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