svn rev #23397: trunk/src/lib/crypto/krb/dk/

ghudson@MIT.EDU ghudson at MIT.EDU
Mon Nov 30 20:36:42 EST 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=23397
Commit By: ghudson
Log Message:
ticket: 6589
subject: Fix AES IOV decryption of small messages
tags: pullup
target_version: 1.7.1

AES messages never need to be padded because the confounder ensures
that the plaintext is at least one block long.  Remove a check in
krb5int_dk_decrypt_iov which was rejecting short AES messages because
it didn't count the header length.



Changed Files:
U   trunk/src/lib/crypto/krb/dk/dk_aead.c
Modified: trunk/src/lib/crypto/krb/dk/dk_aead.c
===================================================================
--- trunk/src/lib/crypto/krb/dk/dk_aead.c	2009-12-01 01:32:02 UTC (rev 23396)
+++ trunk/src/lib/crypto/krb/dk/dk_aead.c	2009-12-01 01:36:42 UTC (rev 23397)
@@ -216,21 +216,16 @@
     if (ret != 0)
         return ret;
 
-    for (i = 0; i < num_data; i++) {
-        const krb5_crypto_iov *iov = &data[i];
+    if (blocksize != 0) {
+        /* Check that the input data is correctly padded. */
+        for (i = 0; i < num_data; i++) {
+            const krb5_crypto_iov *iov = &data[i];
 
-        if (ENCRYPT_DATA_IOV(iov))
-            cipherlen += iov->data.length;
-    }
-
-    if (blocksize == 0) {
-        /* Check for correct input length in CTS mode */
-        if (enc->block_size != 0 && cipherlen < enc->block_size)
+            if (ENCRYPT_DATA_IOV(iov))
+                cipherlen += iov->data.length;
+        }
+        if (cipherlen % blocksize != 0)
             return KRB5_BAD_MSIZE;
-    } else {
-        /* Check that the input data is correctly padded */
-        if ((cipherlen % blocksize) != 0)
-            return KRB5_BAD_MSIZE;
     }
 
     /* Validate header and trailer lengths */




More information about the cvs-krb5 mailing list