diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-05-13 15:39:28 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-05-13 15:39:28 +0000 |
commit | 55c37b576f488eb17df5eff986709ece85ab0de7 (patch) | |
tree | 8f19d81ae8338d5ed924bea05d572bef6230c7c4 /sys/crypto/crypto.c | |
parent | b0c05dd06457f702f762c15cfb37a5563a02e3a5 (diff) |
initial cut at /dev/crypto support. takes original mbuf "try, and discard
if we fail" semantics and extends to two varients of data movement: mbuf,
or an iovec style block.
Diffstat (limited to 'sys/crypto/crypto.c')
-rw-r--r-- | sys/crypto/crypto.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/crypto/crypto.c b/sys/crypto/crypto.c index 256eeb88db1..4ca2f90759d 100644 --- a/sys/crypto/crypto.c +++ b/sys/crypto/crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.c,v 1.16 2001/05/05 00:31:34 angelos Exp $ */ +/* $OpenBSD: crypto.c,v 1.17 2001/05/13 15:39:26 deraadt Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) @@ -53,7 +53,7 @@ struct cryptop **crp_req_queue_tail = NULL; * Create a new session. */ int -crypto_newsession(u_int64_t *sid, struct cryptoini *cri) +crypto_newsession(u_int64_t *sid, struct cryptoini *cri, int hard) { struct cryptoini *cr; u_int32_t hid, lid; @@ -80,6 +80,11 @@ crypto_newsession(u_int64_t *sid, struct cryptoini *cri) (crypto_drivers[hid].cc_flags & CRYPTOCAP_F_CLEANUP)) continue; + /* hardware requested -- ignore software drivers */ + if (hard && + (crypto_drivers[hid].cc_flags & CRYPTOCAP_F_SOFTWARE)) + continue; + /* See if all the algorithms are supported */ for (cr = cri; cr; cr = cr->cri_next) if (crypto_drivers[hid].cc_alg[cr->cri_alg] == 0) @@ -325,7 +330,7 @@ crypto_invoke(struct cryptop *crp) for (crd = crp->crp_desc; crd->crd_next; crd = crd->crd_next) crd->CRD_INI.cri_next = &(crd->crd_next->CRD_INI); - if (crypto_newsession(&nid, &(crp->crp_desc->CRD_INI)) == 0) + if (crypto_newsession(&nid, &(crp->crp_desc->CRD_INI), 0) == 0) crp->crp_sid = nid; crp->crp_etype = EAGAIN; @@ -342,7 +347,7 @@ crypto_invoke(struct cryptop *crp) for (crd = crp->crp_desc; crd->crd_next; crd = crd->crd_next) crd->CRD_INI.cri_next = &(crd->crd_next->CRD_INI); - if (crypto_newsession(&nid, &(crp->crp_desc->CRD_INI)) == 0) + if (crypto_newsession(&nid, &(crp->crp_desc->CRD_INI), 0) == 0) crp->crp_sid = nid; crp->crp_etype = EAGAIN; |