From: Daniel Salzman Date: Fri, 22 Dec 2023 07:13:07 +0000 (+0100) Subject: configure: remove no longer needed check for gnutls_privkey_export_x509 X-Git-Tag: v3.4.0~209^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c32b80455e923f577f0be9ab8d09b377eb992da;p=thirdparty%2Fknot-dns.git configure: remove no longer needed check for gnutls_privkey_export_x509 --- diff --git a/configure.ac b/configure.ac index e1e383cd30..41f85372e9 100644 --- a/configure.ac +++ b/configure.ac @@ -150,9 +150,6 @@ PKG_CHECK_MODULES([gnutls], [gnutls >= 3.6.10], [ [enable_ed448=no], [#include ]) - AC_CHECK_FUNC([gnutls_privkey_export_x509], - [AC_DEFINE([HAVE_EXPORT_X509], [1], [gnutls_privkey_export_x509 available])]) - AC_CHECK_FUNC([gnutls_memset], [AC_DEFINE([HAVE_GNUTLS_MEMSET], [1], [gnutls_memset available]) gnutls_memset=yes], [gnutls_memset=no]) diff --git a/src/libdnssec/pem.c b/src/libdnssec/pem.c index fa463f69d8..41fd855a14 100644 --- a/src/libdnssec/pem.c +++ b/src/libdnssec/pem.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2020 CZ.NIC, z.s.p.o. +/* Copyright (C) 2023 CZ.NIC, z.s.p.o. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -130,29 +130,10 @@ int dnssec_pem_from_x509(gnutls_x509_privkey_t key, dnssec_binary_t *pem) static int privkey_export_x509(gnutls_privkey_t key, gnutls_x509_privkey_t *_key) { -#ifdef HAVE_EXPORT_X509 if (gnutls_privkey_export_x509(key, _key) != GNUTLS_E_SUCCESS) { return DNSSEC_KEY_EXPORT_ERROR; } -#else // Needed for GnuTLS < 3.4.0 (CentOS 7) - struct privkey { // Extracted needed items only! - gnutls_privkey_type_t type; - gnutls_pk_algorithm_t pk_algorithm; - gnutls_x509_privkey_t x509; - }; - struct privkey *pkey = (struct privkey *)key; - assert(pkey->type == GNUTLS_PRIVKEY_X509); - - if (gnutls_x509_privkey_init(_key) != GNUTLS_E_SUCCESS) { - return DNSSEC_KEY_EXPORT_ERROR; - } - - if (gnutls_x509_privkey_cpy(*_key, pkey->x509) != GNUTLS_E_SUCCESS) { - gnutls_x509_privkey_deinit(*_key); - return DNSSEC_KEY_EXPORT_ERROR; - } -#endif return DNSSEC_EOK; }