From: Fred Morcos Date: Fri, 10 Feb 2023 14:50:53 +0000 (+0100) Subject: Fix the argument ordering of createFromPEMFile X-Git-Tag: dnsdist-1.8.0-rc1~18^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0186c9419bd87834eb02de0900dfab5a3d60f009;p=thirdparty%2Fpdns.git Fix the argument ordering of createFromPEMFile --- diff --git a/pdns/decafsigners.cc b/pdns/decafsigners.cc index c1fc72663a..2c6af8bd81 100644 --- a/pdns/decafsigners.cc +++ b/pdns/decafsigners.cc @@ -40,7 +40,7 @@ public: * \return An ED25519 key engine populated with the contents of the * PEM file. */ - void createFromPEMFile(DNSKEYRecordContent& drc, const std::string& filename, std::FILE& inputFile) override; + void createFromPEMFile(DNSKEYRecordContent& drc, std::FILE& inputFile, const std::string& filename) override; /** * \brief Writes this key's contents to a file. @@ -89,7 +89,7 @@ void DecafED25519DNSCryptoKeyEngine::create(unsigned int bits) } #if defined(HAVE_LIBCRYPTO_ED25519) -void DecafED25519DNSCryptoKeyEngine::createFromPEMFile(DNSKEYRecordContent& drc, const string& filename, std::FILE& inputFile) +void DecafED25519DNSCryptoKeyEngine::createFromPEMFile(DNSKEYRecordContent& drc, std::FILE& inputFile, const string& filename) { drc.d_algorithm = d_algorithm; auto key = std::unique_ptr(PEM_read_PrivateKey(&inputFile, nullptr, nullptr, nullptr), &EVP_PKEY_free); @@ -238,7 +238,7 @@ public: * \return An ED448 key engine populated with the contents of the PEM * file. */ - void createFromPEMFile(DNSKEYRecordContent& drc, const std::string& filename, std::FILE& inputFile) override; + void createFromPEMFile(DNSKEYRecordContent& drc, std::FILE& inputFile, const std::string& filename) override; /** * \brief Writes this key's contents to a file. @@ -287,7 +287,7 @@ void DecafED448DNSCryptoKeyEngine::create(unsigned int bits) } #if defined(HAVE_LIBCRYPTO_ED448) -void DecafED448DNSCryptoKeyEngine::createFromPEMFile(DNSKEYRecordContent& drc, const string& filename, std::FILE& inputFile) +void DecafED448DNSCryptoKeyEngine::createFromPEMFile(DNSKEYRecordContent& drc, std::FILE& inputFile, const string& filename) { drc.d_algorithm = d_algorithm; auto key = std::unique_ptr(PEM_read_PrivateKey(&inputFile, nullptr, nullptr, nullptr), &EVP_PKEY_free); diff --git a/pdns/dnssecinfra.cc b/pdns/dnssecinfra.cc index 10ba1442a7..9dddd17f05 100644 --- a/pdns/dnssecinfra.cc +++ b/pdns/dnssecinfra.cc @@ -173,7 +173,7 @@ std::unique_ptr DNSCryptoKeyEngine::makeFromISCString(DNSKEY std::unique_ptr DNSCryptoKeyEngine::makeFromPEMFile(DNSKEYRecordContent& drc, const uint8_t algorithm, std::FILE& inputFile, const std::string& filename) { auto maker = DNSCryptoKeyEngine::make(algorithm); - maker->createFromPEMFile(drc, filename, inputFile); + maker->createFromPEMFile(drc, inputFile, filename); return maker; } diff --git a/pdns/dnssecinfra.hh b/pdns/dnssecinfra.hh index d3a437d5bb..0e4653f0b8 100644 --- a/pdns/dnssecinfra.hh +++ b/pdns/dnssecinfra.hh @@ -43,7 +43,7 @@ class DNSCryptoKeyEngine using storvector_t = std::vector>; virtual void create(unsigned int bits)=0; - virtual void createFromPEMFile(DNSKEYRecordContent& /* drc */, const std::string& /* filename */, std::FILE& /* inputFile */) + virtual void createFromPEMFile(DNSKEYRecordContent& /* drc */, std::FILE& /* inputFile */, const std::string& /* filename */) { throw std::runtime_error("Can't create key from PEM file"); } diff --git a/pdns/opensslsigners.cc b/pdns/opensslsigners.cc index 5c26c747fc..4b2ef8be7a 100644 --- a/pdns/opensslsigners.cc +++ b/pdns/opensslsigners.cc @@ -227,7 +227,7 @@ public: * * \return An RSA key engine populated with the contents of the PEM file. */ - void createFromPEMFile(DNSKEYRecordContent& drc, const std::string& filename, std::FILE& inputFile) override; + void createFromPEMFile(DNSKEYRecordContent& drc, std::FILE& inputFile, const std::string& filename) override; /** * \brief Writes this key's contents to a file. @@ -382,7 +382,7 @@ void OpenSSLRSADNSCryptoKeyEngine::create(unsigned int bits) #endif } -void OpenSSLRSADNSCryptoKeyEngine::createFromPEMFile(DNSKEYRecordContent& drc, const std::string& filename, std::FILE& inputFile) +void OpenSSLRSADNSCryptoKeyEngine::createFromPEMFile(DNSKEYRecordContent& drc, std::FILE& inputFile, const std::string& filename) { drc.d_algorithm = d_algorithm; @@ -1013,7 +1013,7 @@ public: * \return An ECDSA key engine populated with the contents of the PEM * file. */ - void createFromPEMFile(DNSKEYRecordContent& drc, const std::string& filename, std::FILE& inputFile) override; + void createFromPEMFile(DNSKEYRecordContent& drc, std::FILE& inputFile, const std::string& filename) override; /** * \brief Writes this key's contents to a file. @@ -1154,7 +1154,7 @@ void OpenSSLECDSADNSCryptoKeyEngine::create(unsigned int bits) #endif } -void OpenSSLECDSADNSCryptoKeyEngine::createFromPEMFile(DNSKEYRecordContent& drc, const string& filename, std::FILE& inputFile) +void OpenSSLECDSADNSCryptoKeyEngine::createFromPEMFile(DNSKEYRecordContent& drc, std::FILE& inputFile, const string& filename) { drc.d_algorithm = d_algorithm; @@ -1768,7 +1768,7 @@ public: * \return An EDDSA key engine populated with the contents of the PEM * file. */ - void createFromPEMFile(DNSKEYRecordContent& drc, const std::string& filename, std::FILE& inputFile) override; + void createFromPEMFile(DNSKEYRecordContent& drc, std::FILE& inputFile, const std::string& filename) override; /** * \brief Writes this key's contents to a file. @@ -1894,7 +1894,7 @@ void OpenSSLEDDSADNSCryptoKeyEngine::create(unsigned int /* bits */) d_edkey.reset(newKey); } -void OpenSSLEDDSADNSCryptoKeyEngine::createFromPEMFile(DNSKEYRecordContent& drc, const string& filename, std::FILE& inputFile) +void OpenSSLEDDSADNSCryptoKeyEngine::createFromPEMFile(DNSKEYRecordContent& drc, std::FILE& inputFile, const string& filename) { drc.d_algorithm = d_algorithm; d_edkey = Key(PEM_read_PrivateKey(&inputFile, nullptr, nullptr, nullptr), &EVP_PKEY_free); diff --git a/pdns/sodiumsigners.cc b/pdns/sodiumsigners.cc index 3310c91fee..623d3290ff 100644 --- a/pdns/sodiumsigners.cc +++ b/pdns/sodiumsigners.cc @@ -37,7 +37,7 @@ public: * \return An ED25519 key engine populated with the contents of the * PEM file. */ - void createFromPEMFile(DNSKEYRecordContent& drc, const std::string& filename, std::FILE& inputFile) override; + void createFromPEMFile(DNSKEYRecordContent& drc, std::FILE& inputFile, const std::string& filename) override; /** * \brief Writes this key's contents to a file. @@ -79,7 +79,7 @@ void SodiumED25519DNSCryptoKeyEngine::create(unsigned int bits) } #if defined(HAVE_LIBCRYPTO_ED25519) -void SodiumED25519DNSCryptoKeyEngine::createFromPEMFile(DNSKEYRecordContent& drc, const string& filename, std::FILE& inputFile) +void SodiumED25519DNSCryptoKeyEngine::createFromPEMFile(DNSKEYRecordContent& drc, std::FILE& inputFile, const string& filename) { drc.d_algorithm = d_algorithm; auto key = std::unique_ptr(PEM_read_PrivateKey(&inputFile, nullptr, nullptr, nullptr), &EVP_PKEY_free);