1*de0e0e4dSAntonio Huete Jimenez /* $OpenBSD: ts_err.c,v 1.6 2022/07/12 14:42:50 kn Exp $ */
2f5b1c8a1SJohn Marino /* ====================================================================
3f5b1c8a1SJohn Marino * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
4f5b1c8a1SJohn Marino *
5f5b1c8a1SJohn Marino * Redistribution and use in source and binary forms, with or without
6f5b1c8a1SJohn Marino * modification, are permitted provided that the following conditions
7f5b1c8a1SJohn Marino * are met:
8f5b1c8a1SJohn Marino *
9f5b1c8a1SJohn Marino * 1. Redistributions of source code must retain the above copyright
10f5b1c8a1SJohn Marino * notice, this list of conditions and the following disclaimer.
11f5b1c8a1SJohn Marino *
12f5b1c8a1SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright
13f5b1c8a1SJohn Marino * notice, this list of conditions and the following disclaimer in
14f5b1c8a1SJohn Marino * the documentation and/or other materials provided with the
15f5b1c8a1SJohn Marino * distribution.
16f5b1c8a1SJohn Marino *
17f5b1c8a1SJohn Marino * 3. All advertising materials mentioning features or use of this
18f5b1c8a1SJohn Marino * software must display the following acknowledgment:
19f5b1c8a1SJohn Marino * "This product includes software developed by the OpenSSL Project
20f5b1c8a1SJohn Marino * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
21f5b1c8a1SJohn Marino *
22f5b1c8a1SJohn Marino * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23f5b1c8a1SJohn Marino * endorse or promote products derived from this software without
24f5b1c8a1SJohn Marino * prior written permission. For written permission, please contact
25f5b1c8a1SJohn Marino * openssl-core@OpenSSL.org.
26f5b1c8a1SJohn Marino *
27f5b1c8a1SJohn Marino * 5. Products derived from this software may not be called "OpenSSL"
28f5b1c8a1SJohn Marino * nor may "OpenSSL" appear in their names without prior written
29f5b1c8a1SJohn Marino * permission of the OpenSSL Project.
30f5b1c8a1SJohn Marino *
31f5b1c8a1SJohn Marino * 6. Redistributions of any form whatsoever must retain the following
32f5b1c8a1SJohn Marino * acknowledgment:
33f5b1c8a1SJohn Marino * "This product includes software developed by the OpenSSL Project
34f5b1c8a1SJohn Marino * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
35f5b1c8a1SJohn Marino *
36f5b1c8a1SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37f5b1c8a1SJohn Marino * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38f5b1c8a1SJohn Marino * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39f5b1c8a1SJohn Marino * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40f5b1c8a1SJohn Marino * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41f5b1c8a1SJohn Marino * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42f5b1c8a1SJohn Marino * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43f5b1c8a1SJohn Marino * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44f5b1c8a1SJohn Marino * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45f5b1c8a1SJohn Marino * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46f5b1c8a1SJohn Marino * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47f5b1c8a1SJohn Marino * OF THE POSSIBILITY OF SUCH DAMAGE.
48f5b1c8a1SJohn Marino * ====================================================================
49f5b1c8a1SJohn Marino *
50f5b1c8a1SJohn Marino * This product includes cryptographic software written by Eric Young
51f5b1c8a1SJohn Marino * (eay@cryptsoft.com). This product includes software written by Tim
52f5b1c8a1SJohn Marino * Hudson (tjh@cryptsoft.com).
53f5b1c8a1SJohn Marino *
54f5b1c8a1SJohn Marino */
55f5b1c8a1SJohn Marino
56f5b1c8a1SJohn Marino #include <stdio.h>
57f5b1c8a1SJohn Marino
58f5b1c8a1SJohn Marino #include <openssl/opensslconf.h>
59f5b1c8a1SJohn Marino
60f5b1c8a1SJohn Marino #include <openssl/err.h>
61f5b1c8a1SJohn Marino #include <openssl/ts.h>
62f5b1c8a1SJohn Marino
63f5b1c8a1SJohn Marino #ifndef OPENSSL_NO_ERR
64f5b1c8a1SJohn Marino
65f5b1c8a1SJohn Marino #define ERR_FUNC(func) ERR_PACK(ERR_LIB_TS,func,0)
66f5b1c8a1SJohn Marino #define ERR_REASON(reason) ERR_PACK(ERR_LIB_TS,0,reason)
67f5b1c8a1SJohn Marino
68f5b1c8a1SJohn Marino static ERR_STRING_DATA TS_str_functs[] = {
6972c33676SMaxim Ag {ERR_FUNC(0xfff), "CRYPTO_internal"},
70f5b1c8a1SJohn Marino {0, NULL}
71f5b1c8a1SJohn Marino };
72f5b1c8a1SJohn Marino
73f5b1c8a1SJohn Marino static ERR_STRING_DATA TS_str_reasons[]= {
74f5b1c8a1SJohn Marino {ERR_REASON(TS_R_BAD_PKCS7_TYPE) , "bad pkcs7 type"},
75f5b1c8a1SJohn Marino {ERR_REASON(TS_R_BAD_TYPE) , "bad type"},
76f5b1c8a1SJohn Marino {ERR_REASON(TS_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"},
77f5b1c8a1SJohn Marino {ERR_REASON(TS_R_COULD_NOT_SET_ENGINE) , "could not set engine"},
78f5b1c8a1SJohn Marino {ERR_REASON(TS_R_COULD_NOT_SET_TIME) , "could not set time"},
79f5b1c8a1SJohn Marino {ERR_REASON(TS_R_D2I_TS_RESP_INT_FAILED) , "d2i ts resp int failed"},
80f5b1c8a1SJohn Marino {ERR_REASON(TS_R_DETACHED_CONTENT) , "detached content"},
81f5b1c8a1SJohn Marino {ERR_REASON(TS_R_ESS_ADD_SIGNING_CERT_ERROR), "ess add signing cert error"},
82f5b1c8a1SJohn Marino {ERR_REASON(TS_R_ESS_SIGNING_CERTIFICATE_ERROR), "ess signing certificate error"},
83f5b1c8a1SJohn Marino {ERR_REASON(TS_R_INVALID_NULL_POINTER) , "invalid null pointer"},
84f5b1c8a1SJohn Marino {ERR_REASON(TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE), "invalid signer certificate purpose"},
85f5b1c8a1SJohn Marino {ERR_REASON(TS_R_MESSAGE_IMPRINT_MISMATCH), "message imprint mismatch"},
86f5b1c8a1SJohn Marino {ERR_REASON(TS_R_NONCE_MISMATCH) , "nonce mismatch"},
87f5b1c8a1SJohn Marino {ERR_REASON(TS_R_NONCE_NOT_RETURNED) , "nonce not returned"},
88f5b1c8a1SJohn Marino {ERR_REASON(TS_R_NO_CONTENT) , "no content"},
89f5b1c8a1SJohn Marino {ERR_REASON(TS_R_NO_TIME_STAMP_TOKEN) , "no time stamp token"},
90f5b1c8a1SJohn Marino {ERR_REASON(TS_R_PKCS7_ADD_SIGNATURE_ERROR), "pkcs7 add signature error"},
91f5b1c8a1SJohn Marino {ERR_REASON(TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR), "pkcs7 add signed attr error"},
92f5b1c8a1SJohn Marino {ERR_REASON(TS_R_PKCS7_TO_TS_TST_INFO_FAILED), "pkcs7 to ts tst info failed"},
93f5b1c8a1SJohn Marino {ERR_REASON(TS_R_POLICY_MISMATCH) , "policy mismatch"},
94f5b1c8a1SJohn Marino {ERR_REASON(TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE), "private key does not match certificate"},
95f5b1c8a1SJohn Marino {ERR_REASON(TS_R_RESPONSE_SETUP_ERROR) , "response setup error"},
96f5b1c8a1SJohn Marino {ERR_REASON(TS_R_SIGNATURE_FAILURE) , "signature failure"},
97f5b1c8a1SJohn Marino {ERR_REASON(TS_R_THERE_MUST_BE_ONE_SIGNER), "there must be one signer"},
98f5b1c8a1SJohn Marino {ERR_REASON(TS_R_TIME_SYSCALL_ERROR) , "time syscall error"},
99f5b1c8a1SJohn Marino {ERR_REASON(TS_R_TOKEN_NOT_PRESENT) , "token not present"},
100f5b1c8a1SJohn Marino {ERR_REASON(TS_R_TOKEN_PRESENT) , "token present"},
101f5b1c8a1SJohn Marino {ERR_REASON(TS_R_TSA_NAME_MISMATCH) , "tsa name mismatch"},
102f5b1c8a1SJohn Marino {ERR_REASON(TS_R_TSA_UNTRUSTED) , "tsa untrusted"},
103f5b1c8a1SJohn Marino {ERR_REASON(TS_R_TST_INFO_SETUP_ERROR) , "tst info setup error"},
104f5b1c8a1SJohn Marino {ERR_REASON(TS_R_TS_DATASIGN) , "ts datasign"},
105f5b1c8a1SJohn Marino {ERR_REASON(TS_R_UNACCEPTABLE_POLICY) , "unacceptable policy"},
106f5b1c8a1SJohn Marino {ERR_REASON(TS_R_UNSUPPORTED_MD_ALGORITHM), "unsupported md algorithm"},
107f5b1c8a1SJohn Marino {ERR_REASON(TS_R_UNSUPPORTED_VERSION) , "unsupported version"},
108f5b1c8a1SJohn Marino {ERR_REASON(TS_R_WRONG_CONTENT_TYPE) , "wrong content type"},
109f5b1c8a1SJohn Marino {0, NULL}
110f5b1c8a1SJohn Marino };
111f5b1c8a1SJohn Marino
112f5b1c8a1SJohn Marino #endif
113f5b1c8a1SJohn Marino
114f5b1c8a1SJohn Marino void
ERR_load_TS_strings(void)115f5b1c8a1SJohn Marino ERR_load_TS_strings(void)
116f5b1c8a1SJohn Marino {
117f5b1c8a1SJohn Marino #ifndef OPENSSL_NO_ERR
118f5b1c8a1SJohn Marino if (ERR_func_error_string(TS_str_functs[0].error) == NULL) {
119f5b1c8a1SJohn Marino ERR_load_strings(0, TS_str_functs);
120f5b1c8a1SJohn Marino ERR_load_strings(0, TS_str_reasons);
121f5b1c8a1SJohn Marino }
122f5b1c8a1SJohn Marino #endif
123f5b1c8a1SJohn Marino }
124