Fix for address calculation and access to object on memory.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
15
ChangeLog
15
ChangeLog
@@ -1,3 +1,18 @@
|
|||||||
|
2022-04-22 NIIBE Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
|
* src/gnuk.h (_regnual_start): Fix type.
|
||||||
|
* src/main.c (main): Fix address for _regnual_start.
|
||||||
|
* src/usb_ctrl.c (mem_info, usb_setup): Follow the change.
|
||||||
|
* src/flash.c (_keystore_pool, _data_pool): Fix type.
|
||||||
|
(FLASH_ADDR_KEY_STORAGE_START, FLASH_ADDR_DATA_STORAGE_START):
|
||||||
|
Follow the change.
|
||||||
|
|
||||||
|
2022-03-26 Bertrand Jacquin <bertrand@jacquin.bzh>
|
||||||
|
|
||||||
|
* regnual/regnual.c (memset): Remove declaration.
|
||||||
|
* regnual/types.h (NULL): Remove.
|
||||||
|
(size_t): Remove.
|
||||||
|
|
||||||
2021-10-12 NIIBE Yutaka <gniibe@fsij.org>
|
2021-10-12 NIIBE Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
* VERSION: 1.2.19.
|
* VERSION: 1.2.19.
|
||||||
|
|||||||
@@ -82,10 +82,10 @@ extern uint8_t *flash_addr_data_storage_start;
|
|||||||
#define FLASH_ADDR_DATA_STORAGE_START flash_addr_data_storage_start
|
#define FLASH_ADDR_DATA_STORAGE_START flash_addr_data_storage_start
|
||||||
#else
|
#else
|
||||||
/* Linker sets these symbols */
|
/* Linker sets these symbols */
|
||||||
extern uint8_t _keystore_pool;
|
extern uint8_t _keystore_pool[];
|
||||||
extern uint8_t _data_pool;
|
extern uint8_t _data_pool[];
|
||||||
#define FLASH_ADDR_KEY_STORAGE_START ((&_keystore_pool))
|
#define FLASH_ADDR_KEY_STORAGE_START ((_keystore_pool))
|
||||||
#define FLASH_ADDR_DATA_STORAGE_START ((&_data_pool))
|
#define FLASH_ADDR_DATA_STORAGE_START ((_data_pool))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int key_available_at (const uint8_t *k, int key_size)
|
static int key_available_at (const uint8_t *k, int key_size)
|
||||||
|
|||||||
@@ -475,6 +475,6 @@ int pinpad_getline (int msg_code, uint32_t timeout_usec);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
extern uint8_t _regnual_start, __heap_end__[];
|
extern uint8_t _regnual_start[], __heap_end__[];
|
||||||
|
|
||||||
uint8_t * sram_address (uint32_t offset);
|
uint8_t * sram_address (uint32_t offset);
|
||||||
|
|||||||
@@ -503,8 +503,8 @@ main (int argc, const char *argv[])
|
|||||||
|
|
||||||
#ifdef FLASH_UPGRADE_SUPPORT
|
#ifdef FLASH_UPGRADE_SUPPORT
|
||||||
/* Set vector */
|
/* Set vector */
|
||||||
SCB->VTOR = (uintptr_t)&_regnual_start;
|
SCB->VTOR = (uintptr_t)_regnual_start;
|
||||||
entry = calculate_regnual_entry_address (&_regnual_start);
|
entry = calculate_regnual_entry_address (_regnual_start);
|
||||||
#ifdef DFU_SUPPORT
|
#ifdef DFU_SUPPORT
|
||||||
{
|
{
|
||||||
/* Use SYS at ORIGIN_REAL instead of the one at ORIGIN */
|
/* Use SYS at ORIGIN_REAL instead of the one at ORIGIN */
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ static const uint8_t lun_table[] = { 0, 0, 0, 0, };
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FLASH_UPGRADE_SUPPORT
|
#ifdef FLASH_UPGRADE_SUPPORT
|
||||||
static const uint8_t *const mem_info[] = { &_regnual_start, __heap_end__, };
|
static const uint8_t *const mem_info[] = { _regnual_start, __heap_end__, };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USB_FSIJ_GNUK_MEMINFO 0
|
#define USB_FSIJ_GNUK_MEMINFO 0
|
||||||
@@ -284,7 +284,7 @@ usb_setup (struct usb_dev *dev)
|
|||||||
if (ccid_get_ccid_state () != CCID_STATE_EXITED)
|
if (ccid_get_ccid_state () != CCID_STATE_EXITED)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (addr < &_regnual_start || addr + arg->len > __heap_end__)
|
if (addr < _regnual_start || addr + arg->len > __heap_end__)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (arg->index + arg->len < 256)
|
if (arg->index + arg->len < 256)
|
||||||
|
|||||||
Reference in New Issue
Block a user