aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/modes
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-10-17 06:05:37 -0400
committerJack Lloyd <[email protected]>2016-10-21 16:53:17 -0400
commitdf64fb318acbfee7911bee4fd021100f1d6532ed (patch)
tree20238e6f96c7d6e31539389c398255850177d970 /src/lib/modes
parent558808900bffc3c48da5e6d79ba602e88e619154 (diff)
Remove alias logic from SCAN_Name
This required taking a global lock and doing a map lookup each time an algorithm was requested (and so many times during a TLS handshake).
Diffstat (limited to 'src/lib/modes')
-rw-r--r--src/lib/modes/aead/aead.cpp6
-rw-r--r--src/lib/modes/cipher_mode.cpp6
2 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/modes/aead/aead.cpp b/src/lib/modes/aead/aead.cpp
index 033dad94e..1b7b78be7 100644
--- a/src/lib/modes/aead/aead.cpp
+++ b/src/lib/modes/aead/aead.cpp
@@ -76,6 +76,12 @@ AEAD_Mode* get_aead(const std::string& algo, Cipher_Dir dir)
#if defined(BOTAN_HAS_BLOCK_CIPHER)
SCAN_Name req(algo);
+
+ if(req.arg_count() == 0)
+ {
+ return nullptr;
+ }
+
std::unique_ptr<BlockCipher> bc(BlockCipher::create(req.arg(0)));
if(!bc)
diff --git a/src/lib/modes/cipher_mode.cpp b/src/lib/modes/cipher_mode.cpp
index df2944323..d622e7754 100644
--- a/src/lib/modes/cipher_mode.cpp
+++ b/src/lib/modes/cipher_mode.cpp
@@ -79,6 +79,12 @@ Cipher_Mode* get_cipher_mode(const std::string& algo, Cipher_Dir direction)
#if defined(BOTAN_HAS_BLOCK_CIPHER)
SCAN_Name spec(algo);
+
+ if(spec.arg_count() == 0)
+ {
+ return nullptr;
+ }
+
std::unique_ptr<BlockCipher> bc(BlockCipher::create(spec.arg(0)));
if(!bc)