xref: /openbsd/lib/libcrypto/cms/cms.h (revision 5b3c21da)
1 /* $OpenBSD: cms.h,v 1.18 2024/03/30 00:35:15 joshua Exp $ */
2 /*
3  * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4  * project.
5  */
6 /* ====================================================================
7  * Copyright (c) 2008 The OpenSSL Project.  All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in
18  *    the documentation and/or other materials provided with the
19  *    distribution.
20  *
21  * 3. All advertising materials mentioning features or use of this
22  *    software must display the following acknowledgment:
23  *    "This product includes software developed by the OpenSSL Project
24  *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
25  *
26  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27  *    endorse or promote products derived from this software without
28  *    prior written permission. For written permission, please contact
29  *    licensing@OpenSSL.org.
30  *
31  * 5. Products derived from this software may not be called "OpenSSL"
32  *    nor may "OpenSSL" appear in their names without prior written
33  *    permission of the OpenSSL Project.
34  *
35  * 6. Redistributions of any form whatsoever must retain the following
36  *    acknowledgment:
37  *    "This product includes software developed by the OpenSSL Project
38  *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
39  *
40  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
41  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
44  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51  * OF THE POSSIBILITY OF SUCH DAMAGE.
52  * ====================================================================
53  */
54 
55 #ifndef HEADER_CMS_H
56 #define HEADER_CMS_H
57 
58 #include <openssl/opensslconf.h>
59 
60 #ifndef OPENSSL_NO_CMS
61 
62 #include <openssl/pem.h>
63 #include <openssl/x509.h>
64 #include <openssl/x509v3.h>
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
70 typedef struct CMS_ContentInfo_st CMS_ContentInfo;
71 typedef struct CMS_SignerInfo_st CMS_SignerInfo;
72 typedef struct CMS_CertificateChoices CMS_CertificateChoices;
73 typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice;
74 typedef struct CMS_RecipientInfo_st CMS_RecipientInfo;
75 typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest;
76 typedef struct CMS_Receipt_st CMS_Receipt;
77 typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey;
78 typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute;
79 
80 DECLARE_STACK_OF(CMS_SignerInfo)
81 DECLARE_STACK_OF(CMS_RecipientEncryptedKey)
82 DECLARE_STACK_OF(CMS_RecipientInfo)
83 DECLARE_STACK_OF(CMS_RevocationInfoChoice)
84 CMS_ContentInfo *CMS_ContentInfo_new(void);
85 void CMS_ContentInfo_free(CMS_ContentInfo *a);
86 CMS_ContentInfo *d2i_CMS_ContentInfo(CMS_ContentInfo **a, const unsigned char **in, long len);
87 int i2d_CMS_ContentInfo(CMS_ContentInfo *a, unsigned char **out);
88 extern const ASN1_ITEM CMS_ContentInfo_it;
89 CMS_ReceiptRequest *CMS_ReceiptRequest_new(void);
90 void CMS_ReceiptRequest_free(CMS_ReceiptRequest *a);
91 CMS_ReceiptRequest *d2i_CMS_ReceiptRequest(CMS_ReceiptRequest **a, const unsigned char **in, long len);
92 int i2d_CMS_ReceiptRequest(CMS_ReceiptRequest *a, unsigned char **out);
93 extern const ASN1_ITEM CMS_ReceiptRequest_it;
94 int CMS_ContentInfo_print_ctx(BIO *out, CMS_ContentInfo *x, int indent, const ASN1_PCTX *pctx);
95 
96 #define CMS_SIGNERINFO_ISSUER_SERIAL    0
97 #define CMS_SIGNERINFO_KEYIDENTIFIER    1
98 
99 #define CMS_RECIPINFO_NONE              -1
100 #define CMS_RECIPINFO_TRANS             0
101 #define CMS_RECIPINFO_AGREE             1
102 #define CMS_RECIPINFO_KEK               2
103 #define CMS_RECIPINFO_PASS              3
104 #define CMS_RECIPINFO_OTHER             4
105 
106 /* S/MIME related flags */
107 
108 #define CMS_TEXT                        0x1
109 #define CMS_NOCERTS                     0x2
110 #define CMS_NO_CONTENT_VERIFY           0x4
111 #define CMS_NO_ATTR_VERIFY              0x8
112 #define CMS_NOSIGS                      \
113                         (CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY)
114 #define CMS_NOINTERN                    0x10
115 #define CMS_NO_SIGNER_CERT_VERIFY       0x20
116 #define CMS_NOVERIFY                    0x20
117 #define CMS_DETACHED                    0x40
118 #define CMS_BINARY                      0x80
119 #define CMS_NOATTR                      0x100
120 #define CMS_NOSMIMECAP                  0x200
121 #define CMS_NOOLDMIMETYPE               0x400
122 #define CMS_CRLFEOL                     0x800
123 #define CMS_STREAM                      0x1000
124 #define CMS_NOCRL                       0x2000
125 #define CMS_PARTIAL                     0x4000
126 #define CMS_REUSE_DIGEST                0x8000
127 #define CMS_USE_KEYID                   0x10000
128 #define CMS_DEBUG_DECRYPT               0x20000
129 #define CMS_KEY_PARAM                   0x40000
130 #define CMS_ASCIICRLF                   0x80000
131 
132 const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms);
133 
134 int CMS_get_version(const CMS_ContentInfo *cms, long *version);
135 int CMS_SignerInfo_get_version(const CMS_SignerInfo *si, long *version);
136 
137 BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont);
138 int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio);
139 
140 ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms);
141 int CMS_is_detached(CMS_ContentInfo *cms);
142 int CMS_set_detached(CMS_ContentInfo *cms, int detached);
143 
144 CMS_ContentInfo *PEM_read_bio_CMS(BIO *bp, CMS_ContentInfo **x,
145     pem_password_cb *cb, void *u);
146 CMS_ContentInfo *PEM_read_CMS(FILE *fp, CMS_ContentInfo **x,
147     pem_password_cb *cb, void *u);
148 int PEM_write_bio_CMS(BIO *bp, const CMS_ContentInfo *x);
149 int PEM_write_CMS(FILE *fp, const CMS_ContentInfo *x);
150 int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms);
151 CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms);
152 int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms);
153 
154 BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);
155 int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags);
156 int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in,
157     int flags);
158 CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont);
159 int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags);
160 
161 int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int flags);
162 
163 CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
164     BIO *data, unsigned int flags);
165 
166 CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, X509 *signcert,
167     EVP_PKEY *pkey, STACK_OF(X509) *certs, unsigned int flags);
168 
169 int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags);
170 CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags);
171 
172 int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
173     unsigned int flags);
174 CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md,
175     unsigned int flags);
176 
177 int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms, const unsigned char *key,
178     size_t keylen, BIO *dcont, BIO *out, unsigned int flags);
179 
180 CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher,
181     const unsigned char *key, size_t keylen, unsigned int flags);
182 
183 int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph,
184     const unsigned char *key, size_t keylen);
185 
186 int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
187     X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags);
188 
189 int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms,
190     STACK_OF(X509) *certs, X509_STORE *store, unsigned int flags);
191 
192 STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms);
193 
194 CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in,
195     const EVP_CIPHER *cipher, unsigned int flags);
196 
197 int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert,
198     BIO *dcont, BIO *out, unsigned int flags);
199 
200 int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert);
201 int CMS_decrypt_set1_key(CMS_ContentInfo *cms, unsigned char *key,
202     size_t keylen, const unsigned char *id, size_t idlen);
203 int CMS_decrypt_set1_password(CMS_ContentInfo *cms, unsigned char *pass,
204     ssize_t passlen);
205 
206 STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);
207 int CMS_RecipientInfo_type(CMS_RecipientInfo *ri);
208 EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri);
209 CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher);
210 CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms, X509 *recip,
211     unsigned int flags);
212 int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);
213 int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);
214 int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri, EVP_PKEY **pk,
215     X509 **recip, X509_ALGOR **palg);
216 int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri,
217     ASN1_OCTET_STRING **keyid, X509_NAME **issuer, ASN1_INTEGER **sno);
218 
219 CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid,
220     unsigned char *key, size_t keylen, unsigned char *id, size_t idlen,
221     ASN1_GENERALIZEDTIME *date, ASN1_OBJECT *otherTypeId, ASN1_TYPE *otherType);
222 
223 int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, X509_ALGOR **palg,
224     ASN1_OCTET_STRING **pid, ASN1_GENERALIZEDTIME **pdate,
225     ASN1_OBJECT **potherid, ASN1_TYPE **pothertype);
226 
227 int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, unsigned char *key,
228     size_t keylen);
229 
230 int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri,
231     const unsigned char *id, size_t idlen);
232 
233 int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri, unsigned char *pass,
234     ssize_t passlen);
235 
236 CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms, int iter,
237     int wrap_nid, int pbe_nid, unsigned char *pass, ssize_t passlen,
238     const EVP_CIPHER *kekciph);
239 
240 int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
241 int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
242 
243 int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
244     unsigned int flags);
245 CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags);
246 
247 int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);
248 const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);
249 
250 CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms);
251 int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);
252 int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);
253 STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);
254 
255 CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms);
256 int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
257 int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);
258 STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);
259 
260 int CMS_SignedData_init(CMS_ContentInfo *cms);
261 CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms, X509 *signer,
262     EVP_PKEY *pk, const EVP_MD *md, unsigned int flags);
263 EVP_PKEY_CTX *CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si);
264 EVP_MD_CTX *CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si);
265 STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);
266 
267 void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);
268 int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, ASN1_OCTET_STRING **keyid,
269     X509_NAME **issuer, ASN1_INTEGER **sno);
270 int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert);
271 int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
272     unsigned int flags);
273 void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk, X509 **signer,
274     X509_ALGOR **pdig, X509_ALGOR **psig);
275 ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si);
276 int CMS_SignerInfo_sign(CMS_SignerInfo *si);
277 int CMS_SignerInfo_verify(CMS_SignerInfo *si);
278 int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain);
279 
280 int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs);
281 int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs, int algnid,
282     int keysize);
283 int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap);
284 
285 int CMS_signed_get_attr_count(const CMS_SignerInfo *si);
286 int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid, int lastpos);
287 int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj,
288     int lastpos);
289 X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc);
290 X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc);
291 int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
292 int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *obj,
293     int type, const void *bytes, int len);
294 int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si, int nid, int type,
295     const void *bytes, int len);
296 int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si,
297     const char *attrname, int type, const void *bytes, int len);
298 void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid,
299     int lastpos, int type);
300 
301 int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si);
302 int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
303     int lastpos);
304 int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si,
305     const ASN1_OBJECT *obj, int lastpos);
306 X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc);
307 X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc);
308 int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
309 int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si,
310     const ASN1_OBJECT *obj, int type, const void *bytes, int len);
311 int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si, int nid, int type,
312     const void *bytes, int len);
313 int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si, const char *attrname,
314     int type, const void *bytes, int len);
315 void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,
316     int lastpos, int type);
317 
318 int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr);
319 CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen,
320     int allorfirst, STACK_OF(GENERAL_NAMES) *receiptList,
321     STACK_OF(GENERAL_NAMES) *receiptsTo);
322 int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr);
323 void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr, ASN1_STRING **pcid,
324     int *pallorfirst, STACK_OF(GENERAL_NAMES) **plist,
325     STACK_OF(GENERAL_NAMES) **prto);
326 
327 int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri, X509_ALGOR **palg,
328     ASN1_OCTET_STRING **pukm);
329 STACK_OF(CMS_RecipientEncryptedKey) *
330     CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri);
331 
332 int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri,
333     X509_ALGOR **pubalg, ASN1_BIT_STRING **pubkey, ASN1_OCTET_STRING **keyid,
334     X509_NAME **issuer, ASN1_INTEGER **sno);
335 
336 int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert);
337 
338 int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek,
339     ASN1_OCTET_STRING **keyid, ASN1_GENERALIZEDTIME **tm,
340     CMS_OtherKeyAttribute **other, X509_NAME **issuer, ASN1_INTEGER **sno);
341 int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek,
342     X509 *cert);
343 int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk);
344 EVP_CIPHER_CTX *CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri);
345 int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms,
346     CMS_RecipientInfo *ri, CMS_RecipientEncryptedKey *rek);
347 
348 int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg,
349     ASN1_OCTET_STRING *ukm, int keylen);
350 
351 /* Backward compatibility for spelling errors. */
352 #define CMS_R_UNKNOWN_DIGEST_ALGORITM CMS_R_UNKNOWN_DIGEST_ALGORITHM
353 #define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE \
354     CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE
355 
356 int ERR_load_CMS_strings(void);
357 
358 /*
359  * CMS function codes.
360  */
361 #define CMS_F_CHECK_CONTENT                              99
362 #define CMS_F_CMS_ADD0_CERT                              164
363 #define CMS_F_CMS_ADD0_RECIPIENT_KEY                     100
364 #define CMS_F_CMS_ADD0_RECIPIENT_PASSWORD                165
365 #define CMS_F_CMS_ADD1_RECEIPTREQUEST                    158
366 #define CMS_F_CMS_ADD1_RECIPIENT_CERT                    101
367 #define CMS_F_CMS_ADD1_SIGNER                            102
368 #define CMS_F_CMS_ADD1_SIGNINGTIME                       103
369 #define CMS_F_CMS_COMPRESS                               104
370 #define CMS_F_CMS_COMPRESSEDDATA_CREATE                  105
371 #define CMS_F_CMS_COMPRESSEDDATA_INIT_BIO                106
372 #define CMS_F_CMS_COPY_CONTENT                           107
373 #define CMS_F_CMS_COPY_MESSAGEDIGEST                     108
374 #define CMS_F_CMS_DATA                                   109
375 #define CMS_F_CMS_DATAFINAL                              110
376 #define CMS_F_CMS_DATAINIT                               111
377 #define CMS_F_CMS_DECRYPT                                112
378 #define CMS_F_CMS_DECRYPT_SET1_KEY                       113
379 #define CMS_F_CMS_DECRYPT_SET1_PASSWORD                  166
380 #define CMS_F_CMS_DECRYPT_SET1_PKEY                      114
381 #define CMS_F_CMS_DIGESTALGORITHM_FIND_CTX               115
382 #define CMS_F_CMS_DIGESTALGORITHM_INIT_BIO               116
383 #define CMS_F_CMS_DIGESTEDDATA_DO_FINAL                  117
384 #define CMS_F_CMS_DIGEST_VERIFY                          118
385 #define CMS_F_CMS_ENCODE_RECEIPT                         161
386 #define CMS_F_CMS_ENCRYPT                                119
387 #define CMS_F_CMS_ENCRYPTEDCONTENT_INIT                  179
388 #define CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO              120
389 #define CMS_F_CMS_ENCRYPTEDDATA_DECRYPT                  121
390 #define CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT                  122
391 #define CMS_F_CMS_ENCRYPTEDDATA_SET1_KEY                 123
392 #define CMS_F_CMS_ENVELOPEDDATA_CREATE                   124
393 #define CMS_F_CMS_ENVELOPEDDATA_INIT_BIO                 125
394 #define CMS_F_CMS_ENVELOPED_DATA_INIT                    126
395 #define CMS_F_CMS_ENV_ASN1_CTRL                          171
396 #define CMS_F_CMS_FINAL                                  127
397 #define CMS_F_CMS_GET0_CERTIFICATE_CHOICES               128
398 #define CMS_F_CMS_GET0_CONTENT                           129
399 #define CMS_F_CMS_GET0_ECONTENT_TYPE                     130
400 #define CMS_F_CMS_GET0_ENVELOPED                         131
401 #define CMS_F_CMS_GET0_REVOCATION_CHOICES                132
402 #define CMS_F_CMS_GET0_SIGNED                            133
403 #define CMS_F_CMS_MSGSIGDIGEST_ADD1                      162
404 #define CMS_F_CMS_RECEIPTREQUEST_CREATE0                 159
405 #define CMS_F_CMS_RECEIPT_VERIFY                         160
406 #define CMS_F_CMS_RECIPIENTINFO_DECRYPT                  134
407 #define CMS_F_CMS_RECIPIENTINFO_ENCRYPT                  169
408 #define CMS_F_CMS_RECIPIENTINFO_KARI_ENCRYPT             178
409 #define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ALG            175
410 #define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ORIG_ID        173
411 #define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_REKS           172
412 #define CMS_F_CMS_RECIPIENTINFO_KARI_ORIG_ID_CMP         174
413 #define CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT            135
414 #define CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT            136
415 #define CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID            137
416 #define CMS_F_CMS_RECIPIENTINFO_KEKRI_ID_CMP             138
417 #define CMS_F_CMS_RECIPIENTINFO_KTRI_CERT_CMP            139
418 #define CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT             140
419 #define CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT             141
420 #define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS           142
421 #define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID      143
422 #define CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT               167
423 #define CMS_F_CMS_RECIPIENTINFO_SET0_KEY                 144
424 #define CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD            168
425 #define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY                145
426 #define CMS_F_CMS_SD_ASN1_CTRL                           170
427 #define CMS_F_CMS_SET1_IAS                               176
428 #define CMS_F_CMS_SET1_KEYID                             177
429 #define CMS_F_CMS_SET1_SIGNERIDENTIFIER                  146
430 #define CMS_F_CMS_SET_DETACHED                           147
431 #define CMS_F_CMS_SIGN                                   148
432 #define CMS_F_CMS_SIGNED_DATA_INIT                       149
433 #define CMS_F_CMS_SIGNERINFO_CONTENT_SIGN                150
434 #define CMS_F_CMS_SIGNERINFO_SIGN                        151
435 #define CMS_F_CMS_SIGNERINFO_VERIFY                      152
436 #define CMS_F_CMS_SIGNERINFO_VERIFY_CERT                 153
437 #define CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT              154
438 #define CMS_F_CMS_SIGN_RECEIPT                           163
439 #define CMS_F_CMS_STREAM                                 155
440 #define CMS_F_CMS_UNCOMPRESS                             156
441 #define CMS_F_CMS_VERIFY                                 157
442 #define CMS_F_KEK_UNWRAP_KEY                             180
443 
444 /*
445  * CMS reason codes.
446  */
447 #define CMS_R_ADD_SIGNER_ERROR                           99
448 #define CMS_R_CERTIFICATE_ALREADY_PRESENT                175
449 #define CMS_R_CERTIFICATE_HAS_NO_KEYID                   160
450 #define CMS_R_CERTIFICATE_VERIFY_ERROR                   100
451 #define CMS_R_CIPHER_INITIALISATION_ERROR                101
452 #define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR      102
453 #define CMS_R_CMS_DATAFINAL_ERROR                        103
454 #define CMS_R_CMS_LIB                                    104
455 #define CMS_R_CONTENTIDENTIFIER_MISMATCH                 170
456 #define CMS_R_CONTENT_NOT_FOUND                          105
457 #define CMS_R_CONTENT_TYPE_MISMATCH                      171
458 #define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA           106
459 #define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA            107
460 #define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA               108
461 #define CMS_R_CONTENT_VERIFY_ERROR                       109
462 #define CMS_R_CTRL_ERROR                                 110
463 #define CMS_R_CTRL_FAILURE                               111
464 #define CMS_R_DECRYPT_ERROR                              112
465 #define CMS_R_ERROR_GETTING_PUBLIC_KEY                   113
466 #define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE      114
467 #define CMS_R_ERROR_SETTING_KEY                          115
468 #define CMS_R_ERROR_SETTING_RECIPIENTINFO                116
469 #define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH               117
470 #define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER           176
471 #define CMS_R_INVALID_KEY_LENGTH                         118
472 #define CMS_R_MD_BIO_INIT_ERROR                          119
473 #define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH       120
474 #define CMS_R_MESSAGEDIGEST_WRONG_LENGTH                 121
475 #define CMS_R_MSGSIGDIGEST_ERROR                         172
476 #define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE          162
477 #define CMS_R_MSGSIGDIGEST_WRONG_LENGTH                  163
478 #define CMS_R_NEED_ONE_SIGNER                            164
479 #define CMS_R_NOT_A_SIGNED_RECEIPT                       165
480 #define CMS_R_NOT_ENCRYPTED_DATA                         122
481 #define CMS_R_NOT_KEK                                    123
482 #define CMS_R_NOT_KEY_AGREEMENT                          181
483 #define CMS_R_NOT_KEY_TRANSPORT                          124
484 #define CMS_R_NOT_PWRI                                   177
485 #define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE            125
486 #define CMS_R_NO_CIPHER                                  126
487 #define CMS_R_NO_CONTENT                                 127
488 #define CMS_R_NO_CONTENT_TYPE                            173
489 #define CMS_R_NO_DEFAULT_DIGEST                          128
490 #define CMS_R_NO_DIGEST_SET                              129
491 #define CMS_R_NO_KEY                                     130
492 #define CMS_R_NO_KEY_OR_CERT                             174
493 #define CMS_R_NO_MATCHING_DIGEST                         131
494 #define CMS_R_NO_MATCHING_RECIPIENT                      132
495 #define CMS_R_NO_MATCHING_SIGNATURE                      166
496 #define CMS_R_NO_MSGSIGDIGEST                            167
497 #define CMS_R_NO_PASSWORD                                178
498 #define CMS_R_NO_PRIVATE_KEY                             133
499 #define CMS_R_NO_PUBLIC_KEY                              134
500 #define CMS_R_NO_RECEIPT_REQUEST                         168
501 #define CMS_R_NO_SIGNERS                                 135
502 #define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE     136
503 #define CMS_R_RECEIPT_DECODE_ERROR                       169
504 #define CMS_R_RECIPIENT_ERROR                            137
505 #define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND               138
506 #define CMS_R_SIGNFINAL_ERROR                            139
507 #define CMS_R_SMIME_TEXT_ERROR                           140
508 #define CMS_R_STORE_INIT_ERROR                           141
509 #define CMS_R_TYPE_NOT_COMPRESSED_DATA                   142
510 #define CMS_R_TYPE_NOT_DATA                              143
511 #define CMS_R_TYPE_NOT_DIGESTED_DATA                     144
512 #define CMS_R_TYPE_NOT_ENCRYPTED_DATA                    145
513 #define CMS_R_TYPE_NOT_ENVELOPED_DATA                    146
514 #define CMS_R_UNABLE_TO_FINALIZE_CONTEXT                 147
515 #define CMS_R_UNKNOWN_CIPHER                             148
516 #define CMS_R_UNKNOWN_DIGEST_ALGORITHM                   149
517 #define CMS_R_UNKNOWN_ID                                 150
518 #define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM          151
519 #define CMS_R_UNSUPPORTED_CONTENT_TYPE                   152
520 #define CMS_R_UNSUPPORTED_KEK_ALGORITHM                  153
521 #define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM       179
522 #define CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE             155
523 #define CMS_R_UNSUPPORTED_RECIPIENT_TYPE                 154
524 #define CMS_R_UNSUPPORTED_TYPE                           156
525 #define CMS_R_UNWRAP_ERROR                               157
526 #define CMS_R_UNWRAP_FAILURE                             180
527 #define CMS_R_VERIFICATION_FAILURE                       158
528 #define CMS_R_WRAP_ERROR                                 159
529 
530 #ifdef  __cplusplus
531 }
532 #endif
533 #endif
534 #endif
535