ProtobufLAMessages.proto 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // Design decision - could define structures within a structure as messages *within* a message and then refer to the nested msg in another msg as Msg1.nested_msg
  2. // Or could define the nested message separately and use it within the message 1 as a type.
  3. // *Think* that the first option effectively "exposes" the nested msg as a valid msg that can be set/get by the application. Want to "hide" this.
  4. // The second method is easy to automatically generate from the C code and so am using it for now. TODO: Define a CPP class that hides the undesired getters/setters, as per the best practice at https://developers.google.com/protocol-buffers/docs/cpptutorial under "Protocol Buffers and O-O Design"
  5. // TODO: Hide setters/getters for these fields in the generated .h file..?
  6. // uint8_t, uint16_t for Protobuf - uint32, as per here - https://stackoverflow.com/questions/42295695/small-scalar-types-and-google-protocol-buffers
  7. // TODO: Do I need to ensure that the value here is within the defined here? Seems not, as it comes from a trusted source.
  8. // "Repeated" - can be repeated 0 or more times - however, arrays in C or CPP with fixed size that have all their elements defined - are a stricter version of this. (Protobuf doesn't let you define constant-sized arrays.)
  9. // packed=true is necessary to ensure successive, efficient 'packing'
  10. syntax = "proto3";
  11. // LITE_RUNTIME supports serializetocodedstream - which is helpful to read/write multiple messages - https://groups.google.com/forum/#!topic/protobuf/MlUMUPp5WDc and https://developers.google.com/protocol-buffers/docs/techniques?csw=1#streaming
  12. // Only have base classes for those structs in the composite structs that have more than 1 element - this causes a significant reduction in the size of the generated .cc and .h files.
  13. message protobuf_sgx_attributes_t {
  14. uint64 flags = 1;
  15. uint64 xfrm = 2;
  16. }
  17. message protobuf_sgx_ec256_public_t {
  18. repeated uint32 gx = 1 ;
  19. repeated uint32 gy = 2 ;
  20. }
  21. // Composite message types
  22. // Tag numbers - first all the repeated ones (arrays) and then the ones, as per the docs.
  23. message protobuf_sgx_report_body_t {
  24. repeated uint32 cpu_svn = 1 ;
  25. uint32 misc_select = 9;
  26. repeated uint32 reserved1 = 2 ;
  27. protobuf_sgx_attributes_t attributes = 10;
  28. repeated uint32 mr_enclave = 3 ;
  29. repeated uint32 reserved2 = 4 ;
  30. repeated uint32 mr_signer = 5 ;
  31. repeated uint32 reserved3 = 6 ;
  32. uint32 isv_prod_id = 11;
  33. uint32 isv_svn = 12;
  34. repeated uint32 reserved4 = 7 ;
  35. repeated uint32 report_data = 8 ;
  36. }
  37. message protobuf_sgx_report_t {
  38. protobuf_sgx_report_body_t body = 1;
  39. repeated uint32 key_id = 2 ;
  40. repeated uint32 mac = 3 ;
  41. }
  42. message protobuf_sgx_target_info_t {
  43. repeated uint32 mr_enclave = 1 ;
  44. protobuf_sgx_attributes_t attributes = 4;
  45. repeated uint32 reserved1 = 2 ;
  46. uint32 misc_select = 5;
  47. repeated uint32 reserved2 = 3 ;
  48. }
  49. message protobuf_sgx_dh_msg1_t {
  50. protobuf_sgx_ec256_public_t g_a = 1;
  51. protobuf_sgx_target_info_t target = 2;
  52. }
  53. message protobuf_sgx_dh_msg2_t {
  54. protobuf_sgx_ec256_public_t g_b = 1;
  55. protobuf_sgx_report_t report = 2;
  56. repeated uint32 cmac = 3 ;
  57. }
  58. message protobuf_sgx_dh_msg3_body_t {
  59. protobuf_sgx_report_t report = 1;
  60. repeated uint32 additional_prop = 2;
  61. }
  62. message protobuf_sgx_dh_msg3_t {
  63. protobuf_sgx_dh_msg3_body_t msg3_body = 1;
  64. repeated uint32 cmac = 2 ;
  65. }
  66. // for post-LA key establishment and other msgs (in particular, between Apache and Decryptor)
  67. message protobuf_post_LA_encrypted_msg_t {
  68. bytes msg = 1 ;
  69. }