diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2009-12-17 15:28:45 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2009-12-17 15:28:45 +0000 |
commit | 2d3855fc6e7f094336d5e33b4a439efc52751ff1 (patch) | |
tree | 94f521dfc45339afedd4bbc65ce8dcb53a97e26a /crypto/evp/evp_pbe.c | |
parent | 1cd47f5f6e30f5c9ca6c77202dfbaf2579793d2a (diff) |
PR: 2127
Submitted by: Tomas Mraz <tmraz@redhat.com>
Check for lookup failures in EVP_PBE_CipherInit().
Diffstat (limited to 'crypto/evp/evp_pbe.c')
-rw-r--r-- | crypto/evp/evp_pbe.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/crypto/evp/evp_pbe.c b/crypto/evp/evp_pbe.c index cd6e40dcaa..c9d932d205 100644 --- a/crypto/evp/evp_pbe.c +++ b/crypto/evp/evp_pbe.c @@ -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)) { |