Skip to content

Commit

Permalink
Merge pull request #432 from LedgerHQ/tdj/deprecate_check_api_level_f…
Browse files Browse the repository at this point in the history
…unction

Deprecate "check_api_level" function
  • Loading branch information
xchapron-ledger authored Sep 22, 2023
2 parents 81ff49c + 5a6d52d commit b2ca981
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions include/os_apilevel.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@
#ifndef OS_APILEVEL_H
#define OS_APILEVEL_H

#ifndef HAVE_BOLOS
// Obsolete defines - shall not be used
// Replaced by API_LEVEL mechanism enforced directly at app sideloading.
// Hence the app can consider it runs on a OS which match the SDK the app has been built for.
#define CX_APILEVEL _Pragma("GCC warning \"Deprecated constant!\"") 12
#define CX_COMPAT_APILEVEL _Pragma("GCC warning \"Deprecated constant!\"") 12
#else
#define CX_APILEVEL 12
#define CX_COMPAT_APILEVEL 12
#endif

#endif // OS_APILEVEL_H
5 changes: 4 additions & 1 deletion include/os_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ unsigned int os_get_sn(unsigned char *buffer);
SYSCALL unsigned int get_api_level(void);

#ifndef HAVE_BOLOS
static inline void check_api_level(unsigned int apiLevel)
// Obsolete function - shall not be used
// Replaced by API_LEVEL mechanism enforced directly at app sideloading.
// Hence the app can consider it runs on a OS which match the SDK the app has been built for.
DEPRECATED static inline void check_api_level(unsigned int apiLevel)
{
if (apiLevel < get_api_level()) {
os_sched_exit(-1);
Expand Down
3 changes: 0 additions & 3 deletions src/os_io_seproxyhal.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,6 @@ static const unsigned char seph_io_mcu_protect[] = {
void io_seproxyhal_init(void)
{
#ifndef HAVE_BOLOS
// Enforce OS compatibility
check_api_level(CX_COMPAT_APILEVEL);

#ifdef HAVE_MCU_PROTECT
// engage RDP2 on MCU
io_seproxyhal_spi_send(seph_io_mcu_protect, sizeof(seph_io_mcu_protect));
Expand Down

0 comments on commit b2ca981

Please sign in to comment.