update main-with-bazel from master branch

This commit is contained in:
BoringSSL Robot
2024-03-23 16:28:21 +00:00
15 changed files with 416 additions and 6285 deletions
-1
View File
@@ -693,7 +693,6 @@ crypto_sources_nasm = [
pki_headers = [
"src/include/openssl/pki/certificate.h",
"src/include/openssl/pki/signature_verify_cache.h",
"src/include/openssl/pki/verify_error.h",
]
pki_internal_headers = [
+3 -2
View File
@@ -61,9 +61,12 @@ test_support_sources = [
"src/crypto/test/abi_test.h",
"src/crypto/test/file_test.cc",
"src/crypto/test/file_test.h",
"src/crypto/test/file_test_gtest.cc",
"src/crypto/test/file_util.cc",
"src/crypto/test/file_util.h",
"src/crypto/test/gtest_main.h",
"src/crypto/test/test_data.cc",
"src/crypto/test/test_data.h",
"src/crypto/test/test_util.cc",
"src/crypto/test/test_util.h",
"src/crypto/test/wycheproof_util.cc",
@@ -131,7 +134,6 @@ test_support_sources = [
]
crypto_test_sources = [
"crypto_test_data.cc",
"src/crypto/abi_self_test.cc",
"src/crypto/asn1/asn1_test.cc",
"src/crypto/base64/base64_test.cc",
@@ -195,7 +197,6 @@ crypto_test_sources = [
"src/crypto/siphash/siphash_test.cc",
"src/crypto/spx/spx_test.cc",
"src/crypto/stack/stack_test.cc",
"src/crypto/test/file_test_gtest.cc",
"src/crypto/test/gtest_main.cc",
"src/crypto/thread_test.cc",
"src/crypto/trust_token/trust_token_test.cc",
-6151
View File
File diff suppressed because one or more lines are too long
+4 -4
View File
@@ -556,7 +556,6 @@
"src/gen/test_support/trampoline-x86_64-win.asm"
],
"crypto_test": [
"crypto_test_data.cc",
"src/crypto/abi_self_test.cc",
"src/crypto/asn1/asn1_test.cc",
"src/crypto/base64/base64_test.cc",
@@ -620,7 +619,6 @@
"src/crypto/siphash/siphash_test.cc",
"src/crypto/spx/spx_test.cc",
"src/crypto/stack/stack_test.cc",
"src/crypto/test/file_test_gtest.cc",
"src/crypto/test/gtest_main.cc",
"src/crypto/thread_test.cc",
"src/crypto/trust_token/trust_token_test.cc",
@@ -1018,8 +1016,7 @@
],
"pki_headers": [
"src/include/openssl/pki/certificate.h",
"src/include/openssl/pki/signature_verify_cache.h",
"src/include/openssl/pki/verify_error.h"
"src/include/openssl/pki/signature_verify_cache.h"
],
"pki_internal_headers": [
"src/pki/cert_error_id.h",
@@ -2582,7 +2579,9 @@
"test_support": [
"src/crypto/test/abi_test.cc",
"src/crypto/test/file_test.cc",
"src/crypto/test/file_test_gtest.cc",
"src/crypto/test/file_util.cc",
"src/crypto/test/test_data.cc",
"src/crypto/test/test_util.cc",
"src/crypto/test/wycheproof_util.cc"
],
@@ -2591,6 +2590,7 @@
"src/crypto/test/file_test.h",
"src/crypto/test/file_util.h",
"src/crypto/test/gtest_main.h",
"src/crypto/test/test_data.h",
"src/crypto/test/test_util.h",
"src/crypto/test/wycheproof_util.h",
"src/ssl/test/async_bio.h",
+1 -21
View File
@@ -490,26 +490,6 @@ target_include_directories(
# themselves as dependencies next to the target definition.
add_custom_target(all_tests)
# On Windows, CRYPTO_TEST_DATA is too long to fit in command-line limits.
# TODO(davidben): CMake 3.12 has a list(JOIN) command. Use that when we've
# updated the minimum version.
set(EMBED_TEST_DATA_ARGS "")
foreach(arg ${CRYPTO_TEST_DATA})
set(EMBED_TEST_DATA_ARGS "${EMBED_TEST_DATA_ARGS}${arg}\n")
endforeach()
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/embed_test_data_args.txt"
"${EMBED_TEST_DATA_ARGS}")
add_custom_command(
OUTPUT crypto_test_data.cc
COMMAND ${GO_EXECUTABLE} run util/embed_test_data.go -file-list
"${CMAKE_CURRENT_BINARY_DIR}/embed_test_data_args.txt" >
"${CMAKE_CURRENT_BINARY_DIR}/crypto_test_data.cc"
DEPENDS util/embed_test_data.go ${CRYPTO_TEST_DATA}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_library(crypto_test_data OBJECT crypto_test_data.cc)
add_subdirectory(crypto)
add_subdirectory(ssl/test)
add_subdirectory(util/fipstools)
@@ -550,7 +530,7 @@ add_executable(urandom_test ${URANDOM_TEST_SOURCES})
target_link_libraries(urandom_test test_support_lib boringssl_gtest crypto)
add_dependencies(all_tests urandom_test)
add_executable(crypto_test ${CRYPTO_TEST_SOURCES} $<TARGET_OBJECTS:crypto_test_data>)
add_executable(crypto_test ${CRYPTO_TEST_SOURCES})
target_link_libraries(crypto_test test_support_lib boringssl_gtest crypto)
add_dependencies(all_tests crypto_test)
+99 -4
View File
@@ -69,6 +69,92 @@
]
},
"crypto": {
"hdrs": [
"include/openssl/aead.h",
"include/openssl/aes.h",
"include/openssl/arm_arch.h",
"include/openssl/asm_base.h",
"include/openssl/asn1.h",
"include/openssl/asn1_mac.h",
"include/openssl/asn1t.h",
"include/openssl/base.h",
"include/openssl/base64.h",
"include/openssl/bio.h",
"include/openssl/blake2.h",
"include/openssl/blowfish.h",
"include/openssl/bn.h",
"include/openssl/buf.h",
"include/openssl/buffer.h",
"include/openssl/bytestring.h",
"include/openssl/cast.h",
"include/openssl/chacha.h",
"include/openssl/cipher.h",
"include/openssl/cmac.h",
"include/openssl/conf.h",
"include/openssl/cpu.h",
"include/openssl/crypto.h",
"include/openssl/ctrdrbg.h",
"include/openssl/curve25519.h",
"include/openssl/des.h",
"include/openssl/dh.h",
"include/openssl/digest.h",
"include/openssl/dsa.h",
"include/openssl/e_os2.h",
"include/openssl/ec.h",
"include/openssl/ec_key.h",
"include/openssl/ecdh.h",
"include/openssl/ecdsa.h",
"include/openssl/engine.h",
"include/openssl/err.h",
"include/openssl/evp.h",
"include/openssl/evp_errors.h",
"include/openssl/ex_data.h",
"include/openssl/experimental/kyber.h",
"include/openssl/experimental/spx.h",
"include/openssl/hkdf.h",
"include/openssl/hmac.h",
"include/openssl/hpke.h",
"include/openssl/hrss.h",
"include/openssl/is_boringssl.h",
"include/openssl/kdf.h",
"include/openssl/lhash.h",
"include/openssl/md4.h",
"include/openssl/md5.h",
"include/openssl/mem.h",
"include/openssl/nid.h",
"include/openssl/obj.h",
"include/openssl/obj_mac.h",
"include/openssl/objects.h",
"include/openssl/opensslconf.h",
"include/openssl/opensslv.h",
"include/openssl/ossl_typ.h",
"include/openssl/pem.h",
"include/openssl/pkcs12.h",
"include/openssl/pkcs7.h",
"include/openssl/pkcs8.h",
"include/openssl/poly1305.h",
"include/openssl/pool.h",
"include/openssl/posix_time.h",
"include/openssl/rand.h",
"include/openssl/rc4.h",
"include/openssl/ripemd.h",
"include/openssl/rsa.h",
"include/openssl/safestack.h",
"include/openssl/service_indicator.h",
"include/openssl/sha.h",
"include/openssl/siphash.h",
"include/openssl/span.h",
"include/openssl/stack.h",
"include/openssl/target.h",
"include/openssl/thread.h",
"include/openssl/time.h",
"include/openssl/trust_token.h",
"include/openssl/type_check.h",
"include/openssl/x509.h",
"include/openssl/x509_vfy.h",
"include/openssl/x509v3.h",
"include/openssl/x509v3_errors.h"
],
"err_data": [
"crypto/err/*.errordata"
],
@@ -133,6 +219,10 @@
"pki/verify_error.cc",
"pki/verify_name_match.cc",
"pki/verify_signed_data.cc"
],
"hdrs": [
"include/openssl/pki/certificate.h",
"include/openssl/pki/signature_verify_cache.h"
]
},
"ssl": {
@@ -175,6 +265,13 @@
"ssl/tls13_client.cc",
"ssl/tls13_enc.cc",
"ssl/tls13_server.cc"
],
"hdrs": [
"include/openssl/dtls1.h",
"include/openssl/srtp.h",
"include/openssl/ssl.h",
"include/openssl/ssl3.h",
"include/openssl/tls1.h"
]
},
"decrepit": {
@@ -202,7 +299,9 @@
"srcs": [
"crypto/test/abi_test.cc",
"crypto/test/file_test.cc",
"crypto/test/file_test_gtest.cc",
"crypto/test/file_util.cc",
"crypto/test/test_data.cc",
"crypto/test/test_util.cc",
"crypto/test/wycheproof_util.cc"
],
@@ -285,10 +384,6 @@
"crypto/siphash/siphash_test.cc",
"crypto/spx/spx_test.cc",
"crypto/thread_test.cc",
// TODO(crbug.com/boringssl/542): This should be in test_support, so
// that all tests can use it. But it depends on GetTestData, which
// is not currently usable outside of crypto_test.
"crypto/test/file_test_gtest.cc",
"crypto/test/gtest_main.cc",
"crypto/trust_token/trust_token_test.cc",
"crypto/x509/tab_test.cc",
+1 -2
View File
@@ -25,11 +25,10 @@
#include <openssl/stack.h>
#include <openssl/x509.h>
#include "../test/test_data.h"
#include "../test/test_util.h"
std::string GetTestData(const char *path);
// kPassword is the password shared by most of the sample PKCS#12 files.
static const char kPassword[] = "foo";
+1 -1
View File
@@ -25,8 +25,8 @@
#include <openssl/err.h>
#include "test_data.h"
std::string GetTestData(const char *path);
class StringLineReader : public FileTest::LineReader {
public:
+51
View File
@@ -0,0 +1,51 @@
/* Copyright (c) 2024, 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 "test_data.h"
#include <stdio.h>
#include <stdlib.h>
#include "file_util.h"
#if !defined(BORINGSSL_CUSTOM_GET_TEST_DATA)
std::string GetTestData(const char *path) {
const char *root = getenv("BORINGSSL_TEST_DATA_ROOT");
root = root != nullptr ? root : ".";
std::string full_path = root;
full_path.push_back('/');
full_path.append(path);
ScopedFILE file(fopen(full_path.c_str(), "rb"));
if (file == nullptr) {
fprintf(stderr, "Could not open '%s'.\n", full_path.c_str());
abort();
}
std::string ret;
for (;;) {
char buf[512];
size_t n = fread(buf, 1, sizeof(buf), file.get());
if (n == 0) {
if (feof(file.get())) {
return ret;
}
fprintf(stderr, "Error reading from '%s'.\n", full_path.c_str());
abort();
}
ret.append(buf, n);
}
}
#endif // !BORINGSSL_CUSTOM_GET_TEST_DATA
+31
View File
@@ -0,0 +1,31 @@
/* Copyright (c) 2024, 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. */
#ifndef OPENSSL_HEADER_CRYPTO_TEST_TEST_DATA_H
#define OPENSSL_HEADER_CRYPTO_TEST_TEST_DATA_H
#include <string>
// GetTestData returns the test data for |path|, or aborts on error. |path|
// must be a slash-separated path, relative to the BoringSSL source tree. By
// default, this is implemented by reading from the filesystem, relative to
// the BORINGSSL_TEST_DATA_ROOT environment variable, or the current working
// directory if unset.
//
// Callers with more complex needs can build with
// BORINGSSL_CUSTOM_GET_TEST_DATA and then link in an alternate implementation
// of this function.
std::string GetTestData(const char *path);
#endif // OPENSSL_HEADER_CRYPTO_TEST_TEST_DATA_H
+1 -2
View File
@@ -37,6 +37,7 @@
#include "internal.h"
#include "../internal.h"
#include "../test/file_util.h"
#include "../test/test_data.h"
#include "../test/test_util.h"
#if defined(OPENSSL_THREADS)
@@ -44,8 +45,6 @@
#endif
std::string GetTestData(const char *path);
static const char kCrossSigningRootPEM[] = R"(
-----BEGIN CERTIFICATE-----
MIICcTCCAdqgAwIBAgIIagJHiPvE0MowDQYJKoZIhvcNAQELBQAwPDEaMBgGA1UE
+108 -1
View File
@@ -175,6 +175,95 @@ set(
gen/crypto/err_data.c
)
set(
CRYPTO_HEADERS
include/openssl/aead.h
include/openssl/aes.h
include/openssl/arm_arch.h
include/openssl/asm_base.h
include/openssl/asn1.h
include/openssl/asn1_mac.h
include/openssl/asn1t.h
include/openssl/base.h
include/openssl/base64.h
include/openssl/bio.h
include/openssl/blake2.h
include/openssl/blowfish.h
include/openssl/bn.h
include/openssl/buf.h
include/openssl/buffer.h
include/openssl/bytestring.h
include/openssl/cast.h
include/openssl/chacha.h
include/openssl/cipher.h
include/openssl/cmac.h
include/openssl/conf.h
include/openssl/cpu.h
include/openssl/crypto.h
include/openssl/ctrdrbg.h
include/openssl/curve25519.h
include/openssl/des.h
include/openssl/dh.h
include/openssl/digest.h
include/openssl/dsa.h
include/openssl/e_os2.h
include/openssl/ec.h
include/openssl/ec_key.h
include/openssl/ecdh.h
include/openssl/ecdsa.h
include/openssl/engine.h
include/openssl/err.h
include/openssl/evp.h
include/openssl/evp_errors.h
include/openssl/ex_data.h
include/openssl/experimental/kyber.h
include/openssl/experimental/spx.h
include/openssl/hkdf.h
include/openssl/hmac.h
include/openssl/hpke.h
include/openssl/hrss.h
include/openssl/is_boringssl.h
include/openssl/kdf.h
include/openssl/lhash.h
include/openssl/md4.h
include/openssl/md5.h
include/openssl/mem.h
include/openssl/nid.h
include/openssl/obj.h
include/openssl/obj_mac.h
include/openssl/objects.h
include/openssl/opensslconf.h
include/openssl/opensslv.h
include/openssl/ossl_typ.h
include/openssl/pem.h
include/openssl/pkcs12.h
include/openssl/pkcs7.h
include/openssl/pkcs8.h
include/openssl/poly1305.h
include/openssl/pool.h
include/openssl/posix_time.h
include/openssl/rand.h
include/openssl/rc4.h
include/openssl/ripemd.h
include/openssl/rsa.h
include/openssl/safestack.h
include/openssl/service_indicator.h
include/openssl/sha.h
include/openssl/siphash.h
include/openssl/span.h
include/openssl/stack.h
include/openssl/target.h
include/openssl/thread.h
include/openssl/time.h
include/openssl/trust_token.h
include/openssl/type_check.h
include/openssl/x509.h
include/openssl/x509_vfy.h
include/openssl/x509v3.h
include/openssl/x509v3_errors.h
)
set(
CRYPTO_SOURCES_ASM
@@ -277,7 +366,6 @@ set(
crypto/siphash/siphash_test.cc
crypto/spx/spx_test.cc
crypto/stack/stack_test.cc
crypto/test/file_test_gtest.cc
crypto/test/gtest_main.cc
crypto/thread_test.cc
crypto/trust_token/trust_token_test.cc
@@ -603,6 +691,13 @@ set(
pki/verify_signed_data.cc
)
set(
PKI_HEADERS
include/openssl/pki/certificate.h
include/openssl/pki/signature_verify_cache.h
)
set(
PKI_TEST_SOURCES
@@ -2086,6 +2181,16 @@ set(
ssl/tls_record.cc
)
set(
SSL_HEADERS
include/openssl/dtls1.h
include/openssl/srtp.h
include/openssl/ssl.h
include/openssl/ssl3.h
include/openssl/tls1.h
)
set(
SSL_TEST_SOURCES
@@ -2100,7 +2205,9 @@ set(
crypto/test/abi_test.cc
crypto/test/file_test.cc
crypto/test/file_test_gtest.cc
crypto/test/file_util.cc
crypto/test/test_data.cc
crypto/test/test_util.cc
crypto/test/wycheproof_util.cc
)
+99 -1
View File
@@ -153,6 +153,92 @@
"srcs": [
"gen/crypto/err_data.c"
],
"hdrs": [
"include/openssl/aead.h",
"include/openssl/aes.h",
"include/openssl/arm_arch.h",
"include/openssl/asm_base.h",
"include/openssl/asn1.h",
"include/openssl/asn1_mac.h",
"include/openssl/asn1t.h",
"include/openssl/base.h",
"include/openssl/base64.h",
"include/openssl/bio.h",
"include/openssl/blake2.h",
"include/openssl/blowfish.h",
"include/openssl/bn.h",
"include/openssl/buf.h",
"include/openssl/buffer.h",
"include/openssl/bytestring.h",
"include/openssl/cast.h",
"include/openssl/chacha.h",
"include/openssl/cipher.h",
"include/openssl/cmac.h",
"include/openssl/conf.h",
"include/openssl/cpu.h",
"include/openssl/crypto.h",
"include/openssl/ctrdrbg.h",
"include/openssl/curve25519.h",
"include/openssl/des.h",
"include/openssl/dh.h",
"include/openssl/digest.h",
"include/openssl/dsa.h",
"include/openssl/e_os2.h",
"include/openssl/ec.h",
"include/openssl/ec_key.h",
"include/openssl/ecdh.h",
"include/openssl/ecdsa.h",
"include/openssl/engine.h",
"include/openssl/err.h",
"include/openssl/evp.h",
"include/openssl/evp_errors.h",
"include/openssl/ex_data.h",
"include/openssl/experimental/kyber.h",
"include/openssl/experimental/spx.h",
"include/openssl/hkdf.h",
"include/openssl/hmac.h",
"include/openssl/hpke.h",
"include/openssl/hrss.h",
"include/openssl/is_boringssl.h",
"include/openssl/kdf.h",
"include/openssl/lhash.h",
"include/openssl/md4.h",
"include/openssl/md5.h",
"include/openssl/mem.h",
"include/openssl/nid.h",
"include/openssl/obj.h",
"include/openssl/obj_mac.h",
"include/openssl/objects.h",
"include/openssl/opensslconf.h",
"include/openssl/opensslv.h",
"include/openssl/ossl_typ.h",
"include/openssl/pem.h",
"include/openssl/pkcs12.h",
"include/openssl/pkcs7.h",
"include/openssl/pkcs8.h",
"include/openssl/poly1305.h",
"include/openssl/pool.h",
"include/openssl/posix_time.h",
"include/openssl/rand.h",
"include/openssl/rc4.h",
"include/openssl/ripemd.h",
"include/openssl/rsa.h",
"include/openssl/safestack.h",
"include/openssl/service_indicator.h",
"include/openssl/sha.h",
"include/openssl/siphash.h",
"include/openssl/span.h",
"include/openssl/stack.h",
"include/openssl/target.h",
"include/openssl/thread.h",
"include/openssl/time.h",
"include/openssl/trust_token.h",
"include/openssl/type_check.h",
"include/openssl/x509.h",
"include/openssl/x509_vfy.h",
"include/openssl/x509v3.h",
"include/openssl/x509v3_errors.h"
],
"asm": [
"crypto/curve25519/asm/x25519-asm-arm.S",
"crypto/hrss/asm/poly_rq_mul.S",
@@ -249,7 +335,6 @@
"crypto/siphash/siphash_test.cc",
"crypto/spx/spx_test.cc",
"crypto/stack/stack_test.cc",
"crypto/test/file_test_gtest.cc",
"crypto/test/gtest_main.cc",
"crypto/thread_test.cc",
"crypto/trust_token/trust_token_test.cc",
@@ -567,6 +652,10 @@
"pki/verify_error.cc",
"pki/verify_name_match.cc",
"pki/verify_signed_data.cc"
],
"hdrs": [
"include/openssl/pki/certificate.h",
"include/openssl/pki/signature_verify_cache.h"
]
},
"pki_test": {
@@ -2045,6 +2134,13 @@
"ssl/tls13_server.cc",
"ssl/tls_method.cc",
"ssl/tls_record.cc"
],
"hdrs": [
"include/openssl/dtls1.h",
"include/openssl/srtp.h",
"include/openssl/ssl.h",
"include/openssl/ssl3.h",
"include/openssl/tls1.h"
]
},
"ssl_test": {
@@ -2059,7 +2155,9 @@
"srcs": [
"crypto/test/abi_test.cc",
"crypto/test/file_test.cc",
"crypto/test/file_test_gtest.cc",
"crypto/test/file_util.cc",
"crypto/test/test_data.cc",
"crypto/test/test_util.cc",
"crypto/test/wycheproof_util.cc"
],
+4 -47
View File
@@ -12,9 +12,12 @@
#include <string_view>
#include <gtest/gtest.h>
#include <openssl/bytestring.h>
#include <openssl/mem.h>
#include <openssl/pool.h>
#include "../crypto/test/test_data.h"
#include "cert_error_params.h"
#include "cert_errors.h"
#include "parser.h"
@@ -90,41 +93,6 @@ std::vector<std::string> SplitString(std::string_view str) {
return out;
}
bool ReadFileToString(const std::string &path, std::string *out) {
std::ifstream file(path, std::ios::binary);
file.unsetf(std::ios::skipws);
file.seekg(0, std::ios::end);
if (file.tellg() == -1) {
return false;
}
out->reserve(file.tellg());
file.seekg(0, std::ios::beg);
out->assign(std::istreambuf_iterator<char>(file),
std::istreambuf_iterator<char>());
return true;
}
std::string AppendComponent(const std::string &path,
const std::string &component) {
// Append a path component to a path. Use the \ separator if this appears to
// be a Windows path, otherwise the Unix one.
if (path.find(":\\") != std::string::npos) {
return path + "\\" + component;
}
return path + "/" + component;
}
std::string GetTestRoot(void) {
// We expect our test data to live in "pki" underneath a
// test root directory, or in the current directry.
char *root_from_env = getenv("BORINGSSL_TEST_DATA_ROOT");
std::string root = root_from_env ? root_from_env : ".";
return AppendComponent(root, "pki");
}
} // namespace
namespace der {
@@ -450,18 +418,7 @@ bool ReadVerifyCertChainTestFromFile(const std::string &file_path_ascii,
}
std::string ReadTestFileToString(const std::string &file_path_ascii) {
// Compute the full path, relative to the src/ directory.
std::string src_root = GetTestRoot();
std::string filepath = AppendComponent(src_root, file_path_ascii);
// Read the full contents of the file.
std::string file_data;
if (!ReadFileToString(filepath, &file_data)) {
ADD_FAILURE() << "Couldn't read file: " << filepath;
return std::string();
}
return file_data;
return GetTestData(("pki/" + file_path_ascii).c_str());
}
void VerifyCertPathErrors(const std::string &expected_errors_str,
+13 -48
View File
@@ -24,7 +24,6 @@ import json
PREFIX = None
EMBED_TEST_DATA = True
def PathOf(x):
@@ -80,12 +79,12 @@ class Android(object):
non_bcm_asm = self.FilterBcmAsm(files['crypto_asm'], False)
bcm_asm = self.FilterBcmAsm(files['crypto_asm'], True)
self.PrintDefaults(blueprint, 'libcrypto_sources', non_bcm_c_files, non_bcm_asm)
self.PrintDefaults(blueprint, 'libcrypto_bcm_sources', bcm_c_files, bcm_asm)
self.PrintDefaults(blueprint, 'libcrypto_sources', non_bcm_c_files, asm_files=non_bcm_asm)
self.PrintDefaults(blueprint, 'libcrypto_bcm_sources', bcm_c_files, asm_files=bcm_asm)
self.PrintDefaults(blueprint, 'libssl_sources', files['ssl'])
self.PrintDefaults(blueprint, 'bssl_sources', files['tool'])
self.PrintDefaults(blueprint, 'boringssl_test_support_sources', files['test_support'])
self.PrintDefaults(blueprint, 'boringssl_crypto_test_sources', files['crypto_test'])
self.PrintDefaults(blueprint, 'boringssl_crypto_test_sources', files['crypto_test'], data=files['crypto_test_data'])
self.PrintDefaults(blueprint, 'boringssl_ssl_test_sources', files['ssl_test'])
self.PrintDefaults(blueprint, 'libpki_sources', files['pki'])
@@ -97,7 +96,7 @@ class Android(object):
self.PrintVariableSection(makefile, 'crypto_sources_asm',
files['crypto_asm'])
def PrintDefaults(self, blueprint, name, files, asm_files=[]):
def PrintDefaults(self, blueprint, name, files, asm_files=[], data=[]):
"""Print a cc_defaults section from a list of C files and optionally assembly outputs"""
if asm_files:
blueprint.write('\n')
@@ -113,6 +112,11 @@ class Android(object):
for f in sorted(files):
blueprint.write(' "%s",\n' % f)
blueprint.write(' ],\n')
if data:
blueprint.write(' data: [\n')
for f in sorted(data):
blueprint.write(' "%s",\n' % f)
blueprint.write(' ],\n')
if asm_files:
blueprint.write(' target: {\n')
@@ -560,18 +564,6 @@ def NoTestRunnerFiles(path, dent, is_dir):
return not is_dir or dent != 'runner'
def SSLHeaderFiles(path, dent, is_dir):
return dent in ['ssl.h', 'tls1.h', 'ssl23.h', 'ssl3.h', 'dtls1.h', 'srtp.h']
def CryptoHeaderFiles(path, dent, is_dir):
if SSLHeaderFiles(path, dent, is_dir):
return False
if is_dir and dent == 'pki':
return False
return True
def FindCFiles(directory, filter_func):
"""Recurses through directory and returns a list of paths to all the C source
files that pass filter_func."""
@@ -655,31 +647,9 @@ def main(platforms):
FindHeaderFiles(os.path.join('src', 'crypto', 'test'), AllFiles) +
FindHeaderFiles(os.path.join('src', 'ssl', 'test'), NoTestRunnerFiles))
crypto_test_files = []
if EMBED_TEST_DATA:
# Generate crypto_test_data.cc
with open('crypto_test_data.cc', 'w+') as out:
subprocess.check_call(
['go', 'run', 'util/embed_test_data.go'] + sources['crypto_test']['data'],
cwd='src',
stdout=out)
crypto_test_files.append('crypto_test_data.cc')
crypto_test_files += PrefixWithSrc(sources['crypto_test']['srcs'])
crypto_test_files.sort()
fuzz_c_files = FindCFiles(os.path.join('src', 'fuzz'), NoTests)
ssl_h_files = FindHeaderFiles(os.path.join('src', 'include', 'openssl'),
SSLHeaderFiles)
pki_internal_h_files = FindHeaderFiles(os.path.join('src', 'pki'), AllFiles)
crypto_h_files = FindHeaderFiles(os.path.join('src', 'include', 'openssl'),
CryptoHeaderFiles)
pki_h_files = FindHeaderFiles(
os.path.join('src', 'include', 'openssl', 'pki'), AllFiles)
ssl_internal_h_files = FindHeaderFiles(os.path.join('src', 'ssl'), NoTests)
crypto_internal_h_files = (
FindHeaderFiles(os.path.join('src', 'crypto'), NoTests) +
@@ -698,21 +668,21 @@ def main(platforms):
'crypto': crypto_c_files,
'crypto_asm': PrefixWithSrc(crypto_asm),
'crypto_nasm': PrefixWithSrc(crypto_nasm),
'crypto_headers': crypto_h_files,
'crypto_headers': PrefixWithSrc(sources['crypto']['hdrs']),
'crypto_internal_headers': crypto_internal_h_files,
'crypto_test': crypto_test_files,
'crypto_test': PrefixWithSrc(sources['crypto_test']['srcs']),
'crypto_test_data': PrefixWithSrc(sources['crypto_test']['data']),
'fips_fragments': fips_fragments,
'fuzz': fuzz_c_files,
'pki': PrefixWithSrc(sources['pki']['srcs']),
'pki_headers': pki_h_files,
'pki_headers': PrefixWithSrc(sources['pki']['hdrs']),
'pki_internal_headers': sorted(list(pki_internal_h_files)),
'pki_test': PrefixWithSrc(sources['pki_test']['srcs']),
'pki_test_data': PrefixWithSrc(sources['pki_test']['data']),
'rust_bssl_crypto': bssl_crypto_files,
'rust_bssl_sys': bssl_sys_files,
'ssl': PrefixWithSrc(sources['ssl']['srcs']),
'ssl_headers': ssl_h_files,
'ssl_headers': PrefixWithSrc(sources['ssl']['hdrs']),
'ssl_internal_headers': ssl_internal_h_files,
'ssl_test': PrefixWithSrc(sources['ssl_test']['srcs']),
'tool': PrefixWithSrc(sources['bssl']['srcs']),
@@ -744,13 +714,8 @@ if __name__ == '__main__':
'|'.join(sorted(ALL_PLATFORMS.keys())))
parser.add_option('--prefix', dest='prefix',
help='For Bazel, prepend argument to all source files')
parser.add_option(
'--embed_test_data', type='choice', dest='embed_test_data',
action='store', default="true", choices=["true", "false"],
help='For Bazel or GN, don\'t embed data files in crypto_test_data.cc')
options, args = parser.parse_args(sys.argv[1:])
PREFIX = options.prefix
EMBED_TEST_DATA = (options.embed_test_data == "true")
if not args:
parser.print_help()