Skip to content

Commit

Permalink
crypto: rsa-pkcs1pad - Use helper to set reqsize
Browse files Browse the repository at this point in the history
commit 5b11d1a upstream.

The value of reqsize must only be changed through the helper.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
herbertx authored and gregkh committed Sep 13, 2023
1 parent 63f1117 commit 9c8dab1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crypto/rsa-pkcs1pad.c
Expand Up @@ -575,6 +575,10 @@ static int pkcs1pad_init_tfm(struct crypto_akcipher *tfm)
return PTR_ERR(child_tfm);

ctx->child = child_tfm;

akcipher_set_reqsize(tfm, sizeof(struct pkcs1pad_request) +
crypto_akcipher_reqsize(child_tfm));

return 0;
}

Expand Down Expand Up @@ -670,7 +674,6 @@ static int pkcs1pad_create(struct crypto_template *tmpl, struct rtattr **tb)
inst->alg.set_pub_key = pkcs1pad_set_pub_key;
inst->alg.set_priv_key = pkcs1pad_set_priv_key;
inst->alg.max_size = pkcs1pad_get_max_size;
inst->alg.reqsize = sizeof(struct pkcs1pad_request) + rsa_alg->reqsize;

inst->free = pkcs1pad_free;

Expand Down

0 comments on commit 9c8dab1

Please sign in to comment.