diff options
Diffstat (limited to 'src/lib/libcrypto/evp/e_aes.c')
-rw-r--r-- | src/lib/libcrypto/evp/e_aes.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c index 8fddeaaa40..e1b53c2ce7 100644 --- a/src/lib/libcrypto/evp/e_aes.c +++ b/src/lib/libcrypto/evp/e_aes.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: e_aes.c,v 1.39 2019/05/12 15:52:46 tb Exp $ */ | 1 | /* $OpenBSD: e_aes.c,v 1.40 2020/04/27 19:31:02 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -1441,6 +1441,11 @@ aead_aes_gcm_seal(const EVP_AEAD_CTX *ctx, unsigned char *out, size_t *out_len, | |||
1441 | } | 1441 | } |
1442 | 1442 | ||
1443 | memcpy(&gcm, &gcm_ctx->gcm, sizeof(gcm)); | 1443 | memcpy(&gcm, &gcm_ctx->gcm, sizeof(gcm)); |
1444 | |||
1445 | if (nonce_len == 0) { | ||
1446 | EVPerror(EVP_R_INVALID_IV_LENGTH); | ||
1447 | return 0; | ||
1448 | } | ||
1444 | CRYPTO_gcm128_setiv(&gcm, nonce, nonce_len); | 1449 | CRYPTO_gcm128_setiv(&gcm, nonce, nonce_len); |
1445 | 1450 | ||
1446 | if (ad_len > 0 && CRYPTO_gcm128_aad(&gcm, ad, ad_len)) | 1451 | if (ad_len > 0 && CRYPTO_gcm128_aad(&gcm, ad, ad_len)) |
@@ -1487,6 +1492,11 @@ aead_aes_gcm_open(const EVP_AEAD_CTX *ctx, unsigned char *out, size_t *out_len, | |||
1487 | } | 1492 | } |
1488 | 1493 | ||
1489 | memcpy(&gcm, &gcm_ctx->gcm, sizeof(gcm)); | 1494 | memcpy(&gcm, &gcm_ctx->gcm, sizeof(gcm)); |
1495 | |||
1496 | if (nonce_len == 0) { | ||
1497 | EVPerror(EVP_R_INVALID_IV_LENGTH); | ||
1498 | return 0; | ||
1499 | } | ||
1490 | CRYPTO_gcm128_setiv(&gcm, nonce, nonce_len); | 1500 | CRYPTO_gcm128_setiv(&gcm, nonce, nonce_len); |
1491 | 1501 | ||
1492 | if (CRYPTO_gcm128_aad(&gcm, ad, ad_len)) | 1502 | if (CRYPTO_gcm128_aad(&gcm, ad, ad_len)) |