diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2023-06-20 02:47:37 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-19 20:47:37 +0200 |
| commit | 0cef7f27ea7098d531a20ba6d12a627335a27a5d (patch) | |
| tree | 06e61f34098af1bc6248faf2e109c6d13c61324b /src | |
| parent | 9698844cc3894f29e101fe9282141d4a5e27267f (diff) | |
| download | box64-0cef7f27ea7098d531a20ba6d12a627335a27a5d.tar.gz box64-0cef7f27ea7098d531a20ba6d12a627335a27a5d.zip | |
[WRAPPER] Added more symbols for openssl wrapper (#847)
* Added more symbols for openssl * Added more symbols for openssl
Diffstat (limited to 'src')
| -rw-r--r-- | src/wrapped/generated/functions_list.txt | 22 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedcryptotypes.h | 13 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedlibssltypes.h | 5 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.c | 10 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.h | 4 | ||||
| -rwxr-xr-x | src/wrapped/wrappedcrypto.c | 270 | ||||
| -rwxr-xr-x | src/wrapped/wrappedcrypto_private.h | 92 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibssl.c | 153 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibssl_private.h | 43 |
9 files changed, 560 insertions, 52 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index e4ff0b86..6b30bd2f 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -36,6 +36,7 @@ #() iFp #() iFO #() iFS +#() iFP #() IFv #() IFi #() IFI @@ -1837,6 +1838,7 @@ #() iFiiiipp #() iFiiiuwp #() iFiWiipi +#() iFilpppp #() iFiLpppi #() iFipiipi #() iFipipip @@ -1933,6 +1935,7 @@ #() iFppppip #() iFppppup #() iFpppppi +#() iFpppppL #() iFpppppp #() uFEiippp #() uFEiuppp @@ -2270,6 +2273,7 @@ #() pFpLppiip #() pFppiiipp #() pFppiiCCC +#() pFppiippp #() pFppipipp #() pFppipLpp #() pFppuippp @@ -2849,18 +2853,30 @@ wrappedcrypto: - sk_new - vFpp: - X509_STORE_CTX_set_verify_cb + - X509_STORE_set_verify_cb - sk_pop_free +- iFpp: + - BIO_meth_set_create + - BIO_meth_set_ctrl + - BIO_meth_set_destroy + - BIO_meth_set_gets + - BIO_meth_set_puts + - BIO_meth_set_read + - BIO_meth_set_write - pFpp: - OPENSSL_sk_pop_free - iFppp: - ASN1_i2d_bio - pFpppp: - ASN1_d2i_bio + - PEM_read_bio_DHparams - PEM_read_bio_DSAPrivateKey - PEM_read_bio_DSA_PUBKEY - PEM_read_bio_ECPrivateKey - PEM_read_bio_EC_PUBKEY - PEM_read_bio_PKCS7 + - PEM_read_bio_PUBKEY + - PEM_read_bio_PrivateKey - PEM_read_bio_RSAPrivateKey - PEM_read_bio_RSA_PUBKEY - PEM_read_bio_X509 @@ -2875,6 +2891,7 @@ wrappedcrypto: - iFppppipp: - PEM_write_bio_DSAPrivateKey - PEM_write_bio_ECPrivateKey + - PEM_write_bio_PrivateKey - PEM_write_bio_RSAPrivateKey wrappedcrypto3: - vFp: @@ -4212,9 +4229,14 @@ wrappedlibssl: - pFp: - SSL_get_verify_callback - vFpp: + - SSL_CTX_sess_set_new_cb - SSL_CTX_set_client_cert_cb + - SSL_CTX_set_cookie_generate_cb + - SSL_CTX_set_cookie_verify_cb - SSL_CTX_set_default_passwd_cb - SSL_set_psk_client_callback + - SSL_set_psk_server_callback + - SSL_set_psk_use_session_callback - vFpip: - SSL_CTX_set_verify - SSL_set_verify diff --git a/src/wrapped/generated/wrappedcryptotypes.h b/src/wrapped/generated/wrappedcryptotypes.h index fce03fad..2c51e4d5 100644 --- a/src/wrapped/generated/wrappedcryptotypes.h +++ b/src/wrapped/generated/wrappedcryptotypes.h @@ -14,6 +14,7 @@ typedef void (*vFp_t)(void*); typedef void* (*pFp_t)(void*); typedef void (*vFpp_t)(void*, void*); +typedef int32_t (*iFpp_t)(void*, void*); typedef void* (*pFpp_t)(void*, void*); typedef int32_t (*iFppp_t)(void*, void*, void*); typedef void* (*pFpppp_t)(void*, void*, void*, void*); @@ -26,15 +27,26 @@ typedef int32_t (*iFppppipp_t)(void*, void*, void*, void*, int32_t, void*, void* GO(CRYPTO_set_locking_callback, vFp_t) \ GO(sk_new, pFp_t) \ GO(X509_STORE_CTX_set_verify_cb, vFpp_t) \ + GO(X509_STORE_set_verify_cb, vFpp_t) \ GO(sk_pop_free, vFpp_t) \ + GO(BIO_meth_set_create, iFpp_t) \ + GO(BIO_meth_set_ctrl, iFpp_t) \ + GO(BIO_meth_set_destroy, iFpp_t) \ + GO(BIO_meth_set_gets, iFpp_t) \ + GO(BIO_meth_set_puts, iFpp_t) \ + GO(BIO_meth_set_read, iFpp_t) \ + GO(BIO_meth_set_write, iFpp_t) \ GO(OPENSSL_sk_pop_free, pFpp_t) \ GO(ASN1_i2d_bio, iFppp_t) \ GO(ASN1_d2i_bio, pFpppp_t) \ + GO(PEM_read_bio_DHparams, pFpppp_t) \ GO(PEM_read_bio_DSAPrivateKey, pFpppp_t) \ GO(PEM_read_bio_DSA_PUBKEY, pFpppp_t) \ GO(PEM_read_bio_ECPrivateKey, pFpppp_t) \ GO(PEM_read_bio_EC_PUBKEY, pFpppp_t) \ GO(PEM_read_bio_PKCS7, pFpppp_t) \ + GO(PEM_read_bio_PUBKEY, pFpppp_t) \ + GO(PEM_read_bio_PrivateKey, pFpppp_t) \ GO(PEM_read_bio_RSAPrivateKey, pFpppp_t) \ GO(PEM_read_bio_RSA_PUBKEY, pFpppp_t) \ GO(PEM_read_bio_X509, pFpppp_t) \ @@ -46,6 +58,7 @@ typedef int32_t (*iFppppipp_t)(void*, void*, void*, void*, int32_t, void*, void* GO(ENGINE_ctrl_cmd, iFpplppi_t) \ GO(PEM_write_bio_DSAPrivateKey, iFppppipp_t) \ GO(PEM_write_bio_ECPrivateKey, iFppppipp_t) \ + GO(PEM_write_bio_PrivateKey, iFppppipp_t) \ GO(PEM_write_bio_RSAPrivateKey, iFppppipp_t) #endif // __wrappedcryptoTYPES_H_ diff --git a/src/wrapped/generated/wrappedlibssltypes.h b/src/wrapped/generated/wrappedlibssltypes.h index 1d00a486..ca81176d 100644 --- a/src/wrapped/generated/wrappedlibssltypes.h +++ b/src/wrapped/generated/wrappedlibssltypes.h @@ -20,9 +20,14 @@ typedef int32_t (*iFlpppp_t)(intptr_t, void*, void*, void*, void*); #define SUPER() ADDED_FUNCTIONS() \ GO(SSL_get_verify_callback, pFp_t) \ + GO(SSL_CTX_sess_set_new_cb, vFpp_t) \ GO(SSL_CTX_set_client_cert_cb, vFpp_t) \ + GO(SSL_CTX_set_cookie_generate_cb, vFpp_t) \ + GO(SSL_CTX_set_cookie_verify_cb, vFpp_t) \ GO(SSL_CTX_set_default_passwd_cb, vFpp_t) \ GO(SSL_set_psk_client_callback, vFpp_t) \ + GO(SSL_set_psk_server_callback, vFpp_t) \ + GO(SSL_set_psk_use_session_callback, vFpp_t) \ GO(SSL_CTX_set_verify, vFpip_t) \ GO(SSL_set_verify, vFpip_t) \ GO(SSL_CTX_set_alpn_select_cb, vFppp_t) \ diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c index c652f42c..3c6b4210 100644 --- a/src/wrapped/generated/wrapper.c +++ b/src/wrapped/generated/wrapper.c @@ -72,6 +72,7 @@ typedef int32_t (*iFL_t)(uintptr_t); typedef int32_t (*iFp_t)(void*); typedef int32_t (*iFO_t)(int32_t); typedef int32_t (*iFS_t)(void*); +typedef int32_t (*iFP_t)(void*); typedef int64_t (*IFv_t)(void); typedef int64_t (*IFi_t)(int32_t); typedef int64_t (*IFI_t)(int64_t); @@ -1873,6 +1874,7 @@ typedef int32_t (*iFiiiiip_t)(int32_t, int32_t, int32_t, int32_t, int32_t, void* typedef int32_t (*iFiiiipp_t)(int32_t, int32_t, int32_t, int32_t, void*, void*); typedef int32_t (*iFiiiuwp_t)(int32_t, int32_t, int32_t, uint32_t, int16_t, void*); typedef int32_t (*iFiWiipi_t)(int32_t, uint16_t, int32_t, int32_t, void*, int32_t); +typedef int32_t (*iFilpppp_t)(int32_t, intptr_t, void*, void*, void*, void*); typedef int32_t (*iFiLpppi_t)(int32_t, uintptr_t, void*, void*, void*, int32_t); typedef int32_t (*iFipiipi_t)(int32_t, void*, int32_t, int32_t, void*, int32_t); typedef int32_t (*iFipipip_t)(int32_t, void*, int32_t, void*, int32_t, void*); @@ -1969,6 +1971,7 @@ typedef int32_t (*iFppppiu_t)(void*, void*, void*, void*, int32_t, uint32_t); typedef int32_t (*iFppppip_t)(void*, void*, void*, void*, int32_t, void*); typedef int32_t (*iFppppup_t)(void*, void*, void*, void*, uint32_t, void*); typedef int32_t (*iFpppppi_t)(void*, void*, void*, void*, void*, int32_t); +typedef int32_t (*iFpppppL_t)(void*, void*, void*, void*, void*, uintptr_t); typedef int32_t (*iFpppppp_t)(void*, void*, void*, void*, void*, void*); typedef uint32_t (*uFEiippp_t)(x64emu_t*, int32_t, int32_t, void*, void*, void*); typedef uint32_t (*uFEiuppp_t)(x64emu_t*, int32_t, uint32_t, void*, void*, void*); @@ -2306,6 +2309,7 @@ typedef void* (*pFplppppp_t)(void*, intptr_t, void*, void*, void*, void*, void*) typedef void* (*pFpLppiip_t)(void*, uintptr_t, void*, void*, int32_t, int32_t, void*); typedef void* (*pFppiiipp_t)(void*, void*, int32_t, int32_t, int32_t, void*, void*); typedef void* (*pFppiiCCC_t)(void*, void*, int32_t, int32_t, uint8_t, uint8_t, uint8_t); +typedef void* (*pFppiippp_t)(void*, void*, int32_t, int32_t, void*, void*, void*); typedef void* (*pFppipipp_t)(void*, void*, int32_t, void*, int32_t, void*, void*); typedef void* (*pFppipLpp_t)(void*, void*, int32_t, void*, uintptr_t, void*, void*); typedef void* (*pFppuippp_t)(void*, void*, uint32_t, int32_t, void*, void*, void*); @@ -2890,6 +2894,7 @@ void iFL(x64emu_t *emu, uintptr_t fcn) { iFL_t fn = (iFL_t)fcn; R_RAX=(int32_t)f void iFp(x64emu_t *emu, uintptr_t fcn) { iFp_t fn = (iFp_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI); } void iFO(x64emu_t *emu, uintptr_t fcn) { iFO_t fn = (iFO_t)fcn; R_RAX=(int32_t)fn(of_convert((int32_t)R_RDI)); } void iFS(x64emu_t *emu, uintptr_t fcn) { iFS_t fn = (iFS_t)fcn; R_RAX=(int32_t)fn(io_convert((void*)R_RDI)); } +void iFP(x64emu_t *emu, uintptr_t fcn) { iFP_t fn = (iFP_t)fcn; R_RAX=(int32_t)fn(*(void**)(R_RSP + 8)); } void IFv(x64emu_t *emu, uintptr_t fcn) { IFv_t fn = (IFv_t)fcn; R_RAX=(int64_t)fn(); } void IFi(x64emu_t *emu, uintptr_t fcn) { IFi_t fn = (IFi_t)fcn; R_RAX=(int64_t)fn((int32_t)R_RDI); } void IFI(x64emu_t *emu, uintptr_t fcn) { IFI_t fn = (IFI_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI); } @@ -4691,6 +4696,7 @@ void iFiiiiip(x64emu_t *emu, uintptr_t fcn) { iFiiiiip_t fn = (iFiiiiip_t)fcn; R void iFiiiipp(x64emu_t *emu, uintptr_t fcn) { iFiiiipp_t fn = (iFiiiipp_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (void*)R_R8, (void*)R_R9); } void iFiiiuwp(x64emu_t *emu, uintptr_t fcn) { iFiiiuwp_t fn = (iFiiiuwp_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (uint32_t)R_RCX, (int16_t)R_R8, (void*)R_R9); } void iFiWiipi(x64emu_t *emu, uintptr_t fcn) { iFiWiipi_t fn = (iFiWiipi_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (uint16_t)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (void*)R_R8, (int32_t)R_R9); } +void iFilpppp(x64emu_t *emu, uintptr_t fcn) { iFilpppp_t fn = (iFilpppp_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (intptr_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9); } void iFiLpppi(x64emu_t *emu, uintptr_t fcn) { iFiLpppi_t fn = (iFiLpppi_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (int32_t)R_R9); } void iFipiipi(x64emu_t *emu, uintptr_t fcn) { iFipiipi_t fn = (iFipiipi_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (void*)R_R8, (int32_t)R_R9); } void iFipipip(x64emu_t *emu, uintptr_t fcn) { iFipipip_t fn = (iFipipip_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (void*)R_RCX, (int32_t)R_R8, (void*)R_R9); } @@ -4787,6 +4793,7 @@ void iFppppiu(x64emu_t *emu, uintptr_t fcn) { iFppppiu_t fn = (iFppppiu_t)fcn; R void iFppppip(x64emu_t *emu, uintptr_t fcn) { iFppppip_t fn = (iFppppip_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (int32_t)R_R8, (void*)R_R9); } void iFppppup(x64emu_t *emu, uintptr_t fcn) { iFppppup_t fn = (iFppppup_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (uint32_t)R_R8, (void*)R_R9); } void iFpppppi(x64emu_t *emu, uintptr_t fcn) { iFpppppi_t fn = (iFpppppi_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (int32_t)R_R9); } +void iFpppppL(x64emu_t *emu, uintptr_t fcn) { iFpppppL_t fn = (iFpppppL_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (uintptr_t)R_R9); } void iFpppppp(x64emu_t *emu, uintptr_t fcn) { iFpppppp_t fn = (iFpppppp_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9); } void uFEiippp(x64emu_t *emu, uintptr_t fcn) { uFEiippp_t fn = (uFEiippp_t)fcn; R_RAX=(uint32_t)fn(emu, (int32_t)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8); } void uFEiuppp(x64emu_t *emu, uintptr_t fcn) { uFEiuppp_t fn = (uFEiuppp_t)fcn; R_RAX=(uint32_t)fn(emu, (int32_t)R_RDI, (uint32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8); } @@ -5124,6 +5131,7 @@ void pFplppppp(x64emu_t *emu, uintptr_t fcn) { pFplppppp_t fn = (pFplppppp_t)fcn void pFpLppiip(x64emu_t *emu, uintptr_t fcn) { pFpLppiip_t fn = (pFpLppiip_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (int32_t)R_R8, (int32_t)R_R9, *(void**)(R_RSP + 8)); } void pFppiiipp(x64emu_t *emu, uintptr_t fcn) { pFppiiipp_t fn = (pFppiiipp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (int32_t)R_R8, (void*)R_R9, *(void**)(R_RSP + 8)); } void pFppiiCCC(x64emu_t *emu, uintptr_t fcn) { pFppiiCCC_t fn = (pFppiiCCC_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (uint8_t)R_R8, (uint8_t)R_R9, *(uint8_t*)(R_RSP + 8)); } +void pFppiippp(x64emu_t *emu, uintptr_t fcn) { pFppiippp_t fn = (pFppiippp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8)); } void pFppipipp(x64emu_t *emu, uintptr_t fcn) { pFppipipp_t fn = (pFppipipp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (void*)R_RCX, (int32_t)R_R8, (void*)R_R9, *(void**)(R_RSP + 8)); } void pFppipLpp(x64emu_t *emu, uintptr_t fcn) { pFppipLpp_t fn = (pFppipLpp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (void*)R_RCX, (uintptr_t)R_R8, (void*)R_R9, *(void**)(R_RSP + 8)); } void pFppuippp(x64emu_t *emu, uintptr_t fcn) { pFppuippp_t fn = (pFppuippp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (uint32_t)R_RDX, (int32_t)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8)); } @@ -7226,6 +7234,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFiiiipp) return 1; if (fun == &iFiiiuwp) return 1; if (fun == &iFiWiipi) return 1; + if (fun == &iFilpppp) return 1; if (fun == &iFiLpppi) return 1; if (fun == &iFipiipi) return 1; if (fun == &iFipipip) return 1; @@ -7321,6 +7330,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFppppip) return 1; if (fun == &iFppppup) return 1; if (fun == &iFpppppi) return 1; + if (fun == &iFpppppL) return 1; if (fun == &iFpppppp) return 1; if (fun == &uFuuuuuu) return 1; if (fun == &uFupuufp) return 2; diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h index f0e08c35..24fdb036 100644 --- a/src/wrapped/generated/wrapper.h +++ b/src/wrapped/generated/wrapper.h @@ -73,6 +73,7 @@ void iFL(x64emu_t *emu, uintptr_t fnc); void iFp(x64emu_t *emu, uintptr_t fnc); void iFO(x64emu_t *emu, uintptr_t fnc); void iFS(x64emu_t *emu, uintptr_t fnc); +void iFP(x64emu_t *emu, uintptr_t fnc); void IFv(x64emu_t *emu, uintptr_t fnc); void IFi(x64emu_t *emu, uintptr_t fnc); void IFI(x64emu_t *emu, uintptr_t fnc); @@ -1874,6 +1875,7 @@ void iFiiiiip(x64emu_t *emu, uintptr_t fnc); void iFiiiipp(x64emu_t *emu, uintptr_t fnc); void iFiiiuwp(x64emu_t *emu, uintptr_t fnc); void iFiWiipi(x64emu_t *emu, uintptr_t fnc); +void iFilpppp(x64emu_t *emu, uintptr_t fnc); void iFiLpppi(x64emu_t *emu, uintptr_t fnc); void iFipiipi(x64emu_t *emu, uintptr_t fnc); void iFipipip(x64emu_t *emu, uintptr_t fnc); @@ -1970,6 +1972,7 @@ void iFppppiu(x64emu_t *emu, uintptr_t fnc); void iFppppip(x64emu_t *emu, uintptr_t fnc); void iFppppup(x64emu_t *emu, uintptr_t fnc); void iFpppppi(x64emu_t *emu, uintptr_t fnc); +void iFpppppL(x64emu_t *emu, uintptr_t fnc); void iFpppppp(x64emu_t *emu, uintptr_t fnc); void uFEiippp(x64emu_t *emu, uintptr_t fnc); void uFEiuppp(x64emu_t *emu, uintptr_t fnc); @@ -2307,6 +2310,7 @@ void pFplppppp(x64emu_t *emu, uintptr_t fnc); void pFpLppiip(x64emu_t *emu, uintptr_t fnc); void pFppiiipp(x64emu_t *emu, uintptr_t fnc); void pFppiiCCC(x64emu_t *emu, uintptr_t fnc); +void pFppiippp(x64emu_t *emu, uintptr_t fnc); void pFppipipp(x64emu_t *emu, uintptr_t fnc); void pFppipLpp(x64emu_t *emu, uintptr_t fnc); void pFppuippp(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped/wrappedcrypto.c b/src/wrapped/wrappedcrypto.c index 5455f19e..8c5a1619 100755 --- a/src/wrapped/wrappedcrypto.c +++ b/src/wrapped/wrappedcrypto.c @@ -35,11 +35,179 @@ GO(2) \ GO(3) \ GO(4) +// BIO_meth_set_write +#define GO(A) \ +static uintptr_t my_BIO_meth_set_write_fct_##A = 0; \ +static int my_BIO_meth_set_write_##A(void* a, void* b, int c) \ +{ \ + return (int)RunFunctionFmt(my_context, my_BIO_meth_set_write_fct_##A, "ppi", a, b, c); \ +} +SUPER() +#undef GO +static void* find_BIO_meth_set_write_Fct(void* fct) +{ + if (!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my_BIO_meth_set_write_fct_##A == (uintptr_t)fct) return my_BIO_meth_set_write_##A; + SUPER() + #undef GO + #define GO(A) if(my_BIO_meth_set_write_fct_##A == 0) {my_BIO_meth_set_write_fct_##A = (uintptr_t)fct; return my_BIO_meth_set_write_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libcrypto BIO_meth_set_write callback\n"); + return NULL; +} + +// BIO_meth_set_read +#define GO(A) \ +static uintptr_t my_BIO_meth_set_read_fct_##A = 0; \ +static int my_BIO_meth_set_read_##A(void* a, void* b, int c)\ +{ \ + return (int)RunFunctionFmt(my_context, my_BIO_meth_set_read_fct_##A, "ppi", a, b, c); \ +} +SUPER() +#undef GO +static void* find_BIO_meth_set_read_Fct(void* fct) +{ + if (!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my_BIO_meth_set_read_fct_##A == (uintptr_t)fct) return my_BIO_meth_set_read_##A; + SUPER() + #undef GO + #define GO(A) if(my_BIO_meth_set_read_fct_##A == 0) {my_BIO_meth_set_read_fct_##A = (uintptr_t)fct; return my_BIO_meth_set_read_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libcrypto BIO_meth_set_read callback\n"); + return NULL; +} + +// BIO_meth_set_puts +#define GO(A) \ +static uintptr_t my_BIO_meth_set_puts_fct_##A = 0; \ +static int my_BIO_meth_set_puts_##A(void* a, void* b) \ +{ \ + return (int)RunFunctionFmt(my_context, my_BIO_meth_set_puts_fct_##A, "pp", a, b); \ +} +SUPER() +#undef GO +static void* find_BIO_meth_set_puts_Fct(void* fct) +{ + if (!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my_BIO_meth_set_puts_fct_##A == (uintptr_t)fct) return my_BIO_meth_set_puts_##A; + SUPER() + #undef GO + #define GO(A) if(my_BIO_meth_set_puts_fct_##A == 0) {my_BIO_meth_set_puts_fct_##A = (uintptr_t)fct; return my_BIO_meth_set_puts_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libcrypto BIO_meth_set_puts callback\n"); + return NULL; +} + +// BIO_meth_set_gets +#define GO(A) \ +static uintptr_t my_BIO_meth_set_gets_fct_##A = 0; \ +static int my_BIO_meth_set_gets_##A(void* a, void* b, int c)\ +{ \ + return (int)RunFunctionFmt(my_context, my_BIO_meth_set_gets_fct_##A, "ppi", a, b, c); \ +} +SUPER() +#undef GO +static void* find_BIO_meth_set_gets_Fct(void* fct) +{ + if (!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my_BIO_meth_set_gets_fct_##A == (uintptr_t)fct) return my_BIO_meth_set_gets_##A; + SUPER() + #undef GO + #define GO(A) if(my_BIO_meth_set_gets_fct_##A == 0) {my_BIO_meth_set_gets_fct_##A = (uintptr_t)fct; return my_BIO_meth_set_gets_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libcrypto BIO_meth_set_gets callback\n"); + return NULL; +} + +// BIO_meth_set_ctrl +#define GO(A) \ +static uintptr_t my_BIO_meth_set_ctrl_fct_##A = 0; \ +static long my_BIO_meth_set_ctrl_##A(void* a, int b, long c, void* d) \ +{ \ + return (long)RunFunctionFmt(my_context, my_BIO_meth_set_ctrl_fct_##A, "pilp", a, b, c, d); \ +} +SUPER() +#undef GO +static void* find_BIO_meth_set_ctrl_Fct(void* fct) +{ + if (!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my_BIO_meth_set_ctrl_fct_##A == (uintptr_t)fct) return my_BIO_meth_set_ctrl_##A; + SUPER() + #undef GO + #define GO(A) if(my_BIO_meth_set_ctrl_fct_##A == 0) {my_BIO_meth_set_ctrl_fct_##A = (uintptr_t)fct; return my_BIO_meth_set_ctrl_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libcrypto BIO_meth_set_ctrl callback\n"); + return NULL; +} + +// BIO_meth_set_create +#define GO(A) \ +static uintptr_t my_BIO_meth_set_create_fct_##A = 0;\ +static int my_BIO_meth_set_create_##A(void* a) \ +{ \ + return (int)RunFunctionFmt(my_context, my_BIO_meth_set_create_fct_##A, "p", a); \ +} +SUPER() +#undef GO +static void* find_BIO_meth_set_create_Fct(void* fct) +{ + if (!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my_BIO_meth_set_create_fct_##A == (uintptr_t)fct) return my_BIO_meth_set_create_##A; + SUPER() + #undef GO + #define GO(A) if(my_BIO_meth_set_create_fct_##A == 0) {my_BIO_meth_set_create_fct_##A = (uintptr_t)fct; return my_BIO_meth_set_create_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libcrypto BIO_meth_set_create callback\n"); + return NULL; +} + +// BIO_meth_set_destroy +#define GO(A) \ +static uintptr_t my_BIO_meth_set_destroy_fct_##A = 0; \ +static int my_BIO_meth_set_destroy_##A(void* a) \ +{ \ + return (int)RunFunctionFmt(my_context, my_BIO_meth_set_destroy_fct_##A, "p", a);\ +} +SUPER() +#undef GO +static void* find_BIO_meth_set_destroy_Fct(void* fct) +{ + if (!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my_BIO_meth_set_destroy_fct_##A == (uintptr_t)fct) return my_BIO_meth_set_destroy_##A; + SUPER() + #undef GO + #define GO(A) if(my_BIO_meth_set_destroy_fct_##A == 0) {my_BIO_meth_set_destroy_fct_##A = (uintptr_t)fct; return my_BIO_meth_set_destroy_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libcrypto BIO_meth_set_destroy callback\n"); + return NULL; +} + // ENGINE_ctrl_cb #define GO(A) \ -static uintptr_t my_ENGINE_ctrl_cb_fct_##A = 0; \ -static void my_ENGINE_ctrl_cb_##A() \ -{ \ +static uintptr_t my_ENGINE_ctrl_cb_fct_##A = 0; \ +static void my_ENGINE_ctrl_cb_##A() \ +{ \ RunFunctionFmt(my_context, my_ENGINE_ctrl_cb_fct_##A, ""); \ } SUPER() @@ -275,6 +443,31 @@ static void* find_pem_password_cb_Fct(void* fct) return NULL; } +// ctx_verify_cb +#define GO(A) \ +static uintptr_t my_ctx_verify_cb_fct_##A = 0; \ +static int my_ctx_verify_cb_##A(int a, void* b) \ +{ \ + return (int)RunFunctionFmt(my_context, my_ctx_verify_cb_fct_##A, "ip", a, b); \ +} +SUPER() +#undef GO +static void* find_ctx_verify_cb_Fct(void* fct) +{ + if(!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my_ctx_verify_cb_fct_##A == (uintptr_t)fct) return my_ctx_verify_cb_##A; + SUPER() + #undef GO + #define GO(A) if(my_ctx_verify_cb_fct_##A == 0) {my_ctx_verify_cb_fct_##A = (uintptr_t)fct; return my_ctx_verify_cb_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libcrypto ctx_verify_cb callback\n"); + return NULL; +} + + // verify_cb #define GO(A) \ static uintptr_t my_verify_cb_fct_##A = 0; \ @@ -301,6 +494,42 @@ static void* find_verify_cb_Fct(void* fct) #undef SUPER +EXPORT int32_t my_BIO_meth_set_write(x64emu_t* emu, void* biom, void* cb) +{ + (void)emu; + return my->BIO_meth_set_write(biom, find_BIO_meth_set_write_Fct(cb)); +} +EXPORT int32_t my_BIO_meth_set_read(x64emu_t* emu, void* biom, void* cb) +{ + (void)emu; + return my->BIO_meth_set_read(biom, find_BIO_meth_set_read_Fct(cb)); +} +EXPORT int32_t my_BIO_meth_set_puts(x64emu_t* emu, void* biom, void* cb) +{ + (void)emu; + return my->BIO_meth_set_puts(biom, find_BIO_meth_set_puts_Fct(cb)); +} +EXPORT int32_t my_BIO_meth_set_gets(x64emu_t* emu, void* biom, void* cb) +{ + (void)emu; + return my->BIO_meth_set_gets(biom, find_BIO_meth_set_gets_Fct(cb)); +} +EXPORT int32_t my_BIO_meth_set_ctrl(x64emu_t* emu, void* biom, void* cb) +{ + (void)emu; + return my->BIO_meth_set_ctrl(biom, find_BIO_meth_set_ctrl_Fct(cb)); +} +EXPORT int32_t my_BIO_meth_set_create(x64emu_t* emu, void* biom, void* cb) +{ + (void)emu; + return my->BIO_meth_set_create(biom, find_BIO_meth_set_create_Fct(cb)); +} +EXPORT int32_t my_BIO_meth_set_destroy(x64emu_t* emu, void* biom, void* cb) +{ + (void)emu; + return my->BIO_meth_set_destroy(biom, find_BIO_meth_set_destroy_Fct(cb)); +} + EXPORT int32_t my_ENGINE_ctrl(x64emu_t* emu, void* e, int32_t cmd, int32_t i, void* p, void* f) { (void)emu; @@ -373,6 +602,13 @@ EXPORT int my_PEM_write_bio_RSAPrivateKey(x64emu_t* emu, void* bp, void* x, void return my->PEM_write_bio_RSAPrivateKey(bp, x, e, str, len, find_passphrase_Fct(cb), u); } + +EXPORT int my_PEM_write_bio_PrivateKey(x64emu_t* emu, void* bp, void* x, void* e, void* str, int len, void* cb, void* u) +{ + (void)emu; + return my->PEM_write_bio_PrivateKey(bp, x, e, str, len, find_passphrase_Fct(cb), u); +} + EXPORT int my_PEM_write_bio_ECPrivateKey(x64emu_t* emu, void* bp, void* x, void* e, void* str, int len, void* cb, void* u) { (void)emu; @@ -409,6 +645,25 @@ EXPORT void* my_PEM_read_bio_PKCS7(x64emu_t* emu, void* bp, void* x, void* cb, v return my->PEM_read_bio_PKCS7(bp, x, find_pem_password_cb_Fct(cb), u); } +EXPORT void* my_PEM_read_bio_PrivateKey(x64emu_t* emu, void* bp, void* x, void* cb, void* u) +{ + (void)emu; + return my->PEM_read_bio_PrivateKey(bp, x, find_pem_password_cb_Fct(cb), u); +} + + +EXPORT void* my_PEM_read_bio_PUBKEY(x64emu_t* emu, void* bp, void* x, void* cb, void* u) +{ + (void)emu; + return my->PEM_read_bio_PUBKEY(bp, x, find_pem_password_cb_Fct(cb), u); +} + +EXPORT void* my_PEM_read_bio_DHparams(x64emu_t* emu, void* bp, void* x, void* cb, void* u) +{ + (void)emu; + return my->PEM_read_bio_DHparams(bp, x, find_pem_password_cb_Fct(cb), u); +} + EXPORT void* my_PEM_read_bio_X509(x64emu_t* emu, void* bp, void* x, void* cb, void* u) { (void)emu; @@ -442,7 +697,14 @@ EXPORT void* my_PEM_read_bio_X509_CERT_PAIR(x64emu_t* emu, void* bp, void* x, vo EXPORT void my_X509_STORE_CTX_set_verify_cb(x64emu_t* emu, void* ctx, void* cb) { (void)emu; - my->X509_STORE_CTX_set_verify_cb(ctx, find_verify_cb_Fct(cb)); + my->X509_STORE_CTX_set_verify_cb(ctx, find_ctx_verify_cb_Fct(cb)); +} + + +EXPORT void my_X509_STORE_set_verify_cb(x64emu_t* emu, void* ctx, void* cb) +{ + (void)emu; + my->X509_STORE_set_verify_cb(ctx, find_verify_cb_Fct(cb)); } EXPORT void my_OPENSSL_sk_pop_free(x64emu_t* emu, void* s, void* cb) diff --git a/src/wrapped/wrappedcrypto_private.h b/src/wrapped/wrappedcrypto_private.h index 7c127fc8..ab3b3ba2 100755 --- a/src/wrapped/wrappedcrypto_private.h +++ b/src/wrapped/wrappedcrypto_private.h @@ -96,7 +96,7 @@ GOM(ASN1_i2d_bio, iFEppp) //GO(ASN1_i2d_fp, //GO(ASN1_IA5STRING_free, //GO(ASN1_IA5STRING_new, -//GO(ASN1_INTEGER_cmp, +GO(ASN1_INTEGER_cmp, iFpp) //GO(ASN1_INTEGER_dup, GO(ASN1_INTEGER_free, vFp) GO(ASN1_INTEGER_get, lFp) @@ -172,6 +172,7 @@ GO(ASN1_STRING_data, pFp) GO(ASN1_STRING_dup, pFp) GO(ASN1_STRING_free, vFp) //GO(ASN1_STRING_get_default_mask, +GO(ASN1_STRING_get0_data, pFp) GO(ASN1_STRING_length, iFp) //GO(ASN1_STRING_length_set, //GO(ASN1_STRING_new, @@ -255,12 +256,14 @@ GO(BASIC_CONSTRAINTS_new, pFv) //GO(BF_options, //GO(BF_set_key, //GO(BIO_accept, +GO(BIO_ADDR_free, vFp) +GO(BIO_ADDR_new, pFv) //GO(BIO_asn1_get_prefix, //GO(BIO_asn1_get_suffix, //GO(BIO_asn1_set_prefix, //GO(BIO_asn1_set_suffix, //GO(BIO_callback_ctrl, -//GO(BIO_clear_flags, +GO(BIO_clear_flags, vFpi) //GO(BIO_CONNECT_free, //GO(BIO_CONNECT_new, //GO(BIO_copy_next_retry, @@ -299,17 +302,28 @@ GO(BIO_free_all, vFp) //GO(BIO_get_callback, //GO(BIO_get_callback_arg, GO(BIO_get_close, iFp) -//GO(BIO_get_ex_data, +GO(BIO_get_data, pFp) +GO(BIO_get_ex_data, pFpi) //GO(BIO_get_ex_new_index, //GO(BIO_gethostbyname, //GO(BIO_get_host_ip, //GO(BIO_get_port, //GO(BIO_get_retry_BIO, //GO(BIO_get_retry_reason, +GO(BIO_get_shutdown, iFp) GO(BIO_gets, iFppi) //GO(BIO_hex_string, //GO(BIO_indent, GO(BIO_int_ctrl, lFpili) +GO(BIO_meth_free, vFp) +GO(BIO_meth_new, pFip) +GOM(BIO_meth_set_write, iFEpp) +GOM(BIO_meth_set_read, iFEpp) +GOM(BIO_meth_set_puts, iFEpp) +GOM(BIO_meth_set_gets, iFEpp) +GOM(BIO_meth_set_ctrl, iFEpp) +GOM(BIO_meth_set_create, iFEpp) +GOM(BIO_meth_set_destroy, iFEpp) //GO(BIO_method_name, //GO(BIO_method_type, GO(BIO_new, pFp) @@ -350,8 +364,11 @@ GO(BIO_set, iFpp) //GO(BIO_set_callback_arg, GO(BIO_set_close, iFpl) //GO(BIO_set_cipher, -//GO(BIO_set_ex_data, -//GO(BIO_set_flags, +GO(BIO_set_data, vFpp) +GO(BIO_set_ex_data, iFpip) +GO(BIO_set_flags, vFpi) +GO(BIO_set_init, vFpi) +GO(BIO_set_shutdown, vFpi) //GO(BIO_set_tcp_ndelay, //GO(BIO_s_fd, //GO(BIO_s_file, @@ -462,6 +479,7 @@ GO(BN_is_bit_set, iFpi) //GO(BN_is_prime_ex, //GO(BN_is_prime_fasttest, //GO(BN_is_prime_fasttest_ex, +GO(BN_is_word, iFpL) GO(BN_is_zero, iFp) //GO(BN_kronecker, GO(BN_lshift, iFppi) @@ -848,7 +866,7 @@ GO(CRYPTO_free, vFppi) //GO(CRYPTO_get_dynlock_value, //GO(CRYPTO_get_ex_data, //GO(CRYPTO_get_ex_data_implementation, -//GO(CRYPTO_get_ex_new_index, +GO(CRYPTO_get_ex_new_index, iFilpppp) //GO(CRYPTO_get_id_callback, //GO(CRYPTO_get_locked_mem_ex_functions, //GO(CRYPTO_get_locked_mem_functions, @@ -1148,7 +1166,8 @@ GO(DES_set_odd_parity, vFp) GO(DES_string_to_2keys, vFppp) GO(DES_string_to_key, vFpp) GO(DES_xcbc_encrypt, vFpplppppi) -//GO(DH_check, +GO(DH_bits, iFp) +GO(DH_check, iFpp) //GO(DH_check_pub_key, //GO(DH_compute_key, //GO(DH_compute_key_padded, @@ -1156,6 +1175,7 @@ GO(DH_free, vFp) //GO(DH_generate_key, //GO(DH_generate_parameters, //GO(DH_generate_parameters_ex, +GO(DH_get0_pqg, vFpppp) //GO(DH_get_1024_160, //GO(DH_get_2048_224, //GO(DH_get_2048_256, @@ -1185,6 +1205,7 @@ GO(DH_new, pFv) //GO(DIST_POINT_set_dpname, //GO(dsa_builtin_paramgen, //GO(dsa_builtin_paramgen2, +GO(DSA_bits, iFp) //GO(DSA_do_sign, //GO(DSA_do_verify, //GO(DSA_dup_DH, @@ -1954,7 +1975,7 @@ GO(EVP_MD_type, iFp) //GO(EVP_PKEY_asn1_set_private, //GO(EVP_PKEY_asn1_set_public, GO(EVP_PKEY_assign, iFpip) -//GO(EVP_PKEY_base_id, +GO(EVP_PKEY_base_id, iFp) //GO(EVP_PKEY_bits, GO(EVP_PKEY_cmp, iFpp) GO(EVP_PKEY_cmp_parameters, iFpp) @@ -1989,7 +2010,7 @@ GO(EVP_PKEY_derive_set_peer, iFppi) GO(EVP_PKEY_free, vFp) //GO(EVP_PKEY_get0, //GO(EVP_PKEY_get0_asn1, -//GO(EVP_PKEY_get1_DH, +GO(EVP_PKEY_get1_DH, pFp) GO(EVP_PKEY_get1_DSA, pFp) GO(EVP_PKEY_get1_EC_KEY, pFp) GO(EVP_PKEY_get1_RSA, pFp) @@ -2024,13 +2045,14 @@ GO(EVP_PKEY_keygen_init, iFp) GO(EVP_PKEY_missing_parameters, iFp) GO(EVP_PKEY_new, pFv) GO(EVP_PKEY_new_mac_key, pFippi) +GO(EVP_PKEY_param_check, iFp) GO(EVP_PKEY_paramgen, iFpp) GO(EVP_PKEY_paramgen_init, iFp) //GO(EVP_PKEY_print_params, //GO(EVP_PKEY_print_private, //GO(EVP_PKEY_print_public, //GO(EVP_PKEY_save_parameters, -//GO(EVP_PKEY_set1_DH, +GO(EVP_PKEY_set1_DH, iFpp) GO(EVP_PKEY_set1_DSA, iFpp) GO(EVP_PKEY_set1_EC_KEY, iFpp) GO(EVP_PKEY_set1_RSA, iFpp) @@ -2492,7 +2514,7 @@ GO(OBJ_txt2obj, pFpi) //GO(OCSP_archive_cutoff_new, //GO(OCSP_basic_add1_cert, //GO(OCSP_basic_add1_nonce, -//GO(OCSP_basic_add1_status, +GO(OCSP_basic_add1_status, pFppiippp) //GO(OCSP_BASICRESP_add1_ext_i2d, //GO(OCSP_BASICRESP_add_ext, //GO(OCSP_BASICRESP_delete_ext, @@ -2503,8 +2525,8 @@ GO(OCSP_BASICRESP_free, vFp) //GO(OCSP_BASICRESP_get_ext_by_NID, //GO(OCSP_BASICRESP_get_ext_by_OBJ, //GO(OCSP_BASICRESP_get_ext_count, -//GO(OCSP_BASICRESP_new, -//GO(OCSP_basic_sign, +GO(OCSP_BASICRESP_new, pFv) +GO(OCSP_basic_sign, iFpppppL) GO(OCSP_basic_verify, iFpppL) //GO(OCSP_CERTID_dup, GO(OCSP_CERTID_free, vFp) @@ -2515,14 +2537,14 @@ GO(OCSP_CERTID_free, vFp) //GO(OCSP_cert_status_str, GO(OCSP_cert_to_id, pFppp) GO(OCSP_check_nonce, iFpp) -//GO(OCSP_check_validity, +GO(OCSP_check_validity, iFppll) //GO(OCSP_copy_nonce, //GO(OCSP_CRLID_free, //GO(OCSP_crlID_new, //GO(OCSP_CRLID_new, //GO(OCSP_crl_reason_str, -//GO(OCSP_id_cmp, -//GO(OCSP_id_get0_info, +GO(OCSP_id_cmp, iFpp) +GO(OCSP_id_get0_info, iFppppp) //GO(OCSP_id_issuer_cmp, //GO(OCSP_ONEREQ_add1_ext_i2d, //GO(OCSP_ONEREQ_add_ext, @@ -2571,21 +2593,22 @@ GO(OCSP_REQUEST_new, pFv) //GO(OCSP_request_verify, //GO(OCSP_RESPBYTES_free, //GO(OCSP_RESPBYTES_new, -//GO(OCSP_resp_count, +GO(OCSP_resp_count, iFp) //GO(OCSP_RESPDATA_free, //GO(OCSP_RESPDATA_new, //GO(OCSP_resp_find, GO(OCSP_resp_find_status, iFppppppp) -//GO(OCSP_resp_get0, +GO(OCSP_resp_get0, pFpi) +GO(OCSP_resp_get0_certs, pFp) //GO(OCSP_RESPID_free, //GO(OCSP_RESPID_new, -//GO(OCSP_response_create, +GO(OCSP_response_create, pFip) GO(OCSP_RESPONSE_free, vFp) GO(OCSP_response_get1_basic, pFp) GO(OCSP_RESPONSE_new, pFv) //GO(OCSP_RESPONSE_print, -//GO(OCSP_response_status, -//GO(OCSP_response_status_str, +GO(OCSP_response_status, iFp) +GO(OCSP_response_status_str, pFl) //GO(OCSP_REVOKEDINFO_free, //GO(OCSP_REVOKEDINFO_new, //GO(OCSP_sendreq_bio, @@ -2596,11 +2619,12 @@ GO(OCSP_RESPONSE_new, pFv) //GO(OCSP_set_max_response_length, //GO(OCSP_SIGNATURE_free, //GO(OCSP_SIGNATURE_new, -//GO(OCSP_single_get0_status, +GO(OCSP_single_get0_status, iFppppp) //GO(OCSP_SINGLERESP_add1_ext_i2d, //GO(OCSP_SINGLERESP_add_ext, //GO(OCSP_SINGLERESP_delete_ext, //GO(OCSP_SINGLERESP_free, +GO(OCSP_SINGLERESP_get0_id, pFp) //GO(OCSP_SINGLERESP_get1_ext_d2i, //GO(OCSP_SINGLERESP_get_ext, //GO(OCSP_SINGLERESP_get_ext_by_critical, @@ -2647,6 +2671,7 @@ GO(OPENSSL_sk_value, pFpi) //1.1+ //GO(OPENSSL_strcasecmp, //GO(OPENSSL_strncasecmp, //GO(OPENSSL_uni2asc, +GO(OpenSSL_version, pFi) GO(OpenSSL_version_num, LFv) //GO(OPENSSL_wipe_cpu, //GO(_ossl_096_des_random_seed, @@ -2710,7 +2735,7 @@ GO(OpenSSL_version_num, LFv) //GO(PEM_read, //GO(PEM_read_bio, //GO(PEM_read_bio_CMS, -//GO(PEM_read_bio_DHparams, +GOM(PEM_read_bio_DHparams, pFEpppp) //GO(PEM_read_bio_DSAparams, GOM(PEM_read_bio_DSAPrivateKey, pFEpppp) GOM(PEM_read_bio_DSA_PUBKEY, pFEpppp) @@ -2722,8 +2747,8 @@ GOM(PEM_read_bio_EC_PUBKEY, pFEpppp) GOM(PEM_read_bio_PKCS7, pFEpppp) //GO(PEM_read_bio_PKCS8, //GO(PEM_read_bio_PKCS8_PRIV_KEY_INFO, -//GO(PEM_read_bio_PrivateKey, -//GO(PEM_read_bio_PUBKEY, +GOM(PEM_read_bio_PrivateKey, pFEpppp) +GOM(PEM_read_bio_PUBKEY, pFEpppp) GOM(PEM_read_bio_RSAPrivateKey, pFEpppp) GOM(PEM_read_bio_RSA_PUBKEY, pFEpppp) //GO(PEM_read_bio_RSAPublicKey, @@ -2781,8 +2806,8 @@ GO(PEM_write_bio_EC_PUBKEY, iFpp) //GO(PEM_write_bio_PKCS8PrivateKey, //GO(PEM_write_bio_PKCS8PrivateKey_nid, //GO(PEM_write_bio_PKCS8_PRIV_KEY_INFO, -//GO(PEM_write_bio_PrivateKey, -//GO(PEM_write_bio_PUBKEY, +GOM(PEM_write_bio_PrivateKey, iFEppppipp) +GO(PEM_write_bio_PUBKEY, iFpp) GOM(PEM_write_bio_RSAPrivateKey, iFEppppipp) GO(PEM_write_bio_RSA_PUBKEY, iFpp) //GO(PEM_write_bio_RSAPublicKey, @@ -3031,6 +3056,7 @@ GO(RAND_write_file, iFp) //GO(RIPEMD160_Init, //GO(RIPEMD160_Transform, //GO(RIPEMD160_Update, +GO(RSA_bits, iFp) //GO(RSA_blinding_off, //GO(RSA_blinding_on, GO(RSA_check_key, iFp) @@ -3555,7 +3581,9 @@ GO(X509_get_version, lFp) GO(X509_get0_notAfter, pFp) GO(X509_get0_notBefore, pFp) GO(X509_get0_pubkey, pFp) -//GO(X509_gmtime_adj, +GO(X509_getm_notBefore, pFp) +GO(X509_getm_notAfter, pFp) +GO(X509_gmtime_adj, pFpl) //GO(X509_http_nbio, //GO(X509_INFO_free, //GO(X509_INFO_new, @@ -3745,7 +3773,7 @@ GO(X509_STORE_CTX_get_chain, pFp) GO(X509_STORE_CTX_get_current_cert, pFp) GO(X509_STORE_CTX_get_error, iFp) GO(X509_STORE_CTX_get_error_depth, iFp) -//GO(X509_STORE_CTX_get_ex_data, +GO(X509_STORE_CTX_get_ex_data, pFpi) //GO(X509_STORE_CTX_get_ex_new_index, //GO(X509_STORE_CTX_get_explicit_policy, GO(X509_STORE_CTX_init, iFpppp) @@ -3770,7 +3798,8 @@ GOM(X509_STORE_CTX_set_verify_cb, vFEpp) GO(X509_STORE_free, vFp) //GO(X509_STORE_get1_certs, //GO(X509_STORE_get1_crls, -//GO(X509_STORE_get_by_subject, +//GO(X509_STORE_get_by_subject, +GO(X509_STORE_get_ex_data, pFpi) GO(X509_STORE_load_file, iFpp) GO(X509_STORE_load_path, iFpp) GO(X509_STORE_load_store, iFpp) @@ -3779,11 +3808,12 @@ GO(X509_STORE_new, pFv) //GO(X509_STORE_set1_param, //GO(X509_STORE_set_default_paths, GO(X509_STORE_set_depth, iFpi) +GO(X509_STORE_set_ex_data, iFpip) GO(X509_STORE_set_flags, iFpL) //GO(X509_STORE_set_lookup_crls_cb, GO(X509_STORE_set_purpose, iFpi) GO(X509_STORE_set_trust, iFpi) -//GO(X509_STORE_set_verify_cb, +GOM(X509_STORE_set_verify_cb, vFEpp) //GO(X509_subject_name_cmp, GO(X509_subject_name_hash, LFp) GO(X509_subject_name_hash_old, LFp) diff --git a/src/wrapped/wrappedlibssl.c b/src/wrapped/wrappedlibssl.c index 040e3f89..e60d2664 100755 --- a/src/wrapped/wrappedlibssl.c +++ b/src/wrapped/wrappedlibssl.c @@ -215,6 +215,80 @@ static void* find_client_cb_Fct(void* fct) return NULL; } + +// server_cb +#define GO(A) \ +static uintptr_t my_server_cb_fct_##A = 0; \ +static uint32_t my_server_cb_##A(void* ssl, void* identity, void* psk, uint32_t psk_len) \ +{ \ + return RunFunctionFmt(my_context, my_server_cb_fct_##A, "pppu", ssl, identity, psk, psk_len); \ +} +SUPER() +#undef GO +static void* find_server_cb_Fct(void* fct) +{ + if(!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my_server_cb_fct_##A == (uintptr_t)fct) return my_server_cb_##A; + SUPER() + #undef GO + #define GO(A) if(my_server_cb_fct_##A == 0) {my_server_cb_fct_##A = (uintptr_t)fct; return my_server_cb_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libSSL server_cb callback\n"); + return NULL; +} + + +// use_session_cb +#define GO(A) \ +static uintptr_t my_use_session_cb_fct_##A = 0; \ +static uint32_t my_use_session_cb_##A(void* ssl, void* md, void* id, void* id_len, void* sess) \ +{ \ + return RunFunctionFmt(my_context, my_use_session_cb_fct_##A, "ppppp", ssl, md, id, id_len, sess); \ +} +SUPER() +#undef GO +static void* find_use_session_cb_Fct(void* fct) +{ + if(!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my_use_session_cb_fct_##A == (uintptr_t)fct) return my_use_session_cb_##A; + SUPER() + #undef GO + #define GO(A) if(my_use_session_cb_fct_##A == 0) {my_use_session_cb_fct_##A = (uintptr_t)fct; return my_use_session_cb_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libSSL use_session_cb callback\n"); + return NULL; +} + +// sess +#define GO(A) \ +static uintptr_t my_sess_fct_##A = 0; \ +static uint32_t my_sess_##A(void* ssl, void* sess) \ +{ \ + return RunFunctionFmt(my_context, my_sess_fct_##A, "pp", ssl, sess);\ +} +SUPER() +#undef GO +static void* find_sess_Fct(void* fct) +{ + if(!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my_sess_fct_##A == (uintptr_t)fct) return my_sess_##A; + SUPER() + #undef GO + #define GO(A) if(my_sess_fct_##A == 0) {my_sess_fct_##A = (uintptr_t)fct; return my_sess_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libSSL sess callback\n"); + return NULL; +} + // proto_select #define GO(A) \ static uintptr_t my_proto_select_fct_##A = 0; \ @@ -263,6 +337,55 @@ static void* find_client_cert_Fct(void* fct) return NULL; } +// cookie_generate +#define GO(A) \ +static uintptr_t my_cookie_generate_fct_##A = 0; \ +static int my_cookie_generate_##A(void* a, void* b, void* c)\ +{ \ + return (int)RunFunctionFmt(my_context, my_cookie_generate_fct_##A, "ppp", a, b, c); \ +} +SUPER() +#undef GO +static void* find_cookie_generate_Fct(void* fct) +{ + if(!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my_cookie_generate_fct_##A == (uintptr_t)fct) return my_cookie_generate_##A; + SUPER() + #undef GO + #define GO(A) if(my_cookie_generate_fct_##A == 0) {my_cookie_generate_fct_##A = (uintptr_t)fct; return my_cookie_generate_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libSSL cookie_generate callback\n"); + return NULL; +} + + +// cookie_verify +#define GO(A) \ +static uintptr_t my_cookie_verify_fct_##A = 0; \ +static int my_cookie_verify_##A(void* a, void* b, uint32_t c) \ +{ \ + return (int)RunFunctionFmt(my_context, my_cookie_verify_fct_##A, "ppu", a, b, c); \ +} +SUPER() +#undef GO +static void* find_cookie_verify_Fct(void* fct) +{ + if(!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my_cookie_verify_fct_##A == (uintptr_t)fct) return my_cookie_verify_##A; + SUPER() + #undef GO + #define GO(A) if(my_cookie_verify_fct_##A == 0) {my_cookie_verify_fct_##A = (uintptr_t)fct; return my_cookie_verify_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libSSL cookie_verify callback\n"); + return NULL; +} + // alpn_select #define GO(A) \ static uintptr_t my_alpn_select_fct_##A = 0; \ @@ -331,6 +454,24 @@ EXPORT void my_SSL_set_psk_client_callback(x64emu_t* emu, void* ctx, void* cb) my->SSL_set_psk_client_callback(ctx, find_client_cb_Fct(cb)); } +EXPORT void my_SSL_set_psk_server_callback(x64emu_t* emu, void* ctx, void* cb) +{ + (void)emu; + my->SSL_set_psk_server_callback(ctx, find_client_cb_Fct(cb)); +} + +EXPORT void my_SSL_set_psk_use_session_callback(x64emu_t* emu, void* ctx, void* cb) +{ + (void)emu; + my->SSL_set_psk_use_session_callback(ctx, find_use_session_cb_Fct(cb)); +} + +EXPORT void my_SSL_CTX_sess_set_new_cb(x64emu_t* emu, void* ctx, void* cb) +{ + (void)emu; + my->SSL_CTX_sess_set_new_cb(ctx, find_sess_Fct(cb)); +} + EXPORT void my_SSL_CTX_set_next_proto_select_cb(x64emu_t* emu, void* ctx, void* cb, void* arg) { (void)emu; @@ -355,6 +496,18 @@ 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_cookie_generate_cb(x64emu_t* emu, void* ctx, void* cb) +{ + (void)emu; + my->SSL_CTX_set_cookie_generate_cb(ctx, find_cookie_generate_Fct(cb)); +} + +EXPORT void my_SSL_CTX_set_cookie_verify_cb(x64emu_t* emu, void* ctx, void* cb) +{ + (void)emu; + my->SSL_CTX_set_cookie_verify_cb(ctx, find_cookie_verify_Fct(cb)); +} + EXPORT void my_SSL_CTX_set_alpn_select_cb(x64emu_t* emu, void* ctx, void* f ,void* arg) { (void)emu; diff --git a/src/wrapped/wrappedlibssl_private.h b/src/wrapped/wrappedlibssl_private.h index 3595fea9..fa2a083b 100755 --- a/src/wrapped/wrappedlibssl_private.h +++ b/src/wrapped/wrappedlibssl_private.h @@ -56,13 +56,14 @@ GO(d2i_SSL_SESSION, pFppl) //GO(dtls1_stop_timer, //GO(dtls1_write_app_data_bytes, //GO(dtls1_write_bytes, -//GO(DTLS_client_method, +GO(DTLS_client_method, pFv) GO(DTLS_method, pFv) GO(DTLS_server_method, pFv) GO(DTLSv1_2_client_method, pFv) GO(DTLSv1_2_method, pFv) GO(DTLSv1_2_server_method, pFv) GO(DTLSv1_client_method, pFv) +GO(DTLSv1_listen, iFpp) GO(DTLSv1_method, pFv) GO(DTLSv1_server_method, pFv) //GO(ERR_load_SSL_strings, @@ -243,17 +244,17 @@ GO(SSL_clear, iFp) //GO(SSL_COMP_get_compression_methods, //GO(SSL_COMP_get_name, //GO(SSL_COMP_set0_compression_methods, -//GO(SSL_CONF_cmd, -//GO(SSL_CONF_cmd_argv, -//GO(SSL_CONF_cmd_value_type, +GO(SSL_CONF_cmd, iFppp) +GO(SSL_CONF_cmd_argv, iFppp) +GO(SSL_CONF_cmd_value_type, iFpp) //GO(SSL_CONF_CTX_clear_flags, -//GO(SSL_CONF_CTX_finish, -//GO(SSL_CONF_CTX_free, -//GO(SSL_CONF_CTX_new, +GO(SSL_CONF_CTX_finish, iFp) +GO(SSL_CONF_CTX_free, vFp) +GO(SSL_CONF_CTX_new, pFv) //GO(SSL_CONF_CTX_set1_prefix, -//GO(SSL_CONF_CTX_set_flags, +GO(SSL_CONF_CTX_set_flags, uFpu) //GO(SSL_CONF_CTX_set_ssl, -//GO(SSL_CONF_CTX_set_ssl_ctx, +GO(SSL_CONF_CTX_set_ssl_ctx, vFpp) GO(SSL_connect, iFp) //GO(SSL_copy_session_id, //GO(ssl_create_cipher_list, @@ -279,6 +280,7 @@ GO(SSL_CTX_get_ex_data, pFpi) //GO(SSL_CTX_get_ex_new_index, //GO(SSL_CTX_get_info_callback, //GO(SSL_CTX_get_quiet_shutdown, +GO(SSL_CTX_get_security_level, iFp) //GO(SSL_CTX_get_ssl_method, //GO(SSL_CTX_get_timeout, //GO(SSL_CTX_get_verify_callback, @@ -292,7 +294,7 @@ GO(SSL_CTX_new, pFp) //GO(SSL_CTX_sess_get_remove_cb, //GO(SSL_CTX_sessions, //GO(SSL_CTX_sess_set_get_cb, -//GO(SSL_CTX_sess_set_new_cb, +GOM(SSL_CTX_sess_set_new_cb, vFEpp) //GO(SSL_CTX_sess_set_remove_cb, //GO(SSL_CTX_set1_param, GO(SSL_CTX_set_alpn_protos, iFppu) @@ -305,8 +307,8 @@ GO(SSL_CTX_set_ciphersuites, iFpp) GO(SSL_CTX_set_client_CA_list, vFpp) GOM(SSL_CTX_set_client_cert_cb, vFEpp) //GO(SSL_CTX_set_client_cert_engine, -//GO(SSL_CTX_set_cookie_generate_cb, -//GO(SSL_CTX_set_cookie_verify_cb, +GOM(SSL_CTX_set_cookie_generate_cb, vFEpp) +GOM(SSL_CTX_set_cookie_verify_cb, vFEpp) GOM(SSL_CTX_set_default_passwd_cb, vFEpp) GO(SSL_CTX_set_default_passwd_cb_userdata, vFpp) GO(SSL_CTX_set_default_verify_paths, iFp) @@ -348,7 +350,7 @@ GO(SSL_CTX_use_certificate_file, iFppi) GO(SSL_CTX_use_PrivateKey, iFpp) GO(SSL_CTX_use_PrivateKey_ASN1, iFuppi) GO(SSL_CTX_use_PrivateKey_file, iFppi) -//GO(SSL_CTX_use_psk_identity_hint, +GO(SSL_CTX_use_psk_identity_hint, iFpp) GO(SSL_CTX_use_RSAPrivateKey, iFpp) GO(SSL_CTX_use_RSAPrivateKey_ASN1, iFppl) GO(SSL_CTX_use_RSAPrivateKey_file, iFppi) @@ -375,6 +377,7 @@ GO(SSL_get_certificate, pFp) GO(SSL_get_ciphers, pFp) //GO(ssl_get_ciphers_by_id, GO(SSL_get_client_CA_list, pFp) +GO(SSL_get_client_random, LFppL) GO(SSL_get_current_cipher, pFp) //GO(SSL_get_current_compression, //GO(SSL_get_current_expansion, @@ -396,7 +399,7 @@ GO(SSL_get_privatekey, pFp) //GO(SSL_get_psk_identity, //GO(SSL_get_psk_identity_hint, //GO(SSL_get_quiet_shutdown, -//GO(SSL_get_rbio, +GO(SSL_get_rbio, pFp) //GO(SSL_get_read_ahead, //GO(SSL_get_rfd, //GO(SSL_get_selected_srtp_profile, @@ -427,6 +430,7 @@ GO(SSL_get_version, pFp) //GO(SSL_get_wfd, //GO(SSL_has_matching_session_id, //GO(ssl_init_wbio_buffer, +GO(SSL_in_init, iFP) GO(SSL_is_init_finished, iFp) GO(SSL_is_server, iFp) GO(SSL_library_init, iFv) @@ -463,8 +467,11 @@ GO(SSL_SESSION_free, vFp) //GO(SSL_SESSION_get_ex_data, //GO(SSL_SESSION_get_ex_new_index, //GO(SSL_SESSION_get_id, +GO(SSL_SESSION_get_master_key, LFppL) +GO(SSL_SESSION_get_ticket_lifetime_hint, LFp) //GO(SSL_SESSION_get_time, -//GO(SSL_SESSION_get_timeout, +//GO(SSL_SESSION_get_timeout, +GO(SSL_SESSION_is_resumable, iFp) GO(SSL_SESSION_new, pFv) //GO(SSL_SESSION_print, //GO(SSL_SESSION_print_fp, @@ -476,7 +483,7 @@ GO(SSL_session_reused, iFp) GO(SSL_SESSION_up_ref, iFp) //GO(SSL_set1_param, GO(SSL_set_accept_state, vFp) -//GO(SSL_set_alpn_protos, +GO(SSL_set_alpn_protos, iFppu) GO(SSL_set_bio, vFppp) //GO(SSL_set_cert_cb, //GO(ssl_set_cert_masks, @@ -490,9 +497,11 @@ GO(SSL_set_fd, iFpi) //GO(SSL_set_generate_session_id, //GO(SSL_set_info_callback, //GO(SSL_set_msg_callback, +GO(SSL_set_options, LFpL) //GO(ssl_set_peer_cert_type, GOM(SSL_set_psk_client_callback, vFEpp) -//GO(SSL_set_psk_server_callback, +GOM(SSL_set_psk_server_callback, vFEpp) +GOM(SSL_set_psk_use_session_callback, vFEpp) //GO(SSL_set_purpose, GO(SSL_set_quiet_shutdown, vFpi) //GO(SSL_set_read_ahead, |