diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/cms/cms_cd.c | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/src/lib/libcrypto/cms/cms_cd.c b/src/lib/libcrypto/cms/cms_cd.c index 8882f1c898..55fff110d1 100644 --- a/src/lib/libcrypto/cms/cms_cd.c +++ b/src/lib/libcrypto/cms/cms_cd.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_cd.c,v 1.11 2019/08/10 16:39:17 jsing Exp $ */ | 1 | /* $OpenBSD: cms_cd.c,v 1.12 2019/08/10 16:42:20 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 4 | * project. | 4 | * project. |
| @@ -68,60 +68,60 @@ | |||
| 68 | 68 | ||
| 69 | CMS_ContentInfo *cms_CompressedData_create(int comp_nid) | 69 | CMS_ContentInfo *cms_CompressedData_create(int comp_nid) |
| 70 | { | 70 | { |
| 71 | CMS_ContentInfo *cms; | 71 | CMS_ContentInfo *cms; |
| 72 | CMS_CompressedData *cd; | 72 | CMS_CompressedData *cd; |
| 73 | /* | 73 | /* |
| 74 | * Will need something cleverer if there is ever more than one | 74 | * Will need something cleverer if there is ever more than one |
| 75 | * compression algorithm or parameters have some meaning... | 75 | * compression algorithm or parameters have some meaning... |
| 76 | */ | 76 | */ |
| 77 | if (comp_nid != NID_zlib_compression) { | 77 | if (comp_nid != NID_zlib_compression) { |
| 78 | CMSerr(CMS_F_CMS_COMPRESSEDDATA_CREATE, | 78 | CMSerr(CMS_F_CMS_COMPRESSEDDATA_CREATE, |
| 79 | CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM); | 79 | CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM); |
| 80 | return NULL; | 80 | return NULL; |
| 81 | } | 81 | } |
| 82 | cms = CMS_ContentInfo_new(); | 82 | cms = CMS_ContentInfo_new(); |
| 83 | if (cms == NULL) | 83 | if (cms == NULL) |
| 84 | return NULL; | 84 | return NULL; |
| 85 | 85 | ||
| 86 | cd = M_ASN1_new_of(CMS_CompressedData); | 86 | cd = M_ASN1_new_of(CMS_CompressedData); |
| 87 | 87 | ||
| 88 | if (cd == NULL) | 88 | if (cd == NULL) |
| 89 | goto err; | 89 | goto err; |
| 90 | 90 | ||
| 91 | cms->contentType = OBJ_nid2obj(NID_id_smime_ct_compressedData); | 91 | cms->contentType = OBJ_nid2obj(NID_id_smime_ct_compressedData); |
| 92 | cms->d.compressedData = cd; | 92 | cms->d.compressedData = cd; |
| 93 | 93 | ||
| 94 | cd->version = 0; | 94 | cd->version = 0; |
| 95 | 95 | ||
| 96 | X509_ALGOR_set0(cd->compressionAlgorithm, | 96 | X509_ALGOR_set0(cd->compressionAlgorithm, |
| 97 | OBJ_nid2obj(NID_zlib_compression), V_ASN1_UNDEF, NULL); | 97 | OBJ_nid2obj(NID_zlib_compression), V_ASN1_UNDEF, NULL); |
| 98 | 98 | ||
| 99 | cd->encapContentInfo->eContentType = OBJ_nid2obj(NID_pkcs7_data); | 99 | cd->encapContentInfo->eContentType = OBJ_nid2obj(NID_pkcs7_data); |
| 100 | 100 | ||
| 101 | return cms; | 101 | return cms; |
| 102 | 102 | ||
| 103 | err: | 103 | err: |
| 104 | CMS_ContentInfo_free(cms); | 104 | CMS_ContentInfo_free(cms); |
| 105 | return NULL; | 105 | return NULL; |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | BIO *cms_CompressedData_init_bio(CMS_ContentInfo *cms) | 108 | BIO *cms_CompressedData_init_bio(CMS_ContentInfo *cms) |
| 109 | { | 109 | { |
| 110 | CMS_CompressedData *cd; | 110 | CMS_CompressedData *cd; |
| 111 | const ASN1_OBJECT *compoid; | 111 | const ASN1_OBJECT *compoid; |
| 112 | if (OBJ_obj2nid(cms->contentType) != NID_id_smime_ct_compressedData) { | 112 | if (OBJ_obj2nid(cms->contentType) != NID_id_smime_ct_compressedData) { |
| 113 | CMSerr(CMS_F_CMS_COMPRESSEDDATA_INIT_BIO, | 113 | CMSerr(CMS_F_CMS_COMPRESSEDDATA_INIT_BIO, |
| 114 | CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA); | 114 | CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA); |
| 115 | return NULL; | 115 | return NULL; |
| 116 | } | 116 | } |
| 117 | cd = cms->d.compressedData; | 117 | cd = cms->d.compressedData; |
| 118 | X509_ALGOR_get0(&compoid, NULL, NULL, cd->compressionAlgorithm); | 118 | X509_ALGOR_get0(&compoid, NULL, NULL, cd->compressionAlgorithm); |
| 119 | if (OBJ_obj2nid(compoid) != NID_zlib_compression) { | 119 | if (OBJ_obj2nid(compoid) != NID_zlib_compression) { |
| 120 | CMSerr(CMS_F_CMS_COMPRESSEDDATA_INIT_BIO, | 120 | CMSerr(CMS_F_CMS_COMPRESSEDDATA_INIT_BIO, |
| 121 | CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM); | 121 | CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM); |
| 122 | return NULL; | 122 | return NULL; |
| 123 | } | 123 | } |
| 124 | return BIO_new(BIO_f_zlib()); | 124 | return BIO_new(BIO_f_zlib()); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | #endif | 127 | #endif |
