Change apdu payload length to proper size (8 bits)

This commit is contained in:
Alexandre Paillier
2022-07-19 11:42:25 +02:00
parent cd36a5fe9c
commit 895c37e1fa
17 changed files with 37 additions and 36 deletions

View File

@@ -61,37 +61,37 @@
void handleGetPublicKey(uint8_t p1,
uint8_t p2,
const uint8_t *dataBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx);
void handleProvideErc20TokenInformation(uint8_t p1,
uint8_t p2,
const uint8_t *dataBuffer,
uint16_t dataLength,
const uint8_t *workBuffer,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx);
void handleProvideNFTInformation(uint8_t p1,
uint8_t p2,
const uint8_t *dataBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx);
void handleSign(uint8_t p1,
uint8_t p2,
const uint8_t *dataBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx);
void handleGetAppConfiguration(uint8_t p1,
uint8_t p2,
const uint8_t *dataBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx);
void handleSignPersonalMessage(uint8_t p1,
uint8_t p2,
const uint8_t *dataBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx);
void handleSignEIP712Message(uint8_t p1,
@@ -104,21 +104,21 @@ void handleSignEIP712Message(uint8_t p1,
void handleSetExternalPlugin(uint8_t p1,
uint8_t p2,
const uint8_t *workBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx);
void handleSetPlugin(uint8_t p1,
uint8_t p2,
const uint8_t *workBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx);
void handlePerformPrivacyOperation(uint8_t p1,
uint8_t p2,
const uint8_t *workBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx);
@@ -127,13 +127,13 @@ void handlePerformPrivacyOperation(uint8_t p1,
void handleGetEth2PublicKey(uint8_t p1,
uint8_t p2,
const uint8_t *dataBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx);
void handleSetEth2WinthdrawalIndex(uint8_t p1,
uint8_t p2,
uint8_t *dataBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx);
@@ -144,25 +144,25 @@ void handleSetEth2WinthdrawalIndex(uint8_t p1,
void handleStarkwareGetPublicKey(uint8_t p1,
uint8_t p2,
const uint8_t *dataBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx);
void handleStarkwareSignMessage(uint8_t p1,
uint8_t p2,
uint8_t *dataBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx);
void handleStarkwareProvideQuantum(uint8_t p1,
uint8_t p2,
const uint8_t *dataBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx);
void handleStarkwareUnsafeSign(uint8_t p1,
uint8_t p2,
const uint8_t *dataBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx);

View File

@@ -480,7 +480,7 @@ void handleGetWalletId(volatile unsigned int *tx) {
#endif // HAVE_WALLET_ID_SDK
const uint8_t *parseBip32(const uint8_t *dataBuffer, uint16_t *dataLength, bip32_path_t *bip32) {
const uint8_t *parseBip32(const uint8_t *dataBuffer, uint8_t *dataLength, bip32_path_t *bip32) {
if (*dataLength < 1) {
PRINTF("Invalid data\n");
return NULL;

View File

@@ -219,6 +219,6 @@ extern uint32_t eth2WithdrawalIndex;
#endif
void reset_app_context(void);
const uint8_t *parseBip32(const uint8_t *, uint16_t *, bip32_path_t *);
const uint8_t *parseBip32(const uint8_t *, uint8_t *, bip32_path_t *);
#endif // _SHARED_CONTEXT_H_

View File

@@ -6,7 +6,7 @@
void handleGetAppConfiguration(uint8_t p1,
uint8_t p2,
const uint8_t *workBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx) {
UNUSED(p1);

View File

@@ -43,7 +43,7 @@ void getEth2PublicKey(uint32_t *bip32Path, uint8_t bip32PathLength, uint8_t *out
void handleGetEth2PublicKey(uint8_t p1,
uint8_t p2,
const uint8_t *dataBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx) {
bip32_path_t bip32;

View File

@@ -8,7 +8,7 @@
void handleGetPublicKey(uint8_t p1,
uint8_t p2,
const uint8_t *dataBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx) {
uint8_t privateKeyData[INT256_LENGTH];

View File

@@ -26,7 +26,7 @@ void decodeScalar(const uint8_t *scalarIn, uint8_t *scalarOut) {
void handlePerformPrivacyOperation(uint8_t p1,
uint8_t p2,
const uint8_t *dataBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx) {
uint8_t privateKeyData[INT256_LENGTH];

View File

@@ -7,8 +7,8 @@
void handleProvideErc20TokenInformation(uint8_t p1,
uint8_t p2,
uint8_t *workBuffer,
uint16_t dataLength,
const uint8_t *workBuffer,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx) {
UNUSED(p1);
@@ -102,12 +102,13 @@ void handleProvideErc20TokenInformation(uint8_t p1,
void handleProvideErc20TokenInformation(uint8_t p1,
uint8_t p2,
const uint8_t *workBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
__attribute__((unused)) unsigned int *tx) {
unsigned int *tx) {
UNUSED(p1);
UNUSED(p2);
UNUSED(flags);
UNUSED(tx);
uint32_t offset = 0;
uint8_t tickerLength;
uint32_t chainId;

View File

@@ -54,7 +54,7 @@ typedef bool verificationAlgo(const cx_ecfp_public_key_t *,
void handleProvideNFTInformation(uint8_t p1,
uint8_t p2,
const uint8_t *workBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx) {
UNUSED(p1);

View File

@@ -8,7 +8,7 @@
void handleSetExternalPlugin(uint8_t p1,
uint8_t p2,
const uint8_t *workBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx) {
UNUSED(p1);
@@ -90,4 +90,4 @@ void handleSetExternalPlugin(uint8_t p1,
G_io_apdu_buffer[(*tx)++] = 0x90;
G_io_apdu_buffer[(*tx)++] = 0x00;
}
}

View File

@@ -87,7 +87,7 @@ static pluginType_t getPluginType(char *pluginName, uint8_t pluginNameLength) {
void handleSetPlugin(uint8_t p1,
uint8_t p2,
const uint8_t *workBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx) {
UNUSED(p1);

View File

@@ -114,7 +114,7 @@ static void feed_value_str(const uint8_t *const data, size_t length, bool is_asc
void handleSignPersonalMessage(uint8_t p1,
uint8_t p2,
const uint8_t *workBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx) {
UNUSED(tx);

View File

@@ -7,7 +7,7 @@
void handleSign(uint8_t p1,
uint8_t p2,
const uint8_t *workBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx) {
UNUSED(tx);

View File

@@ -9,7 +9,7 @@
void handleStarkwareGetPublicKey(uint8_t p1,
uint8_t p2,
const uint8_t *dataBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
unsigned int *tx) {
bip32_path_t bip32;

View File

@@ -8,7 +8,7 @@
void handleStarkwareProvideQuantum(uint8_t p1,
__attribute__((unused)) uint8_t p2,
const uint8_t *dataBuffer,
uint16_t dataLength,
uint8_t dataLength,
__attribute__((unused)) unsigned int *flags,
__attribute__((unused)) unsigned int *tx) {
size_t i = 0;

View File

@@ -15,7 +15,7 @@
void handleStarkwareSignMessage(uint8_t p1,
uint8_t p2,
uint8_t *dataBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
__attribute__((unused)) unsigned int *tx) {
uint8_t privateKeyData[INT256_LENGTH];

View File

@@ -9,7 +9,7 @@
void handleStarkwareUnsafeSign(uint8_t p1,
uint8_t p2,
const uint8_t *dataBuffer,
uint16_t dataLength,
uint8_t dataLength,
unsigned int *flags,
__attribute__((unused)) unsigned int *tx) {
uint8_t privateKeyData[INT256_LENGTH];