Date: Tuesday, November 1, 2022 @ 19:21:53
  Author: foutrelis
Revision: 459963

Fix build with OpenSSL 3.0 (-Wno-error= flag by logs)

Added:
  sbsigntools/trunk/openssl3.patch
Modified:
  sbsigntools/trunk/PKGBUILD

----------------+
 PKGBUILD       |    6 +++++-
 openssl3.patch |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 1 deletion(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2022-11-01 19:18:31 UTC (rev 459962)
+++ PKGBUILD    2022-11-01 19:21:53 UTC (rev 459963)
@@ -14,13 +14,16 @@
 makedepends=('git' 'gnu-efi' 'help2man' 'util-linux-libs')
 
source=("git+https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git#tag=v${pkgver}?signed";
         "git+https://git.ozlabs.org/ccan";
+        openssl3.patch
         )
 sha256sums=('SKIP'
-            'SKIP')
+            'SKIP'
+            '631336ec0687150c80aef32f296b50d322a5c461187c8456d89ae66f32a92718')
 validpgpkeys=('D5606E73C8B46271BEAD9ADF814AE47C214854D6') # James Bottomley 
<[email protected]>
 
 prepare() {
   cd ${pkgname}
+  patch -Np1 -i ../openssl3.patch
   git submodule init
   git config submodule."lib/ccan.git".url "${srcdir}/ccan"
   git -c protocol.file.allow=always submodule update
@@ -29,6 +32,7 @@
 
 build() {
   cd "${pkgname}"
+  CFLAGS+=' -Wno-error=deprecated-declarations'
   ./configure --prefix="/usr" \
               --bindir="/usr/bin" \
               --sbindir="/usr/bin" \

Added: openssl3.patch
===================================================================
--- openssl3.patch                              (rev 0)
+++ openssl3.patch      2022-11-01 19:21:53 UTC (rev 459963)
@@ -0,0 +1,35 @@
+Subject: [PATCH] Fix openssl-3.0 issue involving ASN1 xxx_it
+From: Jeremi Piotrowski <[email protected]>
+Origin: https://groups.io/g/sbsigntools/message/54
+
+Use ASN1_ITEM_rptr() instead of taking the address of IDC_PEID_it.
+
+openssl-3.0 changed the type of TYPE_it from `const ASN1_ITEM TYPE_it` to
+`const ASN1_ITEM *TYPE_it(void)`. This was previously hidden behind
+OPENSSL_EXPORT_VAR_AS_FUNCTION but in 3.0 only the function version is
+available. This change should have been transparent to the application, but
+only if the `ASN1_ITEM_rptr()` macro is used.
+
+This change passes `make check` with both openssl 1.1 and 3.0.
+
+Signed-off-by: Jeremi Piotrowski <[email protected]>
+---
+ src/idc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/idc.c b/src/idc.c
+index 6d87bd4..0a82218 100644
+--- a/src/idc.c
++++ b/src/idc.c
+@@ -189,7 +189,7 @@ int IDC_set(PKCS7 *p7, PKCS7_SIGNER_INFO *si, struct image 
*image)
+ 
+       idc->data->type = OBJ_nid2obj(peid_nid);
+       idc->data->value = ASN1_TYPE_new();
+-      type_set_sequence(image, idc->data->value, peid, &IDC_PEID_it);
++      type_set_sequence(image, idc->data->value, peid, 
ASN1_ITEM_rptr(IDC_PEID));
+ 
+         idc->digest->alg->parameter = ASN1_TYPE_new();
+         idc->digest->alg->algorithm = OBJ_nid2obj(NID_sha256);
+-- 
+2.25.1
+

Reply via email to