Fix sys/opencrypto/blake2_test when kern.cryptodevallowsoft=0

Two of these testcases require software crypto to be enabled. Curiously, it
isn't by default.

PR:		230671
Reported by:	Jenkins
Reviewed by:	cem
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D16755
This commit is contained in:
Alan Somers 2018-08-16 23:49:56 +00:00
parent 32d2623ae2
commit 3c5ba95ad1
2 changed files with 14 additions and 0 deletions

View File

@ -31,6 +31,7 @@
#include <sys/param.h>
#include <sys/module.h>
#include <sys/sysctl.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
@ -52,6 +53,17 @@
} \
} while(0)
#define ATF_REQUIRE_SYSCTL_INT(_mib_name, _required_value) do { \
int value; \
size_t size = sizeof(value); \
if (sysctlbyname(_mib_name, &value, &size, NULL, 0) == -1) { \
atf_tc_skip("sysctl for %s failed: %s", _mib_name, \
strerror(errno)); \
} \
if (value != _required_value) \
atf_tc_skip("requires %s=%d", _mib_name, _required_value); \
} while(0)
#define PLAIN_REQUIRE_FEATURE(_feature_name, _exit_code) do { \
if (feature_present(_feature_name) == 0) { \
printf("kernel feature (%s) not present\n", \

View File

@ -172,12 +172,14 @@ test_blake2s_vectors(int crid, const char *modname)
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");
}
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");
}