dfu-cc.proto 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package dfu;
  2. // Version 0.1
  3. enum FwType {
  4. APPLICATION = 0;
  5. SOFTDEVICE = 1;
  6. BOOTLOADER = 2;
  7. SOFTDEVICE_BOOTLOADER = 3;
  8. EXTERNAL_APPLICATION = 4;
  9. }
  10. enum HashType {
  11. NO_HASH = 0;
  12. CRC = 1;
  13. SHA128 = 2;
  14. SHA256 = 3;
  15. SHA512 = 4;
  16. }
  17. enum OpCode {
  18. INIT = 1;
  19. }
  20. enum ValidationType {
  21. NO_VALIDATION = 0;
  22. VALIDATE_GENERATED_CRC = 1;
  23. VALIDATE_SHA256 = 2;
  24. VALIDATE_ECDSA_P256_SHA256 = 3;
  25. }
  26. message Hash {
  27. required HashType hash_type = 1;
  28. required bytes hash = 2;
  29. }
  30. message BootValidation {
  31. required ValidationType type = 1;
  32. required bytes bytes = 2;
  33. }
  34. // Commands data
  35. message InitCommand {
  36. optional uint32 fw_version = 1;
  37. optional uint32 hw_version = 2;
  38. repeated uint32 sd_req = 3 [packed = true];
  39. optional FwType type = 4;
  40. optional uint32 sd_size = 5;
  41. optional uint32 bl_size = 6;
  42. optional uint32 app_size = 7;
  43. optional Hash hash = 8;
  44. optional bool is_debug = 9 [default = false];
  45. repeated BootValidation boot_validation = 10;
  46. }
  47. // Command type
  48. message Command {
  49. optional OpCode op_code = 1;
  50. optional InitCommand init = 2;
  51. }
  52. // Signed command types
  53. enum SignatureType {
  54. ECDSA_P256_SHA256 = 0;
  55. ED25519 = 1;
  56. }
  57. message SignedCommand {
  58. required Command command = 1;
  59. required SignatureType signature_type = 2;
  60. required bytes signature = 3;
  61. }
  62. // Parent packet type
  63. message Packet {
  64. optional Command command = 1;
  65. optional SignedCommand signed_command = 2;
  66. }