//
// BIO_lookup from 0xd72280 to 0xd724b4 (564 bytes)
//
// 7 xrefs:
// > BIO_get_host_ip @ 0xd74c18
// > BIO_get_port @ 0xd74d30
// > BIO_get_accept_socket @ 0xd74e94
// > sub_D773BC @ 0xd7749c
// > sub_D77C14 @ 0xd77d34
// > sub_D780A0 @ 0xd781c0
// > ??> @ 0x744d8
//
// 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 BIO_lookup(char *a1, const char *a2, int a3, int a4, int a5, struct addrinfo **a6)
{
bool v10; // zf
__int64 result; // x0
size_t v12; // x24
struct addrinfo *v13; // x0
_WORD *v14; // x0
struct addrinfo *v15; // x19
struct sockaddr *v16; // x0
int v17; // w0
int v18; // w19
unsigned int *v19; // x0
const char *v20; // x0
__int64 v21; // x2
struct addrinfo v24; // [xsp+50h] [xbp+50h] BYREF
if ( a4 < 0 )
goto LABEL_14;
if ( a4 > 2 )
{
if ( a4 == 10 )
goto LABEL_4;
LABEL_14:
ERR_put_error(32, 135, 131, "crypto/bio/b_addr.c", 649);
return 0;
}
if ( a4 != 1 )
{
LABEL_4:
v10 = (unsigned int)BIO_sock_init() == 1;
result = 0;
if ( v10 )
{
memset(&v24.ai_protocol, 0, 36);
v24.ai_family = a4;
v24.ai_socktype = a5;
v24.ai_flags = a3 == 1;
v17 = getaddrinfo(a1, a2, &v24, a6);
v18 = v17;
if ( v17 )
{
if ( v17 == 11 )
{
v19 = (unsigned int *)__errno();
ERR_put_error(2, 12, *v19, "crypto/bio/b_addr.c", 684);
ERR_put_error(32, 135, 2, "crypto/bio/b_addr.c", 685);
}
else
{
ERR_put_error(32, 135, 2, "crypto/bio/b_addr.c", 692);
v20 = gai_strerror(v18);
ERR_add_error_data(1, v20, v21);
}
return 0;
}
else
{
return 1;
}
}
return result;
}
v12 = strlen(a1);
if ( !a6 )
OPENSSL_die((int)"assertion failed: bai != NULL");
v13 = (struct addrinfo *)CRYPTO_zalloc(48, "crypto/bio/b_addr.c", 570);
*a6 = v13;
if ( !v13 )
{
LABEL_13:
ERR_put_error(32, 135, 65, "crypto/bio/b_addr.c", 658);
return 0;
}
v13->ai_socktype = a5;
v13->ai_family = 1;
v13->ai_protocol = 0;
v14 = BIO_ADDR_new();
if ( v14 )
{
BIO_ADDR_rawmake((__int64)v14, 1, a1, v12, 0);
v15 = *a6;
BIO_ADDR_sockaddr_noconst();
v15->ai_addr = v16;
}
result = 1;
(*a6)->ai_next = nullptr;
if ( !(*a6)->ai_addr )
{
BIO_ADDRINFO_free(*a6);
*a6 = nullptr;
goto LABEL_13;
}
return result;
}