From aacd5b4cfb87306888eb9e3612cb90afbb2ecba5 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Thu, 2 Jan 2020 19:59:00 -0800 Subject: crypto: skcipher - use crypto_grab_cipher() and simplify error paths Make skcipher_alloc_instance_simple() use the new function crypto_grab_cipher() to initialize its cipher spawn. This is needed to make all spawns be initialized in a consistent way. Also simplify the error handling by taking advantage of crypto_drop_*() now accepting (as a no-op) spawns that haven't been initialized yet, and by taking advantage of crypto_grab_*() now handling ERR_PTR() names. Signed-off-by: Eric Biggers Signed-off-by: Herbert Xu --- include/crypto/internal/skcipher.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/crypto') diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h index e387424f6247..10226c12c5df 100644 --- a/include/crypto/internal/skcipher.h +++ b/include/crypto/internal/skcipher.h @@ -214,9 +214,9 @@ struct skcipher_instance *skcipher_alloc_instance_simple( static inline struct crypto_alg *skcipher_ialg_simple( struct skcipher_instance *inst) { - struct crypto_spawn *spawn = skcipher_instance_ctx(inst); + struct crypto_cipher_spawn *spawn = skcipher_instance_ctx(inst); - return spawn->alg; + return crypto_spawn_cipher_alg(spawn); } #endif /* _CRYPTO_INTERNAL_SKCIPHER_H */ -- cgit v1.2.3