diff options
author | David Benjamin <davidben@chromium.org> | 2015-05-11 22:58:08 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-05-12 00:44:36 +0300 |
commit | 5c694e3fef39ac4c2d23fcaec38fc38836bb2472 (patch) | |
tree | 1a1d92049fb35ee1bf88efe55a151c3835abd786 /crypto/hmac | |
parent | 074e3d2dfd51b6e7fe51968cd7b6685591b8eda4 (diff) |
Add evp_test, loosely based on upstream's version.
This imports the EVP_PKEY test data of upstream's evptests.txt, but
modified to fit our test framework and with a new test driver. The
remainder of the test data will be imported separately into aead_test
and cipher_test.
Some minor changes to the test format were made to account for test
framework differences. One test has different results since we don't
support RSA signatures with omitted (rather than NULL) parameters.
Otherwise, the biggest difference in test format is that the ad-hoc
result strings are replaced with checking ERR_peek_error.
Change-Id: I758869abbeb843f5f2ac6c1cbd87333baec08ec3
Reviewed-on: https://boringssl-review.googlesource.com/4703
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/hmac')
-rw-r--r-- | crypto/hmac/hmac_test.cc | 4 | ||||
-rw-r--r-- | crypto/hmac/hmac_tests.txt | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/crypto/hmac/hmac_test.cc b/crypto/hmac/hmac_test.cc index e5128278..d438b702 100644 --- a/crypto/hmac/hmac_test.cc +++ b/crypto/hmac/hmac_test.cc @@ -86,7 +86,7 @@ static const EVP_MD *GetDigest(const std::string &name) { return nullptr; } -static bool TestHMAC(FileTest *t) { +static bool TestHMAC(FileTest *t, void *arg) { std::string digest_str; if (!t->GetAttribute(&digest_str, "HMAC")) { return false; @@ -167,5 +167,5 @@ int main(int argc, char *argv[]) { return 1; } - return FileTestMain(TestHMAC, argv[1]); + return FileTestMain(TestHMAC, nullptr, argv[1]); } diff --git a/crypto/hmac/hmac_tests.txt b/crypto/hmac/hmac_tests.txt index 141b1ed4..9caa3c92 100644 --- a/crypto/hmac/hmac_tests.txt +++ b/crypto/hmac/hmac_tests.txt @@ -1,3 +1,6 @@ +# This test file is shared between evp_test and hmac_test, to test the legacy +# EVP_PKEY_HMAC API. + HMAC = MD5 # Note: The empty key results in passing NULL to HMAC_Init_ex, so this tests # that HMAC_CTX and HMAC treat NULL as the empty key initially. |