@@ -101,10 +101,10 @@ def wolfssl_lib_dir(local_wolfssl=None, fips=False):
101101 return lib_dir
102102
103103def call (cmd ):
104- print ("Calling: '{}' from working directory {}" . format ( cmd , os .getcwd ()) )
104+ print (f "Calling: '{ cmd } ' from working directory { os .getcwd ()} " )
105105
106106 old_env = os .environ ["PATH" ]
107- os .environ ["PATH" ] = "{ }:{}" . format ( WOLFSSL_SRC_PATH , old_env )
107+ os .environ ["PATH" ] = f" { WOLFSSL_SRC_PATH } :{ old_env } "
108108 subprocess .check_call (cmd , shell = True , env = os .environ )
109109 os .environ ["PATH" ] = old_env
110110
@@ -133,7 +133,7 @@ def checkout_version(version):
133133 current = subprocess .check_output (
134134 ["git" , "describe" , "--all" , "--exact-match" ]
135135 ).strip ().decode ().split ('/' )[- 1 ]
136- except :
136+ except subprocess . CalledProcessError :
137137 pass
138138
139139 if current != version :
@@ -142,9 +142,9 @@ def checkout_version(version):
142142 ).strip ().decode ().split ("\n " )
143143
144144 if version != "master" and version not in tags :
145- call ("git fetch --depth=1 origin tag {}" . format ( version ) )
145+ call (f "git fetch --depth=1 origin tag { version } " )
146146
147- call ("git checkout --force {}" . format ( version ) )
147+ call (f "git checkout --force { version } " )
148148
149149 return True # rebuild needed
150150
@@ -171,7 +171,7 @@ def make_flags(prefix, fips):
171171 """
172172 if sys .platform == "win32" :
173173 flags = []
174- flags .append ("-DCMAKE_INSTALL_PREFIX={}" . format ( prefix ) )
174+ flags .append (f "-DCMAKE_INSTALL_PREFIX={ prefix } " )
175175 flags .append ("-DWOLFSSL_CRYPT_TESTS=no" )
176176 flags .append ("-DWOLFSSL_EXAMPLES=no" )
177177 flags .append ("-DBUILD_SHARED_LIBS=no" )
@@ -188,7 +188,7 @@ def make_flags(prefix, fips):
188188 flags .append ("CFLAGS=-fPIC" )
189189
190190 # install location
191- flags .append ("--prefix={}" . format ( prefix ) )
191+ flags .append (f "--prefix={ prefix } " )
192192
193193 # crypt only, lib only
194194 flags .append ("--enable-cryptonly" )
@@ -261,7 +261,7 @@ def make(configure_flags, fips=False):
261261 raise Exception ("Cannot build wolfSSL FIPS from git repo." )
262262
263263 with chdir (build_path ):
264- call ("cmake {} .." . format ( configure_flags ) )
264+ call (f "cmake { configure_flags } .." )
265265 call ("cmake --build . --config Release" )
266266 call ("cmake --install . --config Release" )
267267 else :
@@ -274,7 +274,7 @@ def make(configure_flags, fips=False):
274274 call ("libtoolize" )
275275 call ("./autogen.sh" )
276276
277- call ("./configure {}" . format ( configure_flags ) )
277+ call (f "./configure { configure_flags } " )
278278 call ("make" )
279279 call ("make install" )
280280
@@ -458,45 +458,45 @@ def build_ffi(local_wolfssl, features):
458458 #include <wolfssl/wolfcrypt/dilithium.h>
459459 """
460460
461- init_source_string = """
461+ init_source_string = f """
462462 #ifdef __cplusplus
463- extern "C" {
463+ extern "C" {{
464464 #endif
465- """ + includes_string + """
465+ { includes_string }
466466 #ifdef __cplusplus
467- }
467+ }}
468468 #endif
469469
470- int ERROR_STRINGS_ENABLED = """ + str ( features ["ERROR_STRINGS" ]) + """ ;
471- int MPAPI_ENABLED = """ + str ( features ["MPAPI" ]) + """ ;
472- int SHA_ENABLED = """ + str ( features ["SHA" ]) + """ ;
473- int SHA256_ENABLED = """ + str ( features ["SHA256" ]) + """ ;
474- int SHA384_ENABLED = """ + str ( features ["SHA384" ]) + """ ;
475- int SHA512_ENABLED = """ + str ( features ["SHA512" ]) + """ ;
476- int SHA3_ENABLED = """ + str ( features ["SHA3" ]) + """ ;
477- int DES3_ENABLED = """ + str ( features ["DES3" ]) + """ ;
478- int AES_ENABLED = """ + str ( features ["AES" ]) + """ ;
479- int AES_SIV_ENABLED = """ + str ( features ["AES_SIV" ]) + """ ;
480- int CHACHA_ENABLED = """ + str ( features ["CHACHA" ]) + """ ;
481- int HMAC_ENABLED = """ + str ( features ["HMAC" ]) + """ ;
482- int RSA_ENABLED = """ + str ( features ["RSA" ]) + """ ;
483- int RSA_BLINDING_ENABLED = """ + str ( features ["RSA_BLINDING" ]) + """ ;
484- int ECC_TIMING_RESISTANCE_ENABLED = """ + str ( features ["ECC_TIMING_RESISTANCE" ]) + """ ;
485- int ECC_ENABLED = """ + str ( features ["ECC" ]) + """ ;
486- int ED25519_ENABLED = """ + str ( features ["ED25519" ]) + """ ;
487- int ED448_ENABLED = """ + str ( features ["ED448" ]) + """ ;
488- int KEYGEN_ENABLED = """ + str ( features ["KEYGEN" ]) + """ ;
489- int PWDBASED_ENABLED = """ + str ( features ["PWDBASED" ]) + """ ;
490- int FIPS_ENABLED = """ + str ( features ["FIPS" ]) + """ ;
491- int FIPS_VERSION = """ + str ( features ["FIPS_VERSION" ]) + """ ;
492- int ASN_ENABLED = """ + str ( features ["ASN" ]) + """ ;
493- int WC_RNG_SEED_CB_ENABLED = """ + str ( features ["WC_RNG_SEED_CB" ]) + """ ;
494- int AESGCM_STREAM_ENABLED = """ + str ( features ["AESGCM_STREAM" ]) + """ ;
495- int RSA_PSS_ENABLED = """ + str ( features ["RSA_PSS" ]) + """ ;
496- int CHACHA20_POLY1305_ENABLED = """ + str ( features ["CHACHA20_POLY1305" ]) + """ ;
497- int ML_KEM_ENABLED = """ + str ( features ["ML_KEM" ]) + """ ;
498- int ML_DSA_ENABLED = """ + str ( features ["ML_DSA" ]) + """ ;
499- int HKDF_ENABLED = """ + str ( features ["HKDF" ]) + """ ;
470+ int ERROR_STRINGS_ENABLED = { features ["ERROR_STRINGS" ]} ;
471+ int MPAPI_ENABLED = { features ["MPAPI" ]} ;
472+ int SHA_ENABLED = { features ["SHA" ]} ;
473+ int SHA256_ENABLED = { features ["SHA256" ]} ;
474+ int SHA384_ENABLED = { features ["SHA384" ]} ;
475+ int SHA512_ENABLED = { features ["SHA512" ]} ;
476+ int SHA3_ENABLED = { features ["SHA3" ]} ;
477+ int DES3_ENABLED = { features ["DES3" ]} ;
478+ int AES_ENABLED = { features ["AES" ]} ;
479+ int AES_SIV_ENABLED = { features ["AES_SIV" ]} ;
480+ int CHACHA_ENABLED = { features ["CHACHA" ]} ;
481+ int HMAC_ENABLED = { features ["HMAC" ]} ;
482+ int RSA_ENABLED = { features ["RSA" ]} ;
483+ int RSA_BLINDING_ENABLED = { features ["RSA_BLINDING" ]} ;
484+ int ECC_TIMING_RESISTANCE_ENABLED = { features ["ECC_TIMING_RESISTANCE" ]} ;
485+ int ECC_ENABLED = { features ["ECC" ]} ;
486+ int ED25519_ENABLED = { features ["ED25519" ]} ;
487+ int ED448_ENABLED = { features ["ED448" ]} ;
488+ int KEYGEN_ENABLED = { features ["KEYGEN" ]} ;
489+ int PWDBASED_ENABLED = { features ["PWDBASED" ]} ;
490+ int FIPS_ENABLED = { features ["FIPS" ]} ;
491+ int FIPS_VERSION = { features ["FIPS_VERSION" ]} ;
492+ int ASN_ENABLED = { features ["ASN" ]} ;
493+ int WC_RNG_SEED_CB_ENABLED = { features ["WC_RNG_SEED_CB" ]} ;
494+ int AESGCM_STREAM_ENABLED = { features ["AESGCM_STREAM" ]} ;
495+ int RSA_PSS_ENABLED = { features ["RSA_PSS" ]} ;
496+ int CHACHA20_POLY1305_ENABLED = { features ["CHACHA20_POLY1305" ]} ;
497+ int ML_KEM_ENABLED = { features ["ML_KEM" ]} ;
498+ int ML_DSA_ENABLED = { features ["ML_DSA" ]} ;
499+ int HKDF_ENABLED = { features ["HKDF" ]} ;
500500 """
501501
502502 ffibuilder .set_source ( "wolfcrypt._ffi" , init_source_string ,
@@ -1306,6 +1306,7 @@ def build_ffi(local_wolfssl, features):
13061306
13071307 if features ["ML_DSA" ]:
13081308 cdef += """
1309+ static const int DILITHIUM_SEED_SZ;
13091310 static const int WC_ML_DSA_44;
13101311 static const int WC_ML_DSA_65;
13111312 static const int WC_ML_DSA_87;
@@ -1375,9 +1376,9 @@ def main(ffibuilder):
13751376
13761377 local_wolfssl = os .environ .get ("USE_LOCAL_WOLFSSL" )
13771378 if local_wolfssl :
1378- print ("Using local wolfSSL at {}." . format ( local_wolfssl ) )
1379+ print (f "Using local wolfSSL at { local_wolfssl } ." )
13791380 if not os .path .exists (local_wolfssl ):
1380- e = "Local wolfssl installation path {} doesn't exist." . format ( local_wolfssl )
1381+ e = f "Local wolfssl installation path { local_wolfssl } doesn't exist."
13811382 raise FileNotFoundError (e )
13821383
13831384 if not local_wolfssl :
0 commit comments