e9d64c75f7769ab7f411213c3689566b6fe74498 galt Fri Nov 29 00:33:03 2024 -0800 fixes for MD5, evp functions mostly for OpenSSL3, not 1.1 diff --git src/hg/hgLogin/hgLogin.c src/hg/hgLogin/hgLogin.c index 11db40b..050aca4 100644 --- src/hg/hgLogin/hgLogin.c +++ src/hg/hgLogin/hgLogin.c @@ -87,34 +87,34 @@ * */ { if isEmpty(cfgOption(CFG_LOGIN_MAIL_RETURN_ADDR)) return cloneString("NULL_mailReturnAddr"); else return cloneString(cfgOption(CFG_LOGIN_MAIL_RETURN_ADDR)); } /* ---- password functions depend on installed openssl lib ---- */ void md5It(unsigned char *input, int inputSize, unsigned char *output) /* handle function deprecated by newer versions of openssl */ { -#if OPENSSL_VERSION_NUMBER < 0x10100000L // # 1.1 -MD5(input, inputSize, output); -#else +#if OPENSSL_VERSION_NUMBER >= 0x30000000L // > #3.0 EVP_Q_digest(NULL, "MD5", NULL, input, inputSize, output, NULL); +#else +MD5(input, inputSize, output); #endif } void cryptWikiWay(char *password, char *salt, char* result) /* encrypt password in mediawiki format - ':B:'.$salt.':'. md5($salt.'-'.md5($password ) */ { int i; unsigned char result1[MD5_DIGEST_LENGTH]; unsigned char result2[MD5_DIGEST_LENGTH]; char firstMD5[MD5_DIGEST_LENGTH*2 + 1]; char secondMD5[MD5_DIGEST_LENGTH*2 + 1]; i = MD5_DIGEST_LENGTH; md5It((unsigned char *)password, strlen(password), result1); for(i = 0; i < MD5_DIGEST_LENGTH; i++)