Advertisement
Guest User

Untitled

a guest
Nov 7th, 2017
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 15.28 KB | None | 0 0
  1. void sub_120()
  2. {
  3.     Block0();
  4.     Block1();
  5.     Block2();
  6.     Block3();
  7.     do
  8.     {
  9.         Block4();
  10.     }
  11.     while(Block5())
  12.     Block6();
  13.     Block7();
  14.     Block8();
  15.     while(Block9());
  16.     Block10();
  17.     Block11();
  18.     do
  19.     {
  20.         if(Block12())
  21.         {
  22.             Block15();
  23.         }
  24.         else
  25.         {
  26.             if(!Block13())
  27.             {
  28.                 Block14();
  29.             }
  30.         }
  31.         while(Block16());
  32.         Block17();
  33.     }
  34.     while(Block18())
  35.     Block19();
  36.     Block20();
  37.     Block21();
  38.     Block22();
  39.     Block23();
  40.     while(Block24());
  41.     Block25();
  42. }
  43.  
  44. void Block0()
  45. {
  46.     _asm
  47.     {
  48.         mfspr     r12, LR                       #(mfspr) Copies the contents of a special-purpose register into a general-purpose register.
  49.         std       r12, -8(r1)
  50.         std       response, -0x10(r1)
  51.         std       r30, -0x18(r1)
  52.         std       r29, -0x20(r1)
  53.         std       r28, -0x28(r1)
  54.         std       r27, -0x30(r1)
  55.         std       r26, -0x38(r1)
  56.         std       r25, -0x40(r1)
  57.         stdu      r1, -0xF0(r1)
  58.         addi      response, r3, 0x20            #increment the contents of r3 by 0x20 then store the result back into r31(response)
  59.         ld        r12, 0(r0)                    #read from 0x0 in HV & Load a double-word of data into the specified general purpose register.
  60.         std       r12, 8(response)              #store HV 8 byte header at response + 0x28 = wHvMagic
  61.         ld        r12, 0x10(r0)                 #read from 0x10 in HV & Load a double-word of data into the specified general purpose register.
  62.         std       r12, 0x10(response)           #store BaseKernel+UpdateType at 0x30 = wHvVersion
  63.         lwz       r12, dword_30                 #read from 0x30 in HV & Loads a word of data from a specified location in memory into a general-purpose register
  64.         stw       r12, 0x18(response)           #response + 0x38 = dwBaseKernelVersion
  65.         lwz       r12, dword_74                 #read from 0x74 in HV & Loads a word of data from a specified location in memory into a general-purpose register
  66.         stw       r12, 0x1C(response)           #response + 0x3C = dwUpdateSequence
  67.         std       r2, 0x20(response)            #store RTOC @ response + 0x40 (RTOC = 0x00000002000000000 = qwRTOC
  68.         mfspr     r12, HRMOR                    #0x0000010000000000 (mfspr) Copies the contents of a special-purpose register into a general-purpose register.
  69.         std       r12, 0x28(response)           #response + 0x48 = qwHRMOR
  70.         lwz       r12, dword_4C                 #read from 0x4C in HV Loads a word of data from a specified location in memory into a general-purpose register
  71.         add       r30, r2, r12                  #increments the contents of r2 by the contents of r12 storing the result back into r30
  72.         lwz       r12, 8(r30)                   #Loads a word of data from a specified location in memory into a general-purpose register
  73.         mtspr     CTR, r12                      #(mtspr) Copies the contents of a general-purpose register into a special-purpose register.
  74.         mr        r3, r4                        #The mr subcommand modifies general purpose, segment, special, or floating point registers.
  75.         li        r4, 0x1000                    #load immediate (take this constant value known at compile time and store it in this register)
  76.         bctrl    
  77.     }
  78. }
  79.  
  80. void Block1()
  81. {
  82.     _asm
  83.     {
  84.         mr        r25, r3                       #The mr subcommand modifies general purpose, segment, special, or floating point registers.
  85.         lwz       r28, 0xD4(r30)                #Loads a word of data from a specified location in memory into a general-purpose register
  86.         lwz       r29, 0xD8(r30)                #Loads a word of data from a specified location in memory into a general-purpose register
  87.         lwz       r30, 0xD0(r30)                #Loads a word of data from a specified location in memory into a general-purpose register
  88.         bl        XeCryptShaInit                #Branch (to call a function)
  89.     }
  90. }
  91.  
  92. void Block2()
  93. {
  94.     _asm
  95.     {
  96.         li        r5, 0x10                      #load immediate (take this constant value known at compile time and store it in this register)
  97.         mr        r4, r25                       #The mr subcommand modifies general purpose, segment, special, or floating point registers.
  98.         bl        XeCryptShaUpdate              #Branch (to call a function) & first hash HV salt
  99.     }
  100. }
  101.  
  102. void Block3()
  103. {
  104.     _asm
  105.     {
  106.         li        r26, 7                        #load immediate (take this constant value known at compile time and store it in this register)
  107.         addi      r27, response, 0x388          #increment the contents of r31 by 0x388 then store the result back into r27
  108.     }
  109. }
  110.  
  111. void Block4()
  112. {
  113.     _asm
  114.     {
  115.         loc_1BC
  116.         ldu       r6, 8(r27)                    #start reading from offset at 0x3B0 & Load a double-word of data into the specified general purpose register, updating the address base.
  117.         andi.     r5, r6, 0xFFF                 #(create length) & Logically ANDs the contents of a general-purpose register with an immediate value.
  118.         srdi      r4, r6, 16                    #(create offset) & Rotate double word right immediate
  119.         bl        XeCryptShaUpdate              #Branch (to call a function)
  120.     }
  121. }
  122.  
  123. void Block5()
  124. {
  125.     _asm
  126.     {
  127.         addic.    r26, r26, -1                  #Performs an addition with carry of the contents of a general-purpose register and an immediate value.
  128.         bne       loc_1BC
  129.     }
  130. }
  131.  
  132. void Block6()
  133. {
  134.     _asm
  135.     {
  136.         addi      r4, response, 0xCC            #(store at response + 0xEC) increment the contents of r31 by 0xCC then store the result back into r4
  137.         bl        XeCryptShaFinal               #Branch (to call a function)
  138.     }
  139. }
  140.  
  141. void Block7()
  142. {
  143.     _asm
  144.     {
  145.         bl        XeCryptShaInit                #Branch (to call a function)
  146.     }
  147. }
  148.  
  149. void Block8()
  150. {
  151.     _asm
  152.     {
  153.         li        r5, 8                         #load immediate (take this constant value known at compile time and store it in this register)
  154.         mtspr     CTR, r5                       #(mtspr) Copies the contents of a general-purpose register into a special-purpose register.
  155.         addi      r26, response, 0x3E0          #increment the contents of r31 by 0x3E0 then store the result back into r26
  156.         extrdi    r12, r26, 16,32               #Extract double word and right justify immediate
  157.         sth       r12, 0xD8(response)           #Stores a halfword of data from a general-purpose register into a specified location in memory.
  158.         addi      r4, r26, -8                   #increment the contents of r26 by -8 then store the result back into r4
  159.     }
  160. }
  161.  
  162. void Block9()
  163. {
  164.     _asm
  165.     {
  166.         loc_1F8
  167.         ld        r12, 0(r25)                   #Load a double-word of data into the specified general purpose register.
  168.         stdu      r12, 8(r4)                    #Store a double-word of data from a general purpose register into a specified memory location. Update the address base.
  169.         ld        r12, 8(r25)                   #Load a double-word of data into the specified general purpose register.
  170.         stdu      r12, 8(r4)                    #Store a double-word of data from a general purpose register into a specified memory location. Update the address base.
  171.         bdnz+     loc_1F8
  172.     }
  173. }
  174.  
  175. void Block10()
  176. {
  177.     _asm
  178.     {
  179.         dcbst     r0, r26                       #Allows a program to copy the contents of a modified block to main memory.
  180.         sync      
  181.         li        r25, 0x200                    #load immediate (take this constant value known at compile time and store it in this register)
  182.         oris      r25, r25, 0x8000              #Logically ORs the upper 16 bits of the contents of a general-purpose register with a 16-bit unsigned integer and stores the result in another general-purpose register.
  183.         sldi      r25, r25, 32                  #Shift left double word immediate
  184.         oris      r25, r25, 1                   #Logically ORs the upper 16 bits of the contents of a general-purpose register with a 16-bit unsigned integer and stores the result in another general-purpose register.
  185.         extrdi    r4, r26, 10,48                #Extract double word and right justify immediate
  186.         ori       r4, r4, 0xF800                #Logically ORs the lower 16 bits of the contents of a general-purpose register with a 16-bit unsigned integer and stores the result in another general-purpose register.
  187.         li        r5, 2                         #load immediate (take this constant value known at compile time and store it in this register)
  188.         add       r4, r25, r4                   #increments the contents of r25 by the contents of r4 storing the result back into r4
  189.         bl        XeCryptShaUpdate              #Branch (to call a function)
  190.     }
  191. }
  192.  
  193. void Block11()
  194. {
  195.     _asm
  196.     {
  197.         li        r26, 0xD                      #load immediate (take this constant value known at compile time and store it in this register)
  198.         addi      r27, response, 0x320          #increment the contents of r31 by 0x320 then store the result back into r27
  199.     }
  200. }
  201.  
  202. void Block12()
  203. {
  204.     _asm
  205.     {
  206.         loc_240
  207.         ldu       r6, 8(r27)                    #start reading from offset at 0x348 & Load a double-word of data into the specified general purpose register, updating the address base.
  208.         andi.     r12, r6, 0x8000               #Logically ANDs the contents of a general-purpose register with an immediate value.
  209.         bne       loc_278
  210.     }
  211. }
  212.  
  213. void Block13()
  214. {
  215.     _asm
  216.     {
  217.         li        r3, 1                         #load immediate (take this constant value known at compile time and store it in this register)
  218.         mtspr     CTR, r3                       #(mtspr) Copies the contents of a general-purpose register into a special-purpose register.
  219.         srdi      r3, r6, 16                    #Rotate double word right immediate
  220.         mr        r4, r3                        #The mr subcommand modifies general purpose, segment, special, or floating point registers.
  221.         andi.     r5, r6, 0x7F                  #Logically ANDs the contents of a general-purpose register with an immediate value.
  222.         cmplwi    r5, 0x10                      #Compare Logical Word Immediate
  223.         blt       loc_290
  224.     }
  225. }
  226.  
  227. void Block14()
  228. {
  229.     _asm
  230.     {
  231.         clrldi    r4, r4, 46                    #Clear left double word immediate
  232.         li        r12, 1                        #load immediate (take this constant value known at compile time and store it in this register)
  233.         insrdi    r4, r12, 1,0                  #Insert double word from right immediate
  234.         b         loc_290
  235.     }
  236. }
  237.  
  238. void Block15()
  239. {
  240.     _asm
  241.     {
  242.         loc_278
  243.         andi.     r5, r6, 0x3FF                 #Logically ANDs the contents of a general-purpose register with an immediate value.
  244.         mtspr     CTR, r5                       #(mtspr) Copies the contents of a general-purpose register into a special-purpose register.
  245.         srdi      r3, r6, 16                    #Rotate double word right immediate
  246.         extrdi    r12, r3, 12,46                #Extract double word and right justify immediate
  247.         add       r4, r25, r12                  #increments the contents of r25 by the contents of r12 storing the result back into r4
  248.         sldi      r5, r5, 1                     #Shift left double word immediate
  249.     }
  250. }
  251.  
  252. void Block16()
  253. {
  254.     _asm
  255.     {
  256.         loc_290
  257.         lbz       r12, 0(r3)                    #Loads a byte of data from a specified location in memory into a general-purpose register and sets the remaining 24 bits to 0.
  258.         stb       r12, 0(r3)                    #Stores a byte of data from a general-purpose register into a specified location in memory.
  259.         dcbst     r0, r3                        #Allows a program to copy the contents of a modified block to main memory.
  260.         addi      r3, r3, 0x80                  #increment the contents of r3 by 0x80 then store the result back into r3
  261.         bdnz+     loc_290
  262.     }
  263. }
  264.  
  265. void Block17()
  266. {
  267.     _asm
  268.     {
  269.         sync      
  270.         bl        XeCryptShaUpdate              #Branch (to call a function)
  271.     }
  272. }
  273.  
  274. void Block18()
  275. {
  276.     _asm
  277.     {
  278.         addic.    r26, r26, -1                  #Performs an addition with carry of the contents of a general-purpose register and an immediate value.
  279.         bne       loc_240
  280.     }
  281. }
  282.  
  283. void Block19()
  284. {
  285.     _asm
  286.     {
  287.         addi      r4, response, 0x30            #(store at response + 0x50) increment the contents of r31 by 0x30 then store the result back into r4
  288.         bl        XeCryptShaFinal               #Branch (to call a function)
  289.     }
  290. }
  291.  
  292. void Block20()
  293. {
  294.     _asm
  295.     {
  296.         bl        XeCryptShaInit                #Branch (to call a function)
  297.     }
  298. }
  299.  
  300. void Block21()
  301. {
  302.     _asm
  303.     {
  304.         li        r5, 0x10                      #load immediate (take this constant value known at compile time and store it in this register)
  305.         li        r4, 0x20                      #' '                                    #Get The CPUKey off the HV
  306.         bl        XeCryptShaUpdate              #Branch (to call a function)
  307.     }
  308. }
  309.  
  310. void Block22()
  311. {
  312.     _asm
  313.     {
  314.         addi      r4, response, 0x44            #(hash CPU key at response + 0x64) increment the contents of r31 by 0x44 then store the result back into r4
  315.         bl        XeCryptShaFinal               #Branch (to call a function)
  316.     }
  317. }
  318.  
  319. void Block23()
  320. {
  321.     _asm
  322.     {
  323.         li        r5, 0x10                      #load immediate (take this constant value known at compile time and store it in this register)
  324.         mtspr     CTR, r5                       #(mtspr) Copies the contents of a general-purpose register into a special-purpose register.
  325.         addi      r4, response, 0x50            #(reading from response at 0x78) increment the contents of r31 by 0x50 then store the result back into r4
  326.         lis       r3, 1                         #Load Immediate Shifted
  327.         insrdi    r3, r3, 47,0                  #Insert double word from right immediate
  328.         ori       r3, r3, 0x38                  #Logically ORs the lower 16 bits of the contents of a general-purpose register with a 16-bit unsigned integer and stores the result in another general-purpose register.
  329.     }
  330. }
  331.  
  332. void Block24()
  333. {
  334.     _asm
  335.     {
  336.         loc_2EC
  337.         ldu       r12, 8(r3)                    #0000000200010040 (0x10040 in HV space) & Load a double-word of data into the specified general purpose register, updating the address base.
  338.         stdu      r12, 8(r4)                    #Store a double-word of data from a general purpose register into a specified memory location. Update the address base.
  339.         bdnz      loc_2EC                       #copy 0x74 bytes of data into response + 0x78
  340.     }
  341. }
  342.  
  343. void Block25()
  344. {
  345.     _asm
  346.     {
  347.         addi      r1, r1, 0xF0                  #increment the contents of r1 by 0xF0 then store the result back into r1
  348.         ld        r12, -8(r1)                   #Load a double-word of data into the specified general purpose register.
  349.         mtspr     LR, r12                       #(mtspr) Copies the contents of a general-purpose register into a special-purpose register.
  350.         ld        r25, -0x40(r1)                #Load a double-word of data into the specified general purpose register.
  351.         ld        r26, -0x38(r1)                #Load a double-word of data into the specified general purpose register.
  352.         ld        r27, -0x30(r1)                #Load a double-word of data into the specified general purpose register.
  353.         ld        r28, -0x28(r1)                #Load a double-word of data into the specified general purpose register.
  354.         ld        r29, -0x20(r1)                #Load a double-word of data into the specified general purpose register.
  355.         ld        r30, -0x18(r1)                #Load a double-word of data into the specified general purpose register.
  356.         ld        response, -0x10(r1)           #Load a double-word of data into the specified general purpose register.
  357.         li        r3, 0                         #load immediate (take this constant value known at compile time and store it in this register)
  358.         blr      
  359.     }
  360. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement