提交 0e097628 编写于 作者: H Hui Tang 提交者: Zheng Zengkai

crypto: ecdh - fix 'ecdh_init'

mainline inclusion
from mainline-master
commit 8fd28fa5
category: bugfix
bugzilla: 173981
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8fd28fa5046b377039d5bbc0ab2f625dec703980

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

NIST P192 is not unregistered if failed to register NIST P256,
actually it need to unregister the algorithms already registered.
Signed-off-by: NHui Tang <tanghui20@huawei.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: NMingqiang Ling <lingmingqiang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 7ab0dfc5
......@@ -183,7 +183,16 @@ static int ecdh_init(void)
ret = crypto_register_kpp(&ecdh_nist_p192);
ecdh_nist_p192_registered = ret == 0;
return crypto_register_kpp(&ecdh_nist_p256);
ret = crypto_register_kpp(&ecdh_nist_p256);
if (ret)
goto nist_p256_error;
return 0;
nist_p256_error:
if (ecdh_nist_p192_registered)
crypto_unregister_kpp(&ecdh_nist_p192);
return ret;
}
static void ecdh_exit(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册