No more discrimination related with core0/core1. using get_core_num() returns the core number.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
c0a540ae2b
commit
a8fe504d14
5 changed files with 9 additions and 27 deletions
|
|
@ -168,19 +168,11 @@ uint32_t neug_get() {
|
|||
return v;
|
||||
}
|
||||
|
||||
void neug_wait_full(void) { //should be called only on core1
|
||||
void neug_wait_full() {
|
||||
struct rng_rb *rb = &the_ring_buffer;
|
||||
|
||||
uint core = get_core_num();
|
||||
while (!rb->full) {
|
||||
sleep_ms(1);
|
||||
}
|
||||
}
|
||||
|
||||
void neug_wait_full_ext(bool blocking) {
|
||||
struct rng_rb *rb = &the_ring_buffer;
|
||||
|
||||
while (!rb->full) {
|
||||
if (blocking == true)
|
||||
if (core == 1)
|
||||
sleep_ms(1);
|
||||
else
|
||||
neug_task();
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@
|
|||
void neug_init(uint32_t *buf, uint8_t size);
|
||||
uint32_t neug_get();
|
||||
void neug_flush(void);
|
||||
void neug_wait_full(void);
|
||||
void neug_wait_full_ext(bool);
|
||||
void neug_wait_full();
|
||||
void neug_fini(void);
|
||||
|
||||
#endif
|
||||
|
|
@ -79,13 +79,13 @@ void random_get_salt(uint8_t *p) {
|
|||
/*
|
||||
* Random byte iterator
|
||||
*/
|
||||
int random_gen_ext(void *arg, unsigned char *out, size_t out_len, bool blocking) {
|
||||
int random_gen(void *arg, unsigned char *out, size_t out_len) {
|
||||
uint8_t *index_p = (uint8_t *)arg;
|
||||
uint8_t index = index_p ? *index_p : 0;
|
||||
size_t n;
|
||||
|
||||
while (out_len) {
|
||||
neug_wait_full_ext(blocking);
|
||||
neug_wait_full();
|
||||
|
||||
n = RANDOM_BYTES_LENGTH - index;
|
||||
if (n > out_len)
|
||||
|
|
@ -107,11 +107,3 @@ int random_gen_ext(void *arg, unsigned char *out, size_t out_len, bool blocking)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int random_gen(void *arg, unsigned char *out, size_t out_len) {
|
||||
return random_gen_ext(arg, out, out_len, true);
|
||||
}
|
||||
|
||||
int random_gen_core0(void *arg, unsigned char *out, size_t out_len) {
|
||||
return random_gen_ext(arg, out, out_len, false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ void random_bytes_free (const uint8_t *p);
|
|||
void random_get_salt (uint8_t *p);
|
||||
|
||||
/* iterator returning a byta at a time */
|
||||
extern int random_gen (void *arg, unsigned char *output, size_t output_len);
|
||||
extern int random_gen_core0(void *arg, unsigned char *out, size_t out_len);
|
||||
extern int random_gen(void *arg, unsigned char *output, size_t output_len);
|
||||
|
||||
#endif
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
static bool mounted = false;
|
||||
extern int cbor_process(uint8_t, const uint8_t *, size_t);
|
||||
extern void init_fido(bool);
|
||||
extern void init_fido();
|
||||
|
||||
typedef struct msg_packet {
|
||||
uint16_t len;
|
||||
|
|
@ -216,7 +216,7 @@ int driver_process_usb_packet_hid(uint16_t read) {
|
|||
}
|
||||
|
||||
if (ctap_req->init.cmd == CTAPHID_INIT) {
|
||||
init_fido(false);
|
||||
init_fido();
|
||||
ctap_resp = (CTAPHID_FRAME *)usb_get_tx(ITF_HID);
|
||||
memset(ctap_resp, 0, 64);
|
||||
CTAPHID_INIT_REQ *req = (CTAPHID_INIT_REQ *)ctap_req->init.data;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue