Now uses some of the old EIP712 code as common code between the two implementations + approve/reject button now works

This commit is contained in:
Alexandre Paillier
2022-05-12 17:30:04 +02:00
parent 9f29a7caa2
commit 9cd39e2c02
10 changed files with 61 additions and 55 deletions

View File

@@ -2,15 +2,15 @@
#include "apdu_constants.h"
#include "utils.h"
#include "ui_flow.h"
#include "eip712.h"
#include "common_712.h"
void handleSignEIP712Message_v0(uint8_t p1,
uint8_t p2,
const uint8_t *workBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx) {
uint8_t i;
UNUSED(tx);
if ((p1 != 00) || (p2 != 00)) {
THROW(0x6B00);
@@ -21,11 +21,15 @@ void handleSignEIP712Message_v0(uint8_t p1,
workBuffer = parseBip32(workBuffer, &dataLength, &tmpCtx.messageSigningContext.bip32);
if ((workBuffer == NULL) || (dataLength < (32 + 32))) {
if ((workBuffer == NULL) || (dataLength < (KECCAK256_HASH_BYTESIZE * 2))) {
THROW(0x6a80);
}
memmove(tmpCtx.messageSigningContext712.domainHash, workBuffer, 32);
memmove(tmpCtx.messageSigningContext712.messageHash, workBuffer + 32, 32);
memmove(tmpCtx.messageSigningContext712.domainHash,
workBuffer,
KECCAK256_HASH_BYTESIZE);
memmove(tmpCtx.messageSigningContext712.messageHash,
workBuffer + KECCAK256_HASH_BYTESIZE,
KECCAK256_HASH_BYTESIZE);
#ifdef NO_CONSENT
io_seproxyhal_touch_signMessage_ok(NULL);