dfu-cc.proto 1.2 KB

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