Commit b04218c4 authored by LeoLiu-oc's avatar LeoLiu-oc
Browse files

crypto: zhaoxin - Fix incorrect parameter in sm4 driver

zhaoxin inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBMDJH


CVE: NA

-------------------

The prior patch("crypto: simd - Do not call crypto_alloc_tfm during
registration") had an error in arch/x86/crypto/sm4-zhaoxin-gmi.c.
It should pass 'sm4_algs + i' to 'simd_skcipher_create_compat',
like other changes, instead of 'sm4_algs'.

Passing the wrong param made 'simd_skcipher_create_compat' always get the
start address of 'sm4_algs', not the right struct pointer in the loop,
risking logic errors.

This patch fixes it by changing the 'simd_skcipher_create_compat' call to
use 'sm4_algs + i' as the first arg.

Fixes: 922cc13a ("crypto: simd - Do not call crypto_alloc_tfm during registration")
Signed-off-by: default avatarLeoLiu-oc <leoliu-oc@zhaoxin.com>
parent 541cdead
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -835,7 +835,7 @@ static int __init gmi_sm4_init(void)
		algname = sm4_algs[i].base.cra_name + 2;
		drvname = sm4_algs[i].base.cra_driver_name + 2;
		basename = sm4_algs[i].base.cra_driver_name;
		simd = simd_skcipher_create_compat(sm4_algs, algname, drvname, basename);
		simd = simd_skcipher_create_compat(sm4_algs + i, algname, drvname, basename);
		err = PTR_ERR(simd);
		if (IS_ERR(simd))
			goto unregister_simds;