summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c5
-rw-r--r--src/lib/libssl/src/crypto/evp/e_aes_cbc_hmac_sha1.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c b/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c
index 42aa20701b..8574823aed 100644
--- a/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c
+++ b/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_aes_cbc_hmac_sha1.c,v 1.11 2016/05/04 14:53:29 tedu Exp $ */ 1/* $OpenBSD: e_aes_cbc_hmac_sha1.c,v 1.12 2016/05/04 15:01:33 tedu Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2011-2013 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2011-2013 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -60,6 +60,7 @@
60#include <openssl/aes.h> 60#include <openssl/aes.h>
61#include <openssl/sha.h> 61#include <openssl/sha.h>
62#include "evp_locl.h" 62#include "evp_locl.h"
63#include "constant_time_locl.h"
63 64
64#ifndef EVP_CIPH_FLAG_AEAD_CIPHER 65#ifndef EVP_CIPH_FLAG_AEAD_CIPHER
65#define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000 66#define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000
@@ -282,6 +283,8 @@ aesni_cbc_hmac_sha1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
282 maxpad |= (255 - maxpad) >> (sizeof(maxpad) * 8 - 8); 283 maxpad |= (255 - maxpad) >> (sizeof(maxpad) * 8 - 8);
283 maxpad &= 255; 284 maxpad &= 255;
284 285
286 ret &= constant_time_ge(maxpad, pad);
287
285 inp_len = len - (SHA_DIGEST_LENGTH + pad + 1); 288 inp_len = len - (SHA_DIGEST_LENGTH + pad + 1);
286 mask = (0 - ((inp_len - len) >> 289 mask = (0 - ((inp_len - len) >>
287 (sizeof(inp_len) * 8 - 1))); 290 (sizeof(inp_len) * 8 - 1)));
diff --git a/src/lib/libssl/src/crypto/evp/e_aes_cbc_hmac_sha1.c b/src/lib/libssl/src/crypto/evp/e_aes_cbc_hmac_sha1.c
index 42aa20701b..8574823aed 100644
--- a/src/lib/libssl/src/crypto/evp/e_aes_cbc_hmac_sha1.c
+++ b/src/lib/libssl/src/crypto/evp/e_aes_cbc_hmac_sha1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_aes_cbc_hmac_sha1.c,v 1.11 2016/05/04 14:53:29 tedu Exp $ */ 1/* $OpenBSD: e_aes_cbc_hmac_sha1.c,v 1.12 2016/05/04 15:01:33 tedu Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2011-2013 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2011-2013 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -60,6 +60,7 @@
60#include <openssl/aes.h> 60#include <openssl/aes.h>
61#include <openssl/sha.h> 61#include <openssl/sha.h>
62#include "evp_locl.h" 62#include "evp_locl.h"
63#include "constant_time_locl.h"
63 64
64#ifndef EVP_CIPH_FLAG_AEAD_CIPHER 65#ifndef EVP_CIPH_FLAG_AEAD_CIPHER
65#define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000 66#define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000
@@ -282,6 +283,8 @@ aesni_cbc_hmac_sha1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
282 maxpad |= (255 - maxpad) >> (sizeof(maxpad) * 8 - 8); 283 maxpad |= (255 - maxpad) >> (sizeof(maxpad) * 8 - 8);
283 maxpad &= 255; 284 maxpad &= 255;
284 285
286 ret &= constant_time_ge(maxpad, pad);
287
285 inp_len = len - (SHA_DIGEST_LENGTH + pad + 1); 288 inp_len = len - (SHA_DIGEST_LENGTH + pad + 1);
286 mask = (0 - ((inp_len - len) >> 289 mask = (0 - ((inp_len - len) >>
287 (sizeof(inp_len) * 8 - 1))); 290 (sizeof(inp_len) * 8 - 1)));