aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/scripts/oids.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/scripts/oids.py b/src/scripts/oids.py
index 5e8368980..a4e40f074 100755
--- a/src/scripts/oids.py
+++ b/src/scripts/oids.py
@@ -219,30 +219,36 @@ def format_pads_as_map(sig_dict):
*/
#include <botan/internal/padding.h>
-#include <map>
+#include <unordered_map>
#include <vector>
#include <string>
#include <algorithm>
namespace Botan {
-const std::map<const std::string, std::vector<std::string>> allowed_signature_paddings =
+namespace {
+
+const std::unordered_map<const std::string, std::vector<std::string>> allowed_signature_paddings =
{
%s
};
-__attribute__((visibility("default"))) const std::vector<std::string> get_sig_paddings(const std::string algo)
+}
+
+const std::vector<std::string> get_sig_paddings(const std::string algo)
{
- if(allowed_signature_paddings.count(algo) > 0)
- return allowed_signature_paddings.at(algo);
+ auto i = allowed_signature_paddings.find(algo);
+ if(i != allowed_signature_paddings.end())
+ return i->second;
return {};
}
bool sig_algo_and_pad_ok(const std::string algo, std::string padding)
{
- std::vector<std::string> pads = get_sig_paddings(algo);
+ const std::vector<std::string> pads = get_sig_paddings(algo);
return std::find(pads.begin(), pads.end(), padding) != pads.end();
}
+
}
""" % (sys.argv[0], datetime.date.today().strftime("%Y-%m-%d"),
format_set_map(sig_dict))
@@ -321,6 +327,8 @@ def main(args = None):
print(format_dn_ub_as_map(dn_ub,oid2str))
elif args[1] == "pads":
print(format_pads_as_map(sig2pads))
+ else:
+ print("Unknown command")
return 0