X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=providers%2Fimplementations%2Fciphers%2Fcipher_aes_gcm.c;h=409dfa7b3300dcee28feffdcc8f394194465be24;hp=92a0ad17954f1dff026a003632dfe5dbac487f13;hb=29844ea5b3d2b7240d99b043a0d82cb177f0762d;hpb=363b1e5daea4a01889e6ff27148018be63d33b9b diff --git a/providers/implementations/ciphers/cipher_aes_gcm.c b/providers/implementations/ciphers/cipher_aes_gcm.c index 92a0ad1795..409dfa7b33 100644 --- a/providers/implementations/ciphers/cipher_aes_gcm.c +++ b/providers/implementations/ciphers/cipher_aes_gcm.c @@ -18,13 +18,22 @@ #include "cipher_aes_gcm.h" #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 = OPENSSL_zalloc(sizeof(*ctx)); + PROV_AES_GCM_CTX *ctx; + + if (!ossl_prov_is_running()) + return NULL; + ctx = OPENSSL_zalloc(sizeof(*ctx)); if (ctx != NULL) - gcm_initctx(provctx, &ctx->base, keybits, PROV_AES_HW_gcm(keybits), 8); + gcm_initctx(provctx, &ctx->base, keybits, PROV_AES_HW_gcm(keybits), + AES_GCM_IV_MIN_SIZE); return ctx; }