Review fixes
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
#define P2_CHAINCODE 0x01
|
||||
#define P1_FIRST 0x00
|
||||
#define P1_MORE 0x80
|
||||
#define P2_EIP712_LEGACY_IMPLEM 0x00
|
||||
#define P2_EIP712_FULL_IMPLEM 0x01
|
||||
|
||||
#define COMMON_CLA 0xB0
|
||||
#define COMMON_INS_GET_WALLET_ID 0x04
|
||||
|
||||
29
src/main.c
29
src/main.c
@@ -674,21 +674,24 @@ void handleApdu(unsigned int *flags, unsigned int *tx) {
|
||||
break;
|
||||
|
||||
case INS_SIGN_EIP_712_MESSAGE:
|
||||
if (G_io_apdu_buffer[OFFSET_P2] == 0) {
|
||||
memset(tmpCtx.transactionContext.tokenSet, 0, MAX_ITEMS);
|
||||
handleSignEIP712Message_v0(G_io_apdu_buffer[OFFSET_P1],
|
||||
G_io_apdu_buffer[OFFSET_P2],
|
||||
G_io_apdu_buffer + OFFSET_CDATA,
|
||||
G_io_apdu_buffer[OFFSET_LC],
|
||||
flags,
|
||||
tx);
|
||||
} else {
|
||||
switch (G_io_apdu_buffer[OFFSET_P2]) {
|
||||
case P2_EIP712_LEGACY_IMPLEM:
|
||||
memset(tmpCtx.transactionContext.tokenSet, 0, MAX_ITEMS);
|
||||
handleSignEIP712Message_v0(G_io_apdu_buffer[OFFSET_P1],
|
||||
G_io_apdu_buffer[OFFSET_P2],
|
||||
G_io_apdu_buffer + OFFSET_CDATA,
|
||||
G_io_apdu_buffer[OFFSET_LC],
|
||||
flags,
|
||||
tx);
|
||||
break;
|
||||
#ifdef HAVE_EIP712_FULL_SUPPORT
|
||||
*flags |= IO_ASYNCH_REPLY;
|
||||
handle_eip712_sign(G_io_apdu_buffer);
|
||||
#else
|
||||
THROW(0x6B00);
|
||||
case P2_EIP712_FULL_IMPLEM:
|
||||
*flags |= IO_ASYNCH_REPLY;
|
||||
handle_eip712_sign(G_io_apdu_buffer);
|
||||
break;
|
||||
#endif // HAVE_EIP712_FULL_SUPPORT
|
||||
default:
|
||||
THROW(APDU_RESPONSE_INVALID_P1_P2);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -222,6 +222,6 @@ extern uint32_t eth2WithdrawalIndex;
|
||||
#endif
|
||||
|
||||
void reset_app_context(void);
|
||||
const uint8_t *parseBip32(const uint8_t *, uint8_t *, bip32_path_t *);
|
||||
const uint8_t *parseBip32(const uint8_t *dataBuffer, uint8_t *dataLength, bip32_path_t *bip32);
|
||||
|
||||
#endif // _SHARED_CONTEXT_H_
|
||||
|
||||
Reference in New Issue
Block a user