Changeset View
Changeset View
Standalone View
Standalone View
sys/opencrypto/crypto.c
Show First 20 Lines • Show All 896 Lines • ▼ Show 20 Lines | |||||
* driver that supports the algorithms we need. If there are | * driver that supports the algorithms we need. If there are | ||||
* multiple suitable drivers we choose the driver with the | * multiple suitable drivers we choose the driver with the | ||||
* fewest active operations. We prefer hardware-backed | * fewest active operations. We prefer hardware-backed | ||||
* drivers to software ones when either may be used. | * drivers to software ones when either may be used. | ||||
*/ | */ | ||||
static struct cryptocap * | static struct cryptocap * | ||||
crypto_select_kdriver(const struct cryptkop *krp, int flags) | crypto_select_kdriver(const struct cryptkop *krp, int flags) | ||||
{ | { | ||||
struct cryptocap *cap, *best, *blocked; | struct cryptocap *cap, *best; | ||||
int match, hid; | int match, hid; | ||||
CRYPTO_DRIVER_ASSERT(); | CRYPTO_DRIVER_ASSERT(); | ||||
/* | /* | ||||
* Look first for hardware crypto devices if permitted. | * Look first for hardware crypto devices if permitted. | ||||
*/ | */ | ||||
if (flags & CRYPTOCAP_F_HARDWARE) | if (flags & CRYPTOCAP_F_HARDWARE) | ||||
match = CRYPTOCAP_F_HARDWARE; | match = CRYPTOCAP_F_HARDWARE; | ||||
else | else | ||||
match = CRYPTOCAP_F_SOFTWARE; | match = CRYPTOCAP_F_SOFTWARE; | ||||
best = NULL; | best = NULL; | ||||
blocked = NULL; | |||||
again: | again: | ||||
for (hid = 0; hid < crypto_drivers_num; hid++) { | for (hid = 0; hid < crypto_drivers_num; hid++) { | ||||
cap = &crypto_drivers[hid]; | cap = &crypto_drivers[hid]; | ||||
/* | /* | ||||
* If it's not initialized, is in the process of | * If it's not initialized, is in the process of | ||||
* going away, or is not appropriate (hardware | * going away, or is not appropriate (hardware | ||||
* or software based on match), then skip. | * or software based on match), then skip. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 687 Lines • Show Last 20 Lines |