1 /*
2  * Copyright 2021 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 #pragma once
18 
19 #include <keymaster/remote_provisioning_context.h>
20 
21 #include <cppbor.h>
22 
23 namespace keymaster {
24 
25 /**
26  * SoftKeymasterContext provides the context for a non-secure implementation of AndroidKeymaster.
27  */
28 class PureSoftRemoteProvisioningContext : public RemoteProvisioningContext {
29   public:
30     PureSoftRemoteProvisioningContext();
31     ~PureSoftRemoteProvisioningContext() override;
32     std::vector<uint8_t> DeriveBytesFromHbk(const std::string& context,
33                                             size_t numBytes) const override;
34     std::unique_ptr<cppbor::Map> CreateDeviceInfo() const override;
35     std::pair<std::vector<uint8_t>, cppbor::Array> GenerateBcc(bool testMode) const override;
36     std::optional<cppcose::HmacSha256>
37     GenerateHmacSha256(const cppcose::bytevec& input) const override;
38 };
39 
40 }  // namespace keymaster
41