summaryrefslogtreecommitdiff
path: root/src/cipher.cpp
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-01-15 16:28:12 +0000
committerChristian Pointner <equinox@anytun.org>2009-01-15 16:28:12 +0000
commit1c5626cd8a3dd28d7d09e01d6d3b95f49f10e421 (patch)
treee251b16e72d99ea7696d222c24fb13fd13812890 /src/cipher.cpp
parentimproved Makefile (clean now for -j *) (diff)
log class can now easily use errno and gpg_err
Diffstat (limited to 'src/cipher.cpp')
-rw-r--r--src/cipher.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/cipher.cpp b/src/cipher.cpp
index 6e325d9..69686bb 100644
--- a/src/cipher.cpp
+++ b/src/cipher.cpp
@@ -100,9 +100,7 @@ void AesIcmCipher::init(u_int16_t key_length)
gcry_error_t err = gcry_cipher_open(&handle_, algo, 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);
+ cLog.msg(Log::PRIO_CRIT) << "AesIcmCipher::AesIcmCipher: Failed to open cipher" << LogGpgError(err);
}
#endif
}
@@ -163,9 +161,7 @@ void AesIcmCipher::calc(KeyDerivation& kd, u_int8_t* in, u_int32_t ilen, u_int8_
#else
gcry_error_t err = gcry_cipher_setkey(handle_, key_.getBuf(), key_.getLength());
if(err) {
- char buf[STERROR_TEXT_MAX];
- buf[0] = 0;
- cLog.msg(Log::PRIO_ERR) << "AesIcmCipher: Failed to set cipher key: " << gpg_strerror_r(err, buf, STERROR_TEXT_MAX);
+ cLog.msg(Log::PRIO_ERR) << "AesIcmCipher: Failed to set cipher key: " << LogGpgError(err);
return;
}
#endif
@@ -175,17 +171,13 @@ void AesIcmCipher::calc(KeyDerivation& kd, u_int8_t* in, u_int32_t ilen, u_int8_
#ifndef USE_SSL_CRYPTO
err = gcry_cipher_setctr(handle_, ctr_.buf_, CTR_LENGTH);
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);
+ cLog.msg(Log::PRIO_ERR) << "AesIcmCipher: Failed to set cipher CTR: " << LogGpgError(err);
return;
}
err = gcry_cipher_encrypt(handle_, out, olen, in, ilen);
if(err) {
- char buf[STERROR_TEXT_MAX];
- buf[0] = 0;
- cLog.msg(Log::PRIO_ERR) << "AesIcmCipher: Failed to de/encrypt packet: " << gpg_strerror_r(err, buf, STERROR_TEXT_MAX);
+ cLog.msg(Log::PRIO_ERR) << "AesIcmCipher: Failed to de/encrypt packet: " << LogGpgError(err);
return;
}
#else