aboutsummaryrefslogtreecommitdiff
path: root/src/lib/crypto/crypto_tests
diff options
context:
space:
mode:
authorTom Yu <tlyu@mit.edu>2009-10-31 00:48:38 +0000
committerTom Yu <tlyu@mit.edu>2009-10-31 00:48:38 +0000
commit02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b (patch)
tree61b9147863cd8be3eff63903dc36cae168254bd5 /src/lib/crypto/crypto_tests
parent162ab371748cba0cc6f172419bd6e71fa04bb878 (diff)
downloadkrb5-02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b.zip
krb5-02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b.tar.gz
krb5-02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b.tar.bz2
make mark-cstyle
make reindent git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23100 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/crypto/crypto_tests')
-rw-r--r--src/lib/crypto/crypto_tests/aes-test.c4
-rw-r--r--src/lib/crypto/crypto_tests/t_crc.c2
-rw-r--r--src/lib/crypto/crypto_tests/t_cts.c4
-rw-r--r--src/lib/crypto/crypto_tests/t_encrypt.c12
-rw-r--r--src/lib/crypto/crypto_tests/t_hmac.c8
-rw-r--r--src/lib/crypto/crypto_tests/t_kperf.c2
-rw-r--r--src/lib/crypto/crypto_tests/t_mddriver.c10
-rw-r--r--src/lib/crypto/crypto_tests/t_nfold.c6
-rw-r--r--src/lib/crypto/crypto_tests/t_pkcs5.c4
-rw-r--r--src/lib/crypto/crypto_tests/t_prf.c8
-rw-r--r--src/lib/crypto/crypto_tests/t_prng.c4
-rw-r--r--src/lib/crypto/crypto_tests/vectors.c4
-rw-r--r--src/lib/crypto/crypto_tests/ytest.c54
13 files changed, 60 insertions, 62 deletions
diff --git a/src/lib/crypto/crypto_tests/aes-test.c b/src/lib/crypto/crypto_tests/aes-test.c
index 8999bd7..3ccacd8 100644
--- a/src/lib/crypto/crypto_tests/aes-test.c
+++ b/src/lib/crypto/crypto_tests/aes-test.c
@@ -8,7 +8,7 @@
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
+ *
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
@@ -22,7 +22,7 @@
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
- *
+ *
*
* Subset of NIST tests for AES; specifically, the variable-key and
* variable-text tests for 128- and 256-bit keys.
diff --git a/src/lib/crypto/crypto_tests/t_crc.c b/src/lib/crypto/crypto_tests/t_crc.c
index e8a353a..cf837f8 100644
--- a/src/lib/crypto/crypto_tests/t_crc.c
+++ b/src/lib/crypto/crypto_tests/t_crc.c
@@ -8,7 +8,7 @@
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
+ *
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
diff --git a/src/lib/crypto/crypto_tests/t_cts.c b/src/lib/crypto/crypto_tests/t_cts.c
index 596ca3b..d948532 100644
--- a/src/lib/crypto/crypto_tests/t_cts.c
+++ b/src/lib/crypto/crypto_tests/t_cts.c
@@ -8,7 +8,7 @@
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
+ *
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
@@ -22,7 +22,7 @@
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
- *
+ *
*
* Test vectors for crypto code, matching data submitted for inclusion
* with RFC1510bis.
diff --git a/src/lib/crypto/crypto_tests/t_encrypt.c b/src/lib/crypto/crypto_tests/t_encrypt.c
index aac31fb..5615bc8 100644
--- a/src/lib/crypto/crypto_tests/t_encrypt.c
+++ b/src/lib/crypto/crypto_tests/t_encrypt.c
@@ -8,7 +8,7 @@
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
+ *
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
@@ -22,11 +22,11 @@
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
- *
+ *
*
* <<< Description >>>
*/
-/*
+/*
* Some black-box tests of crypto systems. Make sure that we can decrypt things we encrypt, etc.
*/
@@ -125,7 +125,7 @@ main ()
enc_out.ciphertext = out;
enc_out2.ciphertext = out2;
- /* We use an intermediate `len' because size_t may be different size
+ /* We use an intermediate `len' because size_t may be different size
than `int' */
krb5_c_encrypt_length (context, keyblock->enctype, in.length, &len);
enc_out.ciphertext.length = len;
@@ -200,7 +200,7 @@ main ()
krb5_c_decrypt_iov(context, keyblock, 7, 0, iov, 5));
test("Comparing results",
compare_results(&in, &iov[1].data));
-
+
/* Try again with opaque-key-using variants. */
test("iov encrypting (k)",
krb5_k_encrypt_iov(context, key, 7, 0, iov, 5));
@@ -261,5 +261,3 @@ main ()
free(check2.data);
return 0;
}
-
-
diff --git a/src/lib/crypto/crypto_tests/t_hmac.c b/src/lib/crypto/crypto_tests/t_hmac.c
index d09adb0..55b47b8 100644
--- a/src/lib/crypto/crypto_tests/t_hmac.c
+++ b/src/lib/crypto/crypto_tests/t_hmac.c
@@ -8,7 +8,7 @@
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
+ *
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
@@ -22,7 +22,7 @@
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
- *
+ *
*
* Test vectors for HMAC-MD5 and HMAC-SHA1 (placeholder only).
* Tests taken from RFC 2202.
@@ -91,7 +91,7 @@ struct hmac_test {
const char *hexdigest;
};
-static krb5_error_code hmac1(const struct krb5_hash_provider *h,
+static krb5_error_code hmac1(const struct krb5_hash_provider *h,
krb5_keyblock *key,
krb5_data *in, krb5_data *out)
{
@@ -223,7 +223,7 @@ static void test_hmac()
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
},
- 73,
+ 73,
"Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
"0x6f630fad67cda0ee1fb1f562db3aa53e"
},
diff --git a/src/lib/crypto/crypto_tests/t_kperf.c b/src/lib/crypto/crypto_tests/t_kperf.c
index f56aa3c..4c99d72 100644
--- a/src/lib/crypto/crypto_tests/t_kperf.c
+++ b/src/lib/crypto/crypto_tests/t_kperf.c
@@ -9,7 +9,7 @@
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
+ *
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
diff --git a/src/lib/crypto/crypto_tests/t_mddriver.c b/src/lib/crypto/crypto_tests/t_mddriver.c
index 2c0210c..3fab847 100644
--- a/src/lib/crypto/crypto_tests/t_mddriver.c
+++ b/src/lib/crypto/crypto_tests/t_mddriver.c
@@ -117,7 +117,7 @@ struct md_test_entry md_test_suite[] = {
{ "abcdefghijklmnopqrstuvwxyz",
{0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00,
0x7d, 0xfb, 0x49, 0x6c, 0xca, 0x67, 0xe1, 0x3b }},
- { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
+ { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
{0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5,
0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f }},
{ "12345678901234567890123456789012345678901234567890123456789012345678901234567890",
@@ -125,7 +125,7 @@ struct md_test_entry md_test_suite[] = {
0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a }},
{ 0, {0} }
};
-
+
#endif
/* Main driver.
@@ -185,7 +185,7 @@ static void MDTimeTrial ()
time_t endTime, startTime;
unsigned char block[TEST_BLOCK_LEN];
unsigned int i;
-
+
printf("MD%d time trial. Digesting %d %d-byte blocks ...", MD,
TEST_BLOCK_LEN, TEST_BLOCK_COUNT);
@@ -222,7 +222,7 @@ static void MDTestSuite ()
MD_CTX context;
struct md_test_entry *entry;
int i, num_tests = 0, num_failed = 0;
-
+
printf ("MD%d test suite:\n\n", MD);
for (entry = md_test_suite; entry->string; entry++) {
unsigned int len = strlen (entry->string);
@@ -254,7 +254,7 @@ static void MDTestSuite ()
exit(0);
}
#else
-
+
printf ("MD%d test suite:\n", MD);
MDString ("");
MDString ("a");
diff --git a/src/lib/crypto/crypto_tests/t_nfold.c b/src/lib/crypto/crypto_tests/t_nfold.c
index 2b5b0e3..27a5760 100644
--- a/src/lib/crypto/crypto_tests/t_nfold.c
+++ b/src/lib/crypto/crypto_tests/t_nfold.c
@@ -8,7 +8,7 @@
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
+ *
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
@@ -22,7 +22,7 @@
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
- *
+ *
*
* Program to test the correctness of nfold implementation.
*
@@ -139,7 +139,7 @@ main(argc, argv)
printf("N-fold\n");
for (i=0; i<sizeof(nfold_in)/sizeof(char *); i++) {
- printf("\tInput:\t\"%.*s\"\n", (int) strlen((char *) nfold_in[i]),
+ printf("\tInput:\t\"%.*s\"\n", (int) strlen((char *) nfold_in[i]),
nfold_in[i]);
printf("\t192-Fold:\t");
krb5int_nfold(strlen((char *) nfold_in[i])*8, nfold_in[i], 24*8,
diff --git a/src/lib/crypto/crypto_tests/t_pkcs5.c b/src/lib/crypto/crypto_tests/t_pkcs5.c
index fa1f43d..2d58b50 100644
--- a/src/lib/crypto/crypto_tests/t_pkcs5.c
+++ b/src/lib/crypto/crypto_tests/t_pkcs5.c
@@ -8,7 +8,7 @@
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
+ *
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
@@ -22,7 +22,7 @@
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
- *
+ *
*
* Test vectors for PBKDF2 (from PKCS #5v2), based on RFC 3211.
*/
diff --git a/src/lib/crypto/crypto_tests/t_prf.c b/src/lib/crypto/crypto_tests/t_prf.c
index ac244eb..c8825d0 100644
--- a/src/lib/crypto/crypto_tests/t_prf.c
+++ b/src/lib/crypto/crypto_tests/t_prf.c
@@ -8,7 +8,7 @@
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
+ *
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
@@ -22,7 +22,7 @@
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
- *
+ *
* This file contains tests for the PRF code in Kerberos. IT reads an
* input file, and writes an output file. It is assumed that the
* output file will be diffed against expected output to see whether
@@ -55,7 +55,7 @@ int main () {
input.data = &s[0];
input.length = strlen(s);
assert(krb5_c_string_to_key (0, enctype, &input, &input, key) == 0);
-
+
if (scanf("%u", &in_length) == EOF)
break;
@@ -71,7 +71,7 @@ int main () {
assert (output.data = malloc(prfsz));
output.length = prfsz;
assert (krb5_c_prf(0, key, &input, &output) == 0);
-
+
free (input.data);
input.data = NULL;
}
diff --git a/src/lib/crypto/crypto_tests/t_prng.c b/src/lib/crypto/crypto_tests/t_prng.c
index 7df743b..2555e89 100644
--- a/src/lib/crypto/crypto_tests/t_prng.c
+++ b/src/lib/crypto/crypto_tests/t_prng.c
@@ -8,7 +8,7 @@
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
+ *
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
@@ -22,7 +22,7 @@
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
- *
+ *
* This file contains tests for the PRNG code in Kerberos. It reads
* an input file, and writes an output file. It is assumed that the
* output file will be diffed against expected output to see whether
diff --git a/src/lib/crypto/crypto_tests/vectors.c b/src/lib/crypto/crypto_tests/vectors.c
index 6723544..a6301ed 100644
--- a/src/lib/crypto/crypto_tests/vectors.c
+++ b/src/lib/crypto/crypto_tests/vectors.c
@@ -8,7 +8,7 @@
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
- *
+ *
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
@@ -22,7 +22,7 @@
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
- *
+ *
*
* Test vectors for crypto code, matching data submitted for inclusion
* with RFC1510bis.
diff --git a/src/lib/crypto/crypto_tests/ytest.c b/src/lib/crypto/crypto_tests/ytest.c
index 93fb5f2..82e2eba 100644
--- a/src/lib/crypto/crypto_tests/ytest.c
+++ b/src/lib/crypto/crypto_tests/ytest.c
@@ -28,8 +28,8 @@ static void print_yarrow_status( Yarrow_CTX *y )
for ( sid = 0; sid < y->num_sources; sid++ )
{
source = &y->source[ sid ];
- printf( "#%d=%d/%d, ", sid, source->entropy[pool],
- pool == YARROW_SLOW_POOL ?
+ printf( "#%d=%d/%d, ", sid, source->entropy[pool],
+ pool == YARROW_SLOW_POOL ?
y->slow_thresh : y->fast_thresh );
}
}
@@ -44,8 +44,8 @@ int Instrumented_krb5int_yarrow_input( Yarrow_CTX* y, int sid, void* sample,
{
int ret;
- VERBOSE( printf( "krb5int_yarrow_input( #%d, %d bits, %s ) = [", sid, entropy,
- y->source[sid].pool ==
+ VERBOSE( printf( "krb5int_yarrow_input( #%d, %d bits, %s ) = [", sid, entropy,
+ y->source[sid].pool ==
YARROW_SLOW_POOL ? "slow" : "fast" ); );
ret = krb5int_yarrow_input( y, sid, sample, size, entropy );
@@ -95,15 +95,15 @@ int main( int argc, char* argv[] )
int done_some_tests = 0;
int i;
int ret;
-
+
for ( argvp = argv+1, i = 1; i < argc; i++, argvp++ )
{
arg = *argvp;
- if ( arg[0] == '-' )
+ if ( arg[0] == '-' )
{
switch ( arg[1] )
{
- case 'v': yarrow_verbose = 1; continue;
+ case 'v': yarrow_verbose = 1; continue;
default: fprintf( stderr, "usage: test [-v] [[test] ... ]\n" );
THROW( YARROW_FAIL );
}
@@ -193,7 +193,7 @@ int test_3( void )
VERBOSE( printf( "\nkrb5int_yarrow_stretch\n\n" ); );
THROW( YARROW_NOT_IMPL );
-
+
CATCH:
EXCEP_RET;
}
@@ -232,18 +232,18 @@ int test_4( void )
VERBOSE( printf( "krb5int_yarrow_new_source() = [%s]\n",
krb5int_yarrow_str_error( ret ) ); );
if ( ret != YARROW_OK ) { THROW( ret ); }
-
+
VERBOSE( printf( "Yarrow_Poll( #%d ) = [", user ); );
ret = Yarrow_Poll( &yarrow, user );
VERBOSE( printf( "%s]\n", krb5int_yarrow_str_error( ret ) ); );
ret = krb5int_yarrow_new_source( &yarrow, &mouse );
- VERBOSE( printf( "krb5int_yarrow_new_source() = [%s]\n",
+ VERBOSE( printf( "krb5int_yarrow_new_source() = [%s]\n",
krb5int_yarrow_str_error( ret ) ); );
if ( ret != YARROW_OK ) { THROW( ret ); }
ret = krb5int_yarrow_new_source( &yarrow, &keyboard );
- VERBOSE( printf( "krb5int_yarrow_new_source() = [%s]\n",
+ VERBOSE( printf( "krb5int_yarrow_new_source() = [%s]\n",
krb5int_yarrow_str_error( ret ) ); );
if ( ret != YARROW_OK ) { THROW( ret ); }
@@ -255,22 +255,22 @@ int test_4( void )
ret = krb5int_yarrow_output( &yarrow, random, sizeof( random ) );
VERBOSE( printf( "%s]\n", krb5int_yarrow_str_error( ret ) ); );
-/* do it twice so that we some slow samples
+/* do it twice so that we some slow samples
* (first sample goes to fast pool, and then samples alternate)
*/
for ( i = 0; i < 2; i++ )
{
- TRY( Instrumented_krb5int_yarrow_input( &yarrow, mouse, mouse_sample,
+ TRY( Instrumented_krb5int_yarrow_input( &yarrow, mouse, mouse_sample,
sizeof( mouse_sample ), 2 ) );
-
- TRY( Instrumented_krb5int_yarrow_input( &yarrow, keyboard, keyboard_sample,
+
+ TRY( Instrumented_krb5int_yarrow_input( &yarrow, keyboard, keyboard_sample,
sizeof( keyboard_sample ), 2 ) );
- TRY( Instrumented_krb5int_yarrow_input( &yarrow, user, user_sample,
+ TRY( Instrumented_krb5int_yarrow_input( &yarrow, user, user_sample,
sizeof( user_sample ), 2 ) );
}
-
+
#if defined( YARROW_DEBUG )
dump_yarrow_state( stdout, &yarrow );
#endif
@@ -282,8 +282,8 @@ int test_4( void )
for ( i = 0; i < 7; i++ )
{
- TRY( Instrumented_krb5int_yarrow_input( &yarrow, user, user_sample,
- sizeof( user_sample ),
+ TRY( Instrumented_krb5int_yarrow_input( &yarrow, user, user_sample,
+ sizeof( user_sample ),
sizeof( user_sample ) * 3 ) );
}
@@ -295,8 +295,8 @@ int test_4( void )
for ( i = 0; i < 40; i++ )
{
- TRY( Instrumented_krb5int_yarrow_input( &yarrow, mouse, mouse_sample,
- sizeof( mouse_sample ),
+ TRY( Instrumented_krb5int_yarrow_input( &yarrow, mouse, mouse_sample,
+ sizeof( mouse_sample ),
sizeof( mouse_sample )*2 ) );
}
@@ -320,20 +320,20 @@ int test_4( void )
if ( i % 16 == 0 )
{
- TRY( Instrumented_krb5int_yarrow_input( &yarrow, mouse, junk,
- sizeof( junk ),
+ TRY( Instrumented_krb5int_yarrow_input( &yarrow, mouse, junk,
+ sizeof( junk ),
sizeof( junk ) * 3 ) );
}
else
{
- TRY( Instrumented_krb5int_yarrow_input( &yarrow, user, junk,
- sizeof( junk ),
+ TRY( Instrumented_krb5int_yarrow_input( &yarrow, user, junk,
+ sizeof( junk ),
sizeof( junk ) * 3 ) );
}
}
VERBOSE( printf( "\nPrint some random output\n\n" ); );
-
+
VERBOSE( printf( "krb5int_yarrow_output( %d ) = [", sizeof( random ) ); );
ret = krb5int_yarrow_output( &yarrow, random, sizeof( random ) );
VERBOSE( printf( "%s]\n", krb5int_yarrow_str_error( ret ) ); );
@@ -365,7 +365,7 @@ void hex_print( FILE* f, const char* var, void* data, size_t size )
size_t i;
char* p = (char*) data;
char c, d;
-
+
fprintf( f, var );
fprintf( f, " = " );
for ( i = 0; i < size; i++ )