diff options
author | Greg Hudson <ghudson@mit.edu> | 2009-10-06 16:11:31 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2009-10-06 16:11:31 +0000 |
commit | 14096ef68bce9b8be9397bd302ac85bf3c33d7c4 (patch) | |
tree | eb26f2b4d2ab128821c87859738f6099bb8ba7bd | |
parent | fc49391247f48622214e33f522e90febface0efe (diff) | |
download | krb5-14096ef68bce9b8be9397bd302ac85bf3c33d7c4.zip krb5-14096ef68bce9b8be9397bd302ac85bf3c33d7c4.tar.gz krb5-14096ef68bce9b8be9397bd302ac85bf3c33d7c4.tar.bz2 |
Adjust test programs to match new internal interfaces using krb5_key
git-svn-id: svn://anonsvn.mit.edu/krb5/branches/enc-perf@22858 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r-- | src/lib/crypto/crypto_tests/aes-test.c | 6 | ||||
-rw-r--r-- | src/lib/crypto/crypto_tests/t_cksum.c | 9 | ||||
-rw-r--r-- | src/lib/crypto/crypto_tests/t_hmac.c | 5 |
3 files changed, 15 insertions, 5 deletions
diff --git a/src/lib/crypto/crypto_tests/aes-test.c b/src/lib/crypto/crypto_tests/aes-test.c index c05fd26..8999bd7 100644 --- a/src/lib/crypto/crypto_tests/aes-test.c +++ b/src/lib/crypto/crypto_tests/aes-test.c @@ -50,7 +50,11 @@ static void init() } static void enc() { - krb5int_aes_encrypt(&enc_key, &ivec, &in, &out); + krb5_key key; + + krb5_k_create_key(NULL, &enc_key, &key); + krb5int_aes_encrypt(key, &ivec, &in, &out); + krb5_k_free_key(NULL, key); } static void hexdump(const char *label, const char *cp, int len) diff --git a/src/lib/crypto/crypto_tests/t_cksum.c b/src/lib/crypto/crypto_tests/t_cksum.c index 98187f7..2b53651 100644 --- a/src/lib/crypto/crypto_tests/t_cksum.c +++ b/src/lib/crypto/crypto_tests/t_cksum.c @@ -75,6 +75,7 @@ main(argc, argv) krb5_boolean valid; size_t length; krb5_keyblock keyblock; + krb5_key key; krb5_error_code kret=0; krb5_data plaintext, newstyle_checksum; @@ -89,6 +90,8 @@ main(argc, argv) keyblock.length = sizeof(testkey); keyblock.contents = testkey; + krb5_k_create_key(NULL, &keyblock, &key); + length = khp.hashsize; newstyle_checksum.length = length; @@ -102,13 +105,13 @@ main(argc, argv) plaintext.length = strlen(argv[msgindex]); plaintext.data = argv[msgindex]; - if ((kret = (*(khp.hash))(&keyblock, 0, 0, &plaintext, &newstyle_checksum))) { + if ((kret = (*(khp.hash))(key, 0, 0, &plaintext, &newstyle_checksum))) { printf("krb5_calculate_checksum choked with %d\n", kret); break; } print_checksum("correct", MD, argv[msgindex], &newstyle_checksum); - if ((kret = (*(khp.verify))(&keyblock, 0, 0, &plaintext, &newstyle_checksum, + if ((kret = (*(khp.verify))(key, 0, 0, &plaintext, &newstyle_checksum, &valid))) { printf("verify on new checksum choked with %d\n", kret); break; @@ -120,7 +123,7 @@ main(argc, argv) printf("Verify succeeded for \"%s\"\n", argv[msgindex]); newstyle_checksum.data[0]++; - if ((kret = (*(khp.verify))(&keyblock, 0, 0, &plaintext, &newstyle_checksum, + if ((kret = (*(khp.verify))(key, 0, 0, &plaintext, &newstyle_checksum, &valid))) { printf("verify on new checksum choked with %d\n", kret); break; diff --git a/src/lib/crypto/crypto_tests/t_hmac.c b/src/lib/crypto/crypto_tests/t_hmac.c index bf629c3..30830d6 100644 --- a/src/lib/crypto/crypto_tests/t_hmac.c +++ b/src/lib/crypto/crypto_tests/t_hmac.c @@ -98,6 +98,7 @@ static krb5_error_code hmac1(const struct krb5_hash_provider *h, char tmp[40]; size_t blocksize, hashsize; krb5_error_code err; + krb5_key k; printk(" test key", key); blocksize = h->blocksize; @@ -120,7 +121,9 @@ static krb5_error_code hmac1(const struct krb5_hash_provider *h, printk(" pre-hashed key", key); } printd(" hmac input", in); - err = krb5_hmac(h, key, 1, in, out); + krb5_k_create_key(NULL, key, &k); + err = krb5_hmac(h, k, 1, in, out); + krb5_k_free_key(NULL, k); if (err == 0) printd(" hmac output", out); return err; |