Fix from 0.9.7-stable.
authorDr. Stephen Henson <steve@openssl.org>
Sat, 15 Apr 2006 17:43:18 +0000 (17:43 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sat, 15 Apr 2006 17:43:18 +0000 (17:43 +0000)
crypto/evp/p5_crpt2.c

index f11cb701a40d6144583cfc51de50b5dd461b6d6f..c969d5a2062a23ed8c725967d4f8b9671af891ae 100644 (file)
@@ -201,11 +201,16 @@ int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
 
        /* Now decode key derivation function */
 
+       if(!pbe2->keyfunc->parameter ||
+                (pbe2->keyfunc->parameter->type != V_ASN1_SEQUENCE))
+               {
+               EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,EVP_R_DECODE_ERROR);
+               goto err;
+               }
+
        pbuf = pbe2->keyfunc->parameter->value.sequence->data;
        plen = pbe2->keyfunc->parameter->value.sequence->length;
-       if(!pbe2->keyfunc->parameter ||
-                (pbe2->keyfunc->parameter->type != V_ASN1_SEQUENCE) ||
-                               !(kdf = d2i_PBKDF2PARAM(NULL, &pbuf, plen)) ) {
+       if(!(kdf = d2i_PBKDF2PARAM(NULL, &pbuf, plen)) ) {
                EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,EVP_R_DECODE_ERROR);
                goto err;
        }