summaryrefslogtreecommitdiffstats
path: root/libtommath/etc/mont.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-17 09:24:05 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-17 09:24:05 (GMT)
commit0be726feecac0c0515760b48dd64f435024dd908 (patch)
tree6b4d147483303cbf4b2bebdc29fbcc042ea07442 /libtommath/etc/mont.c
parentbdc4a4970774a123700ec1bb3392d3a2f614fa0a (diff)
downloadtcl-0be726feecac0c0515760b48dd64f435024dd908.zip
tcl-0be726feecac0c0515760b48dd64f435024dd908.tar.gz
tcl-0be726feecac0c0515760b48dd64f435024dd908.tar.bz2
Remove subdirectories of "libtommath", and various individual related files, not taking any part in the Tcl build. Makes the Tcl distribution smaller without sacrificing anything.
Diffstat (limited to 'libtommath/etc/mont.c')
-rw-r--r--libtommath/etc/mont.c41
1 files changed, 0 insertions, 41 deletions
diff --git a/libtommath/etc/mont.c b/libtommath/etc/mont.c
deleted file mode 100644
index 7839675..0000000
--- a/libtommath/etc/mont.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* tests the montgomery routines */
-#include <tommath.h>
-
-int main(void)
-{
- mp_int modulus, R, p, pp;
- mp_digit mp;
- long x, y;
-
- srand(time(NULL));
- mp_init_multi(&modulus, &R, &p, &pp, NULL);
-
- /* loop through various sizes */
- for (x = 4; x < 256; x++) {
- printf("DIGITS == %3ld...", x); fflush(stdout);
-
- /* make up the odd modulus */
- mp_rand(&modulus, x);
- modulus.dp[0] |= 1;
-
- /* now find the R value */
- mp_montgomery_calc_normalization(&R, &modulus);
- mp_montgomery_setup(&modulus, &mp);
-
- /* now run through a bunch tests */
- for (y = 0; y < 1000; y++) {
- mp_rand(&p, x/2); /* p = random */
- mp_mul(&p, &R, &pp); /* pp = R * p */
- mp_montgomery_reduce(&pp, &modulus, mp);
-
- /* should be equal to p */
- if (mp_cmp(&pp, &p) != MP_EQ) {
- printf("FAILURE!\n");
- exit(-1);
- }
- }
- printf("PASSED\n");
- }
-
- return 0;
-}