summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mmap_SA
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-11-14 23:13:38 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-11-14 23:13:38 +0000
commitbd49c3201234f447a4fc951ea652532d973c07b1 (patch)
tree9ee40ab3181612ff138197c679090577a0c173e8 /plugins/Dbx_mmap_SA
parent5056234c898e593ba71a01659dbbcd70ca519d89 (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 'plugins/Dbx_mmap_SA')
-rw-r--r--plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj1
-rw-r--r--plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj.filters3
-rw-r--r--plugins/Dbx_mmap_SA/db3x_mmap_sa_11.vcxproj1
-rw-r--r--plugins/Dbx_mmap_SA/db3x_mmap_sa_11.vcxproj.filters3
-rw-r--r--plugins/Dbx_mmap_SA/db3x_mmap_sa_12.vcxproj1
-rw-r--r--plugins/Dbx_mmap_SA/db3x_mmap_sa_12.vcxproj.filters3
-rw-r--r--plugins/Dbx_mmap_SA/src/commonheaders.h1
-rw-r--r--plugins/Dbx_mmap_SA/src/security.cpp29
8 files changed, 22 insertions, 20 deletions
diff --git a/plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj b/plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj
index 5aa4e3f5d6..7a548ce305 100644
--- a/plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj
+++ b/plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj
@@ -194,6 +194,7 @@
<ClCompile Include="..\Db3x_mmap\src\database.cpp" />
<ClCompile Include="..\Db3x_mmap\src\dbcache.cpp" />
<ClCompile Include="..\Db3x_mmap\src\dbcontacts.cpp" />
+ <ClCompile Include="..\Db3x_mmap\src\dbcrypt.cpp" />
<ClCompile Include="..\Db3x_mmap\src\dbevents.cpp" />
<ClCompile Include="..\Db3x_mmap\src\dbheaders.cpp" />
<ClCompile Include="..\Db3x_mmap\src\dbintf.cpp" />
diff --git a/plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj.filters b/plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj.filters
index ecddf5d298..ab9907fdb9 100644
--- a/plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj.filters
+++ b/plugins/Dbx_mmap_SA/db3x_mmap_sa_10.vcxproj.filters
@@ -90,6 +90,9 @@
<ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\Db3x_mmap\src\dbcrypt.cpp">
+ <Filter>Mmap files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\commonheaders.h">
diff --git a/plugins/Dbx_mmap_SA/db3x_mmap_sa_11.vcxproj b/plugins/Dbx_mmap_SA/db3x_mmap_sa_11.vcxproj
index 211cd216f3..6f1fd99934 100644
--- a/plugins/Dbx_mmap_SA/db3x_mmap_sa_11.vcxproj
+++ b/plugins/Dbx_mmap_SA/db3x_mmap_sa_11.vcxproj
@@ -197,6 +197,7 @@
<ClCompile Include="..\Db3x_mmap\src\database.cpp" />
<ClCompile Include="..\Db3x_mmap\src\dbcache.cpp" />
<ClCompile Include="..\Db3x_mmap\src\dbcontacts.cpp" />
+ <ClCompile Include="..\Db3x_mmap\src\dbcrypt.cpp" />
<ClCompile Include="..\Db3x_mmap\src\dbevents.cpp" />
<ClCompile Include="..\Db3x_mmap\src\dbheaders.cpp" />
<ClCompile Include="..\Db3x_mmap\src\dbintf.cpp" />
diff --git a/plugins/Dbx_mmap_SA/db3x_mmap_sa_11.vcxproj.filters b/plugins/Dbx_mmap_SA/db3x_mmap_sa_11.vcxproj.filters
index ecddf5d298..ab9907fdb9 100644
--- a/plugins/Dbx_mmap_SA/db3x_mmap_sa_11.vcxproj.filters
+++ b/plugins/Dbx_mmap_SA/db3x_mmap_sa_11.vcxproj.filters
@@ -90,6 +90,9 @@
<ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\Db3x_mmap\src\dbcrypt.cpp">
+ <Filter>Mmap files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\commonheaders.h">
diff --git a/plugins/Dbx_mmap_SA/db3x_mmap_sa_12.vcxproj b/plugins/Dbx_mmap_SA/db3x_mmap_sa_12.vcxproj
index 5710d3c924..8168d59428 100644
--- a/plugins/Dbx_mmap_SA/db3x_mmap_sa_12.vcxproj
+++ b/plugins/Dbx_mmap_SA/db3x_mmap_sa_12.vcxproj
@@ -197,6 +197,7 @@
<ClCompile Include="..\Db3x_mmap\src\database.cpp" />
<ClCompile Include="..\Db3x_mmap\src\dbcache.cpp" />
<ClCompile Include="..\Db3x_mmap\src\dbcontacts.cpp" />
+ <ClCompile Include="..\Db3x_mmap\src\dbcrypt.cpp" />
<ClCompile Include="..\Db3x_mmap\src\dbevents.cpp" />
<ClCompile Include="..\Db3x_mmap\src\dbheaders.cpp" />
<ClCompile Include="..\Db3x_mmap\src\dbintf.cpp" />
diff --git a/plugins/Dbx_mmap_SA/db3x_mmap_sa_12.vcxproj.filters b/plugins/Dbx_mmap_SA/db3x_mmap_sa_12.vcxproj.filters
index ecddf5d298..ab9907fdb9 100644
--- a/plugins/Dbx_mmap_SA/db3x_mmap_sa_12.vcxproj.filters
+++ b/plugins/Dbx_mmap_SA/db3x_mmap_sa_12.vcxproj.filters
@@ -90,6 +90,9 @@
<ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\Db3x_mmap\src\dbcrypt.cpp">
+ <Filter>Mmap files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\commonheaders.h">
diff --git a/plugins/Dbx_mmap_SA/src/commonheaders.h b/plugins/Dbx_mmap_SA/src/commonheaders.h
index 87255bdc18..cfee1a77ae 100644
--- a/plugins/Dbx_mmap_SA/src/commonheaders.h
+++ b/plugins/Dbx_mmap_SA/src/commonheaders.h
@@ -39,6 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_langpack.h>
#include <m_options.h>
#include <m_skin.h>
+#include <m_crypto.h>
#include <m_folders.h>
diff --git a/plugins/Dbx_mmap_SA/src/security.cpp b/plugins/Dbx_mmap_SA/src/security.cpp
index 04d7c82b49..6d41787d24 100644
--- a/plugins/Dbx_mmap_SA/src/security.cpp
+++ b/plugins/Dbx_mmap_SA/src/security.cpp
@@ -69,37 +69,27 @@ void CDbxMmapSA::EncodeCopyMemory(void * dst, void * src, size_t size )
{
memcpy(dst, src, size);
- if (!m_bEncoding)
- return;
-
- CryptoEngine->EncryptMem((BYTE *)dst, (int)size, key);
+ if (m_bEncoding)
+ CryptoEngine->EncryptMem((BYTE *)dst, (int)size, key);
}
void CDbxMmapSA::DecodeCopyMemory(void * dst, void * src, size_t size )
{
memcpy(dst, src, size);
- if (!m_bEncoding)
- return;
-
- CryptoEngine->DecryptMem((BYTE *)dst, (int)size, key);
+ if (m_bEncoding)
+ CryptoEngine->DecryptMem((BYTE *)dst, (int)size, key);
}
void CDbxMmapSA::EncodeDBWrite(DWORD ofs, void *src, int size)
{
- if (m_bEncoding)
- {
- BYTE * buf;
-
- buf = (BYTE*)GlobalAlloc(GPTR, sizeof(BYTE)*size);
+ if (m_bEncoding) {
+ BYTE *buf = (BYTE*)GlobalAlloc(GPTR, sizeof(BYTE)*size);
EncodeCopyMemory(buf, src, size);
DBWrite(ofs, buf, (int)size);
GlobalFree(buf);
}
- else
- {
- DBWrite(ofs, src, (int)size);
- }
+ else DBWrite(ofs, src, (int)size);
}
void CDbxMmapSA::DecodeDBWrite(DWORD ofs, void *src, int size)
@@ -242,9 +232,8 @@ void CDbxMmapSA::EncryptDB()
return;
}
- if (SelectEncoder()) {
+ if (SelectEncoder())
return;
- }
bEncProcess = 1;
@@ -366,4 +355,4 @@ void CDbxMmapSA::ChangePwd()
zero_fill((BYTE *)newpass, sizeof newpass);
LeaveCriticalSection(&m_csDbAccess);
-} \ No newline at end of file
+}