u8 DecryptedHiddenVolumeSlotsData (void) { if (TRUE == DecryptedHiddenVolumeSlotsActive_u8) { return (TRUE); } // Get the encrypted hidden volume slots key ReadHiddenVolumeSlotsKey (DecryptedHiddenVolumeSlotsKey_au8); /* Don't restart because the password access is lost */ // Check for smartcard on if (CCID_SLOT_STATUS_PRESENT_ACTIVE != CCID_GetSlotStatus_u8 ()) { return (FALSE); // Smartcard is off - return error } CI_LocalPrintf ("Decrypt hidden volume slots key\r\n"); // Decrypt the slots key of the hidden volumes if (FALSE == DecryptKeyViaSmartcard_u32 (DecryptedHiddenVolumeSlotsKey_au8)) { return (FALSE); } // Copy encrypted hidden slot data into ram memcpy (DecryptedHiddenVolumeSlotsData_au8, (u8 *) HV_SALT_START_ADDRESS, HV_SALT_SIZE + HV_SLOT_COUNT * HV_SLOT_SIZE); // Decrypt salt AES_StorageKeyEncryption (HV_SALT_SIZE, DecryptedHiddenVolumeSlotsData_au8, DecryptedHiddenVolumeSlotsKey_au8, AES_PMODE_DECIPHER); // Decrypt slot data (max 256 byte per decryption) AES_StorageKeyEncryption (HV_SLOT_COUNT * HV_SLOT_SIZE, &DecryptedHiddenVolumeSlotsData_au8[HV_SALT_SIZE], DecryptedHiddenVolumeSlotsKey_au8, AES_PMODE_DECIPHER); // Key is ready DecryptedHiddenVolumeSlotsActive_u8 = TRUE; return (TRUE); }
u8 PWS_DecryptedPasswordSafeKey (void) { if (TRUE == DecryptedPasswordSafeKey_u8) { return (TRUE); } CI_LocalPrintf ("Decrypt password safe key\r\n"); // Get the encrypted hidden volume slots key ReadPasswordSafeKey (DecryptedPasswordSafeKey_au8); // Decrypt the slots key of the hidden volumes if (FALSE == DecryptKeyViaSmartcard_u32 (DecryptedPasswordSafeKey_au8)) { return (FALSE); } // Key is ready DecryptedPasswordSafeKey_u8 = TRUE; return (TRUE); }