aboutsummaryrefslogtreecommitdiff
path: root/openssl/crypto/cms/cms_cd.c
diff options
context:
space:
mode:
Diffstat (limited to 'openssl/crypto/cms/cms_cd.c')
-rw-r--r--openssl/crypto/cms/cms_cd.c104
1 files changed, 51 insertions, 53 deletions
diff --git a/openssl/crypto/cms/cms_cd.c b/openssl/crypto/cms/cms_cd.c
index 202168810..aa3238f58 100644
--- a/openssl/crypto/cms/cms_cd.c
+++ b/openssl/crypto/cms/cms_cd.c
@@ -1,5 +1,6 @@
/* crypto/cms/cms_cd.c */
-/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
+/*
+ * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
/* ====================================================================
@@ -10,7 +11,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -59,7 +60,7 @@
#include <openssl/cms.h>
#include <openssl/bio.h>
#ifndef OPENSSL_NO_COMP
-#include <openssl/comp.h>
+# include <openssl/comp.h>
#endif
#include "cms_lcl.h"
@@ -70,67 +71,64 @@ DECLARE_ASN1_ITEM(CMS_CompressedData)
/* CMS CompressedData Utilities */
CMS_ContentInfo *cms_CompressedData_create(int comp_nid)
- {
- CMS_ContentInfo *cms;
- CMS_CompressedData *cd;
- /* Will need something cleverer if there is ever more than one
- * compression algorithm or parameters have some meaning...
- */
- if (comp_nid != NID_zlib_compression)
- {
- CMSerr(CMS_F_CMS_COMPRESSEDDATA_CREATE,
- CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM);
- return NULL;
- }
- cms = CMS_ContentInfo_new();
- if (!cms)
- return NULL;
+{
+ CMS_ContentInfo *cms;
+ CMS_CompressedData *cd;
+ /*
+ * Will need something cleverer if there is ever more than one
+ * compression algorithm or parameters have some meaning...
+ */
+ if (comp_nid != NID_zlib_compression) {
+ CMSerr(CMS_F_CMS_COMPRESSEDDATA_CREATE,
+ CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM);
+ return NULL;
+ }
+ cms = CMS_ContentInfo_new();
+ if (!cms)
+ return NULL;
- cd = M_ASN1_new_of(CMS_CompressedData);
+ cd = M_ASN1_new_of(CMS_CompressedData);
- if (!cd)
- goto err;
+ if (!cd)
+ goto err;
- cms->contentType = OBJ_nid2obj(NID_id_smime_ct_compressedData);
- cms->d.compressedData = cd;
+ cms->contentType = OBJ_nid2obj(NID_id_smime_ct_compressedData);
+ cms->d.compressedData = cd;
- cd->version = 0;
+ cd->version = 0;
- X509_ALGOR_set0(cd->compressionAlgorithm,
- OBJ_nid2obj(NID_zlib_compression),
- V_ASN1_UNDEF, NULL);
+ X509_ALGOR_set0(cd->compressionAlgorithm,
+ OBJ_nid2obj(NID_zlib_compression), V_ASN1_UNDEF, NULL);
- cd->encapContentInfo->eContentType = OBJ_nid2obj(NID_pkcs7_data);
+ cd->encapContentInfo->eContentType = OBJ_nid2obj(NID_pkcs7_data);
- return cms;
+ return cms;
- err:
+ err:
- if (cms)
- CMS_ContentInfo_free(cms);
+ if (cms)
+ CMS_ContentInfo_free(cms);
- return NULL;
- }
+ return NULL;
+}
BIO *cms_CompressedData_init_bio(CMS_ContentInfo *cms)
- {
- CMS_CompressedData *cd;
- ASN1_OBJECT *compoid;
- if (OBJ_obj2nid(cms->contentType) != NID_id_smime_ct_compressedData)
- {
- CMSerr(CMS_F_CMS_COMPRESSEDDATA_INIT_BIO,
- CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA);
- return NULL;
- }
- cd = cms->d.compressedData;
- X509_ALGOR_get0(&compoid, NULL, NULL, cd->compressionAlgorithm);
- if (OBJ_obj2nid(compoid) != NID_zlib_compression)
- {
- CMSerr(CMS_F_CMS_COMPRESSEDDATA_INIT_BIO,
- CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM);
- return NULL;
- }
- return BIO_new(BIO_f_zlib());
- }
+{
+ CMS_CompressedData *cd;
+ ASN1_OBJECT *compoid;
+ if (OBJ_obj2nid(cms->contentType) != NID_id_smime_ct_compressedData) {
+ CMSerr(CMS_F_CMS_COMPRESSEDDATA_INIT_BIO,
+ CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA);
+ return NULL;
+ }
+ cd = cms->d.compressedData;
+ X509_ALGOR_get0(&compoid, NULL, NULL, cd->compressionAlgorithm);
+ if (OBJ_obj2nid(compoid) != NID_zlib_compression) {
+ CMSerr(CMS_F_CMS_COMPRESSEDDATA_INIT_BIO,
+ CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM);
+ return NULL;
+ }
+ return BIO_new(BIO_f_zlib());
+}
#endif