Debian Codegraph @

src/nitrokey/trussed/_bootloader/nrf52_upload/dfu/dfu-cc.proto

raw
1 package dfu;
2
3 // Version 0.1
4
5 // Definition of enums and types
6 enum OpCode {
7 RESET = 0;
8 INIT = 1;
9 }
10
11 enum FwType {
12 APPLICATION = 0; // default, compatible with proto3
13 SOFTDEVICE = 1;
14 BOOTLOADER = 2;
15 SOFTDEVICE_BOOTLOADER = 3;
16 EXTERNAL_APPLICATION = 4;
17 }
18
19 enum HashType {
20 NO_HASH = 0;
21 CRC = 1;
22 SHA128 = 2;
23 SHA256 = 3;
24 SHA512 = 4;
25 }
26
27 enum ValidationType {
28 NO_VALIDATION = 0;
29 VALIDATE_GENERATED_CRC = 1;
30 VALIDATE_SHA256 = 2;
31 VALIDATE_ECDSA_P256_SHA256 = 3;
32 }
33
34 message Hash {
35 required HashType hash_type = 1;
36 required bytes hash = 2;
37 }
38
39 message BootValidation {
40 required ValidationType type = 1;
41 required bytes bytes_ = 2;
42 }
43
44 // Commands data
45 message InitCommand {
46 optional uint32 fw_version = 1;
47 optional uint32 hw_version = 2;
48 repeated uint32 sd_req = 3 [packed = true]; // packed option is default in proto3
49 optional FwType type = 4;
50
51 optional uint32 sd_size = 5;
52 optional uint32 bl_size = 6;
53 optional uint32 app_size = 7;
54
55 optional Hash hash = 8;
56
57 optional bool is_debug = 9 [default = false];
58
59 repeated BootValidation boot_validation = 10;
60 }
61
62 message ResetCommand {
63 required uint32 timeout = 1;
64 }
65
66 // Command type
67 message Command {
68 optional OpCode op_code = 1;
69 optional InitCommand init = 2;
70 optional ResetCommand reset = 3;
71 }
72
73 // Signed command types
74 enum SignatureType {
75 ECDSA_P256_SHA256 = 0;
76 ED25519 = 1;
77 }
78
79 message SignedCommand {
80 required Command command = 1;
81 required SignatureType signature_type = 2;
82 required bytes signature = 3;
83 }
84
85 // Parent packet type
86 message Packet {
87 optional Command command = 1;
88 optional SignedCommand signed_command = 2;
89 }