Преглед изворни кода

Make GMP use uppercase to match LibTomMath.

Patrick Pelletier пре 14 година
родитељ
комит
e3acd4cabe
1 измењених фајлова са 5 додато и 0 уклоњено
  1. 5 0
      src/math/gmp_desc.c

+ 5 - 0
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;
 }