From 3caf39eb798addc6f5022a1e90225a5981356b0b Mon Sep 17 00:00:00 2001 From: Bernd Kuhls Date: Sun, 27 Sep 2026 12:42:41 +0200 Subject: [PATCH] package/pkcs11-helper: add support for OpenSSL 4.0.0 Signed-off-by: Bernd Kuhls Signed-off-by: Thomas Petazzoni --- ...1-crypto-openssl-use-ASN1_TIME_to_tm.patch | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 package/pkcs11-helper/0001-crypto-openssl-use-ASN1_TIME_to_tm.patch diff --git a/package/pkcs11-helper/0001-crypto-openssl-use-ASN1_TIME_to_tm.patch b/package/pkcs11-helper/0001-crypto-openssl-use-ASN1_TIME_to_tm.patch new file mode 100644 index 0000000000..d8149330e1 --- /dev/null +++ b/package/pkcs11-helper/0001-crypto-openssl-use-ASN1_TIME_to_tm.patch @@ -0,0 +1,48 @@ +From 59cc22b8d65669da599f1c435fdfe35d4e07db0e Mon Sep 17 00:00:00 2001 +From: Ravi Kant Sharma +Date: Thu, 4 Jun 2026 12:49:44 +0200 +Subject: [PATCH] crypto-openssl: use ASN1_TIME_to_tm + +Introduced in openssl-1.1.1 and is required for openssl-4. + +Upstream: https://github.com/OpenSC/pkcs11-helper/commit/59cc22b8d65669da599f1c435fdfe35d4e07db0e + +Signed-off-by: Bernd Kuhls +--- + lib/_pkcs11h-crypto-openssl.c | 16 +++++----------- + 1 files change, 5 insertions(+), 11 deletions(-) + +diff --git a/lib/_pkcs11h-crypto-openssl.c b/lib/_pkcs11h-crypto-openssl.c +index 05af65e..aa58722 100644 +--- a/lib/_pkcs11h-crypto-openssl.c ++++ b/lib/_pkcs11h-crypto-openssl.c +@@ -148,21 +148,15 @@ __pkcs11h_crypto_openssl_certificate_get_expiration ( + notBefore != NULL && + notAfter != NULL && + X509_cmp_current_time (notBefore) <= 0 && +- X509_cmp_current_time (notAfter) >= 0 && +- notAfter->length >= 12 ++ X509_cmp_current_time (notAfter) >= 0 + ) { + struct tm tm1; + + memset (&tm1, 0, sizeof (tm1)); +- tm1.tm_year = (notAfter->data[ 0] - '0') * 10 + (notAfter->data[ 1] - '0') + 100; +- tm1.tm_mon = (notAfter->data[ 2] - '0') * 10 + (notAfter->data[ 3] - '0') - 1; +- tm1.tm_mday = (notAfter->data[ 4] - '0') * 10 + (notAfter->data[ 5] - '0'); +- tm1.tm_hour = (notAfter->data[ 6] - '0') * 10 + (notAfter->data[ 7] - '0'); +- tm1.tm_min = (notAfter->data[ 8] - '0') * 10 + (notAfter->data[ 9] - '0'); +- tm1.tm_sec = (notAfter->data[10] - '0') * 10 + (notAfter->data[11] - '0'); +- +- *expiration = mktime (&tm1); +- *expiration += (int)(mktime (localtime (expiration)) - mktime (gmtime (expiration))); ++ if (ASN1_TIME_to_tm (notAfter, &tm1)) { ++ *expiration = mktime (&tm1); ++ *expiration += (int)(mktime (localtime (expiration)) - mktime (gmtime (expiration))); ++ } + } + + cleanup: +-- +2.47.3 +