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";