diff options
author | Jack Lloyd <[email protected]> | 2019-06-03 10:49:00 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-06-03 10:49:00 -0400 |
commit | 450d5c2bc92663af1ce249a90bdc0f5c5c965a77 (patch) | |
tree | d82c8c5a04421e9d7deb3f9ec0c1693b39f299e2 /src | |
parent | aed46aad14b793ca04309d053dc55bb77411c089 (diff) |
Address some issues found by LGTM
Diffstat (limited to 'src')
-rwxr-xr-x | src/scripts/comba.py | 7 | ||||
-rwxr-xr-x | src/scripts/dist.py | 1 | ||||
-rwxr-xr-x | src/scripts/ffi_decls.py | 2 | ||||
-rwxr-xr-x | src/scripts/monty.py | 7 | ||||
-rwxr-xr-x | src/scripts/run_tls_fuzzer.py | 1 | ||||
-rwxr-xr-x | src/scripts/tls_suite_info.py | 9 |
6 files changed, 16 insertions, 11 deletions
diff --git a/src/scripts/comba.py b/src/scripts/comba.py index b018b724c..711d1a950 100755 --- a/src/scripts/comba.py +++ b/src/scripts/comba.py @@ -80,6 +80,11 @@ def main(args = None): if args is None: args = sys.argv + if len(args) <= 1: + sizes = [4, 6, 8, 9, 16, 24] + else: + sizes = map(int, args[1:]) + print("""/* * Comba Multiplication and Squaring * @@ -94,7 +99,7 @@ def main(args = None): namespace Botan { """ % (sys.argv[0], datetime.date.today().strftime("%Y-%m-%d"))) - for n in [4,6,8,9,16,24]: + for n in sizes: print("/*\n* Comba %dx%d Squaring\n*/" % (n, n)) print("void bigint_comba_sqr%d(word z[%d], const word x[%d])" % (n, 2*n, n)) print(" {") diff --git a/src/scripts/dist.py b/src/scripts/dist.py index ae894a74d..2de825adf 100755 --- a/src/scripts/dist.py +++ b/src/scripts/dist.py @@ -333,7 +333,6 @@ def main(args=None): (major, minor, patch) = [int(x) for x in target_version.split('.')] assert target_version == '%d.%d.%d' % (major, minor, patch) - target_version = target_version except ValueError as e: logging.error('Invalid version number %s' % (target_version)) diff --git a/src/scripts/ffi_decls.py b/src/scripts/ffi_decls.py index e4dbcefcc..b336e61f5 100755 --- a/src/scripts/ffi_decls.py +++ b/src/scripts/ffi_decls.py @@ -8,7 +8,7 @@ Automatically generate declarations for the FFI layer Botan is released under the Simplified BSD License (see license.txt) """ -from pycparser import c_parser, c_ast, parse_file +from pycparser import c_ast, parse_file ffi_header = 'src/lib/ffi/ffi.h' diff --git a/src/scripts/monty.py b/src/scripts/monty.py index e63442824..d3e9b5cb3 100755 --- a/src/scripts/monty.py +++ b/src/scripts/monty.py @@ -60,6 +60,11 @@ def main(args = None): if args is None: args = sys.argv + if len(args) <= 1: + sizes = [4, 6, 8, 16, 24, 32] + else: + sizes = map(int, args[1:]) + print("""/* * This file was automatically generated by %s on %s * All manual changes will be lost. Edit the script instead. @@ -75,7 +80,7 @@ def main(args = None): namespace Botan { """ % (sys.argv[0], datetime.date.today().strftime("%Y-%m-%d"))) - for n in [4, 6, 8, 16, 24, 32]: + for n in sizes: print("void bigint_monty_redc_%d(word z[], const word p[%d], word p_dash, word ws[])" % (n, n)) print(" {") diff --git a/src/scripts/run_tls_fuzzer.py b/src/scripts/run_tls_fuzzer.py index 4754480a6..b4ee91d24 100755 --- a/src/scripts/run_tls_fuzzer.py +++ b/src/scripts/run_tls_fuzzer.py @@ -92,6 +92,7 @@ def main(args = None): else: print("FAIL %s" % (script)) sys.stdout.flush() + return 0 if __name__ == '__main__': sys.exit(main()) diff --git a/src/scripts/tls_suite_info.py b/src/scripts/tls_suite_info.py index e19c24186..0a894e0bc 100755 --- a/src/scripts/tls_suite_info.py +++ b/src/scripts/tls_suite_info.py @@ -118,7 +118,6 @@ def to_ciphersuite_info(code, name): if cipher_algo in ['AES', 'Camellia', 'ARIA']: cipher_algo += '-%d' % (cipher_keylen*8) - modestr = '' mode = '' if cipher[0] == 'CHACHA20' and cipher[1] == 'POLY1305': @@ -136,14 +135,9 @@ def to_ciphersuite_info(code, name): if mode == 'CBC': return (name, code, sig_algo, kex_algo, cipher_algo, cipher_keylen, mac_algo, mac_keylen[mac_algo], mac_algo, 'CBC_MODE') - elif mode == 'OCB': return (name, code, sig_algo, kex_algo, cipher_algo, cipher_keylen, "AEAD", 0, mac_algo, 'AEAD_XOR_12') - else: - iv_bytes_from_hs = 4 - iv_bytes_from_rec = 8 - return (name, code, sig_algo, kex_algo, cipher_algo, cipher_keylen, "AEAD", 0, mac_algo, 'AEAD_IMPLICIT_4') def open_input(args): @@ -214,7 +208,6 @@ def main(args = None): ciphersuite_re = re.compile(' +0x([0-9a-fA-F][0-9a-fA-F]),0x([0-9a-fA-F][0-9a-fA-F]) + TLS_([A-Za-z_0-9]+) ') suites = {} - suite_codes = {} contents = '' @@ -343,5 +336,7 @@ const std::vector<Ciphersuite>& Ciphersuite::all_known_ciphersuites() out.write(suite_info) out.close() + return 0 + if __name__ == '__main__': sys.exit(main()) |