Removed Themida

This commit is contained in:
MindL0ve
2026-01-31 23:46:32 +03:00
parent eb4dd129b9
commit 4a85743893
2 changed files with 2 additions and 37 deletions

View File

@@ -32,11 +32,6 @@
#include <shacal2.h>
#include <skipjack.h>
#include <tea.h>
#ifdef __THEMIDA__
#include <ThemidaSDK.h>
#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;
}

View File

@@ -10,7 +10,6 @@
// Forward declaration
class KeyAgreement;
//THEMIDA
// Communication channel encryption handler.
class Cipher {
public: