From 36818c9c84cce676b9ec6533807b7a33e03902a0 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Wed, 22 Jul 2015 15:37:17 +0000 Subject: SecureIM: vc2015 compilation fix git-svn-id: http://svn.miranda-ng.org/main/trunk@14634 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SecureIM/src/crypt_check.cpp | 2 +- plugins/SecureIM/src/main.cpp | 10 +++++----- plugins/SecureIM/src/options.cpp | 18 +++++++++--------- plugins/SecureIM/src/svcs_clist.cpp | 2 +- plugins/SecureIM/src/svcs_proto.cpp | 22 +++++++++++----------- plugins/SecureIM/src/svcs_rsa.cpp | 10 +++++----- plugins/SecureIM/src/svcs_rsa.h | 2 +- 7 files changed, 33 insertions(+), 33 deletions(-) (limited to 'plugins') diff --git a/plugins/SecureIM/src/crypt_check.cpp b/plugins/SecureIM/src/crypt_check.cpp index ae19be8d5f..67b80e507b 100644 --- a/plugins/SecureIM/src/crypt_check.cpp +++ b/plugins/SecureIM/src/crypt_check.cpp @@ -52,7 +52,7 @@ BYTE isContactSecured(MCONTACT hContact) break; case MODE_RSAAES: - if (exp->rsa_get_state(p->cntx) == 7) res |= SECURED; + if (mir_exp->rsa_get_state(p->cntx) == 7) res |= SECURED; break; case MODE_RSA: diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 4e6e31cdb9..e5fcdd8439 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -79,24 +79,24 @@ static int onModulesLoaded(WPARAM, LPARAM) // RSA/AES Sent_NetLog("rsa_init"); - rsa_init(&exp, &imp); + rsa_init(&mir_exp, &imp); DBVARIANT dbv; dbv.type = DBVT_BLOB; if (db_get(0, MODULENAME, "rsa_priv", &dbv) == 0) { - exp->rsa_set_keypair(CPP_MODE_RSA_4096, dbv.pbVal, dbv.cpbVal); + mir_exp->rsa_set_keypair(CPP_MODE_RSA_4096, dbv.pbVal, dbv.cpbVal); db_free(&dbv); rsa_4096 = 1; } else if (db_get(0, MODULENAME, "rsa_priv_4096", &dbv) == 0) { - exp->rsa_set_keypair(CPP_MODE_RSA_4096 | CPP_MODE_RSA_BER, dbv.pbVal, dbv.cpbVal); + mir_exp->rsa_set_keypair(CPP_MODE_RSA_4096 | CPP_MODE_RSA_BER, dbv.pbVal, dbv.cpbVal); db_free(&dbv); char priv_key[4096]; int priv_len; char pub_key[4096]; int pub_len; - exp->rsa_get_keypair(CPP_MODE_RSA_4096, (PBYTE)&priv_key, &priv_len, (PBYTE)&pub_key, &pub_len); + mir_exp->rsa_get_keypair(CPP_MODE_RSA_4096, (PBYTE)&priv_key, &priv_len, (PBYTE)&pub_key, &pub_len); db_set_blob(NULL, MODULENAME, "rsa_priv", priv_key, priv_len); db_set_blob(NULL, MODULENAME, "rsa_pub", &pub_key, pub_len); db_unset(NULL, MODULENAME, "rsa_priv_2048"); @@ -107,7 +107,7 @@ static int onModulesLoaded(WPARAM, LPARAM) if (!rsa_4096) mir_forkthread(sttGenerateRSA, NULL); - exp->rsa_set_timeout(db_get_w(0, MODULENAME, "ket", 10)); + mir_exp->rsa_set_timeout(db_get_w(0, MODULENAME, "ket", 10)); Sent_NetLog("pgp_init"); diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 60beb05651..c1769cbd80 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -315,7 +315,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR } if (ptr->keyLoaded) { LPSTR buffer = (LPSTR)alloca(RSASIZE); - exp->rsa_export_pubkey(ptr->cntx, buffer); + mir_exp->rsa_export_pubkey(ptr->cntx, buffer); if (!SaveExportRSAKeyDlg(hDlg, buffer, 0)) msgbox(hDlg, sim114, MODULENAME, MB_OK | MB_ICONEXCLAMATION); } @@ -329,9 +329,9 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR createRSAcntx(ptr); LPSTR pub = (LPSTR)alloca(RSASIZE); if (!LoadImportRSAKeyDlg(hDlg, pub, 0)) return TRUE; - if (exp->rsa_import_pubkey(ptr->cntx, pub)) { + if (mir_exp->rsa_import_pubkey(ptr->cntx, pub)) { int len; - exp->rsa_get_pubkey(ptr->cntx, (PBYTE)pub, &len); + mir_exp->rsa_get_pubkey(ptr->cntx, (PBYTE)pub, &len); db_set_blob(ptr->hContact, MODULENAME, "rsa_pub", pub, len); setListViewPUB(hLV, idx, 1); @@ -525,7 +525,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM case IDC_RSA_EXP: { LPSTR pub = (LPSTR)alloca(RSASIZE); - exp->rsa_export_keypair(CPP_MODE_RSA, NULL, pub, NULL); + mir_exp->rsa_export_keypair(CPP_MODE_RSA, NULL, pub, NULL); if (!SaveExportRSAKeyDlg(hDlg, pub, 0)) msgbox(hDlg, sim114, MODULENAME, MB_OK | MB_ICONEXCLAMATION); } @@ -537,7 +537,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM int res = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PASSPHRASE), NULL, DlgProcSetPassphrase, (LPARAM)passphrase); if (res == IDOK) { LPSTR priv = (LPSTR)alloca(RSASIZE); - exp->rsa_export_keypair(CPP_MODE_RSA, priv, NULL, passphrase); + mir_exp->rsa_export_keypair(CPP_MODE_RSA, priv, NULL, passphrase); if (!SaveExportRSAKeyDlg(hDlg, priv, 1)) msgbox(hDlg, sim112, MODULENAME, MB_OK | MB_ICONEXCLAMATION); } @@ -553,7 +553,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM LPSTR passphrase = (LPSTR)alloca(RSASIZE); int res = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PASSPHRASE), NULL, DlgProcSetPassphrase, (LPARAM)passphrase); if (res == IDOK) { - if (!exp->rsa_import_keypair(CPP_MODE_RSA, priv, passphrase)) + if (!mir_exp->rsa_import_keypair(CPP_MODE_RSA, priv, passphrase)) msgbox(hDlg, sim113, MODULENAME, MB_OK | MB_ICONEXCLAMATION); else // обновить SHA1 значение RefreshProtoDlg(hDlg); @@ -1025,7 +1025,7 @@ void RefreshProtoDlg(HWND hDlg) EnableWindow(GetDlgItem(hDlg, IDC_SPLITON), false); EnableWindow(GetDlgItem(hDlg, IDC_SPLITOFF), false); - BYTE sha[64]; int len; exp->rsa_get_keyhash(CPP_MODE_RSA, NULL, NULL, (PBYTE)&sha, &len); + BYTE sha[64]; int len; mir_exp->rsa_get_keyhash(CPP_MODE_RSA, NULL, NULL, (PBYTE)&sha, &len); LPSTR txt = mir_strdup(to_hex(sha, len)); SetDlgItemText(hDlg, IDC_RSA_SHA, txt); mir_free(txt); @@ -1216,7 +1216,7 @@ void ApplyGeneralSettings(HWND hDlg) GetDlgItemText(hDlg, IDC_KET, timeout, 5); tmp = atoi(timeout); if (tmp > 65535) tmp = 65535; db_set_w(0, MODULENAME, "ket", tmp); - exp->rsa_set_timeout(db_get_w(0, MODULENAME, "ket", 10)); + mir_exp->rsa_set_timeout(db_get_w(0, MODULENAME, "ket", 10)); mir_itoa(tmp, timeout, 10); SetDlgItemText(hDlg, IDC_KET, timeout); @@ -1445,7 +1445,7 @@ void setListViewPUB(HWND hLV, UINT iItem, UINT iStatus) pUinKey ptr = (pUinKey)getListViewParam(hLV, iItem); if (db_get(ptr->hContact, MODULENAME, "rsa_pub", &dbv) == 0) { int len; - exp->rsa_get_hash((PBYTE)dbv.pbVal, dbv.cpbVal, (PBYTE)str, &len); + mir_exp->rsa_get_hash((PBYTE)dbv.pbVal, dbv.cpbVal, (PBYTE)str, &len); sha = mir_strdup(to_hex((PBYTE)str, len)); db_free(&dbv); } diff --git a/plugins/SecureIM/src/svcs_clist.cpp b/plugins/SecureIM/src/svcs_clist.cpp index 5d1a565565..16ef2f9339 100644 --- a/plugins/SecureIM/src/svcs_clist.cpp +++ b/plugins/SecureIM/src/svcs_clist.cpp @@ -15,7 +15,7 @@ int __cdecl onContactSettingChanged(WPARAM hContact, LPARAM lParam) showPopupDC(hContact); // show popup "Disabled" ShowStatusIconNotify(hContact); // change icon in CL } - else if (ptr->mode == MODE_RSAAES && exp->rsa_get_state(ptr->cntx) == 7) { + else if (ptr->mode == MODE_RSAAES && mir_exp->rsa_get_state(ptr->cntx) == 7) { deleteRSAcntx(ptr); showPopupDC(hContact); // show popup "Disabled" ShowStatusIconNotify(hContact); // change icon in CL diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp index f9e690f68a..00ae0afdf7 100644 --- a/plugins/SecureIM/src/svcs_proto.cpp +++ b/plugins/SecureIM/src/svcs_proto.cpp @@ -99,7 +99,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) } else { createRSAcntx(ptr); - exp->rsa_disabled(ptr->cntx); + mir_exp->rsa_disabled(ptr->cntx); deleteRSAcntx(ptr); } SAFE_FREE(ptr->msgSplitted); @@ -188,11 +188,11 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) } createRSAcntx(ptr); loadRSAkey(ptr); - if (exp->rsa_get_state(ptr->cntx) == 0) + if (mir_exp->rsa_get_state(ptr->cntx) == 0) showPopupKR(ptr->hContact); { - LPSTR szOldMsg = exp->rsa_recv(ptr->cntx, szEncMsg); + LPSTR szOldMsg = mir_exp->rsa_recv(ptr->cntx, szEncMsg); if (!szOldMsg) return 1; // don't display it ... @@ -334,7 +334,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) resetRSAcntx(ptr); loadRSAkey(ptr); - exp->rsa_connect(ptr->cntx); + mir_exp->rsa_connect(ptr->cntx); showPopupKS(ccs->hContact); ShowStatusIconNotify(ccs->hContact); @@ -515,7 +515,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) // contact is offline if (stat == ID_STATUS_OFFLINE) { if (ptr->cntx) { - if (exp->rsa_get_state(ptr->cntx) != 0) + if (mir_exp->rsa_get_state(ptr->cntx) != 0) resetRSAcntx(ptr); } else createRSAcntx(ptr); @@ -530,7 +530,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) } // шлем шифрованное в оффлайн - exp->rsa_send(ptr->cntx, ptrA(miranda_to_utf8((LPCSTR)ccs->lParam, ccs->wParam))); + mir_exp->rsa_send(ptr->cntx, ptrA(miranda_to_utf8((LPCSTR)ccs->lParam, ccs->wParam))); showPopupSM(ptr->hContact); return returnNoError(ccs->hContact); } @@ -538,7 +538,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) // SecureIM connection with this contact is disabled if (stid == STATUS_DISABLED) { if (ptr->cntx) { - exp->rsa_disabled(ptr->cntx); + mir_exp->rsa_disabled(ptr->cntx); deleteRSAcntx(ptr); } @@ -552,7 +552,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) // разорвать соединение if (ssig == SiG_DEIN) { if (ptr->cntx) { - exp->rsa_disconnect(ptr->cntx); + mir_exp->rsa_disconnect(ptr->cntx); deleteRSAcntx(ptr); } ShowStatusIconNotify(ptr->hContact); @@ -561,8 +561,8 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) } // соединение установлено - if (ptr->cntx && exp->rsa_get_state(ptr->cntx) == 7) { - exp->rsa_send(ptr->cntx, ptrA(miranda_to_utf8((LPCSTR)ccs->lParam, ccs->wParam))); + if (ptr->cntx && mir_exp->rsa_get_state(ptr->cntx) == 7) { + mir_exp->rsa_send(ptr->cntx, ptrA(miranda_to_utf8((LPCSTR)ccs->lParam, ccs->wParam))); ShowStatusIconNotify(ptr->hContact); showPopupSM(ptr->hContact); return returnNoError(ccs->hContact); @@ -582,7 +582,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) if (ssig == SiG_INIT) { createRSAcntx(ptr); loadRSAkey(ptr); - exp->rsa_connect(ptr->cntx); + mir_exp->rsa_connect(ptr->cntx); showPopupKS(ccs->hContact); ShowStatusIconNotify(ccs->hContact); return returnNoError(ccs->hContact); diff --git a/plugins/SecureIM/src/svcs_rsa.cpp b/plugins/SecureIM/src/svcs_rsa.cpp index 63e3e2455a..e60c19430a 100644 --- a/plugins/SecureIM/src/svcs_rsa.cpp +++ b/plugins/SecureIM/src/svcs_rsa.cpp @@ -1,6 +1,6 @@ #include "commonheaders.h" -pRSA_EXPORT exp = NULL; +pRSA_EXPORT mir_exp = NULL; RSA_IMPORT imp = { rsa_inject, @@ -45,7 +45,7 @@ int __cdecl rsa_check_pub(HANDLE context, PBYTE pub, int pubLen, PBYTE sig, int if (db_get(ptr->hContact, MODULENAME, "rsa_pub", &dbv) == 0) { k = 1; PBYTE buf = (PBYTE)alloca(sigLen); int len; - exp->rsa_get_hash((PBYTE)dbv.pbVal, dbv.cpbVal, (PBYTE)buf, &len); + mir_exp->rsa_get_hash((PBYTE)dbv.pbVal, dbv.cpbVal, (PBYTE)buf, &len); sha_old = mir_strdup(to_hex(buf, len)); db_free(&dbv); } @@ -148,8 +148,8 @@ void sttGenerateRSA(LPVOID) char priv_key[4096]; int priv_len; char pub_key[4096]; int pub_len; - exp->rsa_gen_keypair(CPP_MODE_RSA_4096); - exp->rsa_get_keypair(CPP_MODE_RSA_4096, (PBYTE)&priv_key, &priv_len, (PBYTE)&pub_key, &pub_len); + mir_exp->rsa_gen_keypair(CPP_MODE_RSA_4096); + mir_exp->rsa_get_keypair(CPP_MODE_RSA_4096, (PBYTE)&priv_key, &priv_len, (PBYTE)&pub_key, &pub_len); db_set_blob(NULL, MODULENAME, "rsa_priv", priv_key, priv_len); db_set_blob(NULL, MODULENAME, "rsa_pub", pub_key, pub_len); @@ -163,7 +163,7 @@ BYTE loadRSAkey(pUinKey ptr) DBVARIANT dbv; dbv.type = DBVT_BLOB; if (db_get(ptr->hContact, MODULENAME, "rsa_pub", &dbv) == 0) { - ptr->keyLoaded = exp->rsa_set_pubkey(ptr->cntx, dbv.pbVal, dbv.cpbVal); + ptr->keyLoaded = mir_exp->rsa_set_pubkey(ptr->cntx, dbv.pbVal, dbv.cpbVal); Sent_NetLog("loadRSAkey %d", ptr->keyLoaded); db_free(&dbv); } diff --git a/plugins/SecureIM/src/svcs_rsa.h b/plugins/SecureIM/src/svcs_rsa.h index d054b48054..f076d3bd8b 100644 --- a/plugins/SecureIM/src/svcs_rsa.h +++ b/plugins/SecureIM/src/svcs_rsa.h @@ -1,7 +1,7 @@ #ifndef __SVCS_RSA_H__ #define __SVCS_RSA_H__ -extern pRSA_EXPORT exp; +extern pRSA_EXPORT mir_exp; extern RSA_IMPORT imp; extern BOOL rsa_4096; -- cgit v1.2.3