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

Function crypto_kregister

freebsd/opencrypto/crypto.c:1119–1150  ·  view source on GitHub ↗

* Register support for a key-related algorithm. This routine * is called once for each algorithm supported a driver. */

Source from the content-addressed store, hash-verified

1117 * is called once for each algorithm supported a driver.
1118 */
1119int
1120crypto_kregister(uint32_t driverid, int kalg, uint32_t flags)
1121{
1122 struct cryptocap *cap;
1123 int err;
1124
1125 CRYPTO_DRIVER_LOCK();
1126
1127 cap = crypto_checkdriver(driverid);
1128 if (cap != NULL &&
1129 (CRK_ALGORITM_MIN <= kalg && kalg <= CRK_ALGORITHM_MAX)) {
1130 /*
1131 * XXX Do some performance testing to determine placing.
1132 * XXX We probably need an auxiliary data structure that
1133 * XXX describes relative performances.
1134 */
1135
1136 cap->cc_kalg[kalg] = flags | CRYPTO_ALG_FLAG_SUPPORTED;
1137 if (bootverbose)
1138 printf("crypto: %s registers key alg %u flags %u\n"
1139 , device_get_nameunit(cap->cc_dev)
1140 , kalg
1141 , flags
1142 );
1143 gone_in_dev(cap->cc_dev, 14, "asymmetric crypto");
1144 err = 0;
1145 } else
1146 err = EINVAL;
1147
1148 CRYPTO_DRIVER_UNLOCK();
1149 return err;
1150}
1151
1152/*
1153 * Unregister all algorithms associated with a crypto driver.

Callers 1

xlp_rsa_attachFunction · 0.85

Calls 3

crypto_checkdriverFunction · 0.85
device_get_nameunitFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected