The security engine's device-unique key derivation: the two constants below are public domain-separation labels (they are in this binary and in this repository), and the console-unique part is the master key the engine mixes in, which never leaves the engine. Generation 0 so a firmware update does not re-derive a different key under us.
| 327 | // engine mixes in, which never leaves the engine. Generation 0 so a |
| 328 | // firmware update does not re-derive a different key under us. |
| 329 | bool splSecret(uint8_t* out) |
| 330 | { |
| 331 | static const u8 kWrappedKek[16] = "CheckpointSeal1"; |
| 332 | static const u8 kWrappedKey[16] = "CheckpointKey_1"; |
| 333 | if (R_FAILED(splCryptoInitialize())) { |
| 334 | return false; |
| 335 | } |
| 336 | u8 sealedKek[16] = {0}; |
| 337 | u8 key[16] = {0}; |
| 338 | bool ok = R_SUCCEEDED(splCryptoGenerateAesKek(kWrappedKek, 0, 1 /* device unique */, sealedKek)) && |
| 339 | R_SUCCEEDED(splCryptoGenerateAesKey(sealedKek, kWrappedKey, key)); |
| 340 | splCryptoExit(); |
| 341 | if (ok) { |
| 342 | hashInto("Checkpoint NX SPL device key v1", key, sizeof(key), out); |
| 343 | } |
| 344 | memset(sealedKek, 0, sizeof(sealedKek)); |
| 345 | memset(key, 0, sizeof(key)); |
| 346 | return ok; |
| 347 | } |
| 348 | |
| 349 | // Fallback only. The serial number is console-unique and is not on the SD |
| 350 | // card, which is the whole claim the seal makes — but unlike the SPL key |
nothing calls this directly
no test coverage detected