diff options
author | lloyd <[email protected]> | 2012-01-24 14:35:54 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-01-24 14:35:54 +0000 |
commit | ff250652c0bd1d3c119e3007c1c1e89325b08277 (patch) | |
tree | 37617a48ecabfe11870495d851b5b67aeb997faa /src | |
parent | b10166e5ab51318857a4b59b4bf3f8ec75213b78 (diff) |
For ECDH you don't strip leading zeros. Bikeshedding: 1 Consistency: 0
Diffstat (limited to 'src')
-rw-r--r-- | src/tls/c_kex.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
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(...) { |