diff options
author | jsing <> | 2014-05-24 15:55:21 +0000 |
---|---|---|
committer | jsing <> | 2014-05-24 15:55:21 +0000 |
commit | 3e701b2a57219523e039e78e0cc655852ca63e1b (patch) | |
tree | 9e85cd03c39514d9c5edce1ab5a94a548e899f4b /src/lib/libcrypto/cms/cms_cd.c | |
parent | 9d5e69e894332ec60ed31ee4362a6c5fd3f5bd3f (diff) | |
download | openbsd-3e701b2a57219523e039e78e0cc655852ca63e1b.tar.gz openbsd-3e701b2a57219523e039e78e0cc655852ca63e1b.tar.bz2 openbsd-3e701b2a57219523e039e78e0cc655852ca63e1b.zip |
KNF.
Diffstat (limited to 'src/lib/libcrypto/cms/cms_cd.c')
-rw-r--r-- | src/lib/libcrypto/cms/cms_cd.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/src/lib/libcrypto/cms/cms_cd.c b/src/lib/libcrypto/cms/cms_cd.c index 2021688101..ec48471df2 100644 --- a/src/lib/libcrypto/cms/cms_cd.c +++ b/src/lib/libcrypto/cms/cms_cd.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -69,19 +69,20 @@ DECLARE_ASN1_ITEM(CMS_CompressedData) | |||
69 | 69 | ||
70 | /* CMS CompressedData Utilities */ | 70 | /* CMS CompressedData Utilities */ |
71 | 71 | ||
72 | CMS_ContentInfo *cms_CompressedData_create(int comp_nid) | 72 | CMS_ContentInfo * |
73 | { | 73 | cms_CompressedData_create(int comp_nid) |
74 | { | ||
74 | CMS_ContentInfo *cms; | 75 | CMS_ContentInfo *cms; |
75 | CMS_CompressedData *cd; | 76 | CMS_CompressedData *cd; |
77 | |||
76 | /* Will need something cleverer if there is ever more than one | 78 | /* Will need something cleverer if there is ever more than one |
77 | * compression algorithm or parameters have some meaning... | 79 | * compression algorithm or parameters have some meaning... |
78 | */ | 80 | */ |
79 | if (comp_nid != NID_zlib_compression) | 81 | if (comp_nid != NID_zlib_compression) { |
80 | { | ||
81 | CMSerr(CMS_F_CMS_COMPRESSEDDATA_CREATE, | 82 | CMSerr(CMS_F_CMS_COMPRESSEDDATA_CREATE, |
82 | CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM); | 83 | CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM); |
83 | return NULL; | 84 | return NULL; |
84 | } | 85 | } |
85 | cms = CMS_ContentInfo_new(); | 86 | cms = CMS_ContentInfo_new(); |
86 | if (!cms) | 87 | if (!cms) |
87 | return NULL; | 88 | return NULL; |
@@ -97,40 +98,38 @@ CMS_ContentInfo *cms_CompressedData_create(int comp_nid) | |||
97 | cd->version = 0; | 98 | cd->version = 0; |
98 | 99 | ||
99 | X509_ALGOR_set0(cd->compressionAlgorithm, | 100 | X509_ALGOR_set0(cd->compressionAlgorithm, |
100 | OBJ_nid2obj(NID_zlib_compression), | 101 | OBJ_nid2obj(NID_zlib_compression), |
101 | V_ASN1_UNDEF, NULL); | 102 | V_ASN1_UNDEF, NULL); |
102 | 103 | ||
103 | cd->encapContentInfo->eContentType = OBJ_nid2obj(NID_pkcs7_data); | 104 | cd->encapContentInfo->eContentType = OBJ_nid2obj(NID_pkcs7_data); |
104 | 105 | ||
105 | return cms; | 106 | return cms; |
106 | 107 | ||
107 | err: | 108 | err: |
108 | |||
109 | if (cms) | 109 | if (cms) |
110 | CMS_ContentInfo_free(cms); | 110 | CMS_ContentInfo_free(cms); |
111 | |||
112 | return NULL; | 111 | return NULL; |
113 | } | 112 | } |
114 | 113 | ||
115 | BIO *cms_CompressedData_init_bio(CMS_ContentInfo *cms) | 114 | BIO * |
116 | { | 115 | cms_CompressedData_init_bio(CMS_ContentInfo *cms) |
116 | { | ||
117 | CMS_CompressedData *cd; | 117 | CMS_CompressedData *cd; |
118 | ASN1_OBJECT *compoid; | 118 | ASN1_OBJECT *compoid; |
119 | if (OBJ_obj2nid(cms->contentType) != NID_id_smime_ct_compressedData) | 119 | |
120 | { | 120 | if (OBJ_obj2nid(cms->contentType) != NID_id_smime_ct_compressedData) { |
121 | CMSerr(CMS_F_CMS_COMPRESSEDDATA_INIT_BIO, | 121 | CMSerr(CMS_F_CMS_COMPRESSEDDATA_INIT_BIO, |
122 | CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA); | 122 | CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA); |
123 | return NULL; | 123 | return NULL; |
124 | } | 124 | } |
125 | cd = cms->d.compressedData; | 125 | cd = cms->d.compressedData; |
126 | X509_ALGOR_get0(&compoid, NULL, NULL, cd->compressionAlgorithm); | 126 | X509_ALGOR_get0(&compoid, NULL, NULL, cd->compressionAlgorithm); |
127 | if (OBJ_obj2nid(compoid) != NID_zlib_compression) | 127 | if (OBJ_obj2nid(compoid) != NID_zlib_compression) { |
128 | { | ||
129 | CMSerr(CMS_F_CMS_COMPRESSEDDATA_INIT_BIO, | 128 | CMSerr(CMS_F_CMS_COMPRESSEDDATA_INIT_BIO, |
130 | CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM); | 129 | CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM); |
131 | return NULL; | 130 | return NULL; |
132 | } | ||
133 | return BIO_new(BIO_f_zlib()); | ||
134 | } | 131 | } |
132 | return BIO_new(BIO_f_zlib()); | ||
133 | } | ||
135 | 134 | ||
136 | #endif | 135 | #endif |