From a8e4e6270c6e87fabedd1cb2203cf134b3318c40 Mon Sep 17 00:00:00 2001 From: Philippe Bonnaz Date: Wed, 5 Jul 2023 16:57:46 +0200 Subject: [PATCH] Rename HAVE_CUSTOM_CA_SETTINGS to HAVE_CUSTOM_CA_DETAILS_IN_SETTINGS Add HAVE_ENDORSEMENT_DETAILS_IN_SETTINGS compil flag --- include/os_endorsement.h | 4 ++-- include/syscalls.h | 11 +++++++---- src/syscalls.c | 10 ++++++---- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/include/os_endorsement.h b/include/os_endorsement.h index 5d15b0595..9aeb4107e 100644 --- a/include/os_endorsement.h +++ b/include/os_endorsement.h @@ -16,6 +16,6 @@ SYSCALL unsigned int os_endorsement_key1_get_app_secret(unsigned char* buffer PL SYSCALL unsigned int os_endorsement_key1_sign_data(unsigned char* src PLENGTH(srcLength), unsigned int srcLength, unsigned char* signature PLENGTH(ENDORSEMENT_MAX_ASN1_LENGTH)); SYSCALL unsigned int os_endorsement_key2_derive_sign_data(unsigned char* src PLENGTH(srcLength), unsigned int srcLength, unsigned char* signature PLENGTH(ENDORSEMENT_MAX_ASN1_LENGTH)); -#if (defined(HAVE_BOLOS_NOTWIPED_ENDORSEMENT) && defined(HAVE_ENDORSEMENTS_DISPLAY)) +#ifdef HAVE_ENDORSEMENT_DETAILS_IN_SETTINGS SYSCALL unsigned int os_endorsement_get_metadata(unsigned char index, unsigned char* buffer PLENGTH(8)); -#endif // (defined(HAVE_BOLOS_NOTWIPED_ENDORSEMENT) && defined(HAVE_ENDORSEMENTS_DISPLAY)) +#endif // HAVE_ENDORSEMENT_DETAILS_IN_SETTINGS diff --git a/include/syscalls.h b/include/syscalls.h index c84a52a99..189ef79bb 100644 --- a/include/syscalls.h +++ b/include/syscalls.h @@ -194,11 +194,14 @@ #define SYSCALL_os_allow_protected_ram_ID 0x00000092 #define SYSCALL_os_deny_protected_ram_ID 0x00000093 -#ifdef HAVE_CUSTOM_CA_SETTINGS +#ifdef HAVE_CUSTOM_CA_DETAILS_IN_SETTINGS #define SYSCALL_os_bolos_custom_ca_get_info_ID 0x01000CA0 #define SYSCALL_os_bolos_custom_ca_revoke_ID 0x00000CA1 +#endif // HAVE_CUSTOM_CA_DETAILS_IN_SETTINGS + +#ifdef HAVE_ENDORSEMENT_DETAILS_IN_SETTINGS #define SYSCALL_os_bolos_endorsement_revoke_ID 0x010001ED -#endif // HAVE_CUSTOM_CA_SETTINGS +#endif #ifndef HAVE_BOLOS_NO_CUSTOMCA #define SYSCALL_os_customca_verify_ID 0x03000090 @@ -222,9 +225,9 @@ #define SYSCALL_os_aem_is_pin_validated_ID 0x00000147 #endif // HAVE_AEM_PIN -#if (defined(HAVE_BOLOS_NOTWIPED_ENDORSEMENT) && defined(HAVE_ENDORSEMENTS_DISPLAY)) +#ifdef HAVE_ENDORSEMENT_DETAILS_IN_SETTINGS #define SYSCALL_os_endorsement_get_metadata_ID 0x02000138 -#endif // (defined(HAVE_BOLOS_NOTWIPED_ENDORSEMENT) && defined(HAVE_ENDORSEMENTS_DISPLAY)) +#endif // HAVE_ENDORSEMENT_DETAILS_IN_SETTINGS #if defined(HAVE_VAULT_RECOVERY_ALGO) #define SYSCALL_os_perso_derive_and_prepare_seed_ID 0x02000137 diff --git a/src/syscalls.c b/src/syscalls.c index 0d11970d6..5d64f944b 100644 --- a/src/syscalls.c +++ b/src/syscalls.c @@ -1556,7 +1556,7 @@ unsigned int os_deny_protected_flash( void ) { return (unsigned int) SVC_Call(SYSCALL_os_deny_protected_flash_ID, parameters); } -#ifdef HAVE_CUSTOM_CA_SETTINGS +#ifdef HAVE_CUSTOM_CA_DETAILS_IN_SETTINGS bolos_bool_t os_bolos_custom_ca_get_info(customca_data_t *custom_ca) { unsigned int parameters[2]; parameters[0] = (unsigned int) custom_ca; @@ -1570,14 +1570,16 @@ void os_bolos_custom_ca_revoke(void) { SVC_Call(SYSCALL_os_bolos_custom_ca_revoke_ID, parameters); return; } +#endif //HAVE_CUSTOM_CA_DETAILS_IN_SETTINGS +#ifdef HAVE_ENDORSEMENT_DETAILS_IN_SETTINGS bolos_bool_t os_bolos_endorsement_revoke(uint8_t slot) { unsigned int parameters[1]; parameters[0] = (unsigned int) slot; bolos_bool_t ret = SVC_Call(SYSCALL_os_bolos_endorsement_revoke_ID, parameters); return ret; } -#endif //HAVE_CUSTOM_CA_SETTINGS +#endif #ifdef HAVE_MCU_SERIAL_STORAGE unsigned int os_seph_serial ( unsigned char * serial, unsigned int maxlength ) { @@ -1778,14 +1780,14 @@ bolos_bool_t os_aem_is_pin_validated ( void ) { } #endif // HAVE_AEM_PIN -#if (defined(HAVE_BOLOS_NOTWIPED_ENDORSEMENT) && defined(HAVE_ENDORSEMENTS_DISPLAY)) +#ifdef HAVE_ENDORSEMENT_DETAILS_IN_SETTINGS unsigned int os_endorsement_get_metadata ( unsigned char index, unsigned char * buffer ) { unsigned int parameters[2]; parameters[0] = (unsigned int)index; parameters[1] = (unsigned int)buffer; return (unsigned int) SVC_Call(SYSCALL_os_endorsement_get_metadata_ID, parameters); } -#endif // (defined(HAVE_BOLOS_NOTWIPED_ENDORSEMENT) && defined(HAVE_ENDORSEMENTS_DISPLAY)) +#endif // HAVE_ENDORSEMENT_DETAILS_IN_SETTINGS #if defined(HAVE_LANGUAGE_PACK) void list_language_packs(UX_LOC_LANGUAGE_PACK_INFO *packs) {