diff options
Diffstat (limited to 'src/lib/modes')
-rw-r--r-- | src/lib/modes/aead/ccm/ccm.cpp | 6 | ||||
-rw-r--r-- | src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp | 2 | ||||
-rw-r--r-- | src/lib/modes/aead/gcm/gcm.cpp | 2 | ||||
-rw-r--r-- | src/lib/modes/aead/ocb/ocb.cpp | 4 | ||||
-rw-r--r-- | src/lib/modes/cbc/cbc.cpp | 4 | ||||
-rw-r--r-- | src/lib/modes/cfb/cfb.cpp | 2 | ||||
-rw-r--r-- | src/lib/modes/ecb/ecb.cpp | 4 | ||||
-rw-r--r-- | src/lib/modes/xts/xts.cpp | 2 |
8 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/modes/aead/ccm/ccm.cpp b/src/lib/modes/aead/ccm/ccm.cpp index bd4e0f4be..df33685f3 100644 --- a/src/lib/modes/aead/ccm/ccm.cpp +++ b/src/lib/modes/aead/ccm/ccm.cpp @@ -20,13 +20,13 @@ CCM_Mode::CCM_Mode(BlockCipher* cipher, size_t tag_size, size_t L) : m_cipher(cipher) { if(m_cipher->block_size() != BS) - throw std::invalid_argument(m_cipher->name() + " cannot be used with CCM mode"); + throw Invalid_Argument(m_cipher->name() + " cannot be used with CCM mode"); if(L < 2 || L > 8) - throw std::invalid_argument("Invalid CCM L value " + std::to_string(L)); + throw Invalid_Argument("Invalid CCM L value " + std::to_string(L)); if(tag_size < 4 || tag_size > 16 || tag_size % 2 != 0) - throw std::invalid_argument("invalid CCM tag length " + std::to_string(tag_size)); + throw Invalid_Argument("invalid CCM tag length " + std::to_string(tag_size)); } void CCM_Mode::clear() diff --git a/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp b/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp index 0aef6a747..2350e2e6a 100644 --- a/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp +++ b/src/lib/modes/aead/chacha20poly1305/chacha20poly1305.cpp @@ -39,7 +39,7 @@ void ChaCha20Poly1305_Mode::key_schedule(const byte key[], size_t length) void ChaCha20Poly1305_Mode::set_associated_data(const byte ad[], size_t length) { if(m_ctext_len) - throw std::runtime_error("Too late to set AD for ChaCha20Poly1305"); + throw Exception("Too late to set AD for ChaCha20Poly1305"); m_ad.assign(ad, ad + length); } diff --git a/src/lib/modes/aead/gcm/gcm.cpp b/src/lib/modes/aead/gcm/gcm.cpp index 15820069d..a77c3e4d4 100644 --- a/src/lib/modes/aead/gcm/gcm.cpp +++ b/src/lib/modes/aead/gcm/gcm.cpp @@ -163,7 +163,7 @@ GCM_Mode::GCM_Mode(BlockCipher* cipher, size_t tag_size) : m_cipher_name(cipher->name()) { if(cipher->block_size() != BS) - throw std::invalid_argument("GCM requires a 128 bit cipher so cannot be used with " + + throw Invalid_Argument("GCM requires a 128 bit cipher so cannot be used with " + cipher->name()); m_ghash.reset(new GHASH); diff --git a/src/lib/modes/aead/ocb/ocb.cpp b/src/lib/modes/aead/ocb/ocb.cpp index ff3317dd9..08157cd47 100644 --- a/src/lib/modes/aead/ocb/ocb.cpp +++ b/src/lib/modes/aead/ocb/ocb.cpp @@ -123,10 +123,10 @@ OCB_Mode::OCB_Mode(BlockCipher* cipher, size_t tag_size) : m_tag_size(tag_size) { if(BS() != 16) - throw std::invalid_argument("OCB is not compatible with " + m_cipher->name()); + throw Invalid_Argument("OCB is not compatible with " + m_cipher->name()); if(m_tag_size % 4 != 0 || m_tag_size < 8 || m_tag_size > BS()) - throw std::invalid_argument("OCB cannot produce a " + std::to_string(m_tag_size) + + throw Invalid_Argument("OCB cannot produce a " + std::to_string(m_tag_size) + " byte tag"); } diff --git a/src/lib/modes/cbc/cbc.cpp b/src/lib/modes/cbc/cbc.cpp index 1e3c6d6e3..fedeaf20d 100644 --- a/src/lib/modes/cbc/cbc.cpp +++ b/src/lib/modes/cbc/cbc.cpp @@ -17,7 +17,7 @@ CBC_Mode::CBC_Mode(BlockCipher* cipher, BlockCipherModePaddingMethod* padding) : m_state(m_cipher->block_size()) { if(m_padding && !m_padding->valid_blocksize(cipher->block_size())) - throw std::invalid_argument("Padding " + m_padding->name() + + throw Invalid_Argument("Padding " + m_padding->name() + " cannot be used with " + cipher->name() + "/CBC"); } @@ -127,7 +127,7 @@ void CBC_Encryption::finish(secure_vector<byte>& buffer, size_t offset) padding().add_padding(buffer, bytes_in_final_block, BS); if((buffer.size()-offset) % BS) - throw std::runtime_error("Did not pad to full block size in " + name()); + throw Exception("Did not pad to full block size in " + name()); update(buffer, offset); } diff --git a/src/lib/modes/cfb/cfb.cpp b/src/lib/modes/cfb/cfb.cpp index 7c7ed1865..6c9239e73 100644 --- a/src/lib/modes/cfb/cfb.cpp +++ b/src/lib/modes/cfb/cfb.cpp @@ -16,7 +16,7 @@ CFB_Mode::CFB_Mode(BlockCipher* cipher, size_t feedback_bits) : m_feedback_bytes(feedback_bits ? feedback_bits / 8 : cipher->block_size()) { if(feedback_bits % 8 || feedback() > cipher->block_size()) - throw std::invalid_argument(name() + ": feedback bits " + + throw Invalid_Argument(name() + ": feedback bits " + std::to_string(feedback_bits) + " not supported"); } diff --git a/src/lib/modes/ecb/ecb.cpp b/src/lib/modes/ecb/ecb.cpp index 14e72e20b..407b5c582 100644 --- a/src/lib/modes/ecb/ecb.cpp +++ b/src/lib/modes/ecb/ecb.cpp @@ -15,7 +15,7 @@ ECB_Mode::ECB_Mode(BlockCipher* cipher, BlockCipherModePaddingMethod* padding) : m_padding(padding) { if(!m_padding->valid_blocksize(cipher->block_size())) - throw std::invalid_argument("Padding " + m_padding->name() + + throw Invalid_Argument("Padding " + m_padding->name() + " cannot be used with " + cipher->name() + "/ECB"); } @@ -102,7 +102,7 @@ void ECB_Encryption::finish(secure_vector<byte>& buffer, size_t offset) padding().add_padding(buffer, bytes_in_final_block, BS); if(buffer.size() % BS) - throw std::runtime_error("Did not pad to full block size in " + name()); + throw Exception("Did not pad to full block size in " + name()); update(buffer, offset); } diff --git a/src/lib/modes/xts/xts.cpp b/src/lib/modes/xts/xts.cpp index c42988d10..b369fde29 100644 --- a/src/lib/modes/xts/xts.cpp +++ b/src/lib/modes/xts/xts.cpp @@ -51,7 +51,7 @@ inline void poly_double(byte out[], const byte in[], size_t size) XTS_Mode::XTS_Mode(BlockCipher* cipher) : m_cipher(cipher) { if(m_cipher->block_size() != 8 && m_cipher->block_size() != 16) - throw std::invalid_argument("Bad cipher for XTS: " + cipher->name()); + throw Invalid_Argument("Bad cipher for XTS: " + cipher->name()); m_tweak_cipher.reset(m_cipher->clone()); m_tweak.resize(update_granularity()); |