components/openssl/common/patches/032-aes_cbc_len_check.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Thu, 24 Sep 2015 23:16:46 -0700
changeset 4905 9567ece93afb
parent 4822 1fb8a14c6702
permissions -rw-r--r--
Added tag s12-84 for changeset 4f05d46b7e44

#
# This was developed in house and reported to the upstream.
#
--- openssl-1.0.1e/crypto/evp/e_aes.c        Tue Jul  2 11:03:12 2013
+++ openssl-1.0.1e/crypto/evp/e_aes.c.new    Tue Jul  2 11:04:56 2013
@@ -1016,8 +1016,12 @@
 static int aes_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
                           const unsigned char *in, size_t len)
 {
+    size_t	bl = ctx->cipher->block_size;
     EVP_AES_KEY *dat = (EVP_AES_KEY *) ctx->cipher_data;
 
+    if (len < bl)
+        return 1;
+
     if (dat->stream.cbc)
         (*dat->stream.cbc) (in, out, len, &dat->ks, ctx->iv, ctx->encrypt);
     else if (ctx->encrypt)