ARM64: rockchip_defconfig: enable pwm remote control
[firefly-linux-kernel-4.4.55.git] / crypto / cts.c
index 60b9da3fa7c1cd1fe4ec95c88fb1985c8ebea4e5..e467ec0acf9f091cc2865963b5370cd975791ed3 100644 (file)
@@ -202,7 +202,8 @@ static int cts_cbc_decrypt(struct crypto_cts_ctx *ctx,
        /* 5. Append the tail (BB - Ln) bytes of Xn (tmp) to Cn to create En */
        memcpy(s + bsize + lastn, tmp + lastn, bsize - lastn);
        /* 6. Decrypt En to create Pn-1 */
-       memset(iv, 0, sizeof(iv));
+       memzero_explicit(iv, sizeof(iv));
+
        sg_set_buf(&sgsrc[0], s + bsize, bsize);
        sg_set_buf(&sgdst[0], d, bsize);
        err = crypto_blkcipher_decrypt_iv(&lcldesc, sgdst, sgsrc, bsize);
@@ -289,6 +290,9 @@ static struct crypto_instance *crypto_cts_alloc(struct rtattr **tb)
        if (!is_power_of_2(alg->cra_blocksize))
                goto out_put_alg;
 
+       if (strncmp(alg->cra_name, "cbc(", 4))
+               goto out_put_alg;
+
        inst = crypto_alloc_instance("cts", alg);
        if (IS_ERR(inst))
                goto out_put_alg;
@@ -306,8 +310,6 @@ static struct crypto_instance *crypto_cts_alloc(struct rtattr **tb)
        inst->alg.cra_blkcipher.min_keysize = alg->cra_blkcipher.min_keysize;
        inst->alg.cra_blkcipher.max_keysize = alg->cra_blkcipher.max_keysize;
 
-       inst->alg.cra_blkcipher.geniv = "seqiv";
-
        inst->alg.cra_ctxsize = sizeof(struct crypto_cts_ctx);
 
        inst->alg.cra_init = crypto_cts_init_tfm;