From: Kanchana P Sridhar <[email protected]> This patch adds segmentation support for compression.
Add a bit to the crypto_alg flags to indicate support for segmentation. Also add a helper for acomp to test whether a given tfm supports segmentation. Signed-off-by: Herbert Xu <[email protected]> (cherry picked from commit 9c16129795e20b055d5fa8ea7e3fdd35cf6a9a1a) Signed-off-by: Leonid Ravich <[email protected]> --- include/crypto/algapi.h | 5 +++++ include/crypto/internal/acompress.h | 5 +++++ include/linux/crypto.h | 3 +++ 3 files changed, 13 insertions(+) diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index 05deea9dac5e..7d406cfe5751 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h @@ -280,6 +280,11 @@ static inline bool crypto_tfm_req_virt(struct crypto_tfm *tfm) return tfm->__crt_alg->cra_flags & CRYPTO_ALG_REQ_VIRT; } +static inline bool crypto_tfm_req_seg(struct crypto_tfm *tfm) +{ + return tfm->__crt_alg->cra_flags & CRYPTO_ALG_REQ_SEG; +} + static inline u32 crypto_request_flags(struct crypto_async_request *req) { return req->flags & ~CRYPTO_TFM_REQ_ON_STACK; diff --git a/include/crypto/internal/acompress.h b/include/crypto/internal/acompress.h index 9cd37df32dc4..93ae59623f13 100644 --- a/include/crypto/internal/acompress.h +++ b/include/crypto/internal/acompress.h @@ -189,6 +189,11 @@ static inline bool crypto_acomp_req_virt(struct crypto_acomp *tfm) return crypto_tfm_req_virt(&tfm->base); } +static inline bool crypto_acomp_req_seg(struct crypto_acomp *tfm) +{ + return crypto_tfm_req_seg(&tfm->base); +} + void crypto_acomp_free_streams(struct crypto_acomp_streams *s); int crypto_acomp_alloc_streams(struct crypto_acomp_streams *s); diff --git a/include/linux/crypto.h b/include/linux/crypto.h index a2137e19be7d..89b9c3f87f4d 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h @@ -139,6 +139,9 @@ /* Set if the algorithm cannot have a fallback (e.g., phmac). */ #define CRYPTO_ALG_NO_FALLBACK 0x00080000 +/* Set if the algorithm supports segmentation. */ +#define CRYPTO_ALG_REQ_SEG 0x00100000 + /* The high bits 0xff000000 are reserved for type-specific flags. */ /* -- 2.47.3

