diff options
author | Jack Lloyd <[email protected]> | 2016-02-28 02:43:57 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-03-20 09:38:17 -0400 |
commit | ada363473a9491a3b07e3bb6fa2b5fd9f12aec98 (patch) | |
tree | 0dc7eefb24c3d9983e45dd6e2e7f0876179c8c11 /src/lib/pk_pad/eme.cpp | |
parent | f70a9de37d22282d8cca465632efd0044ab9008c (diff) |
Add PK_Decryptor::decrypt_or_random
Performs content checks on the value (expected length, expected bytes)
and in constant time returns either the decrypted value or a random value.
Diffstat (limited to 'src/lib/pk_pad/eme.cpp')
-rw-r--r-- | src/lib/pk_pad/eme.cpp | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/src/lib/pk_pad/eme.cpp b/src/lib/pk_pad/eme.cpp index 623c3777e..b36ed6e67 100644 --- a/src/lib/pk_pad/eme.cpp +++ b/src/lib/pk_pad/eme.cpp @@ -57,8 +57,8 @@ EME* get_eme(const std::string& algo_spec) * Encode a message */ secure_vector<byte> EME::encode(const byte msg[], size_t msg_len, - size_t key_bits, - RandomNumberGenerator& rng) const + size_t key_bits, + RandomNumberGenerator& rng) const { return pad(msg, msg_len, key_bits, rng); } @@ -67,28 +67,11 @@ secure_vector<byte> EME::encode(const byte msg[], size_t msg_len, * Encode a message */ secure_vector<byte> EME::encode(const secure_vector<byte>& msg, - size_t key_bits, - RandomNumberGenerator& rng) const + size_t key_bits, + RandomNumberGenerator& rng) const { return pad(msg.data(), msg.size(), key_bits, rng); } -/* -* Decode a message -*/ -secure_vector<byte> EME::decode(const byte msg[], size_t msg_len, - size_t key_bits) const - { - return unpad(msg, msg_len, key_bits); - } - -/* -* Decode a message -*/ -secure_vector<byte> EME::decode(const secure_vector<byte>& msg, - size_t key_bits) const - { - return unpad(msg.data(), msg.size(), key_bits); - } } |