]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
crypto: skcipher - Add crypto_spawn_skcipher_alg_common
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 3 Oct 2023 03:43:19 +0000 (11:43 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 13 Oct 2023 10:27:26 +0000 (18:27 +0800)
As skcipher spawns can be of two different types (skcipher vs.
lskcipher), only the common fields can be accessed.  Add a helper
to return the common algorithm object.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
include/crypto/internal/skcipher.h

index 4382fd707b8a39e7abf309e7014dcc125c15f13c..c767b5cfbd9c5e0d456017faff8cb32e0885e3d0 100644 (file)
@@ -160,6 +160,12 @@ static inline struct lskcipher_alg *crypto_lskcipher_spawn_alg(
        return container_of(spawn->base.alg, struct lskcipher_alg, co.base);
 }
 
+static inline struct skcipher_alg_common *crypto_spawn_skcipher_alg_common(
+       struct crypto_skcipher_spawn *spawn)
+{
+       return container_of(spawn->base.alg, struct skcipher_alg_common, base);
+}
+
 static inline struct skcipher_alg *crypto_spawn_skcipher_alg(
        struct crypto_skcipher_spawn *spawn)
 {