From 41d1fa8b006aa55cd4161f3fbecab0715bc62d9d Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Fri, 8 May 2026 17:03:00 +0300 Subject: [PATCH] Do not use OSSL_LIB_CTX --- src/3proxy_crypt.c | 14 +++++--------- src/ssllib.c | 10 ++++------ 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/3proxy_crypt.c b/src/3proxy_crypt.c index 1bcab05..9c7e853 100644 --- a/src/3proxy_crypt.c +++ b/src/3proxy_crypt.c @@ -96,6 +96,7 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi unsigned long l; #if defined(WITH_SSL) +#ifndef WITHMAIN if(salt[0] == '$' && salt[1] == '1' && salt[2] == '$' && (ep = (unsigned char *)strchr((char *)salt+3, '$'))) { EVP_MD_CTX *ctx, *ctx1; unsigned int len; @@ -183,6 +184,7 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi EVP_MD_CTX_free(ctx1); } else +#endif #endif if(salt[0] == '$' && salt[1] == '3' && salt[2] == '$' && (ep = (unsigned char *)strchr((char *)salt+3, '$'))) { sp = salt +3; @@ -229,7 +231,6 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi #ifdef WITHMAIN #ifdef WITH_SSL -OSSL_LIB_CTX *library_ctx = NULL; #include #endif #include @@ -256,17 +257,12 @@ int main(int argc, char* argv[]){ return 1; } #ifdef WITH_SSL - library_ctx = OSSL_LIB_CTX_new(); - OSSL_PROVIDER_load(library_ctx, "legacy"); - OSSL_PROVIDER_load(library_ctx, "default"); - md4_hash = EVP_MD_fetch(library_ctx, "MD4", NULL); + OSSL_PROVIDER_load(NULL, "legacy"); + OSSL_PROVIDER_load(NULL, "default"); + md4_hash = EVP_MD_fetch(NULL, "MD4", NULL); if (md4_hash == NULL) { 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 if(argc == 2) { #ifdef WITH_SSL diff --git a/src/ssllib.c b/src/ssllib.c index 46395b0..45e89a3 100644 --- a/src/ssllib.c +++ b/src/ssllib.c @@ -278,7 +278,6 @@ int ssl_file_init = 0; int ssl_init_done = 0; -OSSL_LIB_CTX *library_ctx = NULL; extern EVP_MD *md4_hash; extern EVP_MD *md5_hash; @@ -293,14 +292,13 @@ void ssl_init() SSL_load_error_strings(); _3proxy_mutex_init(&ssl_file_mutex); bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); - library_ctx = OSSL_LIB_CTX_new(); - OSSL_PROVIDER_load(library_ctx, "legacy"); - OSSL_PROVIDER_load(library_ctx, "default"); - md4_hash = EVP_MD_fetch(library_ctx, "MD4", NULL); + OSSL_PROVIDER_load(NULL, "legacy"); + OSSL_PROVIDER_load(NULL, "default"); + md4_hash = EVP_MD_fetch(NULL, "MD4", NULL); if (md4_hash == NULL) { 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) { fprintf(stderr, "Error fetching MD5\n"); }