summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/keyDerivation.cpp6
-rw-r--r--src/keyDerivation.h5
2 files changed, 6 insertions, 5 deletions
diff --git a/src/keyDerivation.cpp b/src/keyDerivation.cpp
index 75ebe02..5b4f7a6 100644
--- a/src/keyDerivation.cpp
+++ b/src/keyDerivation.cpp
@@ -90,6 +90,7 @@ void AesIcmKeyDerivation::init(Buffer key, Buffer salt)
{
WritersLock lock(mutex_);
+ is_initialized_ = false;
master_salt_ = SyncBuffer(salt);
master_key_ = SyncBuffer(key);
@@ -145,6 +146,7 @@ void AesIcmKeyDerivation::updateMasterKey()
}
}
#endif
+ is_initialized_ = true;
}
std::string AesIcmKeyDerivation::printType()
@@ -183,10 +185,8 @@ bool AesIcmKeyDerivation::generate(kd_dir_t dir, satp_prf_label_t label, seq_nr_
{
ReadersLock lock(mutex_);
-#ifndef USE_SSL_CRYPTO
- if(!handle_[dir])
+ if(!is_initialized_)
return false;
-#endif
seq_nr_t r;
calcCtr(dir, &r, label, seq_nr);
diff --git a/src/keyDerivation.h b/src/keyDerivation.h
index f977922..5d433ca 100644
--- a/src/keyDerivation.h
+++ b/src/keyDerivation.h
@@ -67,8 +67,8 @@ typedef struct {
class KeyDerivation
{
public:
- KeyDerivation() : ld_kdr_(0), key_length_(0), master_salt_(0), master_key_(0) {};
- KeyDerivation(u_int16_t key_length) : ld_kdr_(0), key_length_(key_length), master_salt_(0), master_key_(0) {};
+ 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) {};
virtual ~KeyDerivation() {};
void setLogKDRate(const int8_t ld_rate);
@@ -94,6 +94,7 @@ protected:
updateMasterKey();
}
+ bool is_initialized_;
int8_t ld_kdr_; // ld(key_derivation_rate)
u_int16_t key_length_;
SyncBuffer master_salt_;