diff options
author | kavsrf <kavsrf@gmail.com> | 2017-02-05 17:31:28 +0300 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2017-06-05 17:36:54 +0200 |
commit | abf3adcd2f37f4e278fc9ef7634ca0c8f5171893 (patch) | |
tree | c7fe7706e8648c7a989bcfd30dbc66a1faa108f3 /Library/VeraCryptLib | |
parent | d200f27ac3b8a4f58e52a5ee798e11e3fdf74924 (diff) | |
download | VeraCrypt-DCS-abf3adcd2f37f4e278fc9ef7634ca0c8f5171893.tar.gz VeraCrypt-DCS-abf3adcd2f37f4e278fc9ef7634ca0c8f5171893.zip |
picture password bmp and DcsProp can be in secregion on separate flash
Tables overlay configuration commands
Diffstat (limited to 'Library/VeraCryptLib')
-rw-r--r-- | Library/VeraCryptLib/DcsConfig.c | 4 | ||||
-rw-r--r-- | Library/VeraCryptLib/DcsConfig.h | 2 | ||||
-rw-r--r-- | Library/VeraCryptLib/DcsVeraCrypt.c | 30 |
3 files changed, 22 insertions, 14 deletions
diff --git a/Library/VeraCryptLib/DcsConfig.c b/Library/VeraCryptLib/DcsConfig.c index 00aa5f8..e29e767 100644 --- a/Library/VeraCryptLib/DcsConfig.c +++ b/Library/VeraCryptLib/DcsConfig.c @@ -23,6 +23,8 @@ https://opensource.org/licenses/Apache-2.0 //////////////////////////////////////////////////////////////////////////
char *gConfigBuffer = NULL;
UINTN gConfigBufferSize = 0;
+char *gConfigBufferUpdated = NULL;
+UINTN gConfigBufferUpdatedSize = 0;
BOOLEAN
ConfigRead(char *configKey, char *configValue, int maxValueSize)
@@ -35,7 +37,7 @@ ConfigRead(char *configKey, char *configValue, int maxValueSize) }
}
- xml = gConfigBuffer;
+ xml = gConfigBufferUpdated != NULL? gConfigBufferUpdated : gConfigBuffer;
if (xml != NULL)
{
xml = XmlFindElementByAttributeValue(xml, "config", "key", configKey);
diff --git a/Library/VeraCryptLib/DcsConfig.h b/Library/VeraCryptLib/DcsConfig.h index 04719d9..cc803ce 100644 --- a/Library/VeraCryptLib/DcsConfig.h +++ b/Library/VeraCryptLib/DcsConfig.h @@ -22,6 +22,8 @@ https://opensource.org/licenses/Apache-2.0 //////////////////////////////////////////////////////////////////////////
extern char *gConfigBuffer;
extern UINTN gConfigBufferSize;
+extern char *gConfigBufferUpdated;
+extern UINTN gConfigBufferUpdatedSize;
BOOLEAN ConfigRead(char *configKey, char *configValue, int maxValueSize);
int ConfigReadInt(char *configKey, int defaultValue);
diff --git a/Library/VeraCryptLib/DcsVeraCrypt.c b/Library/VeraCryptLib/DcsVeraCrypt.c index cc85f4e..f4a1e27 100644 --- a/Library/VeraCryptLib/DcsVeraCrypt.c +++ b/Library/VeraCryptLib/DcsVeraCrypt.c @@ -85,6 +85,10 @@ CHAR8* gOnExitNotFound = NULL; // Authorize
/////////////////////////////////////////////////////////////////////////
+#define VCCONFIG_ALLOC(data, size) \
+ if(data == NULL) MEM_FREE(data); \
+ data = MEM_ALLOC(size);
+
VOID
VCAuthLoadConfig()
{
@@ -96,30 +100,30 @@ VCAuthLoadConfig() SetMem(&gAuthPassword, sizeof(gAuthPassword), 0);
strTemp = MEM_ALLOC(MAX_MSG);
- gPasswordPictureFileName = MEM_ALLOC(MAX_MSG * 2);
+ VCCONFIG_ALLOC(gPasswordPictureFileName, MAX_MSG * 2);
ConfigReadString("PasswordPicture", "\\EFI\\VeraCrypt\\login.bmp", strTemp, MAX_MSG);
AsciiStrToUnicodeStr(strTemp, gPasswordPictureFileName);
MEM_FREE(strTemp);
- gPasswordPictureChars = MEM_ALLOC(MAX_MSG);
+ VCCONFIG_ALLOC(gPasswordPictureChars, MAX_MSG);
ConfigReadString("PictureChars", gPasswordPictureCharsDefault, gPasswordPictureChars, MAX_MSG);
gPasswordPictureCharsLen = strlen(gPasswordPictureChars);
gAuthPasswordType = ConfigReadInt("PasswordType", 0);
- gAuthPasswordMsg = MEM_ALLOC(MAX_MSG);
+ VCCONFIG_ALLOC(gAuthPasswordMsg, MAX_MSG);
ConfigReadString("PasswordMsg", "Password:", gAuthPasswordMsg, MAX_MSG);
gAutoLogin = (UINT8)ConfigReadInt("AutoLogin", 0);
- gAutoPassword = MEM_ALLOC(MAX_PASSWORD);
+ VCCONFIG_ALLOC(gAutoPassword, MAX_PASSWORD);
ConfigReadString("AutoPassword", "", gAutoPassword, MAX_PASSWORD);
- gAuthPimMsg = MEM_ALLOC(MAX_MSG);
+ VCCONFIG_ALLOC(gAuthPimMsg, MAX_MSG);
gAuthPimRqt = ConfigReadInt("PimRqt", 1);
gAuthPim = ConfigReadInt("Pim", 0);
ConfigReadString("PimMsg", "Pim:", gAuthPimMsg, MAX_MSG);
- gAuthHashMsg = MEM_ALLOC(MAX_MSG);
+ VCCONFIG_ALLOC(gAuthHashMsg, MAX_MSG);
gAuthHashRqt = ConfigReadInt("HashRqt", 1);
gAuthHash = ConfigReadInt("Hash", 0);
@@ -145,15 +149,15 @@ VCAuthLoadConfig() gDcsBootForce = ConfigReadInt("DcsBootForce", 1); // Ask password even if no USB marked found.
- gForcePasswordMsg = MEM_ALLOC(MAX_MSG);
+ VCCONFIG_ALLOC(gForcePasswordMsg, MAX_MSG);
ConfigReadString("ForcePasswordMsg", gAuthPasswordMsg, gForcePasswordMsg, MAX_MSG);
gForcePasswordType = ConfigReadInt("ForcePasswordType", gAuthPasswordType);
gForcePasswordProgress = (UINT8)ConfigReadInt("ForcePasswordProgress", gPasswordProgress);
gAuthRetry = ConfigReadInt("AuthorizeRetry", 10);
- gAuthStartMsg = MEM_ALLOC(MAX_MSG);
+ VCCONFIG_ALLOC(gAuthStartMsg, MAX_MSG);
ConfigReadString("AuthStartMsg", "Authorizing...\n\r", gAuthStartMsg, MAX_MSG);
- gAuthErrorMsg = MEM_ALLOC(MAX_MSG);
+ VCCONFIG_ALLOC(gAuthErrorMsg, MAX_MSG);
ConfigReadString("AuthErrorMsg", "Authorization failed. Wrong password, PIM or hash.\n\r", gAuthErrorMsg, MAX_MSG);
gRUD = ConfigReadInt("RUD", 0);
@@ -166,11 +170,11 @@ VCAuthLoadConfig() gSCLocked = ConfigReadInt("SCLocked", 0);
// Actions for DcsInt
- gOnExitSuccess = MEM_ALLOC(MAX_MSG);
+ VCCONFIG_ALLOC(gOnExitSuccess, MAX_MSG);
ConfigReadString("ActionSuccess", "Exit", gOnExitSuccess, MAX_MSG);
- gOnExitNotFound = MEM_ALLOC(MAX_MSG);
+ VCCONFIG_ALLOC(gOnExitNotFound, MAX_MSG);
ConfigReadString("ActionNotFound", "Exit", gOnExitNotFound, MAX_MSG);
- gOnExitFailed = MEM_ALLOC(MAX_MSG);
+ VCCONFIG_ALLOC(gOnExitFailed, MAX_MSG);
ConfigReadString("ActionFailed", "Exit", gOnExitFailed, MAX_MSG);
strTemp = MEM_ALLOC(MAX_MSG);
@@ -178,7 +182,7 @@ VCAuthLoadConfig() if (strTemp[0] != 0) {
EFI_GUID g;
if (AsciiStrToGuid(&g, strTemp)) {
- gPartitionGuidOS = MEM_ALLOC(sizeof(EFI_GUID));
+ VCCONFIG_ALLOC(gPartitionGuidOS, sizeof(EFI_GUID));
if (gPartitionGuidOS != NULL) {
memcpy(gPartitionGuidOS, &g, sizeof(g));
}
|