@@ -242,7 +242,6 @@ def make_flags(prefix, fips):
242242 flags .append ("--disable-oldtls" )
243243 flags .append ("--disable-oldnames" )
244244 flags .append ("--disable-extended-master" )
245- flags .append ("--disable-errorstrings" )
246245
247246 return " " .join (flags )
248247
@@ -430,6 +429,7 @@ def build_ffi(local_wolfssl, features):
430429
431430 includes_string += """
432431 #include <wolfssl/wolfcrypt/settings.h>
432+ #include <wolfssl/wolfcrypt/error-crypt.h>
433433
434434 #include <wolfssl/wolfcrypt/sha.h>
435435 #include <wolfssl/wolfcrypt/sha256.h>
@@ -467,6 +467,7 @@ def build_ffi(local_wolfssl, features):
467467 }
468468 #endif
469469
470+ int ERROR_STRINGS_ENABLED = """ + str (features ["ERROR_STRINGS" ]) + """;
470471 int MPAPI_ENABLED = """ + str (features ["MPAPI" ]) + """;
471472 int SHA_ENABLED = """ + str (features ["SHA" ]) + """;
472473 int SHA256_ENABLED = """ + str (features ["SHA256" ]) + """;
@@ -507,6 +508,7 @@ def build_ffi(local_wolfssl, features):
507508 # TODO: change cdef to cdef.
508509 # cdef = ""
509510 cdef = """
511+ extern int ERROR_STRINGS_ENABLED;
510512 extern int MPAPI_ENABLED;
511513 extern int SHA_ENABLED;
512514 extern int SHA256_ENABLED;
@@ -552,6 +554,270 @@ def build_ffi(local_wolfssl, features):
552554 int wc_FreeRng(WC_RNG*);
553555 """
554556
557+ if features ["ERROR_STRINGS" ]:
558+ cdef += """
559+ static const int WC_FAILURE;
560+
561+ static const int MAX_CODE_E;
562+ static const int WC_FIRST_E;
563+
564+ static const int WC_SPAN1_FIRST_E;
565+
566+ static const int MP_MEM;
567+ static const int MP_VAL;
568+ static const int MP_WOULDBLOCK;
569+
570+ static const int MP_NOT_INF;
571+
572+ static const int OPEN_RAN_E;
573+ static const int READ_RAN_E;
574+ static const int WINCRYPT_E;
575+ static const int CRYPTGEN_E;
576+ static const int RAN_BLOCK_E;
577+ static const int BAD_MUTEX_E;
578+ static const int WC_TIMEOUT_E;
579+ static const int WC_PENDING_E;
580+ static const int WC_NO_PENDING_E;
581+
582+ static const int MP_INIT_E;
583+ static const int MP_READ_E;
584+ static const int MP_EXPTMOD_E;
585+ static const int MP_TO_E;
586+ static const int MP_SUB_E;
587+ static const int MP_ADD_E;
588+ static const int MP_MUL_E;
589+ static const int MP_MULMOD_E;
590+ static const int MP_MOD_E;
591+ static const int MP_INVMOD_E;
592+ static const int MP_CMP_E;
593+ static const int MP_ZERO_E;
594+
595+ static const int AES_EAX_AUTH_E;
596+ static const int KEY_EXHAUSTED_E;
597+ static const int MEMORY_E;
598+ static const int VAR_STATE_CHANGE_E;
599+ static const int FIPS_DEGRADED_E;
600+
601+ static const int FIPS_CODE_SZ_E;
602+ static const int FIPS_DATA_SZ_E;
603+
604+ static const int RSA_WRONG_TYPE_E;
605+ static const int RSA_BUFFER_E;
606+ static const int BUFFER_E;
607+ static const int ALGO_ID_E;
608+ static const int PUBLIC_KEY_E;
609+ static const int DATE_E;
610+ static const int SUBJECT_E;
611+ static const int ISSUER_E;
612+ static const int CA_TRUE_E;
613+ static const int EXTENSIONS_E;
614+
615+ static const int ASN_PARSE_E;
616+ static const int ASN_VERSION_E;
617+ static const int ASN_GETINT_E;
618+ static const int ASN_RSA_KEY_E;
619+ static const int ASN_OBJECT_ID_E;
620+ static const int ASN_TAG_NULL_E;
621+ static const int ASN_EXPECT_0_E;
622+ static const int ASN_BITSTR_E;
623+ static const int ASN_UNKNOWN_OID_E;
624+ static const int ASN_DATE_SZ_E;
625+ static const int ASN_BEFORE_DATE_E;
626+ static const int ASN_AFTER_DATE_E;
627+ static const int ASN_SIG_OID_E;
628+ static const int ASN_TIME_E;
629+ static const int ASN_INPUT_E;
630+ static const int ASN_SIG_CONFIRM_E;
631+ static const int ASN_SIG_HASH_E;
632+ static const int ASN_SIG_KEY_E;
633+ static const int ASN_DH_KEY_E;
634+ static const int KDF_SRTP_KAT_FIPS_E;
635+ static const int ASN_CRIT_EXT_E;
636+ static const int ASN_ALT_NAME_E;
637+ static const int ASN_NO_PEM_HEADER;
638+ static const int ED25519_KAT_FIPS_E;
639+ static const int ED448_KAT_FIPS_E;
640+ static const int PBKDF2_KAT_FIPS_E;
641+ static const int WC_KEY_MISMATCH_E;
642+
643+ static const int ECC_BAD_ARG_E;
644+ static const int ASN_ECC_KEY_E;
645+ static const int ECC_CURVE_OID_E;
646+ static const int BAD_FUNC_ARG;
647+ static const int NOT_COMPILED_IN;
648+ static const int UNICODE_SIZE_E;
649+ static const int NO_PASSWORD;
650+ static const int ALT_NAME_E;
651+ static const int BAD_OCSP_RESPONDER;
652+ static const int CRL_CERT_DATE_ERR;
653+
654+ static const int AES_GCM_AUTH_E;
655+ static const int AES_CCM_AUTH_E;
656+
657+ static const int ASYNC_INIT_E;
658+
659+ static const int COMPRESS_INIT_E;
660+ static const int COMPRESS_E;
661+ static const int DECOMPRESS_INIT_E;
662+ static const int DECOMPRESS_E;
663+
664+ static const int BAD_ALIGN_E;
665+ static const int ASN_NO_SIGNER_E;
666+ static const int ASN_CRL_CONFIRM_E;
667+ static const int ASN_CRL_NO_SIGNER_E;
668+ static const int ASN_OCSP_CONFIRM_E;
669+
670+ static const int BAD_STATE_E;
671+ static const int BAD_PADDING_E;
672+
673+ static const int REQ_ATTRIBUTE_E;
674+
675+ static const int PKCS7_OID_E;
676+ static const int PKCS7_RECIP_E;
677+ static const int FIPS_NOT_ALLOWED_E;
678+ static const int ASN_NAME_INVALID_E;
679+
680+ static const int RNG_FAILURE_E;
681+ static const int HMAC_MIN_KEYLEN_E;
682+ static const int RSA_PAD_E;
683+ static const int LENGTH_ONLY_E;
684+
685+ static const int IN_CORE_FIPS_E;
686+ static const int AES_KAT_FIPS_E;
687+ static const int DES3_KAT_FIPS_E;
688+ static const int HMAC_KAT_FIPS_E;
689+ static const int RSA_KAT_FIPS_E;
690+ static const int DRBG_KAT_FIPS_E;
691+ static const int DRBG_CONT_FIPS_E;
692+ static const int AESGCM_KAT_FIPS_E;
693+ static const int THREAD_STORE_KEY_E;
694+ static const int THREAD_STORE_SET_E;
695+
696+ static const int MAC_CMP_FAILED_E;
697+ static const int IS_POINT_E;
698+ static const int ECC_INF_E;
699+ static const int ECC_PRIV_KEY_E;
700+ static const int ECC_OUT_OF_RANGE_E;
701+
702+ static const int SRP_CALL_ORDER_E;
703+ static const int SRP_VERIFY_E;
704+ static const int SRP_BAD_KEY_E;
705+
706+ static const int ASN_NO_SKID;
707+ static const int ASN_NO_AKID;
708+ static const int ASN_NO_KEYUSAGE;
709+ static const int SKID_E;
710+ static const int AKID_E;
711+ static const int KEYUSAGE_E;
712+ static const int CERTPOLICIES_E;
713+
714+ static const int WC_INIT_E;
715+ static const int SIG_VERIFY_E;
716+ static const int BAD_COND_E;
717+ static const int SIG_TYPE_E;
718+ static const int HASH_TYPE_E;
719+
720+ static const int FIPS_INVALID_VER_E;
721+
722+ static const int WC_KEY_SIZE_E;
723+ static const int ASN_COUNTRY_SIZE_E;
724+ static const int MISSING_RNG_E;
725+ static const int ASN_PATHLEN_SIZE_E;
726+ static const int ASN_PATHLEN_INV_E;
727+
728+ static const int BAD_KEYWRAP_ALG_E;
729+ static const int BAD_KEYWRAP_IV_E;
730+ static const int WC_CLEANUP_E;
731+ static const int ECC_CDH_KAT_FIPS_E;
732+ static const int DH_CHECK_PUB_E;
733+ static const int BAD_PATH_ERROR;
734+
735+ static const int ASYNC_OP_E;
736+
737+ static const int ECC_PRIVATEONLY_E;
738+ static const int EXTKEYUSAGE_E;
739+ static const int WC_HW_E;
740+ static const int WC_HW_WAIT_E;
741+
742+ static const int PSS_SALTLEN_E;
743+ static const int PRIME_GEN_E;
744+ static const int BER_INDEF_E;
745+ static const int RSA_OUT_OF_RANGE_E;
746+ static const int RSAPSS_PAT_FIPS_E;
747+ static const int ECDSA_PAT_FIPS_E;
748+ static const int DH_KAT_FIPS_E;
749+ static const int AESCCM_KAT_FIPS_E;
750+ static const int SHA3_KAT_FIPS_E;
751+ static const int ECDHE_KAT_FIPS_E;
752+ static const int AES_GCM_OVERFLOW_E;
753+ static const int AES_CCM_OVERFLOW_E;
754+ static const int RSA_KEY_PAIR_E;
755+ static const int DH_CHECK_PRIV_E;
756+
757+ static const int WC_AFALG_SOCK_E;
758+ static const int WC_DEVCRYPTO_E;
759+
760+ static const int ZLIB_INIT_ERROR;
761+ static const int ZLIB_COMPRESS_ERROR;
762+ static const int ZLIB_DECOMPRESS_ERROR;
763+
764+ static const int PKCS7_NO_SIGNER_E;
765+ static const int WC_PKCS7_WANT_READ_E;
766+
767+ static const int CRYPTOCB_UNAVAILABLE;
768+ static const int PKCS7_SIGNEEDS_CHECK;
769+ static const int PSS_SALTLEN_RECOVER_E;
770+ static const int CHACHA_POLY_OVERFLOW;
771+ static const int ASN_SELF_SIGNED_E;
772+ static const int SAKKE_VERIFY_FAIL_E;
773+ static const int MISSING_IV;
774+ static const int MISSING_KEY;
775+ static const int BAD_LENGTH_E;
776+ static const int ECDSA_KAT_FIPS_E;
777+ static const int RSA_PAT_FIPS_E;
778+ static const int KDF_TLS12_KAT_FIPS_E;
779+ static const int KDF_TLS13_KAT_FIPS_E;
780+ static const int KDF_SSH_KAT_FIPS_E;
781+ static const int DHE_PCT_E;
782+ static const int ECC_PCT_E;
783+ static const int FIPS_PRIVATE_KEY_LOCKED_E;
784+ static const int PROTOCOLCB_UNAVAILABLE;
785+ static const int AES_SIV_AUTH_E;
786+ static const int NO_VALID_DEVID;
787+
788+ static const int IO_FAILED_E;
789+ static const int SYSLIB_FAILED_E;
790+ static const int USE_HW_PSK;
791+
792+ static const int ENTROPY_RT_E;
793+ static const int ENTROPY_APT_E;
794+
795+ static const int ASN_DEPTH_E;
796+ static const int ASN_LEN_E;
797+
798+ static const int SM4_GCM_AUTH_E;
799+ static const int SM4_CCM_AUTH_E;
800+
801+ static const int WC_SPAN1_LAST_E;
802+ static const int WC_SPAN1_MIN_CODE_E;
803+
804+ static const int WC_SPAN2_FIRST_E;
805+
806+ static const int DEADLOCK_AVERTED_E;
807+ static const int ASCON_AUTH_E;
808+ static const int WC_ACCEL_INHIBIT_E;
809+ static const int BAD_INDEX_E;
810+ static const int INTERRUPTED_E;
811+
812+ static const int WC_SPAN2_LAST_E;
813+ static const int WC_LAST_E;
814+
815+ static const int WC_SPAN2_MIN_CODE_E;
816+ static const int MIN_CODE_E;
817+
818+ const char* wc_GetErrorString(int error);
819+ """
820+
555821 if not features ["FIPS" ] or features ["FIPS_VERSION" ] > 2 :
556822 cdef += """
557823 int wc_GenerateSeed(OS_Seed* os, byte* seed, word32 sz);
0 commit comments