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

Function crypto_kinvoke

freebsd/opencrypto/crypto.c:1611–1655  ·  view source on GitHub ↗

* Dispatch an asymmetric crypto request. */

Source from the content-addressed store, hash-verified

1609 * Dispatch an asymmetric crypto request.
1610 */
1611static int
1612crypto_kinvoke(struct cryptkop *krp)
1613{
1614 struct cryptocap *cap = NULL;
1615 int error;
1616
1617 KASSERT(krp != NULL, ("%s: krp == NULL", __func__));
1618 KASSERT(krp->krp_callback != NULL,
1619 ("%s: krp->crp_callback == NULL", __func__));
1620
1621 CRYPTO_DRIVER_LOCK();
1622 cap = crypto_lookup_kdriver(krp);
1623 if (cap == NULL) {
1624 CRYPTO_DRIVER_UNLOCK();
1625 krp->krp_status = ENODEV;
1626 crypto_kdone(krp);
1627 return (0);
1628 }
1629
1630 /*
1631 * If the device is blocked, return ERESTART to requeue it.
1632 */
1633 if (cap->cc_kqblocked) {
1634 /*
1635 * XXX: Previously this set krp_status to ERESTART and
1636 * invoked crypto_kdone but the caller would still
1637 * requeue it.
1638 */
1639 CRYPTO_DRIVER_UNLOCK();
1640 return (ERESTART);
1641 }
1642
1643 cap->cc_koperations++;
1644 CRYPTO_DRIVER_UNLOCK();
1645 error = CRYPTODEV_KPROCESS(cap->cc_dev, krp, 0);
1646 if (error == ERESTART) {
1647 CRYPTO_DRIVER_LOCK();
1648 cap->cc_koperations--;
1649 CRYPTO_DRIVER_UNLOCK();
1650 return (error);
1651 }
1652
1653 KASSERT(error == 0, ("error %d returned from crypto_kprocess", error));
1654 return (0);
1655}
1656
1657static void
1658crypto_task_invoke(void *ctx, int pending)

Callers 2

crypto_kdispatchFunction · 0.85
crypto_procFunction · 0.85

Calls 2

crypto_lookup_kdriverFunction · 0.85
crypto_kdoneFunction · 0.85

Tested by

no test coverage detected