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