diff options
Diffstat (limited to 'src/lib/pk_pad/emsa_pssr/pssr.cpp')
-rw-r--r-- | src/lib/pk_pad/emsa_pssr/pssr.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/pk_pad/emsa_pssr/pssr.cpp b/src/lib/pk_pad/emsa_pssr/pssr.cpp index a41e79e78..5f76b5a6f 100644 --- a/src/lib/pk_pad/emsa_pssr/pssr.cpp +++ b/src/lib/pk_pad/emsa_pssr/pssr.cpp @@ -14,7 +14,7 @@ namespace Botan { /* * PSSR Update Operation */ -void PSSR::update(const byte input[], size_t length) +void PSSR::update(const uint8_t input[], size_t length) { m_hash->update(input, length); } @@ -22,7 +22,7 @@ void PSSR::update(const byte input[], size_t length) /* * Return the raw (unencoded) data */ -secure_vector<byte> PSSR::raw_data() +secure_vector<uint8_t> PSSR::raw_data() { return m_hash->final(); } @@ -30,7 +30,7 @@ secure_vector<byte> PSSR::raw_data() /* * PSSR Encode Operation */ -secure_vector<byte> PSSR::encoding_of(const secure_vector<byte>& msg, +secure_vector<uint8_t> PSSR::encoding_of(const secure_vector<uint8_t>& msg, size_t output_bits, RandomNumberGenerator& rng) { @@ -43,15 +43,15 @@ secure_vector<byte> PSSR::encoding_of(const secure_vector<byte>& msg, const size_t output_length = (output_bits + 7) / 8; - secure_vector<byte> salt = rng.random_vec(m_SALT_SIZE); + secure_vector<uint8_t> salt = rng.random_vec(m_SALT_SIZE); for(size_t j = 0; j != 8; ++j) m_hash->update(0); m_hash->update(msg); m_hash->update(salt); - secure_vector<byte> H = m_hash->final(); + secure_vector<uint8_t> H = m_hash->final(); - secure_vector<byte> EM(output_length); + secure_vector<uint8_t> EM(output_length); EM[output_length - HASH_SIZE - m_SALT_SIZE - 2] = 0x01; buffer_insert(EM, output_length - 1 - HASH_SIZE - m_SALT_SIZE, salt); @@ -66,8 +66,8 @@ secure_vector<byte> PSSR::encoding_of(const secure_vector<byte>& msg, /* * PSSR Decode/Verify Operation */ -bool PSSR::verify(const secure_vector<byte>& const_coded, - const secure_vector<byte>& raw, size_t key_bits) +bool PSSR::verify(const secure_vector<uint8_t>& const_coded, + const secure_vector<uint8_t>& raw, size_t key_bits) { const size_t HASH_SIZE = m_hash->output_length(); const size_t KEY_BYTES = (key_bits + 7) / 8; @@ -84,10 +84,10 @@ bool PSSR::verify(const secure_vector<byte>& const_coded, if(const_coded[const_coded.size()-1] != 0xBC) return false; - secure_vector<byte> coded = const_coded; + secure_vector<uint8_t> coded = const_coded; if(coded.size() < KEY_BYTES) { - secure_vector<byte> temp(KEY_BYTES); + secure_vector<uint8_t> temp(KEY_BYTES); buffer_insert(temp, KEY_BYTES - coded.size(), coded); coded = temp; } @@ -96,10 +96,10 @@ bool PSSR::verify(const secure_vector<byte>& const_coded, if(TOP_BITS > 8 - high_bit(coded[0])) return false; - byte* DB = coded.data(); + uint8_t* DB = coded.data(); const size_t DB_size = coded.size() - HASH_SIZE - 1; - const byte* H = &coded[DB_size]; + const uint8_t* H = &coded[DB_size]; const size_t H_size = HASH_SIZE; mgf1_mask(*m_hash, H, H_size, DB, DB_size); @@ -120,7 +120,7 @@ bool PSSR::verify(const secure_vector<byte>& const_coded, m_hash->update(0); m_hash->update(raw); m_hash->update(&DB[salt_offset], DB_size - salt_offset); - secure_vector<byte> H2 = m_hash->final(); + secure_vector<uint8_t> H2 = m_hash->final(); return same_mem(H, H2.data(), HASH_SIZE); } |