]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Fix compilation in OpenSSL < 3 and LibreSSL
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Mon, 6 May 2024 21:54:16 +0000 (15:54 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Mon, 6 May 2024 21:54:16 +0000 (15:54 -0600)
src/libcrypto_util.c
src/libcrypto_util.h

index 462e79f35c5092bc00aca22ad49d3deb19dd8094..82a6810277a4d8d9a4ec10b821c2fd3a67d166a7 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <stdlib.h>
 #include <openssl/asn1.h>
+#include <openssl/opensslv.h>
 
 #include "alloc.h"
 #include "extension.h"
@@ -90,6 +91,7 @@ json_t *
 asn1time2json(ASN1_TIME const *time)
 {
        BIO *bio;
+       int success;
 
        if (time == NULL)
                return json_null();
@@ -98,7 +100,12 @@ asn1time2json(ASN1_TIME const *time)
        if (bio == NULL)
                return NULL;
 
-       if (!ASN1_TIME_print_ex(bio, time, ASN1_DTFLGS_ISO8601)) {
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+       success = ASN1_TIME_print_ex(bio, time, ASN1_DTFLGS_ISO8601);
+#else
+       success = ASN1_TIME_print(bio, time); /* Kill me */
+#endif
+       if (!success) {
                BIO_free_all(bio);
                return NULL;
        }
index 53c9ba529c1651b0c97bc228d2c8025c1cbb6ac6..3e464f99001318830ea2f8c3dc8f36ecb492624b 100644 (file)
@@ -4,7 +4,7 @@
 #include <jansson.h>
 #include <openssl/asn1.h>
 #include <openssl/bio.h>
-#include <openssl/x509.h>
+#include <openssl/x509v3.h>
 
 char *bio2str(BIO *);
 json_t *bio2json(BIO *);