Skip to content

Commit

Permalink
Refactoring in endorsements related syscalls
Browse files Browse the repository at this point in the history
  • Loading branch information
abonnaudet-ledger committed Dec 2, 2024
1 parent e8f68a6 commit 27832bf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
11 changes: 0 additions & 11 deletions include/os_endorsement.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
/* - ENDORSEMENT FEATURE - */
/* ----------------------------------------------------------------------- */

typedef enum endorsement_revoke_id_e {
ENDORSEMENT_REVOKE_ID_ALL = 0,
ENDORSEMENT_REVOKE_ID_SLOT1 = 1,
ENDORSEMENT_REVOKE_ID_SLOT2 = 2,
ENDORSEMENT_REVOKE_ID_LAST = 3,
} endorsement_revoke_id_t;

#define ENDORSEMENT_MAX_ASN1_LENGTH (1 + 1 + 2 * (1 + 1 + 33))

SYSCALL unsigned int os_endorsement_get_code_hash(unsigned char *buffer PLENGTH(32));
Expand All @@ -40,7 +33,3 @@ SYSCALL unsigned int os_endorsement_key2_derive_sign_data(unsigned char *src PLE

SYSCALL unsigned int os_endorsement_get_metadata(unsigned char index,
unsigned char *buffer PLENGTH(8));

SYSCALL void os_endorsement_revoke_slot1(void);
SYSCALL void os_endorsement_revoke_slot2(void);
SYSCALL void os_endorsement_revoke_all(void);
2 changes: 1 addition & 1 deletion include/syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
#define SYSCALL_CERT_erase_ID 0x00000CA1
#endif // HAVE_CUSTOM_CA_DETAILS_IN_SETTINGS

#define SYSCALL_os_bolos_endorsement_revoke_ID 0x010001ED
#define SYSCALL_ENDORSEMENT_revoke_slot_ID 0x010001ED

#ifdef HAVE_AEM_PIN
#define SYSCALL_os_aem_set_pin_ID 0x02000139
Expand Down
8 changes: 5 additions & 3 deletions src/syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#if defined(HAVE_BOLOS)
#include "bolos_privileged_ux.h"
#include "cert_privileged.h"
#include "endorsement_privileged.h"
#endif // HAVE_BOLOS

#include "bolos_target.h"
Expand Down Expand Up @@ -1928,11 +1930,11 @@ void CERT_erase(void)
}
#endif // HAVE_CUSTOM_CA_DETAILS_IN_SETTINGS

bolos_bool_t os_bolos_endorsement_revoke(uint8_t slot)
bolos_bool_t ENDORSEMENT_revoke_slot(ENDORSEMENT_revoke_id_t revoke_id)
{
unsigned int parameters[1];
parameters[0] = (unsigned int) slot;
bolos_bool_t ret = SVC_Call(SYSCALL_os_bolos_endorsement_revoke_ID, parameters);
parameters[0] = (unsigned int) revoke_id;
bolos_bool_t ret = SVC_Call(SYSCALL_ENDORSEMENT_revoke_slot_ID, parameters);
return ret;
}

Expand Down

0 comments on commit 27832bf

Please sign in to comment.