aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-03-19 12:30:56 +0000
committerlloyd <[email protected]>2012-03-19 12:30:56 +0000
commit9ecf7c11be659502e28407b7e5001d88cba763c2 (patch)
tree9b45f3e9b90587e43fd62a2dbf0812a9c9663ab2 /src/tls
parentb1238320b591bced237ab08bd32713c59d18525a (diff)
Small fixes, cleanups
Diffstat (limited to 'src/tls')
-rw-r--r--src/tls/c_hello.cpp1
-rw-r--r--src/tls/tls_extensions.cpp6
-rw-r--r--src/tls/tls_extensions.h13
-rw-r--r--src/tls/tls_reader.h9
-rw-r--r--src/tls/tls_session.cpp2
5 files changed, 22 insertions, 9 deletions
diff --git a/src/tls/c_hello.cpp b/src/tls/c_hello.cpp
index 1d02986ac..712fde30c 100644
--- a/src/tls/c_hello.cpp
+++ b/src/tls/c_hello.cpp
@@ -159,6 +159,7 @@ MemoryVector<byte> Client_Hello::serialize() const
extensions.add(new Server_Name_Indicator(m_hostname));
extensions.add(new SRP_Identifier(m_srp_identifier));
extensions.add(new Supported_Elliptic_Curves(m_supported_curves));
+ extensions.add(new Session_Ticket());
if(m_version >= Protocol_Version::TLS_V12)
extensions.add(new Signature_Algorithms(m_supported_algos));
diff --git a/src/tls/tls_extensions.cpp b/src/tls/tls_extensions.cpp
index d0d5b2c62..c1b62ef16 100644
--- a/src/tls/tls_extensions.cpp
+++ b/src/tls/tls_extensions.cpp
@@ -504,6 +504,12 @@ Signature_Algorithms::Signature_Algorithms(TLS_Data_Reader& reader,
}
}
+Session_Ticket::Session_Ticket(const TLS_Data_Reader& reader,
+ u16bit extension_size)
+ {
+
+ }
+
}
}
diff --git a/src/tls/tls_extensions.h b/src/tls/tls_extensions.h
index 1adb7f72b..c2b9091db 100644
--- a/src/tls/tls_extensions.h
+++ b/src/tls/tls_extensions.h
@@ -218,7 +218,7 @@ class Session_Ticket : public Extension
Handshake_Extension_Type type() const { return static_type(); }
- const MemoryVector<byte>& contents() const { return m_contents; }
+ const MemoryVector<byte>& contents() const { return m_ticket; }
/**
* Create empty extension, used by both client and server
@@ -229,21 +229,18 @@ class Session_Ticket : public Extension
* Extension with ticket, used by client
*/
Session_Ticket(const MemoryRegion<byte>& session_ticket) :
- m_contents(session_ticket) {}
+ m_ticket(session_ticket) {}
/**
* Deserialize a session ticket
*/
- Session_Ticket(const TLS_Data_Reader& reader, u16bit extension_size)
- {
- // FIXME
- }
+ Session_Ticket(const TLS_Data_Reader& reader, u16bit extension_size);
- MemoryVector<byte> serialize() const { return m_contents; }
+ MemoryVector<byte> serialize() const { return m_ticket; }
bool empty() const { return false; }
private:
- MemoryVector<byte> m_contents;
+ MemoryVector<byte> m_ticket;
};
/**
diff --git a/src/tls/tls_reader.h b/src/tls/tls_reader.h
index 162f691aa..f6b0d4088 100644
--- a/src/tls/tls_reader.h
+++ b/src/tls/tls_reader.h
@@ -50,6 +50,15 @@ class TLS_Data_Reader
offset += bytes;
}
+ u16bit get_u32bit()
+ {
+ assert_at_least(4);
+ u16bit result = make_u32bit(buf[offset ], buf[offset+1],
+ buf[offset+2], buf[offset+3]);
+ offset += 4;
+ return result;
+ }
+
u16bit get_u16bit()
{
assert_at_least(2);
diff --git a/src/tls/tls_session.cpp b/src/tls/tls_session.cpp
index 41d4a662d..ddf0661c6 100644
--- a/src/tls/tls_session.cpp
+++ b/src/tls/tls_session.cpp
@@ -138,7 +138,7 @@ Session::encrypt(const SymmetricKey& master_key,
" for key_name in TLS_Session::encrypt");
if(master_key.length() == 0)
- throw Decoding_Error("Session master_key not set");
+ throw Decoding_Error("Session encryption key not set");
std::auto_ptr<KDF> kdf(get_kdf("KDF2(SHA-256)"));