mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zkey: Adjustments for OpenSSL v4.0.0 API changes and deprecations
With OpenSSL 4.0.0 function X509_cmp_current_time() is deprecated and should be replaced by X509_check_certificate_times(). Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
0ae29148f0
commit
211431abc2
@@ -27,6 +27,18 @@
|
||||
#include "properties.h"
|
||||
#include "utils.h"
|
||||
|
||||
#ifndef OPENSSL_VERSION_PREREQ
|
||||
#if defined(OPENSSL_VERSION_MAJOR) && defined(OPENSSL_VERSION_MINOR)
|
||||
#define OPENSSL_VERSION_PREREQ(maj, min) \
|
||||
((OPENSSL_VERSION_MAJOR << 16) + \
|
||||
OPENSSL_VERSION_MINOR >= ((maj) << 16) + (min))
|
||||
#else
|
||||
#define OPENSSL_VERSION_PREREQ(maj, min) \
|
||||
(OPENSSL_VERSION_NUMBER >= (((maj) << 28) | \
|
||||
((min) << 20)))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Initializes the plugin and setup the plugin data structure
|
||||
*
|
||||
@@ -377,8 +389,12 @@ int plugin_check_certificate(struct plugin_data *pd, const char *cert_file,
|
||||
*self_signed = (X509_NAME_cmp(X509_get_subject_name(cert),
|
||||
X509_get_issuer_name(cert)) == 0);
|
||||
|
||||
#if OPENSSL_VERSION_PREREQ(4, 0)
|
||||
*valid = X509_check_certificate_times(NULL, cert, NULL);
|
||||
#else
|
||||
*valid = (X509_cmp_current_time(X509_get0_notBefore(cert)) < 0 &&
|
||||
X509_cmp_current_time(X509_get0_notAfter(cert)) > 0);
|
||||
#endif
|
||||
|
||||
X509_free(cert);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user