SSL/TLS Library

Dependents:  

CyaSSL is SSL/TLS library for embedded systems.

wolfssl.com

Committer:
wolfSSL
Date:
Sun Apr 20 12:40:57 2014 +0000
Revision:
0:9d17e4342598
CyaSSL SSL/TLS Library 2.9.4;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wolfSSL 0:9d17e4342598 1 /* error.c
wolfSSL 0:9d17e4342598 2 *
wolfSSL 0:9d17e4342598 3 * Copyright (C) 2006-2013 wolfSSL Inc.
wolfSSL 0:9d17e4342598 4 *
wolfSSL 0:9d17e4342598 5 * This file is part of CyaSSL.
wolfSSL 0:9d17e4342598 6 *
wolfSSL 0:9d17e4342598 7 * CyaSSL is free software; you can redistribute it and/or modify
wolfSSL 0:9d17e4342598 8 * it under the terms of the GNU General Public License as published by
wolfSSL 0:9d17e4342598 9 * the Free Software Foundation; either version 2 of the License, or
wolfSSL 0:9d17e4342598 10 * (at your option) any later version.
wolfSSL 0:9d17e4342598 11 *
wolfSSL 0:9d17e4342598 12 * CyaSSL is distributed in the hope that it will be useful,
wolfSSL 0:9d17e4342598 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
wolfSSL 0:9d17e4342598 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
wolfSSL 0:9d17e4342598 15 * GNU General Public License for more details.
wolfSSL 0:9d17e4342598 16 *
wolfSSL 0:9d17e4342598 17 * You should have received a copy of the GNU General Public License
wolfSSL 0:9d17e4342598 18 * along with this program; if not, write to the Free Software
wolfSSL 0:9d17e4342598 19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
wolfSSL 0:9d17e4342598 20 */
wolfSSL 0:9d17e4342598 21
wolfSSL 0:9d17e4342598 22 #ifdef HAVE_CONFIG_H
wolfSSL 0:9d17e4342598 23 #include <config.h>
wolfSSL 0:9d17e4342598 24 #endif
wolfSSL 0:9d17e4342598 25
wolfSSL 0:9d17e4342598 26 #include <cyassl/ctaocrypt/settings.h>
wolfSSL 0:9d17e4342598 27
wolfSSL 0:9d17e4342598 28 #include <cyassl/ctaocrypt/error-crypt.h>
wolfSSL 0:9d17e4342598 29
wolfSSL 0:9d17e4342598 30 #ifdef _MSC_VER
wolfSSL 0:9d17e4342598 31 /* 4996 warning to use MS extensions e.g., strcpy_s instead of XSTRNCPY */
wolfSSL 0:9d17e4342598 32 #pragma warning(disable: 4996)
wolfSSL 0:9d17e4342598 33 #endif
wolfSSL 0:9d17e4342598 34
wolfSSL 0:9d17e4342598 35
wolfSSL 0:9d17e4342598 36 void CTaoCryptErrorString(int error, char* buffer)
wolfSSL 0:9d17e4342598 37 {
wolfSSL 0:9d17e4342598 38 const int max = CYASSL_MAX_ERROR_SZ; /* shorthand */
wolfSSL 0:9d17e4342598 39
wolfSSL 0:9d17e4342598 40 #ifdef NO_ERROR_STRINGS
wolfSSL 0:9d17e4342598 41
wolfSSL 0:9d17e4342598 42 (void)error;
wolfSSL 0:9d17e4342598 43 XSTRNCPY(buffer, "no support for error strings built in", max);
wolfSSL 0:9d17e4342598 44
wolfSSL 0:9d17e4342598 45 #else
wolfSSL 0:9d17e4342598 46
wolfSSL 0:9d17e4342598 47 switch (error) {
wolfSSL 0:9d17e4342598 48
wolfSSL 0:9d17e4342598 49 case OPEN_RAN_E :
wolfSSL 0:9d17e4342598 50 XSTRNCPY(buffer, "opening random device error", max);
wolfSSL 0:9d17e4342598 51 break;
wolfSSL 0:9d17e4342598 52
wolfSSL 0:9d17e4342598 53 case READ_RAN_E :
wolfSSL 0:9d17e4342598 54 XSTRNCPY(buffer, "reading random device error", max);
wolfSSL 0:9d17e4342598 55 break;
wolfSSL 0:9d17e4342598 56
wolfSSL 0:9d17e4342598 57 case WINCRYPT_E :
wolfSSL 0:9d17e4342598 58 XSTRNCPY(buffer, "windows crypt init error", max);
wolfSSL 0:9d17e4342598 59 break;
wolfSSL 0:9d17e4342598 60
wolfSSL 0:9d17e4342598 61 case CRYPTGEN_E :
wolfSSL 0:9d17e4342598 62 XSTRNCPY(buffer, "windows crypt generation error", max);
wolfSSL 0:9d17e4342598 63 break;
wolfSSL 0:9d17e4342598 64
wolfSSL 0:9d17e4342598 65 case RAN_BLOCK_E :
wolfSSL 0:9d17e4342598 66 XSTRNCPY(buffer, "random device read would block error", max);
wolfSSL 0:9d17e4342598 67 break;
wolfSSL 0:9d17e4342598 68
wolfSSL 0:9d17e4342598 69 case BAD_MUTEX_E :
wolfSSL 0:9d17e4342598 70 XSTRNCPY(buffer, "Bad mutex, operation failed", max);
wolfSSL 0:9d17e4342598 71 break;
wolfSSL 0:9d17e4342598 72
wolfSSL 0:9d17e4342598 73 case MP_INIT_E :
wolfSSL 0:9d17e4342598 74 XSTRNCPY(buffer, "mp_init error state", max);
wolfSSL 0:9d17e4342598 75 break;
wolfSSL 0:9d17e4342598 76
wolfSSL 0:9d17e4342598 77 case MP_READ_E :
wolfSSL 0:9d17e4342598 78 XSTRNCPY(buffer, "mp_read error state", max);
wolfSSL 0:9d17e4342598 79 break;
wolfSSL 0:9d17e4342598 80
wolfSSL 0:9d17e4342598 81 case MP_EXPTMOD_E :
wolfSSL 0:9d17e4342598 82 XSTRNCPY(buffer, "mp_exptmod error state", max);
wolfSSL 0:9d17e4342598 83 break;
wolfSSL 0:9d17e4342598 84
wolfSSL 0:9d17e4342598 85 case MP_TO_E :
wolfSSL 0:9d17e4342598 86 XSTRNCPY(buffer, "mp_to_xxx error state, can't convert", max);
wolfSSL 0:9d17e4342598 87 break;
wolfSSL 0:9d17e4342598 88
wolfSSL 0:9d17e4342598 89 case MP_SUB_E :
wolfSSL 0:9d17e4342598 90 XSTRNCPY(buffer, "mp_sub error state, can't subtract", max);
wolfSSL 0:9d17e4342598 91 break;
wolfSSL 0:9d17e4342598 92
wolfSSL 0:9d17e4342598 93 case MP_ADD_E :
wolfSSL 0:9d17e4342598 94 XSTRNCPY(buffer, "mp_add error state, can't add", max);
wolfSSL 0:9d17e4342598 95 break;
wolfSSL 0:9d17e4342598 96
wolfSSL 0:9d17e4342598 97 case MP_MUL_E :
wolfSSL 0:9d17e4342598 98 XSTRNCPY(buffer, "mp_mul error state, can't multiply", max);
wolfSSL 0:9d17e4342598 99 break;
wolfSSL 0:9d17e4342598 100
wolfSSL 0:9d17e4342598 101 case MP_MULMOD_E :
wolfSSL 0:9d17e4342598 102 XSTRNCPY(buffer, "mp_mulmod error state, can't multiply mod", max);
wolfSSL 0:9d17e4342598 103 break;
wolfSSL 0:9d17e4342598 104
wolfSSL 0:9d17e4342598 105 case MP_MOD_E :
wolfSSL 0:9d17e4342598 106 XSTRNCPY(buffer, "mp_mod error state, can't mod", max);
wolfSSL 0:9d17e4342598 107 break;
wolfSSL 0:9d17e4342598 108
wolfSSL 0:9d17e4342598 109 case MP_INVMOD_E :
wolfSSL 0:9d17e4342598 110 XSTRNCPY(buffer, "mp_invmod error state, can't inv mod", max);
wolfSSL 0:9d17e4342598 111 break;
wolfSSL 0:9d17e4342598 112
wolfSSL 0:9d17e4342598 113 case MP_CMP_E :
wolfSSL 0:9d17e4342598 114 XSTRNCPY(buffer, "mp_cmp error state", max);
wolfSSL 0:9d17e4342598 115 break;
wolfSSL 0:9d17e4342598 116
wolfSSL 0:9d17e4342598 117 case MP_ZERO_E :
wolfSSL 0:9d17e4342598 118 XSTRNCPY(buffer, "mp zero result, not expected", max);
wolfSSL 0:9d17e4342598 119 break;
wolfSSL 0:9d17e4342598 120
wolfSSL 0:9d17e4342598 121 case MEMORY_E :
wolfSSL 0:9d17e4342598 122 XSTRNCPY(buffer, "out of memory error", max);
wolfSSL 0:9d17e4342598 123 break;
wolfSSL 0:9d17e4342598 124
wolfSSL 0:9d17e4342598 125 case RSA_WRONG_TYPE_E :
wolfSSL 0:9d17e4342598 126 XSTRNCPY(buffer, "RSA wrong block type for RSA function", max);
wolfSSL 0:9d17e4342598 127 break;
wolfSSL 0:9d17e4342598 128
wolfSSL 0:9d17e4342598 129 case RSA_BUFFER_E :
wolfSSL 0:9d17e4342598 130 XSTRNCPY(buffer, "RSA buffer error, output too small or input too big",
wolfSSL 0:9d17e4342598 131 max);
wolfSSL 0:9d17e4342598 132 break;
wolfSSL 0:9d17e4342598 133
wolfSSL 0:9d17e4342598 134 case BUFFER_E :
wolfSSL 0:9d17e4342598 135 XSTRNCPY(buffer, "Buffer error, output too small or input too big",max);
wolfSSL 0:9d17e4342598 136 break;
wolfSSL 0:9d17e4342598 137
wolfSSL 0:9d17e4342598 138 case ALGO_ID_E :
wolfSSL 0:9d17e4342598 139 XSTRNCPY(buffer, "Setting Cert AlogID error", max);
wolfSSL 0:9d17e4342598 140 break;
wolfSSL 0:9d17e4342598 141
wolfSSL 0:9d17e4342598 142 case PUBLIC_KEY_E :
wolfSSL 0:9d17e4342598 143 XSTRNCPY(buffer, "Setting Cert Public Key error", max);
wolfSSL 0:9d17e4342598 144 break;
wolfSSL 0:9d17e4342598 145
wolfSSL 0:9d17e4342598 146 case DATE_E :
wolfSSL 0:9d17e4342598 147 XSTRNCPY(buffer, "Setting Cert Date validity error", max);
wolfSSL 0:9d17e4342598 148 break;
wolfSSL 0:9d17e4342598 149
wolfSSL 0:9d17e4342598 150 case SUBJECT_E :
wolfSSL 0:9d17e4342598 151 XSTRNCPY(buffer, "Setting Cert Subject name error", max);
wolfSSL 0:9d17e4342598 152 break;
wolfSSL 0:9d17e4342598 153
wolfSSL 0:9d17e4342598 154 case ISSUER_E :
wolfSSL 0:9d17e4342598 155 XSTRNCPY(buffer, "Setting Cert Issuer name error", max);
wolfSSL 0:9d17e4342598 156 break;
wolfSSL 0:9d17e4342598 157
wolfSSL 0:9d17e4342598 158 case CA_TRUE_E :
wolfSSL 0:9d17e4342598 159 XSTRNCPY(buffer, "Setting basic constraint CA true error", max);
wolfSSL 0:9d17e4342598 160 break;
wolfSSL 0:9d17e4342598 161
wolfSSL 0:9d17e4342598 162 case EXTENSIONS_E :
wolfSSL 0:9d17e4342598 163 XSTRNCPY(buffer, "Setting extensions error", max);
wolfSSL 0:9d17e4342598 164 break;
wolfSSL 0:9d17e4342598 165
wolfSSL 0:9d17e4342598 166 case ASN_PARSE_E :
wolfSSL 0:9d17e4342598 167 XSTRNCPY(buffer, "ASN parsing error, invalid input", max);
wolfSSL 0:9d17e4342598 168 break;
wolfSSL 0:9d17e4342598 169
wolfSSL 0:9d17e4342598 170 case ASN_VERSION_E :
wolfSSL 0:9d17e4342598 171 XSTRNCPY(buffer, "ASN version error, invalid number", max);
wolfSSL 0:9d17e4342598 172 break;
wolfSSL 0:9d17e4342598 173
wolfSSL 0:9d17e4342598 174 case ASN_GETINT_E :
wolfSSL 0:9d17e4342598 175 XSTRNCPY(buffer, "ASN get big int error, invalid data", max);
wolfSSL 0:9d17e4342598 176 break;
wolfSSL 0:9d17e4342598 177
wolfSSL 0:9d17e4342598 178 case ASN_RSA_KEY_E :
wolfSSL 0:9d17e4342598 179 XSTRNCPY(buffer, "ASN key init error, invalid input", max);
wolfSSL 0:9d17e4342598 180 break;
wolfSSL 0:9d17e4342598 181
wolfSSL 0:9d17e4342598 182 case ASN_OBJECT_ID_E :
wolfSSL 0:9d17e4342598 183 XSTRNCPY(buffer, "ASN object id error, invalid id", max);
wolfSSL 0:9d17e4342598 184 break;
wolfSSL 0:9d17e4342598 185
wolfSSL 0:9d17e4342598 186 case ASN_TAG_NULL_E :
wolfSSL 0:9d17e4342598 187 XSTRNCPY(buffer, "ASN tag error, not null", max);
wolfSSL 0:9d17e4342598 188 break;
wolfSSL 0:9d17e4342598 189
wolfSSL 0:9d17e4342598 190 case ASN_EXPECT_0_E :
wolfSSL 0:9d17e4342598 191 XSTRNCPY(buffer, "ASN expect error, not zero", max);
wolfSSL 0:9d17e4342598 192 break;
wolfSSL 0:9d17e4342598 193
wolfSSL 0:9d17e4342598 194 case ASN_BITSTR_E :
wolfSSL 0:9d17e4342598 195 XSTRNCPY(buffer, "ASN bit string error, wrong id", max);
wolfSSL 0:9d17e4342598 196 break;
wolfSSL 0:9d17e4342598 197
wolfSSL 0:9d17e4342598 198 case ASN_UNKNOWN_OID_E :
wolfSSL 0:9d17e4342598 199 XSTRNCPY(buffer, "ASN oid error, unknown sum id", max);
wolfSSL 0:9d17e4342598 200 break;
wolfSSL 0:9d17e4342598 201
wolfSSL 0:9d17e4342598 202 case ASN_DATE_SZ_E :
wolfSSL 0:9d17e4342598 203 XSTRNCPY(buffer, "ASN date error, bad size", max);
wolfSSL 0:9d17e4342598 204 break;
wolfSSL 0:9d17e4342598 205
wolfSSL 0:9d17e4342598 206 case ASN_BEFORE_DATE_E :
wolfSSL 0:9d17e4342598 207 XSTRNCPY(buffer, "ASN date error, current date before", max);
wolfSSL 0:9d17e4342598 208 break;
wolfSSL 0:9d17e4342598 209
wolfSSL 0:9d17e4342598 210 case ASN_AFTER_DATE_E :
wolfSSL 0:9d17e4342598 211 XSTRNCPY(buffer, "ASN date error, current date after", max);
wolfSSL 0:9d17e4342598 212 break;
wolfSSL 0:9d17e4342598 213
wolfSSL 0:9d17e4342598 214 case ASN_SIG_OID_E :
wolfSSL 0:9d17e4342598 215 XSTRNCPY(buffer, "ASN signature error, mismatched oid", max);
wolfSSL 0:9d17e4342598 216 break;
wolfSSL 0:9d17e4342598 217
wolfSSL 0:9d17e4342598 218 case ASN_TIME_E :
wolfSSL 0:9d17e4342598 219 XSTRNCPY(buffer, "ASN time error, unkown time type", max);
wolfSSL 0:9d17e4342598 220 break;
wolfSSL 0:9d17e4342598 221
wolfSSL 0:9d17e4342598 222 case ASN_INPUT_E :
wolfSSL 0:9d17e4342598 223 XSTRNCPY(buffer, "ASN input error, not enough data", max);
wolfSSL 0:9d17e4342598 224 break;
wolfSSL 0:9d17e4342598 225
wolfSSL 0:9d17e4342598 226 case ASN_SIG_CONFIRM_E :
wolfSSL 0:9d17e4342598 227 XSTRNCPY(buffer, "ASN sig error, confirm failure", max);
wolfSSL 0:9d17e4342598 228 break;
wolfSSL 0:9d17e4342598 229
wolfSSL 0:9d17e4342598 230 case ASN_SIG_HASH_E :
wolfSSL 0:9d17e4342598 231 XSTRNCPY(buffer, "ASN sig error, unsupported hash type", max);
wolfSSL 0:9d17e4342598 232 break;
wolfSSL 0:9d17e4342598 233
wolfSSL 0:9d17e4342598 234 case ASN_SIG_KEY_E :
wolfSSL 0:9d17e4342598 235 XSTRNCPY(buffer, "ASN sig error, unsupported key type", max);
wolfSSL 0:9d17e4342598 236 break;
wolfSSL 0:9d17e4342598 237
wolfSSL 0:9d17e4342598 238 case ASN_DH_KEY_E :
wolfSSL 0:9d17e4342598 239 XSTRNCPY(buffer, "ASN key init error, invalid input", max);
wolfSSL 0:9d17e4342598 240 break;
wolfSSL 0:9d17e4342598 241
wolfSSL 0:9d17e4342598 242 case ASN_NTRU_KEY_E :
wolfSSL 0:9d17e4342598 243 XSTRNCPY(buffer, "ASN NTRU key decode error, invalid input", max);
wolfSSL 0:9d17e4342598 244 break;
wolfSSL 0:9d17e4342598 245
wolfSSL 0:9d17e4342598 246 case ASN_CRIT_EXT_E:
wolfSSL 0:9d17e4342598 247 XSTRNCPY(buffer, "X.509 Critical extension ignored", max);
wolfSSL 0:9d17e4342598 248 break;
wolfSSL 0:9d17e4342598 249
wolfSSL 0:9d17e4342598 250 case ECC_BAD_ARG_E :
wolfSSL 0:9d17e4342598 251 XSTRNCPY(buffer, "ECC input argument wrong type, invalid input", max);
wolfSSL 0:9d17e4342598 252 break;
wolfSSL 0:9d17e4342598 253
wolfSSL 0:9d17e4342598 254 case ASN_ECC_KEY_E :
wolfSSL 0:9d17e4342598 255 XSTRNCPY(buffer, "ECC ASN1 bad key data, invalid input", max);
wolfSSL 0:9d17e4342598 256 break;
wolfSSL 0:9d17e4342598 257
wolfSSL 0:9d17e4342598 258 case ECC_CURVE_OID_E :
wolfSSL 0:9d17e4342598 259 XSTRNCPY(buffer, "ECC curve sum OID unsupported, invalid input", max);
wolfSSL 0:9d17e4342598 260 break;
wolfSSL 0:9d17e4342598 261
wolfSSL 0:9d17e4342598 262 case BAD_FUNC_ARG :
wolfSSL 0:9d17e4342598 263 XSTRNCPY(buffer, "Bad function argument", max);
wolfSSL 0:9d17e4342598 264 break;
wolfSSL 0:9d17e4342598 265
wolfSSL 0:9d17e4342598 266 case NOT_COMPILED_IN :
wolfSSL 0:9d17e4342598 267 XSTRNCPY(buffer, "Feature not compiled in", max);
wolfSSL 0:9d17e4342598 268 break;
wolfSSL 0:9d17e4342598 269
wolfSSL 0:9d17e4342598 270 case UNICODE_SIZE_E :
wolfSSL 0:9d17e4342598 271 XSTRNCPY(buffer, "Unicode password too big", max);
wolfSSL 0:9d17e4342598 272 break;
wolfSSL 0:9d17e4342598 273
wolfSSL 0:9d17e4342598 274 case NO_PASSWORD :
wolfSSL 0:9d17e4342598 275 XSTRNCPY(buffer, "No password provided by user", max);
wolfSSL 0:9d17e4342598 276 break;
wolfSSL 0:9d17e4342598 277
wolfSSL 0:9d17e4342598 278 case ALT_NAME_E :
wolfSSL 0:9d17e4342598 279 XSTRNCPY(buffer, "Alt Name problem, too big", max);
wolfSSL 0:9d17e4342598 280 break;
wolfSSL 0:9d17e4342598 281
wolfSSL 0:9d17e4342598 282 case AES_GCM_AUTH_E:
wolfSSL 0:9d17e4342598 283 XSTRNCPY(buffer, "AES-GCM Authentication check fail", max);
wolfSSL 0:9d17e4342598 284 break;
wolfSSL 0:9d17e4342598 285
wolfSSL 0:9d17e4342598 286 case AES_CCM_AUTH_E:
wolfSSL 0:9d17e4342598 287 XSTRNCPY(buffer, "AES-CCM Authentication check fail", max);
wolfSSL 0:9d17e4342598 288 break;
wolfSSL 0:9d17e4342598 289
wolfSSL 0:9d17e4342598 290 case CAVIUM_INIT_E:
wolfSSL 0:9d17e4342598 291 XSTRNCPY(buffer, "Cavium Init type error", max);
wolfSSL 0:9d17e4342598 292 break;
wolfSSL 0:9d17e4342598 293
wolfSSL 0:9d17e4342598 294 case COMPRESS_INIT_E:
wolfSSL 0:9d17e4342598 295 XSTRNCPY(buffer, "Compress Init error", max);
wolfSSL 0:9d17e4342598 296 break;
wolfSSL 0:9d17e4342598 297
wolfSSL 0:9d17e4342598 298 case COMPRESS_E:
wolfSSL 0:9d17e4342598 299 XSTRNCPY(buffer, "Compress error", max);
wolfSSL 0:9d17e4342598 300 break;
wolfSSL 0:9d17e4342598 301
wolfSSL 0:9d17e4342598 302 case DECOMPRESS_INIT_E:
wolfSSL 0:9d17e4342598 303 XSTRNCPY(buffer, "DeCompress Init error", max);
wolfSSL 0:9d17e4342598 304 break;
wolfSSL 0:9d17e4342598 305
wolfSSL 0:9d17e4342598 306 case DECOMPRESS_E:
wolfSSL 0:9d17e4342598 307 XSTRNCPY(buffer, "DeCompress error", max);
wolfSSL 0:9d17e4342598 308 break;
wolfSSL 0:9d17e4342598 309
wolfSSL 0:9d17e4342598 310 case BAD_ALIGN_E:
wolfSSL 0:9d17e4342598 311 XSTRNCPY(buffer, "Bad alignment error, no alloc help", max);
wolfSSL 0:9d17e4342598 312 break;
wolfSSL 0:9d17e4342598 313
wolfSSL 0:9d17e4342598 314 case ASN_NO_SIGNER_E :
wolfSSL 0:9d17e4342598 315 XSTRNCPY(buffer, "ASN no signer error to confirm failure", max);
wolfSSL 0:9d17e4342598 316 break;
wolfSSL 0:9d17e4342598 317
wolfSSL 0:9d17e4342598 318 case ASN_CRL_CONFIRM_E :
wolfSSL 0:9d17e4342598 319 XSTRNCPY(buffer, "ASN CRL sig error, confirm failure", max);
wolfSSL 0:9d17e4342598 320 break;
wolfSSL 0:9d17e4342598 321
wolfSSL 0:9d17e4342598 322 case ASN_CRL_NO_SIGNER_E :
wolfSSL 0:9d17e4342598 323 XSTRNCPY(buffer, "ASN CRL no signer error to confirm failure", max);
wolfSSL 0:9d17e4342598 324 break;
wolfSSL 0:9d17e4342598 325
wolfSSL 0:9d17e4342598 326 case ASN_OCSP_CONFIRM_E :
wolfSSL 0:9d17e4342598 327 XSTRNCPY(buffer, "ASN OCSP sig error, confirm failure", max);
wolfSSL 0:9d17e4342598 328 break;
wolfSSL 0:9d17e4342598 329
wolfSSL 0:9d17e4342598 330 case BAD_ENC_STATE_E:
wolfSSL 0:9d17e4342598 331 XSTRNCPY(buffer, "Bad ecc encrypt state operation", max);
wolfSSL 0:9d17e4342598 332 break;
wolfSSL 0:9d17e4342598 333
wolfSSL 0:9d17e4342598 334 case BAD_PADDING_E:
wolfSSL 0:9d17e4342598 335 XSTRNCPY(buffer, "Bad padding, message wrong length", max);
wolfSSL 0:9d17e4342598 336 break;
wolfSSL 0:9d17e4342598 337
wolfSSL 0:9d17e4342598 338 case REQ_ATTRIBUTE_E:
wolfSSL 0:9d17e4342598 339 XSTRNCPY(buffer, "Setting cert request attributes error", max);
wolfSSL 0:9d17e4342598 340 break;
wolfSSL 0:9d17e4342598 341
wolfSSL 0:9d17e4342598 342 case PKCS7_OID_E:
wolfSSL 0:9d17e4342598 343 XSTRNCPY(buffer, "PKCS#7 error: mismatched OID value", max);
wolfSSL 0:9d17e4342598 344 break;
wolfSSL 0:9d17e4342598 345
wolfSSL 0:9d17e4342598 346 case PKCS7_RECIP_E:
wolfSSL 0:9d17e4342598 347 XSTRNCPY(buffer, "PKCS#7 error: no matching recipient found", max);
wolfSSL 0:9d17e4342598 348 break;
wolfSSL 0:9d17e4342598 349
wolfSSL 0:9d17e4342598 350 case FIPS_NOT_ALLOWED_E:
wolfSSL 0:9d17e4342598 351 XSTRNCPY(buffer, "FIPS mode not allowed error", max);
wolfSSL 0:9d17e4342598 352 break;
wolfSSL 0:9d17e4342598 353
wolfSSL 0:9d17e4342598 354 default:
wolfSSL 0:9d17e4342598 355 XSTRNCPY(buffer, "unknown error number", max);
wolfSSL 0:9d17e4342598 356
wolfSSL 0:9d17e4342598 357 }
wolfSSL 0:9d17e4342598 358
wolfSSL 0:9d17e4342598 359 #endif /* NO_ERROR_STRINGS */
wolfSSL 0:9d17e4342598 360
wolfSSL 0:9d17e4342598 361 }