diff options
author | lloyd <[email protected]> | 2008-09-28 20:03:58 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-28 20:03:58 +0000 |
commit | eb8fd42d6aa3ed267c7444b114e02e64a567ca00 (patch) | |
tree | eac8431723ecd2d2985a7801c9877955d6ba50bf /src/mgf1.cpp | |
parent | fde29acbeb656bcffe13b91f08f847eee4509670 (diff) |
Modularize MGF1. Make EME1 and EMSA4 depend on it
Diffstat (limited to 'src/mgf1.cpp')
-rw-r--r-- | src/mgf1.cpp | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/src/mgf1.cpp b/src/mgf1.cpp deleted file mode 100644 index c2cda7f4c..000000000 --- a/src/mgf1.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************* -* MGF1 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#include <botan/mgf1.h> -#include <botan/loadstor.h> -#include <botan/xor_buf.h> -#include <algorithm> -#include <memory> - -namespace Botan { - -/************************************************* -* MGF1 Mask Generation Function * -*************************************************/ -void MGF1::mask(const byte in[], u32bit in_len, byte out[], - u32bit out_len) const - { - u32bit counter = 0; - - while(out_len) - { - hash->update(in, in_len); - for(u32bit j = 0; j != 4; ++j) - hash->update(get_byte(j, counter)); - SecureVector<byte> buffer = hash->final(); - - u32bit xored = std::min(buffer.size(), out_len); - xor_buf(out, buffer.begin(), xored); - out += xored; - out_len -= xored; - - ++counter; - } - } - -/************************************************* -* MGF1 Constructor * -*************************************************/ -MGF1::MGF1(HashFunction* h) : hash(h) - { - if(!hash) - throw Invalid_Argument("MGF1 given null hash object"); - } - -/************************************************* -* MGF1 Destructor * -*************************************************/ -MGF1::~MGF1() - { - delete hash; - } - -} |