From ff250652c0bd1d3c119e3007c1c1e89325b08277 Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 24 Jan 2012 14:35:54 +0000 Subject: For ECDH you don't strip leading zeros. Bikeshedding: 1 Consistency: 0 --- src/tls/c_kex.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/tls/c_kex.cpp') diff --git a/src/tls/c_kex.cpp b/src/tls/c_kex.cpp index 4724b007a..901d9e004 100644 --- a/src/tls/c_kex.cpp +++ b/src/tls/c_kex.cpp @@ -103,8 +103,7 @@ Client_Key_Exchange::Client_Key_Exchange(Record_Writer& writer, PK_Key_Agreement ka(priv_key, "Raw"); - pre_master = strip_leading_zeros( - ka.derive_key(0, counterparty_key.public_value()).bits_of()); + pre_master = ka.derive_key(0, counterparty_key.public_value()).bits_of(); append_tls_length_value(key_material, priv_key.public_value(), 1); } @@ -207,7 +206,10 @@ Client_Key_Exchange::pre_master_secret(RandomNumberGenerator& rng, try { PK_Key_Agreement ka(*dh, "Raw"); - pre_master = strip_leading_zeros(ka.derive_key(0, key_material).bits_of()); + if(dh->algo_name() == "DH") + pre_master = strip_leading_zeros(ka.derive_key(0, key_material).bits_of()); + else + pre_master = ka.derive_key(0, key_material).bits_of(); } catch(...) { -- cgit v1.2.3