Use names for the TLS 1.3 variants in bssl client.

Change-Id: I09d6b05675b82ed04a9665c64b632d1a156fa977
Reviewed-on: https://boringssl-review.googlesource.com/18985
Reviewed-by: Steven Valdez <svaldez@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
This commit is contained in:
David Benjamin 2017-08-08 20:09:17 -04:00
parent f6ae9e6c2c
commit 590b677d48

View File

@ -297,6 +297,26 @@ static bool DoConnection(SSL_CTX *ctx,
return cb(ssl.get(), sock); return cb(ssl.get(), sock);
} }
static bool GetTLS13Variant(tls13_variant_t *out, const std::string &in) {
if (in == "draft") {
*out = tls13_default;
return true;
}
if (in == "experiment") {
*out = tls13_experiment;
return true;
}
if (in == "record-type") {
*out = tls13_record_type_experiment;
return true;
}
if (in == "no-session-id") {
*out = tls13_no_session_id_experiment;
return true;
}
return false;
}
bool Client(const std::vector<std::string> &args) { bool Client(const std::vector<std::string> &args) {
if (!InitSocketLibrary()) { if (!InitSocketLibrary()) {
return false; return false;
@ -464,9 +484,13 @@ bool Client(const std::vector<std::string> &args) {
} }
if (args_map.count("-tls13-variant") != 0) { if (args_map.count("-tls13-variant") != 0) {
SSL_CTX_set_tls13_variant(ctx.get(), tls13_variant_t variant;
static_cast<enum tls13_variant_t>( if (!GetTLS13Variant(&variant, args_map["-tls13-variant"])) {
atoi(args_map["-tls13-variant"].c_str()))); fprintf(stderr, "Unknown TLS 1.3 variant: %s\n",
args_map["-tls13-variant"].c_str());
return false;
}
SSL_CTX_set_tls13_variant(ctx.get(), variant);
} }
if (args_map.count("-ed25519") != 0) { if (args_map.count("-ed25519") != 0) {