/*! \fn guiDisplayPinOnPinEnteringScreen(uint8_t* current_pin, uint8_t selected_digit) * \brief Overwrite the digits on the current pin entering screen * \param current_pin Array containing the pin * \param selected_digit Currently selected digit */ void guiDisplayPinOnPinEnteringScreen(uint8_t* current_pin, uint8_t selected_digit) { oledFillXY(88, 31, 82, 19, 0x00); for (uint8_t i = 0; i < 4; i++) { oledSetXY(88+22*i, 25); if (i != selected_digit) { oledPutch('*'); } else { if (current_pin[i] >= 0x0A) { oledPutch(current_pin[i]+'A'-0x0A); } else { oledPutch(current_pin[i]+'0'); } } } }
/*! \fn afterFlashInitTests(void) * \brief Test functions launched after flash init */ void afterFlashInitTests(void) { //#define TEST_NODE #ifdef TEST_NODE nodeTest(); // spin while(1); #endif //#define TEST_HID_AND_CDC #ifdef TEST_HID_AND_CDC //Show_String("Z",FALSE,2,0); //usbKeyboardPress(KEY_S, 0); while(1) { int n = usb_serial_getchar(); if (n >= 0) { usb_serial_putchar(n); oledSetXY(2,0); oledPutch((char)n); //usbKeyboardPress(n,0); } } #endif /* TEST_HID_AND_CDC */ //#define NESSIE_TEST_VECTORS #ifdef NESSIE_TEST_VECTORS while(1) { // msg into oled display oledSetXY(2,0); printf_P(PSTR("send s to start nessie test")); int input0 = usb_serial_getchar(); nessieOutput = &usb_serial_putchar; // do nessie test after sending s or S chars if (input0 == 's' || input0 == 'S') { nessieTest(1); nessieTest(2); nessieTest(3); nessieTest(4); nessieTest(5); nessieTest(6); nessieTest(7); nessieTest(8); } } #endif //#define CTR_TEST_VECTORS #ifdef CTR_TEST_VECTORS while(1) { // msg into oled display oledSetXY(2,0); printf_P(PSTR("send s to start CTR test")); int input1 = usb_serial_getchar(); ctrTestOutput = &usb_serial_putchar; // do ctr test after sending s or S chars if (input1 == 's' || input1 == 'S') { aes256CtrTest(); } } #endif //#define TEST_CTR_SPEED #ifdef TEST_CTR_SPEED // msg into oled display oledSetXY(2,0); usbPrintf_P(PSTR("CTR speed TEST with 1000 encryptions\n")); usbPrintf_P(PSTR("Time:")); usbPrintf_P(PSTR("%lu ms"), aes256CtrSpeedTest()); while(1); #endif //#define TEST_RNG #ifdef TEST_RNG while(1) { // init avrentropy library EntropyInit(); // msg into oled display oledSetXY(2,0); printf_P(PSTR("send s to start entropy")); int input2 = usb_serial_getchar(); uint32_t randomNumCtr; // do nessie test after sending s or S chars if (input2 == 's' || input2 == 'S') { while(EntropyAvailable() < 2); EntropyRandom8(); usb_serial_putchar(EntropyBytesAvailable()); for(randomNumCtr=0; randomNumCtr<25; randomNumCtr++) { usb_serial_putchar(EntropyRandom8()); } } } #endif }