version 1.22.2.2, 2003/09/16 21:20:25 |
version 1.23, 2002/11/21 22:22:50 |
|
|
|
|
if ((f = fopen(_PATH_DH_MODULI, "r")) == NULL && |
if ((f = fopen(_PATH_DH_MODULI, "r")) == NULL && |
(f = fopen(_PATH_DH_PRIMES, "r")) == NULL) { |
(f = fopen(_PATH_DH_PRIMES, "r")) == NULL) { |
logit("WARNING: %s does not exist, using old modulus", _PATH_DH_MODULI); |
log("WARNING: %s does not exist, using old modulus", _PATH_DH_MODULI); |
return (dh_new_group1()); |
return (dh_new_group1()); |
} |
} |
|
|
|
|
|
|
if (bestcount == 0) { |
if (bestcount == 0) { |
fclose(f); |
fclose(f); |
logit("WARNING: no suitable primes in %s", _PATH_DH_PRIMES); |
log("WARNING: no suitable primes in %s", _PATH_DH_PRIMES); |
return (NULL); |
return (NULL); |
} |
} |
|
|
|
|
int bits_set = 0; |
int bits_set = 0; |
|
|
if (dh_pub->neg) { |
if (dh_pub->neg) { |
logit("invalid public DH value: negativ"); |
log("invalid public DH value: negativ"); |
return 0; |
return 0; |
} |
} |
for (i = 0; i <= n; i++) |
for (i = 0; i <= n; i++) |
|
|
/* if g==2 and bits_set==1 then computing log_g(dh_pub) is trivial */ |
/* if g==2 and bits_set==1 then computing log_g(dh_pub) is trivial */ |
if (bits_set > 1 && (BN_cmp(dh_pub, dh->p) == -1)) |
if (bits_set > 1 && (BN_cmp(dh_pub, dh->p) == -1)) |
return 1; |
return 1; |
logit("invalid public DH value (%d/%d)", bits_set, BN_num_bits(dh->p)); |
log("invalid public DH value (%d/%d)", bits_set, BN_num_bits(dh->p)); |
return 0; |
return 0; |
} |
} |
|
|