//
// sub_101A074 from 0x101a074 to 0x101a26c (504 bytes)
//
// 1 xrefs:
// > ??> @ 0x14008f0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:16:07 +0000
//
__int64 __fastcall sub_101A074(__int64 a1, __int64 a2)
{
__int64 v4; // x0
unsigned int *v5; // x20
_QWORD *v6; // x3
int v7; // w19
char *v8; // x23
__int64 v9; // x21
_QWORD *v10; // x0
__int64 v11; // x3
unsigned int v12; // w19
__int64 v13; // x3
int v14; // [xsp+48h] [xbp+48h] BYREF
int v15; // [xsp+4Ch] [xbp+4Ch] BYREF
char *v16; // [xsp+50h] [xbp+50h] BYREF
_QWORD *v17; // [xsp+58h] [xbp+58h] BYREF
if ( !(unsigned int)PKCS8_pkey_get0(nullptr, (__int64 *)&v16, &v14, &v17, a2) )
return 0;
v4 = d2i_ASN1_OCTET_STRING(nullptr, &v16, v14);
v5 = (unsigned int *)v4;
if ( v4 )
{
v16 = (char *)ASN1_STRING_get0_data(v4);
v14 = ASN1_STRING_length(v5);
v6 = v17;
v7 = v14;
v8 = v16;
if ( !v17 )
{
LABEL_6:
if ( v7 == 32 && v8 )
{
v9 = CRYPTO_zalloc(40, "crypto/ec/ecx_meth.c", 58);
if ( v9 )
{
v10 = (_QWORD *)CRYPTO_secure_malloc(32, "crypto/ec/ecx_meth.c", 67);
*(_QWORD *)(v9 + 32) = v10;
if ( v10 )
{
v11 = *((_QWORD *)v8 + 1);
*v10 = *(_QWORD *)v8;
v10[1] = v11;
v12 = 1;
v13 = *((_QWORD *)v8 + 3);
v10[2] = *((_QWORD *)v8 + 2);
v10[3] = v13;
X25519_public_from_private(v9, *(_QWORD *)(v9 + 32));
EVP_PKEY_assign(a1, 1034, v9);
}
else
{
v12 = 0;
ERR_put_error(16, 266, 65, "crypto/ec/ecx_meth.c", 69);
CRYPTO_free(v9, "crypto/ec/ecx_meth.c", 70);
}
}
else
{
v12 = 0;
ERR_put_error(16, 266, 65, "crypto/ec/ecx_meth.c", 60);
}
goto LABEL_11;
}
goto LABEL_15;
}
}
else
{
v6 = v17;
v16 = nullptr;
v14 = 0;
if ( !v17 )
{
LABEL_15:
v12 = 0;
ERR_put_error(16, 266, 102, "crypto/ec/ecx_meth.c", 53);
goto LABEL_11;
}
v7 = 0;
v8 = nullptr;
}
X509_ALGOR_get0(0, &v15, nullptr, v6);
if ( v15 == -1 )
goto LABEL_6;
v12 = 0;
ERR_put_error(16, 266, 102, "crypto/ec/ecx_meth.c", 47);
LABEL_11:
ASN1_OCTET_STRING_free((__int64)v5);
return v12;
}