unsigned int block_size =
crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm));
unsigned int len, need_pad, sg_count;
+ gfp_t gfp;
int ret;
if (!ctx->u.aes.key_len)
* possible data pieces (buffer, input data, padding)
*/
sg_count = (nbytes) ? sg_nents(req->src) + 2 : 2;
- ret = sg_alloc_table(&rctx->data_sg, sg_count, GFP_KERNEL);
+ gfp = req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ?
+ GFP_KERNEL : GFP_ATOMIC;
+ ret = sg_alloc_table(&rctx->data_sg, sg_count, gfp);
if (ret)
return ret;
unsigned int block_size =
crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm));
unsigned int len, sg_count;
+ gfp_t gfp;
int ret;
if (!final && ((nbytes + rctx->buf_count) <= block_size)) {
* possible data pieces (hmac ipad, buffer, input data)
*/
sg_count = (nbytes) ? sg_nents(req->src) + 2 : 2;
- ret = sg_alloc_table(&rctx->data_sg, sg_count, GFP_KERNEL);
+ gfp = req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ?
+ GFP_KERNEL : GFP_ATOMIC;
+ ret = sg_alloc_table(&rctx->data_sg, sg_count, gfp);
if (ret)
return ret;