SecurityPkg: Clear AuthSession content after use.

Some commands in Tpm2CommandLib accept AuthSession
as input parameter and copy to local command buffer.
After use, this AuthSession content should be zeroed,
because there might be some secrete there.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: "Zhang, Chao B" <chao.b.zhang@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19635 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Yao, Jiewen
2016-01-11 05:18:32 +00:00
committed by jyao1
parent f1e95ab817
commit 7ae130da85
6 changed files with 333 additions and 122 deletions

View File

@ -1,7 +1,7 @@
/** @file
Implement TPM2 EnhancedAuthorization related command.
Copyright (c) 2014, Intel Corporation. All rights reserved. <BR>
Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved. <BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@ -161,16 +161,18 @@ Tpm2PolicySecret (
RecvBufferSize = sizeof (RecvBuffer);
Status = Tpm2SubmitCommand (SendBufferSize, (UINT8 *)&SendBuffer, &RecvBufferSize, (UINT8 *)&RecvBuffer);
if (EFI_ERROR (Status)) {
return Status;
goto Done;
}
if (RecvBufferSize < sizeof (TPM2_RESPONSE_HEADER)) {
DEBUG ((EFI_D_ERROR, "Tpm2PolicySecret - RecvBufferSize Error - %x\n", RecvBufferSize));
return EFI_DEVICE_ERROR;
Status = EFI_DEVICE_ERROR;
goto Done;
}
if (SwapBytes32(RecvBuffer.Header.responseCode) != TPM_RC_SUCCESS) {
DEBUG ((EFI_D_ERROR, "Tpm2PolicySecret - responseCode - %x\n", SwapBytes32(RecvBuffer.Header.responseCode)));
return EFI_DEVICE_ERROR;
Status = EFI_DEVICE_ERROR;
goto Done;
}
//
@ -189,7 +191,13 @@ Tpm2PolicySecret (
Buffer += sizeof(UINT16);
CopyMem (PolicyTicket->digest.buffer, Buffer, PolicyTicket->digest.size);
return EFI_SUCCESS;
Done:
//
// Clear AuthSession Content
//
ZeroMem (&SendBuffer, sizeof(SendBuffer));
ZeroMem (&RecvBuffer, sizeof(RecvBuffer));
return Status;
}
/**