Skip to content

Commit 47c113e

Browse files
kroeckxandi34
authored andcommitted
Check that we have enough padding characters.
Reviewed-by: Emilia Käsper <emilia@openssl.org> CVE-2016-2107 MR: #2572 (cherry-picked from commit 4159f311671cf3bac03815e5de44681eb758304a) Bug: 28550804 Change-Id: Ia43cfe32f8930112eb38dbef614c96db43b30c27
1 parent 18b642b commit 47c113e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

crypto/evp/e_aes_cbc_hmac_sha1.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
#include <openssl/aes.h>
6060
#include <openssl/sha.h>
6161
#include "evp_locl.h"
62+
#include "constant_time_locl.h"
6263

6364
#ifndef EVP_CIPH_FLAG_AEAD_CIPHER
6465
#define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000
@@ -278,6 +279,8 @@ static int aesni_cbc_hmac_sha1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
278279
maxpad |= (255-maxpad)>>(sizeof(maxpad)*8-8);
279280
maxpad &= 255;
280281

282+
ret &= constant_time_ge(maxpad, pad);
283+
281284
inp_len = len - (SHA_DIGEST_LENGTH+pad+1);
282285
mask = (0-((inp_len-len)>>(sizeof(inp_len)*8-1)));
283286
inp_len &= mask;

0 commit comments

Comments
 (0)