From 64fd1fe78ec19feb8350eb709e85901b5688ae28 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 20 May 2008 13:16:52 +0000 Subject: bugfix with strerror_r - still not working but at least not using uninitialized data --- src/keyDerivation.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/keyDerivation.cpp') diff --git a/src/keyDerivation.cpp b/src/keyDerivation.cpp index eda2189..12ba5d8 100644 --- a/src/keyDerivation.cpp +++ b/src/keyDerivation.cpp @@ -72,6 +72,7 @@ void AesIcmKeyDerivation::updateMasterKey() gcry_error_t err = gcry_cipher_setkey( cipher_, master_key_.getBuf(), master_key_.getLength() ); if( err ) { char buf[STERROR_TEXT_MAX]; + buf[0] = 0; cLog.msg(Log::PRIO_ERR) << "KeyDerivation::updateMasterKey: Failed to set cipher key: " << gpg_strerror_r(err, buf, STERROR_TEXT_MAX); } } @@ -86,6 +87,7 @@ void AesIcmKeyDerivation::init(Buffer key, Buffer salt) gcry_error_t err = gcry_cipher_open( &cipher_, GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_CTR, 0 ); if( err ) { char buf[STERROR_TEXT_MAX]; + buf[0] = 0; cLog.msg(Log::PRIO_ERR) << "KeyDerivation::init: Failed to open cipher: " << gpg_strerror_r(err, buf, STERROR_TEXT_MAX); return; } @@ -108,6 +110,7 @@ void AesIcmKeyDerivation::generate(satp_prf_label label, seq_nr_t seq_nr, Buffer gcry_error_t err = gcry_cipher_reset( cipher_ ); if( err ) { char buf[STERROR_TEXT_MAX]; + buf[0] = 0; cLog.msg(Log::PRIO_ERR) << "KeyDerivation::generate: Failed to reset cipher: " << gpg_strerror_r(err, buf, STERROR_TEXT_MAX); } @@ -149,6 +152,7 @@ void AesIcmKeyDerivation::generate(satp_prf_label label, seq_nr_t seq_nr, Buffer if( err ) { char buf[STERROR_TEXT_MAX]; + buf[0] = 0; cLog.msg(Log::PRIO_ERR) << "KeyDerivation::generate: Failed to set CTR: " << gpg_strerror_r(err, buf, STERROR_TEXT_MAX); } @@ -156,6 +160,7 @@ void AesIcmKeyDerivation::generate(satp_prf_label label, seq_nr_t seq_nr, Buffer err = gcry_cipher_encrypt( cipher_, key, key.getLength(), NULL, 0); if( err ) { char buf[STERROR_TEXT_MAX]; + buf[0] = 0; cLog.msg(Log::PRIO_ERR) << "KeyDerivation::generate: Failed to generate cipher bitstream: " << gpg_strerror_r(err, buf, STERROR_TEXT_MAX); } } -- cgit v1.2.3