]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
krb5kdf.c.in: Check the key size before applying the key
authorTomas Mraz <tomas@openssl.org>
Thu, 25 Sep 2025 12:19:22 +0000 (14:19 +0200)
committerNeil Horman <nhorman@openssl.org>
Fri, 26 Sep 2025 16:55:18 +0000 (12:55 -0400)
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28663)

(cherry picked from commit 3addc8bb3a8e62e701d44ae849437f97940632cd)

providers/implementations/kdfs/krb5kdf.c

index 8516a3f824af674fbe0e4c5e7a3f4f13c5ccfbea..04a0b67ebdd7eed3f17b695181d176a2b902ab61 100644 (file)
@@ -329,7 +329,7 @@ static int cipher_init(EVP_CIPHER_CTX *ctx,
 {
     int klen, ret;
 
-    ret = EVP_EncryptInit_ex(ctx, cipher, engine, key, NULL);
+    ret = EVP_EncryptInit_ex(ctx, cipher, engine, NULL, NULL);
     if (!ret)
         goto out;
     /* set the key len for the odd variable key len cipher */
@@ -341,6 +341,9 @@ static int cipher_init(EVP_CIPHER_CTX *ctx,
             goto out;
         }
     }
+    ret = EVP_EncryptInit_ex(ctx, NULL, NULL, key, NULL);
+    if (!ret)
+        goto out;
     /* we never want padding, either the length requested is a multiple of
      * the cipher block size or we are passed a cipher that can cope with
      * partial blocks via techniques like cipher text stealing */