summaryrefslogtreecommitdiff
path: root/src/keyDerivation.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/keyDerivation.h')
-rw-r--r--src/keyDerivation.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/keyDerivation.h b/src/keyDerivation.h
index ea5f359..5b40a70 100644
--- a/src/keyDerivation.h
+++ b/src/keyDerivation.h
@@ -67,8 +67,10 @@ typedef struct {
class KeyDerivation
{
public:
- KeyDerivation() : is_initialized_(false), ld_kdr_(0), key_length_(0), master_salt_(0), master_key_(0) {};
- KeyDerivation(u_int16_t key_length) : is_initialized_(false), ld_kdr_(0), key_length_(key_length), master_salt_(0), master_key_(0) {};
+ KeyDerivation() : is_initialized_(false), ld_kdr_(0), anytun02_compat_(false), key_length_(0), master_salt_(0), master_key_(0) {};
+ KeyDerivation(bool a) : is_initialized_(false), ld_kdr_(0), anytun02_compat_(a), key_length_(0), master_salt_(0), master_key_(0) {};
+ KeyDerivation(u_int16_t key_length) : is_initialized_(false), ld_kdr_(0), anytun02_compat_(false), key_length_(key_length), master_salt_(0), master_key_(0) {};
+ KeyDerivation(bool a, u_int16_t key_length) : is_initialized_(false), ld_kdr_(0), anytun02_compat_(a), key_length_(key_length), master_salt_(0), master_key_(0) {};
virtual ~KeyDerivation() {};
void setLogKDRate(const int8_t ld_rate);
@@ -101,6 +103,7 @@ protected:
bool is_initialized_;
int8_t ld_kdr_; // ld(key_derivation_rate)
+ bool anytun02_compat_;
u_int16_t key_length_;
SyncBuffer master_salt_;
SyncBuffer master_key_;
@@ -142,7 +145,9 @@ class AesIcmKeyDerivation : public KeyDerivation
{
public:
AesIcmKeyDerivation();
+ AesIcmKeyDerivation(bool a);
AesIcmKeyDerivation(u_int16_t key_length);
+ AesIcmKeyDerivation(bool a, u_int16_t key_length);
~AesIcmKeyDerivation();
static const u_int16_t DEFAULT_KEY_LENGTH = 128;
@@ -184,14 +189,12 @@ private:
u_int8_t buf_[SALT_LENGTH];
u_int16_t zero_;
} salt_;
-#ifndef ANYTUN_02_COMPAT
struct ATTR_PACKED {
u_int8_t fill_[SALT_LENGTH - sizeof(u_int8_t) - sizeof(seq_nr_t)];
u_int8_t label_;
seq_nr_t r_;
u_int16_t zero_;
- } params_;
-#else
+ } params_compat_;
struct ATTR_PACKED {
u_int8_t fill_[SALT_LENGTH - sizeof(u_int8_t) - 2 - sizeof(seq_nr_t)];
u_int8_t label_;
@@ -199,7 +202,6 @@ private:
seq_nr_t r_;
u_int16_t zero_;
} params_;
-#endif
} ctr_[2];
#ifdef _MSC_VER
#pragma pack(pop)