From c691561f3198f481c13457433efbccc1c9fcd898 Mon Sep 17 00:00:00 2001 From: lloyd Date: Fri, 18 May 2012 20:32:36 +0000 Subject: 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. --- src/pk_pad/emsa2/emsa2.cpp | 14 +++++++------- src/pk_pad/emsa2/emsa2.h | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/pk_pad/emsa2') 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 emsa2_encoding(const MemoryRegion& msg, +secure_vector emsa2_encoding(const secure_vector& msg, size_t output_bits, - const MemoryRegion& empty_hash, + const secure_vector& empty_hash, byte hash_id) { const size_t HASH_SIZE = empty_hash.size(); @@ -34,7 +34,7 @@ SecureVector emsa2_encoding(const MemoryRegion& msg, if(empty_hash[j] != msg[j]) empty = false; - SecureVector output(output_length); + secure_vector 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 EMSA2::raw_data() +secure_vector EMSA2::raw_data() { return hash->final(); } @@ -67,7 +67,7 @@ SecureVector EMSA2::raw_data() /* * EMSA2 Encode Operation */ -SecureVector EMSA2::encoding_of(const MemoryRegion& msg, +secure_vector EMSA2::encoding_of(const secure_vector& msg, size_t output_bits, RandomNumberGenerator&) { @@ -77,8 +77,8 @@ SecureVector EMSA2::encoding_of(const MemoryRegion& msg, /* * EMSA2 Verify Operation */ -bool EMSA2::verify(const MemoryRegion& coded, - const MemoryRegion& raw, +bool EMSA2::verify(const secure_vector& coded, + const secure_vector& 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 raw_data(); + secure_vector raw_data(); - SecureVector encoding_of(const MemoryRegion&, size_t, + secure_vector encoding_of(const secure_vector&, size_t, RandomNumberGenerator& rng); - bool verify(const MemoryRegion&, const MemoryRegion&, + bool verify(const secure_vector&, const secure_vector&, size_t); - SecureVector empty_hash; + secure_vector empty_hash; HashFunction* hash; byte hash_id; }; -- cgit v1.2.3