Lines Matching defs:dh
1 /* crypto/dh/dh_check.c */
62 #include <openssl/dh.h>
74 int DH_check(const DH *dh, int *ret)
93 if (dh->q) {
94 if (BN_cmp(dh->g, BN_value_one()) <= 0)
96 else if (BN_cmp(dh->g, dh->p) >= 0)
100 if (!BN_mod_exp(t1, dh->g, dh->q, dh->p, ctx))
105 if (!BN_is_prime_ex(dh->q, BN_prime_checks, ctx, NULL))
108 if (!BN_div(t1, t2, dh->p, dh->q, ctx))
112 if (dh->j && BN_cmp(dh->j, t1))
115 } else if (BN_is_word(dh->g, DH_GENERATOR_2)) {
116 l = BN_mod_word(dh->p, 24);
121 else if (BN_is_word(dh->g, DH_GENERATOR_3)) {
122 l = BN_mod_word(dh->p, 12);
127 else if (BN_is_word(dh->g, DH_GENERATOR_5)) {
128 l = BN_mod_word(dh->p, 10);
134 if (!BN_is_prime_ex(dh->p, BN_prime_checks, ctx, NULL))
136 else if (!dh->q) {
137 if (!BN_rshift1(t1, dh->p))
151 int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret)
167 if (BN_copy(tmp, dh->p) == NULL || !BN_sub_word(tmp, 1))
172 if (dh->q != NULL) {
174 if (!BN_mod_exp(tmp, pub_key, dh->q, dh->p, ctx))