aboutsummaryrefslogtreecommitdiffstats
path: root/src/pk_pad/emsa2
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-05-18 20:32:36 +0000
committerlloyd <[email protected]>2012-05-18 20:32:36 +0000
commitc691561f3198f481c13457433efbccc1c9fcd898 (patch)
treea45ea2c5a30e0cb009fbcb68a61ef39332ff790c /src/pk_pad/emsa2
parentd76700f01c7ecac5633edf75f8d7408b46c5dbac (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/emsa2')
-rw-r--r--src/pk_pad/emsa2/emsa2.cpp14
-rw-r--r--src/pk_pad/emsa2/emsa2.h8
2 files changed, 11 insertions, 11 deletions
diff --git a/src/pk_pad/emsa2/emsa2.cpp b/src/pk_pad/emsa2/emsa2.cpp
index 50ea7dbe3..d299ddacd 100644
--- a/src/pk_pad/emsa2/emsa2.cpp
+++ b/src/pk_pad/emsa2/emsa2.cpp
@@ -15,9 +15,9 @@ namespace {
/*
* EMSA2 Encode Operation
*/
-SecureVector<byte> emsa2_encoding(const MemoryRegion<byte>& msg,
+secure_vector<byte> emsa2_encoding(const secure_vector<byte>& msg,
size_t output_bits,
- const MemoryRegion<byte>& empty_hash,
+ const secure_vector<byte>& empty_hash,
byte hash_id)
{
const size_t HASH_SIZE = empty_hash.size();
@@ -34,7 +34,7 @@ SecureVector<byte> emsa2_encoding(const MemoryRegion<byte>& msg,
if(empty_hash[j] != msg[j])
empty = false;
- SecureVector<byte> output(output_length);
+ secure_vector<byte> output(output_length);
output[0] = (empty ? 0x4B : 0x6B);
output[output_length - 3 - HASH_SIZE] = 0xBA;
@@ -59,7 +59,7 @@ void EMSA2::update(const byte input[], size_t length)
/*
* Return the raw (unencoded) data
*/
-SecureVector<byte> EMSA2::raw_data()
+secure_vector<byte> EMSA2::raw_data()
{
return hash->final();
}
@@ -67,7 +67,7 @@ SecureVector<byte> EMSA2::raw_data()
/*
* EMSA2 Encode Operation
*/
-SecureVector<byte> EMSA2::encoding_of(const MemoryRegion<byte>& msg,
+secure_vector<byte> EMSA2::encoding_of(const secure_vector<byte>& msg,
size_t output_bits,
RandomNumberGenerator&)
{
@@ -77,8 +77,8 @@ SecureVector<byte> EMSA2::encoding_of(const MemoryRegion<byte>& msg,
/*
* EMSA2 Verify Operation
*/
-bool EMSA2::verify(const MemoryRegion<byte>& coded,
- const MemoryRegion<byte>& raw,
+bool EMSA2::verify(const secure_vector<byte>& coded,
+ const secure_vector<byte>& raw,
size_t key_bits)
{
try
diff --git a/src/pk_pad/emsa2/emsa2.h b/src/pk_pad/emsa2/emsa2.h
index 9e0fa6a95..fb0cecb21 100644
--- a/src/pk_pad/emsa2/emsa2.h
+++ b/src/pk_pad/emsa2/emsa2.h
@@ -27,15 +27,15 @@ class BOTAN_DLL EMSA2 : public EMSA
~EMSA2() { delete hash; }
private:
void update(const byte[], size_t);
- SecureVector<byte> raw_data();
+ secure_vector<byte> raw_data();
- SecureVector<byte> encoding_of(const MemoryRegion<byte>&, size_t,
+ secure_vector<byte> encoding_of(const secure_vector<byte>&, size_t,
RandomNumberGenerator& rng);
- bool verify(const MemoryRegion<byte>&, const MemoryRegion<byte>&,
+ bool verify(const secure_vector<byte>&, const secure_vector<byte>&,
size_t);
- SecureVector<byte> empty_hash;
+ secure_vector<byte> empty_hash;
HashFunction* hash;
byte hash_id;
};