//
// -[NSData makeCryptedVersionWithKeyData:ofLength:decrypt:] from 0x100251380 to 0x100251560 (480 bytes)
//
// 1 xrefs:
// > ??> @ 0x100846548
//
// 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
//
id __cdecl -[NSData makeCryptedVersionWithKeyData:ofLength:decrypt:](
NSData *self,
SEL a2,
const void *a3,
int a4,
bool a5)
{
CCOperation v5; // w19
int v7; // w8
char *dataOutAvailable; // x22
void *dataOut; // x20
CCCryptorStatus v10; // w0
__CFString *v11; // x0
const char *v13; // x8
size_t v14; // [xsp+18h] [xbp-68h] BYREF
_OWORD key[2]; // [xsp+20h] [xbp-60h] BYREF
v5 = a5;
memset(key, 0, sizeof(key));
if ( a4 >= 32 )
v7 = 32;
else
v7 = a4;
__memcpy_chk(key, a3, v7, 32);
dataOutAvailable = (char *)-[NSData length](self, "length") + 16;
dataOut = malloc((size_t)dataOutAvailable);
v10 = CCCrypt(
v5,
0,
3u,
key,
0x20u,
nullptr,
-[NSData bytes](self, "bytes"),
-[NSData length](self, "length"),
dataOut,
(size_t)dataOutAvailable,
&v14);
if ( v10 <= -4303 )
{
switch ( v10 )
{
case -4305:
v11 = CFSTR("Error: NSData: Could not %s data: Unimplemented");
goto LABEL_20;
case -4304:
v11 = CFSTR("Error: NSData: Could not %s data: Decode error");
goto LABEL_20;
case -4303:
v11 = CFSTR("Error: NSData: Could not %s data: Alignment error");
goto LABEL_20;
}
LABEL_16:
v11 = CFSTR("Error: NSData: Could not %s data: Unknown error");
goto LABEL_20;
}
if ( v10 > -4301 )
{
if ( v10 == -4300 )
{
v11 = CFSTR("Error: NSData: Could not %s data: Param error");
goto LABEL_20;
}
if ( !v10 )
return +[NSData dataWithBytesNoCopy:length:](&OBJC_CLASS___NSData, "dataWithBytesNoCopy:length:", dataOut, v14);
goto LABEL_16;
}
if ( v10 == -4302 )
v11 = CFSTR("Error: NSData: Could not %s data: Memory failure");
else
v11 = CFSTR("Error: NSData: Could not %s data: Buffer too small");
LABEL_20:
v13 = "encrypt";
if ( v5 )
v13 = "decrypt";
NSLog(&v11->isa, v13);
free(dataOut);
return nullptr;
}