This can occur due to a problem with OpenSSL 0.9.8; as a workaround try a different version of OpenSSL.
Downgrading to an older version (or possibly upgrading to a newer version) is known to fix this issue.