From 8663eb1a6ed027354a0e9cef2aa7bfbf0129dc82 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Wed, 19 Jun 2019 12:26:37 -0700 Subject: [PATCH] sept: tweak vector check --- .../key_derivation/src/key_derivation.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sept/sept-secondary/key_derivation/src/key_derivation.c b/sept/sept-secondary/key_derivation/src/key_derivation.c index 349e72ada..94194bf4a 100644 --- a/sept/sept-secondary/key_derivation/src/key_derivation.c +++ b/sept/sept-secondary/key_derivation/src/key_derivation.c @@ -98,7 +98,20 @@ void derive_keys(void) { clear_aes_keyslot(0xD); /* Test against a vector. */ + for (size_t i = 0; i < 4; i++) { + work_buffer[i] = 0; + } + if (memcmp(work_buffer, zeroes, 0x10) != 0) { + clear_aes_keyslot(0xE); + clear_aes_keyslot(0xD); + clear_aes_keyslot(0xC); + clear_aes_keyslot(0xA); + clear_aes_keyslot(0xF); + generic_panic(); + } + se_aes_ecb_decrypt_block(0xE, work_buffer, 0x10, master_devkey_vectors[derivation_id], 0x10); + if (memcmp(work_buffer, zeroes, 0x10) == 0) { clear_aes_keyslot(0xE); clear_aes_keyslot(0xD);