aboutsummaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorBob Beck <bbe@google.com>2024-05-27 21:46:42 +0000
committerBoringssl LUCI CQ <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-05-28 19:25:21 +0000
commite09fcf8302f75dc50afcfe40f0d59a92b40a3c2e (patch)
treef31b277443b7e233611a437891213ed14e017942 /crypto
parentafd52e91dfed27ab7193be040f067900947b14ac (diff)
downloadboringssl-e09fcf8302f75dc50afcfe40f0d59a92b40a3c2e.zip
boringssl-e09fcf8302f75dc50afcfe40f0d59a92b40a3c2e.tar.gz
boringssl-e09fcf8302f75dc50afcfe40f0d59a92b40a3c2e.tar.bz2
Move unit tests out of bcm/fipsmodule
Strictly speaking this does not change any of the bcm/fipsmodule code, it moves the tests out into libcrypto so that once we move to an api boundary where bcm does not call libcrypto functions directly, these tests still can do so. Bug: 722 Change-Id: I9defc70a9e523e52dda2d53ab4bd155a4b44fc02 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/68787 Reviewed-by: Adam Langley <agl@google.com> Commit-Queue: Bob Beck <bbe@google.com>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bn_extra/bn_test.cc (renamed from crypto/fipsmodule/bn/bn_test.cc)13
-rw-r--r--crypto/cipher_extra/aes_test.cc (renamed from crypto/fipsmodule/aes/aes_test.cc)11
-rw-r--r--crypto/cipher_extra/cmac_test.cc (renamed from crypto/fipsmodule/cmac/cmac_test.cc)6
-rw-r--r--crypto/cipher_extra/gcm_test.cc (renamed from crypto/fipsmodule/modes/gcm_test.cc)11
-rw-r--r--crypto/cipher_extra/hkdf_test.cc (renamed from crypto/fipsmodule/hkdf/hkdf_test.cc)6
-rw-r--r--crypto/cipher_extra/md5_test.cc (renamed from crypto/fipsmodule/md5/md5_test.cc)3
-rw-r--r--crypto/cipher_extra/sha_test.cc (renamed from crypto/fipsmodule/sha/sha_test.cc)6
-rw-r--r--crypto/ec_extra/ec_test.cc (renamed from crypto/fipsmodule/ec/ec_test.cc)8
-rw-r--r--crypto/ec_extra/p256-nistz_test.cc (renamed from crypto/fipsmodule/ec/p256-nistz_test.cc)13
-rw-r--r--crypto/ec_extra/p256-nistz_tests.txt (renamed from crypto/fipsmodule/ec/p256-nistz_tests.txt)0
-rw-r--r--crypto/ec_extra/p256_test.cc (renamed from crypto/fipsmodule/ec/p256_test.cc)6
-rw-r--r--crypto/ecdsa_extra/ecdsa_test.cc (renamed from crypto/fipsmodule/ecdsa/ecdsa_test.cc)6
-rw-r--r--crypto/rand_extra/ctrdrbg_test.cc (renamed from crypto/fipsmodule/rand/ctrdrbg_test.cc)8
-rw-r--r--crypto/rand_extra/ctrdrbg_vectors.txt (renamed from crypto/fipsmodule/rand/ctrdrbg_vectors.txt)0
-rw-r--r--crypto/rand_extra/fork_detect_test.cc (renamed from crypto/fipsmodule/rand/fork_detect_test.cc)2
-rw-r--r--crypto/rand_extra/urandom_test.cc (renamed from crypto/fipsmodule/rand/urandom_test.cc)3
16 files changed, 47 insertions, 55 deletions
diff --git a/crypto/fipsmodule/bn/bn_test.cc b/crypto/bn_extra/bn_test.cc
index 710b60f..47af50d 100644
--- a/crypto/fipsmodule/bn/bn_test.cc
+++ b/crypto/bn_extra/bn_test.cc
@@ -87,13 +87,12 @@
#include <openssl/mem.h>
#include <openssl/rand.h>
-#include "./internal.h"
-#include "./rsaz_exp.h"
-#include "../../internal.h"
-#include "../../test/abi_test.h"
-#include "../../test/file_test.h"
-#include "../../test/test_util.h"
-#include "../../test/wycheproof_util.h"
+#include "../fipsmodule/bn/internal.h"
+#include "../internal.h"
+#include "../test/abi_test.h"
+#include "../test/file_test.h"
+#include "../test/test_util.h"
+#include "../test/wycheproof_util.h"
static int HexToBIGNUM(bssl::UniquePtr<BIGNUM> *out, const char *in) {
diff --git a/crypto/fipsmodule/aes/aes_test.cc b/crypto/cipher_extra/aes_test.cc
index d4a458b..47e5666 100644
--- a/crypto/fipsmodule/aes/aes_test.cc
+++ b/crypto/cipher_extra/aes_test.cc
@@ -25,12 +25,11 @@
#include <openssl/aes.h>
#include <openssl/rand.h>
-#include "internal.h"
-#include "../../internal.h"
-#include "../../test/abi_test.h"
-#include "../../test/file_test.h"
-#include "../../test/test_util.h"
-#include "../../test/wycheproof_util.h"
+#include "../fipsmodule/aes/internal.h"
+#include "../test/abi_test.h"
+#include "../test/file_test.h"
+#include "../test/test_util.h"
+#include "../test/wycheproof_util.h"
static void TestRaw(FileTest *t) {
diff --git a/crypto/fipsmodule/cmac/cmac_test.cc b/crypto/cipher_extra/cmac_test.cc
index 9e3744e..f6da0eb 100644
--- a/crypto/fipsmodule/cmac/cmac_test.cc
+++ b/crypto/cipher_extra/cmac_test.cc
@@ -23,9 +23,9 @@
#include <openssl/cmac.h>
#include <openssl/mem.h>
-#include "../../test/file_test.h"
-#include "../../test/test_util.h"
-#include "../../test/wycheproof_util.h"
+#include "../test/file_test.h"
+#include "../test/test_util.h"
+#include "../test/wycheproof_util.h"
static void test(const char *name, const uint8_t *key, size_t key_len,
diff --git a/crypto/fipsmodule/modes/gcm_test.cc b/crypto/cipher_extra/gcm_test.cc
index b4f9b90..456ce99 100644
--- a/crypto/fipsmodule/modes/gcm_test.cc
+++ b/crypto/cipher_extra/gcm_test.cc
@@ -55,12 +55,11 @@
#include <openssl/aes.h>
-#include "../../internal.h"
-#include "../../test/abi_test.h"
-#include "../../test/file_test.h"
-#include "../../test/test_util.h"
-#include "../aes/internal.h"
-#include "internal.h"
+#include "../test/abi_test.h"
+#include "../test/file_test.h"
+#include "../test/test_util.h"
+#include "../fipsmodule/aes/internal.h"
+#include "../fipsmodule/modes/internal.h"
TEST(GCMTest, TestVectors) {
diff --git a/crypto/fipsmodule/hkdf/hkdf_test.cc b/crypto/cipher_extra/hkdf_test.cc
index dd7dd58..8aad6c8 100644
--- a/crypto/fipsmodule/hkdf/hkdf_test.cc
+++ b/crypto/cipher_extra/hkdf_test.cc
@@ -20,9 +20,9 @@
#include <gtest/gtest.h>
-#include "../../test/file_test.h"
-#include "../../test/test_util.h"
-#include "../../test/wycheproof_util.h"
+#include "../test/file_test.h"
+#include "../test/test_util.h"
+#include "../test/wycheproof_util.h"
struct HKDFTestVector {
diff --git a/crypto/fipsmodule/md5/md5_test.cc b/crypto/cipher_extra/md5_test.cc
index 7df5bb2..4ad6b8c 100644
--- a/crypto/fipsmodule/md5/md5_test.cc
+++ b/crypto/cipher_extra/md5_test.cc
@@ -16,8 +16,7 @@
#include <gtest/gtest.h>
-#include "internal.h"
-#include "../../test/abi_test.h"
+#include "../test/abi_test.h"
#if defined(MD5_ASM) && defined(SUPPORTS_ABI_TEST)
diff --git a/crypto/fipsmodule/sha/sha_test.cc b/crypto/cipher_extra/sha_test.cc
index 5624288..e6a0488 100644
--- a/crypto/fipsmodule/sha/sha_test.cc
+++ b/crypto/cipher_extra/sha_test.cc
@@ -18,9 +18,9 @@
#include <gtest/gtest.h>
-#include "internal.h"
-#include "../../test/abi_test.h"
-#include "../../test/test_util.h"
+#include "../fipsmodule/sha/internal.h"
+#include "../test/abi_test.h"
+#include "../test/test_util.h"
TEST(SHATest, FIPS1862PRF) {
diff --git a/crypto/fipsmodule/ec/ec_test.cc b/crypto/ec_extra/ec_test.cc
index b9bc1a2..a9e8ffe 100644
--- a/crypto/fipsmodule/ec/ec_test.cc
+++ b/crypto/ec_extra/ec_test.cc
@@ -30,11 +30,9 @@
#include <openssl/obj.h>
#include <openssl/span.h>
-#include "../../ec_extra/internal.h"
-#include "../../test/file_test.h"
-#include "../../test/test_util.h"
-#include "../bn/internal.h"
-#include "internal.h"
+#include "./internal.h"
+#include "../test/file_test.h"
+#include "../test/test_util.h"
// kECKeyWithoutPublic is an ECPrivateKey with the optional publicKey field
diff --git a/crypto/fipsmodule/ec/p256-nistz_test.cc b/crypto/ec_extra/p256-nistz_test.cc
index 263db50..11d99a4 100644
--- a/crypto/fipsmodule/ec/p256-nistz_test.cc
+++ b/crypto/ec_extra/p256-nistz_test.cc
@@ -25,12 +25,11 @@
#include <openssl/nid.h>
#include "internal.h"
-#include "../bn/internal.h"
-#include "../../internal.h"
-#include "../../test/abi_test.h"
-#include "../../test/file_test.h"
-#include "../../test/test_util.h"
-#include "p256-nistz.h"
+#include "../internal.h"
+#include "../test/abi_test.h"
+#include "../test/file_test.h"
+#include "../test/test_util.h"
+#include "../fipsmodule/ec/p256-nistz.h"
// Disable tests if BORINGSSL_SHARED_LIBRARY is defined. These tests need access
@@ -487,7 +486,7 @@ static void TestOrdMulMont(FileTest *t) {
}
TEST(P256_NistzTest, TestVectors) {
- return FileTestGTest("crypto/fipsmodule/ec/p256-nistz_tests.txt",
+ return FileTestGTest("crypto/ec_extra/p256-nistz_tests.txt",
[](FileTest *t) {
if (t->GetParameter() == "Negate") {
TestNegate(t);
diff --git a/crypto/fipsmodule/ec/p256-nistz_tests.txt b/crypto/ec_extra/p256-nistz_tests.txt
index 8bc301e..8bc301e 100644
--- a/crypto/fipsmodule/ec/p256-nistz_tests.txt
+++ b/crypto/ec_extra/p256-nistz_tests.txt
diff --git a/crypto/fipsmodule/ec/p256_test.cc b/crypto/ec_extra/p256_test.cc
index 2af9319..7fc1c80 100644
--- a/crypto/fipsmodule/ec/p256_test.cc
+++ b/crypto/ec_extra/p256_test.cc
@@ -13,13 +13,13 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
#include <gtest/gtest.h>
-#include "../../internal.h"
-#include "../../test/abi_test.h"
+#include "../internal.h"
+#include "../test/abi_test.h"
#if !defined(OPENSSL_NO_ASM) && defined(__GNUC__) && defined(__x86_64__) && \
defined(SUPPORTS_ABI_TEST)
extern "C" {
-#include "../../../third_party/fiat/p256_64.h"
+#include "../../third_party/fiat/p256_64.h"
}
TEST(P256Test, AdxMulABI) {
diff --git a/crypto/fipsmodule/ecdsa/ecdsa_test.cc b/crypto/ecdsa_extra/ecdsa_test.cc
index 5876935..53d7bc2 100644
--- a/crypto/fipsmodule/ecdsa/ecdsa_test.cc
+++ b/crypto/ecdsa_extra/ecdsa_test.cc
@@ -64,9 +64,9 @@
#include <openssl/nid.h>
#include <openssl/rand.h>
-#include "../ec/internal.h"
-#include "../../test/file_test.h"
-#include "../../test/test_util.h"
+//#include "../ec/internal.h"
+#include "../test/file_test.h"
+#include "../test/test_util.h"
static bssl::UniquePtr<BIGNUM> HexToBIGNUM(const char *hex) {
diff --git a/crypto/fipsmodule/rand/ctrdrbg_test.cc b/crypto/rand_extra/ctrdrbg_test.cc
index deed19f..6950bb3 100644
--- a/crypto/fipsmodule/rand/ctrdrbg_test.cc
+++ b/crypto/rand_extra/ctrdrbg_test.cc
@@ -17,9 +17,9 @@
#include <openssl/ctrdrbg.h>
#include <openssl/sha.h>
-#include "internal.h"
-#include "../../test/file_test.h"
-#include "../../test/test_util.h"
+#include "../fipsmodule/rand/internal.h"
+#include "../test/file_test.h"
+#include "../test/test_util.h"
TEST(CTRDRBGTest, Basic) {
@@ -94,7 +94,7 @@ TEST(CTRDRBGTest, Large) {
}
TEST(CTRDRBGTest, TestVectors) {
- FileTestGTest("crypto/fipsmodule/rand/ctrdrbg_vectors.txt", [](FileTest *t) {
+ FileTestGTest("crypto/rand_extra/ctrdrbg_vectors.txt", [](FileTest *t) {
std::vector<uint8_t> seed, personalisation, reseed, ai_reseed, ai1, ai2,
expected;
ASSERT_TRUE(t->GetBytes(&seed, "EntropyInput"));
diff --git a/crypto/fipsmodule/rand/ctrdrbg_vectors.txt b/crypto/rand_extra/ctrdrbg_vectors.txt
index c866431..c866431 100644
--- a/crypto/fipsmodule/rand/ctrdrbg_vectors.txt
+++ b/crypto/rand_extra/ctrdrbg_vectors.txt
diff --git a/crypto/fipsmodule/rand/fork_detect_test.cc b/crypto/rand_extra/fork_detect_test.cc
index f9cde28..bea1ec6 100644
--- a/crypto/fipsmodule/rand/fork_detect_test.cc
+++ b/crypto/rand_extra/fork_detect_test.cc
@@ -14,7 +14,7 @@
#include <openssl/base.h>
-#include "fork_detect.h"
+#include "../fipsmodule/rand/fork_detect.h"
// TSAN cannot cope with this test and complains that "starting new threads
// after multi-threaded fork is not supported".
diff --git a/crypto/fipsmodule/rand/urandom_test.cc b/crypto/rand_extra/urandom_test.cc
index 08e4183..909d193 100644
--- a/crypto/fipsmodule/rand/urandom_test.cc
+++ b/crypto/rand_extra/urandom_test.cc
@@ -19,8 +19,7 @@
#include <openssl/ctrdrbg.h>
#include <openssl/rand.h>
-#include "getrandom_fillin.h"
-#include "internal.h"
+#include "../fipsmodule/rand/getrandom_fillin.h"
#if (defined(OPENSSL_X86_64) || defined(OPENSSL_AARCH64)) && \
!defined(BORINGSSL_SHARED_LIBRARY) && defined(OPENSSL_RAND_URANDOM) && \