summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortedu <>2016-05-04 15:01:33 +0000
committertedu <>2016-05-04 15:01:33 +0000
commit00eab3af460c4af05c8b8506af1e1b44f19673d3 (patch)
tree611fb08a4dc4c04635f6a6dc510c5830fe8cd583 /src
parentdfa9c905663f3ba7b991d13c769bd68a1a292ee1 (diff)
downloadopenbsd-00eab3af460c4af05c8b8506af1e1b44f19673d3.tar.gz
openbsd-00eab3af460c4af05c8b8506af1e1b44f19673d3.tar.bz2
openbsd-00eab3af460c4af05c8b8506af1e1b44f19673d3.zip
fix a padding oracle in aesni cbc mac check. there must be enough data
for both the mac and padding bytes. CVE-2016-2107 from openssl
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)));