Re: [PATCH] crypto: rsassa-pkcs1 - Use constant-time digest comparison

From: Lukas Wunner

Date: Mon Jul 20 2026 - 02:22:20 EST


On Mon, Jul 20, 2026 at 10:13:22AM +0800, Jiangshan Yi wrote:
> +++ b/crypto/rsassa-pkcs1.c
> @@ -291,7 +291,7 @@ static int rsassa_pkcs1_verify(struct crypto_sig *tfm,
> /* RFC 8017 sec 8.2.2 step 4 - comparison of digest with out_buf */
> if (dlen != dst_len - pos)
> return -EKEYREJECTED;
> - if (memcmp(digest, out_buf + pos, dlen) != 0)
> + if (crypto_memneq(digest, out_buf + pos, dlen))
> return -EKEYREJECTED;
>
> return 0;

The exact same patch was previously submitted by someone else
and rejected:

https://lore.kernel.org/all/alEr_e-G0L2nxxv-@fudgebox/T/#u