summaryrefslogtreecommitdiff
path: root/src/keyDerivation.h
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-01-18 02:06:11 +0000
committerChristian Pointner <equinox@anytun.org>2009-01-18 02:06:11 +0000
commitf6d182bc21651b2040577754471db2d1870b54c0 (patch)
tree5332e33420c35f408c42a54e4b9c4bbbe8f84f63 /src/keyDerivation.h
parentenabled 128,192 and 256 bit keys for cipher and key derivation (diff)
added passphrase support to key derivation
Diffstat (limited to 'src/keyDerivation.h')
-rw-r--r--src/keyDerivation.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/keyDerivation.h b/src/keyDerivation.h
index 926d35f..518a498 100644
--- a/src/keyDerivation.h
+++ b/src/keyDerivation.h
@@ -73,7 +73,7 @@ public:
void setLogKDRate(const int8_t ld_rate);
- virtual void init(Buffer key, Buffer salt) = 0;
+ virtual void init(Buffer key, Buffer salt, std::string passphrase = "") = 0;
virtual bool generate(kd_dir_t dir, satp_prf_label_t label, seq_nr_t seq_nr, Buffer& key) = 0;
virtual std::string printType() { return "GenericKeyDerivation"; };
@@ -81,6 +81,11 @@ public:
protected:
virtual void updateMasterKey() = 0;
+#ifndef NO_PASSPHRASE
+ void calcMasterKey(std::string passphrase, u_int16_t length);
+ void calcMasterSalt(std::string passphrase, u_int16_t length);
+#endif
+
KeyDerivation(const KeyDerivation & src);
friend class boost::serialization::access;
template<class Archive>
@@ -113,7 +118,7 @@ public:
NullKeyDerivation() {};
~NullKeyDerivation() {};
- void init(Buffer key, Buffer salt) {};
+ void init(Buffer key, Buffer salt, std::string passphrase = "") {};
bool generate(kd_dir_t dir, satp_prf_label_t label, seq_nr_t seq_nr, Buffer& key);
std::string printType() { return "NullKeyDerivation"; };
@@ -144,7 +149,7 @@ public:
static const u_int16_t CTR_LENGTH = 16;
static const u_int16_t SALT_LENGTH = 14;
- void init(Buffer key, Buffer salt);
+ void init(Buffer key, Buffer salt, std::string passphrase = "");
bool generate(kd_dir_t dir, satp_prf_label_t label, seq_nr_t seq_nr, Buffer& key);
std::string printType();