diff options
author | Andy Polyakov <appro@openssl.org> | 2013-08-03 16:56:58 +0200 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2013-08-03 17:09:06 +0200 |
commit | a59f43629583b4a73c3d28ddac2c3d5a49127ece (patch) | |
tree | f1a540c5967530efcc54db7e0de6120b6edc7095 | |
parent | crypto/bn/asm/rsax-x86_64.pl: make it work on Darwin. (diff) | |
download | openssl-a59f43629583b4a73c3d28ddac2c3d5a49127ece.tar.xz openssl-a59f43629583b4a73c3d28ddac2c3d5a49127ece.zip |
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.
-rw-r--r-- | crypto/evp/e_aes.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/crypto/evp/e_aes.c b/crypto/evp/e_aes.c index 857587b672..fbf47ac2cb 100644 --- a/crypto/evp/e_aes.c +++ b/crypto/evp/e_aes.c @@ -1260,7 +1260,10 @@ static int aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, gctx->ctr = NULL; break; } + else #endif + (void)0; /* terminate potentially open 'else' */ + AES_set_encrypt_key(key, ctx->key_len * 8, &gctx->ks.ks); CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, (block128_f)AES_encrypt); #ifdef AES_CTR_ASM @@ -1653,14 +1656,17 @@ static int aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 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.ks); - xctx->xts.block2 = (block128_f)vpaes_encrypt; + xctx->xts.block2 = (block128_f)vpaes_encrypt; - xctx->xts.key1 = &xctx->ks1; - break; - } + xctx->xts.key1 = &xctx->ks1; + break; + } + else #endif + (void)0; /* terminate potentially open 'else' */ + if (enc) { AES_set_encrypt_key(key, ctx->key_len * 4, &xctx->ks1.ks); |