@@ -304,13 +304,14 @@ def generate_libwolfssl(fips):
304304
305305def get_features (local_wolfssl , features ):
306306 fips = False
307+ fips_file = None
307308
308- if sys .platform == "win32" :
309+ if local_wolfssl and sys .platform == "win32" :
309310 # On Windows, we assume the local_wolfssl path is to a wolfSSL source
310311 # directory where the library has been built.
311312 fips_file = os .path .join (local_wolfssl , "wolfssl" , "wolfcrypt" ,
312313 "fips.h" )
313- else :
314+ elif local_wolfssl :
314315 # On non-Windows platforms, first assume local_wolfssl is an
315316 # installation directory with an include subdirectory.
316317 fips_file = os .path .join (local_wolfssl , "include" , "wolfssl" ,
@@ -320,7 +321,7 @@ def get_features(local_wolfssl, features):
320321 fips_file = os .path .join (local_wolfssl , "wolfssl" , "wolfcrypt" ,
321322 "fips.h" )
322323
323- if os .path .exists (fips_file ):
324+ if fips_file and os .path .exists (fips_file ):
324325 with open (fips_file , "r" ) as f :
325326 contents = f .read ()
326327 if not contents .isspace ():
@@ -618,10 +619,10 @@ def build_ffi(local_wolfssl, features):
618619 int wc_Sha3_256_Final(wc_Sha3*, byte*);
619620 int wc_Sha3_384_Final(wc_Sha3*, byte*);
620621 int wc_Sha3_512_Final(wc_Sha3*, byte*);
621- int wc_Sha3_224_Free(wc_Sha3*);
622- int wc_Sha3_256_Free(wc_Sha3*);
623- int wc_Sha3_384_Free(wc_Sha3*);
624- int wc_Sha3_512_Free(wc_Sha3*);
622+ void wc_Sha3_224_Free(wc_Sha3*);
623+ void wc_Sha3_256_Free(wc_Sha3*);
624+ void wc_Sha3_384_Free(wc_Sha3*);
625+ void wc_Sha3_512_Free(wc_Sha3*);
625626 """
626627
627628 if features ["DES3" ]:
@@ -1107,17 +1108,17 @@ def main(ffibuilder):
11071108 e = "Local wolfssl installation path {} doesn't exist." .format (local_wolfssl )
11081109 raise FileNotFoundError (e )
11091110
1110- get_features (local_wolfssl , features )
1111-
1112- if features ["RSA_BLINDING" ] and features ["FIPS" ]:
1113- # These settings can't coexist. See settings.h.
1114- features ["RSA_BLINDING" ] = 0
1115-
11161111 if not local_wolfssl :
11171112 print ("Building wolfSSL..." )
11181113 if not get_libwolfssl ():
11191114 generate_libwolfssl (features ["FIPS" ])
11201115
1116+ get_features (local_wolfssl , features )
1117+
1118+ if features ["RSA_BLINDING" ] and features ["FIPS" ]:
1119+ # These settings can't coexist. See settings.h.
1120+ features ["RSA_BLINDING" ] = 0
1121+
11211122 build_ffi (local_wolfssl , features )
11221123
11231124
0 commit comments