Commit 3a32ce50 authored by Herbert Xu's avatar Herbert Xu

crypto: rsa-pkcs1pad - Always use GFP_KERNEL

We don't currently support using akcipher in atomic contexts,
so GFP_KERNEL should always be used.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 0f2c8319
...@@ -260,8 +260,7 @@ static int pkcs1pad_encrypt(struct akcipher_request *req) ...@@ -260,8 +260,7 @@ static int pkcs1pad_encrypt(struct akcipher_request *req)
req_ctx->child_req.dst_len = ctx->key_size; req_ctx->child_req.dst_len = ctx->key_size;
req_ctx->in_buf = kmalloc(ctx->key_size - 1 - req->src_len, req_ctx->in_buf = kmalloc(ctx->key_size - 1 - req->src_len,
(req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ? GFP_KERNEL);
GFP_KERNEL : GFP_ATOMIC);
if (!req_ctx->in_buf) if (!req_ctx->in_buf)
return -ENOMEM; return -ENOMEM;
...@@ -274,9 +273,7 @@ static int pkcs1pad_encrypt(struct akcipher_request *req) ...@@ -274,9 +273,7 @@ static int pkcs1pad_encrypt(struct akcipher_request *req)
pkcs1pad_sg_set_buf(req_ctx->in_sg, req_ctx->in_buf, pkcs1pad_sg_set_buf(req_ctx->in_sg, req_ctx->in_buf,
ctx->key_size - 1 - req->src_len, req->src); ctx->key_size - 1 - req->src_len, req->src);
req_ctx->out_buf = kmalloc(ctx->key_size, req_ctx->out_buf = kmalloc(ctx->key_size, GFP_KERNEL);
(req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
GFP_KERNEL : GFP_ATOMIC);
if (!req_ctx->out_buf) { if (!req_ctx->out_buf) {
kfree(req_ctx->in_buf); kfree(req_ctx->in_buf);
return -ENOMEM; return -ENOMEM;
...@@ -379,9 +376,7 @@ static int pkcs1pad_decrypt(struct akcipher_request *req) ...@@ -379,9 +376,7 @@ static int pkcs1pad_decrypt(struct akcipher_request *req)
req_ctx->child_req.dst = req_ctx->out_sg; req_ctx->child_req.dst = req_ctx->out_sg;
req_ctx->child_req.dst_len = ctx->key_size ; req_ctx->child_req.dst_len = ctx->key_size ;
req_ctx->out_buf = kmalloc(ctx->key_size, req_ctx->out_buf = kmalloc(ctx->key_size, GFP_KERNEL);
(req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
GFP_KERNEL : GFP_ATOMIC);
if (!req_ctx->out_buf) if (!req_ctx->out_buf)
return -ENOMEM; return -ENOMEM;
...@@ -438,8 +433,7 @@ static int pkcs1pad_sign(struct akcipher_request *req) ...@@ -438,8 +433,7 @@ static int pkcs1pad_sign(struct akcipher_request *req)
req_ctx->child_req.dst_len = ctx->key_size; req_ctx->child_req.dst_len = ctx->key_size;
req_ctx->in_buf = kmalloc(ctx->key_size - 1 - req->src_len, req_ctx->in_buf = kmalloc(ctx->key_size - 1 - req->src_len,
(req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ? GFP_KERNEL);
GFP_KERNEL : GFP_ATOMIC);
if (!req_ctx->in_buf) if (!req_ctx->in_buf)
return -ENOMEM; return -ENOMEM;
...@@ -454,9 +448,7 @@ static int pkcs1pad_sign(struct akcipher_request *req) ...@@ -454,9 +448,7 @@ static int pkcs1pad_sign(struct akcipher_request *req)
pkcs1pad_sg_set_buf(req_ctx->in_sg, req_ctx->in_buf, pkcs1pad_sg_set_buf(req_ctx->in_sg, req_ctx->in_buf,
ctx->key_size - 1 - req->src_len, req->src); ctx->key_size - 1 - req->src_len, req->src);
req_ctx->out_buf = kmalloc(ctx->key_size, req_ctx->out_buf = kmalloc(ctx->key_size, GFP_KERNEL);
(req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
GFP_KERNEL : GFP_ATOMIC);
if (!req_ctx->out_buf) { if (!req_ctx->out_buf) {
kfree(req_ctx->in_buf); kfree(req_ctx->in_buf);
return -ENOMEM; return -ENOMEM;
...@@ -577,9 +569,7 @@ static int pkcs1pad_verify(struct akcipher_request *req) ...@@ -577,9 +569,7 @@ static int pkcs1pad_verify(struct akcipher_request *req)
req_ctx->child_req.dst = req_ctx->out_sg; req_ctx->child_req.dst = req_ctx->out_sg;
req_ctx->child_req.dst_len = ctx->key_size; req_ctx->child_req.dst_len = ctx->key_size;
req_ctx->out_buf = kmalloc(ctx->key_size, req_ctx->out_buf = kmalloc(ctx->key_size, GFP_KERNEL);
(req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
GFP_KERNEL : GFP_ATOMIC);
if (!req_ctx->out_buf) if (!req_ctx->out_buf)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment