Update ethereum plugin-sdk
This commit is contained in:
Submodule ethereum-plugin-sdk updated: 2bf928b2c1...2ced76b8a3
@@ -58,20 +58,3 @@ void reverseString(char *const str, uint32_t length) {
|
|||||||
str[j] = c;
|
str[j] = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int bytes_to_string(char *out, size_t outl, const void *value, size_t len) {
|
|
||||||
if (outl <= 2) {
|
|
||||||
// Need at least '0x' and 1 digit
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (strlcpy(out, "0x", outl) != 2) {
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
if (format_hex(value, len, out + 2, outl - 2) < 0) {
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
err:
|
|
||||||
*out = '\0';
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -35,6 +35,4 @@ void read_u64_be(const uint8_t *const in, uint64_t *const out);
|
|||||||
uint64_t readUint64BE(const uint8_t *const buffer);
|
uint64_t readUint64BE(const uint8_t *const buffer);
|
||||||
void reverseString(char *const str, uint32_t length);
|
void reverseString(char *const str, uint32_t length);
|
||||||
|
|
||||||
int bytes_to_string(char *out, size_t outl, const void *value, size_t len);
|
|
||||||
|
|
||||||
#endif //_UINT_COMMON_H_
|
#endif //_UINT_COMMON_H_
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
#include "uint_common.h"
|
#include "uint_common.h"
|
||||||
|
|
||||||
void prepare_eth2_public_key() {
|
void prepare_eth2_public_key() {
|
||||||
bytes_to_string(strings.tmp.tmp,
|
array_bytes_string(strings.tmp.tmp,
|
||||||
sizeof(strings.tmp.tmp),
|
sizeof(strings.tmp.tmp),
|
||||||
tmpCtx.publicKeyContext.publicKey.W,
|
tmpCtx.publicKeyContext.publicKey.W,
|
||||||
48);
|
48);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
|||||||
@@ -4,17 +4,17 @@
|
|||||||
#include "uint_common.h"
|
#include "uint_common.h"
|
||||||
|
|
||||||
void prepare_domain_hash_v0() {
|
void prepare_domain_hash_v0() {
|
||||||
bytes_to_string(strings.tmp.tmp,
|
array_bytes_string(strings.tmp.tmp,
|
||||||
sizeof(strings.tmp.tmp),
|
sizeof(strings.tmp.tmp),
|
||||||
tmpCtx.messageSigningContext712.domainHash,
|
tmpCtx.messageSigningContext712.domainHash,
|
||||||
KECCAK256_HASH_BYTESIZE);
|
KECCAK256_HASH_BYTESIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void prepare_message_hash_v0() {
|
void prepare_message_hash_v0() {
|
||||||
bytes_to_string(strings.tmp.tmp,
|
array_bytes_string(strings.tmp.tmp,
|
||||||
sizeof(strings.tmp.tmp),
|
sizeof(strings.tmp.tmp),
|
||||||
tmpCtx.messageSigningContext712.messageHash,
|
tmpCtx.messageSigningContext712.messageHash,
|
||||||
KECCAK256_HASH_BYTESIZE);
|
KECCAK256_HASH_BYTESIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
|||||||
@@ -166,10 +166,10 @@ void ui_712_message_hash(void) {
|
|||||||
const char *const title = "Message hash";
|
const char *const title = "Message hash";
|
||||||
|
|
||||||
ui_712_set_title(title, strlen(title));
|
ui_712_set_title(title, strlen(title));
|
||||||
bytes_to_string(strings.tmp.tmp,
|
array_bytes_string(strings.tmp.tmp,
|
||||||
sizeof(strings.tmp.tmp),
|
sizeof(strings.tmp.tmp),
|
||||||
tmpCtx.messageSigningContext712.messageHash,
|
tmpCtx.messageSigningContext712.messageHash,
|
||||||
KECCAK256_HASH_BYTESIZE);
|
KECCAK256_HASH_BYTESIZE);
|
||||||
ui_712_redraw_generic_step();
|
ui_712_redraw_generic_step();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,7 +286,7 @@ static bool ui_712_format_bool(const uint8_t *const data, uint8_t length) {
|
|||||||
*/
|
*/
|
||||||
static void ui_712_format_bytes(const uint8_t *const data, uint8_t length) {
|
static void ui_712_format_bytes(const uint8_t *const data, uint8_t length) {
|
||||||
if (ui_712_field_shown()) {
|
if (ui_712_field_shown()) {
|
||||||
bytes_to_string(strings.tmp.tmp, sizeof(strings.tmp.tmp), data, length);
|
array_bytes_string(strings.tmp.tmp, sizeof(strings.tmp.tmp), data, length);
|
||||||
// +2 for the "0x"
|
// +2 for the "0x"
|
||||||
// x2 for each byte value is represented by 2 ASCII characters
|
// x2 for each byte value is represented by 2 ASCII characters
|
||||||
if ((2 + (length * 2)) > (sizeof(strings.tmp.tmp) - 1)) {
|
if ((2 + (length * 2)) > (sizeof(strings.tmp.tmp) - 1)) {
|
||||||
|
|||||||
@@ -21,10 +21,10 @@ static void reviewChoice(bool confirm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ui_display_public_eth2(void) {
|
void ui_display_public_eth2(void) {
|
||||||
bytes_to_string(strings.tmp.tmp,
|
array_bytes_string(strings.tmp.tmp,
|
||||||
sizeof(strings.tmp.tmp),
|
sizeof(strings.tmp.tmp),
|
||||||
tmpCtx.publicKeyContext.publicKey.W,
|
tmpCtx.publicKeyContext.publicKey.W,
|
||||||
48);
|
48);
|
||||||
strlcpy(g_stax_shared_buffer, "Verify ETH2\naddress", sizeof(g_stax_shared_buffer));
|
strlcpy(g_stax_shared_buffer, "Verify ETH2\naddress", sizeof(g_stax_shared_buffer));
|
||||||
nbgl_useCaseAddressReview(strings.tmp.tmp,
|
nbgl_useCaseAddressReview(strings.tmp.tmp,
|
||||||
NULL,
|
NULL,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ static void messageReviewChoice_cb(bool confirm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char *format_hash(const uint8_t *hash, char *buffer, size_t buffer_size, size_t offset) {
|
static char *format_hash(const uint8_t *hash, char *buffer, size_t buffer_size, size_t offset) {
|
||||||
bytes_to_string(buffer + offset, buffer_size - offset, hash, KECCAK256_HASH_BYTESIZE);
|
array_bytes_string(buffer + offset, buffer_size - offset, hash, KECCAK256_HASH_BYTESIZE);
|
||||||
return buffer + offset;
|
return buffer + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user