Skip to content

Commit

Permalink
update policyForSignTxInit
Browse files Browse the repository at this point in the history
  • Loading branch information
janmazak committed Aug 10, 2022
1 parent 7efde1f commit 3e9b226
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/securityPolicy.c
Expand Up @@ -305,11 +305,12 @@ security_policy_t policyForSignTxInit(
uint16_t numCertificates,
uint16_t numWithdrawals,
bool includeMint,
bool includeScriptDataHash,
uint16_t numCollateralInputs,
uint16_t numRequiredSigners,
bool includeScriptDataHash,
bool includeNetworkId,
bool includeTotalCollateral, // TODO add other babbage elements too and update the policy
bool includeCollateralOutput,
bool includeTotalCollateral,
uint16_t numReferenceInputs
)
{
Expand Down Expand Up @@ -339,13 +340,17 @@ security_policy_t policyForSignTxInit(
DENY_IF(includeScriptDataHash);
DENY_IF(numCollateralInputs > 0);
DENY_IF(numRequiredSigners > 0);
DENY_IF(includeCollateralOutput);
DENY_IF(includeTotalCollateral);
DENY_IF(numReferenceInputs > 0);
break;

case SIGN_TX_SIGNINGMODE_ORDINARY_TX:
case SIGN_TX_SIGNINGMODE_MULTISIG_TX:
// collateral inputs are allowed only in PLUTUS_TX
DENY_IF(numCollateralInputs > 0);
DENY_IF(includeCollateralOutput);
DENY_IF(includeTotalCollateral);
DENY_IF(numReferenceInputs > 0);
break;

Expand Down
3 changes: 2 additions & 1 deletion src/securityPolicy.h
Expand Up @@ -37,10 +37,11 @@ security_policy_t policyForSignTxInit(
uint16_t numCertificates,
uint16_t numWithdrawals,
bool includeMint,
bool includeScriptDataHash,
uint16_t numCollateralInputs,
uint16_t numRequiredSigners,
bool includeScriptDataHash,
bool includeNetworkId,
bool includeCollateralOutput,
bool includeTotalCollateral,
uint16_t numReferenceInputs
);
Expand Down
3 changes: 2 additions & 1 deletion src/signTx.c
Expand Up @@ -657,10 +657,11 @@ static void signTx_handleInitAPDU(uint8_t p2, const uint8_t* wireDataBuffer, siz
ctx->numCertificates,
ctx->numWithdrawals,
ctx->includeMint,
ctx->includeScriptDataHash,
ctx->numCollateralInputs,
ctx->numRequiredSigners,
ctx->includeScriptDataHash,
ctx->includeNetworkId,
ctx->includeCollateralOutput,
ctx->includeTotalCollateral,
ctx->numReferenceInputs
);
Expand Down

0 comments on commit 3e9b226

Please sign in to comment.