xref: /aosp_15_r20/system/keymint/wire/src/sharedsecret.rs (revision 9860b7637a5f185913c70aa0caabe3ecb78441e4)
1*9860b763SAndroid Build Coastguard Worker // Copyright 2022, The Android Open Source Project
2*9860b763SAndroid Build Coastguard Worker //
3*9860b763SAndroid Build Coastguard Worker // Licensed under the Apache License, Version 2.0 (the "License");
4*9860b763SAndroid Build Coastguard Worker // you may not use this file except in compliance with the License.
5*9860b763SAndroid Build Coastguard Worker // You may obtain a copy of the License at
6*9860b763SAndroid Build Coastguard Worker //
7*9860b763SAndroid Build Coastguard Worker //     http://www.apache.org/licenses/LICENSE-2.0
8*9860b763SAndroid Build Coastguard Worker //
9*9860b763SAndroid Build Coastguard Worker // Unless required by applicable law or agreed to in writing, software
10*9860b763SAndroid Build Coastguard Worker // distributed under the License is distributed on an "AS IS" BASIS,
11*9860b763SAndroid Build Coastguard Worker // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*9860b763SAndroid Build Coastguard Worker // See the License for the specific language governing permissions and
13*9860b763SAndroid Build Coastguard Worker // limitations under the License.
14*9860b763SAndroid Build Coastguard Worker 
15*9860b763SAndroid Build Coastguard Worker //! Local types that are equivalent to those generated for the SharedSecret HAL interface
16*9860b763SAndroid Build Coastguard Worker 
17*9860b763SAndroid Build Coastguard Worker use crate::{cbor_type_error, AsCborValue, CborError};
18*9860b763SAndroid Build Coastguard Worker use alloc::{
19*9860b763SAndroid Build Coastguard Worker     format,
20*9860b763SAndroid Build Coastguard Worker     string::{String, ToString},
21*9860b763SAndroid Build Coastguard Worker     vec::Vec,
22*9860b763SAndroid Build Coastguard Worker };
23*9860b763SAndroid Build Coastguard Worker use kmr_derive::AsCborValue;
24*9860b763SAndroid Build Coastguard Worker 
25*9860b763SAndroid Build Coastguard Worker pub const KEY_AGREEMENT_LABEL: &str = "KeymasterSharedMac";
26*9860b763SAndroid Build Coastguard Worker pub const KEY_CHECK_LABEL: &str = "Keymaster HMAC Verification";
27*9860b763SAndroid Build Coastguard Worker 
28*9860b763SAndroid Build Coastguard Worker #[derive(Debug, Clone, Eq, Hash, PartialEq, Default, AsCborValue)]
29*9860b763SAndroid Build Coastguard Worker pub struct SharedSecretParameters {
30*9860b763SAndroid Build Coastguard Worker     pub seed: Vec<u8>,
31*9860b763SAndroid Build Coastguard Worker     pub nonce: Vec<u8>,
32*9860b763SAndroid Build Coastguard Worker }
33