mirror of
https://github.com/openssl/openssl.git
synced 2024-11-27 05:21:51 +08:00
Check that we have enough padding characters.
Reviewed-by: Emilia Käsper <emilia@openssl.org> CVE-2016-2107 MR: #2572
This commit is contained in:
parent
2c7fe4dc9a
commit
70428eada9
@ -59,6 +59,7 @@
|
||||
#include <openssl/rand.h>
|
||||
#include "modes_lcl.h"
|
||||
#include "internal/evp_int.h"
|
||||
#include "internal/constant_time_locl.h"
|
||||
|
||||
#ifndef EVP_CIPH_FLAG_AEAD_CIPHER
|
||||
# define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000
|
||||
@ -583,6 +584,8 @@ static int aesni_cbc_hmac_sha1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
maxpad |= (255 - maxpad) >> (sizeof(maxpad) * 8 - 8);
|
||||
maxpad &= 255;
|
||||
|
||||
ret &= constant_time_ge(maxpad, pad);
|
||||
|
||||
inp_len = len - (SHA_DIGEST_LENGTH + pad + 1);
|
||||
mask = (0 - ((inp_len - len) >> (sizeof(inp_len) * 8 - 1)));
|
||||
inp_len &= mask;
|
||||
|
@ -59,6 +59,7 @@
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/rand.h>
|
||||
#include "modes_lcl.h"
|
||||
#include "internal/constant_time_locl.h"
|
||||
#include "internal/evp_int.h"
|
||||
|
||||
#ifndef EVP_CIPH_FLAG_AEAD_CIPHER
|
||||
@ -594,6 +595,8 @@ static int aesni_cbc_hmac_sha256_cipher(EVP_CIPHER_CTX *ctx,
|
||||
maxpad |= (255 - maxpad) >> (sizeof(maxpad) * 8 - 8);
|
||||
maxpad &= 255;
|
||||
|
||||
ret &= constant_time_ge(maxpad, pad);
|
||||
|
||||
inp_len = len - (SHA256_DIGEST_LENGTH + pad + 1);
|
||||
mask = (0 - ((inp_len - len) >> (sizeof(inp_len) * 8 - 1)));
|
||||
inp_len &= mask;
|
||||
|
Loading…
Reference in New Issue
Block a user