blob: e3489cf53cb28bc75aa2ab8bef426354630fe345 [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 "2sysincludes.h"
12#include "2api.h"
13
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))
Randall Spanglerda2b49c2014-06-10 17:03:40 -070028int vb2ex_tpm_clear_owner(struct vb2_context *ctx)
29{
Randall Spangler25c95d02014-06-20 13:57:12 -070030 return VB2_ERROR_EX_TPM_CLEAR_OWNER_UNIMPLEMENTED;
Randall Spanglerda2b49c2014-06-10 17:03:40 -070031}
32
Julius Wernerf10e9092014-12-16 19:24:54 -080033__attribute__((weak))
Randall Spanglerda2b49c2014-06-10 17:03:40 -070034int vb2ex_read_resource(struct vb2_context *ctx,
35 enum vb2_resource_index index,
36 uint32_t offset,
37 void *buf,
38 uint32_t size)
39{
Randall Spangler25c95d02014-06-20 13:57:12 -070040 return VB2_ERROR_EX_READ_RESOURCE_UNIMPLEMENTED;
Randall Spanglerda2b49c2014-06-10 17:03:40 -070041}
Julius Wernerf10e9092014-12-16 19:24:54 -080042
43__attribute__((weak))
44int vb2ex_hwcrypto_digest_init(enum vb2_hash_algorithm hash_alg,
45 uint32_t data_size)
46{
47 return VB2_ERROR_EX_HWCRYPTO_UNSUPPORTED;
48}
49
50__attribute__((weak))
51int vb2ex_hwcrypto_digest_extend(const uint8_t *buf,
52 uint32_t size)
53{
54 return VB2_ERROR_SHA_EXTEND_ALGORITHM; /* Should not be called. */
55}
56
57__attribute__((weak))
58int vb2ex_hwcrypto_digest_finalize(uint8_t *digest,
59 uint32_t digest_size)
60{
61 return VB2_ERROR_SHA_FINALIZE_ALGORITHM; /* Should not be called. */
62}
Matt Delco08bf6802019-02-13 15:54:24 -080063
64__attribute__((weak))
65int vb2ex_tpm_set_mode(enum vb2_tpm_mode mode_val)
66{
67 return VB2_ERROR_UNKNOWN;
68}