diff options
author | lloyd <[email protected]> | 2008-10-08 19:40:02 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-10-08 19:40:02 +0000 |
commit | afd97edf49c9381e434f5f786c59f743a246101b (patch) | |
tree | e45ccffd6a43a9c971826e53094a888d885b0476 /src/pk_pad/emsa1_bsi/emsa1_bsi.cpp | |
parent | 4b2294731b8e48227021e57ba7f0a661a87cf5f3 (diff) |
Add BSI variant of EMSA1, from InSiTo
Diffstat (limited to 'src/pk_pad/emsa1_bsi/emsa1_bsi.cpp')
-rw-r--r-- | src/pk_pad/emsa1_bsi/emsa1_bsi.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/pk_pad/emsa1_bsi/emsa1_bsi.cpp b/src/pk_pad/emsa1_bsi/emsa1_bsi.cpp new file mode 100644 index 000000000..cc7868a1d --- /dev/null +++ b/src/pk_pad/emsa1_bsi/emsa1_bsi.cpp @@ -0,0 +1,27 @@ +/************************************************* +* EMSA1 BSI Source File * +* (C) 1999-2008 Jack Lloyd * +* 2008 Falko Strenzke, FlexSecure GmbH * +*************************************************/ + +#include <botan/emsa1_bsi.h> + +namespace Botan { + +/************************************************* +* EMSA1 BSI Encode Operation * +*************************************************/ +SecureVector<byte> EMSA1_BSI::encoding_of(const MemoryRegion<byte>& msg, + u32bit 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"); + } + +} |