summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2008-02-19 17:19:44 +0000
committerChristian Pointner <equinox@anytun.org>2008-02-19 17:19:44 +0000
commit3a98fb2934af5f0f7c70fba7ac27a638f06ff69c (patch)
tree6f594c970e689411518b2c3c25f27394b37e495b
parentminor changes (diff)
minor changes
-rw-r--r--cypher.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/cypher.cpp b/cypher.cpp
index d8998bb..7652bff 100644
--- a/cypher.cpp
+++ b/cypher.cpp
@@ -72,7 +72,7 @@ AesIcmCypher::AesIcmCypher() : salt_(Buffer(14)) // Q@NINE 14??????
// TODO: hardcoded keysize!!!!!
err = gcry_cipher_open( &cipher_, GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_CTR, 0 );
if( err )
- cLog.msg(Log::PRIO_CRIT) << "AesIcmCypher::AesIcmCypher: Failed to open cypher";
+ cLog.msg(Log::PRIO_CRIT) << "AesIcmCypher::AesIcmCypher: Failed to open cipher";
}
@@ -109,21 +109,26 @@ void AesIcmCypher::cypher(u_int8_t * out, u_int8_t * in, u_int32_t length, seq_
// // IV = (k_s * 2^16) XOR (SSRC * 2^64) XOR (i * 2^16)
// // sizeof(k_s) = 112 bit, random
- Mpi iv(128);
+ Mpi iv(128); // TODO: hardcoded size
Mpi salt = Mpi(salt_.getBuf(), salt_.getLength());
Mpi sid = sender_id;
Mpi seq = seq_nr;
- iv = salt.mul2exp(16) ^ sid.mul2exp(64) ^ seq.mul2exp(16);
+ iv = salt.mul2exp(16) ^ sid.mul2exp(64) ^ seq.mul2exp(16); // TODO: hardcoded size
- u_int8_t *iv_buf = iv.getNewBuf(16);
- err = gcry_cipher_setiv( cipher_, iv_buf, 16 );
+ u_int8_t *iv_buf = iv.getNewBuf(16); // TODO: hardcoded size
+
+ // Q@NINE -> CTR Mode -> gcry_cipher_setctr() ????
+
+ err = gcry_cipher_setiv( cipher_, iv_buf, 16 ); // TODO: hardcoded size
delete[] iv_buf;
if( err ) {
cLog.msg(Log::PRIO_ERR) << "AesIcmCypher: Failed to set cipher IV: " << gpg_strerror( err );
return;
}
+ // Q@NINE -> reset clears IV ????
+
err = gcry_cipher_reset( cipher_ );
if( err ) {
cLog.msg(Log::PRIO_ERR) << "AesIcmCypher: Failed to reset cipher: " << gpg_strerror( err );