diff genrsa.c @ 299:740e782679be ucc-axis-hack

Various changes to compile+kind of run on UCC's axis board. Note that fprintf(stdin -> printf( accounts for many of the changes
author Matt Johnston <matt@ucc.asn.au>
date Sat, 25 Mar 2006 12:57:09 +0000
parents c9483550701b
children
line wrap: on
line diff
--- a/genrsa.c	Fri Dec 09 06:10:27 2005 +0000
+++ b/genrsa.c	Sat Mar 25 12:57:09 2006 +0000
@@ -58,7 +58,7 @@
 	seedrandom();
 
 	if (mp_set_int(key->e, RSA_E) != MP_OKAY) {
-		fprintf(stderr, "rsa generation failed\n");
+		printf( "rsa generation failed\n");
 		exit(1);
 	}
 
@@ -69,21 +69,21 @@
 		getrsaprime(key->q, &qminus, key->e, size/2);
 
 		if (mp_mul(key->p, key->q, key->n) != MP_OKAY) {
-			fprintf(stderr, "rsa generation failed\n");
+			printf( "rsa generation failed\n");
 			exit(1);
 		}
 	} while (mp_count_bits(key->n) % 8 != 0);
 
 	/* lcm(p-1, q-1) */
 	if (mp_lcm(&pminus, &qminus, &lcm) != MP_OKAY) {
-		fprintf(stderr, "rsa generation failed\n");
+		printf( "rsa generation failed\n");
 		exit(1);
 	}
 
 	/* de = 1 mod lcm(p-1,q-1) */
 	/* therefore d = (e^-1) mod lcm(p-1,q-1) */
 	if (mp_invmod(key->e, &lcm, key->d) != MP_OKAY) {
-		fprintf(stderr, "rsa generation failed\n");
+		printf( "rsa generation failed\n");
 		exit(1);
 	}
 
@@ -112,18 +112,18 @@
 
 		/* find the next integer which is prime, 8 round of miller-rabin */
 		if (mp_prime_next_prime(prime, 8, 0) != MP_OKAY) {
-			fprintf(stderr, "rsa generation failed\n");
+			printf( "rsa generation failed\n");
 			exit(1);
 		}
 
 		/* subtract one to get p-1 */
 		if (mp_sub_d(prime, 1, primeminus) != MP_OKAY) {
-			fprintf(stderr, "rsa generation failed\n");
+			printf( "rsa generation failed\n");
 			exit(1);
 		}
 		/* check relative primality to e */
 		if (mp_gcd(primeminus, rsa_e, &temp_gcd) != MP_OKAY) {
-			fprintf(stderr, "rsa generation failed\n");
+			printf( "rsa generation failed\n");
 			exit(1);
 		}
 	} while (mp_cmp_d(&temp_gcd, 1) != MP_EQ); /* while gcd(p-1, e) != 1 */