tats/w3m

MD5 deprecated in openssl 3.0

nsanmartin opened this issue · 2 comments

The function unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md) from openssl is deprecated ad therefore generates lots of warnings in the build when compiling against openssl 3.0. According to https://wiki.openssl.org/index.php/EVP_Message_Digests it should be implemented similarly to this:

void digest_message(const unsigned char *message, size_t message_len, unsigned char *md) {

    unsigned int digest_len = MD5_DIGEST_LENGTH;

	EVP_MD_CTX *mdctx;

	if((mdctx = EVP_MD_CTX_new()) == NULL)
		handleErrors();

	if(1 != EVP_DigestInit_ex(mdctx, EVP_sha256(), NULL))
		handleErrors();

	if(1 != EVP_DigestUpdate(mdctx, message, message_len))
		handleErrors();

	if((md = (unsigned char *)OPENSSL_malloc(EVP_MD_size(EVP_md5()))) == NULL)
		handleErrors();

	if(1 != EVP_DigestFinal_ex(mdctx, md, &digest_len))
		handleErrors();

	EVP_MD_CTX_free(mdctx);
}

I was trying to test replacing present usages of MD5 with that, but on the one hand I'm not sure about what method w3m uses to "handleErrors" (I see for example that in some places is just used exit(1)). On the other hand, is there a proper way to test such change (MD5 is used in file.c)?

rkta commented
rkta commented