From e3acd4cabe0268ed1e89b081ba3cc0956acf51c2 Mon Sep 17 00:00:00 2001 From: Patrick Pelletier Date: Wed, 5 Oct 2011 01:24:23 -0700 Subject: [PATCH] Make GMP use uppercase to match LibTomMath. --- src/math/gmp_desc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/math/gmp_desc.c b/src/math/gmp_desc.c index b09aab3..464cd93 100644 --- a/src/math/gmp_desc.c +++ b/src/math/gmp_desc.c @@ -188,6 +188,11 @@ static int write_radix(void *a, char *b, int radix) { LTC_ARGCHK(a != NULL); LTC_ARGCHK(b != NULL); + if (radix >= 11 && radix <= 36) + /* If radix is positive, GMP uses lowercase, and if negative, uppercase. + * We want it to use uppercase, to match the test vectors (presumably + * generated with LibTomMath). */ + radix = -radix; mpz_get_str(b, radix, a); return CRYPT_OK; }