From ce39ef62ef5be5922bed48f6ceadf678bba9f1a1 Mon Sep 17 00:00:00 2001 From: toddouska Date: Wed, 14 May 2014 15:05:20 -0700 Subject: [PATCH] update const error strings for newly added ones --- ctaocrypt/src/error.c | 20 +++++++------------- cyassl/ctaocrypt/error-crypt.h | 2 +- src/internal.c | 11 ++++------- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/ctaocrypt/src/error.c b/ctaocrypt/src/error.c index b49fa549d..eebc6cfb7 100644 --- a/ctaocrypt/src/error.c +++ b/ctaocrypt/src/error.c @@ -32,7 +32,7 @@ #pragma warning(disable: 4996) #endif -const char *CTaoCryptGetErrorString(int error) +const char* CTaoCryptGetErrorString(int error) { #ifdef NO_ERROR_STRINGS @@ -191,8 +191,7 @@ const char *CTaoCryptGetErrorString(int error) return "ASN NTRU key decode error, invalid input"; case ASN_CRIT_EXT_E: - XSTRNCPY(buffer, "X.509 Critical extension ignored", max); - break; + return "X.509 Critical extension ignored"; case ECC_BAD_ARG_E : return "ECC input argument wrong type, invalid input"; @@ -261,24 +260,19 @@ const char *CTaoCryptGetErrorString(int error) return "Bad padding, message wrong length"; case REQ_ATTRIBUTE_E: - XSTRNCPY(buffer, "Setting cert request attributes error", max); - break; + return "Setting cert request attributes error"; case PKCS7_OID_E: - XSTRNCPY(buffer, "PKCS#7 error: mismatched OID value", max); - break; + return "PKCS#7 error: mismatched OID value"; case PKCS7_RECIP_E: - XSTRNCPY(buffer, "PKCS#7 error: no matching recipient found", max); - break; + return "PKCS#7 error: no matching recipient found"; case FIPS_NOT_ALLOWED_E: - XSTRNCPY(buffer, "FIPS mode not allowed error", max); - break; + return "FIPS mode not allowed error"; case ASN_NAME_INVALID_E: - XSTRNCPY(buffer, "Name Constraint error", max); - break; + return "Name Constraint error"; default: return "unknown error number"; diff --git a/cyassl/ctaocrypt/error-crypt.h b/cyassl/ctaocrypt/error-crypt.h index 1c7930eed..131e248af 100644 --- a/cyassl/ctaocrypt/error-crypt.h +++ b/cyassl/ctaocrypt/error-crypt.h @@ -130,7 +130,7 @@ enum { CYASSL_API void CTaoCryptErrorString(int err, char* buff); -CYASSL_API const char *CTaoCryptGetErrorString(int error); +CYASSL_API const char* CTaoCryptGetErrorString(int error); #ifdef __cplusplus diff --git a/src/internal.c b/src/internal.c index 8618bf642..a99042504 100644 --- a/src/internal.c +++ b/src/internal.c @@ -6206,7 +6206,7 @@ const char* CyaSSL_ERR_reason_error_string(unsigned long e) #else - int error = (long) e; + int error = (int)e; /* pass to CTaoCrypt */ if (error < MAX_CODE_E && error > MIN_CODE_E) { @@ -6465,16 +6465,13 @@ const char* CyaSSL_ERR_reason_error_string(unsigned long e) return "Unrecognized host name Error"; case KEYUSE_SIGNATURE_E: - XSTRNCPY(str, "Key Use digitalSignature not set Error", max); - break; + return "Key Use digitalSignature not set Error"; case KEYUSE_ENCIPHER_E: - XSTRNCPY(str, "Key Use keyEncipherment not set Error", max); - break; + return "Key Use keyEncipherment not set Error"; case EXTKEYUSE_AUTH_E: - XSTRNCPY(str, "Ext Key Use server/client auth not set Error", max); - break; + return "Ext Key Use server/client auth not set Error"; default : return "unknown error number";