Do you have to call OpenSSL_add_all_digests() first?
On Aug 9, 2013, at 7:17 PM, Sanjay Kumar (sanjaku5) wrote:
Hello All,
I have a test program to use the function EVP_get_digestbyname as
below
I am not able figure out why function “EVP_get_digestbyname”
return NULL ?
After running the program as below I am getting the print “md is NULL”
Any help ?
#include <stdio.h>
#include <openssl/evp.h>
int main(int argc, char *argv[])
{
const EVP_MD *md;
const char *hash_type = "SHA1";
md = EVP_get_digestbyname(hash_type);
if(md == NULL)
{
printf("\n md is NULL\n");
}
return 0;
}
Compilation:
cc test.c –lcrypto
Running:
./a.out
md is NULL
Thanks,
Sanjay