xref: /src/crypto/openssl/include/openssl/cms.h (revision 1731fc70f7344af08db49b06c63c963fa12ee354)
1 /*
2  * WARNING: do not edit!
3  * Generated by Makefile from include/openssl/cms.h.in
4  *
5  * Copyright 2008-2025 The OpenSSL Project Authors. All Rights Reserved.
6  *
7  * Licensed under the Apache License 2.0 (the "License").  You may not use
8  * this file except in compliance with the License.  You can obtain a copy
9  * in the file LICENSE in the source distribution or at
10  * https://www.openssl.org/source/license.html
11  */
12 
13 /* clang-format off */
14 
15 /* clang-format on */
16 
17 #ifndef OPENSSL_CMS_H
18 #define OPENSSL_CMS_H
19 #pragma once
20 
21 #include <openssl/macros.h>
22 #ifndef OPENSSL_NO_DEPRECATED_3_0
23 #define HEADER_CMS_H
24 #endif
25 
26 #include <openssl/opensslconf.h>
27 
28 #ifndef OPENSSL_NO_CMS
29 #include <openssl/x509.h>
30 #include <openssl/x509v3.h>
31 #include <openssl/cmserr.h>
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 typedef struct CMS_EnvelopedData_st CMS_EnvelopedData;
37 typedef struct CMS_ContentInfo_st CMS_ContentInfo;
38 typedef struct CMS_SignerInfo_st CMS_SignerInfo;
39 typedef struct CMS_SignedData_st CMS_SignedData;
40 typedef struct CMS_CertificateChoices CMS_CertificateChoices;
41 typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice;
42 typedef struct CMS_RecipientInfo_st CMS_RecipientInfo;
43 typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest;
44 typedef struct CMS_Receipt_st CMS_Receipt;
45 typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey;
46 typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute;
47 
48 /* clang-format off */
49 SKM_DEFINE_STACK_OF_INTERNAL(CMS_SignerInfo, CMS_SignerInfo, CMS_SignerInfo)
50 #define sk_CMS_SignerInfo_num(sk) OPENSSL_sk_num(ossl_check_const_CMS_SignerInfo_sk_type(sk))
51 #define sk_CMS_SignerInfo_value(sk, idx) ((CMS_SignerInfo *)OPENSSL_sk_value(ossl_check_const_CMS_SignerInfo_sk_type(sk), (idx)))
52 #define sk_CMS_SignerInfo_new(cmp) ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_new(ossl_check_CMS_SignerInfo_compfunc_type(cmp)))
53 #define sk_CMS_SignerInfo_new_null() ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_new_null())
54 #define sk_CMS_SignerInfo_new_reserve(cmp, n) ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_new_reserve(ossl_check_CMS_SignerInfo_compfunc_type(cmp), (n)))
55 #define sk_CMS_SignerInfo_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CMS_SignerInfo_sk_type(sk), (n))
56 #define sk_CMS_SignerInfo_free(sk) OPENSSL_sk_free(ossl_check_CMS_SignerInfo_sk_type(sk))
57 #define sk_CMS_SignerInfo_zero(sk) OPENSSL_sk_zero(ossl_check_CMS_SignerInfo_sk_type(sk))
58 #define sk_CMS_SignerInfo_delete(sk, i) ((CMS_SignerInfo *)OPENSSL_sk_delete(ossl_check_CMS_SignerInfo_sk_type(sk), (i)))
59 #define sk_CMS_SignerInfo_delete_ptr(sk, ptr) ((CMS_SignerInfo *)OPENSSL_sk_delete_ptr(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr)))
60 #define sk_CMS_SignerInfo_push(sk, ptr) OPENSSL_sk_push(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr))
61 #define sk_CMS_SignerInfo_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr))
62 #define sk_CMS_SignerInfo_pop(sk) ((CMS_SignerInfo *)OPENSSL_sk_pop(ossl_check_CMS_SignerInfo_sk_type(sk)))
63 #define sk_CMS_SignerInfo_shift(sk) ((CMS_SignerInfo *)OPENSSL_sk_shift(ossl_check_CMS_SignerInfo_sk_type(sk)))
64 #define sk_CMS_SignerInfo_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CMS_SignerInfo_sk_type(sk),ossl_check_CMS_SignerInfo_freefunc_type(freefunc))
65 #define sk_CMS_SignerInfo_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr), (idx))
66 #define sk_CMS_SignerInfo_set(sk, idx, ptr) ((CMS_SignerInfo *)OPENSSL_sk_set(ossl_check_CMS_SignerInfo_sk_type(sk), (idx), ossl_check_CMS_SignerInfo_type(ptr)))
67 #define sk_CMS_SignerInfo_find(sk, ptr) OPENSSL_sk_find(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr))
68 #define sk_CMS_SignerInfo_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr))
69 #define sk_CMS_SignerInfo_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr), pnum)
70 #define sk_CMS_SignerInfo_sort(sk) OPENSSL_sk_sort(ossl_check_CMS_SignerInfo_sk_type(sk))
71 #define sk_CMS_SignerInfo_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CMS_SignerInfo_sk_type(sk))
72 #define sk_CMS_SignerInfo_dup(sk) ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_dup(ossl_check_const_CMS_SignerInfo_sk_type(sk)))
73 #define sk_CMS_SignerInfo_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_deep_copy(ossl_check_const_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_copyfunc_type(copyfunc), ossl_check_CMS_SignerInfo_freefunc_type(freefunc)))
74 #define sk_CMS_SignerInfo_set_cmp_func(sk, cmp) ((sk_CMS_SignerInfo_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_compfunc_type(cmp)))
75 SKM_DEFINE_STACK_OF_INTERNAL(CMS_RecipientEncryptedKey, CMS_RecipientEncryptedKey, CMS_RecipientEncryptedKey)
76 #define sk_CMS_RecipientEncryptedKey_num(sk) OPENSSL_sk_num(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk))
77 #define sk_CMS_RecipientEncryptedKey_value(sk, idx) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_value(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk), (idx)))
78 #define sk_CMS_RecipientEncryptedKey_new(cmp) ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_new(ossl_check_CMS_RecipientEncryptedKey_compfunc_type(cmp)))
79 #define sk_CMS_RecipientEncryptedKey_new_null() ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_new_null())
80 #define sk_CMS_RecipientEncryptedKey_new_reserve(cmp, n) ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_new_reserve(ossl_check_CMS_RecipientEncryptedKey_compfunc_type(cmp), (n)))
81 #define sk_CMS_RecipientEncryptedKey_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), (n))
82 #define sk_CMS_RecipientEncryptedKey_free(sk) OPENSSL_sk_free(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk))
83 #define sk_CMS_RecipientEncryptedKey_zero(sk) OPENSSL_sk_zero(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk))
84 #define sk_CMS_RecipientEncryptedKey_delete(sk, i) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_delete(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), (i)))
85 #define sk_CMS_RecipientEncryptedKey_delete_ptr(sk, ptr) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_delete_ptr(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr)))
86 #define sk_CMS_RecipientEncryptedKey_push(sk, ptr) OPENSSL_sk_push(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr))
87 #define sk_CMS_RecipientEncryptedKey_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr))
88 #define sk_CMS_RecipientEncryptedKey_pop(sk) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_pop(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk)))
89 #define sk_CMS_RecipientEncryptedKey_shift(sk) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_shift(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk)))
90 #define sk_CMS_RecipientEncryptedKey_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk),ossl_check_CMS_RecipientEncryptedKey_freefunc_type(freefunc))
91 #define sk_CMS_RecipientEncryptedKey_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr), (idx))
92 #define sk_CMS_RecipientEncryptedKey_set(sk, idx, ptr) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_set(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), (idx), ossl_check_CMS_RecipientEncryptedKey_type(ptr)))
93 #define sk_CMS_RecipientEncryptedKey_find(sk, ptr) OPENSSL_sk_find(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr))
94 #define sk_CMS_RecipientEncryptedKey_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr))
95 #define sk_CMS_RecipientEncryptedKey_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr), pnum)
96 #define sk_CMS_RecipientEncryptedKey_sort(sk) OPENSSL_sk_sort(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk))
97 #define sk_CMS_RecipientEncryptedKey_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk))
98 #define sk_CMS_RecipientEncryptedKey_dup(sk) ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_dup(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk)))
99 #define sk_CMS_RecipientEncryptedKey_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_deep_copy(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_copyfunc_type(copyfunc), ossl_check_CMS_RecipientEncryptedKey_freefunc_type(freefunc)))
100 #define sk_CMS_RecipientEncryptedKey_set_cmp_func(sk, cmp) ((sk_CMS_RecipientEncryptedKey_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_compfunc_type(cmp)))
101 SKM_DEFINE_STACK_OF_INTERNAL(CMS_RecipientInfo, CMS_RecipientInfo, CMS_RecipientInfo)
102 #define sk_CMS_RecipientInfo_num(sk) OPENSSL_sk_num(ossl_check_const_CMS_RecipientInfo_sk_type(sk))
103 #define sk_CMS_RecipientInfo_value(sk, idx) ((CMS_RecipientInfo *)OPENSSL_sk_value(ossl_check_const_CMS_RecipientInfo_sk_type(sk), (idx)))
104 #define sk_CMS_RecipientInfo_new(cmp) ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_new(ossl_check_CMS_RecipientInfo_compfunc_type(cmp)))
105 #define sk_CMS_RecipientInfo_new_null() ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_new_null())
106 #define sk_CMS_RecipientInfo_new_reserve(cmp, n) ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_new_reserve(ossl_check_CMS_RecipientInfo_compfunc_type(cmp), (n)))
107 #define sk_CMS_RecipientInfo_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CMS_RecipientInfo_sk_type(sk), (n))
108 #define sk_CMS_RecipientInfo_free(sk) OPENSSL_sk_free(ossl_check_CMS_RecipientInfo_sk_type(sk))
109 #define sk_CMS_RecipientInfo_zero(sk) OPENSSL_sk_zero(ossl_check_CMS_RecipientInfo_sk_type(sk))
110 #define sk_CMS_RecipientInfo_delete(sk, i) ((CMS_RecipientInfo *)OPENSSL_sk_delete(ossl_check_CMS_RecipientInfo_sk_type(sk), (i)))
111 #define sk_CMS_RecipientInfo_delete_ptr(sk, ptr) ((CMS_RecipientInfo *)OPENSSL_sk_delete_ptr(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr)))
112 #define sk_CMS_RecipientInfo_push(sk, ptr) OPENSSL_sk_push(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr))
113 #define sk_CMS_RecipientInfo_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr))
114 #define sk_CMS_RecipientInfo_pop(sk) ((CMS_RecipientInfo *)OPENSSL_sk_pop(ossl_check_CMS_RecipientInfo_sk_type(sk)))
115 #define sk_CMS_RecipientInfo_shift(sk) ((CMS_RecipientInfo *)OPENSSL_sk_shift(ossl_check_CMS_RecipientInfo_sk_type(sk)))
116 #define sk_CMS_RecipientInfo_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CMS_RecipientInfo_sk_type(sk),ossl_check_CMS_RecipientInfo_freefunc_type(freefunc))
117 #define sk_CMS_RecipientInfo_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr), (idx))
118 #define sk_CMS_RecipientInfo_set(sk, idx, ptr) ((CMS_RecipientInfo *)OPENSSL_sk_set(ossl_check_CMS_RecipientInfo_sk_type(sk), (idx), ossl_check_CMS_RecipientInfo_type(ptr)))
119 #define sk_CMS_RecipientInfo_find(sk, ptr) OPENSSL_sk_find(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr))
120 #define sk_CMS_RecipientInfo_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr))
121 #define sk_CMS_RecipientInfo_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr), pnum)
122 #define sk_CMS_RecipientInfo_sort(sk) OPENSSL_sk_sort(ossl_check_CMS_RecipientInfo_sk_type(sk))
123 #define sk_CMS_RecipientInfo_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CMS_RecipientInfo_sk_type(sk))
124 #define sk_CMS_RecipientInfo_dup(sk) ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_dup(ossl_check_const_CMS_RecipientInfo_sk_type(sk)))
125 #define sk_CMS_RecipientInfo_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_deep_copy(ossl_check_const_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_copyfunc_type(copyfunc), ossl_check_CMS_RecipientInfo_freefunc_type(freefunc)))
126 #define sk_CMS_RecipientInfo_set_cmp_func(sk, cmp) ((sk_CMS_RecipientInfo_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_compfunc_type(cmp)))
127 SKM_DEFINE_STACK_OF_INTERNAL(CMS_RevocationInfoChoice, CMS_RevocationInfoChoice, CMS_RevocationInfoChoice)
128 #define sk_CMS_RevocationInfoChoice_num(sk) OPENSSL_sk_num(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk))
129 #define sk_CMS_RevocationInfoChoice_value(sk, idx) ((CMS_RevocationInfoChoice *)OPENSSL_sk_value(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk), (idx)))
130 #define sk_CMS_RevocationInfoChoice_new(cmp) ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_new(ossl_check_CMS_RevocationInfoChoice_compfunc_type(cmp)))
131 #define sk_CMS_RevocationInfoChoice_new_null() ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_new_null())
132 #define sk_CMS_RevocationInfoChoice_new_reserve(cmp, n) ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_new_reserve(ossl_check_CMS_RevocationInfoChoice_compfunc_type(cmp), (n)))
133 #define sk_CMS_RevocationInfoChoice_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), (n))
134 #define sk_CMS_RevocationInfoChoice_free(sk) OPENSSL_sk_free(ossl_check_CMS_RevocationInfoChoice_sk_type(sk))
135 #define sk_CMS_RevocationInfoChoice_zero(sk) OPENSSL_sk_zero(ossl_check_CMS_RevocationInfoChoice_sk_type(sk))
136 #define sk_CMS_RevocationInfoChoice_delete(sk, i) ((CMS_RevocationInfoChoice *)OPENSSL_sk_delete(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), (i)))
137 #define sk_CMS_RevocationInfoChoice_delete_ptr(sk, ptr) ((CMS_RevocationInfoChoice *)OPENSSL_sk_delete_ptr(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr)))
138 #define sk_CMS_RevocationInfoChoice_push(sk, ptr) OPENSSL_sk_push(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr))
139 #define sk_CMS_RevocationInfoChoice_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr))
140 #define sk_CMS_RevocationInfoChoice_pop(sk) ((CMS_RevocationInfoChoice *)OPENSSL_sk_pop(ossl_check_CMS_RevocationInfoChoice_sk_type(sk)))
141 #define sk_CMS_RevocationInfoChoice_shift(sk) ((CMS_RevocationInfoChoice *)OPENSSL_sk_shift(ossl_check_CMS_RevocationInfoChoice_sk_type(sk)))
142 #define sk_CMS_RevocationInfoChoice_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CMS_RevocationInfoChoice_sk_type(sk),ossl_check_CMS_RevocationInfoChoice_freefunc_type(freefunc))
143 #define sk_CMS_RevocationInfoChoice_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr), (idx))
144 #define sk_CMS_RevocationInfoChoice_set(sk, idx, ptr) ((CMS_RevocationInfoChoice *)OPENSSL_sk_set(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), (idx), ossl_check_CMS_RevocationInfoChoice_type(ptr)))
145 #define sk_CMS_RevocationInfoChoice_find(sk, ptr) OPENSSL_sk_find(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr))
146 #define sk_CMS_RevocationInfoChoice_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr))
147 #define sk_CMS_RevocationInfoChoice_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr), pnum)
148 #define sk_CMS_RevocationInfoChoice_sort(sk) OPENSSL_sk_sort(ossl_check_CMS_RevocationInfoChoice_sk_type(sk))
149 #define sk_CMS_RevocationInfoChoice_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk))
150 #define sk_CMS_RevocationInfoChoice_dup(sk) ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_dup(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk)))
151 #define sk_CMS_RevocationInfoChoice_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_deep_copy(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_copyfunc_type(copyfunc), ossl_check_CMS_RevocationInfoChoice_freefunc_type(freefunc)))
152 #define sk_CMS_RevocationInfoChoice_set_cmp_func(sk, cmp) ((sk_CMS_RevocationInfoChoice_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_compfunc_type(cmp)))
153 
154 /* clang-format on */
155 
156 DECLARE_ASN1_ITEM(CMS_EnvelopedData)
157 DECLARE_ASN1_ALLOC_FUNCTIONS(CMS_SignedData)
158 DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
159 DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest)
160 DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
161 
162 DECLARE_ASN1_DUP_FUNCTION(CMS_EnvelopedData)
163 
164 CMS_ContentInfo *CMS_ContentInfo_new_ex(OSSL_LIB_CTX *libctx, const char *propq);
165 
166 #define CMS_SIGNERINFO_ISSUER_SERIAL 0
167 #define CMS_SIGNERINFO_KEYIDENTIFIER 1
168 
169 #define CMS_RECIPINFO_NONE -1
170 #define CMS_RECIPINFO_TRANS 0
171 #define CMS_RECIPINFO_AGREE 1
172 #define CMS_RECIPINFO_KEK 2
173 #define CMS_RECIPINFO_PASS 3
174 #define CMS_RECIPINFO_OTHER 4
175 
176 /* S/MIME related flags */
177 
178 #define CMS_TEXT 0x1
179 #define CMS_NOCERTS 0x2
180 #define CMS_NO_CONTENT_VERIFY 0x4
181 #define CMS_NO_ATTR_VERIFY 0x8
182 #define CMS_NOSIGS \
183     (CMS_NO_CONTENT_VERIFY | CMS_NO_ATTR_VERIFY)
184 #define CMS_NOINTERN 0x10
185 #define CMS_NO_SIGNER_CERT_VERIFY 0x20
186 #define CMS_NOVERIFY 0x20
187 #define CMS_DETACHED 0x40
188 #define CMS_BINARY 0x80
189 #define CMS_NOATTR 0x100
190 #define CMS_NOSMIMECAP 0x200
191 #define CMS_NOOLDMIMETYPE 0x400
192 #define CMS_CRLFEOL 0x800
193 #define CMS_STREAM 0x1000
194 #define CMS_NOCRL 0x2000
195 #define CMS_PARTIAL 0x4000
196 #define CMS_REUSE_DIGEST 0x8000
197 #define CMS_USE_KEYID 0x10000
198 #define CMS_DEBUG_DECRYPT 0x20000
199 #define CMS_KEY_PARAM 0x40000
200 #define CMS_ASCIICRLF 0x80000
201 #define CMS_CADES 0x100000
202 #define CMS_USE_ORIGINATOR_KEYID 0x200000
203 #define CMS_NO_SIGNING_TIME 0x400000
204 
205 const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms);
206 
207 BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont);
208 int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio);
209 
210 ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms);
211 int CMS_is_detached(CMS_ContentInfo *cms);
212 int CMS_set_detached(CMS_ContentInfo *cms, int detached);
213 
214 #ifdef OPENSSL_PEM_H
215 DECLARE_PEM_rw(CMS, CMS_ContentInfo)
216 #endif
217 int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms);
218 CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms);
219 int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms);
220 
221 BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);
222 int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags);
223 int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in,
224     int flags);
225 CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont);
226 CMS_ContentInfo *SMIME_read_CMS_ex(BIO *bio, int flags, BIO **bcont, CMS_ContentInfo **ci);
227 int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags);
228 
229 int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont,
230     unsigned int flags);
231 int CMS_final_digest(CMS_ContentInfo *cms,
232     const unsigned char *md, unsigned int mdlen, BIO *dcont,
233     unsigned int flags);
234 
235 CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey,
236     STACK_OF(X509) *certs, BIO *data,
237     unsigned int flags);
238 CMS_ContentInfo *CMS_sign_ex(X509 *signcert, EVP_PKEY *pkey,
239     STACK_OF(X509) *certs, BIO *data,
240     unsigned int flags, OSSL_LIB_CTX *libctx,
241     const char *propq);
242 
243 CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si,
244     X509 *signcert, EVP_PKEY *pkey,
245     STACK_OF(X509) *certs, unsigned int flags);
246 
247 int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags);
248 CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags);
249 CMS_ContentInfo *CMS_data_create_ex(BIO *in, unsigned int flags,
250     OSSL_LIB_CTX *libctx, const char *propq);
251 
252 int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
253     unsigned int flags);
254 CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md,
255     unsigned int flags);
256 CMS_ContentInfo *CMS_digest_create_ex(BIO *in, const EVP_MD *md,
257     unsigned int flags, OSSL_LIB_CTX *libctx,
258     const char *propq);
259 
260 int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,
261     const unsigned char *key, size_t keylen,
262     BIO *dcont, BIO *out, unsigned int flags);
263 CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher,
264     const unsigned char *key,
265     size_t keylen, unsigned int flags);
266 CMS_ContentInfo *CMS_EncryptedData_encrypt_ex(BIO *in, const EVP_CIPHER *cipher,
267     const unsigned char *key,
268     size_t keylen, unsigned int flags,
269     OSSL_LIB_CTX *libctx,
270     const char *propq);
271 
272 int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph,
273     const unsigned char *key, size_t keylen);
274 
275 int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
276     X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags);
277 
278 int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms,
279     STACK_OF(X509) *certs,
280     X509_STORE *store, unsigned int flags);
281 
282 STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms);
283 
284 CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in,
285     const EVP_CIPHER *cipher, unsigned int flags);
286 CMS_ContentInfo *CMS_encrypt_ex(STACK_OF(X509) *certs, BIO *in,
287     const EVP_CIPHER *cipher, unsigned int flags,
288     OSSL_LIB_CTX *libctx, const char *propq);
289 
290 int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert,
291     BIO *dcont, BIO *out, unsigned int flags);
292 
293 int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert);
294 int CMS_decrypt_set1_pkey_and_peer(CMS_ContentInfo *cms, EVP_PKEY *pk,
295     X509 *cert, X509 *peer);
296 int CMS_decrypt_set1_key(CMS_ContentInfo *cms,
297     unsigned char *key, size_t keylen,
298     const unsigned char *id, size_t idlen);
299 int CMS_decrypt_set1_password(CMS_ContentInfo *cms,
300     unsigned char *pass, ossl_ssize_t passlen);
301 
302 STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);
303 int CMS_RecipientInfo_type(CMS_RecipientInfo *ri);
304 EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri);
305 CMS_ContentInfo *CMS_AuthEnvelopedData_create(const EVP_CIPHER *cipher);
306 CMS_ContentInfo *
307 CMS_AuthEnvelopedData_create_ex(const EVP_CIPHER *cipher, OSSL_LIB_CTX *libctx,
308     const char *propq);
309 CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher);
310 CMS_ContentInfo *CMS_EnvelopedData_create_ex(const EVP_CIPHER *cipher,
311     OSSL_LIB_CTX *libctx,
312     const char *propq);
313 BIO *CMS_EnvelopedData_decrypt(CMS_EnvelopedData *env, BIO *detached_data,
314     EVP_PKEY *pkey, X509 *cert,
315     ASN1_OCTET_STRING *secret, unsigned int flags,
316     OSSL_LIB_CTX *libctx, const char *propq);
317 
318 CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,
319     X509 *recip, unsigned int flags);
320 CMS_RecipientInfo *CMS_add1_recipient(CMS_ContentInfo *cms, X509 *recip,
321     EVP_PKEY *originatorPrivKey, X509 *originator, unsigned int flags);
322 int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);
323 int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);
324 int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri,
325     EVP_PKEY **pk, X509 **recip,
326     X509_ALGOR **palg);
327 int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri,
328     ASN1_OCTET_STRING **keyid,
329     X509_NAME **issuer,
330     ASN1_INTEGER **sno);
331 
332 CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid,
333     unsigned char *key, size_t keylen,
334     unsigned char *id, size_t idlen,
335     ASN1_GENERALIZEDTIME *date,
336     ASN1_OBJECT *otherTypeId,
337     ASN1_TYPE *otherType);
338 
339 int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri,
340     X509_ALGOR **palg,
341     ASN1_OCTET_STRING **pid,
342     ASN1_GENERALIZEDTIME **pdate,
343     ASN1_OBJECT **potherid,
344     ASN1_TYPE **pothertype);
345 
346 int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri,
347     unsigned char *key, size_t keylen);
348 
349 int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri,
350     const unsigned char *id, size_t idlen);
351 
352 int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri,
353     unsigned char *pass,
354     ossl_ssize_t passlen);
355 
356 CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,
357     int iter, int wrap_nid,
358     int pbe_nid,
359     unsigned char *pass,
360     ossl_ssize_t passlen,
361     const EVP_CIPHER *kekciph);
362 
363 int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
364 int CMS_RecipientInfo_encrypt(const CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
365 
366 int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
367     unsigned int flags);
368 CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags);
369 
370 int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);
371 const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);
372 
373 CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms);
374 int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);
375 int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);
376 STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);
377 
378 CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms);
379 int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
380 int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);
381 STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);
382 
383 int CMS_SignedData_init(CMS_ContentInfo *cms);
384 CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms,
385     X509 *signer, EVP_PKEY *pk, const EVP_MD *md,
386     unsigned int flags);
387 EVP_PKEY_CTX *CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si);
388 EVP_MD_CTX *CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si);
389 STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);
390 
391 void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);
392 int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si,
393     ASN1_OCTET_STRING **keyid,
394     X509_NAME **issuer, ASN1_INTEGER **sno);
395 int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert);
396 int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
397     unsigned int flags);
398 void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk,
399     X509 **signer, X509_ALGOR **pdig,
400     X509_ALGOR **psig);
401 ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si);
402 int CMS_SignerInfo_sign(CMS_SignerInfo *si);
403 int CMS_SignerInfo_verify(CMS_SignerInfo *si);
404 int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain);
405 BIO *CMS_SignedData_verify(CMS_SignedData *sd, BIO *detached_data,
406     STACK_OF(X509) *scerts, X509_STORE *store,
407     STACK_OF(X509) *extra, STACK_OF(X509_CRL) *crls,
408     unsigned int flags,
409     OSSL_LIB_CTX *libctx, const char *propq);
410 
411 int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs);
412 int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs,
413     int algnid, int keysize);
414 int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap);
415 
416 int CMS_signed_get_attr_count(const CMS_SignerInfo *si);
417 int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
418     int lastpos);
419 int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj,
420     int lastpos);
421 X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc);
422 X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc);
423 int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
424 int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si,
425     const ASN1_OBJECT *obj, int type,
426     const void *bytes, int len);
427 int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si,
428     int nid, int type,
429     const void *bytes, int len);
430 int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si,
431     const char *attrname, int type,
432     const void *bytes, int len);
433 void *CMS_signed_get0_data_by_OBJ(const CMS_SignerInfo *si,
434     const ASN1_OBJECT *oid,
435     int lastpos, int type);
436 
437 int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si);
438 int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
439     int lastpos);
440 int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si,
441     const ASN1_OBJECT *obj, int lastpos);
442 X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc);
443 X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc);
444 int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
445 int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si,
446     const ASN1_OBJECT *obj, int type,
447     const void *bytes, int len);
448 int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si,
449     int nid, int type,
450     const void *bytes, int len);
451 int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si,
452     const char *attrname, int type,
453     const void *bytes, int len);
454 void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,
455     int lastpos, int type);
456 
457 int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr);
458 CMS_ReceiptRequest *CMS_ReceiptRequest_create0(
459     unsigned char *id, int idlen, int allorfirst,
460     STACK_OF(GENERAL_NAMES) *receiptList,
461     STACK_OF(GENERAL_NAMES) *receiptsTo);
462 CMS_ReceiptRequest *CMS_ReceiptRequest_create0_ex(
463     unsigned char *id, int idlen, int allorfirst,
464     STACK_OF(GENERAL_NAMES) *receiptList,
465     STACK_OF(GENERAL_NAMES) *receiptsTo,
466     OSSL_LIB_CTX *libctx);
467 
468 int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr);
469 void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr,
470     ASN1_STRING **pcid,
471     int *pallorfirst,
472     STACK_OF(GENERAL_NAMES) **plist,
473     STACK_OF(GENERAL_NAMES) **prto);
474 int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri,
475     X509_ALGOR **palg,
476     ASN1_OCTET_STRING **pukm);
477 STACK_OF(CMS_RecipientEncryptedKey)
478 *CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri);
479 
480 int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri,
481     X509_ALGOR **pubalg,
482     ASN1_BIT_STRING **pubkey,
483     ASN1_OCTET_STRING **keyid,
484     X509_NAME **issuer,
485     ASN1_INTEGER **sno);
486 
487 int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert);
488 
489 int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek,
490     ASN1_OCTET_STRING **keyid,
491     ASN1_GENERALIZEDTIME **tm,
492     CMS_OtherKeyAttribute **other,
493     X509_NAME **issuer, ASN1_INTEGER **sno);
494 int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek,
495     X509 *cert);
496 int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk);
497 int CMS_RecipientInfo_kari_set0_pkey_and_peer(CMS_RecipientInfo *ri, EVP_PKEY *pk, X509 *peer);
498 EVP_CIPHER_CTX *CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri);
499 int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms,
500     CMS_RecipientInfo *ri,
501     CMS_RecipientEncryptedKey *rek);
502 
503 int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg,
504     ASN1_OCTET_STRING *ukm, int keylen);
505 
506 /* Backward compatibility for spelling errors. */
507 #define CMS_R_UNKNOWN_DIGEST_ALGORITM CMS_R_UNKNOWN_DIGEST_ALGORITHM
508 #define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE \
509     CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE
510 
511 #ifdef __cplusplus
512 }
513 #endif
514 #endif
515 #endif
516