diff options
author | lloyd <[email protected]> | 2010-03-30 15:24:36 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-30 15:24:36 +0000 |
commit | 40d0f36446d5d80dcc1e99c8707e2b84e82c5da0 (patch) | |
tree | f660c5cca710b7098d601c0d77d2a12fd3df2181 /src/ssl/c_kex.cpp | |
parent | 9378baca4d4b2eb1f8d36177ada4dfc4015d46e8 (diff) |
Add a class that knows how to decode a (very small subset of) TLS data
formatting. Particularly useful in the ClientHello, but generally helps
centralize the offset handling, which was particularly unreadable in
the hello messages.
Diffstat (limited to 'src/ssl/c_kex.cpp')
-rw-r--r-- | src/ssl/c_kex.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/ssl/c_kex.cpp b/src/ssl/c_kex.cpp index 9e59beefc..e09e18ce1 100644 --- a/src/ssl/c_kex.cpp +++ b/src/ssl/c_kex.cpp @@ -6,6 +6,7 @@ */ #include <botan/tls_messages.h> +#include <botan/internal/tls_reader.h> #include <botan/pubkey.h> #include <botan/dh.h> #include <botan/rsa.h> @@ -99,14 +100,8 @@ void Client_Key_Exchange::deserialize(const MemoryRegion<byte>& buf) { if(include_length) { - if(buf.size() < 2) - throw Decoding_Error("Client_Key_Exchange: Packet corrupted"); - - u32bit size = make_u16bit(buf[0], buf[1]); - if(size + 2 != buf.size()) - throw Decoding_Error("Client_Key_Exchange: Packet corrupted"); - - key_material.set(buf + 2, size); + TLS_Data_Reader reader(buf); + key_material = reader.get_range<byte>(2, 0, 65535); } else key_material = buf; |