diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/dh/dh_check.c (renamed from src/lib/libssl/src/fips/dh/fips_dh_check.c) | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/lib/libssl/src/fips/dh/fips_dh_check.c b/src/lib/libcrypto/dh/dh_check.c index 7333f7c80f..066898174e 100644 --- a/src/lib/libssl/src/fips/dh/fips_dh_check.c +++ b/src/lib/libcrypto/dh/dh_check.c | |||
| @@ -57,13 +57,12 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "cryptlib.h" | ||
| 60 | #include <openssl/bn.h> | 61 | #include <openssl/bn.h> |
| 61 | #include <openssl/dh.h> | 62 | #include <openssl/dh.h> |
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/fips.h> | ||
| 64 | 63 | ||
| 65 | /* Check that p is a safe prime and | 64 | /* Check that p is a safe prime and |
| 66 | * 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 |
| 67 | * where | 66 | * where |
| 68 | * for 2, p mod 24 == 11 | 67 | * for 2, p mod 24 == 11 |
| 69 | * for 3, p mod 12 == 5 | 68 | * for 3, p mod 12 == 5 |
| @@ -71,8 +70,6 @@ | |||
| 71 | * should hold. | 70 | * should hold. |
| 72 | */ | 71 | */ |
| 73 | 72 | ||
| 74 | #ifdef OPENSSL_FIPS | ||
| 75 | |||
| 76 | int DH_check(const DH *dh, int *ret) | 73 | int DH_check(const DH *dh, int *ret) |
| 77 | { | 74 | { |
| 78 | int ok=0; | 75 | int ok=0; |
| @@ -131,11 +128,11 @@ int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret) | |||
| 131 | q=BN_new(); | 128 | q=BN_new(); |
| 132 | if (q == NULL) goto err; | 129 | if (q == NULL) goto err; |
| 133 | BN_set_word(q,1); | 130 | BN_set_word(q,1); |
| 134 | if (BN_cmp(pub_key,q) <= 0) | 131 | if (BN_cmp(pub_key,q)<=0) |
| 135 | *ret|=DH_CHECK_PUBKEY_TOO_SMALL; | 132 | *ret|=DH_CHECK_PUBKEY_TOO_SMALL; |
| 136 | BN_copy(q,dh->p); | 133 | BN_copy(q,dh->p); |
| 137 | BN_sub_word(q,1); | 134 | BN_sub_word(q,1); |
| 138 | if (BN_cmp(pub_key,q) >= 0) | 135 | if (BN_cmp(pub_key,q)>=0) |
| 139 | *ret|=DH_CHECK_PUBKEY_TOO_LARGE; | 136 | *ret|=DH_CHECK_PUBKEY_TOO_LARGE; |
| 140 | 137 | ||
| 141 | ok = 1; | 138 | ok = 1; |
| @@ -143,5 +140,3 @@ err: | |||
| 143 | if (q != NULL) BN_free(q); | 140 | if (q != NULL) BN_free(q); |
| 144 | return(ok); | 141 | return(ok); |
| 145 | } | 142 | } |
| 146 | |||
| 147 | #endif | ||
