Skip to content

Commit

Permalink
add MP RSA HW error codes to error.c; see wolfSSL#6565 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
gojimmypi committed Jul 10, 2023
1 parent 73d447d commit 70e9843
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wolfssl", "wolfssl", "{D9780A88-9270-4F6A-BE47-F3B0264381E3}"
ProjectSection(SolutionItems) = preProject
..\..\..\..\..\..\wolfssl\wolfcrypt\error-crypt.h = ..\..\..\..\..\..\wolfssl\wolfcrypt\error-crypt.h
..\..\..\..\..\..\wolfcrypt\src\error.c = ..\..\..\..\..\..\wolfcrypt\src\error.c
..\..\..\..\..\..\wolfssl\wolfcrypt\port\Espressif\esp32-crypt.h = ..\..\..\..\..\..\wolfssl\wolfcrypt\port\Espressif\esp32-crypt.h
..\..\..\..\..\..\wolfcrypt\src\port\Espressif\esp32_aes.c = ..\..\..\..\..\..\wolfcrypt\src\port\Espressif\esp32_aes.c
..\..\..\..\..\..\wolfcrypt\src\port\Espressif\esp32_mp.c = ..\..\..\..\..\..\wolfcrypt\src\port\Espressif\esp32_mp.c
Expand Down
12 changes: 12 additions & 0 deletions wolfcrypt/src/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,18 @@ const char* wc_GetErrorString(int error)
case SM4_CCM_AUTH_E:
return "SM4-CCM Authentication check fail";

case RSA_HW_ERROR:
return "Hardware math acceleration error";

case RSA_HW_BUSY:
return "Hardware math accelerator busy, can fall back to SW";

case RSA_HW_FALLBACK:
return "Hardware math issue: not supported, always fall back to SW";

case RSA_HW_VALIDATION_ACTIVE:
return "Hardware acceleration will call into SW to validate result";

default:
return "unknown error number";

Expand Down
9 changes: 7 additions & 2 deletions wolfssl/wolfcrypt/error-crypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,13 @@ enum {
SM4_GCM_AUTH_E = -298, /* SM4-GCM Authentication check failure */
SM4_CCM_AUTH_E = -299, /* SM4-CCM Authentication check failure */

WC_LAST_E = -299, /* Update this to indicate last error */
MIN_CODE_E = -300 /* errors -101 - -299 */
RSA_HW_ERROR = -300, /* hardware math error */
RSA_HW_BUSY = -301, /* hardware math busy, may fall back to SW */
RSA_HW_FALLBACK = -302, /* signal to caller to fall back to SW */
RSA_HW_VALIDATION_ACTIVE = -303, /* optional debug HW validation active */

WC_LAST_E = -303, /* Update this to indicate last error */
MIN_CODE_E = -303 /* errors -101 - -303 */

/* add new companion error id strings for any new error codes
wolfcrypt/src/error.c !!! */
Expand Down

0 comments on commit 70e9843

Please sign in to comment.