Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/crypto/openssl/engines/e_capi_err.c
34865 views
1
/*
2
* Generated by util/mkerr.pl DO NOT EDIT
3
* Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.
4
*
5
* Licensed under the Apache License 2.0 (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/err.h>
12
#include "e_capi_err.h"
13
14
#ifndef OPENSSL_NO_ERR
15
16
static ERR_STRING_DATA CAPI_str_reasons[] = {
17
{ERR_PACK(0, 0, CAPI_R_CANT_CREATE_HASH_OBJECT), "can't create hash object"},
18
{ERR_PACK(0, 0, CAPI_R_CANT_FIND_CAPI_CONTEXT), "can't find capi context"},
19
{ERR_PACK(0, 0, CAPI_R_CANT_GET_KEY), "can't get key"},
20
{ERR_PACK(0, 0, CAPI_R_CANT_SET_HASH_VALUE), "can't set hash value"},
21
{ERR_PACK(0, 0, CAPI_R_CRYPTACQUIRECONTEXT_ERROR),
22
"cryptacquirecontext error"},
23
{ERR_PACK(0, 0, CAPI_R_CRYPTENUMPROVIDERS_ERROR),
24
"cryptenumproviders error"},
25
{ERR_PACK(0, 0, CAPI_R_DECRYPT_ERROR), "decrypt error"},
26
{ERR_PACK(0, 0, CAPI_R_ENGINE_NOT_INITIALIZED), "engine not initialized"},
27
{ERR_PACK(0, 0, CAPI_R_ENUMCONTAINERS_ERROR), "enumcontainers error"},
28
{ERR_PACK(0, 0, CAPI_R_ERROR_ADDING_CERT), "error adding cert"},
29
{ERR_PACK(0, 0, CAPI_R_ERROR_CREATING_STORE), "error creating store"},
30
{ERR_PACK(0, 0, CAPI_R_ERROR_GETTING_FRIENDLY_NAME),
31
"error getting friendly name"},
32
{ERR_PACK(0, 0, CAPI_R_ERROR_GETTING_KEY_PROVIDER_INFO),
33
"error getting key provider info"},
34
{ERR_PACK(0, 0, CAPI_R_ERROR_OPENING_STORE), "error opening store"},
35
{ERR_PACK(0, 0, CAPI_R_ERROR_SIGNING_HASH), "error signing hash"},
36
{ERR_PACK(0, 0, CAPI_R_FILE_OPEN_ERROR), "file open error"},
37
{ERR_PACK(0, 0, CAPI_R_FUNCTION_NOT_SUPPORTED), "function not supported"},
38
{ERR_PACK(0, 0, CAPI_R_GETUSERKEY_ERROR), "getuserkey error"},
39
{ERR_PACK(0, 0, CAPI_R_INVALID_DIGEST_LENGTH), "invalid digest length"},
40
{ERR_PACK(0, 0, CAPI_R_INVALID_DSA_PUBLIC_KEY_BLOB_MAGIC_NUMBER),
41
"invalid dsa public key blob magic number"},
42
{ERR_PACK(0, 0, CAPI_R_INVALID_LOOKUP_METHOD), "invalid lookup method"},
43
{ERR_PACK(0, 0, CAPI_R_INVALID_PUBLIC_KEY_BLOB), "invalid public key blob"},
44
{ERR_PACK(0, 0, CAPI_R_INVALID_RSA_PUBLIC_KEY_BLOB_MAGIC_NUMBER),
45
"invalid rsa public key blob magic number"},
46
{ERR_PACK(0, 0, CAPI_R_PUBKEY_EXPORT_ERROR), "pubkey export error"},
47
{ERR_PACK(0, 0, CAPI_R_PUBKEY_EXPORT_LENGTH_ERROR),
48
"pubkey export length error"},
49
{ERR_PACK(0, 0, CAPI_R_UNKNOWN_COMMAND), "unknown command"},
50
{ERR_PACK(0, 0, CAPI_R_UNSUPPORTED_ALGORITHM_NID),
51
"unsupported algorithm nid"},
52
{ERR_PACK(0, 0, CAPI_R_UNSUPPORTED_PADDING), "unsupported padding"},
53
{ERR_PACK(0, 0, CAPI_R_UNSUPPORTED_PUBLIC_KEY_ALGORITHM),
54
"unsupported public key algorithm"},
55
{ERR_PACK(0, 0, CAPI_R_WIN32_ERROR), "win32 error"},
56
{0, NULL}
57
};
58
59
#endif
60
61
static int lib_code = 0;
62
static int error_loaded = 0;
63
64
static int ERR_load_CAPI_strings(void)
65
{
66
if (lib_code == 0)
67
lib_code = ERR_get_next_error_library();
68
69
if (!error_loaded) {
70
#ifndef OPENSSL_NO_ERR
71
ERR_load_strings(lib_code, CAPI_str_reasons);
72
#endif
73
error_loaded = 1;
74
}
75
return 1;
76
}
77
78
static void ERR_unload_CAPI_strings(void)
79
{
80
if (error_loaded) {
81
#ifndef OPENSSL_NO_ERR
82
ERR_unload_strings(lib_code, CAPI_str_reasons);
83
#endif
84
error_loaded = 0;
85
}
86
}
87
88
static void ERR_CAPI_error(int function, int reason, const char *file, int line)
89
{
90
if (lib_code == 0)
91
lib_code = ERR_get_next_error_library();
92
ERR_raise(lib_code, reason);
93
ERR_set_debug(file, line, NULL);
94
}
95
96
static int ERR_CAPI_lib(void)
97
{
98
if (lib_code == 0)
99
lib_code = ERR_get_next_error_library();
100
return lib_code;
101
}
102
103