From 5a6d52db87b006a716a7d87609d71d0bb7e2bae6 Mon Sep 17 00:00:00 2001 From: tdejoigny-ledger Date: Tue, 19 Sep 2023 13:59:22 +0200 Subject: [PATCH] Deprecate CX_APILEVEL related function anddefines This mecanism is replaced by the API_LEVEL one handle which is fully handled by the OS. --- include/os_apilevel.h | 8 ++++++++ include/os_id.h | 5 ++++- src/os_io_seproxyhal.c | 3 --- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/os_apilevel.h b/include/os_apilevel.h index fce683e0e..7fccf5e0a 100644 --- a/include/os_apilevel.h +++ b/include/os_apilevel.h @@ -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 diff --git a/include/os_id.h b/include/os_id.h index 791fff86e..04c022436 100644 --- a/include/os_id.h +++ b/include/os_id.h @@ -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); diff --git a/src/os_io_seproxyhal.c b/src/os_io_seproxyhal.c index c21bc28d9..a75070c5c 100644 --- a/src/os_io_seproxyhal.c +++ b/src/os_io_seproxyhal.c @@ -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));