Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78557e77 authored by Tudor-Dan Ambarus's avatar Tudor-Dan Ambarus Committed by Herbert Xu
Browse files

crypto: vmx - remove unnecessary check



You can't reach init() if parent alg_name is invalid. Moreover,
cypto_alloc_base() will return ENOENT if alg_name is NULL.
Found while grasping the fallback mechanism.

Signed-off-by: default avatarTudor Ambarus <tudor.ambarus@microchip.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 4914b90b
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -37,15 +37,10 @@ struct p8_aes_ctx {

static int p8_aes_init(struct crypto_tfm *tfm)
{
	const char *alg;
	const char *alg = crypto_tfm_alg_name(tfm);
	struct crypto_cipher *fallback;
	struct p8_aes_ctx *ctx = crypto_tfm_ctx(tfm);

	if (!(alg = crypto_tfm_alg_name(tfm))) {
		printk(KERN_ERR "Failed to get algorithm name.\n");
		return -ENOENT;
	}

	fallback = crypto_alloc_cipher(alg, 0, CRYPTO_ALG_NEED_FALLBACK);
	if (IS_ERR(fallback)) {
		printk(KERN_ERR
+1 −6
Original line number Diff line number Diff line
@@ -39,15 +39,10 @@ struct p8_aes_cbc_ctx {

static int p8_aes_cbc_init(struct crypto_tfm *tfm)
{
	const char *alg;
	const char *alg = crypto_tfm_alg_name(tfm);
	struct crypto_skcipher *fallback;
	struct p8_aes_cbc_ctx *ctx = crypto_tfm_ctx(tfm);

	if (!(alg = crypto_tfm_alg_name(tfm))) {
		printk(KERN_ERR "Failed to get algorithm name.\n");
		return -ENOENT;
	}

	fallback = crypto_alloc_skcipher(alg, 0,
			CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK);

+1 −6
Original line number Diff line number Diff line
@@ -36,15 +36,10 @@ struct p8_aes_ctr_ctx {

static int p8_aes_ctr_init(struct crypto_tfm *tfm)
{
	const char *alg;
	const char *alg = crypto_tfm_alg_name(tfm);
	struct crypto_blkcipher *fallback;
	struct p8_aes_ctr_ctx *ctx = crypto_tfm_ctx(tfm);

	if (!(alg = crypto_tfm_alg_name(tfm))) {
		printk(KERN_ERR "Failed to get algorithm name.\n");
		return -ENOENT;
	}

	fallback =
	    crypto_alloc_blkcipher(alg, 0, CRYPTO_ALG_NEED_FALLBACK);
	if (IS_ERR(fallback)) {
+1 −6
Original line number Diff line number Diff line
@@ -41,15 +41,10 @@ struct p8_aes_xts_ctx {

static int p8_aes_xts_init(struct crypto_tfm *tfm)
{
	const char *alg;
	const char *alg = crypto_tfm_alg_name(tfm);
	struct crypto_skcipher *fallback;
	struct p8_aes_xts_ctx *ctx = crypto_tfm_ctx(tfm);

	if (!(alg = crypto_tfm_alg_name(tfm))) {
		printk(KERN_ERR "Failed to get algorithm name.\n");
		return -ENOENT;
	}

	fallback = crypto_alloc_skcipher(alg, 0,
			CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK);
	if (IS_ERR(fallback)) {