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 <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h
index e387424..10226c1 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 */