From 3be59531fc4d287a409b2a1e8059698b13435e42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Thu, 4 Jan 2007 23:41:43 +0000 Subject: [PATCH] (imath_rsa_generate_key): make p > q git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19713 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/des/rsa-imath.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/des/rsa-imath.c b/lib/des/rsa-imath.c index ff8dd860e..7453c85aa 100644 --- a/lib/des/rsa-imath.c +++ b/lib/des/rsa-imath.c @@ -414,6 +414,10 @@ imath_rsa_generate_key(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb) CHECK(mp_int_gcd(&t1, &el, &t2), MP_OK); } while(mp_int_compare_value(&t2, 1) != 0); + /* make p > q */ + if (mp_int_compare(&p, &q) < 0) + mp_int_swap(&p, &q); + BN_GENCB_call(cb, 3, 1); /* calculate n, n = p * q */