Commit Graph

35 Commits

Author SHA1 Message Date
zoogie
eaef974dca Add working footer signing
Everything working now.
From https://github.com/zoogie/footer_adjust
2018-11-07 06:38:59 -06:00
Iason Papadopoulos
e2b19bac94 Works!
Indeed it works, I tested it and frogtool imports it without issue
2018-11-03 22:19:56 +00:00
Iason Papadopoulos
848b96212c Fix calculating hashes
I was calculating hashes from the encrypted sections instead of the plaintext sections. Fixed.
2018-10-28 22:33:01 +00:00
Iason Papadopoulos
62cdabaca7 Fix the footer hashes before handing off to doSigning() 2018-10-28 21:03:28 +00:00
Iason Papadopoulos
20ef790516 Replace mbedtls CMAC with something else, and cleanup placeSection() 2018-10-28 20:54:04 +00:00
Iason Papadopoulos
92586865a5 Fixed (?)
Well this build seems to produce a DSiWare that is successfully decrypted by the python TADPole.
2018-10-28 12:52:03 +00:00
Iason Papadopoulos
ac3dbfedee Fix realloc() and cleanup placeSection() 2018-10-28 11:33:26 +00:00
Iason Papadopoulos
f975796ad7 Attempt to fix keyscrambler
So I tried importing a DSiWare injected by this, and it doesn't work. I took that same DSiWare and tried decrypting it with the python TADPole. It said it couldn't decrypt. Turns out, the normal key generated by the 3DS injector is just a tiny bit different than the normal key generated by the python injector. For example:

Normal key:
F247CA716B8BB38A484894F5844803B7 <-- TADPole Python
F247CA716B8BB38A484894F5845E83B7 <-- TADPole 3DS

Normal key CMAC:
69081275B05E8FC7911E6AB8B85C10B8 <-- TADPole python
6981275B05E8FC7911E6AB8B85C10B8 <-- TADPole 3DS

I don't know why this happens. I tried switching to a different key scrambler (this one to be exact: https://github.com/luigoalma/3ds_keyscrambler/blob/master/src/UnScrambler.c#L50) in the hopes that it was something wrong with the uint128_t library or something of the sort, but nope.

Well I'll stick with the new algorithm since it reduces the overhead a bit.
2018-10-28 00:46:03 +01:00
Iason Papadopoulos
826b2e8ab8 Fix file sizes and some printouts 2018-10-27 23:47:02 +01:00
Iason Papadopoulos
efbc480ad7 Do away with the vectors completely
A LOT of changes to the project. I completely replaced vectors with C arrays because of the allocation issues.
This has completely fixed the problem I had before and the project compiles.
Note however that it doesn't mean the project actually works. The produced DSiWare export doesn't get accepted by Frogtool, so our work here is not done.
2018-10-27 18:25:13 +01:00
Iason Papadopoulos
6ed2b34d71 it works???
i have no idea what is going on anymore
2018-10-13 17:05:32 +01:00
Iason Papadopoulos
ea7ba3cbba Make it compile-able on otheer people's PCs 2018-10-13 16:39:37 +01:00
Iason Papadopoulos
0f9fb2f76e Replace all instances of &vector[0] with vector.data()
Some other things as well which I can't recall atm
2018-10-13 16:02:14 +01:00
Iason Papadopoulos
003135815b Various attempts to get it to work
Nothing so far though...
2018-10-13 15:34:43 +01:00
Iason Papadopoulos
8737830297 Changes...
Basically I noticed that the process of re-encrypting a section and placing it back was common and I was doing it manually 3 times for no reason, so I wrote a new function called placeSection which does exactly that. It takes a section, calculates the CMAC of the sha256 of it, places it there, encrypts the section, places it there, and sorts out the all-zero IV

Oh and I rewrote the SHA256 function to be more "proper"
2018-10-07 13:44:59 +01:00
Iason Papadopoulos
f411b0e530 Lot of progress on signing
It should work now (?), there has to be something wrong...
2018-10-07 01:31:47 +01:00
Iason Papadopoulos
9efba55599 Replace the raw ninty-233 library with the packaged fork
See https://github.com/jason0597/ninty-233
2018-10-06 21:04:12 +01:00
Iason Papadopoulos
feb82b10a2 Some progress
I need to figure out how to integrate this ninty-233 library into the project. I'm thinking of compiling it to .a myself and linking to it at the end, cause automatically compiling it every time looks like it will be a chore (cpp files inside of folders inside of folders)
2018-09-30 11:10:01 +01:00
Iason Papadopoulos
f3307f1b34 Add the ninty-233 library
Full credit goes to https://github.com/jbop1626/ninty-233 of course
2018-09-29 17:17:27 +01:00
Iason Papadopoulos
3eb263480a Inject the (fixed) header and srl.nds, all that's left is the footer 2018-09-29 01:13:01 +01:00
Iason Papadopoulos
2c2ec74c71 Progress on injecting srl.nds and checking for bad movable.sed
I'm thwarted by the disabled CMAC algorithm in the 3DS's mbedtls, so now I need to rebuild it with the "#define MBEDTLS_CMAC_C" enabled in the config.h
Either that or maybe the devkitpro guys can help me out, idk
2018-09-28 20:51:50 +01:00
Iason Papadopoulos
229d5de4c4 tiny change 2018-09-28 18:30:02 +01:00
Iason Papadopoulos
39374a2200 Read keyY from movable.sed
If my uint128_t library could read in numbers through byte arrays i would just feed in that, but it doesn't seem to support that feature...
2018-09-28 18:27:37 +01:00
Iason Papadopoulos
cd9e6cf883 Dumps footer.bin and srl.nds successfully
These are the only 2 files we need to modify in order to inject Flipnote into DS Download Play
2018-09-26 23:32:22 +01:00
Iason Papadopoulos
64da235e82 Some cleaning up 2018-09-26 23:18:11 +01:00
Iason Papadopoulos
0083396be9 FINALLY got decryption working 2018-09-26 21:38:28 +01:00
Iason Papadopoulos
7359e7ffd0 Decryption that should be working
I tested it and it doesn't get me the byte that I should get, but I'm not sure what I'm doing wrong.
2018-09-24 16:47:29 +01:00
Iason Papadopoulos
29f8980ff1 Some progress, and pass keys/data by reference instead of copying it
Also some notes in the comments, copied from Seedplanter.
Also using std::array for some of the fixed-size data (like keys and IVs)
2018-09-19 21:20:49 +01:00
Iason Papadopoulos
d33f39d956 CMAC is 16 bytes long, not 32 2018-09-16 19:13:14 +01:00
Iason Papadopoulos
4a406c0493 Move crypto stuff to crypto.cpp and add more functions 2018-09-16 18:58:28 +01:00
Iason Papadopoulos
217114077f Clean up a bit 2018-09-16 15:12:12 +01:00
Iason Papadopoulos
72bd412c31 Working keyscrambler
Thank you to https://github.com/calccrypto/uint128_t/ for your library!
2018-09-16 14:41:25 +01:00
Iason Papadopoulos
6ad6ec6464 Add .gitignore file 2018-09-08 12:11:36 +01:00
Iason Papadopoulos
21ae138d2d Test that compiling works 2018-09-08 12:07:18 +01:00
Iason Papadopoulos
b36b88d770
Initial commit 2018-09-08 11:57:02 +01:00