diff options
Diffstat (limited to 'src/cipher.cpp')
-rw-r--r-- | src/cipher.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cipher.cpp b/src/cipher.cpp index 593218f..3667290 100644 --- a/src/cipher.cpp +++ b/src/cipher.cpp @@ -80,6 +80,7 @@ AesIcmCipher::AesIcmCipher() : cipher_(NULL) 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_CRIT) << "AesIcmCipher::AesIcmCipher: Failed to open cipher" << gpg_strerror_r(err, buf, STERROR_TEXT_MAX); } } @@ -99,6 +100,7 @@ void AesIcmCipher::setKey(Buffer& key) gcry_error_t err = gcry_cipher_setkey( cipher_, key.getBuf(), key.getLength() ); if( err ) { char buf[STERROR_TEXT_MAX]; + buf[0] = 0; cLog.msg(Log::PRIO_ERR) << "AesIcmCipher::setKey: Failed to set cipher key: " << gpg_strerror_r(err, buf, STERROR_TEXT_MAX); } } @@ -130,6 +132,7 @@ void AesIcmCipher::calc(u_int8_t* in, u_int32_t ilen, u_int8_t* out, u_int32_t o gcry_error_t err = gcry_cipher_reset( cipher_ ); if( err ) { char buf[STERROR_TEXT_MAX]; + buf[0] = 0; cLog.msg(Log::PRIO_ERR) << "AesIcmCipher: Failed to reset cipher: " << gpg_strerror_r(err, buf, STERROR_TEXT_MAX); return; } @@ -160,6 +163,7 @@ void AesIcmCipher::calc(u_int8_t* in, u_int32_t ilen, u_int8_t* out, u_int32_t o delete[] ctr_buf; if( err ) { char buf[STERROR_TEXT_MAX]; + buf[0] = 0; cLog.msg(Log::PRIO_ERR) << "AesIcmCipher: Failed to set cipher CTR: " << gpg_strerror_r(err, buf, STERROR_TEXT_MAX); return; } @@ -167,6 +171,7 @@ void AesIcmCipher::calc(u_int8_t* in, u_int32_t ilen, u_int8_t* out, u_int32_t o err = gcry_cipher_encrypt( cipher_, out, olen, in, ilen ); if( err ) { char buf[STERROR_TEXT_MAX]; + buf[0] = 0; cLog.msg(Log::PRIO_ERR) << "AesIcmCipher: Failed to generate cipher bitstream: " << gpg_strerror_r(err, buf, STERROR_TEXT_MAX); return; } |