Make *Final work for key wrap again.
authorDr. Stephen Henson <steve@openssl.org>
Thu, 17 Jul 2014 21:27:50 +0000 (22:27 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 17 Jul 2014 22:31:11 +0000 (23:31 +0100)
Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 58f4698f67c33b723a9e99bed1101161a59eea73)

crypto/evp/e_aes.c

index d20cecaaadedd8138960293631843bd1a54b14e8..ae1fd0a2ed9f9ca92aa30a2d04a7d16a4b96944d 100644 (file)
@@ -2075,6 +2075,8 @@ static int aes_wrap_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
        {
        EVP_AES_WRAP_CTX *wctx = ctx->cipher_data;
        size_t rv;
+       if (!in)
+               return 0;
        if (inlen % 8)
                return -1;
        if (ctx->encrypt && inlen < 8)
@@ -2088,8 +2090,6 @@ static int aes_wrap_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
                else
                        return inlen - 8;
                }
-       if (!in)
-               return 0;
        if (ctx->encrypt)
                rv = CRYPTO_128_wrap(&wctx->ks.ks, wctx->iv, out, in, inlen,
                                                (block128_f)AES_encrypt);