summaryrefslogtreecommitdiff
path: root/crypto/internal.h
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2005-09-01 17:43:05 -0700
committerDavid S. Miller <davem@davemloft.net>2005-09-01 17:43:05 -0700
commit09866cf53e2989fee32d397c870a2d7a64b8a94c (patch)
tree10ac00171f26ee070cb45ac47313333404cba581 /crypto/internal.h
parentac12dcaca86edd0e5d4a499dbfb7207a53e1043e (diff)
downloadlinux-crypto-09866cf53e2989fee32d397c870a2d7a64b8a94c.tar.gz
linux-crypto-09866cf53e2989fee32d397c870a2d7a64b8a94c.zip
[CRYPTO]: Added CRYPTO_TFM_REQ_MAY_SLEEP flag
The crypto layer currently uses in_atomic() to determine whether it is allowed to sleep. This is incorrect since spin locks don't always cause in_atomic() to return true. Instead of that, this patch returns to an earlier idea of a per-tfm flag which determines whether sleeping is allowed. Unlike the earlier version, the default is to not allow sleeping. This ensures that no existing code can break. As usual, this flag may either be set through crypto_alloc_tfm(), or just before a specific crypto operation. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--crypto/internal.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/internal.h b/crypto/internal.h
index 37515bea..37aa652c 100644
--- a/crypto/internal.h
+++ b/crypto/internal.h
@@ -17,6 +17,7 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/kernel.h>
+#include <linux/slab.h>
#include <asm/kmap_types.h>
extern enum km_type crypto_km_types[];
@@ -38,7 +39,7 @@ static inline void crypto_kunmap(void *vaddr, int out)
static inline void crypto_yield(struct crypto_tfm *tfm)
{
- if (!in_atomic())
+ if (tfm->crt_flags & CRYPTO_TFM_REQ_MAY_SLEEP)
cond_resched();
}