]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Adjust test programs to match new internal interfaces using krb5_key
authorGreg Hudson <ghudson@mit.edu>
Tue, 6 Oct 2009 16:11:31 +0000 (16:11 +0000)
committerGreg Hudson <ghudson@mit.edu>
Tue, 6 Oct 2009 16:11:31 +0000 (16:11 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/branches/enc-perf@22858 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/crypto/crypto_tests/aes-test.c
src/lib/crypto/crypto_tests/t_cksum.c
src/lib/crypto/crypto_tests/t_hmac.c

index c05fd26e3c5808360adb5926f5e4f49515479f49..8999bd7578b423a451f7295e51998d0d2eff35f2 100644 (file)
@@ -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)
index 98187f7f162ccd780c8f9781c7a6987415bb9677..2b5365119789f79810148f37329442336f06b42e 100644 (file)
@@ -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;
index bf629c359fdad676f64d8cde51af908ab749a142..30830d617382a659d01639f335bbd859e78ba138 100644 (file)
@@ -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;