From 5b280a80dfdb70939d725cd22a1a0a902c2fdbef Mon Sep 17 00:00:00 2001 From: Andres Erbsen Date: Mon, 30 Oct 2017 15:58:33 +0000 Subject: [PATCH] Move curve25519 code to third_party/fiat. This change doesn't actually introduce any Fiat code yet. It sets up the directory structure to make the diffs in the next change clearer. Change-Id: I38a21fb36b18a08b0907f9d37b7ef5d7d3137ede Reviewed-on: https://boringssl-review.googlesource.com/22624 Reviewed-by: David Benjamin --- CMakeLists.txt | 1 + LICENSE | 3 ++- crypto/CMakeLists.txt | 1 + crypto/curve25519/CMakeLists.txt | 1 - crypto/curve25519/spake25519.c | 2 +- crypto/curve25519/spake25519_test.cc | 2 +- crypto/curve25519/x25519-x86_64.c | 2 +- third_party/fiat/CMakeLists.txt | 9 +++++++++ {crypto/curve25519 => third_party/fiat}/curve25519.c | 2 +- {crypto/curve25519 => third_party/fiat}/internal.h | 0 util/generate_build_files.py | 8 +++++--- 11 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 third_party/fiat/CMakeLists.txt rename {crypto/curve25519 => third_party/fiat}/curve25519.c (99%) rename {crypto/curve25519 => third_party/fiat}/internal.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f2f6ba02..338f212ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -338,6 +338,7 @@ add_custom_command( add_library(crypto_test_data OBJECT crypto_test_data.cc) add_subdirectory(crypto) +add_subdirectory(third_party/fiat) add_subdirectory(ssl) add_subdirectory(ssl/test) add_subdirectory(fipstools) diff --git a/LICENSE b/LICENSE index a25996f72..9eb5bb493 100644 --- a/LICENSE +++ b/LICENSE @@ -6,7 +6,8 @@ Contributors to BoringSSL are required to follow the CLA rules for Chromium: https://cla.developers.google.com/clas Some files from Intel are under yet another license, which is also included -underneath. +underneath. Files in third_party/ have their own licenses, as described +therein. The OpenSSL toolkit stays under a dual license, i.e. both the conditions of the OpenSSL License and the original SSLeay license apply to the toolkit. See below diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index ae5d0b635..640f20693 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -179,6 +179,7 @@ add_library( $ $ $ + $ $ $ $ diff --git a/crypto/curve25519/CMakeLists.txt b/crypto/curve25519/CMakeLists.txt index c6004d3bc..6f51d54ff 100644 --- a/crypto/curve25519/CMakeLists.txt +++ b/crypto/curve25519/CMakeLists.txt @@ -21,7 +21,6 @@ add_library( OBJECT - curve25519.c spake25519.c x25519-x86_64.c diff --git a/crypto/curve25519/spake25519.c b/crypto/curve25519/spake25519.c index 9b8d43c32..e0ff9baee 100644 --- a/crypto/curve25519/spake25519.c +++ b/crypto/curve25519/spake25519.c @@ -22,8 +22,8 @@ #include #include -#include "internal.h" #include "../internal.h" +#include "../../third_party/fiat/internal.h" // The following precomputation tables are for the following diff --git a/crypto/curve25519/spake25519_test.cc b/crypto/curve25519/spake25519_test.cc index 3ebd0a963..71c977135 100644 --- a/crypto/curve25519/spake25519_test.cc +++ b/crypto/curve25519/spake25519_test.cc @@ -23,7 +23,7 @@ #include #include "../internal.h" -#include "internal.h" +#include "../../third_party/fiat/internal.h" // TODO(agl): add tests with fixed vectors once SPAKE2 is nailed down. diff --git a/crypto/curve25519/x25519-x86_64.c b/crypto/curve25519/x25519-x86_64.c index d677b52ee..41db0bddc 100644 --- a/crypto/curve25519/x25519-x86_64.c +++ b/crypto/curve25519/x25519-x86_64.c @@ -24,7 +24,7 @@ #include #include "../internal.h" -#include "internal.h" +#include "../../third_party/fiat/internal.h" #if defined(BORINGSSL_X25519_X86_64) diff --git a/third_party/fiat/CMakeLists.txt b/third_party/fiat/CMakeLists.txt new file mode 100644 index 000000000..fcc77d52b --- /dev/null +++ b/third_party/fiat/CMakeLists.txt @@ -0,0 +1,9 @@ +include_directories(../../include) + +add_library( + fiat + + OBJECT + + curve25519.c +) diff --git a/crypto/curve25519/curve25519.c b/third_party/fiat/curve25519.c similarity index 99% rename from crypto/curve25519/curve25519.c rename to third_party/fiat/curve25519.c index 1496134a5..b1354817b 100644 --- a/crypto/curve25519/curve25519.c +++ b/third_party/fiat/curve25519.c @@ -30,7 +30,7 @@ #include #include "internal.h" -#include "../internal.h" +#include "../../crypto/internal.h" static const int64_t kBottom25Bits = INT64_C(0x1ffffff); diff --git a/crypto/curve25519/internal.h b/third_party/fiat/internal.h similarity index 100% rename from crypto/curve25519/internal.h rename to third_party/fiat/internal.h diff --git a/util/generate_build_files.py b/util/generate_build_files.py index 738484d41..4b4a89912 100644 --- a/util/generate_build_files.py +++ b/util/generate_build_files.py @@ -587,7 +587,8 @@ def ExtractVariablesFromCMakeFile(cmakefile): def main(platforms): cmake = ExtractVariablesFromCMakeFile(os.path.join('src', 'sources.cmake')) - crypto_c_files = FindCFiles(os.path.join('src', 'crypto'), NoTestsNorFIPSFragments) + crypto_c_files = (FindCFiles(os.path.join('src', 'crypto'), NoTestsNorFIPSFragments) + + FindCFiles(os.path.join('src', 'third_party', 'fiat'), NoTestsNorFIPSFragments)) fips_fragments = FindCFiles(os.path.join('src', 'crypto', 'fipsmodule'), OnlyFIPSFragments) ssl_source_files = FindCFiles(os.path.join('src', 'ssl'), NoTests) tool_c_files = FindCFiles(os.path.join('src', 'tool'), NoTests) @@ -638,8 +639,9 @@ def main(platforms): NotSSLHeaderFiles)) ssl_internal_h_files = FindHeaderFiles(os.path.join('src', 'ssl'), NoTests) - crypto_internal_h_files = FindHeaderFiles( - os.path.join('src', 'crypto'), NoTests) + crypto_internal_h_files = ( + FindHeaderFiles(os.path.join('src', 'crypto'), NoTests) + + FindHeaderFiles(os.path.join('src', 'third_party', 'fiat'), NoTests)) files = { 'crypto': crypto_c_files,