diff --git a/lib/hcrypto/libtommath/demo/demo.c b/lib/hcrypto/libtommath/demo/demo.c index e1b2eb238..2442611f9 100644 --- a/lib/hcrypto/libtommath/demo/demo.c +++ b/lib/hcrypto/libtommath/demo/demo.c @@ -83,7 +83,7 @@ int main(void) // now test a random reduction for (ix = 0; ix < 100; ix++) { - mp_rand(&c, 1 + labs(rand()) % (2*i)); + mp_rand(&c, 1 + abs(rand()) % (2*i)); mp_copy(&c, &d); mp_copy(&c, &e); @@ -286,7 +286,7 @@ printf("compare no compare!\n"); exit(EXIT_FAILURE); } if (!(++cnt & 127)) printf("%9d\r", cnt); - mp_rand(&a, labs(rand()) % 128 + 1); + mp_rand(&a, abs(rand()) % 128 + 1); mp_div(&a, &d, &b, &e); mp_div_3(&a, &c, &r2); @@ -394,7 +394,7 @@ printf("compare no compare!\n"); exit(EXIT_FAILURE); } for (;;) { /* randomly clear and re-init one variable, this has the affect of triming the alloc space */ - switch (labs(rand()) % 7) { + switch (abs(rand()) % 7) { case 0: mp_clear(&a); mp_init(&a); diff --git a/lib/hcrypto/libtommath/etc/pprime.c b/lib/hcrypto/libtommath/etc/pprime.c index bc9f87403..317e2a0fc 100644 --- a/lib/hcrypto/libtommath/etc/pprime.c +++ b/lib/hcrypto/libtommath/etc/pprime.c @@ -163,7 +163,7 @@ mp_digit prime_digit(void) int n; mp_digit d; - n = labs(rand()) % n_prime; + n = abs(rand()) % n_prime; fseek(primes, n * sizeof(mp_digit), SEEK_SET); fread(&d, 1, sizeof(mp_digit), primes); return d; diff --git a/lib/hcrypto/libtommath/mtest/mtest.c b/lib/hcrypto/libtommath/mtest/mtest.c index 6053f7b52..bdfe6127a 100644 --- a/lib/hcrypto/libtommath/mtest/mtest.c +++ b/lib/hcrypto/libtommath/mtest/mtest.c @@ -281,7 +281,7 @@ int main(void) printf("%s\n", buf); } else if (n == 13) { rand_num2(&a); - tmp = labs(rand()) & THE_MASK; + tmp = abs(rand()) & THE_MASK; mp_add_d(&a, tmp, &b); printf("add_d\n"); mp_to64(&a, buf); @@ -290,7 +290,7 @@ int main(void) printf("%s\n", buf); } else if (n == 14) { rand_num2(&a); - tmp = labs(rand()) & THE_MASK; + tmp = abs(rand()) & THE_MASK; mp_sub_d(&a, tmp, &b); printf("sub_d\n"); mp_to64(&a, buf); diff --git a/lib/hcrypto/libtommath/tommath.src b/lib/hcrypto/libtommath/tommath.src index 2e058056e..40658222c 100644 --- a/lib/hcrypto/libtommath/tommath.src +++ b/lib/hcrypto/libtommath/tommath.src @@ -19,7 +19,7 @@ \def\gcd{{\rm gcd}} \def\log{{\rm log}} \def\ord{{\rm ord}} -\def\labs{{\mathit labs}} +\def\abs{{\mathit abs}} \def\rep{{\mathit rep}} \def\mod{{\mathit\ mod\ }} \renewcommand{\pmod}[1]{\ ({\rm mod\ }{#1})} diff --git a/lib/hcrypto/libtommath/tommath.tex b/lib/hcrypto/libtommath/tommath.tex index 020c2e50c..17d6041d5 100644 --- a/lib/hcrypto/libtommath/tommath.tex +++ b/lib/hcrypto/libtommath/tommath.tex @@ -20,6 +20,7 @@ \def\log{{\rm log}} \def\ord{{\rm ord}} \def\labs{{\mathit labs}} +\def\abs{{\mathit abs}} \def\rep{{\mathit rep}} \def\mod{{\mathit\ mod\ }} \renewcommand{\pmod}[1]{\ ({\rm mod\ }{#1})}