11#!./python
2- """Run Python tests against multiple installations of OpenSSL and LibreSSL
2+ """Run Python tests against multiple installations of cryptography libraries
33
44The script
55
6- (1) downloads OpenSSL / LibreSSL tar bundle
6+ (1) downloads the tar bundle
77 (2) extracts it to ./src
8- (3) compiles OpenSSL / LibreSSL
9- (4) installs OpenSSL / LibreSSL into ../multissl/$LIB/$VERSION/
8+ (3) compiles the relevant library
9+ (4) installs that library into ../multissl/$LIB/$VERSION/
1010 (5) forces a recompilation of Python modules using the
1111 header and library files from ../multissl/$LIB/$VERSION/
1212 (6) runs Python's test suite
6161LIBRESSL_RECENT_VERSIONS = [
6262]
6363
64+ AWSLC_RECENT_VERSIONS = [
65+ "1.55.0" ,
66+ ]
67+
6468# store files in ../multissl
6569HERE = os .path .dirname (os .path .abspath (__file__ ))
6670PYTHONROOT = os .path .abspath (os .path .join (HERE , '..' , '..' ))
7074parser = argparse .ArgumentParser (
7175 prog = 'multissl' ,
7276 description = (
73- "Run CPython tests with multiple OpenSSL and LibreSSL "
77+ "Run CPython tests with multiple cryptography libraries "
7478 "versions."
75- )
79+ ),
7680)
7781parser .add_argument (
7882 '--debug' ,
102106 "OpenSSL and LibreSSL versions are given."
103107 ).format (LIBRESSL_RECENT_VERSIONS , LIBRESSL_OLD_VERSIONS )
104108)
109+ parser .add_argument (
110+ '--awslc' ,
111+ nargs = '+' ,
112+ default = (),
113+ help = (
114+ "AWS-LC versions, defaults to '{}' if no crypto library versions are given."
115+ ).format (AWSLC_RECENT_VERSIONS )
116+ )
105117parser .add_argument (
106118 '--tests' ,
107119 nargs = '*' ,
111123parser .add_argument (
112124 '--base-directory' ,
113125 default = MULTISSL_DIR ,
114- help = "Base directory for OpenSSL / LibreSSL sources and builds."
126+ help = "Base directory for crypto library sources and builds."
115127)
116128parser .add_argument (
117129 '--no-network' ,
124136 choices = ['library' , 'modules' , 'tests' ],
125137 default = 'tests' ,
126138 help = (
127- "Which steps to perform. 'library' downloads and compiles OpenSSL "
128- "or LibreSSL . 'module' also compiles Python modules. 'tests' builds "
139+ "Which steps to perform. 'library' downloads and compiles a crypto "
140+ "library . 'module' also compiles Python modules. 'tests' builds "
129141 "all and runs the test suite."
130142 )
131143)
@@ -453,6 +465,34 @@ class BuildLibreSSL(AbstractBuilder):
453465 build_template = "libressl-{}"
454466
455467
468+ class BuildAWSLC (AbstractBuilder ):
469+ library = "AWS-LC"
470+ url_templates = (
471+ "https://github.com/aws/aws-lc/archive/refs/tags/v{v}.tar.gz" ,
472+ )
473+ src_template = "aws-lc-{}.tar.gz"
474+ build_template = "aws-lc-{}"
475+
476+ def _build_src (self , config_args = ()):
477+ cwd = self .build_dir
478+ log .info ("Running build in {}" .format (cwd ))
479+ env = os .environ .copy ()
480+ env ["LD_RUN_PATH" ] = self .lib_dir # set rpath
481+ if self .system :
482+ env ['SYSTEM' ] = self .system
483+ cmd = [
484+ "cmake" ,
485+ "-DCMAKE_BUILD_TYPE=RelWithDebInfo" ,
486+ "-DCMAKE_PREFIX_PATH={}" .format (self .install_dir ),
487+ "-DCMAKE_INSTALL_PREFIX={}" .format (self .install_dir ),
488+ "-DBUILD_SHARED_LIBS=ON" ,
489+ "-DBUILD_TESTING=OFF" ,
490+ "-DFIPS=OFF" ,
491+ ]
492+ self ._subprocess_call (cmd , cwd = cwd , env = env )
493+ self ._subprocess_call (["make" , "-j{}" .format (self .jobs )], cwd = cwd , env = env )
494+
495+
456496def configure_make ():
457497 if not os .path .isfile ('Makefile' ):
458498 log .info ('Running ./configure' )
@@ -467,9 +507,10 @@ def configure_make():
467507
468508def main ():
469509 args = parser .parse_args ()
470- if not args .openssl and not args .libressl :
510+ if not args .openssl and not args .libressl and not args . awslc :
471511 args .openssl = list (OPENSSL_RECENT_VERSIONS )
472512 args .libressl = list (LIBRESSL_RECENT_VERSIONS )
513+ args .awslc = list (AWSLC_RECENT_VERSIONS )
473514 if not args .disable_ancient :
474515 args .openssl .extend (OPENSSL_OLD_VERSIONS )
475516 args .libressl .extend (LIBRESSL_OLD_VERSIONS )
@@ -496,22 +537,15 @@ def main():
496537
497538 # download and register builder
498539 builds = []
499-
500- for version in args .openssl :
501- build = BuildOpenSSL (
502- version ,
503- args
504- )
505- build .install ()
506- builds .append (build )
507-
508- for version in args .libressl :
509- build = BuildLibreSSL (
510- version ,
511- args
512- )
513- build .install ()
514- builds .append (build )
540+ for build_class , versions in [
541+ (BuildOpenSSL , args .openssl ),
542+ (BuildLibreSSL , args .libressl ),
543+ (BuildAWSLC , args .awslc ),
544+ ]:
545+ for version in versions :
546+ build = build_class (version , args )
547+ build .install ()
548+ builds .append (build )
515549
516550 if args .steps in {'modules' , 'tests' }:
517551 for build in builds :
@@ -539,7 +573,7 @@ def main():
539573 else :
540574 print ('Executed all SSL tests.' )
541575
542- print ('OpenSSL / LibreSSL versions:' )
576+ print ('OpenSSL / LibreSSL / AWS-LC versions:' )
543577 for build in builds :
544578 print (" * {0.library} {0.version}" .format (build ))
545579
0 commit comments