diff --git a/doc/ethapp.asc b/doc/ethapp.asc index d57e13c..35ef221 100644 --- a/doc/ethapp.asc +++ b/doc/ethapp.asc @@ -473,6 +473,7 @@ The following standard Status Words are returned for all APDUs - some specific S [width="80%"] |=============================================================================================== | *SW* | *Description* +| 6501 | TransactionType not supported | 6700 | Incorrect length | 6982 | Security status not satisfied (Canceled by user) | 6A80 | Invalid data diff --git a/src_common/ethUstream.c b/src_common/ethUstream.c index 2bd36a6..6cf92d9 100644 --- a/src_common/ethUstream.c +++ b/src_common/ethUstream.c @@ -249,25 +249,9 @@ static void processV(txContext_t *context) { } static parserStatus_e processTxInternal(txContext_t *context) { - // EIP 2718: TransactionType might be present before the TransactionPayload. - uint8_t txType = *context->workBuffer; - if (txType >= MIN_TX_TYPE && txType <= MAX_TX_TYPE) { - PRINTF("TX TYPE: %u\n", txType); - - // Enumerate through all supported txTypes here... - if (txType == LEGACY_TX) { - context->txType = txType; - context->workBuffer++; - } else { - PRINTF("Transaction type not supported\n"); - return USTREAM_FAULT; - } - } - - // Parse the TransactionPayload. for (;;) { customStatus_e customStatus = CUSTOM_NOT_HANDLED; - // EIP 155 style transasction + // EIP 155 style transaction if (context->currentField == TX_RLP_DONE) { return USTREAM_FINISHED; } diff --git a/src_features/signTx/cmd_signTx.c b/src_features/signTx/cmd_signTx.c index e721d06..d08c528 100644 --- a/src_features/signTx/cmd_signTx.c +++ b/src_features/signTx/cmd_signTx.c @@ -40,6 +40,22 @@ void handleSign(uint8_t p1, } dataPresent = false; dataContext.tokenContext.pluginAvailable = 0; + + // EIP 2718: TransactionType might be present before the TransactionPayload. + uint8_t txType = *workBuffer; + if (txType >= MIN_TX_TYPE && txType <= MAX_TX_TYPE) { + PRINTF("Transaction type: %u\n", txType); + + // Enumerate through all supported txTypes here... + if (txType == LEGACY_TX) { + txContext.txType = txType; + workBuffer++; + dataLength--; + } else { + PRINTF("Transaction type not supported\n"); + THROW(0x6501); + } + } initTx(&txContext, &global_sha3, &tmpContent.txContent, customProcessor, NULL); } else if (p1 != P1_MORE) { THROW(0x6B00);