diff options
author | lloyd <[email protected]> | 2010-09-15 14:45:43 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-09-15 14:45:43 +0000 |
commit | 8de40eb3955a964aa822b01b5092edeed73364c9 (patch) | |
tree | 5ea0b42d13add07431704e5571f132dd4831f565 /src/ssl/c_kex.cpp | |
parent | ca0cdf81ebac6b04164766df46e8c03d454af962 (diff) |
Add a helper function for encoding TLS values with length tagging
Diffstat (limited to 'src/ssl/c_kex.cpp')
-rw-r--r-- | src/ssl/c_kex.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/ssl/c_kex.cpp b/src/ssl/c_kex.cpp index 3ce4a2f06..0f20b819c 100644 --- a/src/ssl/c_kex.cpp +++ b/src/ssl/c_kex.cpp @@ -77,17 +77,14 @@ Client_Key_Exchange::Client_Key_Exchange(const MemoryRegion<byte>& contents, */ SecureVector<byte> Client_Key_Exchange::serialize() const { - SecureVector<byte> buf; - if(include_length) { - u16bit key_size = key_material.size(); - buf.push_back(get_byte(0, key_size)); - buf.push_back(get_byte(1, key_size)); + SecureVector<byte> buf; + append_tls_length_value(buf, key_material, 2); + return buf; } - buf += key_material; - - return buf; + else + return key_material; } /** |