summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dh/dh_check.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/dh/dh_check.c')
-rw-r--r--src/lib/libcrypto/dh/dh_check.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/libcrypto/dh/dh_check.c b/src/lib/libcrypto/dh/dh_check.c
index b846913004..17debff62d 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 it is a suitable generator 65 * if g is 2, 3 or 5, check that is 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,6 +70,8 @@
70 * should hold. 70 * should hold.
71 */ 71 */
72 72
73#ifndef OPENSSL_FIPS
74
73int DH_check(const DH *dh, int *ret) 75int DH_check(const DH *dh, int *ret)
74 { 76 {
75 int ok=0; 77 int ok=0;
@@ -104,12 +106,12 @@ int DH_check(const DH *dh, int *ret)
104 else 106 else
105 *ret|=DH_UNABLE_TO_CHECK_GENERATOR; 107 *ret|=DH_UNABLE_TO_CHECK_GENERATOR;
106 108
107 if (!BN_is_prime_ex(dh->p,BN_prime_checks,ctx,NULL)) 109 if (!BN_is_prime(dh->p,BN_prime_checks,NULL,ctx,NULL))
108 *ret|=DH_CHECK_P_NOT_PRIME; 110 *ret|=DH_CHECK_P_NOT_PRIME;
109 else 111 else
110 { 112 {
111 if (!BN_rshift1(q,dh->p)) goto err; 113 if (!BN_rshift1(q,dh->p)) goto err;
112 if (!BN_is_prime_ex(q,BN_prime_checks,ctx,NULL)) 114 if (!BN_is_prime(q,BN_prime_checks,NULL,ctx,NULL))
113 *ret|=DH_CHECK_P_NOT_SAFE_PRIME; 115 *ret|=DH_CHECK_P_NOT_SAFE_PRIME;
114 } 116 }
115 ok=1; 117 ok=1;
@@ -140,3 +142,5 @@ err:
140 if (q != NULL) BN_free(q); 142 if (q != NULL) BN_free(q);
141 return(ok); 143 return(ok);
142 } 144 }
145
146#endif