Changeset View
Changeset View
Standalone View
Standalone View
head/tests/sys/opencrypto/blake2_test.c
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | lookup_crid(int fd, const char *devname) | ||||
strlcpy(find.name, devname, sizeof(find.name)); | strlcpy(find.name, devname, sizeof(find.name)); | ||||
ATF_REQUIRE(ioctl(fd, CIOCFINDDEV, &find) != -1); | ATF_REQUIRE(ioctl(fd, CIOCFINDDEV, &find) != -1); | ||||
return (find.crid); | return (find.crid); | ||||
} | } | ||||
static int | static int | ||||
get_handle_fd(void) | get_handle_fd(void) | ||||
{ | { | ||||
int dc_fd, fd; | int fd; | ||||
dc_fd = open("/dev/crypto", O_RDWR); | fd = open("/dev/crypto", O_RDWR); | ||||
ATF_REQUIRE(fd >= 0); | |||||
/* | |||||
* Why do we do this dance instead of just operating on /dev/crypto | |||||
* directly? I have no idea. | |||||
*/ | |||||
ATF_REQUIRE(dc_fd >= 0); | |||||
ATF_REQUIRE(ioctl(dc_fd, CRIOGET, &fd) != -1); | |||||
close(dc_fd); | |||||
return (fd); | return (fd); | ||||
} | } | ||||
static int | static int | ||||
create_session(int fd, int alg, int crid, const void *key, size_t klen) | create_session(int fd, int alg, int crid, const void *key, size_t klen) | ||||
{ | { | ||||
struct session2_op sop; | struct session2_op sop; | ||||
▲ Show 20 Lines • Show All 117 Lines • Show Last 20 Lines |