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