]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OpenSSL: Fix build with OpenSSL 1.0.2
authorJouni Malinen <jouni@codeaurora.org>
Wed, 3 Nov 2021 14:02:07 +0000 (16:02 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 3 Nov 2021 14:02:07 +0000 (16:02 +0200)
OpenSSL 1.0.2 did not define the 'bytes' argument to
X509_NAME_add_entry_by_NID() to be const like it did for the previously
used X509_NAME_add_entry_by_txt(). Add a backwards compatible version of
this call to avoid compilation issues.

Fixes: d51939f2c4b5 ("DPP: Move CSR routines to use crypto.h")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/crypto/crypto_openssl.c

index 98b93d9a7829c59a3fb6d7f2803162590da2a20b..ef669c40847436a82dc3af79f2153028cc09fa10 100644 (file)
@@ -3099,10 +3099,17 @@ int crypto_csr_set_name(struct crypto_csr *csr, enum crypto_csr_name type,
        if (!n)
                return -1;
 
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+       if (!X509_NAME_add_entry_by_NID(n, nid, MBSTRING_UTF8,
+                                       (unsigned char *) name,
+                                       os_strlen(name), -1, 0))
+               return -1;
+#else
        if (!X509_NAME_add_entry_by_NID(n, nid, MBSTRING_UTF8,
                                        (const unsigned char *) name,
                                        os_strlen(name), -1, 0))
                return -1;
+#endif
 
        return 0;
 }