Remove uses of CRIOGET in OCF tests after r368005.
Pointy hat to: jhb Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27367
This commit is contained in:
parent
81870b54d6
commit
a4a23d2137
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=368008
@ -88,17 +88,10 @@ lookup_crid(int fd, const char *devname)
|
||||
static int
|
||||
get_handle_fd(void)
|
||||
{
|
||||
int dc_fd, fd;
|
||||
int fd;
|
||||
|
||||
dc_fd = open("/dev/crypto", O_RDWR);
|
||||
|
||||
/*
|
||||
* 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);
|
||||
fd = open("/dev/crypto", O_RDWR);
|
||||
ATF_REQUIRE(fd >= 0);
|
||||
return (fd);
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,6 @@ class CryptAEAD(dpkt.Packet):
|
||||
)
|
||||
|
||||
# h2py.py can't handle multiarg macros
|
||||
CRIOGET = 3221513060
|
||||
CIOCGSESSION = 3224396645
|
||||
CIOCFSESSION = 2147771238
|
||||
CIOCKEY = 3230688104
|
||||
@ -131,17 +130,7 @@ class CryptAEAD(dpkt.Packet):
|
||||
CIOCCRYPT = 3223085927
|
||||
CIOCCRYPTAEAD = 3223872365
|
||||
|
||||
def _getdev():
|
||||
buf = array.array('I', [0])
|
||||
fd = os.open('/dev/crypto', os.O_RDWR)
|
||||
try:
|
||||
ioctl(fd, CRIOGET, buf, 1)
|
||||
finally:
|
||||
os.close(fd)
|
||||
|
||||
return buf[0]
|
||||
|
||||
_cryptodev = _getdev()
|
||||
_cryptodev = os.open('/dev/crypto', os.O_RDWR)
|
||||
|
||||
def str_to_ascii(val):
|
||||
if sys.version_info[0] >= 3:
|
||||
|
@ -302,17 +302,10 @@ parse_vector(const struct poly1305_kat *kat,
|
||||
static int
|
||||
get_handle_fd(void)
|
||||
{
|
||||
int dc_fd, fd;
|
||||
int fd;
|
||||
|
||||
dc_fd = open("/dev/crypto", O_RDWR);
|
||||
|
||||
/*
|
||||
* 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);
|
||||
fd = open("/dev/crypto", O_RDWR);
|
||||
ATF_REQUIRE(fd >= 0);
|
||||
return (fd);
|
||||
}
|
||||
|
||||
|
@ -113,10 +113,7 @@ UB_mod_exp(BIGNUM *res, const BIGNUM *a, const BIGNUM *b, const BIGNUM *c)
|
||||
{
|
||||
struct crypt_kop kop;
|
||||
void *ale, *ble, *cle;
|
||||
static int crypto_fd = -1;
|
||||
|
||||
if (crypto_fd == -1 && ioctl(devcrypto(), CRIOGET, &crypto_fd) == -1)
|
||||
err(1, "CRIOGET");
|
||||
int crypto_fd = devcrypto();
|
||||
|
||||
if ((ale = bignum_to_le(a)) == NULL)
|
||||
err(1, "bignum_to_le, a");
|
||||
|
@ -229,23 +229,11 @@ crfind(int crid)
|
||||
|
||||
bzero(&find, sizeof(find));
|
||||
find.crid = crid;
|
||||
if (ioctl(devcrypto(), CRIOFINDDEV, &find) == -1)
|
||||
if (ioctl(devcrypto(), CIOCFINDDEV, &find) == -1)
|
||||
err(1, "ioctl(CIOCFINDDEV): crid %d", crid);
|
||||
return find.name;
|
||||
}
|
||||
|
||||
int
|
||||
crget(void)
|
||||
{
|
||||
int fd;
|
||||
|
||||
if (ioctl(devcrypto(), CRIOGET, &fd) == -1)
|
||||
err(1, "ioctl(CRIOGET)");
|
||||
if (fcntl(fd, F_SETFD, 1) == -1)
|
||||
err(1, "fcntl(F_SETFD) (crget)");
|
||||
return fd;
|
||||
}
|
||||
|
||||
char
|
||||
rdigit(void)
|
||||
{
|
||||
@ -259,7 +247,7 @@ rdigit(void)
|
||||
void
|
||||
runtest(struct alg *ealg, struct alg *alg, int count, int size, u_long cmd, struct timeval *tv)
|
||||
{
|
||||
int i, fd = crget();
|
||||
int i, fd = devcrypto();
|
||||
struct timeval start, stop, dt;
|
||||
char *cleartext, *ciphertext, *originaltext, *key;
|
||||
struct session2_op sop;
|
||||
|
Loading…
Reference in New Issue
Block a user