Changeset View
Changeset View
Standalone View
Standalone View
sys/opencrypto/crypto.c
Show First 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | SYSCTL_INT(_kern_crypto, OID_AUTO, allow_soft, CTLFLAG_RWTUN, | ||||
&crypto_devallowsoft, 0, | &crypto_devallowsoft, 0, | ||||
"Enable use of software crypto by /dev/crypto"); | "Enable use of software crypto by /dev/crypto"); | ||||
#ifdef COMPAT_FREEBSD12 | #ifdef COMPAT_FREEBSD12 | ||||
SYSCTL_INT(_kern, OID_AUTO, cryptodevallowsoft, CTLFLAG_RWTUN, | SYSCTL_INT(_kern, OID_AUTO, cryptodevallowsoft, CTLFLAG_RWTUN, | ||||
&crypto_devallowsoft, 0, | &crypto_devallowsoft, 0, | ||||
"Enable/disable use of software crypto by /dev/crypto"); | "Enable/disable use of software crypto by /dev/crypto"); | ||||
#endif | #endif | ||||
#ifdef DIAGNOSTIC | |||||
bool crypto_destroyreq_check; | |||||
SYSCTL_BOOL(_kern_crypto, OID_AUTO, destroyreq_check, CTLFLAG_RWTUN, | |||||
&crypto_destroyreq_check, 0, | |||||
"Enable checks when destroying a request"); | |||||
#endif | |||||
MALLOC_DEFINE(M_CRYPTO_DATA, "crypto", "crypto session records"); | MALLOC_DEFINE(M_CRYPTO_DATA, "crypto", "crypto session records"); | ||||
static void crypto_proc(void); | static void crypto_proc(void); | ||||
static struct proc *cryptoproc; | static struct proc *cryptoproc; | ||||
static void crypto_ret_proc(struct crypto_ret_worker *ret_worker); | static void crypto_ret_proc(struct crypto_ret_worker *ret_worker); | ||||
static void crypto_destroy(void); | static void crypto_destroy(void); | ||||
static int crypto_invoke(struct cryptocap *cap, struct cryptop *crp, int hint); | static int crypto_invoke(struct cryptocap *cap, struct cryptop *crp, int hint); | ||||
static void crypto_task_invoke(void *ctx, int pending); | static void crypto_task_invoke(void *ctx, int pending); | ||||
▲ Show 20 Lines • Show All 1,304 Lines • ▼ Show 20 Lines | |||||
void | void | ||||
crypto_destroyreq(struct cryptop *crp) | crypto_destroyreq(struct cryptop *crp) | ||||
{ | { | ||||
#ifdef DIAGNOSTIC | #ifdef DIAGNOSTIC | ||||
{ | { | ||||
struct cryptop *crp2; | struct cryptop *crp2; | ||||
struct crypto_ret_worker *ret_worker; | struct crypto_ret_worker *ret_worker; | ||||
if (!crypto_destroyreq_check) | |||||
return; | |||||
CRYPTO_Q_LOCK(); | CRYPTO_Q_LOCK(); | ||||
TAILQ_FOREACH(crp2, &crp_q, crp_next) { | TAILQ_FOREACH(crp2, &crp_q, crp_next) { | ||||
KASSERT(crp2 != crp, | KASSERT(crp2 != crp, | ||||
("Freeing cryptop from the crypto queue (%p).", | ("Freeing cryptop from the crypto queue (%p).", | ||||
crp)); | crp)); | ||||
} | } | ||||
CRYPTO_Q_UNLOCK(); | CRYPTO_Q_UNLOCK(); | ||||
▲ Show 20 Lines • Show All 390 Lines • Show Last 20 Lines |