aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/base/sym_algo.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-05-13 12:49:40 -0400
committerJack Lloyd <[email protected]>2018-05-13 12:49:40 -0400
commit1fcf8c6ba3f8912c9c6cba0555597ab0083eaaa2 (patch)
tree07199fd3b677dd02828f73fa1d2dcda272ee7a1f /src/lib/base/sym_algo.cpp
parentbef5303b3ec1a17bc79ccce0eecdca4874639b56 (diff)
Add message to BOTAN_ARG_CHECK and use it more widely
Diffstat (limited to 'src/lib/base/sym_algo.cpp')
-rw-r--r--src/lib/base/sym_algo.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/lib/base/sym_algo.cpp b/src/lib/base/sym_algo.cpp
new file mode 100644
index 000000000..c6062667b
--- /dev/null
+++ b/src/lib/base/sym_algo.cpp
@@ -0,0 +1,25 @@
+/*
+* (C) 2018 Jack Lloyd
+*
+* Botan is released under the Simplified BSD License (see license.txt)
+*/
+
+#include <botan/sym_algo.h>
+#include <botan/exceptn.h>
+
+namespace Botan {
+
+void SymmetricAlgorithm::verify_key_set(bool cond) const
+ {
+ if(cond == false)
+ throw Key_Not_Set(name());
+ }
+
+void SymmetricAlgorithm::set_key(const uint8_t key[], size_t length)
+ {
+ if(!valid_keylength(length))
+ throw Invalid_Key_Length(name(), length);
+ key_schedule(key, length);
+ }
+
+}