summaryrefslogtreecommitdiffstats
path: root/src/lib/crypto/crypto_tests
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2012-10-09 14:27:04 -0400
committerGreg Hudson <ghudson@mit.edu>2012-10-09 14:27:04 -0400
commit01f30a7f06110f54c5d69fdd7697347c102f5274 (patch)
treed7103da14e3d895f6c2629647daa3fdde0641759 /src/lib/crypto/crypto_tests
parentfd136728de5b603974e3ec21bc5856406c4e814d (diff)
downloadkrb5-01f30a7f06110f54c5d69fdd7697347c102f5274.tar.gz
krb5-01f30a7f06110f54c5d69fdd7697347c102f5274.tar.xz
krb5-01f30a7f06110f54c5d69fdd7697347c102f5274.zip
De-conditionalize Camellia code
The Camellia enctypes and cksumtypes have received IANA assignments. Add #defines using those assignments to krb5.h, remove the CAMELLIA conditional, and enable testing code as appropriate. The Camellia draft has not received an RFC number yet, so there is no Doxygen markup for the enctype and cksumtype #defines. That can be added once the RFC number is known.
Diffstat (limited to 'src/lib/crypto/crypto_tests')
-rw-r--r--src/lib/crypto/crypto_tests/Makefile.in3
-rw-r--r--src/lib/crypto/crypto_tests/camellia-test.c8
-rw-r--r--src/lib/crypto/crypto_tests/t_cksums.c2
-rw-r--r--src/lib/crypto/crypto_tests/t_cmac.c6
-rw-r--r--src/lib/crypto/crypto_tests/t_decrypt.c4
-rw-r--r--src/lib/crypto/crypto_tests/t_derive.c4
-rw-r--r--src/lib/crypto/crypto_tests/t_encrypt.c2
-rw-r--r--src/lib/crypto/crypto_tests/t_short.c2
-rw-r--r--src/lib/crypto/crypto_tests/t_str2key.c2
9 files changed, 2 insertions, 31 deletions
diff --git a/src/lib/crypto/crypto_tests/Makefile.in b/src/lib/crypto/crypto_tests/Makefile.in
index 5aeef54a6e..58e1c48109 100644
--- a/src/lib/crypto/crypto_tests/Makefile.in
+++ b/src/lib/crypto/crypto_tests/Makefile.in
@@ -59,8 +59,7 @@ check-unix:: t_nfold t_encrypt t_decrypt t_prf t_prng t_cmac t_hmac \
$(RUN_SETUP) $(VALGRIND) ./aes-test > vt.txt
cmp vt.txt $(srcdir)/expect-vt.txt
$(RUN_SETUP) $(VALGRIND) ./camellia-test > camellia-vt.txt
-# Enable this when Camellia becomes unconditional.
-# cmp camellia-vt.txt $(srcdir)/camellia-expect-vt.txt
+ cmp camellia-vt.txt $(srcdir)/camellia-expect-vt.txt
$(RUN_SETUP) $(VALGRIND) $(C)t_mddriver4 -x
$(RUN_SETUP) $(VALGRIND) $(C)t_mddriver -x
$(RUN_SETUP) $(VALGRIND) ./t_short
diff --git a/src/lib/crypto/crypto_tests/camellia-test.c b/src/lib/crypto/crypto_tests/camellia-test.c
index 9975d4d261..73ef2caa43 100644
--- a/src/lib/crypto/crypto_tests/camellia-test.c
+++ b/src/lib/crypto/crypto_tests/camellia-test.c
@@ -28,9 +28,7 @@
*/
#include <stdio.h>
-#include "k5-int.h"
-
-#ifdef CAMELLIA
+#include "crypto_int.h"
static char key[32];
static char plain[16], cipher[16], zero[16];
@@ -124,11 +122,8 @@ static void vt_test()
vt_test_1(32);
}
-#endif /* CAMELLIA */
-
int main (int argc, char *argv[])
{
-#ifdef CAMELLIA
if (argc > 2 || (argc == 2 && strcmp(argv[1], "-k"))) {
fprintf(stderr,
"usage:\t%s -k\tfor variable-key tests\n"
@@ -141,6 +136,5 @@ int main (int argc, char *argv[])
vk_test();
else
vt_test();
-#endif /* CAMELLIA */
return 0;
}
diff --git a/src/lib/crypto/crypto_tests/t_cksums.c b/src/lib/crypto/crypto_tests/t_cksums.c
index ee089eebda..c0694a1c0d 100644
--- a/src/lib/crypto/crypto_tests/t_cksums.c
+++ b/src/lib/crypto/crypto_tests/t_cksums.c
@@ -108,7 +108,6 @@ struct test {
{ KV5M_DATA, 16,
"\xEB\x38\xCC\x97\xE2\x23\x0F\x59\xDA\x41\x17\xDC\x58\x59\xD7\xEC" }
},
-#ifdef CAMELLIA
{
"abcdefghijk",
CKSUMTYPE_CMAC_CAMELLIA128, ENCTYPE_CAMELLIA128_CTS_CMAC, 7,
@@ -143,7 +142,6 @@ struct test {
{ KV5M_DATA, 16,
"\x3F\xA0\xB4\x23\x55\xE5\x2B\x18\x91\x87\x29\x4A\xA2\x52\xAB\x64" }
},
-#endif
};
static void
diff --git a/src/lib/crypto/crypto_tests/t_cmac.c b/src/lib/crypto/crypto_tests/t_cmac.c
index 7a4b3aeee9..7a95e437aa 100644
--- a/src/lib/crypto/crypto_tests/t_cmac.c
+++ b/src/lib/crypto/crypto_tests/t_cmac.c
@@ -40,8 +40,6 @@
#include "crypto_int.h"
-#ifdef CAMELLIA
-
/* All examples use the following Camellia-128 key. */
static unsigned char keybytes[] = {
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
@@ -98,12 +96,9 @@ check_result(const char *name, const unsigned char *result,
}
}
-#endif /* CAMELLIA */
-
int
main(int argc, char **argv)
{
-#ifdef CAMELLIA
krb5_context context = NULL;
krb5_keyblock keyblock;
krb5_key key;
@@ -142,6 +137,5 @@ main(int argc, char **argv)
printf("All CMAC tests passed.\n");
krb5_k_free_key(context, key);
-#endif /* CAMELLIA */
return 0;
}
diff --git a/src/lib/crypto/crypto_tests/t_decrypt.c b/src/lib/crypto/crypto_tests/t_decrypt.c
index 34486c8655..9db60a1f25 100644
--- a/src/lib/crypto/crypto_tests/t_decrypt.c
+++ b/src/lib/crypto/crypto_tests/t_decrypt.c
@@ -445,7 +445,6 @@ struct test {
"\xB7\x34\xD4\xD4\x98\xB6\x71\x4F\x1C\x1D" }
},
-#ifdef CAMELLIA
{
ENCTYPE_CAMELLIA128_CTS_CMAC,
"", 0,
@@ -552,7 +551,6 @@ struct test {
"\xF3\x4A\xD1\x25\x5A\x34\x49\x99\xAD\x37\x14\x68\x87\xA6\xC6\x84"
"\x57\x31\xAC\x7F\x46\x37\x6A\x05\x04\xCD\x06\x57\x14\x74" }
},
-#endif
};
static void
@@ -585,10 +583,8 @@ enctypes[] = {
ENCTYPE_ARCFOUR_HMAC_EXP,
ENCTYPE_AES128_CTS_HMAC_SHA1_96,
ENCTYPE_AES256_CTS_HMAC_SHA1_96,
-#ifdef CAMELLIA
ENCTYPE_CAMELLIA128_CTS_CMAC,
ENCTYPE_CAMELLIA256_CTS_CMAC
-#endif
};
static char *plaintexts[] = {
diff --git a/src/lib/crypto/crypto_tests/t_derive.c b/src/lib/crypto/crypto_tests/t_derive.c
index 5f4c04ae65..0f34b00ed4 100644
--- a/src/lib/crypto/crypto_tests/t_derive.c
+++ b/src/lib/crypto/crypto_tests/t_derive.c
@@ -137,7 +137,6 @@ struct test {
"\xD7\xBB\xA9\x07\x76\xD8\x12\x6D\x91\xF3\x4F\x31\x01\xAE\xA8\xBA" }
},
-#ifdef CAMELLIA
/* Kc, Ke, Ki for a Camellia-128 key */
{
ENCTYPE_CAMELLIA128_CTS_CMAC,
@@ -201,7 +200,6 @@ struct test {
"\xFA\x62\x4F\xA0\xE5\x23\x99\x3F\xA3\x88\xAE\xFD\xC6\x7E\x67\xEB"
"\xCD\x8C\x08\xE8\xA0\x24\x6B\x1D\x73\xB0\xD1\xDD\x9F\xC5\x82\xB0" }
},
-#endif
};
static void
@@ -231,10 +229,8 @@ get_enc_provider(krb5_enctype enctype)
case ENCTYPE_DES3_CBC_SHA1: return &krb5int_enc_des3;
case ENCTYPE_AES128_CTS_HMAC_SHA1_96: return &krb5int_enc_aes128;
case ENCTYPE_AES256_CTS_HMAC_SHA1_96: return &krb5int_enc_aes256;
-#ifdef CAMELLIA
case ENCTYPE_CAMELLIA128_CTS_CMAC: return &krb5int_enc_camellia128;
case ENCTYPE_CAMELLIA256_CTS_CMAC: return &krb5int_enc_camellia256;
-#endif
}
abort();
}
diff --git a/src/lib/crypto/crypto_tests/t_encrypt.c b/src/lib/crypto/crypto_tests/t_encrypt.c
index 580120b8fb..1ac375e497 100644
--- a/src/lib/crypto/crypto_tests/t_encrypt.c
+++ b/src/lib/crypto/crypto_tests/t_encrypt.c
@@ -45,10 +45,8 @@ krb5_enctype interesting_enctypes[] = {
ENCTYPE_ARCFOUR_HMAC_EXP,
ENCTYPE_AES256_CTS_HMAC_SHA1_96,
ENCTYPE_AES128_CTS_HMAC_SHA1_96,
-#ifdef CAMELLIA
ENCTYPE_CAMELLIA128_CTS_CMAC,
ENCTYPE_CAMELLIA256_CTS_CMAC,
-#endif
0
};
diff --git a/src/lib/crypto/crypto_tests/t_short.c b/src/lib/crypto/crypto_tests/t_short.c
index 295206651a..6ee7b1987a 100644
--- a/src/lib/crypto/crypto_tests/t_short.c
+++ b/src/lib/crypto/crypto_tests/t_short.c
@@ -42,10 +42,8 @@ krb5_enctype interesting_enctypes[] = {
ENCTYPE_ARCFOUR_HMAC_EXP,
ENCTYPE_AES256_CTS_HMAC_SHA1_96,
ENCTYPE_AES128_CTS_HMAC_SHA1_96,
-#ifdef CAMELLIA
ENCTYPE_CAMELLIA128_CTS_CMAC,
ENCTYPE_CAMELLIA256_CTS_CMAC,
-#endif
0
};
diff --git a/src/lib/crypto/crypto_tests/t_str2key.c b/src/lib/crypto/crypto_tests/t_str2key.c
index fe58bd11c3..e9b29ba67f 100644
--- a/src/lib/crypto/crypto_tests/t_str2key.c
+++ b/src/lib/crypto/crypto_tests/t_str2key.c
@@ -410,7 +410,6 @@ struct test {
"\x57\x18\x48\xB7\x84\xA3\xD6\xBD\xC3\x46\x58\x9A\x3E\x39\x3F\x9E" }
},
-#ifdef CAMELLIA
/* The same inputs applied to Camellia enctypes. */
{
ENCTYPE_CAMELLIA128_CTS_CMAC,
@@ -531,7 +530,6 @@ struct test {
"\x16\x3B\x76\x8C\x6D\xB1\x48\xB4\xEE\xC7\x16\x3D\xF5\xAE\xD7\x0E"
"\x20\x6B\x68\xCE\xC0\x78\xBC\x06\x9E\xD6\x8A\x7E\xD3\x6B\x1E\xCC" }
}
-#endif /* CAMELLIA */
};
static void