|
|
1.1 root 1: /* keygen.h - C include file for RSA key generation routines
2:
3: (c) Copyright 1986 by Philip Zimmermann. All rights reserved.
4: The author assumes no liability for damages resulting from the use
5: of this software, even if the damage results from defects in this
6: software. No warranty is expressed or implied.
7:
8: NOTE: This assumes previous inclusion of "rsalib.h"
9: */
10:
11: extern word16 primetable[]; /* table of small primes, zero-terminated.*/
12:
13: boolean primetest(unitptr p);
14: /* Returns TRUE iff p is a prime. */
15:
16: int nextprime(unitptr p);
17: /* Find next higher prime starting at p, returning result in p. */
18:
19: void randombits(unitptr p,short nbits);
20: /* Make a random unit array p with nbits of precision. */
21:
22: int randomprime(unitptr p,short nbits);
23: /* Makes a "random" prime p with nbits significant bits of precision. */
24:
25: void gcd(unitptr result,unitptr a,unitptr n);
26: /* Computes greatest common divisor via Euclid's algorithm. */
27:
28: void inv(unitptr x,unitptr a,unitptr n);
29: /* Euclid's algorithm extended to compute multiplicative inverse.
30: Computes x such that a*x mod n = 1, where 0<a<n */
31:
32: void derivekeys(unitptr n,unitptr e,unitptr d,
33: unitptr p,unitptr q,unitptr u,short ebits);
34: /* Given primes p and q, derive key components n, e, d, and u. */
35:
36: int keygen(unitptr n,unitptr e,unitptr d,
37: unitptr p,unitptr q,unitptr u,short keybits,short ebits);
38: /* Generate key components p, q, n, e, d, and u. */
39:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.