@@ -416,6 +416,10 @@ static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm,
{
struct aead_request *req;
+ if (crypto_aead_reqsize(tfm) &&
+ (crypto_aead_get_flags(tfm) & CRYPTO_TFM_REQ_DMA))
+ gfp |= GFP_DMA;
+
req = kmalloc(sizeof(*req) + crypto_aead_reqsize(tfm), gfp);
if (likely(req))
@@ -158,6 +158,23 @@ static inline unsigned int crypto_akcipher_reqsize(struct crypto_akcipher *tfm)
return crypto_akcipher_alg(tfm)->reqsize;
}
+static inline u32 crypto_akcipher_get_flags(struct crypto_akcipher *tfm)
+{
+ return crypto_tfm_get_flags(crypto_akcipher_tfm(tfm));
+}
+
+static inline void crypto_akcipher_set_flags(struct crypto_akcipher *tfm,
+ u32 flags)
+{
+ crypto_tfm_set_flags(crypto_akcipher_tfm(tfm), flags);
+}
+
+static inline void crypto_akcipher_clear_flags(struct crypto_akcipher *tfm,
+ u32 flags)
+{
+ crypto_tfm_clear_flags(crypto_akcipher_tfm(tfm), flags);
+}
+
static inline void akcipher_request_set_tfm(struct akcipher_request *req,
struct crypto_akcipher *tfm)
{
@@ -193,6 +210,10 @@ static inline struct akcipher_request *akcipher_request_alloc(
{
struct akcipher_request *req;
+ if (crypto_akcipher_reqsize(tfm) &&
+ (crypto_akcipher_get_flags(tfm) & CRYPTO_TFM_REQ_DMA))
+ gfp |= GFP_DMA;
+
req = kmalloc(sizeof(*req) + crypto_akcipher_reqsize(tfm), gfp);
if (likely(req))
akcipher_request_set_tfm(req, tfm);
@@ -599,6 +599,10 @@ static inline struct ahash_request *ahash_request_alloc(
{
struct ahash_request *req;
+ if (crypto_ahash_reqsize(tfm) &&
+ (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_REQ_DMA))
+ gfp |= GFP_DMA;
+
req = kmalloc(sizeof(struct ahash_request) +
crypto_ahash_reqsize(tfm), gfp);
@@ -493,6 +493,10 @@ static inline struct skcipher_request *skcipher_request_alloc(
{
struct skcipher_request *req;
+ if (crypto_skcipher_reqsize(tfm) &&
+ (crypto_skcipher_get_flags(tfm) & CRYPTO_TFM_REQ_DMA))
+ gfp |= GFP_DMA;
+
req = kmalloc(sizeof(struct skcipher_request) +
crypto_skcipher_reqsize(tfm), gfp);
@@ -141,6 +141,7 @@
#define CRYPTO_TFM_REQ_FORBID_WEAK_KEYS 0x00000100
#define CRYPTO_TFM_REQ_MAY_SLEEP 0x00000200
#define CRYPTO_TFM_REQ_MAY_BACKLOG 0x00000400
+#define CRYPTO_TFM_REQ_DMA 0x00000800
/*
* Miscellaneous stuff.