Skip to content

Commit 3f5ef24

Browse files
committed
bpo-40479: Test with latest OpenSSL versions
* 1.0.2u (EOL) * 1.1.0l (EOL) * 1.1.1g * 3.0.0-alpha2 Build the FIPS provider and create a FIPS configuration file for OpenSSL 3.0.0. Signed-off-by: Christian Heimes <[email protected]>
1 parent 16d4e6f commit 3f5ef24

File tree

2 files changed

+60
-3
lines changed

2 files changed

+60
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Update multissltest helper to test with latest OpenSSL 1.0.2, 1.1.0, 1.1.1,
2+
and 3.0.0-alpha.

Tools/ssl/multissltests.py

+58-3
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@
4141
log = logging.getLogger("multissl")
4242

4343
OPENSSL_OLD_VERSIONS = [
44-
"1.0.2",
4544
]
4645

4746
OPENSSL_RECENT_VERSIONS = [
48-
"1.0.2t",
47+
"1.0.2u",
4948
"1.1.0l",
50-
"1.1.1f",
49+
"1.1.1g",
50+
# "3.0.0-alpha2"
5151
]
5252

5353
LIBRESSL_OLD_VERSIONS = [
@@ -143,6 +143,23 @@
143143
help="Keep original sources for debugging."
144144
)
145145

146+
OPENSSL_FIPS_CNF = """\
147+
openssl_conf = openssl_init
148+
149+
.include {self.install_dir}/ssl/fipsinstall.cnf
150+
# .include {self.install_dir}/ssl/openssl.cnf
151+
152+
[openssl_init]
153+
providers = provider_sect
154+
155+
[provider_sect]
156+
fips = fips_sect
157+
default = default_sect
158+
159+
[default_sect]
160+
activate = 1
161+
"""
162+
146163

147164
class AbstractBuilder(object):
148165
library = None
@@ -291,9 +308,13 @@ def _make_install(self):
291308
["make", "-j1", self.install_target],
292309
cwd=self.build_dir
293310
)
311+
self._post_install()
294312
if not self.args.keep_sources:
295313
shutil.rmtree(self.build_dir)
296314

315+
def _post_install(self):
316+
pass
317+
297318
def install(self):
298319
log.info(self.openssl_cli)
299320
if not self.has_openssl or self.args.force:
@@ -365,6 +386,40 @@ class BuildOpenSSL(AbstractBuilder):
365386
# only install software, skip docs
366387
install_target = 'install_sw'
367388

389+
def _post_install(self):
390+
if self.version.startswith("3.0"):
391+
self._post_install_300()
392+
393+
def _post_install_300(self):
394+
# create ssl/ subdir with example configs
395+
self._subprocess_call(
396+
["make", "-j1", "install_ssldirs"],
397+
cwd=self.build_dir
398+
)
399+
# Install FIPS module
400+
# https://wiki.openssl.org/index.php/OpenSSL_3.0#Completing_the_installation_of_the_FIPS_Module
401+
fipsinstall_cnf = os.path.join(
402+
self.install_dir, "ssl", "fipsinstall.cnf"
403+
)
404+
openssl_fips_cnf = os.path.join(
405+
self.install_dir, "ssl", "openssl-fips.cnf"
406+
)
407+
fips_mod = os.path.join(self.lib_dir, "ossl-modules/fips.so")
408+
self._subprocess_call(
409+
[
410+
self.openssl_cli, "fipsinstall",
411+
"-out", fipsinstall_cnf,
412+
"-module", fips_mod,
413+
"-provider_name", "fips",
414+
"-mac_name", "HMAC",
415+
"-macopt", "digest:SHA256",
416+
"-macopt", "hexkey:00",
417+
"-section_name", "fips_sect"
418+
]
419+
)
420+
with open(openssl_fips_cnf, "w") as f:
421+
f.write(OPENSSL_FIPS_CNF.format(self=self))
422+
368423

369424
class BuildLibreSSL(AbstractBuilder):
370425
library = "LibreSSL"

0 commit comments

Comments
 (0)