From f51841ba5237952dda3e76df643d3ae13bed3df5 Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 11 Aug 2009 02:31:17 +0000 Subject: Change the BlockCipher interface to support multi-block encryption and decryption. Currently only used for counter mode. Doesn't offer much advantage as-is (though might help slightly, in terms of cache effects), but allows for SIMD implementations to process multiple blocks in parallel when possible. Particularly thinking here of Serpent; TEA/XTEA also seem promising in this sense, as is Threefish once that is implemented as a standalone block cipher. --- src/block/cast/cast256.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/block/cast/cast256.h') diff --git a/src/block/cast/cast256.h b/src/block/cast/cast256.h index cd48edd5e..ea80df65d 100644 --- a/src/block/cast/cast256.h +++ b/src/block/cast/cast256.h @@ -23,8 +23,8 @@ class BOTAN_DLL CAST_256 : public BlockCipher BlockCipher* clone() const { return new CAST_256; } CAST_256() : BlockCipher(16, 4, 32, 4) {} private: - void enc(const byte[], byte[]) const; - void dec(const byte[], byte[]) const; + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); static const u32bit KEY_MASK[192]; -- cgit v1.2.3 From c8c3d7f6eecd753aa87a882b1458346682e606db Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 11 Aug 2009 19:34:50 +0000 Subject: Make encrypt_n public for all BlockCipher implementations - unlike the enc/dec functions it replaces, these are public interfaces. Add the first bits of a SSE2 implementation of Serpent. Currently incomplete. --- src/block/aes/aes.h | 6 +- src/block/blowfish/blowfish.h | 6 +- src/block/cast/cast128.h | 6 +- src/block/cast/cast256.h | 6 +- src/block/des/des.h | 12 ++- src/block/des/desx.h | 6 +- src/block/gost_28147/gost_28147.h | 5 +- src/block/idea/idea.h | 6 +- src/block/kasumi/kasumi.h | 5 +- src/block/lion/lion.h | 5 +- src/block/lubyrack/lubyrack.h | 6 +- src/block/mars/mars.h | 6 +- src/block/misty1/misty1.h | 6 +- src/block/noekeon/noekeon.h | 6 +- src/block/rc2/rc2.h | 6 +- src/block/rc5/rc5.h | 6 +- src/block/rc6/rc6.h | 6 +- src/block/safer/safer_sk.h | 7 +- src/block/seed/seed.h | 6 +- src/block/serpent/serpent.h | 5 +- src/block/serpent_ia32/serp_ia32.h | 5 +- src/block/serpent_sse2/info.txt | 27 ++++++ src/block/serpent_sse2/serp_sse2.cpp | 170 +++++++++++++++++++++++++++++++++++ src/block/serpent_sse2/serp_sse2.h | 29 ++++++ src/block/skipjack/skipjack.h | 7 +- src/block/square/square.h | 6 +- src/block/tea/tea.h | 6 +- src/block/twofish/twofish.h | 6 +- src/block/xtea/xtea.h | 6 +- src/engine/sse2_eng/eng_sse2.cpp | 23 ++++- src/engine/sse2_eng/eng_sse2.h | 5 +- 31 files changed, 355 insertions(+), 58 deletions(-) create mode 100644 src/block/serpent_sse2/info.txt create mode 100644 src/block/serpent_sse2/serp_sse2.cpp create mode 100644 src/block/serpent_sse2/serp_sse2.h (limited to 'src/block/cast/cast256.h') diff --git a/src/block/aes/aes.h b/src/block/aes/aes.h index 940e11a48..768bb09e7 100644 --- a/src/block/aes/aes.h +++ b/src/block/aes/aes.h @@ -18,14 +18,16 @@ namespace Botan { class BOTAN_DLL AES : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw(); std::string name() const { return "AES"; } BlockCipher* clone() const { return new AES; } + AES() : BlockCipher(16, 16, 32, 8) { ROUNDS = 14; } AES(u32bit); private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); static u32bit S(u32bit); diff --git a/src/block/blowfish/blowfish.h b/src/block/blowfish/blowfish.h index 3623c2087..345c1ce49 100644 --- a/src/block/blowfish/blowfish.h +++ b/src/block/blowfish/blowfish.h @@ -18,13 +18,15 @@ namespace Botan { class BOTAN_DLL Blowfish : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw(); std::string name() const { return "Blowfish"; } BlockCipher* clone() const { return new Blowfish; } + Blowfish() : BlockCipher(8, 1, 56) {} private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); void generate_sbox(u32bit[], u32bit, u32bit&, u32bit&) const; diff --git a/src/block/cast/cast128.h b/src/block/cast/cast128.h index 092ee824b..864a4e47e 100644 --- a/src/block/cast/cast128.h +++ b/src/block/cast/cast128.h @@ -18,13 +18,15 @@ namespace Botan { class BOTAN_DLL CAST_128 : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw() { MK.clear(); RK.clear(); } std::string name() const { return "CAST-128"; } BlockCipher* clone() const { return new CAST_128; } + CAST_128() : BlockCipher(8, 11, 16) {} private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); static void key_schedule(u32bit[16], u32bit[4]); diff --git a/src/block/cast/cast256.h b/src/block/cast/cast256.h index ea80df65d..1be7fa9cf 100644 --- a/src/block/cast/cast256.h +++ b/src/block/cast/cast256.h @@ -18,13 +18,15 @@ namespace Botan { class BOTAN_DLL CAST_256 : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw() { MK.clear(); RK.clear(); } std::string name() const { return "CAST-256"; } BlockCipher* clone() const { return new CAST_256; } + CAST_256() : BlockCipher(16, 4, 32, 4) {} private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); static const u32bit KEY_MASK[192]; diff --git a/src/block/des/des.h b/src/block/des/des.h index 39d1ac404..856aaf60c 100644 --- a/src/block/des/des.h +++ b/src/block/des/des.h @@ -18,13 +18,15 @@ namespace Botan { class BOTAN_DLL DES : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw() { round_key.clear(); } std::string name() const { return "DES"; } BlockCipher* clone() const { return new DES; } + DES() : BlockCipher(8, 8) {} private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); SecureBuffer round_key; @@ -36,13 +38,15 @@ class BOTAN_DLL DES : public BlockCipher class BOTAN_DLL TripleDES : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw() { round_key.clear(); } std::string name() const { return "TripleDES"; } BlockCipher* clone() const { return new TripleDES; } + TripleDES() : BlockCipher(8, 16, 24, 8) {} private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); SecureBuffer round_key; diff --git a/src/block/des/desx.h b/src/block/des/desx.h index d71335071..d22895296 100644 --- a/src/block/des/desx.h +++ b/src/block/des/desx.h @@ -18,13 +18,15 @@ namespace Botan { class BOTAN_DLL DESX : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw() { des.clear(); K1.clear(); K2.clear(); } std::string name() const { return "DESX"; } BlockCipher* clone() const { return new DESX; } + DESX() : BlockCipher(8, 24) {} private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); SecureBuffer K1, K2; DES des; diff --git a/src/block/gost_28147/gost_28147.h b/src/block/gost_28147/gost_28147.h index 825e106a2..18c1d0a29 100644 --- a/src/block/gost_28147/gost_28147.h +++ b/src/block/gost_28147/gost_28147.h @@ -44,6 +44,9 @@ class GOST_28147_89_Params class BOTAN_DLL GOST_28147_89 : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw() { EK.clear(); } std::string name() const { return "GOST-28147-89"; } @@ -54,8 +57,6 @@ class BOTAN_DLL GOST_28147_89 : public BlockCipher GOST_28147_89(const SecureBuffer& other_SBOX) : BlockCipher(8, 32), SBOX(other_SBOX) {} - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); SecureBuffer SBOX; diff --git a/src/block/idea/idea.h b/src/block/idea/idea.h index a3384b667..59484531b 100644 --- a/src/block/idea/idea.h +++ b/src/block/idea/idea.h @@ -18,13 +18,15 @@ namespace Botan { class BOTAN_DLL IDEA : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw() { EK.clear(); DK.clear(); } std::string name() const { return "IDEA"; } BlockCipher* clone() const { return new IDEA; } + IDEA() : BlockCipher(8, 16) {} private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); SecureBuffer EK, DK; }; diff --git a/src/block/kasumi/kasumi.h b/src/block/kasumi/kasumi.h index 3b18e675b..0f5a5d182 100644 --- a/src/block/kasumi/kasumi.h +++ b/src/block/kasumi/kasumi.h @@ -18,14 +18,15 @@ namespace Botan { class BOTAN_DLL KASUMI : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw() { EK.clear(); } std::string name() const { return "KASUMI"; } BlockCipher* clone() const { return new KASUMI; } KASUMI() : BlockCipher(8, 16) {} private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); SecureBuffer EK; diff --git a/src/block/lion/lion.h b/src/block/lion/lion.h index d9f933846..d421771d6 100644 --- a/src/block/lion/lion.h +++ b/src/block/lion/lion.h @@ -20,6 +20,9 @@ namespace Botan { class BOTAN_DLL Lion : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw(); std::string name() const; BlockCipher* clone() const; @@ -27,8 +30,6 @@ class BOTAN_DLL Lion : public BlockCipher Lion(HashFunction*, StreamCipher*, u32bit); ~Lion() { delete hash; delete cipher; } private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); const u32bit LEFT_SIZE, RIGHT_SIZE; diff --git a/src/block/lubyrack/lubyrack.h b/src/block/lubyrack/lubyrack.h index 1e83748a6..940b34603 100644 --- a/src/block/lubyrack/lubyrack.h +++ b/src/block/lubyrack/lubyrack.h @@ -19,6 +19,9 @@ namespace Botan { class BOTAN_DLL LubyRackoff : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw(); std::string name() const; BlockCipher* clone() const; @@ -26,9 +29,8 @@ class BOTAN_DLL LubyRackoff : public BlockCipher LubyRackoff(HashFunction* hash); ~LubyRackoff() { delete hash; } private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); + HashFunction* hash; SecureVector K1, K2; }; diff --git a/src/block/mars/mars.h b/src/block/mars/mars.h index b3d74b179..7d0bfe4fa 100644 --- a/src/block/mars/mars.h +++ b/src/block/mars/mars.h @@ -15,13 +15,15 @@ namespace Botan { class BOTAN_DLL MARS : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw() { EK.clear(); } std::string name() const { return "MARS"; } BlockCipher* clone() const { return new MARS; } + MARS() : BlockCipher(16, 16, 32, 4) {} private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); void encrypt_round(u32bit&, u32bit&, u32bit&, u32bit&, u32bit) const; diff --git a/src/block/misty1/misty1.h b/src/block/misty1/misty1.h index 14b7c8e45..8db6881de 100644 --- a/src/block/misty1/misty1.h +++ b/src/block/misty1/misty1.h @@ -18,13 +18,15 @@ namespace Botan { class BOTAN_DLL MISTY1 : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw() { EK.clear(); DK.clear(); } std::string name() const { return "MISTY1"; } BlockCipher* clone() const { return new MISTY1; } + MISTY1(u32bit = 8); private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); SecureBuffer EK, DK; diff --git a/src/block/noekeon/noekeon.h b/src/block/noekeon/noekeon.h index b4f3980d7..37b24fb7d 100644 --- a/src/block/noekeon/noekeon.h +++ b/src/block/noekeon/noekeon.h @@ -18,13 +18,15 @@ namespace Botan { class BOTAN_DLL Noekeon : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw(); std::string name() const { return "Noekeon"; } BlockCipher* clone() const { return new Noekeon; } + Noekeon() : BlockCipher(16, 16) {} private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); static const byte RC[17]; diff --git a/src/block/rc2/rc2.h b/src/block/rc2/rc2.h index 0d94d69a2..db623b385 100644 --- a/src/block/rc2/rc2.h +++ b/src/block/rc2/rc2.h @@ -18,15 +18,17 @@ namespace Botan { class BOTAN_DLL RC2 : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + static byte EKB_code(u32bit); void clear() throw() { K.clear(); } std::string name() const { return "RC2"; } BlockCipher* clone() const { return new RC2; } + RC2() : BlockCipher(8, 1, 32) {} private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); SecureBuffer K; diff --git a/src/block/rc5/rc5.h b/src/block/rc5/rc5.h index 1816994dc..ff9204710 100644 --- a/src/block/rc5/rc5.h +++ b/src/block/rc5/rc5.h @@ -18,13 +18,15 @@ namespace Botan { class BOTAN_DLL RC5 : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw() { S.clear(); } std::string name() const; BlockCipher* clone() const { return new RC5(ROUNDS); } + RC5(u32bit); private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); SecureVector S; const u32bit ROUNDS; diff --git a/src/block/rc6/rc6.h b/src/block/rc6/rc6.h index f634ebcd9..5171006f5 100644 --- a/src/block/rc6/rc6.h +++ b/src/block/rc6/rc6.h @@ -18,13 +18,15 @@ namespace Botan { class BOTAN_DLL RC6 : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw() { S.clear(); } std::string name() const { return "RC6"; } BlockCipher* clone() const { return new RC6; } + RC6() : BlockCipher(16, 1, 32) {} private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); SecureBuffer S; diff --git a/src/block/safer/safer_sk.h b/src/block/safer/safer_sk.h index ae3d4f9a8..4d17bba51 100644 --- a/src/block/safer/safer_sk.h +++ b/src/block/safer/safer_sk.h @@ -18,19 +18,22 @@ namespace Botan { class BOTAN_DLL SAFER_SK : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw() { EK.clear(); } std::string name() const; BlockCipher* clone() const; + SAFER_SK(u32bit); private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); static const byte EXP[256]; static const byte LOG[512]; static const byte BIAS[208]; static const byte KEY_INDEX[208]; + SecureVector EK; const u32bit ROUNDS; }; diff --git a/src/block/seed/seed.h b/src/block/seed/seed.h index 0c9c2c8af..5a5a512e7 100644 --- a/src/block/seed/seed.h +++ b/src/block/seed/seed.h @@ -18,13 +18,15 @@ namespace Botan { class BOTAN_DLL SEED : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw() { K.clear(); } std::string name() const { return "SEED"; } BlockCipher* clone() const { return new SEED; } + SEED() : BlockCipher(16, 16) {} private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); class G_FUNC diff --git a/src/block/serpent/serpent.h b/src/block/serpent/serpent.h index 9c9fb59f2..d919c3008 100644 --- a/src/block/serpent/serpent.h +++ b/src/block/serpent/serpent.h @@ -18,13 +18,14 @@ namespace Botan { class BOTAN_DLL Serpent : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw() { round_key.clear(); } std::string name() const { return "Serpent"; } BlockCipher* clone() const { return new Serpent; } Serpent() : BlockCipher(16, 16, 32, 8) {} protected: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); SecureBuffer round_key; diff --git a/src/block/serpent_ia32/serp_ia32.h b/src/block/serpent_ia32/serp_ia32.h index 2b4a95d3d..dc6beaf13 100644 --- a/src/block/serpent_ia32/serp_ia32.h +++ b/src/block/serpent_ia32/serp_ia32.h @@ -18,10 +18,11 @@ namespace Botan { class BOTAN_DLL Serpent_IA32 : public Serpent { public: - BlockCipher* clone() const { return new Serpent_IA32; } - private: void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + + BlockCipher* clone() const { return new Serpent_IA32; } + private: void key_schedule(const byte[], u32bit); }; diff --git a/src/block/serpent_sse2/info.txt b/src/block/serpent_sse2/info.txt new file mode 100644 index 000000000..ad8323f53 --- /dev/null +++ b/src/block/serpent_sse2/info.txt @@ -0,0 +1,27 @@ +realname "Serpent (SSE2)" + +define SERPENT_SSE2 + +load_on auto + + +serp_sse2.cpp +serp_sse2.h + + + +pentium-m +pentium4 +prescott +amd64 + + + +gcc +icc + + + +serpent +sse2_eng + diff --git a/src/block/serpent_sse2/serp_sse2.cpp b/src/block/serpent_sse2/serp_sse2.cpp new file mode 100644 index 000000000..759f3e1d6 --- /dev/null +++ b/src/block/serpent_sse2/serp_sse2.cpp @@ -0,0 +1,170 @@ +/* +* Serpent (SSE2) +* (C) 2009 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include +#include +#include + +namespace Botan { + +namespace { + +#define SBoxE1(b0, b1, b2, b3, b4) \ + do { \ + b3 = _mm_xor_si128(b3, b0); \ + b4 = b1; \ + b1 = _mm_and_si128(b1, b3); \ + b4 = _mm_xor_si128(b4, b2); \ + b1 = _mm_xor_si128(b1, b0); \ + b0 = _mm_or_si128(b0, b3); \ + b0 = _mm_xor_si128(b0, b4); \ + b4 = _mm_xor_si128(b4, b3); \ + b3 = _mm_xor_si128(b3, b2); \ + b2 = _mm_or_si128(b2, b1); \ + b2 = _mm_xor_si128(b2, b4); \ + b4 = _mm_andnot_si128(b4, all_ones); \ + b4 = _mm_or_si128(b4, b1); \ + b1 = _mm_xor_si128(b1, b3); \ + b1 = _mm_xor_si128(b1, b4); \ + b3 = _mm_or_si128(b3, b0); \ + b1 = _mm_xor_si128(b1, b3); \ + b4 = _mm_xor_si128(b4, b3); \ + b3 = b0; b0 = b1; b1 = b4; \ + } while(0); + +#define rotate_left_m128(vec, rot) \ + _mm_or_si128(_mm_slli_epi32(vec, rot), _mm_srli_epi32(vec, 32-rot)) + +#define key_xor(round, b0, b1, b2, b3) \ + do { \ + __m128i key = _mm_loadu_si128(keys + round); \ + b0 = _mm_xor_si128(b0, _mm_shuffle_epi32(key, _MM_SHUFFLE(0,0,0,0))); \ + b1 = _mm_xor_si128(b1, _mm_shuffle_epi32(key, _MM_SHUFFLE(1,1,1,1))); \ + b2 = _mm_xor_si128(b2, _mm_shuffle_epi32(key, _MM_SHUFFLE(2,2,2,2))); \ + b3 = _mm_xor_si128(b3, _mm_shuffle_epi32(key, _MM_SHUFFLE(3,3,3,3))); \ + } while(0); + +#define transform(b0, b1, b2, b3) \ + do \ + { \ + b0 = rotate_left_m128(b0, 13); \ + b2 = rotate_left_m128(b2, 3); \ + b1 = _mm_xor_si128(b1, _mm_xor_si128(b0, b2)); \ + b3 = _mm_xor_si128(b3, _mm_xor_si128(b2, _mm_slli_epi32(b0, 3))); \ + b1 = rotate_left_m128(b1, 1); \ + b3 = rotate_left_m128(b3, 7); \ + b0 = _mm_xor_si128(b0, _mm_xor_si128(b1, b3)); \ + b2 = _mm_xor_si128(b2, _mm_xor_si128(b3, _mm_slli_epi32(b1, 7))); \ + b0 = rotate_left_m128(b0, 5); \ + b2 = rotate_left_m128(b2, 22); \ + } while(0); + +void print_simd(const char* name, __m128i vec) + { + union { __m128i v; int32_t ints[4]; } u = { vec }; + + printf("%s: ", name); + for(u32bit i = 0; i != 4; ++i) + printf("%08X ", u.ints[i]); + printf("\n"); + } + +void serpent_encrypt_4(const byte in[64], + byte out[64], + const u32bit keys_32[132]) + { + const __m128i* keys = (const __m128i*)(keys_32); + + /* + FIXME: figure out a fast way to do this with 4 loads with + _mm_loadu_si128 plus shuffle/interleave ops + */ + union { __m128i v; u32bit u32[4]; } convert; + + convert.u32[0] = load_le(in, 0); + convert.u32[1] = load_le(in, 4); + convert.u32[2] = load_le(in, 8); + convert.u32[3] = load_le(in, 12); + + __m128i b0 = convert.v; + + convert.u32[0] = load_le(in, 1); + convert.u32[1] = load_le(in, 5); + convert.u32[2] = load_le(in, 9); + convert.u32[3] = load_le(in, 13); + + __m128i b1 = convert.v; + + convert.u32[0] = load_le(in, 2); + convert.u32[1] = load_le(in, 6); + convert.u32[2] = load_le(in, 10); + convert.u32[3] = load_le(in, 14); + + __m128i b2 = convert.v; + + convert.u32[0] = load_le(in, 3); + convert.u32[1] = load_le(in, 7); + convert.u32[2] = load_le(in, 11); + convert.u32[3] = load_le(in, 15); + + + __m128i b3 = convert.v; + + __m128i b4; // temp + + const __m128i all_ones = _mm_set1_epi8(0xFF); + + key_xor(0, b0, b1, b2, b3); + SBoxE1(b0, b1, b2, b3, b4); + transform(b0, b1, b2, b3); + + key_xor(b0, b1, b2, b3, 1); + + print_simd("b0", b0); + print_simd("b1", b1); + print_simd("b2", b2); + print_simd("b3", b3); + } + +} + +/* +* Serpent Encryption +*/ +void Serpent_SSE2::encrypt_n(const byte in[], byte out[], u32bit blocks) const + { + while(blocks >= 4) + { + serpent_encrypt_4(in, out, this->round_key); + //Serpent::encrypt_n(in, out, 4); + in += 4 * BLOCK_SIZE; + out += 4 * BLOCK_SIZE; + blocks -= 4; + } + + for(u32bit i = 0; i != blocks; ++i) + { + Serpent::encrypt_n(in, out, 1); + in += BLOCK_SIZE; + out += BLOCK_SIZE; + } + } + +/* +* Serpent Decryption +*/ +void Serpent_SSE2::decrypt_n(const byte in[], byte out[], u32bit blocks) const + { + for(u32bit i = 0; i != blocks; ++i) + { + Serpent::decrypt_n(in, out, 1); + in += BLOCK_SIZE; + out += BLOCK_SIZE; + } + } + +} diff --git a/src/block/serpent_sse2/serp_sse2.h b/src/block/serpent_sse2/serp_sse2.h new file mode 100644 index 000000000..f1e5c2028 --- /dev/null +++ b/src/block/serpent_sse2/serp_sse2.h @@ -0,0 +1,29 @@ +/* +* Serpent (SSE2) +* (C) 2009 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_SERPENT_SSE2_H__ +#define BOTAN_SERPENT_SSE2_H__ + +#include + +namespace Botan { + +/* +* Serpent +*/ +class BOTAN_DLL Serpent_SSE2 : public Serpent + { + public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + + BlockCipher* clone() const { return new Serpent_SSE2; } + }; + +} + +#endif diff --git a/src/block/skipjack/skipjack.h b/src/block/skipjack/skipjack.h index ec071dfe7..f12032f36 100644 --- a/src/block/skipjack/skipjack.h +++ b/src/block/skipjack/skipjack.h @@ -18,18 +18,21 @@ namespace Botan { class BOTAN_DLL Skipjack : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw(); std::string name() const { return "Skipjack"; } BlockCipher* clone() const { return new Skipjack; } + Skipjack() : BlockCipher(8, 10) {} private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); void step_A(u16bit&, u16bit&, u32bit) const; void step_B(u16bit&, u16bit&, u32bit) const; void step_Ai(u16bit&, u16bit&, u32bit) const; void step_Bi(u16bit&, u16bit&, u32bit) const; + SecureBuffer FTABLE[10]; }; diff --git a/src/block/square/square.h b/src/block/square/square.h index 0de4c20bd..5d9cfc78c 100644 --- a/src/block/square/square.h +++ b/src/block/square/square.h @@ -18,13 +18,15 @@ namespace Botan { class BOTAN_DLL Square : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw(); std::string name() const { return "Square"; } BlockCipher* clone() const { return new Square; } + Square() : BlockCipher(16, 16) {} private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); static void transform(u32bit[4]); diff --git a/src/block/tea/tea.h b/src/block/tea/tea.h index 141899e88..825a051aa 100644 --- a/src/block/tea/tea.h +++ b/src/block/tea/tea.h @@ -18,13 +18,15 @@ namespace Botan { class BOTAN_DLL TEA : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw() { K.clear(); } std::string name() const { return "TEA"; } BlockCipher* clone() const { return new TEA; } + TEA() : BlockCipher(8, 16) {} private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); SecureBuffer K; }; diff --git a/src/block/twofish/twofish.h b/src/block/twofish/twofish.h index 640fb58ad..87b9aa626 100644 --- a/src/block/twofish/twofish.h +++ b/src/block/twofish/twofish.h @@ -18,13 +18,15 @@ namespace Botan { class BOTAN_DLL Twofish : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw(); std::string name() const { return "Twofish"; } BlockCipher* clone() const { return new Twofish; } + Twofish() : BlockCipher(16, 16, 32, 8) {} private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); static void rs_mul(byte[4], byte, u32bit); diff --git a/src/block/xtea/xtea.h b/src/block/xtea/xtea.h index b50f487b4..de265818d 100644 --- a/src/block/xtea/xtea.h +++ b/src/block/xtea/xtea.h @@ -18,13 +18,15 @@ namespace Botan { class BOTAN_DLL XTEA : public BlockCipher { public: + void encrypt_n(const byte in[], byte out[], u32bit blocks) const; + void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void clear() throw() { EK.clear(); } std::string name() const { return "XTEA"; } BlockCipher* clone() const { return new XTEA; } + XTEA() : BlockCipher(8, 16) {} private: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; void key_schedule(const byte[], u32bit); SecureBuffer EK; }; diff --git a/src/engine/sse2_eng/eng_sse2.cpp b/src/engine/sse2_eng/eng_sse2.cpp index c738b3d96..9f68a070e 100644 --- a/src/engine/sse2_eng/eng_sse2.cpp +++ b/src/engine/sse2_eng/eng_sse2.cpp @@ -1,6 +1,6 @@ /** * SSE2 Assembly Engine -* (C) 1999-2008 Jack Lloyd +* (C) 1999-2009 Jack Lloyd * * Distributed under the terms of the Botan license */ @@ -11,10 +11,27 @@ #include #endif +#if defined(BOTAN_HAS_SERPENT_SSE2) + #include +#endif + namespace Botan { -HashFunction* SSE2_Assembler_Engine::find_hash(const SCAN_Name& request, - Algorithm_Factory&) const +BlockCipher* +SSE2_Assembler_Engine::find_block_cipher(const SCAN_Name& request, + Algorithm_Factory&) const + { +#if defined(BOTAN_HAS_SERPENT_SSE2) + if(request.algo_name() == "Serpent") + return new Serpent_SSE2; +#endif + + return 0; + } + +HashFunction* +SSE2_Assembler_Engine::find_hash(const SCAN_Name& request, + Algorithm_Factory&) const { #if defined(BOTAN_HAS_SHA1_SSE2) if(request.algo_name() == "SHA-160") diff --git a/src/engine/sse2_eng/eng_sse2.h b/src/engine/sse2_eng/eng_sse2.h index 129697e8f..c6b0ce889 100644 --- a/src/engine/sse2_eng/eng_sse2.h +++ b/src/engine/sse2_eng/eng_sse2.h @@ -1,6 +1,6 @@ /** * SSE2 Assembly Engine -* (C) 1999-2008 Jack Lloyd +* (C) 1999-2009 Jack Lloyd * * Distributed under the terms of the Botan license */ @@ -17,6 +17,9 @@ class BOTAN_DLL SSE2_Assembler_Engine : public Engine public: std::string provider_name() const { return "sse2"; } private: + BlockCipher* find_block_cipher(const SCAN_Name&, + Algorithm_Factory&) const; + HashFunction* find_hash(const SCAN_Name& reqeust, Algorithm_Factory&) const; }; -- cgit v1.2.3 From bbe91cb8030c2d1a910082650a02a0747a718a8e Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 22 Oct 2009 17:35:04 +0000 Subject: Remove all exception specifications. The way these are designed in C++ is just too fragile and not that useful. Something like Java's checked exceptions might be nice, but simply killing the process entirely if an unexpected exception is thrown is not exactly useful for something trying to be robust. --- src/alloc/mem_pool/mem_pool.cpp | 6 +++--- src/alloc/mem_pool/mem_pool.h | 6 +++--- src/block/aes/aes.cpp | 2 +- src/block/aes/aes.h | 2 +- src/block/block_cipher.h | 2 +- src/block/blowfish/blowfish.cpp | 2 +- src/block/blowfish/blowfish.h | 2 +- src/block/cast/cast128.h | 2 +- src/block/cast/cast256.h | 2 +- src/block/des/des.h | 4 ++-- src/block/des/desx.h | 2 +- src/block/gost_28147/gost_28147.h | 2 +- src/block/idea/idea.h | 2 +- src/block/kasumi/kasumi.h | 2 +- src/block/lion/lion.cpp | 2 +- src/block/lion/lion.h | 2 +- src/block/lubyrack/lubyrack.cpp | 2 +- src/block/lubyrack/lubyrack.h | 2 +- src/block/mars/mars.h | 2 +- src/block/misty1/misty1.h | 2 +- src/block/noekeon/noekeon.cpp | 2 +- src/block/noekeon/noekeon.h | 2 +- src/block/rc2/rc2.h | 2 +- src/block/rc5/rc5.h | 2 +- src/block/rc6/rc6.h | 2 +- src/block/safer/safer_sk.h | 2 +- src/block/seed/seed.h | 2 +- src/block/serpent/serpent.h | 2 +- src/block/skipjack/skipjack.cpp | 2 +- src/block/skipjack/skipjack.h | 2 +- src/block/square/square.cpp | 2 +- src/block/square/square.h | 2 +- src/block/tea/tea.h | 2 +- src/block/twofish/twofish.cpp | 2 +- src/block/twofish/twofish.h | 2 +- src/block/xtea/xtea.h | 2 +- src/checksum/adler32/adler32.h | 2 +- src/checksum/crc24/crc24.h | 2 +- src/checksum/crc32/crc32.h | 2 +- src/engine/openssl/arc4_openssl.cpp | 2 +- src/engine/openssl/ossl_bc.cpp | 4 ++-- src/engine/openssl/ossl_md.cpp | 4 ++-- src/hash/bmw/bmw_512.cpp | 2 +- src/hash/bmw/bmw_512.h | 2 +- src/hash/fork256/fork256.cpp | 2 +- src/hash/fork256/fork256.h | 2 +- src/hash/gost_3411/gost_3411.cpp | 2 +- src/hash/gost_3411/gost_3411.h | 2 +- src/hash/has160/has160.cpp | 2 +- src/hash/has160/has160.h | 2 +- src/hash/hash.h | 2 +- src/hash/md2/md2.cpp | 2 +- src/hash/md2/md2.h | 2 +- src/hash/md4/md4.cpp | 2 +- src/hash/md4/md4.h | 2 +- src/hash/md5/md5.cpp | 2 +- src/hash/md5/md5.h | 2 +- src/hash/mdx_hash/mdx_hash.cpp | 2 +- src/hash/mdx_hash/mdx_hash.h | 2 +- src/hash/par_hash/par_hash.cpp | 2 +- src/hash/par_hash/par_hash.h | 2 +- src/hash/rmd128/rmd128.cpp | 2 +- src/hash/rmd128/rmd128.h | 2 +- src/hash/rmd160/rmd160.cpp | 2 +- src/hash/rmd160/rmd160.h | 2 +- src/hash/sha1/sha160.cpp | 2 +- src/hash/sha1/sha160.h | 2 +- src/hash/sha2/sha2_32.cpp | 6 +++--- src/hash/sha2/sha2_32.h | 6 +++--- src/hash/sha2/sha2_64.cpp | 6 +++--- src/hash/sha2/sha2_64.h | 6 +++--- src/hash/skein/skein_512.cpp | 2 +- src/hash/skein/skein_512.h | 2 +- src/hash/tiger/tiger.cpp | 2 +- src/hash/tiger/tiger.h | 2 +- src/hash/whirlpool/whrlpool.cpp | 2 +- src/hash/whirlpool/whrlpool.h | 2 +- src/mac/cbc_mac/cbc_mac.cpp | 2 +- src/mac/cbc_mac/cbc_mac.h | 2 +- src/mac/cmac/cmac.cpp | 2 +- src/mac/cmac/cmac.h | 2 +- src/mac/hmac/hmac.cpp | 2 +- src/mac/hmac/hmac.h | 2 +- src/mac/mac.h | 2 +- src/mac/ssl3mac/ssl3_mac.cpp | 2 +- src/mac/ssl3mac/ssl3_mac.h | 2 +- src/mac/x919_mac/x919_mac.cpp | 2 +- src/mac/x919_mac/x919_mac.h | 2 +- src/pk_pad/emsa.h | 2 +- src/pk_pad/emsa1/emsa1.cpp | 2 +- src/pk_pad/emsa1/emsa1.h | 2 +- src/pk_pad/emsa2/emsa2.cpp | 2 +- src/pk_pad/emsa2/emsa2.h | 2 +- src/pk_pad/emsa3/emsa3.cpp | 4 ++-- src/pk_pad/emsa3/emsa3.h | 4 ++-- src/pk_pad/emsa4/emsa4.cpp | 2 +- src/pk_pad/emsa4/emsa4.h | 2 +- src/pk_pad/emsa_raw/emsa_raw.cpp | 2 +- src/pk_pad/emsa_raw/emsa_raw.h | 2 +- src/rng/auto_rng/auto_rng.h | 2 +- src/rng/hmac_rng/hmac_rng.cpp | 2 +- src/rng/hmac_rng/hmac_rng.h | 2 +- src/rng/randpool/randpool.cpp | 2 +- src/rng/randpool/randpool.h | 2 +- src/rng/rng.h | 4 ++-- src/rng/x931_rng/x931_rng.cpp | 2 +- src/rng/x931_rng/x931_rng.h | 2 +- src/stream/arc4/arc4.cpp | 2 +- src/stream/arc4/arc4.h | 2 +- src/stream/ctr/ctr.cpp | 2 +- src/stream/ctr/ctr.h | 2 +- src/stream/ofb/ofb.cpp | 2 +- src/stream/ofb/ofb.h | 2 +- src/stream/salsa20/salsa20.cpp | 2 +- src/stream/salsa20/salsa20.h | 2 +- src/stream/stream_cipher.h | 2 +- src/stream/turing/turing.cpp | 2 +- src/stream/turing/turing.h | 2 +- src/stream/wid_wake/wid_wake.cpp | 2 +- src/stream/wid_wake/wid_wake.h | 2 +- src/sym_algo/sym_algo.h | 4 ++-- 121 files changed, 140 insertions(+), 140 deletions(-) (limited to 'src/block/cast/cast256.h') diff --git a/src/alloc/mem_pool/mem_pool.cpp b/src/alloc/mem_pool/mem_pool.cpp index dabf5e310..e30a7b98a 100644 --- a/src/alloc/mem_pool/mem_pool.cpp +++ b/src/alloc/mem_pool/mem_pool.cpp @@ -42,7 +42,7 @@ Pooling_Allocator::Memory_Block::Memory_Block(void* buf) * See if ptr is contained by this block */ bool Pooling_Allocator::Memory_Block::contains(void* ptr, - u32bit length) const throw() + u32bit length) const { return ((buffer <= ptr) && (buffer_end >= static_cast(ptr) + length * BLOCK_SIZE)); @@ -51,7 +51,7 @@ bool Pooling_Allocator::Memory_Block::contains(void* ptr, /* * Allocate some memory, if possible */ -byte* Pooling_Allocator::Memory_Block::alloc(u32bit n) throw() +byte* Pooling_Allocator::Memory_Block::alloc(u32bit n) { if(n == 0 || n > BITMAP_SIZE) return 0; @@ -91,7 +91,7 @@ byte* Pooling_Allocator::Memory_Block::alloc(u32bit n) throw() /* * Mark this memory as free, if we own it */ -void Pooling_Allocator::Memory_Block::free(void* ptr, u32bit blocks) throw() +void Pooling_Allocator::Memory_Block::free(void* ptr, u32bit blocks) { clear_mem(static_cast(ptr), blocks * BLOCK_SIZE); diff --git a/src/alloc/mem_pool/mem_pool.h b/src/alloc/mem_pool/mem_pool.h index a57800972..51571405e 100644 --- a/src/alloc/mem_pool/mem_pool.h +++ b/src/alloc/mem_pool/mem_pool.h @@ -44,9 +44,9 @@ class BOTAN_DLL Pooling_Allocator : public Allocator static u32bit bitmap_size() { return BITMAP_SIZE; } static u32bit block_size() { return BLOCK_SIZE; } - bool contains(void*, u32bit) const throw(); - byte* alloc(u32bit) throw(); - void free(void*, u32bit) throw(); + bool contains(void*, u32bit) const; + byte* alloc(u32bit); + void free(void*, u32bit); bool operator<(const Memory_Block& other) const { diff --git a/src/block/aes/aes.cpp b/src/block/aes/aes.cpp index 34698ae7f..7ba8136ec 100644 --- a/src/block/aes/aes.cpp +++ b/src/block/aes/aes.cpp @@ -258,7 +258,7 @@ AES::AES(u32bit key_size) : BlockCipher(16, key_size) /** * Clear memory of sensitive data */ -void AES::clear() throw() +void AES::clear() { EK.clear(); DK.clear(); diff --git a/src/block/aes/aes.h b/src/block/aes/aes.h index 768bb09e7..229ce307c 100644 --- a/src/block/aes/aes.h +++ b/src/block/aes/aes.h @@ -21,7 +21,7 @@ class BOTAN_DLL AES : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw(); + void clear(); std::string name() const { return "AES"; } BlockCipher* clone() const { return new AES; } diff --git a/src/block/block_cipher.h b/src/block/block_cipher.h index a27609171..1dcdde7c7 100644 --- a/src/block/block_cipher.h +++ b/src/block/block_cipher.h @@ -87,7 +87,7 @@ class BOTAN_DLL BlockCipher : public SymmetricAlgorithm /** * Zeroize internal state */ - virtual void clear() throw() = 0; + virtual void clear() = 0; BlockCipher(u32bit block_size, u32bit key_min, diff --git a/src/block/blowfish/blowfish.cpp b/src/block/blowfish/blowfish.cpp index 312603c3a..d0b182a84 100644 --- a/src/block/blowfish/blowfish.cpp +++ b/src/block/blowfish/blowfish.cpp @@ -128,7 +128,7 @@ void Blowfish::generate_sbox(u32bit Box[], u32bit size, /* * Clear memory of sensitive data */ -void Blowfish::clear() throw() +void Blowfish::clear() { P.copy(P_INIT, 18); S.copy(S_INIT, 1024); diff --git a/src/block/blowfish/blowfish.h b/src/block/blowfish/blowfish.h index 345c1ce49..5419308ca 100644 --- a/src/block/blowfish/blowfish.h +++ b/src/block/blowfish/blowfish.h @@ -21,7 +21,7 @@ class BOTAN_DLL Blowfish : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw(); + void clear(); std::string name() const { return "Blowfish"; } BlockCipher* clone() const { return new Blowfish; } diff --git a/src/block/cast/cast128.h b/src/block/cast/cast128.h index 864a4e47e..caffb97ea 100644 --- a/src/block/cast/cast128.h +++ b/src/block/cast/cast128.h @@ -21,7 +21,7 @@ class BOTAN_DLL CAST_128 : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw() { MK.clear(); RK.clear(); } + void clear() { MK.clear(); RK.clear(); } std::string name() const { return "CAST-128"; } BlockCipher* clone() const { return new CAST_128; } diff --git a/src/block/cast/cast256.h b/src/block/cast/cast256.h index 1be7fa9cf..0db3682ba 100644 --- a/src/block/cast/cast256.h +++ b/src/block/cast/cast256.h @@ -21,7 +21,7 @@ class BOTAN_DLL CAST_256 : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw() { MK.clear(); RK.clear(); } + void clear() { MK.clear(); RK.clear(); } std::string name() const { return "CAST-256"; } BlockCipher* clone() const { return new CAST_256; } diff --git a/src/block/des/des.h b/src/block/des/des.h index 856aaf60c..b28990178 100644 --- a/src/block/des/des.h +++ b/src/block/des/des.h @@ -21,7 +21,7 @@ class BOTAN_DLL DES : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw() { round_key.clear(); } + void clear() { round_key.clear(); } std::string name() const { return "DES"; } BlockCipher* clone() const { return new DES; } @@ -41,7 +41,7 @@ class BOTAN_DLL TripleDES : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw() { round_key.clear(); } + void clear() { round_key.clear(); } std::string name() const { return "TripleDES"; } BlockCipher* clone() const { return new TripleDES; } diff --git a/src/block/des/desx.h b/src/block/des/desx.h index d22895296..89664d064 100644 --- a/src/block/des/desx.h +++ b/src/block/des/desx.h @@ -21,7 +21,7 @@ class BOTAN_DLL DESX : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw() { des.clear(); K1.clear(); K2.clear(); } + void clear() { des.clear(); K1.clear(); K2.clear(); } std::string name() const { return "DESX"; } BlockCipher* clone() const { return new DESX; } diff --git a/src/block/gost_28147/gost_28147.h b/src/block/gost_28147/gost_28147.h index 18c1d0a29..bf6f8178b 100644 --- a/src/block/gost_28147/gost_28147.h +++ b/src/block/gost_28147/gost_28147.h @@ -47,7 +47,7 @@ class BOTAN_DLL GOST_28147_89 : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw() { EK.clear(); } + void clear() { EK.clear(); } std::string name() const { return "GOST-28147-89"; } BlockCipher* clone() const { return new GOST_28147_89(SBOX); } diff --git a/src/block/idea/idea.h b/src/block/idea/idea.h index 59484531b..c1a79f423 100644 --- a/src/block/idea/idea.h +++ b/src/block/idea/idea.h @@ -21,7 +21,7 @@ class BOTAN_DLL IDEA : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw() { EK.clear(); DK.clear(); } + void clear() { EK.clear(); DK.clear(); } std::string name() const { return "IDEA"; } BlockCipher* clone() const { return new IDEA; } diff --git a/src/block/kasumi/kasumi.h b/src/block/kasumi/kasumi.h index 0f5a5d182..c3db1cb05 100644 --- a/src/block/kasumi/kasumi.h +++ b/src/block/kasumi/kasumi.h @@ -21,7 +21,7 @@ class BOTAN_DLL KASUMI : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw() { EK.clear(); } + void clear() { EK.clear(); } std::string name() const { return "KASUMI"; } BlockCipher* clone() const { return new KASUMI; } diff --git a/src/block/lion/lion.cpp b/src/block/lion/lion.cpp index 0ed7b2630..e71091258 100644 --- a/src/block/lion/lion.cpp +++ b/src/block/lion/lion.cpp @@ -95,7 +95,7 @@ BlockCipher* Lion::clone() const /* * Clear memory of sensitive data */ -void Lion::clear() throw() +void Lion::clear() { hash->clear(); cipher->clear(); diff --git a/src/block/lion/lion.h b/src/block/lion/lion.h index d421771d6..f24acdb72 100644 --- a/src/block/lion/lion.h +++ b/src/block/lion/lion.h @@ -23,7 +23,7 @@ class BOTAN_DLL Lion : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw(); + void clear(); std::string name() const; BlockCipher* clone() const; diff --git a/src/block/lubyrack/lubyrack.cpp b/src/block/lubyrack/lubyrack.cpp index 6ad64f2b0..2003d2a89 100644 --- a/src/block/lubyrack/lubyrack.cpp +++ b/src/block/lubyrack/lubyrack.cpp @@ -92,7 +92,7 @@ void LubyRackoff::key_schedule(const byte key[], u32bit length) /* * Clear memory of sensitive data */ -void LubyRackoff::clear() throw() +void LubyRackoff::clear() { K1.clear(); K2.clear(); diff --git a/src/block/lubyrack/lubyrack.h b/src/block/lubyrack/lubyrack.h index 940b34603..7249cf157 100644 --- a/src/block/lubyrack/lubyrack.h +++ b/src/block/lubyrack/lubyrack.h @@ -22,7 +22,7 @@ class BOTAN_DLL LubyRackoff : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw(); + void clear(); std::string name() const; BlockCipher* clone() const; diff --git a/src/block/mars/mars.h b/src/block/mars/mars.h index 7d0bfe4fa..8173fb984 100644 --- a/src/block/mars/mars.h +++ b/src/block/mars/mars.h @@ -18,7 +18,7 @@ class BOTAN_DLL MARS : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw() { EK.clear(); } + void clear() { EK.clear(); } std::string name() const { return "MARS"; } BlockCipher* clone() const { return new MARS; } diff --git a/src/block/misty1/misty1.h b/src/block/misty1/misty1.h index 8db6881de..000830915 100644 --- a/src/block/misty1/misty1.h +++ b/src/block/misty1/misty1.h @@ -21,7 +21,7 @@ class BOTAN_DLL MISTY1 : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw() { EK.clear(); DK.clear(); } + void clear() { EK.clear(); DK.clear(); } std::string name() const { return "MISTY1"; } BlockCipher* clone() const { return new MISTY1; } diff --git a/src/block/noekeon/noekeon.cpp b/src/block/noekeon/noekeon.cpp index 1b327aa47..0bfce1882 100644 --- a/src/block/noekeon/noekeon.cpp +++ b/src/block/noekeon/noekeon.cpp @@ -201,7 +201,7 @@ void Noekeon::key_schedule(const byte key[], u32bit) /* * Clear memory of sensitive data */ -void Noekeon::clear() throw() +void Noekeon::clear() { EK.clear(); DK.clear(); diff --git a/src/block/noekeon/noekeon.h b/src/block/noekeon/noekeon.h index 37b24fb7d..4532c1be2 100644 --- a/src/block/noekeon/noekeon.h +++ b/src/block/noekeon/noekeon.h @@ -21,7 +21,7 @@ class BOTAN_DLL Noekeon : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw(); + void clear(); std::string name() const { return "Noekeon"; } BlockCipher* clone() const { return new Noekeon; } diff --git a/src/block/rc2/rc2.h b/src/block/rc2/rc2.h index db623b385..c6e4946f9 100644 --- a/src/block/rc2/rc2.h +++ b/src/block/rc2/rc2.h @@ -23,7 +23,7 @@ class BOTAN_DLL RC2 : public BlockCipher static byte EKB_code(u32bit); - void clear() throw() { K.clear(); } + void clear() { K.clear(); } std::string name() const { return "RC2"; } BlockCipher* clone() const { return new RC2; } diff --git a/src/block/rc5/rc5.h b/src/block/rc5/rc5.h index ff9204710..82931c1d2 100644 --- a/src/block/rc5/rc5.h +++ b/src/block/rc5/rc5.h @@ -21,7 +21,7 @@ class BOTAN_DLL RC5 : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw() { S.clear(); } + void clear() { S.clear(); } std::string name() const; BlockCipher* clone() const { return new RC5(ROUNDS); } diff --git a/src/block/rc6/rc6.h b/src/block/rc6/rc6.h index 5171006f5..6cd0f54db 100644 --- a/src/block/rc6/rc6.h +++ b/src/block/rc6/rc6.h @@ -21,7 +21,7 @@ class BOTAN_DLL RC6 : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw() { S.clear(); } + void clear() { S.clear(); } std::string name() const { return "RC6"; } BlockCipher* clone() const { return new RC6; } diff --git a/src/block/safer/safer_sk.h b/src/block/safer/safer_sk.h index 4d17bba51..80d2dc069 100644 --- a/src/block/safer/safer_sk.h +++ b/src/block/safer/safer_sk.h @@ -21,7 +21,7 @@ class BOTAN_DLL SAFER_SK : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw() { EK.clear(); } + void clear() { EK.clear(); } std::string name() const; BlockCipher* clone() const; diff --git a/src/block/seed/seed.h b/src/block/seed/seed.h index 5a5a512e7..5a4b44057 100644 --- a/src/block/seed/seed.h +++ b/src/block/seed/seed.h @@ -21,7 +21,7 @@ class BOTAN_DLL SEED : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw() { K.clear(); } + void clear() { K.clear(); } std::string name() const { return "SEED"; } BlockCipher* clone() const { return new SEED; } diff --git a/src/block/serpent/serpent.h b/src/block/serpent/serpent.h index d919c3008..4fa7451b9 100644 --- a/src/block/serpent/serpent.h +++ b/src/block/serpent/serpent.h @@ -21,7 +21,7 @@ class BOTAN_DLL Serpent : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw() { round_key.clear(); } + void clear() { round_key.clear(); } std::string name() const { return "Serpent"; } BlockCipher* clone() const { return new Serpent; } Serpent() : BlockCipher(16, 16, 32, 8) {} diff --git a/src/block/skipjack/skipjack.cpp b/src/block/skipjack/skipjack.cpp index 6c308c0f8..e8b2cfb8d 100644 --- a/src/block/skipjack/skipjack.cpp +++ b/src/block/skipjack/skipjack.cpp @@ -165,7 +165,7 @@ void Skipjack::key_schedule(const byte key[], u32bit) /* * Clear memory of sensitive data */ -void Skipjack::clear() throw() +void Skipjack::clear() { for(u32bit j = 0; j != 10; ++j) FTABLE[j].clear(); diff --git a/src/block/skipjack/skipjack.h b/src/block/skipjack/skipjack.h index f12032f36..60fad6310 100644 --- a/src/block/skipjack/skipjack.h +++ b/src/block/skipjack/skipjack.h @@ -21,7 +21,7 @@ class BOTAN_DLL Skipjack : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw(); + void clear(); std::string name() const { return "Skipjack"; } BlockCipher* clone() const { return new Skipjack; } diff --git a/src/block/square/square.cpp b/src/block/square/square.cpp index fdd47d3b2..90f2301cf 100644 --- a/src/block/square/square.cpp +++ b/src/block/square/square.cpp @@ -196,7 +196,7 @@ void Square::transform(u32bit round_key[4]) /* * Clear memory of sensitive data */ -void Square::clear() throw() +void Square::clear() { EK.clear(); DK.clear(); diff --git a/src/block/square/square.h b/src/block/square/square.h index 5d9cfc78c..088122181 100644 --- a/src/block/square/square.h +++ b/src/block/square/square.h @@ -21,7 +21,7 @@ class BOTAN_DLL Square : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw(); + void clear(); std::string name() const { return "Square"; } BlockCipher* clone() const { return new Square; } diff --git a/src/block/tea/tea.h b/src/block/tea/tea.h index 825a051aa..c19f272a6 100644 --- a/src/block/tea/tea.h +++ b/src/block/tea/tea.h @@ -21,7 +21,7 @@ class BOTAN_DLL TEA : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw() { K.clear(); } + void clear() { K.clear(); } std::string name() const { return "TEA"; } BlockCipher* clone() const { return new TEA; } diff --git a/src/block/twofish/twofish.cpp b/src/block/twofish/twofish.cpp index 6a482a8f3..3136837aa 100644 --- a/src/block/twofish/twofish.cpp +++ b/src/block/twofish/twofish.cpp @@ -218,7 +218,7 @@ void Twofish::rs_mul(byte S[4], byte key, u32bit offset) /* * Clear memory of sensitive data */ -void Twofish::clear() throw() +void Twofish::clear() { SBox0.clear(); SBox1.clear(); diff --git a/src/block/twofish/twofish.h b/src/block/twofish/twofish.h index 87b9aa626..71a1e8781 100644 --- a/src/block/twofish/twofish.h +++ b/src/block/twofish/twofish.h @@ -21,7 +21,7 @@ class BOTAN_DLL Twofish : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw(); + void clear(); std::string name() const { return "Twofish"; } BlockCipher* clone() const { return new Twofish; } diff --git a/src/block/xtea/xtea.h b/src/block/xtea/xtea.h index de265818d..f3b554edb 100644 --- a/src/block/xtea/xtea.h +++ b/src/block/xtea/xtea.h @@ -21,7 +21,7 @@ class BOTAN_DLL XTEA : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() throw() { EK.clear(); } + void clear() { EK.clear(); } std::string name() const { return "XTEA"; } BlockCipher* clone() const { return new XTEA; } diff --git a/src/checksum/adler32/adler32.h b/src/checksum/adler32/adler32.h index 98a28bc81..79804a842 100644 --- a/src/checksum/adler32/adler32.h +++ b/src/checksum/adler32/adler32.h @@ -18,7 +18,7 @@ namespace Botan { class BOTAN_DLL Adler32 : public HashFunction { public: - void clear() throw() { S1 = 1; S2 = 0; } + void clear() { S1 = 1; S2 = 0; } std::string name() const { return "Adler32"; } HashFunction* clone() const { return new Adler32; } Adler32() : HashFunction(4) { clear(); } diff --git a/src/checksum/crc24/crc24.h b/src/checksum/crc24/crc24.h index bca4d0e89..f59ac4a45 100644 --- a/src/checksum/crc24/crc24.h +++ b/src/checksum/crc24/crc24.h @@ -18,7 +18,7 @@ namespace Botan { class BOTAN_DLL CRC24 : public HashFunction { public: - void clear() throw() { crc = 0xB704CE; } + void clear() { crc = 0xB704CE; } std::string name() const { return "CRC24"; } HashFunction* clone() const { return new CRC24; } CRC24() : HashFunction(3) { clear(); } diff --git a/src/checksum/crc32/crc32.h b/src/checksum/crc32/crc32.h index 390fb100e..998e8489e 100644 --- a/src/checksum/crc32/crc32.h +++ b/src/checksum/crc32/crc32.h @@ -18,7 +18,7 @@ namespace Botan { class BOTAN_DLL CRC32 : public HashFunction { public: - void clear() throw() { crc = 0xFFFFFFFF; } + void clear() { crc = 0xFFFFFFFF; } std::string name() const { return "CRC32"; } HashFunction* clone() const { return new CRC32; } CRC32() : HashFunction(4) { clear(); } diff --git a/src/engine/openssl/arc4_openssl.cpp b/src/engine/openssl/arc4_openssl.cpp index 08ed3eb10..793e1faff 100644 --- a/src/engine/openssl/arc4_openssl.cpp +++ b/src/engine/openssl/arc4_openssl.cpp @@ -19,7 +19,7 @@ namespace { class ARC4_OpenSSL : public StreamCipher { public: - void clear() throw() { std::memset(&state, 0, sizeof(state)); } + void clear() { std::memset(&state, 0, sizeof(state)); } std::string name() const; StreamCipher* clone() const { return new ARC4_OpenSSL(SKIP); } diff --git a/src/engine/openssl/ossl_bc.cpp b/src/engine/openssl/ossl_bc.cpp index 9c85439ca..7fdf54e42 100644 --- a/src/engine/openssl/ossl_bc.cpp +++ b/src/engine/openssl/ossl_bc.cpp @@ -18,7 +18,7 @@ namespace { class EVP_BlockCipher : public BlockCipher { public: - void clear() throw(); + void clear(); std::string name() const { return cipher_name; } BlockCipher* clone() const; EVP_BlockCipher(const EVP_CIPHER*, const std::string&); @@ -145,7 +145,7 @@ BlockCipher* EVP_BlockCipher::clone() const /* * Clear memory of sensitive data */ -void EVP_BlockCipher::clear() throw() +void EVP_BlockCipher::clear() { const EVP_CIPHER* algo = EVP_CIPHER_CTX_cipher(&encrypt); diff --git a/src/engine/openssl/ossl_md.cpp b/src/engine/openssl/ossl_md.cpp index 42975c8a3..1e01a6f25 100644 --- a/src/engine/openssl/ossl_md.cpp +++ b/src/engine/openssl/ossl_md.cpp @@ -18,7 +18,7 @@ namespace { class EVP_HashFunction : public HashFunction { public: - void clear() throw(); + void clear(); std::string name() const { return algo_name; } HashFunction* clone() const; EVP_HashFunction(const EVP_MD*, const std::string&); @@ -52,7 +52,7 @@ void EVP_HashFunction::final_result(byte output[]) /* * Clear memory of sensitive data */ -void EVP_HashFunction::clear() throw() +void EVP_HashFunction::clear() { const EVP_MD* algo = EVP_MD_CTX_md(&md); EVP_DigestInit_ex(&md, algo, 0); diff --git a/src/hash/bmw/bmw_512.cpp b/src/hash/bmw/bmw_512.cpp index ad3826351..ae80d5725 100644 --- a/src/hash/bmw/bmw_512.cpp +++ b/src/hash/bmw/bmw_512.cpp @@ -176,7 +176,7 @@ void BMW_512::copy_out(byte output[]) /* * Clear memory of sensitive data */ -void BMW_512::clear() throw() +void BMW_512::clear() { MDx_HashFunction::clear(); M.clear(); diff --git a/src/hash/bmw/bmw_512.h b/src/hash/bmw/bmw_512.h index d1f2539e9..55cd761a9 100644 --- a/src/hash/bmw/bmw_512.h +++ b/src/hash/bmw/bmw_512.h @@ -15,7 +15,7 @@ namespace Botan { class BMW_512 : public MDx_HashFunction { public: - void clear() throw(); + void clear(); std::string name() const { return "BMW512"; } HashFunction* clone() const { return new BMW_512; } BMW_512() : MDx_HashFunction(64, 128, false, true) { clear(); } diff --git a/src/hash/fork256/fork256.cpp b/src/hash/fork256/fork256.cpp index f80bff43a..6718f9f97 100644 --- a/src/hash/fork256/fork256.cpp +++ b/src/hash/fork256/fork256.cpp @@ -133,7 +133,7 @@ void FORK_256::copy_out(byte output[]) /* * Clear memory of sensitive data */ -void FORK_256::clear() throw() +void FORK_256::clear() { MDx_HashFunction::clear(); digest[0] = 0x6A09E667; diff --git a/src/hash/fork256/fork256.h b/src/hash/fork256/fork256.h index 70d336cc9..f535370e6 100644 --- a/src/hash/fork256/fork256.h +++ b/src/hash/fork256/fork256.h @@ -18,7 +18,7 @@ namespace Botan { class BOTAN_DLL FORK_256 : public MDx_HashFunction { public: - void clear() throw(); + void clear(); std::string name() const { return "FORK-256"; } HashFunction* clone() const { return new FORK_256; } FORK_256() : MDx_HashFunction(32, 64, true, true) { clear(); } diff --git a/src/hash/gost_3411/gost_3411.cpp b/src/hash/gost_3411/gost_3411.cpp index 8f3982fca..90ef3e805 100644 --- a/src/hash/gost_3411/gost_3411.cpp +++ b/src/hash/gost_3411/gost_3411.cpp @@ -23,7 +23,7 @@ GOST_34_11::GOST_34_11() : position = 0; } -void GOST_34_11::clear() throw() +void GOST_34_11::clear() { cipher.clear(); sum.clear(); diff --git a/src/hash/gost_3411/gost_3411.h b/src/hash/gost_3411/gost_3411.h index 960adaa44..7b17bdc1f 100644 --- a/src/hash/gost_3411/gost_3411.h +++ b/src/hash/gost_3411/gost_3411.h @@ -19,7 +19,7 @@ namespace Botan { class BOTAN_DLL GOST_34_11 : public HashFunction { public: - void clear() throw(); + void clear(); std::string name() const { return "GOST-R-34.11-94" ; } HashFunction* clone() const { return new GOST_34_11; } diff --git a/src/hash/has160/has160.cpp b/src/hash/has160/has160.cpp index 9a505d31d..533efe595 100644 --- a/src/hash/has160/has160.cpp +++ b/src/hash/has160/has160.cpp @@ -145,7 +145,7 @@ void HAS_160::copy_out(byte output[]) /* * Clear memory of sensitive data */ -void HAS_160::clear() throw() +void HAS_160::clear() { MDx_HashFunction::clear(); X.clear(); diff --git a/src/hash/has160/has160.h b/src/hash/has160/has160.h index 44bb63b9d..cae66c93a 100644 --- a/src/hash/has160/has160.h +++ b/src/hash/has160/has160.h @@ -18,7 +18,7 @@ namespace Botan { class BOTAN_DLL HAS_160 : public MDx_HashFunction { public: - void clear() throw(); + void clear(); std::string name() const { return "HAS-160"; } HashFunction* clone() const { return new HAS_160; } HAS_160() : MDx_HashFunction(20, 64, false, true) { clear(); } diff --git a/src/hash/hash.h b/src/hash/hash.h index a30234be0..1098951d8 100644 --- a/src/hash/hash.h +++ b/src/hash/hash.h @@ -38,7 +38,7 @@ class BOTAN_DLL HashFunction : public BufferedComputation /** * Reset the internal state of this object. */ - virtual void clear() throw() = 0; + virtual void clear() = 0; HashFunction(u32bit hash_len, u32bit block_len = 0) : BufferedComputation(hash_len), HASH_BLOCK_SIZE(block_len) {} diff --git a/src/hash/md2/md2.cpp b/src/hash/md2/md2.cpp index c67e72b5a..f03518ec0 100644 --- a/src/hash/md2/md2.cpp +++ b/src/hash/md2/md2.cpp @@ -97,7 +97,7 @@ void MD2::final_result(byte output[]) /** * Clear memory of sensitive data */ -void MD2::clear() throw() +void MD2::clear() { X.clear(); checksum.clear(); diff --git a/src/hash/md2/md2.h b/src/hash/md2/md2.h index 9337c43f4..0a7125759 100644 --- a/src/hash/md2/md2.h +++ b/src/hash/md2/md2.h @@ -18,7 +18,7 @@ namespace Botan { class BOTAN_DLL MD2 : public HashFunction { public: - void clear() throw(); + void clear(); std::string name() const { return "MD2"; } HashFunction* clone() const { return new MD2; } MD2() : HashFunction(16, 16) { clear(); } diff --git a/src/hash/md4/md4.cpp b/src/hash/md4/md4.cpp index 39e3c8c41..b2870066d 100644 --- a/src/hash/md4/md4.cpp +++ b/src/hash/md4/md4.cpp @@ -95,7 +95,7 @@ void MD4::copy_out(byte output[]) /* * Clear memory of sensitive data */ -void MD4::clear() throw() +void MD4::clear() { MDx_HashFunction::clear(); M.clear(); diff --git a/src/hash/md4/md4.h b/src/hash/md4/md4.h index df6f2292d..0b76a70e4 100644 --- a/src/hash/md4/md4.h +++ b/src/hash/md4/md4.h @@ -18,7 +18,7 @@ namespace Botan { class BOTAN_DLL MD4 : public MDx_HashFunction { public: - void clear() throw(); + void clear(); std::string name() const { return "MD4"; } HashFunction* clone() const { return new MD4; } MD4() : MDx_HashFunction(16, 64, false, true) { clear(); } diff --git a/src/hash/md5/md5.cpp b/src/hash/md5/md5.cpp index 7c280aab7..163413bec 100644 --- a/src/hash/md5/md5.cpp +++ b/src/hash/md5/md5.cpp @@ -123,7 +123,7 @@ void MD5::copy_out(byte output[]) /* * Clear memory of sensitive data */ -void MD5::clear() throw() +void MD5::clear() { MDx_HashFunction::clear(); M.clear(); diff --git a/src/hash/md5/md5.h b/src/hash/md5/md5.h index 85f684d8b..456a02c28 100644 --- a/src/hash/md5/md5.h +++ b/src/hash/md5/md5.h @@ -18,7 +18,7 @@ namespace Botan { class BOTAN_DLL MD5 : public MDx_HashFunction { public: - void clear() throw(); + void clear(); std::string name() const { return "MD5"; } HashFunction* clone() const { return new MD5; } MD5() : MDx_HashFunction(16, 64, false, true) { clear(); } diff --git a/src/hash/mdx_hash/mdx_hash.cpp b/src/hash/mdx_hash/mdx_hash.cpp index b630ec227..28402c2c5 100644 --- a/src/hash/mdx_hash/mdx_hash.cpp +++ b/src/hash/mdx_hash/mdx_hash.cpp @@ -28,7 +28,7 @@ MDx_HashFunction::MDx_HashFunction(u32bit hash_len, u32bit block_len, /** * Clear memory of sensitive data */ -void MDx_HashFunction::clear() throw() +void MDx_HashFunction::clear() { buffer.clear(); count = position = 0; diff --git a/src/hash/mdx_hash/mdx_hash.h b/src/hash/mdx_hash/mdx_hash.h index 0c3aa7806..2d70deed3 100644 --- a/src/hash/mdx_hash/mdx_hash.h +++ b/src/hash/mdx_hash/mdx_hash.h @@ -25,7 +25,7 @@ class BOTAN_DLL MDx_HashFunction : public HashFunction void final_result(byte output[]); virtual void compress_n(const byte block[], u32bit block_n) = 0; - void clear() throw(); + void clear(); virtual void copy_out(byte[]) = 0; virtual void write_count(byte[]); private: diff --git a/src/hash/par_hash/par_hash.cpp b/src/hash/par_hash/par_hash.cpp index 4b0c7c466..0ba3f5a4f 100644 --- a/src/hash/par_hash/par_hash.cpp +++ b/src/hash/par_hash/par_hash.cpp @@ -77,7 +77,7 @@ HashFunction* Parallel::clone() const /* * Clear memory of sensitive data */ -void Parallel::clear() throw() +void Parallel::clear() { for(u32bit j = 0; j != hashes.size(); ++j) hashes[j]->clear(); diff --git a/src/hash/par_hash/par_hash.h b/src/hash/par_hash/par_hash.h index 7e75c27be..874e491b1 100644 --- a/src/hash/par_hash/par_hash.h +++ b/src/hash/par_hash/par_hash.h @@ -19,7 +19,7 @@ namespace Botan { class BOTAN_DLL Parallel : public HashFunction { public: - void clear() throw(); + void clear(); std::string name() const; HashFunction* clone() const; diff --git a/src/hash/rmd128/rmd128.cpp b/src/hash/rmd128/rmd128.cpp index 8b2c0ccf8..899e50914 100644 --- a/src/hash/rmd128/rmd128.cpp +++ b/src/hash/rmd128/rmd128.cpp @@ -159,7 +159,7 @@ void RIPEMD_128::copy_out(byte output[]) /* * Clear memory of sensitive data */ -void RIPEMD_128::clear() throw() +void RIPEMD_128::clear() { MDx_HashFunction::clear(); M.clear(); diff --git a/src/hash/rmd128/rmd128.h b/src/hash/rmd128/rmd128.h index 031ae5746..d9cb4ebb4 100644 --- a/src/hash/rmd128/rmd128.h +++ b/src/hash/rmd128/rmd128.h @@ -18,7 +18,7 @@ namespace Botan { class BOTAN_DLL RIPEMD_128 : public MDx_HashFunction { public: - void clear() throw(); + void clear(); std::string name() const { return "RIPEMD-128"; } HashFunction* clone() const { return new RIPEMD_128; } RIPEMD_128() : MDx_HashFunction(16, 64, false, true) { clear(); } diff --git a/src/hash/rmd160/rmd160.cpp b/src/hash/rmd160/rmd160.cpp index 863de8487..2baf5ab08 100644 --- a/src/hash/rmd160/rmd160.cpp +++ b/src/hash/rmd160/rmd160.cpp @@ -196,7 +196,7 @@ void RIPEMD_160::copy_out(byte output[]) /* * Clear memory of sensitive data */ -void RIPEMD_160::clear() throw() +void RIPEMD_160::clear() { MDx_HashFunction::clear(); M.clear(); diff --git a/src/hash/rmd160/rmd160.h b/src/hash/rmd160/rmd160.h index f2babc582..aee007b98 100644 --- a/src/hash/rmd160/rmd160.h +++ b/src/hash/rmd160/rmd160.h @@ -18,7 +18,7 @@ namespace Botan { class BOTAN_DLL RIPEMD_160 : public MDx_HashFunction { public: - void clear() throw(); + void clear(); std::string name() const { return "RIPEMD-160"; } HashFunction* clone() const { return new RIPEMD_160; } RIPEMD_160() : MDx_HashFunction(20, 64, false, true) { clear(); } diff --git a/src/hash/sha1/sha160.cpp b/src/hash/sha1/sha160.cpp index 45323a11b..a9e6880a7 100644 --- a/src/hash/sha1/sha160.cpp +++ b/src/hash/sha1/sha160.cpp @@ -130,7 +130,7 @@ void SHA_160::copy_out(byte output[]) /* * Clear memory of sensitive data */ -void SHA_160::clear() throw() +void SHA_160::clear() { MDx_HashFunction::clear(); W.clear(); diff --git a/src/hash/sha1/sha160.h b/src/hash/sha1/sha160.h index 232cf0322..142c6bf17 100644 --- a/src/hash/sha1/sha160.h +++ b/src/hash/sha1/sha160.h @@ -18,7 +18,7 @@ namespace Botan { class BOTAN_DLL SHA_160 : public MDx_HashFunction { public: - void clear() throw(); + void clear(); std::string name() const { return "SHA-160"; } HashFunction* clone() const { return new SHA_160; } SHA_160(); diff --git a/src/hash/sha2/sha2_32.cpp b/src/hash/sha2/sha2_32.cpp index 9da2ec23f..9fbcae44d 100644 --- a/src/hash/sha2/sha2_32.cpp +++ b/src/hash/sha2/sha2_32.cpp @@ -152,7 +152,7 @@ void SHA_224_256_BASE::copy_out(byte output[]) /* * Clear memory of sensitive data */ -void SHA_224_256_BASE::clear() throw() +void SHA_224_256_BASE::clear() { MDx_HashFunction::clear(); W.clear(); @@ -161,7 +161,7 @@ void SHA_224_256_BASE::clear() throw() /* * Clear memory of sensitive data */ -void SHA_224::clear() throw() +void SHA_224::clear() { SHA_224_256_BASE::clear(); digest[0] = 0xc1059ed8; @@ -177,7 +177,7 @@ void SHA_224::clear() throw() /* * Clear memory of sensitive data */ -void SHA_256::clear() throw() +void SHA_256::clear() { SHA_224_256_BASE::clear(); digest[0] = 0x6A09E667; diff --git a/src/hash/sha2/sha2_32.h b/src/hash/sha2/sha2_32.h index 05083d19d..313eec676 100644 --- a/src/hash/sha2/sha2_32.h +++ b/src/hash/sha2/sha2_32.h @@ -19,7 +19,7 @@ namespace Botan { class BOTAN_DLL SHA_224_256_BASE : public MDx_HashFunction { protected: - void clear() throw(); + void clear(); SHA_224_256_BASE(u32bit out) : MDx_HashFunction(out, 64, true, true) { clear(); } @@ -36,7 +36,7 @@ class BOTAN_DLL SHA_224_256_BASE : public MDx_HashFunction class BOTAN_DLL SHA_224 : public SHA_224_256_BASE { public: - void clear() throw(); + void clear(); std::string name() const { return "SHA-224"; } HashFunction* clone() const { return new SHA_224; } SHA_224() : SHA_224_256_BASE(28) { clear(); } @@ -48,7 +48,7 @@ class BOTAN_DLL SHA_224 : public SHA_224_256_BASE class BOTAN_DLL SHA_256 : public SHA_224_256_BASE { public: - void clear() throw(); + void clear(); std::string name() const { return "SHA-256"; } HashFunction* clone() const { return new SHA_256; } SHA_256() : SHA_224_256_BASE(32) { clear (); } diff --git a/src/hash/sha2/sha2_64.cpp b/src/hash/sha2/sha2_64.cpp index e9b4c2e5a..3c771eb44 100644 --- a/src/hash/sha2/sha2_64.cpp +++ b/src/hash/sha2/sha2_64.cpp @@ -167,7 +167,7 @@ void SHA_384_512_BASE::copy_out(byte output[]) /* * Clear memory of sensitive data */ -void SHA_384_512_BASE::clear() throw() +void SHA_384_512_BASE::clear() { MDx_HashFunction::clear(); W.clear(); @@ -176,7 +176,7 @@ void SHA_384_512_BASE::clear() throw() /* * Clear memory of sensitive data */ -void SHA_384::clear() throw() +void SHA_384::clear() { SHA_384_512_BASE::clear(); digest[0] = 0xCBBB9D5DC1059ED8; @@ -192,7 +192,7 @@ void SHA_384::clear() throw() /* * Clear memory of sensitive data */ -void SHA_512::clear() throw() +void SHA_512::clear() { SHA_384_512_BASE::clear(); digest[0] = 0x6A09E667F3BCC908; diff --git a/src/hash/sha2/sha2_64.h b/src/hash/sha2/sha2_64.h index dcc6dc83b..8e4d171f8 100644 --- a/src/hash/sha2/sha2_64.h +++ b/src/hash/sha2/sha2_64.h @@ -18,7 +18,7 @@ namespace Botan { class BOTAN_DLL SHA_384_512_BASE : public MDx_HashFunction { protected: - void clear() throw(); + void clear(); SHA_384_512_BASE(u32bit out) : MDx_HashFunction(out, 128, true, true, 16) {} @@ -37,7 +37,7 @@ class BOTAN_DLL SHA_384_512_BASE : public MDx_HashFunction class BOTAN_DLL SHA_384 : public SHA_384_512_BASE { public: - void clear() throw(); + void clear(); std::string name() const { return "SHA-384"; } HashFunction* clone() const { return new SHA_384; } SHA_384() : SHA_384_512_BASE(48) { clear(); } @@ -49,7 +49,7 @@ class BOTAN_DLL SHA_384 : public SHA_384_512_BASE class BOTAN_DLL SHA_512 : public SHA_384_512_BASE { public: - void clear() throw(); + void clear(); std::string name() const { return "SHA-512"; } HashFunction* clone() const { return new SHA_512; } SHA_512() : SHA_384_512_BASE(64) { clear(); } diff --git a/src/hash/skein/skein_512.cpp b/src/hash/skein/skein_512.cpp index a48cfc186..b24efd5f7 100644 --- a/src/hash/skein/skein_512.cpp +++ b/src/hash/skein/skein_512.cpp @@ -183,7 +183,7 @@ HashFunction* Skein_512::clone() const return new Skein_512(output_bits, personalization); } -void Skein_512::clear() throw() +void Skein_512::clear() { H.clear(); T.clear(); diff --git a/src/hash/skein/skein_512.h b/src/hash/skein/skein_512.h index fa558fc0d..db8d3c8b7 100644 --- a/src/hash/skein/skein_512.h +++ b/src/hash/skein/skein_512.h @@ -22,7 +22,7 @@ class BOTAN_DLL Skein_512 : public HashFunction HashFunction* clone() const; std::string name() const; - void clear() throw(); + void clear(); private: void add_data(const byte input[], u32bit length); void final_result(byte out[]); diff --git a/src/hash/tiger/tiger.cpp b/src/hash/tiger/tiger.cpp index e46f2cb77..975ea9b6b 100644 --- a/src/hash/tiger/tiger.cpp +++ b/src/hash/tiger/tiger.cpp @@ -129,7 +129,7 @@ void Tiger::mix(u64bit X[8]) /* * Clear memory of sensitive data */ -void Tiger::clear() throw() +void Tiger::clear() { MDx_HashFunction::clear(); X.clear(); diff --git a/src/hash/tiger/tiger.h b/src/hash/tiger/tiger.h index 63184a938..86ddcd270 100644 --- a/src/hash/tiger/tiger.h +++ b/src/hash/tiger/tiger.h @@ -18,7 +18,7 @@ namespace Botan { class BOTAN_DLL Tiger : public MDx_HashFunction { public: - void clear() throw(); + void clear(); std::string name() const; HashFunction* clone() const { return new Tiger(OUTPUT_LENGTH); } Tiger(u32bit = 24, u32bit = 3); diff --git a/src/hash/whirlpool/whrlpool.cpp b/src/hash/whirlpool/whrlpool.cpp index 8548d6192..b7a02a9b6 100644 --- a/src/hash/whirlpool/whrlpool.cpp +++ b/src/hash/whirlpool/whrlpool.cpp @@ -136,7 +136,7 @@ void Whirlpool::copy_out(byte output[]) /* * Clear memory of sensitive data */ -void Whirlpool::clear() throw() +void Whirlpool::clear() { MDx_HashFunction::clear(); M.clear(); diff --git a/src/hash/whirlpool/whrlpool.h b/src/hash/whirlpool/whrlpool.h index b72ff609f..34b4d2302 100644 --- a/src/hash/whirlpool/whrlpool.h +++ b/src/hash/whirlpool/whrlpool.h @@ -18,7 +18,7 @@ namespace Botan { class BOTAN_DLL Whirlpool : public MDx_HashFunction { public: - void clear() throw(); + void clear(); std::string name() const { return "Whirlpool"; } HashFunction* clone() const { return new Whirlpool; } Whirlpool() : MDx_HashFunction(64, 64, true, true, 32) { clear(); } diff --git a/src/mac/cbc_mac/cbc_mac.cpp b/src/mac/cbc_mac/cbc_mac.cpp index f5d9e1567..0617e3e90 100644 --- a/src/mac/cbc_mac/cbc_mac.cpp +++ b/src/mac/cbc_mac/cbc_mac.cpp @@ -62,7 +62,7 @@ void CBC_MAC::key_schedule(const byte key[], u32bit length) /* * Clear memory of sensitive data */ -void CBC_MAC::clear() throw() +void CBC_MAC::clear() { e->clear(); state.clear(); diff --git a/src/mac/cbc_mac/cbc_mac.h b/src/mac/cbc_mac/cbc_mac.h index d17d792d3..15026c0a9 100644 --- a/src/mac/cbc_mac/cbc_mac.h +++ b/src/mac/cbc_mac/cbc_mac.h @@ -19,7 +19,7 @@ namespace Botan { class BOTAN_DLL CBC_MAC : public MessageAuthenticationCode { public: - void clear() throw(); + void clear(); std::string name() const; MessageAuthenticationCode* clone() const; diff --git a/src/mac/cmac/cmac.cpp b/src/mac/cmac/cmac.cpp index 84aa61e03..58923138b 100644 --- a/src/mac/cmac/cmac.cpp +++ b/src/mac/cmac/cmac.cpp @@ -101,7 +101,7 @@ void CMAC::key_schedule(const byte key[], u32bit length) /* * Clear memory of sensitive data */ -void CMAC::clear() throw() +void CMAC::clear() { e->clear(); state.clear(); diff --git a/src/mac/cmac/cmac.h b/src/mac/cmac/cmac.h index 5a6deb7b0..8297e5ea1 100644 --- a/src/mac/cmac/cmac.h +++ b/src/mac/cmac/cmac.h @@ -19,7 +19,7 @@ namespace Botan { class BOTAN_DLL CMAC : public MessageAuthenticationCode { public: - void clear() throw(); + void clear(); std::string name() const; MessageAuthenticationCode* clone() const; diff --git a/src/mac/hmac/hmac.cpp b/src/mac/hmac/hmac.cpp index 717e2640c..99be479fa 100644 --- a/src/mac/hmac/hmac.cpp +++ b/src/mac/hmac/hmac.cpp @@ -58,7 +58,7 @@ void HMAC::key_schedule(const byte key[], u32bit length) /* * Clear memory of sensitive data */ -void HMAC::clear() throw() +void HMAC::clear() { hash->clear(); i_key.clear(); diff --git a/src/mac/hmac/hmac.h b/src/mac/hmac/hmac.h index 932af71fc..62bb69853 100644 --- a/src/mac/hmac/hmac.h +++ b/src/mac/hmac/hmac.h @@ -19,7 +19,7 @@ namespace Botan { class BOTAN_DLL HMAC : public MessageAuthenticationCode { public: - void clear() throw(); + void clear(); std::string name() const; MessageAuthenticationCode* clone() const; diff --git a/src/mac/mac.h b/src/mac/mac.h index 3ec5fff5f..7c73a2900 100644 --- a/src/mac/mac.h +++ b/src/mac/mac.h @@ -43,7 +43,7 @@ class BOTAN_DLL MessageAuthenticationCode : public BufferedComputation, /** * Reset the internal state of this object. */ - virtual void clear() throw() = 0; + virtual void clear() = 0; MessageAuthenticationCode(u32bit mac_len, u32bit key_min, diff --git a/src/mac/ssl3mac/ssl3_mac.cpp b/src/mac/ssl3mac/ssl3_mac.cpp index c29296ced..23a636424 100644 --- a/src/mac/ssl3mac/ssl3_mac.cpp +++ b/src/mac/ssl3mac/ssl3_mac.cpp @@ -46,7 +46,7 @@ void SSL3_MAC::key_schedule(const byte key[], u32bit length) /* * Clear memory of sensitive data */ -void SSL3_MAC::clear() throw() +void SSL3_MAC::clear() { hash->clear(); i_key.clear(); diff --git a/src/mac/ssl3mac/ssl3_mac.h b/src/mac/ssl3mac/ssl3_mac.h index dcaf7f404..828b072ed 100644 --- a/src/mac/ssl3mac/ssl3_mac.h +++ b/src/mac/ssl3mac/ssl3_mac.h @@ -19,7 +19,7 @@ namespace Botan { class BOTAN_DLL SSL3_MAC : public MessageAuthenticationCode { public: - void clear() throw(); + void clear(); std::string name() const; MessageAuthenticationCode* clone() const; diff --git a/src/mac/x919_mac/x919_mac.cpp b/src/mac/x919_mac/x919_mac.cpp index ef89cac9c..52260494a 100644 --- a/src/mac/x919_mac/x919_mac.cpp +++ b/src/mac/x919_mac/x919_mac.cpp @@ -63,7 +63,7 @@ void ANSI_X919_MAC::key_schedule(const byte key[], u32bit length) /* * Clear memory of sensitive data */ -void ANSI_X919_MAC::clear() throw() +void ANSI_X919_MAC::clear() { e->clear(); d->clear(); diff --git a/src/mac/x919_mac/x919_mac.h b/src/mac/x919_mac/x919_mac.h index 1c2a06bee..a4690fdcd 100644 --- a/src/mac/x919_mac/x919_mac.h +++ b/src/mac/x919_mac/x919_mac.h @@ -19,7 +19,7 @@ namespace Botan { class BOTAN_DLL ANSI_X919_MAC : public MessageAuthenticationCode { public: - void clear() throw(); + void clear(); std::string name() const; MessageAuthenticationCode* clone() const; diff --git a/src/pk_pad/emsa.h b/src/pk_pad/emsa.h index e2491e40f..8b19d3cb2 100644 --- a/src/pk_pad/emsa.h +++ b/src/pk_pad/emsa.h @@ -27,7 +27,7 @@ class BOTAN_DLL EMSA RandomNumberGenerator& rng) = 0; virtual bool verify(const MemoryRegion&, const MemoryRegion&, - u32bit) throw() = 0; + u32bit) = 0; virtual ~EMSA() {} }; diff --git a/src/pk_pad/emsa1/emsa1.cpp b/src/pk_pad/emsa1/emsa1.cpp index 26d709c28..0ae7e8d2d 100644 --- a/src/pk_pad/emsa1/emsa1.cpp +++ b/src/pk_pad/emsa1/emsa1.cpp @@ -72,7 +72,7 @@ SecureVector EMSA1::encoding_of(const MemoryRegion& msg, * EMSA1 Decode/Verify Operation */ bool EMSA1::verify(const MemoryRegion& coded, - const MemoryRegion& raw, u32bit key_bits) throw() + const MemoryRegion& raw, u32bit key_bits) { try { if(raw.size() != hash->OUTPUT_LENGTH) diff --git a/src/pk_pad/emsa1/emsa1.h b/src/pk_pad/emsa1/emsa1.h index a5dac07e2..d86020966 100644 --- a/src/pk_pad/emsa1/emsa1.h +++ b/src/pk_pad/emsa1/emsa1.h @@ -31,7 +31,7 @@ class BOTAN_DLL EMSA1 : public EMSA RandomNumberGenerator& rng); bool verify(const MemoryRegion&, const MemoryRegion&, - u32bit) throw(); + u32bit); HashFunction* hash; }; diff --git a/src/pk_pad/emsa2/emsa2.cpp b/src/pk_pad/emsa2/emsa2.cpp index 168f9209e..74a045931 100644 --- a/src/pk_pad/emsa2/emsa2.cpp +++ b/src/pk_pad/emsa2/emsa2.cpp @@ -79,7 +79,7 @@ SecureVector EMSA2::encoding_of(const MemoryRegion& msg, */ bool EMSA2::verify(const MemoryRegion& coded, const MemoryRegion& raw, - u32bit key_bits) throw() + u32bit key_bits) { try { diff --git a/src/pk_pad/emsa2/emsa2.h b/src/pk_pad/emsa2/emsa2.h index 76888d1f6..7efc80873 100644 --- a/src/pk_pad/emsa2/emsa2.h +++ b/src/pk_pad/emsa2/emsa2.h @@ -29,7 +29,7 @@ class BOTAN_DLL EMSA2 : public EMSA RandomNumberGenerator& rng); bool verify(const MemoryRegion&, const MemoryRegion&, - u32bit) throw(); + u32bit); SecureVector empty_hash; HashFunction* hash; diff --git a/src/pk_pad/emsa3/emsa3.cpp b/src/pk_pad/emsa3/emsa3.cpp index 4d50abd84..dc905a464 100644 --- a/src/pk_pad/emsa3/emsa3.cpp +++ b/src/pk_pad/emsa3/emsa3.cpp @@ -72,7 +72,7 @@ SecureVector EMSA3::encoding_of(const MemoryRegion& msg, */ bool EMSA3::verify(const MemoryRegion& coded, const MemoryRegion& raw, - u32bit key_bits) throw() + u32bit key_bits) { if(raw.size() != hash->OUTPUT_LENGTH) return false; @@ -137,7 +137,7 @@ SecureVector EMSA3_Raw::encoding_of(const MemoryRegion& msg, */ bool EMSA3_Raw::verify(const MemoryRegion& coded, const MemoryRegion& raw, - u32bit key_bits) throw() + u32bit key_bits) { try { diff --git a/src/pk_pad/emsa3/emsa3.h b/src/pk_pad/emsa3/emsa3.h index 301f2142a..c4a3d658b 100644 --- a/src/pk_pad/emsa3/emsa3.h +++ b/src/pk_pad/emsa3/emsa3.h @@ -32,7 +32,7 @@ class BOTAN_DLL EMSA3 : public EMSA RandomNumberGenerator& rng); bool verify(const MemoryRegion&, const MemoryRegion&, - u32bit) throw(); + u32bit); private: HashFunction* hash; SecureVector hash_id; @@ -54,7 +54,7 @@ class BOTAN_DLL EMSA3_Raw : public EMSA RandomNumberGenerator& rng); bool verify(const MemoryRegion&, const MemoryRegion&, - u32bit) throw(); + u32bit); private: SecureVector message; diff --git a/src/pk_pad/emsa4/emsa4.cpp b/src/pk_pad/emsa4/emsa4.cpp index cff9a1537..dba248662 100644 --- a/src/pk_pad/emsa4/emsa4.cpp +++ b/src/pk_pad/emsa4/emsa4.cpp @@ -68,7 +68,7 @@ SecureVector EMSA4::encoding_of(const MemoryRegion& msg, * EMSA4 Decode/Verify Operation */ bool EMSA4::verify(const MemoryRegion& const_coded, - const MemoryRegion& raw, u32bit key_bits) throw() + const MemoryRegion& raw, u32bit key_bits) { const u32bit HASH_SIZE = hash->OUTPUT_LENGTH; const u32bit KEY_BYTES = (key_bits + 7) / 8; diff --git a/src/pk_pad/emsa4/emsa4.h b/src/pk_pad/emsa4/emsa4.h index b716178a9..9e37684f5 100644 --- a/src/pk_pad/emsa4/emsa4.h +++ b/src/pk_pad/emsa4/emsa4.h @@ -31,7 +31,7 @@ class BOTAN_DLL EMSA4 : public EMSA SecureVector encoding_of(const MemoryRegion&, u32bit, RandomNumberGenerator& rng); bool verify(const MemoryRegion&, const MemoryRegion&, - u32bit) throw(); + u32bit); u32bit SALT_SIZE; HashFunction* hash; diff --git a/src/pk_pad/emsa_raw/emsa_raw.cpp b/src/pk_pad/emsa_raw/emsa_raw.cpp index d5973ee55..5dfe20a50 100644 --- a/src/pk_pad/emsa_raw/emsa_raw.cpp +++ b/src/pk_pad/emsa_raw/emsa_raw.cpp @@ -42,7 +42,7 @@ SecureVector EMSA_Raw::encoding_of(const MemoryRegion& msg, */ bool EMSA_Raw::verify(const MemoryRegion& coded, const MemoryRegion& raw, - u32bit) throw() + u32bit) { return (coded == raw); } diff --git a/src/pk_pad/emsa_raw/emsa_raw.h b/src/pk_pad/emsa_raw/emsa_raw.h index 1b0ad516e..5f2eaa2fe 100644 --- a/src/pk_pad/emsa_raw/emsa_raw.h +++ b/src/pk_pad/emsa_raw/emsa_raw.h @@ -24,7 +24,7 @@ class BOTAN_DLL EMSA_Raw : public EMSA SecureVector encoding_of(const MemoryRegion&, u32bit, RandomNumberGenerator&); bool verify(const MemoryRegion&, const MemoryRegion&, - u32bit) throw(); + u32bit); SecureVector message; }; diff --git a/src/rng/auto_rng/auto_rng.h b/src/rng/auto_rng/auto_rng.h index f18f8e5cd..a15b11b13 100644 --- a/src/rng/auto_rng/auto_rng.h +++ b/src/rng/auto_rng/auto_rng.h @@ -23,7 +23,7 @@ class BOTAN_DLL AutoSeeded_RNG : public RandomNumberGenerator { rng->randomize(out, len); } bool is_seeded() const { return rng->is_seeded(); } - void clear() throw() { rng->clear(); } + void clear() { rng->clear(); } std::string name() const { return "AutoSeeded(" + rng->name() + ")"; } diff --git a/src/rng/hmac_rng/hmac_rng.cpp b/src/rng/hmac_rng/hmac_rng.cpp index 8444b1083..9d5ee97e4 100644 --- a/src/rng/hmac_rng/hmac_rng.cpp +++ b/src/rng/hmac_rng/hmac_rng.cpp @@ -147,7 +147,7 @@ void HMAC_RNG::add_entropy_source(EntropySource* src) /* * Clear memory of sensitive data */ -void HMAC_RNG::clear() throw() +void HMAC_RNG::clear() { extractor->clear(); prf->clear(); diff --git a/src/rng/hmac_rng/hmac_rng.h b/src/rng/hmac_rng/hmac_rng.h index 318e2a931..97b0baf15 100644 --- a/src/rng/hmac_rng/hmac_rng.h +++ b/src/rng/hmac_rng/hmac_rng.h @@ -29,7 +29,7 @@ class BOTAN_DLL HMAC_RNG : public RandomNumberGenerator public: void randomize(byte buf[], u32bit len); bool is_seeded() const { return seeded; } - void clear() throw(); + void clear(); std::string name() const; void reseed(u32bit poll_bits); diff --git a/src/rng/randpool/randpool.cpp b/src/rng/randpool/randpool.cpp index fe83f4361..9ec92267d 100644 --- a/src/rng/randpool/randpool.cpp +++ b/src/rng/randpool/randpool.cpp @@ -149,7 +149,7 @@ void Randpool::add_entropy_source(EntropySource* src) /** * Clear memory of sensitive data */ -void Randpool::clear() throw() +void Randpool::clear() { cipher->clear(); mac->clear(); diff --git a/src/rng/randpool/randpool.h b/src/rng/randpool/randpool.h index b6a3adda4..ab6ed6748 100644 --- a/src/rng/randpool/randpool.h +++ b/src/rng/randpool/randpool.h @@ -23,7 +23,7 @@ class BOTAN_DLL Randpool : public RandomNumberGenerator public: void randomize(byte[], u32bit); bool is_seeded() const { return seeded; } - void clear() throw(); + void clear(); std::string name() const; void reseed(u32bit bits_to_collect); diff --git a/src/rng/rng.h b/src/rng/rng.h index 41904dbef..c53d8e22d 100644 --- a/src/rng/rng.h +++ b/src/rng/rng.h @@ -47,7 +47,7 @@ class BOTAN_DLL RandomNumberGenerator /** * Clear all internally held values of this RNG. */ - virtual void clear() throw() = 0; + virtual void clear() = 0; /** * Return the name of this object @@ -89,7 +89,7 @@ class BOTAN_DLL Null_RNG : public RandomNumberGenerator { public: void randomize(byte[], u32bit) { throw PRNG_Unseeded("Null_RNG"); } - void clear() throw() {} + void clear() {} std::string name() const { return "Null_RNG"; } void reseed(u32bit) {} diff --git a/src/rng/x931_rng/x931_rng.cpp b/src/rng/x931_rng/x931_rng.cpp index e239bce84..64d57ac1c 100644 --- a/src/rng/x931_rng/x931_rng.cpp +++ b/src/rng/x931_rng/x931_rng.cpp @@ -108,7 +108,7 @@ bool ANSI_X931_RNG::is_seeded() const /** * Clear memory of sensitive data */ -void ANSI_X931_RNG::clear() throw() +void ANSI_X931_RNG::clear() { cipher->clear(); prng->clear(); diff --git a/src/rng/x931_rng/x931_rng.h b/src/rng/x931_rng/x931_rng.h index 44e9b4428..d5ba2e9eb 100644 --- a/src/rng/x931_rng/x931_rng.h +++ b/src/rng/x931_rng/x931_rng.h @@ -21,7 +21,7 @@ class BOTAN_DLL ANSI_X931_RNG : public RandomNumberGenerator public: void randomize(byte[], u32bit); bool is_seeded() const; - void clear() throw(); + void clear(); std::string name() const; void reseed(u32bit poll_bits); diff --git a/src/stream/arc4/arc4.cpp b/src/stream/arc4/arc4.cpp index 0f78f7362..293a0a336 100644 --- a/src/stream/arc4/arc4.cpp +++ b/src/stream/arc4/arc4.cpp @@ -87,7 +87,7 @@ std::string ARC4::name() const /* * Clear memory of sensitive data */ -void ARC4::clear() throw() +void ARC4::clear() { state.clear(); buffer.clear(); diff --git a/src/stream/arc4/arc4.h b/src/stream/arc4/arc4.h index 3f92fa914..ae37cb165 100644 --- a/src/stream/arc4/arc4.h +++ b/src/stream/arc4/arc4.h @@ -21,7 +21,7 @@ class BOTAN_DLL ARC4 : public StreamCipher public: void cipher(const byte in[], byte out[], u32bit length); - void clear() throw(); + void clear(); std::string name() const; StreamCipher* clone() const { return new ARC4(SKIP); } diff --git a/src/stream/ctr/ctr.cpp b/src/stream/ctr/ctr.cpp index 5ef5e447f..5f0880fa5 100644 --- a/src/stream/ctr/ctr.cpp +++ b/src/stream/ctr/ctr.cpp @@ -37,7 +37,7 @@ CTR_BE::~CTR_BE() /* * Zeroize */ -void CTR_BE::clear() throw() +void CTR_BE::clear() { permutation->clear(); buffer.clear(); diff --git a/src/stream/ctr/ctr.h b/src/stream/ctr/ctr.h index f60f21b5a..5f94170cc 100644 --- a/src/stream/ctr/ctr.h +++ b/src/stream/ctr/ctr.h @@ -31,7 +31,7 @@ class BOTAN_DLL CTR_BE : public StreamCipher CTR_BE* clone() const { return new CTR_BE(permutation->clone()); } - void clear() throw(); + void clear(); CTR_BE(BlockCipher*); ~CTR_BE(); diff --git a/src/stream/ofb/ofb.cpp b/src/stream/ofb/ofb.cpp index 577f61cbf..0d12d23bd 100644 --- a/src/stream/ofb/ofb.cpp +++ b/src/stream/ofb/ofb.cpp @@ -35,7 +35,7 @@ OFB::~OFB() /* * Zeroize */ -void OFB::clear() throw() +void OFB::clear() { permutation->clear(); buffer.clear(); diff --git a/src/stream/ofb/ofb.h b/src/stream/ofb/ofb.h index 5cd48716b..1985ae5a9 100644 --- a/src/stream/ofb/ofb.h +++ b/src/stream/ofb/ofb.h @@ -31,7 +31,7 @@ class BOTAN_DLL OFB : public StreamCipher OFB* clone() const { return new OFB(permutation->clone()); } - void clear() throw(); + void clear(); OFB(BlockCipher*); ~OFB(); diff --git a/src/stream/salsa20/salsa20.cpp b/src/stream/salsa20/salsa20.cpp index a147cdb45..3aae64eae 100644 --- a/src/stream/salsa20/salsa20.cpp +++ b/src/stream/salsa20/salsa20.cpp @@ -197,7 +197,7 @@ std::string Salsa20::name() const /* * Clear memory of sensitive data */ -void Salsa20::clear() throw() +void Salsa20::clear() { state.clear(); buffer.clear(); diff --git a/src/stream/salsa20/salsa20.h b/src/stream/salsa20/salsa20.h index a3e9a3706..3ca781ea2 100644 --- a/src/stream/salsa20/salsa20.h +++ b/src/stream/salsa20/salsa20.h @@ -25,7 +25,7 @@ class BOTAN_DLL Salsa20 : public StreamCipher bool valid_iv_length(u32bit iv_len) const { return (iv_len == 8); } - void clear() throw(); + void clear(); std::string name() const; StreamCipher* clone() const { return new Salsa20; } diff --git a/src/stream/stream_cipher.h b/src/stream/stream_cipher.h index d6abb37fc..29c16c8b5 100644 --- a/src/stream/stream_cipher.h +++ b/src/stream/stream_cipher.h @@ -61,7 +61,7 @@ class BOTAN_DLL StreamCipher : public SymmetricAlgorithm /** * Zeroize internal state */ - virtual void clear() throw() = 0; + virtual void clear() = 0; /** * StreamCipher constructor diff --git a/src/stream/turing/turing.cpp b/src/stream/turing/turing.cpp index 8336a70a7..810f65ca4 100644 --- a/src/stream/turing/turing.cpp +++ b/src/stream/turing/turing.cpp @@ -295,7 +295,7 @@ void Turing::set_iv(const byte iv[], u32bit length) /* * Clear memory of sensitive data */ -void Turing::clear() throw() +void Turing::clear() { S0.clear(); S1.clear(); diff --git a/src/stream/turing/turing.h b/src/stream/turing/turing.h index 59290f640..7291647ea 100644 --- a/src/stream/turing/turing.h +++ b/src/stream/turing/turing.h @@ -24,7 +24,7 @@ class BOTAN_DLL Turing : public StreamCipher bool valid_iv_length(u32bit iv_len) const { return (iv_len % 4 == 0 && iv_len <= 16); } - void clear() throw(); + void clear(); std::string name() const { return "Turing"; } StreamCipher* clone() const { return new Turing; } Turing() : StreamCipher(4, 32, 4) { position = 0; } diff --git a/src/stream/wid_wake/wid_wake.cpp b/src/stream/wid_wake/wid_wake.cpp index 56f938fac..2a8946649 100644 --- a/src/stream/wid_wake/wid_wake.cpp +++ b/src/stream/wid_wake/wid_wake.cpp @@ -136,7 +136,7 @@ void WiderWake_41_BE::set_iv(const byte iv[], u32bit length) /* * Clear memory of sensitive data */ -void WiderWake_41_BE::clear() throw() +void WiderWake_41_BE::clear() { position = 0; t_key.clear(); diff --git a/src/stream/wid_wake/wid_wake.h b/src/stream/wid_wake/wid_wake.h index a037a056e..23e1eacab 100644 --- a/src/stream/wid_wake/wid_wake.h +++ b/src/stream/wid_wake/wid_wake.h @@ -24,7 +24,7 @@ class BOTAN_DLL WiderWake_41_BE : public StreamCipher bool valid_iv_length(u32bit iv_len) const { return (iv_len == 8); } - void clear() throw(); + void clear(); std::string name() const { return "WiderWake4+1-BE"; } StreamCipher* clone() const { return new WiderWake_41_BE; } WiderWake_41_BE() : StreamCipher(16, 16, 1) {} diff --git a/src/sym_algo/sym_algo.h b/src/sym_algo/sym_algo.h index 1c8b816fd..929f2a6f0 100644 --- a/src/sym_algo/sym_algo.h +++ b/src/sym_algo/sym_algo.h @@ -46,7 +46,7 @@ class BOTAN_DLL SymmetricAlgorithm * Set the symmetric key of this object. * @param key the SymmetricKey to be set. */ - void set_key(const SymmetricKey& key) throw(Invalid_Key_Length) + void set_key(const SymmetricKey& key) { set_key(key.begin(), key.length()); } /** @@ -54,7 +54,7 @@ class BOTAN_DLL SymmetricAlgorithm * @param key the to be set as a byte array. * @param the length of the byte array. */ - void set_key(const byte key[], u32bit length) throw(Invalid_Key_Length) + void set_key(const byte key[], u32bit length) { if(!valid_keylength(length)) throw Invalid_Key_Length(name(), length); -- cgit v1.2.3