EVP_DigestInit_ex() may be used to recycle an existing EVP_MD_CTX without having
to reinitialize all of it, especially if it is used with the same MD algorithm.
However, when the MD algorithm changes, it needs to perform more cleanups.
Make that code more closer to what EVP_MD_CTX_cleanup() does by:
- only freeing md_data if EVP_MD_CTX_FLAG_REUSE is not set
- performing an explicit_bzero of md_data before freeing it
- making sure we call EVP_PKEY_CTX_free on the pctx if the allocation for the
new md_data fails.
ok tedu@