//
// BN_BLINDING_update from 0xa808dc to 0xa80a2c (336 bytes)
//
// 2 xrefs:
// > BN_BLINDING_convert_ex @ 0xa80a7c
// > ??> @ 0x8374c
//
// 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:08:49 +0000
//
int __fastcall BN_BLINDING_update(int *a1, int a2)
{
int v2; // r12
int v4; // r2
int v6; // r2
int result; // r0
int v8; // r3
int v9; // r3
int v10; // r3
int v11; // r0
int *param; // r0
v2 = *a1;
if ( !*a1 || !a1[1] )
{
ERR_put_error(3, 103, 107, (int)"crypto/bn/bn_blind.c", 99);
v10 = a1[5];
result = 0;
goto LABEL_15;
}
v4 = a1[5];
if ( v4 == -1 )
{
v8 = a1[6];
result = 1;
a1[5] = 1;
if ( (v8 & 1) != 0 )
return result;
}
else
{
v6 = v4 + 1;
a1[5] = v6;
if ( v6 == 32 )
{
v9 = a1[6];
if ( a1[2] && (v9 & 2) == 0 )
{
param = BN_BLINDING_create_param(a1, 0, 0, a2, 0, 0);
v10 = a1[5];
result = param != nullptr;
goto LABEL_15;
}
if ( (v9 & 1) != 0 )
{
result = 1;
LABEL_16:
a1[5] = 0;
return result;
}
}
else if ( (a1[6] & 1) != 0 )
{
return 1;
}
}
result = BN_mod_mul(v2, v2, v2, a1[3], a2);
if ( result )
{
v11 = BN_mod_mul(a1[1], a1[1], a1[1], a1[3], a2);
v10 = a1[5];
result = v11 != 0;
}
else
{
v10 = a1[5];
}
LABEL_15:
if ( v10 == 32 )
goto LABEL_16;
return result;
}