Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

little felling of dex

By: a guest on Jun 5th, 2012  |  syntax: None  |  size: 13.82 KB  |  hits: 225  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Been playing around as i always do  :)
  2.  
  3. been bugging me there arent any disasemplers that can view any code, only dissasemply.
  4.  
  5. and some interesting stuff came up
  6.  
  7. first you should build all the samples and projects in the sdk.
  8.  
  9. you would need to do an batch build with both debug and release.
  10.  
  11. after build you would have debug and an realese folder.
  12.  
  13. now open up tuner software from the sdk.
  14.  
  15. Choose open static analyze
  16.  
  17. now if you open any elf from the build, and open them in the tuner it looks like this after
  18. using sample from libsecure release build.
  19. Aes.obj
  20. right click it, then it shows disasemply
  21. [img]http://i.imgur.com/AVEGX.png[/img]
  22. now this is okay since you can get some info in tuner what the functions are for.
  23.  
  24. but now comes the neat part if you do the same with the debug buils
  25. Aes.obj
  26.  
  27. right click it.
  28.  
  29. shows all the source code insteed  :D
  30.  
  31. [code]/* SCE CONFIDENTIAL
  32.  * Copyright (C) 2011 Sony Computer Entertainment Inc.
  33.  * All Rights Reserved.
  34.  */
  35.  
  36. /*
  37.  *                   libsecure encryption/decryption sample file
  38.  *
  39.  *                               - libsecure -
  40.  *
  41.  *                       samples/ps3/cipher/source/aes.c
  42.  *
  43.  *       Version        Date            Design      Log
  44.  *  --------------------------------------------------------------------
  45.  *      2.00            Nov,19,2010     Emmanuel Poitier    Naming changes
  46.  *      1.00            Apr,04,2008     David Carter        Initial version
  47.  */
  48.  
  49. // ---------------------------------------------------------------------
  50. // Includes
  51. // ---------------------------------------------------------------------
  52.  
  53. #include "libsecure.h"
  54. #include "main.h"
  55.  
  56. /*E A symmetric key */
  57. static unsigned char s_symmetricKeyArray[16]= {
  58.         0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11,
  59.         0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99
  60. };
  61.  
  62. static SceLibSecureSymmetricKey s_symmetricKey = {
  63.         sizeof(s_symmetricKeyArray), (void*)(&s_symmetricKeyArray)
  64. };
  65.  
  66. /* The plaintext message */
  67. static char s_message[] = "AES testing message.";
  68.  
  69.  
  70. // ---------------------------------------------------------------------
  71. // Functions
  72. // ---------------------------------------------------------------------
  73.  
  74. SceLibSecureErrorType processAesEcbNoPadding()
  75. {
  76.         SceLibSecureErrorType err;
  77.  
  78.         printf("--------------------------------------------------\n\n");
  79.  
  80.         /*E ECB encryption / decryption */
  81.         err = encryptDecryptNoPadding(SCE_LIBSECURE_CIPHER_AES, SCE_LIBSECURE_BLOCKCIPHERMODE_ECB,
  82.                 SCE_LIBSECURE_PADDING_NONE, &s_symmetricKey, s_message, 0);
  83.         if (err != SCE_LIBSECURE_OK) return err;
  84.  
  85.         printf("--------------------------------------------------\n\n");
  86.  
  87.         /*E ECB encryption / decryption */
  88.         err = encryptDecryptNoPadding(SCE_LIBSECURE_CIPHER_AES, SCE_LIBSECURE_BLOCKCIPHERMODE_ECB,
  89.                 SCE_LIBSECURE_PADDING_NONE_NORMAL, &s_symmetricKey, s_message, 0);
  90.         if (err != SCE_LIBSECURE_OK) return err;
  91.  
  92.         printf("--------------------------------------------------\n\n");
  93.  
  94.         /*E ECB encryption / decryption */
  95.         err = encryptDecryptNoPadding(SCE_LIBSECURE_CIPHER_AES, SCE_LIBSECURE_BLOCKCIPHERMODE_ECB,
  96.                 SCE_LIBSECURE_PADDING_NONE_STEALING, &s_symmetricKey, s_message, 0);
  97.         if (err != SCE_LIBSECURE_OK) return err;
  98.  
  99.         printf("--------------------------------------------------\n\n");
  100.  
  101.     return SCE_LIBSECURE_OK;
  102. }
  103.  
  104. SceLibSecureErrorType processAesEcbWithPadding()
  105. {
  106.         SceLibSecureErrorType err;
  107.  
  108.         printf("--------------------------------------------------\n\n");
  109.  
  110.         /*E ECB encryption / decryption */
  111.         err = encryptDecryptWithPadding(SCE_LIBSECURE_CIPHER_AES, SCE_LIBSECURE_BLOCKCIPHERMODE_ECB,
  112.                 SCE_LIBSECURE_PADDING_NIL, &s_symmetricKey, s_message, 0);
  113.         if (err != SCE_LIBSECURE_OK) return err;
  114.  
  115.         printf("--------------------------------------------------\n\n");
  116.  
  117.         /*E ECB encryption / decryption */
  118.         err = encryptDecryptWithPadding(SCE_LIBSECURE_CIPHER_AES, SCE_LIBSECURE_BLOCKCIPHERMODE_ECB,
  119.                 SCE_LIBSECURE_PADDING_RANDOM, &s_symmetricKey, s_message, 0);
  120.         if (err != SCE_LIBSECURE_OK) return err;
  121.  
  122.         printf("--------------------------------------------------\n\n");
  123.  
  124.     return SCE_LIBSECURE_OK;
  125. }
  126.  
  127. SceLibSecureErrorType processAesCbcNoPadding()
  128. {
  129.         SceLibSecureErrorType err;
  130.  
  131.         printf("--------------------------------------------------\n\n");
  132.  
  133.         /*E CBC encryption / decryption */
  134.         err = encryptDecryptNoPadding(SCE_LIBSECURE_CIPHER_AES, SCE_LIBSECURE_BLOCKCIPHERMODE_CBC,
  135.                 SCE_LIBSECURE_PADDING_NONE, &s_symmetricKey, s_message, 0);
  136.         if (err != SCE_LIBSECURE_OK) return err;
  137.  
  138.         printf("--------------------------------------------------\n\n");
  139.  
  140.         /*E CBC encryption / decryption */
  141.         err = encryptDecryptNoPadding(SCE_LIBSECURE_CIPHER_AES, SCE_LIBSECURE_BLOCKCIPHERMODE_CBC,
  142.                 SCE_LIBSECURE_PADDING_NONE_NORMAL, &s_symmetricKey, s_message, 0);
  143.         if (err != SCE_LIBSECURE_OK) return err;
  144.  
  145.         printf("--------------------------------------------------\n\n");
  146.  
  147.         /*E CBC encryption / decryption */
  148.         err = encryptDecryptNoPadding(SCE_LIBSECURE_CIPHER_AES, SCE_LIBSECURE_BLOCKCIPHERMODE_CBC,
  149.                 SCE_LIBSECURE_PADDING_NONE_STEALING, &s_symmetricKey, s_message, 0);
  150.         if (err != SCE_LIBSECURE_OK) return err;
  151.  
  152.         printf("--------------------------------------------------\n\n");
  153.  
  154.         /*E CBC encryption / decryption */
  155.         err = encryptDecryptNoPadding(SCE_LIBSECURE_CIPHER_AES, SCE_LIBSECURE_BLOCKCIPHERMODE_CBC,
  156.                 SCE_LIBSECURE_PADDING_NONE_BLKTERM, &s_symmetricKey, s_message, 0);
  157.         if (err != SCE_LIBSECURE_OK) return err;
  158.  
  159.         printf("--------------------------------------------------\n\n");
  160.  
  161.     return SCE_LIBSECURE_OK;
  162. }
  163.  
  164. SceLibSecureErrorType processAesCbcWithPadding()
  165. {
  166.         SceLibSecureErrorType err;
  167.  
  168.         printf("--------------------------------------------------\n\n");
  169.  
  170.         /*E CBC encryption / decryption */
  171.         err = encryptDecryptWithPadding(SCE_LIBSECURE_CIPHER_AES, SCE_LIBSECURE_BLOCKCIPHERMODE_CBC,
  172.                 SCE_LIBSECURE_PADDING_NIL, &s_symmetricKey, s_message, 0);
  173.         if (err != SCE_LIBSECURE_OK) return err;
  174.  
  175.         printf("--------------------------------------------------\n\n");
  176.  
  177.         /*E CBC encryption / decryption */
  178.         err = encryptDecryptWithPadding(SCE_LIBSECURE_CIPHER_AES, SCE_LIBSECURE_BLOCKCIPHERMODE_CBC,
  179.                 SCE_LIBSECURE_PADDING_RANDOM, &s_symmetricKey, s_message, 0);
  180.         if (err != SCE_LIBSECURE_OK) return err;
  181.  
  182.         printf("--------------------------------------------------\n\n");
  183.  
  184.     return SCE_LIBSECURE_OK;
  185. }
  186.  
  187. SceLibSecureErrorType processAesCtrNoPadding()
  188. {
  189.         SceLibSecureErrorType err;
  190.  
  191.         printf("--------------------------------------------------\n\n");
  192.  
  193.         /*E CTR encryption / decryption */
  194.         err = encryptDecryptNoPadding(SCE_LIBSECURE_CIPHER_AES, SCE_LIBSECURE_BLOCKCIPHERMODE_CTR,
  195.                 SCE_LIBSECURE_PADDING_NONE, &s_symmetricKey, s_message, 0);
  196.         if (err != SCE_LIBSECURE_OK) return err;
  197.  
  198.         printf("--------------------------------------------------\n\n");
  199.  
  200.         /*E CTR encryption / decryption */
  201.         err = encryptDecryptNoPadding(SCE_LIBSECURE_CIPHER_AES, SCE_LIBSECURE_BLOCKCIPHERMODE_CTR,
  202.                 SCE_LIBSECURE_PADDING_NONE_NORMAL, &s_symmetricKey, s_message, 0);
  203.         if (err != SCE_LIBSECURE_OK) return err;
  204.  
  205.         printf("--------------------------------------------------\n\n");
  206.  
  207.     return SCE_LIBSECURE_OK;
  208. }
  209.  
  210. SceLibSecureErrorType processAes()
  211. {
  212.         SceLibSecureErrorType err;
  213.  
  214.         /*E ECB with no padding encryption / decryption */
  215.         err = processAesEcbNoPadding();
  216.         if (err != SCE_LIBSECURE_OK) return err;
  217.  
  218.         /*E CBC with no padding encryption / decryption */
  219.         err = processAesCbcNoPadding();
  220.         if (err != SCE_LIBSECURE_OK) return err;
  221.  
  222.         /*E CTR with no padding encryption / decryption */
  223.         err = processAesCtrNoPadding();
  224.         if (err != SCE_LIBSECURE_OK) return err;
  225.  
  226.         /*E ECB with padding encryption / decryption */
  227.         err = processAesEcbWithPadding();
  228.         if (err != SCE_LIBSECURE_OK) return err;
  229.  
  230.         /*E CBC with padding encryption / decryption */
  231.         err = processAesCbcWithPadding();
  232.         if (err != SCE_LIBSECURE_OK) return err;
  233.  
  234.     return SCE_LIBSECURE_OK;
  235. }
  236.  
  237. [/code]
  238.  
  239. this works on all the debug objects files in debug build.
  240.  
  241.  could be off use when looking at big builds
  242. and when building you own
  243.  
  244. and one more thing the tuner can take alot off the extracted files that i posted,
  245. and show there build too.
  246. also some of the files if you used dev_blinds to copy intire dev flash/2/3 from ps3
  247. some of the elf files there are debugs and the pic files are also shown and how there build there.
  248. And work also if you take all the  *.a files extract them with 7zip you have alot off *.o files they work there also.
  249.  
  250. so for exampel libguard.a extarcted there are alot of *.o inside
  251. just one in the tuner with sources
  252. [code]C:\HOME\KANEE\SVNWORK\PS3-SVN\SVN\SYS\TRUNK\SDK\TARGET\SPU\INCLUDE\SPU_INTERNALS.H
  253.       si_wrch(MFC_EAH,si_from_uint(eahi));
  254. 00000324 40800026 il r038,0x0000                            EVN
  255. C:\HOME\KANEE\SVNWORK\PS3-SVN\SVN\SYS\TRUNK\SPU_RUNTIME\IMPLEMENTATION\SRC\SPURS3\JM2\SPU\JOB_CRT_AUXILIARY.C
  256. 00000328 340004A3 lqd r035,0x0000(r009)                     ODD
  257. 0000032C 8482C2A7 selb r036,r005,r011,r039                  EVN
  258. C:\HOME\KANEE\SVNWORK\PS3-SVN\SVN\SYS\TRUNK\SDK\TARGET\SPU\INCLUDE\SPU_INTERNALS.H
  259. [...]
  260. {
  261.       si_wrch(MFC_LSA,si_from_ptr(ls));
  262.       si_wrch(MFC_EAL,si_from_uint(ea));
  263.       si_wrch(MFC_Size,si_from_uint(size));
  264.       si_wrch(MFC_TagID,si_from_uint(tagid));
  265.       si_wrch(MFC_Cmd,si_from_uint(cmd));
  266. }
  267. static __inline__ void
  268. spu_mfcdma64(volatile void *ls, unsigned int eahi, unsigned int ealow, unsigned int size, unsigned int tagid, unsigned int cmd)
  269. {
  270.       si_wrch(MFC_LSA,si_from_ptr(ls));
  271. 00000330 21A00802 wrch $MFC_LSA,r002                        ODD
  272.       si_wrch(MFC_EAH,si_from_uint(eahi));
  273. 00000334 21A008A6 wrch $MFC_EAH,r038
  274.       si_wrch(MFC_Size,si_from_uint(size));
  275. 00000338 04001225 lr r037,r036
  276. C:\HOME\KANEE\SVNWORK\PS3-SVN\SVN\SYS\TRUNK\SPU_RUNTIME\IMPLEMENTATION\SRC\SPURS3\JM2\SPU\JOB_CRT_AUXILIARY.C
  277. 0000033C 08015205 sf r005,r036,r005                         EVN
  278. C:\HOME\KANEE\SVNWORK\PS3-SVN\SVN\SYS\TRUNK\SDK\TARGET\SPU\INCLUDE\SPU_INTERNALS.H
  279.       si_wrch(MFC_EAL,si_from_uint(ealow));
  280. 00000340 21A0090A wrch $MFC_EAL,r010                        ODD
  281. C:\HOME\KANEE\SVNWORK\PS3-SVN\SVN\SYS\TRUNK\SPU_RUNTIME\IMPLEMENTATION\SRC\SPURS3\JM2\SPU\JOB_CRT_AUXILIARY.C
  282. 00000344 18090387 a r007,r007,r036                          EVN
  283. C:\HOME\KANEE\SVNWORK\PS3-SVN\SVN\SYS\TRUNK\SDK\TARGET\SPU\INCLUDE\SPU_INTERNALS.H
  284.       si_wrch(MFC_Size,si_from_uint(size));
  285. 00000348 21A009A5 wrch $MFC_Size,r037                       ODD
  286. C:\HOME\KANEE\SVNWORK\PS3-SVN\SVN\SYS\TRUNK\SPU_RUNTIME\IMPLEMENTATION\SRC\SPURS3\JM2\SPU\JOB_CRT_AUXILIARY.C
  287. 0000034C 18090306 a r006,r006,r036                          EVN
  288. 00000350 3B8251A2 rotqby r034,r035,r009                     ODD
  289. C:\HOME\KANEE\SVNWORK\PS3-SVN\SVN\SYS\TRUNK\SDK\TARGET\SPU\INCLUDE\SPU_INTERNALS.H
  290.       si_wrch(MFC_TagID,si_from_uint(tagid));
  291. 00000354 21A00A22 wrch $MFC_TagID,r034                     03 (00000350) REG
  292.       si_wrch(MFC_Cmd,si_from_uint(cmd));
  293. 00000358 21A00A8F wrch $MFC_Cmd,r015                        ODD
  294. [...]
  295. {
  296.       si_wrch(MFC_LSA,si_from_ptr(ls));
  297.       si_wrch(MFC_EAL,si_from_uint(ea));
  298.       si_wrch(MFC_Size,si_from_uint(size));
  299.       si_wrch(MFC_TagID,si_from_uint(tagid));
  300.       si_wrch(MFC_Cmd,si_from_uint(cmd));
  301. }
  302. static __inline__ void
  303. spu_mfcdma64(volatile void *ls, unsigned int eahi, unsigned int ealow, unsigned int size, unsigned int tagid, unsigned int cmd)
  304. {
  305.       si_wrch(MFC_LSA,si_from_ptr(ls));
  306. 0000035C 04000382 lr r002,r007                              EVN
  307.       si_wrch(MFC_EAL,si_from_uint(ealow));
  308. 00000360 3FE0030A shlqbyi r010,r006,0x00                    ODD
  309. C:\HOME\KANEE\SVNWORK\PS3-SVN\SVN\SYS\TRUNK\SPU_RUNTIME\IMPLEMENTATION\SRC\SPURS3\JM2\SPU\JOB_CRT_AUXILIARY.C
  310. 00000364 1C092889 ai r009,r081,0x0024                       EVN
  311. 00000368 217FF685 brnz r005,0x0000031C                      ODD
  312. 0000036C 1C020408 ai r008,r008,0x0008                       EVN
  313. 00000370 40800083 il r003,0x0001
  314. 00000374 34000429 lqd r041,0x0000(r008)                    01 (0000036C) REG
  315. 00000378 3B821486 rotqby r006,r041,r008                    05 (00000374) REG ODD
  316. 0000037C 7CFFC328 ceqi r040,r006,-0x0001                   03 (00000378) REG EVN
  317. 00000380 207FEC28 brz r040,0x000002E0                      01 (0000037C) REG ODD ?HINT
  318. 00000384 20000503 brz r003,0x000003AC                       ?HINT
  319. 00000388 1C0928AF ai r047,r081,0x0024
  320. 0000038C 408000AC il r044,0x0001                            EVN
  321. 00000390 340017AE lqd r046,0x0000(r047)                     ODD
  322. 00000394 4080012A il r042,0x0002                            EVN
  323. 00000398 3B8BD72D rotqby r045,r046,r047                    04 (00000390) REG ODD
  324. 0000039C 0B6B562B shl r043,r044,r045                       03 (00000398) REG EVN
  325. 000003A0 21A00B2B wrch $MFC_WrTagMask,r043                 03 (0000039C) REG ODD
  326. 000003A4 21A00BAA wrch $MFC_WrTagUpdate,r042
  327. 000003A8 01A00C02 rdch r002,$MFC_RdTagStat                  ODD
  328. 000003AC 408000B2 il r050,0x0001                            EVN
  329. 000003B0 34010731 lqd r049,0x0040(r014)                     ODD
  330. 000003B4 3EC100B3 cwd r051,0x04(r001)
  331. 000003B8 B60C5933 shufb r048,r050,r049,r051                04 (000003B0) REG ODD
  332. 000003BC 24010730 stqd r048,0x0040(r014)                   03 (000003B8) REG
  333. 000003C0 1C0B2838 ai r056,r080,0x002C
  334. 000003C4 1C0E6837 ai r055,r080,0x0039                       EVN
  335. 000003C8 34001C36 lqd r054,0x0000(r056)                     ODD
  336. 000003CC 3B8DDB35 rotqby r053,r054,r055                    05 (000003C8) REG
  337. 000003D0 14009AB4 andi r052,r053,0x0002                    03 (000003CC) REG
  338. 000003D4 200006B4 brz r052,0x00000408                      02 (000003D0) REG ?HINT
  339. 000003D8 3400683F lqd r063,0x0010(r080)                     ODD
  340. C:\HOME\KANEE\SVNWORK\PS3-SVN\SVN\SYS\TRUNK\SPU_RUNTIME\IMPLEMENTATION\SRC\SPURS3\JM2\SPU\JOB_MEMORY_CHECK.H
  341. 000003DC 408000B9 il r057,0x0001                            EVN
  342. 000003E0 33800041 lqr r065,0x000003E0                       ODD[/code]
  343. and that aint in the wiki  ;)