diff options
-rw-r--r-- | sys/crypto/crypto.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/crypto/crypto.c b/sys/crypto/crypto.c index e34936c5bc4..e964768b6dc 100644 --- a/sys/crypto/crypto.c +++ b/sys/crypto/crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.c,v 1.56 2010/07/08 09:46:50 thib Exp $ */ +/* $OpenBSD: crypto.c,v 1.57 2010/08/08 04:10:49 jsing Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) * @@ -35,6 +35,7 @@ int crypto_drivers_num = 0; struct pool cryptop_pool; struct pool cryptodesc_pool; +int crypto_pool_initialized = 0; struct workq *crypto_workq; @@ -592,6 +593,14 @@ 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); @@ -617,12 +626,8 @@ crypto_getreq(int num) } void -init_crypto(void) +init_crypto() { - 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_workq = workq_create("crypto", 1, IPL_HIGH); } |