Add extra defenses around BIGNUM sharp edges
Add extra defenses around BIGNUM sharp edges

Markus Vervier noticed that our client side code isn't being
defensive enough around DHE parameters and can pass on a
"0" as the value of dh->p. Note: not that the the BIGNUM is NULL,
but that the value of the number is literally zero.

Internally the libcrypto BIGNUM code treats zero specially and
ultimately ends up trying to dereference a NULL. A survey of
OpenSSL/BoringSSL/LibreSSL shows that in general it's the caller's
job to guard against this.

This change adds some extra sanity checks around the dh parameters.
Only one of these checks are critical and the rest are guards against
any potential future errors. I haven't been able to measure any
performance impact.

Reminder: Client mode is "hard" disabled and won't be enabled until
X509 validation is ready.

pascal-cuoq/s2n,jldodds/s2n,PKRoma/s2n,PKRoma/s2n,jfigus/s2n,colmmacc/s2n,awslabs/s2n,awslabs/s2n,kedars/s2n,awslabs/s2n,jldodds/s2n,regehr/s2n,gibson-compsci/s2n,gibson-compsci/s2n,colmmacc/s2n,jldodds/s2n,wcs1only/s2n,wcs1only/s2n,colmmacc/s2n,gibson-compsci/s2n,Wiladams/s2n,gibson-compsci/s2n,colmmacc/s2n,PKRoma/s2n,jqk6/s2n,raycoll/s2n,alexeblee/s2n,0-wiz-0/s2n,wcs1only/s2n,wcs1only/s2n,jldodds/s2n,gibson-compsci/s2n,colmmacc/s2n,SomeoneWeird/s2n,PKRoma/s2n,alexeblee/s2n,raycoll/s2n,raycoll/s2n,jldodds/s2n,colmmacc/s2n,PKRoma/s2n,barnabycolby/s2n,alexeblee/s2n,bpdavidson/s2n,bpdavidson/s2n,wcs1only/s2n,wcs1only/s2n,alexeblee/s2n,gibson-compsci/s2n,raycoll/s2n,PKRoma/s2n,bpdavidson/s2n,bpdavidson/s2n,hechunwen/s2n,awslabs/s2n,raycoll/s2n,wcs1only/s2n,PKRoma/s2n,bpdavidson/s2n,alexeblee/s2n,awslabs/s2n,bpdavidson/s2n,awslabs/s2n,alexeblee/s2n,wcs1only/s2n,PKRoma/s2n,raycoll/s2n