about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-12-14 11:43:03 +0100
committerptitSeb <sebastien.chev@gmail.com>2022-12-14 11:44:01 +0100
commit73467dc523081ecd0ffad503d6f46c2c58057f90 (patch)
tree231d49b1bd83d6e1f7f107432113b968f688c37f /src
parent4ff744ef8965a8f6db104a72db48ca6df89d95db (diff)
downloadbox64-73467dc523081ecd0ffad503d6f46c2c58057f90.tar.gz
box64-73467dc523081ecd0ffad503d6f46c2c58057f90.zip
Added more wrapped function to libgnutls (helps Wine)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/wrapped/wrappedgnutls.c30
-rwxr-xr-xsrc/wrapped/wrappedgnutls_private.h16
2 files changed, 38 insertions, 8 deletions
diff --git a/src/wrapped/wrappedgnutls.c b/src/wrapped/wrappedgnutls.c
index e5418f96..cc89e69c 100755
--- a/src/wrapped/wrappedgnutls.c
+++ b/src/wrapped/wrappedgnutls.c
@@ -81,6 +81,30 @@ static void* find_pullpush_Fct(void* fct)
     return NULL;
 }
 
+// timeout
+#define GO(A)   \
+static uintptr_t my_timeout_fct_##A = 0;                                \
+static int my_timeout_##A(void* p, uint32_t t)                          \
+{                                                                       \
+    return (int)RunFunction(my_context, my_timeout_fct_##A, 2, p, t);   \
+}
+SUPER()
+#undef GO
+static void* find_timeout_Fct(void* fct)
+{
+    if(!fct) return NULL;
+    void* p;
+    if((p = GetNativeFnc((uintptr_t)fct))) return p;
+    #define GO(A) if(my_timeout_fct_##A == (uintptr_t)fct) return my_timeout_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_timeout_fct_##A == 0) {my_timeout_fct_##A = (uintptr_t)fct; return my_timeout_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for libgnutls.so.30 timeout callback\n");
+    return NULL;
+}
+
 #undef SUPER
 
 
@@ -101,6 +125,12 @@ EXPORT void my_gnutls_transport_set_push_function(x64emu_t* emu, void* session,
     my->gnutls_transport_set_push_function(session, find_pullpush_Fct(f));
 }
 
+EXPORT void my_gnutls_transport_set_pull_timeout_function(x64emu_t* emu, void* session, void* f)
+{
+    (void)emu;
+    my->gnutls_transport_set_pull_timeout_function(session, find_timeout_Fct(f));
+}
+
 #define CUSTOM_INIT \
     getMy(lib);
 
diff --git a/src/wrapped/wrappedgnutls_private.h b/src/wrapped/wrappedgnutls_private.h
index 854806cf..cb981d3d 100755
--- a/src/wrapped/wrappedgnutls_private.h
+++ b/src/wrapped/wrappedgnutls_private.h
@@ -177,8 +177,8 @@ GO(gnutls_dh_params_init, iFp)
 //GO(gnutls_dtls_get_timeout, 
 //GO(gnutls_dtls_prestate_set, 
 //GO(gnutls_dtls_set_data_mtu, 
-//GO(gnutls_dtls_set_mtu, 
-//GO(gnutls_dtls_set_timeouts, 
+GO(gnutls_dtls_set_mtu, vFpu)
+GO(gnutls_dtls_set_timeouts, vFpuu)
 //GO(gnutls_ecc_curve_get, 
 //GO(gnutls_ecc_curve_get_id, 
 //GO(gnutls_ecc_curve_get_name, 
@@ -582,13 +582,13 @@ GO(gnutls_protocol_get_version, iFp)
 //GO(gnutls_psk_set_server_known_dh_params, 
 //GO(gnutls_psk_set_server_params_function, 
 GO(gnutls_pubkey_deinit, vFp)
-//GO(gnutls_pubkey_encrypt_data, 
+GO(gnutls_pubkey_encrypt_data, iFpupp)
 //GO(gnutls_pubkey_export, 
 //GO(gnutls_pubkey_export2, 
-//GO(gnutls_pubkey_export_dsa_raw, 
-//GO(gnutls_pubkey_export_ecc_raw, 
+GO(gnutls_pubkey_export_dsa_raw, iFppppp)
+GO(gnutls_pubkey_export_ecc_raw, iFpppp)
 //GO(gnutls_pubkey_export_ecc_x962, 
-//GO(gnutls_pubkey_export_rsa_raw, 
+GO(gnutls_pubkey_export_rsa_raw, iFppp)
 //GO(gnutls_pubkey_get_key_id, 
 //GO(gnutls_pubkey_get_key_usage, 
 //GO(gnutls_pubkey_get_openpgp_key_id, 
@@ -601,7 +601,7 @@ GO(gnutls_pubkey_import_ecc_raw, iFpppp)
 //GO(gnutls_pubkey_import_openpgp, 
 //GO(gnutls_pubkey_import_openpgp_raw, 
 //GO(gnutls_pubkey_import_pkcs11, 
-//GO(gnutls_pubkey_import_privkey, 
+GO(gnutls_pubkey_import_privkey, iFppuu)
 GO(gnutls_pubkey_import_rsa_raw, iFppp)
 //GO(gnutls_pubkey_import_tpm_raw, 
 //GO(gnutls_pubkey_import_tpm_url, 
@@ -754,7 +754,7 @@ GO(gnutls_transport_set_errno, vFpi)
 GO(gnutls_transport_set_ptr, vFpp)
 //GO(gnutls_transport_set_ptr2, 
 GOM(gnutls_transport_set_pull_function, vFEpp)
-//GO(gnutls_transport_set_pull_timeout_function, 
+GOM(gnutls_transport_set_pull_timeout_function, vFEpp)
 GOM(gnutls_transport_set_push_function, vFEpp)
 //GO(gnutls_transport_set_vec_push_function, 
 //GO(_gnutls_ucs2_to_utf8,