summaryrefslogtreecommitdiffstats
path: root/providers/implementations/ciphers
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-07-13 18:40:01 +1000
committerTomas Mraz <tomas@openssl.org>2021-07-14 12:02:03 +0200
commitc55c7d0292947bb906847ff03132c7eeb967936f (patch)
tree992a2fb9b0fda777174830161006dbd908e0258c /providers/implementations/ciphers
parent2f0a53816b2956f585903a52ab6ab681cf6f9ae1 (diff)
Remove lower limit on GCM mode ciphers
Fixes #16057 Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16064)
Diffstat (limited to 'providers/implementations/ciphers')
-rw-r--r--providers/implementations/ciphers/cipher_aes_gcm.c5
-rw-r--r--providers/implementations/ciphers/cipher_aria_gcm.c4
-rw-r--r--providers/implementations/ciphers/ciphercommon_gcm.c5
3 files changed, 4 insertions, 10 deletions
diff --git a/providers/implementations/ciphers/cipher_aes_gcm.c b/providers/implementations/ciphers/cipher_aes_gcm.c
index a9f574ab23..0081ca6cd7 100644
--- a/providers/implementations/ciphers/cipher_aes_gcm.c
+++ b/providers/implementations/ciphers/cipher_aes_gcm.c
@@ -20,9 +20,6 @@
#include "prov/implementations.h"
#include "prov/providercommon.h"
-#define AES_GCM_IV_MIN_SIZE (64 / 8) /* size in bytes */
-/* Note: GCM_IV_MAX_SIZE is listed in ciphercommon_gcm.h */
-
static void *aes_gcm_newctx(void *provctx, size_t keybits)
{
PROV_AES_GCM_CTX *ctx;
@@ -33,7 +30,7 @@ static void *aes_gcm_newctx(void *provctx, size_t keybits)
ctx = OPENSSL_zalloc(sizeof(*ctx));
if (ctx != NULL)
ossl_gcm_initctx(provctx, &ctx->base, keybits,
- ossl_prov_aes_hw_gcm(keybits), AES_GCM_IV_MIN_SIZE);
+ ossl_prov_aes_hw_gcm(keybits));
return ctx;
}
diff --git a/providers/implementations/ciphers/cipher_aria_gcm.c b/providers/implementations/ciphers/cipher_aria_gcm.c
index c2fe7ec185..b412bd3202 100644
--- a/providers/implementations/ciphers/cipher_aria_gcm.c
+++ b/providers/implementations/ciphers/cipher_aria_gcm.c
@@ -13,8 +13,6 @@
#include "prov/implementations.h"
#include "prov/providercommon.h"
-#define ARIA_GCM_IV_MIN_SIZE (32 / 8) /* size in bytes */
-
static void *aria_gcm_newctx(void *provctx, size_t keybits)
{
PROV_ARIA_GCM_CTX *ctx;
@@ -25,7 +23,7 @@ static void *aria_gcm_newctx(void *provctx, size_t keybits)
ctx = OPENSSL_zalloc(sizeof(*ctx));
if (ctx != NULL)
ossl_gcm_initctx(provctx, &ctx->base, keybits,
- ossl_prov_aria_hw_gcm(keybits), ARIA_GCM_IV_MIN_SIZE);
+ ossl_prov_aria_hw_gcm(keybits));
return ctx;
}
diff --git a/providers/implementations/ciphers/ciphercommon_gcm.c b/providers/implementations/ciphers/ciphercommon_gcm.c
index 97a1af3191..c4301f6b82 100644
--- a/providers/implementations/ciphers/ciphercommon_gcm.c
+++ b/providers/implementations/ciphers/ciphercommon_gcm.c
@@ -26,13 +26,12 @@ static int gcm_cipher_internal(PROV_GCM_CTX *ctx, unsigned char *out,
size_t len);
void ossl_gcm_initctx(void *provctx, PROV_GCM_CTX *ctx, size_t keybits,
- const PROV_GCM_HW *hw, size_t ivlen_min)
+ const PROV_GCM_HW *hw)
{
ctx->pad = 1;
ctx->mode = EVP_CIPH_GCM_MODE;
ctx->taglen = UNINITIALISED_SIZET;
ctx->tls_aad_len = UNINITIALISED_SIZET;
- ctx->ivlen_min = ivlen_min;
ctx->ivlen = (EVP_GCM_TLS_FIXED_IV_LEN + EVP_GCM_TLS_EXPLICIT_IV_LEN);
ctx->keylen = keybits / 8;
ctx->hw = hw;
@@ -51,7 +50,7 @@ static int gcm_init(void *vctx, const unsigned char *key, size_t keylen,
ctx->enc = enc;
if (iv != NULL) {
- if (ivlen < ctx->ivlen_min || ivlen > sizeof(ctx->iv)) {
+ if (ivlen == 0 || ivlen > sizeof(ctx->iv)) {
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_IV_LENGTH);
return 0;
}