]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - crypto/keywrap.c
Merge branch 'i2c/for-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
[linux.git] / crypto / keywrap.c
index a155c88105ea1a91fb9d4f4fde2cf22ec8e1713f..0355cce21b1e21711df1fadb26e67ecfd9b952de 100644 (file)
@@ -266,10 +266,12 @@ static int crypto_kw_create(struct crypto_template *tmpl, struct rtattr **tb)
        struct crypto_alg *alg;
        int err;
 
-       inst = skcipher_alloc_instance_simple(tmpl, tb, &alg);
+       inst = skcipher_alloc_instance_simple(tmpl, tb);
        if (IS_ERR(inst))
                return PTR_ERR(inst);
 
+       alg = skcipher_ialg_simple(inst);
+
        err = -EINVAL;
        /* Section 5.1 requirement for KW */
        if (alg->cra_blocksize != sizeof(struct crypto_kw_block))
@@ -283,14 +285,11 @@ static int crypto_kw_create(struct crypto_template *tmpl, struct rtattr **tb)
        inst->alg.decrypt = crypto_kw_decrypt;
 
        err = skcipher_register_instance(tmpl, inst);
-       if (err)
-               goto out_free_inst;
-       goto out_put_alg;
-
+       if (err) {
 out_free_inst:
-       inst->free(inst);
-out_put_alg:
-       crypto_mod_put(alg);
+               inst->free(inst);
+       }
+
        return err;
 }