Remove aeskeydb.bin warning for entrypoints other than b9s

Fixes #676
This commit is contained in:
d0k3 2021-02-23 15:45:09 +01:00
parent bea16124a4
commit 3f7eb872b8
3 changed files with 0 additions and 28 deletions

View File

@ -226,25 +226,3 @@ u32 InitKeyDb(const char* path)
free(keydb); free(keydb);
return (nkeys) ? 0 : 1; return (nkeys) ? 0 : 1;
} }
// creates dependency to "sha.h", not required for base keydb functions
u32 CheckRecommendedKeyDb(const char* path)
{
// SHA-256 of the recommended aeskeydb.bin file
// equals MD5 A5B28945A7C051D7A0CD18AF0E580D1B
static const u8 recommended_sha[0x20] = {
0x40, 0x76, 0x54, 0x3D, 0xA3, 0xFF, 0x91, 0x1C, 0xE1, 0xCC, 0x4E, 0xC7, 0x2F, 0x92, 0xE4, 0xB7,
0x2B, 0x24, 0x00, 0x15, 0xBE, 0x9B, 0xFC, 0xDE, 0x7F, 0xED, 0x95, 0x1D, 0xD5, 0xAB, 0x2D, 0xCB
};
// try to load aeskeydb.bin file
AesKeyInfo* keydb = (AesKeyInfo*) malloc(STD_BUFFER_SIZE);
if (!keydb) return 1;
u32 nkeys = LoadKeyDb(path, keydb, STD_BUFFER_SIZE);
// compare with recommended SHA
bool res = (nkeys && (sha_cmp(recommended_sha, keydb, nkeys * sizeof(AesKeyInfo), SHA256_MODE) == 0));
free(keydb);
return res ? 0 : 1;
}

View File

@ -30,4 +30,3 @@ u32 GetUnitKeysType(void);
void CryptAesKeyInfo(AesKeyInfo* info); void CryptAesKeyInfo(AesKeyInfo* info);
u32 LoadKeyFromFile(void* key, u32 keyslot, char type, char* id); u32 LoadKeyFromFile(void* key, u32 keyslot, char type, char* id);
u32 InitKeyDb(const char* path); u32 InitKeyDb(const char* path);
u32 CheckRecommendedKeyDb(const char* path);

View File

@ -2299,11 +2299,6 @@ u32 GodMode(int entrypoint) {
} }
} }
// check aeskeydb.bin / key state
if ((entrypoint != ENTRY_B9S) && (CheckRecommendedKeyDb(NULL) != 0)) {
ShowPrompt(false, "WARNING:\nNot running from a boot9strap\ncompatible entrypoint. Not\neverything may work as expected.\n \nProvide the recommended\naeskeydb.bin file to make this\nwarning go away.");
}
#if defined(SALTMODE) #if defined(SALTMODE)
show_splash = bootmenu = (bootloader && CheckButton(BOOTMENU_KEY)); show_splash = bootmenu = (bootloader && CheckButton(BOOTMENU_KEY));
if (show_splash) SplashInit("saltmode"); if (show_splash) SplashInit("saltmode");