Skip to content

Impl SetupSslCertKey for some system tools#106

Open
R-YaTian wants to merge 2 commits intoLNH-team:developfrom
R-YaTian:sslkeyslot
Open

Impl SetupSslCertKey for some system tools#106
R-YaTian wants to merge 2 commits intoLNH-team:developfrom
R-YaTian:sslkeyslot

Conversation

@R-YaTian
Copy link
Copy Markdown
Contributor

No description provided.

@Gericom
Copy link
Copy Markdown
Contributor

Gericom commented Jan 21, 2026

I think it might be a good idea to pass the ssl cert key to TwlAes::SetupAes (you could pass a null pointer if it could not be found or so) and then call aes_setKeySlot(0) (and possibly aes_waitKeyBusy() near the point where the arm7 is booted. This makes sure that most of the responsibility is in the TwlAes class and avoids repeating some code (most of what you are doing in SetupKeySlot does already happen in SetupAes)

@R-YaTian
Copy link
Copy Markdown
Contributor Author

I think it might be a good idea to pass the ssl cert key to TwlAes::SetupAes (you could pass a null pointer if it could not be found or so) and then call aes_setKeySlot(0) (and possibly aes_waitKeyBusy() near the point where the arm7 is booted. This makes sure that most of the responsibility is in the TwlAes class and avoids repeating some code (most of what you are doing in SetupKeySlot does already happen in SetupAes)

It seems that sslcertkey needs to be set after both ARM9i and ARM7i decryption are completed.
Trying to pass it to key slot 0 earlier does not work.

@Gericom
Copy link
Copy Markdown
Contributor

Gericom commented Jan 24, 2026

I think it might be a good idea to pass the ssl cert key to TwlAes::SetupAes (you could pass a null pointer if it could not be found or so) and then call aes_setKeySlot(0) (and possibly aes_waitKeyBusy() near the point where the arm7 is booted. This makes sure that most of the responsibility is in the TwlAes class and avoids repeating some code (most of what you are doing in SetupKeySlot does already happen in SetupAes)

It seems that sslcertkey needs to be set after both ARM9i and ARM7i decryption are completed. Trying to pass it to key slot 0 earlier does not work.

You should be able to set the key regardless. It doesn't suddenly disappear.

@R-YaTian
Copy link
Copy Markdown
Contributor Author

I think it might be a good idea to pass the ssl cert key to TwlAes::SetupAes (you could pass a null pointer if it could not be found or so) and then call aes_setKeySlot(0) (and possibly aes_waitKeyBusy() near the point where the arm7 is booted. This makes sure that most of the responsibility is in the TwlAes class and avoids repeating some code (most of what you are doing in SetupKeySlot does already happen in SetupAes)

It seems that sslcertkey needs to be set after both ARM9i and ARM7i decryption are completed. Trying to pass it to key slot 0 earlier does not work.

You should be able to set the key regardless. It doesn't suddenly disappear.

I found an alternative approach to avoid repeating code.
It has been tested, works as expected, and does not break any existing functionality.

@Gericom
Copy link
Copy Markdown
Contributor

Gericom commented Jan 31, 2026

Quoting what I said on discord

I just don't understand why setting your ssl keyslot requires a different approach than setting the other key slots
I can understand if AES needs an extra reset or something to activate the keyslot maybe and that is fine, but that can probably be done in NdsLoader.cpp just before booting
Also another important thing is that we should not do any file IO anymore after performing the arm7 patches
The key should be setup in the same way as the other keys in the SetupAes function

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

Successfully merging this pull request may close these issues.

2 participants