Go Back  
Reply
 
Thread Tools
Old 12-11-2011   #81
jester
Member
null
 
Join Date: Dec 2008
Posts: 30
Likes: 0
Liked 8 Times in 6 Posts
Mentioned: 3 Post(s)
Tagged: 0 Thread(s)
Validates first 0xA0 bytes on EDAT. This uses appldr with the following execution (see below):
-Single execution
-Encrypted arguments
-CMAC. Key: rifkey, expectedHash: data at 0xA0-0xAF
-No Encryption erk:null,riv:null
Hey juannadie, I'm having no luck with verifying the very first 0xA0 bytes of edats. Is this the same for every edat type or only for 0xC?
I've tried both with decrypted klicensee (obtained using SELF algo), and with the dev_klic extracted bruteforcing the eboot

Is the CMAC algo you mentioned the same used for this?
The second is a CMAC. The key is npdrm_omac_key3, and the message is the titleID (0x30 bytes) concat to the filename (excluding path and case sensitive),

Last edited by jester; 12-11-2011 at 11:25 AM.
jester is offline   Reply With Quote
Old 12-11-2011   #82
Octopus
Member
 
Join Date: Oct 2011
Posts: 83
Likes: 31
Liked 50 Times in 9 Posts
Mentioned: 15 Post(s)
Tagged: 0 Thread(s)
We have decrypt edat, trying to re-encrypt it for free. What to do with 0x90-0xAF ?

Last edited by Octopus; 12-11-2011 at 02:54 PM.
Octopus is offline   Reply With Quote
Old 12-12-2011   #83
JuanNadie
Homebrew Developer
 
Join Date: Oct 2011
Posts: 20
Likes: 11
Liked 368 Times in 19 Posts
Mentioned: 68 Post(s)
Tagged: 0 Thread(s)
First of all, here is an implementation of the algorithm. It is not fully tested (for example with ISO.BIN.EDAT it validates but fails when decrypting) and is missing the decompression algorithm (I tried deflate but is does not work if someone identifies the algorithm please post it. Blocks start with 0x05). Also keys have been eliminated. On previous port you have the SHA1.

http://pastebin.com/SuAukd8B

About compression: Instead of having metadatasections of 0x10 byes the new section is 0x20 bytes long.

Code:
struct compressMetadataSection {
	uint8_t hash[0x10];
	uint64_t fileOffset;
	uint32_t len;
	uint32_t isEndOfCompression;   
}
The obtain bytes 0x10-01F xor of data is used

@jester You probably forgot to decrypt the key. The result of syscall471 must be decrypted using EDATKEY and RIVKEY.

@Octopus to make free files.
- Create a memory image of the file.
- Decrypt the data, so you have a memory copy of the file decrypted (for compressed no need to decompress)
- Modify NPD to make if free (0x03 instead of 0x02). Recalculate hashes using devlikc (that why we need it).
- Recrypt each block using the devklic as base to calculate blocks keys (wich will then be transformed again as does the appldr for that type).
- Once recrypted, recalculate the hashes of the sections so they matched the new value for the encrypted data.
-If compressed recalculate the offset and len on the metadatasection
-Using the new metadatasection recalculate data 0x90-0x9F.
-Using the new NPD header + new metadatasectionHash calculate hash and place it at 0xA0-0xAF.
-Write file to disk (Remember, that file is function of filename, you must overwrite (not recommend while testing) or remember to rename it properly).

Done
JuanNadie is offline   Reply With Quote
Likes: (12)
Old 12-12-2011   #84
advocatusdiaboli
Senior Member
 
advocatusdiaboli's Avatar
 
Join Date: Sep 2010
Location: /dev/random
Posts: 1,687
Likes: 425
Liked 271 Times in 171 Posts
Mentioned: 14 Post(s)
Tagged: 0 Thread(s)
Finally a good thread on here, most of what is said is history, but it’s a nice reminder to the functions and their sources.
__________________
US 4USB ports OFW 3.15 PS Ubuntu
EU 4USB ports CFW 4.21.1 REX
There is only one OS; AmigaOS, the rest are just [l]imitations.
advocatusdiaboli is offline   Reply With Quote
Old 12-12-2011   #85
EXE.trim.ALL
Apprentice
 
Join Date: Oct 2011
Posts: 14
Likes: 1
Liked 2 Times in 2 Posts
Mentioned: 22 Post(s)
Tagged: 0 Thread(s)
Thanks a lot for new info.
So we finally can re-encrypt local licensed edats to free license (except compressed ones).
Have you any progress on sdat?

Last edited by EXE.trim.ALL; 12-12-2011 at 02:35 PM.
EXE.trim.ALL is offline   Reply With Quote
Old 12-12-2011   #86
Octopus
Member
 
Join Date: Oct 2011
Posts: 83
Likes: 31
Liked 50 Times in 9 Posts
Mentioned: 15 Post(s)
Tagged: 0 Thread(s)
I have to say thanks for all @JuanNadie , we had re-encrypt edat in free. What about SDAT? Translators asking for it VERY hard.
Octopus is offline   Reply With Quote
Old 12-12-2011   #87
H3avyRa1n
Senior Member
 
H3avyRa1n's Avatar
 
Join Date: Aug 2011
Posts: 1,270
Likes: 179
Liked 840 Times in 392 Posts
Mentioned: 61 Post(s)
Tagged: 0 Thread(s)
thanks @JuanNadie for your contribution
H3avyRa1n is offline   Reply With Quote
Old 12-12-2011   #88
snowydew
Homebrew Developer
 
Join Date: Jun 2011
Location: Fknnrds.com
Posts: 74
Likes: 14
Liked 124 Times in 37 Posts
Mentioned: 33 Post(s)
Tagged: 0 Thread(s)
Send a message via Skype™ to snowydew
jaun, was wondering if there was an easier way to contact you?
snowydew is offline   Reply With Quote
Old 12-13-2011   #89
JuanNadie
Homebrew Developer
 
Join Date: Oct 2011
Posts: 20
Likes: 11
Liked 368 Times in 19 Posts
Mentioned: 68 Post(s)
Tagged: 0 Thread(s)
The code I posted already implements SDAT. You just need the SDATKEY.
The SHA1 is ED2A015EEB1BD0CE06D0447F1A22AF4C1C401E4A

However you won't find it by bruteforce as it is coded as a series of inmediate values. If you check routine sub_5529C at graf_chokolo's dump_lv2 you'll see the routine that checks the edat/sdat header. Few lines below at address 5543C you'll see those inmediate values that are xored with the hash of the NPD to create the fake rifkey (the first 0x100 bytes of the npd are loaded starting at sp + 0x110)

About compression: We don´t know the algorithm but if we decrypt the data and modify the NPD so it looks like a debug you can use make_edata_npdrm to decompress it
JuanNadie is offline   Reply With Quote
Likes: (13)
Old 12-13-2011   #90
dsadsadsa
Member
 
dsadsadsa's Avatar
 
Join Date: Nov 2011
Posts: 66
Likes: 16
Liked 28 Times in 16 Posts
Mentioned: 8 Post(s)
Tagged: 0 Thread(s)
Originally Posted by JuanNadie View Post
The code I posted already implements SDAT. You just need the SDATKEY.
The SHA1 is ED2A015EEB1BD0CE06D0447F1A22AF4C1C401E4A...
@JuanNadie , Thanks for your great work! Would it be possible for you to have a short chat with Kakaroto about his work on the NPDRM algo? I think you could really help him, and in turn advance the scene a whole lot!
__________________
dsadsadsa is offline   Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



PS3Hax.net is Copyright © 2010-2013.
Use of this site is governed by our Terms of Use and Privacy Policy. All Trademarks and images are owned by their respected owners.
Posts and links are subject to each author on this forum and are no way affiliated with the operations and/or opinions of ps3hax.net
All times are GMT -5. The time now is 05:04 PM.