version 1.23.2.2, 2004/03/04 18:18:15 |
version 1.24, 2003/04/08 20:21:28 |
|
|
|
|
if (dh->p == NULL) |
if (dh->p == NULL) |
fatal("dh_gen_key: dh->p == NULL"); |
fatal("dh_gen_key: dh->p == NULL"); |
if (need > INT_MAX / 2 || 2 * need >= BN_num_bits(dh->p)) |
if (2*need >= BN_num_bits(dh->p)) |
fatal("dh_gen_key: group too small: %d (2*need %d)", |
fatal("dh_gen_key: group too small: %d (2*need %d)", |
BN_num_bits(dh->p), 2*need); |
BN_num_bits(dh->p), 2*need); |
do { |
do { |
|
|
dh_estimate(int bits) |
dh_estimate(int bits) |
{ |
{ |
|
|
if (bits <= 128) |
if (bits < 64) |
|
return (512); /* O(2**63) */ |
|
if (bits < 128) |
return (1024); /* O(2**86) */ |
return (1024); /* O(2**86) */ |
if (bits <= 192) |
if (bits < 192) |
return (2048); /* O(2**116) */ |
return (2048); /* O(2**116) */ |
return (4096); /* O(2**156) */ |
return (4096); /* O(2**156) */ |
} |
} |