The value of reqsize cannot be determined in case of fallbacks. Therefore it must be stored in the tfm and not the alg object.
Unified · Split
| @@ -53,7 +53,7 @@ static inline void *kpp_request_ctx(struct kpp_request *req) · 52 unmodified lines | |||
| 53 | static inline void kpp_set_reqsize(struct crypto_kpp *kpp, | 53 | static inline void kpp_set_reqsize(struct crypto_kpp *kpp, |
| 54 | unsigned int reqsize) | 54 | unsigned int reqsize) |
| 55 | { | 55 | { |
| 56 | crypto_kpp_alg(kpp)->reqsize = reqsize; | 56 | kpp->reqsize = reqsize; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | static inline void *kpp_tfm_ctx(struct crypto_kpp *tfm) | 59 | static inline void *kpp_tfm_ctx(struct crypto_kpp *tfm) |
| @@ -37,9 +37,13 @@ struct kpp_request { · 36 unmodified lines | |||
| 37 | * struct crypto_kpp - user-instantiated object which encapsulate | 37 | * struct crypto_kpp - user-instantiated object which encapsulate |
| 38 | * algorithms and core processing logic | 38 | * algorithms and core processing logic |
| 39 | * | 39 | * |
| 40 | * @reqsize: Request context size required by algorithm | ||
| 41 | * implementation | ||
| 40 | * @base: Common crypto API algorithm data structure | 42 | * @base: Common crypto API algorithm data structure |
| 41 | */ | 43 | */ |
| 42 | struct crypto_kpp { | 44 | struct crypto_kpp { |
| 45 | unsigned int reqsize; | ||
| 46 | |||
| 43 | struct crypto_tfm base; | 47 | struct crypto_tfm base; |
| 44 | }; | 48 | }; |
| 45 | 49 | ||
| @@ -64,8 +68,6 @@ struct crypto_kpp { · 18 unmodified lines | |||
| 64 | * put in place here. | 68 | * put in place here. |
| 65 | * @exit: Undo everything @init did. | 69 | * @exit: Undo everything @init did. |
| 66 | * | 70 | * |
| 67 | * @reqsize: Request context size required by algorithm | ||
| 68 | * implementation | ||
| 69 | * @base: Common crypto API algorithm data structure | 71 | * @base: Common crypto API algorithm data structure |
| 70 | */ | 72 | */ |
| 71 | struct kpp_alg { | 73 | struct kpp_alg { |
| @@ -79,7 +81,6 @@ struct kpp_alg { · 7 unmodified lines | |||
| 79 | int (*init)(struct crypto_kpp *tfm); | 81 | int (*init)(struct crypto_kpp *tfm); |
| 80 | void (*exit)(struct crypto_kpp *tfm); | 82 | void (*exit)(struct crypto_kpp *tfm); |
| 81 | 83 | ||
| 82 | unsigned int reqsize; | ||
| 83 | struct crypto_alg base; | 84 | struct crypto_alg base; |
| 84 | }; | 85 | }; |
| 85 | 86 | ||
| @@ -128,7 +129,7 @@ static inline struct kpp_alg *crypto_kpp_alg(struct crypto_kpp *tfm) · 42 unmodified lines | |||
| 128 | 129 | ||
| 129 | static inline unsigned int crypto_kpp_reqsize(struct crypto_kpp *tfm) | 130 | static inline unsigned int crypto_kpp_reqsize(struct crypto_kpp *tfm) |
| 130 | { | 131 | { |
| 131 | return crypto_kpp_alg(tfm)->reqsize; | 132 | return tfm->reqsize; |
| 132 | } | 133 | } |
| 133 | 134 | ||
| 134 | static inline void kpp_request_set_tfm(struct kpp_request *req, | 135 | static inline void kpp_request_set_tfm(struct kpp_request *req, |