Do not use OSSL_LIB_CTX

This commit is contained in:
Vladimir Dubrovin 2026-05-08 17:03:00 +03:00
parent 8c638fcaff
commit 41d1fa8b00
2 changed files with 9 additions and 15 deletions

View File

@ -96,6 +96,7 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
unsigned long l; unsigned long l;
#if defined(WITH_SSL) #if defined(WITH_SSL)
#ifndef WITHMAIN
if(salt[0] == '$' && salt[1] == '1' && salt[2] == '$' && (ep = (unsigned char *)strchr((char *)salt+3, '$'))) { if(salt[0] == '$' && salt[1] == '1' && salt[2] == '$' && (ep = (unsigned char *)strchr((char *)salt+3, '$'))) {
EVP_MD_CTX *ctx, *ctx1; EVP_MD_CTX *ctx, *ctx1;
unsigned int len; unsigned int len;
@ -183,6 +184,7 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
EVP_MD_CTX_free(ctx1); EVP_MD_CTX_free(ctx1);
} }
else else
#endif
#endif #endif
if(salt[0] == '$' && salt[1] == '3' && salt[2] == '$' && (ep = (unsigned char *)strchr((char *)salt+3, '$'))) { if(salt[0] == '$' && salt[1] == '3' && salt[2] == '$' && (ep = (unsigned char *)strchr((char *)salt+3, '$'))) {
sp = salt +3; sp = salt +3;
@ -229,7 +231,6 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
#ifdef WITHMAIN #ifdef WITHMAIN
#ifdef WITH_SSL #ifdef WITH_SSL
OSSL_LIB_CTX *library_ctx = NULL;
#include <openssl/provider.h> #include <openssl/provider.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
@ -256,17 +257,12 @@ int main(int argc, char* argv[]){
return 1; return 1;
} }
#ifdef WITH_SSL #ifdef WITH_SSL
library_ctx = OSSL_LIB_CTX_new(); OSSL_PROVIDER_load(NULL, "legacy");
OSSL_PROVIDER_load(library_ctx, "legacy"); OSSL_PROVIDER_load(NULL, "default");
OSSL_PROVIDER_load(library_ctx, "default"); md4_hash = EVP_MD_fetch(NULL, "MD4", NULL);
md4_hash = EVP_MD_fetch(library_ctx, "MD4", NULL);
if (md4_hash == NULL) { if (md4_hash == NULL) {
fprintf(stderr, "Error fetching MD4\n"); fprintf(stderr, "Error fetching MD4\n");
} }
md5_hash = EVP_MD_fetch(library_ctx, "MD5", NULL);
if (md5_hash == NULL) {
fprintf(stderr, "Error fetching MD5\n");
}
#endif #endif
if(argc == 2) { if(argc == 2) {
#ifdef WITH_SSL #ifdef WITH_SSL

View File

@ -278,7 +278,6 @@ int ssl_file_init = 0;
int ssl_init_done = 0; int ssl_init_done = 0;
OSSL_LIB_CTX *library_ctx = NULL;
extern EVP_MD *md4_hash; extern EVP_MD *md4_hash;
extern EVP_MD *md5_hash; extern EVP_MD *md5_hash;
@ -293,14 +292,13 @@ void ssl_init()
SSL_load_error_strings(); SSL_load_error_strings();
_3proxy_mutex_init(&ssl_file_mutex); _3proxy_mutex_init(&ssl_file_mutex);
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
library_ctx = OSSL_LIB_CTX_new(); OSSL_PROVIDER_load(NULL, "legacy");
OSSL_PROVIDER_load(library_ctx, "legacy"); OSSL_PROVIDER_load(NULL, "default");
OSSL_PROVIDER_load(library_ctx, "default"); md4_hash = EVP_MD_fetch(NULL, "MD4", NULL);
md4_hash = EVP_MD_fetch(library_ctx, "MD4", NULL);
if (md4_hash == NULL) { if (md4_hash == NULL) {
fprintf(stderr, "Error fetching MD4\n"); fprintf(stderr, "Error fetching MD4\n");
} }
md5_hash = EVP_MD_fetch(library_ctx, "MD5", NULL); md5_hash = EVP_MD_fetch(NULL, "MD5", NULL);
if (md5_hash == NULL) { if (md5_hash == NULL) {
fprintf(stderr, "Error fetching MD5\n"); fprintf(stderr, "Error fetching MD5\n");
} }