diff options
author | lloyd <[email protected]> | 2014-01-10 03:41:59 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-01-10 03:41:59 +0000 |
commit | 6894dca64c04936d07048c0e8cbf7e25858548c3 (patch) | |
tree | 5d572bfde9fe667dab14e3f04b5285a85d8acd95 /src/lib/pk_pad/emsa1_bsi | |
parent | 9efa3be92442afb3d0b69890a36c7f122df18eda (diff) |
Move lib into src
Diffstat (limited to 'src/lib/pk_pad/emsa1_bsi')
-rw-r--r-- | src/lib/pk_pad/emsa1_bsi/emsa1_bsi.cpp | 29 | ||||
-rw-r--r-- | src/lib/pk_pad/emsa1_bsi/emsa1_bsi.h | 35 | ||||
-rw-r--r-- | src/lib/pk_pad/emsa1_bsi/info.txt | 5 |
3 files changed, 69 insertions, 0 deletions
diff --git a/src/lib/pk_pad/emsa1_bsi/emsa1_bsi.cpp b/src/lib/pk_pad/emsa1_bsi/emsa1_bsi.cpp new file mode 100644 index 000000000..9096edfbf --- /dev/null +++ b/src/lib/pk_pad/emsa1_bsi/emsa1_bsi.cpp @@ -0,0 +1,29 @@ +/* +* EMSA1 BSI +* (C) 1999-2008 Jack Lloyd +* 2008 Falko Strenzke, FlexSecure GmbH +* +* Distributed under the terms of the Botan license +*/ + +#include <botan/emsa1_bsi.h> + +namespace Botan { + +/* +* EMSA1 BSI Encode Operation +*/ +secure_vector<byte> EMSA1_BSI::encoding_of(const secure_vector<byte>& msg, + size_t output_bits, + RandomNumberGenerator&) + { + if(msg.size() != hash_ptr()->output_length()) + throw Encoding_Error("EMSA1_BSI::encoding_of: Invalid size for input"); + + if(8*msg.size() <= output_bits) + return msg; + + throw Encoding_Error("EMSA1_BSI::encoding_of: max key input size exceeded"); + } + +} diff --git a/src/lib/pk_pad/emsa1_bsi/emsa1_bsi.h b/src/lib/pk_pad/emsa1_bsi/emsa1_bsi.h new file mode 100644 index 000000000..1b90f48df --- /dev/null +++ b/src/lib/pk_pad/emsa1_bsi/emsa1_bsi.h @@ -0,0 +1,35 @@ +/* +* EMSA1 BSI Variant +* (C) 1999-2008 Jack Lloyd +* 2007 FlexSecure GmbH +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_EMSA1_BSI_H__ +#define BOTAN_EMSA1_BSI_H__ + +#include <botan/emsa1.h> + +namespace Botan { + +/** +EMSA1_BSI is a variant of EMSA1 specified by the BSI. It accepts only +hash values which are less or equal than the maximum key length. The +implementation comes from InSiTo +*/ +class BOTAN_DLL EMSA1_BSI : public EMSA1 + { + public: + /** + * @param hash the hash object to use + */ + EMSA1_BSI(HashFunction* hash) : EMSA1(hash) {} + private: + secure_vector<byte> encoding_of(const secure_vector<byte>&, size_t, + RandomNumberGenerator& rng); + }; + +} + +#endif diff --git a/src/lib/pk_pad/emsa1_bsi/info.txt b/src/lib/pk_pad/emsa1_bsi/info.txt new file mode 100644 index 000000000..021c99720 --- /dev/null +++ b/src/lib/pk_pad/emsa1_bsi/info.txt @@ -0,0 +1,5 @@ +define EMSA1_BSI 20131128 + +<requires> +emsa1 +</requires> |