crypto: akcipher - Move reqsize into tfm

The value of reqsize cannot be determined in case of fallbacks.
Therefore it must be stored in the tfm and not the alg object.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Herbert Xu 2022-11-22 18:03:35 +08:00
parent 93c446cd36
commit 3e71e5b0ef
2 changed files with 5 additions and 4 deletions

View File

@ -43,9 +43,12 @@ struct akcipher_request {
* struct crypto_akcipher - user-instantiated objects which encapsulate * struct crypto_akcipher - user-instantiated objects which encapsulate
* algorithms and core processing logic * algorithms and core processing logic
* *
* @reqsize: Request context size required by algorithm implementation
* @base: Common crypto API algorithm data structure * @base: Common crypto API algorithm data structure
*/ */
struct crypto_akcipher { struct crypto_akcipher {
unsigned int reqsize;
struct crypto_tfm base; struct crypto_tfm base;
}; };
@ -86,7 +89,6 @@ struct crypto_akcipher {
* counterpart to @init, used to remove various changes set in * counterpart to @init, used to remove various changes set in
* @init. * @init.
* *
* @reqsize: Request context size required by algorithm implementation
* @base: Common crypto API algorithm data structure * @base: Common crypto API algorithm data structure
*/ */
struct akcipher_alg { struct akcipher_alg {
@ -102,7 +104,6 @@ struct akcipher_alg {
int (*init)(struct crypto_akcipher *tfm); int (*init)(struct crypto_akcipher *tfm);
void (*exit)(struct crypto_akcipher *tfm); void (*exit)(struct crypto_akcipher *tfm);
unsigned int reqsize;
struct crypto_alg base; struct crypto_alg base;
}; };
@ -155,7 +156,7 @@ static inline struct akcipher_alg *crypto_akcipher_alg(
static inline unsigned int crypto_akcipher_reqsize(struct crypto_akcipher *tfm) static inline unsigned int crypto_akcipher_reqsize(struct crypto_akcipher *tfm)
{ {
return crypto_akcipher_alg(tfm)->reqsize; return tfm->reqsize;
} }
static inline void akcipher_request_set_tfm(struct akcipher_request *req, static inline void akcipher_request_set_tfm(struct akcipher_request *req,

View File

@ -36,7 +36,7 @@ static inline void *akcipher_request_ctx(struct akcipher_request *req)
static inline void akcipher_set_reqsize(struct crypto_akcipher *akcipher, static inline void akcipher_set_reqsize(struct crypto_akcipher *akcipher,
unsigned int reqsize) unsigned int reqsize)
{ {
crypto_akcipher_alg(akcipher)->reqsize = reqsize; akcipher->reqsize = reqsize;
} }
static inline void *akcipher_tfm_ctx(struct crypto_akcipher *tfm) static inline void *akcipher_tfm_ctx(struct crypto_akcipher *tfm)