Get bssl tool building on Windows.
This lets us run bssl speed at least. bssl client is currently compiled out until we clean up our socket story on Windows and get it working. Change-Id: Ib1dc0d0e0a6eed7544207e7bbe138503731fda67 Reviewed-on: https://boringssl-review.googlesource.com/2103 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
f44aa68a26
commit
eee7306c72
@ -8,6 +8,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
elseif(MSVC)
|
||||
# Disable warnings for implicit integer narrowing.
|
||||
set(CMAKE_C_FLAGS "/wd4267")
|
||||
set(CMAKE_CXX_FLAGS "/wd4267")
|
||||
endif()
|
||||
|
||||
add_definitions(-DBORINGSSL_IMPLEMENTATION)
|
||||
|
@ -11,7 +11,7 @@ add_executable(
|
||||
tool.cc
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
if (APPLE OR WIN32)
|
||||
target_link_libraries(bssl ssl crypto)
|
||||
else()
|
||||
target_link_libraries(bssl ssl crypto -lrt)
|
||||
|
@ -14,6 +14,9 @@
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
// TODO(davidben): bssl client does not work on Windows.
|
||||
#if !defined(OPENSSL_WINDOWS)
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -299,3 +302,5 @@ bool Client(const std::vector<std::string> &args) {
|
||||
SSL_CTX_free(ctx);
|
||||
return ok;
|
||||
}
|
||||
|
||||
#endif // !OPENSSL_WINDOWS
|
@ -12,6 +12,8 @@
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -21,7 +23,11 @@
|
||||
#include <stdint.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#if defined(OPENSSL_WINDOWS)
|
||||
#include <io.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <openssl/bytestring.h>
|
||||
#include <openssl/pem.h>
|
||||
@ -31,6 +37,12 @@
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
#if defined(OPENSSL_WINDOWS)
|
||||
typedef int read_result_t;
|
||||
#else
|
||||
typedef ssize_t read_result_t;
|
||||
#endif
|
||||
|
||||
static const struct argument kArguments[] = {
|
||||
{
|
||||
"-dump", false, "Dump the key and contents of the given file to stdout",
|
||||
@ -64,7 +76,7 @@ bool DoPKCS12(const std::vector<std::string> &args) {
|
||||
const size_t size = st.st_size;
|
||||
|
||||
std::unique_ptr<uint8_t[]> contents(new uint8_t[size]);
|
||||
ssize_t n;
|
||||
read_result_t n;
|
||||
size_t off = 0;
|
||||
do {
|
||||
n = read(fd, &contents[off], size - off);
|
||||
|
@ -19,7 +19,9 @@
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
|
||||
#if !defined(OPENSSL_WINDOWS)
|
||||
bool Client(const std::vector<std::string> &args);
|
||||
#endif
|
||||
bool DoPKCS12(const std::vector<std::string> &args);
|
||||
bool Speed(const std::vector<std::string> &args);
|
||||
|
||||
@ -42,8 +44,10 @@ int main(int argc, char **argv) {
|
||||
|
||||
if (tool == "speed") {
|
||||
return !Speed(args);
|
||||
#if !defined(OPENSSL_WINDOWS)
|
||||
} else if (tool == "s_client" || tool == "client") {
|
||||
return !Client(args);
|
||||
#endif
|
||||
} else if (tool == "pkcs12") {
|
||||
return !DoPKCS12(args);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user