crypto/evp/e_aes.c: fix logical pre-processor bug and formatting.
Bug would emerge when XTS is added to bsaes-armv7.pl. Pointed out by Ard Biesheuvel of Linaro. (cherry picked from commit 044f63086051d7542fa9485a1432498c39c4d8fa)
This commit is contained in:
parent
04b80f4003
commit
5cd1aa4f15
1 changed files with 11 additions and 5 deletions
|
@ -842,7 +842,10 @@ static int aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||||
gctx->ctr = NULL;
|
gctx->ctr = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
|
(void)0; /* terminate potentially open 'else' */
|
||||||
|
|
||||||
AES_set_encrypt_key(key, ctx->key_len * 8, &gctx->ks);
|
AES_set_encrypt_key(key, ctx->key_len * 8, &gctx->ks);
|
||||||
CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, (block128_f)AES_encrypt);
|
CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, (block128_f)AES_encrypt);
|
||||||
#ifdef AES_CTR_ASM
|
#ifdef AES_CTR_ASM
|
||||||
|
@ -1083,14 +1086,17 @@ static int aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||||
xctx->xts.block1 = (block128_f)vpaes_decrypt;
|
xctx->xts.block1 = (block128_f)vpaes_decrypt;
|
||||||
}
|
}
|
||||||
|
|
||||||
vpaes_set_encrypt_key(key + ctx->key_len/2,
|
vpaes_set_encrypt_key(key + ctx->key_len/2,
|
||||||
ctx->key_len * 4, &xctx->ks2);
|
ctx->key_len * 4, &xctx->ks2);
|
||||||
xctx->xts.block2 = (block128_f)vpaes_encrypt;
|
xctx->xts.block2 = (block128_f)vpaes_encrypt;
|
||||||
|
|
||||||
xctx->xts.key1 = &xctx->ks1;
|
xctx->xts.key1 = &xctx->ks1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
|
(void)0; /* terminate potentially open 'else' */
|
||||||
|
|
||||||
if (enc)
|
if (enc)
|
||||||
{
|
{
|
||||||
AES_set_encrypt_key(key, ctx->key_len * 4, &xctx->ks1);
|
AES_set_encrypt_key(key, ctx->key_len * 4, &xctx->ks1);
|
||||||
|
|
Loading…
Reference in a new issue