Files
app-ethereum/src_nbgl/ui_sign_712_v0.c

43 lines
1.5 KiB
C
Raw Permalink Normal View History

#include <string.h> // explicit_bzero
#include "os_utils.h" // ARRAYLEN
2023-02-21 11:01:18 +01:00
#include "common_ui.h"
#include "ui_nbgl.h"
#include "common_712.h"
2023-06-06 16:58:27 +02:00
#include "ui_message_signing.h"
2023-02-21 11:01:18 +01:00
static nbgl_contentTagValue_t pairs[2];
2024-05-24 13:46:06 +02:00
static nbgl_contentTagValueList_t pairs_list;
2023-02-21 11:01:18 +01:00
static char *format_hash(const uint8_t *hash, char *buffer, size_t buffer_size, size_t offset) {
2024-05-07 16:01:12 +02:00
array_bytes_string(buffer + offset, buffer_size - offset, hash, KECCAK256_HASH_BYTESIZE);
return buffer + offset;
2023-02-21 11:01:18 +01:00
}
void ui_sign_712_v0(void) {
explicit_bzero(pairs, sizeof(pairs));
2024-05-24 13:46:06 +02:00
explicit_bzero(&pairs_list, sizeof(pairs_list));
2023-02-21 11:01:18 +01:00
pairs[0].item = "Domain hash";
pairs[0].value = format_hash(tmpCtx.messageSigningContext712.domainHash,
strings.tmp.tmp,
sizeof(strings.tmp.tmp),
0);
pairs[1].item = "Message hash";
pairs[1].value = format_hash(tmpCtx.messageSigningContext712.messageHash,
strings.tmp.tmp,
sizeof(strings.tmp.tmp),
70);
2023-06-16 11:57:08 +02:00
2024-05-24 13:46:06 +02:00
pairs_list.nbPairs = ARRAYLEN(pairs);
pairs_list.pairs = pairs;
pairs_list.nbMaxLinesForValue = 0;
nbgl_useCaseReview(TYPE_MESSAGE,
2024-05-24 13:46:06 +02:00
&pairs_list,
&C_Review_64px,
TEXT_REVIEW_EIP712,
NULL,
TEXT_SIGN_EIP712,
ui_typed_message_review_choice);
2023-02-21 11:01:18 +01:00
}