VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/Include/Library/DcsTpmLib.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/Library/DcsTpmLib.h')
-rw-r--r--Include/Library/DcsTpmLib.h102
1 files changed, 81 insertions, 21 deletions
diff --git a/Include/Library/DcsTpmLib.h b/Include/Library/DcsTpmLib.h
index a8f015e..d3eb04c 100644
--- a/Include/Library/DcsTpmLib.h
+++ b/Include/Library/DcsTpmLib.h
@@ -16,6 +16,44 @@ https://opensource.org/licenses/LGPL-3.0
#include <Uefi.h>
+#define DCS_TPM_NV_INDEX 0x0DC5B
+#define DCS_TPM_NV_SIZE 128
+#define DCS_TPM_PCR_LOCK 8
+#define TPM_OWNER_PWD_MAX 64
+
+typedef struct _DCS_TPM_PROTOCOL DCS_TPM_PROTOCOL;
+extern DCS_TPM_PROTOCOL* gTpm;
+
+EFI_STATUS
+GetTpm();
+
+UINT32
+AskPcrsMask(
+ IN UINT32 def
+ );
+
+VOID
+AskTpmOwnerPwd(
+ OUT CHAR16* ownerPass
+ );
+
+EFI_STATUS
+Sha1Hash(
+ IN VOID *data,
+ IN UINTN dataSize,
+ OUT UINT8 *hash
+ );
+
+EFI_STATUS
+Sha256Hash(
+ IN VOID *data,
+ IN UINTN dataSize,
+ OUT UINT8 *hash
+ );
+
+//////////////////////////////////////////////////////////////////////////
+// TPM 1.2
+//////////////////////////////////////////////////////////////////////////
EFI_STATUS
InitTpm12();
@@ -45,25 +83,31 @@ Tpm12NvDetails(
OUT UINT32 *pcrW
);
+VOID
+DcsInitTpm12(
+ IN OUT DCS_TPM_PROTOCOL* Tpm);
+
+//////////////////////////////////////////////////////////////////////////
+// TPM 2.0
+//////////////////////////////////////////////////////////////////////////
+EFI_STATUS
+InitTpm20();
+
EFI_STATUS
-Tpm12GetRandom(
- IN OUT UINT32 *DataSize,
- OUT UINT8 *Data
- );
+DcsTpm2DumpPcrs(
+ IN UINT32 sPcr,
+ IN UINT32 ePcr);
+
+EFI_STATUS
+Tpm20Tests();
+
+VOID
+DcsInitTpm20(
+ IN OUT DCS_TPM_PROTOCOL* Tpm);
//////////////////////////////////////////////////////////////////////////
// DCS TPM protocol
//////////////////////////////////////////////////////////////////////////
-/*
-Lock - Try lock TPM secret
-Apply - Apply secret to password
-Configure - Create TPM secret and configure PCRs
-IsConfigured - TPM secret is set?
-IsOpen - Can apply secret?
-*/
-typedef struct _DCS_TPM_PROTOCOL DCS_TPM_PROTOCOL;
-
-extern DCS_TPM_PROTOCOL* gTpm;
typedef EFI_STATUS(*DCS_TPM_LOCK)(
IN DCS_TPM_PROTOCOL *tpm
@@ -86,21 +130,37 @@ typedef BOOLEAN(*DCS_TPM_IS_CONFIGURED)(
IN DCS_TPM_PROTOCOL *tpm
);
+typedef EFI_STATUS(*DCS_TPM_GETRANDOM)(
+ IN DCS_TPM_PROTOCOL *tpm,
+ IN UINT32 size,
+ OUT VOID* rnd
+ );
+
+typedef EFI_STATUS(*DCS_TPM_MEASURE)(
+ IN DCS_TPM_PROTOCOL *tpm,
+ IN UINTN index,
+ IN UINTN size,
+ OUT VOID* data
+ );
+
+/*
+Lock - Try lock TPM secret
+Apply - Apply secret to password
+Configure - Create TPM secret and configure PCRs
+IsConfigured - TPM secret is set?
+IsOpen - Can apply secret?
+*/
typedef struct _DCS_TPM_PROTOCOL {
+ UINTN TpmVersion;
DCS_TPM_LOCK Lock;
DCS_TPM_APPLY Apply;
DCS_TPM_CONFIGURE Configure;
DCS_TPM_IS_OPEN IsOpen;
DCS_TPM_IS_CONFIGURED IsConfigured;
+ DCS_TPM_GETRANDOM GetRandom;
+ DCS_TPM_MEASURE Measure;
} DCS_TPM_PROTOCOL;
-EFI_STATUS
-GetTpm();
-EFI_STATUS
-TpmMeasure(
- IN VOID* data,
- IN UINTN dataSz
- );
#endif \ No newline at end of file