auto dckeVerify = verifier(algo);
cout<<"Testing algorithm "<<algo<<"("<<DNSSEC::algorithm2name(algo)<<"): '"<<dckeCreate->getName()<<"' ->'"<<dckeSign->getName()<<"' -> '"<<dckeVerify->getName()<<"' ";
- unsigned int bits;
- if(algo <= 10)
- bits=2048;
- else if(algo == DNSSEC::ECCGOST || algo == DNSSEC::ECDSA256 || algo == DNSSEC::ED25519)
+ unsigned int bits{};
+ if(algo <= 10) {
+ bits = 2048;
+ }
+ else if(algo == DNSSEC::ECCGOST || algo == DNSSEC::ECDSA256 || algo == DNSSEC::ED25519) {
bits = 256;
- else if(algo == DNSSEC::ECDSA384)
+ }
+ else if(algo == DNSSEC::ECDSA384) {
bits = 384;
- else if(algo == DNSSEC::ED448)
+ }
+ else if(algo == DNSSEC::ED448) {
bits = 456;
- else
- throw runtime_error("Can't guess key size for algorithm "+std::to_string(algo));
+ }
+ else {
+ throw runtime_error("Can't guess key size for algorithm " + std::to_string(algo));
+ }
DTime dt; dt.set();
for(unsigned int n = 0; n < 100; ++n)
dcke->create(dcke->getBits());
DNSSECPrivateKey csk;
csk.setKey(std::move(dcke), 0);
- DSRecordContent ds = makeDSFromDNSKey(target, csk.getDNSKEY(), DNSSEC::DIGEST_SHA256);
+ DSRecordContent dsContent = makeDSFromDNSKey(target, csk.getDNSKEY(), DNSSEC::DIGEST_SHA256);
- keys[target] = std::pair<DNSSECPrivateKey, DSRecordContent>(csk, ds);
+ keys[target] = std::pair<DNSSECPrivateKey, DSRecordContent>(csk, dsContent);
/* Set the root DS */
auto luaconfsCopy = g_luaconfs.getCopy();
luaconfsCopy.dsAnchors.clear();
- luaconfsCopy.dsAnchors[g_rootdnsname].insert(ds);
+ luaconfsCopy.dsAnchors[g_rootdnsname].insert(dsContent);
g_luaconfs.setState(luaconfsCopy);
size_t queriesCount = 0;
dcke->create(dcke->getBits());
DNSSECPrivateKey csk;
csk.setKey(std::move(dcke), 257 | 128);
- DSRecordContent ds = makeDSFromDNSKey(target, csk.getDNSKEY(), DNSSEC::DIGEST_SHA256);
+ DSRecordContent dsContent = makeDSFromDNSKey(target, csk.getDNSKEY(), DNSSEC::DIGEST_SHA256);
- keys[target] = std::pair<DNSSECPrivateKey, DSRecordContent>(csk, ds);
+ keys[target] = std::pair<DNSSECPrivateKey, DSRecordContent>(csk, dsContent);
/* Set the root DS */
auto luaconfsCopy = g_luaconfs.getCopy();
luaconfsCopy.dsAnchors.clear();
- luaconfsCopy.dsAnchors[g_rootdnsname].insert(ds);
+ luaconfsCopy.dsAnchors[g_rootdnsname].insert(dsContent);
g_luaconfs.setState(luaconfsCopy);
size_t queriesCount = 0;
#include "dnssecinfra.hh"
#include "misc.hh"
-// Include below is essential, otherwise we get failures I do not understand, maybe some runtime
-// value does not get initialized?
-#include <openssl/sha.h>
+#include <openssl/opensslv.h> // OPENSSL_VERSION_MAJOR
#include <unordered_map>