diff options
Diffstat (limited to 'src/encryptedPacket.cpp')
-rw-r--r-- | src/encryptedPacket.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/encryptedPacket.cpp b/src/encryptedPacket.cpp index 9a1e063..34d2725 100644 --- a/src/encryptedPacket.cpp +++ b/src/encryptedPacket.cpp @@ -37,6 +37,7 @@ #include "endian.h" #include "datatypes.h" #include "log.h" +#include "anytunError.hpp" EncryptedPacket::EncryptedPacket(u_int32_t payload_length, bool allow_realloc) : Buffer(payload_length + sizeof(struct HeaderStruct), allow_realloc) @@ -137,14 +138,14 @@ void EncryptedPacket::reinit() if(length_ < (sizeof(struct HeaderStruct))) { header_ = NULL; - throw std::runtime_error("encrypted packet can't be initialized, buffer is too small"); + AnytunError::throwErr() << "encrypted packet can't be initialized, buffer is too small"; } if(auth_tag_) { if(length_ < (sizeof(struct HeaderStruct) + AUTHTAG_SIZE)) { auth_tag_ = NULL; - throw std::runtime_error("auth-tag can't be enabled, buffer is too small"); + AnytunError::throwErr() << "auth-tag can't be enabled, buffer is too small"; } auth_tag_ = buf_ + length_ - AUTHTAG_SIZE; } @@ -179,7 +180,7 @@ void EncryptedPacket::withAuthTag(bool b) if(b) { if(length_ < (sizeof(struct HeaderStruct) + AUTHTAG_SIZE)) - throw std::runtime_error("auth-tag can't be enabled, buffer is too small"); + AnytunError::throwErr() << "auth-tag can't be enabled, buffer is too small"; auth_tag_ = buf_ + length_ - AUTHTAG_SIZE; } |