summaryrefslogtreecommitdiffstats
path: root/src/tool/client.cc
diff options
context:
space:
mode:
authorAdam Langley <agl@google.com>2015-09-24 10:57:52 -0700
committerAdam Langley <agl@google.com>2015-09-24 11:04:03 -0700
commit1e4884f615b20946411a74e41eb9c6aa65e2d5f3 (patch)
treedd743d9d64af3145fe96b8d5fc2f3427544794bd /src/tool/client.cc
parent08656b61d075740bfb24ddcce65223146259fc02 (diff)
downloadexternal_boringssl-1e4884f615b20946411a74e41eb9c6aa65e2d5f3.zip
external_boringssl-1e4884f615b20946411a74e41eb9c6aa65e2d5f3.tar.gz
external_boringssl-1e4884f615b20946411a74e41eb9c6aa65e2d5f3.tar.bz2
external/boringssl: sync with upstream.
This change imports the current version of BoringSSL. The only local change now is that |BORINGSSL_201509| is defined in base.h. This allows this change to be made without (hopefully) breaking the build. This change will need https://android-review.googlesource.com/172744 to be landed afterwards to update a test. Change-Id: I6d1f463f7785a2423bd846305af91c973c326104
Diffstat (limited to 'src/tool/client.cc')
-rw-r--r--src/tool/client.cc42
1 files changed, 41 insertions, 1 deletions
diff --git a/src/tool/client.cc b/src/tool/client.cc
index 1de0df2..cd8353b 100644
--- a/src/tool/client.cc
+++ b/src/tool/client.cc
@@ -70,6 +70,16 @@ static const struct argument kArguments[] = {
"The key to use for signing a channel ID",
},
{
+ "-false-start", kBooleanArgument,
+ "Enable False Start",
+ },
+ { "-session-in", kOptionalArgument,
+ "A file containing a session to resume.",
+ },
+ { "-session-out", kOptionalArgument,
+ "A file to write the negotiated session to.",
+ },
+ {
"", kOptionalArgument, "",
},
};
@@ -211,7 +221,10 @@ bool Client(const std::vector<std::string> &args) {
if (!pkey || !SSL_CTX_set1_tls_channel_id(ctx.get(), pkey.get())) {
return false;
}
- ctx->tlsext_channel_id_enabled_new = 1;
+ }
+
+ if (args_map.count("-false-start") != 0) {
+ SSL_CTX_set_mode(ctx.get(), SSL_MODE_ENABLE_FALSE_START);
}
int sock = -1;
@@ -226,6 +239,23 @@ bool Client(const std::vector<std::string> &args) {
SSL_set_tlsext_host_name(ssl.get(), args_map["-server-name"].c_str());
}
+ if (args_map.count("-session-in") != 0) {
+ ScopedBIO in(BIO_new_file(args_map["-session-in"].c_str(), "rb"));
+ if (!in) {
+ fprintf(stderr, "Error reading session\n");
+ ERR_print_errors_cb(PrintErrorCallback, stderr);
+ return false;
+ }
+ ScopedSSL_SESSION session(PEM_read_bio_SSL_SESSION(in.get(), nullptr,
+ nullptr, nullptr));
+ if (!session) {
+ fprintf(stderr, "Error reading session\n");
+ ERR_print_errors_cb(PrintErrorCallback, stderr);
+ return false;
+ }
+ SSL_set_session(ssl.get(), session.get());
+ }
+
SSL_set_bio(ssl.get(), bio.get(), bio.get());
bio.release();
@@ -240,6 +270,16 @@ bool Client(const std::vector<std::string> &args) {
fprintf(stderr, "Connected.\n");
PrintConnectionInfo(ssl.get());
+ if (args_map.count("-session-out") != 0) {
+ ScopedBIO out(BIO_new_file(args_map["-session-out"].c_str(), "wb"));
+ if (!out ||
+ !PEM_write_bio_SSL_SESSION(out.get(), SSL_get0_session(ssl.get()))) {
+ fprintf(stderr, "Error while saving session:\n");
+ ERR_print_errors_cb(PrintErrorCallback, stderr);
+ return false;
+ }
+ }
+
bool ok = TransferData(ssl.get(), sock);
return ok;