Add upper bound for withdrawal index

This commit is contained in:
pscott
2021-04-22 10:08:05 +02:00
parent de0f449204
commit 6ff2172f1b
4 changed files with 13 additions and 1 deletions

View File

@@ -19,7 +19,7 @@ void getEth2PublicKey(uint32_t *bip32Path, uint8_t bip32PathLength, uint8_t *out
uint8_t tmp[96];
io_seproxyhal_io_heartbeat();
os_perso_derive_eip2333(CX_CURVE_BLS12_381_G1, bip32Path, bip32PathLength, privateKeyData);
// os_perso_derive_eip2333(CX_CURVE_BLS12_381_G1, bip32Path, bip32PathLength, privateKeyData);
io_seproxyhal_io_heartbeat();
memset(tmp, 0, 48);
memmove(tmp + 16, privateKeyData, 32);

View File

@@ -2,6 +2,7 @@
#include "shared_context.h"
#include "apdu_constants.h"
#include "withdrawal_index.h"
void handleSetEth2WithdrawalIndex(uint8_t p1,
uint8_t p2,
@@ -18,6 +19,9 @@ void handleSetEth2WithdrawalIndex(uint8_t p1,
}
eth2WithdrawalIndex = U4BE(dataBuffer, 0);
if (eth2WithdrawalIndex > INDEX_MAX) {
THROW(0x6A80); // scott throw this error code or create new one ?
}
THROW(0x9000);
}

View File

@@ -1,5 +1,7 @@
#include "stdint.h"
#define INDEX_MAX 1337 // scott
void handleSetEth2WithdrawalIndex(uint8_t p1,
uint8_t p2,
uint8_t *dataBuffer,