commit:     7aa42a239fc2409815cfed90acf5ef658b72f7c4
Author:     orbea <orbea <AT> riseup <DOT> net>
AuthorDate: Tue Nov 12 17:36:36 2024 +0000
Commit:     orbea <orbea <AT> riseup <DOT> net>
CommitDate: Tue Nov 12 17:36:36 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=7aa42a23

app-pda/libimobiledevice: add correct patch

Signed-off-by: orbea <orbea <AT> riseup.net>

 .../files/libimobiledevice-1.3.0-libressl.patch    | 12 ------
 ...libimobiledevice-1.3.0_p20240201_libressl.patch | 47 ++++++++++++++++++++++
 .../libimobiledevice-1.3.0_p20240201.ebuild        |  2 +-
 3 files changed, 48 insertions(+), 13 deletions(-)

diff --git 
a/app-pda/libimobiledevice/files/libimobiledevice-1.3.0-libressl.patch 
b/app-pda/libimobiledevice/files/libimobiledevice-1.3.0-libressl.patch
deleted file mode 100644
index 9f13402..0000000
--- a/app-pda/libimobiledevice/files/libimobiledevice-1.3.0-libressl.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/common/userpref.c
-+++ b/common/userpref.c
-@@ -627,7 +627,9 @@ userpref_error_t 
pair_record_generate_keys_and_certs(plist_t pair_record, key_da
-               }
-       }
- 
-+#ifndef LIBRESSL_VERSION_NUMBER
-       X509V3_EXT_cleanup();
-+#endif
-       X509_free(dev_cert);
- 
-       EVP_PKEY_free(pubkey);

diff --git 
a/app-pda/libimobiledevice/files/libimobiledevice-1.3.0_p20240201_libressl.patch
 
b/app-pda/libimobiledevice/files/libimobiledevice-1.3.0_p20240201_libressl.patch
new file mode 100644
index 0000000..33c8d77
--- /dev/null
+++ 
b/app-pda/libimobiledevice/files/libimobiledevice-1.3.0_p20240201_libressl.patch
@@ -0,0 +1,47 @@
+--- a/common/userpref.c
++++ b/common/userpref.c
+@@ -627,7 +627,9 @@ userpref_error_t 
pair_record_generate_keys_and_certs(plist_t pair_record, key_da
+               }
+       }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+       X509V3_EXT_cleanup();
++#endif
+       X509_free(dev_cert);
+ 
+       EVP_PKEY_free(pubkey);
+From 9d74aed599b4bb5f6c2fce042ab9630acaebb159 Mon Sep 17 00:00:00 2001
+From: orbea <[email protected]>
+Date: Tue, 23 Apr 2024 09:24:56 -0700
+Subject: [PATCH] libsrp6a-sha512: disable BN_mod_exp_mont_word() with LibreSSL
+
+When building libimobiledevice with LibreSSL 3.9 it fails with an
+implicit declaration for BN_mod_exp_mont_word().
+
+This function was removed from the public symbols in LibreSSL because it
+is rarely used where "BN_mod_exp() and BN_mod_exp_mont() will use the
+word optimization when appropriate."
+
+Reference: https://github.com/libressl/portable/issues/1049
+Signed-off-by: orbea <[email protected]>
+---
+ 3rd_party/libsrp6a-sha512/t_math.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/3rd_party/libsrp6a-sha512/t_math.c 
b/3rd_party/libsrp6a-sha512/t_math.c
+index 037650ee1..dac19ecd9 100644
+--- a/3rd_party/libsrp6a-sha512/t_math.c
++++ b/3rd_party/libsrp6a-sha512/t_math.c
+@@ -720,7 +720,11 @@ BigIntegerModExp(BigInteger r, BigInteger b, BigInteger 
e, BigInteger m, BigInte
+   else if(a == NULL) {
+     BN_mod_exp(r, b, e, m, c);
+   }
+-#if OPENSSL_VERSION_NUMBER >= 0x00906000
++/*
++ * In LibreSSL BN_mod_exp_mont_word() is not a public symbol where 
BN_mod_exp()
++ * and BN_mod_exp_mont() will use the word optimization when appropriate.
++ */
++#if OPENSSL_VERSION_NUMBER >= 0x00906000 && !defined(LIBRESSL_VERSION_NUMBER)
+   else if(B > 0 && B < ULONG_MAX) {  /* 0.9.6 and above has mont_word 
optimization */
+     BN_mod_exp_mont_word(r, B, e, m, c, a);
+   }

diff --git a/app-pda/libimobiledevice/libimobiledevice-1.3.0_p20240201.ebuild 
b/app-pda/libimobiledevice/libimobiledevice-1.3.0_p20240201.ebuild
index 428271b..9b895fb 100644
--- a/app-pda/libimobiledevice/libimobiledevice-1.3.0_p20240201.ebuild
+++ b/app-pda/libimobiledevice/libimobiledevice-1.3.0_p20240201.ebuild
@@ -39,7 +39,7 @@ BDEPEND="
 "
 
 PATCHES=(
-       "${FILESDIR}"/${PN}-1.3.0_p20240201-libressl.patch
+       "${FILESDIR}"/${PN}-1.3.0_p20240201_libressl.patch
        "${FILESDIR}"/${PN}-1.3.0_p20240201_time_h.patch
 )
 

Reply via email to