• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <keymaster/contexts/soft_attestation_context.h>
18 
19 #include <string>
20 
21 #include <keymaster/km_openssl/asymmetric_key.h>
22 #include <keymaster/km_openssl/attestation_utils.h>
23 
24 namespace keymaster {
25 
26 const AttestationContext::VerifiedBootParams*
GetVerifiedBootParams(keymaster_error_t * error) const27 SoftAttestationContext::GetVerifiedBootParams(keymaster_error_t* error) const {
28     static AttestationContext::VerifiedBootParams params;
29     static std::string fake_vb_key(32, 0);
30 
31     params.verified_boot_key = {reinterpret_cast<uint8_t*>(fake_vb_key.data()), fake_vb_key.size()};
32     params.verified_boot_hash = {reinterpret_cast<uint8_t*>(fake_vb_key.data()),
33                                  fake_vb_key.size()};
34     params.verified_boot_state = KM_VERIFIED_BOOT_UNVERIFIED;
35     params.device_locked = false;
36     *error = KM_ERROR_OK;
37     return &params;
38 }
39 
40 }  // namespace keymaster
41