ta_securetime.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef __TRUSTZONE_TA_SECURE_TIMER__
  2. #define __TRUSTZONE_TA_SECURE_TIMER__
  3. #define TZ_TA_SECURETIME_UUID "b25bf100-d276-11e2-9c9c-9c9c9c9c9c9c"
  4. #define uint64 unsigned long long
  5. #define TZ_SECURETIME_BIRTHDATE 1392967151
  6. /* used for getting encrypted prtime struct to save file when shutdown and
  7. suspend or after THREAD_SAVEFILE_VALUE second */
  8. #define TZCMD_SECURETIME_GET_CURRENT_COUNTER 0x00000000
  9. /* used for set new playready time using the current rtc counter and
  10. encrypted saved prtime struct when resume and bootup */
  11. #define TZCMD_SECURETIME_SET_CURRENT_COUNTER 0x00000001
  12. /* used for increase current counter at least PR_TIME_INC_COUNTER secs and
  13. no more than PR_TIME_MAX_COUNTER_OFFSET secs */
  14. #define TZCMD_SECURETIME_INC_CURRENT_COUNTER 0x00000002
  15. /* used for network time-sync module to sync pr_time */
  16. #define TZCMD_SECURETIME_SET_CURRENT_PRTIME 0x00000003
  17. #define GB_TIME_INC_COUNTER 5
  18. #define GB_TIME_MAX_COUNTER_OFFSET 8
  19. #define GB_TIME_FILE_BASE 50000
  20. #define GB_TIME_FILE_ERROR_SIGN (GB_TIME_FILE_BASE + 1)
  21. #define GB_TIME_FILE_OK_SIGN (GB_TIME_FILE_BASE + 2)
  22. #define GB_NO_SECURETD_FILE (GB_TIME_FILE_BASE + 3)
  23. #define GB_TIME_ERROR_SETPRTIME (GB_TIME_FILE_BASE + 4)
  24. #define DRM_UINT64 unsigned long long
  25. typedef struct TZ_GB_SECURETIME_INFO {
  26. volatile unsigned long long hwcounter;
  27. volatile unsigned long long gb_time;
  28. char signature[8];
  29. } TZ_GB_SECURETIME_INFO;
  30. struct TM_GB {
  31. int tm_sec; /* seconds */
  32. int tm_min; /* minutes */
  33. int tm_hour; /* hours */
  34. int tm_mday; /* day of the month */
  35. int tm_mon; /* month */
  36. int tm_year; /* year */
  37. int tm_wday; /* day of the week */
  38. int tm_yday; /* day in the year */
  39. int tm_isdst; /* daylight saving time */
  40. long int tm_gmtoff; /* Seconds east of UTC. */
  41. const char *tm_zone; /* Timezone abbreviation. */
  42. };
  43. /* end of SUPPORT_GB_SECURE_CLOCK */
  44. typedef struct SECURETIME_IVDATA {
  45. unsigned long long qwInitializationVector;
  46. unsigned long long qwBlockOffset;
  47. unsigned long bByteOffset;
  48. } SECURETIME_IVDATA;
  49. typedef struct TZ_SECURETIME_ENCINFO {
  50. char role[100];
  51. unsigned int dataSize; /* total enc buffer size */
  52. unsigned int segNum; /* trunk number */
  53. SECURETIME_IVDATA iv[10]; /* IV data for each trunk */
  54. unsigned int offset[10]; /* pointer to an integer array,
  55. each element describes clear data size */
  56. unsigned int length[10]; /* pointer to an integer array,
  57. each element describe enc data size */
  58. unsigned int dstHandle; /* true : dstData is a handle;
  59. false : dstData is a buffer; */
  60. } TZ_SECURETIME_ENCINFO;
  61. /* only be userd in tee, in user or kernel, should call the tee_service call */
  62. /* unsigned long long GetTee_SecureTime(); */
  63. #endif /* __TRUSTZONE_TA_SECURE_TIMER__ */