2stub.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #include <stdarg.h>
  8. #include <stdio.h>
  9. #include "2sysincludes.h"
  10. #include "2api.h"
  11. __attribute__((weak))
  12. void vb2ex_printf(const char *func, const char *fmt, ...)
  13. {
  14. va_list ap;
  15. va_start(ap, fmt);
  16. if (func)
  17. fprintf(stderr, "%s: ", func);
  18. vfprintf(stderr, fmt, ap);
  19. va_end(ap);
  20. }
  21. __attribute__((weak))
  22. int vb2ex_tpm_clear_owner(struct vb2_context *ctx)
  23. {
  24. return VB2_ERROR_EX_TPM_CLEAR_OWNER_UNIMPLEMENTED;
  25. }
  26. __attribute__((weak))
  27. int vb2ex_read_resource(struct vb2_context *ctx,
  28. enum vb2_resource_index index,
  29. uint32_t offset,
  30. void *buf,
  31. uint32_t size)
  32. {
  33. return VB2_ERROR_EX_READ_RESOURCE_UNIMPLEMENTED;
  34. }
  35. __attribute__((weak))
  36. int vb2ex_hwcrypto_digest_init(enum vb2_hash_algorithm hash_alg,
  37. uint32_t data_size)
  38. {
  39. return VB2_ERROR_EX_HWCRYPTO_UNSUPPORTED;
  40. }
  41. __attribute__((weak))
  42. int vb2ex_hwcrypto_digest_extend(const uint8_t *buf,
  43. uint32_t size)
  44. {
  45. return VB2_ERROR_SHA_EXTEND_ALGORITHM; /* Should not be called. */
  46. }
  47. __attribute__((weak))
  48. int vb2ex_hwcrypto_digest_finalize(uint8_t *digest,
  49. uint32_t digest_size)
  50. {
  51. return VB2_ERROR_SHA_FINALIZE_ALGORITHM; /* Should not be called. */
  52. }