Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2015 The ChromiumOS Authors. All rights reserved. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #include <tpm_lite/tlcl.h> |
| 17 | |
| 18 | #ifdef FOR_TEST |
| 19 | #include <stdio.h> |
| 20 | #define VBDEBUG(format, args...) printf(format, ## args) |
| 21 | #else |
| 22 | #include <console/console.h> |
| 23 | #define VBDEBUG(format, args...) printk(BIOS_DEBUG, format, ## args) |
| 24 | #endif |
| 25 | |
| 26 | uint32_t tlcl_lib_init(void) { |
| 27 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 28 | return TPM_E_NO_DEVICE; |
| 29 | } |
| 30 | |
| 31 | uint32_t tlcl_startup(void) { |
| 32 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 33 | return TPM_E_NO_DEVICE; |
| 34 | } |
| 35 | |
| 36 | uint32_t tlcl_resume(void) { |
| 37 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 38 | return TPM_E_NO_DEVICE; |
| 39 | } |
| 40 | |
| 41 | uint32_t tlcl_self_test_full(void) |
| 42 | { |
| 43 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 44 | return TPM_E_NO_DEVICE; |
| 45 | } |
| 46 | |
| 47 | uint32_t tlcl_continue_self_test(void) |
| 48 | { |
| 49 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 50 | return TPM_E_NO_DEVICE; |
| 51 | } |
| 52 | |
| 53 | uint32_t tlcl_define_space(uint32_t index, uint32_t perm, uint32_t size) |
| 54 | { |
| 55 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 56 | return TPM_E_NO_DEVICE; |
| 57 | } |
| 58 | |
Lee Leahy | b2d834a | 2017-03-08 16:52:22 -0800 | [diff] [blame] | 59 | uint32_t tlcl_write(uint32_t index, const void *data, uint32_t length) |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 60 | { |
| 61 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 62 | return TPM_E_NO_DEVICE; |
| 63 | } |
| 64 | |
Lee Leahy | b2d834a | 2017-03-08 16:52:22 -0800 | [diff] [blame] | 65 | uint32_t tlcl_read(uint32_t index, void *data, uint32_t length) |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 66 | { |
| 67 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 68 | return TPM_E_NO_DEVICE; |
| 69 | } |
| 70 | |
| 71 | |
| 72 | uint32_t tlcl_assert_physical_presence(void) { |
| 73 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 74 | return TPM_E_NO_DEVICE; |
| 75 | } |
| 76 | |
| 77 | uint32_t tlcl_physical_presence_cmd_enable(void) { |
| 78 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 79 | return TPM_E_NO_DEVICE; |
| 80 | } |
| 81 | |
| 82 | uint32_t tlcl_finalize_physical_presence(void) { |
| 83 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 84 | return TPM_E_NO_DEVICE; |
| 85 | } |
| 86 | |
| 87 | uint32_t tlcl_set_nv_locked(void) { |
| 88 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 89 | return TPM_E_NO_DEVICE; |
| 90 | } |
| 91 | |
| 92 | uint32_t tlcl_force_clear(void) { |
| 93 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 94 | return TPM_E_NO_DEVICE; |
| 95 | } |
| 96 | |
| 97 | uint32_t tlcl_set_enable(void) { |
| 98 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 99 | return TPM_E_NO_DEVICE; |
| 100 | } |
| 101 | |
| 102 | uint32_t tlcl_set_deactivated(uint8_t flag) |
| 103 | { |
| 104 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 105 | return TPM_E_NO_DEVICE; |
| 106 | } |
| 107 | |
Lee Leahy | b2d834a | 2017-03-08 16:52:22 -0800 | [diff] [blame] | 108 | uint32_t tlcl_get_permanent_flags(TPM_PERMANENT_FLAGS *pflags) |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 109 | { |
| 110 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 111 | return TPM_E_NO_DEVICE; |
| 112 | } |
| 113 | |
Lee Leahy | b2d834a | 2017-03-08 16:52:22 -0800 | [diff] [blame] | 114 | uint32_t tlcl_get_flags(uint8_t *disable, uint8_t *deactivated, |
Lee Leahy | e20a319 | 2017-03-09 16:21:34 -0800 | [diff] [blame] | 115 | uint8_t *nvlocked) |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 116 | { |
| 117 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 118 | return TPM_E_NO_DEVICE; |
| 119 | } |
| 120 | |
| 121 | uint32_t tlcl_set_global_lock(void) |
| 122 | { |
| 123 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 124 | return TPM_E_NO_DEVICE; |
| 125 | } |
| 126 | |
Lee Leahy | b2d834a | 2017-03-08 16:52:22 -0800 | [diff] [blame] | 127 | uint32_t tlcl_extend(int pcr_num, const uint8_t *in_digest, |
Lee Leahy | e20a319 | 2017-03-09 16:21:34 -0800 | [diff] [blame] | 128 | uint8_t *out_digest) |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 129 | { |
| 130 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 131 | return TPM_E_NO_DEVICE; |
| 132 | } |