/src/libressl/crypto/cms/cms_err.c
Line | Count | Source |
1 | | /* $OpenBSD: cms_err.c,v 1.13 2022/07/12 14:42:48 kn Exp $ */ |
2 | | /* |
3 | | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. |
4 | | * |
5 | | * Licensed under the OpenSSL license (the "License"). You may not use |
6 | | * this file except in compliance with the License. You can obtain a copy |
7 | | * in the file LICENSE in the source distribution or at |
8 | | * https://www.openssl.org/source/license.html |
9 | | */ |
10 | | |
11 | | #include <openssl/cms.h> |
12 | | #include <openssl/err.h> |
13 | | |
14 | | #ifndef OPENSSL_NO_ERR |
15 | | |
16 | | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_CMS,func,0) |
17 | | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_CMS,0,reason) |
18 | | |
19 | | static ERR_STRING_DATA CMS_str_functs[] = { |
20 | | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
21 | | {0, NULL} |
22 | | }; |
23 | | |
24 | | static ERR_STRING_DATA CMS_str_reasons[] = { |
25 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_ADD_SIGNER_ERROR), "add signer error"}, |
26 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CERTIFICATE_ALREADY_PRESENT), |
27 | | "certificate already present"}, |
28 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CERTIFICATE_HAS_NO_KEYID), |
29 | | "certificate has no keyid"}, |
30 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CERTIFICATE_VERIFY_ERROR), |
31 | | "certificate verify error"}, |
32 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CIPHER_INITIALISATION_ERROR), |
33 | | "cipher initialisation error"}, |
34 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR), |
35 | | "cipher parameter initialisation error"}, |
36 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CMS_DATAFINAL_ERROR), |
37 | | "cms datafinal error"}, |
38 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CMS_LIB), "cms lib"}, |
39 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CONTENTIDENTIFIER_MISMATCH), |
40 | | "contentidentifier mismatch"}, |
41 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CONTENT_NOT_FOUND), "content not found"}, |
42 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CONTENT_TYPE_MISMATCH), |
43 | | "content type mismatch"}, |
44 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA), |
45 | | "content type not compressed data"}, |
46 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA), |
47 | | "content type not enveloped data"}, |
48 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA), |
49 | | "content type not signed data"}, |
50 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CONTENT_VERIFY_ERROR), |
51 | | "content verify error"}, |
52 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CTRL_ERROR), "ctrl error"}, |
53 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CTRL_FAILURE), "ctrl failure"}, |
54 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_DECRYPT_ERROR), "decrypt error"}, |
55 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_ERROR_GETTING_PUBLIC_KEY), |
56 | | "error getting public key"}, |
57 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE), |
58 | | "error reading messagedigest attribute"}, |
59 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_ERROR_SETTING_KEY), "error setting key"}, |
60 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_ERROR_SETTING_RECIPIENTINFO), |
61 | | "error setting recipientinfo"}, |
62 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_INVALID_ENCRYPTED_KEY_LENGTH), |
63 | | "invalid encrypted key length"}, |
64 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER), |
65 | | "invalid key encryption parameter"}, |
66 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_INVALID_KEY_LENGTH), "invalid key length"}, |
67 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_MD_BIO_INIT_ERROR), "md bio init error"}, |
68 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH), |
69 | | "messagedigest attribute wrong length"}, |
70 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_MESSAGEDIGEST_WRONG_LENGTH), |
71 | | "messagedigest wrong length"}, |
72 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_MSGSIGDIGEST_ERROR), "msgsigdigest error"}, |
73 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE), |
74 | | "msgsigdigest verification failure"}, |
75 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_MSGSIGDIGEST_WRONG_LENGTH), |
76 | | "msgsigdigest wrong length"}, |
77 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NEED_ONE_SIGNER), "need one signer"}, |
78 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NOT_A_SIGNED_RECEIPT), |
79 | | "not a signed receipt"}, |
80 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NOT_ENCRYPTED_DATA), "not encrypted data"}, |
81 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NOT_KEK), "not kek"}, |
82 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NOT_KEY_AGREEMENT), "not key agreement"}, |
83 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NOT_KEY_TRANSPORT), "not key transport"}, |
84 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NOT_PWRI), "not pwri"}, |
85 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE), |
86 | | "not supported for this key type"}, |
87 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NO_CIPHER), "no cipher"}, |
88 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NO_CONTENT), "no content"}, |
89 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NO_CONTENT_TYPE), "no content type"}, |
90 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NO_DEFAULT_DIGEST), "no default digest"}, |
91 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NO_DIGEST_SET), "no digest set"}, |
92 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NO_KEY), "no key"}, |
93 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NO_KEY_OR_CERT), "no key or cert"}, |
94 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NO_MATCHING_DIGEST), "no matching digest"}, |
95 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NO_MATCHING_RECIPIENT), |
96 | | "no matching recipient"}, |
97 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NO_MATCHING_SIGNATURE), |
98 | | "no matching signature"}, |
99 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NO_MSGSIGDIGEST), "no msgsigdigest"}, |
100 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NO_PASSWORD), "no password"}, |
101 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NO_PRIVATE_KEY), "no private key"}, |
102 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NO_PUBLIC_KEY), "no public key"}, |
103 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NO_RECEIPT_REQUEST), "no receipt request"}, |
104 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_NO_SIGNERS), "no signers"}, |
105 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE), |
106 | | "private key does not match certificate"}, |
107 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_RECEIPT_DECODE_ERROR), |
108 | | "receipt decode error"}, |
109 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_RECIPIENT_ERROR), "recipient error"}, |
110 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_SIGNER_CERTIFICATE_NOT_FOUND), |
111 | | "signer certificate not found"}, |
112 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_SIGNFINAL_ERROR), "signfinal error"}, |
113 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_SMIME_TEXT_ERROR), "smime text error"}, |
114 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_STORE_INIT_ERROR), "store init error"}, |
115 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_TYPE_NOT_COMPRESSED_DATA), |
116 | | "type not compressed data"}, |
117 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_TYPE_NOT_DATA), "type not data"}, |
118 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_TYPE_NOT_DIGESTED_DATA), |
119 | | "type not digested data"}, |
120 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_TYPE_NOT_ENCRYPTED_DATA), |
121 | | "type not encrypted data"}, |
122 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_TYPE_NOT_ENVELOPED_DATA), |
123 | | "type not enveloped data"}, |
124 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_UNABLE_TO_FINALIZE_CONTEXT), |
125 | | "unable to finalize context"}, |
126 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_UNKNOWN_CIPHER), "unknown cipher"}, |
127 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_UNKNOWN_DIGEST_ALGORITHM), |
128 | | "unknown digest algorithm"}, |
129 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_UNKNOWN_ID), "unknown id"}, |
130 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM), |
131 | | "unsupported compression algorithm"}, |
132 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_UNSUPPORTED_CONTENT_TYPE), |
133 | | "unsupported content type"}, |
134 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_UNSUPPORTED_KEK_ALGORITHM), |
135 | | "unsupported kek algorithm"}, |
136 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM), |
137 | | "unsupported key encryption algorithm"}, |
138 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE), |
139 | | "unsupported recipientinfo type"}, |
140 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_UNSUPPORTED_RECIPIENT_TYPE), |
141 | | "unsupported recipient type"}, |
142 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_UNSUPPORTED_TYPE), "unsupported type"}, |
143 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_UNWRAP_ERROR), "unwrap error"}, |
144 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_UNWRAP_FAILURE), "unwrap failure"}, |
145 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_VERIFICATION_FAILURE), |
146 | | "verification failure"}, |
147 | | {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_WRAP_ERROR), "wrap error"}, |
148 | | {0, NULL} |
149 | | }; |
150 | | |
151 | | #endif |
152 | | |
153 | | int |
154 | | ERR_load_CMS_strings(void) |
155 | 2 | { |
156 | 2 | #ifndef OPENSSL_NO_ERR |
157 | 2 | if (ERR_func_error_string(CMS_str_functs[0].error) == NULL) { |
158 | 2 | ERR_load_strings(ERR_LIB_CMS, CMS_str_functs); |
159 | 2 | ERR_load_strings(ERR_LIB_CMS, CMS_str_reasons); |
160 | 2 | } |
161 | 2 | #endif |
162 | 2 | return 1; |
163 | 2 | } |