Don't init screens if the PIN file does not exist or is invalid
This commit is contained in:
parent
c739ed8e48
commit
050f58a3bb
@ -66,11 +66,6 @@ void writeConfig(ConfigurationStatus needConfig, u32 configTemp)
|
||||
|
||||
void configMenu(bool oldPinStatus)
|
||||
{
|
||||
initScreens();
|
||||
|
||||
drawString(CONFIG_TITLE, 10, 10, COLOR_TITLE);
|
||||
drawString("Press A to select, START to save", 10, 30, COLOR_WHITE);
|
||||
|
||||
const char *multiOptionsText[] = { "Default EmuNAND: 1( ) 2( ) 3( ) 4( )",
|
||||
"Screen brightness: 4( ) 3( ) 2( ) 1( )",
|
||||
"PIN lock: Off( ) 4( ) 6( ) 8( ) digits",
|
||||
@ -122,6 +117,11 @@ void configMenu(bool oldPinStatus)
|
||||
for(u32 i = 0; i < singleOptionsAmount; i++)
|
||||
singleOptions[i].enabled = CONFIG(i);
|
||||
|
||||
initScreens();
|
||||
|
||||
drawString(CONFIG_TITLE, 10, 10, COLOR_TITLE);
|
||||
drawString("Press A to select, START to save", 10, 30, COLOR_WHITE);
|
||||
|
||||
//Character to display a selected option
|
||||
char selected = 'x';
|
||||
|
||||
|
16
source/pin.c
16
source/pin.c
@ -48,19 +48,19 @@ void newPin(bool allowSkipping)
|
||||
{
|
||||
clearScreens();
|
||||
|
||||
u8 length = 4 + 2 * (MULTICONFIG(PIN) - 1);
|
||||
|
||||
char *title = allowSkipping ? "Press START to skip or enter a new PIN" : "Enter a new PIN to proceed";
|
||||
drawString(title, 10, 10, COLOR_TITLE);
|
||||
drawString("PIN ( digits): ", 10, 10 + 2 * SPACING_Y, COLOR_WHITE);
|
||||
drawCharacter('0' + length, 10 + 5 * SPACING_X, 10 + 2 * SPACING_Y, COLOR_WHITE);
|
||||
|
||||
//Pad to AES block length with zeroes
|
||||
u8 __attribute__((aligned(4))) enteredPassword[0x10] = {0};
|
||||
|
||||
u8 length = 4 + 2 * (MULTICONFIG(PIN) - 1),
|
||||
cnt = 0;
|
||||
u8 cnt = 0;
|
||||
int charDrawPos = 16 * SPACING_X;
|
||||
|
||||
drawCharacter('0' + length, 10 + 5 * SPACING_X, 10 + 2 * SPACING_Y, COLOR_WHITE);
|
||||
|
||||
while(cnt < length)
|
||||
{
|
||||
u32 pressed;
|
||||
@ -106,8 +106,6 @@ void newPin(bool allowSkipping)
|
||||
|
||||
bool verifyPin(void)
|
||||
{
|
||||
initScreens();
|
||||
|
||||
PinData pin;
|
||||
|
||||
if(fileRead(&pin, PIN_PATH) != sizeof(PinData) ||
|
||||
@ -125,11 +123,13 @@ bool verifyPin(void)
|
||||
//Test vector verification (SD card has, or hasn't been used on another console)
|
||||
if(memcmp(pin.testHash, tmp, sizeof(tmp)) != 0) return false;
|
||||
|
||||
initScreens();
|
||||
|
||||
//Pad to AES block length with zeroes
|
||||
u8 __attribute__((aligned(4))) enteredPassword[0x10] = {0};
|
||||
|
||||
u8 cnt = 0;
|
||||
bool unlock = false;
|
||||
u8 cnt = 0;
|
||||
int charDrawPos = 16 * SPACING_X;
|
||||
|
||||
while(!unlock)
|
||||
@ -165,7 +165,7 @@ bool verifyPin(void)
|
||||
|
||||
if(!unlock)
|
||||
{
|
||||
charDrawPos = 5 * SPACING_X;
|
||||
charDrawPos = 16 * SPACING_X;
|
||||
cnt = 0;
|
||||
|
||||
clearScreens();
|
||||
|
Reference in New Issue
Block a user