2 * Copyright 2008-2020 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #include "internal/cryptlib.h"
11 #include <openssl/asn1t.h>
12 #include <openssl/x509.h>
13 #include <openssl/x509v3.h>
14 #include <openssl/err.h>
15 #include <openssl/cms.h>
16 #include "cms_local.h"
17 #include "crypto/asn1.h"
19 DEFINE_STACK_OF(CMS_SignerInfo)
21 DEFINE_STACK_OF(X509_CRL)
22 DEFINE_STACK_OF(CMS_RecipientEncryptedKey)
23 DEFINE_STACK_OF(CMS_RecipientInfo)
25 static BIO *cms_get_text_bio(BIO *out, unsigned int flags)
29 rbio = BIO_new(BIO_s_null());
30 else if (flags & CMS_TEXT) {
31 rbio = BIO_new(BIO_s_mem());
32 BIO_set_mem_eof_return(rbio, 0);
38 static int cms_copy_content(BIO *out, BIO *in, unsigned int flags)
40 unsigned char buf[4096];
44 tmpout = cms_get_text_bio(out, flags);
47 CMSerr(CMS_F_CMS_COPY_CONTENT, ERR_R_MALLOC_FAILURE);
51 /* Read all content through chain to process digest, decrypt etc */
53 i = BIO_read(in, buf, sizeof(buf));
55 if (BIO_method_type(in) == BIO_TYPE_CIPHER) {
56 if (!BIO_get_cipher_status(in))
64 if (tmpout && (BIO_write(tmpout, buf, i) != i))
68 if (flags & CMS_TEXT) {
69 if (!SMIME_text(tmpout, out)) {
70 CMSerr(CMS_F_CMS_COPY_CONTENT, CMS_R_SMIME_TEXT_ERROR);
84 static int check_content(CMS_ContentInfo *cms)
86 ASN1_OCTET_STRING **pos = CMS_get0_content(cms);
88 if (pos == NULL || *pos == NULL) {
89 CMSerr(CMS_F_CHECK_CONTENT, CMS_R_NO_CONTENT);
95 static void do_free_upto(BIO *f, BIO *upto)
103 } while (f != NULL && f != upto);
108 int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags)
112 if (OBJ_obj2nid(CMS_get0_type(cms)) != NID_pkcs7_data) {
113 CMSerr(CMS_F_CMS_DATA, CMS_R_TYPE_NOT_DATA);
116 cont = CMS_dataInit(cms, NULL);
119 r = cms_copy_content(out, cont, flags);
124 CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags)
126 CMS_ContentInfo *cms;
127 cms = cms_Data_create();
131 if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags))
134 CMS_ContentInfo_free(cms);
139 int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
144 if (OBJ_obj2nid(CMS_get0_type(cms)) != NID_pkcs7_digest) {
145 CMSerr(CMS_F_CMS_DIGEST_VERIFY, CMS_R_TYPE_NOT_DIGESTED_DATA);
149 if (!dcont && !check_content(cms))
152 cont = CMS_dataInit(cms, dcont);
155 r = cms_copy_content(out, cont, flags);
157 r = cms_DigestedData_do_final(cms, cont, 1);
158 do_free_upto(cont, dcont);
162 CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md,
165 CMS_ContentInfo *cms;
168 cms = cms_DigestedData_create(md);
172 if (!(flags & CMS_DETACHED))
173 CMS_set_detached(cms, 0);
175 if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags))
178 CMS_ContentInfo_free(cms);
182 int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,
183 const unsigned char *key, size_t keylen,
184 BIO *dcont, BIO *out, unsigned int flags)
188 if (OBJ_obj2nid(CMS_get0_type(cms)) != NID_pkcs7_encrypted) {
189 CMSerr(CMS_F_CMS_ENCRYPTEDDATA_DECRYPT,
190 CMS_R_TYPE_NOT_ENCRYPTED_DATA);
194 if (!dcont && !check_content(cms))
197 if (CMS_EncryptedData_set1_key(cms, NULL, key, keylen) <= 0)
199 cont = CMS_dataInit(cms, dcont);
202 r = cms_copy_content(out, cont, flags);
203 do_free_upto(cont, dcont);
207 CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher,
208 const unsigned char *key,
209 size_t keylen, unsigned int flags)
211 CMS_ContentInfo *cms;
213 CMSerr(CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT, CMS_R_NO_CIPHER);
216 cms = CMS_ContentInfo_new();
219 if (!CMS_EncryptedData_set1_key(cms, cipher, key, keylen))
222 if (!(flags & CMS_DETACHED))
223 CMS_set_detached(cms, 0);
225 if ((flags & (CMS_STREAM | CMS_PARTIAL))
226 || CMS_final(cms, in, NULL, flags))
229 CMS_ContentInfo_free(cms);
233 static int cms_signerinfo_verify_cert(CMS_SignerInfo *si,
235 STACK_OF(X509) *certs,
236 STACK_OF(X509_CRL) *crls)
238 X509_STORE_CTX *ctx = X509_STORE_CTX_new();
243 CMSerr(CMS_F_CMS_SIGNERINFO_VERIFY_CERT, ERR_R_MALLOC_FAILURE);
246 CMS_SignerInfo_get0_algs(si, NULL, &signer, NULL, NULL);
247 if (!X509_STORE_CTX_init(ctx, store, signer, certs)) {
248 CMSerr(CMS_F_CMS_SIGNERINFO_VERIFY_CERT, CMS_R_STORE_INIT_ERROR);
251 X509_STORE_CTX_set_default(ctx, "smime_sign");
253 X509_STORE_CTX_set0_crls(ctx, crls);
255 i = X509_verify_cert(ctx);
257 j = X509_STORE_CTX_get_error(ctx);
258 CMSerr(CMS_F_CMS_SIGNERINFO_VERIFY_CERT,
259 CMS_R_CERTIFICATE_VERIFY_ERROR);
260 ERR_add_error_data(2, "Verify error:",
261 X509_verify_cert_error_string(j));
266 X509_STORE_CTX_free(ctx);
271 int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
272 X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags)
275 STACK_OF(CMS_SignerInfo) *sinfos;
276 STACK_OF(X509) *cms_certs = NULL;
277 STACK_OF(X509_CRL) *crls = NULL;
279 int i, scount = 0, ret = 0;
280 BIO *cmsbio = NULL, *tmpin = NULL, *tmpout = NULL;
282 if (!dcont && !check_content(cms))
284 if (dcont && !(flags & CMS_BINARY)) {
285 const ASN1_OBJECT *coid = CMS_get0_eContentType(cms);
286 if (OBJ_obj2nid(coid) == NID_id_ct_asciiTextWithCRLF)
287 flags |= CMS_ASCIICRLF;
290 /* Attempt to find all signer certificates */
292 sinfos = CMS_get0_SignerInfos(cms);
294 if (sk_CMS_SignerInfo_num(sinfos) <= 0) {
295 CMSerr(CMS_F_CMS_VERIFY, CMS_R_NO_SIGNERS);
299 for (i = 0; i < sk_CMS_SignerInfo_num(sinfos); i++) {
300 si = sk_CMS_SignerInfo_value(sinfos, i);
301 CMS_SignerInfo_get0_algs(si, NULL, &signer, NULL, NULL);
306 if (scount != sk_CMS_SignerInfo_num(sinfos))
307 scount += CMS_set1_signers_certs(cms, certs, flags);
309 if (scount != sk_CMS_SignerInfo_num(sinfos)) {
310 CMSerr(CMS_F_CMS_VERIFY, CMS_R_SIGNER_CERTIFICATE_NOT_FOUND);
314 /* Attempt to verify all signers certs */
316 if (!(flags & CMS_NO_SIGNER_CERT_VERIFY)) {
317 cms_certs = CMS_get1_certs(cms);
318 if (!(flags & CMS_NOCRL))
319 crls = CMS_get1_crls(cms);
320 for (i = 0; i < sk_CMS_SignerInfo_num(sinfos); i++) {
321 si = sk_CMS_SignerInfo_value(sinfos, i);
322 if (!cms_signerinfo_verify_cert(si, store, cms_certs, crls))
327 /* Attempt to verify all SignerInfo signed attribute signatures */
329 if (!(flags & CMS_NO_ATTR_VERIFY)) {
330 for (i = 0; i < sk_CMS_SignerInfo_num(sinfos); i++) {
331 si = sk_CMS_SignerInfo_value(sinfos, i);
332 if (CMS_signed_get_attr_count(si) < 0)
334 if (CMS_SignerInfo_verify(si) <= 0)
340 * Performance optimization: if the content is a memory BIO then store
341 * its contents in a temporary read only memory BIO. This avoids
342 * potentially large numbers of slow copies of data which will occur when
343 * reading from a read write memory BIO when signatures are calculated.
346 if (dcont && (BIO_method_type(dcont) == BIO_TYPE_MEM)) {
349 len = BIO_get_mem_data(dcont, &ptr);
350 tmpin = BIO_new_mem_buf(ptr, len);
352 CMSerr(CMS_F_CMS_VERIFY, ERR_R_MALLOC_FAILURE);
358 * If not binary mode and detached generate digests by *writing* through
359 * the BIO. That makes it possible to canonicalise the input.
361 if (!(flags & SMIME_BINARY) && dcont) {
363 * Create output BIO so we can either handle text or to ensure
364 * included content doesn't override detached content.
366 tmpout = cms_get_text_bio(out, flags);
368 CMSerr(CMS_F_CMS_VERIFY, ERR_R_MALLOC_FAILURE);
371 cmsbio = CMS_dataInit(cms, tmpout);
375 * Don't use SMIME_TEXT for verify: it adds headers and we want to
378 SMIME_crlf_copy(dcont, cmsbio, flags & ~SMIME_TEXT);
380 if (flags & CMS_TEXT) {
381 if (!SMIME_text(tmpout, out)) {
382 CMSerr(CMS_F_CMS_VERIFY, CMS_R_SMIME_TEXT_ERROR);
387 cmsbio = CMS_dataInit(cms, tmpin);
391 if (!cms_copy_content(out, cmsbio, flags))
395 if (!(flags & CMS_NO_CONTENT_VERIFY)) {
396 for (i = 0; i < sk_CMS_SignerInfo_num(sinfos); i++) {
397 si = sk_CMS_SignerInfo_value(sinfos, i);
398 if (CMS_SignerInfo_verify_content(si, cmsbio) <= 0) {
399 CMSerr(CMS_F_CMS_VERIFY, CMS_R_CONTENT_VERIFY_ERROR);
408 if (!(flags & SMIME_BINARY) && dcont) {
409 do_free_upto(cmsbio, tmpout);
413 if (dcont && (tmpin == dcont))
414 do_free_upto(cmsbio, dcont);
416 BIO_free_all(cmsbio);
420 BIO_free_all(tmpout);
423 sk_X509_pop_free(cms_certs, X509_free);
424 sk_X509_CRL_pop_free(crls, X509_CRL_free);
429 int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms,
430 STACK_OF(X509) *certs,
431 X509_STORE *store, unsigned int flags)
434 flags &= ~(CMS_DETACHED | CMS_TEXT);
435 r = CMS_verify(rcms, certs, store, NULL, NULL, flags);
438 return cms_Receipt_verify(rcms, ocms);
441 CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey,
442 STACK_OF(X509) *certs, BIO *data,
445 CMS_ContentInfo *cms;
448 cms = CMS_ContentInfo_new();
449 if (cms == NULL || !CMS_SignedData_init(cms))
451 if (flags & CMS_ASCIICRLF
452 && !CMS_set1_eContentType(cms,
453 OBJ_nid2obj(NID_id_ct_asciiTextWithCRLF)))
456 if (pkey && !CMS_add1_signer(cms, signcert, pkey, NULL, flags)) {
457 CMSerr(CMS_F_CMS_SIGN, CMS_R_ADD_SIGNER_ERROR);
461 for (i = 0; i < sk_X509_num(certs); i++) {
462 X509 *x = sk_X509_value(certs, i);
463 if (!CMS_add1_cert(cms, x))
467 if (!(flags & CMS_DETACHED))
468 CMS_set_detached(cms, 0);
470 if ((flags & (CMS_STREAM | CMS_PARTIAL))
471 || CMS_final(cms, data, NULL, flags))
477 CMSerr(CMS_F_CMS_SIGN, ERR_R_MALLOC_FAILURE);
480 CMS_ContentInfo_free(cms);
484 CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si,
485 X509 *signcert, EVP_PKEY *pkey,
486 STACK_OF(X509) *certs, unsigned int flags)
488 CMS_SignerInfo *rct_si;
489 CMS_ContentInfo *cms = NULL;
490 ASN1_OCTET_STRING **pos, *os;
491 BIO *rct_cont = NULL;
494 flags &= ~(CMS_STREAM | CMS_TEXT);
495 /* Not really detached but avoids content being allocated */
496 flags |= CMS_PARTIAL | CMS_BINARY | CMS_DETACHED;
497 if (pkey == NULL || signcert == NULL) {
498 CMSerr(CMS_F_CMS_SIGN_RECEIPT, CMS_R_NO_KEY_OR_CERT);
502 /* Initialize signed data */
504 cms = CMS_sign(NULL, NULL, certs, NULL, flags);
508 /* Set inner content type to signed receipt */
509 if (!CMS_set1_eContentType(cms, OBJ_nid2obj(NID_id_smime_ct_receipt)))
512 rct_si = CMS_add1_signer(cms, signcert, pkey, NULL, flags);
514 CMSerr(CMS_F_CMS_SIGN_RECEIPT, CMS_R_ADD_SIGNER_ERROR);
518 os = cms_encode_Receipt(si);
523 /* Set content to digest */
524 rct_cont = BIO_new_mem_buf(os->data, os->length);
528 /* Add msgSigDigest attribute */
530 if (!cms_msgSigDigest_add1(rct_si, si))
533 /* Finalize structure */
534 if (!CMS_final(cms, rct_cont, NULL, flags))
537 /* Set embedded content */
538 pos = CMS_get0_content(cms);
547 CMS_ContentInfo_free(cms);
552 CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *data,
553 const EVP_CIPHER *cipher, unsigned int flags)
555 CMS_ContentInfo *cms;
558 cms = CMS_EnvelopedData_create(cipher);
561 for (i = 0; i < sk_X509_num(certs); i++) {
562 recip = sk_X509_value(certs, i);
563 if (!CMS_add1_recipient_cert(cms, recip, flags)) {
564 CMSerr(CMS_F_CMS_ENCRYPT, CMS_R_RECIPIENT_ERROR);
569 if (!(flags & CMS_DETACHED))
570 CMS_set_detached(cms, 0);
572 if ((flags & (CMS_STREAM | CMS_PARTIAL))
573 || CMS_final(cms, data, NULL, flags))
579 CMSerr(CMS_F_CMS_ENCRYPT, ERR_R_MALLOC_FAILURE);
581 CMS_ContentInfo_free(cms);
585 static int cms_kari_set1_pkey_and_peer(CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
586 EVP_PKEY *pk, X509 *cert, X509 *peer)
589 STACK_OF(CMS_RecipientEncryptedKey) *reks;
590 CMS_RecipientEncryptedKey *rek;
592 reks = CMS_RecipientInfo_kari_get0_reks(ri);
593 for (i = 0; i < sk_CMS_RecipientEncryptedKey_num(reks); i++) {
595 rek = sk_CMS_RecipientEncryptedKey_value(reks, i);
596 if (cert != NULL && CMS_RecipientEncryptedKey_cert_cmp(rek, cert))
598 CMS_RecipientInfo_kari_set0_pkey_and_peer(ri, pk, peer);
599 rv = CMS_RecipientInfo_kari_decrypt(cms, ri, rek);
600 CMS_RecipientInfo_kari_set0_pkey(ri, NULL);
603 return cert == NULL ? 0 : -1;
608 int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert)
610 return CMS_decrypt_set1_pkey_and_peer(cms, pk, cert, NULL);
613 int CMS_decrypt_set1_pkey_and_peer(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert, X509 *peer)
615 STACK_OF(CMS_RecipientInfo) *ris;
616 CMS_RecipientInfo *ri;
617 int i, r, cms_pkey_ri_type;
618 int debug = 0, match_ri = 0;
619 ris = CMS_get0_RecipientInfos(cms);
621 debug = cms->d.envelopedData->encryptedContentInfo->debug;
623 cms_pkey_ri_type = cms_pkey_get_ri_type(pk);
624 if (cms_pkey_ri_type == CMS_RECIPINFO_NONE) {
625 CMSerr(CMS_F_CMS_DECRYPT_SET1_PKEY_AND_PEER,
626 CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE);
630 for (i = 0; i < sk_CMS_RecipientInfo_num(ris); i++) {
633 ri = sk_CMS_RecipientInfo_value(ris, i);
634 ri_type = CMS_RecipientInfo_type(ri);
635 if (!cms_pkey_is_ri_type_supported(pk, ri_type))
638 if (ri_type == CMS_RECIPINFO_AGREE) {
639 r = cms_kari_set1_pkey_and_peer(cms, ri, pk, cert, peer);
646 * If we have a cert try matching RecipientInfo otherwise try them
649 else if (!cert || !CMS_RecipientInfo_ktri_cert_cmp(ri, cert)) {
651 CMS_RecipientInfo_set0_pkey(ri, pk);
652 r = CMS_RecipientInfo_decrypt(cms, ri);
653 CMS_RecipientInfo_set0_pkey(ri, NULL);
656 * If not debugging clear any error and return success to
657 * avoid leaking of information useful to MMA
665 CMSerr(CMS_F_CMS_DECRYPT_SET1_PKEY_AND_PEER, CMS_R_DECRYPT_ERROR);
669 * If no cert and not debugging don't leave loop after first
670 * successful decrypt. Always attempt to decrypt all recipients
671 * to avoid leaking timing of a successful decrypt.
673 else if (r > 0 && (debug || cms_pkey_ri_type != CMS_RECIPINFO_TRANS))
677 /* If no cert, key transport and not debugging always return success */
678 if (cert == NULL && cms_pkey_ri_type == CMS_RECIPINFO_TRANS && match_ri && !debug) {
683 CMSerr(CMS_F_CMS_DECRYPT_SET1_PKEY_AND_PEER, CMS_R_NO_MATCHING_RECIPIENT);
688 int CMS_decrypt_set1_key(CMS_ContentInfo *cms,
689 unsigned char *key, size_t keylen,
690 const unsigned char *id, size_t idlen)
692 STACK_OF(CMS_RecipientInfo) *ris;
693 CMS_RecipientInfo *ri;
695 ris = CMS_get0_RecipientInfos(cms);
696 for (i = 0; i < sk_CMS_RecipientInfo_num(ris); i++) {
697 ri = sk_CMS_RecipientInfo_value(ris, i);
698 if (CMS_RecipientInfo_type(ri) != CMS_RECIPINFO_KEK)
702 * If we have an id try matching RecipientInfo otherwise try them
705 if (!id || (CMS_RecipientInfo_kekri_id_cmp(ri, id, idlen) == 0)) {
706 CMS_RecipientInfo_set0_key(ri, key, keylen);
707 r = CMS_RecipientInfo_decrypt(cms, ri);
708 CMS_RecipientInfo_set0_key(ri, NULL, 0);
712 CMSerr(CMS_F_CMS_DECRYPT_SET1_KEY, CMS_R_DECRYPT_ERROR);
719 CMSerr(CMS_F_CMS_DECRYPT_SET1_KEY, CMS_R_NO_MATCHING_RECIPIENT);
724 int CMS_decrypt_set1_password(CMS_ContentInfo *cms,
725 unsigned char *pass, ossl_ssize_t passlen)
727 STACK_OF(CMS_RecipientInfo) *ris;
728 CMS_RecipientInfo *ri;
730 ris = CMS_get0_RecipientInfos(cms);
731 for (i = 0; i < sk_CMS_RecipientInfo_num(ris); i++) {
732 ri = sk_CMS_RecipientInfo_value(ris, i);
733 if (CMS_RecipientInfo_type(ri) != CMS_RECIPINFO_PASS)
735 CMS_RecipientInfo_set0_password(ri, pass, passlen);
736 r = CMS_RecipientInfo_decrypt(cms, ri);
737 CMS_RecipientInfo_set0_password(ri, NULL, 0);
742 CMSerr(CMS_F_CMS_DECRYPT_SET1_PASSWORD, CMS_R_NO_MATCHING_RECIPIENT);
747 int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert,
748 BIO *dcont, BIO *out, unsigned int flags)
753 if (OBJ_obj2nid(CMS_get0_type(cms)) != NID_pkcs7_enveloped) {
754 CMSerr(CMS_F_CMS_DECRYPT, CMS_R_TYPE_NOT_ENVELOPED_DATA);
757 if (!dcont && !check_content(cms))
759 if (flags & CMS_DEBUG_DECRYPT)
760 cms->d.envelopedData->encryptedContentInfo->debug = 1;
762 cms->d.envelopedData->encryptedContentInfo->debug = 0;
764 cms->d.envelopedData->encryptedContentInfo->havenocert = 1;
766 cms->d.envelopedData->encryptedContentInfo->havenocert = 0;
767 if (pk == NULL && cert == NULL && dcont == NULL && out == NULL)
769 if (pk != NULL && !CMS_decrypt_set1_pkey(cms, pk, cert))
771 cont = CMS_dataInit(cms, dcont);
774 r = cms_copy_content(out, cont, flags);
775 do_free_upto(cont, dcont);
779 int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int flags)
784 if ((cmsbio = CMS_dataInit(cms, dcont)) == NULL) {
785 CMSerr(CMS_F_CMS_FINAL, CMS_R_CMS_LIB);
789 SMIME_crlf_copy(data, cmsbio, flags);
791 (void)BIO_flush(cmsbio);
793 if (!CMS_dataFinal(cms, cmsbio)) {
794 CMSerr(CMS_F_CMS_FINAL, CMS_R_CMS_DATAFINAL_ERROR);
801 do_free_upto(cmsbio, dcont);
809 int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
814 if (OBJ_obj2nid(CMS_get0_type(cms)) != NID_id_smime_ct_compressedData) {
815 CMSerr(CMS_F_CMS_UNCOMPRESS, CMS_R_TYPE_NOT_COMPRESSED_DATA);
819 if (!dcont && !check_content(cms))
822 cont = CMS_dataInit(cms, dcont);
825 r = cms_copy_content(out, cont, flags);
826 do_free_upto(cont, dcont);
830 CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags)
832 CMS_ContentInfo *cms;
834 comp_nid = NID_zlib_compression;
835 cms = cms_CompressedData_create(comp_nid);
839 if (!(flags & CMS_DETACHED))
840 CMS_set_detached(cms, 0);
842 if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags))
845 CMS_ContentInfo_free(cms);
851 int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
854 CMSerr(CMS_F_CMS_UNCOMPRESS, CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM);
858 CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags)
860 CMSerr(CMS_F_CMS_COMPRESS, CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM);