blob: 69873393816795c4ce0d2d58911522a29a0f22c8 [file] [log] [blame]
Randall Spanglerda2b49c2014-06-10 17:03:40 -07001/* 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 Richardson40890c52015-01-26 13:48:32 -08008#include <stdarg.h>
9#include <stdio.h>
10
Randall Spanglerda2b49c2014-06-10 17:03:40 -070011#include "2api.h"
Joel Kitchingffd42a82019-08-29 13:58:52 +080012#include "2sysincludes.h"
Randall Spanglerda2b49c2014-06-10 17:03:40 -070013
Julius Wernerf10e9092014-12-16 19:24:54 -080014__attribute__((weak))
Bill Richardson40890c52015-01-26 13:48:32 -080015void vb2ex_printf(const char *func, const char *fmt, ...)
16{
Julius Werner5160e692019-03-05 13:56:41 -080017#ifdef VBOOT_DEBUG
Bill Richardson40890c52015-01-26 13:48:32 -080018 va_list ap;
19 va_start(ap, fmt);
Randall Spanglera6094782017-01-20 14:54:47 -080020 if (func)
21 fprintf(stderr, "%s: ", func);
Bill Richardson40890c52015-01-26 13:48:32 -080022 vfprintf(stderr, fmt, ap);
23 va_end(ap);
Julius Werner5160e692019-03-05 13:56:41 -080024#endif
Bill Richardson40890c52015-01-26 13:48:32 -080025}
26
27__attribute__((weak))
Joel Kitchinge6700f42019-07-31 14:12:30 +080028vb2_error_t vb2ex_tpm_clear_owner(struct vb2_context *ctx)
Randall Spanglerda2b49c2014-06-10 17:03:40 -070029{
Joel Kitching231112a2019-04-25 18:16:06 +080030 fprintf(stderr, "%s: function not implemented\n", __func__);
Joel Kitchinga1df89d2018-12-03 14:39:57 +080031 return VB2_ERROR_EX_UNIMPLEMENTED;
Randall Spanglerda2b49c2014-06-10 17:03:40 -070032}
33
Julius Wernerf10e9092014-12-16 19:24:54 -080034__attribute__((weak))
Joel Kitchinge6700f42019-07-31 14:12:30 +080035vb2_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 Spanglerda2b49c2014-06-10 17:03:40 -070038{
Joel Kitching231112a2019-04-25 18:16:06 +080039 fprintf(stderr, "%s: function not implemented\n", __func__);
Joel Kitchinga1df89d2018-12-03 14:39:57 +080040 return VB2_ERROR_EX_UNIMPLEMENTED;
Randall Spanglerda2b49c2014-06-10 17:03:40 -070041}
Julius Wernerf10e9092014-12-16 19:24:54 -080042
43__attribute__((weak))
Joel Kitchinge6700f42019-07-31 14:12:30 +080044vb2_error_t vb2ex_hwcrypto_digest_init(enum vb2_hash_algorithm hash_alg,
45 uint32_t data_size)
Julius Wernerf10e9092014-12-16 19:24:54 -080046{
47 return VB2_ERROR_EX_HWCRYPTO_UNSUPPORTED;
48}
49
50__attribute__((weak))
Joel Kitchinge6700f42019-07-31 14:12:30 +080051vb2_error_t vb2ex_hwcrypto_digest_extend(const uint8_t *buf, uint32_t size)
Julius Wernerf10e9092014-12-16 19:24:54 -080052{
Joel Kitchinga1df89d2018-12-03 14:39:57 +080053 return VB2_ERROR_SHA_EXTEND_ALGORITHM; /* Should not be called. */
Julius Wernerf10e9092014-12-16 19:24:54 -080054}
55
56__attribute__((weak))
Joel Kitchinge6700f42019-07-31 14:12:30 +080057vb2_error_t vb2ex_hwcrypto_digest_finalize(uint8_t *digest,
58 uint32_t digest_size)
Julius Wernerf10e9092014-12-16 19:24:54 -080059{
Joel Kitchinga1df89d2018-12-03 14:39:57 +080060 return VB2_ERROR_SHA_FINALIZE_ALGORITHM; /* Should not be called. */
Julius Wernerf10e9092014-12-16 19:24:54 -080061}
Matt Delco08bf6802019-02-13 15:54:24 -080062
63__attribute__((weak))
Joel Kitchinge6700f42019-07-31 14:12:30 +080064vb2_error_t vb2ex_tpm_set_mode(enum vb2_tpm_mode mode_val)
Matt Delco08bf6802019-02-13 15:54:24 -080065{
Joel Kitching231112a2019-04-25 18:16:06 +080066 fprintf(stderr, "%s: function not implemented\n", __func__);
Joel Kitchinga1df89d2018-12-03 14:39:57 +080067 return VB2_ERROR_EX_UNIMPLEMENTED;
Matt Delco08bf6802019-02-13 15:54:24 -080068}
Joel Kitchingaaf39432019-09-11 14:15:45 +080069
70__attribute__((weak))
Tim Wawrzynczak5d874c22019-10-22 15:36:59 -060071vb2_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))
78vb2_error_t vb2ex_auxfw_update(void)
79{
80 return VB2_SUCCESS;
81}
82
83__attribute__((weak))
84vb2_error_t vb2ex_auxfw_finalize(struct vb2_context *ctx)
85{
86 return VB2_SUCCESS;
87}
88
89__attribute__((weak))
Joel Kitchingaaf39432019-09-11 14:15:45 +080090void vb2ex_abort(void)
91{
92 /* Stub simply exits. */
93 exit(1);
94}