Files
app-ethereum/src_features/signMessageEIP712_v0/cmd_signMessage712.c

38 lines
1.1 KiB
C
Raw Normal View History

2020-09-26 15:49:36 +02:00
#include "shared_context.h"
#include "apdu_constants.h"
#include "utils.h"
#include "ui_flow.h"
void handleSignEIP712Message_v0(uint8_t p1,
uint8_t p2,
const uint8_t *workBuffer,
uint16_t dataLength,
unsigned int *flags,
unsigned int *tx) {
uint8_t i;
2020-12-01 16:20:13 +01:00
UNUSED(tx);
if ((p1 != 00) || (p2 != 00)) {
2022-05-12 17:29:35 +02:00
THROW(0x6B00);
2020-09-26 15:49:36 +02:00
}
2020-12-01 16:20:13 +01:00
if (appState != APP_STATE_IDLE) {
reset_app_context();
}
2022-07-08 11:12:50 +02:00
workBuffer = parseBip32(workBuffer, &dataLength, &tmpCtx.messageSigningContext.bip32);
2022-05-12 17:29:35 +02:00
if ((workBuffer == NULL) || (dataLength < (32 + 32))) {
2020-12-01 16:20:13 +01:00
THROW(0x6a80);
}
2022-05-12 17:29:35 +02:00
memmove(tmpCtx.messageSigningContext712.domainHash, workBuffer, 32);
memmove(tmpCtx.messageSigningContext712.messageHash, workBuffer + 32, 32);
2020-09-26 15:49:36 +02:00
#ifdef NO_CONSENT
io_seproxyhal_touch_signMessage_ok(NULL);
2020-12-01 16:20:13 +01:00
#else // NO_CONSENT
2020-09-26 15:49:36 +02:00
ux_flow_init(0, ux_sign_712_v0_flow, NULL);
2020-12-01 16:20:13 +01:00
#endif // NO_CONSENT
2020-09-26 15:49:36 +02:00
2020-10-07 16:56:40 +02:00
*flags |= IO_ASYNCH_REPLY;
2020-09-26 15:49:36 +02:00
}