Editing HDD Encryption
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
[[Category:Software]] | |||
=Introduction= | =Introduction= | ||
* The following information was reverse engineered from LV1, Storage Manager in LPAR1 and sb_iso_spu_module.self. | * The following information was reverse engineered from LV1, Storage Manager in LPAR1 and sb_iso_spu_module.self. | ||
* I'm able to decrypt/encrypt my PS3 HDD and VFLASH on PC now. | * I'm able to decrypt/encrypt my PS3 HDD and VFLASH on PC now. | ||
=HDD Encryption= | =HDD Encryption= | ||
* XTS-AES-128 is used to encrypt all data on PS3 HDD. | * XTS-AES-128 is used to encrypt all data on PS3 HDD. | ||
* XTS is NOT CBC!!! It's AES-ECB with tweak XORing. AES-CBC is impractical for HDD encryption. Each sector can be encrypted/decrypted | * XTS is NOT CBC !!! It's AES-ECB with tweak XORing. AES-CBC is impractical for HDD encryption. Each sector can be encrypted/decrypted independantly from other HDD sectors. | ||
* Good paper about XTS-AES: http://ntnu.diva-portal.org/smash/get/diva2:347753/FULLTEXT01 | * Good paper about XTS-AES: http://ntnu.diva-portal.org/smash/get/diva2:347753/FULLTEXT01 | ||
* VFLASH is encrypted twice. First with ENCDEC keys and then with ATA keys. | * VFLASH is encrypted twice. First with ENCDEC keys and then with ATA keys. | ||
* Tweak and data XTS keys are of size 32 bytes but only the first 16 bytes are used. | * Tweak and data XTS keys are of size 32 bytes but only the first 16 bytes are used. | ||
* '''You can set and clear ATA keys with my Linux ps3encdec device driver which | * '''You can set and clear ATA keys with my Linux ps3encdec device driver which i use to test HDD/VFLASH encryption. But be careful, never set/clear ATA keys while some HDD regions/partitions are mounted !!! You will corrupt your data on your HDD !!!''' | ||
=Dumping ATA Keys= | =Dumping ATA Keys= | ||
Line 30: | Line 18: | ||
* I modified sb_iso_spu_module.self to dump ATA keys. | * I modified sb_iso_spu_module.self to dump ATA keys. | ||
* ATA keys are passed as parameters to sb_iso_spu_module.self. | * ATA keys are passed as parameters to sb_iso_spu_module.self. | ||
==Program== | ==Program== | ||
Line 165: | Line 151: | ||
==Test== | ==Test== | ||
* To test your ATA XTS tweak and data keys, you need encrypted HDD sectors. You can either connect your HDD to PC and dump it or use my ps3vuart-tools on Linux and clear ATA keys and then dump it from ps3da. I tried both methods. But make sure you unmount all HDD regions before using ps3vuart-tools to clear your ATA keys | * To test your ATA XTS tweak and data keys, you need encrypted HDD sectors. You can either connect your HDD to PC and dump it or use my ps3vuart-tools on Linux and clear ATA keys and then dump it from ps3da. I tried both methods. But make sure you unmount all HDD regions before using ps3vuart-tools to clear your ATA keys. | ||
* I coded a small application which implements XTS-AES encryption/decryption | * I coded a small application which implements XTS-AES encryption/decryption. | ||
* You have to pass the correct sector number in order to get correct results. | * You have to pass the correct sector number in order to get correct results. | ||
* As you see below in my examples, i pass sector number 0 and sector 8 for VFLASH because VFLASH begins at sector 8 on HDD. | * As you see below in my examples, i pass sector number 0 and sector 8 for VFLASH because VFLASH begins at sector 8 on HDD. | ||
* Another interesting fact is that you have to swap half-words after encrypting and before decrypting HDD sectors else you will get wrong results. This swapping is not necessary for VFLASH sectors. | * Another interesting fact is that you have to swap half-words after encrypting and before decrypting HDD sectors else you will get wrong results. This swapping is not necessary for VFLASH sectors. | ||
* Another note is that you have to decrypt VFLASH sectors with ATA keys first and then with ENCDEC keys. | * Another note is that you have to decrypt VFLASH sectors with ATA keys first and then with ENCDEC keys. | ||
Result with 1st encrypted sector from HDD: | Result with 1st encrypted sector from HDD: | ||
Line 212: | Line 197: | ||
* metldr passes to lv1ldr AES-CBC-256 IV and key which are used to compute ENCDEC keys. | * metldr passes to lv1ldr AES-CBC-256 IV and key which are used to compute ENCDEC keys. | ||
* I tested my ENCDEC keys with my ps3encdec Linux driver and set them again, and VFLASH was still working fine. As soon as i changed some bits in these keys, VFLASH could not be decrypted properly anymore :) It means keys are correct. | * I tested my ENCDEC keys with my ps3encdec Linux driver and set them again, and VFLASH was still working fine. As soon as i changed some bits in these keys, VFLASH could not be decrypted properly anymore :) It means keys are correct. | ||
==ENCDEC Key Seeds== | ==ENCDEC Key Seeds== | ||
* Use the dumped ENCDEC IV and key to encrypt these seeds and you will get your ENCDEC keys for VFLASH. | * Use the dumped ENCDEC IV and key to encrypt these seeds and you will get your ENCDEC keys for VFLASH. | ||
* You can find these seeds in | * You can find these seeds in lv1ldr. | ||
Tweak key seed: | |||
<pre> | <pre> | ||
Line 228: | Line 212: | ||
</pre> | </pre> | ||
Data key seed: | |||
<pre> | <pre> | ||
Line 398: | Line 382: | ||
==Test== | ==Test== | ||
Result with 1st encrypted sector from VFLASH: | Result with 1st encrypted sector from VFLASH: | ||
Line 431: | Line 410: | ||
00000200 | 00000200 | ||
</pre> | </pre> | ||