//
// ssl3_cbc_copy_mac from 0x9a08fc to 0x9a0a74 (376 bytes)
//
// 3 xrefs:
// > ssl3_get_record @ 0x9a12c4
// > dtls1_process_record @ 0x9a17e0
// > ??> @ 0x7459c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:06:48 +0000
//
void *__fastcall ssl3_cbc_copy_mac(_BYTE *a1, _DWORD *a2, size_t a3)
{
unsigned int v3; // r11
int v4; // r9
size_t v7; // r10
unsigned int v8; // r4
_BYTE *v9; // r6
unsigned int v10; // r7
void *result; // r0
int v12; // r1
unsigned __int8 *v13; // r12
int v14; // lr
int v15; // t1
_BYTE *v16; // r8
_BYTE v18[132]; // [sp+8h] [bp-84h] BYREF
v3 = a2[3];
v4 = a2[2];
v7 = v4 - a3;
if ( a3 > v3 )
OPENSSL_die("assertion failed: rec->orig_len >= md_size", "ssl/record/ssl3_record.c", 1223);
if ( a3 > 0x40 )
OPENSSL_die("assertion failed: md_size <= EVP_MAX_MD_SIZE", "ssl/record/ssl3_record.c", 1224);
if ( v3 <= a3 + 256 )
v8 = 0;
else
v8 = v3 - 256 - a3;
v9 = &v18[-(int)v18 & 0x3F];
v10 = (v7 + (a3 >> 1 << 24) - v8) % a3;
result = memset(v9, 0, a3);
if ( v8 < v3 )
{
v12 = 0;
v13 = (unsigned __int8 *)(a2[5] + v8);
do
{
v15 = *v13++;
v14 = v15;
if ( ((((v8 - v7) ^ v7 | v8 ^ v7) ^ v8) & 0x80000000) != 0 )
v14 = 0;
result = (void *)(v14 & ((int)(((v8 - v4) ^ v4 | v8 ^ v4) ^ v8) >> 31) | (unsigned __int8)v9[v12]);
++v8;
v9[v12] = (_BYTE)result;
v12 = (v12 + 1) & ((int)(((v12 + 1 - a3) ^ a3 | (v12 + 1) ^ a3) ^ (v12 + 1)) >> 31);
}
while ( v8 != v3 );
}
if ( a3 )
{
v16 = a1;
do
{
result = (void *)(unsigned __int8)v9[v10];
*v16++ = (_BYTE)result;
v10 = (v10 + 1) & ((int)(((v10 + 1 - a3) ^ a3 | (v10 + 1) ^ a3) ^ (v10 + 1)) >> 31);
}
while ( v16 != &a1[a3] );
}
return result;
}