libressl/portable

BN_mod_exp_mont_word() is not a public symbol

Closed this issue · 3 comments

OS: Gentoo
LibreSSL: 3.9.1
libimobiledevice: libimobiledevice/libimobiledevice@73b6fd1 (Gentoo snapshot)

When building libimobiledevice with LibreSSL it fails with an implicit declaration for BN_mod_exp_mont_word() and looking in the LibreSSL sources it seems to already exist, but is not a public symbol. Should it be public or is libimobiledevice wrong for using it?

A workaround appears to be:

--- a/3rd_party/libsrp6a-sha512/t_math.c
+++ b/3rd_party/libsrp6a-sha512/t_math.c
@@ -720,7 +720,7 @@ 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
+#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);
   }

Thanks for the info, I will try submitting it upstream to libimobiledevice soon.

I made a PR for libimobiledevice. libimobiledevice/libimobiledevice#1562