//
// BN_BLINDING_update from 0xe15418 to 0xe15564 (332 bytes)
//
// 2 xrefs:
// > BN_BLINDING_convert_ex @ 0xe155a8
// > ??> @ 0x48528
//
// 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
//
__int64 __fastcall BN_BLINDING_update(__int64 *a1, __int64 a2)
{
__int64 v2; // x5
int v5; // w2
int v6; // w2
__int64 result; // x0
__int64 v8; // x1
__int64 v9; // x2
int v10; // w1
int v11; // w0
v2 = *a1;
if ( !*a1 || !a1[1] )
{
ERR_put_error(3, 103, 107, (__int64)"crypto/bn/bn_blind.c", 99);
result = 0;
if ( *((_DWORD *)a1 + 10) == 32 )
goto LABEL_16;
return result;
}
v5 = *((_DWORD *)a1 + 10);
if ( v5 == -1 )
{
v8 = a1[6];
result = 1;
*((_DWORD *)a1 + 10) = 1;
if ( (v8 & 1) != 0 )
return result;
}
else
{
v6 = v5 + 1;
*((_DWORD *)a1 + 10) = v6;
if ( v6 == 32 )
{
v9 = a1[6];
if ( a1[2] && (v9 & 2) == 0 )
{
result = BN_BLINDING_create_param(a1, a1[6] & 2, a1[6] & 2, a2, a1[6] & 2, a1[6] & 2) != nullptr;
v10 = *((_DWORD *)a1 + 10);
goto LABEL_15;
}
if ( (v9 & 1) != 0 )
{
*((_DWORD *)a1 + 10) = 0;
return 1;
}
}
else if ( (a1[6] & 1) != 0 )
{
return 1;
}
}
result = BN_mod_mul(v2, v2, v2, a1[3], a2);
if ( (_DWORD)result )
{
v11 = BN_mod_mul(a1[1], a1[1], a1[1], a1[3], a2);
v10 = *((_DWORD *)a1 + 10);
result = v11 != 0;
}
else
{
v10 = *((_DWORD *)a1 + 10);
}
LABEL_15:
if ( v10 == 32 )
LABEL_16:
*((_DWORD *)a1 + 10) = 0;
return result;
}