From b69e61c39868383b0d7819077db13d6be2d60c5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Tue, 5 Sep 2006 21:24:48 +0000 Subject: [PATCH] Check for Daniel Bleichenbacher an attack on PKCS #1 v1.5 signatures. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18029 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/des/rsa-imath.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/des/rsa-imath.c b/lib/des/rsa-imath.c index 24243bfb2..6545c849f 100644 --- a/lib/des/rsa-imath.c +++ b/lib/des/rsa-imath.c @@ -188,6 +188,14 @@ imath_rsa_public_decrypt(int flen, const unsigned char* from, return -1; size--; p++; + /* + * Check for Daniel Bleichenbacher an attack on PKCS #1 v1.5 + * signatures. Doesn't work on standard signatures and small key, + * so limit when we check for it. + */ + if (size > 42 && (3 * 8 * size) >= BN_num_bits(rsa->n)) + return -1; + memmove(to, p, size); return size;