8 #include <botan/emsa_raw.h>
15 void EMSA_Raw::update(
const byte input[],
size_t length)
17 message += std::make_pair(input, length);
23 SecureVector<byte> EMSA_Raw::raw_data()
25 SecureVector<byte> output;
33 SecureVector<byte> EMSA_Raw::encoding_of(
const MemoryRegion<byte>& msg,
35 RandomNumberGenerator&)
43 bool EMSA_Raw::verify(
const MemoryRegion<byte>& coded,
44 const MemoryRegion<byte>& raw,
47 if(coded.size() == raw.size())
48 return (coded == raw);
50 if(coded.size() > raw.size())
54 const size_t leading_zeros_expected = raw.size() - coded.size();
56 bool same_modulo_leading_zeros =
true;
58 for(
size_t i = 0; i != leading_zeros_expected; ++i)
60 same_modulo_leading_zeros =
false;
62 if(!
same_mem(&coded[0], &raw[leading_zeros_expected], coded.size()))
63 same_modulo_leading_zeros =
false;
65 return same_modulo_leading_zeros;
bool same_mem(const T *p1, const T *p2, size_t n)
void swap(Botan::MemoryRegion< T > &x, Botan::MemoryRegion< T > &y)