comparison libtommath/bn_mp_prime_random_ex.c @ 511:582cb38e4eb5 insecure-nocrypto

propagate from branch 'au.asn.ucc.matt.dropbear' (head cdcc3c729e29544e8b98a408e2dc60e4483dfd2a) to branch 'au.asn.ucc.matt.dropbear.insecure-nocrypto' (head 0ca38a1cf349f7426ac9de34ebe4c3e3735effab)
author Matt Johnston <matt@ucc.asn.au>
date Thu, 06 Nov 2008 13:16:55 +0000
parents 5ff8218bcee9
children 60fc6476e044
comparison
equal deleted inserted replaced
361:461c4b1fb35f 511:582cb38e4eb5
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 $ */