diff options
Diffstat (limited to 'src/ssl/rec_read.cpp')
-rw-r--r-- | src/ssl/rec_read.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/ssl/rec_read.cpp b/src/ssl/rec_read.cpp index 29e2ca4c7..0886a688f 100644 --- a/src/ssl/rec_read.cpp +++ b/src/ssl/rec_read.cpp @@ -100,7 +100,7 @@ void Record_Reader::set_keys(const CipherSuite& suite, const SessionKeys& keys, throw Invalid_Argument("Record_Reader: Unknown hash " + mac_algo); } -void Record_Reader::add_input(const byte input[], u32bit input_size) +void Record_Reader::add_input(const byte input[], size_t input_size) { input_queue.write(input, input_size); } @@ -108,12 +108,12 @@ void Record_Reader::add_input(const byte input[], u32bit input_size) /* * Retrieve the next record */ -u32bit Record_Reader::get_record(byte& msg_type, +size_t Record_Reader::get_record(byte& msg_type, MemoryRegion<byte>& output) { byte header[5] = { 0 }; - const u32bit have_in_queue = input_queue.size(); + const size_t have_in_queue = input_queue.size(); if(have_in_queue < sizeof(header)) return (sizeof(header) - have_in_queue); @@ -126,7 +126,7 @@ u32bit Record_Reader::get_record(byte& msg_type, // SSLv2-format client hello? if(header[0] & 0x80 && header[2] == 1 && header[3] == 3) { - u32bit record_len = make_u16bit(header[0], header[1]) & 0x7FFF; + size_t record_len = make_u16bit(header[0], header[1]) & 0x7FFF; if(have_in_queue < record_len + 2) return (record_len + 2 - have_in_queue); @@ -184,7 +184,7 @@ u32bit Record_Reader::get_record(byte& msg_type, cipher.process_msg(buffer); SecureVector<byte> plaintext = cipher.read_all(Pipe::LAST_MESSAGE); - u32bit pad_size = 0; + size_t pad_size = 0; if(block_size) { @@ -206,7 +206,7 @@ u32bit Record_Reader::get_record(byte& msg_type, } else { - for(u32bit j = 0; j != pad_size; j++) + for(size_t j = 0; j != pad_size; j++) if(plaintext[plaintext.size()-j-1] != pad_value) pad_size = 0; } @@ -215,22 +215,22 @@ u32bit Record_Reader::get_record(byte& msg_type, if(plaintext.size() < mac_size + pad_size + iv_size) throw Decoding_Error("Record_Reader: Record truncated"); - const u32bit mac_offset = plaintext.size() - (mac_size + pad_size); + const size_t mac_offset = plaintext.size() - (mac_size + pad_size); SecureVector<byte> recieved_mac(&plaintext[mac_offset], mac_size); const u16bit plain_length = plaintext.size() - (mac_size + pad_size + iv_size); mac.start_msg(); - for(u32bit j = 0; j != 8; j++) + for(size_t j = 0; j != 8; j++) mac.write(get_byte(j, seq_no)); mac.write(header[0]); // msg_type if(version != SSL_V3) - for(u32bit j = 0; j != 2; j++) + for(size_t j = 0; j != 2; j++) mac.write(get_byte(j, version)); - for(u32bit j = 0; j != 2; j++) + for(size_t j = 0; j != 2; j++) mac.write(get_byte(j, plain_length)); mac.write(&plaintext[iv_size], plain_length); mac.end_msg(); |