diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2020-04-22 20:43:18 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2020-04-22 20:43:18 +0000 |
| commit | 871eec00e252fcdf21c24e313ab7da8ee7b7d39d (patch) | |
| tree | 49ee4c99e894c3607793548889340869f5ddd2ca | |
| parent | e27a9ad8e6b0587e4ba5d6a6410d8b458974032f (diff) | |
Notes
| -rw-r--r-- | tests/sys/opencrypto/blake2_test.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/tests/sys/opencrypto/blake2_test.c b/tests/sys/opencrypto/blake2_test.c index f8392d77ba74..6809f4500415 100644 --- a/tests/sys/opencrypto/blake2_test.c +++ b/tests/sys/opencrypto/blake2_test.c @@ -75,6 +75,17 @@ initialize_constant_buffers(void) } static int +lookup_crid(int fd, const char *devname) +{ + struct crypt_find_op find; + + find.crid = -1; + strlcpy(find.name, devname, sizeof(find.name)); + ATF_REQUIRE(ioctl(fd, CIOCFINDDEV, &find) != -1); + return (find.crid); +} + +static int get_handle_fd(void) { int dc_fd, fd; @@ -124,10 +135,10 @@ do_cryptop(int fd, int ses, size_t inlen, void *out) } static void -test_blake2b_vectors(int crid, const char *modname) +test_blake2b_vectors(const char *devname, const char *modname) { uint8_t hash[BLAKE2B_OUTBYTES]; - int fd, ses; + int crid, fd, ses; size_t i; ATF_REQUIRE_KERNEL_MODULE(modname); @@ -135,6 +146,7 @@ test_blake2b_vectors(int crid, const char *modname) initialize_constant_buffers(); fd = get_handle_fd(); + crid = lookup_crid(fd, devname); ses = create_session(fd, CRYPTO_BLAKE2B, crid, key2b, sizeof(key2b)); for (i = 0; i < sizeof(katbuf); i++) { @@ -147,10 +159,10 @@ test_blake2b_vectors(int crid, const char *modname) } static void -test_blake2s_vectors(int crid, const char *modname) +test_blake2s_vectors(const char *devname, const char *modname) { uint8_t hash[BLAKE2S_OUTBYTES]; - int fd, ses; + int crid, fd, ses; size_t i; ATF_REQUIRE_KERNEL_MODULE(modname); @@ -158,6 +170,7 @@ test_blake2s_vectors(int crid, const char *modname) initialize_constant_buffers(); fd = get_handle_fd(); + crid = lookup_crid(fd, devname); ses = create_session(fd, CRYPTO_BLAKE2S, crid, key2s, sizeof(key2s)); for (i = 0; i < sizeof(katbuf); i++) { @@ -173,33 +186,29 @@ ATF_TC_WITHOUT_HEAD(blake2b_vectors); ATF_TC_BODY(blake2b_vectors, tc) { ATF_REQUIRE_SYSCTL_INT("kern.cryptodevallowsoft", 1); - test_blake2b_vectors(CRYPTO_FLAG_SOFTWARE, "nexus/cryptosoft"); + test_blake2b_vectors("cryptosoft0", "nexus/cryptosoft"); } ATF_TC_WITHOUT_HEAD(blake2s_vectors); ATF_TC_BODY(blake2s_vectors, tc) { ATF_REQUIRE_SYSCTL_INT("kern.cryptodevallowsoft", 1); - test_blake2s_vectors(CRYPTO_FLAG_SOFTWARE, "nexus/cryptosoft"); + test_blake2s_vectors("cryptosoft0", "nexus/cryptosoft"); } #if defined(__i386__) || defined(__amd64__) ATF_TC_WITHOUT_HEAD(blake2b_vectors_x86); ATF_TC_BODY(blake2b_vectors_x86, tc) { - if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) - atf_tc_skip("https://bugs.freebsd.org/245825"); - - test_blake2b_vectors(CRYPTO_FLAG_HARDWARE, "nexus/blake2"); + ATF_REQUIRE_SYSCTL_INT("kern.cryptodevallowsoft", 1); + test_blake2b_vectors("blaketwo0", "nexus/blake2"); } ATF_TC_WITHOUT_HEAD(blake2s_vectors_x86); ATF_TC_BODY(blake2s_vectors_x86, tc) { - if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) - atf_tc_skip("https://bugs.freebsd.org/245825"); - - test_blake2s_vectors(CRYPTO_FLAG_HARDWARE, "nexus/blake2"); + ATF_REQUIRE_SYSCTL_INT("kern.cryptodevallowsoft", 1); + test_blake2s_vectors("blaketwo0", "nexus/blake2"); } #endif |
