mirleft/ocaml-tls — pull request #136 by pqwy (2014-06-14 01:26:05+00:00)
Title: Dh checks

Do DH sanity checks:

* Group modulus size (the group can still be bad in other ways, but then we have a malicious server, not a misconfigured one, and all the bets are off).
* KEX for certain degenerate cases that could be a result of MITM on g^y. (This is actually done in [nocrypto](https://github.com/mirleft/ocaml-nocrypto/blob/a55f2b390518a6709d9c84b267215496c0dc987f/src/dh.ml#L36).)

Although the size-constant lives in `Config` (512; same as the browsers), I didn't actually make it configurable as this is something that can be broadly agreed on, and would just further complicate the usage.

Fixes #48 although I'm still not finished with DH adventures and intend to track progress on https://github.com/mirleft/ocaml-nocrypto/issues/20.