MCPcopy Create free account
hub / github.com/F-Stack/f-stack / crypto_find_driver

Function crypto_find_driver

freebsd/opencrypto/crypto.c:1057–1076  ·  view source on GitHub ↗

* Lookup a driver by name. We match against the full device * name and unit, and against just the name. The latter gives * us a simple widlcarding by device name. On success return the * driver/hardware identifier; otherwise return -1. */

Source from the content-addressed store, hash-verified

1055 * driver/hardware identifier; otherwise return -1.
1056 */
1057int
1058crypto_find_driver(const char *match)
1059{
1060 struct cryptocap *cap;
1061 int i, len = strlen(match);
1062
1063 CRYPTO_DRIVER_LOCK();
1064 for (i = 0; i < crypto_drivers_size; i++) {
1065 if (crypto_drivers[i] == NULL)
1066 continue;
1067 cap = crypto_drivers[i];
1068 if (strncmp(match, device_get_nameunit(cap->cc_dev), len) == 0 ||
1069 strncmp(match, device_get_name(cap->cc_dev), len) == 0) {
1070 CRYPTO_DRIVER_UNLOCK();
1071 return (i);
1072 }
1073 }
1074 CRYPTO_DRIVER_UNLOCK();
1075 return (-1);
1076}
1077
1078/*
1079 * Return the device_t for the specified driver or NULL

Callers 1

cryptodev_findFunction · 0.85

Calls 3

strncmpFunction · 0.85
device_get_nameunitFunction · 0.85
device_get_nameFunction · 0.85

Tested by

no test coverage detected