From: Pieter Lexis Date: Mon, 20 Sep 2021 09:12:34 +0000 (+0200) Subject: Remove separate string_compare source X-Git-Tag: dnsdist-1.7.0-alpha1~3^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79d9c3874cf4877a4dce4813ee41dfe3a509427b;p=thirdparty%2Fpdns.git Remove separate string_compare source --- diff --git a/pdns/Makefile.am b/pdns/Makefile.am index 867d3c04cb..a916faba09 100644 --- a/pdns/Makefile.am +++ b/pdns/Makefile.am @@ -53,7 +53,6 @@ EXTRA_DIST = \ lua-record.cc \ minicurl.cc \ minicurl.hh \ - string_compare.hh \ api-swagger.yaml \ api-swagger.json \ requirements.txt \ diff --git a/pdns/dnsdistdist/Makefile.am b/pdns/dnsdistdist/Makefile.am index 26371f6bf3..a9f4433f20 100644 --- a/pdns/dnsdistdist/Makefile.am +++ b/pdns/dnsdistdist/Makefile.am @@ -103,7 +103,6 @@ EXTRA_DIST=COPYING \ kqueuemplexer.cc \ portsmplexer.cc \ cdb.cc cdb.hh \ - string_compare.hh \ ext/lmdb-safe/lmdb-safe.cc ext/lmdb-safe/lmdb-safe.hh \ ext/protozero/include/* \ builder-support/gen-version diff --git a/pdns/dnsdistdist/string_compare.hh b/pdns/dnsdistdist/string_compare.hh deleted file mode 120000 index 7c3ecf51f4..0000000000 --- a/pdns/dnsdistdist/string_compare.hh +++ /dev/null @@ -1 +0,0 @@ -../string_compare.hh \ No newline at end of file diff --git a/pdns/dnssecinfra.cc b/pdns/dnssecinfra.cc index f89acb68e1..e4f77e795f 100644 --- a/pdns/dnssecinfra.cc +++ b/pdns/dnssecinfra.cc @@ -45,7 +45,6 @@ #include "pkcs11signers.hh" #endif #include "misc.hh" -#include "string_compare.hh" using namespace boost::assign; diff --git a/pdns/ednscookies.cc b/pdns/ednscookies.cc index 204f4eed06..5992b13f86 100644 --- a/pdns/ednscookies.cc +++ b/pdns/ednscookies.cc @@ -24,7 +24,6 @@ #endif #include "ednscookies.hh" #include "misc.hh" -#include "string_compare.hh" #ifdef HAVE_CRYPTO_SHORTHASH #include diff --git a/pdns/recursordist/Makefile.am b/pdns/recursordist/Makefile.am index 6ceec19979..b80d554f50 100644 --- a/pdns/recursordist/Makefile.am +++ b/pdns/recursordist/Makefile.am @@ -63,7 +63,6 @@ EXTRA_DIST = \ mtasker_fcontext.cc mtasker_ucontext.cc \ NOTICE \ opensslsigners.hh opensslsigners.cc \ - string_compare.hh \ portsmplexer.cc \ dnstap.proto dnstap.cc dnstap.hh fstrm_logger.cc fstrm_logger.hh \ ext/protozero/include/* \ diff --git a/pdns/recursordist/string_compare.hh b/pdns/recursordist/string_compare.hh deleted file mode 120000 index 7c3ecf51f4..0000000000 --- a/pdns/recursordist/string_compare.hh +++ /dev/null @@ -1 +0,0 @@ -../string_compare.hh \ No newline at end of file diff --git a/pdns/string_compare.hh b/pdns/string_compare.hh deleted file mode 100644 index 65d51c6749..0000000000 --- a/pdns/string_compare.hh +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is part of PowerDNS or dnsdist. - * Copyright -- PowerDNS.COM B.V. and its contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * In addition, for the avoidance of any doubt, permission is granted to - * link this program with OpenSSL and to (re)distribute the binaries - * produced as the result of such linking. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifdef HAVE_CRYPTO_MEMCMP -#include -#endif - -static bool constantTimeStringEquals(const std::string& a, const std::string& b) -{ - if (a.size() != b.size()) { - return false; - } - const size_t size = a.size(); -#ifdef HAVE_CRYPTO_MEMCMP - return CRYPTO_memcmp(a.c_str(), b.c_str(), size) == 0; -#else - const volatile unsigned char* _a = (const volatile unsigned char*)a.c_str(); - const volatile unsigned char* _b = (const volatile unsigned char*)b.c_str(); - unsigned char res = 0; - - for (size_t idx = 0; idx < size; idx++) { - res |= _a[idx] ^ _b[idx]; - } - - return res == 0; -#endif -}