components/openssl/openssl-1.0.1/patches/32_aes_cbc_len_check.patch
branchs11-update
changeset 4006 c737cefdce54
parent 2717 da0ef75be98f
equal deleted inserted replaced
4005:4bcc81bdda4e 4006:c737cefdce54
       
     1 #
       
     2 # This was developed in house and reported to the upstream.
       
     3 #
     1 --- openssl-1.0.1e/crypto/evp/e_aes.c        Tue Jul  2 11:03:12 2013
     4 --- openssl-1.0.1e/crypto/evp/e_aes.c        Tue Jul  2 11:03:12 2013
     2 +++ openssl-1.0.1e/crypto/evp/e_aes.c.new    Tue Jul  2 11:04:56 2013
     5 +++ openssl-1.0.1e/crypto/evp/e_aes.c.new    Tue Jul  2 11:04:56 2013
     3 @@ -574,8 +574,11 @@
     6 @@ -536,8 +536,12 @@
     4  static int aes_cbc_cipher(EVP_CIPHER_CTX *ctx,unsigned char *out,
     7  static int aes_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
     5  	const unsigned char *in, size_t len)
     8                            const unsigned char *in, size_t len)
     6  {
     9  {
     7 +	size_t	bl = ctx->cipher->block_size;
    10 +    size_t	bl = ctx->cipher->block_size;
     8  	EVP_AES_KEY *dat = (EVP_AES_KEY *)ctx->cipher_data;
    11      EVP_AES_KEY *dat = (EVP_AES_KEY *) ctx->cipher_data;
     9  
    12  
    10 +	if (len<bl)	return 1;
    13 +    if (len < bl)
       
    14 +        return 1;
    11 +
    15 +
    12  	if (dat->stream.cbc)
    16      if (dat->stream.cbc)
    13  		(*dat->stream.cbc)(in,out,len,&dat->ks,ctx->iv,ctx->encrypt);
    17          (*dat->stream.cbc) (in, out, len, &dat->ks, ctx->iv, ctx->encrypt);
    14  	else if (ctx->encrypt)
    18      else if (ctx->encrypt)