VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/Include/Library
diff options
context:
space:
mode:
authorkavsrf <kavsrf@gmail.com>2017-04-17 23:30:06 +0300
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2017-06-18 15:41:16 +0200
commit3058711f8b12cf11585e0eda2a1b573f0d871667 (patch)
tree3bfcf8f345924c10e0e11fd266b7b4ab133fbe54 /Include/Library
parent3cddd24df26085682c819a3c8e9e3ce21a2872da (diff)
downloadVeraCrypt-DCS-3058711f8b12cf11585e0eda2a1b573f0d871667.tar.gz
VeraCrypt-DCS-3058711f8b12cf11585e0eda2a1b573f0d871667.zip
TPM 2.0
Diffstat (limited to 'Include/Library')
-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