* Unregister all algorithms associated with a crypto driver. * If there are pending sessions using it, leave enough information * around so that subsequent calls using those sessions will * correctly detect the driver has been unregistered and reroute * requests. */
| 1157 | * requests. |
| 1158 | */ |
| 1159 | int |
| 1160 | crypto_unregister_all(uint32_t driverid) |
| 1161 | { |
| 1162 | struct cryptocap *cap; |
| 1163 | |
| 1164 | CRYPTO_DRIVER_LOCK(); |
| 1165 | cap = crypto_checkdriver(driverid); |
| 1166 | if (cap == NULL) { |
| 1167 | CRYPTO_DRIVER_UNLOCK(); |
| 1168 | return (EINVAL); |
| 1169 | } |
| 1170 | |
| 1171 | cap->cc_flags |= CRYPTOCAP_F_CLEANUP; |
| 1172 | crypto_drivers[driverid] = NULL; |
| 1173 | |
| 1174 | /* |
| 1175 | * XXX: This doesn't do anything to kick sessions that |
| 1176 | * have no pending operations. |
| 1177 | */ |
| 1178 | while (cap->cc_sessions != 0 || cap->cc_koperations != 0) |
| 1179 | mtx_sleep(cap, &crypto_drivers_mtx, 0, "cryunreg", 0); |
| 1180 | CRYPTO_DRIVER_UNLOCK(); |
| 1181 | cap_rele(cap); |
| 1182 | |
| 1183 | return (0); |
| 1184 | } |
| 1185 | |
| 1186 | /* |
| 1187 | * Clear blockage on a driver. The what parameter indicates whether |
no test coverage detected