Skip to content

Commit

Permalink
random: use void* instead of uint8_t* for opaque bytes in and out
Browse files Browse the repository at this point in the history
  • Loading branch information
greenaddress authored and JamieDriver committed Oct 12, 2023
1 parent 78f2f5c commit 1a3d41f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion main/process/dashboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -2157,7 +2157,7 @@ static void display_screen(jade_process_t* process, gui_activity_t* act)

// Refeed sensor entropy every time we return to dashboard screen
const TickType_t tick_count = xTaskGetTickCount();
refeed_entropy((const uint8_t*)&tick_count, sizeof(tick_count));
refeed_entropy(&tick_count, sizeof(tick_count));
}

// Display the dashboard ready or welcome screen. Await messages or user GUI input.
Expand Down
4 changes: 2 additions & 2 deletions main/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ static void get_random_internal(uint8_t* bytes_out, const size_t len, const uint
JADE_WALLY_VERIFY(wally_bzero(buf, sizeof(buf)));
}

void refeed_entropy(const uint8_t* additional, const size_t len)
void refeed_entropy(const void* additional, const size_t len)
{
JADE_ASSERT(additional);
JADE_ASSERT(len);
get_random_internal(NULL, 0, additional, len);
}

void get_random(uint8_t* bytes_out, const size_t len)
void get_random(void* bytes_out, const size_t len)
{
JADE_ASSERT(bytes_out);
JADE_ASSERT(len);
Expand Down
4 changes: 2 additions & 2 deletions main/random.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <stddef.h>
#include <stdint.h>

void refeed_entropy(const uint8_t* additional, size_t len);
void get_random(uint8_t* bytes_out, size_t len);
void refeed_entropy(const void* additional, size_t len);
void get_random(void* bytes_out, size_t len);
uint8_t get_uniform_random_byte(uint8_t upper_bound);

// this function needs to be called first thing when starting up
Expand Down

0 comments on commit 1a3d41f

Please sign in to comment.