diff options
| author | Herbert Xu <herbert@gondor.apana.org.au> | 2025-03-19 14:04:54 +0800 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2025-04-07 13:22:25 +0800 |
| commit | 9c8cf582626ef56632006212b385cfbb6c54f094 (patch) | |
| tree | 9ec4aaad5f729e4e270662b539d936f81a6620a6 /include/crypto/internal | |
| parent | crypto: acomp - Move scomp stream allocation code into acomp (diff) | |
| download | linux-9c8cf582626ef56632006212b385cfbb6c54f094.tar.gz linux-9c8cf582626ef56632006212b385cfbb6c54f094.zip | |
crypto: acomp - Add acomp_walk
Add acomp_walk which is similar to skcipher_walk but tailored for
acomp.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto/internal')
| -rw-r--r-- | include/crypto/internal/acompress.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/include/crypto/internal/acompress.h b/include/crypto/internal/acompress.h index ee5eff19eaf4..fbbff9a8a2d9 100644 --- a/include/crypto/internal/acompress.h +++ b/include/crypto/internal/acompress.h @@ -11,6 +11,7 @@ #include <crypto/acompress.h> #include <crypto/algapi.h> +#include <crypto/scatterwalk.h> #include <linux/compiler_types.h> #include <linux/cpumask_types.h> #include <linux/spinlock.h> @@ -75,6 +76,37 @@ struct crypto_acomp_streams { cpumask_t stream_want; }; +struct acomp_walk { + union { + /* Virtual address of the source. */ + struct { + struct { + const void *const addr; + } virt; + } src; + + /* Private field for the API, do not use. */ + struct scatter_walk in; + }; + + union { + /* Virtual address of the destination. */ + struct { + struct { + void *const addr; + } virt; + } dst; + + /* Private field for the API, do not use. */ + struct scatter_walk out; + }; + + unsigned int slen; + unsigned int dlen; + + int flags; +}; + /* * Transform internal helpers. */ @@ -190,4 +222,16 @@ static inline void crypto_acomp_unlock_stream_bh( { spin_unlock_bh(&stream->lock); } + +void acomp_walk_done_src(struct acomp_walk *walk, int used); +void acomp_walk_done_dst(struct acomp_walk *walk, int used); +int acomp_walk_next_src(struct acomp_walk *walk); +int acomp_walk_next_dst(struct acomp_walk *walk); +int acomp_walk_virt(struct acomp_walk *__restrict walk, + struct acomp_req *__restrict req); + +static inline bool acomp_walk_more_src(const struct acomp_walk *walk, int cur) +{ + return walk->slen != cur; +} #endif |
