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 "2sysincludes.h" |
| 12 | #include "2api.h" |
| 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 | { |
| 17 | va_list ap; |
| 18 | va_start(ap, fmt); |
| 19 | fprintf(stderr, "%s: ", func); |
| 20 | vfprintf(stderr, fmt, ap); |
| 21 | va_end(ap); |
| 22 | } |
| 23 | |
| 24 | __attribute__((weak)) |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 25 | int vb2ex_tpm_clear_owner(struct vb2_context *ctx) |
| 26 | { |
Randall Spangler | 25c95d0 | 2014-06-20 13:57:12 -0700 | [diff] [blame] | 27 | return VB2_ERROR_EX_TPM_CLEAR_OWNER_UNIMPLEMENTED; |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 28 | } |
| 29 | |
Julius Werner | f10e909 | 2014-12-16 19:24:54 -0800 | [diff] [blame] | 30 | __attribute__((weak)) |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 31 | int vb2ex_read_resource(struct vb2_context *ctx, |
| 32 | enum vb2_resource_index index, |
| 33 | uint32_t offset, |
| 34 | void *buf, |
| 35 | uint32_t size) |
| 36 | { |
Randall Spangler | 25c95d0 | 2014-06-20 13:57:12 -0700 | [diff] [blame] | 37 | return VB2_ERROR_EX_READ_RESOURCE_UNIMPLEMENTED; |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 38 | } |
Julius Werner | f10e909 | 2014-12-16 19:24:54 -0800 | [diff] [blame] | 39 | |
| 40 | __attribute__((weak)) |
| 41 | int vb2ex_hwcrypto_digest_init(enum vb2_hash_algorithm hash_alg, |
| 42 | uint32_t data_size) |
| 43 | { |
| 44 | return VB2_ERROR_EX_HWCRYPTO_UNSUPPORTED; |
| 45 | } |
| 46 | |
| 47 | __attribute__((weak)) |
| 48 | int vb2ex_hwcrypto_digest_extend(const uint8_t *buf, |
| 49 | uint32_t size) |
| 50 | { |
| 51 | return VB2_ERROR_SHA_EXTEND_ALGORITHM; /* Should not be called. */ |
| 52 | } |
| 53 | |
| 54 | __attribute__((weak)) |
| 55 | int vb2ex_hwcrypto_digest_finalize(uint8_t *digest, |
| 56 | uint32_t digest_size) |
| 57 | { |
| 58 | return VB2_ERROR_SHA_FINALIZE_ALGORITHM; /* Should not be called. */ |
| 59 | } |