summaryrefslogtreecommitdiff
path: root/firmware/lib/tpm_lite
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2020-07-06 13:58:11 +0800
committerCommit Bot <commit-bot@chromium.org>2020-07-10 06:33:46 +0000
commit28eededf643cc3cb278e8aa276b9c97e527dabdb (patch)
tree1a29c05e0ecaaed4600df2f3d86f81e77555f618 /firmware/lib/tpm_lite
parenta3815e035f442473300951dc0ea93c3f01297659 (diff)
downloadvboot-28eededf643cc3cb278e8aa276b9c97e527dabdb.tar.gz
vboot: move TPM callbacks to vboot2 namespace
Move TPM callback definitions from vboot_api.h to 2api.h. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Cq-Depend: chromium:2282023 Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Iad9da9fd3b6786609148d08b88f2e62ac3dee627 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2282322 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'firmware/lib/tpm_lite')
-rw-r--r--firmware/lib/tpm_lite/mocked_tlcl.c3
-rw-r--r--firmware/lib/tpm_lite/tlcl.c21
2 files changed, 11 insertions, 13 deletions
diff --git a/firmware/lib/tpm_lite/mocked_tlcl.c b/firmware/lib/tpm_lite/mocked_tlcl.c
index 838b5e7e..c29ada7b 100644
--- a/firmware/lib/tpm_lite/mocked_tlcl.c
+++ b/firmware/lib/tpm_lite/mocked_tlcl.c
@@ -6,11 +6,10 @@
#include "2sysincludes.h"
#include "tlcl.h"
#include "tlcl_internal.h"
-#include "vboot_api.h"
uint32_t TlclLibInit(void)
{
- return VbExTpmInit();
+ return TPM_SUCCESS;
}
uint32_t TlclLibClose(void)
diff --git a/firmware/lib/tpm_lite/tlcl.c b/firmware/lib/tpm_lite/tlcl.c
index 28c0bb63..4b3714da 100644
--- a/firmware/lib/tpm_lite/tlcl.c
+++ b/firmware/lib/tpm_lite/tlcl.c
@@ -21,7 +21,6 @@
#include "tlcl.h"
#include "tlcl_internal.h"
#include "tlcl_structures.h"
-#include "vboot_api.h"
/* Sets the size field of a TPM command. */
static inline void SetTpmCommandSize(uint8_t* buffer, uint32_t size)
@@ -75,8 +74,8 @@ static uint32_t TlclSendReceiveNoRetry(const uint8_t* request,
request[6], request[7], request[8], request[9]);
#endif
- result = VbExTpmSendReceive(request, TpmCommandSize(request),
- response, &response_length);
+ result = vb2ex_tpm_send_recv(request, TpmCommandSize(request),
+ response, &response_length);
if (TPM_SUCCESS != result) {
/* Communication with TPM failed, so response is garbage */
VB2_DEBUG("TPM: command %#x send/receive failed: %#x\n",
@@ -202,8 +201,8 @@ static uint32_t StartOSAPSession(
memcpy(&cmd, &tpm_osap_cmd, sizeof(cmd));
ToTpmUint16(cmd.buffer + cmd.entityType, entity_type);
ToTpmUint32(cmd.buffer + cmd.entityValue, entity_value);
- if (VbExTpmGetRandom(cmd.buffer + cmd.nonceOddOSAP,
- sizeof(TPM_NONCE)) != VB2_SUCCESS) {
+ if (vb2ex_tpm_get_random(cmd.buffer + cmd.nonceOddOSAP,
+ sizeof(TPM_NONCE)) != VB2_SUCCESS) {
return TPM_E_INTERNAL_ERROR;
}
@@ -283,8 +282,8 @@ static uint32_t AddRequestAuthBlock(struct auth_session* auth_session,
vb2_sha1_finalize(&sha1_ctx, buf);
/* Generate a fresh nonce. */
- if (VbExTpmGetRandom(auth_session->nonce_odd.nonce,
- sizeof(TPM_NONCE)) != VB2_SUCCESS) {
+ if (vb2ex_tpm_get_random(auth_session->nonce_odd.nonce,
+ sizeof(TPM_NONCE)) != VB2_SUCCESS) {
return TPM_E_INTERNAL_ERROR;
}
@@ -389,12 +388,12 @@ static uint32_t CheckResponseAuthBlock(struct auth_session* auth_session,
uint32_t TlclLibInit(void)
{
- return VbExTpmInit();
+ return vb2ex_tpm_init();
}
uint32_t TlclLibClose(void)
{
- return VbExTpmClose();
+ return vb2ex_tpm_close();
}
uint32_t TlclStartup(void)
@@ -1216,8 +1215,8 @@ uint32_t TlclReadPubek(uint32_t* public_exponent,
{
struct s_tpm_readpubek_cmd cmd;
memcpy(&cmd, &tpm_readpubek_cmd, sizeof(cmd));
- if (VbExTpmGetRandom(cmd.buffer + tpm_readpubek_cmd.antiReplay,
- sizeof(TPM_NONCE)) != VB2_SUCCESS) {
+ if (vb2ex_tpm_get_random(cmd.buffer + tpm_readpubek_cmd.antiReplay,
+ sizeof(TPM_NONCE)) != VB2_SUCCESS) {
return TPM_E_INTERNAL_ERROR;
}