diff options
author | Jack Lloyd <[email protected]> | 2018-02-08 07:31:33 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-02-13 07:48:56 -0500 |
commit | af6b860d327e523503da694a7dca9316b6501e34 (patch) | |
tree | 8866a2f3f62cf1a9d1e7a6a33b2647c900267d0c /src/lib/tls/tls_text_policy.cpp | |
parent | 7f07e4a86c098715f93a453066ded0c1a6c63d55 (diff) |
Add a test of TLS handshake with custom curve (secp112r1 in this case)
Diffstat (limited to 'src/lib/tls/tls_text_policy.cpp')
-rw-r--r-- | src/lib/tls/tls_text_policy.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/lib/tls/tls_text_policy.cpp b/src/lib/tls/tls_text_policy.cpp index 28783a430..5c7a4b278 100644 --- a/src/lib/tls/tls_text_policy.cpp +++ b/src/lib/tls/tls_text_policy.cpp @@ -112,7 +112,7 @@ std::vector<Group_Params> Text_Policy::key_exchange_groups() const if(group_str.empty()) { // fall back to previously used name - group_str = get_str("ecc_curves"); + group_str = get_str("groups"); } if(group_str.empty()) @@ -127,11 +127,28 @@ std::vector<Group_Params> Text_Policy::key_exchange_groups() const if(group_id == Group_Params::NONE) { - // TODO accept hex codes in text file - continue; + try + { + size_t consumed = 0; + unsigned long ll_id = std::stoul(group_name, &consumed, 0); + if(consumed != group_name.size()) + continue; // some other cruft + + const uint16_t id = static_cast<uint16_t>(ll_id); + + if(id != ll_id) + continue; // integer too large + + group_id = static_cast<Group_Params>(id); + } + catch(...) + { + continue; + } } - groups.push_back(group_id); + if(group_id != Group_Params::NONE) + groups.push_back(group_id); } return groups; |