@@ -496,6 +496,7 @@ def build_ffi(local_wolfssl, features):
496496 int ML_KEM_ENABLED = """ + str (features ["ML_KEM" ]) + """;
497497 int ML_DSA_ENABLED = """ + str (features ["ML_DSA" ]) + """;
498498 int HKDF_ENABLED = """ + str (features ["HKDF" ]) + """;
499+ int ERROR_STRINGS_ENABLED = """ + str (features ["ERROR_STRINGS" ]) + """;
499500 """
500501
501502 ffibuilder .set_source ( "wolfcrypt._ffi" , init_source_string ,
@@ -535,6 +536,7 @@ def build_ffi(local_wolfssl, features):
535536 extern int ML_KEM_ENABLED;
536537 extern int ML_DSA_ENABLED;
537538 extern int HKDF_ENABLED;
539+ extern int ERROR_STRINGS_ENABLED;
538540
539541 typedef unsigned char byte;
540542 typedef unsigned int word32;
@@ -558,6 +560,7 @@ def build_ffi(local_wolfssl, features):
558560 typedef struct { ...; } mp_int;
559561
560562 int mp_init (mp_int * a);
563+ void mp_clear (mp_int * a);
561564 int mp_to_unsigned_bin (mp_int * a, unsigned char *b);
562565 int mp_to_unsigned_bin_len (mp_int * a, unsigned char *b, int c);
563566 int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c);
@@ -569,6 +572,7 @@ def build_ffi(local_wolfssl, features):
569572 int wc_InitSha(wc_Sha*);
570573 int wc_ShaUpdate(wc_Sha*, const byte*, word32);
571574 int wc_ShaFinal(wc_Sha*, byte*);
575+ void wc_ShaFree(wc_Sha*);
572576 """
573577
574578 if features ["SHA256" ]:
@@ -577,6 +581,7 @@ def build_ffi(local_wolfssl, features):
577581 int wc_InitSha256(wc_Sha256*);
578582 int wc_Sha256Update(wc_Sha256*, const byte*, word32);
579583 int wc_Sha256Final(wc_Sha256*, byte*);
584+ void wc_Sha256Free(wc_Sha256*);
580585 """
581586
582587 if features ["SHA384" ]:
@@ -585,6 +590,7 @@ def build_ffi(local_wolfssl, features):
585590 int wc_InitSha384(wc_Sha384*);
586591 int wc_Sha384Update(wc_Sha384*, const byte*, word32);
587592 int wc_Sha384Final(wc_Sha384*, byte*);
593+ void wc_Sha384Free(wc_Sha384*);
588594 """
589595
590596 if features ["SHA512" ]:
@@ -594,6 +600,7 @@ def build_ffi(local_wolfssl, features):
594600 int wc_InitSha512(wc_Sha512*);
595601 int wc_Sha512Update(wc_Sha512*, const byte*, word32);
596602 int wc_Sha512Final(wc_Sha512*, byte*);
603+ void wc_Sha512Free(wc_Sha512*);
597604 """
598605 if features ["SHA3" ]:
599606 cdef += """
@@ -610,6 +617,10 @@ def build_ffi(local_wolfssl, features):
610617 int wc_Sha3_256_Final(wc_Sha3*, byte*);
611618 int wc_Sha3_384_Final(wc_Sha3*, byte*);
612619 int wc_Sha3_512_Final(wc_Sha3*, byte*);
620+ int wc_Sha3_224_Free(wc_Sha3*);
621+ int wc_Sha3_256_Free(wc_Sha3*);
622+ int wc_Sha3_384_Free(wc_Sha3*);
623+ int wc_Sha3_512_Free(wc_Sha3*);
613624 """
614625
615626 if features ["DES3" ]:
@@ -706,6 +717,7 @@ def build_ffi(local_wolfssl, features):
706717 int wc_HmacSetKey(Hmac*, int, const byte*, word32);
707718 int wc_HmacUpdate(Hmac*, const byte*, word32);
708719 int wc_HmacFinal(Hmac*, byte*);
720+ void wc_HmacFree(Hmac*);
709721 """
710722
711723 if features ["RSA" ]:
@@ -990,6 +1002,11 @@ def build_ffi(local_wolfssl, features):
9901002 int wolfCrypt_GetPrivateKeyReadEnable_fips(enum wc_KeyType);
9911003 """
9921004
1005+ if features ["ERROR_STRINGS" ]:
1006+ cdef += """
1007+ const char* wc_GetErrorString(int error);
1008+ """
1009+
9931010 if features ["ML_KEM" ] or features ["ML_DSA" ]:
9941011 cdef += """
9951012 static const int INVALID_DEVID;
0 commit comments