Advertisement
Guest User

Untitled

a guest
May 25th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. uint64_t tsl_decrypt_2(struct Tsl *tsl, uint64_t prop)
  2. {
  3.     struct uint128_t xmm;
  4.     if (!READ(prop, &xmm, 16))
  5.     {
  6.         return 0;
  7.     }
  8.  
  9.     uint32_t key = (uint32_t)xmm.low;
  10.     if (!IsValid(xmm.high))
  11.         return 0;
  12.     if (!mem->IsValid(xmm.high) || !mem->IsValid(key))
  13.         return 0;
  14.  
  15.     int v6; // ecx
  16.     int v7; // edx
  17.     int v8; // eax
  18.  
  19.     if (IDA_LOWORD(key) & 4)
  20.         v6 = ~(~IDA_LOWORD(key) + 117);
  21.     else
  22.         LOWORD(v6) = IDA_LOWORD(key) - 78;
  23.     v7 = (unsigned __int16)v6 ^ ((unsigned __int16)ror2(IDA_HIWORD(key), 8) + 54121);
  24.     v8 = (unsigned __int8)(v6 ^ (ror2(IDA_HIWORD(key), 8) + 105));
  25.     if (v8 & 4)
  26.         v8 = ~(~v8 - 99);
  27.     else
  28.         LOBYTE(v8) = v8 + 66;
  29.  
  30.     auto index = ((unsigned __int8)v8 ^ ((unsigned __int8)(BYTE1(v7) + 49)
  31.         + 238))
  32.         % 128;
  33.  
  34.     uint64_t func = READ64(GET_ADDR(TABLE) + 0x8 * index);
  35.  
  36.     if (auto encValue = decrypt(tsl, func, (rol8(xmm.high, 8 * (IDA_LOWORD(key) & 7u)) - (unsigned int)IDA_LOWORD(key))))
  37.         return ror8(encValue, -59);
  38.  
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement