buzzmarshall has quit [Quit: Konversation terminated!]
chewitt has joined #linux-amlogic
naoki has quit [Quit: naoki]
jacobk has quit [Ping timeout: 260 seconds]
jacobk has joined #linux-amlogic
GNUtoo has quit [Ping timeout: 260 seconds]
GNUtoo has joined #linux-amlogic
chewitt has quit [Quit: Zzz..]
<f_>
phh: yep, it was completely encrypted
<f_>
I've been hard at work reversing and inspecting the bootROM for clues lately
<f_>
There is a function "auth_image()" which takes care of running other functions that check the @AML header.
<f_>
There is an fip_check() function, which is being ran, which checks if the header is valid. I concluded that function runs on decrypted data as it straight looks for e.g. the "@AML" magic.
<f_>
In the end, this is what I found (simplified):
<f_>
if (readl(0xc8100228) & 0x10000000) { decrypt(...) }
<f_>
a dump of 0xc8100228 is printed over UART on bootup, it's that "FEAT:..." thing. And indeed, on the TV stick, it is not == 0.
chewitt has joined #linux-amlogic
<f_>
Now. I can run unsigned code in Secure World thanks to amlogic-usbdl, so I could've just tried reading that BL2 and decrypting, all by running the bootROM's functions.. But TBH I'm a bit skeptical about running random functions I have not completely figured out.
<f_>
anyway, tl;dr BL2 is encrypted with AES-256-CBC to no one's surprise, and also to no one's surprise the key and IV are stored in OTP memory
<f_>
(there is a copy of the OTP memory also, stored at 0xd9013c00)
<f_>
Btw while I was reversing the bootROM I also started writing some notes, could be useful for troubleshooting boot or something
<f_>
The blogpost says it affects S905D3[G], but it actually also affects most older 64-bit Amlogic SoCs, so GXBB, GXL, are affected and G12A/B and SM1 should also be affected (although I did not test). No idea about AXG though.
<f_>
Well. S905D3 *is* SM1..
<f_>
Maybe I should probably work on the DTS instead of trying to run funny stuff in secure world on a secureboot-enabled device
<f_>
But from what I saw the bootROM usually seems to work with that copy of the OTP instead of the OTP directly. But there might be places I overlooked in the bootROM.