mirror of
https://github.com/openssl/openssl.git
synced 2024-11-25 11:03:37 +08:00
Simplify cipher and digest lookup in PKCS#7 code.
This commit is contained in:
parent
8d9086dfa2
commit
77fe058c10
@ -103,7 +103,7 @@ static ASN1_OCTET_STRING *PKCS7_get_octet_string(PKCS7 *p7)
|
||||
|
||||
BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio)
|
||||
{
|
||||
int i,j;
|
||||
int i;
|
||||
BIO *out=NULL,*btmp=NULL;
|
||||
X509_ALGOR *xa;
|
||||
const EVP_MD *evp_md;
|
||||
@ -161,8 +161,7 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio)
|
||||
goto err;
|
||||
}
|
||||
|
||||
j=OBJ_obj2nid(xa->algorithm);
|
||||
evp_md=EVP_get_digestbyname(OBJ_nid2sn(j));
|
||||
evp_md=EVP_get_digestbyobj(xa->algorithm);
|
||||
if (evp_md == NULL)
|
||||
{
|
||||
PKCS7err(PKCS7_F_PKCS7_DATAINIT,PKCS7_R_UNKNOWN_DIGEST_TYPE);
|
||||
@ -314,7 +313,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
|
||||
md_sk=p7->d.signed_and_enveloped->md_algs;
|
||||
data_body=p7->d.signed_and_enveloped->enc_data->enc_data;
|
||||
enc_alg=p7->d.signed_and_enveloped->enc_data->algorithm;
|
||||
evp_cipher=EVP_get_cipherbyname(OBJ_nid2sn(OBJ_obj2nid(enc_alg->algorithm)));
|
||||
evp_cipher=EVP_get_cipherbyobj(enc_alg->algorithm);
|
||||
if (evp_cipher == NULL)
|
||||
{
|
||||
PKCS7err(PKCS7_F_PKCS7_DATADECODE,PKCS7_R_UNSUPPORTED_CIPHER_TYPE);
|
||||
@ -326,7 +325,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
|
||||
rsk=p7->d.enveloped->recipientinfo;
|
||||
enc_alg=p7->d.enveloped->enc_data->algorithm;
|
||||
data_body=p7->d.enveloped->enc_data->enc_data;
|
||||
evp_cipher=EVP_get_cipherbyname(OBJ_nid2sn(OBJ_obj2nid(enc_alg->algorithm)));
|
||||
evp_cipher=EVP_get_cipherbyobj(enc_alg->algorithm);
|
||||
if (evp_cipher == NULL)
|
||||
{
|
||||
PKCS7err(PKCS7_F_PKCS7_DATADECODE,PKCS7_R_UNSUPPORTED_CIPHER_TYPE);
|
||||
@ -352,7 +351,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
|
||||
}
|
||||
|
||||
j=OBJ_obj2nid(xa->algorithm);
|
||||
evp_md=EVP_get_digestbyname(OBJ_nid2sn(j));
|
||||
evp_md=EVP_get_digestbynid(j);
|
||||
if (evp_md == NULL)
|
||||
{
|
||||
PKCS7err(PKCS7_F_PKCS7_DATADECODE,PKCS7_R_UNKNOWN_DIGEST_TYPE);
|
||||
|
Loading…
Reference in New Issue
Block a user