]> code.ossystems Code Review - openembedded-core.git/commitdiff
openssl: Add reproducibility fix
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 3 Jan 2022 14:20:12 +0000 (14:20 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 4 Jan 2022 23:13:32 +0000 (23:13 +0000)
When the date rolled from one year to another, it highlighted a reproducibility
issue in openssl. Patch a workaround for this to avoid autobuilder failures. Help
submitting upstream welcome.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-connectivity/openssl/openssl/reproducibility.patch [new file with mode: 0644]
meta/recipes-connectivity/openssl/openssl_3.0.1.bb

diff --git a/meta/recipes-connectivity/openssl/openssl/reproducibility.patch b/meta/recipes-connectivity/openssl/openssl/reproducibility.patch
new file mode 100644 (file)
index 0000000..8accbc9
--- /dev/null
@@ -0,0 +1,22 @@
+Using localtime() means the output can depend on the timezone of the build machine.
+Using gmtime() is safer. For complete reproducibility use SOURCE_DATE_EPOCH if set.
+
+Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
+Upstream-Status: Pending [should be suitable]
+
+Index: openssl-3.0.1/apps/progs.pl
+===================================================================
+--- openssl-3.0.1.orig/apps/progs.pl
++++ openssl-3.0.1/apps/progs.pl
+@@ -21,7 +21,10 @@ die "Unrecognised option, must be -C or
+ my %commands     = ();
+ my $cmdre        = qr/^\s*int\s+([a-z_][a-z0-9_]*)_main\(\s*int\s+argc\s*,/;
+ my $apps_openssl = shift @ARGV;
+-my $YEAR         = [localtime()]->[5] + 1900;
++my $YEAR         = [gmtime()]->[5] + 1900;
++if (defined($ENV{SOURCE_DATE_EPOCH}) && $ENV{SOURCE_DATE_EPOCH} !~ /\D/) {
++    $YEAR = [gmtime($ENV{SOURCE_DATE_EPOCH})]->[5] + 1900;
++}
+ # because the program apps/openssl has object files as sources, and
+ # they then have the corresponding C files as source, we need to chain
index 162435480c4775056a46e7713dd0bba8a9c7ef1c..7727ec43e87d97d2f1bef8dfcf6e60bb6ff7f18b 100644 (file)
@@ -12,6 +12,7 @@ SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
            file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \
            file://afalg.patch \
            file://0001-Configure-do-not-tweak-mips-cflags.patch \
+           file://reproducibility.patch \
            "
 
 SRC_URI:append:class-nativesdk = " \