diff --git a/src/cardano.h b/src/cardano.h index 4f2e7f11..c2514911 100644 --- a/src/cardano.h +++ b/src/cardano.h @@ -3,6 +3,7 @@ #include "common.h" #include "bip44.h" +#include "keyDerivation.h" // Just a trick to make the numbers readable #define __CONCAT4(A,B,C,D) A ## B ## C ## D @@ -23,7 +24,6 @@ STATIC_ASSERT(LOVELACE_MAX_SUPPLY < LOVELACE_INVALID, "bad LOVELACE_INVALID"); #define SCRIPT_HASH_LENGTH 28 #define SCRIPT_DATA_HASH_LENGTH 32 #define OUTPUT_DATUM_HASH_LENGTH 32 -#define VKEY_LENGTH 32 #define MINTING_POLICY_ID_SIZE 28 #define ASSET_NAME_SIZE_MAX 32 diff --git a/src/keyDerivation.h b/src/keyDerivation.h index e7b72d36..04f22726 100644 --- a/src/keyDerivation.h +++ b/src/keyDerivation.h @@ -5,7 +5,6 @@ #include "handlers.h" #include "bip44.h" - #define PUBLIC_KEY_SIZE (32) #define CHAIN_CODE_SIZE (32) #define EXTENDED_PUBKEY_SIZE (CHAIN_CODE_SIZE + PUBLIC_KEY_SIZE) diff --git a/src/signTx.c b/src/signTx.c index 2bfeffd2..e195f363 100644 --- a/src/signTx.c +++ b/src/signTx.c @@ -1830,8 +1830,8 @@ static void signTx_handleRequiredSignerAPDU(uint8_t p2, uint8_t* wireDataBuffer, TRACE_BUFFER(wireDataBuffer, wireDataSize); read_view_t view = make_read_view(wireDataBuffer, wireDataBuffer + wireDataSize); - STATIC_ASSERT(SIZEOF(BODY_CTX->stageData.requiredSigner) == VKEY_LENGTH, "wrong vkey length"); - view_copyWireToBuffer(BODY_CTX->stageData.requiredSigner, &view, VKEY_LENGTH); + STATIC_ASSERT(SIZEOF(BODY_CTX->stageData.requiredSigner) == PUBLIC_KEY_SIZE, "wrong vkey length"); + view_copyWireToBuffer(BODY_CTX->stageData.requiredSigner, &view, PUBLIC_KEY_SIZE); VALIDATE(view_remainingSize(&view) == 0, ERR_INVALID_DATA); } diff --git a/src/signTx.h b/src/signTx.h index bd6c19a4..7e854839 100644 --- a/src/signTx.h +++ b/src/signTx.h @@ -134,7 +134,7 @@ typedef struct { uint64_t validityIntervalStart; uint8_t scriptDataHash[SCRIPT_DATA_HASH_LENGTH]; sign_tx_transaction_input_t collateral; - uint8_t requiredSigner[VKEY_LENGTH]; + uint8_t requiredSigner[PUBLIC_KEY_SIZE]; } stageData; // TODO rename to reflect single-APDU scope union { diff --git a/src/txHashBuilder.c b/src/txHashBuilder.c index 2be62ac5..782147d9 100644 --- a/src/txHashBuilder.c +++ b/src/txHashBuilder.c @@ -1355,7 +1355,7 @@ void txHashBuilder_addRequiredSigner( // Unsigned[index] // ] { - ASSERT(vkeySize == VKEY_LENGTH); + ASSERT(vkeySize == PUBLIC_KEY_SIZE); BUILDER_APPEND_CBOR(CBOR_TYPE_BYTES, vkeySize); BUILDER_APPEND_DATA(vkeyBuffer, vkeySize); }