@@ -305,13 +305,14 @@ def generate_libwolfssl(fips):
305305
306306def get_features (local_wolfssl , features ):
307307 fips = False
308+ fips_file = None
308309
309- if sys .platform == "win32" :
310+ if local_wolfssl and sys .platform == "win32" :
310311 # On Windows, we assume the local_wolfssl path is to a wolfSSL source
311312 # directory where the library has been built.
312313 fips_file = os .path .join (local_wolfssl , "wolfssl" , "wolfcrypt" ,
313314 "fips.h" )
314- else :
315+ elif local_wolfssl :
315316 # On non-Windows platforms, first assume local_wolfssl is an
316317 # installation directory with an include subdirectory.
317318 fips_file = os .path .join (local_wolfssl , "include" , "wolfssl" ,
@@ -321,7 +322,7 @@ def get_features(local_wolfssl, features):
321322 fips_file = os .path .join (local_wolfssl , "wolfssl" , "wolfcrypt" ,
322323 "fips.h" )
323324
324- if os .path .exists (fips_file ):
325+ if fips_file and os .path .exists (fips_file ):
325326 with open (fips_file , "r" ) as f :
326327 contents = f .read ()
327328 if not contents .isspace ():
@@ -617,10 +618,10 @@ def build_ffi(local_wolfssl, features):
617618 int wc_Sha3_256_Final(wc_Sha3*, byte*);
618619 int wc_Sha3_384_Final(wc_Sha3*, byte*);
619620 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*);
621+ void wc_Sha3_224_Free(wc_Sha3*);
622+ void wc_Sha3_256_Free(wc_Sha3*);
623+ void wc_Sha3_384_Free(wc_Sha3*);
624+ void wc_Sha3_512_Free(wc_Sha3*);
624625 """
625626
626627 if features ["DES3" ]:
@@ -1106,17 +1107,17 @@ def main(ffibuilder):
11061107 e = "Local wolfssl installation path {} doesn't exist." .format (local_wolfssl )
11071108 raise FileNotFoundError (e )
11081109
1109- get_features (local_wolfssl , features )
1110-
1111- if features ["RSA_BLINDING" ] and features ["FIPS" ]:
1112- # These settings can't coexist. See settings.h.
1113- features ["RSA_BLINDING" ] = 0
1114-
11151110 if not local_wolfssl :
11161111 print ("Building wolfSSL..." )
11171112 if not get_libwolfssl ():
11181113 generate_libwolfssl (features ["FIPS" ])
11191114
1115+ get_features (local_wolfssl , features )
1116+
1117+ if features ["RSA_BLINDING" ] and features ["FIPS" ]:
1118+ # These settings can't coexist. See settings.h.
1119+ features ["RSA_BLINDING" ] = 0
1120+
11201121 build_ffi (local_wolfssl , features )
11211122
11221123
0 commit comments