OpenSC / pkcs11-helper

Library that simplifies the interaction with PKCS#11 providers for end-user applications using a simple API and optional OpenSSL engine
Other
66 stars 43 forks source link

fix build with libressl >= 3.5.0 #55

Closed ffontaine closed 2 years ago

ffontaine commented 2 years ago

DSA_METHOD is opaque since libressl 3.5.0 and https://github.com/libressl-portable/openbsd/commit/62c7bff5397fa44f595b161cd593d9456eca236e resulting in the following build failure:

pkcs11h-openssl.c: In function 'DSA_meth_set1_name':
pkcs11h-openssl.c:239:41: error: invalid use of incomplete typedef 'DSA_METHOD' {aka 'struct dsa_method'}
  239 |  rv = _pkcs11h_mem_strdup ((void *)&meth->name, name);
      |                                         ^~

Fixes:

Signed-off-by: Fabrice Fontaine fontaine.fabrice@gmail.com

alonbl commented 2 years ago

the name of the method is important for openssl debug logs and interaction with application. it is used at line 1605

I guess the issue will be resolved by adding #ifndef OPENSSL_NO_DSA and such for all the compatibility functions.

ffontaine commented 2 years ago

Indeed, thanks for your review. However, the issue can't be fixed by adding #ifndef OPENSSL_NO_DSA as DSA is supported by libressl. The real issue is that libressl doesn't have DSA_meth_set1_name (but it has RSA_meth_set1_name).

The only 'solution' that I can found is to disable DSA_meth_set1_name with libressl >= 3.5.0 (i.e. through #if !(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x30500000L)). Otherwise, I could also disable pkcs11-helper with libressl on buildroot side.

A more long term solution would be to add this function to libressl but I don't know how long it will takes (https://github.com/libressl-portable/openbsd/issues/130).

alonbl commented 2 years ago

Can you please check https://github.com/OpenSC/pkcs11-helper/pull/56 as an alternative?

ffontaine commented 2 years ago

56 is also fixing the build failure

alonbl commented 2 years ago

Great :)

What approach do you think is better?

ffontaine commented 2 years ago

I think yours is better. I'll close this one.