Set const qualifiers in few fields used by the plugin interface

This commit is contained in:
Jean-Baptiste Bédrune
2022-02-03 14:19:53 +01:00
parent 458ef9af52
commit 89fddf3ef8
2 changed files with 9 additions and 9 deletions

View File

@@ -76,7 +76,7 @@ typedef struct ethPluginInitContract_t {
ethPluginSharedRO_t *pluginSharedRO;
uint8_t *pluginContext;
size_t pluginContextLength;
uint8_t *selector; // 4 bytes selector
const uint8_t *selector; // 4 bytes selector
size_t dataSize;
char *alias; // 29 bytes alias if ETH_PLUGIN_RESULT_OK_ALIAS set
@@ -89,7 +89,7 @@ typedef struct ethPluginProvideParameter_t {
ethPluginSharedRW_t *pluginSharedRW;
ethPluginSharedRO_t *pluginSharedRO;
uint8_t *pluginContext;
uint8_t *parameter; // 32 bytes parameter
const uint8_t *parameter; // 32 bytes parameter
uint32_t parameterOffset;
uint8_t result;
@@ -106,9 +106,9 @@ typedef struct ethPluginFinalize_t {
uint8_t *tokenLookup1; // set by the plugin if a token should be looked up
uint8_t *tokenLookup2;
uint8_t *amount; // set an uint256 pointer if uiType is UI_AMOUNT_ADDRESS
uint8_t *address; // set to the destination address if uiType is UI_AMOUNT_ADDRESS. Set to the
// user's address if uiType is UI_TYPE_GENERIC
const uint8_t *amount; // set an uint256 pointer if uiType is UI_AMOUNT_ADDRESS
const uint8_t *address; // set to the destination address if uiType is UI_AMOUNT_ADDRESS. Set
// to the user's address if uiType is UI_TYPE_GENERIC
uint8_t uiType;
uint8_t numScreens; // ignored if uiType is UI_AMOUNT_ADDRESS

View File

@@ -185,7 +185,7 @@ bool is_deversify_contract(const uint8_t *address) {
}
// TODO : rewrite as independant code
bool starkware_verify_asset_id(uint8_t *tmp32, uint8_t *tokenId, bool assetTypeOnly) {
bool starkware_verify_asset_id(uint8_t *tmp32, const uint8_t *tokenId, bool assetTypeOnly) {
if (quantumSet) {
cx_sha3_t sha3;
tokenDefinition_t *currentToken = NULL;
@@ -214,7 +214,7 @@ bool starkware_verify_asset_id(uint8_t *tmp32, uint8_t *tokenId, bool assetTypeO
return true;
}
bool starkware_verify_token(uint8_t *token) {
bool starkware_verify_token(const uint8_t *token) {
if (quantumSet) {
if (dataContext.tokenContext.quantumIndex != MAX_ITEMS) {
tokenDefinition_t *currentToken =
@@ -235,7 +235,7 @@ bool starkware_verify_token(uint8_t *token) {
return true;
}
bool starkware_verify_quantum(uint8_t *quantum) {
bool starkware_verify_quantum(const uint8_t *quantum) {
if (quantumSet) {
if (dataContext.tokenContext.quantumIndex != MAX_ITEMS) {
if (memcmp(quantum, dataContext.tokenContext.quantum, 32) != 0) {
@@ -254,7 +254,7 @@ bool starkware_verify_quantum(uint8_t *quantum) {
return true;
}
bool starkware_verify_nft_token_id(uint8_t *tokenId) {
bool starkware_verify_nft_token_id(const uint8_t *tokenId) {
if (!quantumSet) {
PRINTF("Quantum not set\n");
return false;