Fixed DH and EC compiling on openssl < 1.0.1 - credits go to Nick Altmann for reporting and testing the fix

(cherry picked from commit aefe6c18319eaf6348695c5865aa2b2a5d451378)