From: Peter van Dijk Date: Wed, 17 Feb 2021 09:39:12 +0000 (+0100) Subject: speedtest: add NSEC3 hashing test X-Git-Tag: dnsdist-1.6.0-alpha2~34^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f21878ab464ac4f57239ba965bc7ac44e1690dd;p=thirdparty%2Fpdns.git speedtest: add NSEC3 hashing test --- diff --git a/pdns/Makefile.am b/pdns/Makefile.am index 053212287d..2f7cd11533 100644 --- a/pdns/Makefile.am +++ b/pdns/Makefile.am @@ -908,6 +908,7 @@ endif speedtest_SOURCES = \ base32.cc \ base64.cc base64.hh \ + dnssecinfra.cc dnssecinfra.hh \ dnslabeltext.cc \ dnsname.cc dnsname.hh \ dnsparser.cc dnsparser.hh \ @@ -1405,6 +1406,8 @@ testrunner_LDADD = \ if PKCS11 testrunner_SOURCES += pkcs11signers.cc pkcs11signers.hh testrunner_LDADD += $(P11KIT1_LIBS) +speedtest_SOURCES += pkcs11signers.cc pkcs11signers.hh +speedtest_LDADD += $(P11KIT1_LIBS) endif if LIBSODIUM diff --git a/pdns/speedtest.cc b/pdns/speedtest.cc index 79384363e2..5a3c39df69 100644 --- a/pdns/speedtest.cc +++ b/pdns/speedtest.cc @@ -9,6 +9,7 @@ #include "iputils.hh" #include #include "uuid-utils.hh" +#include "dnssecinfra.hh" #ifndef RECURSOR #include "statbag.hh" @@ -843,6 +844,24 @@ struct UUIDGenTest } }; +struct NSEC3HashTest +{ + explicit NSEC3HashTest(int iterations, string salt) : d_iterations(iterations), d_salt(salt) {} + + string getName() const + { + return (boost::format("%d NSEC3 iterations, salt length %d") % d_iterations % d_salt.length()).str(); + } + + void operator()() const + { + hashQNameWithSalt(d_salt, d_iterations, d_name); + } + int d_iterations; + string d_salt; + DNSName d_name = DNSName("www.example.com"); +}; + int main(int argc, char** argv) try { @@ -930,6 +949,18 @@ try doRun(UUIDGenTest()); + doRun(NSEC3HashTest(1, "ABCD")); + doRun(NSEC3HashTest(10, "ABCD")); + doRun(NSEC3HashTest(50, "ABCD")); + doRun(NSEC3HashTest(150, "ABCD")); + doRun(NSEC3HashTest(500, "ABCD")); + + doRun(NSEC3HashTest(1, "ABCDABCDABCDABCDABCDABCDABCDABCD")); + doRun(NSEC3HashTest(10, "ABCDABCDABCDABCDABCDABCDABCDABCD")); + doRun(NSEC3HashTest(50, "ABCDABCDABCDABCDABCDABCDABCDABCD")); + doRun(NSEC3HashTest(150, "ABCDABCDABCDABCDABCDABCDABCDABCD")); + doRun(NSEC3HashTest(500, "ABCDABCDABCDABCDABCDABCDABCDABCD")); + #ifndef RECURSOR S.doRings();