Rich Salz | b6cff31 | 2016-05-17 17:38:18 -0400 | [diff] [blame] | 1 | /* |
Rich Salz | 52df25c | 2017-06-07 15:12:03 -0400 | [diff] [blame] | 2 | * Generated by util/mkerr.pl DO NOT EDIT |
Sven Schwermer | 29253e1 | 2021-05-27 08:41:07 +0200 | [diff] [blame] | 3 | * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. |
Dr. Stephen Henson | 408f906 | 2008-05-31 22:50:00 +0000 | [diff] [blame] | 4 | * |
Richard Levitte | ab3fa1c | 2018-12-06 14:07:27 +0100 | [diff] [blame] | 5 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
Rich Salz | b6cff31 | 2016-05-17 17:38:18 -0400 | [diff] [blame] | 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 |
Dr. Stephen Henson | 408f906 | 2008-05-31 22:50:00 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
Dr. Stephen Henson | 408f906 | 2008-05-31 22:50:00 +0000 | [diff] [blame] | 11 | #include <openssl/err.h> |
| 12 | #include "e_capi_err.h" |
| 13 | |
Dr. Stephen Henson | 408f906 | 2008-05-31 22:50:00 +0000 | [diff] [blame] | 14 | #ifndef OPENSSL_NO_ERR |
| 15 | |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 16 | static ERR_STRING_DATA CAPI_str_reasons[] = { |
Rich Salz | 52df25c | 2017-06-07 15:12:03 -0400 | [diff] [blame] | 17 | {ERR_PACK(0, 0, CAPI_R_CANT_CREATE_HASH_OBJECT), "cant create hash object"}, |
| 18 | {ERR_PACK(0, 0, CAPI_R_CANT_FIND_CAPI_CONTEXT), "cant find capi context"}, |
| 19 | {ERR_PACK(0, 0, CAPI_R_CANT_GET_KEY), "cant get key"}, |
| 20 | {ERR_PACK(0, 0, CAPI_R_CANT_SET_HASH_VALUE), "cant 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"}, |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 56 | {0, NULL} |
| 57 | }; |
Dr. Stephen Henson | 408f906 | 2008-05-31 22:50:00 +0000 | [diff] [blame] | 58 | |
| 59 | #endif |
| 60 | |
Rich Salz | 52df25c | 2017-06-07 15:12:03 -0400 | [diff] [blame] | 61 | static int lib_code = 0; |
| 62 | static int error_loaded = 0; |
Dr. Stephen Henson | 408f906 | 2008-05-31 22:50:00 +0000 | [diff] [blame] | 63 | |
Rich Salz | 52df25c | 2017-06-07 15:12:03 -0400 | [diff] [blame] | 64 | static int ERR_load_CAPI_strings(void) |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 65 | { |
Rich Salz | 52df25c | 2017-06-07 15:12:03 -0400 | [diff] [blame] | 66 | if (lib_code == 0) |
| 67 | lib_code = ERR_get_next_error_library(); |
Dr. Stephen Henson | 408f906 | 2008-05-31 22:50:00 +0000 | [diff] [blame] | 68 | |
Rich Salz | 52df25c | 2017-06-07 15:12:03 -0400 | [diff] [blame] | 69 | if (!error_loaded) { |
Dr. Stephen Henson | 408f906 | 2008-05-31 22:50:00 +0000 | [diff] [blame] | 70 | #ifndef OPENSSL_NO_ERR |
Rich Salz | 52df25c | 2017-06-07 15:12:03 -0400 | [diff] [blame] | 71 | ERR_load_strings(lib_code, CAPI_str_reasons); |
Dr. Stephen Henson | 408f906 | 2008-05-31 22:50:00 +0000 | [diff] [blame] | 72 | #endif |
Rich Salz | 52df25c | 2017-06-07 15:12:03 -0400 | [diff] [blame] | 73 | error_loaded = 1; |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 74 | } |
Rich Salz | 52df25c | 2017-06-07 15:12:03 -0400 | [diff] [blame] | 75 | return 1; |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 76 | } |
Dr. Stephen Henson | 408f906 | 2008-05-31 22:50:00 +0000 | [diff] [blame] | 77 | |
| 78 | static void ERR_unload_CAPI_strings(void) |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 79 | { |
Rich Salz | 52df25c | 2017-06-07 15:12:03 -0400 | [diff] [blame] | 80 | if (error_loaded) { |
Dr. Stephen Henson | 408f906 | 2008-05-31 22:50:00 +0000 | [diff] [blame] | 81 | #ifndef OPENSSL_NO_ERR |
Rich Salz | 52df25c | 2017-06-07 15:12:03 -0400 | [diff] [blame] | 82 | ERR_unload_strings(lib_code, CAPI_str_reasons); |
Dr. Stephen Henson | 408f906 | 2008-05-31 22:50:00 +0000 | [diff] [blame] | 83 | #endif |
Rich Salz | 52df25c | 2017-06-07 15:12:03 -0400 | [diff] [blame] | 84 | error_loaded = 0; |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 85 | } |
| 86 | } |
Dr. Stephen Henson | 408f906 | 2008-05-31 22:50:00 +0000 | [diff] [blame] | 87 | |
Sven Schwermer | 29253e1 | 2021-05-27 08:41:07 +0200 | [diff] [blame] | 88 | static void ERR_CAPI_error(int function, int reason, const char *file, int line) |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 89 | { |
Rich Salz | 52df25c | 2017-06-07 15:12:03 -0400 | [diff] [blame] | 90 | if (lib_code == 0) |
| 91 | lib_code = ERR_get_next_error_library(); |
Richard Levitte | c361297 | 2019-07-24 16:55:32 +0200 | [diff] [blame] | 92 | ERR_raise(lib_code, reason); |
| 93 | ERR_set_debug(file, line, NULL); |
Matt Caswell | 0f113f3 | 2015-01-22 03:40:55 +0000 | [diff] [blame] | 94 | } |