Path: blob/main/crypto/openssl/engines/e_capi_err.c
108098 views
/*1* Generated by util/mkerr.pl DO NOT EDIT2* Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.3*4* Licensed under the Apache License 2.0 (the "License"). You may not use5* this file except in compliance with the License. You can obtain a copy6* in the file LICENSE in the source distribution or at7* https://www.openssl.org/source/license.html8*/910#include <openssl/err.h>11#include "e_capi_err.h"1213#ifndef OPENSSL_NO_ERR1415static ERR_STRING_DATA CAPI_str_reasons[] = {16{ ERR_PACK(0, 0, CAPI_R_CANT_CREATE_HASH_OBJECT), "can't create hash object" },17{ ERR_PACK(0, 0, CAPI_R_CANT_FIND_CAPI_CONTEXT), "can't find capi context" },18{ ERR_PACK(0, 0, CAPI_R_CANT_GET_KEY), "can't get key" },19{ ERR_PACK(0, 0, CAPI_R_CANT_SET_HASH_VALUE), "can't set hash value" },20{ ERR_PACK(0, 0, CAPI_R_CRYPTACQUIRECONTEXT_ERROR),21"cryptacquirecontext error" },22{ ERR_PACK(0, 0, CAPI_R_CRYPTENUMPROVIDERS_ERROR),23"cryptenumproviders error" },24{ ERR_PACK(0, 0, CAPI_R_DECRYPT_ERROR), "decrypt error" },25{ ERR_PACK(0, 0, CAPI_R_ENGINE_NOT_INITIALIZED), "engine not initialized" },26{ ERR_PACK(0, 0, CAPI_R_ENUMCONTAINERS_ERROR), "enumcontainers error" },27{ ERR_PACK(0, 0, CAPI_R_ERROR_ADDING_CERT), "error adding cert" },28{ ERR_PACK(0, 0, CAPI_R_ERROR_CREATING_STORE), "error creating store" },29{ ERR_PACK(0, 0, CAPI_R_ERROR_GETTING_FRIENDLY_NAME),30"error getting friendly name" },31{ ERR_PACK(0, 0, CAPI_R_ERROR_GETTING_KEY_PROVIDER_INFO),32"error getting key provider info" },33{ ERR_PACK(0, 0, CAPI_R_ERROR_OPENING_STORE), "error opening store" },34{ ERR_PACK(0, 0, CAPI_R_ERROR_SIGNING_HASH), "error signing hash" },35{ ERR_PACK(0, 0, CAPI_R_FILE_OPEN_ERROR), "file open error" },36{ ERR_PACK(0, 0, CAPI_R_FUNCTION_NOT_SUPPORTED), "function not supported" },37{ ERR_PACK(0, 0, CAPI_R_GETUSERKEY_ERROR), "getuserkey error" },38{ ERR_PACK(0, 0, CAPI_R_INVALID_DIGEST_LENGTH), "invalid digest length" },39{ ERR_PACK(0, 0, CAPI_R_INVALID_DSA_PUBLIC_KEY_BLOB_MAGIC_NUMBER),40"invalid dsa public key blob magic number" },41{ ERR_PACK(0, 0, CAPI_R_INVALID_LOOKUP_METHOD), "invalid lookup method" },42{ ERR_PACK(0, 0, CAPI_R_INVALID_PUBLIC_KEY_BLOB), "invalid public key blob" },43{ ERR_PACK(0, 0, CAPI_R_INVALID_RSA_PUBLIC_KEY_BLOB_MAGIC_NUMBER),44"invalid rsa public key blob magic number" },45{ ERR_PACK(0, 0, CAPI_R_PUBKEY_EXPORT_ERROR), "pubkey export error" },46{ ERR_PACK(0, 0, CAPI_R_PUBKEY_EXPORT_LENGTH_ERROR),47"pubkey export length error" },48{ ERR_PACK(0, 0, CAPI_R_UNKNOWN_COMMAND), "unknown command" },49{ ERR_PACK(0, 0, CAPI_R_UNSUPPORTED_ALGORITHM_NID),50"unsupported algorithm nid" },51{ ERR_PACK(0, 0, CAPI_R_UNSUPPORTED_PADDING), "unsupported padding" },52{ ERR_PACK(0, 0, CAPI_R_UNSUPPORTED_PUBLIC_KEY_ALGORITHM),53"unsupported public key algorithm" },54{ ERR_PACK(0, 0, CAPI_R_WIN32_ERROR), "win32 error" },55{ 0, NULL }56};5758#endif5960static int lib_code = 0;61static int error_loaded = 0;6263static int ERR_load_CAPI_strings(void)64{65if (lib_code == 0)66lib_code = ERR_get_next_error_library();6768if (!error_loaded) {69#ifndef OPENSSL_NO_ERR70ERR_load_strings(lib_code, CAPI_str_reasons);71#endif72error_loaded = 1;73}74return 1;75}7677static void ERR_unload_CAPI_strings(void)78{79if (error_loaded) {80#ifndef OPENSSL_NO_ERR81ERR_unload_strings(lib_code, CAPI_str_reasons);82#endif83error_loaded = 0;84}85}8687static void ERR_CAPI_error(int function, int reason, const char *file, int line)88{89if (lib_code == 0)90lib_code = ERR_get_next_error_library();91ERR_raise(lib_code, reason);92ERR_set_debug(file, line, NULL);93}9495static int ERR_CAPI_lib(void)96{97if (lib_code == 0)98lib_code = ERR_get_next_error_library();99return lib_code;100}101102103