1/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use, copy,
8 * modify, merge, publish, distribute, sublicense, and/or sell copies
9 * of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24
25#include "fake_atap_ops.h"
26
27#include <memory>
28
29namespace atap {
30
31FakeAtapOps::FakeAtapOps() {}
32FakeAtapOps::~FakeAtapOps() {}
33
34AtapResult FakeAtapOps::read_product_id(
35    uint8_t product_id[ATAP_PRODUCT_ID_LEN]) {
36  memset(product_id, 0x00, ATAP_PRODUCT_ID_LEN);
37  return ATAP_RESULT_OK;
38}
39
40AtapResult FakeAtapOps::get_auth_key_type(AtapKeyType* key_type) {
41  *key_type = ATAP_KEY_TYPE_NONE;
42  return ATAP_RESULT_OK;
43}
44
45AtapResult FakeAtapOps::read_auth_key_cert_chain(AtapCertChain* cert_chain) {
46  return ATAP_RESULT_ERROR_UNSUPPORTED_OPERATION;
47}
48
49AtapResult FakeAtapOps::write_attestation_key(AtapKeyType key_type,
50                                              const AtapBlob* key,
51                                              const AtapCertChain* cert_chain) {
52  return ATAP_RESULT_OK;
53}
54
55AtapResult FakeAtapOps::read_attestation_public_key(
56
57    AtapKeyType key_type,
58    uint8_t pubkey[ATAP_KEY_LEN_MAX],
59    uint32_t* pubkey_len) {
60  return ATAP_RESULT_ERROR_UNSUPPORTED_OPERATION;
61}
62
63AtapResult FakeAtapOps::read_soc_global_key(
64    uint8_t global_key[ATAP_AES_128_KEY_LEN]) {
65  return ATAP_RESULT_ERROR_UNSUPPORTED_OPERATION;
66}
67
68AtapResult FakeAtapOps::write_hex_uuid(const uint8_t uuid[ATAP_HEX_UUID_LEN]) {
69  return ATAP_RESULT_OK;
70}
71
72AtapResult FakeAtapOps::auth_key_sign(const uint8_t* nonce,
73                                      uint32_t nonce_len,
74                                      uint8_t sig[ATAP_SIGNATURE_LEN_MAX],
75                                      uint32_t* sig_len) {
76  return ATAP_RESULT_ERROR_UNSUPPORTED_OPERATION;
77}
78
79}  // namespace atap
80