comparison bn_mp_prime_random_ex.c @ 386:97db060d0ef5 libtommath-orig libtommath-0.40

Update to LibTomMath 0.40
author Matt Johnston <matt@ucc.asn.au>
date Thu, 11 Jan 2007 03:11:15 +0000
parents 91fbc376f010
children
comparison
equal deleted inserted replaced
282:91fbc376f010 386:97db060d0ef5
10 * additional optimizations in place. 10 * additional optimizations in place.
11 * 11 *
12 * The library is free for all purposes without any express 12 * The library is free for all purposes without any express
13 * guarantee it works. 13 * guarantee it works.
14 * 14 *
15 * Tom St Denis, [email protected], http://math.libtomcrypt.org 15 * Tom St Denis, [email protected], http://math.libtomcrypt.com
16 */ 16 */
17 17
18 /* makes a truly random prime of a given size (bits), 18 /* makes a truly random prime of a given size (bits),
19 * 19 *
20 * Flags are as follows: 20 * Flags are as follows:
60 60
61 /* calc the maskOR_msb */ 61 /* calc the maskOR_msb */
62 maskOR_msb = 0; 62 maskOR_msb = 0;
63 maskOR_msb_offset = ((size & 7) == 1) ? 1 : 0; 63 maskOR_msb_offset = ((size & 7) == 1) ? 1 : 0;
64 if (flags & LTM_PRIME_2MSB_ON) { 64 if (flags & LTM_PRIME_2MSB_ON) {
65 maskOR_msb |= 1 << ((size - 2) & 7); 65 maskOR_msb |= 0x80 >> ((9 - size) & 7);
66 } else if (flags & LTM_PRIME_2MSB_OFF) { 66 }
67 maskAND &= ~(1 << ((size - 2) & 7));
68 }
69 67
70 /* get the maskOR_lsb */ 68 /* get the maskOR_lsb */
71 maskOR_lsb = 1; 69 maskOR_lsb = 1;
72 if (flags & LTM_PRIME_BBS) { 70 if (flags & LTM_PRIME_BBS) {
73 maskOR_lsb |= 3; 71 maskOR_lsb |= 3;
119 return err; 117 return err;
120 } 118 }
121 119
122 120
123 #endif 121 #endif
122
123 /* $Source: /cvs/libtom/libtommath/bn_mp_prime_random_ex.c,v $ */
124 /* $Revision: 1.4 $ */
125 /* $Date: 2006/03/31 14:18:44 $ */