]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
crypto: testmgr - Fix wrong test case of RSA
authorLei He <helei.sig11@bytedance.com>
Fri, 5 Nov 2021 12:25:31 +0000 (20:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:50:47 +0000 (12:50 +0100)
commitbd258be9a8becffcf9c82a80f9ee1794832ba701
treef2afcd4d382a167d5594a5adb9bd39c809bdd5b8
parent8fbf27a746c3793822f374d0535a02c7ed8c700c
crypto: testmgr - Fix wrong test case of RSA

[ Upstream commit a9887010ed2da3fddaff83ceec80e2b71be8a966 ]

According to the BER encoding rules, integer value should be encoded
as two's complement, and if the highest bit of a positive integer
is 1, should add a leading zero-octet.

The kernel's built-in RSA algorithm cannot recognize negative numbers
when parsing keys, so it can pass this test case.

Export the key to file and run the following command to verify the
fix result:

  openssl asn1parse -inform DER -in /path/to/key/file

Signed-off-by: Lei He <helei.sig11@bytedance.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
crypto/testmgr.h