diff options
author | 2014-10-23 00:10:09 +0000 | |
---|---|---|
committer | 2014-10-23 00:10:09 +0000 | |
commit | 4b6c0a6d0cf041cd6fd65c9eb0607df8cd41f684 (patch) | |
tree | 9fa5657c8426bf606b04b8ee8882088162d98052 | |
parent | make [bl]emtoh{16,32,64} take volatile const foo *, not volatile foo * (diff) | |
download | wireguard-openbsd-4b6c0a6d0cf041cd6fd65c9eb0607df8cd41f684.tar.xz wireguard-openbsd-4b6c0a6d0cf041cd6fd65c9eb0607df8cd41f684.zip |
revert previous. it did more than the commit message said it did.
-rw-r--r-- | sys/crypto/crypto.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/crypto/crypto.c b/sys/crypto/crypto.c index e56c04b65a8..8adf3b4c977 100644 --- a/sys/crypto/crypto.c +++ b/sys/crypto/crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.c,v 1.69 2014/10/22 05:37:54 dlg Exp $ */ +/* $OpenBSD: crypto.c,v 1.70 2014/10/23 00:10:09 dlg Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) * @@ -453,16 +453,20 @@ void crypto_freereq(struct cryptop *crp) { struct cryptodesc *crd; + int s; if (crp == NULL) return; + s = splvm(); + while ((crd = crp->crp_desc) != NULL) { crp->crp_desc = crd->crd_next; pool_put(&cryptodesc_pool, crd); } pool_put(&cryptop_pool, crp); + splx(s); } /* @@ -473,14 +477,20 @@ crypto_getreq(int num) { struct cryptodesc *crd; struct cryptop *crp; + int s; + s = splvm(); + crp = pool_get(&cryptop_pool, PR_NOWAIT | PR_ZERO); - if (crp == NULL) + if (crp == NULL) { + splx(s); return NULL; + } while (num--) { crd = pool_get(&cryptodesc_pool, PR_NOWAIT | PR_ZERO); if (crd == NULL) { + splx(s); crypto_freereq(crp); return NULL; } @@ -489,20 +499,19 @@ crypto_getreq(int num) crp->crp_desc = crd; } + splx(s); return crp; } void crypto_init(void) { - crypto_taskq = taskq_create("crypto", 1, IPL_VM); + crypto_taskq = taskq_create("crypto", 1, IPL_HIGH); pool_init(&cryptop_pool, sizeof(struct cryptop), 0, 0, 0, "cryptop", NULL); - pool_setipl(&cryptop_pool, IPL_VM); pool_init(&cryptodesc_pool, sizeof(struct cryptodesc), 0, 0, 0, "cryptodesc", NULL); - pool_setipl(&cryptodesc_pool, IPL_VM); } /* |