Don't include asn1_mac.h if all you need is asn1.h.
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@
Check X509_NAME_oneline() return value when it will have to allocate memory.
dsa_priv_decode(): only destroy the object we've created, and with the
  appropriate function. Checking for privkey != NULL is not enough since
  privkey points to a member of ndsa if ndsa != NULL.
dsa_priv_encode(): possible double free in error path.
Possible PBEPARAM leak in the error path.