Skip to content

Commit

Permalink
Add syscall for os_factory_hash()
Browse files Browse the repository at this point in the history
  • Loading branch information
yrichard-ledger committed Aug 28, 2023
1 parent b28aed3 commit 66df07d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
19 changes: 11 additions & 8 deletions include/os_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,30 @@
//#define OS_FLAG_CUSTOM_UX 4
/* Enable application to retrieve OS current running options */
SYSCALL unsigned int os_flags(void);
SYSCALL unsigned int os_version(unsigned char* version PLENGTH(maxlength), unsigned int maxlength);
SYSCALL unsigned int os_version(unsigned char* version PLENGTH(maxlength), unsigned int maxlength);
/* Grab the SE serial number */
SYSCALL unsigned int os_serial(unsigned char* serial PLENGTH(maxlength), unsigned int maxlength);
SYSCALL unsigned int os_serial(unsigned char* serial PLENGTH(maxlength), unsigned int maxlength);
/* 32-bytes data unique to SE */
SYSCALL unsigned int os_factory_hash(unsigned char* buffer PLENGTH(maxlength), unsigned int maxlength);

#ifdef HAVE_MCU_SERIAL_STORAGE
/* Grab the SEPROXYHAL's MCU serial number */
SYSCALL unsigned int os_seph_serial(unsigned char* serial PLENGTH(maxlength), unsigned int maxlength);
SYSCALL unsigned int os_seph_serial(unsigned char* serial PLENGTH(maxlength), unsigned int maxlength);
#endif // HAVE_MCU_SERIAL_STORAGE
/* Grab the SEPROXYHAL's feature set */
SYSCALL unsigned int os_seph_features(void);
SYSCALL unsigned int os_seph_features(void);
/* Grab the SEPROXYHAL's version */
SYSCALL unsigned int os_seph_version(unsigned char* version PLENGTH(maxlength), unsigned int maxlength);
SYSCALL unsigned int os_seph_version(unsigned char* version PLENGTH(maxlength), unsigned int maxlength);
/* Grab the MCU bootloader's version */
SYSCALL unsigned int os_bootloader_version(unsigned char* version PLENGTH(maxlength), unsigned int maxlength);
SYSCALL unsigned int os_bootloader_version(unsigned char* version PLENGTH(maxlength), unsigned int maxlength);
/* Grab factory setting */
SYSCALL unsigned int os_factory_setting_get(unsigned int id, unsigned char* value PLENGTH(maxlength), unsigned int maxlength);
SYSCALL unsigned int os_factory_setting_get(unsigned int id, unsigned char* value PLENGTH(maxlength), unsigned int maxlength);


/*
* Copy the serial number in the given buffer and return its length
*/
unsigned int os_get_sn(unsigned char* buffer);
unsigned int os_get_sn(unsigned char* buffer);

// get API level
SYSCALL unsigned int get_api_level(void);
Expand Down
1 change: 1 addition & 0 deletions include/syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
#define SYSCALL_os_flags_ID 0x0000006a
#define SYSCALL_os_version_ID 0x0200006b
#define SYSCALL_os_serial_ID 0x0200006c
#define SYSCALL_os_factory_hash_ID 0x02000075
#define SYSCALL_os_seph_features_ID 0x0000006e
#define SYSCALL_os_seph_version_ID 0x0200006f
#define SYSCALL_os_bootloader_version_ID 0x02000073
Expand Down
7 changes: 7 additions & 0 deletions src/syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,13 @@ unsigned int os_serial ( unsigned char * serial, unsigned int maxlength ) {
return (unsigned int) SVC_Call(SYSCALL_os_serial_ID, parameters);
}

unsigned int os_factory_hash ( unsigned char * buffer, unsigned int maxlength ) {
unsigned int parameters[2];
parameters[0] = (unsigned int)buffer;
parameters[1] = (unsigned int)maxlength;
return (unsigned int) SVC_Call(SYSCALL_os_factory_hash_ID, parameters);
}

unsigned int os_seph_features ( void ) {
unsigned int parameters[2];
parameters[1] = 0;
Expand Down

0 comments on commit 66df07d

Please sign in to comment.