config: Rename session_isPinCached() to session_isUnlocked(). Change GetFeatures to always return pin_cached=false if PIN is not set, in order to maintain the same behavior as before.

pull/25/head
andrew 5 years ago committed by Pavol Rusnak
parent 66ffa4c7dc
commit ae48b528a9
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -767,7 +767,7 @@ bool session_getState(const uint8_t *salt, uint8_t *state, const char *passphras
return true;
}
bool session_isPinCached(void)
bool session_isUnlocked(void)
{
return storage_is_unlocked();
}

@ -125,7 +125,7 @@ bool config_containsPin(const char *pin);
bool config_hasPin(void);
void config_setPin(const char *pin);
bool config_changePin(const char *old_pin, const char *new_pin);
bool session_isPinCached(void);
bool session_isUnlocked(void);
uint32_t config_nextU2FCounter(void);
void config_setU2FCounter(uint32_t u2fcounter);

@ -58,7 +58,7 @@ void fsm_msgGetFeatures(const GetFeatures *msg)
resp->has_label = config_getLabel(resp->label, sizeof(resp->label));
resp->has_initialized = true; resp->initialized = config_isInitialized();
resp->has_imported = config_getImported(&(resp->imported));
resp->has_pin_cached = true; resp->pin_cached = session_isPinCached();
resp->has_pin_cached = true; resp->pin_cached = session_isUnlocked() && config_hasPin();
resp->has_passphrase_cached = true; resp->passphrase_cached = session_isPassphraseCached();
resp->has_needs_backup = config_getNeedsBackup(&(resp->needs_backup));
resp->has_unfinished_backup = config_getUnfinishedBackup(&(resp->unfinished_backup));

@ -181,13 +181,10 @@ secbool protectPinUiCallback(uint32_t wait, uint32_t progress)
bool protectPin(bool use_cached)
{
if (use_cached && session_isPinCached()) {
if (use_cached && session_isUnlocked()) {
return true;
}
// TODO If maximum number of PIN attempts:
// error_shutdown("Too many wrong PIN", "attempts. Storage has", "been wiped.", NULL, "Please unplug", "the device.");
const char *pin = "";
if (config_hasPin()) {
pin = requestPin(PinMatrixRequestType_PinMatrixRequestType_Current, _("Please enter current PIN:"));

@ -91,7 +91,6 @@ int main(void)
{
#if EMULATOR
memzero(HW_ENTROPY_DATA, HW_ENTROPY_LEN);
HW_ENTROPY_DATA[0] = 1;
#else
desig_get_unique_id((uint32_t*)HW_ENTROPY_DATA);
#endif

Loading…
Cancel
Save