Compare commits
1 Commits
cleanup/ip
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f650abe6ff |
@@ -53,7 +53,7 @@ Progress
|
||||
<!-- progress:start -->
|
||||
| Decompiled | Matched | Linked | Data |
|
||||
|:---:|:---:|:---:|:---:|
|
||||
| 97.04% | 83.51% | 58.20% | 89.93% |
|
||||
| 97.14% | 83.51% | 58.20% | 89.94% |
|
||||
|
||||
units 778/1027 complete, functions 12020/12563 matched.
|
||||
|
||||
|
||||
@@ -388,8 +388,8 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
u64 tickRemainder;
|
||||
AOSSReceiveBuffer* packetBuffer;
|
||||
AOSSPacketHeader* packetWords;
|
||||
s16 initialSleep;
|
||||
s16 nextSleep;
|
||||
u16 initialSleep;
|
||||
u16 nextSleep;
|
||||
u8 errorStatus;
|
||||
u32 resultCode;
|
||||
int state;
|
||||
@@ -404,7 +404,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
u64 timeoutTicks;
|
||||
int initializationResult = 0;
|
||||
short attemptCount;
|
||||
s16 remainingWait;
|
||||
int remainingWait;
|
||||
short waitAttempt;
|
||||
int receivedPackets;
|
||||
AOSSWaitSettings waitSettings;
|
||||
@@ -412,7 +412,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
AOSSRequestRecords requestRecords;
|
||||
struct {
|
||||
s16 connection;
|
||||
s16 response;
|
||||
u16 response;
|
||||
} waitIntervals;
|
||||
AOSSSocketAddress replyAddress;
|
||||
u8 messageIdentity[8];
|
||||
@@ -440,7 +440,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
initialWait = 10;
|
||||
}
|
||||
waitIntervals.response = input->options[1];
|
||||
if (waitIntervals.response == -1) {
|
||||
if (waitIntervals.response == 0xffff) {
|
||||
waitIntervals.response = 100;
|
||||
}
|
||||
waitSettings.halfwords.low = input->options[3];
|
||||
@@ -449,7 +449,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
}
|
||||
waitSettings.halfwords.high = initialWait;
|
||||
timeoutMilliseconds = (int)(short)input->options[4];
|
||||
if (input->options[4] == 0xffff) {
|
||||
if (input->options[4] == -1) {
|
||||
timeoutMilliseconds = 2000;
|
||||
}
|
||||
memset(&s_accessPointName,0,8);
|
||||
@@ -462,7 +462,19 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
s_runtime.state = 0;
|
||||
s_runtime.ipAddress = 0xc0a80b01;
|
||||
s_runtime.active = '\0';
|
||||
if ((input->flags & 1) == 1) {
|
||||
if ((input->flags & 1) != 1) {
|
||||
s_errorCode = 0x13;
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
} else {
|
||||
attemptCount = 0;
|
||||
initialWait = waitIntervals.connection;
|
||||
if (s_operationState != 0) {
|
||||
@@ -615,20 +627,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
}
|
||||
else {
|
||||
s_errorCode = 0x13;
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
}
|
||||
goto finish_initialization;
|
||||
wait_for_initial_link:
|
||||
if ((short)initialWait <= (short)remainingWait) goto handle_initial_link;
|
||||
@@ -687,6 +686,385 @@ wait_for_initial_link:
|
||||
}
|
||||
remainingWait = remainingWait + 1;
|
||||
goto wait_for_initial_link;
|
||||
handle_initial_link:
|
||||
if (remainingWait == waitIntervals.connection) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
}
|
||||
else {
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
requestResult = 0;
|
||||
state = 0;
|
||||
do {
|
||||
memcpy(requestRecords.bytes + state,input->optionData,6);
|
||||
retryWait = rand();
|
||||
requestRecords.records[requestResult].transactionId = (short)retryWait;
|
||||
receivedLength = SOHtoNs(retryWait & 0xffff);
|
||||
requestRecords.records[requestResult].transactionId = receivedLength;
|
||||
requestResult = requestResult + 1;
|
||||
state = state + 8;
|
||||
} while (requestResult < 3);
|
||||
s_socket = SOSocket(2,2,0);
|
||||
if (s_socket < 0) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
}
|
||||
else if (initializationResult < 0) {
|
||||
s_errorCode = 0xb;
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
}
|
||||
else {
|
||||
memset(&socketAddress,0,8);
|
||||
socketAddress.family = 2;
|
||||
socketAddress.address = SOGetHostID();
|
||||
socketAddress.port = SOHtoNs(0x5790);
|
||||
socketAddress.length = 8;
|
||||
state = SOBind(s_socket,&socketAddress);
|
||||
if (-1 < state) {
|
||||
attemptCount = waitSettings.halfwords.high;
|
||||
settings.gatewayAddress = 0xc0a80b65;
|
||||
settings.ipAddress = 0xc0a80b01;
|
||||
state = 0;
|
||||
perform_request:
|
||||
packetBuffer = s_responseBuffer;
|
||||
memset(networkAddresses,0,0x14);
|
||||
gatewayAddress = settings.gatewayAddress;
|
||||
networkAddresses[0] = settings.ipAddress;
|
||||
do {
|
||||
if ((state == 1) && (s_runtime.active != '\x01')) {
|
||||
if (s_socket != -1) {
|
||||
SOClose(s_socket);
|
||||
}
|
||||
s_socket = -1;
|
||||
if (s_socketStarted == 1) {
|
||||
s_socketStarted = 0;
|
||||
requestResult = SOCleanup();
|
||||
if (-1 < requestResult) goto request_socket_cleanup_complete;
|
||||
requestResult = -1;
|
||||
}
|
||||
else {
|
||||
request_socket_cleanup_complete:
|
||||
requestResult = 0;
|
||||
}
|
||||
if (requestResult != 0) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
responseSleep = s_runtime.ipAddress & s_runtime.subnetMask;
|
||||
retryWait = responseSleep | (s_runtime.ipAddress & ~s_runtime.subnetMask) + 1;
|
||||
if ((responseSleep | ~s_runtime.subnetMask) <= retryWait) {
|
||||
retryWait = responseSleep | 1;
|
||||
}
|
||||
requestResult = AOSSi_SetNCDIPAddr(retryWait,s_runtime.subnetMask,s_runtime.ipAddress,0,0);
|
||||
if (requestResult != 0) {
|
||||
s_errorCode = 0xc;
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
s_runtime.active = '\x01';
|
||||
s_accessPointConfig = (int *)AOSSi_Alloc(0x58);
|
||||
if (s_accessPointConfig == (int *)0x0) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
memset(s_accessPointConfig,0,0x58);
|
||||
initialWait = waitIntervals.connection;
|
||||
for (waitAttempt = 0; waitAttempt < (short)initialWait; waitAttempt = waitAttempt + 1) {
|
||||
requestResult = AOSS_814020CC(&settings,s_accessPointConfig);
|
||||
if (requestResult == -1) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
remainingWait = waitIntervals.response;
|
||||
if ((requestResult == 0) && (*s_accessPointConfig == 1)) break;
|
||||
for (; remainingWait != 0; remainingWait = remainingWait - initialSleep) {
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
initialSleep = remainingWait;
|
||||
if (100 < remainingWait) {
|
||||
initialSleep = 100;
|
||||
}
|
||||
AOSSi_Sleep(initialSleep);
|
||||
initialSleep = remainingWait;
|
||||
if (100 < remainingWait) {
|
||||
initialSleep = 100;
|
||||
}
|
||||
}
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
}
|
||||
s_socket = SOSocket(2,2,0);
|
||||
if (s_socket < 0) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
memset(&socketAddress,0,8);
|
||||
socketAddress.family = 2;
|
||||
socketAddress.address = SOGetHostID();
|
||||
socketAddress.port = SOHtoNs(0x5790);
|
||||
socketAddress.length = 8;
|
||||
requestResult = SOBind(s_socket,&socketAddress);
|
||||
if (requestResult < 0) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
}
|
||||
requestResult = s_socket;
|
||||
if (state == 1) {
|
||||
if (s_operationState != 3) {
|
||||
s_operationState = 3;
|
||||
AOSSi_Status(3);
|
||||
}
|
||||
requestResult = AOSS_81401778(networkAddresses,&requestRecords,requestResult);
|
||||
}
|
||||
else if (state < 1) {
|
||||
if (state < 0) {
|
||||
invalid_request_state:
|
||||
requestResult = -1;
|
||||
}
|
||||
else {
|
||||
if (s_operationState != 2) {
|
||||
s_operationState = 2;
|
||||
AOSSi_Status(2);
|
||||
}
|
||||
requestResult = AOSS_81401574(networkAddresses,&requestRecords,requestResult);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (2 < state) goto invalid_request_state;
|
||||
if (s_operationState != 5) {
|
||||
s_operationState = 5;
|
||||
AOSSi_Status(5);
|
||||
}
|
||||
packetWords = s_responseBuffer;
|
||||
memset(s_responseBuffer,0,0x5dc);
|
||||
memcpy(messageIdentity,&requestRecords.records[2],8);
|
||||
manufacturerLength = strlen(s_manufacturer);
|
||||
AOSS_81401E80(messageIdentity,8,s_manufacturer,manufacturerLength);
|
||||
receivedLength = SOHtoNs(1);
|
||||
packetWords->initialLength = receivedLength;
|
||||
packetWords->initialType = 0;
|
||||
packetWords->initialSequence = 0;
|
||||
packetWords->responseLength = SOHtoNs(0x3000);
|
||||
packetWords->responseType = 0;
|
||||
packetWords->finalLength = SOHtoNs(0);
|
||||
packetWords->finalSequence = SOHtoNs(0);
|
||||
packetWords->reserved = 0;
|
||||
packetWords->messageType = 0x11;
|
||||
memcpy(packetWords->messageIdentity,messageIdentity,8);
|
||||
memset(&replyAddress,0,8);
|
||||
replyAddress.family = 2;
|
||||
replyAddress.port = SOHtoNs(0x5790);
|
||||
replyAddress.address = SOHtoNl(s_runtime.ipAddress);
|
||||
if (s_runtime.active == '\0') {
|
||||
replyAddress.address = 0xffffffff;
|
||||
}
|
||||
replyAddress.length = 8;
|
||||
SOSendTo(requestResult,packetWords,0x18,0,&replyAddress);
|
||||
requestResult = 0;
|
||||
}
|
||||
if (requestResult == -1) {
|
||||
s_errorCode = state + 0x1000;
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
memset(packetBuffer,0,0x5f8);
|
||||
pollSeconds = timeoutMilliseconds / 1000;
|
||||
pollSubseconds = (timeoutMilliseconds % 1000) * 1000;
|
||||
pollArguments[1] = 1;
|
||||
pollArguments[0] = s_socket;
|
||||
pollArguments[2] = 0;
|
||||
pollArguments[3] = s_socket;
|
||||
pollResultLow = 0;
|
||||
pollResultHigh = 1;
|
||||
timeoutTicks = (u32)(pollSeconds * (OS_BUS_CLOCK >> 2));
|
||||
tickRemainder = (u32)(pollSubseconds * ((OS_BUS_CLOCK >> 2) / 125000)) >> 3;
|
||||
requestResult = SOPoll(pollArguments,1,((u32)((timeoutTicks + tickRemainder) >> 32)),(int)timeoutTicks + (int)tickRemainder);
|
||||
if (0 < requestResult) goto process_received_packet;
|
||||
receivedPackets = receivedPackets + 1;
|
||||
retryWait = waitSettings.value;
|
||||
if (attemptCount < receivedPackets) {
|
||||
if (state == 0) {
|
||||
s_errorCode = 0xf;
|
||||
}
|
||||
else if (state == 1) {
|
||||
s_errorCode = 0x10;
|
||||
}
|
||||
else {
|
||||
s_errorCode = 0x11;
|
||||
}
|
||||
timeoutMilliseconds = -1;
|
||||
goto close_protocol_socket;
|
||||
}
|
||||
for (; retryWait = retryWait & 0xffff, retryWait != 0; retryWait = retryWait - responseSleep) {
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
responseSleep = retryWait;
|
||||
if (100 < retryWait) {
|
||||
responseSleep = 100;
|
||||
}
|
||||
AOSSi_Sleep(responseSleep);
|
||||
responseSleep = retryWait;
|
||||
if (100 < retryWait) {
|
||||
responseSleep = 100;
|
||||
}
|
||||
}
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
} while (1);
|
||||
}
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
}
|
||||
}
|
||||
goto finish_initialization;
|
||||
process_received_packet:
|
||||
receivedAddress.length = 8;
|
||||
receivedLength = SORecvFrom(s_socket,&packetBuffer->message,0x5dc,0,&receivedAddress);
|
||||
@@ -1045,387 +1423,6 @@ cancelled_configuration:
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
handle_initial_link:
|
||||
if (remainingWait == waitIntervals.connection) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
}
|
||||
else {
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
requestResult = 0;
|
||||
state = 0;
|
||||
do {
|
||||
memcpy(requestRecords.bytes + state,input->optionData,6);
|
||||
retryWait = rand();
|
||||
requestRecords.records[requestResult].transactionId = (short)retryWait;
|
||||
receivedLength = SOHtoNs(retryWait & 0xffff);
|
||||
requestRecords.records[requestResult].transactionId = receivedLength;
|
||||
requestResult = requestResult + 1;
|
||||
state = state + 8;
|
||||
} while (requestResult < 3);
|
||||
s_socket = SOSocket(2,2,0);
|
||||
if (s_socket < 0) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
}
|
||||
else if (initializationResult < 0) {
|
||||
s_errorCode = 0xb;
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
}
|
||||
else {
|
||||
memset(&socketAddress,0,8);
|
||||
socketAddress.family = 2;
|
||||
socketAddress.address = SOGetHostID();
|
||||
socketAddress.port = SOHtoNs(0x5790);
|
||||
socketAddress.length = 8;
|
||||
state = SOBind(s_socket,&socketAddress);
|
||||
if (-1 < state) {
|
||||
attemptCount = waitSettings.halfwords.high;
|
||||
settings.gatewayAddress = 0xc0a80b65;
|
||||
settings.ipAddress = 0xc0a80b01;
|
||||
state = 0;
|
||||
perform_request:
|
||||
packetBuffer = s_responseBuffer;
|
||||
memset(networkAddresses,0,0x14);
|
||||
gatewayAddress = settings.gatewayAddress;
|
||||
networkAddresses[0] = settings.ipAddress;
|
||||
do {
|
||||
if ((state == 1) && (s_runtime.active != '\x01')) {
|
||||
if (s_socket != -1) {
|
||||
SOClose(s_socket);
|
||||
}
|
||||
s_socket = -1;
|
||||
if (s_socketStarted == 1) {
|
||||
s_socketStarted = 0;
|
||||
requestResult = SOCleanup();
|
||||
if (-1 < requestResult) goto request_socket_cleanup_complete;
|
||||
requestResult = -1;
|
||||
}
|
||||
else {
|
||||
request_socket_cleanup_complete:
|
||||
requestResult = 0;
|
||||
}
|
||||
if (requestResult != 0) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
responseSleep = s_runtime.ipAddress & s_runtime.subnetMask;
|
||||
retryWait = responseSleep | (s_runtime.ipAddress & ~s_runtime.subnetMask) + 1;
|
||||
if ((responseSleep | ~s_runtime.subnetMask) <= retryWait) {
|
||||
retryWait = responseSleep | 1;
|
||||
}
|
||||
requestResult = AOSSi_SetNCDIPAddr(retryWait,s_runtime.subnetMask,s_runtime.ipAddress,0,0);
|
||||
if (requestResult != 0) {
|
||||
s_errorCode = 0xc;
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
s_runtime.active = '\x01';
|
||||
s_accessPointConfig = (int *)AOSSi_Alloc(0x58);
|
||||
if (s_accessPointConfig == (int *)0x0) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
memset(s_accessPointConfig,0,0x58);
|
||||
initialWait = waitIntervals.connection;
|
||||
for (waitAttempt = 0; waitAttempt < (short)initialWait; waitAttempt = waitAttempt + 1) {
|
||||
requestResult = AOSS_814020CC(&settings,s_accessPointConfig);
|
||||
if (requestResult == -1) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
remainingWait = waitIntervals.response;
|
||||
if ((requestResult == 0) && (*s_accessPointConfig == 1)) break;
|
||||
for (; remainingWait != 0; remainingWait = remainingWait - initialSleep) {
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
initialSleep = remainingWait;
|
||||
if (100 < remainingWait) {
|
||||
initialSleep = 100;
|
||||
}
|
||||
AOSSi_Sleep(initialSleep);
|
||||
initialSleep = remainingWait;
|
||||
if (100 < remainingWait) {
|
||||
initialSleep = 100;
|
||||
}
|
||||
}
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
}
|
||||
s_socket = SOSocket(2,2,0);
|
||||
if (s_socket < 0) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
memset(&socketAddress,0,8);
|
||||
socketAddress.family = 2;
|
||||
socketAddress.address = SOGetHostID();
|
||||
socketAddress.port = SOHtoNs(0x5790);
|
||||
socketAddress.length = 8;
|
||||
requestResult = SOBind(s_socket,&socketAddress);
|
||||
if (requestResult < 0) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
}
|
||||
requestResult = s_socket;
|
||||
if (state == 1) {
|
||||
if (s_operationState != 3) {
|
||||
s_operationState = 3;
|
||||
AOSSi_Status(3);
|
||||
}
|
||||
requestResult = AOSS_81401778(networkAddresses,&requestRecords,requestResult);
|
||||
}
|
||||
else if (state < 1) {
|
||||
if (state < 0) {
|
||||
invalid_request_state:
|
||||
requestResult = -1;
|
||||
}
|
||||
else {
|
||||
if (s_operationState != 2) {
|
||||
s_operationState = 2;
|
||||
AOSSi_Status(2);
|
||||
}
|
||||
requestResult = AOSS_81401574(networkAddresses,&requestRecords,requestResult);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (2 < state) goto invalid_request_state;
|
||||
if (s_operationState != 5) {
|
||||
s_operationState = 5;
|
||||
AOSSi_Status(5);
|
||||
}
|
||||
packetWords = s_responseBuffer;
|
||||
memset(s_responseBuffer,0,0x5dc);
|
||||
memcpy(messageIdentity,&requestRecords.records[2],8);
|
||||
manufacturerLength = strlen(s_manufacturer);
|
||||
AOSS_81401E80(messageIdentity,8,s_manufacturer,manufacturerLength);
|
||||
receivedLength = SOHtoNs(1);
|
||||
packetWords->initialLength = receivedLength;
|
||||
packetWords->initialType = 0;
|
||||
packetWords->initialSequence = 0;
|
||||
packetWords->responseLength = SOHtoNs(0x3000);
|
||||
packetWords->responseType = 0;
|
||||
packetWords->finalLength = SOHtoNs(0);
|
||||
packetWords->finalSequence = SOHtoNs(0);
|
||||
packetWords->reserved = 0;
|
||||
packetWords->messageType = 0x11;
|
||||
memcpy(packetWords->messageIdentity,messageIdentity,8);
|
||||
memset(&replyAddress,0,8);
|
||||
replyAddress.family = 2;
|
||||
replyAddress.port = SOHtoNs(0x5790);
|
||||
replyAddress.address = SOHtoNl(s_runtime.ipAddress);
|
||||
if (s_runtime.active == '\0') {
|
||||
replyAddress.address = 0xffffffff;
|
||||
}
|
||||
replyAddress.length = 8;
|
||||
SOSendTo(requestResult,packetWords,0x18,0,&replyAddress);
|
||||
requestResult = 0;
|
||||
}
|
||||
if (requestResult == -1) {
|
||||
s_errorCode = state + 0x1000;
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
memset(packetBuffer,0,0x5f8);
|
||||
timeoutSeconds = timeoutMilliseconds >> 0x1f;
|
||||
requestResult = timeoutMilliseconds / 1000 + timeoutSeconds;
|
||||
pollArguments[1] = 1;
|
||||
pollArguments[0] = s_socket;
|
||||
pollSeconds = requestResult - timeoutSeconds;
|
||||
pollArguments[2] = 0;
|
||||
pollArguments[3] = s_socket;
|
||||
pollResultLow = 0;
|
||||
pollResultHigh = 1;
|
||||
pollSubseconds = (timeoutMilliseconds + (requestResult - timeoutSeconds) * -1000) * 1000;
|
||||
timeoutTicks = (s64)pollSeconds * (s64)(int)(OS_BUS_CLOCK >> 2);
|
||||
tickRemainder = ((s64)pollSubseconds * (s64)(int)((OS_BUS_CLOCK >> 2) / 0x1e848) &
|
||||
0xffffffffU) >> 3;
|
||||
requestResult = SOPoll(pollArguments,1,((u32)((timeoutTicks + tickRemainder) >> 32)),(int)timeoutTicks + (int)tickRemainder);
|
||||
if (0 < requestResult) goto process_received_packet;
|
||||
receivedPackets = receivedPackets + 1;
|
||||
retryWait = waitSettings.value;
|
||||
if (attemptCount < receivedPackets) {
|
||||
if (state == 0) {
|
||||
s_errorCode = 0xf;
|
||||
}
|
||||
else if (state == 1) {
|
||||
s_errorCode = 0x10;
|
||||
}
|
||||
else {
|
||||
s_errorCode = 0x11;
|
||||
}
|
||||
timeoutMilliseconds = -1;
|
||||
goto close_protocol_socket;
|
||||
}
|
||||
for (; retryWait = retryWait & 0xffff, retryWait != 0; retryWait = retryWait - responseSleep) {
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
responseSleep = retryWait;
|
||||
if (100 < retryWait) {
|
||||
responseSleep = 100;
|
||||
}
|
||||
AOSSi_Sleep(responseSleep);
|
||||
responseSleep = retryWait;
|
||||
if (100 < retryWait) {
|
||||
responseSleep = 100;
|
||||
}
|
||||
}
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto finish_initialization;
|
||||
}
|
||||
} while (1);
|
||||
}
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
s_accessPointConfig = (int *)0x0;
|
||||
}
|
||||
if (s_accessPointList != 0) {
|
||||
AOSSi_Free(s_accessPointList);
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
}
|
||||
}
|
||||
finish_initialization:
|
||||
return (int)resultCode;}
|
||||
|
||||
@@ -1847,11 +1844,11 @@ int AOSS_81400830(AOSSDecryptionMessage* message) {
|
||||
u8 manufacturerAddress[8];
|
||||
AOSSKeySchedule schedule;
|
||||
u8* decryptedData;
|
||||
u8* stateBytes;
|
||||
u32 dataLength;
|
||||
u32 controlFlags;
|
||||
u32 checksum;
|
||||
u32 i;
|
||||
s32 crcIndex;
|
||||
u32 firstIndex;
|
||||
u32 secondIndex;
|
||||
u32 firstValue;
|
||||
@@ -1891,14 +1888,13 @@ int AOSS_81400830(AOSSDecryptionMessage* message) {
|
||||
}
|
||||
|
||||
checksum = message->checksum;
|
||||
stateBytes = AOSSi_Alloc(dataLength);
|
||||
if (stateBytes == 0) {
|
||||
schedule.bytes = AOSSi_Alloc(dataLength);
|
||||
if (schedule.bytes == 0) {
|
||||
s_errorCode = 2;
|
||||
result = -1;
|
||||
} else {
|
||||
memcpy(s_packetState.keyNonce, &message->payload.encrypted.keyNonce, sizeof(message->payload.encrypted.keyNonce));
|
||||
memcpy(s_packetState.keyAddress, s_accessPointName, sizeof(s_accessPointName));
|
||||
schedule.bytes = stateBytes;
|
||||
AOSS_81401C9C(&schedule, s_packetState.keyNonce,
|
||||
sizeof(s_packetState.keyNonce) + sizeof(s_packetState.keyAddress), dataLength);
|
||||
|
||||
@@ -1918,15 +1914,15 @@ int AOSS_81400830(AOSSDecryptionMessage* message) {
|
||||
|
||||
AOSS_81401DC0(0, s_crcTable);
|
||||
crc = 0xffffffff;
|
||||
for (i = 0; i < dataLength; i++) {
|
||||
crc = (crc >> 8) ^ s_crcTable[(crc ^ decryptedData[i]) & 0xff];
|
||||
for (crcIndex = 0; crcIndex < (s32)dataLength; crcIndex++) {
|
||||
crc = (crc >> 8) ^ s_crcTable[(crc ^ decryptedData[crcIndex]) & 0xff];
|
||||
}
|
||||
if (((crc ^ 0xffffffff) & 0xff) != checksum) {
|
||||
s_errorCode = 0x12;
|
||||
AOSSi_Free(stateBytes);
|
||||
AOSSi_Free(schedule.bytes);
|
||||
result = -1;
|
||||
} else {
|
||||
AOSSi_Free(stateBytes);
|
||||
AOSSi_Free(schedule.bytes);
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
@@ -2158,6 +2154,7 @@ int AOSS_81401284(const AOSSOptionRecord* packet, AOSSStoredConfig* config) {
|
||||
}
|
||||
|
||||
int AOSS_814013AC(int state, const AOSSReplyOption* response, int responseLength, void* config, void* networkData) {
|
||||
u32 flags = 0;
|
||||
const AOSSReplyOption* responseRecord;
|
||||
AOSSConfigRecord* configRecord;
|
||||
AOSSStoredConfig* wep40Config;
|
||||
@@ -2165,7 +2162,6 @@ int AOSS_814013AC(int state, const AOSSReplyOption* response, int responseLength
|
||||
AOSSStoredConfig* tkipConfig;
|
||||
AOSSStoredConfig* aesConfig;
|
||||
u8* networkSettings;
|
||||
u32 flags = 0;
|
||||
const AOSSReplyOption* option;
|
||||
u32 length;
|
||||
s32 remainingLength = responseLength;
|
||||
@@ -2192,8 +2188,8 @@ int AOSS_814013AC(int state, const AOSSReplyOption* response, int responseLength
|
||||
option = (const AOSSReplyOption*)&responseRecord->bytes[4];
|
||||
remainingLength = SONtoHs((u16)length);
|
||||
configRecord = &((AOSSConfigData*)config)->records[state];
|
||||
networkSettings = ((AOSSNetworkBufferRecord*)networkData)[state + 3].bytes;
|
||||
wep40Config = (AOSSStoredConfig*)&configRecord->reserved00[8];
|
||||
networkSettings = ((AOSSNetworkBufferRecord*)networkData)[state + 3].bytes;
|
||||
wep104Config = (AOSSStoredConfig*)&configRecord->reserved138[0];
|
||||
tkipConfig = (AOSSStoredConfig*)&configRecord->reserved268[0];
|
||||
aesConfig = (AOSSStoredConfig*)&configRecord->reserved2d8[0];
|
||||
|
||||
@@ -474,6 +474,10 @@ typedef struct {
|
||||
|
||||
typedef union {
|
||||
u8 data[0x818];
|
||||
struct {
|
||||
u8 encryptedOptions[0x7F8];
|
||||
u8 keyMaterial[24];
|
||||
} session;
|
||||
struct {
|
||||
union {
|
||||
u8 payload[0x800];
|
||||
@@ -870,6 +874,7 @@ int ATERM_81402A24(void) {
|
||||
AtermApRecordSet* previousRecords = NULL;
|
||||
u8* rawScanBuffer = NULL;
|
||||
u8* scanBuffer;
|
||||
u16* firstDescriptor;
|
||||
AtermApRecord* recordCursor;
|
||||
u32 recordBytes = gAtermScanLimit * sizeof(AtermApRecord) + sizeof(AtermApRecord) + sizeof(u32);
|
||||
u32 scanBufferBytes;
|
||||
@@ -894,10 +899,11 @@ int ATERM_81402A24(void) {
|
||||
if (previousRecords == NULL) {
|
||||
goto cleanup;
|
||||
}
|
||||
scanBufferBytes = gAtermScanBufferSize * 0x100;
|
||||
scanBufferBytes = gAtermScanLimit * 0x100;
|
||||
rawScanBuffer = (u8*)gAtermAllocate(scanBufferBytes + 0x40);
|
||||
scanBuffer = (u8*)(((u32)rawScanBuffer + 0x1F) & ~0x1F);
|
||||
|
||||
firstDescriptor = (u16*)(scanBuffer + sizeof(u16));
|
||||
while (iteration < 300 && gAtermCancelRequested == 0) {
|
||||
s64 currentTime = OSGetTime();
|
||||
now = (u32)OSTicksToMilliseconds(currentTime);
|
||||
@@ -919,7 +925,7 @@ int ATERM_81402A24(void) {
|
||||
|
||||
scanCount = (u32)result;
|
||||
{
|
||||
u16* descriptorWords = (u16*)(scanBuffer + sizeof(u16));
|
||||
u16* descriptorWords = firstDescriptor;
|
||||
char* ssidCursor = (char*)currentRecords->entries[0].ssid;
|
||||
u8* bssidCursor = currentRecords->entries[0].bssid;
|
||||
recordCursor = currentRecords->entries;
|
||||
@@ -928,10 +934,10 @@ int ATERM_81402A24(void) {
|
||||
WDBssDesc* descriptor = (WDBssDesc*)descriptorWords;
|
||||
|
||||
memcpy(ssidCursor, descriptor->ssid, sizeof(recordCursor->ssid));
|
||||
if (descriptor->ssidLength <= sizeof(recordCursor->ssid)) {
|
||||
recordCursor->ssidLength = descriptor->ssidLength;
|
||||
} else {
|
||||
if (descriptor->ssidLength > sizeof(recordCursor->ssid)) {
|
||||
recordCursor->ssidLength = 0;
|
||||
} else {
|
||||
recordCursor->ssidLength = descriptor->ssidLength;
|
||||
}
|
||||
recordCursor->ssid[recordCursor->ssidLength] = '\0';
|
||||
recordCursor->status = (descriptor->capabilities >> 4) & 1;
|
||||
@@ -1427,10 +1433,9 @@ s32 ATERM_814038C8(void) {
|
||||
OSAlarm waitAlarm;
|
||||
AtermSocketAddress socketBindAddress;
|
||||
AtermSocketAddress peerAddress;
|
||||
u8* packetBuffer = gAtermConfigurationResult.packetBuffer;
|
||||
AtermThreadBuffer* response = &gAtermResponseBuffer;
|
||||
AtermThreadBuffer* response = (AtermThreadBuffer*)&gAtermConfigurationResult.responseLength;
|
||||
void* connectionKey = gAtermConfigurationResult.connectionPrefix;
|
||||
void* sessionKey = response->authentication.keyMaterial;
|
||||
void* sessionKey = gAtermResponseBuffer.session.keyMaterial;
|
||||
AtermMd5Context digestContext;
|
||||
u8 digestLength[8];
|
||||
s32 socket = 0;
|
||||
@@ -1516,10 +1521,10 @@ s32 ATERM_814038C8(void) {
|
||||
}
|
||||
peerAddress.length = 8;
|
||||
ATERM_814031DC((AtermAssociationRequest*)connectionKey);
|
||||
receivedLength = SORecvFrom(socket, packetBuffer,
|
||||
receivedLength = SORecvFrom(socket, gAtermConfigurationResult.packetBuffer,
|
||||
sizeof(gAtermConfigurationResult.packetBuffer), 4, &peerAddress);
|
||||
if (receivedLength > 0 &&
|
||||
ATERM_81402FC0((AtermPacket*)packetBuffer, &gAtermResponseMode)) {
|
||||
ATERM_81402FC0((AtermPacket*)gAtermConfigurationResult.packetBuffer, &gAtermResponseMode)) {
|
||||
AtermProgress progress;
|
||||
gAtermDeadline = (u32)(OSGetTime() / (__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6)) + 30000;
|
||||
gAtermProtocolState = 5;
|
||||
@@ -1578,13 +1583,13 @@ s32 ATERM_814038C8(void) {
|
||||
longOption++;
|
||||
}
|
||||
optionEnd = (u8*)longOption;
|
||||
gAtermMessageLength = ATERM_81402E40((u16*)packetBuffer, 2,
|
||||
gAtermMessageLength = ATERM_81402E40((u16*)gAtermConfigurationResult.packetBuffer, 2,
|
||||
(u16*)response->data, optionEnd - gAtermRequestOptions + 8, NULL);
|
||||
sendAddress.length = 8;
|
||||
sendAddress.family = 2;
|
||||
sendAddress.address = 0xFFFFFFFF;
|
||||
sendAddress.port = SOHtoNs(0xE601);
|
||||
SOSendTo(socket, packetBuffer, gAtermMessageLength, 0, &sendAddress);
|
||||
SOSendTo(socket, gAtermConfigurationResult.packetBuffer, gAtermMessageLength, 0, &sendAddress);
|
||||
lastSendTime = (u32)(OSGetTime() / (__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6));
|
||||
gAtermProtocolState = 6;
|
||||
break;
|
||||
@@ -1597,14 +1602,14 @@ s32 ATERM_814038C8(void) {
|
||||
failed = 1;
|
||||
break;
|
||||
}
|
||||
receivedLength = SORecvFrom(socket, packetBuffer,
|
||||
receivedLength = SORecvFrom(socket, gAtermConfigurationResult.packetBuffer,
|
||||
sizeof(gAtermConfigurationResult.packetBuffer), 4, &peerAddress);
|
||||
if (receivedLength > 0) {
|
||||
AtermPacket* packet = (AtermPacket*)packetBuffer;
|
||||
AtermPacket* packet = (AtermPacket*)gAtermConfigurationResult.packetBuffer;
|
||||
s32 sequence = SONtoHs(packet->sequence);
|
||||
s32 payloadLength = SONtoHs(packet->length);
|
||||
u32 checksum = 0;
|
||||
u8* cursor = packetBuffer;
|
||||
u8* cursor = gAtermConfigurationResult.packetBuffer;
|
||||
u8* packetEnd = packet->payload + payloadLength;
|
||||
u8* payload = packet->payload;
|
||||
for (; cursor < packetEnd; cursor++) {
|
||||
@@ -1643,7 +1648,7 @@ s32 ATERM_814038C8(void) {
|
||||
u32 index;
|
||||
u32 digestBytes;
|
||||
u32 bitCount[2];
|
||||
memcpy(gAtermResponseBuffer.authentication.challenge,
|
||||
memcpy(response->authentication.challenge,
|
||||
optionValue, 8);
|
||||
digestContext.state[0] = 0x67452301;
|
||||
digestContext.state[1] = 0xEFCDAB89;
|
||||
@@ -1717,27 +1722,27 @@ s32 ATERM_814038C8(void) {
|
||||
memcpy(option->value, response->authentication.digest, 8);
|
||||
gAtermReplyLength = (u8*)(option + 1) - response->data;
|
||||
response->authentication.decoded.length = gAtermReplyLength - 8;
|
||||
gAtermMessageLength = ATERM_81402E40((u16*)packetBuffer, 4,
|
||||
gAtermMessageLength = ATERM_81402E40((u16*)gAtermConfigurationResult.packetBuffer, 4,
|
||||
(u16*)response->data, gAtermReplyLength, connectionKey);
|
||||
sendAddress.length = 8;
|
||||
sendAddress.family = 2;
|
||||
sendAddress.address = 0xFFFFFFFF;
|
||||
sendAddress.port = SOHtoNs(0xE601);
|
||||
SOSendTo(socket, packetBuffer, gAtermMessageLength, 0, &sendAddress);
|
||||
SOSendTo(socket, gAtermConfigurationResult.packetBuffer, gAtermMessageLength, 0, &sendAddress);
|
||||
lastSendTime = (u32)(OSGetTime() / (__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6));
|
||||
memset(&gScanSettings, 0, sizeof(gScanSettings));
|
||||
memset(&gScanSettings, 0, 0x254);
|
||||
gAtermProtocolState = 8;
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
receivedLength = SORecvFrom(socket, packetBuffer,
|
||||
receivedLength = SORecvFrom(socket, gAtermConfigurationResult.packetBuffer,
|
||||
sizeof(gAtermConfigurationResult.packetBuffer), 4, &peerAddress);
|
||||
if (receivedLength > 0) {
|
||||
AtermPacket* packet = (AtermPacket*)packetBuffer;
|
||||
AtermPacket* packet = (AtermPacket*)gAtermConfigurationResult.packetBuffer;
|
||||
s32 sequence = SONtoHs(packet->sequence);
|
||||
s32 payloadLength = SONtoHs(packet->length);
|
||||
u32 checksum = 0;
|
||||
u8* cursor = packetBuffer;
|
||||
u8* cursor = gAtermConfigurationResult.packetBuffer;
|
||||
u8* packetEnd = packet->payload + payloadLength;
|
||||
u8* payload = packet->payload;
|
||||
for (; cursor < packetEnd; cursor++) {
|
||||
@@ -1788,7 +1793,7 @@ s32 ATERM_814038C8(void) {
|
||||
memcpy(option->value, &gAtermMode, 1);
|
||||
gAtermReplyLength = (u8*)(option + 1) - response->data;
|
||||
response->authentication.decoded.length = gAtermReplyLength - 8;
|
||||
gAtermMessageLength = ATERM_81402E40((u16*)packetBuffer, 6,
|
||||
gAtermMessageLength = ATERM_81402E40((u16*)gAtermConfigurationResult.packetBuffer, 6,
|
||||
(u16*)response->data, gAtermReplyLength, sessionKey);
|
||||
if (NCDGetLinkStatus() != 5) {
|
||||
lastSendTime = (u32)(OSGetTime() / (__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6)) + 1000;
|
||||
@@ -1800,7 +1805,7 @@ s32 ATERM_814038C8(void) {
|
||||
sendAddress.family = 2;
|
||||
sendAddress.address = 0xFFFFFFFF;
|
||||
sendAddress.port = SOHtoNs(0xE601);
|
||||
SOSendTo(socket, packetBuffer, gAtermMessageLength, 0, &sendAddress);
|
||||
SOSendTo(socket, gAtermConfigurationResult.packetBuffer, gAtermMessageLength, 0, &sendAddress);
|
||||
lastSendTime = (u32)(OSGetTime() / (__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6));
|
||||
gAtermProtocolState = 10;
|
||||
break;
|
||||
@@ -2152,6 +2157,10 @@ int ATERM_8140502C(u32* expandedKey, const void* key, u32 keyBits) {
|
||||
#undef ATERM_AES_TRANSFORM_KEY
|
||||
|
||||
void ATERM_81405254(const u32* expandedKey, u32 rounds, const u8* input, u8* output) {
|
||||
const u32* roundTable3 = gAtermAesEncryptTable3;
|
||||
const u32* roundTable2 = gAtermAesEncryptTable2;
|
||||
const u32* roundTable0 = gAtermAesEncryptTable0;
|
||||
const u32* roundTable1 = gAtermAesEncryptTable1;
|
||||
s32 roundPairs = (s32)rounds >> 1;
|
||||
u32 state0 = (((u32)input[2] << 8) ^ input[3]) ^
|
||||
(((u32)input[0] << 24) ^ ((u32)input[1] << 16)) ^ expandedKey[0];
|
||||
@@ -2162,10 +2171,6 @@ void ATERM_81405254(const u32* expandedKey, u32 rounds, const u8* input, u8* out
|
||||
u32 state3 = (((u32)input[14] << 8) ^ input[15]) ^
|
||||
(((u32)input[12] << 24) ^ ((u32)input[13] << 16)) ^ expandedKey[3];
|
||||
u32 next0, next1, next2, next3;
|
||||
const u32* roundTable3 = gAtermAesEncryptTable3;
|
||||
const u32* roundTable2 = gAtermAesEncryptTable2;
|
||||
const u32* roundTable0 = gAtermAesEncryptTable0;
|
||||
const u32* roundTable1 = gAtermAesEncryptTable1;
|
||||
|
||||
for (;;) {
|
||||
next0 = (roundTable3[state3 & 0xFF] ^ roundTable2[(state2 >> 8) & 0xFF]) ^
|
||||
@@ -2230,14 +2235,10 @@ void ATERM_81405254(const u32* expandedKey, u32 rounds, const u8* input, u8* out
|
||||
|
||||
void ATERM_81405690(const u32* expandedKey, u32 rounds, const u8* input, u8* output) {
|
||||
s32 roundPairs = (s32)rounds >> 1;
|
||||
u32 state0 = (((u32)input[2] << 8) ^ input[3]) ^
|
||||
(((u32)input[0] << 24) ^ ((u32)input[1] << 16)) ^ expandedKey[0];
|
||||
u32 state1 = (((u32)input[6] << 8) ^ input[7]) ^
|
||||
(((u32)input[4] << 24) ^ ((u32)input[5] << 16)) ^ expandedKey[1];
|
||||
u32 state2 = (((u32)input[10] << 8) ^ input[11]) ^
|
||||
(((u32)input[8] << 24) ^ ((u32)input[9] << 16)) ^ expandedKey[2];
|
||||
u32 state3 = (((u32)input[14] << 8) ^ input[15]) ^
|
||||
(((u32)input[12] << 24) ^ ((u32)input[13] << 16)) ^ expandedKey[3];
|
||||
u32 state0 = (((u32)input[0] << 24) ^ ((u32)input[1] << 16) ^ ((u32)input[2] << 8) ^ input[3]) ^ expandedKey[0];
|
||||
u32 state1 = (((u32)input[4] << 24) ^ ((u32)input[5] << 16) ^ ((u32)input[6] << 8) ^ input[7]) ^ expandedKey[1];
|
||||
u32 state2 = (((u32)input[8] << 24) ^ ((u32)input[9] << 16) ^ ((u32)input[10] << 8) ^ input[11]) ^ expandedKey[2];
|
||||
u32 state3 = (((u32)input[12] << 24) ^ ((u32)input[13] << 16) ^ ((u32)input[14] << 8) ^ input[15]) ^ expandedKey[3];
|
||||
u32 next0, next1, next2, next3;
|
||||
const u32* roundTable3 = gAtermAesDecryptTable3;
|
||||
const u32* roundTable2 = gAtermAesDecryptTable2;
|
||||
@@ -2562,7 +2563,7 @@ int ATERMi_ApConfigGetVersion(void) {
|
||||
return 0x106;
|
||||
}
|
||||
|
||||
u8* gAtermRequestOptions = gAtermResponseBuffer.authentication.decoded.options;
|
||||
u8* gAtermRequestOptions = gAtermResponseBuffer.data;
|
||||
|
||||
u32 gAtermUseSharedAddress = 1;
|
||||
char gAtermProductName[5] = "WARP";
|
||||
|
||||
200
tools/decomp-assist/sol-med-round6-aoss.md
Normal file
200
tools/decomp-assist/sol-med-round6-aoss.md
Normal file
@@ -0,0 +1,200 @@
|
||||
# AOSS round 6 attempts
|
||||
|
||||
Baseline at 03ed29cc: instruction exact 15/21, code 6436/16192, data 3896/3928, fuzzy 69.37574.
|
||||
|
||||
Each distinct compiling source trial is measured and logged. Only higher scores are retained; unchanged and failed candidates do not count.
|
||||
|
||||
AOSS_81400E0C initial 100.0%
|
||||
- network-data parser uses unsigned parsed length: 59.389473%; src 0x280 base 0x2f8 insns 160/190; --- delete mine 2:3 base 2:2; M 2 li r5, 0x104; --- replace mine 4:7 base 3:5
|
||||
- network bytes accumulate by multiplication: 100.0%; src 0x2f8 base 0x2f8 insns 190/190; diffs 5: [19, 57, 62, 117, 122]; 19 M bgt -10911; B bgt -11215
|
||||
- next record offset captured as named byte view: 100.0%; src 0x2f8 base 0x2f8 insns 190/190; diffs 5: [19, 57, 62, 117, 122]; 19 M bgt -10911; B bgt -11215
|
||||
Retained objdiff-100 original; instruction residual is reported below
|
||||
|
||||
AOSS_81401E80 initial 98.5034%
|
||||
- XOR key byte precedes input byte expression: 97.993195%; src 0x24c base 0x24c insns 147/147; diffs 46: [53, 54, 56, 58, 59, 63, 64, 66, 69, 71, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83]; 53 M li r5, 0; B li r3, 0
|
||||
- XOR destination uses ordinary compound assignment: 98.23129%; src 0x24c base 0x24c insns 147/147; diffs 46: [53, 54, 56, 58, 59, 63, 64, 66, 69, 71, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83]; 53 M li r5, 0; B li r3, 0
|
||||
- XOR loop traversal index declared before allocation views: 98.12925%; src 0x24c base 0x24c insns 147/147; diffs 48: [34, 36, 40, 41, 42, 43, 44, 48, 49, 53, 54, 56, 58, 59, 63, 64, 66, 69, 71, 72]; 34 M li r5, 0; B li r6, 0
|
||||
Retained best candidate
|
||||
|
||||
AOSS_814013AC initial 96.57895%
|
||||
- one option cursor reused after outer response search: 96.18421%; src 0x1c8 base 0x1c8 insns 114/114; diffs 38: [6, 7, 10, 14, 15, 16, 17, 20, 25, 29, 30, 34, 37, 38, 39, 40, 41, 42, 55, 56]; 6 M mr r24, r5; B mr r27, r3
|
||||
- first config view computed before network-data view: 98.333336%; src 0x1c8 base 0x1c8 insns 114/114; diffs 28: [6, 7, 10, 14, 15, 16, 17, 20, 25, 29, 30, 34, 42, 55, 58, 60, 63, 65, 68, 70]; 6 M mr r24, r5; B mr r27, r3
|
||||
- one option cursor with config-before-network evaluation: 96.18421%; src 0x1c8 base 0x1c8 insns 114/114; diffs 38: [6, 7, 10, 14, 15, 16, 17, 20, 25, 29, 30, 34, 37, 38, 39, 40, 41, 42, 55, 56]; 6 M mr r24, r5; B mr r27, r3
|
||||
Retained best candidate
|
||||
|
||||
AOSS_814013AC initial 98.333336%
|
||||
- single selected-option view declared after flags: 95.833336%; src 0x1c8 base 0x1c8 insns 114/114; diffs 44: [6, 7, 8, 9, 10, 14, 15, 16, 17, 20, 24, 25, 29, 30, 32, 33, 34, 36, 37, 38]; 6 M mr r25, r5; B mr r27, r3
|
||||
- input state retained in a named selection before remaining length: 98.333336%; src 0x1c8 base 0x1c8 insns 114/114; diffs 28: [6, 7, 10, 14, 15, 16, 17, 20, 25, 29, 30, 34, 42, 55, 58, 60, 63, 65, 68, 70]; 6 M mr r24, r5; B mr r27, r3
|
||||
- single selected cursor and named state selection: 95.833336%; src 0x1c8 base 0x1c8 insns 114/114; diffs 44: [6, 7, 8, 9, 10, 14, 15, 16, 17, 20, 24, 25, 29, 30, 32, 33, 34, 36, 37, 38]; 6 M mr r25, r5; B mr r27, r3
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81400830 initial 87.78505%
|
||||
- decryption publishes schedule fields directly for each byte: 84.4486%; src 0x500 base 0x504 insns 320/321; --- replace mine 5:6 base 5:7; M 5 mr r27, r3; B 5 mr r26, r3
|
||||
- decryption swap byte and lookup sum match their source widths: 84.4486%; src 0x500 base 0x504 insns 320/321; --- replace mine 5:6 base 5:7; M 5 mr r27, r3; B 5 mr r26, r3
|
||||
- CRC traversal uses signed byte index and original nonempty guard: 91.97196%; src 0x51c base 0x504 insns 327/321; --- replace mine 5:6 base 5:7; M 5 mr r27, r3; B 5 mr r26, r3
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81401778 initial 79.13919%
|
||||
- hello encrypted destination initialized as one payload byte view: 76.29304%; src 0x440 base 0x444 insns 272/273; --- replace mine 5:7 base 5:6; M 5 lis r31, 0; M 6 lwz r30, 0(0)
|
||||
- hello RC4 byte output writes through its named encryptedData field: 79.13919%; src 0x44c base 0x444 insns 275/273; --- replace mine 5:7 base 5:6; M 5 lis r31, 0; M 6 lwz r30, 0(0)
|
||||
- hello request identity view declared after packet response initialization: 79.13919%; src 0x44c base 0x444 insns 275/273; --- replace mine 5:7 base 5:6; M 5 lis r31, 0; M 6 lwz r30, 0(0)
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81400830 initial 91.97196%
|
||||
- unsigned RC4 traversal and separate signed CRC byte index: 92.563866%; src 0x51c base 0x504 insns 327/321; --- replace mine 5:6 base 5:7; M 5 mr r27, r3; B 5 mr r26, r3
|
||||
- signed CRC index declared before RC4 traversal index: 92.563866%; src 0x51c base 0x504 insns 327/321; --- replace mine 5:6 base 5:7; M 5 mr r27, r3; B 5 mr r26, r3
|
||||
- signed CRC loop carries nonempty payload guard: 91.88162%; src 0x520 base 0x504 insns 328/321; --- replace mine 5:6 base 5:7; M 5 mr r27, r3; B 5 mr r26, r3
|
||||
Retained best candidate
|
||||
|
||||
Initialization default timeout corrected: input.options is signed s16; comparing against 0xffff was always false. Target compares signed value with -1 and selects 2000 ms. Native compile-time/sign-extension evidence and target offsets 0xb4..0xc0. Score 28.222221%.
|
||||
|
||||
AOSS_Init_old initial 28.222221%
|
||||
- socket poll descriptors expressed as the actual SDK records: 28.174242%; src 0x17a4 base 0x18c0 insns 1513/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x110(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
- connection counter separate from unsigned response sleep widths: 28.587122%; src 0x176c base 0x18c0 insns 1499/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
- error paths return directly after their resource cleanup: 28.222221%; src 0x179c base 0x18c0 insns 1511/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81400830 initial 92.563866%
|
||||
- RC4 allocation is owned directly by the key schedule: 93.84112%; src 0x518 base 0x504 insns 326/321; --- replace mine 5:6 base 5:7; M 5 mr r28, r3; B 5 mr r26, r3
|
||||
- decryption output destination read before source XOR byte: 93.84112%; src 0x518 base 0x504 insns 326/321; --- replace mine 5:6 base 5:7; M 5 mr r28, r3; B 5 mr r26, r3
|
||||
- RC4 swap sum captured before writes with byte-width swap: 93.84112%; src 0x518 base 0x504 insns 326/321; --- replace mine 5:6 base 5:7; M 5 mr r28, r3; B 5 mr r26, r3
|
||||
Retained best candidate
|
||||
|
||||
AOSS_Init_old initial 28.587122%
|
||||
- poll seconds and microseconds derived directly from milliseconds: 28.618687%; src 0x176c base 0x18c0 insns 1499/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
- poll tick terms use target 32-bit products before 64-bit sum: 29.417297%; src 0x175c base 0x18c0 insns 1495/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
- typed two-record descriptor array with original timeout arithmetic: 29.073233%; src 0x1764 base 0x18c0 insns 1497/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x110(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
Retained best candidate
|
||||
|
||||
AOSS_814013AC initial 98.333336%
|
||||
- response flags declared before response and config views: 98.77193%; src 0x1c8 base 0x1c8 insns 114/114; diffs 22: [6, 7, 14, 15, 16, 17, 20, 25, 29, 30, 34, 42, 55, 60, 65, 70, 75, 81, 87, 95]; 6 M mr r24, r5; B mr r27, r3
|
||||
- remaining response span initialized before config views: 98.070175%; src 0x1c8 base 0x1c8 insns 114/114; diffs 33: [6, 7, 10, 14, 15, 16, 17, 20, 24, 25, 29, 30, 34, 37, 39, 42, 55, 56, 58, 60]; 6 M mr r29, r5; B mr r27, r3
|
||||
- response search cursor declared beside selected option cursor: 96.31579%; src 0x1c8 base 0x1c8 insns 114/114; diffs 35: [6, 7, 8, 9, 10, 14, 15, 16, 17, 20, 25, 29, 30, 32, 33, 34, 36, 37, 38, 42]; 6 M mr r24, r5; B mr r27, r3
|
||||
Retained best candidate
|
||||
|
||||
AOSS_Init_old initial 29.417297%
|
||||
- initial flags failure block precedes the scan branch: 30.063131%; src 0x175c base 0x18c0 insns 1495/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
- initial flags guard returns before the scan loop: 30.063131%; src 0x175c base 0x18c0 insns 1495/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
- early flags guard and explicit unsigned retry halfword comparison: 30.063131%; src 0x175c base 0x18c0 insns 1495/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
Retained best candidate
|
||||
|
||||
AOSS_Init_old initial 30.063131%
|
||||
- protocol send loop precedes receive and cleanup blocks in target order: 73.34911%; src 0x1758 base 0x18c0 insns 1494/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
- protocol order with signed response-count limit from input options: 73.22538%; src 0x1758 base 0x18c0 insns 1494/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
- protocol order with direct error returns after resources are freed: 73.34911%; src 0x1758 base 0x18c0 insns 1494/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
Retained best candidate
|
||||
|
||||
AOSS_814013AC initial 98.77193%
|
||||
- input response-length parameter reused for option byte span: 98.20175%; src 0x1c8 base 0x1c8 insns 114/114; diffs 32: [7, 10, 14, 15, 16, 17, 20, 24, 25, 29, 30, 34, 37, 39, 42, 55, 56, 58, 60, 61]; 7 M mr r31, r5; B mr r24, r5
|
||||
- one cursor after flags with retained configuration evaluation order: 95.833336%; src 0x1c8 base 0x1c8 insns 114/114; diffs 44: [6, 7, 8, 9, 10, 14, 15, 16, 17, 20, 24, 25, 29, 30, 32, 33, 34, 36, 37, 38]; 6 M mr r25, r5; B mr r27, r3
|
||||
- input length and one cursor retained throughout response parsing: 96.22807%; src 0x1c8 base 0x1c8 insns 114/114; diffs 38: [7, 10, 14, 15, 16, 17, 20, 24, 25, 29, 30, 34, 37, 38, 39, 40, 41, 42, 55, 56]; 7 M mr r31, r5; B mr r24, r5
|
||||
Retained best candidate
|
||||
|
||||
Data linkage trial: CRC table linkage matches extracted global binding; fuzzy 87.587204%, data 3896, objdiff-exact regressions [].
|
||||
- AOSS_81400830 93.84112%; src 0x518 base 0x504 insns 326/321
|
||||
- AOSS_81401778 79.13919%; src 0x44c base 0x444 insns 275/273
|
||||
|
||||
Data linkage trial: CRC table and runtime state use externally linked storage; fuzzy 87.587204%, data 400, objdiff-exact regressions [].
|
||||
- AOSS_81400830 93.84112%; src 0x518 base 0x504 insns 326/321
|
||||
- AOSS_81401778 79.13919%; src 0x44c base 0x444 insns 275/273
|
||||
|
||||
Data linkage trial: all recovered small-BSS state objects use original global binding; fuzzy 87.587204%, data 3896, objdiff-exact regressions [].
|
||||
- AOSS_81400830 93.84112%; src 0x518 base 0x504 insns 326/321
|
||||
- AOSS_81401778 79.13919%; src 0x44c base 0x444 insns 275/273
|
||||
|
||||
AOSS_814013AC initial 98.77193%
|
||||
- state type table exposed as first declared byte view: 98.77193%; src 0x1c8 base 0x1c8 insns 114/114; diffs 22: [6, 7, 14, 15, 16, 17, 20, 25, 29, 30, 34, 42, 55, 60, 65, 70, 75, 81, 87, 95]; 6 M mr r24, r5; B mr r27, r3
|
||||
- state type table exposed after scalar parse result: 98.77193%; src 0x1c8 base 0x1c8 insns 114/114; diffs 22: [6, 7, 14, 15, 16, 17, 20, 25, 29, 30, 34, 42, 55, 60, 65, 70, 75, 81, 87, 95]; 6 M mr r24, r5; B mr r27, r3
|
||||
- explicit state table and one option cursor declared after scalars: 95.92105%; src 0x1c8 base 0x1c8 insns 114/114; diffs 43: [6, 7, 8, 9, 10, 14, 15, 16, 17, 20, 25, 29, 30, 32, 33, 34, 36, 37, 38, 39]; 6 M mr r24, r5; B mr r27, r3
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81400830 initial 93.84112%
|
||||
- encrypted payload typed view precedes crypto locals: 93.84112%; src 0x518 base 0x504 insns 326/321; --- replace mine 5:6 base 5:7; M 5 mr r28, r3; B 5 mr r26, r3
|
||||
- encrypted payload typed view follows result declaration: 93.84112%; src 0x518 base 0x504 insns 326/321; --- replace mine 5:6 base 5:7; M 5 mr r28, r3; B 5 mr r26, r3
|
||||
- payload byte-span view assigned before manufacturer decode call: 93.84112%; src 0x518 base 0x504 insns 326/321; --- replace mine 5:6 base 5:7; M 5 mr r28, r3; B 5 mr r26, r3
|
||||
Retained best candidate
|
||||
|
||||
Retained initialization changes: signed -1 default timeout selects 2000 ms; unsigned halfword sleep durations and an integer connection counter match the target load/compare widths; poll timeout uses 32-bit products widened for the 64-bit tick sum. The initial error branch comes first. The send loop now precedes receive, socket cleanup and error reporting, matching the target block order. No branches or real functions were removed. Initialization rose from 28.193813 to 73.34911% and total AOSS fuzzy from 69.37574 to 87.587204%.
|
||||
|
||||
Decryption retains unsigned RC4 traversal and a separate signed CRC traversal index. The schedule owns its allocated state directly instead of an extra stateBytes alias. Native checks verify payload and rejection behavior at odd/even and unroll-boundary lengths. Remaining differences include frame/payload bindings and five extra instructions; no instruction-exact claim.
|
||||
|
||||
Data trials changed only real state-object linkage. CRC linkage had no gain. External runtime linkage regressed data from 3896 to 400 and was reverted. Small-BSS global linkage had no gain and was reverted. All original storage declarations remain. Every data section except the .sbss symbol correspondence remains 100%; physical small-BSS bytes and observed relocation offsets are identical. No padding was added to reproduce extracted section alignment tails.
|
||||
|
||||
Supplemental full-initialization verification PASS under /tmp: flags rejection, cancellation cleanup, explicit 1501 ms polling, -1 selecting 2000 ms, eleven-poll retry exhaustion, and discovery/hello/final transitions. Five scenarios with explicit timeouts match the previous body for returns, status/error, poll ticks, protocol calls, allocation/free and nonce traces; the native comparison reproduces big-endian wait halfwords. The transition stub observes one configuration allocation overwritten, both before and after the reordering and consistent with the original allocation block. This existing behavior was preserved. Native verification does not assert instruction identity.
|
||||
|
||||
## Attempt coverage
|
||||
|
||||
Every baseline instruction residual has at least three distinct successful source trials. Failed and unchanged trials are excluded. Only function-name initial lines start a new count; labels beginning with "initial" remain attempts of their function.
|
||||
|
||||
- AOSS_81400E0C: 3 compiling trials.
|
||||
- AOSS_81401E80: 3 compiling trials.
|
||||
- AOSS_814013AC: 21 compiling trials.
|
||||
- AOSS_81400830: 12 compiling trials.
|
||||
- AOSS_81401778: 3 compiling trials.
|
||||
- AOSS_Init_old: 12 compiling trials.
|
||||
|
||||
## Remaining instruction residuals
|
||||
|
||||
| Function | objdiff % | Instructions (mine/original) | Evidence / remaining reason |
|
||||
|---|---:|---|---|
|
||||
| AOSS_Init_old | 73.34911 | 1494/1584 | initialization frame/alignment and remaining loop scheduling; 90 instructions short, including preserved initialized fallback for target r14 |
|
||||
| AOSS_81400830 | 93.84112 | 326/321 | RC4 cursor publication, payload/frame bindings and store/reload scheduling; five extra instructions |
|
||||
| AOSS_81400E0C | 100.0 | 190/190 | objdiff 100; gate/ctxdiff has cr1 address-normalization differences; raw bytes identical |
|
||||
| AOSS_814013AC | 98.77193 | 114/114 | response/flags/remaining-length pointer lifetimes and argument move order |
|
||||
| AOSS_81401778 | 79.13919 | 275/273 | hello RC4/CRC schedule, table/stack-field bindings; two extra instructions |
|
||||
| AOSS_81401E80 | 98.5034 | 147/147 | XOR loop scratch registers r3/r4/r5 cycle plus cr1 normalization; all saved registers and instruction count identical |
|
||||
|
||||
## Data audit
|
||||
|
||||
No artificial data objects or symbol names added. String pools are identical. These C units contain no vtables.
|
||||
|
||||
- .bss: mine 3496, original 3496 bytes; prefix mismatches 0/3496; extra alignment tail bytes 0, all zero True.
|
||||
- .data: mine 364, original 368 bytes; prefix mismatches 0/364; extra alignment tail bytes 4, all zero True.
|
||||
- .sdata2: mine 8, original 8 bytes; prefix mismatches 0/8; extra alignment tail bytes 0, all zero True.
|
||||
- .sdata: mine 24, original 24 bytes; prefix mismatches 0/24; extra alignment tail bytes 0, all zero True.
|
||||
- .sbss: mine 32, original 32 bytes; prefix mismatches 0/32; extra alignment tail bytes 0, all zero True.
|
||||
|
||||
AOSS_81400E0C raw .text bytes identical: True. SHA-256 mine 63ce5401f76a8449cd914634f600fd3410d63192a39e33e9b5f054b717a2dbee, original 63ce5401f76a8449cd914634f600fd3410d63192a39e33e9b5f054b717a2dbee. Raw bytes do not assert relocation identity. The gate instruction count remains authoritative.
|
||||
|
||||
Relocations at corresponding instruction offsets in objdiff-exact functions (observed mappings only, no object/config override):
|
||||
|
||||
- (('.sbss', 's_accessPointConfig', 4, 4, 0), ('.sbss', 'lbl_81698C74', 4, 4, 0))
|
||||
- (('.sbss', 's_accessPointList', 0, 4, 0), ('.sbss', 'lbl_81698C70', 0, 4, 0))
|
||||
- (('.sbss', 's_accessPointName', 8, 8, 0), ('.sbss', 'lbl_81698C78', 8, 8, 0))
|
||||
- (('.sbss', 's_connectionState', 16, 4, 0), ('.sbss', 'lbl_81698C80', 16, 4, 0))
|
||||
- (('.sbss', 's_errorCode', 20, 4, 0), ('.sbss', 'lbl_81698C84', 20, 4, 0))
|
||||
- (('.sbss', 's_responseBuffer', 28, 4, 0), ('.sbss', 'lbl_81698C8C', 28, 4, 0))
|
||||
- (('.sbss', 's_socketStarted', 24, 4, 0), ('.sbss', 'lbl_81698C88', 24, 4, 0))
|
||||
- (('.sdata', 's_manufacturer', 4, 6, 0), ('.sdata', 'lbl_81697204', 4, 6, 0))
|
||||
- (('.sdata', 's_socket', 0, 4, 0), ('.sdata', 'lbl_81697200', 0, 4, 0))
|
||||
|
||||
Data is not claimed 100%: AOSS .sbss symbol correspondence remains 42.857143%, despite all seven observed .sbss source globals now using the original offsets and identical physical bytes. Other AOSS data sections are 100%. Original extracted alignment tails are not synthesized.
|
||||
|
||||
Prior and current supplemental native verification PASS: KSA lengths 0/1/7/8/9/16/256/300; all 256 CRC rows; decryption/checksum rejection lengths 1/7/8/9/16/31/32/255/256/257; two-round vendor transform for eight even lengths 2..260 with three key lengths; hello packets for 64 encrypted/plain, active/broadcast, security-flag combinations against prior paired-loop behavior; request initialization preserves three network-order IDs and an eight-byte boundary canary; encryption flag is separate from progress state; three discovery error paths publish the error global; DHCP timeout clears config without altering response data, immediate host and cancellation paths. Decryption tests stub vendor/network conversion to isolate RC4; odd-length vendor-tail behavior is not claimed. All test harnesses are under /tmp.
|
||||
|
||||
Initialization uncertainty: original target AOSS_Init_old tests r14 at offset 0xa20 before its first assignment at 0xb2c in linear disassembly. The source keeps its existing initialized fallback; no undefined/uninitialized read was introduced to imitate this. Full initialization still differs and is not claimed exact.
|
||||
full build: ok
|
||||
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
[src/scene/setting/AOSS] pool: IDENTICAL
|
||||
[src/scene/setting/AOSS] objdiff: code 6436/16192 data 3896/3928 functions 16/21 fuzzy 87.5872 linked code 0
|
||||
[src/scene/setting/AOSS] instruction-exact functions: 15/21
|
||||
[src/scene/setting/AOSS] section .bss size 3496 match 100.0
|
||||
[src/scene/setting/AOSS] section .data size 368 match 100.0
|
||||
[src/scene/setting/AOSS] section .sbss size 32 match 42.857143
|
||||
[src/scene/setting/AOSS] section .sdata size 24 match 100.0
|
||||
[src/scene/setting/AOSS] section .sdata2 size 8 match 100.0
|
||||
[src/scene/setting/AOSS] section .text size 16192 match 87.587204
|
||||
[src/scene/setting/AOSS] below 100: AOSS_Init_old 73.34911
|
||||
[src/scene/setting/AOSS] below 100: AOSS_81400830 93.84112
|
||||
[src/scene/setting/AOSS] below 100: AOSS_814013AC 98.77193
|
||||
[src/scene/setting/AOSS] below 100: AOSS_81401778 79.13919
|
||||
[src/scene/setting/AOSS] below 100: AOSS_81401E80 98.5034
|
||||
[src/scene/setting/AOSS] baseline: code 6436/16192 data 3896 functions 16 fuzzy 69.3757
|
||||
regressions vs baseline: 0
|
||||
global matched_code_percent: 83.23489 -> 83.23489
|
||||
global fuzzy_match_percent: 96.70702 -> 96.80967
|
||||
global complete_code_percent: 58.19218 -> 58.19218
|
||||
global matched_data_percent: 89.93214 -> 89.93520
|
||||
forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
234
tools/decomp-assist/sol-med-round6-aterm.md
Normal file
234
tools/decomp-assist/sol-med-round6-aterm.md
Normal file
@@ -0,0 +1,234 @@
|
||||
# ATERM round 6 attempts
|
||||
|
||||
Baseline at 03ed29cc: instruction exact 11/26, code 6576/19204, data 18448/18864, fuzzy 90.81421.
|
||||
|
||||
Each distinct compiling source trial is measured and logged. Only higher scores are retained; unchanged and failed candidates do not count.
|
||||
|
||||
ATERM_81402FC0 initial 100.0%
|
||||
- checksum cursor increments after accumulation: 87.59259%; src 0x1fc base 0x21c insns 127/135; --- replace mine 5:6 base 5:6; M 5 mr r25, r3; B 5 mr r27, r3
|
||||
- success mode uses conditional value expression: 96.39259%; src 0x218 base 0x21c insns 134/135; --- replace mine 18:19 base 18:19; M 18 bge -3631; B 18 bge -3647
|
||||
- packet checksum length is named as a byte span: compile failed
|
||||
Retained objdiff-100 original; instruction residual is reported below
|
||||
|
||||
ATERM_81402E40 initial 99.791664%
|
||||
- checksum initialized after payload header call: 96.34375%; src 0x180 base 0x180 insns 96/96; diffs 9: [9, 10, 11, 12, 13, 14, 15, 47, 52]; 9 M mr r29, r7; B mr r3, r27
|
||||
- payload byte view initialized for header memset: 99.791664%; src 0x180 base 0x180 insns 96/96; diffs 4: [9, 10, 47, 52]; 9 M mr r29, r7; B mr r3, r27
|
||||
- payload header destination uses end view before checksum span: 99.791664%; src 0x180 base 0x180 insns 96/96; diffs 4: [9, 10, 47, 52]; 9 M mr r29, r7; B mr r3, r27
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81402FC0 initial 100.0%
|
||||
- checksum halfword widened only at comparison: 100.0%; src 0x21c base 0x21c insns 135/135; diffs 2: [18, 23]; 18 M bge -3631; B bge -3647
|
||||
Retained objdiff-100 original; instruction residual is reported below
|
||||
|
||||
ATERM_8140502C initial 99.565216%
|
||||
- round swaps share one full-scope temporary word: 98.62319%; src 0x228 base 0x228 insns 138/138; diffs 25: [10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]; 10 M mr r5, r31; B mr r4, r31
|
||||
- swap temporary declared before reversal indices: 98.62319%; src 0x228 base 0x228 insns 138/138; diffs 25: [10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]; 10 M mr r5, r31; B mr r4, r31
|
||||
- round swap traverses by named four-word span: 99.565216%; src 0x228 base 0x228 insns 138/138; diffs 11: [11, 15, 18, 20, 21, 24, 25, 28, 29, 33, 35]; 11 M slwi r6, r3, 2; B slwi r8, r3, 2
|
||||
Retained best candidate
|
||||
|
||||
ATERM_814033F0 initial 99.56204%
|
||||
- parser result declared before key view: 99.56204%; src 0x224 base 0x224 insns 137/137; diffs 11: [11, 65, 66, 81, 82, 85, 86, 96, 97, 98, 101]; 11 M li r23, 0; B li r22, 0
|
||||
- key view declared at option-loop scope: 99.56204%; src 0x224 base 0x224 insns 137/137; diffs 11: [11, 65, 66, 81, 82, 85, 86, 96, 97, 98, 101]; 11 M li r23, 0; B li r22, 0
|
||||
- zero parser result initialized immediately before option iteration: 97.66423%; src 0x224 base 0x224 insns 137/137; diffs 18: [7, 8, 9, 10, 11, 12, 13, 14, 65, 66, 81, 82, 85, 86, 96, 97, 98, 101]; 7 M bl 0; B li r24, 0
|
||||
Retained best candidate
|
||||
|
||||
ATERM_8140276C initial 99.166664%
|
||||
- current record view assigned after flags: 99.08046%; src 0x2b8 base 0x2b8 insns 174/174; diffs 28: [8, 9, 11, 12, 13, 18, 29, 30, 34, 41, 54, 60, 69, 70, 74, 82, 84, 87, 88, 89]; 8 M addi r27, r4, 4; B addi r31, r3, 4
|
||||
- both record views assigned after scalar declarations: 99.166664%; src 0x2b8 base 0x2b8 insns 174/174; diffs 27: [8, 11, 12, 13, 18, 29, 30, 34, 41, 54, 60, 69, 70, 74, 82, 84, 87, 88, 89, 90]; 8 M addi r20, r3, 4; B addi r31, r3, 4
|
||||
- fallback presence flags initialized in previous/current order: 99.05173%; src 0x2b8 base 0x2b8 insns 174/174; diffs 31: [8, 11, 12, 13, 18, 29, 30, 34, 41, 54, 60, 69, 70, 74, 82, 84, 87, 88, 89, 90]; 8 M addi r20, r3, 4; B addi r31, r3, 4
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81404844 initial 98.97436%
|
||||
- wrap loop scalars declared in block/round/pass order: 98.67522%; src 0x1d4 base 0x1d4 insns 117/117; diffs 24: [8, 18, 19, 27, 30, 36, 37, 38, 39, 40, 41, 42, 43, 45, 48, 54, 58, 60, 99, 100]; 8 M mr r24, r3; B mr r25, r3
|
||||
- wrap block offset declared before output view at loop scope: 98.67522%; src 0x1d4 base 0x1d4 insns 117/117; diffs 24: [8, 18, 19, 27, 30, 36, 37, 38, 39, 40, 41, 42, 43, 45, 48, 54, 58, 60, 99, 100]; 8 M mr r24, r3; B mr r25, r3
|
||||
- wrap count assigned before expanded key result: no source change; skipped
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81404BFC initial 98.94403%
|
||||
- first key word declared before expansion scratch word: 98.94403%; src 0x430 base 0x430 insns 268/268; diffs 49: [5, 7, 8, 10, 13, 14, 16, 19, 20, 22, 25, 26, 28, 30, 31, 32, 34, 45, 48, 49]; 5 M lbz r7, 6(r4); B lbz r7, 2(r4)
|
||||
- initial word declarations follow initial byte order: 98.75746%; src 0x430 base 0x430 insns 268/268; diffs 53: [5, 7, 8, 10, 13, 14, 16, 19, 20, 22, 25, 26, 28, 30, 31, 32, 34, 40, 41, 43]; 5 M lbz r7, 6(r4); B lbz r7, 2(r4)
|
||||
- initial word byte packing uses ordinary shift/add disjoint fields: 94.89552%; src 0x430 base 0x430 insns 268/268; diffs 68: [5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, 25, 26, 27, 28]; 5 M lbz r7, 6(r4); B lbz r7, 2(r4)
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81404844 initial 98.97436%
|
||||
- wrap computes pass contribution at function scope per iteration: compile failed
|
||||
Retained best candidate
|
||||
|
||||
ATERM_814021BC initial 96.61688%
|
||||
- interface configuration view assigned before its memset: 95.87013%; src 0x268 base 0x268 insns 154/154; diffs 52: [7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]; 7 M addi r3, r30, 0; B addi r30, r30, 0
|
||||
- IP configuration cleared through its aggregate field: 96.61688%; src 0x268 base 0x268 insns 154/154; diffs 54: [7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]; 7 M addi r3, r30, 0; B addi r30, r30, 0
|
||||
- converted host declared after typed config views: 96.61688%; src 0x268 base 0x268 insns 154/154; diffs 54: [7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]; 7 M addi r3, r30, 0; B addi r30, r30, 0
|
||||
Retained best candidate
|
||||
|
||||
ATERM_814031DC initial 90.766914%
|
||||
- MAC formatting uses bounded do-while loops: 90.22556%; src 0x20c base 0x214 insns 131/133; --- replace mine 47:48 base 47:49; M 47 beq 312; B 47 beq 320
|
||||
- MAC do-while terminates at equality: 90.22556%; src 0x20c base 0x214 insns 131/133; --- replace mine 47:48 base 47:49; M 47 beq 312; B 47 beq 320
|
||||
- MAC colon branch retains bounded unsigned traversal: 89.3985%; src 0x20c base 0x214 insns 131/133; --- replace mine 47:48 base 47:49; M 47 beq 312; B 47 beq 320
|
||||
Retained best candidate
|
||||
|
||||
ATERMi_AutoConfigThread initial 94.75%
|
||||
- completion state expresses ordinary equality selection: 94.0%; src 0xa0 base 0xa0 insns 40/40; diffs 9: [20, 21, 22, 23, 24, 26, 28, 29, 30]; 20 M nor r0, r3, r0; B nor r3, r3, r0
|
||||
- completion mask uses named unsigned difference: 82.725%; src 0xa0 base 0xa0 insns 40/40; diffs 9: [18, 19, 20, 21, 22, 23, 24, 25, 26]; 18 M addi r5, r31, -1; B addi r3, r31, -1
|
||||
- progress result loaded before completion fields are published: 94.3%; src 0xa0 base 0xa0 insns 40/40; diffs 6: [20, 22, 23, 29, 30, 31]; 20 M nor r0, r3, r0; B nor r3, r3, r0
|
||||
Retained best candidate
|
||||
|
||||
Scan allocation relocation correction: original instruction at function offset 0x98 references scan-limit .sdata offset 4, not buffer-size offset 8. Use gAtermScanLimit for scanBufferBytes, preserving the separate buffer-size global assigned by Start. objdiff 90.34981%.
|
||||
|
||||
ATERM_81402A24 initial 90.34981%
|
||||
- first descriptor view initialized once outside scanning loop: 92.357414%; src 0x410 base 0x41c insns 260/263; --- replace mine 6:7 base 6:7; M 6 li r25, 0; B 6 li r4, 0
|
||||
- SSID oversized branch before valid-length branch: 90.406845%; src 0x40c base 0x41c insns 259/263; --- replace mine 6:7 base 6:7; M 6 li r24, 0; B 6 li r4, 0
|
||||
- persistent descriptor view and original SSID branch direction: 92.41445%; src 0x410 base 0x41c insns 260/263; --- replace mine 6:7 base 6:7; M 6 li r25, 0; B 6 li r4, 0
|
||||
- scan pointer alignment uses signed integer address statements: 90.34981%; src 0x40c base 0x41c insns 259/263; --- replace mine 6:7 base 6:7; M 6 li r24, 0; B 6 li r4, 0
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81404844 initial 98.97436%
|
||||
- wrap pass contribution stored after block byte-view declaration: 98.97436%; src 0x1d4 base 0x1d4 insns 117/117; diffs 20: [8, 27, 30, 36, 38, 39, 40, 41, 42, 45, 48, 54, 58, 60, 99, 100, 101, 103, 104, 106]; 8 M mr r24, r3; B mr r25, r3
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81405ACC initial 88.583336%
|
||||
- MD5 byte copying uses explicit source/destination views: 74.416664%; src 0x21c base 0x240 insns 135/144; --- delete mine 5:6 base 5:5; M 5 mr r31, r4; --- insert mine 7:7 base 6:7
|
||||
- MD5 byte-view loops use indexed reads and writes: 72.854164%; src 0x228 base 0x240 insns 138/144; --- replace mine 15:16 base 15:16; M 15 rlwinm r7, r6, 0x1d, 0x1a, 0x1f; B 15 rlwinm r0, r6, 0x1d, 0x1a, 0x1f
|
||||
- MD5 byte-view source declared before destination: 74.729164%; src 0x21c base 0x240 insns 135/144; --- delete mine 5:6 base 5:5; M 5 mr r31, r4; --- insert mine 7:7 base 6:7
|
||||
Retained best candidate
|
||||
|
||||
Protocol record layout re-derived from target: original response header begins at pooled BSS 0x1498, the named ConfigurationResult.responseLength field; options begin at adjacent response buffer 0x14a0, authentication challenge at 0x1c98. Previous source incorrectly treated response buffer 0x14a0 as the header and shifted all these views by eight bytes. Correct typed header view and challenge access: 86.15353%; src 0xf30 base 0xedc insns 972/951.
|
||||
|
||||
Request-options pointer initializer corrected to response-buffer data start: .rela.sdata offset 0x28 now references named response buffer with addend zero, matching the original rather than eight. No new storage or address symbols.
|
||||
|
||||
ATERM_814038C8 initial 86.15353%
|
||||
- protocol uses SDK millisecond/tick conversions: 86.15353%; src 0xf30 base 0xedc insns 972/951; --- delete mine 5:6 base 5:5; M 5 lis r3, 0; --- replace mine 7:9 base 6:8
|
||||
- packet buffer uses named aggregate field at each call: 86.57519%; src 0xf34 base 0xedc insns 973/951; --- delete mine 5:6 base 5:5; M 5 lis r26, 0; --- replace mine 7:9 base 6:8
|
||||
- protocol callbacks reuse one function-scope progress record: 86.11672%; src 0xf30 base 0xedc insns 972/951; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x160(r1); B 0 stwu r1, -0x180(r1)
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81405254 initial 61.94834%
|
||||
- AES initial byte packing uses ordered big-endian XOR fields: 61.98524%; src 0x43c base 0x43c insns 271/271; diffs 191: [24, 26, 28, 30, 32, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50]; 24 M slwi r7, r7, 0x18; B srawi r30, r4, 1
|
||||
- AES state initialization follows reverse word order: 57.701107%; src 0x43c base 0x43c insns 271/271; diffs 234: [5, 7, 9, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29]; 5 M lbz r12, 0xa(r5); B lbz r12, 6(r5)
|
||||
- AES round-table declarations precede state initialization: 62.110703%; src 0x43c base 0x43c insns 271/271; diffs 214: [12, 13, 18, 20, 24, 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41]; 12 M slwi r21, r11, 0x18; B slwi r22, r11, 0x18
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81405690 initial 59.273064%
|
||||
- AES initial byte packing uses ordered big-endian XOR fields: 59.309963%; src 0x43c base 0x43c insns 271/271; diffs 199: [24, 26, 28, 30, 32, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50]; 24 M slwi r7, r7, 0x18; B srawi r30, r4, 1
|
||||
- AES state initialization follows reverse word order: 55.671585%; src 0x43c base 0x43c insns 271/271; diffs 239: [5, 7, 9, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29]; 5 M lbz r12, 0xa(r5); B lbz r12, 6(r5)
|
||||
- AES round-table declarations precede state initialization: 57.1845%; src 0x43c base 0x43c insns 271/271; diffs 220: [12, 13, 18, 20, 24, 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41]; 12 M slwi r21, r11, 0x18; B slwi r22, r11, 0x18
|
||||
Retained best candidate
|
||||
|
||||
Scan-settings clear extent: target case 7 clears 0x254 bytes, while extracted global occupies 0x258. Reducing inferred trailing field from 0x14 to 0x10 regressed pooled BSS correspondence from 100 to 50% and was reverted. Keep existing object layout, use original explicit 0x254 clear length. No symbol sizes changed.
|
||||
|
||||
ATERMi_AutoConfigThread initial 94.75%
|
||||
- completion NOR expression consumed directly by signed state arithmetic: 94.75%; src 0xa0 base 0xa0 insns 40/40; diffs 3: [20, 22, 23]; 20 M nor r0, r3, r0; B nor r3, r3, r0
|
||||
- completion mask uses De Morgan intersection of complements: 77.725%; src 0xa4 base 0xa0 insns 41/40; --- replace mine 18:19 base 18:21; M 18 addi r0, r31, -1; B 18 addi r3, r31, -1
|
||||
- signed completion mask retains arithmetic shift type: compile failed
|
||||
Retained best candidate
|
||||
|
||||
Data checkpoint regression diagnosed: replacing the early response-global view removed its first genuine function reference, so file IPA emitted OSThread before the response buffer. Corrected session-key view uses the response global at its original encrypted-option capacity 0x7f8, with a named session union member. Union storage size is unchanged; the field is used for the real session key. This restores early response-global usage and preserves physical BSS object order without dummy references or padding.
|
||||
|
||||
Stable corrected layout checkpoint PASS: code 6576/19204, data 18504/18864, fuzzy 91.468864, instruction exact 11/26, regressions 0. .bss, .rodata, .sdata and .sdata2 all 100%; .sdata initializer relocation now exact.
|
||||
|
||||
Native behavior verification PASS: AES-128/192/256 encrypt/decrypt, MD5 boundary lengths 0/1/3/55/56/64/130, scan-list fallback/security/empty transitions and normalized MAC association formatting. Typed protocol-header/options/challenge/digest/session offsets and 0x254 scan-clear boundary verified in a contiguous module-layout test. These native checks do not assert instruction identity.
|
||||
|
||||
## Attempt coverage
|
||||
|
||||
Every baseline instruction residual has at least three distinct successful source trials. Failed and unchanged trials are excluded. Only function-name initial lines start a new count; labels beginning with "initial" remain attempts of their function.
|
||||
|
||||
- ATERM_81402FC0: 3 compiling trials.
|
||||
- ATERM_81402E40: 3 compiling trials.
|
||||
- ATERM_8140502C: 3 compiling trials.
|
||||
- ATERM_814033F0: 3 compiling trials.
|
||||
- ATERM_8140276C: 3 compiling trials.
|
||||
- ATERM_81404844: 3 compiling trials.
|
||||
- ATERM_81404BFC: 3 compiling trials.
|
||||
- ATERM_814021BC: 3 compiling trials.
|
||||
- ATERM_814031DC: 3 compiling trials.
|
||||
- ATERMi_AutoConfigThread: 5 compiling trials.
|
||||
- ATERM_81402A24: 4 compiling trials.
|
||||
- ATERM_81405ACC: 3 compiling trials.
|
||||
- ATERM_814038C8: 3 compiling trials.
|
||||
- ATERM_81405254: 3 compiling trials.
|
||||
- ATERM_81405690: 3 compiling trials.
|
||||
|
||||
## Remaining instruction residuals
|
||||
|
||||
| Function | objdiff % | Instructions (mine/original) | Evidence / remaining reason |
|
||||
|---|---:|---|---|
|
||||
| ATERM_814021BC | 96.61688 | 154/154 | settings aggregate base-address scheduling and temporary register allocation |
|
||||
| ATERM_8140276C | 99.166664 | 174/174 | current/previous record and fallback flag register cycles |
|
||||
| ATERM_81402A24 | 92.41445 | 260/263 | scan descriptor-view scheduling, alignment expression and MAC-loop guard; three instructions short |
|
||||
| ATERM_81402E40 | 99.791664 | 96/96 | two argument-move ordering differences plus two cr1 normalization differences |
|
||||
| ATERM_81402FC0 | 100.0 | 135/135 | objdiff 100; gate/ctxdiff has two cr1 address-normalization differences; raw bytes identical |
|
||||
| ATERM_814031DC | 90.766914 | 129/133 | explicit terminal MAC break versus original CTR loop; four instructions short |
|
||||
| ATERM_814033F0 | 99.56204 | 137/137 | result/key pointer register cycle |
|
||||
| ATERM_814038C8 | 85.933754 | 978/951 | protocol frame and option/authentication loop scheduling; corrected response/session buffer views; frame and option/authentication scheduling still differ |
|
||||
| ATERMi_AutoConfigThread | 94.75 | 40/40 | NOR mask temporary and result-load scheduling |
|
||||
| ATERM_81404844 | 98.97436 | 117/117 | wrap pass/block/output/byte-offset register allocation |
|
||||
| ATERM_81404BFC | 98.94403 | 268/268 | initial key byte-load order and AES-128 substitution view allocation |
|
||||
| ATERM_8140502C | 99.565216 | 138/138 | round-reversal index/swap register allocation |
|
||||
| ATERM_81405254 | 62.110703 | 271/271 | AES input, round and final XOR scheduling/register allocation; instruction count now identical |
|
||||
| ATERM_81405690 | 59.309963 | 271/271 | inverse AES input, round and final XOR scheduling/register allocation; instruction count now identical |
|
||||
| ATERM_81405ACC | 88.583336 | 139/144 | MD5 input-copy guards and state/index scheduling; five instructions short |
|
||||
|
||||
## Data audit
|
||||
|
||||
No artificial data objects or symbol names added. String pools are identical. These C units contain no vtables.
|
||||
|
||||
- .bss: mine 8144, original 8160 bytes; prefix mismatches 0/8144; extra alignment tail bytes 16, all zero True.
|
||||
- .rodata: mine 10280, original 10280 bytes; prefix mismatches 0/10280; extra alignment tail bytes 0, all zero True.
|
||||
- .data: mine 280, original 280 bytes; prefix mismatches 0/280; extra alignment tail bytes 0, all zero True.
|
||||
- .sdata2: mine 7, original 8 bytes; prefix mismatches 0/7; extra alignment tail bytes 1, all zero True.
|
||||
- .sdata: mine 53, original 56 bytes; prefix mismatches 0/53; extra alignment tail bytes 3, all zero True.
|
||||
- .sbss: mine 80, original 80 bytes; prefix mismatches 0/80; extra alignment tail bytes 0, all zero True.
|
||||
|
||||
ATERM_81402FC0 raw .text bytes identical: True. SHA-256 mine 91a60a7585553b8702d6f6ff83d5a91eedfd3cbaf3a04fb25501c637a6f84acd, original 91a60a7585553b8702d6f6ff83d5a91eedfd3cbaf3a04fb25501c637a6f84acd. Raw bytes do not assert relocation identity. The gate instruction count remains authoritative.
|
||||
|
||||
Relocations at corresponding instruction offsets in objdiff-exact functions (observed mappings only, no object/config override):
|
||||
|
||||
- (('.sbss', 'gAtermAllocate', 12, 4, 0), ('.sbss', 'lbl_81698C9C', 12, 4, 0))
|
||||
- (('.sbss', 'gAtermAllocation', 20, 4, 0), ('.sbss', 'lbl_81698CA4', 20, 4, 0))
|
||||
- (('.sbss', 'gAtermCancelRequested', 76, 4, 0), ('.sbss', 'lbl_81698CDC', 76, 4, 0))
|
||||
- (('.sbss', 'gAtermProgressCallback', 8, 4, 0), ('.sbss', 'lbl_81698C98', 8, 4, 0))
|
||||
- (('.sbss', 'gAtermRelease', 16, 4, 0), ('.sbss', 'lbl_81698CA0', 16, 4, 0))
|
||||
- (('.sbss', 'gAtermResult', 4, 4, 0), ('.sbss', 'lbl_81698C94', 4, 4, 0))
|
||||
- (('.sbss', 'gAtermState', 0, 4, 0), ('.sbss', 'lbl_81698C90', 0, 4, 0))
|
||||
- (('.sbss', 'gAtermThreadStarted', 24, 4, 0), ('.sbss', 'lbl_81698CA8', 24, 4, 0))
|
||||
- (('.sdata', 'gAtermDeadline', 0, 4, 0), ('.sdata', 'lbl_81697218', 0, 4, 0))
|
||||
- (('.sdata', 'gAtermScanBufferSize', 8, 4, 0), ('.sdata', 'lbl_81697220', 8, 4, 0))
|
||||
- (('.sdata', 'gAtermScanLimit', 4, 4, 0), ('.sdata', 'lbl_8169721C', 4, 4, 0))
|
||||
|
||||
Data is not claimed 100%: ATERM switch-table and anonymous small-BSS symbol mappings remain incomplete; initialized .sdata is now 100%. Original extracted alignment tails are not synthesized.
|
||||
|
||||
Supplemental native verification PASS: AES-128/192/256 encrypt/decrypt, MD5 lengths 0/1/3/55/56/64/130, scan-list fallback/reset transitions, normalized BSSID and six-byte MAC formatting. Native verification checks behavior; the MWCC/object gate checks matching.
|
||||
full build: ok
|
||||
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
[src/scene/setting/ATERM] pool: IDENTICAL
|
||||
[src/scene/setting/ATERM] objdiff: code 6576/19204 data 18504/18864 functions 12/26 fuzzy 91.4689 linked code 0
|
||||
[src/scene/setting/ATERM] instruction-exact functions: 11/26
|
||||
[src/scene/setting/ATERM] section .bss size 8160 match 100.0
|
||||
[src/scene/setting/ATERM] section .data size 280 match None
|
||||
[src/scene/setting/ATERM] section .rodata size 10280 match 100.0
|
||||
[src/scene/setting/ATERM] section .sbss size 80 match 38.88889
|
||||
[src/scene/setting/ATERM] section .sdata size 56 match 100.0
|
||||
[src/scene/setting/ATERM] section .sdata2 size 8 match 100.0
|
||||
[src/scene/setting/ATERM] section .text size 19204 match 91.468864
|
||||
[src/scene/setting/ATERM] below 100: ATERM_814021BC 96.61688
|
||||
[src/scene/setting/ATERM] below 100: ATERM_8140276C 99.166664
|
||||
[src/scene/setting/ATERM] below 100: ATERM_81402A24 92.41445
|
||||
[src/scene/setting/ATERM] below 100: ATERM_81402E40 99.791664
|
||||
[src/scene/setting/ATERM] below 100: ATERM_814031DC 90.766914
|
||||
[src/scene/setting/ATERM] below 100: ATERM_814033F0 99.56204
|
||||
[src/scene/setting/ATERM] below 100: ATERM_814038C8 85.933754
|
||||
[src/scene/setting/ATERM] below 100: ATERMi_AutoConfigThread 94.75
|
||||
[src/scene/setting/ATERM] below 100: ATERM_81404844 98.97436
|
||||
[src/scene/setting/ATERM] below 100: ATERM_81404BFC 98.94403
|
||||
[src/scene/setting/ATERM] below 100: ATERM_8140502C 99.565216
|
||||
[src/scene/setting/ATERM] below 100: ATERM_81405254 62.110703
|
||||
[src/scene/setting/ATERM] below 100: ATERM_81405690 59.309963
|
||||
[src/scene/setting/ATERM] below 100: ATERM_81405ACC 88.583336
|
||||
[src/scene/setting/ATERM] baseline: code 6576/19204 data 18448 functions 12 fuzzy 90.8142
|
||||
regressions vs baseline: 0
|
||||
global matched_code_percent: 83.23489 -> 83.23489
|
||||
global fuzzy_match_percent: 96.70702 -> 96.71121
|
||||
global complete_code_percent: 58.19218 -> 58.19218
|
||||
global matched_data_percent: 89.93214 -> 89.93520
|
||||
forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
Reference in New Issue
Block a user