Compare commits
1 Commits
cleanup/ip
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2665bca24 |
@@ -53,7 +53,7 @@ Progress
|
||||
<!-- progress:start -->
|
||||
| Decompiled | Matched | Linked | Data |
|
||||
|:---:|:---:|:---:|:---:|
|
||||
| 93.26% | 82.03% | 57.21% | 89.10% |
|
||||
| 93.35% | 82.03% | 57.21% | 89.10% |
|
||||
|
||||
units 768/1027 complete, functions 11879/12563 matched.
|
||||
|
||||
|
||||
326
agent/sol-med-round2.md
Normal file
326
agent/sol-med-round2.md
Normal file
@@ -0,0 +1,326 @@
|
||||
# ATERM and AOSS continuation
|
||||
|
||||
Baseline ATERM: 5/26, code 1108/19204, data 18440/18864, fuzzy 50.973755. Baseline AOSS: 8/21, code 2764/16192, data 3896/3928, fuzzy 63.720604. All functions have bodies; existing large state machine and crypto bodies remain incomplete reconstructions. No absent symbols or empty bodies found.
|
||||
|
||||
ATERM_8140276C initial 92.10345%
|
||||
- previous cursor declaration before current cursor: no source change; skipped
|
||||
- signed record indices: 92.10345%; src 0x2ac base 0x2b8 insns 171/174; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x90(r1); B 0 stwu r1, -0x80(r1)
|
||||
- AOSS flags initialized after clear: 91.72988%; src 0x2ac base 0x2b8 insns 171/174; --- replace mine 5:10 base 5:13; M 5 mr r25, r3; M 6 mr r26, r4
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81402A24 initial 72.47529%
|
||||
- record byte count kept signed: no source change; skipped
|
||||
- allocate nullable buffers before handling failure: 72.380226%; src 0x3cc base 0x41c insns 243/263; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x80(r1); B 0 stwu r1, -0x90(r1)
|
||||
- multiply-high tick conversion: 75.76426%; src 0x3f4 base 0x41c insns 253/263; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x80(r1); B 0 stwu r1, -0x90(r1)
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81402E40 initial 99.791664%
|
||||
- payload clear through byte alias: 99.791664%; src 0x180 base 0x180 insns 96/96; diffs 4: [9, 10, 47, 52]; 9 M mr r29, r7; B mr r3, r27
|
||||
- natural checksum loop: 65.208336%; src 0x108 base 0x180 insns 66/96; --- replace mine 5:12 base 5:12; M 5 mr r28, r5; M 6 mr r26, r3
|
||||
- end length as packet byte extent: 95.572914%; src 0x180 base 0x180 insns 96/96; diffs 6: [9, 10, 42, 44, 47, 52]; 9 M mr r29, r7; B mr r3, r27
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81402FC0 initial 67.28148%
|
||||
- full-width checksum accumulator: 64.76296%; src 0x20c base 0x21c insns 131/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- replace mine 9:10 base 10:11
|
||||
- bottom-tested option loop: compile failed
|
||||
- early return for bad checksum: 66.94074%; src 0x20c base 0x21c insns 131/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- replace mine 9:10 base 10:11
|
||||
Retained best candidate
|
||||
|
||||
ATERM_814031DC initial 85.7218%
|
||||
- MAC text uses equal-sized buffers: 85.766914%; src 0x1f4 base 0x214 insns 125/133; --- replace mine 47:48 base 47:48; M 47 beq 288; B 47 beq 320
|
||||
- nibble conversion advances output cursor: 84.293236%; src 0x204 base 0x214 insns 129/133; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x70(r1); B 0 stwu r1, -0x60(r1)
|
||||
- inclusive digit bound and pointer-based MAC scan: 85.90225%; src 0x1f4 base 0x214 insns 125/133; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x70(r1); B 0 stwu r1, -0x60(r1)
|
||||
Retained best candidate
|
||||
|
||||
ATERM_814033F0 initial 65.868614%
|
||||
- option fields retain converted word width: 67.39416%; src 0x214 base 0x224 insns 133/137; --- replace mine 5:6 base 5:6; M 5 addi r30, r3, 8; B 5 addi r29, r3, 8
|
||||
- bottom-tested parser dispatch: 65.79562%; src 0x21c base 0x224 insns 135/137; --- replace mine 5:6 base 5:6; M 5 addi r28, r3, 8; B 5 addi r29, r3, 8
|
||||
- signed nibble comparisons: 65.32117%; src 0x21c base 0x224 insns 135/137; --- insert mine 7:7 base 7:8; B 7 li r24, 0; --- replace mine 10:29 base 11:17
|
||||
Retained best candidate
|
||||
|
||||
ATERM_814036D8 initial 73.92742%
|
||||
- security switch matches original decision tree: 85.22581%; src 0x1ec base 0x1f0 insns 123/124; --- replace mine 14:15 base 14:15; M 14 beq 340; B 14 beq 344
|
||||
- key text passed through one cursor: 87.0%; src 0x1e4 base 0x1f0 insns 121/124; --- replace mine 14:24 base 14:16; M 14 bne 36; M 15 addi r3, r25, 0
|
||||
- counted loop over key records: 73.92742%; src 0x1e0 base 0x1f0 insns 120/124; --- replace mine 14:24 base 14:16; M 14 bne 36; M 15 addi r3, r25, 0
|
||||
Retained best candidate
|
||||
|
||||
ATERM_814038C8 initial 35.28917%
|
||||
- one-shot 500ms wait replaces repeated alarm: 35.700314%; src 0x788 base 0xedc insns 482/951; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0xe0(r1); B 0 stwu r1, -0x180(r1)
|
||||
- bottom-tested state machine and wait buffer order: 35.288116%; src 0x784 base 0xedc insns 481/951; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0xe0(r1); B 0 stwu r1, -0x180(r1)
|
||||
- progress uses semantic structure: 35.28917%; src 0x784 base 0xedc insns 481/951; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0xe0(r1); B 0 stwu r1, -0x180(r1)
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81404844 initial 19.615385%
|
||||
- complete RFC3394 block handling with target initial value and byte counter: 89.89744%; src 0x1bc base 0x1d4 insns 111/117; --- replace mine 6:13 base 6:13; M 6 lwz r8, 0(0); M 7 lwz r0, 0(0)
|
||||
- hoist signed pass product outside block loop: 89.89744%; src 0x1bc base 0x1d4 insns 111/117; --- replace mine 6:13 base 6:13; M 6 lwz r8, 0(0); M 7 lwz r0, 0(0)
|
||||
- natural bytewise counter XOR loop: 62.299145%; src 0x178 base 0x1d4 insns 94/117; --- replace mine 6:13 base 6:13; M 6 lwz r8, 0(0); M 7 lwz r0, 0(0)
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81404A18 initial 51.107437%
|
||||
- complete RFC3394 block handling with target initial value and byte counter: 74.38843%; src 0x1c0 base 0x1e4 insns 112/121; --- replace mine 6:13 base 6:14; M 6 lwz r8, 0(0); M 7 lwz r0, 0(0)
|
||||
- hoist signed pass product outside block loop: 74.38843%; src 0x1c0 base 0x1e4 insns 112/121; --- replace mine 6:13 base 6:14; M 6 lwz r8, 0(0); M 7 lwz r0, 0(0)
|
||||
- natural bytewise counter XOR loop: 55.96694%; src 0x180 base 0x1e4 insns 96/121; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x190(r1); B 0 stwu r1, -0x1a0(r1)
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81404BFC initial 36.869404%
|
||||
- complete AES schedules with bounded final expansion for all three key sizes: 52.50746%; src 0x408 base 0x430 insns 258/268; --- replace mine 0:6 base 0:20; M 0 lbz r7, 1(r4); M 1 cmplwi r5, 0x80
|
||||
- direct expanded-key parameter used as advancing cursor: 52.50746%; src 0x408 base 0x430 insns 258/268; --- replace mine 0:6 base 0:20; M 0 lbz r7, 1(r4); M 1 cmplwi r5, 0x80
|
||||
- round limit at loop bottom for 128-bit key: 53.074627%; src 0x404 base 0x430 insns 257/268; --- replace mine 0:6 base 0:20; M 0 lbz r7, 1(r4); M 1 cmplwi r5, 0x80
|
||||
Retained best candidate
|
||||
|
||||
ATERM_8140502C initial 35.666668%
|
||||
- interleaved key-word swaps: 42.355072%; src 0x280 base 0x228 insns 160/138; --- insert mine 5:5 base 5:8; B 5 stw r30, 8(r1); B 6 lis r30, 0
|
||||
- signed indexed round reversal: 38.746376%; src 0x290 base 0x228 insns 164/138; --- insert mine 5:5 base 5:8; B 5 stw r30, 8(r1); B 6 lis r30, 0
|
||||
- counted transformation loop: 11.731884%; src 0x288 base 0x228 insns 162/138; --- insert mine 5:5 base 5:8; B 5 stw r30, 8(r1); B 6 lis r30, 0
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81405254 initial 30.464945%
|
||||
- AES byte assembly uses XOR: 34.23247%; src 0x3c4 base 0x43c insns 241/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
- two-round loop with final round exit: compile failed
|
||||
- signed round count with separately combined key XOR: compile failed
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81405690 initial 26.601477%
|
||||
- AES byte assembly uses XOR: 34.64945%; src 0x3d4 base 0x43c insns 245/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
- two-round loop with final round exit: compile failed
|
||||
- signed round count with separately combined key XOR: compile failed
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81405254 initial 34.23247%
|
||||
- two-round AES loop with final round exit matching target structure: 16.295202%; src 0x4a8 base 0x43c insns 298/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
- signed remaining round-pair count: 16.295202%; src 0x4a8 base 0x43c insns 298/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
- separate round exit before key advancement: 17.630997%; src 0x4a8 base 0x43c insns 298/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81405690 initial 34.64945%
|
||||
- two-round AES loop with final round exit matching target structure: 33.738007%; src 0x4c8 base 0x43c insns 306/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
- signed remaining round-pair count: 33.738007%; src 0x4c8 base 0x43c insns 306/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
- separate round exit before key advancement: 31.90037%; src 0x4c8 base 0x43c insns 306/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81405D0C initial 32.62639%
|
||||
- complete MD5 accumulator rotation with per-step argument-relative selectors: 53.851387%; src 0xa50 base 0xb40 insns 660/720; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x90(r1); B 0 stwu r1, -0xa0(r1)
|
||||
- MD5 selectors expressed as XOR masks: 44.879166%; src 0xa48 base 0xb40 insns 658/720; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x90(r1); B 0 stwu r1, -0xa0(r1)
|
||||
- natural sixteen-word little-endian block decode: 47.679165%; src 0x970 base 0xb40 insns 604/720; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x90(r1); B 0 stwu r1, -0xa0(r1)
|
||||
Retained best candidate
|
||||
|
||||
ATERMi_ApConfigGetState initial 99.42857%
|
||||
- read bus clock before current time call: 72.942856%; src 0x94 base 0x8c insns 37/35; --- replace mine 4:6 base 4:5; M 4 stw r30, 8(r1); M 5 mr r30, r3
|
||||
- direct timer division using clock conversion expression: 99.42857%; src 0x8c base 0x8c insns 35/35; diffs 3: [17, 18, 20]; 17 M lwz r6, 0xf8(r6); B lwz r0, 0xf8(r6)
|
||||
- timer load narrowed to native clock register width: 99.42857%; src 0x8c base 0x8c insns 35/35; diffs 4: [15, 16, 17, 18]; 15 M lis r5, -0x8000; B lis r6, -0x8000
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81402E40 initial 99.791664%
|
||||
- checksum terminal pointer declared before byte length: 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 encryption size retained as signed integer: 99.791664%; src 0x180 base 0x180 insns 96/96; diffs 4: [9, 10, 47, 52]; 9 M mr r29, r7; B mr r3, r27
|
||||
- end pointer assigned only after header conversion: 94.947914%; src 0x180 base 0x180 insns 96/96; diffs 8: [9, 10, 42, 44, 45, 46, 47, 52]; 9 M mr r29, r7; B mr r3, r27
|
||||
Retained best candidate
|
||||
|
||||
ATERMi_AutoConfigThread initial 94.6%
|
||||
- callback progress uses three-field structure: 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
|
||||
- signed completion state mask in correctly sized progress buffer: 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
|
||||
- explicit completion state branch in progress structure: 85.25%; src 0x9c base 0xa0 insns 39/40; --- replace mine 18:21 base 18:22; M 18 addi r0, r31, -1; M 19 li r5, -1
|
||||
Retained best candidate
|
||||
|
||||
ATERM_814021BC initial 67.655846%
|
||||
- interface configuration pointer initialized before IP setup: 64.266235%; src 0x264 base 0x268 insns 153/154; --- replace mine 7:8 base 7:8; M 7 addi r28, r30, 0; B 7 addi r30, r30, 0
|
||||
- wait queue message and buffer order follows target stack slots: 67.64286%; src 0x264 base 0x268 insns 153/154; --- insert mine 7:7 base 7:9; B 7 addi r30, r30, 0; B 8 li r4, 0
|
||||
- host wait expressed as while with shared converted host value: 92.77922%; src 0x274 base 0x268 insns 157/154; --- replace mine 5:8 base 5:8; M 5 lis r31, 0; M 6 li r28, 0
|
||||
Retained best candidate
|
||||
|
||||
ATERM_8140276C initial 92.10345%
|
||||
- previous-record cursor reset at outer loop tail and scoped fallback flags: 94.04023%; src 0x2b0 base 0x2b8 insns 172/174; --- replace mine 5:11 base 5:13; M 5 mr r25, r3; M 6 mr r26, r4
|
||||
- previous record initialized before current record: 94.0115%; src 0x2b0 base 0x2b8 insns 172/174; --- replace mine 5:11 base 5:13; M 5 mr r25, r3; M 6 mr r26, r4
|
||||
- fallback flags set after SSID clear: 94.04023%; src 0x2b0 base 0x2b8 insns 172/174; --- replace mine 5:11 base 5:13; M 5 mr r25, r3; M 6 mr r26, r4
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81405ACC initial 0%
|
||||
- complete two-phase update copy with target eight-byte group bounds: 55.54861%; src 0x21c base 0x240 insns 135/144; --- insert mine 2:2 base 2:3; B 2 slwi r7, r5, 3; --- replace mine 3:7 base 4:10
|
||||
- signed byte-copy loop cursors: 55.54861%; src 0x21c base 0x240 insns 135/144; --- insert mine 2:2 base 2:3; B 2 slwi r7, r5, 3; --- replace mine 3:7 base 4:10
|
||||
- cursor-pair copies instead of repeated indexed addresses: 55.54861%; src 0x21c base 0x240 insns 135/144; --- insert mine 2:2 base 2:3; B 2 slwi r7, r5, 3; --- replace mine 3:7 base 4:10
|
||||
Retained best candidate
|
||||
Retained complete update implementation: objdiff 55.54861%, 135/144 instructions. Older source had no reported function score; no exact claim.
|
||||
|
||||
ATERMi_ApConfigStart initial 86.49515%
|
||||
- allocate via stored callback: 86.49515%; src 0x1a4 base 0x19c insns 105/103; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x30(r1); B 0 stwu r1, -0x20(r1)
|
||||
- tick multiplier commutes operands: 84.11651%; src 0x1a4 base 0x19c insns 105/103; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x30(r1); B 0 stwu r1, -0x20(r1)
|
||||
- progress callback loaded from installed function pointer: 93.718445%; src 0x1a0 base 0x19c insns 104/103; --- delete mine 4:5 base 4:4; M 4 mr r31, r3; --- replace mine 6:7 base 5:6
|
||||
Retained best candidate
|
||||
|
||||
ATERMi_ApConfigEnd initial 87.54263%
|
||||
- message queues declared within their wait scopes: 85.496124%; src 0x1dc base 0x204 insns 119/129; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0xe0; M 4 bl 0
|
||||
- join loop expressed as do-while: 85.28682%; src 0x1e8 base 0x204 insns 122/129; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0xe0; M 4 bl 0
|
||||
- time conversion evaluated directly: 87.54263%; src 0x1dc base 0x204 insns 119/129; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0xe0; M 4 bl 0
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81402FC0 initial 67.28148%
|
||||
- signed option payload cursor length: no source change; skipped
|
||||
- checksum receive pointer read after length decode: 67.28148%; src 0x210 base 0x21c insns 132/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- replace mine 9:10 base 10:11
|
||||
- option traversal explicit continuation: 67.28148%; src 0x210 base 0x21c insns 132/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- replace mine 9:10 base 10:11
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81402A24 initial 75.76426%
|
||||
- record allocation size held as size_t: no source change; skipped
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81402FC0 initial 67.28148%
|
||||
- packet and option values stay full-width until usage: 68.577774%; src 0x208 base 0x21c insns 130/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- delete mine 15:16 base 16:16
|
||||
- full-width checksum accumulated before explicit final narrowing: 67.28148%; src 0x210 base 0x21c insns 132/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- replace mine 9:10 base 10:11
|
||||
- option lengths retained as signed word count: 67.28148%; src 0x210 base 0x21c insns 132/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- replace mine 9:10 base 10:11
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81402A24 initial 75.76426%
|
||||
- record allocation byte count stored in size_t: 75.76426%; src 0x3f4 base 0x41c insns 253/263; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x80(r1); B 0 stwu r1, -0x90(r1)
|
||||
- iteration counter narrowed to signed timer range: 76.20532%; src 0x3f4 base 0x41c insns 253/263; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x80(r1); B 0 stwu r1, -0x90(r1)
|
||||
- record pointer walk and indexed record walk share cursor: 75.76426%; src 0x3f4 base 0x41c insns 253/263; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x80(r1); B 0 stwu r1, -0x90(r1)
|
||||
Retained best candidate
|
||||
|
||||
ATERM reconstruction evidence: all 26 target function names have source bodies. Reconstructed RFC3394 wrap/unwrap initial value, signed counters, block writeback and unwrap ordering; corrected all three AES key schedules; corrected MD5 per-step accumulator/selector semantics and low/high bit counts; reconstructed the missing authentication timestamp digest and protocol option-id bytes in the main state machine. These are partial instruction matches, not completion.
|
||||
Native validation of extracted unchanged crypto implementations: NIST AES 128/192/256 encryption and decryption vectors passed. MD5 messages of length 0, 1, 3, 55, 56, 64, 130 matched hashlib. Native correctness is supplemental evidence only; MWCC objdiff remains the matching authority.
|
||||
Data attempts: ordinary local option-id initialization restored the real seven-byte constant sequence; .sdata2 reached 100%. Genuine MD5 fill array emitted locally, then as an ordinary named global after the state-machine function to preserve jump-table/source order. .data remains incomplete because the three generated jump tables still differ. AES tables and round constants remain byte-identical .rodata.
|
||||
Data attempt: restored the genuine request-options pointer initializer shown in target .sdata; it completed .sdata but moved the response buffer before the thread in .bss and caused objdiff .bss 100 -> 83.33333 and a matched-data regression. Tried source declaration order, original thread name, and original section-aligned network buffer declaration; none passed the regression gate. Restored the pointer attempt and kept the existing BSS layout. No artificial padding, address symbols, or forced sections retained. .sdata and .sbss remain open.
|
||||
|
||||
Initial AOSS trial batch failed to compile because of a mistaken message-length field name in the packet dispatcher; corrected the field and reran all trials successfully. Failed batch not counted as attempts.
|
||||
|
||||
AOSS_Init_old initial 28.42298%
|
||||
- full-width wait counters instead of narrowing every update: 28.546717%; 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
|
||||
- packet length conversion retains full width: 28.42298%; src 0x1794 base 0x18c0 insns 1509/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
- poll arguments given semantic socket events structure: 28.42298%; src 0x1794 base 0x18c0 insns 1509/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
Retained best candidate
|
||||
|
||||
AOSS_813FFD68 initial 96.981735%
|
||||
- validation loops use signed char: 93.69406%; src 0x364 base 0x36c insns 217/219; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- return failure immediately on invalid character: 82.05023%; src 0x2ec base 0x36c insns 187/219; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- ascending validation cursor loop: 94.76712%; src 0x374 base 0x36c insns 221/219; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
Retained best candidate
|
||||
|
||||
AOSS_814001B4 initial 88.78481%
|
||||
- converted packet length stays full width: 88.78481%; src 0x12c base 0x13c insns 75/79; --- replace mine 3:5 base 3:10; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- direct opcode return cases: 83.27848%; src 0x124 base 0x13c insns 73/79; --- replace mine 3:5 base 3:10; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- full-width validation and branch nesting: no source change; skipped
|
||||
Retained best candidate
|
||||
|
||||
AOSS_814002F0 initial 79.525%
|
||||
- read manufacturer only after state validation: 85.058334%; src 0x1c4 base 0x1e0 insns 113/120; --- replace mine 6:8 base 6:8; M 6 mr r30, r3; M 7 mr r26, r4
|
||||
- packet sequence values remain full-width: 76.441666%; src 0x1c4 base 0x1e0 insns 113/120; --- replace mine 5:7 base 5:8; M 5 mr r30, r3; M 6 mr r26, r4
|
||||
- direct address error branch: 79.525%; src 0x1c8 base 0x1e0 insns 114/120; --- replace mine 5:7 base 5:8; M 5 mr r30, r3; M 6 mr r26, r4
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81400830 initial 77.619934%
|
||||
- single-byte RC4 generation loop instead of manual pairs: 65.65109%; src 0x3c0 base 0x504 insns 240/321; --- insert mine 6:6 base 6:7; B 6 addi r29, r3, 0x18; --- insert mine 7:7 base 8:9
|
||||
- natural CRC byte loop: 60.13084%; src 0x3c4 base 0x504 insns 241/321; --- replace mine 5:6 base 5:7; M 5 mr r27, r3; B 5 mr r26, r3
|
||||
- narrow RC4 state indices at assignment: 77.619934%; src 0x4b8 base 0x504 insns 302/321; --- insert mine 6:6 base 6:7; B 6 addi r29, r3, 0x18; --- insert mine 7:7 base 8:9
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81400E0C initial 77.52105%
|
||||
- signed option lengths and iteration indices: 77.778946%; src 0x2bc base 0x2f8 insns 175/190; --- insert mine 5:5 base 5:6; B 5 mr r29, r4; --- replace mine 6:8 base 7:8
|
||||
- natural integer byte decode for both address options: 44.963158%; src 0x188 base 0x2f8 insns 98/190; --- insert mine 5:5 base 5:6; B 5 mr r29, r4; --- replace mine 6:8 base 7:8
|
||||
- address decode accumulation uses OR: 61.963158%; src 0x284 base 0x2f8 insns 161/190; --- replace mine 5:8 base 5:8; M 5 mr r29, r3; M 6 mr r30, r4
|
||||
Retained best candidate
|
||||
|
||||
AOSS_814013AC initial 91.70175%
|
||||
- signed option lengths: 91.70175%; src 0x1cc base 0x1c8 insns 115/114; --- insert mine 6:6 base 6:7; B 6 mr r27, r3; --- delete mine 7:8 base 8:8
|
||||
- apply flags after successful parser call: 84.68421%; src 0x1ec base 0x1c8 insns 123/114; --- insert mine 6:6 base 6:7; B 6 mr r27, r3; --- delete mine 7:8 base 8:8
|
||||
- bounded while loop over selected reply payload: 88.2807%; src 0x1d4 base 0x1c8 insns 117/114; --- insert mine 6:6 base 6:7; B 6 mr r27, r3; --- delete mine 7:8 base 8:8
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81401574 initial 92.558136%
|
||||
- semantic payload extent expression: 92.558136%; src 0x1fc base 0x204 insns 127/129; --- replace mine 5:7 base 5:7; M 5 lwz r30, 0(0); M 6 mr r27, r4
|
||||
- request length remains full-width: 92.209305%; src 0x1f8 base 0x204 insns 126/129; --- replace mine 5:7 base 5:7; M 5 lwz r30, 0(0); M 6 mr r27, r4
|
||||
- initialize destination length before port conversion: 88.31783%; src 0x1fc base 0x204 insns 127/129; --- replace mine 5:7 base 5:7; M 5 lwz r30, 0(0); M 6 mr r27, r4
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81401778 initial 71.93407%
|
||||
- CRC checksum stays full width until header store: 71.93407%; src 0x434 base 0x444 insns 269/273; --- replace mine 5:7 base 5:6; M 5 lis r31, 0; M 6 lwz r30, 0(0)
|
||||
- signed RC4 byte loop index: 71.93407%; src 0x434 base 0x444 insns 269/273; --- replace mine 5:7 base 5:6; M 5 lis r31, 0; M 6 lwz r30, 0(0)
|
||||
- copy hello payload before manufacturer encoding: 71.91575%; src 0x434 base 0x444 insns 269/273; --- replace mine 5:7 base 5:6; M 5 lis r31, 0; M 6 lwz r30, 0(0)
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81401C9C initial 71.9315%
|
||||
- natural RC4 state initialization loop: 43.342464%; src 0x98 base 0x124 insns 38/73; --- replace mine 0:1 base 0:2; M 0 li r9, 0; B 0 stwu r1, -0x10(r1)
|
||||
- schedule state reset before obtaining byte pointer: 71.9315%; src 0x12c base 0x124 insns 75/73; --- replace mine 0:6 base 0:2; M 0 stwu r1, -0x20(r1); M 1 mflr r0
|
||||
- signed key and state indices: 71.9315%; src 0x12c base 0x124 insns 75/73; --- replace mine 0:6 base 0:2; M 0 stwu r1, -0x20(r1); M 1 mflr r0
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81401E80 initial 91.80272%
|
||||
- natural XOR loop over half-packet: 56.455784%; src 0x168 base 0x24c insns 90/147; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x30(r1); B 0 stwu r1, -0x40(r1)
|
||||
- half-length via signed division: 87.04082%; src 0x240 base 0x24c insns 144/147; --- replace mine 5:19 base 5:13; M 5 srawi r0, r4, 1; M 6 mr r28, r3
|
||||
- count-down rounds: 88.734695%; src 0x244 base 0x24c insns 145/147; --- replace mine 6:7 base 6:7; M 6 mr r28, r3; B 6 mr r21, r3
|
||||
Retained best candidate
|
||||
|
||||
AOSS_814020CC initial 76.066666%
|
||||
- sleep tick product stays 64-bit: 67.51667%; src 0xfc base 0xf0 insns 63/60; --- replace mine 3:6 base 3:7; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- tick duration via explicit multiply-high: 81.65%; src 0xe4 base 0xf0 insns 57/60; --- replace mine 3:5 base 3:6; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- do-while host acquisition loop: 65.066666%; src 0xf8 base 0xf0 insns 62/60; --- replace mine 3:6 base 3:7; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81401DC0 initial 99.375%
|
||||
- CRC output accumulator reuses incoming seed value: 99.375%; src 0xc0 base 0xc0 insns 48/48; diffs 4: [39, 41, 42, 43]; 39 M srwi r0, r3, 1; B srwi r3, r3, 1
|
||||
- last CRC bit combined with conditional polynomial: 80.916664%; src 0xc8 base 0xc0 insns 50/48; --- delete mine 0:1 base 0:0; M 0 lis r3, -0x1247; --- replace mine 2:4 base 1:2
|
||||
- ordinary counted loop for eight CRC polynomial steps: 24.833334%; src 0x40 base 0xc0 insns 16/48; --- insert mine 0:0 base 0:1; B 0 li r0, 0x100; --- delete mine 1:3 base 2:2
|
||||
Retained best candidate
|
||||
|
||||
AOSS_Init_old initial 28.546717%
|
||||
- network settings alignment follows target 32-byte stack contract: 24.69697%; src 0x17f8 base 0x18c0 insns 1534/1584; --- replace mine 8:9 base 8:11; M 8 li r14, 0; B 8 lhz r4, 0(0)
|
||||
- request records alignment follows target stack offset a0: 24.69697%; src 0x17f8 base 0x18c0 insns 1534/1584; --- replace mine 8:9 base 8:11; M 8 li r14, 0; B 8 lhz r4, 0(0)
|
||||
- both network settings and request records use observed stack alignment: 24.69697%; src 0x17f8 base 0x18c0 insns 1534/1584; --- replace mine 8:9 base 8:11; M 8 li r14, 0; B 8 lhz r4, 0(0)
|
||||
Retained best candidate
|
||||
|
||||
AOSS_814001B4 initial 88.78481%
|
||||
- opcode uses full-width switch expression after conversion: 88.78481%; src 0x12c base 0x13c insns 75/79; --- replace mine 3:5 base 3:10; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- rejection increments written as explicit count stores: 88.78481%; src 0x12c base 0x13c insns 75/79; --- replace mine 3:5 base 3:10; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- validation represented by a named result before rejection: 88.78481%; src 0x12c base 0x13c insns 75/79; --- replace mine 3:5 base 3:10; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
Retained best candidate
|
||||
|
||||
AOSS_814013AC initial 91.70175%
|
||||
- outer response stride evaluated once before cursor advancement: 91.70175%; src 0x1cc base 0x1c8 insns 115/114; --- insert mine 6:6 base 6:7; B 6 mr r27, r3; --- delete mine 7:8 base 8:8
|
||||
- one option cursor serves outer and inner traversal: 91.70175%; src 0x1cc base 0x1c8 insns 115/114; --- insert mine 6:6 base 6:7; B 6 mr r27, r3; --- delete mine 7:8 base 8:8
|
||||
- config flags initialization delayed until matching response is located: 89.60526%; src 0x1cc base 0x1c8 insns 115/114; --- insert mine 6:6 base 6:7; B 6 mr r27, r3; --- delete mine 7:8 base 8:8
|
||||
Retained best candidate
|
||||
|
||||
AOSS .sbss source-order reconstruction: moved real existing address/status declarations into original address order; 28.57143 -> 57.14286.
|
||||
- explicit zero initialization of owned pointer globals: 42.857143%; original source restored if no improvement.
|
||||
- explicit zero initialization of runtime status globals: 57.14286%; original source restored if no improvement.
|
||||
- ordinary zero initialization of access-point address bytes: 28.57143%; original source restored if no improvement.
|
||||
|
||||
AOSS dispatch reconstruction: rejected empty/type/validation failures return immediately and opcode dispatch uses a switch; 41.518986 -> 88.78481%, 75/79 instructions. Remaining four instructions are prologue/epilogue save helpers versus individual register saves; three additional real source variations did not change them.
|
||||
AOSS_Init_old has a body for every observed state path; six distinct attempts logged. Restored narrow wait counters despite a small fuzzy gain from widening, because the original performs signed 16-bit wrapping assignments. Observed 32-byte stack alignment trials all worsened codegen and were restored. Renamed existing decompiler labels to meaningful state/cleanup names.
|
||||
AOSS .data/.bss/.sdata/.sdata2 remain 100%; ordinary source declaration reordering improves .sbss to 57.14286 but does not finish its symbol associations. Three normal initialization forms produced no further improvement and were restored. No forced sections, padding, address-pinning symbols, or table blobs added.
|
||||
|
||||
Current handoff: remaining functions and instruction evidence
|
||||
ATERM_814021BC 92.77922%: src 0x274 base 0x268 insns 157/154; --- replace mine 5:8 base 5:8; M 5 lis r31, 0; M 6 li r28, 0; M 7 addi r3, r31, 0
|
||||
ATERM_8140276C 94.04023%: src 0x2b0 base 0x2b8 insns 172/174; --- replace mine 5:11 base 5:13; M 5 mr r25, r3; M 6 mr r26, r4; M 7 mr r27, r5
|
||||
ATERM_81402A24 76.20532%: src 0x3f4 base 0x41c insns 253/263; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x80(r1); B 0 stwu r1, -0x90(r1); --- replace mine 2:4 base 2:4
|
||||
ATERM_81402E40 99.791664%: src 0x180 base 0x180 insns 96/96; diffs 4: [9, 10, 47, 52]; 9 M mr r29, r7; B mr r3, r27; 10 M mr r3, r27
|
||||
ATERM_81402FC0 68.577774%: src 0x208 base 0x21c insns 130/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- delete mine 15:16 base 16:16; M 15 li r31, 0
|
||||
ATERM_814031DC 85.90225%: src 0x1f4 base 0x214 insns 125/133; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x70(r1); B 0 stwu r1, -0x60(r1); --- replace mine 4:6 base 4:6
|
||||
ATERM_814033F0 67.39416%: src 0x214 base 0x224 insns 133/137; --- replace mine 5:6 base 5:6; M 5 addi r30, r3, 8; B 5 addi r29, r3, 8; --- insert mine 7:7 base 7:8
|
||||
ATERM_814036D8 87.0%: src 0x1e4 base 0x1f0 insns 121/124; --- replace mine 14:24 base 14:16; M 14 bne 36; M 15 addi r3, r25, 0; M 16 li r0, 4
|
||||
ATERM_814038C8 41.043114%: src 0x9b4 base 0xedc insns 621/951; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x140(r1); B 0 stwu r1, -0x180(r1); --- replace mine 2:4 base 2:4
|
||||
ATERMi_AutoConfigThread 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; 22 M srawi r3, r0, 0x1f
|
||||
ATERM_81404844 92.62393%: src 0x1bc base 0x1d4 insns 111/117; --- replace mine 8:13 base 8:13; M 8 mr r29, r3; M 9 mr r22, r4; M 10 mr r23, r5
|
||||
ATERM_81404A18 75.82645%: src 0x1c0 base 0x1e4 insns 112/121; --- replace mine 8:13 base 8:14; M 8 mr r29, r3; M 9 mr r21, r4; M 10 mr r22, r5
|
||||
ATERM_81404BFC 74.36194%: src 0x46c base 0x430 insns 283/268; --- replace mine 6:7 base 6:7; M 6 cmplwi r5, 0x80; B 6 cmpwi r5, 0x80; --- delete mine 38:40 base 38:38
|
||||
ATERM_8140502C 42.355072%: src 0x280 base 0x228 insns 160/138; --- insert mine 5:5 base 5:8; B 5 stw r30, 8(r1); B 6 lis r30, 0; B 7 addi r30, r30, 0
|
||||
ATERM_81405254 34.23247%: src 0x3c4 base 0x43c insns 241/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1); --- replace mine 2:4 base 2:4
|
||||
ATERM_81405690 34.64945%: src 0x3d4 base 0x43c insns 245/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1); --- replace mine 2:4 base 2:4
|
||||
ATERM_81405ACC 55.54861%: src 0x21c base 0x240 insns 135/144; --- insert mine 2:2 base 2:3; B 2 slwi r7, r5, 3; --- replace mine 3:7 base 4:10; M 3 addi r11, r1, 0x20
|
||||
ATERM_81405D0C 53.851387%: src 0xa50 base 0xb40 insns 660/720; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x90(r1); B 0 stwu r1, -0xa0(r1); --- replace mine 2:4 base 2:4
|
||||
ATERMi_ApConfigStart 93.718445%: src 0x1a0 base 0x19c insns 104/103; --- delete mine 4:5 base 4:4; M 4 mr r31, r3; --- replace mine 6:7 base 5:6; M 6 mr r30, r8
|
||||
ATERMi_ApConfigEnd 87.54263%: src 0x1dc base 0x204 insns 119/129; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0xe0; M 4 bl 0; B 3 stw r31, 0xdc(r1)
|
||||
ATERMi_ApConfigGetState 99.42857%: src 0x8c base 0x8c insns 35/35; diffs 3: [17, 18, 20]; 17 M lwz r6, 0xf8(r6); B lwz r0, 0xf8(r6); 18 M addi r0, r5, 0x4dd3
|
||||
AOSS_Init_old 28.42298%: src 0x1794 base 0x18c0 insns 1509/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b; B 1 mr r12, r1
|
||||
AOSS_813FFD68 96.981735%: src 0x364 base 0x36c insns 217/219; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0x20; M 4 bl 0; B 3 stw r31, 0x1c(r1)
|
||||
AOSS_814001B4 88.78481%: src 0x12c base 0x13c insns 75/79; --- replace mine 3:5 base 3:10; M 3 addi r11, r1, 0x20; M 4 bl 0; B 3 stw r31, 0x1c(r1)
|
||||
AOSS_814002F0 85.058334%: src 0x1c4 base 0x1e0 insns 113/120; --- replace mine 6:8 base 6:8; M 6 mr r30, r3; M 7 mr r26, r4; B 6 mr r26, r3
|
||||
AOSS_81400830 77.619934%: src 0x4b8 base 0x504 insns 302/321; --- insert mine 6:6 base 6:7; B 6 addi r29, r3, 0x18; --- insert mine 7:7 base 8:9; B 8 li r5, 8
|
||||
AOSS_81400E0C 77.778946%: src 0x2bc base 0x2f8 insns 175/190; --- insert mine 5:5 base 5:6; B 5 mr r29, r4; --- replace mine 6:8 base 7:8; M 6 mr r29, r4
|
||||
AOSS_814013AC 91.70175%: src 0x1cc base 0x1c8 insns 115/114; --- insert mine 6:6 base 6:7; B 6 mr r27, r3; --- delete mine 7:8 base 8:8; M 7 mr r27, r3
|
||||
AOSS_81401574 92.558136%: src 0x1fc base 0x204 insns 127/129; --- replace mine 5:7 base 5:7; M 5 lwz r30, 0(0); M 6 mr r27, r4; B 5 lwz r27, 0(0)
|
||||
AOSS_81401778 71.93407%: src 0x434 base 0x444 insns 269/273; --- replace mine 5:7 base 5:6; M 5 lis r31, 0; M 6 lwz r30, 0(0); B 5 lwz r28, 0(0)
|
||||
AOSS_81401C9C 71.9315%: src 0x12c base 0x124 insns 75/73; --- replace mine 0:6 base 0:2; M 0 stwu r1, -0x20(r1); M 1 mflr r0; M 2 stw r0, 0x24(r1)
|
||||
AOSS_81401DC0 99.375%: src 0xc0 base 0xc0 insns 48/48; diffs 4: [39, 41, 42, 43]; 39 M srwi r0, r3, 1; B srwi r3, r3, 1; 41 M xoris r0, r0, 0xedb8
|
||||
AOSS_81401E80 91.80272%: src 0x244 base 0x24c insns 145/147; --- replace mine 6:7 base 6:7; M 6 mr r28, r3; B 6 mr r21, r3; --- replace mine 8:20 base 8:13
|
||||
AOSS_814020CC 81.65%: src 0xe4 base 0xf0 insns 57/60; --- replace mine 3:5 base 3:6; M 3 addi r11, r1, 0x20; M 4 bl 0; B 3 stw r31, 0x1c(r1)
|
||||
|
||||
Supplemental native crypto validation: NIST AES-128/192/256 encrypt/decrypt vectors passed; MD5 lengths 0, 1, 3, 55, 56, 64, 130 and streaming chunks 1, 7, 55, 63, 64, 65, 127 over 512 bytes passed against hashlib. RFC3394 wrap/unwrap passed using a temporary native test copy that explicitly emulates Wii big-endian counter bytes; unchanged x86 union byte order does not emulate the target. Tests reside under /tmp; MWCC object and gate remain matching authority.
|
||||
@@ -258,9 +258,9 @@ static const u16 s_defaultOptions[4] = { 0xffff, 0xffff, 0, 0 };
|
||||
|
||||
static void* s_accessPointList;
|
||||
static int* s_accessPointConfig;
|
||||
static u8 s_accessPointName[8];
|
||||
static u32 s_connectionState;
|
||||
static u32 s_errorCode;
|
||||
static u32 s_connectionState;
|
||||
static u8 s_accessPointName[8];
|
||||
static s32 s_socketStarted;
|
||||
static void* s_responseBuffer;
|
||||
|
||||
@@ -479,7 +479,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
input->status = 0xf;
|
||||
@@ -492,7 +492,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
state = AOSS_CheckAP(s_accessPointList);
|
||||
if (state == 4) {
|
||||
@@ -506,7 +506,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
if (state == 0) {
|
||||
if (s_operationState != 1) {
|
||||
@@ -528,7 +528,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
memset(s_accessPointConfig,0,0x58);
|
||||
initialWait = connectionWait;
|
||||
remainingWait = 0;
|
||||
goto LAB_00011698;
|
||||
goto wait_for_initial_link;
|
||||
}
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
@@ -554,7 +554,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
}
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
remainingWait = responseWait;
|
||||
if ((short)initialWait <= attemptCount) {
|
||||
@@ -568,7 +568,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
for (; remainingWait != 0; remainingWait = remainingWait - initialSleep) {
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
@@ -582,7 +582,7 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
initialSleep = remainingWait;
|
||||
if (100 < remainingWait) {
|
||||
@@ -621,9 +621,9 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
}
|
||||
goto LAB_00012878;
|
||||
LAB_00011698:
|
||||
if ((short)initialWait <= (short)remainingWait) goto LAB_000116a4;
|
||||
goto finish_initialization;
|
||||
wait_for_initial_link:
|
||||
if ((short)initialWait <= (short)remainingWait) goto handle_initial_link;
|
||||
state = AOSS_814020CC(&settings,s_accessPointConfig);
|
||||
if (state == -1) {
|
||||
input->status = 0xf;
|
||||
@@ -636,10 +636,10 @@ LAB_00011698:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
initialSleep = responseWait;
|
||||
if ((state == 0) && (*s_accessPointConfig == 1)) goto LAB_000116a4;
|
||||
if ((state == 0) && (*s_accessPointConfig == 1)) goto handle_initial_link;
|
||||
for (; initialSleep != 0; initialSleep = initialSleep - nextSleep) {
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
input->status = 0xf;
|
||||
@@ -652,7 +652,7 @@ LAB_00011698:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
nextSleep = initialSleep;
|
||||
if (100 < initialSleep) {
|
||||
@@ -675,11 +675,11 @@ LAB_00011698:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
remainingWait = remainingWait + 1;
|
||||
goto LAB_00011698;
|
||||
LAB_00012088:
|
||||
goto wait_for_initial_link;
|
||||
process_received_packet:
|
||||
receivedAddress.length = 8;
|
||||
receivedLength = SORecvFrom(s_socket,&packetBuffer->message,0x5dc,0,&receivedAddress);
|
||||
packetBuffer->socket = s_socket;
|
||||
@@ -695,7 +695,7 @@ LAB_00012088:
|
||||
else {
|
||||
if (state != requestResult) {
|
||||
state = requestResult;
|
||||
if (requestResult != 2) goto LAB_000118e8;
|
||||
if (requestResult != 2) goto perform_request;
|
||||
if (s_socket != -1) {
|
||||
SOClose(s_socket);
|
||||
}
|
||||
@@ -705,11 +705,11 @@ LAB_00012088:
|
||||
state = SOCleanup();
|
||||
if (state < 0) {
|
||||
state = -1;
|
||||
goto LAB_00012148;
|
||||
goto wait_for_packet;
|
||||
}
|
||||
}
|
||||
state = 0;
|
||||
LAB_00012148:
|
||||
wait_for_packet:
|
||||
if (state != 0) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
@@ -721,7 +721,7 @@ LAB_00012148:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
if (s_operationState != 4) {
|
||||
s_operationState = 4;
|
||||
@@ -743,7 +743,7 @@ LAB_00012148:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
input->status = 0xf;
|
||||
@@ -756,7 +756,7 @@ LAB_00012148:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
state = AOSS_CheckAP(s_accessPointList);
|
||||
if (state == 4) {
|
||||
@@ -770,7 +770,7 @@ LAB_00012148:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
if (state != 0) {
|
||||
input->status = 1;
|
||||
@@ -783,7 +783,7 @@ LAB_00012148:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
s_accessPointConfig = (int *)AOSSi_Alloc(0x58);
|
||||
if (s_accessPointConfig == (int *)0x0) {
|
||||
@@ -797,7 +797,7 @@ LAB_00012148:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
memset(s_accessPointConfig,0,0x58);
|
||||
initialWait = connectionWait;
|
||||
@@ -814,7 +814,7 @@ LAB_00012148:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
remainingWait = responseWait;
|
||||
if ((state == 0) && (*s_accessPointConfig == 1)) break;
|
||||
@@ -830,7 +830,7 @@ LAB_00012148:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
initialSleep = remainingWait;
|
||||
if (100 < remainingWait) {
|
||||
@@ -853,7 +853,7 @@ LAB_00012148:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
}
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
@@ -876,7 +876,7 @@ LAB_00012148:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
memset(&socketAddress,0,8);
|
||||
socketAddress.family = 2;
|
||||
@@ -885,8 +885,8 @@ LAB_00012148:
|
||||
socketAddress.length = 8;
|
||||
timeoutSeconds = SOBind(s_socket,&socketAddress);
|
||||
state = requestResult;
|
||||
if (timeoutSeconds < 0) goto code_r0x00012580;
|
||||
goto LAB_000118e8;
|
||||
if (timeoutSeconds < 0) goto cancelled_configuration;
|
||||
goto perform_request;
|
||||
}
|
||||
retryWait = waitSettings.value;
|
||||
if (receivedPackets <= waitSettings.halfwords.high) {
|
||||
@@ -902,7 +902,7 @@ LAB_00012148:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
responseSleep = retryWait;
|
||||
if (100 < retryWait) {
|
||||
@@ -926,9 +926,9 @@ LAB_00012148:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
goto LAB_000118e8;
|
||||
goto perform_request;
|
||||
}
|
||||
if (requestResult == 0) {
|
||||
s_errorCode = 0xf;
|
||||
@@ -941,7 +941,7 @@ LAB_00012148:
|
||||
}
|
||||
timeoutMilliseconds = -1;
|
||||
}
|
||||
LAB_000126f0:
|
||||
close_protocol_socket:
|
||||
if (s_socket != -1) {
|
||||
SOClose(s_socket);
|
||||
}
|
||||
@@ -949,11 +949,11 @@ LAB_000126f0:
|
||||
if (s_socketStarted == 1) {
|
||||
s_socketStarted = 0;
|
||||
state = SOCleanup();
|
||||
if (-1 < state) goto LAB_00012730;
|
||||
if (-1 < state) goto protocol_socket_cleanup_complete;
|
||||
state = -1;
|
||||
}
|
||||
else {
|
||||
LAB_00012730:
|
||||
protocol_socket_cleanup_complete:
|
||||
state = 0;
|
||||
}
|
||||
if (state != 0) {
|
||||
@@ -967,7 +967,7 @@ LAB_00012730:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
if (timeoutMilliseconds == 0) {
|
||||
timeoutMilliseconds = AOSS_813FFD68(input);
|
||||
@@ -986,34 +986,34 @@ LAB_00012730:
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
}
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
if (s_errorCode == 0x11) {
|
||||
errorStatus = 5;
|
||||
goto LAB_000127e8;
|
||||
goto report_protocol_error;
|
||||
}
|
||||
if (s_errorCode < 0x11) {
|
||||
if (s_errorCode == 0xf) {
|
||||
errorStatus = 3;
|
||||
goto LAB_000127e8;
|
||||
goto report_protocol_error;
|
||||
}
|
||||
if (0xe < s_errorCode) {
|
||||
errorStatus = 4;
|
||||
goto LAB_000127e8;
|
||||
goto report_protocol_error;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (s_errorCode == 0x15) {
|
||||
errorStatus = 8;
|
||||
goto LAB_000127e8;
|
||||
goto report_protocol_error;
|
||||
}
|
||||
if ((s_errorCode < 0x15) && (0x13 < s_errorCode)) {
|
||||
errorStatus = 7;
|
||||
goto LAB_000127e8;
|
||||
goto report_protocol_error;
|
||||
}
|
||||
}
|
||||
errorStatus = 0xf;
|
||||
LAB_000127e8:
|
||||
report_protocol_error:
|
||||
input->status = errorStatus;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
@@ -1024,8 +1024,8 @@ LAB_000127e8:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
code_r0x00012580:
|
||||
goto finish_initialization;
|
||||
cancelled_configuration:
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
AOSSi_Free(s_accessPointConfig);
|
||||
@@ -1036,8 +1036,8 @@ code_r0x00012580:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
LAB_000116a4:
|
||||
goto finish_initialization;
|
||||
handle_initial_link:
|
||||
if (remainingWait == connectionWait) {
|
||||
input->status = 0xf;
|
||||
if (s_accessPointConfig != (int *)0x0) {
|
||||
@@ -1108,7 +1108,7 @@ LAB_000116a4:
|
||||
settings.gatewayAddress = 0xc0a80b65;
|
||||
settings.ipAddress = 0xc0a80b01;
|
||||
state = 0;
|
||||
LAB_000118e8:
|
||||
perform_request:
|
||||
packetBuffer = s_responseBuffer;
|
||||
memset(networkAddresses,0,0x14);
|
||||
gatewayAddress = settings.gatewayAddress;
|
||||
@@ -1122,11 +1122,11 @@ LAB_000118e8:
|
||||
if (s_socketStarted == 1) {
|
||||
s_socketStarted = 0;
|
||||
requestResult = SOCleanup();
|
||||
if (-1 < requestResult) goto LAB_00011958;
|
||||
if (-1 < requestResult) goto request_socket_cleanup_complete;
|
||||
requestResult = -1;
|
||||
}
|
||||
else {
|
||||
LAB_00011958:
|
||||
request_socket_cleanup_complete:
|
||||
requestResult = 0;
|
||||
}
|
||||
if (requestResult != 0) {
|
||||
@@ -1140,7 +1140,7 @@ LAB_00011958:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
responseSleep = s_runtime.ipAddress & s_runtime.subnetMask;
|
||||
retryWait = responseSleep | (s_runtime.ipAddress & ~s_runtime.subnetMask) + 1;
|
||||
@@ -1160,7 +1160,7 @@ LAB_00011958:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
s_runtime.active = '\x01';
|
||||
s_accessPointConfig = (int *)AOSSi_Alloc(0x58);
|
||||
@@ -1175,7 +1175,7 @@ LAB_00011958:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
memset(s_accessPointConfig,0,0x58);
|
||||
initialWait = connectionWait;
|
||||
@@ -1192,7 +1192,7 @@ LAB_00011958:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
remainingWait = responseWait;
|
||||
if ((requestResult == 0) && (*s_accessPointConfig == 1)) break;
|
||||
@@ -1208,7 +1208,7 @@ LAB_00011958:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
initialSleep = remainingWait;
|
||||
if (100 < remainingWait) {
|
||||
@@ -1231,7 +1231,7 @@ LAB_00011958:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
}
|
||||
s_socket = SOSocket(2,2,0);
|
||||
@@ -1246,7 +1246,7 @@ LAB_00011958:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
memset(&socketAddress,0,8);
|
||||
socketAddress.family = 2;
|
||||
@@ -1265,7 +1265,7 @@ LAB_00011958:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
}
|
||||
requestResult = s_socket;
|
||||
@@ -1278,7 +1278,7 @@ LAB_00011958:
|
||||
}
|
||||
else if (state < 1) {
|
||||
if (state < 0) {
|
||||
LAB_00011e70:
|
||||
invalid_request_state:
|
||||
requestResult = -1;
|
||||
}
|
||||
else {
|
||||
@@ -1290,7 +1290,7 @@ LAB_00011e70:
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (2 < state) goto LAB_00011e70;
|
||||
if (2 < state) goto invalid_request_state;
|
||||
if (s_operationState != 5) {
|
||||
s_operationState = 5;
|
||||
AOSSi_Status(5);
|
||||
@@ -1334,7 +1334,7 @@ LAB_00011e70:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
memset(packetBuffer,0,0x5f8);
|
||||
timeoutSeconds = timeoutMilliseconds >> 0x1f;
|
||||
@@ -1351,7 +1351,7 @@ LAB_00011e70:
|
||||
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 LAB_00012088;
|
||||
if (0 < requestResult) goto process_received_packet;
|
||||
receivedPackets = receivedPackets + 1;
|
||||
retryWait = waitSettings.value;
|
||||
if (attemptCount < receivedPackets) {
|
||||
@@ -1365,7 +1365,7 @@ LAB_00011e70:
|
||||
s_errorCode = 0x11;
|
||||
}
|
||||
timeoutMilliseconds = -1;
|
||||
goto LAB_000126f0;
|
||||
goto close_protocol_socket;
|
||||
}
|
||||
for (; retryWait = retryWait & 0xffff, retryWait != 0; retryWait = retryWait - responseSleep) {
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
@@ -1379,7 +1379,7 @@ LAB_00011e70:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
responseSleep = retryWait;
|
||||
if (100 < retryWait) {
|
||||
@@ -1402,7 +1402,7 @@ LAB_00011e70:
|
||||
s_accessPointList = 0;
|
||||
}
|
||||
resultCode = 0xffffffff;
|
||||
goto LAB_00012878;
|
||||
goto finish_initialization;
|
||||
}
|
||||
} while (1);
|
||||
}
|
||||
@@ -1418,7 +1418,7 @@ LAB_00011e70:
|
||||
resultCode = 0xffffffff;
|
||||
}
|
||||
}
|
||||
LAB_00012878:
|
||||
finish_initialization:
|
||||
return (int)resultCode;}
|
||||
|
||||
int AOSS_813FFD68(AOSSInitInput* input) {
|
||||
@@ -1608,47 +1608,39 @@ int AOSS_CheckAP(AOSSAccessPointRecord* list) {
|
||||
|
||||
int AOSS_814001B4(int state, AOSSReceiveBuffer* packet, int* count, AOSSRequestRecords* request) {
|
||||
u16 messageLength = SONtoHs(packet->message.messageLength);
|
||||
int opcode;
|
||||
int validationResult;
|
||||
u16 opcode;
|
||||
|
||||
if (messageLength < 1) {
|
||||
goto reject_empty;
|
||||
(*count)++;
|
||||
return state;
|
||||
}
|
||||
if (packet->message.messageType != 0x11) {
|
||||
goto reject_type;
|
||||
(*count)++;
|
||||
return state;
|
||||
}
|
||||
validationResult = AOSS_81400830((AOSSDecryptionMessage*)&packet->message);
|
||||
if (validationResult >= 1) {
|
||||
goto reject_invalid;
|
||||
if (AOSS_81400830((AOSSDecryptionMessage*)&packet->message) > 0) {
|
||||
(*count)++;
|
||||
return state;
|
||||
}
|
||||
opcode = (u16)SONtoHs(packet->message.opcode);
|
||||
if (opcode == 0x2010) {
|
||||
opcode = SONtoHs(packet->message.opcode);
|
||||
switch (opcode) {
|
||||
case 0x1010:
|
||||
state = AOSS_814002F0(state, packet, count, request);
|
||||
break;
|
||||
case 0x2010:
|
||||
state = AOSS_814004D0(state, packet, count, request);
|
||||
} else if (opcode < 0x2010) {
|
||||
if (opcode == 0x1010) {
|
||||
state = AOSS_814002F0(state, packet, count, request);
|
||||
}
|
||||
} else if (opcode == 0x3010) {
|
||||
break;
|
||||
case 0x3010:
|
||||
state = AOSS_814006A4(state, packet, count, request);
|
||||
break;
|
||||
}
|
||||
goto done;
|
||||
|
||||
reject_empty:
|
||||
*count = *count + 1;
|
||||
goto done;
|
||||
reject_type:
|
||||
*count = *count + 1;
|
||||
goto done;
|
||||
reject_invalid:
|
||||
*count = *count + 1;
|
||||
done:
|
||||
return state;
|
||||
}
|
||||
|
||||
int AOSS_814002F0(int state, AOSSReceiveBuffer* packet, int* count, AOSSRequestRecords* request) {
|
||||
AOSSReplyPayload* reply;
|
||||
AOSSRequestRecord* requestRecord;
|
||||
size_t manufacturerLength = strlen(s_manufacturer);
|
||||
size_t manufacturerLength;
|
||||
int compareResult;
|
||||
u16 packetSequence;
|
||||
u16 requestSequence;
|
||||
@@ -1662,6 +1654,7 @@ int AOSS_814002F0(int state, AOSSReceiveBuffer* packet, int* count, AOSSRequestR
|
||||
return state;
|
||||
}
|
||||
|
||||
manufacturerLength = strlen(s_manufacturer);
|
||||
validationResult = 0;
|
||||
reply = &packet->message.payload.reply;
|
||||
requestRecord = &request->records[0];
|
||||
@@ -2001,8 +1994,8 @@ int AOSS_81400D34(u16 command, const u8* manufacturerAddress) {
|
||||
int AOSS_81400E0C(const AOSSOptionRecord* packet, u8* settings) {
|
||||
const u8* packetBytes = (const u8*)packet;
|
||||
const AOSSOptionRecord* record = packet;
|
||||
u32 length;
|
||||
u32 index;
|
||||
s32 length;
|
||||
s32 index;
|
||||
u32 value;
|
||||
u32 remaining;
|
||||
u16 nextOffset;
|
||||
@@ -2667,7 +2660,7 @@ int AOSS_814020CC(void* settings, void* config) {
|
||||
break;
|
||||
}
|
||||
|
||||
ticksPerMillisecond = (u32)(((u64)(__OSBusClock >> 2) * 0x10624dd3) >> 38);
|
||||
ticksPerMillisecond = (__mulhwu(0x10624dd3, __OSBusClock >> 2) >> 6);
|
||||
OSSleepTicks((OSTime)(ticksPerMillisecond * 100));
|
||||
}
|
||||
|
||||
|
||||
@@ -468,9 +468,30 @@ typedef struct {
|
||||
} AtermConfigurationResult;
|
||||
|
||||
typedef struct {
|
||||
u16 length;
|
||||
u8 header[6];
|
||||
u8 options[0x7F8];
|
||||
} AtermDecodedPayload;
|
||||
|
||||
typedef union {
|
||||
u8 data[0x818];
|
||||
struct {
|
||||
union {
|
||||
u8 payload[0x800];
|
||||
AtermDecodedPayload decoded;
|
||||
};
|
||||
u8 challenge[8];
|
||||
u8 digest[16];
|
||||
} authentication;
|
||||
} AtermThreadBuffer;
|
||||
|
||||
typedef struct {
|
||||
u32 state[4];
|
||||
u32 bitCountLow;
|
||||
u32 bitCountHigh;
|
||||
u8 buffer8[64];
|
||||
} AtermMd5Context;
|
||||
|
||||
typedef void (*AtermProgressCallback)(void*);
|
||||
typedef void* (*AtermAllocateCallback)(u32);
|
||||
typedef void (*AtermFreeCallback)(void*);
|
||||
@@ -513,6 +534,8 @@ s32 gAtermState;
|
||||
|
||||
void ATERM_8140684C(OSAlarm* alarm, OSContext* context);
|
||||
s32 ATERM_814038C8(void);
|
||||
void ATERM_81405ACC(AtermMd5Context* context, const void* input, u32 length);
|
||||
extern u8 gAtermDigestFill[64];
|
||||
int ATERM_81404844(u16* destination, u16* source, u32 length, void* key, u32 keyLength);
|
||||
int ATERM_81404A18(u16* destination, u16* source, u32 length, void* key, u32 keyLength);
|
||||
int ATERM_81404BFC(u32* expandedKey, const void* key, u32 keyBits);
|
||||
@@ -584,17 +607,15 @@ int ATERM_814021BC(void) {
|
||||
gAtermSocketReady = waitCount;
|
||||
}
|
||||
if (gAtermSocketReady != 0) {
|
||||
for (;;) {
|
||||
convertedHost = SOHtoNl(0);
|
||||
if (SOGetHostID() != convertedHost) {
|
||||
break;
|
||||
}
|
||||
convertedHost = SOHtoNl(0);
|
||||
while (SOGetHostID() == convertedHost) {
|
||||
OSInitMessageQueue(&hostQueue, &hostQueueBuffer, 1);
|
||||
OSCreateAlarm(&hostAlarm);
|
||||
OSSetAlarmTag(&hostAlarm, (u32)&hostQueue);
|
||||
timeoutTicks = (__mulhwu(0x10624DD3, *(u32*)0x800000F8 >> 2) >> 6) * 10;
|
||||
OSSetAlarm(&hostAlarm, timeoutTicks, ATERM_8140684C);
|
||||
OSReceiveMessage(&hostQueue, &hostMessage, 1);
|
||||
convertedHost = SOHtoNl(0);
|
||||
}
|
||||
} else {
|
||||
waitCount = -2;
|
||||
@@ -735,7 +756,7 @@ unlock_driver:
|
||||
int ATERM_8140276C(AtermApRecordSet* currentRecords, AtermApRecordSet* previousRecords,
|
||||
u32* changedIndex) {
|
||||
AtermApRecord* currentRecord = currentRecords->entries;
|
||||
AtermApRecord* previousRecord;
|
||||
AtermApRecord* previousRecord = previousRecords->entries;
|
||||
u32 currentIndex;
|
||||
u32 previousIndex;
|
||||
u32 resultIndex = 0;
|
||||
@@ -744,8 +765,7 @@ int ATERM_8140276C(AtermApRecordSet* currentRecords, AtermApRecordSet* previousR
|
||||
size_t aossLength;
|
||||
size_t formattedSsidLength;
|
||||
int found = 0;
|
||||
int previousHasAoss = 0;
|
||||
int currentHasAoss = 0;
|
||||
|
||||
|
||||
for (currentIndex = 0; currentIndex < currentRecords->count; currentIndex++) {
|
||||
AtermSsidBuffer ssidName;
|
||||
@@ -760,7 +780,6 @@ int ATERM_8140276C(AtermApRecordSet* currentRecords, AtermApRecordSet* previousR
|
||||
ssidName.clear.finalWord = 0;
|
||||
memcpy(ssidName.text, currentRecord->ssid, sizeof(currentRecord->ssid));
|
||||
ssidName.text[currentRecord->ssidLength] = '\0';
|
||||
previousRecord = previousRecords->entries;
|
||||
for (previousIndex = 0; previousIndex < previousRecords->count; previousIndex++) {
|
||||
ssidLength = currentRecord->ssidLength;
|
||||
if (ssidLength == 0 || ssidLength > sizeof(currentRecord->ssid) ||
|
||||
@@ -782,10 +801,13 @@ int ATERM_8140276C(AtermApRecordSet* currentRecords, AtermApRecordSet* previousR
|
||||
break;
|
||||
}
|
||||
currentRecord++;
|
||||
previousRecord = previousRecords->entries;
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
AtermSsidBuffer aossSsidName;
|
||||
int previousHasAoss = 0;
|
||||
int currentHasAoss = 0;
|
||||
|
||||
aossSsidName.clear.word0 = 0;
|
||||
aossSsidName.clear.word1 = 0;
|
||||
@@ -851,7 +873,7 @@ int ATERM_81402A24(void) {
|
||||
u32 scanBufferBytes = gAtermScanBufferSize * 0x100;
|
||||
u32 scanCount;
|
||||
u32 recordIndex;
|
||||
u32 iteration = 0;
|
||||
s32 iteration = 0;
|
||||
u32 now;
|
||||
char selectedMacText[32];
|
||||
|
||||
@@ -873,7 +895,7 @@ int ATERM_81402A24(void) {
|
||||
|
||||
while (iteration < 300 && gAtermCancelRequested == 0) {
|
||||
s64 currentTime = OSGetTime();
|
||||
now = (u32)(currentTime / (OS_BUS_CLOCK / 4000));
|
||||
now = (u32)(currentTime / (__mulhwu(0x10624DD3, OS_BUS_CLOCK >> 2) >> 6));
|
||||
if (gAtermDeadline <= now) {
|
||||
break;
|
||||
}
|
||||
@@ -964,7 +986,7 @@ int ATERM_81402A24(void) {
|
||||
progressInfo[2] = -1;
|
||||
} else {
|
||||
s64 currentTime = OSGetTime();
|
||||
now = (u32)(currentTime / (OS_BUS_CLOCK / 4000));
|
||||
now = (u32)(currentTime / (__mulhwu(0x10624DD3, OS_BUS_CLOCK >> 2) >> 6));
|
||||
progressInfo[2] = gAtermDeadline - now;
|
||||
}
|
||||
progressInfo[3] = gAtermResult;
|
||||
@@ -974,7 +996,7 @@ int ATERM_81402A24(void) {
|
||||
|
||||
if (iteration < 300) {
|
||||
s64 currentTime = OSGetTime();
|
||||
now = (u32)(currentTime / (OS_BUS_CLOCK / 4000));
|
||||
now = (u32)(currentTime / (__mulhwu(0x10624DD3, OS_BUS_CLOCK >> 2) >> 6));
|
||||
if (now <= gAtermDeadline) {
|
||||
result = gAtermCancelRequested == 0 ? 1 : -8;
|
||||
goto cleanup;
|
||||
@@ -1048,9 +1070,9 @@ int ATERM_81402FC0(AtermPacket* packet, u32* setupType) {
|
||||
u8* payload;
|
||||
u8* value;
|
||||
u16 checksum;
|
||||
u16 messageType;
|
||||
u32 messageType;
|
||||
u32 payloadLength;
|
||||
u16 optionType;
|
||||
u32 optionType;
|
||||
u16 optionLength;
|
||||
u16 authenticationReady;
|
||||
u16 networkReady;
|
||||
@@ -1147,17 +1169,17 @@ int ATERM_814031DC(AtermAssociationRequest* request) {
|
||||
char* textCursor = interfaceMacText;
|
||||
|
||||
for (addressIndex = 0; addressIndex < 6; addressIndex++) {
|
||||
u8 addressByte = interfaceMacAddress[addressIndex];
|
||||
u8 addressByte = *(interfaceMacAddress + addressIndex);
|
||||
s32 highNibble = (addressByte & 0xF0) >> 4;
|
||||
s32 lowNibble = addressByte & 0xF;
|
||||
char* nextText = textCursor + 2;
|
||||
|
||||
if (highNibble < 10) {
|
||||
if (highNibble <= 9) {
|
||||
*textCursor = highNibble + 0x30;
|
||||
} else {
|
||||
*textCursor = highNibble + 0x37;
|
||||
}
|
||||
if (lowNibble < 10) {
|
||||
if (lowNibble <= 9) {
|
||||
textCursor[1] = lowNibble + 0x30;
|
||||
} else {
|
||||
textCursor[1] = lowNibble + 0x37;
|
||||
@@ -1173,17 +1195,17 @@ int ATERM_814031DC(AtermAssociationRequest* request) {
|
||||
|
||||
textCursor = scanAddressText;
|
||||
for (addressIndex = 0; addressIndex < 6; addressIndex++) {
|
||||
u8 addressByte = scanAddress[addressIndex];
|
||||
u8 addressByte = *(scanAddress + addressIndex);
|
||||
s32 highNibble = (addressByte & 0xF0) >> 4;
|
||||
s32 lowNibble = addressByte & 0xF;
|
||||
char* nextText = textCursor + 2;
|
||||
|
||||
if (highNibble < 10) {
|
||||
if (highNibble <= 9) {
|
||||
*textCursor = highNibble + 0x30;
|
||||
} else {
|
||||
*textCursor = highNibble + 0x37;
|
||||
}
|
||||
if (lowNibble < 10) {
|
||||
if (lowNibble <= 9) {
|
||||
textCursor[1] = lowNibble + 0x30;
|
||||
} else {
|
||||
textCursor[1] = lowNibble + 0x37;
|
||||
@@ -1203,8 +1225,8 @@ int ATERM_814031DC(AtermAssociationRequest* request) {
|
||||
int ATERM_814033F0(u16* response) {
|
||||
u16* optionCursor = response + 4;
|
||||
u16* responseEnd = (u16*)((u8*)optionCursor + SONtoHs(response[0]));
|
||||
u16 optionType;
|
||||
u16 optionLength;
|
||||
u32 optionType;
|
||||
u32 optionLength;
|
||||
u8* optionValue;
|
||||
u32 value;
|
||||
u32 result = 0;
|
||||
@@ -1326,6 +1348,7 @@ int ATERM_814036D8(void) {
|
||||
char* sourceKey;
|
||||
s32 keyIndex;
|
||||
size_t keyLength;
|
||||
char* keyString;
|
||||
struct {
|
||||
char text[32];
|
||||
char terminator;
|
||||
@@ -1349,33 +1372,34 @@ int ATERM_814036D8(void) {
|
||||
do {
|
||||
memcpy(keyText.text, sourceKey, 0x20);
|
||||
keyText.terminator = '\0';
|
||||
keyLength = strlen(keyText.text);
|
||||
keyString = keyText.text;
|
||||
keyLength = strlen(keyString);
|
||||
switch (keyLength) {
|
||||
case 0:
|
||||
break;
|
||||
case 5:
|
||||
gAtermConfigurationResult.setupMode = 1;
|
||||
memcpy(outputKey, keyText.text, 5);
|
||||
memcpy(outputKey, keyString, 5);
|
||||
break;
|
||||
case 10:
|
||||
gAtermConfigurationResult.setupMode = 1;
|
||||
ATERM_81403614((u8*)outputKey, keyText.text, 10);
|
||||
ATERM_81403614((u8*)outputKey, keyString, 10);
|
||||
break;
|
||||
case 13:
|
||||
gAtermConfigurationResult.setupMode = 2;
|
||||
memcpy(outputKey, keyText.text, 0xD);
|
||||
memcpy(outputKey, keyString, 0xD);
|
||||
break;
|
||||
case 16:
|
||||
gAtermConfigurationResult.setupMode = 3;
|
||||
memcpy(outputKey, keyText.text, 0x10);
|
||||
memcpy(outputKey, keyString, 0x10);
|
||||
break;
|
||||
case 26:
|
||||
gAtermConfigurationResult.setupMode = 2;
|
||||
ATERM_81403614((u8*)outputKey, keyText.text, 0x1A);
|
||||
ATERM_81403614((u8*)outputKey, keyString, 0x1A);
|
||||
break;
|
||||
case 32:
|
||||
gAtermConfigurationResult.setupMode = 3;
|
||||
ATERM_81403614((u8*)outputKey, keyText.text, 0x20);
|
||||
ATERM_81403614((u8*)outputKey, keyString, 0x20);
|
||||
break;
|
||||
default:
|
||||
result = -7;
|
||||
@@ -1404,7 +1428,9 @@ s32 ATERM_814038C8(void) {
|
||||
AtermSocketAddress peerAddress;
|
||||
u8* packetBuffer = gAtermConfigurationResult.packetBuffer;
|
||||
u8* requestOptions = gAtermResponseBuffer.data;
|
||||
u8 digest[16];
|
||||
AtermMd5Context digestContext;
|
||||
u8 digestLength[8];
|
||||
u8 optionIds[7] = { 6, 0, 1, 2, 3, 4, 5 };
|
||||
AtermRequestOption16* shortOption;
|
||||
AtermRequestOption24* longOption;
|
||||
u8* optionEnd;
|
||||
@@ -1436,8 +1462,9 @@ s32 ATERM_814038C8(void) {
|
||||
OSInitMessageQueue(&waitQueue, waitBuffer, 1);
|
||||
OSCreateAlarm(&waitAlarm);
|
||||
OSSetAlarmTag(&waitAlarm, (u32)&waitQueue);
|
||||
OSSetPeriodicAlarm(&waitAlarm, OS_BUS_CLOCK >> 2,
|
||||
(OS_BUS_CLOCK / 4000) * 500, ATERM_8140684C);
|
||||
OSSetAlarm(&waitAlarm,
|
||||
(__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6) * 500,
|
||||
ATERM_8140684C);
|
||||
OSReceiveMessage(&waitQueue, &waitMessage, 1);
|
||||
|
||||
switch (gAtermProtocolState) {
|
||||
@@ -1523,7 +1550,7 @@ s32 ATERM_814038C8(void) {
|
||||
longOption = (AtermRequestOption24*)shortOption;
|
||||
longOption->type = SOHtoNs(3);
|
||||
longOption->length = SOHtoNs(7);
|
||||
memcpy(longOption->value, gAtermProductName, 4);
|
||||
memcpy(longOption->value, optionIds, sizeof(optionIds));
|
||||
longOption++;
|
||||
if (gAtermResponseMode != 0) {
|
||||
longOption->type = SOHtoNs(4);
|
||||
@@ -1556,16 +1583,77 @@ s32 ATERM_814038C8(void) {
|
||||
receivedLength = SORecvFrom(socket, packetBuffer,
|
||||
sizeof(gAtermConfigurationResult.packetBuffer), 4,
|
||||
&peerAddress);
|
||||
if (receivedLength > 0 &&
|
||||
ATERM_81402FC0((AtermPacket*)packetBuffer, &gAtermResponseMode) &&
|
||||
ATERM_81404A18((u16*)packetBuffer, (u16*)packetBuffer, receivedLength,
|
||||
gAtermAddressBuffer, 0x10)) {
|
||||
memcpy(digest, packetBuffer, sizeof(digest));
|
||||
gAtermProtocolState = 7;
|
||||
stateProgress[0] = 5;
|
||||
stateProgress[1] = (s32)(gAtermDeadline - now);
|
||||
stateProgress[2] = gAtermResult;
|
||||
(*gAtermProgressCallback)(stateProgress);
|
||||
if (receivedLength > 0) {
|
||||
AtermPacket* packet = (AtermPacket*)packetBuffer;
|
||||
u16 sequence = SONtoHs(packet->sequence);
|
||||
u16 payloadLength = SONtoHs(packet->length);
|
||||
u8* packetEnd = packet->payload + payloadLength;
|
||||
u8* cursor = packetBuffer;
|
||||
u32 checksum = 0;
|
||||
u32 optionType = 0;
|
||||
|
||||
while (cursor < packetEnd) {
|
||||
checksum += *cursor++;
|
||||
}
|
||||
if ((u16)checksum == SONtoHs(*(u16*)packetEnd) && sequence == 3) {
|
||||
AtermPacketOption* option;
|
||||
u8* optionEnd;
|
||||
ATERM_81404A18((u16*)gAtermResponseBuffer.authentication.payload,
|
||||
(u16*)packet->payload, payloadLength,
|
||||
gAtermConfigurationResult.connectionPrefix, 0x10);
|
||||
payloadLength -= 8;
|
||||
option = (AtermPacketOption*)
|
||||
gAtermResponseBuffer.authentication.decoded.options;
|
||||
optionEnd = (u8*)option + SONtoHs(
|
||||
gAtermResponseBuffer.authentication.decoded.length);
|
||||
if ((u8*)option < optionEnd) {
|
||||
optionType = SONtoHs(option->type);
|
||||
SONtoHs(option->length);
|
||||
}
|
||||
if (payloadLength != 0 && optionType == 0x101) {
|
||||
u32 authenticationTime = (u32)(OSGetTime() /
|
||||
(__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6));
|
||||
u32 index;
|
||||
u32 digestBytes;
|
||||
u32 bitCount[2];
|
||||
memcpy(gAtermResponseBuffer.authentication.challenge,
|
||||
option->value, 8);
|
||||
digestContext.state[0] = 0x67452301;
|
||||
digestContext.state[1] = 0xEFCDAB89;
|
||||
digestContext.state[2] = 0x98BADCFE;
|
||||
digestContext.state[3] = 0x10325476;
|
||||
digestContext.bitCountLow = 0;
|
||||
digestContext.bitCountHigh = 0;
|
||||
ATERM_81405ACC(&digestContext, &authenticationTime, sizeof(authenticationTime));
|
||||
bitCount[0] = digestContext.bitCountLow;
|
||||
bitCount[1] = digestContext.bitCountHigh;
|
||||
for (index = 0; index < 2; index++) {
|
||||
digestLength[index * 4] = bitCount[index];
|
||||
digestLength[index * 4 + 1] = bitCount[index] >> 8;
|
||||
digestLength[index * 4 + 2] = bitCount[index] >> 16;
|
||||
digestLength[index * 4 + 3] = bitCount[index] >> 24;
|
||||
}
|
||||
digestBytes = (digestContext.bitCountLow >> 3) & 0x3F;
|
||||
ATERM_81405ACC(&digestContext, gAtermDigestFill,
|
||||
digestBytes < 56 ? 56 - digestBytes : 120 - digestBytes);
|
||||
ATERM_81405ACC(&digestContext, digestLength, sizeof(digestLength));
|
||||
for (index = 0; index < 4; index++) {
|
||||
gAtermResponseBuffer.authentication.digest[index * 4] = digestContext.state[index];
|
||||
gAtermResponseBuffer.authentication.digest[index * 4 + 1] = digestContext.state[index] >> 8;
|
||||
gAtermResponseBuffer.authentication.digest[index * 4 + 2] = digestContext.state[index] >> 16;
|
||||
gAtermResponseBuffer.authentication.digest[index * 4 + 3] = digestContext.state[index] >> 24;
|
||||
}
|
||||
memset(&digestContext, 0, sizeof(digestContext));
|
||||
gAtermProtocolState = 7;
|
||||
gAtermState = 5;
|
||||
gAtermDeadline = 0xFFFFFFFF;
|
||||
retries = 0;
|
||||
stateProgress[0] = 5;
|
||||
stateProgress[1] = -1;
|
||||
stateProgress[2] = gAtermResult;
|
||||
(*gAtermProgressCallback)(stateProgress);
|
||||
}
|
||||
}
|
||||
} else if (now - lastSendTime >= 2000) {
|
||||
if (++retries >= 10) {
|
||||
result = -2;
|
||||
@@ -1580,7 +1668,7 @@ s32 ATERM_814038C8(void) {
|
||||
longOption = (AtermRequestOption24*)requestOptions;
|
||||
longOption->type = SOHtoNs(0x102);
|
||||
longOption->length = SOHtoNs(8);
|
||||
memcpy(longOption->value, digest, 8);
|
||||
memcpy(longOption->value, gAtermResponseBuffer.authentication.digest, 8);
|
||||
requestLength = ATERM_81402E40((u16*)packetBuffer, 4,
|
||||
(u16*)requestOptions,
|
||||
sizeof(AtermRequestOption24),
|
||||
@@ -1646,9 +1734,11 @@ s32 ATERM_814038C8(void) {
|
||||
}
|
||||
}
|
||||
|
||||
u8 gAtermDigestFill[64] = { 0x80 };
|
||||
|
||||
s32 ATERMi_AutoConfigThread(void) {
|
||||
s32 result = ATERM_814038C8();
|
||||
s32 progress[5];
|
||||
AtermProgress progress;
|
||||
u32 equalityMask;
|
||||
s32 completedState;
|
||||
|
||||
@@ -1664,22 +1754,26 @@ s32 ATERMi_AutoConfigThread(void) {
|
||||
gAtermDeadline = 0xFFFFFFFF;
|
||||
completedState = ((s32)equalityMask >> 31) + 7;
|
||||
gAtermState = completedState;
|
||||
progress[0] = completedState;
|
||||
progress[1] = -1;
|
||||
progress[2] = gAtermResult;
|
||||
(*gAtermProgressCallback)(progress);
|
||||
progress.state = completedState;
|
||||
progress.remainingTime = -1;
|
||||
progress.result = gAtermResult;
|
||||
(*gAtermProgressCallback)(&progress);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ATERM_81404844(u16* destination, u16* source, u32 length, void* key, u32 keyLength) {
|
||||
u32 expandedKey[64];
|
||||
u32 stateWords[4];
|
||||
u32 expandedKey[80];
|
||||
u32 initialValue[2];
|
||||
union { u32 words[4]; u8 bytes[16]; } block;
|
||||
union { s64 value; u8 bytes[8]; } counter;
|
||||
u8* destinationBytes = (u8*)destination;
|
||||
const u8* sourceBytes = (const u8*)source;
|
||||
u32 blockCount;
|
||||
s32 blockCount;
|
||||
u32 rounds;
|
||||
u32 pass;
|
||||
s32 pass;
|
||||
|
||||
initialValue[0] = 0xA6A6A6A6;
|
||||
initialValue[1] = 0xA6A6A6A6;
|
||||
if ((length & 7) != 0 || (keyLength & 7) != 0) {
|
||||
return 0;
|
||||
}
|
||||
@@ -1690,39 +1784,44 @@ int ATERM_81404844(u16* destination, u16* source, u32 length, void* key, u32 key
|
||||
|
||||
rounds = ATERM_81404BFC(expandedKey, key, keyLength << 3);
|
||||
memcpy(destinationBytes + 8, sourceBytes, length);
|
||||
stateWords[0] = 0x4D4D4D4D;
|
||||
stateWords[1] = 0x4D4D4D4D;
|
||||
memcpy(block.bytes, initialValue, sizeof(initialValue));
|
||||
for (pass = 0; pass < 6; pass++) {
|
||||
u32 blockIndex;
|
||||
s32 blockIndex;
|
||||
for (blockIndex = 1; blockIndex <= blockCount; blockIndex++) {
|
||||
u64 counter = (u64)pass * blockCount + blockIndex;
|
||||
u8* stateBytes = (u8*)stateWords;
|
||||
s64 passBase = (s64)pass * blockCount;
|
||||
u8* stateBytes = block.bytes;
|
||||
|
||||
memcpy(stateBytes + 8, destinationBytes + blockIndex * 8, 8);
|
||||
ATERM_81405254(expandedKey, rounds, stateBytes, stateBytes);
|
||||
stateBytes[0] ^= (u8)(counter >> 56);
|
||||
stateBytes[1] ^= (u8)(counter >> 48);
|
||||
stateBytes[2] ^= (u8)(counter >> 40);
|
||||
stateBytes[3] ^= (u8)(counter >> 32);
|
||||
stateBytes[4] ^= (u8)(counter >> 24);
|
||||
stateBytes[5] ^= (u8)(counter >> 16);
|
||||
stateBytes[6] ^= (u8)(counter >> 8);
|
||||
stateBytes[7] ^= (u8)counter;
|
||||
counter.value = passBase + blockIndex;
|
||||
stateBytes[0] ^= counter.bytes[0];
|
||||
stateBytes[1] ^= counter.bytes[1];
|
||||
stateBytes[2] ^= counter.bytes[2];
|
||||
stateBytes[3] ^= counter.bytes[3];
|
||||
stateBytes[4] ^= counter.bytes[4];
|
||||
stateBytes[5] ^= counter.bytes[5];
|
||||
stateBytes[6] ^= counter.bytes[6];
|
||||
stateBytes[7] ^= counter.bytes[7];
|
||||
memcpy(destinationBytes + blockIndex * 8, stateBytes + 8, 8);
|
||||
}
|
||||
}
|
||||
memcpy(destinationBytes, stateWords, 8);
|
||||
memcpy(destinationBytes, block.words, 8);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ATERM_81404A18(u16* destination, u16* source, u32 length, void* key, u32 keyLength) {
|
||||
u32 expandedKey[64];
|
||||
u32 stateWords[4];
|
||||
u32 expandedKey[80];
|
||||
u32 initialValue[2];
|
||||
union { u32 words[4]; u8 bytes[16]; } block;
|
||||
union { s64 value; u8 bytes[8]; } counter;
|
||||
u8* destinationBytes = (u8*)destination;
|
||||
const u8* sourceBytes = (const u8*)source;
|
||||
u32 blockCount;
|
||||
s32 blockCount;
|
||||
u32 rounds;
|
||||
s32 pass;
|
||||
|
||||
initialValue[0] = 0xA6A6A6A6;
|
||||
initialValue[1] = 0xA6A6A6A6;
|
||||
if ((length & 7) != 0 || (keyLength & 7) != 0) {
|
||||
return 0;
|
||||
}
|
||||
@@ -1732,29 +1831,30 @@ int ATERM_81404A18(u16* destination, u16* source, u32 length, void* key, u32 key
|
||||
}
|
||||
|
||||
rounds = ATERM_8140502C(expandedKey, key, keyLength << 3);
|
||||
memcpy(stateWords, sourceBytes, 8);
|
||||
memcpy(block.words, sourceBytes, 8);
|
||||
memcpy(destinationBytes, sourceBytes + 8, length - 1);
|
||||
for (pass = 5; pass >= 0; pass--) {
|
||||
u32 blockIndex;
|
||||
s32 blockIndex;
|
||||
for (blockIndex = blockCount; blockIndex != 0; blockIndex--) {
|
||||
u64 counter = (u64)(u32)pass * blockCount + blockIndex;
|
||||
u8* stateBytes = (u8*)stateWords;
|
||||
s64 passBase = (s64)pass * blockCount;
|
||||
u8* stateBytes = block.bytes;
|
||||
u8* outputBlock = destinationBytes + (blockIndex - 1) * 8;
|
||||
|
||||
memcpy(stateBytes + 8, outputBlock, 8);
|
||||
counter.value = passBase + blockIndex;
|
||||
stateBytes[0] ^= counter.bytes[0];
|
||||
stateBytes[1] ^= counter.bytes[1];
|
||||
stateBytes[2] ^= counter.bytes[2];
|
||||
stateBytes[3] ^= counter.bytes[3];
|
||||
stateBytes[4] ^= counter.bytes[4];
|
||||
stateBytes[5] ^= counter.bytes[5];
|
||||
stateBytes[6] ^= counter.bytes[6];
|
||||
stateBytes[7] ^= counter.bytes[7];
|
||||
ATERM_81405690(expandedKey, rounds, stateBytes, stateBytes);
|
||||
stateBytes[0] ^= (u8)(counter >> 56);
|
||||
stateBytes[1] ^= (u8)(counter >> 48);
|
||||
stateBytes[2] ^= (u8)(counter >> 40);
|
||||
stateBytes[3] ^= (u8)(counter >> 32);
|
||||
stateBytes[4] ^= (u8)(counter >> 24);
|
||||
stateBytes[5] ^= (u8)(counter >> 16);
|
||||
stateBytes[6] ^= (u8)(counter >> 8);
|
||||
stateBytes[7] ^= (u8)counter;
|
||||
memcpy(outputBlock, stateBytes + 8, 8);
|
||||
}
|
||||
}
|
||||
return stateWords[0] == 0x4D4D4D4D && stateWords[1] == 0x4D4D4D4D;
|
||||
return memcmp(block.bytes, initialValue, sizeof(initialValue)) == 0;
|
||||
}
|
||||
|
||||
#define ATERM_AES_SUB_BYTE(value) (gAtermAesTables[4][(value)] & 0xFF)
|
||||
@@ -1765,16 +1865,17 @@ int ATERM_81404A18(u16* destination, u16* source, u32 length, void* key, u32 key
|
||||
ATERM_AES_SUB_BYTE((value) & 0xFF))
|
||||
|
||||
#define ATERM_AES_READ_KEY_WORD(index) \
|
||||
(((u32)keyBytes[(index) * 4] << 24) | \
|
||||
((u32)keyBytes[(index) * 4 + 1] << 16) | \
|
||||
((u32)keyBytes[(index) * 4 + 2] << 8) | \
|
||||
(((u32)keyBytes[(index) * 4] << 24) ^ \
|
||||
((u32)keyBytes[(index) * 4 + 1] << 16) ^ \
|
||||
((u32)keyBytes[(index) * 4 + 2] << 8) ^ \
|
||||
keyBytes[(index) * 4 + 3])
|
||||
|
||||
int ATERM_81404BFC(u32* expandedKey, const void* key, u32 keyBits) {
|
||||
const u8* keyBytes = (const u8*)key;
|
||||
u32* roundKey;
|
||||
u32* roundKey = expandedKey;
|
||||
const u32* roundConstant;
|
||||
u32 temp;
|
||||
u32 keyWord;
|
||||
s32 generatedRounds = 0;
|
||||
|
||||
expandedKey[0] = ATERM_AES_READ_KEY_WORD(0);
|
||||
expandedKey[1] = ATERM_AES_READ_KEY_WORD(1);
|
||||
@@ -1782,61 +1883,74 @@ int ATERM_81404BFC(u32* expandedKey, const void* key, u32 keyBits) {
|
||||
expandedKey[3] = ATERM_AES_READ_KEY_WORD(3);
|
||||
|
||||
if (keyBits == 0x80) {
|
||||
roundKey = expandedKey + 4;
|
||||
roundConstant = gAtermAesRoundConstants;
|
||||
do {
|
||||
temp = roundKey[3];
|
||||
temp = (temp << 8) | (temp >> 24);
|
||||
temp = ATERM_AES_SUB_WORD(temp) ^ *roundConstant++;
|
||||
roundKey[0] = roundKey[-4] ^ temp;
|
||||
roundKey[1] = roundKey[-3] ^ roundKey[0];
|
||||
roundKey[2] = roundKey[-2] ^ roundKey[1];
|
||||
roundKey[3] = roundKey[-1] ^ roundKey[2];
|
||||
keyWord = roundKey[3];
|
||||
roundKey[4] = roundKey[0] ^
|
||||
(gAtermAesTables[4][(keyWord >> 16) & 0xFF] & 0xFF000000) ^
|
||||
(gAtermAesTables[4][(keyWord >> 8) & 0xFF] & 0x00FF0000) ^
|
||||
(gAtermAesTables[4][keyWord & 0xFF] & 0x0000FF00) ^
|
||||
(gAtermAesTables[4][keyWord >> 24] & 0x000000FF) ^ *roundConstant++;
|
||||
roundKey[5] = roundKey[1] ^ roundKey[4];
|
||||
roundKey[6] = roundKey[2] ^ roundKey[5];
|
||||
roundKey[7] = roundKey[3] ^ roundKey[6];
|
||||
roundKey += 4;
|
||||
} while (roundKey < expandedKey + 44);
|
||||
} while (++generatedRounds < 10);
|
||||
return 10;
|
||||
}
|
||||
|
||||
expandedKey[4] = ATERM_AES_READ_KEY_WORD(4);
|
||||
expandedKey[5] = ATERM_AES_READ_KEY_WORD(5);
|
||||
if (keyBits == 0xC0) {
|
||||
roundKey = expandedKey + 6;
|
||||
roundConstant = gAtermAesRoundConstants;
|
||||
do {
|
||||
temp = roundKey[5];
|
||||
temp = (temp << 8) | (temp >> 24);
|
||||
temp = ATERM_AES_SUB_WORD(temp) ^ *roundConstant++;
|
||||
roundKey[0] = roundKey[-6] ^ temp;
|
||||
roundKey[1] = roundKey[-5] ^ roundKey[0];
|
||||
roundKey[2] = roundKey[-4] ^ roundKey[1];
|
||||
roundKey[3] = roundKey[-3] ^ roundKey[2];
|
||||
roundKey[4] = roundKey[-2] ^ roundKey[0];
|
||||
roundKey[5] = roundKey[-1] ^ roundKey[4];
|
||||
keyWord = roundKey[5];
|
||||
roundKey[6] = roundKey[0] ^
|
||||
(gAtermAesTables[4][(keyWord >> 16) & 0xFF] & 0xFF000000) ^
|
||||
(gAtermAesTables[4][(keyWord >> 8) & 0xFF] & 0x00FF0000) ^
|
||||
(gAtermAesTables[4][keyWord & 0xFF] & 0x0000FF00) ^
|
||||
(gAtermAesTables[4][keyWord >> 24] & 0x000000FF) ^ *roundConstant++;
|
||||
roundKey[7] = roundKey[1] ^ roundKey[6];
|
||||
roundKey[8] = roundKey[2] ^ roundKey[7];
|
||||
roundKey[9] = roundKey[3] ^ roundKey[8];
|
||||
if (++generatedRounds == 8) {
|
||||
return 12;
|
||||
}
|
||||
roundKey[10] = roundKey[4] ^ roundKey[9];
|
||||
roundKey[11] = roundKey[5] ^ roundKey[10];
|
||||
roundKey += 6;
|
||||
} while (roundKey < expandedKey + 54);
|
||||
} while (1);
|
||||
return 12;
|
||||
}
|
||||
|
||||
expandedKey[6] = ATERM_AES_READ_KEY_WORD(6);
|
||||
expandedKey[7] = ATERM_AES_READ_KEY_WORD(7);
|
||||
if (keyBits == 0x100) {
|
||||
roundKey = expandedKey + 8;
|
||||
roundConstant = gAtermAesRoundConstants;
|
||||
do {
|
||||
temp = roundKey[7];
|
||||
temp = (temp << 8) | (temp >> 24);
|
||||
temp = ATERM_AES_SUB_WORD(temp) ^ *roundConstant++;
|
||||
roundKey[0] = roundKey[-8] ^ temp;
|
||||
roundKey[1] = roundKey[-7] ^ roundKey[0];
|
||||
roundKey[2] = roundKey[-6] ^ roundKey[1];
|
||||
roundKey[3] = roundKey[-5] ^ roundKey[2];
|
||||
temp = ATERM_AES_SUB_WORD(roundKey[3]);
|
||||
roundKey[4] = roundKey[-4] ^ temp;
|
||||
roundKey[5] = roundKey[-3] ^ roundKey[4];
|
||||
roundKey[6] = roundKey[-2] ^ roundKey[5];
|
||||
roundKey[7] = roundKey[-1] ^ roundKey[6];
|
||||
keyWord = roundKey[7];
|
||||
roundKey[8] = roundKey[0] ^
|
||||
(gAtermAesTables[4][(keyWord >> 16) & 0xFF] & 0xFF000000) ^
|
||||
(gAtermAesTables[4][(keyWord >> 8) & 0xFF] & 0x00FF0000) ^
|
||||
(gAtermAesTables[4][keyWord & 0xFF] & 0x0000FF00) ^
|
||||
(gAtermAesTables[4][keyWord >> 24] & 0x000000FF) ^ *roundConstant++;
|
||||
roundKey[9] = roundKey[1] ^ roundKey[8];
|
||||
roundKey[10] = roundKey[2] ^ roundKey[9];
|
||||
roundKey[11] = roundKey[3] ^ roundKey[10];
|
||||
if (++generatedRounds == 7) {
|
||||
return 14;
|
||||
}
|
||||
keyWord = roundKey[11];
|
||||
roundKey[12] = roundKey[4] ^
|
||||
(gAtermAesTables[4][keyWord >> 24] & 0xFF000000) ^
|
||||
(gAtermAesTables[4][(keyWord >> 16) & 0xFF] & 0x00FF0000) ^
|
||||
(gAtermAesTables[4][(keyWord >> 8) & 0xFF] & 0x0000FF00) ^
|
||||
(gAtermAesTables[4][keyWord & 0xFF] & 0x000000FF);
|
||||
roundKey[13] = roundKey[5] ^ roundKey[12];
|
||||
roundKey[14] = roundKey[6] ^ roundKey[13];
|
||||
roundKey[15] = roundKey[7] ^ roundKey[14];
|
||||
roundKey += 8;
|
||||
} while (roundKey < expandedKey + 64);
|
||||
} while (1);
|
||||
return 14;
|
||||
}
|
||||
return 0;
|
||||
@@ -1867,19 +1981,11 @@ int ATERM_8140502C(u32* expandedKey, const void* key, u32 keyBits) {
|
||||
u32 roundCount;
|
||||
|
||||
while (firstRound < lastRound) {
|
||||
u32 word0 = firstRound[0];
|
||||
u32 word1 = firstRound[1];
|
||||
u32 word2 = firstRound[2];
|
||||
u32 word3 = firstRound[3];
|
||||
|
||||
firstRound[0] = lastRound[0];
|
||||
firstRound[1] = lastRound[1];
|
||||
firstRound[2] = lastRound[2];
|
||||
firstRound[3] = lastRound[3];
|
||||
lastRound[0] = word0;
|
||||
lastRound[1] = word1;
|
||||
lastRound[2] = word2;
|
||||
lastRound[3] = word3;
|
||||
u32 word;
|
||||
word = firstRound[0]; firstRound[0] = lastRound[0]; lastRound[0] = word;
|
||||
word = firstRound[1]; firstRound[1] = lastRound[1]; lastRound[1] = word;
|
||||
word = firstRound[2]; firstRound[2] = lastRound[2]; lastRound[2] = word;
|
||||
word = firstRound[3]; firstRound[3] = lastRound[3]; lastRound[3] = word;
|
||||
firstRound += 4;
|
||||
lastRound -= 4;
|
||||
}
|
||||
@@ -1901,14 +2007,14 @@ 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) {
|
||||
u32 state0 = ((u32)input[0] << 24) | ((u32)input[1] << 16) |
|
||||
((u32)input[2] << 8) | input[3];
|
||||
u32 state1 = ((u32)input[4] << 24) | ((u32)input[5] << 16) |
|
||||
((u32)input[6] << 8) | input[7];
|
||||
u32 state2 = ((u32)input[8] << 24) | ((u32)input[9] << 16) |
|
||||
((u32)input[10] << 8) | input[11];
|
||||
u32 state3 = ((u32)input[12] << 24) | ((u32)input[13] << 16) |
|
||||
((u32)input[14] << 8) | input[15];
|
||||
u32 state0 = ((u32)input[0] << 24) ^ ((u32)input[1] << 16) |
|
||||
((u32)input[2] << 8) ^ input[3];
|
||||
u32 state1 = ((u32)input[4] << 24) ^ ((u32)input[5] << 16) |
|
||||
((u32)input[6] << 8) ^ input[7];
|
||||
u32 state2 = ((u32)input[8] << 24) ^ ((u32)input[9] << 16) |
|
||||
((u32)input[10] << 8) ^ input[11];
|
||||
u32 state3 = ((u32)input[12] << 24) ^ ((u32)input[13] << 16) |
|
||||
((u32)input[14] << 8) ^ input[15];
|
||||
u32 roundIndex;
|
||||
|
||||
state0 ^= expandedKey[0];
|
||||
@@ -1978,14 +2084,14 @@ 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) {
|
||||
u32 state0 = ((u32)input[0] << 24) | ((u32)input[1] << 16) |
|
||||
((u32)input[2] << 8) | input[3];
|
||||
u32 state1 = ((u32)input[4] << 24) | ((u32)input[5] << 16) |
|
||||
((u32)input[6] << 8) | input[7];
|
||||
u32 state2 = ((u32)input[8] << 24) | ((u32)input[9] << 16) |
|
||||
((u32)input[10] << 8) | input[11];
|
||||
u32 state3 = ((u32)input[12] << 24) | ((u32)input[13] << 16) |
|
||||
((u32)input[14] << 8) | input[15];
|
||||
u32 state0 = ((u32)input[0] << 24) ^ ((u32)input[1] << 16) |
|
||||
((u32)input[2] << 8) ^ input[3];
|
||||
u32 state1 = ((u32)input[4] << 24) ^ ((u32)input[5] << 16) |
|
||||
((u32)input[6] << 8) ^ input[7];
|
||||
u32 state2 = ((u32)input[8] << 24) ^ ((u32)input[9] << 16) |
|
||||
((u32)input[10] << 8) ^ input[11];
|
||||
u32 state3 = ((u32)input[12] << 24) ^ ((u32)input[13] << 16) |
|
||||
((u32)input[14] << 8) ^ input[15];
|
||||
u32 roundIndex;
|
||||
|
||||
state0 ^= expandedKey[0];
|
||||
@@ -2056,43 +2162,64 @@ void ATERM_81405690(const u32* expandedKey, u32 rounds, const u8* input, u8* out
|
||||
|
||||
void ATERM_81405D0C(u32 state[4], const u8 block[64]);
|
||||
|
||||
void ATERM_81405ACC(NETMD5Context* context, const void* input, u32 length) {
|
||||
void ATERM_81405ACC(AtermMd5Context* context, const void* input, u32 length) {
|
||||
const u8* data = (const u8*)input;
|
||||
u32 bufferIndex = (u32)(context->length >> 3) & 0x3F;
|
||||
u32 bufferIndex = (context->bitCountLow >> 3) & 0x3F;
|
||||
u32 bytesToFill = 64 - bufferIndex;
|
||||
u32 copiedBytes;
|
||||
u32 index;
|
||||
|
||||
context->length += (u64)length << 3;
|
||||
context->bitCountLow += length << 3;
|
||||
if (context->bitCountLow < (length << 3)) {
|
||||
context->bitCountHigh++;
|
||||
}
|
||||
context->bitCountHigh += length >> 29;
|
||||
if (length >= bytesToFill) {
|
||||
u32 alignedBytes = bytesToFill & ~7U;
|
||||
|
||||
for (copiedBytes = 0; copiedBytes < alignedBytes; copiedBytes += 8) {
|
||||
context->buffer8[bufferIndex + copiedBytes] = data[copiedBytes];
|
||||
context->buffer8[bufferIndex + copiedBytes + 1] = data[copiedBytes + 1];
|
||||
context->buffer8[bufferIndex + copiedBytes + 2] = data[copiedBytes + 2];
|
||||
context->buffer8[bufferIndex + copiedBytes + 3] = data[copiedBytes + 3];
|
||||
context->buffer8[bufferIndex + copiedBytes + 4] = data[copiedBytes + 4];
|
||||
context->buffer8[bufferIndex + copiedBytes + 5] = data[copiedBytes + 5];
|
||||
context->buffer8[bufferIndex + copiedBytes + 6] = data[copiedBytes + 6];
|
||||
context->buffer8[bufferIndex + copiedBytes + 7] = data[copiedBytes + 7];
|
||||
}
|
||||
for (index = copiedBytes; index < bytesToFill; index++) {
|
||||
context->buffer8[bufferIndex + index] = data[index];
|
||||
copiedBytes = 0;
|
||||
if (bytesToFill != 0) {
|
||||
u32 groupLimit = bytesToFill - 8;
|
||||
if (bytesToFill > 8) {
|
||||
for (; copiedBytes < groupLimit; copiedBytes += 8) {
|
||||
context->buffer8[bufferIndex + copiedBytes + 0] = data[copiedBytes + 0];
|
||||
context->buffer8[bufferIndex + copiedBytes + 1] = data[copiedBytes + 1];
|
||||
context->buffer8[bufferIndex + copiedBytes + 2] = data[copiedBytes + 2];
|
||||
context->buffer8[bufferIndex + copiedBytes + 3] = data[copiedBytes + 3];
|
||||
context->buffer8[bufferIndex + copiedBytes + 4] = data[copiedBytes + 4];
|
||||
context->buffer8[bufferIndex + copiedBytes + 5] = data[copiedBytes + 5];
|
||||
context->buffer8[bufferIndex + copiedBytes + 6] = data[copiedBytes + 6];
|
||||
context->buffer8[bufferIndex + copiedBytes + 7] = data[copiedBytes + 7];
|
||||
}
|
||||
}
|
||||
for (; copiedBytes < bytesToFill; copiedBytes++) {
|
||||
context->buffer8[bufferIndex + copiedBytes] = data[copiedBytes];
|
||||
}
|
||||
}
|
||||
ATERM_81405D0C(context->state, context->buffer8);
|
||||
data += bytesToFill;
|
||||
length -= bytesToFill;
|
||||
while (length >= sizeof(context->buffer8)) {
|
||||
ATERM_81405D0C(context->state, data);
|
||||
data += sizeof(context->buffer8);
|
||||
length -= sizeof(context->buffer8);
|
||||
for (copiedBytes = bytesToFill; copiedBytes + 63 < length; copiedBytes += 64) {
|
||||
ATERM_81405D0C(context->state, data + copiedBytes);
|
||||
}
|
||||
bufferIndex = 0;
|
||||
} else {
|
||||
copiedBytes = 0;
|
||||
}
|
||||
if (length != 0) {
|
||||
for (index = 0; index < length; index++) {
|
||||
context->buffer8[bufferIndex + index] = data[index];
|
||||
if (length - copiedBytes != 0) {
|
||||
u32 remainingBytes = length - copiedBytes;
|
||||
u32 groupLimit = remainingBytes - 8;
|
||||
index = 0;
|
||||
if (remainingBytes > 8) {
|
||||
for (; index < groupLimit; index += 8) {
|
||||
context->buffer8[bufferIndex + index + 0] = data[copiedBytes + index + 0];
|
||||
context->buffer8[bufferIndex + index + 1] = data[copiedBytes + index + 1];
|
||||
context->buffer8[bufferIndex + index + 2] = data[copiedBytes + index + 2];
|
||||
context->buffer8[bufferIndex + index + 3] = data[copiedBytes + index + 3];
|
||||
context->buffer8[bufferIndex + index + 4] = data[copiedBytes + index + 4];
|
||||
context->buffer8[bufferIndex + index + 5] = data[copiedBytes + index + 5];
|
||||
context->buffer8[bufferIndex + index + 6] = data[copiedBytes + index + 6];
|
||||
context->buffer8[bufferIndex + index + 7] = data[copiedBytes + index + 7];
|
||||
}
|
||||
}
|
||||
for (; index < remainingBytes; index++) {
|
||||
context->buffer8[bufferIndex + index] = data[copiedBytes + index];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2100,10 +2227,7 @@ void ATERM_81405ACC(NETMD5Context* context, const void* input, u32 length) {
|
||||
#define ATERM_MD5_STEP(A, B, C, D, WORD, CONSTANT, SHIFT, F) \
|
||||
do { \
|
||||
u32 value = (A) + (F) + (WORD) + (CONSTANT); \
|
||||
(A) = (D); \
|
||||
(D) = (C); \
|
||||
(C) = (B); \
|
||||
(B) += (value << (SHIFT)) | (value >> (32 - (SHIFT))); \
|
||||
(A) = (B) + ((value << (SHIFT)) | (value >> (32 - (SHIFT)))); \
|
||||
} while (0)
|
||||
|
||||
void ATERM_81405D0C(u32 state[4], const u8 block[64]) {
|
||||
@@ -2137,69 +2261,69 @@ void ATERM_81405D0C(u32 state[4], const u8 block[64]) {
|
||||
}
|
||||
|
||||
ATERM_MD5_STEP(a, b, c, d, words[0], 0xd76aa478, 7, (b & c) | (~b & d));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[1], 0xe8c7b756, 12, (b & c) | (~b & d));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[2], 0x242070db, 17, (b & c) | (~b & d));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[3], 0xc1bdceee, 22, (b & c) | (~b & d));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[1], 0xe8c7b756, 12, (a & b) | (~a & c));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[2], 0x242070db, 17, (d & a) | (~d & b));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[3], 0xc1bdceee, 22, (c & d) | (~c & a));
|
||||
ATERM_MD5_STEP(a, b, c, d, words[4], 0xf57c0faf, 7, (b & c) | (~b & d));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[5], 0x4787c62a, 12, (b & c) | (~b & d));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[6], 0xa8304613, 17, (b & c) | (~b & d));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[7], 0xfd469501, 22, (b & c) | (~b & d));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[5], 0x4787c62a, 12, (a & b) | (~a & c));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[6], 0xa8304613, 17, (d & a) | (~d & b));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[7], 0xfd469501, 22, (c & d) | (~c & a));
|
||||
ATERM_MD5_STEP(a, b, c, d, words[8], 0x698098d8, 7, (b & c) | (~b & d));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[9], 0x8b44f7af, 12, (b & c) | (~b & d));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[10], 0xffff5bb1, 17, (b & c) | (~b & d));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[11], 0x895cd7be, 22, (b & c) | (~b & d));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[9], 0x8b44f7af, 12, (a & b) | (~a & c));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[10], 0xffff5bb1, 17, (d & a) | (~d & b));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[11], 0x895cd7be, 22, (c & d) | (~c & a));
|
||||
ATERM_MD5_STEP(a, b, c, d, words[12], 0x6b901122, 7, (b & c) | (~b & d));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[13], 0xfd987193, 12, (b & c) | (~b & d));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[14], 0xa679438e, 17, (b & c) | (~b & d));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[15], 0x49b40821, 22, (b & c) | (~b & d));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[13], 0xfd987193, 12, (a & b) | (~a & c));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[14], 0xa679438e, 17, (d & a) | (~d & b));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[15], 0x49b40821, 22, (c & d) | (~c & a));
|
||||
ATERM_MD5_STEP(a, b, c, d, words[1], 0xf61e2562, 5, (d & b) | (~d & c));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[6], 0xc040b340, 9, (d & b) | (~d & c));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[11], 0x265e5a51, 14, (d & b) | (~d & c));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[0], 0xe9b6c7aa, 20, (d & b) | (~d & c));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[6], 0xc040b340, 9, (c & a) | (~c & b));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[11], 0x265e5a51, 14, (b & d) | (~b & a));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[0], 0xe9b6c7aa, 20, (a & c) | (~a & d));
|
||||
ATERM_MD5_STEP(a, b, c, d, words[5], 0xd62f105d, 5, (d & b) | (~d & c));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[10], 0x02441453, 9, (d & b) | (~d & c));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[15], 0xd8a1e681, 14, (d & b) | (~d & c));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[4], 0xe7d3fbc8, 20, (d & b) | (~d & c));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[10], 0x02441453, 9, (c & a) | (~c & b));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[15], 0xd8a1e681, 14, (b & d) | (~b & a));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[4], 0xe7d3fbc8, 20, (a & c) | (~a & d));
|
||||
ATERM_MD5_STEP(a, b, c, d, words[9], 0x21e1cde6, 5, (d & b) | (~d & c));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[14], 0xc33707d6, 9, (d & b) | (~d & c));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[3], 0xf4d50d87, 14, (d & b) | (~d & c));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[8], 0x455a14ed, 20, (d & b) | (~d & c));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[14], 0xc33707d6, 9, (c & a) | (~c & b));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[3], 0xf4d50d87, 14, (b & d) | (~b & a));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[8], 0x455a14ed, 20, (a & c) | (~a & d));
|
||||
ATERM_MD5_STEP(a, b, c, d, words[13], 0xa9e3e905, 5, (d & b) | (~d & c));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[2], 0xfcefa3f8, 9, (d & b) | (~d & c));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[7], 0x676f02d9, 14, (d & b) | (~d & c));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[12], 0x8d2a4c8a, 20, (d & b) | (~d & c));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[2], 0xfcefa3f8, 9, (c & a) | (~c & b));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[7], 0x676f02d9, 14, (b & d) | (~b & a));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[12], 0x8d2a4c8a, 20, (a & c) | (~a & d));
|
||||
ATERM_MD5_STEP(a, b, c, d, words[5], 0xfffa3942, 4, b ^ c ^ d);
|
||||
ATERM_MD5_STEP(d, a, b, c, words[8], 0x8771f681, 11, b ^ c ^ d);
|
||||
ATERM_MD5_STEP(c, d, a, b, words[11], 0x6d9d6122, 16, b ^ c ^ d);
|
||||
ATERM_MD5_STEP(b, c, d, a, words[14], 0xfde5380c, 23, b ^ c ^ d);
|
||||
ATERM_MD5_STEP(d, a, b, c, words[8], 0x8771f681, 11, a ^ b ^ c);
|
||||
ATERM_MD5_STEP(c, d, a, b, words[11], 0x6d9d6122, 16, d ^ a ^ b);
|
||||
ATERM_MD5_STEP(b, c, d, a, words[14], 0xfde5380c, 23, c ^ d ^ a);
|
||||
ATERM_MD5_STEP(a, b, c, d, words[1], 0xa4beea44, 4, b ^ c ^ d);
|
||||
ATERM_MD5_STEP(d, a, b, c, words[4], 0x4bdecfa9, 11, b ^ c ^ d);
|
||||
ATERM_MD5_STEP(c, d, a, b, words[7], 0xf6bb4b60, 16, b ^ c ^ d);
|
||||
ATERM_MD5_STEP(b, c, d, a, words[10], 0xbebfbc70, 23, b ^ c ^ d);
|
||||
ATERM_MD5_STEP(d, a, b, c, words[4], 0x4bdecfa9, 11, a ^ b ^ c);
|
||||
ATERM_MD5_STEP(c, d, a, b, words[7], 0xf6bb4b60, 16, d ^ a ^ b);
|
||||
ATERM_MD5_STEP(b, c, d, a, words[10], 0xbebfbc70, 23, c ^ d ^ a);
|
||||
ATERM_MD5_STEP(a, b, c, d, words[13], 0x289b7ec6, 4, b ^ c ^ d);
|
||||
ATERM_MD5_STEP(d, a, b, c, words[0], 0xeaa127fa, 11, b ^ c ^ d);
|
||||
ATERM_MD5_STEP(c, d, a, b, words[3], 0xd4ef3085, 16, b ^ c ^ d);
|
||||
ATERM_MD5_STEP(b, c, d, a, words[6], 0x04881d05, 23, b ^ c ^ d);
|
||||
ATERM_MD5_STEP(d, a, b, c, words[0], 0xeaa127fa, 11, a ^ b ^ c);
|
||||
ATERM_MD5_STEP(c, d, a, b, words[3], 0xd4ef3085, 16, d ^ a ^ b);
|
||||
ATERM_MD5_STEP(b, c, d, a, words[6], 0x04881d05, 23, c ^ d ^ a);
|
||||
ATERM_MD5_STEP(a, b, c, d, words[9], 0xd9d4d039, 4, b ^ c ^ d);
|
||||
ATERM_MD5_STEP(d, a, b, c, words[12], 0xe6db99e5, 11, b ^ c ^ d);
|
||||
ATERM_MD5_STEP(c, d, a, b, words[15], 0x1fa27cf8, 16, b ^ c ^ d);
|
||||
ATERM_MD5_STEP(b, c, d, a, words[2], 0xc4ac5665, 23, b ^ c ^ d);
|
||||
ATERM_MD5_STEP(d, a, b, c, words[12], 0xe6db99e5, 11, a ^ b ^ c);
|
||||
ATERM_MD5_STEP(c, d, a, b, words[15], 0x1fa27cf8, 16, d ^ a ^ b);
|
||||
ATERM_MD5_STEP(b, c, d, a, words[2], 0xc4ac5665, 23, c ^ d ^ a);
|
||||
ATERM_MD5_STEP(a, b, c, d, words[0], 0xf4292244, 6, c ^ (b | ~d));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[7], 0x432aff97, 10, c ^ (b | ~d));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[14], 0xab9423a7, 15, c ^ (b | ~d));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[5], 0xfc93a039, 21, c ^ (b | ~d));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[7], 0x432aff97, 10, b ^ (a | ~c));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[14], 0xab9423a7, 15, a ^ (d | ~b));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[5], 0xfc93a039, 21, d ^ (c | ~a));
|
||||
ATERM_MD5_STEP(a, b, c, d, words[12], 0x655b59c3, 6, c ^ (b | ~d));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[3], 0x8f0ccc92, 10, c ^ (b | ~d));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[10], 0xffeff47d, 15, c ^ (b | ~d));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[1], 0x85845dd1, 21, c ^ (b | ~d));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[3], 0x8f0ccc92, 10, b ^ (a | ~c));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[10], 0xffeff47d, 15, a ^ (d | ~b));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[1], 0x85845dd1, 21, d ^ (c | ~a));
|
||||
ATERM_MD5_STEP(a, b, c, d, words[8], 0x6fa87e4f, 6, c ^ (b | ~d));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[15], 0xfe2ce6e0, 10, c ^ (b | ~d));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[6], 0xa3014314, 15, c ^ (b | ~d));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[13], 0x4e0811a1, 21, c ^ (b | ~d));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[15], 0xfe2ce6e0, 10, b ^ (a | ~c));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[6], 0xa3014314, 15, a ^ (d | ~b));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[13], 0x4e0811a1, 21, d ^ (c | ~a));
|
||||
ATERM_MD5_STEP(a, b, c, d, words[4], 0xf7537e82, 6, c ^ (b | ~d));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[11], 0xbd3af235, 10, c ^ (b | ~d));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[2], 0x2ad7d2bb, 15, c ^ (b | ~d));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[9], 0xeb86d391, 21, c ^ (b | ~d));
|
||||
ATERM_MD5_STEP(d, a, b, c, words[11], 0xbd3af235, 10, b ^ (a | ~c));
|
||||
ATERM_MD5_STEP(c, d, a, b, words[2], 0x2ad7d2bb, 15, a ^ (d | ~b));
|
||||
ATERM_MD5_STEP(b, c, d, a, words[9], 0xeb86d391, 21, d ^ (c | ~a));
|
||||
|
||||
state[0] += a;
|
||||
state[1] += b;
|
||||
@@ -2252,7 +2376,7 @@ int ATERMi_ApConfigStart(OSPriority priority, u32 scanLimit,
|
||||
(__mulhwu(0x10624DD3, OS_BUS_CLOCK >> 2) >> 6));
|
||||
}
|
||||
progress.result = gAtermResult;
|
||||
progressCallback(&progress);
|
||||
gAtermProgressCallback(&progress);
|
||||
OSResumeThread(&sAtermThread);
|
||||
gAtermThreadStarted = 1;
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user