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