Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do CMA Key Derivation offline #43

Closed
LiEnby opened this issue Feb 4, 2019 · 2 comments
Closed

Do CMA Key Derivation offline #43

LiEnby opened this issue Feb 4, 2019 · 2 comments

Comments

@LiEnby
Copy link
Contributor

LiEnby commented Feb 4, 2019

Now with the F00D Keys its possible to do the CMA key derivation without needing cma.henkaku.xyz,

here's a little implementation i wrote : https://bitbucket.org/SilicaAndPina/cmakeyderiv
based off what i read from the Wiki: https://wiki.henkaku.xyz/vita/PSVIMG#PSVIMG_Key_Derivation

@soarqin
Copy link
Owner

soarqin commented Feb 4, 2019

It really helps, thank u very much, I'd look into this later

@soarqin
Copy link
Owner

soarqin commented Feb 4, 2019

    void cmakeygen(uint8_t input[8], uint8_t output[32]) {
        static const uint8_t passphrase[] = "Sri Jayewardenepura Kotte";
        static const uint8_t key[] = { 0xA9,0xFA,0x5A,0x62,0x79,0x9F,0xCC,0x4C,0x72,0x6B,0x4E,0x2C,0xE3,0x50,0x6D,0x38 };
        sha256_context ctx;
        aes_context aes;
        sha256_init(&ctx);
        sha256_starts(&ctx);
        sha256_update(&ctx, input, 8);
        sha256_update(&ctx, passphrase, 25);
        sha256_final(&ctx, output);
        aes_init_dec(&aes, key, 128);
        aes_ecb_decrypt(&aes, output, output);
        aes_ecb_decrypt(&aes, output + 16, output + 16);
    }

test codes (using scrpto lib from finalhe), working fine, will integrate this into finalhe asap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants