summaryrefslogtreecommitdiff
path: root/keyDerivation.cpp
diff options
context:
space:
mode:
authorErwin Nindl <nine@wirdorange.org>2007-12-11 12:24:54 +0000
committerErwin Nindl <nine@wirdorange.org>2007-12-11 12:24:54 +0000
commit7a707064d7d212cd4f2fbb7e90720cb3893686d1 (patch)
tree0210b6a13d458d6adcf38e093198aa3376ad7763 /keyDerivation.cpp
parentfixed Makefile, ip detection (diff)
fixes in mpi class, keyderivation iv generation
Diffstat (limited to 'keyDerivation.cpp')
-rw-r--r--keyDerivation.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/keyDerivation.cpp b/keyDerivation.cpp
index b068c0c..3c25ae3 100644
--- a/keyDerivation.cpp
+++ b/keyDerivation.cpp
@@ -101,7 +101,7 @@ void KeyDerivation::generate(satp_prf_label label, seq_nr_t seq_nr, Buffer& key,
gcry_error_t err;
Mpi r;
- Mpi key_id;
+ Mpi key_id(128);
Mpi iv(128);
// see at: http://tools.ietf.org/html/rfc3711#section-4.3
@@ -118,7 +118,7 @@ void KeyDerivation::generate(satp_prf_label label, seq_nr_t seq_nr, Buffer& key,
// FIXXME: kdr can be greater than 2^32 (= 2^48)
r = static_cast<long unsigned int>(seq_nr / ( 0x01 << ld_kdr_ ));
- r.rShift(8);
+ r = r.mul2exp(8);
key_id = r + Mpi(static_cast<long unsigned int>(label));
Mpi salt = Mpi(salt_.getBuf(), salt_.getLength());
@@ -127,7 +127,6 @@ void KeyDerivation::generate(satp_prf_label label, seq_nr_t seq_nr, Buffer& key,
err = gcry_cipher_reset( cipher_ );
if( err )
cLog.msg(Log::PRIO_ERR) << "KeyDerivation::generate: Failed to reset cipher: " << gpg_strerror( err );
-
err = gcry_cipher_setiv( cipher_ , iv.getBuf().getBuf(), iv.getBuf().getLength());
if( err )