diff options
Diffstat (limited to 'src/wrapped/wrappedlibssl3.c')
| -rw-r--r-- | src/wrapped/wrappedlibssl3.c | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/src/wrapped/wrappedlibssl3.c b/src/wrapped/wrappedlibssl3.c index 88c758d9..23d2e3b5 100644 --- a/src/wrapped/wrappedlibssl3.c +++ b/src/wrapped/wrappedlibssl3.c @@ -37,7 +37,7 @@ GO(4) static uintptr_t my3_pem_passwd_cb_fct_##A = 0; \ static int my3_pem_passwd_cb_##A(void* buf, int size, int rwflag, void* password) \ { \ - return (int)RunFunction(my_context, my3_pem_passwd_cb_fct_##A, 4, buf, size, rwflag, password); \ + return (int)RunFunctionFmt(my3_pem_passwd_cb_fct_##A, "piip", buf, size, rwflag, password); \ } SUPER() #undef GO @@ -61,7 +61,7 @@ static void* find_pem_passwd_cb_Fct(void* fct) static uintptr_t my3_anonymous_fct_##A = 0; \ static void* my3_anonymous_##A(void* a, void* b, void* c, void *d) \ { \ - return (void*)RunFunction(my_context, my3_anonymous_fct_##A, 4, a, b, c, d); \ + return (void*)RunFunctionFmt(my3_anonymous_fct_##A, "pppp", a, b, c, d); \ } SUPER() #undef GO @@ -86,7 +86,7 @@ static void* find_anonymous_Fct(void* fct) static uintptr_t my3_verify_fct_##A = 0; \ static int my3_verify_##A(int a, void* b) \ { \ - return (int)RunFunction(my_context, my3_verify_fct_##A, 2, a, b); \ + return (int)RunFunctionFmt(my3_verify_fct_##A, "ip", a, b); \ } SUPER() #undef GO @@ -120,7 +120,7 @@ static void* reverse_verify_Fct(void* fct) static uintptr_t my3_ex_new_fct_##A = 0; \ static void my3_ex_new_##A(void* parent, void* ptr, void* ad, int idx, long argl, void* argp) \ { \ - RunFunction(my_context, my3_ex_new_fct_##A, 6, parent, ptr, ad, idx, argl, argp); \ + RunFunctionFmt(my3_ex_new_fct_##A, "pppilp", parent, ptr, ad, idx, argl, argp); \ } SUPER() #undef GO @@ -144,7 +144,7 @@ static void* find_ex_new_Fct(void* fct) static uintptr_t my3_ex_free_fct_##A = 0; \ static void my3_ex_free_##A(void* parent, void* ptr, void* ad, int idx, long argl, void* argp) \ { \ - RunFunction(my_context, my3_ex_free_fct_##A, 6, parent, ptr, ad, idx, argl, argp); \ + RunFunctionFmt(my3_ex_free_fct_##A, "pppilp", parent, ptr, ad, idx, argl, argp); \ } SUPER() #undef GO @@ -168,7 +168,7 @@ static void* find_ex_free_Fct(void* fct) static uintptr_t my3_ex_dup_fct_##A = 0; \ static int my3_ex_dup_##A(void* to, void* from, void* from_d, int idx, long argl, void* argp) \ { \ - return (int) RunFunction(my_context, my3_ex_dup_fct_##A, 6, to, from, from_d, idx, argl, argp); \ + return (int) RunFunctionFmt(my3_ex_dup_fct_##A, "pppilp", to, from, from_d, idx, argl, argp); \ } SUPER() #undef GO @@ -192,7 +192,7 @@ static void* find_ex_dup_Fct(void* fct) static uintptr_t my3_client_cb_fct_##A = 0; \ static uint32_t my3_client_cb_##A(void* ssl, void* hint, void* identity, uint32_t id_len, void* psk, uint32_t psk_len) \ { \ - return RunFunction(my_context, my3_client_cb_fct_##A, 6, ssl, hint, identity, id_len, psk, psk_len); \ + return RunFunctionFmt(my3_client_cb_fct_##A, "pppupu", ssl, hint, identity, id_len, psk, psk_len); \ } SUPER() #undef GO @@ -216,7 +216,7 @@ static void* find_client_cb_Fct(void* fct) static uintptr_t my3_proto_select_fct_##A = 0; \ static int my3_proto_select_##A(void* s, void* out, void* outlen, void* in, uint32_t inlen, void* arg) \ { \ - return (int)RunFunction(my_context, my3_proto_select_fct_##A, 6, s, out, outlen, in, inlen, arg); \ + return (int)RunFunctionFmt(my3_proto_select_fct_##A, "ppppup", s, out, outlen, in, inlen, arg); \ } SUPER() #undef GO @@ -240,7 +240,7 @@ static void* find_proto_select_Fct(void* fct) static uintptr_t my3_client_cert_fct_##A = 0; \ static int my3_client_cert_##A(void* a, void* b, void* c) \ { \ - return (int)RunFunction(my_context, my3_client_cert_fct_##A, 3, a, b, c); \ + return (int)RunFunctionFmt(my3_client_cert_fct_##A, "ppp", a, b, c); \ } SUPER() #undef GO @@ -259,6 +259,30 @@ static void* find_client_cert_Fct(void* fct) return NULL; } +// alpn_select_cb +#define GO(A) \ +static uintptr_t my3_alpn_select_cb_fct_##A = 0; \ +static int my3_alpn_select_cb_##A(void* a, void* b, void* c, void* d, uint32_t e, void* f) \ +{ \ + return (int)RunFunctionFmt(my3_alpn_select_cb_fct_##A, "ppppup", a, b, c, d, e, f); \ +} +SUPER() +#undef GO +static void* find_alpn_select_cb_Fct(void* fct) +{ + if(!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my3_alpn_select_cb_fct_##A == (uintptr_t)fct) return my3_alpn_select_cb_##A; + SUPER() + #undef GO + #define GO(A) if(my3_alpn_select_cb_fct_##A == 0) {my3_alpn_select_cb_fct_##A = (uintptr_t)fct; return my3_alpn_select_cb_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libSSL alpn_select_cb callback\n"); + return NULL; +} + #undef SUPER EXPORT void my3_SSL_CTX_set_default_passwd_cb(x64emu_t* emu, void* ctx, void* cb) @@ -327,6 +351,11 @@ EXPORT void my3_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 my3_SSL_CTX_set_alpn_select_cb(x64emu_t* emu, void* ctx, void* f, void* arg) +{ + my->SSL_CTX_set_alpn_select_cb(ctx, find_alpn_select_cb_Fct(f), arg); +} + #define CUSTOM_INIT \ SETALT(my3_); \ getMy(lib); \ |