diff --git a/include/os_id.h b/include/os_id.h index e9abd69c6..f699c0766 100644 --- a/include/os_id.h +++ b/include/os_id.h @@ -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); diff --git a/include/syscalls.h b/include/syscalls.h index 91458f9ba..269320c60 100644 --- a/include/syscalls.h +++ b/include/syscalls.h @@ -159,6 +159,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 diff --git a/src/syscalls.c b/src/syscalls.c index 2a78aff15..69db9193e 100644 --- a/src/syscalls.c +++ b/src/syscalls.c @@ -1304,6 +1304,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;