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 | |
Lee Leahy | 342f8d6 | 2017-03-10 15:31:56 -0800 | [diff] [blame] | 26 | uint32_t tlcl_lib_init(void) |
| 27 | { |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 28 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 29 | return TPM_E_NO_DEVICE; |
| 30 | } |
| 31 | |
Lee Leahy | 342f8d6 | 2017-03-10 15:31:56 -0800 | [diff] [blame] | 32 | uint32_t tlcl_startup(void) |
| 33 | { |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 34 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 35 | return TPM_E_NO_DEVICE; |
| 36 | } |
| 37 | |
Lee Leahy | 342f8d6 | 2017-03-10 15:31:56 -0800 | [diff] [blame] | 38 | uint32_t tlcl_resume(void) |
| 39 | { |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 40 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 41 | return TPM_E_NO_DEVICE; |
| 42 | } |
| 43 | |
| 44 | uint32_t tlcl_self_test_full(void) |
| 45 | { |
| 46 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 47 | return TPM_E_NO_DEVICE; |
| 48 | } |
| 49 | |
| 50 | uint32_t tlcl_continue_self_test(void) |
| 51 | { |
| 52 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 53 | return TPM_E_NO_DEVICE; |
| 54 | } |
| 55 | |
| 56 | uint32_t tlcl_define_space(uint32_t index, uint32_t perm, uint32_t size) |
| 57 | { |
| 58 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 59 | return TPM_E_NO_DEVICE; |
| 60 | } |
| 61 | |
Lee Leahy | b2d834a | 2017-03-08 16:52:22 -0800 | [diff] [blame] | 62 | 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] | 63 | { |
| 64 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 65 | return TPM_E_NO_DEVICE; |
| 66 | } |
| 67 | |
Lee Leahy | b2d834a | 2017-03-08 16:52:22 -0800 | [diff] [blame] | 68 | uint32_t tlcl_read(uint32_t index, void *data, uint32_t length) |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 69 | { |
| 70 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 71 | return TPM_E_NO_DEVICE; |
| 72 | } |
| 73 | |
| 74 | |
Lee Leahy | 342f8d6 | 2017-03-10 15:31:56 -0800 | [diff] [blame] | 75 | uint32_t tlcl_assert_physical_presence(void) |
| 76 | { |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 77 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 78 | return TPM_E_NO_DEVICE; |
| 79 | } |
| 80 | |
Lee Leahy | 342f8d6 | 2017-03-10 15:31:56 -0800 | [diff] [blame] | 81 | uint32_t tlcl_physical_presence_cmd_enable(void) |
| 82 | { |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 83 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 84 | return TPM_E_NO_DEVICE; |
| 85 | } |
| 86 | |
Lee Leahy | 342f8d6 | 2017-03-10 15:31:56 -0800 | [diff] [blame] | 87 | uint32_t tlcl_finalize_physical_presence(void) |
| 88 | { |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 89 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 90 | return TPM_E_NO_DEVICE; |
| 91 | } |
| 92 | |
Lee Leahy | 342f8d6 | 2017-03-10 15:31:56 -0800 | [diff] [blame] | 93 | uint32_t tlcl_set_nv_locked(void) |
| 94 | { |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 95 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 96 | return TPM_E_NO_DEVICE; |
| 97 | } |
| 98 | |
Lee Leahy | 342f8d6 | 2017-03-10 15:31:56 -0800 | [diff] [blame] | 99 | uint32_t tlcl_force_clear(void) |
| 100 | { |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 101 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 102 | return TPM_E_NO_DEVICE; |
| 103 | } |
| 104 | |
Lee Leahy | 342f8d6 | 2017-03-10 15:31:56 -0800 | [diff] [blame] | 105 | uint32_t tlcl_set_enable(void) |
| 106 | { |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 107 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 108 | return TPM_E_NO_DEVICE; |
| 109 | } |
| 110 | |
| 111 | uint32_t tlcl_set_deactivated(uint8_t flag) |
| 112 | { |
| 113 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 114 | return TPM_E_NO_DEVICE; |
| 115 | } |
| 116 | |
Lee Leahy | b2d834a | 2017-03-08 16:52:22 -0800 | [diff] [blame] | 117 | uint32_t tlcl_get_permanent_flags(TPM_PERMANENT_FLAGS *pflags) |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 118 | { |
| 119 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 120 | return TPM_E_NO_DEVICE; |
| 121 | } |
| 122 | |
Lee Leahy | b2d834a | 2017-03-08 16:52:22 -0800 | [diff] [blame] | 123 | uint32_t tlcl_get_flags(uint8_t *disable, uint8_t *deactivated, |
Lee Leahy | e20a319 | 2017-03-09 16:21:34 -0800 | [diff] [blame] | 124 | uint8_t *nvlocked) |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 125 | { |
| 126 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 127 | return TPM_E_NO_DEVICE; |
| 128 | } |
| 129 | |
| 130 | uint32_t tlcl_set_global_lock(void) |
| 131 | { |
| 132 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 133 | return TPM_E_NO_DEVICE; |
| 134 | } |
| 135 | |
Lee Leahy | b2d834a | 2017-03-08 16:52:22 -0800 | [diff] [blame] | 136 | uint32_t tlcl_extend(int pcr_num, const uint8_t *in_digest, |
Lee Leahy | e20a319 | 2017-03-09 16:21:34 -0800 | [diff] [blame] | 137 | uint8_t *out_digest) |
Yen Lin | 5bdbd00 | 2015-04-08 16:55:17 -0700 | [diff] [blame] | 138 | { |
| 139 | VBDEBUG("MOCK_TPM: %s\n", __func__); |
| 140 | return TPM_E_NO_DEVICE; |
| 141 | } |