diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2015-03-28 15:10:54 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2015-03-30 22:01:31 +0100 |
commit | e93c8748ab40d876285147e3112c7a520d68880e (patch) | |
tree | 189c788dcf2e364274cfd87c6b7c883836ac5bc2 /crypto/cms | |
parent | 22f5bd3dd2a660f6f50ef86de78985b995c63a85 (diff) |
Remove duplicate code.
Update code to use ASN1_TYPE_pack_sequence and ASN1_TYPE_unpack_sequence
instead of performing the same operation manually.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/cms')
-rw-r--r-- | crypto/cms/cms_pwri.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/crypto/cms/cms_pwri.c b/crypto/cms/cms_pwri.c index 83a65d2f59..4f1b31d8ae 100644 --- a/crypto/cms/cms_pwri.c +++ b/crypto/cms/cms_pwri.c @@ -320,8 +320,6 @@ int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, { CMS_EncryptedContentInfo *ec; CMS_PasswordRecipientInfo *pwri; - const unsigned char *p = NULL; - int plen; int r = 0; X509_ALGOR *algtmp, *kekalg = NULL; EVP_CIPHER_CTX kekctx; @@ -346,11 +344,9 @@ int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, return 0; } - if (algtmp->parameter->type == V_ASN1_SEQUENCE) { - p = algtmp->parameter->value.sequence->data; - plen = algtmp->parameter->value.sequence->length; - kekalg = d2i_X509_ALGOR(NULL, &p, plen); - } + kekalg = ASN1_TYPE_unpack_sequence(ASN1_ITEM_rptr(X509_ALGOR), + algtmp->parameter); + if (kekalg == NULL) { CMSerr(CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT, CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER); |