diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2000-02-22 18:45:11 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2000-02-22 18:45:11 +0000 |
commit | 4b42658082a3d6224d25f10de8fdb605d30015a9 (patch) | |
tree | 6c9ce1e8f0f222d9a1de90de288b184436a23db4 /crypto | |
parent | 3f2b5a88ad62c63caae1265f9055fb660c7eb407 (diff) |
Make pkcs8 work again.
Make EVP_CIPHER_type() return NID_undef if the cipher has no
ASN1 OID, modify code to handle this.
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/asn1/p5_pbev2.c | 4 | ||||
-rw-r--r-- | crypto/evp/evp_lib.c | 6 | ||||
-rw-r--r-- | crypto/pkcs7/pk7_lib.c | 5 |
3 files changed, 10 insertions, 5 deletions
diff --git a/crypto/asn1/p5_pbev2.c b/crypto/asn1/p5_pbev2.c index 2f6a4c4518..4ce06a94ab 100644 --- a/crypto/asn1/p5_pbev2.c +++ b/crypto/asn1/p5_pbev2.c @@ -178,12 +178,12 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, ASN1_OBJECT *obj; alg_nid = EVP_CIPHER_type(cipher); - obj = OBJ_nid2obj(alg_nid); - if(!obj || !obj->data) { + if(alg_nid == NID_undef) { ASN1err(ASN1_F_PKCS5_PBE2_SET, ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER); goto err; } + obj = OBJ_nid2obj(alg_nid); if(!(pbe2 = PBE2PARAM_new())) goto merr; diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c index 3f9bf55828..a431945ef5 100644 --- a/crypto/evp/evp_lib.c +++ b/crypto/evp/evp_lib.c @@ -115,6 +115,7 @@ int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) int EVP_CIPHER_type(const EVP_CIPHER *ctx) { int nid; + ASN1_OBJECT *otmp; nid = EVP_CIPHER_nid(ctx); switch(nid) { @@ -131,7 +132,10 @@ int EVP_CIPHER_type(const EVP_CIPHER *ctx) return NID_rc4; default: - + /* Check it has an OID and it is valid */ + otmp = OBJ_nid2obj(nid); + if(!otmp || !otmp->data) nid = NID_undef; + ASN1_OBJECT_free(otmp); return nid; } } diff --git a/crypto/pkcs7/pk7_lib.c b/crypto/pkcs7/pk7_lib.c index 2012d7c87a..45973fe850 100644 --- a/crypto/pkcs7/pk7_lib.c +++ b/crypto/pkcs7/pk7_lib.c @@ -456,11 +456,12 @@ int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher) } /* Check cipher OID exists and has data in it*/ - objtmp = OBJ_nid2obj(EVP_CIPHER_type(cipher)); - if(!objtmp || !objtmp->data) { + i = EVP_CIPHER_type(cipher); + if(i == NID_undef) { PKCS7err(PKCS7_F_PKCS7_SET_CIPHER,PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER); return(0); } + objtmp = OBJ_nid2obj(i); ec->cipher = cipher; return 1; |