VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/Include/Library/PasswordLib.h
blob: cc7795764ff7e8ed37a2fb533a9b3244e4e036dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/** @file
Password library

Copyright (c) 2016. Disk Cryptography Services for EFI (DCS), Alex Kolotnikov
Copyright (c) 2016. VeraCrypt, Mounir IDRASSI 

This program and the accompanying materials are licensed and made available 
under the terms and conditions of the GNU Lesser General Public License, version 3.0 (LGPL-3.0).

The full text of the license may be found at
https://opensource.org/licenses/LGPL-3.0
**/

#ifndef __PASSWORDLIB_H__
#define __PASSWORDLIB_H__

#include <Uefi.h>
#include <Protocol/GraphicsOutput.h>

extern CHAR16*	gPasswordPictureFileName;

extern CHAR8*	gPasswordPictureChars;
extern CHAR8*	gPasswordPictureCharsDefault;
extern UINTN	gPasswordPictureCharsLen;
extern UINT8	gPasswordVisible;
extern UINT8	gPasswordProgress;
extern int		gPasswordTimeout;

extern int		gPasswordShowMark;
extern VOID*	gPictPwdBmp;
extern UINTN	gPictPwdBmpSize;

extern int		gPlatformLocked;
extern int		gTPMLocked;
extern int		gSCLocked;

enum AskPwdType {
	AskPwdLogin = 1,
	AskPwdNew,
	AskPwdConfirm
};

enum AskPwdRetCode {
	AskPwdRetCancel = 0,
	AskPwdRetLogin  = 1,
	AskPwdRetChange = 2,
	AskPwdRetTimeout
};

VOID
AskPictPwdInt(
	IN  UINTN	pwdType,
	IN  UINTN	pwdMax,
	OUT CHAR8*	pwd,
	OUT UINT32*	pwdLen,
	OUT INT32*	retCode
	);

VOID
AskConsolePwdInt(
	OUT UINT32   *length,
	OUT CHAR8    *asciiLine,
	OUT INT32    *retCode,
	IN  UINTN    line_max,
	IN  UINT8    show
	);

extern EFI_GUID*                     gSmbSystemUUID;        // Universal unique ID 
extern CHAR8*                        gSmbSystemSerial;      // System serial
extern CHAR8*                        gSmbSystemSKU;         // SKU number
extern CHAR8*                        gSmbSystemManufacture;     // computer manufacture
extern CHAR8*                        gSmbSystemModel;           // computer model
extern CHAR8*                        gSmbSystemVersion;         // computer version

extern CHAR8*                        gSmbBaseBoardSerial;       // Base board serial
extern UINT64*                       gSmbProcessorID;           // Processor ID

extern CHAR8*                        gSmbBiosVendor;           // BIOS vendor
extern CHAR8*                        gSmbBiosVersion;          // BIOS version
extern CHAR8*                        gSmbBiosDate;             // BIOS date

EFI_STATUS
SMBIOSGetSerials();

EFI_STATUS
PaltformGetIDCRC(
	IN  EFI_HANDLE  handle,
	OUT UINT32      *crc32
	);

EFI_STATUS
PlatformGetID(
	IN  EFI_HANDLE  handle,
	OUT CHAR8       **id,
	OUT UINTN       *idLen
	);

EFI_STATUS
PlatformGetIDCRC(
	IN  EFI_HANDLE  handle,
	OUT UINT32      *crc32
	);

extern UINTN        gBioIndexAuth;
extern BOOLEAN gBioIndexAuthOnRemovable;

typedef struct _DCS_AUTH_DATA_MARK {
	UINT32     HeaderCrc;
	UINT32     PlatformCrc;
	UINT32     AuthDataSize;
	UINT32     Reserved;
} DCS_AUTH_DATA_MARK;


EFI_STATUS
PlatformGetAuthData(
	OUT UINT8      **data,
	OUT UINTN      *len,
	OUT EFI_HANDLE *secRegionHandle
	);

//////////////////////////////////////////////////////////////////////////
// Certificates
//////////////////////////////////////////////////////////////////////////
extern CHAR8* gDCS_platform_crt_der;

#endif