aboutsummaryrefslogtreecommitdiffstats
path: root/src/ssl/rec_read.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-30 02:24:38 +0000
committerlloyd <[email protected]>2010-03-30 02:24:38 +0000
commit6d141cd765d840d8bbfdaaa8154494d3c9ecce50 (patch)
treebf2ce82c1eb28cd4257a16be750faf747a24bdf6 /src/ssl/rec_read.cpp
parentfd61747c28071c67dafbe7a4e8d8e20cb869dc46 (diff)
Rename pad_amount to block_size, more accurate/descriptive
Diffstat (limited to 'src/ssl/rec_read.cpp')
-rw-r--r--src/ssl/rec_read.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/ssl/rec_read.cpp b/src/ssl/rec_read.cpp
index 11dedc41c..4a042c28b 100644
--- a/src/ssl/rec_read.cpp
+++ b/src/ssl/rec_read.cpp
@@ -19,7 +19,8 @@ void Record_Reader::reset()
{
cipher.reset();
mac.reset();
- mac_size = pad_amount = 0;
+ mac_size = 0;
+ block_size = 0;
major = minor = 0;
seq_no = 0;
}
@@ -70,12 +71,12 @@ void Record_Reader::set_keys(const CipherSuite& suite, const SessionKeys& keys,
cipher_algo + "/CBC/NoPadding",
cipher_key, iv, DECRYPTION)
);
- pad_amount = block_size_of(cipher_algo);
+ block_size = block_size_of(cipher_algo);
}
else if(have_stream_cipher(cipher_algo))
{
cipher.append(get_cipher(cipher_algo, cipher_key, DECRYPTION));
- pad_amount = 0;
+ block_size = 0;
}
else
throw Invalid_Argument("Record_Reader: Unknown cipher " + cipher_algo);
@@ -149,14 +150,15 @@ u32bit Record_Reader::get_record(byte& msg_type,
SecureVector<byte> plaintext = cipher.read_all(Pipe::LAST_MESSAGE);
u32bit pad_size = 0;
- if(pad_amount)
+
+ if(block_size)
{
byte pad_value = plaintext[plaintext.size()-1];
pad_size = pad_value + 1;
if(version == SSL_V3)
{
- if(pad_value > pad_amount)
+ if(pad_value > block_size)
throw TLS_Exception(BAD_RECORD_MAC,
"Record_Reader: Bad padding");
}