]> granicus.if.org Git - pdns/commitdiff
Compare algorithm mnemonics case insensitive
authorPieter Lexis <pieter.lexis@powerdns.com>
Thu, 16 Nov 2017 16:41:40 +0000 (17:41 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Fri, 17 Nov 2017 09:01:56 +0000 (10:01 +0100)
pdns/dnsseckeeper.hh

index 353cea52a3c1c14ff2cba92c5e0906d509fe6c3d..61b17ae571fb07b4cffbc0143071740909b658f5 100644 (file)
@@ -93,25 +93,25 @@ public:
    */
   static int shorthand2algorithm(const string &algorithm)
   {
-    if (!algorithm.compare("rsamd5")) return RSAMD5;
-    if (!algorithm.compare("dh")) return DH;
-    if (!algorithm.compare("dsa")) return DSA;
-    if (!algorithm.compare("rsasha1")) return RSASHA1;
-    if (!algorithm.compare("dsa-nsec3-sha1")) return DSANSEC3SHA1;
-    if (!algorithm.compare("rsasha1-nsec3-sha1")) return RSASHA1NSEC3SHA1;
-    if (!algorithm.compare("rsasha256")) return RSASHA256;
-    if (!algorithm.compare("rsasha512")) return RSASHA512;
-    if (!algorithm.compare("ecc-gost")) return ECCGOST;
-    if (!algorithm.compare("gost")) return ECCGOST;
-    if (!algorithm.compare("ecdsa256")) return ECDSA256;
-    if (!algorithm.compare("ecdsap256sha256")) return ECDSA256;
-    if (!algorithm.compare("ecdsa384")) return ECDSA384;
-    if (!algorithm.compare("ecdsap384sha384")) return ECDSA384;
-    if (!algorithm.compare("ed25519")) return ED25519;
-    if (!algorithm.compare("ed448")) return ED448;
-    if (!algorithm.compare("indirect")) return 252;
-    if (!algorithm.compare("privatedns")) return 253;
-    if (!algorithm.compare("privateoid")) return 254;
+    if (pdns_iequals(algorithm, "rsamd5")) return RSAMD5;
+    if (pdns_iequals(algorithm, "dh")) return DH;
+    if (pdns_iequals(algorithm, "dsa")) return DSA;
+    if (pdns_iequals(algorithm, "rsasha1")) return RSASHA1;
+    if (pdns_iequals(algorithm, "dsa-nsec3-sha1")) return DSANSEC3SHA1;
+    if (pdns_iequals(algorithm, "rsasha1-nsec3-sha1")) return RSASHA1NSEC3SHA1;
+    if (pdns_iequals(algorithm, "rsasha256")) return RSASHA256;
+    if (pdns_iequals(algorithm, "rsasha512")) return RSASHA512;
+    if (pdns_iequals(algorithm, "ecc-gost")) return ECCGOST;
+    if (pdns_iequals(algorithm, "gost")) return ECCGOST;
+    if (pdns_iequals(algorithm, "ecdsa256")) return ECDSA256;
+    if (pdns_iequals(algorithm, "ecdsap256sha256")) return ECDSA256;
+    if (pdns_iequals(algorithm, "ecdsa384")) return ECDSA384;
+    if (pdns_iequals(algorithm, "ecdsap384sha384")) return ECDSA384;
+    if (pdns_iequals(algorithm, "ed25519")) return ED25519;
+    if (pdns_iequals(algorithm, "ed448")) return ED448;
+    if (pdns_iequals(algorithm, "indirect")) return 252;
+    if (pdns_iequals(algorithm, "privatedns")) return 253;
+    if (pdns_iequals(algorithm, "privateoid")) return 254;
     return -1;
   }