xref: /aosp_15_r20/external/open-dice/dpe-rs/src/constants.rs (revision 60b67249c2e226f42f35cc6cfe66c6048e0bae6b)
1 // Copyright 2024 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 // use this file except in compliance with the License. You may obtain a copy of
5 // the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 // License for the specific language governing permissions and limitations under
13 // the License.
14 
15 //! Global constants
16 
17 /// The maximum size in bytes of a message buffer.
18 pub const MAX_MESSAGE_SIZE: usize = 8192;
19 
20 /// The size in bytes of a cryptographic hash.
21 pub const HASH_SIZE: usize = 64;
22 
23 /// The size in bytes of a private session key agreement key.
24 pub const DH_PRIVATE_KEY_SIZE: usize = 32;
25 
26 /// The size in bytes of a public session key agreement key.
27 pub const DH_PUBLIC_KEY_SIZE: usize = 32;
28 
29 /// The size in bytes of an encryption key, currently this is the same for
30 /// session and sealing encryption.
31 pub const ENCRYPTION_KEY_SIZE: usize = 32;
32 
33 /// The size in bytes of a serialized public key for signing.
34 pub const SIGNING_PUBLIC_KEY_SIZE: usize = 32;
35 
36 /// The size in bytes of a serialized private key for signing.
37 pub const SIGNING_PRIVATE_KEY_SIZE: usize = 32;
38 
39 /// The size in bytes of a serialized public key for sealing.
40 pub const SEALING_PUBLIC_KEY_SIZE: usize = 32;
41 
42 /// The size in bytes of a serialized private key for sealing.
43 pub const SEALING_PRIVATE_KEY_SIZE: usize = 32;
44 
45 /// The maximum size in bytes of a signature produced by the Sign command.
46 pub const MAX_SIGNATURE_SIZE: usize = 64;
47 
48 /// The maximum size in bytes of a session handshake message.
49 pub const MAX_HANDSHAKE_MESSAGE_SIZE: usize = 64;
50 
51 /// The maximum size in bytes of a session handshake payload.
52 pub const MAX_HANDSHAKE_PAYLOAD_SIZE: usize = 8;
53