Adding routine for pressing button to test required user presence.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
#include "u2f.h"
|
#include "u2f.h"
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
#include "usb.h"
|
||||||
#include "random.h"
|
#include "random.h"
|
||||||
#include "mbedtls/ecdsa.h"
|
#include "mbedtls/ecdsa.h"
|
||||||
#include "mbedtls/x509_crt.h"
|
#include "mbedtls/x509_crt.h"
|
||||||
@@ -186,6 +187,15 @@ void init_fido() {
|
|||||||
scan_all();
|
scan_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wait_button_pressed() {
|
||||||
|
uint32_t val = EV_PRESS_BUTTON;
|
||||||
|
queue_try_add(&card_to_usb_q, &val);
|
||||||
|
do {
|
||||||
|
queue_remove_blocking(&usb_to_card_q, &val);
|
||||||
|
} while (val != EV_BUTTON_PRESSED && val != EV_BUTTON_TIMEOUT);
|
||||||
|
return val == EV_BUTTON_TIMEOUT;
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct cmd
|
typedef struct cmd
|
||||||
{
|
{
|
||||||
uint8_t ins;
|
uint8_t ins;
|
||||||
|
|||||||
@@ -30,5 +30,6 @@
|
|||||||
|
|
||||||
extern int scan_files();
|
extern int scan_files();
|
||||||
extern int derive_key(const uint8_t *app_id, bool new_key, uint8_t *key_handle, mbedtls_ecdsa_context *key);
|
extern int derive_key(const uint8_t *app_id, bool new_key, uint8_t *key_handle, mbedtls_ecdsa_context *key);
|
||||||
|
extern bool wait_button_pressed();
|
||||||
|
|
||||||
#endif //_FIDO_H
|
#endif //_FIDO_H
|
||||||
|
|||||||
Reference in New Issue
Block a user