diff options
Diffstat (limited to 'src/lib/libcrypto/dh/dh_check.c')
| -rw-r--r-- | src/lib/libcrypto/dh/dh_check.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/lib/libcrypto/dh/dh_check.c b/src/lib/libcrypto/dh/dh_check.c index 17debff62d..b846913004 100644 --- a/src/lib/libcrypto/dh/dh_check.c +++ b/src/lib/libcrypto/dh/dh_check.c | |||
| @@ -62,7 +62,7 @@ | |||
| 62 | #include <openssl/dh.h> | 62 | #include <openssl/dh.h> |
| 63 | 63 | ||
| 64 | /* Check that p is a safe prime and | 64 | /* Check that p is a safe prime and |
| 65 | * if g is 2, 3 or 5, check that is is a suitable generator | 65 | * if g is 2, 3 or 5, check that it is a suitable generator |
| 66 | * where | 66 | * where |
| 67 | * for 2, p mod 24 == 11 | 67 | * for 2, p mod 24 == 11 |
| 68 | * for 3, p mod 12 == 5 | 68 | * for 3, p mod 12 == 5 |
| @@ -70,8 +70,6 @@ | |||
| 70 | * should hold. | 70 | * should hold. |
| 71 | */ | 71 | */ |
| 72 | 72 | ||
| 73 | #ifndef OPENSSL_FIPS | ||
| 74 | |||
| 75 | int DH_check(const DH *dh, int *ret) | 73 | int DH_check(const DH *dh, int *ret) |
| 76 | { | 74 | { |
| 77 | int ok=0; | 75 | int ok=0; |
| @@ -106,12 +104,12 @@ int DH_check(const DH *dh, int *ret) | |||
| 106 | else | 104 | else |
| 107 | *ret|=DH_UNABLE_TO_CHECK_GENERATOR; | 105 | *ret|=DH_UNABLE_TO_CHECK_GENERATOR; |
| 108 | 106 | ||
| 109 | if (!BN_is_prime(dh->p,BN_prime_checks,NULL,ctx,NULL)) | 107 | if (!BN_is_prime_ex(dh->p,BN_prime_checks,ctx,NULL)) |
| 110 | *ret|=DH_CHECK_P_NOT_PRIME; | 108 | *ret|=DH_CHECK_P_NOT_PRIME; |
| 111 | else | 109 | else |
| 112 | { | 110 | { |
| 113 | if (!BN_rshift1(q,dh->p)) goto err; | 111 | if (!BN_rshift1(q,dh->p)) goto err; |
| 114 | if (!BN_is_prime(q,BN_prime_checks,NULL,ctx,NULL)) | 112 | if (!BN_is_prime_ex(q,BN_prime_checks,ctx,NULL)) |
| 115 | *ret|=DH_CHECK_P_NOT_SAFE_PRIME; | 113 | *ret|=DH_CHECK_P_NOT_SAFE_PRIME; |
| 116 | } | 114 | } |
| 117 | ok=1; | 115 | ok=1; |
| @@ -142,5 +140,3 @@ err: | |||
| 142 | if (q != NULL) BN_free(q); | 140 | if (q != NULL) BN_free(q); |
| 143 | return(ok); | 141 | return(ok); |
| 144 | } | 142 | } |
| 145 | |||
| 146 | #endif | ||
