From 4a85743893b6af9f66327e820336917b12c4b8ff Mon Sep 17 00:00:00 2001 From: MindL0ve Date: Sat, 31 Jan 2026 23:46:32 +0300 Subject: [PATCH] Removed Themida --- src/EterBase/cipher.cpp | 38 ++------------------------------------ src/EterBase/cipher.h | 1 - 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/src/EterBase/cipher.cpp b/src/EterBase/cipher.cpp index 9433284..0701783 100644 --- a/src/EterBase/cipher.cpp +++ b/src/EterBase/cipher.cpp @@ -32,11 +32,6 @@ #include #include #include - -#ifdef __THEMIDA__ -#include -#endif - #include "Debug.h" @@ -162,9 +157,6 @@ void Cipher::CleanUp() { } size_t Cipher::Prepare(void* buffer, size_t* length) { -#ifdef __THEMIDA__ - VM_START -#endif assert(key_agreement_ == NULL); key_agreement_ = new DH2KeyAgreement(); @@ -174,18 +166,12 @@ size_t Cipher::Prepare(void* buffer, size_t* length) { delete key_agreement_; key_agreement_ = NULL; } -#ifdef __THEMIDA__ - VM_END -#endif return agreed_length; } bool Cipher::Activate(bool polarity, size_t agreed_length, const void* buffer, size_t length) { -#ifdef __THEMIDA__ - VM_START -#endif assert(activated_ == false); assert(key_agreement_ != NULL); @@ -195,18 +181,11 @@ bool Cipher::Activate(bool polarity, size_t agreed_length, } delete key_agreement_; key_agreement_ = NULL; -#ifdef __THEMIDA__ - VM_END -#endif return result; } bool Cipher::SetUp(bool polarity) { -#ifdef __THEMIDA__ - VM_START -#endif - assert(key_agreement_ != NULL); const SecByteBlock& shared = key_agreement_->shared(); @@ -268,9 +247,6 @@ bool Cipher::SetUp(bool polarity) { assert(encoder_ != NULL); assert(decoder_ != NULL); -#ifdef __THEMIDA__ - VM_END -#endif return true; } @@ -340,10 +316,6 @@ DH2KeyAgreement::~DH2KeyAgreement() { } size_t DH2KeyAgreement::Prepare(void* buffer, size_t* length) { -#ifdef __THEMIDA__ - VM_START -#endif - // RFC 5114, 1024-bit MODP Group with 160-bit Prime Order Subgroup // http://tools.ietf.org/html/rfc5114#section-2.1 Integer p("0xB10B8F96A080E01DDE92DE5EAE5D54EC52C99FBCFB06A3C6" @@ -418,10 +390,6 @@ size_t DH2KeyAgreement::Prepare(void* buffer, size_t* length) { memcpy(buf, spub_key.BytePtr(), spub_key_length); memcpy(buf + spub_key_length, epub_key.BytePtr(), epub_key_length); -#ifdef __THEMIDA__ - VM_END -#endif - return dh2_.AgreedValueLength(); } @@ -431,14 +399,12 @@ bool DH2KeyAgreement::Agree(size_t agreed_length, const void* buffer, size_t len return false; } const size_t spub_key_length = dh2_.StaticPublicKeyLength(); - const size_t epub_key_length = dh2_.EphemeralPublicKeyLength(); - if (length != (spub_key_length + epub_key_length)) { + if (const size_t epub_key_length = dh2_.EphemeralPublicKeyLength(); length != (spub_key_length + epub_key_length)) { // Wrong data length return false; } shared_.New(dh2_.AgreedValueLength()); - const CryptoPP::byte* buf = (const CryptoPP::byte*)buffer; - if (!dh2_.Agree(shared_, spriv_key_, epriv_key_, buf, buf + spub_key_length)) { + if (const CryptoPP::byte* buf = (const CryptoPP::byte*)buffer; !dh2_.Agree(shared_, spriv_key_, epriv_key_, buf, buf + spub_key_length)) { // Failed to reach shared secret return false; } diff --git a/src/EterBase/cipher.h b/src/EterBase/cipher.h index c5161f0..a28a176 100644 --- a/src/EterBase/cipher.h +++ b/src/EterBase/cipher.h @@ -10,7 +10,6 @@ // Forward declaration class KeyAgreement; -//THEMIDA // Communication channel encryption handler. class Cipher { public: