View Single Post
  #1   (View Single Post)  
Old 11th September 2019
Berion Berion is offline
New User
Join Date: Sep 2019
Posts: 2
Default Mounting encryped UFS2 on *BSD, custom partition table, Big Endian

this is my first thread and to be honest, first contact in any BSD operating system. For years I'm using Windows and Linux. However, I like learning new stuff and today is perfect occasion. Also, sorry for my bad English but it is not my native language and I don't have any linguistic skills, enough to say I learned it only from just playing video games. Oh, and I'm not interesting in any OS war, all my compares with Linux are for seeking parallel solutions. Most of the questions will be quite noobish so please for patience. ^^

In my PlayStation 3, main partition is in UFS2 file system. I have successfully fully decrypted it on Linux and also have access to some data on Windows. However, only reading is possible, not write. On Linux we have experimental write support in ufs kernel module but it is far from trustworthy solution (also transfer rate is for some reason slow). So, since CellOS (PS3 operating system) is some kind of FreeBSD fork and UFS2 is native BSD family file system, then the best solution would be to use just *BSD for such task, right? And here are the problems. But before I describe how I doing it on Linux and asking for similar tools and help with syntax in BSD world, I must explain that this is NOT related to any kind of piracy (HDD keys are uniqe per unit and games must be bought or will not work, so this is not any kind of easy pirating stuff junk solution, but my fetish to IT forensics and seeking a way to be free from Sony servers in backup restoring manners).
  1. All data in HDD is writing in Big Endian instead to Little Endian. Is there any converter for such task on BSD? On Linux I'm using special kernel module and cryptosetup with zeroed key to converting it on the fly, making a device mapper which put out the same dev but with "byte swapped" which can be understand by other tools.
  2. Partition table is custom but years ago, support for it, was streamlined with standard kaprtx. I didn't find any port of this specific tool for BSD. Is gmultipath a worth replacement?
  3. Is there any loop device equivalent? Is vnd is what I'm looking for?
  4. Is there any device mappers equivalent? If this functionality exist, how can I create one?
  5. Is there any dmcrypt packet equivalent? I found geom and geli but reading documentation I'm not sure if they support old AES-CBC-192.
  6. If points 1 and/or 2 and/or 4 cannot be achieve on BSD, can I use network block device (redirected decrypted mappers on Linux as nbd and connecting to them on *BSD)?
  7. On top of that, I would be happy if I could use all this stuff from LiveDVD. What BSD should I choose? I found GhostBSD but I need experts advice.

Here is how procedure looks like on Linux:
losetup loop1 /home/mint/ps3/disk.img
insmod '/home/mint/ps3/bswap16-ecb.ko'
cryptsetup create -c bswap16-ecb -d /dev/zero ps3hdd-bs /dev/loop1
cryptsetup create -c aes-cbc-null -d /home/mint/ps3/ata_key.bin -s 192 ps3hdd /dev/mapper/ps3hdd-bs
kpartx -a /dev/mapper/ps3hdd
cryptsetup create -c aes-xts-plain64 -d /home/mint/ps3/vflash_key.bin -s 256 -p 8 ps3vflash /dev/mapper/ps3hdd1
kpartx -a /dev/mapper/ps3vflash

mount -t ufs -o ufstype=ufs2,ro /dev/mapper/ps3hdd2 /home/mint/ps3/dev_hdd0
mount -t vfat /dev/mapper/ps3hdd3 /home/mint/ps3/dev_hdd1
mount -t vfat /dev/mapper/ps3vflash2 /home/mint/ps3/dev_flash1
mount -t vfat /dev/mapper/ps3vflash3 /home/mint/ps3/dev_flash2
mount -t vfat /dev/mapper/ps3vflash4 /home/mint/ps3/dev_flash3
And here is how it looks like in terminal from lsblk:

Thank You for Your attention.

Best regards,
- P.B.
Attached Images
File Type: png lsblk.png (67.8 KB, 224 views)
Reply With Quote