diff options
author | lloyd <[email protected]> | 2012-05-18 20:32:36 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-05-18 20:32:36 +0000 |
commit | c691561f3198f481c13457433efbccc1c9fcd898 (patch) | |
tree | a45ea2c5a30e0cb009fbcb68a61ef39332ff790c /src/pk_pad/eme1/eme1.cpp | |
parent | d76700f01c7ecac5633edf75f8d7408b46c5dbac (diff) |
Fairly huge update that replaces the old secmem types with std::vector
using a custom allocator. Currently our allocator just does new/delete
with a memset before deletion, and the mmap and mlock allocators have
been removed.
Diffstat (limited to 'src/pk_pad/eme1/eme1.cpp')
-rw-r--r-- | src/pk_pad/eme1/eme1.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/pk_pad/eme1/eme1.cpp b/src/pk_pad/eme1/eme1.cpp index 69251605f..57275d4f9 100644 --- a/src/pk_pad/eme1/eme1.cpp +++ b/src/pk_pad/eme1/eme1.cpp @@ -15,7 +15,7 @@ namespace Botan { /* * EME1 Pad Operation */ -SecureVector<byte> EME1::pad(const byte in[], size_t in_length, +secure_vector<byte> EME1::pad(const byte in[], size_t in_length, size_t key_length, RandomNumberGenerator& rng) const { @@ -24,7 +24,7 @@ SecureVector<byte> EME1::pad(const byte in[], size_t in_length, if(in_length > key_length - 2*Phash.size() - 1) throw Invalid_Argument("EME1: Input is too large"); - SecureVector<byte> out(key_length); + secure_vector<byte> out(key_length); rng.randomize(&out[0], Phash.size()); @@ -44,7 +44,7 @@ SecureVector<byte> EME1::pad(const byte in[], size_t in_length, /* * EME1 Unpad Operation */ -SecureVector<byte> EME1::unpad(const byte in[], size_t in_length, +secure_vector<byte> EME1::unpad(const byte in[], size_t in_length, size_t key_length) const { /* @@ -65,7 +65,7 @@ SecureVector<byte> EME1::unpad(const byte in[], size_t in_length, if(in_length > key_length) in_length = 0; - SecureVector<byte> input(key_length); + secure_vector<byte> input(key_length); buffer_insert(input, key_length - in_length, in, in_length); mgf->mask(&input[Phash.size()], input.size() - Phash.size(), @@ -104,8 +104,7 @@ SecureVector<byte> EME1::unpad(const byte in[], size_t in_length, if(bad_input) throw Decoding_Error("Invalid EME1 encoding"); - return SecureVector<byte>(input + delim_idx + 1, - input.size() - delim_idx - 1); + return secure_vector<byte>(&input[delim_idx + 1], &input[input.size()]); } /* |