- {
- ASN1_OCTET_STRING **pos = CMS_get0_content(cms);
- if (!pos)
- return 0;
- /* If ebmedded content find memory BIO and set content */
- if (*pos && ((*pos)->flags & ASN1_STRING_FLAG_CONT))
- {
- BIO *mbio;
- unsigned char *cont;
- long contlen;
- mbio = BIO_find_type(cmsbio, BIO_TYPE_MEM);
- if (!mbio)
- {
- CMSerr(CMS_F_CMS_DATAFINAL, CMS_R_CONTENT_NOT_FOUND);
- return 0;
- }
- contlen = BIO_get_mem_data(mbio, &cont);
- /* Set bio as read only so its content can't be clobbered */
- BIO_set_flags(mbio, BIO_FLAGS_MEM_RDONLY);
- BIO_set_mem_eof_return(mbio, 0);
- ASN1_STRING_set0(*pos, cont, contlen);
- (*pos)->flags &= ~ASN1_STRING_FLAG_CONT;
- }
-
- switch (OBJ_obj2nid(cms->contentType))
- {
-
- case NID_pkcs7_data:
- case NID_pkcs7_enveloped:
- case NID_pkcs7_encrypted:
- case NID_id_smime_ct_compressedData:
- /* Nothing to do */
- return 1;
-
- case NID_pkcs7_signed:
- return cms_SignedData_final(cms, cmsbio);
-
- case NID_pkcs7_digest:
- return cms_DigestedData_do_final(cms, cmsbio, 0);
-
- default:
- CMSerr(CMS_F_CMS_DATAFINAL, CMS_R_UNSUPPORTED_TYPE);
- return 0;
- }
- }
-
-/* Return an OCTET STRING pointer to content. This allows it to
- * be accessed or set later.
+{
+ ASN1_OCTET_STRING **pos = CMS_get0_content(cms);
+ if (!pos)
+ return 0;
+ /* If ebmedded content find memory BIO and set content */
+ if (*pos && ((*pos)->flags & ASN1_STRING_FLAG_CONT)) {
+ BIO *mbio;
+ unsigned char *cont;
+ long contlen;
+ mbio = BIO_find_type(cmsbio, BIO_TYPE_MEM);
+ if (!mbio) {
+ CMSerr(CMS_F_CMS_DATAFINAL, CMS_R_CONTENT_NOT_FOUND);
+ return 0;
+ }
+ contlen = BIO_get_mem_data(mbio, &cont);
+ /* Set bio as read only so its content can't be clobbered */
+ BIO_set_flags(mbio, BIO_FLAGS_MEM_RDONLY);
+ BIO_set_mem_eof_return(mbio, 0);
+ ASN1_STRING_set0(*pos, cont, contlen);
+ (*pos)->flags &= ~ASN1_STRING_FLAG_CONT;
+ }
+
+ switch (OBJ_obj2nid(cms->contentType)) {
+
+ case NID_pkcs7_data:
+ case NID_pkcs7_enveloped:
+ case NID_pkcs7_encrypted:
+ case NID_id_smime_ct_compressedData:
+ /* Nothing to do */
+ return 1;
+
+ case NID_pkcs7_signed:
+ return cms_SignedData_final(cms, cmsbio);
+
+ case NID_pkcs7_digest:
+ return cms_DigestedData_do_final(cms, cmsbio, 0);
+
+ default:
+ CMSerr(CMS_F_CMS_DATAFINAL, CMS_R_UNSUPPORTED_TYPE);
+ return 0;
+ }
+}
+
+/*
+ * Return an OCTET STRING pointer to content. This allows it to be accessed
+ * or set later.