Don't require tag before ciphertext in AESGCM mode
(cherry picked from commit 964eaad78c
)
This commit is contained in:
parent
b0ee17ad47
commit
7e98d95f56
1 changed files with 2 additions and 2 deletions
|
@ -956,8 +956,6 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||||
|
|
||||||
if (!gctx->iv_set)
|
if (!gctx->iv_set)
|
||||||
return -1;
|
return -1;
|
||||||
if (!ctx->encrypt && gctx->taglen < 0)
|
|
||||||
return -1;
|
|
||||||
if (in)
|
if (in)
|
||||||
{
|
{
|
||||||
if (out == NULL)
|
if (out == NULL)
|
||||||
|
@ -999,6 +997,8 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||||
{
|
{
|
||||||
if (!ctx->encrypt)
|
if (!ctx->encrypt)
|
||||||
{
|
{
|
||||||
|
if (gctx->taglen < 0)
|
||||||
|
return -1;
|
||||||
if (CRYPTO_gcm128_finish(&gctx->gcm,
|
if (CRYPTO_gcm128_finish(&gctx->gcm,
|
||||||
ctx->buf, gctx->taglen) != 0)
|
ctx->buf, gctx->taglen) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in a new issue