crypto/evp/e_aes.c: fix logical pre-processor bug and formatting.
authorAndy Polyakov <appro@openssl.org>
Sat, 3 Aug 2013 14:56:58 +0000 (16:56 +0200)
committerAndy Polyakov <appro@openssl.org>
Sat, 3 Aug 2013 15:09:06 +0000 (17:09 +0200)
Bug would emerge when XTS is added to bsaes-armv7.pl. Pointed out by
Ard Biesheuvel of Linaro.

crypto/evp/e_aes.c

index 857587b672f6e4a094cdbbfb62cc44d020a8dfe5..fbf47ac2cbb28ee59c9712f5a7afcc7a8a27e66a 100644 (file)
@@ -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);