From 06075c95863a28f40406d41748ade36d7e1014a5 Mon Sep 17 00:00:00 2001 From: pscott Date: Sat, 31 Jul 2021 14:21:10 +0200 Subject: [PATCH] Sign txType byte --- src_features/signTx/cmd_signTx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src_features/signTx/cmd_signTx.c b/src_features/signTx/cmd_signTx.c index c429992..7e64235 100644 --- a/src_features/signTx/cmd_signTx.c +++ b/src_features/signTx/cmd_signTx.c @@ -41,11 +41,14 @@ void handleSign(uint8_t p1, tmpContent.txContent.dataPresent = false; dataContext.tokenContext.pluginStatus = ETH_PLUGIN_RESULT_UNAVAILABLE; + initTx(&txContext, &global_sha3, &tmpContent.txContent, customProcessor, NULL); + // EIP 2718: TransactionType might be present before the TransactionPayload. uint8_t txType = *workBuffer; if (txType >= MIN_TX_TYPE && txType <= MAX_TX_TYPE) { // Enumerate through all supported txTypes here... if (txType == EIP2930 || txType == EIP1559) { + cx_hash((cx_hash_t *) &global_sha3, 0, workBuffer, 1, NULL, 0); txContext.txType = txType; workBuffer++; dataLength--; @@ -56,7 +59,6 @@ void handleSign(uint8_t p1, } else { txContext.txType = LEGACY; } - initTx(&txContext, &global_sha3, &tmpContent.txContent, customProcessor, NULL); } else if (p1 != P1_MORE) { THROW(0x6B00); }