mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-21 23:18:13 +00:00
chore(legacy): simplify data2hex
This commit is contained in:
parent
105f203a1f
commit
0519d86451
@ -422,7 +422,7 @@ void config_init(void) {
|
||||
storage_set(KEY_UUID, config_uuid, sizeof(config_uuid));
|
||||
storage_set(KEY_VERSION, &CONFIG_VERSION, sizeof(CONFIG_VERSION));
|
||||
}
|
||||
data2hex(config_uuid, sizeof(config_uuid), config_uuid_str);
|
||||
data2hex((const uint8_t *)config_uuid, sizeof(config_uuid), config_uuid_str);
|
||||
|
||||
session_clear(false);
|
||||
|
||||
@ -986,7 +986,7 @@ void config_wipe(void) {
|
||||
}
|
||||
usbTiny(oldTiny);
|
||||
random_buffer((uint8_t *)config_uuid, sizeof(config_uuid));
|
||||
data2hex(config_uuid, sizeof(config_uuid), config_uuid_str);
|
||||
data2hex((const uint8_t *)config_uuid, sizeof(config_uuid), config_uuid_str);
|
||||
autoLockDelayMsCached = secfalse;
|
||||
storage_set(KEY_UUID, config_uuid, sizeof(config_uuid));
|
||||
storage_set(KEY_VERSION, &CONFIG_VERSION, sizeof(CONFIG_VERSION));
|
||||
|
@ -32,11 +32,10 @@ void uint32hex(uint32_t num, char *str) {
|
||||
}
|
||||
|
||||
// converts data to hexa
|
||||
void data2hex(const void *data, uint32_t len, char *str) {
|
||||
const uint8_t *cdata = (uint8_t *)data;
|
||||
void data2hex(const uint8_t *data, uint32_t len, char *str) {
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
str[i * 2] = hexdigits[(cdata[i] >> 4) & 0xF];
|
||||
str[i * 2 + 1] = hexdigits[cdata[i] & 0xF];
|
||||
str[i * 2] = hexdigits[(data[i] >> 4) & 0xF];
|
||||
str[i * 2 + 1] = hexdigits[data[i] & 0xF];
|
||||
}
|
||||
str[len * 2] = 0;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ void delay(uint32_t wait);
|
||||
void uint32hex(uint32_t num, char *str);
|
||||
|
||||
// converts data to hexa
|
||||
void data2hex(const void *data, uint32_t len, char *str);
|
||||
void data2hex(const uint8_t *data, uint32_t len, char *str);
|
||||
|
||||
// defined in startup.s (or setup.c for emulator)
|
||||
extern void __attribute__((noreturn)) shutdown(void);
|
||||
|
Loading…
Reference in New Issue
Block a user