diff options
author | Jack Lloyd <[email protected]> | 2017-09-16 14:07:27 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-09-16 14:07:27 -0400 |
commit | 8cae1ee8e81b4bc395a4cca338c71893cad3ddb5 (patch) | |
tree | e7618cf5c66d650bc0eb1ab6a0d1486fa87ab57b /src | |
parent | 6123db0a94f38f218bfdf61409b52ca23c28545b (diff) |
Clear return value, and verify 'raw' hash matches expected size
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/pk_pad/emsa_pssr/pssr.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/pk_pad/emsa_pssr/pssr.cpp b/src/lib/pk_pad/emsa_pssr/pssr.cpp index e78a696f6..8bdcf3745 100644 --- a/src/lib/pk_pad/emsa_pssr/pssr.cpp +++ b/src/lib/pk_pad/emsa_pssr/pssr.cpp @@ -181,7 +181,13 @@ void PSSR_Raw::update(const uint8_t input[], size_t length) */ secure_vector<uint8_t> PSSR_Raw::raw_data() { - return m_msg; + secure_vector<uint8_t> ret; + std::swap(ret, m_msg); + + if(ret.size() != m_hash->output_length()) + throw Encoding_Error("PSSR_Raw Bad input length, did not match hash"); + + return ret; } secure_vector<uint8_t> PSSR_Raw::encoding_of(const secure_vector<uint8_t>& msg, |