Fix alignment access issue on nano S

This commit is contained in:
TamtamHero
2021-05-07 16:06:30 +02:00
committed by pscott
parent ec1a0d1128
commit a54b4bda1d

View File

@@ -74,12 +74,13 @@ uint32_t u32_from_BE(uint8_t *in, uint8_t size, bool strict) {
bool uint256_to_decimal(const uint8_t *value, char *out, size_t out_len) {
uint16_t n[16];
uint16_t *p = (uint16_t *) value;
memcpy((uint8_t*)n, value, 32);
uint16_t *p = n;
for (int i = 0; i < 16; i++) {
n[i] = __builtin_bswap16(*p++);
}
int pos = out_len;
while (!allzeroes((uint8_t *)n, sizeof(n))) {
while (!allzeroes(n, sizeof(n))) {
if (pos == 0) {
return false;
}