From: Andy Polyakov Date: Sat, 3 Aug 2013 14:56:58 +0000 (+0200) Subject: crypto/evp/e_aes.c: fix logical pre-processor bug and formatting. X-Git-Tag: OpenSSL_1_0_2-beta1~313 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9dc07f04c3ae31490946ca6feba534482cd9bde8;p=openssl 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) --- diff --git a/crypto/evp/e_aes.c b/crypto/evp/e_aes.c index 32e0bee727..24a4176f2d 100644 --- a/crypto/evp/e_aes.c +++ b/crypto/evp/e_aes.c @@ -1255,7 +1255,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 @@ -1646,14 +1649,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);