diff options
author | George Hazan <george.hazan@gmail.com> | 2013-11-14 23:13:38 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-11-14 23:13:38 +0000 |
commit | bd49c3201234f447a4fc951ea652532d973c07b1 (patch) | |
tree | 9ee40ab3181612ff138197c679090577a0c173e8 /src | |
parent | 5056234c898e593ba71a01659dbbcd70ca519d89 (diff) |
Encryption: gathering all things together, part I
git-svn-id: http://svn.miranda-ng.org/main/trunk@6910 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdcrypt/encrypt.cpp | 8 | ||||
-rw-r--r-- | src/modules/plugins/newplugins.cpp | 4 | ||||
-rw-r--r-- | src/modules/plugins/plugins.h | 1 |
3 files changed, 8 insertions, 5 deletions
diff --git a/src/core/stdcrypt/encrypt.cpp b/src/core/stdcrypt/encrypt.cpp index 851bae8450..7414d999f3 100644 --- a/src/core/stdcrypt/encrypt.cpp +++ b/src/core/stdcrypt/encrypt.cpp @@ -34,7 +34,7 @@ void CStdCrypt::destroy() size_t CStdCrypt::getKeyLength()
{
- return m_aes.GetKeyLength();
+ return KEY_LENGTH;
}
bool CStdCrypt::getKey(BYTE *pKey, size_t cbKeyLen)
@@ -65,10 +65,12 @@ int CStdCrypt::setKey(const BYTE *pKey, size_t cbKeyLen) void CStdCrypt::generateKey(void)
{
LARGE_INTEGER counter;
+ QueryPerformanceCounter(&counter);
+ srand(counter.LowPart);
+
for (int i = 0; i < sizeof(m_key); i++) {
- QueryPerformanceCounter(&counter);
- srand(counter.LowPart);
m_key[i] = (BYTE)rand();
+ Sleep(0);
}
m_aes.MakeKey(m_key, m_password, KEY_LENGTH, BLOCK_SIZE);
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp index b529a1af2c..7fec687d63 100644 --- a/src/modules/plugins/newplugins.cpp +++ b/src/modules/plugins/newplugins.cpp @@ -413,7 +413,7 @@ pluginEntry* OpenPlugin(TCHAR *tszFileName, TCHAR *dir, TCHAR *path) BASIC_PLUGIN_INFO bpi;
if ( checkAPI(tszFullPath, &bpi, mirandaVersion, CHECKAPI_NONE)) {
// plugin is valid
- p->pclass |= ((bIsDb ? PCLASS_DB : PCLASS_OK) | PCLASS_BASICAPI);
+ p->pclass |= ((bIsDb ? PCLASS_DB : PCLASS_CRYPT) | PCLASS_BASICAPI);
// copy the dblink stuff
p->bpi = bpi;
@@ -849,7 +849,7 @@ void UnloadNewPluginsModule(void) // unload everything but the DB
for (int i = pluginList.getCount()-1; i >= 0; i--) {
pluginEntry* p = pluginList[i];
- if ( !(p->pclass & PCLASS_DB) && p != pluginList_crshdmp)
+ if (!(p->pclass & (PCLASS_DB | PCLASS_CRYPT)) && p != pluginList_crshdmp)
Plugin_Uninit(p);
}
diff --git a/src/modules/plugins/plugins.h b/src/modules/plugins/plugins.h index 72e3087f4a..2b7adb7f9b 100644 --- a/src/modules/plugins/plugins.h +++ b/src/modules/plugins/plugins.h @@ -37,6 +37,7 @@ struct BASIC_PLUGIN_INFO #define PCLASS_CLIST 0x80 // a CList implementation
#define PCLASS_SERVICE 0x100 // has Service Mode implementation
#define PCLASS_CORE 0x200 // a plugin from the /Core directory
+#define PCLASS_CRYPT 0x400 // crypto provider
struct pluginEntry
{
|