Skip to content

Commit

Permalink
Fixing tests that depend on JSON test vectors.
Browse files Browse the repository at this point in the history
Also fixing doc links in open source (see #48).

PiperOrigin-RevId: 191699981
GitOrigin-RevId: e5a0caaf2d794dce378d1c4efefe36a36d2048f7
  • Loading branch information
thaidn authored and Tink Team committed Apr 5, 2018
1 parent 6321e25 commit 16b1d26
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 20 deletions.
15 changes: 15 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
testdata = [
"//testvectors:all",
]

# java

java_library(
Expand Down Expand Up @@ -44,6 +48,7 @@ bouncycastle_all_tests(
srcs = ["java/com/google/security/wycheproof/BouncyCastleAllTests.java"] + test_srcs,
test_class = "com.google.security.wycheproof.BouncyCastleAllTests",
deps = common_deps,
data = testdata,
)

java_test(
Expand All @@ -55,6 +60,7 @@ java_test(
tags = ["manual"],
test_class = "com.google.security.wycheproof.BouncyCastleAllTests",
deps = common_deps + ["@local//:bouncycastle_jar"],
data = testdata,
)

# Generates BouncyCastleTest_1_xx target for all available versions,
Expand All @@ -73,6 +79,7 @@ bouncycastle_tests(
srcs = ["java/com/google/security/wycheproof/BouncyCastleTest.java"] + test_srcs,
test_class = "com.google.security.wycheproof.BouncyCastleTest",
deps = common_deps,
data = testdata,
)

java_test(
Expand All @@ -84,6 +91,7 @@ java_test(
tags = ["manual"],
test_class = "com.google.security.wycheproof.BouncyCastleTest",
deps = common_deps + ["@local//:bouncycastle_jar"],
data = testdata,
)

# Spongy Castle tests
Expand All @@ -106,6 +114,7 @@ spongycastle_all_tests(
srcs = ["java/com/google/security/wycheproof/SpongyCastleAllTests.java"] + test_srcs,
test_class = "com.google.security.wycheproof.SpongyCastleAllTests",
deps = common_deps,
data = testdata,
)

# Generates SpongyCastleTest_1_xx target for all available versions,
Expand All @@ -124,6 +133,7 @@ spongycastle_tests(
srcs = ["java/com/google/security/wycheproof/SpongyCastleTest.java"] + test_srcs,
test_class = "com.google.security.wycheproof.SpongyCastleTest",
deps = common_deps,
data = testdata,
)

# Conscrypt tests
Expand All @@ -134,13 +144,15 @@ conscrypt_tests(
srcs = ["java/com/google/security/wycheproof/ConscryptTest.java"] + test_srcs,
test_class = "com.google.security.wycheproof.ConscryptTest",
deps = common_deps,
data = testdata,
)

conscrypt_all_tests(
size = "enormous",
srcs = ["java/com/google/security/wycheproof/ConscryptAllTests.java"] + test_srcs,
test_class = "com.google.security.wycheproof.ConscryptAllTests",
deps = common_deps,
data = testdata,
)

# OpenJDK tests
Expand All @@ -150,6 +162,7 @@ java_test(
srcs = ["java/com/google/security/wycheproof/OpenJDKTest.java"] + test_srcs,
test_class = "com.google.security.wycheproof.OpenJDKTest",
deps = common_deps,
data = testdata,
)

java_test(
Expand All @@ -158,6 +171,7 @@ java_test(
srcs = ["java/com/google/security/wycheproof/OpenJDKAllTests.java"] + test_srcs,
test_class = "com.google.security.wycheproof.OpenJDKAllTests",
deps = common_deps,
data = testdata,
)

# Platform-independent tests
Expand All @@ -166,6 +180,7 @@ java_test(
size = "small",
srcs = ["java/com/google/security/wycheproof/ProviderIndependentTest.java"] + test_srcs,
deps = common_deps,
data = testdata,
)

# WebCrypto Javascript tests
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ check their libraries against a large number of known attacks, without having
to spend years reading academic papers or become cryptographers themselves.

For more information on the goals and strategies of Project Wycheproof, please
check out our [doc](g3doc/).
check out our [doc](doc/).

### Coverage

Project Wycheproof has tests for the most popular crypto algorithms, including

- AES-EAX
- AES-GCM
- [DH](g3doc/dh.md)
- [DH](doc/dh.md)
- DHIES
- [DSA](g3doc/dsa.md)
- [ECDH](g3doc/ecdh.md)
- [DSA](doc/dsa.md)
- [ECDH](doc/ecdh.md)
- ECDSA
- ECIES
- [RSA](g3doc/rsa.md)
- [RSA](doc/rsa.md)

The tests detect whether a library is vulnerable to many attacks, including

Expand Down Expand Up @@ -159,7 +159,7 @@ slow tests (which are annotated with @SlowTest).

Most test targets are failing, and each failure might be a security issue. To
learn more about what a failed test means, you might want to check out [our
documentation](g3doc/bugs.md) or the comments on top of the corresponding test
documentation](doc/bugs.md) or the comments on top of the corresponding test
function and test class.

### Hall of Bugs
Expand Down
3 changes: 2 additions & 1 deletion kokoro/continuous.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ bazel build ... || exit 1

# Run all tests to generate logs.
# We don't care about the test results, thus always return successfully.
bazel test ... || exit 0
bazel query "kind(test, :all)" | grep AllTests | grep -v Local | xargs bazel \
--host_javabase="$JAVA_HOME" test --test_output=all || exit 0

28 changes: 15 additions & 13 deletions tools/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""

def add_tests(name, versions, provider_dep, srcs, deps, size, test_class):
def add_tests(name, versions, provider_dep, srcs, deps, size, test_class, data):
"""Provider version-specific tests."""

for version in versions:
Expand All @@ -14,6 +14,7 @@ def add_tests(name, versions, provider_dep, srcs, deps, size, test_class):
],
size = size,
test_class = test_class,
data = data,
)

# Latest stable.
Expand All @@ -27,6 +28,7 @@ def add_tests(name, versions, provider_dep, srcs, deps, size, test_class):
],
size = size,
test_class = test_class,
data = data,
)

# Bouncy Castle targets
Expand All @@ -35,46 +37,46 @@ bouncycastle_versions = ["1_%d" % i for i in range(49, 60)]
bouncycastle_dep = "@bouncycastle"

# These targets run all tests.
def bouncycastle_all_tests(srcs, deps, size, test_class):
def bouncycastle_all_tests(srcs, deps, size, test_class, data):
"""BouncyCastle version-specific tests."""

add_tests("BouncyCastleAllTests", bouncycastle_versions, bouncycastle_dep, srcs, deps, size, test_class)
add_tests("BouncyCastleAllTests", bouncycastle_versions, bouncycastle_dep, srcs, deps, size, test_class, data)

# These targets exclude @SlowTest
def bouncycastle_tests(srcs, deps, size, test_class):
def bouncycastle_tests(srcs, deps, size, test_class, data):
"""BouncyCastle version-specific tests."""

add_tests("BouncyCastleTest", bouncycastle_versions, bouncycastle_dep, srcs, deps, size, test_class)
add_tests("BouncyCastleTest", bouncycastle_versions, bouncycastle_dep, srcs, deps, size, test_class, data)

# Spongy Castle targets
spongycastle_versions = ["1_50", "1_51", "1_52", "1_53", "1_54", "1_56", "1_58"]
spongycastle_dep = "@spongycastle_prov"

# These targets run all tests.
def spongycastle_all_tests(srcs, deps, size, test_class):
def spongycastle_all_tests(srcs, deps, size, test_class, data):
"""SpongyCastle version-specific tests."""

add_tests("SpongyCastleAllTests", spongycastle_versions, spongycastle_dep, srcs, deps, size, test_class)
add_tests("SpongyCastleAllTests", spongycastle_versions, spongycastle_dep, srcs, deps, size, test_class, data)


# These targets exclude slow tests.
def spongycastle_tests(srcs, deps, size, test_class):
def spongycastle_tests(srcs, deps, size, test_class, data):
"""SpongyCastle version-specific tests."""

add_tests("SpongyCastleTest", spongycastle_versions, spongycastle_dep, srcs, deps, size, test_class)
add_tests("SpongyCastleTest", spongycastle_versions, spongycastle_dep, srcs, deps, size, test_class, data)

# Conscrypt targets
conscrypt_versions = ["1_0_1"]
conscrypt_dep = "@conscrypt"

# These targets run all tests.
def conscrypt_all_tests(srcs, deps, size, test_class):
def conscrypt_all_tests(srcs, deps, size, test_class, data):
"""Conscrypt version-specific tests."""

add_tests("ConscryptAllTests", conscrypt_versions, conscrypt_dep, srcs, deps, size, test_class)
add_tests("ConscryptAllTests", conscrypt_versions, conscrypt_dep, srcs, deps, size, test_class, data)

# These targets exclude @SlowTest
def conscrypt_tests(srcs, deps, size, test_class):
def conscrypt_tests(srcs, deps, size, test_class, data):
"""Conscrypt version-specific tests."""

add_tests("ConscryptTest", conscrypt_versions, conscrypt_dep, srcs, deps, size, test_class)
add_tests("ConscryptTest", conscrypt_versions, conscrypt_dep, srcs, deps, size, test_class, data)

0 comments on commit 16b1d26

Please sign in to comment.