summaryrefslogtreecommitdiffstats
path: root/crypto/pkcs12
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>1999-08-17 12:58:01 +0000
committerDr. Stephen Henson <steve@openssl.org>1999-08-17 12:58:01 +0000
commitc6c3450643ea00fde94e7f7471c9f134ec7d63b4 (patch)
tree59b0ab7204db5140559faa78de45b34d912bec94 /crypto/pkcs12
parent2cfa692136da461b08008dd751595f8879672a36 (diff)
Fix PKCS7_ENC_CONTENT_new() to include a sensible default content type and add
support for encrypted content type in PKCS7_set_content().
Diffstat (limited to 'crypto/pkcs12')
-rw-r--r--crypto/pkcs12/p12_add.c8
-rw-r--r--crypto/pkcs12/pk12err.c1
-rw-r--r--crypto/pkcs12/pkcs12.h1
3 files changed, 5 insertions, 5 deletions
diff --git a/crypto/pkcs12/p12_add.c b/crypto/pkcs12/p12_add.c
index ae3d9de3b4..50a7d0ba25 100644
--- a/crypto/pkcs12/p12_add.c
+++ b/crypto/pkcs12/p12_add.c
@@ -157,13 +157,11 @@ PKCS7 *PKCS12_pack_p7encdata (int pbe_nid, const char *pass, int passlen,
PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE);
return NULL;
}
- p7->type = OBJ_nid2obj(NID_pkcs7_encrypted);
- if (!(p7->d.encrypted = PKCS7_ENCRYPT_new ())) {
- PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE);
+ if(!PKCS7_set_type(p7, NID_pkcs7_encrypted)) {
+ PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA,
+ PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE);
return NULL;
}
- ASN1_INTEGER_set (p7->d.encrypted->version, 0);
- p7->d.encrypted->enc_data->content_type = OBJ_nid2obj(NID_pkcs7_data);
if (!(pbe = PKCS5_pbe_set (pbe_nid, iter, salt, saltlen))) {
PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE);
return NULL;
diff --git a/crypto/pkcs12/pk12err.c b/crypto/pkcs12/pk12err.c
index 38d7be7675..5bbe2fa330 100644
--- a/crypto/pkcs12/pk12err.c
+++ b/crypto/pkcs12/pk12err.c
@@ -99,6 +99,7 @@ static ERR_STRING_DATA PKCS12_str_reasons[]=
{PKCS12_R_DECODE_ERROR ,"decode error"},
{PKCS12_R_ENCODE_ERROR ,"encode error"},
{PKCS12_R_ENCRYPT_ERROR ,"encrypt error"},
+{PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE,"error setting encrypted data type"},
{PKCS12_R_INVALID_NULL_ARGUMENT ,"invalid null argument"},
{PKCS12_R_INVALID_NULL_PKCS12_POINTER ,"invalid null pkcs12 pointer"},
{PKCS12_R_IV_GEN_ERROR ,"iv gen error"},
diff --git a/crypto/pkcs12/pkcs12.h b/crypto/pkcs12/pkcs12.h
index 4cfba5e6c6..f79cc230c7 100644
--- a/crypto/pkcs12/pkcs12.h
+++ b/crypto/pkcs12/pkcs12.h
@@ -313,6 +313,7 @@ PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12);
#define PKCS12_R_DECODE_ERROR 101
#define PKCS12_R_ENCODE_ERROR 102
#define PKCS12_R_ENCRYPT_ERROR 103
+#define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE 120
#define PKCS12_R_INVALID_NULL_ARGUMENT 104
#define PKCS12_R_INVALID_NULL_PKCS12_POINTER 105
#define PKCS12_R_IV_GEN_ERROR 106