New option to enable/disable connection to unpatched servers
[openssl.git] / crypto / evp / evp_pbe.c
index cd6e40dcaa3ad4381f800ac67658f9181c2e67ba..c9d932d2053a204883f8ded317c6d7435788aabe 100644 (file)
@@ -174,12 +174,26 @@ int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
        if (cipher_nid == -1)
                cipher = NULL;
        else
+               {
                cipher = EVP_get_cipherbynid(cipher_nid);
+               if (!cipher)
+                       {
+                       EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_CIPHER);
+                       return 0;
+                       }
+               }
 
        if (md_nid == -1)
                md = NULL;
        else
+               {
                md = EVP_get_digestbynid(md_nid);
+               if (!md)
+                       {
+                       EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_DIGEST);
+                       return 0;
+                       }
+               }
 
        if (!keygen(ctx, pass, passlen, param, cipher, md, en_de))
                {