Line 8:
Line 8:
An ES block, for lack of a better name, is a commonly used data encryption method on DSi by Nintendo.
An ES block, for lack of a better name, is a commonly used data encryption method on DSi by Nintendo.
−
It uses AES CCM to encrypt a maximum of 0x20000 bytes of data per time, and extends it with a 32 byte encrypted trail block at the end.
+
It uses AES CCM to encrypt a maximum of 0x20000 bytes of data per time, and extends it with a 32 byte trail block at the end.
−
This trail block itself is encrypted with AES CTR, and contains the nonce for decryption and size of the ES block:
+
The last 16 bytes of trail block itself is encrypted with AES CTR, and contains the nonce for decryption and size of the ES block:
0000000: qq qq qq qq qq qq qq qq qq qq qq qq qq qq qq qq
0000000: qq qq qq qq qq qq qq qq qq qq qq qq qq qq qq qq
0000010: xx nn nn nn nn nn nn nn nn nn nn nn nn yy yy yy
0000010: xx nn nn nn nn nn nn nn nn nn nn nn nn yy yy yy