2014-12-19 09:56:51 -07:00
|
|
|
/* error.c
|
|
|
|
|
*
|
2026-02-18 09:52:21 -07:00
|
|
|
* Copyright (C) 2006-2026 wolfSSL Inc.
|
2014-12-19 09:56:51 -07:00
|
|
|
*
|
2016-03-17 16:02:13 -06:00
|
|
|
* This file is part of wolfSSL.
|
2014-12-19 09:56:51 -07:00
|
|
|
*
|
2014-12-19 11:27:01 -07:00
|
|
|
* wolfSSL is free software; you can redistribute it and/or modify
|
2014-12-19 09:56:51 -07:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2025-07-10 16:01:52 -06:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2014-12-19 09:56:51 -07:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
2014-12-19 11:27:01 -07:00
|
|
|
* wolfSSL is distributed in the hope that it will be useful,
|
2014-12-19 09:56:51 -07:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
2016-03-17 16:02:13 -06:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
2014-12-19 09:56:51 -07:00
|
|
|
*/
|
|
|
|
|
|
2025-04-04 18:44:12 -05:00
|
|
|
#include <wolfssl/wolfcrypt/libwolfssl_sources.h>
|
2014-12-19 09:56:51 -07:00
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
|
/* 4996 warning to use MS extensions e.g., strcpy_s instead of XSTRNCPY */
|
|
|
|
|
#pragma warning(disable: 4996)
|
|
|
|
|
#endif
|
|
|
|
|
|
2018-02-23 17:31:20 -07:00
|
|
|
#ifndef NO_ERROR_STRINGS
|
2024-06-08 16:39:53 -05:00
|
|
|
|
|
|
|
|
#ifdef WOLFSSL_DEBUG_TRACE_ERROR_CODES_H
|
|
|
|
|
#include <wolfssl/debug-untrace-error-codes.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-07-28 09:59:41 -05:00
|
|
|
WOLFSSL_ABI
|
2014-12-19 11:27:01 -07:00
|
|
|
const char* wc_GetErrorString(int error)
|
2014-12-19 09:56:51 -07:00
|
|
|
{
|
2024-08-29 14:22:56 -05:00
|
|
|
switch ((enum wolfCrypt_ErrorCodes)error) {
|
2014-12-19 09:56:51 -07:00
|
|
|
|
2026-04-06 14:06:20 -05:00
|
|
|
case WC_SUCCESS:
|
|
|
|
|
return "wolfCrypt generic success";
|
|
|
|
|
|
2024-11-21 21:59:26 -06:00
|
|
|
case WC_FAILURE:
|
|
|
|
|
return "wolfCrypt generic failure";
|
|
|
|
|
|
2024-08-16 19:54:33 -05:00
|
|
|
case MP_MEM :
|
|
|
|
|
return "MP integer dynamic memory allocation failed";
|
|
|
|
|
|
|
|
|
|
case MP_VAL :
|
|
|
|
|
return "MP integer invalid argument";
|
|
|
|
|
|
|
|
|
|
case MP_WOULDBLOCK :
|
|
|
|
|
return "MP integer non-blocking operation would block";
|
|
|
|
|
|
|
|
|
|
case MP_NOT_INF:
|
|
|
|
|
return "MP point not at infinity";
|
|
|
|
|
|
2014-12-19 09:56:51 -07:00
|
|
|
case OPEN_RAN_E :
|
|
|
|
|
return "opening random device error";
|
|
|
|
|
|
|
|
|
|
case READ_RAN_E :
|
|
|
|
|
return "reading random device error";
|
|
|
|
|
|
|
|
|
|
case WINCRYPT_E :
|
|
|
|
|
return "windows crypt init error";
|
|
|
|
|
|
|
|
|
|
case CRYPTGEN_E :
|
|
|
|
|
return "windows crypt generation error";
|
|
|
|
|
|
|
|
|
|
case RAN_BLOCK_E :
|
|
|
|
|
return "random device read would block error";
|
|
|
|
|
|
|
|
|
|
case BAD_MUTEX_E :
|
|
|
|
|
return "Bad mutex, operation failed";
|
|
|
|
|
|
2016-08-15 13:59:41 -06:00
|
|
|
case WC_TIMEOUT_E:
|
|
|
|
|
return "Timeout error";
|
|
|
|
|
|
|
|
|
|
case WC_PENDING_E:
|
|
|
|
|
return "wolfCrypt Operation Pending (would block / eagain) error";
|
|
|
|
|
|
2023-09-15 15:16:51 -04:00
|
|
|
case WC_NO_PENDING_E:
|
2016-08-15 13:59:41 -06:00
|
|
|
return "wolfCrypt operation not pending error";
|
|
|
|
|
|
2014-12-19 09:56:51 -07:00
|
|
|
case MP_INIT_E :
|
|
|
|
|
return "mp_init error state";
|
|
|
|
|
|
|
|
|
|
case MP_READ_E :
|
|
|
|
|
return "mp_read error state";
|
|
|
|
|
|
|
|
|
|
case MP_EXPTMOD_E :
|
|
|
|
|
return "mp_exptmod error state";
|
|
|
|
|
|
|
|
|
|
case MP_TO_E :
|
|
|
|
|
return "mp_to_xxx error state, can't convert";
|
|
|
|
|
|
|
|
|
|
case MP_SUB_E :
|
|
|
|
|
return "mp_sub error state, can't subtract";
|
|
|
|
|
|
|
|
|
|
case MP_ADD_E :
|
|
|
|
|
return "mp_add error state, can't add";
|
|
|
|
|
|
|
|
|
|
case MP_MUL_E :
|
|
|
|
|
return "mp_mul error state, can't multiply";
|
|
|
|
|
|
|
|
|
|
case MP_MULMOD_E :
|
|
|
|
|
return "mp_mulmod error state, can't multiply mod";
|
|
|
|
|
|
|
|
|
|
case MP_MOD_E :
|
|
|
|
|
return "mp_mod error state, can't mod";
|
|
|
|
|
|
|
|
|
|
case MP_INVMOD_E :
|
|
|
|
|
return "mp_invmod error state, can't inv mod";
|
|
|
|
|
|
|
|
|
|
case MP_CMP_E :
|
|
|
|
|
return "mp_cmp error state";
|
|
|
|
|
|
|
|
|
|
case MP_ZERO_E :
|
|
|
|
|
return "mp zero result, not expected";
|
|
|
|
|
|
|
|
|
|
case MEMORY_E :
|
|
|
|
|
return "out of memory error";
|
|
|
|
|
|
2016-04-08 11:14:00 -06:00
|
|
|
case VAR_STATE_CHANGE_E :
|
|
|
|
|
return "Variable state modified by different thread";
|
|
|
|
|
|
2014-12-19 09:56:51 -07:00
|
|
|
case RSA_WRONG_TYPE_E :
|
|
|
|
|
return "RSA wrong block type for RSA function";
|
|
|
|
|
|
|
|
|
|
case RSA_BUFFER_E :
|
|
|
|
|
return "RSA buffer error, output too small or input too big";
|
|
|
|
|
|
|
|
|
|
case BUFFER_E :
|
|
|
|
|
return "Buffer error, output too small or input too big";
|
|
|
|
|
|
|
|
|
|
case ALGO_ID_E :
|
2016-01-29 16:13:09 -08:00
|
|
|
return "Setting Cert AlgoID error";
|
2014-12-19 09:56:51 -07:00
|
|
|
|
|
|
|
|
case PUBLIC_KEY_E :
|
|
|
|
|
return "Setting Cert Public Key error";
|
|
|
|
|
|
|
|
|
|
case DATE_E :
|
|
|
|
|
return "Setting Cert Date validity error";
|
|
|
|
|
|
|
|
|
|
case SUBJECT_E :
|
|
|
|
|
return "Setting Cert Subject name error";
|
|
|
|
|
|
|
|
|
|
case ISSUER_E :
|
|
|
|
|
return "Setting Cert Issuer name error";
|
|
|
|
|
|
|
|
|
|
case CA_TRUE_E :
|
|
|
|
|
return "Setting basic constraint CA true error";
|
|
|
|
|
|
|
|
|
|
case EXTENSIONS_E :
|
|
|
|
|
return "Setting extensions error";
|
|
|
|
|
|
|
|
|
|
case ASN_PARSE_E :
|
|
|
|
|
return "ASN parsing error, invalid input";
|
|
|
|
|
|
|
|
|
|
case ASN_VERSION_E :
|
|
|
|
|
return "ASN version error, invalid number";
|
|
|
|
|
|
|
|
|
|
case ASN_GETINT_E :
|
|
|
|
|
return "ASN get big int error, invalid data";
|
|
|
|
|
|
|
|
|
|
case ASN_RSA_KEY_E :
|
|
|
|
|
return "ASN key init error, invalid input";
|
|
|
|
|
|
|
|
|
|
case ASN_OBJECT_ID_E :
|
|
|
|
|
return "ASN object id error, invalid id";
|
|
|
|
|
|
|
|
|
|
case ASN_TAG_NULL_E :
|
|
|
|
|
return "ASN tag error, not null";
|
|
|
|
|
|
|
|
|
|
case ASN_EXPECT_0_E :
|
|
|
|
|
return "ASN expect error, not zero";
|
|
|
|
|
|
|
|
|
|
case ASN_BITSTR_E :
|
|
|
|
|
return "ASN bit string error, wrong id";
|
|
|
|
|
|
|
|
|
|
case ASN_UNKNOWN_OID_E :
|
|
|
|
|
return "ASN oid error, unknown sum id";
|
|
|
|
|
|
|
|
|
|
case ASN_DATE_SZ_E :
|
|
|
|
|
return "ASN date error, bad size";
|
|
|
|
|
|
|
|
|
|
case ASN_BEFORE_DATE_E :
|
2025-05-13 20:30:48 -05:00
|
|
|
return "ASN date error, current date is before start of validity";
|
2014-12-19 09:56:51 -07:00
|
|
|
|
|
|
|
|
case ASN_AFTER_DATE_E :
|
2025-05-13 20:30:48 -05:00
|
|
|
return "ASN date error, current date is after expiration";
|
2014-12-19 09:56:51 -07:00
|
|
|
|
|
|
|
|
case ASN_SIG_OID_E :
|
|
|
|
|
return "ASN signature error, mismatched oid";
|
|
|
|
|
|
|
|
|
|
case ASN_TIME_E :
|
2016-01-29 16:13:09 -08:00
|
|
|
return "ASN time error, unknown time type";
|
2014-12-19 09:56:51 -07:00
|
|
|
|
|
|
|
|
case ASN_INPUT_E :
|
|
|
|
|
return "ASN input error, not enough data";
|
|
|
|
|
|
|
|
|
|
case ASN_SIG_CONFIRM_E :
|
|
|
|
|
return "ASN sig error, confirm failure";
|
|
|
|
|
|
|
|
|
|
case ASN_SIG_HASH_E :
|
|
|
|
|
return "ASN sig error, unsupported hash type";
|
|
|
|
|
|
|
|
|
|
case ASN_SIG_KEY_E :
|
|
|
|
|
return "ASN sig error, unsupported key type";
|
|
|
|
|
|
|
|
|
|
case ASN_DH_KEY_E :
|
|
|
|
|
return "ASN key init error, invalid input";
|
|
|
|
|
|
|
|
|
|
case ASN_CRIT_EXT_E:
|
2017-03-08 16:40:07 -07:00
|
|
|
return "X.509 Critical extension ignored or invalid";
|
2014-12-19 09:56:51 -07:00
|
|
|
|
2018-02-05 17:04:50 -08:00
|
|
|
case ASN_ALT_NAME_E:
|
|
|
|
|
return "ASN alternate name error";
|
|
|
|
|
|
2014-12-19 09:56:51 -07:00
|
|
|
case ECC_BAD_ARG_E :
|
|
|
|
|
return "ECC input argument wrong type, invalid input";
|
|
|
|
|
|
|
|
|
|
case ASN_ECC_KEY_E :
|
|
|
|
|
return "ECC ASN1 bad key data, invalid input";
|
|
|
|
|
|
|
|
|
|
case ECC_CURVE_OID_E :
|
|
|
|
|
return "ECC curve sum OID unsupported, invalid input";
|
|
|
|
|
|
|
|
|
|
case BAD_FUNC_ARG :
|
|
|
|
|
return "Bad function argument";
|
|
|
|
|
|
|
|
|
|
case NOT_COMPILED_IN :
|
|
|
|
|
return "Feature not compiled in";
|
|
|
|
|
|
|
|
|
|
case UNICODE_SIZE_E :
|
|
|
|
|
return "Unicode password too big";
|
|
|
|
|
|
|
|
|
|
case NO_PASSWORD :
|
|
|
|
|
return "No password provided by user";
|
|
|
|
|
|
|
|
|
|
case ALT_NAME_E :
|
|
|
|
|
return "Alt Name problem, too big";
|
|
|
|
|
|
|
|
|
|
case AES_GCM_AUTH_E:
|
|
|
|
|
return "AES-GCM Authentication check fail";
|
|
|
|
|
|
|
|
|
|
case AES_CCM_AUTH_E:
|
|
|
|
|
return "AES-CCM Authentication check fail";
|
|
|
|
|
|
2022-01-14 16:52:03 -08:00
|
|
|
case AES_SIV_AUTH_E:
|
|
|
|
|
return "AES-SIV authentication failure";
|
|
|
|
|
|
2016-08-15 13:59:41 -06:00
|
|
|
case ASYNC_INIT_E:
|
|
|
|
|
return "Async Init error";
|
2014-12-19 09:56:51 -07:00
|
|
|
|
|
|
|
|
case COMPRESS_INIT_E:
|
|
|
|
|
return "Compress Init error";
|
|
|
|
|
|
|
|
|
|
case COMPRESS_E:
|
|
|
|
|
return "Compress error";
|
|
|
|
|
|
|
|
|
|
case DECOMPRESS_INIT_E:
|
|
|
|
|
return "DeCompress Init error";
|
|
|
|
|
|
|
|
|
|
case DECOMPRESS_E:
|
|
|
|
|
return "DeCompress error";
|
|
|
|
|
|
|
|
|
|
case BAD_ALIGN_E:
|
|
|
|
|
return "Bad alignment error, no alloc help";
|
|
|
|
|
|
|
|
|
|
case ASN_NO_SIGNER_E :
|
2022-01-28 14:40:45 +01:00
|
|
|
#ifndef OPENSSL_EXTRA
|
2014-12-19 09:56:51 -07:00
|
|
|
return "ASN no signer error to confirm failure";
|
2022-01-28 14:40:45 +01:00
|
|
|
#else
|
|
|
|
|
return "certificate verify failed";
|
|
|
|
|
#endif
|
2014-12-19 09:56:51 -07:00
|
|
|
|
|
|
|
|
case ASN_CRL_CONFIRM_E :
|
|
|
|
|
return "ASN CRL sig error, confirm failure";
|
|
|
|
|
|
|
|
|
|
case ASN_CRL_NO_SIGNER_E :
|
|
|
|
|
return "ASN CRL no signer error to confirm failure";
|
|
|
|
|
|
2021-08-24 11:12:12 -07:00
|
|
|
case CRL_CERT_DATE_ERR:
|
|
|
|
|
return "CRL date error";
|
|
|
|
|
|
2014-12-19 09:56:51 -07:00
|
|
|
case ASN_OCSP_CONFIRM_E :
|
|
|
|
|
return "ASN OCSP sig error, confirm failure";
|
|
|
|
|
|
2018-03-27 16:11:31 -07:00
|
|
|
case ASN_NO_PEM_HEADER:
|
|
|
|
|
return "ASN no PEM Header Error";
|
|
|
|
|
|
2016-08-15 13:59:41 -06:00
|
|
|
case BAD_STATE_E:
|
|
|
|
|
return "Bad state operation";
|
2014-12-19 09:56:51 -07:00
|
|
|
|
|
|
|
|
case BAD_PADDING_E:
|
|
|
|
|
return "Bad padding, message wrong length";
|
|
|
|
|
|
|
|
|
|
case REQ_ATTRIBUTE_E:
|
|
|
|
|
return "Setting cert request attributes error";
|
|
|
|
|
|
|
|
|
|
case PKCS7_OID_E:
|
|
|
|
|
return "PKCS#7 error: mismatched OID value";
|
|
|
|
|
|
|
|
|
|
case PKCS7_RECIP_E:
|
|
|
|
|
return "PKCS#7 error: no matching recipient found";
|
|
|
|
|
|
2018-10-05 13:28:20 -06:00
|
|
|
case WC_PKCS7_WANT_READ_E:
|
|
|
|
|
return "PKCS#7 operations wants more input, call again";
|
|
|
|
|
|
2014-12-19 09:56:51 -07:00
|
|
|
case FIPS_NOT_ALLOWED_E:
|
|
|
|
|
return "FIPS mode not allowed error";
|
|
|
|
|
|
|
|
|
|
case ASN_NAME_INVALID_E:
|
|
|
|
|
return "Name Constraint error";
|
|
|
|
|
|
|
|
|
|
case RNG_FAILURE_E:
|
|
|
|
|
return "Random Number Generator failed";
|
|
|
|
|
|
|
|
|
|
case HMAC_MIN_KEYLEN_E:
|
2025-12-11 12:23:38 -05:00
|
|
|
return "FIPS Mode HMAC Minimum Key or Salt Length error";
|
2014-12-19 09:56:51 -07:00
|
|
|
|
|
|
|
|
case RSA_PAD_E:
|
|
|
|
|
return "Rsa Padding error";
|
|
|
|
|
|
|
|
|
|
case LENGTH_ONLY_E:
|
|
|
|
|
return "Output length only set, not for other use error";
|
|
|
|
|
|
|
|
|
|
case IN_CORE_FIPS_E:
|
|
|
|
|
return "In Core Integrity check FIPS error";
|
|
|
|
|
|
|
|
|
|
case AES_KAT_FIPS_E:
|
|
|
|
|
return "AES Known Answer Test check FIPS error";
|
|
|
|
|
|
|
|
|
|
case DES3_KAT_FIPS_E:
|
|
|
|
|
return "DES3 Known Answer Test check FIPS error";
|
|
|
|
|
|
|
|
|
|
case HMAC_KAT_FIPS_E:
|
|
|
|
|
return "HMAC Known Answer Test check FIPS error";
|
|
|
|
|
|
|
|
|
|
case RSA_KAT_FIPS_E:
|
|
|
|
|
return "RSA Known Answer Test check FIPS error";
|
|
|
|
|
|
|
|
|
|
case DRBG_KAT_FIPS_E:
|
|
|
|
|
return "DRBG Known Answer Test check FIPS error";
|
|
|
|
|
|
|
|
|
|
case DRBG_CONT_FIPS_E:
|
|
|
|
|
return "DRBG Continuous Test FIPS error";
|
|
|
|
|
|
|
|
|
|
case AESGCM_KAT_FIPS_E:
|
|
|
|
|
return "AESGCM Known Answer Test check FIPS error";
|
|
|
|
|
|
2015-02-09 16:47:10 -08:00
|
|
|
case THREAD_STORE_KEY_E:
|
|
|
|
|
return "Thread Storage Key Create error";
|
|
|
|
|
|
|
|
|
|
case THREAD_STORE_SET_E:
|
|
|
|
|
return "Thread Storage Set error";
|
|
|
|
|
|
2015-02-24 12:33:52 -08:00
|
|
|
case MAC_CMP_FAILED_E:
|
|
|
|
|
return "MAC comparison failed";
|
|
|
|
|
|
2015-05-01 14:44:43 -07:00
|
|
|
case IS_POINT_E:
|
|
|
|
|
return "ECC is point on curve failed";
|
|
|
|
|
|
2015-06-16 11:29:27 -07:00
|
|
|
case ECC_INF_E:
|
2024-09-20 13:53:36 -05:00
|
|
|
return "ECC point at infinity error";
|
2017-01-11 16:34:06 -07:00
|
|
|
|
|
|
|
|
case ECC_OUT_OF_RANGE_E:
|
2024-09-20 13:53:36 -05:00
|
|
|
return "ECC Qx or Qy out of range error";
|
2015-06-16 11:29:27 -07:00
|
|
|
|
|
|
|
|
case ECC_PRIV_KEY_E:
|
2024-09-20 13:53:36 -05:00
|
|
|
return "ECC private key is not valid error";
|
2015-06-12 13:11:07 -07:00
|
|
|
|
2015-08-04 14:48:17 -03:00
|
|
|
case SRP_CALL_ORDER_E:
|
|
|
|
|
return "SRP function called in the wrong order error";
|
|
|
|
|
|
|
|
|
|
case SRP_VERIFY_E:
|
|
|
|
|
return "SRP proof verification error";
|
|
|
|
|
|
|
|
|
|
case SRP_BAD_KEY_E:
|
|
|
|
|
return "SRP bad key values error";
|
|
|
|
|
|
2015-11-02 12:18:12 -08:00
|
|
|
case ASN_NO_SKID:
|
|
|
|
|
return "ASN no Subject Key Identifier found error";
|
|
|
|
|
|
|
|
|
|
case ASN_NO_AKID:
|
|
|
|
|
return "ASN no Authority Key Identifier found error";
|
|
|
|
|
|
|
|
|
|
case ASN_NO_KEYUSAGE:
|
|
|
|
|
return "ASN no Key Usage found error";
|
|
|
|
|
|
|
|
|
|
case SKID_E:
|
|
|
|
|
return "Setting Subject Key Identifier error";
|
|
|
|
|
|
|
|
|
|
case AKID_E:
|
|
|
|
|
return "Setting Authority Key Identifier error";
|
|
|
|
|
|
|
|
|
|
case KEYUSAGE_E:
|
2017-09-26 12:05:46 -07:00
|
|
|
return "Key Usage value error";
|
|
|
|
|
|
|
|
|
|
case EXTKEYUSAGE_E:
|
|
|
|
|
return "Extended Key Usage value error";
|
2015-11-02 12:18:12 -08:00
|
|
|
|
|
|
|
|
case CERTPOLICIES_E:
|
|
|
|
|
return "Setting Certificate Policies error";
|
|
|
|
|
|
|
|
|
|
case WC_INIT_E:
|
|
|
|
|
return "wolfCrypt Initialize Failure error";
|
|
|
|
|
|
2015-11-13 12:22:32 -08:00
|
|
|
case SIG_VERIFY_E:
|
|
|
|
|
return "Signature verify error";
|
|
|
|
|
|
2015-11-23 15:13:36 -08:00
|
|
|
case BAD_COND_E:
|
|
|
|
|
return "Bad condition variable operation error";
|
|
|
|
|
|
2016-02-03 15:07:56 -08:00
|
|
|
case SIG_TYPE_E:
|
|
|
|
|
return "Signature type not enabled/available";
|
|
|
|
|
|
|
|
|
|
case HASH_TYPE_E:
|
|
|
|
|
return "Hash type not enabled/available";
|
|
|
|
|
|
2016-04-14 09:33:25 -06:00
|
|
|
case WC_KEY_SIZE_E:
|
|
|
|
|
return "Key size error, either too small or large";
|
|
|
|
|
|
2016-05-18 15:04:40 -07:00
|
|
|
case ASN_COUNTRY_SIZE_E:
|
|
|
|
|
return "Country code size error, either too small or large";
|
|
|
|
|
|
2016-07-18 18:10:38 -07:00
|
|
|
case MISSING_RNG_E:
|
|
|
|
|
return "RNG required but not provided";
|
|
|
|
|
|
2016-09-19 17:29:49 -07:00
|
|
|
case ASN_PATHLEN_SIZE_E:
|
|
|
|
|
return "ASN CA path length value too large error";
|
|
|
|
|
|
|
|
|
|
case ASN_PATHLEN_INV_E:
|
|
|
|
|
return "ASN CA path length larger than signer error";
|
|
|
|
|
|
2016-12-16 15:58:18 -07:00
|
|
|
case BAD_KEYWRAP_ALG_E:
|
|
|
|
|
return "Unsupported key wrap algorithm error";
|
|
|
|
|
|
2016-12-05 15:38:42 -07:00
|
|
|
case BAD_KEYWRAP_IV_E:
|
|
|
|
|
return "Decrypted AES key wrap IV does not match expected";
|
|
|
|
|
|
2017-02-06 14:51:55 -07:00
|
|
|
case WC_CLEANUP_E:
|
|
|
|
|
return "wolfcrypt cleanup failed";
|
|
|
|
|
|
2017-02-17 12:26:35 -08:00
|
|
|
case ECC_CDH_KAT_FIPS_E:
|
|
|
|
|
return "wolfcrypt FIPS ECC CDH Known Answer Test Failure";
|
|
|
|
|
|
2017-03-03 11:30:38 -08:00
|
|
|
case DH_CHECK_PUB_E:
|
|
|
|
|
return "DH Check Public Key failure";
|
|
|
|
|
|
2017-03-08 11:21:11 -08:00
|
|
|
case BAD_PATH_ERROR:
|
|
|
|
|
return "Bad path for opendir error";
|
|
|
|
|
|
2017-04-07 15:46:32 -07:00
|
|
|
case ASYNC_OP_E:
|
|
|
|
|
return "Async operation error";
|
|
|
|
|
|
2017-01-30 15:07:38 -03:00
|
|
|
case BAD_OCSP_RESPONDER:
|
|
|
|
|
return "Invalid OCSP Responder, missing specific key usage extensions";
|
|
|
|
|
|
2017-08-21 15:48:35 -06:00
|
|
|
case ECC_PRIVATEONLY_E:
|
|
|
|
|
return "Invalid use of private only ECC key";
|
|
|
|
|
|
2017-12-27 15:24:14 -07:00
|
|
|
case WC_HW_E:
|
|
|
|
|
return "Error with hardware crypto use";
|
2017-12-14 11:46:20 -07:00
|
|
|
|
2017-12-27 15:24:14 -07:00
|
|
|
case WC_HW_WAIT_E:
|
|
|
|
|
return "Hardware waiting on resource";
|
2017-12-20 11:12:36 -07:00
|
|
|
|
2018-01-10 09:53:36 +10:00
|
|
|
case PSS_SALTLEN_E:
|
|
|
|
|
return "PSS - Length of salt is too big for hash algorithm";
|
|
|
|
|
|
2017-10-24 11:51:22 -07:00
|
|
|
case PRIME_GEN_E:
|
|
|
|
|
return "Unable to find a prime for RSA key";
|
|
|
|
|
|
2018-02-19 13:40:18 +10:00
|
|
|
case BER_INDEF_E:
|
|
|
|
|
return "Unable to decode an indefinite length encoded message";
|
|
|
|
|
|
2018-02-22 17:17:54 -08:00
|
|
|
case RSA_OUT_OF_RANGE_E:
|
|
|
|
|
return "Ciphertext to decrypt is out of range";
|
|
|
|
|
|
2018-02-27 12:42:25 -08:00
|
|
|
case RSAPSS_PAT_FIPS_E:
|
|
|
|
|
return "wolfcrypt FIPS RSA-PSS Pairwise Agreement Test Failure";
|
|
|
|
|
|
|
|
|
|
case ECDSA_PAT_FIPS_E:
|
|
|
|
|
return "wolfcrypt FIPS ECDSA Pairwise Agreement Test Failure";
|
|
|
|
|
|
2018-02-28 10:54:53 -08:00
|
|
|
case DH_KAT_FIPS_E:
|
|
|
|
|
return "wolfcrypt FIPS DH Known Answer Test Failure";
|
|
|
|
|
|
2018-01-10 09:27:15 -08:00
|
|
|
case AESCCM_KAT_FIPS_E:
|
|
|
|
|
return "AESCCM Known Answer Test check FIPS error";
|
|
|
|
|
|
2018-02-01 11:02:35 -08:00
|
|
|
case SHA3_KAT_FIPS_E:
|
|
|
|
|
return "SHA-3 Known Answer Test check FIPS error";
|
|
|
|
|
|
2018-03-09 14:18:25 -08:00
|
|
|
case ECDHE_KAT_FIPS_E:
|
|
|
|
|
return "wolfcrypt FIPS ECDHE Known Answer Test Failure";
|
|
|
|
|
|
2018-03-15 17:05:30 -07:00
|
|
|
case AES_GCM_OVERFLOW_E:
|
|
|
|
|
return "AES-GCM invocation counter overflow";
|
|
|
|
|
|
|
|
|
|
case AES_CCM_OVERFLOW_E:
|
|
|
|
|
return "AES-CCM invocation counter overflow";
|
|
|
|
|
|
2018-04-26 14:02:43 -07:00
|
|
|
case RSA_KEY_PAIR_E:
|
|
|
|
|
return "RSA Key Pair-Wise Consistency check fail";
|
|
|
|
|
|
2018-05-08 17:02:59 -07:00
|
|
|
case DH_CHECK_PRIV_E:
|
|
|
|
|
return "DH Check Private Key failure";
|
|
|
|
|
|
2018-07-18 17:26:25 -06:00
|
|
|
case WC_AFALG_SOCK_E:
|
2018-10-04 16:07:35 -07:00
|
|
|
return "AF_ALG socket error";
|
2018-07-18 17:26:25 -06:00
|
|
|
|
2018-08-17 09:46:16 -06:00
|
|
|
case WC_DEVCRYPTO_E:
|
2018-09-25 12:16:59 -07:00
|
|
|
return "Error with /dev/crypto";
|
|
|
|
|
|
|
|
|
|
case ZLIB_INIT_ERROR:
|
|
|
|
|
return "zlib init error";
|
|
|
|
|
|
|
|
|
|
case ZLIB_COMPRESS_ERROR:
|
|
|
|
|
return "zlib compress error";
|
|
|
|
|
|
|
|
|
|
case ZLIB_DECOMPRESS_ERROR:
|
|
|
|
|
return "zlib decompress error";
|
2018-08-17 09:46:16 -06:00
|
|
|
|
2018-10-18 13:44:13 +10:00
|
|
|
case PKCS7_NO_SIGNER_E:
|
|
|
|
|
return "No signer in PKCS#7 signed data";
|
|
|
|
|
|
2019-03-08 16:50:45 -08:00
|
|
|
case CRYPTOCB_UNAVAILABLE:
|
|
|
|
|
return "Crypto callback unavailable";
|
|
|
|
|
|
2019-06-03 09:50:03 +07:00
|
|
|
case PKCS7_SIGNEEDS_CHECK:
|
|
|
|
|
return "Signature found but no certificate to verify";
|
|
|
|
|
|
2019-11-01 16:08:02 +10:00
|
|
|
case PSS_SALTLEN_RECOVER_E:
|
|
|
|
|
return "PSS - Salt length unable to be recovered";
|
|
|
|
|
|
2020-07-09 15:13:01 -07:00
|
|
|
case CHACHA_POLY_OVERFLOW:
|
|
|
|
|
return "wolfcrypt - ChaCha20_Poly1305 limit overflow 4GB";
|
|
|
|
|
|
2019-12-06 14:27:01 -07:00
|
|
|
case ASN_SELF_SIGNED_E:
|
|
|
|
|
return "ASN self-signed certificate error";
|
|
|
|
|
|
2021-01-12 12:25:52 +10:00
|
|
|
case SAKKE_VERIFY_FAIL_E:
|
|
|
|
|
return "SAKKE derivation verification error";
|
|
|
|
|
|
2021-03-04 16:01:45 +10:00
|
|
|
case MISSING_IV:
|
|
|
|
|
return "Required IV not set";
|
|
|
|
|
|
|
|
|
|
case MISSING_KEY:
|
|
|
|
|
return "Required key not set";
|
|
|
|
|
|
2021-03-25 17:52:01 -05:00
|
|
|
case BAD_LENGTH_E:
|
|
|
|
|
return "Value of length parameter is invalid.";
|
|
|
|
|
|
2021-02-25 16:03:55 -08:00
|
|
|
case ECDSA_KAT_FIPS_E:
|
|
|
|
|
return "wolfcrypt FIPS ECDSA Known Answer Test Failure";
|
|
|
|
|
|
2021-02-26 10:17:51 -08:00
|
|
|
case RSA_PAT_FIPS_E:
|
|
|
|
|
return "wolfcrypt FIPS RSA Pairwise Agreement Test Failure";
|
|
|
|
|
|
2021-03-01 08:44:01 -08:00
|
|
|
case KDF_TLS12_KAT_FIPS_E:
|
|
|
|
|
return "wolfcrypt FIPS TLSv1.2 KDF Known Answer Test Failure";
|
|
|
|
|
|
|
|
|
|
case KDF_TLS13_KAT_FIPS_E:
|
|
|
|
|
return "wolfcrypt FIPS TLSv1.3 KDF Known Answer Test Failure";
|
|
|
|
|
|
|
|
|
|
case KDF_SSH_KAT_FIPS_E:
|
|
|
|
|
return "wolfcrypt FIPS SSH KDF Known Answer Test Failure";
|
|
|
|
|
|
2021-03-26 10:49:52 -07:00
|
|
|
case DHE_PCT_E:
|
|
|
|
|
return "wolfcrypt DHE Pairwise Consistency Test Failure";
|
2021-03-24 10:31:26 -07:00
|
|
|
|
2021-03-26 10:49:52 -07:00
|
|
|
case ECC_PCT_E:
|
|
|
|
|
return "wolfcrypt ECDHE Pairwise Consistency Test Failure";
|
2021-03-24 10:31:26 -07:00
|
|
|
|
2021-10-12 15:59:17 -07:00
|
|
|
case FIPS_PRIVATE_KEY_LOCKED_E:
|
|
|
|
|
return "Cannot export private key, locked";
|
|
|
|
|
|
2021-10-30 20:21:21 +09:00
|
|
|
case PROTOCOLCB_UNAVAILABLE:
|
|
|
|
|
return "Protocol callback unavailable";
|
2022-03-10 18:21:07 +09:00
|
|
|
|
|
|
|
|
case NO_VALID_DEVID:
|
|
|
|
|
return "No valid device ID set";
|
|
|
|
|
|
2022-07-11 22:27:43 -05:00
|
|
|
case IO_FAILED_E:
|
|
|
|
|
return "Input/output failure";
|
|
|
|
|
|
|
|
|
|
case SYSLIB_FAILED_E:
|
|
|
|
|
return "System/library call failed";
|
|
|
|
|
|
2022-09-21 03:21:33 -04:00
|
|
|
case USE_HW_PSK:
|
|
|
|
|
return "Callback indicates that HW has PSK";
|
|
|
|
|
|
2022-11-25 12:40:35 +10:00
|
|
|
case ENTROPY_RT_E:
|
|
|
|
|
return "Entropy Repetition Test failed";
|
|
|
|
|
|
|
|
|
|
case ENTROPY_APT_E:
|
|
|
|
|
return "Entropy Adaptive Proportion Test failed";
|
|
|
|
|
|
2023-04-28 12:10:05 +10:00
|
|
|
case ASN_DEPTH_E:
|
|
|
|
|
return "Invalid ASN.1 - depth check";
|
|
|
|
|
|
|
|
|
|
case ASN_LEN_E:
|
|
|
|
|
return "ASN.1 length invalid";
|
|
|
|
|
|
2023-02-10 11:48:59 +10:00
|
|
|
case SM4_GCM_AUTH_E:
|
|
|
|
|
return "SM4-GCM Authentication check fail";
|
|
|
|
|
|
|
|
|
|
case SM4_CCM_AUTH_E:
|
|
|
|
|
return "SM4-CCM Authentication check fail";
|
|
|
|
|
|
2023-08-28 15:11:13 -07:00
|
|
|
case FIPS_DEGRADED_E:
|
2023-07-13 09:20:03 -07:00
|
|
|
return "FIPS module in DEGRADED mode";
|
|
|
|
|
|
2023-09-25 17:37:26 -06:00
|
|
|
case AES_EAX_AUTH_E:
|
|
|
|
|
return "AES-EAX Authentication check fail";
|
|
|
|
|
|
2024-01-23 15:22:46 +10:00
|
|
|
case KEY_EXHAUSTED_E:
|
|
|
|
|
return "Key no longer usable for operation";
|
|
|
|
|
|
2024-03-01 19:40:27 -05:00
|
|
|
case FIPS_INVALID_VER_E:
|
|
|
|
|
return "Invalid FIPS version defined, check length";
|
|
|
|
|
|
|
|
|
|
case FIPS_DATA_SZ_E:
|
|
|
|
|
return "FIPS Module Data too large adjust MAX_FIPS_DATA_SZ";
|
|
|
|
|
|
|
|
|
|
case FIPS_CODE_SZ_E:
|
|
|
|
|
return "FIPS Module Code too large adjust MAX_FIPS_CODE_SZ";
|
|
|
|
|
|
|
|
|
|
case KDF_SRTP_KAT_FIPS_E:
|
|
|
|
|
return "wolfCrypt FIPS SRTP-KDF Known Answer Test Failure";
|
|
|
|
|
|
|
|
|
|
case ED25519_KAT_FIPS_E:
|
|
|
|
|
return "wolfCrypt FIPS Ed25519 Known Answer Test Failure";
|
|
|
|
|
|
|
|
|
|
case ED448_KAT_FIPS_E:
|
|
|
|
|
return "wolfCrypt FIPS Ed448 Known Answer Test Failure";
|
|
|
|
|
|
|
|
|
|
case PBKDF2_KAT_FIPS_E:
|
|
|
|
|
return "wolfCrypt FIPS PBKDF2 Known Answer Test Failure";
|
|
|
|
|
|
2025-01-03 16:59:09 -07:00
|
|
|
case WC_KEY_MISMATCH_E:
|
|
|
|
|
return "key values mismatch";
|
|
|
|
|
|
2024-11-13 13:01:00 -06:00
|
|
|
case DEADLOCK_AVERTED_E:
|
|
|
|
|
return "Deadlock averted -- retry the call";
|
|
|
|
|
|
2023-03-06 13:41:01 +01:00
|
|
|
case ASCON_AUTH_E:
|
|
|
|
|
return "ASCON Authentication check fail";
|
|
|
|
|
|
2025-06-20 13:45:04 -05:00
|
|
|
case WC_ACCEL_INHIBIT_E:
|
|
|
|
|
return "Crypto acceleration is currently inhibited";
|
|
|
|
|
|
2025-07-19 16:59:15 -04:00
|
|
|
case BAD_INDEX_E:
|
|
|
|
|
return "Bad index";
|
|
|
|
|
|
2025-07-25 15:56:48 -05:00
|
|
|
case INTERRUPTED_E:
|
|
|
|
|
return "Process interrupted";
|
|
|
|
|
|
2025-11-24 10:22:40 -07:00
|
|
|
case MLKEM_PUB_HASH_E:
|
|
|
|
|
return "ML-KEM priv key's stored hash doesn't match encoded pub key";
|
|
|
|
|
|
2026-01-06 00:55:29 -06:00
|
|
|
case BUSY_E:
|
|
|
|
|
return "Object is busy";
|
|
|
|
|
|
|
|
|
|
case ALREADY_E:
|
|
|
|
|
return "Operation was redundant or preempted";
|
|
|
|
|
|
2026-02-27 23:40:37 -06:00
|
|
|
case SEQ_OVERFLOW_E:
|
|
|
|
|
return "Sequence counter would overflow";
|
|
|
|
|
|
2024-08-29 14:22:56 -05:00
|
|
|
case MAX_CODE_E:
|
2024-11-13 13:01:00 -06:00
|
|
|
case WC_SPAN1_MIN_CODE_E:
|
2024-08-29 14:22:56 -05:00
|
|
|
case MIN_CODE_E:
|
2014-12-19 09:56:51 -07:00
|
|
|
default:
|
|
|
|
|
return "unknown error number";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-08 16:39:53 -05:00
|
|
|
#ifdef WOLFSSL_DEBUG_TRACE_ERROR_CODES
|
|
|
|
|
#include <wolfssl/debug-trace-error-codes.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2014-12-19 11:27:01 -07:00
|
|
|
void wc_ErrorString(int error, char* buffer)
|
2014-12-19 09:56:51 -07:00
|
|
|
{
|
2014-12-19 11:27:01 -07:00
|
|
|
XSTRNCPY(buffer, wc_GetErrorString(error), WOLFSSL_MAX_ERROR_SZ);
|
2019-12-06 09:53:39 -08:00
|
|
|
buffer[WOLFSSL_MAX_ERROR_SZ-1] = 0;
|
2014-12-19 09:56:51 -07:00
|
|
|
}
|
2018-02-23 17:31:20 -07:00
|
|
|
#endif /* !NO_ERROR_STRINGS */
|