[openssl-commits] [openssl] master update
Dr. Stephen Henson
steve at openssl.org
Fri May 6 20:13:20 UTC 2016
The branch master has been updated
via 708cf5ded249f871fcd5e3de27d9281b1f37ae71 (commit)
from ec5b56f3c5c47346c7740e5640d5f66ee2394267 (commit)
- Log -----------------------------------------------------------------
commit 708cf5ded249f871fcd5e3de27d9281b1f37ae71
Author: Dr. Stephen Henson <steve at openssl.org>
Date: Fri May 6 19:27:49 2016 +0100
Only set CMS parameter when encrypting
Reviewed-by: Rich Salz <rsalz at openssl.org>
-----------------------------------------------------------------------
Summary of changes:
crypto/cms/cms_enc.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/crypto/cms/cms_enc.c b/crypto/cms/cms_enc.c
index 4c4c9f2..7093511 100644
--- a/crypto/cms/cms_enc.c
+++ b/crypto/cms/cms_enc.c
@@ -175,21 +175,22 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec)
CMS_R_CIPHER_INITIALISATION_ERROR);
goto err;
}
-
- calg->parameter = ASN1_TYPE_new();
- if (calg->parameter == NULL) {
- CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO, ERR_R_MALLOC_FAILURE);
- goto err;
- }
- if (EVP_CIPHER_param_to_asn1(ctx, calg->parameter) <= 0) {
- CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO,
- CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR);
- goto err;
- }
- /* If parameter type not set omit parameter */
- if (calg->parameter->type == V_ASN1_UNDEF) {
- ASN1_TYPE_free(calg->parameter);
- calg->parameter = NULL;
+ if (enc) {
+ calg->parameter = ASN1_TYPE_new();
+ if (calg->parameter == NULL) {
+ CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ if (EVP_CIPHER_param_to_asn1(ctx, calg->parameter) <= 0) {
+ CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO,
+ CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR);
+ goto err;
+ }
+ /* If parameter type not set omit parameter */
+ if (calg->parameter->type == V_ASN1_UNDEF) {
+ ASN1_TYPE_free(calg->parameter);
+ calg->parameter = NULL;
+ }
}
ok = 1;
More information about the openssl-commits
mailing list