Windows: change cascade encryption naming format to reflex mathematical composition of the encryption algorithm, thus being more clear. For example AES(Twofish(Serpent)) instead of AES-Twofish-Serpent.

This commit is contained in:
Mounir IDRASSI 2015-01-03 22:57:24 +01:00
parent 8f5fd67ff3
commit 55b3400afa
7 changed files with 37 additions and 21 deletions

View File

@ -408,19 +408,35 @@ BOOL EAInitMode (PCRYPTO_INFO ci)
return TRUE;
}
static void EAGetDisplayName(char *buf, int ea, int i)
{
strcpy (buf, CipherGetName (i));
if (i = EAGetPreviousCipher(ea, i))
{
strcat (buf, "(");
EAGetDisplayName (&buf[strlen(buf)], ea, i);
strcat (buf, ")");
}
}
// Returns name of EA, cascaded cipher names are separated by hyphens
char *EAGetName (char *buf, int ea)
char *EAGetName (char *buf, int ea, int guiDisplay)
{
int i = EAGetLastCipher(ea);
strcpy (buf, (i != 0) ? CipherGetName (i) : "?");
while (i = EAGetPreviousCipher(ea, i))
if (guiDisplay)
{
strcat (buf, "-");
strcat (buf, CipherGetName (i));
EAGetDisplayName (buf, ea, EAGetLastCipher(ea));
}
else
{
int i = EAGetLastCipher(ea);
strcpy (buf, (i != 0) ? CipherGetName (i) : "?");
while (i = EAGetPreviousCipher(ea, i))
{
strcat (buf, "-");
strcat (buf, CipherGetName (i));
}
}
return buf;
}
@ -432,7 +448,7 @@ int EAGetByName (char *name)
do
{
EAGetName (n, ea);
EAGetName (n, ea, 0);
if (strcmp (n, name) == 0)
return ea;
}

View File

@ -293,7 +293,7 @@ void DecipherBlocks (int cipher, void *dataPtr, void *ks, size_t blockCount);
int EAGetFirst ();
int EAGetCount (void);
int EAGetNext (int previousEA);
char * EAGetName (char *buf, int ea);
char * EAGetName (char *buf, int ea, int guiDisplay);
int EAGetByName (char *name);
int EAGetKeySize (int ea);
int EAGetFirstMode (int ea);

View File

@ -4574,7 +4574,7 @@ static BOOL PerformBenchmark(HWND hBenchDlg, HWND hwndDlg)
benchmarkTable[benchmarkTotalItems].decSpeed = performanceCountEnd.QuadPart - performanceCountStart.QuadPart;
benchmarkTable[benchmarkTotalItems].id = ci->ea;
benchmarkTable[benchmarkTotalItems].meanBytesPerSec = ((unsigned __int64) (benchmarkBufferSize / ((float) benchmarkTable[benchmarkTotalItems].encSpeed / benchmarkPerformanceFrequency.QuadPart)) + (unsigned __int64) (benchmarkBufferSize / ((float) benchmarkTable[benchmarkTotalItems].decSpeed / benchmarkPerformanceFrequency.QuadPart))) / 2;
EAGetName (benchmarkTable[benchmarkTotalItems].name, ci->ea);
EAGetName (benchmarkTable[benchmarkTotalItems].name, ci->ea, 1);
benchmarkTotalItems++;
}
@ -5349,7 +5349,7 @@ CipherTestDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
for (ea = EAGetFirst (); ea != 0; ea = EAGetNext (ea))
{
if (EAGetCipherCount (ea) == 1 && EAIsFormatEnabled (ea))
AddComboPair (GetDlgItem (hwndDlg, IDC_CIPHER), EAGetName (buf, ea), EAGetFirstCipher (ea));
AddComboPair (GetDlgItem (hwndDlg, IDC_CIPHER), EAGetName (buf, ea, 1), EAGetFirstCipher (ea));
}
ResetCipherTest(hwndDlg, idTestCipher);

View File

@ -511,7 +511,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
if (!EAIsModeSupported (ci->ea, ci->mode))
continue;
EAGetName (name, ci->ea);
EAGetName (name, ci->ea, 0);
if (EAInit (ci->ea, key1, ci->ks) != ERR_SUCCESS)
return FALSE;
@ -777,7 +777,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
if (!EAIsModeSupported (ci->ea, ci->mode))
continue;
EAGetName (name, ci->ea);
EAGetName (name, ci->ea, 0);
if (EAInit (ci->ea, key1, ci->ks) != ERR_SUCCESS)
return FALSE;

View File

@ -1640,7 +1640,7 @@ void GetBootEncryptionAlgorithmName (PIRP irp, PIO_STACK_LOCATION irpSp)
if (BootDriveFilterExtension && BootDriveFilterExtension->DriveMounted)
{
GetBootEncryptionAlgorithmNameRequest *request = (GetBootEncryptionAlgorithmNameRequest *) irp->AssociatedIrp.SystemBuffer;
EAGetName (request->BootEncryptionAlgorithmName, BootDriveFilterExtension->Queue.CryptoInfo->ea);
EAGetName (request->BootEncryptionAlgorithmName, BootDriveFilterExtension->Queue.CryptoInfo->ea, 0);
HashGetName2 (request->BootPrfAlgorithmName, BootDriveFilterExtension->Queue.CryptoInfo->pkcs5);
irp->IoStatus.Information = sizeof (GetBootEncryptionAlgorithmNameRequest);

View File

@ -1189,7 +1189,7 @@ void ComboSelChangeEA (HWND hwndDlg)
int i, cnt = 0;
nIndex = SendMessage (GetDlgItem (hwndDlg, IDC_COMBO_BOX), CB_GETITEMDATA, nIndex, 0);
EAGetName (name, nIndex);
EAGetName (name, nIndex, 0);
if (strcmp (name, "AES") == 0)
{
@ -3723,7 +3723,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
for (ea = EAGetFirst (); ea != 0; ea = EAGetNext (ea))
{
if (EAIsFormatEnabled (ea))
AddComboPair (GetDlgItem (hwndDlg, IDC_COMBO_BOX), EAGetName (buf, ea), ea);
AddComboPair (GetDlgItem (hwndDlg, IDC_COMBO_BOX), EAGetName (buf, ea, 1), ea);
}
SelectAlgo (GetDlgItem (hwndDlg, IDC_COMBO_BOX), &nVolumeEA);
@ -4976,7 +4976,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
int nIndex = SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX), CB_GETCURSEL, 0, 0);
nIndex = SendMessage (GetDlgItem (hCurPage, IDC_COMBO_BOX), CB_GETITEMDATA, nIndex, 0);
EAGetName (name, nIndex);
EAGetName (name, nIndex, 0);
if (strcmp (name, "AES") == 0)
Applink ("aes", FALSE, "");

View File

@ -1188,7 +1188,7 @@ void LoadDriveLetters (HWND hwndDlg, HWND hTree, int drive)
GetSizeString (GetSysEncDeviceSize(TRUE), szTmpW, sizeof(szTmpW));
ListSubItemSetW (hTree, listItem.iItem, 2, szTmpW);
EAGetName (szTmp, propSysEnc.ea);
EAGetName (szTmp, propSysEnc.ea, 1);
listItem.iSubItem = 3;
ListView_SetItem (hTree, &listItem);
@ -1305,7 +1305,7 @@ void LoadDriveLetters (HWND hwndDlg, HWND hTree, int drive)
GetSizeString (bSysEncPartition ? GetSysEncDeviceSize(TRUE) : driver.diskLength[i], szTmpW, sizeof(szTmpW));
ListSubItemSetW (hTree, listItem.iItem, 2, szTmpW);
EAGetName (szTmp, bSysEncPartition ? propSysEnc.ea : driver.ea[i]);
EAGetName (szTmp, bSysEncPartition ? propSysEnc.ea : driver.ea[i], 1);
listItem.iSubItem = 3;
ListView_SetItem (hTree, &listItem);
@ -3081,14 +3081,14 @@ BOOL CALLBACK VolumePropertiesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
return 1;
}
EAGetName (szTmp, prop.ea);
EAGetName (szTmp, prop.ea, 1);
ListSubItemSet (list, i++, 1, szTmp);
// Key size(s)
{
char name[128];
int size = EAGetKeySize (prop.ea);
EAGetName (name, prop.ea);
EAGetName (name, prop.ea, 1);
// Primary key
ListItemAddW (list, i, GetString ("KEY_SIZE"));