diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-10-30 11:05:43 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-10-30 11:05:43 +0100 |
| commit | f82e938ae8e9124796562abbaf5725084db12f42 (patch) | |
| tree | 2e63bc9dc3f0517b15c32040403355b8da0b4b1b /src | |
| parent | 34520c0b4f491bf6ae468efde98c0ed87c1b3e56 (diff) | |
| download | box64-f82e938ae8e9124796562abbaf5725084db12f42.tar.gz box64-f82e938ae8e9124796562abbaf5725084db12f42.zip | |
[WRAPPER] Added more crypto3 and ssl3 function, and fixed some issue with hidden callback (for #1860)
Diffstat (limited to 'src')
| -rw-r--r-- | src/wrapped/generated/functions_list.txt | 14 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedcrypto3types.h | 7 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedlibssl3types.h | 7 | ||||
| -rw-r--r-- | src/wrapped/wrappedcrypto3.c | 97 | ||||
| -rw-r--r-- | src/wrapped/wrappedcrypto3_private.h | 63 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibssl3.c | 178 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibssl3_private.h | 19 |
7 files changed, 333 insertions, 52 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index 63c9fadf..250b8f67 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -3393,9 +3393,11 @@ wrappedcrypto3: - CRYPTO_set_locking_callback - pFp: - OPENSSL_sk_new + - X509V3_EXT_get - vFpp: - OPENSSL_sk_pop_free - X509_STORE_CTX_set_verify_cb + - X509_STORE_set_verify_cb - vFppp: - EVP_MD_do_all_provided - iFppp: @@ -3409,11 +3411,14 @@ wrappedcrypto3: - pFpppp: - ASN1_d2i_bio - PEM_read_DHparams + - 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 @@ -3428,6 +3433,8 @@ wrappedcrypto3: - iFppppipp: - PEM_write_bio_DSAPrivateKey - PEM_write_bio_ECPrivateKey + - PEM_write_bio_PrivateKey + - PEM_write_bio_PrivateKey_traditional - PEM_write_bio_RSAPrivateKey wrappedcurl: - iFpup: @@ -5084,6 +5091,13 @@ wrappedlibssl3: - SSL_set_psk_client_callback - SSL_set_psk_server_callback - SSL_set_psk_use_session_callback +- iFpp: + - BIO_meth_set_create + - BIO_meth_set_ctrl + - BIO_meth_set_destroy + - BIO_meth_set_puts + - BIO_meth_set_read + - BIO_meth_set_write - vFpip: - SSL_CTX_set_verify - SSL_set_verify diff --git a/src/wrapped/generated/wrappedcrypto3types.h b/src/wrapped/generated/wrappedcrypto3types.h index 71d09e9b..79fe61bb 100644 --- a/src/wrapped/generated/wrappedcrypto3types.h +++ b/src/wrapped/generated/wrappedcrypto3types.h @@ -28,8 +28,10 @@ typedef int32_t (*iFppppipp_t)(void*, void*, void*, void*, int32_t, void*, void* GO(CRYPTO_set_id_callback, vFp_t) \ GO(CRYPTO_set_locking_callback, vFp_t) \ GO(OPENSSL_sk_new, pFp_t) \ + GO(X509V3_EXT_get, pFp_t) \ GO(OPENSSL_sk_pop_free, vFpp_t) \ GO(X509_STORE_CTX_set_verify_cb, vFpp_t) \ + GO(X509_STORE_set_verify_cb, vFpp_t) \ GO(EVP_MD_do_all_provided, vFppp_t) \ GO(ASN1_i2d_bio, iFppp_t) \ GO(BIO_printf, iFppV_t) \ @@ -37,11 +39,14 @@ typedef int32_t (*iFppppipp_t)(void*, void*, void*, void*, int32_t, void*, void* GO(ERR_vset_error, vFiipA_t) \ GO(ASN1_d2i_bio, pFpppp_t) \ GO(PEM_read_DHparams, 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) \ @@ -53,6 +58,8 @@ 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_PrivateKey_traditional, iFppppipp_t) \ GO(PEM_write_bio_RSAPrivateKey, iFppppipp_t) #endif // __wrappedcrypto3TYPES_H_ diff --git a/src/wrapped/generated/wrappedlibssl3types.h b/src/wrapped/generated/wrappedlibssl3types.h index ae0b252e..ca4d8784 100644 --- a/src/wrapped/generated/wrappedlibssl3types.h +++ b/src/wrapped/generated/wrappedlibssl3types.h @@ -13,6 +13,7 @@ typedef void* (*pFp_t)(void*); typedef void (*vFpp_t)(void*, void*); +typedef int32_t (*iFpp_t)(void*, void*); typedef void (*vFpip_t)(void*, int32_t, void*); typedef void (*vFppp_t)(void*, void*, void*); typedef intptr_t (*lFpip_t)(void*, int32_t, void*); @@ -34,6 +35,12 @@ typedef int32_t (*iFlpppp_t)(intptr_t, void*, void*, void*, void*); 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(BIO_meth_set_create, iFpp_t) \ + GO(BIO_meth_set_ctrl, iFpp_t) \ + GO(BIO_meth_set_destroy, iFpp_t) \ + GO(BIO_meth_set_puts, iFpp_t) \ + GO(BIO_meth_set_read, iFpp_t) \ + GO(BIO_meth_set_write, iFpp_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/wrappedcrypto3.c b/src/wrapped/wrappedcrypto3.c index 87e5e089..127d130e 100644 --- a/src/wrapped/wrappedcrypto3.c +++ b/src/wrapped/wrappedcrypto3.c @@ -22,10 +22,25 @@ const char* crypto3Name = "libcrypto.so.3"; #define LIBNAME crypto3 -typedef int(*iFppA_t) (void*, void*, va_list); +typedef void*(*pFv_t) (); +typedef int (*iFppA_t) (void*, void*, va_list); +typedef int (*iFpip_t) (void*, int, void*); +typedef void*(*pFppp_t) (void*, void*, void*); #define ADDED_FUNCTIONS() \ GO(BIO_vprintf, iFppA_t); \ + GO(i2t_ASN1_OBJECT, iFpip_t); \ + GO(i2v_ASN1_BIT_STRING, pFppp_t); \ + GO(i2v_GENERAL_NAME, pFppp_t); \ + GO(i2v_GENERAL_NAMES, pFppp_t); \ + GO(ASN1_BIT_STRING_it, pFv_t); \ + GO(EXTENDED_KEY_USAGE_it, pFv_t); \ + GO(ASN1_OCTET_STRING_it, pFv_t); \ + GO(GENERAL_NAMES_it, pFv_t); \ + GO(CERTIFICATEPOLICIES_it, pFv_t); \ + GO(POLICYINFO_it, pFv_t); \ + GO(CRL_DIST_POINTS_it, pFv_t); \ + GO(ISSUING_DIST_POINT_it, pFv_t); \ #include "generated/wrappedcrypto3types.h" @@ -506,6 +521,86 @@ EXPORT void my3_EVP_MD_do_all_provided(x64emu_t* emu, void* ctx, void* cb, void* my->EVP_MD_do_all_provided(ctx, find_do_all_provided_cb_Fct(cb), arg); } +EXPORT void my3_X509_STORE_set_verify_cb(x64emu_t* emu, void* ctx, void* cb) +{ + my->X509_STORE_set_verify_cb(ctx, find_verify_cb_Fct(cb)); +} + +EXPORT void* my3_PEM_read_bio_PrivateKey(x64emu_t* emu, void* bp, void* x, void* cb, void* u) +{ + return my->PEM_read_bio_PrivateKey(bp,x, find_pem_password_cb_Fct(cb), u); +} + +EXPORT int my3_PEM_write_bio_PrivateKey(x64emu_t* emu, void* bp, void* x, void* enc, void* kstr, int klen, void* cb, void* u) +{ + return my->PEM_write_bio_PrivateKey(bp, x, enc, kstr, klen, find_pem_password_cb_Fct(cb), u); +} + +EXPORT int my3_PEM_write_bio_PrivateKey_traditional(x64emu_t* emu, void* bp, void* x, void* enc, void* kstr, int klen, void* cb, void* u) +{ + return my->PEM_write_bio_PrivateKey_traditional(bp, x, enc, kstr, klen, find_pem_password_cb_Fct(cb), u); +} + +EXPORT void* my3_PEM_read_bio_PUBKEY(x64emu_t* emu, void* bp, void* x, void* cb, void* u) +{ + return my->PEM_read_bio_PUBKEY(bp, x, find_pem_password_cb_Fct(cb), u); +} + +EXPORT void* my3_PEM_read_bio_DHparams(x64emu_t* emu, void* bp, void* x, void* cb, void* u) +{ + return my->PEM_read_bio_DHparams(bp, x, find_pem_password_cb_Fct(cb), u); +} + +typedef struct my_v3_ext_method_s { + int ext_nid; + int ext_flags; + void* it; + void* ext_new; + void* ext_free; + void* d2i; + void* i2d; + void* i2s; + void* s2i; + void* i2v; + void* v2i; + void* i2r; + void* r2i; +} my_v3_ext_method_t; + +EXPORT void* my3_X509V3_EXT_get(x64emu_t* emu, void* x) +{ + my_v3_ext_method_t* ret = my->X509V3_EXT_get(x); + if(ret) { + #define GO(A, W) if(ret->A) AddAutomaticBridge(my_lib->w.bridge, W, ret->A, 0, "v3_ext_method_" #A) + GO(ext_new, pFv); + GO(ext_free, vFp); + GO(d2i, pFppl); + GO(i2d, iFpp); + GO(i2s, pFpp); + GO(s2i, pFppp); + GO(i2v, pFppp); + GO(v2i, pFppp); + GO(i2r, iFpppi); + GO(r2i, pFppp); + #undef GO + } + return ret; +} + #define ALTMY my3_ +#define CUSTOM_INIT \ + AddAutomaticBridge(lib->w.bridge, iFpip, my->i2t_ASN1_OBJECT, 0, "i2t_ASN1_OBJECT"); \ + AddAutomaticBridge(lib->w.bridge, pFppp, my->i2v_ASN1_BIT_STRING, 0, "i2v_ASN1_BIT_STRING"); \ + AddAutomaticBridge(lib->w.bridge, pFppp, my->i2v_GENERAL_NAME, 0, "i2v_GENERAL_NAME"); \ + AddAutomaticBridge(lib->w.bridge, pFppp, my->i2v_GENERAL_NAMES, 0, "i2v_GENERAL_NAMES"); \ + AddAutomaticBridge(lib->w.bridge, pFv, my->ASN1_BIT_STRING_it, 0, "ASN1_BIT_STRING_it"); \ + AddAutomaticBridge(lib->w.bridge, pFv, my->EXTENDED_KEY_USAGE_it, 0, "EXTENDED_KEY_USAGE_it"); \ + AddAutomaticBridge(lib->w.bridge, pFv, my->ASN1_OCTET_STRING_it, 0, "ASN1_OCTET_STRING_it"); \ + AddAutomaticBridge(lib->w.bridge, pFv, my->GENERAL_NAMES_it, 0, "GENERAL_NAMES_it"); \ + AddAutomaticBridge(lib->w.bridge, pFv, my->CERTIFICATEPOLICIES_it, 0, "CERTIFICATEPOLICIES_it");\ + AddAutomaticBridge(lib->w.bridge, pFv, my->POLICYINFO_it, 0, "POLICYINFO_it"); \ + AddAutomaticBridge(lib->w.bridge, pFv, my->CRL_DIST_POINTS_it, 0, "CRL_DIST_POINTS_it"); \ + AddAutomaticBridge(lib->w.bridge, pFv, my->ISSUING_DIST_POINT_it, 0, "ISSUING_DIST_POINT_it"); \ + #include "wrappedlib_init.h" diff --git a/src/wrapped/wrappedcrypto3_private.h b/src/wrapped/wrappedcrypto3_private.h index a81711e6..318942fc 100644 --- a/src/wrapped/wrappedcrypto3_private.h +++ b/src/wrapped/wrappedcrypto3_private.h @@ -46,6 +46,7 @@ GO(ASN1_add_oid_module, vFv) GO(ASN1_BIT_STRING_check, iFppi) GO(ASN1_BIT_STRING_free, vFp) GO(ASN1_BIT_STRING_get_bit, iFpi) +GO(ASN1_BIT_STRING_it, pFv) GO(ASN1_BIT_STRING_name_print, iFpppi) GO(ASN1_BIT_STRING_new, pFv) GO(ASN1_BIT_STRING_num_asc, iFpp) @@ -135,6 +136,7 @@ GO(ASN1_object_size, iFiii) GO(ASN1_OCTET_STRING_cmp, iFpp) GO(ASN1_OCTET_STRING_dup, pFp) GO(ASN1_OCTET_STRING_free, vFp) +GO(ASN1_OCTET_STRING_it, pFv) GO(ASN1_OCTET_STRING_new, pFv) GO(ASN1_OCTET_STRING_set, iFppi) //GO(ASN1_pack_string, @@ -464,6 +466,7 @@ GO(BN_is_bit_set, iFpi) GO(BN_is_prime_ex, iFpipp) //GOM(BN_is_prime_fasttest, iFEpipppi) GO(BN_is_prime_fasttest_ex, iFpipip) +GO(BN_is_word, iFpL) GO(BN_is_zero, iFp) GO(BN_kronecker, iFppp) GO(BN_lshift, iFppi) @@ -601,6 +604,7 @@ GO(BN_zero, vFp) //GO(CAST_ofb64_encrypt, //GO(CAST_set_key, //GO(CERTIFICATEPOLICIES_free, +GO(CERTIFICATEPOLICIES_it, pFv) //GO(CERTIFICATEPOLICIES_new, //GO(check_defer, //GO(CMAC_CTX_cleanup, @@ -798,6 +802,7 @@ GO(CONF_modules_unload, vFi) //GO(CONF_set_nconf, GO(COMP_get_type, iFp) GO(CRL_DIST_POINTS_free, vFp) +GO(CRL_DIST_POINTS_it, pFv) GO(CRL_DIST_POINTS_new, pFv) //GO(CRYPTO_128_unwrap, //GO(CRYPTO_128_wrap, @@ -1152,7 +1157,7 @@ GO(DES_string_to_2keys, vFppp) GO(DES_string_to_key, vFpp) GO(DES_xcbc_encrypt, vFpplppppi) GO(DH_bits, iFp) -//GO(DH_check, +GO(DH_check, iFpp) //GO(DH_check_pub_key, //GO(DH_compute_key, //GO(DH_compute_key_padded, @@ -1160,6 +1165,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, @@ -2039,6 +2045,7 @@ GO(EVP_PKEY_get1_RSA, pFp) //GO(EVP_PKEY_get_attr_by_OBJ, //GO(EVP_PKEY_get_attr_count, GO(EVP_PKEY_get_base_id, iFp) +GO(EVP_PKEY_get_bits, iFp) GO(EVP_PKEY_get_default_digest_nid, iFpp) GO(EVP_PKEY_get_raw_private_key, iFppp) GO(EVP_PKEY_get_raw_public_key, iFppp) @@ -2071,6 +2078,7 @@ GO(EVP_PKEY_meth_new, pFii) 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, iFppip) @@ -2127,6 +2135,7 @@ GO(EVP_VerifyInit_ex, iFppp) GO(EVP_VerifyUpdate, iFppu) GO(EVP_whirlpool, pFv) GO(EXTENDED_KEY_USAGE_free, vFp) +GO(EXTENDED_KEY_USAGE_it, pFv) //GO(EXTENDED_KEY_USAGE_new, //GO(fcrypt_body, //GO(_fini, @@ -2150,6 +2159,7 @@ GO(GENERAL_NAME_print, iFpp) //GO(GENERAL_NAME_set0_othername, //GO(GENERAL_NAME_set0_value, GO(GENERAL_NAMES_free, vFp) +GO(GENERAL_NAMES_it, pFv) GO(GENERAL_NAMES_new, pFv) GO(GENERAL_SUBTREE_free, vFp) GO(GENERAL_SUBTREE_new, pFv) @@ -2398,9 +2408,9 @@ GO(i2d_X509_VAL, iFpp) //GO(i2s_ASN1_INTEGER, //GO(i2s_ASN1_OCTET_STRING, GO(i2t_ASN1_OBJECT, iFpip) -//GO(i2v_ASN1_BIT_STRING, -//GO(i2v_GENERAL_NAME, -//GO(i2v_GENERAL_NAMES, +GO(i2v_ASN1_BIT_STRING, pFppp) +GO(i2v_GENERAL_NAME, pFppp) +GO(i2v_GENERAL_NAMES, pFppp) //GO(idea_cbc_encrypt, //GO(idea_cfb64_encrypt, //GO(idea_ecb_encrypt, @@ -2412,6 +2422,7 @@ GO(i2t_ASN1_OBJECT, iFpip) //GO(_init, //GO(int_rsa_verify, //GO(ISSUING_DIST_POINT_free, +GO(ISSUING_DIST_POINT_it, pFv) //GO(ISSUING_DIST_POINT_new, //GO(KRB5_APREQBODY_free, //GO(KRB5_APREQBODY_new, @@ -2541,7 +2552,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, @@ -2552,8 +2563,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) @@ -2564,14 +2575,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, @@ -2620,20 +2631,21 @@ 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_resp_get0_certs, pFp) //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_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, iFp) //GO(OCSP_response_status_str, //GO(OCSP_REVOKEDINFO_free, //GO(OCSP_REVOKEDINFO_new, @@ -2645,11 +2657,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, @@ -2763,7 +2776,7 @@ GO(OSSL_PROVIDER_try_load, pFppi) //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) @@ -2775,8 +2788,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, @@ -2834,8 +2847,9 @@ 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) +GOM(PEM_write_bio_PrivateKey_traditional, 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, @@ -3025,6 +3039,7 @@ GO(PKCS8_PRIV_KEY_INFO_new, pFv) //GO(policy_data_free, //GO(policy_data_new, //GO(POLICYINFO_free, +GO(POLICYINFO_it, pFv) //GO(POLICYINFO_new, //GO(POLICY_MAPPING_free, //GO(POLICY_MAPPING_new, @@ -3811,6 +3826,7 @@ GO(X509_STORE_get0_objects, pFp) //GO(X509_STORE_get1_certs, //GO(X509_STORE_get1_crls, //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) @@ -3818,12 +3834,13 @@ GO(X509_STORE_load_store, iFpp) GO(X509_STORE_new, pFv) //GO(X509_STORE_set1_param, //GO(X509_STORE_set_default_paths, +GO(X509_STORE_set_ex_data, iFpip) GO(X509_STORE_set_depth, iFpi) 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) @@ -3851,7 +3868,7 @@ GO(X509V3_add1_i2d, iFpipiL) //GO(X509V3_add_value_bool_nf, //GO(X509V3_add_value_int, //GO(X509V3_add_value_uchar, -//GO(X509V3_conf_free, +GO(X509V3_conf_free, vFp) //GO(X509v3_delete_ext, //GO(X509V3_EXT_add, //GO(X509V3_EXT_add_alias, @@ -3867,7 +3884,7 @@ GO(X509V3_add1_i2d, iFpipiL) GO(X509V3_EXT_d2i, pFp) //GO(X509V3_extensions_print, //GO(X509V3_EXT_free, -GO(X509V3_EXT_get, pFp) +GOM(X509V3_EXT_get, pFEp) //GO(X509V3_EXT_get_nid, GO(X509V3_EXT_i2d, pFiip) //GO(X509V3_EXT_nconf, diff --git a/src/wrapped/wrappedlibssl3.c b/src/wrapped/wrappedlibssl3.c index 15a4fd4f..658fd2fd 100644 --- a/src/wrapped/wrappedlibssl3.c +++ b/src/wrapped/wrappedlibssl3.c @@ -34,10 +34,10 @@ GO(4) // pem_passwd_cb #define GO(A) \ -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) \ +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)RunFunctionFmt(my3_pem_passwd_cb_fct_##A, "piip", buf, size, rwflag, password); \ + return (int)RunFunctionFmt(my3_pem_passwd_cb_fct_##A, "piip", buf, size, rwflag, password); \ } SUPER() #undef GO @@ -68,10 +68,10 @@ static void* reverse_pem_passwd_cb_Fct(void* fct) // anonymous #define GO(A) \ -static uintptr_t my3_anonymous_fct_##A = 0; \ -static void* my3_anonymous_##A(void* a, void* b, void* c, void *d) \ +static uintptr_t my3_anonymous_fct_##A = 0; \ +static void* my3_anonymous_##A(void* a, void* b, void* c, void *d) \ { \ - return (void*)RunFunctionFmt(my3_anonymous_fct_##A, "pppp", a, b, c, d); \ + return (void*)RunFunctionFmt(my3_anonymous_fct_##A, "pppp", a, b, c, d); \ } SUPER() #undef GO @@ -93,10 +93,10 @@ static void* find_anonymous_Fct(void* fct) // verify #define GO(A) \ -static uintptr_t my3_verify_fct_##A = 0; \ -static int my3_verify_##A(int a, void* b) \ -{ \ - return (int)RunFunctionFmt(my3_verify_fct_##A, "ip", a, b); \ +static uintptr_t my3_verify_fct_##A = 0; \ +static int my3_verify_##A(int a, void* b) \ +{ \ + return (int)RunFunctionFmt(my3_verify_fct_##A, "ip", a, b); \ } SUPER() #undef GO @@ -129,8 +129,8 @@ static void* reverse_verify_Fct(void* fct) #define GO(A) \ 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) \ -{ \ - RunFunctionFmt(my3_ex_new_fct_##A, "pppilp", parent, ptr, ad, idx, argl, argp); \ +{ \ + RunFunctionFmt(my3_ex_new_fct_##A, "pppilp", parent, ptr, ad, idx, argl, argp); \ } SUPER() #undef GO @@ -151,10 +151,10 @@ static void* find_ex_new_Fct(void* fct) // ex_free #define GO(A) \ -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) \ +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) \ { \ - RunFunctionFmt(my3_ex_free_fct_##A, "pppilp", parent, ptr, ad, idx, argl, argp); \ + RunFunctionFmt(my3_ex_free_fct_##A, "pppilp", parent, ptr, ad, idx, argl, argp); \ } SUPER() #undef GO @@ -175,10 +175,10 @@ static void* find_ex_free_Fct(void* fct) // ex_dup #define GO(A) \ -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) \ +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) RunFunctionFmt(my3_ex_dup_fct_##A, "pppilp", 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 @@ -199,10 +199,10 @@ static void* find_ex_dup_Fct(void* fct) // client_cb #define GO(A) \ -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) \ +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 RunFunctionFmt(my3_client_cb_fct_##A, "pppupu", 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 @@ -223,10 +223,10 @@ static void* find_client_cb_Fct(void* fct) // proto_select #define GO(A) \ -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) \ +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)RunFunctionFmt(my3_proto_select_fct_##A, "ppppup", s, out, outlen, in, inlen, arg); \ + return (int)RunFunctionFmt(my3_proto_select_fct_##A, "ppppup", s, out, outlen, in, inlen, arg); \ } SUPER() #undef GO @@ -247,9 +247,9 @@ static void* find_proto_select_Fct(void* fct) // client_cert #define GO(A) \ -static uintptr_t my3_client_cert_fct_##A = 0; \ -static int my3_client_cert_##A(void* a, void* b, void* c) \ -{ \ +static uintptr_t my3_client_cert_fct_##A = 0; \ +static int my3_client_cert_##A(void* a, void* b, void* c) \ +{ \ return (int)RunFunctionFmt(my3_client_cert_fct_##A, "ppp", a, b, c); \ } SUPER() @@ -274,7 +274,7 @@ static void* find_client_cert_Fct(void* fct) 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); \ + return (int)RunFunctionFmt(my3_alpn_select_cb_fct_##A, "ppppup", a, b, c, d, e, f); \ } SUPER() #undef GO @@ -476,6 +476,98 @@ static void* find_psk_server_cb_Fct(void* fct) printf_log(LOG_NONE, "Warning, no more slot for ssl3 psk_server_cb callback\n"); return NULL; } +// read_write +#define GO(A) \ +static uintptr_t my_read_write_fct_##A = 0; \ +static int my_read_write_##A(void* a, void* b, int c) \ +{ \ + return (int)RunFunctionFmt(my_read_write_fct_##A, "ppi", a, b, c); \ +} +SUPER() +#undef GO +static void* find_read_write_Fct(void* fct) +{ + if(!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my_read_write_fct_##A == (uintptr_t)fct) return my_read_write_##A; + SUPER() + #undef GO + #define GO(A) if(my_read_write_fct_##A == 0) {my_read_write_fct_##A = (uintptr_t)fct; return my_read_write_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for ssl3 read_write callback\n"); + return NULL; +} +// puts +#define GO(A) \ +static uintptr_t my_puts_fct_##A = 0; \ +static int my_puts_##A(void* a, void* b) \ +{ \ + return (int)RunFunctionFmt(my_puts_fct_##A, "pp", a, b); \ +} +SUPER() +#undef GO +static void* find_puts_Fct(void* fct) +{ + if(!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my_puts_fct_##A == (uintptr_t)fct) return my_puts_##A; + SUPER() + #undef GO + #define GO(A) if(my_puts_fct_##A == 0) {my_puts_fct_##A = (uintptr_t)fct; return my_puts_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for ssl3 puts callback\n"); + return NULL; +} +// ctrl +#define GO(A) \ +static uintptr_t my_ctrl_fct_##A = 0; \ +static long my_ctrl_##A(void* a, int b, long c, void* d) \ +{ \ + return (long)RunFunctionFmt(my_ctrl_fct_##A, "pilp", a, b, c, d); \ +} +SUPER() +#undef GO +static void* find_ctrl_Fct(void* fct) +{ + if(!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my_ctrl_fct_##A == (uintptr_t)fct) return my_ctrl_##A; + SUPER() + #undef GO + #define GO(A) if(my_ctrl_fct_##A == 0) {my_ctrl_fct_##A = (uintptr_t)fct; return my_ctrl_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for ssl3 ctrl callback\n"); + return NULL; +} +// create_destroy +#define GO(A) \ +static uintptr_t my_create_destroy_fct_##A = 0; \ +static int my_create_destroy_##A(void* a) \ +{ \ + return (int)RunFunctionFmt(my_create_destroy_fct_##A, "p", a); \ +} +SUPER() +#undef GO +static void* find_create_destroy_Fct(void* fct) +{ + if(!fct) return NULL; + void* p; + if((p = GetNativeFnc((uintptr_t)fct))) return p; + #define GO(A) if(my_create_destroy_fct_##A == (uintptr_t)fct) return my_create_destroy_##A; + SUPER() + #undef GO + #define GO(A) if(my_create_destroy_fct_##A == 0) {my_create_destroy_fct_##A = (uintptr_t)fct; return my_create_destroy_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for ssl3 create_destroy callback\n"); + return NULL; +} #undef SUPER @@ -605,6 +697,36 @@ EXPORT void my3_SSL_set_psk_server_callback(x64emu_t* emu, void* ctx, void* f) my->SSL_set_psk_server_callback(ctx, find_psk_server_cb_Fct(f)); } +EXPORT int my3_BIO_meth_set_write(x64emu_t* emu, void* biom, void* f) +{ + return my->BIO_meth_set_write(biom, find_read_write_Fct(f)); +} + +EXPORT int my3_BIO_meth_set_read(x64emu_t* emu, void* biom, void* f) +{ + return my->BIO_meth_set_read(biom, find_read_write_Fct(f)); +} + +EXPORT int my3_BIO_meth_set_puts(x64emu_t* emu, void* biom, void* f) +{ + return my->BIO_meth_set_puts(biom, find_puts_Fct(f)); +} + +EXPORT int my3_BIO_meth_set_ctrl(x64emu_t* emu, void* biom, void* f) +{ + return my->BIO_meth_set_ctrl(biom, find_ctrl_Fct(f)); +} + +EXPORT int my3_BIO_meth_set_create(x64emu_t* emu, void* biom, void* f) +{ + return my->BIO_meth_set_create(biom, find_create_destroy_Fct(f)); +} + +EXPORT int my3_BIO_meth_set_destroy(x64emu_t* emu, void* biom, void* f) +{ + return my->BIO_meth_set_destroy(biom, find_create_destroy_Fct(f)); +} + #define ALTMY my3_ #define NEEDED_LIBS "libcrypto.so.3", "libpthread.so.0" diff --git a/src/wrapped/wrappedlibssl3_private.h b/src/wrapped/wrappedlibssl3_private.h index 97fcf0f0..11d9b09f 100644 --- a/src/wrapped/wrappedlibssl3_private.h +++ b/src/wrapped/wrappedlibssl3_private.h @@ -3,9 +3,24 @@ #endif GO(BIO_f_ssl, pFv) +GO(BIO_ADDR_free, vFp) +GO(BIO_ADDR_new, pFv) +GO(BIO_get_data, pFp) +GO(BIO_get_shutdown, iFp) GO(BIO_new_buffer_ssl_connect, pFp) GO(BIO_new_ssl, pFpi) GO(BIO_new_ssl_connect, pFp) +GO(BIO_meth_free, vFp) +GO(BIO_meth_new, pFip) +GOM(BIO_meth_set_create, iFEpp) +GOM(BIO_meth_set_ctrl, iFEpp) +GOM(BIO_meth_set_destroy, iFEpp) +GOM(BIO_meth_set_puts, iFEpp) +GOM(BIO_meth_set_read, iFEpp) +GOM(BIO_meth_set_write, iFEpp) +GO(BIO_set_data, vFpp) +GO(BIO_set_init, vFpi) +GO(BIO_set_shutdown, vFpi) GO(BIO_ssl_copy_session_id, iFpp) GO(BIO_ssl_shutdown, vFp) //GO(custom_ext_add, @@ -63,6 +78,7 @@ 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, iFv) @@ -393,6 +409,7 @@ GO(SSL_get_ciphers, pFp) //GO(ssl_get_ciphers_by_id, GO(SSL_get_client_CA_list, pFp) GO(SSL_get_client_ciphers, pFp) +GO(SSL_get_client_random, LFppL) GO(SSL_get_current_cipher, pFp) GO(SSL_get_current_compression, pFp) GO(SSL_get_current_expansion, pFp) @@ -481,10 +498,12 @@ GO(SSL_SESSION_get_compress_id, uFp) GO(SSL_SESSION_get_ex_data, pFpi) //GO(SSL_SESSION_get_ex_new_index, GO(SSL_SESSION_get_id, pFpp) +GO(SSL_SESSION_get_master_key, LFppL) GO(SSL_SESSION_get_ticket_lifetime_hint, LFp) GO(SSL_SESSION_get_time, lFp) GO(SSL_SESSION_get_timeout, lFp) GO(SSL_SESSION_has_ticket, iFp) +GO(SSL_SESSION_is_resumable, iFp) GO(SSL_SESSION_new, pFv) GO(SSL_SESSION_print, iFpp) GO(SSL_SESSION_print_fp, iFSp) |