Advertisement
Guest User

Untitled

a guest
May 27th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.40 KB | None | 0 0
  1. uint64_t tsl_decrypt_ulevel(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.     __int64 v6 = IDA_LOWORD(key) & 2 ? xmm.high - (unsigned int)key : xmm.high + (unsigned int)key;
  16.  
  17.     auto index = ((unsigned __int8)((rol2(IDA_HIWORD(key), 8) + 61) ^ ror2(IDA_LOWORD(key), 8)) ^ ((unsigned __int8)(((unsigned __int16)((rol2(IDA_HIWORD(key), 8) + 12093) ^ ror2(IDA_LOWORD(key), 8)) >> 8) + 91) + 70))
  18.         % 128;
  19.  
  20.     uint64_t func = READ64(GET_ADDR(TABLE) + 0x8 * index);
  21.  
  22.     if (auto encValue = decrypt(tsl, func, v6))
  23.         return ror8(encValue, 73);
  24.  
  25.     return 0;
  26. }
  27.  
  28. uint64_t tsl_decrypt_actor(struct Tsl *tsl, uint64_t prop)
  29. {
  30.     struct uint128_t xmm;
  31.     if (!READ(prop, &xmm, 16))
  32.     {
  33.         return 0;
  34.     }
  35.  
  36.     uint32_t key = (uint32_t)xmm.low;
  37.     if (!IsValid(xmm.high))
  38.         return 0;
  39.     if (!mem->IsValid(xmm.high) || !mem->IsValid(key))
  40.         return 0;
  41.  
  42.     auto index = ((unsigned __int8)(IDA_LOWORD(key) ^ (IDA_HIWORD(key) - 72)) ^ (((unsigned __int16)(IDA_LOWORD(key) ^ (IDA_HIWORD(key) + 26808)) >> 8) + 144))
  43.         % 128;
  44.  
  45.     uint64_t func = READ64(GET_ADDR(TABLE) + 0x8 * index);
  46.  
  47.     if (auto encValue = decrypt(tsl, func, (ror8(xmm.high, 8 * (IDA_LOWORD(key) & 7u)) ^ (unsigned int)key)))
  48.         return ror8(encValue, -40);
  49.  
  50.     return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement