add spacing
This commit is contained in:
parent
a76564f488
commit
b6d077c226
@ -155,20 +155,37 @@ int ctap_user_verification(uint8_t arg)
|
|||||||
// Return 1 for user is present, 0 user not present
|
// Return 1 for user is present, 0 user not present
|
||||||
int ctap_user_presence_test()
|
int ctap_user_presence_test()
|
||||||
{
|
{
|
||||||
|
#ifdef SKIP_BUTTON_CHECK
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
uint32_t t1 = millis();
|
uint32_t t1 = millis();
|
||||||
RGB(0x304010);
|
RGB(0x304010);
|
||||||
|
|
||||||
|
#ifdef USE_BUTTON_DELAY
|
||||||
|
delay(3000);
|
||||||
|
RGB(0x001040);
|
||||||
|
delay(50);
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
while (IS_BUTTON_PRESSED())
|
while (IS_BUTTON_PRESSED())
|
||||||
{
|
{
|
||||||
if (t1 + 5000 < millis())
|
if (t1 + 5000 < millis())
|
||||||
|
{
|
||||||
|
printf1(TAG_GEN,"Button not pressed\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
t1 = millis();
|
t1 = millis();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (t1 + 5000 < millis())
|
if (t1 + 5000 < millis())
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
if (! IS_BUTTON_PRESSED())
|
if (! IS_BUTTON_PRESSED())
|
||||||
continue;
|
continue;
|
||||||
delay(1);
|
delay(1);
|
||||||
@ -214,8 +231,8 @@ void heartbeat()
|
|||||||
state = !state;
|
state = !state;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (but) RGB(val * 2);
|
// if (but) RGB(val * 2);
|
||||||
// else
|
// else
|
||||||
RGB((val << 16) | (val*2 << 8));
|
RGB((val << 16) | (val*2 << 8));
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -227,6 +244,12 @@ void heartbeat()
|
|||||||
int but = IS_BUTTON_PRESSED();
|
int but = IS_BUTTON_PRESSED();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
RGB(0x70fefe); // bright ass light
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (state)
|
if (state)
|
||||||
{
|
{
|
||||||
val--;
|
val--;
|
||||||
@ -236,13 +259,14 @@ void heartbeat()
|
|||||||
val++;
|
val++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val > 30 || val < 1)
|
if (val >120/3 || val < 1)
|
||||||
{
|
{
|
||||||
state = !state;
|
state = !state;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (but) RGB(val * 2);
|
if (but) RGB(val * 2);
|
||||||
else RGB(val << 8);
|
else RGB(val*3 | ((val*3) << 8) | (val << 16) );
|
||||||
|
// else RGB((val*3) << 8);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -295,9 +319,9 @@ int usbhid_recv(uint8_t * msg)
|
|||||||
wait_for_efm8_busy();
|
wait_for_efm8_busy();
|
||||||
|
|
||||||
|
|
||||||
// // msgs_to_recv--;
|
// // msgs_to_recv--;
|
||||||
// printf(">> ");
|
// printf(">> ");
|
||||||
// dump_hex(msg,64);
|
// dump_hex(msg,64);
|
||||||
return 64;
|
return 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,13 +644,13 @@ int bootloader_bridge(uint8_t klen, uint8_t * keyh)
|
|||||||
MSC_WriteWordFast(ptr,payload, req->len + (req->len%4));
|
MSC_WriteWordFast(ptr,payload, req->len + (req->len%4));
|
||||||
break;
|
break;
|
||||||
case BootDone:
|
case BootDone:
|
||||||
// printf("BootDone\n");
|
// printf("BootDone\n");
|
||||||
ptr = APPLICATION_START_ADDR;
|
ptr = APPLICATION_START_ADDR;
|
||||||
crypto_sha256_init();
|
crypto_sha256_init();
|
||||||
crypto_sha256_update(ptr, APPLICATION_END_ADDR-APPLICATION_START_ADDR);
|
crypto_sha256_update(ptr, APPLICATION_END_ADDR-APPLICATION_START_ADDR);
|
||||||
crypto_sha256_final(hash);
|
crypto_sha256_final(hash);
|
||||||
// printf("hash: "); dump_hex(hash, 32);
|
// printf("hash: "); dump_hex(hash, 32);
|
||||||
// printf("sig: "); dump_hex(payload, 64);
|
// printf("sig: "); dump_hex(payload, 64);
|
||||||
curve = uECC_secp256r1();
|
curve = uECC_secp256r1();
|
||||||
|
|
||||||
if (! uECC_verify(pubkey,
|
if (! uECC_verify(pubkey,
|
||||||
|
@ -31,7 +31,7 @@ void u2f_request(struct u2f_request_apdu* req, CTAP_RESPONSE * resp)
|
|||||||
rcode = U2F_SW_CLASS_NOT_SUPPORTED;
|
rcode = U2F_SW_CLASS_NOT_SUPPORTED;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
#if defined(BRIDGE_TO_WALLET)
|
#if defined(BRIDGE_TO_WALLET) || defined(IS_BOOTLOADER)
|
||||||
struct u2f_authenticate_request * auth = (struct u2f_authenticate_request *) req->payload;
|
struct u2f_authenticate_request * auth = (struct u2f_authenticate_request *) req->payload;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user