summaryrefslogtreecommitdiffstats
path: root/crypto/cms/cms_enc.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/cms/cms_enc.c')
-rw-r--r--crypto/cms/cms_enc.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/crypto/cms/cms_enc.c b/crypto/cms/cms_enc.c
index fbf87b6735..a99ce1b5f2 100644
--- a/crypto/cms/cms_enc.c
+++ b/crypto/cms/cms_enc.c
@@ -227,13 +227,8 @@ int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph,
BIO *cms_EncryptedData_init_bio(CMS_ContentInfo *cms)
{
- CMS_EncryptedContentInfo *ec;
- if (OBJ_obj2nid(cms->contentType) != NID_pkcs7_encrypted)
- {
- CMSerr(CMS_F_CMS_ENCRYPTEDDATA_INIT_BIO,
- CMS_R_NOT_ENCRYPTED_DATA);
- return NULL;
- }
- ec = cms->d.encryptedData->encryptedContentInfo;
- return cms_EncryptedContent_init_bio(ec);
+ CMS_EncryptedData *enc = cms->d.encryptedData;
+ if (enc->unprotectedAttrs)
+ enc->version = 2;
+ return cms_EncryptedContent_init_bio(enc->encryptedContentInfo);
}