summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/CryptoPP/src/cpp_cntx.cpp2
-rw-r--r--plugins/CryptoPP/src/cpp_misc.cpp2
-rw-r--r--plugins/CryptoPP/src/cpp_rsam.cpp14
3 files changed, 8 insertions, 10 deletions
diff --git a/plugins/CryptoPP/src/cpp_cntx.cpp b/plugins/CryptoPP/src/cpp_cntx.cpp
index c4d2c46338..f0f1c2d96b 100644
--- a/plugins/CryptoPP/src/cpp_cntx.cpp
+++ b/plugins/CryptoPP/src/cpp_cntx.cpp
@@ -27,7 +27,6 @@ HANDLE __cdecl cpp_create_context(int mode) {
// delete context
void __cdecl cpp_delete_context(HANDLE context) {
-
pCNTX tmp = get_context_on_id(context);
if (tmp) { // помечаем на удаление
cpp_free_keys(tmp);
@@ -38,7 +37,6 @@ void __cdecl cpp_delete_context(HANDLE context) {
// reset context
void __cdecl cpp_reset_context(HANDLE context) {
-
pCNTX tmp = get_context_on_id(context);
if (tmp) cpp_free_keys(tmp);
}
diff --git a/plugins/CryptoPP/src/cpp_misc.cpp b/plugins/CryptoPP/src/cpp_misc.cpp
index 5e5720df18..28d89f7cde 100644
--- a/plugins/CryptoPP/src/cpp_misc.cpp
+++ b/plugins/CryptoPP/src/cpp_misc.cpp
@@ -19,7 +19,7 @@ int __cdecl cpp_get_version(void) {
BOOL cpp_get_simdata(HANDLE context, pCNTX *ptr, pSIMDATA *p) {
- *ptr = get_context_on_id(context);
+ *ptr = get_context_on_id(context); if (!ptr) return 0;
// if (!*ptr || !(*ptr)->pdata || (*ptr)->mode&(MODE_PGP|MODE_GPG|MODE_RSA)) return FALSE;
if (!*ptr || (*ptr)->mode&(MODE_PGP|MODE_GPG|MODE_RSA)) return FALSE;
*p = (pSIMDATA) cpp_alloc_pdata(*ptr);
diff --git a/plugins/CryptoPP/src/cpp_rsam.cpp b/plugins/CryptoPP/src/cpp_rsam.cpp
index 36dacf7e0b..e8b68986ed 100644
--- a/plugins/CryptoPP/src/cpp_rsam.cpp
+++ b/plugins/CryptoPP/src/cpp_rsam.cpp
@@ -90,7 +90,7 @@ pRSAPRIV rsa_gen_keys(HANDLE context) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_gen_keys: %d", context);
#endif
- pCNTX ptr = get_context_on_id(context);
+ pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
pRSAPRIV r = (pRSAPRIV) ptr->pdata;
string priv, pub;
@@ -115,7 +115,7 @@ pRSAPRIV rsa_gen_keys(HANDLE context) {
pRSAPRIV rsa_get_priv(pCNTX ptr) {
- pCNTX p = get_context_on_id(hRSA4096);
+ pCNTX p = get_context_on_id(hRSA4096); if (!p) return 0;
pRSAPRIV r = (pRSAPRIV) p->pdata;
return r;
}
@@ -135,7 +135,7 @@ int __cdecl rsa_get_keypair(short mode, PBYTE privKey, int* privKeyLen, PBYTE pu
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_get_keypair: %d", mode);
#endif
- pCNTX ptr = get_context_on_id(hRSA4096);
+ pCNTX ptr = get_context_on_id(hRSA4096); if (!ptr) return 0;
pRSAPRIV r = (pRSAPRIV) ptr->pdata;
*privKeyLen = r->priv_k.length(); if ( privKey ) r->priv_k.copy((char*)privKey, *privKeyLen);
@@ -149,7 +149,7 @@ int __cdecl rsa_get_keyhash(short mode, PBYTE privKey, int* privKeyLen, PBYTE pu
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_get_keyhash: %d", mode);
#endif
- pCNTX ptr = get_context_on_id(hRSA4096);
+ pCNTX ptr = get_context_on_id(hRSA4096); if (!ptr) return 0;
pRSAPRIV r = (pRSAPRIV) ptr->pdata;
if ( privKey ) { *privKeyLen = r->priv_s.length(); r->priv_s.copy((char*)privKey, *privKeyLen); }
@@ -163,7 +163,7 @@ int __cdecl rsa_set_keypair(short mode, PBYTE privKey, int privKeyLen) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_set_keypair: %s", privKey);
#endif
- pCNTX ptr = get_context_on_id(hRSA4096);
+ pCNTX ptr = get_context_on_id(hRSA4096); if (!ptr) return 0;
pRSAPRIV r = (pRSAPRIV) ptr->pdata;
if ( privKey && privKeyLen ) {
@@ -943,7 +943,7 @@ int __cdecl rsa_export_keypair(short mode, LPSTR privKey, LPSTR pubKey, LPSTR pa
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_export_keypair: %d", mode);
#endif
- pCNTX ptr = get_context_on_id(hRSA4096);
+ pCNTX ptr = get_context_on_id(hRSA4096); if (!ptr) return 0;
pRSAPRIV r = (pRSAPRIV) ptr->pdata;
if ( pubKey ) {
@@ -986,7 +986,7 @@ int __cdecl rsa_import_keypair(short mode, LPSTR privKey, LPSTR passPhrase) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_import_keypair: %d", mode);
#endif
- pCNTX ptr = get_context_on_id(hRSA4096);
+ pCNTX ptr = get_context_on_id(hRSA4096); if (!ptr) return 0;
pRSAPRIV r = (pRSAPRIV) ptr->pdata;
if ( !passPhrase ) return 0;