Many openssl APIs return const EVP_MD
pointers (e.g., EVP_sha256
), and sometimes you need to resolve following errors:
error: cast discards 'const' qualifier from pointer target type [-Werror=cast-qual]
You can either suppress the warning like this or duplicate EVP_MD
:
EVP_MD *md = EVP_MD_meth_dup(EVP_sha256());
......
EVP_MD_meth_free(md);