Skip to content

Commit

Permalink
Added missing policy argument check to unseal.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarske authored and danielinux committed Sep 12, 2023
1 parent 00000cb commit 53aa62a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/tpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ int wolfBoot_seal(uint8_t* pubkey_hint, uint8_t* policy, uint16_t policySz,
rc = wolfBoot_store_blob(TPM_RH_PLATFORM,
WOLFBOOT_TPM_SEAL_NV_BASE + index,
nvAttributes, &seal_blob,
NULL, 0 /* auth is not required as sealed blob is already encrypted */
NULL, 0 /* auth is not required as blob is already encrypted */
);
}
if (rc != 0) {
Expand All @@ -812,7 +812,8 @@ int wolfBoot_seal(uint8_t* pubkey_hint, uint8_t* policy, uint16_t policySz,
}

/* The unseal requires a signed policy from HDR_POLICY_SIGNATURE */
int wolfBoot_unseal_blob(uint8_t* pubkey_hint, uint8_t* policy, uint16_t policySz,
int wolfBoot_unseal_blob(uint8_t* pubkey_hint,
uint8_t* policy, uint16_t policySz,
WOLFTPM2_KEYBLOB* seal_blob, uint8_t* secret, int* secret_sz)
{
int rc, i;
Expand All @@ -835,7 +836,8 @@ int wolfBoot_unseal_blob(uint8_t* pubkey_hint, uint8_t* policy, uint16_t policyS
uint8_t* policyRef = NULL; /* optional nonce */
uint32_t policyRefSz = 0;

if (secret == NULL || secret_sz == NULL) {
if (policy == NULL || policySz <= 0 || secret == NULL ||
secret_sz == NULL) {
return -1;
}

Expand Down

0 comments on commit 53aa62a

Please sign in to comment.