Skip to content

Commit 7e161dc

Browse files
miss-islingtonmcepl
authored andcommitted
OpenSSL 3.0.0: Test with latest OpenSSL versions
* 1.0.2u (EOL) * 1.1.0l (EOL) * 1.1.1g * 3.0.0-alpha2 (disabled for now) Build the FIPS provider and create a FIPS configuration file for OpenSSL 3.0.0. (cherry picked from commit gh#python/cpython@5e6b491) Fixes: bpo-40479 From-PR: gh#python/cpython!20108 Patch: openssl-300-test-with-latest-openssl.patch Released-in: 3.7.8 Signed-off-by: Christian Heimes <[email protected]>
1 parent 7aaaeeb commit 7e161dc

File tree

2 files changed

+61
-5
lines changed

2 files changed

+61
-5
lines changed
Lines changed: 2 additions & 0 deletions
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

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,13 @@
4343
OPENSSL_OLD_VERSIONS = [
4444
"0.9.8zh",
4545
"1.0.1u",
46-
"1.0.2",
4746
]
4847

4948
OPENSSL_RECENT_VERSIONS = [
50-
"1.0.2p",
51-
"1.1.0i",
52-
"1.1.1k",
53-
"3.0.3",
49+
"1.0.2u",
50+
"1.1.0l",
51+
"1.1.1g",
52+
# "3.0.0-alpha2"
5453
]
5554

5655
LIBRESSL_OLD_VERSIONS = [
@@ -148,6 +147,23 @@
148147
help="Keep original sources for debugging."
149148
)
150149

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

152168
class AbstractBuilder(object):
153169
library = None
@@ -296,9 +312,13 @@ def _make_install(self):
296312
["make", "-j1", self.install_target],
297313
cwd=self.build_dir
298314
)
315+
self._post_install()
299316
if not self.args.keep_sources:
300317
shutil.rmtree(self.build_dir)
301318

319+
def _post_install(self):
320+
pass
321+
302322
def install(self):
303323
log.info(self.openssl_cli)
304324
if not self.has_openssl or self.args.force:
@@ -370,6 +390,40 @@ class BuildOpenSSL(AbstractBuilder):
370390
# only install software, skip docs
371391
install_target = 'install_sw'
372392

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

374428
class BuildLibreSSL(AbstractBuilder):
375429
library = "LibreSSL"

0 commit comments

Comments
 (0)