diff --git a/lib/des/dh-imath.c b/lib/des/dh-imath.c index 7bc05b477..c900e35b8 100644 --- a/lib/des/dh-imath.c +++ b/lib/des/dh-imath.c @@ -173,7 +173,7 @@ dh_compute_key(unsigned char *shared, const BIGNUM * pub, DH *dh) BN2mpz(&peer_pub, pub); /* check if peers pubkey is reasonable */ - if (MP_SIGN(&peer_pub) != 1 + if (MP_SIGN(&peer_pub) == MP_NEG || mp_int_compare(&peer_pub, &p) >= 0 || mp_int_compare_value(&peer_pub, 1) <= 0) {