diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2023-03-27 19:35:27 +0000 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2023-03-27 19:35:27 +0000 |
| commit | feb4a394577ea152b60393875860c551a7573adf (patch) | |
| tree | 1fb23ae437dae8b76e71719931be05d21bab9ca3 /src/wrapped/wrappedlibssl.c | |
| parent | cca1fd6f1987acc5fe7180a3925bbe8b1f34ccd0 (diff) | |
| download | box64-feb4a394577ea152b60393875860c551a7573adf.tar.gz box64-feb4a394577ea152b60393875860c551a7573adf.zip | |
Improved handling of libssl/libcrypto version 1.1 and 3.0
Diffstat (limited to 'src/wrapped/wrappedlibssl.c')
| -rwxr-xr-x | src/wrapped/wrappedlibssl.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/wrapped/wrappedlibssl.c b/src/wrapped/wrappedlibssl.c index 48dae430..14f28ae9 100755 --- a/src/wrapped/wrappedlibssl.c +++ b/src/wrapped/wrappedlibssl.c @@ -22,6 +22,8 @@ const char* libsslName = "libssl.so.1.0.0"; #define ALTNAME "libssl.so.1.0.2" #define ALTNAME2 "libssl.so.1.1" +#define ADDED_FUNCTIONS() \ + #include "generated/wrappedlibssltypes.h" #include "wrappercallback.h" @@ -261,6 +263,30 @@ static void* find_client_cert_Fct(void* fct) return NULL; } +// alpn_select +#define GO(A) \ +static uintptr_t my_alpn_select_fct_##A = 0; \ +static int my_alpn_select_##A(void* a, void* b, void* c, void* d, uint32_t e, void* f) \ +{ \ + return (int)RunFunction(my_context, my_alpn_select_fct_##A, 6, a, b, c, d, e, f); \ +} +SUPER() +#undef GO +static void* find_alpn_select_Fct(void* fct) +{ + if(!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my_alpn_select_fct_##A == (uintptr_t)fct) return my_alpn_select_##A; + SUPER() + #undef GO + #define GO(A) if(my_alpn_select_fct_##A == 0) {my_alpn_select_fct_##A = (uintptr_t)fct; return my_alpn_select_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libSSL alpn_select callback\n"); + return NULL; +} + #undef SUPER EXPORT void my_SSL_CTX_set_default_passwd_cb(x64emu_t* emu, void* ctx, void* cb) @@ -329,6 +355,12 @@ EXPORT void my_SSL_CTX_set_client_cert_cb(x64emu_t* emu, void* ctx, void* cb) my->SSL_CTX_set_client_cert_cb(ctx, find_client_cert_Fct(cb)); } +EXPORT void my_SSL_CTX_set_alpn_select_cb(x64emu_t* emu, void* ctx, void* f ,void* arg) +{ + (void)emu; + my->SSL_CTX_set_alpn_select_cb(ctx, find_alpn_select_Fct(f), arg); +} + #define CUSTOM_INIT \ getMy(lib); \ setNeededLibs(lib, 2, "libcrypto.so.1.1", "libpthread.so.0"); |