summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cipherFactory.cpp2
-rw-r--r--keyDerivation.h12
-rw-r--r--options.cpp17
-rw-r--r--options.h3
4 files changed, 31 insertions, 3 deletions
diff --git a/cipherFactory.cpp b/cipherFactory.cpp
index 4271600..5d7de85 100644
--- a/cipherFactory.cpp
+++ b/cipherFactory.cpp
@@ -39,7 +39,7 @@ Cipher* CipherFactory::create(std::string const& type)
{
if( type == "null" )
return new NullCipher();
- else if( type == "aes" )
+ else if( type == "aes-ctr" )
return new AesIcmCipher();
else
throw std::invalid_argument("cipher not available");
diff --git a/keyDerivation.h b/keyDerivation.h
index f660efa..6f52099 100644
--- a/keyDerivation.h
+++ b/keyDerivation.h
@@ -51,7 +51,7 @@ typedef enum {
class KeyDerivation
{
public:
- KeyDerivation() : ld_kdr_(0), master_salt_(0), cipher_(NULL) {};
+ KeyDerivation() : ld_kdr_(0), master_salt_(0), master_key_(0), cipher_(NULL) {};
virtual ~KeyDerivation();
void init(Buffer key, Buffer salt);
@@ -83,5 +83,15 @@ protected:
};
+class NullKeyDerivation
+{
+
+};
+
+class AesIcmKeyDerivation
+{
+
+};
+
#endif
diff --git a/options.cpp b/options.cpp
index 4803cd2..461e4f6 100644
--- a/options.cpp
+++ b/options.cpp
@@ -103,7 +103,8 @@ Options::Options()
ifconfig_param_local_ = "192.168.200.1";
ifconfig_param_remote_netmask_ = "255.255.255.0";
seq_window_size_ = 100;
- cipher_ = "aes";
+ cipher_ = "aes-ctr";
+ kd_prf_ = "aes-ctr";
auth_algo_ = "sha1";
}
@@ -134,6 +135,7 @@ bool Options::parse(int argc, char* argv[])
PARSE_SCALAR_PARAM2("-n","--ifconfig", ifconfig_param_local_, ifconfig_param_remote_netmask_)
PARSE_SCALAR_PARAM("-w","--window-size", seq_window_size_)
PARSE_SCALAR_PARAM("-c","--cipher", cipher_)
+ PARSE_SCALAR_PARAM("-k","--kd-prf", kd_prf_)
PARSE_SCALAR_PARAM("-a","--auth-algo", auth_algo_)
PARSE_SCALAR_CSLIST("-M","--sync-hosts", host_port_queue)
else
@@ -405,6 +407,19 @@ Options& Options::setCipher(std::string c)
return *this;
}
+std::string Options::getKdPrf()
+{
+ Lock lock(mutex);
+ return kd_prf_;
+}
+
+Options& Options::setKdPrf(std::string k)
+{
+ Lock lock(mutex);
+ kd_prf_ = k;
+ return *this;
+}
+
std::string Options::getAuthAlgo()
{
Lock lock(mutex);
diff --git a/options.h b/options.h
index 1c302c8..e0c1ac3 100644
--- a/options.h
+++ b/options.h
@@ -84,6 +84,8 @@ public:
Options& setSeqWindowSize(window_size_t s);
std::string getCipher();
Options& setCipher(std::string c);
+ std::string getKdPrf();
+ Options& setKdPrf(std::string k);
std::string getAuthAlgo();
Options& setAuthAlgo(std::string a);
ConnectToList getConnectTo();
@@ -108,6 +110,7 @@ private:
std::string ifconfig_param_remote_netmask_;
window_size_t seq_window_size_;
std::string cipher_;
+ std::string kd_prf_;
std::string auth_algo_;
};