// COPY AUDIT: 3 call(s) with a non-literal length. // sub_405084(a1: 0, a2: off_402B28[0], v8, v11) len=v11 // sub_405084(a1: 0, a2: (const char *)dword_402B6C, v8, v11) len=v11 // sub_405084(a1: 0, a2: off_402B70[0], v8, v11) len=v11 // // Guards seen in this function: // if ( v4 >> 28 == 0 ) /*0x4029a4*/ // if ( v6 > 0xFFFFFFFB || v6 + 4 <= v7 ) /*0x4029d2*/ // if ( v9 != 1 ) /*0x4029f2*/ // if ( *(_DWORD *)(v14 + 792) == 3 ) /*0x402a14*/ // if ( sub_4052AC() == 0 ) /*0x402a22*/ // if ( v15 <= *(_DWORD *)(v14 + 840) ) /*0x402a70*/ // // Heuristic lead, not a verdict: a non-literal length may still be bounded elsewhere (HDCP carries bounded ubfx and unbounded ldrb paths in one function). int __fastcall gcp_cmdFE09_ConfigureAuthenticatedSession(struct gcp_ctx *ctx, struct ta_params *params) { unsigned int arg10; // r0 int v5; // r6 unsigned int v6; // r7 unsigned int v7; // r10 unsigned int v8; // r2 int v9; // r8 int v10; // r11 int v11; // r3 const char *v12; // r1 bool v14; // cc char *v15; // r6 unsigned int v16; // r0 unsigned __int8 *v17; // r0 struct gcp_ctx *v18; // [sp+0h] [bp-4h] gcp_log(level: 0, fmt: (const char *)sub_402AF4); arg10 = params->arg10; if ( arg10 >> 28 == 0 ) { v6 = *(_DWORD *)¶ms->data20[2056]; v7 = *(_DWORD *)¶ms->data20[2040]; v8 = *(_DWORD *)¶ms->data20[1012]; v9 = *(_DWORD *)¶ms->data20[2048]; v10 = *(_DWORD *)¶ms->data20[2052]; v11 = *(_DWORD *)¶ms->data20[2060]; if ( v6 > 0xFFFFFFFB || v6 + 4 <= v7 ) { if ( v9 != 1 ) { v15 = (char *)ctx + 80 * HIBYTE(arg10); if ( *((_DWORD *)v15 + 198) == 3 ) { v18 = (struct gcp_ctx *)(v15 + 792); if ( gcp_VerifyOMAC( ctx: (struct gcp_ctx *)(v15 + 792), params: (struct ta_params *)((char *)¶ms->arg10 + 4)) == 0 ) { v16 = *((unsigned __int8 *)¶ms->arg10 + v10 + 4) | (*((unsigned __int8 *)¶ms->arg10 + v10 + 5) << 8) | ((*((unsigned __int8 *)¶ms->arg10 + v10 + 6) | (*((unsigned __int8 *)¶ms->arg10 + v10 + 7) << 8)) << 16); if ( v16 <= *((_DWORD *)v15 + 210) ) { gcp_log(level: 0, fmt: aAmdTaGcpErrorI); v5 = 560; goto LABEL_7; } *((_DWORD *)v15 + 210) = v16; if ( v9 != 2 ) { if ( v9 == 3 ) { v5 = gcp_ConfigureCryptoSession(ctx, params); if ( v5 != 0 ) goto LABEL_7; } else if ( v9 != 4 ) { gcp_log(level: 0, fmt: (const char *)off_402B68); v5 = 561; goto LABEL_7; } } v5 = 0; v17 = ¶ms->data20[v6 + 1016]; *v17 = 0; v17[3] = 0; v17[2] = 0; v17[1] = 0; gcp_lib_db5482d6_100(a1: (int)¶ms->out1950, a2: (int)¶ms->data20[1016], a3: 1024); if ( gcp_GenerateOMAC(ctx: v18, params: (struct ta_params *)¶ms->out1950) == 0 ) { v5 = 0; *(_DWORD *)¶ms[1].data20[984] = v7; } goto LABEL_7; } gcp_log(level: 0, fmt: (const char *)off_402B2C); v5 = 562; } else { gcp_log(level: 0, fmt: (const char *)off_402B28); v5 = 610; } LABEL_7: gcp_log(level: 0, fmt: (const char *)off_402B74); return v5; } v14 = v11 + 4 > v8; if ( v11 + 4 <= v8 ) v14 = *(_DWORD *)¶ms->data20[2064] + 4 > v8; if ( !v14 ) { v5 = gcp_ConfigureInitialize(ctx, params); goto LABEL_7; } v12 = (const char *)dword_402B6C; } else { v12 = (const char *)off_402B70; } gcp_log(level: 0, fmt: v12); v5 = 256; goto LABEL_7; } return 256; }