Advertisement
Guest User

Untitled

a guest
Dec 20th, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 6.39 KB | None | 0 0
  1. //
  2. // This file was generated by the Retargetable Decompiler
  3. // Website: https://retdec.com
  4. // Copyright (c) 2016 Retargetable Decompiler <info@retdec.com>
  5. //
  6.  
  7. #include <stdint.h>
  8. #include <string.h>
  9.  
  10. // ------------------- Function Prototypes --------------------
  11.  
  12. int32_t ValidLac(int32_t decrypt, char * LacData, uint32_t pswdLength, int32_t ProductID);
  13.  
  14. // ------------------------ Functions -------------------------
  15.  
  16. // Address range: 0x0 - 0x245
  17. int32_t ValidLac(int32_t decrypt, char * LacData, uint32_t pswdLength, int32_t ProductID) {
  18.     int32_t v1;
  19.     int32_t v2 = &v1; // ebp
  20.     int32_t result = -1; // 0x23e65
  21.     if (pswdLength % 8 == 0) {
  22.         // 0x22
  23.         int32_t v3;
  24.         GetLacEncData((int32_t)&v3, 26);
  25.         int32_t v4;
  26.         if (decrypt == 0) {
  27.             // 0x22
  28.             v4 = (int32_t)LacData;
  29.             // branch -> 0x80
  30.         } else {
  31.             int32_t v5 = (int32_t)LacData;
  32.             CbcTrplDec(v5, v2 - 2072, v2 - 2094, v2 - 2086, pswdLength);
  33.             memcpy(LacData, (char *)(v2 - 2072), pswdLength);
  34.             v4 = v5;
  35.             // branch -> 0x80
  36.         }
  37.         // 0x80
  38.         if ((int32_t)*LacData == v3 % 256) {
  39.             // 0x91
  40.             uint32_t v6;
  41.             if ((int32_t)*(char *)(v4 + 1) == v6 % 256) {
  42.                 // 0xpswdLength
  43.                 uint32_t v7;
  44.                 if ((int32_t)*(char *)(v4 + 2) == v7 % 256) {
  45.                     // 0xb7
  46.                     uint32_t v8;
  47.                     if ((int32_t)*(char *)(v4 + 3) == v8 % 256) {
  48.                         // 0xdc
  49.                         int32_t v9;
  50.                         if ((int32_t)*(char *)(v4 + 171) == v9) {
  51.                             // 0xee
  52.                             int32_t v10;
  53.                             if ((int32_t)*(char *)(v4 + 172) == v10) {
  54.                                 // 0x100
  55.                                 int32_t v11;
  56.                                 if ((int32_t)*(char *)(v4 + 173) == v11) {
  57.                                     // 0x112
  58.                                     int32_t v12;
  59.                                     if ((int32_t)*(char *)(v4 + 174) == v12) {
  60.                                         // 0x124
  61.                                         int32_t v13;
  62.                                         if ((int32_t)*(char *)(v4 + 175) == v13) {
  63.                                             // 0x147
  64.                                             memset((char *)(v2 - 2104), (int32_t)ValidLac, 26);
  65.                                             int32_t v14 = v4 + 163; // bp+163
  66.                                             ValExpDate(v14);
  67.                                             if (v14 == 0) {
  68.                                                 int32_t v15 = pswdLength - 4;
  69.                                                 ckSum(v4, v15);
  70.                                                 int32_t v16 = v4 + pswdLength;
  71.                                                 if (v15 / 0x1000000 == (int32_t)*(char *)(v16 - 4)) {
  72.                                                     // 0x1ba
  73.                                                     if (v15 / 0x10000 % 256 == (int32_t)*(char *)(v16 - 3)) {
  74.                                                         // 0x1d8
  75.                                                         if (v15 / 256 % 256 == (int32_t)*(char *)(v16 - 2)) {
  76.                                                             // 0x1f6
  77.                                                             if (v15 % 256 == (int32_t)*(char *)(v16 - 1)) {
  78.                                                                 // 0x21b
  79.                                                                 memcpy((char *)ProductID, (char *)(v4 + 147), 16);
  80.                                                                 result = ValidLac;
  81.                                                                 // branch -> 0x23e
  82.                                                             } else {
  83.                                                                 result = -4;
  84.                                                             }
  85.                                                         } else {
  86.                                                             result = -4;
  87.                                                         }
  88.                                                     } else {
  89.                                                         result = -4;
  90.                                                     }
  91.                                                 } else {
  92.                                                     result = -4;
  93.                                                 }
  94.                                             } else {
  95.                                                 result = -4;
  96.                                             }
  97.                                         } else {
  98.                                             result = -3;
  99.                                         }
  100.                                     } else {
  101.                                         result = -3;
  102.                                     }
  103.                                 } else {
  104.                                     result = -3;
  105.                                 }
  106.                             } else {
  107.                                 result = -3;
  108.                             }
  109.                         } else {
  110.                             result = -3;
  111.                         }
  112.                     } else {
  113.                         result = -2;
  114.                     }
  115.                 } else {
  116.                     result = -2;
  117.                 }
  118.             } else {
  119.                 result = -2;
  120.             }
  121.         } else {
  122.             result = -2;
  123.         }
  124.     }
  125.     // 0x23e
  126.     return result;
  127. }
  128.  
  129. // --------------- Dynamically Linked Functions ---------------
  130.  
  131. // void CbcTrplDec(int32_t decrypt, int32_t LacData, int32_t pswdLength, int32_t ProductID, int32_t a5);
  132. // void ckSum(int32_t decrypt, int32_t LacData);
  133. // void GetLacEncData(int32_t decrypt, int32_t LacData);
  134. // void * memcpy(void * restrict dest, const void * restrict src, size_t n);
  135. // void * memset(void * s, int c, size_t n);
  136. // void ValExpDate(int32_t decrypt);
  137.  
  138. // --------------------- Meta-Information ---------------------
  139.  
  140. // Detected compiler/packer: gcc (3.4.3)
  141. // Detected functions: 1
  142. // Decompiler release: v2.2 (2016-08-25)
  143. // Decompilation date: 2016-09-07 04:14:32
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement