eichin
Joined 14 years ago
Karma
1,594
Submissions
690
Member since
Feb 2
Joined 14 years ago
But no, the actual problem was so much less subtle.
mbedtls_ssl_conf_dh_param_bin(conf, dhm_p, sizeof(dhm_g), dhm_g, sizeof(dhm_g));
The first sizeof(dhm_g) should have been sizeof(dhm_p). So, do you attribute this to a simple typo (hard to catch at a glance due to similar letter shapes), "single letter variable names are bad" but the wikipedia page on DH also calls them p and g - it takes a little digging to get that "root" and "modulus" would have been better names, but maybe having them directly match the most common form of the equation would have made them easier to review...Or do you just add it to the list of C crimes, that "passing storage length and pointer" is maybe the worst possible way to return written-to storage from a function :-)