aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate/get_enc.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-10 02:53:24 +0000
committerlloyd <[email protected]>2008-11-10 02:53:24 +0000
commitcabd8859a0cd87cf78ef1a48a8d59bf4a6fae81c (patch)
treecb9a786f4129e4861bd63b7c5152981304e945bf /src/libstate/get_enc.cpp
parentba1271baf1ccbc0302971e7300229d0dec0405ab (diff)
Remove support for block cipher padding methods in engine. Like S2K,
they were not used at all outside of the core library implementations. One change is that now get_bc_pad returns a new object, instead of a pointer to a const shared padding method. This does imply a bit more dynamic memory overhead, but the modes are pretty light (stateless, for the most part), so this doesn't seem like a big deal. So modify ECB and CBC classes to add destructors to delete the padding object.
Diffstat (limited to 'src/libstate/get_enc.cpp')
-rw-r--r--src/libstate/get_enc.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/libstate/get_enc.cpp b/src/libstate/get_enc.cpp
index f2398e318..4c28c4b98 100644
--- a/src/libstate/get_enc.cpp
+++ b/src/libstate/get_enc.cpp
@@ -76,6 +76,10 @@
#include <botan/prf_tls.h>
#endif
+#if defined(BOTAN_HAS_CIPHER_MODE_PADDING)
+ #include <botan/mode_pad.h>
+#endif
+
namespace Botan {
/*************************************************
@@ -104,6 +108,30 @@ S2K* get_s2k(const std::string& algo_spec)
}
/*************************************************
+* Get a block cipher padding method by name *
+*************************************************/
+BlockCipherModePaddingMethod* get_bc_pad(const std::string& algo_spec)
+ {
+ SCAN_Name request(algo_spec);
+
+#if defined(BOTAN_HAS_CIPHER_MODE_PADDING)
+ if(request.algo_name() == "PKCS7")
+ return new PKCS7_Padding;
+
+ if(request.algo_name() == "OneAndZeros")
+ return new OneAndZeros_Padding;
+
+ if(request.algo_name() == "X9.23")
+ return new ANSI_X923_Padding;
+
+ if(request.algo_name() == "NoPadding")
+ return new Null_Padding;
+#endif
+
+ throw Algorithm_Not_Found(algo_spec);
+ }
+
+/*************************************************
* Get an EMSA by name *
*************************************************/
EMSA* get_emsa(const std::string& algo_spec)