VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/Crypto.c32
-rw-r--r--src/Common/Crypto.h2
-rw-r--r--src/Common/Dlgcode.c4
-rw-r--r--src/Common/Tests.c4
4 files changed, 29 insertions, 13 deletions
diff --git a/src/Common/Crypto.c b/src/Common/Crypto.c
index e47f9565..fc9be05c 100644
--- a/src/Common/Crypto.c
+++ b/src/Common/Crypto.c
@@ -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;
}
diff --git a/src/Common/Crypto.h b/src/Common/Crypto.h
index 70f481d8..208e72a1 100644
--- a/src/Common/Crypto.h
+++ b/src/Common/Crypto.h
@@ -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);
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 9bb4ac49..9b1abb56 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -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);
diff --git a/src/Common/Tests.c b/src/Common/Tests.c
index 7007f64a..c5aea91d 100644
--- a/src/Common/Tests.c
+++ b/src/Common/Tests.c
@@ -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;