These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / crypto / ablkcipher.c
index db201bc..e5b5721 100644 (file)
@@ -277,12 +277,12 @@ static int ablkcipher_walk_first(struct ablkcipher_request *req,
        if (WARN_ON_ONCE(in_irq()))
                return -EDEADLK;
 
+       walk->iv = req->info;
        walk->nbytes = walk->total;
        if (unlikely(!walk->total))
                return 0;
 
        walk->iv_buffer = NULL;
-       walk->iv = req->info;
        if (unlikely(((unsigned long)walk->iv & alignmask))) {
                int err = ablkcipher_copy_iv(walk, tfm, alignmask);
 
@@ -454,7 +454,7 @@ static int crypto_init_givcipher_ops(struct crypto_tfm *tfm, u32 type,
                      alg->setkey : setkey;
        crt->encrypt = alg->encrypt;
        crt->decrypt = alg->decrypt;
-       crt->givencrypt = alg->givencrypt;
+       crt->givencrypt = alg->givencrypt ?: no_givdecrypt;
        crt->givdecrypt = alg->givdecrypt ?: no_givdecrypt;
        crt->base = __crypto_ablkcipher_cast(tfm);
        crt->ivsize = alg->ivsize;
@@ -586,6 +586,13 @@ static int crypto_givcipher_default(struct crypto_alg *alg, u32 type, u32 mask)
        if (!tmpl)
                goto kill_larval;
 
+       if (tmpl->create) {
+               err = tmpl->create(tmpl, tb);
+               if (err)
+                       goto put_tmpl;
+               goto ok;
+       }
+
        inst = tmpl->alloc(tb);
        err = PTR_ERR(inst);
        if (IS_ERR(inst))
@@ -597,6 +604,7 @@ static int crypto_givcipher_default(struct crypto_alg *alg, u32 type, u32 mask)
                goto put_tmpl;
        }
 
+ok:
        /* Redo the lookup to use the instance we just registered. */
        err = -EAGAIN;
 
@@ -636,7 +644,7 @@ struct crypto_alg *crypto_lookup_skcipher(const char *name, u32 type, u32 mask)
 
        if ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) ==
            CRYPTO_ALG_TYPE_GIVCIPHER) {
-               if ((alg->cra_flags ^ type ^ ~mask) & CRYPTO_ALG_TESTED) {
+               if (~alg->cra_flags & (type ^ ~mask) & CRYPTO_ALG_TESTED) {
                        crypto_mod_put(alg);
                        alg = ERR_PTR(-ENOENT);
                }
@@ -698,7 +706,7 @@ struct crypto_ablkcipher *crypto_alloc_ablkcipher(const char *alg_name,
 err:
                if (err != -EAGAIN)
                        break;
-               if (signal_pending(current)) {
+               if (fatal_signal_pending(current)) {
                        err = -EINTR;
                        break;
                }