//
// ssl3_digest_cached_records from 0x7b89ac to 0x7b8af0 (324 bytes)
//
// 11 xrefs:
// > tls_construct_client_verify @ 0x7a2d9c
// > tls_prepare_client_certificate @ 0x7a4604
// > tls_post_process_client_hello @ 0x7a9be8
// > tls_construct_server_done @ 0x7a9f88
// > tls_post_process_client_key_exchange @ 0x7abce4
// > tls_post_process_client_key_exchange @ 0x7abd04
// > tls_process_client_certificate @ 0x7ac514
// > ssl3_final_finish_mac @ 0x7b8b24
// > tls1_final_finish_mac @ 0x7baad0
// > tls1_generate_master_secret @ 0x7bae64
// > ??> @ 0x5d16c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int __fastcall ssl3_digest_cached_records(int a1, int a2)
{
int v2; // r3
int v6; // r0
int v7; // r8
int v8; // r7
int v9; // r0
int v10; // r3
int v11; // r1
int v12; // [sp+Ch] [bp-4h] BYREF
v2 = *(_DWORD *)(a1 + 104);
if ( !*(_DWORD *)(v2 + 216) )
{
v6 = BIO_ctrl(*(_DWORD *)(v2 + 212), 3, 0, &v12);
v7 = v6;
if ( v6 <= 0 )
{
ERR_put_error(20, 293, 332, "ssl/s3_enc.c", 378);
return 0;
}
v8 = *(_DWORD *)(a1 + 104);
v9 = EVP_MD_CTX_new(v6);
v10 = *(_DWORD *)(a1 + 104);
*(_DWORD *)(v8 + 216) = v9;
if ( !*(_DWORD *)(v10 + 216) )
{
ERR_put_error(20, 293, 65, "ssl/s3_enc.c", 384);
return 0;
}
v11 = ssl_handshake_md(a1);
if ( !v11
|| !EVP_DigestInit_ex(*(_DWORD *)(*(_DWORD *)(a1 + 104) + 216), v11, 0)
|| !EVP_DigestUpdate(*(_DWORD *)(*(_DWORD *)(a1 + 104) + 216), v12, v7) )
{
ERR_put_error(20, 293, 68, "ssl/s3_enc.c", 391);
return 0;
}
}
if ( !a2 )
{
BIO_free(*(_DWORD *)(*(_DWORD *)(a1 + 104) + 212));
*(_DWORD *)(*(_DWORD *)(a1 + 104) + 212) = 0;
}
return 1;
}