In t_kperf, generate a valid ciphertext when testing decryption
authorGreg Hudson <ghudson@mit.edu>
Wed, 2 Dec 2009 18:32:03 +0000 (18:32 +0000)
committerGreg Hudson <ghudson@mit.edu>
Wed, 2 Dec 2009 18:32:03 +0000 (18:32 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23427 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/crypto/crypto_tests/t_kperf.c

index e653996bb172fb4cd5df02015a1fac750267892d..8c36e902f0ac92b09efb60d9ae6cc0475b34af23 100644 (file)
@@ -94,6 +94,14 @@ main(int argc, char **argv)
     sum.length = cklen;
     sum.contents = calloc(1, cklen);
 
+    /*
+     * Decrypting typically involves copying the output after checking the
+     * hash, so we need to create a valid ciphertext to correctly measure its
+     * performance.
+     */
+    if (op == 'd')
+        krb5_c_encrypt(NULL, &kblock, 0, NULL, &block, &outblock);
+
     for (i = 0; i < num_blocks; i++) {
         if (intf == 'c') {
             if (op == 'e')