Advertisement
Guest User

samsung dll decrypt

a guest
Nov 21st, 2017
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 12.76 KB | None | 0 0
  1.  public unsafe string GenerateServerHello(string password)
  2.     {
  3.       byte* numPtr = (byte*) <Module>.new[]((uint) (*(int*) ((IntPtr) this._ctx + 4) + 148));
  4.       basic_string<char,std::char_traits<char>,std::allocator<char> > stdAllocatorChar1;
  5.       basic_string<char,std::char_traits<char>,std::allocator<char> >* stdAllocatorCharPtr1 = <Module>.Pairing.StringConverter.String2StdString(&stdAllocatorChar1, password);
  6.       uint length;
  7.       // ISSUE: fault handler
  8.       try
  9.       {
  10.         <Module>.SPCApi.GeneratorServerHello(this._impl, this._ctx, 16U > (uint) *(int*) ((IntPtr) stdAllocatorCharPtr1 + 20) ? (byte*) stdAllocatorCharPtr1 : (byte*) *(int*) stdAllocatorCharPtr1, (uint) password.Length, (byte*) *(int*) this._ctx, numPtr, &length);
  11.       }
  12.       __fault
  13.       {
  14.         // ISSUE: method pointer
  15.         // ISSUE: cast to a function pointer type
  16.         <Module>.___CxxCallUnwindDtor((__FnPtr<void (void*)>) __methodptr(std.basic_string<char,std::char_traits<char>,std::allocator<char> >.{dtor}), (void*) &stdAllocatorChar1);
  17.       }
  18.       <Module>.std.basic_string<char,std::char_traits<char>,std::allocator<char> >._Tidy(&stdAllocatorChar1, true, 0U);
  19.       basic_string<char,std::char_traits<char>,std::allocator<char> > stdAllocatorChar2;
  20.       basic_string<char,std::char_traits<char>,std::allocator<char> >* stdAllocatorCharPtr2 = &stdAllocatorChar2;
  21.       return <Module>.Pairing.StringConverter.StdString2String(<Module>.chr2hex(&stdAllocatorChar2, numPtr, length));
  22.     }
  23.  
  24.  
  25.  
  26.  
  27.     internal static unsafe int SAkepApi.GeneratorServerHello([In] SAkepApi* obj0, Handle_CTX* ctx, byte* pPwd, uint nPwdLen, byte* pUserID, uint nUserIDLen, byte* pOutMsg, uint* nOutLen)
  28.   {
  29.     $ArrayType$$$BY0IA@E arrayTypeBy0IaE1;
  30.     // ISSUE: explicit reference operation
  31.     // ISSUE: cast to a reference type
  32.     // ISSUE: explicit reference operation
  33.     ^(sbyte&) @arrayTypeBy0IaE1 = (sbyte) 0;
  34.     // ISSUE: cast to a reference type
  35.     // ISSUE: initblk instruction
  36.     __memset(($ArrayType$$$BY0IA@E&) ((IntPtr) &arrayTypeBy0IaE1 + 1), 0, (int) sbyte.MaxValue);
  37.     $ArrayType$$$BY0IA@E arrayTypeBy0IaE2;
  38.     // ISSUE: explicit reference operation
  39.     // ISSUE: cast to a reference type
  40.     // ISSUE: explicit reference operation
  41.     ^(sbyte&) @arrayTypeBy0IaE2 = (sbyte) 0;
  42.     // ISSUE: cast to a reference type
  43.     // ISSUE: initblk instruction
  44.     __memset(($ArrayType$$$BY0IA@E&) ((IntPtr) &arrayTypeBy0IaE2 + 1), 0, (int) sbyte.MaxValue);
  45.     $ArrayType$$$BY0IA@E arrayTypeBy0IaE3;
  46.     // ISSUE: explicit reference operation
  47.     // ISSUE: cast to a reference type
  48.     // ISSUE: explicit reference operation
  49.     ^(sbyte&) @arrayTypeBy0IaE3 = (sbyte) 0;
  50.     // ISSUE: cast to a reference type
  51.     // ISSUE: initblk instruction
  52.     __memset(($ArrayType$$$BY0IA@E&) ((IntPtr) &arrayTypeBy0IaE3 + 1), 0, (int) sbyte.MaxValue);
  53.     uint num1 = 0;
  54.     $ArrayType$$$BY0IA@E arrayTypeBy0IaE4;
  55.     // ISSUE: explicit reference operation
  56.     // ISSUE: cast to a reference type
  57.     // ISSUE: explicit reference operation
  58.     ^(sbyte&) @arrayTypeBy0IaE4 = (sbyte) 0;
  59.     // ISSUE: cast to a reference type
  60.     // ISSUE: initblk instruction
  61.     __memset(($ArrayType$$$BY0IA@E&) ((IntPtr) &arrayTypeBy0IaE4 + 1), 0, (int) sbyte.MaxValue);
  62.     <Module>.DRMLOG_Message(&<Module>.SPCLogCTX, 4, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 582, (sbyte*) &<Module>.??_C@_0DB@JPKHBDCI@?$CL?$CL?$CL?$CL?$CL?$CL?$CL?$CL?$CL?$CL?$CL?5GeneratorServerHello@, __arglist ());
  63.     if ((IntPtr) ctx == IntPtr.Zero)
  64.     {
  65.       <Module>.DRMLOG_Message(&<Module>.SPCLogCTX, 4, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 586, (sbyte*) &<Module>.??_C@_0DO@IKOGCEKM@GeneratorServerHello?5Input?5param@, __arglist (-183));
  66.       return -183;
  67.     }
  68.     if (*(int*) ((IntPtr) ctx + 60) >= 129)
  69.     {
  70.       *pOutMsg = (byte) 1;
  71.       pOutMsg[1] = (byte) *(int*) ((IntPtr) ctx + 60);
  72.       // ISSUE: initblk instruction
  73.       __memset((IntPtr) (pOutMsg + 2), 0, 4);
  74.       pOutMsg[6] = (byte) 0;
  75.       <Module>.ConvertUint32ToUint8(0U, pOutMsg + 7);
  76.       *nOutLen = 11U;
  77.       *(int*) ((IntPtr) ctx + 56) = 7;
  78.       return -182;
  79.     }
  80.     if ((IntPtr) pPwd != IntPtr.Zero && nPwdLen > 0U && ((IntPtr) pUserID != IntPtr.Zero && (IntPtr) pOutMsg != IntPtr.Zero))
  81.     {
  82.       int num2 = *(int*) ((IntPtr) ctx + 56);
  83.       if (num2 != 3)
  84.       {
  85.         *(int*) ((IntPtr) ctx + 60) = 133;
  86.         <Module>.DRMLOG_Message(&<Module>.SPCLogCTX, 4, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 613, (sbyte*) &<Module>.??_C@_0EA@MBCGCBIF@GeneratorServerHello?5State?5Error@, __arglist (num2, -183));
  87.         return -191;
  88.       }
  89.       *pOutMsg = (byte) 1;
  90.       pOutMsg[1] = (byte) 2;
  91.       // ISSUE: initblk instruction
  92.       __memset((IntPtr) (pOutMsg + 2), 0, 4);
  93.       pOutMsg[6] = (byte) 0;
  94.       uint uData = nUserIDLen + 132U;
  95.       <Module>.ConvertUint32ToUint8(uData, pOutMsg + 7);
  96.       <Module>.ConvertUint32ToUint8(nUserIDLen, pOutMsg + 11);
  97.       // ISSUE: cpblk instruction
  98.       __memcpy((IntPtr) (pOutMsg + 15), (IntPtr) pUserID, (int) nUserIDLen);
  99.       uint num3 = nUserIDLen + 15U;
  100.       int gy = <Module>.SAkepApi.GetGy(obj0, pPwd, nPwdLen, (byte*) &arrayTypeBy0IaE1, (byte*) &arrayTypeBy0IaE2);
  101.       if (gy != 0)
  102.       {
  103.         <Module>.DRMLOG_Message(&<Module>.SPCLogCTX, 4, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 631, (sbyte*) &<Module>.??_C@_0DG@JDLAFDII@GeneratorServerHello?5GetGyWc?5Err@, __arglist (gy));
  104.         <Module>.DRMLOG_HexaBytes(&<Module>.SPCLogCTX, 4, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 633, (sbyte*) &<Module>.??_C@_08NLHBPEGP@password?$AA@, pPwd, (int) nPwdLen);
  105.         <Module>.DRMLOG_HexaBytes(&<Module>.SPCLogCTX, 4, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 634, (sbyte*) &<Module>.??_C@_03DOKMNJIF@pGy?$AA@, (byte*) &arrayTypeBy0IaE1, 128);
  106.         <Module>.DRMLOG_HexaBytes(&<Module>.SPCLogCTX, 4, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 635, (sbyte*) &<Module>.??_C@_09NACEKEIA@pPrivateY?$AA@, (byte*) &arrayTypeBy0IaE2, 128);
  107.         return -200;
  108.       }
  109.       <Module>.DRMLOG_HexaBytes(&<Module>.SPCLogCTX, 2, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 638, (sbyte*) &<Module>.??_C@_0P@BGNPPNFM@Input?5password?$AA@, pPwd, (int) nPwdLen);
  110.       <Module>.DRMLOG_HexaBytes(&<Module>.SPCLogCTX, 2, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 639, (sbyte*) &<Module>.??_C@_0BC@NLKCFFAN@My?5public?5Key?5pGy?$AA@, (byte*) &arrayTypeBy0IaE1, 128);
  111.       <Module>.DRMLOG_HexaBytes(&<Module>.SPCLogCTX, 2, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 640, (sbyte*) &<Module>.??_C@_09NACEKEIA@pPrivateY?$AA@, (byte*) &arrayTypeBy0IaE2, 128);
  112.       // ISSUE: explicit reference operation
  113.       // ISSUE: cpblk instruction
  114.       __memcpy((IntPtr) obj0, @arrayTypeBy0IaE2, 128);
  115.       // ISSUE: explicit reference operation
  116.       // ISSUE: cpblk instruction
  117.       __memcpy((IntPtr) obj0 + 128, @arrayTypeBy0IaE1, 128);
  118.       <Module>.SAkepApi.SetMac(obj0, pUserID, nUserIDLen);
  119.       int num4 = <Module>.SAkepApi.EncryptGy(obj0, pPwd, nPwdLen, (byte*) &arrayTypeBy0IaE1, 128U, (byte*) &arrayTypeBy0IaE3, &num1);
  120.       if (num4 != 0)
  121.       {
  122.         <Module>.DRMLOG_Message(&<Module>.SPCLogCTX, 4, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 651, (sbyte*) &<Module>.??_C@_0DE@PKJEMDGG@GeneratorServerHello?5GetGy?5Error@, __arglist (num4));
  123.         <Module>.DRMLOG_HexaBytes(&<Module>.SPCLogCTX, 4, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 653, (sbyte*) &<Module>.??_C@_08NLHBPEGP@password?$AA@, pPwd, (int) nPwdLen);
  124.         <Module>.DRMLOG_HexaBytes(&<Module>.SPCLogCTX, 4, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 654, (sbyte*) &<Module>.??_C@_03DOKMNJIF@pGy?$AA@, (byte*) &arrayTypeBy0IaE1, 128);
  125.         <Module>.DRMLOG_HexaBytes(&<Module>.SPCLogCTX, 4, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 655, (sbyte*) &<Module>.??_C@_09NACEKEIA@pPrivateY?$AA@, (byte*) &arrayTypeBy0IaE2, 128);
  126.         return -215;
  127.       }
  128.       <Module>.DRMLOG_HexaBytes(&<Module>.SPCLogCTX, 4, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 659, (sbyte*) &<Module>.??_C@_08NLHBPEGP@password?$AA@, pPwd, (int) nPwdLen);
  129.       <Module>.DRMLOG_HexaBytes(&<Module>.SPCLogCTX, 4, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 660, (sbyte*) &<Module>.??_C@_03DOKMNJIF@pGy?$AA@, (byte*) &arrayTypeBy0IaE1, 128);
  130.       <Module>.DRMLOG_HexaBytes(&<Module>.SPCLogCTX, 4, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 661, (sbyte*) &<Module>.??_C@_0O@FPBBJGAB@Encrypted?5pGy?$AA@, (byte*) &arrayTypeBy0IaE3, (int) num1);
  131.       uint num5 = 0;
  132.       do
  133.       {
  134.         int num6 = (int) <Module>.SWAPv2_Process((byte*) &<Module>.pParameterDataEncTbl, 164432U, (byte*) ((int) num5 + (IntPtr) &arrayTypeBy0IaE3), (byte*) ((int) num5 + (IntPtr) &arrayTypeBy0IaE4));
  135.         num5 += 16U;
  136.       }
  137.       while (num5 < 128U);
  138.       // ISSUE: explicit reference operation
  139.       // ISSUE: cpblk instruction
  140.       __memcpy((int) num3 + (IntPtr) pOutMsg, @arrayTypeBy0IaE4, 128);
  141.       uint num7 = num3 + 128U;
  142.       *(sbyte*) ((int) num7 + (IntPtr) pOutMsg) = (sbyte) 0;
  143.       uint num8 = num7 + 1U;
  144.       // ISSUE: initblk instruction
  145.       __memset((int) num8 + (IntPtr) pOutMsg, 0, 4);
  146.       uint num9 = num8 + 4U;
  147.       byte* pData = (byte*) <Module>.malloc(uData);
  148.       if ((IntPtr) pData == IntPtr.Zero)
  149.       {
  150.         *(int*) ((IntPtr) ctx + 60) = 135;
  151.         <Module>.DRMLOG_Message(&<Module>.SPCLogCTX, 4, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 675, (sbyte*) &<Module>.??_C@_0DP@DICFBOFC@GeneratorServerHello?5pTempHash?5m@, __arglist (-180));
  152.         return -180;
  153.       }
  154.       <Module>.ConvertUint32ToUint8(nUserIDLen, pData);
  155.       // ISSUE: cpblk instruction
  156.       __memcpy((IntPtr) (pData + 4), (IntPtr) pUserID, (int) nUserIDLen);
  157.       // ISSUE: explicit reference operation
  158.       // ISSUE: cpblk instruction
  159.       __memcpy((int) nUserIDLen + (IntPtr) pData + 4, @arrayTypeBy0IaE4, 128);
  160.       <Module>.DRMLOG_HexaBytes(&<Module>.SPCLogCTX, 2, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 685, (sbyte*) &<Module>.??_C@_0CF@MFPJFCMH@GeneratorServerHello?5previos?5Mes@, pData, (int) nUserIDLen + 132);
  161.       _CryptoCoreContainer* cryptoCoreContainer = <Module>.create_CryptoCoreContainer(1022U);
  162.       if ((IntPtr) cryptoCoreContainer == IntPtr.Zero)
  163.       {
  164.         <Module>.free((void*) pData);
  165.         *(int*) ((IntPtr) ctx + 60) = 137;
  166.         <Module>.DRMLOG_Message(&<Module>.SPCLogCTX, 4, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 693, (sbyte*) &<Module>.??_C@_0EJ@CKGLIJLJ@GeneratorServerHello?5create_Cryp@, __arglist (-180));
  167.         return -180;
  168.       }
  169.       _CryptoCoreContainer* cryptoCoreContainerPtr1 = cryptoCoreContainer;
  170.       int num10 = 16;
  171.       // ISSUE: cast to a function pointer type
  172.       // ISSUE: function pointer call
  173.       int num11 = __calli((__FnPtr<int (_CryptoCoreContainer*)>) *(int*) ((IntPtr) cryptoCoreContainerPtr1 + num10))(cryptoCoreContainerPtr1);
  174.       _CryptoCoreContainer* cryptoCoreContainerPtr2 = cryptoCoreContainer;
  175.       byte* numPtr = pData;
  176.       int num12 = (int) uData;
  177.       // ISSUE: cast to a function pointer type
  178.       // ISSUE: function pointer call
  179.       int num13 = __calli((__FnPtr<int (_CryptoCoreContainer*, byte*, uint)>) *(int*) ((IntPtr) cryptoCoreContainer + 20))((uint) cryptoCoreContainerPtr2, numPtr, (_CryptoCoreContainer*) num12);
  180.       _CryptoCoreContainer* cryptoCoreContainerPtr3 = cryptoCoreContainer;
  181.       IntPtr num14 = (IntPtr) ctx + 36;
  182.       // ISSUE: cast to a function pointer type
  183.       // ISSUE: function pointer call
  184.       int num15 = __calli((__FnPtr<int (_CryptoCoreContainer*, byte*)>) *(int*) ((IntPtr) cryptoCoreContainer + 24))((byte*) cryptoCoreContainerPtr3, (_CryptoCoreContainer*) num14);
  185.       <Module>.destroy_CryptoCoreContainer(cryptoCoreContainer);
  186.       <Module>.DRMLOG_HexaBytes(&<Module>.SPCLogCTX, 2, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 702, (sbyte*) &<Module>.??_C@_0CK@GELLFKC@GeneratorServerHello?5previos?5Has@, (byte*) ((IntPtr) ctx + 36), 20);
  187.       <Module>.free((void*) pData);
  188.       *(int*) ((IntPtr) ctx + 56) = 2;
  189.       *nOutLen = num9;
  190.       return 0;
  191.     }
  192.     *(int*) ((IntPtr) ctx + 60) = 148;
  193.     <Module>.DRMLOG_Message(&<Module>.SPCLogCTX, 4, (sbyte*) &<Module>.??_C@_0BE@CPNAOIKD@?4?4?2?4?4?2Src?2SAKEP?4cpp?$AA@, 605, (sbyte*) &<Module>.??_C@_0DO@IKOGCEKM@GeneratorServerHello?5Input?5param@, __arglist (-183));
  194.     return -181;
  195.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement