uint32 getAesCrc(uint32 in_crc, char *sec_code) @ 801042fc 801042fc: addiu sp,sp,-272 80104300: sw s2,264(sp) 80104304: sw a0,272(sp) 80104308: li a2,16 8010430c: addiu a0,sp,16 // buf0 80104310: move s2,a1 80104314: move a1,zero 80104318: sw ra,268(sp) 8010431c: sw s1,260(sp) 80104320: jal 0x800d4760 80104324: sw s0,256(sp) 80104328: addiu a0,sp,32 // buf1 8010432c: move a1,zero 80104330: jal 0x800d4760 80104334: li a2,16 80104338: addiu a0,sp,48 // buf2 8010433c: move a1,zero 80104340: jal 0x800d4760 80104344: li a2,16 80104348: addiu a0,sp,64 // buf3 8010434c: move a1,zero 80104350: jal 0x800d4760 80104354: li a2,16 80104358: addiu a0,sp,80 // aes_ctx 8010435c: move a1,zero 80104360: jal 0x800d4760 80104364: li a2,176 80104368: lui v0,0x8020 8010436c: addiu s0,v0,16668 // 80200000+411c = "STC" (sec_code/key pool) 80104370: j 0x8010439c 80104374: lui s1,0x801e loop: 80104378: jal 0x80103b04 8010437c: nop 80104380: move a0,s2 // s2 - sec_code 80104384: beqz v0,0x801043b0 80104388: move a1,s0 8010438c: jal 0x80103b04 80104390: nop 80104394: beqz v0,0x801043b0 80104398: nop 8010439c: addiu s0,s0,32 // search += 32 801043a0: li v0,32 801043a4: addiu a1,s1,7900 801043a8: bne s0,v0,0x80104378 (loop) // next pool item 801043ac: move a0,s0 801043b0: addiu s1,sp,80 // aes_ctx = sp + 80 801043b4: addiu a0,s0,16 // a0 = key from pool 801043b8: jal 0x80103dd4 801043bc: move a1,s1 // a1 = aes_ctx 801043c0: lb v0,0(s2) 801043c4: beqz v0,0x801043d8 801043c8: addiu a2,sp,48 // buf2 801043cc: move a0,s2 // sec_code 801043d0: j 0x801043e0 801043d4: move a1,s1 801043d8: move a1,s1 801043dc: addiu a0,sp,16 // aes_encrypt(in, ctx, out) 801043e0: jal 0x8010423c 801043e4: nop 801043e8: addiu a0,sp,48 // buf2 801043ec: jal 0x80103dd4 801043f0: addiu a1,sp,80 // aes_ctx 801043f4: addiu a0,sp,32 // buf1 801043f8: addiu v1,sp,272 // in_crc 801043fc: j 0x8010440c 80104400: addiu a1,sp,277 loop2: // copy crc to buf1 80104404: lbu v0,-1(v1) 80104408: sb v0,-1(a0) 8010440c: addiu v1,v1,1 80104410: bne v1,a1,0x80104404 (loop2) 80104414: addiu a0,a0,1 80104418: addiu s1,sp,80 // aes_ctx 8010441c: addiu s0,sp,64 // buf3 80104420: move a1,s1 80104424: addiu a0,sp,32 // buf1 80104428: jal 0x8010423c 8010442c: move a2,s0 // buf3 80104430: lui v0,0x801d 80104434: lw v1,272(sp) // in_crc (start value to crc32) 80104438: j 0x80104460 8010443c: addiu a1,v0,15984 // 0x801d0000+3e70 = crc32_table crc_loop: \ 80104440: lb v0,0(s0) | 80104444: addiu s0,s0,1 | 80104448: xor v0,v1,v0 | 8010444c: andi v0,v0,0xff |- v1 = (v1 >> 8) ^ crc32_table[(crc ^ *buf3++) & 0xff]; 80104450: sll v0,v0,0x2 | 80104454: addu v0,v0,a1 | 80104458: lw v0,0(v0) | 8010445c: xor v1,a0,v0 / 80104460: bne s0,s1,0x80104440 (crc_loop) 80104464: srl a0,v1,0x8 // (v1 >> 8) 80104468: lw ra,268(sp) 8010446c: lw s2,264(sp) 80104470: lw s1,260(sp) 80104474: lw s0,256(sp) 80104478: move v0,v1 8010447c: jr ra 80104480: addiu sp,sp,272 aes_set_encryption_key(key, aes_ctx) @ 80103dd4 80103dd4: addiu sp,sp,-24 80103dd8: sw s0,16(sp) 80103ddc: move s0,a1 80103de0: li a2,16 80103de4: move a1,a0 80103de8: sw ra,20(sp) 80103dec: jal 0x800d4440 80103df0: move a0,s0 80103df4: lui v0,0x8020 80103df8: addiu t5,v0,14304 // 802037e0 aes_subst_table_ptr 80103dfc: lui v0,0x8020 80103e00: addiu t6,v0,16608 // 802040e0 aes_rcon??? 80103e04: li t2,4 80103e08: srl v0,t2,0x2 80103e0c: lbu t0,12(s0) 80103e10: lbu t1,13(s0) 80103e14: lbu a3,14(s0) 80103e18: lbu a2,15(s0) 80103e1c: addu t4,v0,t6 80103e20: andi v0,t2,0x3 80103e24: addu t3,t0,t5 80103e28: addiu t2,t2,1 80103e2c: addu v1,t1,t5 80103e30: addu a0,a3,t5 80103e34: bnez v0,0x80103e58 80103e38: addu a1,a2,t5 80103e3c: lbu v0,0(t4) 80103e40: lbu v1,0(v1) 80103e44: lbu t1,0(a0) 80103e48: xor v0,v0,v1 80103e4c: lbu a3,0(a1) 80103e50: lbu a2,0(t3) 80103e54: andi t0,v0,0xff 80103e58: lbu v0,0(s0) 80103e5c: lbu v1,1(s0) 80103e60: lbu a0,2(s0) 80103e64: lbu a1,3(s0) 80103e68: xor v0,t0,v0 80103e6c: sb v0,16(s0) 80103e70: xor v1,t1,v1 80103e74: xor a0,a3,a0 80103e78: xor a1,a2,a1 80103e7c: li v0,44 80103e80: sb v1,17(s0) 80103e84: sb a0,18(s0) 80103e88: sb a1,19(s0) 80103e8c: bne t2,v0,0x80103e08 80103e90: addiu s0,s0,4 80103e94: lw ra,20(sp) 80103e98: lw s0,16(sp) 80103e9c: jr ra 80103ea0: addiu sp,sp,24 aes_encrypt(in, ctx, out) @ 8010423c 8010423c: addiu sp,sp,-56 80104240: sw s2,40(sp) 80104244: addiu s2,sp,16 80104248: sw s4,48(sp) 8010424c: sw s0,32(sp) 80104250: move s4,a2 80104254: move s0,a1 80104258: li a2,16 8010425c: move a1,a0 80104260: move a0,s2 80104264: sw ra,52(sp) 80104268: sw s3,44(sp) 8010426c: jal 0x800d4440 80104270: sw s1,36(sp) 80104274: move a1,s0 80104278: jal 0x80103ac0 8010427c: move a0,s2 80104280: addiu s0,s0,16 80104284: li s1,1 80104288: move s3,s2 8010428c: li v0,10 // 128 bits, 10 rounds 80104290: beq s1,v0,0x801042a8 80104294: move a0,s3 80104298: jal 0x80103ea4 8010429c: nop 801042a0: j 0x801042b4 801042a4: move a1,s0 801042a8: jal 0x80103450 801042ac: move a0,s3 801042b0: move a1,s0 801042b4: jal 0x80103ac0 801042b8: move a0,s2 801042bc: addiu s1,s1,1 801042c0: li v0,11 801042c4: bne s1,v0,0x8010428c 801042c8: addiu s0,s0,16 801042cc: move a0,s4 801042d0: addiu a1,sp,16 801042d4: jal 0x800d4440 801042d8: li a2,16 801042dc: lw ra,52(sp) 801042e0: lw s4,48(sp) 801042e4: lw s3,44(sp) 801042e8: lw s2,40(sp) 801042ec: lw s1,36(sp) 801042f0: lw s0,32(sp) 801042f4: jr ra 801042f8: addiu sp,sp,56