diff options
author | Dan Brown <[email protected]> | 2016-04-27 11:53:30 -0700 |
---|---|---|
committer | Dan Brown <[email protected]> | 2016-04-27 11:53:30 -0700 |
commit | b55e9bca0c747154aeeb188df9a8a6eda6d65124 (patch) | |
tree | c51c4662acbc3d1f6296a9419d1b0ce11a0db2be /src/lib/tls | |
parent | 4ad555977b03cb92dfac0b87a00febe4d8e7ff5e (diff) |
Change calls to 'get_byte' to explicitly cast parameters and eliminate compiler warnings
Diffstat (limited to 'src/lib/tls')
-rw-r--r-- | src/lib/tls/msg_certificate.cpp | 4 | ||||
-rw-r--r-- | src/lib/tls/tls_channel.cpp | 4 | ||||
-rw-r--r-- | src/lib/tls/tls_extensions.cpp | 24 | ||||
-rw-r--r-- | src/lib/tls/tls_handshake_io.cpp | 6 | ||||
-rw-r--r-- | src/lib/tls/tls_record.cpp | 12 |
5 files changed, 25 insertions, 25 deletions
diff --git a/src/lib/tls/msg_certificate.cpp b/src/lib/tls/msg_certificate.cpp index 5be9379bd..32e3e17f0 100644 --- a/src/lib/tls/msg_certificate.cpp +++ b/src/lib/tls/msg_certificate.cpp @@ -73,14 +73,14 @@ std::vector<byte> Certificate::serialize() const const size_t cert_size = raw_cert.size(); for(size_t j = 0; j != 3; ++j) { - buf.push_back(get_byte<u32bit>(j+1, cert_size)); + buf.push_back(get_byte(j+1, static_cast<u32bit>(cert_size))); } buf += raw_cert; } const size_t buf_size = buf.size() - 3; for(size_t i = 0; i != 3; ++i) - buf[i] = get_byte<u32bit>(i+1, buf_size); + buf[i] = get_byte(i+1, static_cast<u32bit>(buf_size)); return buf; } diff --git a/src/lib/tls/tls_channel.cpp b/src/lib/tls/tls_channel.cpp index 2cf351c80..131196ce5 100644 --- a/src/lib/tls/tls_channel.cpp +++ b/src/lib/tls/tls_channel.cpp @@ -630,8 +630,8 @@ SymmetricKey Channel::key_material_export(const std::string& label, size_t context_size = context.length(); if(context_size > 0xFFFF) throw Exception("key_material_export context is too long"); - salt.push_back(get_byte<u16bit>(0, context_size)); - salt.push_back(get_byte<u16bit>(1, context_size)); + salt.push_back(get_byte(0, static_cast<u16bit>(context_size))); + salt.push_back(get_byte(1, static_cast<u16bit>(context_size))); salt += to_byte_vector(context); } diff --git a/src/lib/tls/tls_extensions.cpp b/src/lib/tls/tls_extensions.cpp index 8befb2fbc..fc442ab14 100644 --- a/src/lib/tls/tls_extensions.cpp +++ b/src/lib/tls/tls_extensions.cpp @@ -99,8 +99,8 @@ std::vector<byte> Extensions::serialize() const buf.push_back(get_byte(0, extn_code)); buf.push_back(get_byte(1, extn_code)); - buf.push_back(get_byte<u16bit>(0, extn_val.size())); - buf.push_back(get_byte<u16bit>(1, extn_val.size())); + buf.push_back(get_byte(0, static_cast<u16bit>(extn_val.size()))); + buf.push_back(get_byte(1, static_cast<u16bit>(extn_val.size()))); buf += extn_val; } @@ -163,12 +163,12 @@ std::vector<byte> Server_Name_Indicator::serialize() const size_t name_len = m_sni_host_name.size(); - buf.push_back(get_byte<u16bit>(0, name_len+3)); - buf.push_back(get_byte<u16bit>(1, name_len+3)); + buf.push_back(get_byte(0, static_cast<u16bit>(name_len+3))); + buf.push_back(get_byte(1, static_cast<u16bit>(name_len+3))); buf.push_back(0); // DNS - buf.push_back(get_byte<u16bit>(0, name_len)); - buf.push_back(get_byte<u16bit>(1, name_len)); + buf.push_back(get_byte(0, static_cast<u16bit>(name_len))); + buf.push_back(get_byte(1, static_cast<u16bit>(name_len))); buf += std::make_pair( reinterpret_cast<const byte*>(m_sni_host_name.data()), @@ -264,8 +264,8 @@ std::vector<byte> Application_Layer_Protocol_Notification::serialize() const 1); } - buf[0] = get_byte<u16bit>(0, buf.size()-2); - buf[1] = get_byte<u16bit>(1, buf.size()-2); + buf[0] = get_byte(0, static_cast<u16bit>(buf.size()-2)); + buf[1] = get_byte(1, static_cast<u16bit>(buf.size()-2)); return buf; } @@ -320,8 +320,8 @@ std::vector<byte> Supported_Elliptic_Curves::serialize() const buf.push_back(get_byte(1, id)); } - buf[0] = get_byte<u16bit>(0, buf.size()-2); - buf[1] = get_byte<u16bit>(1, buf.size()-2); + buf[0] = get_byte(0, static_cast<u16bit>(buf.size()-2)); + buf[1] = get_byte(1, static_cast<u16bit>(buf.size()-2)); return buf; } @@ -435,8 +435,8 @@ std::vector<byte> Signature_Algorithms::serialize() const {} } - buf[0] = get_byte<u16bit>(0, buf.size()-2); - buf[1] = get_byte<u16bit>(1, buf.size()-2); + buf[0] = get_byte(0, static_cast<u16bit>(buf.size()-2)); + buf[1] = get_byte(1, static_cast<u16bit>(buf.size()-2)); return buf; } diff --git a/src/lib/tls/tls_handshake_io.cpp b/src/lib/tls/tls_handshake_io.cpp index f39c9f84e..720e4459f 100644 --- a/src/lib/tls/tls_handshake_io.cpp +++ b/src/lib/tls/tls_handshake_io.cpp @@ -28,9 +28,9 @@ inline size_t load_be24(const byte q[3]) void store_be24(byte out[3], size_t val) { - out[0] = get_byte<u32bit>(1, val); - out[1] = get_byte<u32bit>(2, val); - out[2] = get_byte<u32bit>(3, val); + out[0] = get_byte(1, static_cast<u32bit>(val)); + out[1] = get_byte(2, static_cast<u32bit>(val)); + out[2] = get_byte(3, static_cast<u32bit>(val)); } u64bit steady_clock_ms() diff --git a/src/lib/tls/tls_record.cpp b/src/lib/tls/tls_record.cpp index 8af6587e3..16ba42ce6 100644 --- a/src/lib/tls/tls_record.cpp +++ b/src/lib/tls/tls_record.cpp @@ -172,8 +172,8 @@ void write_record(secure_vector<byte>& output, if(!cs) // initial unencrypted handshake records { - output.push_back(get_byte<u16bit>(0, msg_length)); - output.push_back(get_byte<u16bit>(1, msg_length)); + output.push_back(get_byte(0, static_cast<u16bit>(msg_length))); + output.push_back(get_byte(1, static_cast<u16bit>(msg_length))); output.insert(output.end(), msg, msg + msg_length); @@ -190,8 +190,8 @@ void write_record(secure_vector<byte>& output, const size_t rec_size = ctext_size + cs->nonce_bytes_from_record(); BOTAN_ASSERT(rec_size <= 0xFFFF, "Ciphertext length fits in field"); - output.push_back(get_byte<u16bit>(0, rec_size)); - output.push_back(get_byte<u16bit>(1, rec_size)); + output.push_back(get_byte(0, static_cast<u16bit>(rec_size))); + output.push_back(get_byte(1, static_cast<u16bit>(rec_size))); aead->set_ad(cs->format_ad(seq, msg_type, version, msg_length)); @@ -228,8 +228,8 @@ void write_record(secure_vector<byte>& output, if(buf_size > MAX_CIPHERTEXT_SIZE) throw Internal_Error("Output record is larger than allowed by protocol"); - output.push_back(get_byte<u16bit>(0, buf_size)); - output.push_back(get_byte<u16bit>(1, buf_size)); + output.push_back(get_byte(0, static_cast<u16bit>(buf_size))); + output.push_back(get_byte(1, static_cast<u16bit>(buf_size))); const size_t header_size = output.size(); |