diff options
-rw-r--r-- | src/lib/libcrypto/aes/aes_wrap.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/libcrypto/aes/aes_wrap.c b/src/lib/libcrypto/aes/aes_wrap.c index ac2f83a993..b7e08ab75f 100644 --- a/src/lib/libcrypto/aes/aes_wrap.c +++ b/src/lib/libcrypto/aes/aes_wrap.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: aes_wrap.c,v 1.10 2015/09/10 15:56:24 jsing Exp $ */ | 1 | /* $OpenBSD: aes_wrap.c,v 1.11 2018/10/20 15:53:09 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project. | 3 | * project. |
4 | */ | 4 | */ |
@@ -66,7 +66,8 @@ AES_wrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out, | |||
66 | { | 66 | { |
67 | unsigned char *A, B[16], *R; | 67 | unsigned char *A, B[16], *R; |
68 | unsigned int i, j, t; | 68 | unsigned int i, j, t; |
69 | if ((inlen & 0x7) || (inlen < 8)) | 69 | |
70 | if ((inlen & 0x7) || (inlen < 16)) | ||
70 | return -1; | 71 | return -1; |
71 | A = B; | 72 | A = B; |
72 | t = 1; | 73 | t = 1; |
@@ -100,11 +101,10 @@ AES_unwrap_key(AES_KEY *key, const unsigned char *iv, unsigned char *out, | |||
100 | { | 101 | { |
101 | unsigned char *A, B[16], *R; | 102 | unsigned char *A, B[16], *R; |
102 | unsigned int i, j, t; | 103 | unsigned int i, j, t; |
103 | inlen -= 8; | 104 | |
104 | if (inlen & 0x7) | 105 | if ((inlen & 0x7) || (inlen < 24)) |
105 | return -1; | ||
106 | if (inlen < 8) | ||
107 | return -1; | 106 | return -1; |
107 | inlen -= 8; | ||
108 | A = B; | 108 | A = B; |
109 | t = 6 * (inlen >> 3); | 109 | t = 6 * (inlen >> 3); |
110 | memcpy(A, in, 8); | 110 | memcpy(A, in, 8); |