summaryrefslogtreecommitdiffstats
path: root/src/tool
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2015-09-25 00:26:37 +0000
committerKenny Root <kroot@google.com>2015-09-25 00:26:37 +0000
commita04d78d392463df4e69a64360c952ffa5abd22f7 (patch)
treedc62c249d595198e0d99e43890019d21e901fbec /src/tool
parent1e4884f615b20946411a74e41eb9c6aa65e2d5f3 (diff)
downloadexternal_boringssl-a04d78d392463df4e69a64360c952ffa5abd22f7.zip
external_boringssl-a04d78d392463df4e69a64360c952ffa5abd22f7.tar.gz
external_boringssl-a04d78d392463df4e69a64360c952ffa5abd22f7.tar.bz2
Revert "external/boringssl: sync with upstream."
This reverts commit 1e4884f615b20946411a74e41eb9c6aa65e2d5f3. This breaks some x86 builds. Change-Id: I4d4310663ce52bc0a130e6b9dbc22b868ff4fb25
Diffstat (limited to 'src/tool')
-rw-r--r--src/tool/CMakeLists.txt8
-rw-r--r--src/tool/args.cc27
-rw-r--r--src/tool/client.cc42
-rw-r--r--src/tool/const.cc120
-rw-r--r--src/tool/genrsa.cc69
-rw-r--r--src/tool/internal.h14
-rw-r--r--src/tool/server.cc50
-rw-r--r--src/tool/speed.cc33
-rw-r--r--src/tool/tool.cc18
-rw-r--r--src/tool/transport_common.cc2
10 files changed, 30 insertions, 353 deletions
diff --git a/src/tool/CMakeLists.txt b/src/tool/CMakeLists.txt
index 2d706ba..74c1ac8 100644
--- a/src/tool/CMakeLists.txt
+++ b/src/tool/CMakeLists.txt
@@ -7,7 +7,6 @@ add_executable(
client.cc
const.cc
digest.cc
- genrsa.cc
pkcs12.cc
rand.cc
server.cc
@@ -19,10 +18,5 @@ add_executable(
if (APPLE OR WIN32 OR ANDROID)
target_link_libraries(bssl ssl crypto)
else()
- find_library(FOUND_LIBRT rt)
- if (FOUND_LIBRT)
- target_link_libraries(bssl ssl crypto -lrt)
- else()
- target_link_libraries(bssl ssl crypto)
- endif()
+ target_link_libraries(bssl ssl crypto -lrt)
endif()
diff --git a/src/tool/args.cc b/src/tool/args.cc
index 9ec18a3..a164476 100644
--- a/src/tool/args.cc
+++ b/src/tool/args.cc
@@ -15,9 +15,7 @@
#include <string>
#include <vector>
-#include <limits.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include "internal.h"
@@ -77,28 +75,3 @@ void PrintUsage(const struct argument *templates) {
fprintf(stderr, "%s\t%s\n", templ->name, templ->description);
}
}
-
-bool GetUnsigned(unsigned *out, const std::string &arg_name,
- unsigned default_value,
- const std::map<std::string, std::string> &args) {
- const auto &it = args.find(arg_name);
- if (it == args.end()) {
- *out = default_value;
- return true;
- }
-
- const std::string &value = it->second;
- if (value.empty()) {
- return false;
- }
-
- char *endptr;
- unsigned long int num = strtoul(value.c_str(), &endptr, 10);
- if (*endptr ||
- num > UINT_MAX) {
- return false;
- }
-
- *out = num;
- return true;
-}
diff --git a/src/tool/client.cc b/src/tool/client.cc
index cd8353b..1de0df2 100644
--- a/src/tool/client.cc
+++ b/src/tool/client.cc
@@ -70,16 +70,6 @@ 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, "",
},
};
@@ -221,10 +211,7 @@ bool Client(const std::vector<std::string> &args) {
if (!pkey || !SSL_CTX_set1_tls_channel_id(ctx.get(), pkey.get())) {
return false;
}
- }
-
- if (args_map.count("-false-start") != 0) {
- SSL_CTX_set_mode(ctx.get(), SSL_MODE_ENABLE_FALSE_START);
+ ctx->tlsext_channel_id_enabled_new = 1;
}
int sock = -1;
@@ -239,23 +226,6 @@ 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();
@@ -270,16 +240,6 @@ 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;
diff --git a/src/tool/const.cc b/src/tool/const.cc
index 7b7001e..5222667 100644
--- a/src/tool/const.cc
+++ b/src/tool/const.cc
@@ -15,10 +15,9 @@
#include <stddef.h>
#include <stdint.h>
-#include "internal.h"
+extern "C" {
-
-const uint8_t kDERRSAPrivate2048[] = {
+uint8_t kDERRSAPrivate2048[] = {
0x30, 0x82, 0x04, 0xa3, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00,
0xd0, 0x02, 0xde, 0x5d, 0x19, 0x33, 0x48, 0x15, 0xc7, 0x86, 0xde, 0xa3,
0xec, 0x63, 0x89, 0x14, 0x63, 0x99, 0x30, 0x1f, 0x5d, 0x25, 0xb2, 0xfa,
@@ -121,9 +120,9 @@ const uint8_t kDERRSAPrivate2048[] = {
0x77, 0xe6, 0xd3,
};
-const size_t kDERRSAPrivate2048Len = sizeof(kDERRSAPrivate2048);
+size_t kDERRSAPrivate2048Len = sizeof(kDERRSAPrivate2048);
-const uint8_t kDERRSAPrivate4096[] = {
+uint8_t kDERRSAPrivate4096[] = {
0x30, 0x82, 0x09, 0x28, 0x02, 0x01, 0x00, 0x02, 0x82, 0x02, 0x01, 0x00,
0xc3, 0x82, 0x01, 0xda, 0x03, 0xe1, 0x0d, 0x78, 0xf4, 0x86, 0xf1, 0x28,
0xf0, 0x4c, 0x34, 0xa6, 0x73, 0x0c, 0xfb, 0x22, 0xfa, 0x35, 0xc9, 0x3a,
@@ -322,113 +321,6 @@ const uint8_t kDERRSAPrivate4096[] = {
0x59, 0x8e, 0xd7, 0x45, 0x87, 0x86, 0x05, 0x9d,
};
-const size_t kDERRSAPrivate4096Len = sizeof(kDERRSAPrivate4096);
-
-const uint8_t kDERRSAPrivate3Prime2048[] = {
- 0x30, 0x82, 0x04, 0xd7, 0x02, 0x01, 0x01, 0x02, 0x82, 0x01, 0x00, 0x62,
- 0x91, 0xe9, 0xea, 0xb3, 0x5d, 0x6c, 0x29, 0xae, 0x21, 0x83, 0xbb, 0xb5,
- 0x82, 0xb1, 0x9e, 0xea, 0xe0, 0x64, 0x5b, 0x1e, 0x2f, 0x5e, 0x2c, 0x0a,
- 0x80, 0x3d, 0x29, 0xd4, 0xfa, 0x9a, 0xe7, 0x44, 0xe6, 0x21, 0xbd, 0x98,
- 0xc0, 0x3d, 0xe0, 0x53, 0x59, 0xae, 0xd3, 0x3e, 0xfe, 0xc4, 0xc2, 0xc4,
- 0x5a, 0x5a, 0x89, 0x07, 0xf4, 0x4f, 0xdc, 0xb0, 0x6a, 0xd4, 0x3e, 0x99,
- 0x7d, 0x7a, 0x97, 0x26, 0x4e, 0xe1, 0x93, 0xca, 0x6e, 0xed, 0x07, 0xfc,
- 0xb4, 0xfa, 0x95, 0x1e, 0x73, 0x7b, 0x86, 0x08, 0x6a, 0xb9, 0xd4, 0x29,
- 0xb0, 0x7e, 0x59, 0xb7, 0x9d, 0x7b, 0xeb, 0x67, 0x6e, 0xf0, 0xbb, 0x5e,
- 0xcf, 0xb9, 0xcd, 0x58, 0x93, 0xf0, 0xe7,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xca, 0xf5, 0xf2, 0x87, 0x5d, 0x31, 0xaf,
- 0xe9, 0x32, 0xcd, 0x10, 0xfd, 0x4d, 0xdb, 0xf9, 0x86, 0x05, 0x12, 0x1b,
- 0x01, 0x84, 0x55, 0x97, 0x5f, 0xe2, 0x78, 0x27, 0xd9, 0xe4, 0x26, 0x7d,
- 0xab, 0x0e, 0xe0, 0x1b, 0x6f, 0xcb, 0x4b, 0x14, 0xdd, 0xdc, 0xdc, 0x8b,
- 0xe8, 0x9f, 0xd0, 0x62, 0x96, 0xca, 0xcf,
-};
+size_t kDERRSAPrivate4096Len = sizeof(kDERRSAPrivate4096);
-const size_t kDERRSAPrivate3Prime2048Len = sizeof(kDERRSAPrivate3Prime2048);
+}
diff --git a/src/tool/genrsa.cc b/src/tool/genrsa.cc
deleted file mode 100644
index 4b39401..0000000
--- a/src/tool/genrsa.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Copyright (c) 2015, Google Inc.
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
-
-#include <openssl/bio.h>
-#include <openssl/bn.h>
-#include <openssl/err.h>
-#include <openssl/pem.h>
-#include <openssl/rsa.h>
-
-#include "../crypto/test/scoped_types.h"
-#include "internal.h"
-
-
-static const struct argument kArguments[] = {
- {
- "-nprimes", kOptionalArgument,
- "The number of primes to generate (default: 2)",
- },
- {
- "-bits", kOptionalArgument,
- "The number of bits in the modulus (default: 2048)",
- },
- {
- "", kOptionalArgument, "",
- },
-};
-
-bool GenerateRSAKey(const std::vector<std::string> &args) {
- std::map<std::string, std::string> args_map;
-
- if (!ParseKeyValueArguments(&args_map, args, kArguments)) {
- PrintUsage(kArguments);
- return false;
- }
-
- unsigned bits, nprimes = 0;
- if (!GetUnsigned(&bits, "-bits", 2048, args_map) ||
- !GetUnsigned(&nprimes, "-nprimes", 2, args_map)) {
- PrintUsage(kArguments);
- return false;
- }
-
- ScopedRSA rsa(RSA_new());
- ScopedBIGNUM e(BN_new());
- ScopedBIO bio(BIO_new_fp(stdout, BIO_NOCLOSE));
-
- if (!BN_set_word(e.get(), RSA_F4) ||
- !RSA_generate_multi_prime_key(rsa.get(), bits, nprimes, e.get(), NULL) ||
- !PEM_write_bio_RSAPrivateKey(bio.get(), rsa.get(), NULL /* cipher */,
- NULL /* key */, 0 /* key len */,
- NULL /* password callback */,
- NULL /* callback arg */)) {
- ERR_print_errors_fp(stderr);
- return false;
- }
-
- return true;
-}
diff --git a/src/tool/internal.h b/src/tool/internal.h
index 84f8c4d..277d099 100644
--- a/src/tool/internal.h
+++ b/src/tool/internal.h
@@ -15,8 +15,6 @@
#ifndef OPENSSL_HEADER_TOOL_INTERNAL_H
#define OPENSSL_HEADER_TOOL_INTERNAL_H
-#include <openssl/base.h>
-
#include <string>
#include <vector>
@@ -51,17 +49,5 @@ bool ParseKeyValueArguments(std::map<std::string, std::string> *out_args, const
void PrintUsage(const struct argument *templates);
-bool GetUnsigned(unsigned *out, const std::string &arg_name,
- unsigned default_value,
- const std::map<std::string, std::string> &args);
-
-// These values are DER encoded, RSA private keys.
-extern const uint8_t kDERRSAPrivate2048[];
-extern const size_t kDERRSAPrivate2048Len;
-extern const uint8_t kDERRSAPrivate4096[];
-extern const size_t kDERRSAPrivate4096Len;
-extern const uint8_t kDERRSAPrivate3Prime2048[];
-extern const size_t kDERRSAPrivate3Prime2048Len;
-
#endif /* !OPENSSL_HEADER_TOOL_INTERNAL_H */
diff --git a/src/tool/server.cc b/src/tool/server.cc
index abc71cf..164d6a5 100644
--- a/src/tool/server.cc
+++ b/src/tool/server.cc
@@ -35,54 +35,10 @@ static const struct argument kArguments[] = {
"Private-key file to use (default is server.pem)",
},
{
- "-ocsp-response", kOptionalArgument,
- "OCSP response file to send",
- },
- {
"", kOptionalArgument, "",
},
};
-static bool LoadOCSPResponse(SSL_CTX *ctx, const char *filename) {
- void *data = NULL;
- bool ret = false;
- size_t bytes_read;
- long length;
-
- FILE *f = fopen(filename, "rb");
-
- if (f == NULL ||
- fseek(f, 0, SEEK_END) != 0) {
- goto out;
- }
-
- length = ftell(f);
- if (length < 0) {
- goto out;
- }
-
- data = malloc(length);
- if (data == NULL) {
- goto out;
- }
- rewind(f);
-
- bytes_read = fread(data, 1, length, f);
- if (ferror(f) != 0 ||
- bytes_read != (size_t)length ||
- !SSL_CTX_set_ocsp_response(ctx, (uint8_t*)data, bytes_read)) {
- goto out;
- }
-
- ret = true;
-out:
- if (f != NULL) {
- fclose(f);
- }
- free(data);
- return ret;
-}
-
bool Server(const std::vector<std::string> &args) {
if (!InitSocketLibrary()) {
return false;
@@ -118,12 +74,6 @@ bool Server(const std::vector<std::string> &args) {
return false;
}
- if (args_map.count("-ocsp-response") != 0 &&
- !LoadOCSPResponse(ctx, args_map["-ocsp-response"].c_str())) {
- fprintf(stderr, "Failed to load OCSP response: %s\n", args_map["-ocsp-response"].c_str());
- return false;
- }
-
int sock = -1;
if (!Accept(&sock, args_map["-accept"])) {
return false;
diff --git a/src/tool/speed.cc b/src/tool/speed.cc
index 307b0b9..ab17c2f 100644
--- a/src/tool/speed.cc
+++ b/src/tool/speed.cc
@@ -36,9 +36,16 @@
#endif
#include "../crypto/test/scoped_types.h"
-#include "internal.h"
+extern "C" {
+// These values are DER encoded, RSA private keys.
+extern const uint8_t kDERRSAPrivate2048[];
+extern size_t kDERRSAPrivate2048Len;
+extern const uint8_t kDERRSAPrivate4096[];
+extern size_t kDERRSAPrivate4096Len;
+}
+
// TimeResults represents the results of benchmarking a function.
struct TimeResults {
// num_calls is the number of function calls done in the time period.
@@ -407,9 +414,9 @@ bool Speed(const std::vector<std::string> &args) {
selected = args[0];
}
- RSA *key = RSA_private_key_from_bytes(kDERRSAPrivate2048,
- kDERRSAPrivate2048Len);
- if (key == NULL) {
+ RSA *key = NULL;
+ const uint8_t *inp = kDERRSAPrivate2048;
+ if (NULL == d2i_RSAPrivateKey(&key, &inp, kDERRSAPrivate2048Len)) {
fprintf(stderr, "Failed to parse RSA key.\n");
ERR_print_errors_fp(stderr);
return false;
@@ -420,22 +427,10 @@ bool Speed(const std::vector<std::string> &args) {
}
RSA_free(key);
- key = RSA_private_key_from_bytes(kDERRSAPrivate3Prime2048,
- kDERRSAPrivate3Prime2048Len);
- if (key == NULL) {
- fprintf(stderr, "Failed to parse RSA key.\n");
- ERR_print_errors_fp(stderr);
- return false;
- }
+ key = NULL;
- if (!SpeedRSA("RSA 2048 (3 prime, e=3)", key, selected)) {
- return false;
- }
-
- RSA_free(key);
- key = RSA_private_key_from_bytes(kDERRSAPrivate4096,
- kDERRSAPrivate4096Len);
- if (key == NULL) {
+ inp = kDERRSAPrivate4096;
+ if (NULL == d2i_RSAPrivateKey(&key, &inp, kDERRSAPrivate4096Len)) {
fprintf(stderr, "Failed to parse 4096-bit RSA key.\n");
ERR_print_errors_fp(stderr);
return 1;
diff --git a/src/tool/tool.cc b/src/tool/tool.cc
index e4d5201..4bd7d1a 100644
--- a/src/tool/tool.cc
+++ b/src/tool/tool.cc
@@ -27,17 +27,16 @@
bool Client(const std::vector<std::string> &args);
-bool DoPKCS12(const std::vector<std::string> &args);
-bool GenerateRSAKey(const std::vector<std::string> &args);
+bool Server(const std::vector<std::string> &args);
bool MD5Sum(const std::vector<std::string> &args);
-bool Rand(const std::vector<std::string> &args);
bool SHA1Sum(const std::vector<std::string> &args);
bool SHA224Sum(const std::vector<std::string> &args);
bool SHA256Sum(const std::vector<std::string> &args);
bool SHA384Sum(const std::vector<std::string> &args);
bool SHA512Sum(const std::vector<std::string> &args);
-bool Server(const std::vector<std::string> &args);
+bool DoPKCS12(const std::vector<std::string> &args);
bool Speed(const std::vector<std::string> &args);
+bool Rand(const std::vector<std::string> &args);
typedef bool (*tool_func_t)(const std::vector<std::string> &args);
@@ -47,20 +46,19 @@ struct Tool {
};
static const Tool kTools[] = {
- { "client", Client },
- { "genrsa", GenerateRSAKey },
- { "md5sum", MD5Sum },
+ { "speed", Speed },
{ "pkcs12", DoPKCS12 },
- { "rand", Rand },
+ { "client", Client },
{ "s_client", Client },
- { "s_server", Server },
{ "server", Server },
+ { "s_server", Server },
+ { "md5sum", MD5Sum },
{ "sha1sum", SHA1Sum },
{ "sha224sum", SHA224Sum },
{ "sha256sum", SHA256Sum },
{ "sha384sum", SHA384Sum },
{ "sha512sum", SHA512Sum },
- { "speed", Speed },
+ { "rand", Rand },
{ "", nullptr },
};
diff --git a/src/tool/transport_common.cc b/src/tool/transport_common.cc
index 98f0f95..3f5e631 100644
--- a/src/tool/transport_common.cc
+++ b/src/tool/transport_common.cc
@@ -169,8 +169,6 @@ void PrintConnectionInfo(const SSL *ssl) {
const SSL_CIPHER *cipher = SSL_get_current_cipher(ssl);
fprintf(stderr, " Version: %s\n", SSL_get_version(ssl));
- fprintf(stderr, " Resumed session: %s\n",
- SSL_session_reused(ssl) ? "yes" : "no");
fprintf(stderr, " Cipher: %s\n", SSL_CIPHER_get_name(cipher));
fprintf(stderr, " Secure renegotiation: %s\n",
SSL_get_secure_renegotiation_support(ssl) ? "yes" : "no");