2 /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
5 /* ====================================================================
6 * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
34 * 6. Redistributions of any form whatsoever must retain the following
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
58 #include <openssl/x509.h>
61 #error CMS is disabled.
69 typedef struct CMS_ContentInfo_st CMS_ContentInfo;
70 typedef struct CMS_SignerInfo_st CMS_SignerInfo;
71 typedef struct CMS_CertificateChoices CMS_CertificateChoices;
72 typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice;
73 typedef struct CMS_RecipientInfo_st CMS_RecipientInfo;
74 typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest;
75 typedef struct CMS_Receipt_st CMS_Receipt;
77 DECLARE_STACK_OF(CMS_SignerInfo)
78 DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
79 DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
81 #define CMS_SIGNERINFO_ISSUER_SERIAL 0
82 #define CMS_SIGNERINFO_KEYIDENTIFIER 1
84 #define CMS_RECIPINFO_TRANS 0
85 #define CMS_RECIPINFO_AGREE 1
86 #define CMS_RECIPINFO_KEK 2
87 #define CMS_RECIPINFO_PASS 3
88 #define CMS_RECIPINFO_OTHER 4
90 /* S/MIME related flags */
93 #define CMS_NOCERTS 0x2
94 #define CMS_NO_CONTENT_VERIFY 0x4
95 #define CMS_NO_ATTR_VERIFY 0x8
97 (CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY)
98 #define CMS_NOINTERN 0x10
99 #define CMS_NO_SIGNER_CERT_VERIFY 0x20
100 #define CMS_NOVERIFY 0x20
101 #define CMS_DETACHED 0x40
102 #define CMS_BINARY 0x80
103 #define CMS_NOATTR 0x100
104 #define CMS_NOSMIMECAP 0x200
105 #define CMS_NOOLDMIMETYPE 0x400
106 #define CMS_CRLFEOL 0x800
107 #define CMS_STREAM 0x1000
108 #define CMS_NOCRL 0x2000
109 #define CMS_PARTIAL 0x4000
110 #define CMS_REUSE_DIGEST 0x8000
111 #define CMS_USE_KEYID 0x10000
113 const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms);
115 BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont);
116 int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio);
118 ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms);
119 int CMS_is_detached(CMS_ContentInfo *cms);
120 int CMS_set_detached(CMS_ContentInfo *cms, int detached);
123 DECLARE_PEM_rw_const(CMS, CMS_ContentInfo)
126 int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms);
127 CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms);
128 int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms);
130 BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);
131 int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags);
132 int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags);
133 CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont);
134 int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags);
136 int CMS_final(CMS_ContentInfo *cms, BIO *data, int flags);
138 CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
139 BIO *data, unsigned int flags);
141 int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags);
142 CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags);
144 int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
146 CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md,
149 int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,
150 const unsigned char *key, size_t keylen,
151 BIO *dcont, BIO *out, unsigned int flags);
153 CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher,
154 const unsigned char *key, size_t keylen,
157 int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph,
158 const unsigned char *key, size_t keylen);
160 int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
161 X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags);
163 STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms);
165 CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in,
166 const EVP_CIPHER *cipher, unsigned int flags);
168 int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert,
169 BIO *data, BIO *dcont,
172 int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert);
173 int CMS_decrypt_set1_key(CMS_ContentInfo *cms,
174 unsigned char *key, size_t keylen,
175 unsigned char *id, size_t idlen);
177 STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);
178 int CMS_RecipientInfo_type(CMS_RecipientInfo *ri);
179 CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher);
180 CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,
181 X509 *recip, unsigned int flags);
182 int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);
183 int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);
184 int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri,
185 EVP_PKEY **pk, X509 **recip,
187 int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri,
188 ASN1_OCTET_STRING **keyid,
189 X509_NAME **issuer, ASN1_INTEGER **sno);
191 CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid,
192 unsigned char *key, size_t keylen,
193 unsigned char *id, size_t idlen,
194 ASN1_GENERALIZEDTIME *date,
195 ASN1_OBJECT *otherTypeId,
196 ASN1_TYPE *otherType);
198 int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri,
199 unsigned char *key, size_t keylen);
201 int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri,
202 const unsigned char *id, size_t idlen);
204 int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
206 int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
208 CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags);
210 int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);
211 const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);
213 CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms);
214 int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);
215 int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);
216 STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);
218 CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms);
219 int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
220 STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);
222 int CMS_SignedData_init(CMS_ContentInfo *cms);
223 CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms,
224 X509 *signer, EVP_PKEY *pk, const EVP_MD *md,
226 STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);
228 void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);
229 int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si,
230 ASN1_OCTET_STRING **keyid,
231 X509_NAME **issuer, ASN1_INTEGER **sno);
232 int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert);
233 int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
235 void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk, X509 **signer,
236 X509_ALGOR **pdig, X509_ALGOR **psig);
237 int CMS_SignerInfo_sign(CMS_SignerInfo *si);
238 int CMS_SignerInfo_verify(CMS_SignerInfo *si);
239 int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain);
241 int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs);
242 int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs,
243 int algnid, int keysize);
244 int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap);
246 int CMS_signed_get_attr_count(const CMS_SignerInfo *si);
247 int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
249 int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, ASN1_OBJECT *obj,
251 X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc);
252 X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc);
253 int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
254 int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si,
255 const ASN1_OBJECT *obj, int type,
256 const void *bytes, int len);
257 int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si,
259 const void *bytes, int len);
260 int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si,
261 const char *attrname, int type,
262 const void *bytes, int len);
263 void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,
264 int lastpos, int type);
266 int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si);
267 int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
269 int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, ASN1_OBJECT *obj,
271 X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc);
272 X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc);
273 int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
274 int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si,
275 const ASN1_OBJECT *obj, int type,
276 const void *bytes, int len);
277 int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si,
279 const void *bytes, int len);
280 int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si,
281 const char *attrname, int type,
282 const void *bytes, int len);
283 void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,
284 int lastpos, int type);
286 /* BEGIN ERROR CODES */
287 /* The following lines are auto generated by the script mkerr.pl. Any changes
288 * made after this point may be overwritten when the script is next run.
290 void ERR_load_CMS_strings(void);
292 /* Error codes for the CMS functions. */
294 /* Function codes. */
295 #define CMS_F_CHECK_CONTENT 99
296 #define CMS_F_CMS_ADD0_RECIPIENT_KEY 100
297 #define CMS_F_CMS_ADD1_RECIPIENT_CERT 101
298 #define CMS_F_CMS_ADD1_SIGNER 102
299 #define CMS_F_CMS_ADD1_SIGNINGTIME 103
300 #define CMS_F_CMS_COMPRESS 104
301 #define CMS_F_CMS_COMPRESSEDDATA_CREATE 105
302 #define CMS_F_CMS_COMPRESSEDDATA_INIT_BIO 106
303 #define CMS_F_CMS_COPY_CONTENT 107
304 #define CMS_F_CMS_COPY_MESSAGEDIGEST 108
305 #define CMS_F_CMS_DATA 109
306 #define CMS_F_CMS_DATAFINAL 110
307 #define CMS_F_CMS_DATAINIT 111
308 #define CMS_F_CMS_DECRYPT 112
309 #define CMS_F_CMS_DECRYPT_SET1_KEY 113
310 #define CMS_F_CMS_DECRYPT_SET1_PKEY 114
311 #define CMS_F_CMS_DIGESTALGORITHM_FIND_CTX 115
312 #define CMS_F_CMS_DIGESTALGORITHM_INIT_BIO 116
313 #define CMS_F_CMS_DIGESTEDDATA_DO_FINAL 117
314 #define CMS_F_CMS_DIGEST_VERIFY 118
315 #define CMS_F_CMS_ENCRYPT 119
316 #define CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO 120
317 #define CMS_F_CMS_ENCRYPTEDDATA_DECRYPT 121
318 #define CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT 122
319 #define CMS_F_CMS_ENCRYPTEDDATA_SET1_KEY 123
320 #define CMS_F_CMS_ENVELOPEDDATA_CREATE 124
321 #define CMS_F_CMS_ENVELOPEDDATA_INIT_BIO 125
322 #define CMS_F_CMS_ENVELOPED_DATA_INIT 126
323 #define CMS_F_CMS_FINAL 127
324 #define CMS_F_CMS_GET0_CERTIFICATE_CHOICES 128
325 #define CMS_F_CMS_GET0_CONTENT 129
326 #define CMS_F_CMS_GET0_ECONTENT_TYPE 130
327 #define CMS_F_CMS_GET0_ENVELOPED 131
328 #define CMS_F_CMS_GET0_REVOCATION_CHOICES 132
329 #define CMS_F_CMS_GET0_SIGNED 133
330 #define CMS_F_CMS_RECIPIENTINFO_DECRYPT 134
331 #define CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT 135
332 #define CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT 136
333 #define CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID 137
334 #define CMS_F_CMS_RECIPIENTINFO_KEKRI_ID_CMP 138
335 #define CMS_F_CMS_RECIPIENTINFO_KTRI_CERT_CMP 139
336 #define CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT 140
337 #define CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT 141
338 #define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS 142
339 #define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID 143
340 #define CMS_F_CMS_RECIPIENTINFO_SET0_KEY 144
341 #define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY 145
342 #define CMS_F_CMS_SET1_SIGNERIDENTIFIER 146
343 #define CMS_F_CMS_SET_DETACHED 147
344 #define CMS_F_CMS_SIGN 148
345 #define CMS_F_CMS_SIGNED_DATA_INIT 149
346 #define CMS_F_CMS_SIGNERINFO_CONTENT_SIGN 150
347 #define CMS_F_CMS_SIGNERINFO_SIGN 151
348 #define CMS_F_CMS_SIGNERINFO_VERIFY 152
349 #define CMS_F_CMS_SIGNERINFO_VERIFY_CERT 153
350 #define CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT 154
351 #define CMS_F_CMS_STREAM 155
352 #define CMS_F_CMS_UNCOMPRESS 156
353 #define CMS_F_CMS_VERIFY 157
356 #define CMS_R_ADD_SIGNER_ERROR 99
357 #define CMS_R_CERTIFICATE_HAS_NO_KEYID 160
358 #define CMS_R_CERTIFICATE_VERIFY_ERROR 100
359 #define CMS_R_CIPHER_INITIALISATION_ERROR 101
360 #define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR 102
361 #define CMS_R_CMS_DATAFINAL_ERROR 103
362 #define CMS_R_CMS_LIB 104
363 #define CMS_R_CONTENT_NOT_FOUND 105
364 #define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA 106
365 #define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA 107
366 #define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA 108
367 #define CMS_R_CONTENT_VERIFY_ERROR 109
368 #define CMS_R_CTRL_ERROR 110
369 #define CMS_R_CTRL_FAILURE 111
370 #define CMS_R_DECRYPT_ERROR 112
371 #define CMS_R_ERROR_GETTING_PUBLIC_KEY 113
372 #define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE 114
373 #define CMS_R_ERROR_SETTING_KEY 115
374 #define CMS_R_ERROR_SETTING_RECIPIENTINFO 116
375 #define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH 117
376 #define CMS_R_INVALID_KEY_LENGTH 118
377 #define CMS_R_MD_BIO_INIT_ERROR 119
378 #define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH 120
379 #define CMS_R_MESSAGEDIGEST_WRONG_LENGTH 121
380 #define CMS_R_NOT_ENCRYPTED_DATA 122
381 #define CMS_R_NOT_KEK 123
382 #define CMS_R_NOT_KEY_TRANSPORT 124
383 #define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 125
384 #define CMS_R_NO_CIPHER 126
385 #define CMS_R_NO_CONTENT 127
386 #define CMS_R_NO_DEFAULT_DIGEST 128
387 #define CMS_R_NO_DIGEST_SET 129
388 #define CMS_R_NO_KEY 130
389 #define CMS_R_NO_MATCHING_DIGEST 131
390 #define CMS_R_NO_MATCHING_RECIPIENT 132
391 #define CMS_R_NO_PRIVATE_KEY 133
392 #define CMS_R_NO_PUBLIC_KEY 134
393 #define CMS_R_NO_SIGNERS 135
394 #define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 136
395 #define CMS_R_RECIPIENT_ERROR 137
396 #define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND 138
397 #define CMS_R_SIGNFINAL_ERROR 139
398 #define CMS_R_SMIME_TEXT_ERROR 140
399 #define CMS_R_STORE_INIT_ERROR 141
400 #define CMS_R_TYPE_NOT_COMPRESSED_DATA 142
401 #define CMS_R_TYPE_NOT_DATA 143
402 #define CMS_R_TYPE_NOT_DIGESTED_DATA 144
403 #define CMS_R_TYPE_NOT_ENCRYPTED_DATA 145
404 #define CMS_R_TYPE_NOT_ENVELOPED_DATA 146
405 #define CMS_R_UNABLE_TO_FINALIZE_CONTEXT 147
406 #define CMS_R_UNKNOWN_CIPHER 148
407 #define CMS_R_UNKNOWN_DIGEST_ALGORIHM 149
408 #define CMS_R_UNKNOWN_ID 150
409 #define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM 151
410 #define CMS_R_UNSUPPORTED_CONTENT_TYPE 152
411 #define CMS_R_UNSUPPORTED_KEK_ALGORITHM 153
412 #define CMS_R_UNSUPPORTED_RECIPIENT_TYPE 154
413 #define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE 155
414 #define CMS_R_UNSUPPORTED_TYPE 156
415 #define CMS_R_UNWRAP_ERROR 157
416 #define CMS_R_VERIFICATION_FAILURE 158
417 #define CMS_R_WRAP_ERROR 159