Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2014 The Chromium OS Authors. All rights reserved. |
| 2 | * Use of this source code is governed by a BSD-style license that can be |
| 3 | * found in the LICENSE file. |
| 4 | * |
| 5 | * Stub API implementations which should be implemented by the caller. |
| 6 | */ |
| 7 | |
Bill Richardson | 40890c5 | 2015-01-26 13:48:32 -0800 | [diff] [blame] | 8 | #include <stdarg.h> |
| 9 | #include <stdio.h> |
| 10 | |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 11 | #include "2api.h" |
Joel Kitching | ffd42a8 | 2019-08-29 13:58:52 +0800 | [diff] [blame] | 12 | #include "2sysincludes.h" |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 13 | |
Julius Werner | f10e909 | 2014-12-16 19:24:54 -0800 | [diff] [blame] | 14 | __attribute__((weak)) |
Bill Richardson | 40890c5 | 2015-01-26 13:48:32 -0800 | [diff] [blame] | 15 | void vb2ex_printf(const char *func, const char *fmt, ...) |
| 16 | { |
Julius Werner | 5160e69 | 2019-03-05 13:56:41 -0800 | [diff] [blame] | 17 | #ifdef VBOOT_DEBUG |
Bill Richardson | 40890c5 | 2015-01-26 13:48:32 -0800 | [diff] [blame] | 18 | va_list ap; |
| 19 | va_start(ap, fmt); |
Randall Spangler | a609478 | 2017-01-20 14:54:47 -0800 | [diff] [blame] | 20 | if (func) |
| 21 | fprintf(stderr, "%s: ", func); |
Bill Richardson | 40890c5 | 2015-01-26 13:48:32 -0800 | [diff] [blame] | 22 | vfprintf(stderr, fmt, ap); |
| 23 | va_end(ap); |
Julius Werner | 5160e69 | 2019-03-05 13:56:41 -0800 | [diff] [blame] | 24 | #endif |
Bill Richardson | 40890c5 | 2015-01-26 13:48:32 -0800 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | __attribute__((weak)) |
Joel Kitching | e6700f4 | 2019-07-31 14:12:30 +0800 | [diff] [blame] | 28 | vb2_error_t vb2ex_tpm_clear_owner(struct vb2_context *ctx) |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 29 | { |
Joel Kitching | 231112a | 2019-04-25 18:16:06 +0800 | [diff] [blame] | 30 | fprintf(stderr, "%s: function not implemented\n", __func__); |
Joel Kitching | a1df89d | 2018-12-03 14:39:57 +0800 | [diff] [blame] | 31 | return VB2_ERROR_EX_UNIMPLEMENTED; |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 32 | } |
| 33 | |
Julius Werner | f10e909 | 2014-12-16 19:24:54 -0800 | [diff] [blame] | 34 | __attribute__((weak)) |
Joel Kitching | e6700f4 | 2019-07-31 14:12:30 +0800 | [diff] [blame] | 35 | vb2_error_t vb2ex_read_resource(struct vb2_context *ctx, |
| 36 | enum vb2_resource_index index, uint32_t offset, |
| 37 | void *buf, uint32_t size) |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 38 | { |
Joel Kitching | 231112a | 2019-04-25 18:16:06 +0800 | [diff] [blame] | 39 | fprintf(stderr, "%s: function not implemented\n", __func__); |
Joel Kitching | a1df89d | 2018-12-03 14:39:57 +0800 | [diff] [blame] | 40 | return VB2_ERROR_EX_UNIMPLEMENTED; |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 41 | } |
Julius Werner | f10e909 | 2014-12-16 19:24:54 -0800 | [diff] [blame] | 42 | |
| 43 | __attribute__((weak)) |
Joel Kitching | e6700f4 | 2019-07-31 14:12:30 +0800 | [diff] [blame] | 44 | vb2_error_t vb2ex_hwcrypto_digest_init(enum vb2_hash_algorithm hash_alg, |
| 45 | uint32_t data_size) |
Julius Werner | f10e909 | 2014-12-16 19:24:54 -0800 | [diff] [blame] | 46 | { |
| 47 | return VB2_ERROR_EX_HWCRYPTO_UNSUPPORTED; |
| 48 | } |
| 49 | |
| 50 | __attribute__((weak)) |
Joel Kitching | e6700f4 | 2019-07-31 14:12:30 +0800 | [diff] [blame] | 51 | vb2_error_t vb2ex_hwcrypto_digest_extend(const uint8_t *buf, uint32_t size) |
Julius Werner | f10e909 | 2014-12-16 19:24:54 -0800 | [diff] [blame] | 52 | { |
Joel Kitching | a1df89d | 2018-12-03 14:39:57 +0800 | [diff] [blame] | 53 | return VB2_ERROR_SHA_EXTEND_ALGORITHM; /* Should not be called. */ |
Julius Werner | f10e909 | 2014-12-16 19:24:54 -0800 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | __attribute__((weak)) |
Joel Kitching | e6700f4 | 2019-07-31 14:12:30 +0800 | [diff] [blame] | 57 | vb2_error_t vb2ex_hwcrypto_digest_finalize(uint8_t *digest, |
| 58 | uint32_t digest_size) |
Julius Werner | f10e909 | 2014-12-16 19:24:54 -0800 | [diff] [blame] | 59 | { |
Joel Kitching | a1df89d | 2018-12-03 14:39:57 +0800 | [diff] [blame] | 60 | return VB2_ERROR_SHA_FINALIZE_ALGORITHM; /* Should not be called. */ |
Julius Werner | f10e909 | 2014-12-16 19:24:54 -0800 | [diff] [blame] | 61 | } |
Matt Delco | 08bf680 | 2019-02-13 15:54:24 -0800 | [diff] [blame] | 62 | |
| 63 | __attribute__((weak)) |
Joel Kitching | e6700f4 | 2019-07-31 14:12:30 +0800 | [diff] [blame] | 64 | vb2_error_t vb2ex_tpm_set_mode(enum vb2_tpm_mode mode_val) |
Matt Delco | 08bf680 | 2019-02-13 15:54:24 -0800 | [diff] [blame] | 65 | { |
Joel Kitching | 231112a | 2019-04-25 18:16:06 +0800 | [diff] [blame] | 66 | fprintf(stderr, "%s: function not implemented\n", __func__); |
Joel Kitching | a1df89d | 2018-12-03 14:39:57 +0800 | [diff] [blame] | 67 | return VB2_ERROR_EX_UNIMPLEMENTED; |
Matt Delco | 08bf680 | 2019-02-13 15:54:24 -0800 | [diff] [blame] | 68 | } |
Joel Kitching | aaf3943 | 2019-09-11 14:15:45 +0800 | [diff] [blame] | 69 | |
| 70 | __attribute__((weak)) |
Tim Wawrzynczak | 5d874c2 | 2019-10-22 15:36:59 -0600 | [diff] [blame^] | 71 | vb2_error_t vb2ex_auxfw_check(enum vb2_auxfw_update_severity *severity) |
| 72 | { |
| 73 | *severity = VB_AUX_FW_NO_UPDATE; |
| 74 | return VB2_SUCCESS; |
| 75 | } |
| 76 | |
| 77 | __attribute__((weak)) |
| 78 | vb2_error_t vb2ex_auxfw_update(void) |
| 79 | { |
| 80 | return VB2_SUCCESS; |
| 81 | } |
| 82 | |
| 83 | __attribute__((weak)) |
| 84 | vb2_error_t vb2ex_auxfw_finalize(struct vb2_context *ctx) |
| 85 | { |
| 86 | return VB2_SUCCESS; |
| 87 | } |
| 88 | |
| 89 | __attribute__((weak)) |
Joel Kitching | aaf3943 | 2019-09-11 14:15:45 +0800 | [diff] [blame] | 90 | void vb2ex_abort(void) |
| 91 | { |
| 92 | /* Stub simply exits. */ |
| 93 | exit(1); |
| 94 | } |