aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/s_hello.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-01-20 13:52:54 +0000
committerlloyd <[email protected]>2012-01-20 13:52:54 +0000
commitf7f94a9ade8869caca24aed9bde92bce117991f7 (patch)
tree281baefc47b4ad9287a4b48d9c5d55dec32278fd /src/tls/s_hello.cpp
parent4c3d3e1c56451c635fb81dadfb249ce1856af0ce (diff)
Many fixes for TLS 1.2 though some things in particular client auth
remain broken. New interface for querying the TLS extensions, much cleaner.
Diffstat (limited to 'src/tls/s_hello.cpp')
-rw-r--r--src/tls/s_hello.cpp34
1 files changed, 13 insertions, 21 deletions
diff --git a/src/tls/s_hello.cpp b/src/tls/s_hello.cpp
index 652544806..e6aff94e3 100644
--- a/src/tls/s_hello.cpp
+++ b/src/tls/s_hello.cpp
@@ -123,25 +123,17 @@ Server_Hello::Server_Hello(const MemoryRegion<byte>& buf)
TLS_Extensions extensions(reader);
- for(size_t i = 0; i != extensions.count(); ++i)
+ if(Renegotation_Extension* reneg = extensions.get<Renegotation_Extension>())
{
- TLS_Extension* extn = extensions.at(i);
-
- if(Renegotation_Extension* reneg = dynamic_cast<Renegotation_Extension*>(extn))
- {
- // checked by TLS_Client / TLS_Server as they know the handshake state
- m_secure_renegotiation = true;
- m_renegotiation_info = reneg->renegotiation_info();
- }
- else if(Next_Protocol_Notification* npn = dynamic_cast<Next_Protocol_Notification*>(extn))
- {
- m_next_protocols = npn->protocols();
- m_next_protocol = true;
- }
- else if(Signature_Algorithms* sigs = dynamic_cast<Signature_Algorithms*>(extn))
- {
- // save in handshake state
- }
+ // checked by TLS_Client / TLS_Server as they know the handshake state
+ m_secure_renegotiation = true;
+ m_renegotiation_info = reneg->renegotiation_info();
+ }
+
+ if(Next_Protocol_Notification* npn = extensions.get<Next_Protocol_Notification>())
+ {
+ m_next_protocols = npn->protocols();
+ m_next_protocol = true;
}
}
@@ -166,13 +158,13 @@ MemoryVector<byte> Server_Hello::serialize() const
TLS_Extensions extensions;
if(m_secure_renegotiation)
- extensions.push_back(new Renegotation_Extension(m_renegotiation_info));
+ extensions.add(new Renegotation_Extension(m_renegotiation_info));
if(m_fragment_size != 0)
- extensions.push_back(new Maximum_Fragment_Length(m_fragment_size));
+ extensions.add(new Maximum_Fragment_Length(m_fragment_size));
if(m_next_protocol)
- extensions.push_back(new Next_Protocol_Notification(m_next_protocols));
+ extensions.add(new Next_Protocol_Notification(m_next_protocols));
buf += extensions.serialize();