diff options
author | David Benjamin <davidben@chromium.org> | 2014-10-31 16:01:29 -0400 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2014-10-31 22:02:01 +0000 |
commit | eee7306c726c179284de801e9f021a8021fc926b (patch) | |
tree | acea305b5337a010568e50e6484e6279fd336d12 | |
parent | f44aa68a265bb27d9c8c23585f8a2723a27124c5 (diff) | |
download | src-eee7306c726c179284de801e9f021a8021fc926b.tar.gz |
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>
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | tool/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tool/client.cc | 5 | ||||
-rw-r--r-- | tool/pkcs12.cc | 14 | ||||
-rw-r--r-- | tool/tool.cc | 4 |
5 files changed, 24 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index add0c1a..bdfaee4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/tool/CMakeLists.txt b/tool/CMakeLists.txt index e513c8b..e504838 100644 --- a/tool/CMakeLists.txt +++ b/tool/CMakeLists.txt @@ -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) diff --git a/tool/client.cc b/tool/client.cc index 6cc93d6..21ea8ba 100644 --- a/tool/client.cc +++ b/tool/client.cc @@ -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
\ No newline at end of file diff --git a/tool/pkcs12.cc b/tool/pkcs12.cc index d35ba0b..fca8bb2 100644 --- a/tool/pkcs12.cc +++ b/tool/pkcs12.cc @@ -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); diff --git a/tool/tool.cc b/tool/tool.cc index a0866d7..f35cc7c 100644 --- a/tool/tool.cc +++ b/tool/tool.cc @@ -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 { |