Skip to content

Commit

Permalink
CERT: Refactoring of custom CA elements
Browse files Browse the repository at this point in the history
Custom CA elements are now grouped in the `CERT` module in the OS.

In this context, this commit:
- Remove `os_customca_verify` syscall
- Rename `custom_ca_get_info` and `custom_ca_revoke` syscalls
  • Loading branch information
abonnaudet-ledger committed Oct 22, 2024
1 parent afadb33 commit d8c6dea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 36 deletions.
15 changes: 0 additions & 15 deletions include/os_customca.h

This file was deleted.

8 changes: 2 additions & 6 deletions include/syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,12 @@
#define SYSCALL_os_dashboard_mbx_ID 0x02000150

#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
#define SYSCALL_CERT_get_ID 0x01000CA0
#define SYSCALL_CERT_erase_ID 0x00000CA1
#endif // HAVE_CUSTOM_CA_DETAILS_IN_SETTINGS

#define SYSCALL_os_bolos_endorsement_revoke_ID 0x010001ED

#ifdef HAVE_BOLOS_CUSTOMCA
#define SYSCALL_os_customca_verify_ID 0x03000090
#endif // HAVE_BOLOS_CUSTOMCA

#ifdef HAVE_AEM_PIN
#define SYSCALL_os_aem_set_pin_ID 0x02000139
#define SYSCALL_os_aem_unset_pin_ID 0x0000013a
Expand Down
20 changes: 5 additions & 15 deletions src/syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1737,17 +1737,6 @@ void os_registry_delete_all_apps(void)
return;
}

#ifdef HAVE_BOLOS_CUSTOMCA
unsigned int os_customca_verify(unsigned char *hash, unsigned char *sign, unsigned int sign_length)
{
unsigned int parameters[3];
parameters[0] = (unsigned int) hash;
parameters[1] = (unsigned int) sign;
parameters[2] = (unsigned int) sign_length;
return (unsigned int) SVC_Call(SYSCALL_os_customca_verify_ID, parameters);
}
#endif // HAVE_BOLOS_CUSTOMCA

void os_sched_exec(unsigned int app_idx)
{
unsigned int parameters[2];
Expand Down Expand Up @@ -1928,19 +1917,20 @@ unsigned int os_deny_protected_flash(void)
}

#ifdef HAVE_CUSTOM_CA_DETAILS_IN_SETTINGS
bolos_bool_t os_bolos_custom_ca_get_info(customca_data_t *custom_ca)

bolos_bool_t CERT_get(CERT_info_t *custom_ca)
{
unsigned int parameters[2];
parameters[0] = (unsigned int) custom_ca;
bolos_bool_t ret = (bolos_bool_t) SVC_Call(SYSCALL_os_bolos_custom_ca_get_info_ID, parameters);
bolos_bool_t ret = (bolos_bool_t) SVC_Call(SYSCALL_CERT_get_ID, parameters);
return ret;
}

void os_bolos_custom_ca_revoke(void)
void CERT_erase(void)
{
unsigned int parameters[1];
parameters[0] = 0;
SVC_Call(SYSCALL_os_bolos_custom_ca_revoke_ID, parameters);
SVC_Call(SYSCALL_CERT_erase_ID, parameters);
return;
}
#endif // HAVE_CUSTOM_CA_DETAILS_IN_SETTINGS
Expand Down

0 comments on commit d8c6dea

Please sign in to comment.