aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/s_kex.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-01-27 15:38:53 +0000
committerlloyd <[email protected]>2012-01-27 15:38:53 +0000
commit2d31f3fc1b1c88739e5babbd6a9e8cb3b80263de (patch)
tree59eeaeae4d678f3d251fb3bdf6b9d25aa79140b0 /src/tls/s_kex.cpp
parent3d3c7f45e64c2dab1b9558fc9da80cdd30175063 (diff)
Add client-side support for PSK kex. Tested against OpenSSL.
Diffstat (limited to 'src/tls/s_kex.cpp')
-rw-r--r--src/tls/s_kex.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/tls/s_kex.cpp b/src/tls/s_kex.cpp
index 3ebdc3027..b8aba344c 100644
--- a/src/tls/s_kex.cpp
+++ b/src/tls/s_kex.cpp
@@ -116,7 +116,12 @@ Server_Key_Exchange::Server_Key_Exchange(const MemoryRegion<byte>& buf,
* to be able to parse the whole thing anyway.
*/
- if(kex_algo == "DH")
+ if(kex_algo == "PSK")
+ {
+ std::string identity_hint = reader.get_string(2, 1, 65535);
+ append_tls_length_value(m_params, identity_hint, 2);
+ }
+ else if(kex_algo == "DH")
{
// 3 bigints, DH p, g, Y
@@ -149,8 +154,7 @@ Server_Key_Exchange::Server_Key_Exchange(const MemoryRegion<byte>& buf,
append_tls_length_value(m_params, ecdh_key, 1);
}
else
- throw Decoding_Error("Server_Key_Exchange: Unsupported server key exchange type " +
- kex_algo);
+ throw Decoding_Error("Server_Key_Exchange: Unsupported kex type " + kex_algo);
if(sig_algo != "")
{