diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2010-09-08 14:15:57 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2010-09-08 14:15:57 +0000 |
commit | 2c0c301deb10662e3dbe20c8870ce9b9ca67853e (patch) | |
tree | 7e67763f699f0be1ffd304ff8f65368363b894fe /sys/crypto | |
parent | 1d264ec471038b319a8ce96e1a14dbfa6353698d (diff) |
Reintroduce most crypto/crypto.c r1.55:
Move pool initialization to init_crypto and zap the crypto_pool_initialized
variable. This way we don't have to check if the pool are initialized every
time we do a crypto_getreq().
However, also perform the crypto initialisation earlier in init_main so
that the crypto pools are initialised before they are used.
ok mikeb@ thib@ deraadt@
Diffstat (limited to 'sys/crypto')
-rw-r--r-- | sys/crypto/crypto.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/sys/crypto/crypto.c b/sys/crypto/crypto.c index e964768b6dc..f30bf32f6b9 100644 --- a/sys/crypto/crypto.c +++ b/sys/crypto/crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.c,v 1.57 2010/08/08 04:10:49 jsing Exp $ */ +/* $OpenBSD: crypto.c,v 1.58 2010/09/08 14:15:56 jsing Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) * @@ -28,14 +28,13 @@ #include <crypto/cryptodev.h> -void init_crypto(void); +void crypto_init(void); struct cryptocap *crypto_drivers = NULL; int crypto_drivers_num = 0; struct pool cryptop_pool; struct pool cryptodesc_pool; -int crypto_pool_initialized = 0; struct workq *crypto_workq; @@ -593,14 +592,6 @@ crypto_getreq(int num) s = splvm(); - if (crypto_pool_initialized == 0) { - pool_init(&cryptop_pool, sizeof(struct cryptop), 0, 0, - 0, "cryptop", NULL); - pool_init(&cryptodesc_pool, sizeof(struct cryptodesc), 0, 0, - 0, "cryptodesc", NULL); - crypto_pool_initialized = 1; - } - crp = pool_get(&cryptop_pool, PR_NOWAIT); if (crp == NULL) { splx(s); @@ -626,9 +617,14 @@ crypto_getreq(int num) } void -init_crypto() +crypto_init(void) { crypto_workq = workq_create("crypto", 1, IPL_HIGH); + + pool_init(&cryptop_pool, sizeof(struct cryptop), 0, 0, + 0, "cryptop", NULL); + pool_init(&cryptodesc_pool, sizeof(struct cryptodesc), 0, 0, + 0, "cryptodesc", NULL); } /* |