diff options
Diffstat (limited to 'src/block')
50 files changed, 135 insertions, 91 deletions
diff --git a/src/block/aes/aes.cpp b/src/block/aes/aes.cpp index 5f47762a8..42db7abae 100644 --- a/src/block/aes/aes.cpp +++ b/src/block/aes/aes.cpp @@ -414,8 +414,8 @@ const u32bit TD[1024] = { */ void aes_encrypt_n(const byte in[], byte out[], size_t blocks, - const MemoryRegion<u32bit>& EK, - const MemoryRegion<byte>& ME) + const secure_vector<u32bit>& EK, + const secure_vector<byte>& ME) { const size_t BLOCK_SIZE = 16; @@ -525,8 +525,8 @@ void aes_encrypt_n(const byte in[], byte out[], * AES Decryption */ void aes_decrypt_n(const byte in[], byte out[], size_t blocks, - const MemoryRegion<u32bit>& DK, - const MemoryRegion<byte>& MD) + const secure_vector<u32bit>& DK, + const secure_vector<byte>& MD) { const size_t BLOCK_SIZE = 16; @@ -606,10 +606,10 @@ void aes_decrypt_n(const byte in[], byte out[], size_t blocks, } void aes_key_schedule(const byte key[], size_t length, - MemoryRegion<u32bit>& EK, - MemoryRegion<u32bit>& DK, - MemoryRegion<byte>& ME, - MemoryRegion<byte>& MD) + secure_vector<u32bit>& EK, + secure_vector<u32bit>& DK, + secure_vector<byte>& ME, + secure_vector<byte>& MD) { static const u32bit RC[10] = { 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, @@ -617,7 +617,7 @@ void aes_key_schedule(const byte key[], size_t length, const size_t rounds = (length / 4) + 6; - SecureVector<u32bit> XEK(length + 32), XDK(length + 32); + secure_vector<u32bit> XEK(length + 32), XDK(length + 32); const size_t X = length / 4; for(size_t i = 0; i != X; ++i) diff --git a/src/block/aes/aes.h b/src/block/aes/aes.h index a165f83b5..f6f683bf9 100644 --- a/src/block/aes/aes.h +++ b/src/block/aes/aes.h @@ -30,8 +30,8 @@ class BOTAN_DLL AES_128 : public Block_Cipher_Fixed_Params<16, 16> private: void key_schedule(const byte key[], size_t length); - SecureVector<u32bit> EK, DK; - SecureVector<byte> ME, MD; + secure_vector<u32bit> EK, DK; + secure_vector<byte> ME, MD; }; /** @@ -52,8 +52,8 @@ class BOTAN_DLL AES_192 : public Block_Cipher_Fixed_Params<16, 24> private: void key_schedule(const byte key[], size_t length); - SecureVector<u32bit> EK, DK; - SecureVector<byte> ME, MD; + secure_vector<u32bit> EK, DK; + secure_vector<byte> ME, MD; }; /** @@ -74,8 +74,8 @@ class BOTAN_DLL AES_256 : public Block_Cipher_Fixed_Params<16, 32> private: void key_schedule(const byte key[], size_t length); - SecureVector<u32bit> EK, DK; - SecureVector<byte> ME, MD; + secure_vector<u32bit> EK, DK; + secure_vector<byte> ME, MD; }; } diff --git a/src/block/aes_ni/aes_ni.h b/src/block/aes_ni/aes_ni.h index ae9e5b3f4..4844b7fe8 100644 --- a/src/block/aes_ni/aes_ni.h +++ b/src/block/aes_ni/aes_ni.h @@ -31,7 +31,7 @@ class BOTAN_DLL AES_128_NI : public Block_Cipher_Fixed_Params<16, 16> private: void key_schedule(const byte[], size_t); - SecureVector<u32bit> EK, DK; + secure_vector<u32bit> EK, DK; }; /** @@ -53,7 +53,7 @@ class BOTAN_DLL AES_192_NI : public Block_Cipher_Fixed_Params<16, 24> private: void key_schedule(const byte[], size_t); - SecureVector<u32bit> EK, DK; + secure_vector<u32bit> EK, DK; }; /** @@ -75,7 +75,7 @@ class BOTAN_DLL AES_256_NI : public Block_Cipher_Fixed_Params<16, 32> private: void key_schedule(const byte[], size_t); - SecureVector<u32bit> EK, DK; + secure_vector<u32bit> EK, DK; }; } diff --git a/src/block/aes_ssse3/aes_ssse3.h b/src/block/aes_ssse3/aes_ssse3.h index 686b7999f..3d7c16f42 100644 --- a/src/block/aes_ssse3/aes_ssse3.h +++ b/src/block/aes_ssse3/aes_ssse3.h @@ -29,7 +29,7 @@ class BOTAN_DLL AES_128_SSSE3 : public Block_Cipher_Fixed_Params<16, 16> private: void key_schedule(const byte[], size_t); - SecureVector<u32bit> EK, DK; + secure_vector<u32bit> EK, DK; }; /** @@ -49,7 +49,7 @@ class BOTAN_DLL AES_192_SSSE3 : public Block_Cipher_Fixed_Params<16, 24> private: void key_schedule(const byte[], size_t); - SecureVector<u32bit> EK, DK; + secure_vector<u32bit> EK, DK; }; /** @@ -69,7 +69,7 @@ class BOTAN_DLL AES_256_SSSE3 : public Block_Cipher_Fixed_Params<16, 32> private: void key_schedule(const byte[], size_t); - SecureVector<u32bit> EK, DK; + secure_vector<u32bit> EK, DK; }; } diff --git a/src/block/block_cipher.h b/src/block/block_cipher.h index 8e820fc5a..4a07bb048 100644 --- a/src/block/block_cipher.h +++ b/src/block/block_cipher.h @@ -75,6 +75,50 @@ class BOTAN_DLL BlockCipher : public SymmetricAlgorithm /** * Encrypt one or more blocks + * @param block the input/output buffer (multiple of block_size()) + */ + template<typename Alloc> + void encrypt(std::vector<byte, Alloc>& block) const + { + return encrypt_n(&block[0], &block[0], block.size() / block_size()); + } + + /** + * Decrypt one or more blocks + * @param block the input/output buffer (multiple of block_size()) + */ + template<typename Alloc> + void decrypt(std::vector<byte, Alloc>& block) const + { + return decrypt_n(&block[0], &block[0], block.size() / block_size()); + } + + /** + * Encrypt one or more blocks + * @param in the input buffer (multiple of block_size()) + * @param out the output buffer (same size as in) + */ + template<typename Alloc, typename Alloc2> + void encrypt(const std::vector<byte, Alloc>& in, + std::vector<byte, Alloc2>& out) const + { + return encrypt_n(&in[0], &out[0], in.size() / block_size()); + } + + /** + * Decrypt one or more blocks + * @param in the input buffer (multiple of block_size()) + * @param out the output buffer (same size as in) + */ + template<typename Alloc, typename Alloc2> + void decrypt(const std::vector<byte, Alloc>& in, + std::vector<byte, Alloc2>& out) const + { + return decrypt_n(&in[0], &out[0], in.size() / block_size()); + } + + /** + * Encrypt one or more blocks * @param in the input buffer (multiple of block_size()) * @param out the output buffer (same size as in) * @param blocks the number of blocks to process diff --git a/src/block/blowfish/blowfish.cpp b/src/block/blowfish/blowfish.cpp index b6319eec0..9f5ac1724 100644 --- a/src/block/blowfish/blowfish.cpp +++ b/src/block/blowfish/blowfish.cpp @@ -143,7 +143,7 @@ void Blowfish::eks_key_schedule(const byte key[], size_t length, /* * Generate one of the Sboxes */ -void Blowfish::generate_sbox(MemoryRegion<u32bit>& box, +void Blowfish::generate_sbox(secure_vector<u32bit>& box, u32bit& L, u32bit& R, const byte salt[16], size_t salt_off) const diff --git a/src/block/blowfish/blowfish.h b/src/block/blowfish/blowfish.h index 13706d21e..5bec4b231 100644 --- a/src/block/blowfish/blowfish.h +++ b/src/block/blowfish/blowfish.h @@ -39,7 +39,7 @@ class BOTAN_DLL Blowfish : public Block_Cipher_Fixed_Params<8, 1, 56> size_t key_length, const byte salt[16]); - void generate_sbox(MemoryRegion<u32bit>& box, + void generate_sbox(secure_vector<u32bit>& box, u32bit& L, u32bit& R, const byte salt[16], size_t salt_off) const; @@ -47,8 +47,8 @@ class BOTAN_DLL Blowfish : public Block_Cipher_Fixed_Params<8, 1, 56> static const u32bit P_INIT[18]; static const u32bit S_INIT[1024]; - SecureVector<u32bit> S; - SecureVector<u32bit> P; + secure_vector<u32bit> S; + secure_vector<u32bit> P; }; } diff --git a/src/block/camellia/camellia.cpp b/src/block/camellia/camellia.cpp index 7b85b1aca..bea5d4c51 100644 --- a/src/block/camellia/camellia.cpp +++ b/src/block/camellia/camellia.cpp @@ -116,7 +116,7 @@ inline u64bit FLINV(u64bit v, u64bit K) * Camellia Encryption */ void encrypt(const byte in[], byte out[], size_t blocks, - const SecureVector<u64bit>& SK, const size_t rounds) + const secure_vector<u64bit>& SK, const size_t rounds) { for(size_t i = 0; i != blocks; ++i) { @@ -160,7 +160,7 @@ void encrypt(const byte in[], byte out[], size_t blocks, * Camellia Decryption */ void decrypt(const byte in[], byte out[], size_t blocks, - const SecureVector<u64bit>& SK, const size_t rounds) + const secure_vector<u64bit>& SK, const size_t rounds) { for(size_t i = 0; i != blocks; ++i) { @@ -213,7 +213,7 @@ u64bit left_rot_lo(u64bit h, u64bit l, size_t shift) /* * Camellia Key Schedule */ -void key_schedule(SecureVector<u64bit>& SK, const byte key[], size_t length) +void key_schedule(secure_vector<u64bit>& SK, const byte key[], size_t length) { const u64bit Sigma1 = 0xA09E667F3BCC908B; const u64bit Sigma2 = 0xB67AE8584CAA73B2; diff --git a/src/block/camellia/camellia.h b/src/block/camellia/camellia.h index 9ce305983..4db115f2c 100644 --- a/src/block/camellia/camellia.h +++ b/src/block/camellia/camellia.h @@ -27,7 +27,7 @@ class BOTAN_DLL Camellia_128 : public Block_Cipher_Fixed_Params<16, 16> private: void key_schedule(const byte key[], size_t length); - SecureVector<u64bit> SK; + secure_vector<u64bit> SK; }; /** @@ -45,7 +45,7 @@ class BOTAN_DLL Camellia_192 : public Block_Cipher_Fixed_Params<16, 24> private: void key_schedule(const byte key[], size_t length); - SecureVector<u64bit> SK; + secure_vector<u64bit> SK; }; /** @@ -63,7 +63,7 @@ class BOTAN_DLL Camellia_256 : public Block_Cipher_Fixed_Params<16, 32> private: void key_schedule(const byte key[], size_t length); - SecureVector<u64bit> SK; + secure_vector<u64bit> SK; }; } diff --git a/src/block/cast/cast128.cpp b/src/block/cast/cast128.cpp index 24469e025..8fae4040d 100644 --- a/src/block/cast/cast128.cpp +++ b/src/block/cast/cast128.cpp @@ -119,7 +119,7 @@ void CAST_128::decrypt_n(const byte in[], byte out[], size_t blocks) const void CAST_128::key_schedule(const byte key[], size_t length) { clear(); - SecureVector<u32bit> X(4); + secure_vector<u32bit> X(4); for(size_t j = 0; j != length; ++j) X[j/4] = (X[j/4] << 8) + key[j]; @@ -133,8 +133,8 @@ void CAST_128::key_schedule(const byte key[], size_t length) /* * S-Box Based Key Expansion */ -void CAST_128::cast_ks(MemoryRegion<u32bit>& K, - MemoryRegion<u32bit>& X) +void CAST_128::cast_ks(secure_vector<u32bit>& K, + secure_vector<u32bit>& X) { class ByteReader { @@ -145,7 +145,7 @@ void CAST_128::cast_ks(MemoryRegion<u32bit>& K, const u32bit* X; }; - SecureVector<u32bit> Z(4); + secure_vector<u32bit> Z(4); ByteReader x(&X[0]), z(&Z[0]); Z[0] = X[0] ^ S5[x(13)] ^ S6[x(15)] ^ S7[x(12)] ^ S8[x(14)] ^ S7[x( 8)]; diff --git a/src/block/cast/cast128.h b/src/block/cast/cast128.h index 10c646c94..15efc8132 100644 --- a/src/block/cast/cast128.h +++ b/src/block/cast/cast128.h @@ -29,15 +29,15 @@ class BOTAN_DLL CAST_128 : public Block_Cipher_Fixed_Params<8, 11, 16> private: void key_schedule(const byte[], size_t); - static void cast_ks(MemoryRegion<u32bit>& ks, - MemoryRegion<u32bit>& user_key); + static void cast_ks(secure_vector<u32bit>& ks, + secure_vector<u32bit>& user_key); static const u32bit S5[256]; static const u32bit S6[256]; static const u32bit S7[256]; static const u32bit S8[256]; - SecureVector<u32bit> MK, RK; + secure_vector<u32bit> MK, RK; }; extern const u32bit CAST_SBOX1[256]; diff --git a/src/block/cast/cast256.cpp b/src/block/cast/cast256.cpp index 8be0a8dd6..00e0fbd30 100644 --- a/src/block/cast/cast256.cpp +++ b/src/block/cast/cast256.cpp @@ -138,7 +138,7 @@ void CAST_256::decrypt_n(const byte in[], byte out[], size_t blocks) const */ void CAST_256::key_schedule(const byte key[], size_t length) { - SecureVector<u32bit> K(8); + secure_vector<u32bit> K(8); for(size_t j = 0; j != length; ++j) K[j/4] = (K[j/4] << 8) + key[j]; diff --git a/src/block/cast/cast256.h b/src/block/cast/cast256.h index 2f2beef47..11c5117a3 100644 --- a/src/block/cast/cast256.h +++ b/src/block/cast/cast256.h @@ -32,8 +32,8 @@ class BOTAN_DLL CAST_256 : public Block_Cipher_Fixed_Params<16, 4, 32, 4> static const u32bit KEY_MASK[192]; static const byte KEY_ROT[32]; - SecureVector<u32bit> MK; - SecureVector<byte> RK; + secure_vector<u32bit> MK; + secure_vector<byte> RK; }; extern const u32bit CAST_SBOX1[256]; diff --git a/src/block/des/des.h b/src/block/des/des.h index db5a375e0..711efb16d 100644 --- a/src/block/des/des.h +++ b/src/block/des/des.h @@ -29,7 +29,7 @@ class BOTAN_DLL DES : public Block_Cipher_Fixed_Params<8, 8> private: void key_schedule(const byte[], size_t); - SecureVector<u32bit> round_key; + secure_vector<u32bit> round_key; }; /** @@ -49,7 +49,7 @@ class BOTAN_DLL TripleDES : public Block_Cipher_Fixed_Params<8, 16, 24, 8> private: void key_schedule(const byte[], size_t); - SecureVector<u32bit> round_key; + secure_vector<u32bit> round_key; }; /* diff --git a/src/block/des/desx.h b/src/block/des/desx.h index 993eca86b..1fe8b000c 100644 --- a/src/block/des/desx.h +++ b/src/block/des/desx.h @@ -28,7 +28,7 @@ class BOTAN_DLL DESX : public Block_Cipher_Fixed_Params<8, 24> DESX() : K1(8), K2(8) {} private: void key_schedule(const byte[], size_t); - SecureVector<byte> K1, K2; + secure_vector<byte> K1, K2; DES des; }; diff --git a/src/block/gost_28147/gost_28147.h b/src/block/gost_28147/gost_28147.h index bc26da774..a4a13b827 100644 --- a/src/block/gost_28147/gost_28147.h +++ b/src/block/gost_28147/gost_28147.h @@ -65,13 +65,13 @@ class BOTAN_DLL GOST_28147_89 : public Block_Cipher_Fixed_Params<8, 32> */ GOST_28147_89(const GOST_28147_89_Params& params); private: - GOST_28147_89(const SecureVector<u32bit>& other_SBOX) : + GOST_28147_89(const secure_vector<u32bit>& other_SBOX) : SBOX(other_SBOX), EK(8) {} void key_schedule(const byte[], size_t); - SecureVector<u32bit> SBOX; - SecureVector<u32bit> EK; + secure_vector<u32bit> SBOX; + secure_vector<u32bit> EK; }; } diff --git a/src/block/idea/idea.h b/src/block/idea/idea.h index 42fa60c47..f3f0ce1bc 100644 --- a/src/block/idea/idea.h +++ b/src/block/idea/idea.h @@ -30,16 +30,16 @@ class BOTAN_DLL IDEA : public Block_Cipher_Fixed_Params<8, 16> /** * @return const reference to encryption subkeys */ - const SecureVector<u16bit>& get_EK() const { return EK; } + const secure_vector<u16bit>& get_EK() const { return EK; } /** * @return const reference to decryption subkeys */ - const SecureVector<u16bit>& get_DK() const { return DK; } + const secure_vector<u16bit>& get_DK() const { return DK; } private: void key_schedule(const byte[], size_t); - SecureVector<u16bit> EK, DK; + secure_vector<u16bit> EK, DK; }; } diff --git a/src/block/kasumi/kasumi.cpp b/src/block/kasumi/kasumi.cpp index a57c0396a..d3894789d 100644 --- a/src/block/kasumi/kasumi.cpp +++ b/src/block/kasumi/kasumi.cpp @@ -204,7 +204,7 @@ void KASUMI::key_schedule(const byte key[], size_t) static const u16bit RC[] = { 0x0123, 0x4567, 0x89AB, 0xCDEF, 0xFEDC, 0xBA98, 0x7654, 0x3210 }; - SecureVector<u16bit> K(16); + secure_vector<u16bit> K(16); for(size_t i = 0; i != 8; ++i) { K[i] = load_be<u16bit>(key, i); diff --git a/src/block/kasumi/kasumi.h b/src/block/kasumi/kasumi.h index 7871aa170..f3dd7e0c7 100644 --- a/src/block/kasumi/kasumi.h +++ b/src/block/kasumi/kasumi.h @@ -29,7 +29,7 @@ class BOTAN_DLL KASUMI : public Block_Cipher_Fixed_Params<8, 16> private: void key_schedule(const byte[], size_t); - SecureVector<u16bit> EK; + secure_vector<u16bit> EK; }; } diff --git a/src/block/lion/lion.cpp b/src/block/lion/lion.cpp index 4a9e8b901..778b55be0 100644 --- a/src/block/lion/lion.cpp +++ b/src/block/lion/lion.cpp @@ -16,7 +16,7 @@ namespace Botan { */ void Lion::encrypt_n(const byte in[], byte out[], size_t blocks) const { - SecureVector<byte> buffer_vec(LEFT_SIZE); + secure_vector<byte> buffer_vec(LEFT_SIZE); byte* buffer = &buffer_vec[0]; for(size_t i = 0; i != blocks; ++i) @@ -43,7 +43,7 @@ void Lion::encrypt_n(const byte in[], byte out[], size_t blocks) const */ void Lion::decrypt_n(const byte in[], byte out[], size_t blocks) const { - SecureVector<byte> buffer_vec(LEFT_SIZE); + secure_vector<byte> buffer_vec(LEFT_SIZE); byte* buffer = &buffer_vec[0]; for(size_t i = 0; i != blocks; ++i) diff --git a/src/block/lion/lion.h b/src/block/lion/lion.h index 5076f4461..d016c0e82 100644 --- a/src/block/lion/lion.h +++ b/src/block/lion/lion.h @@ -56,7 +56,7 @@ class BOTAN_DLL Lion : public BlockCipher HashFunction* hash; StreamCipher* cipher; - SecureVector<byte> key1, key2; + secure_vector<byte> key1, key2; }; } diff --git a/src/block/lubyrack/lubyrack.cpp b/src/block/lubyrack/lubyrack.cpp index ef4a11e9d..2fe4c87bf 100644 --- a/src/block/lubyrack/lubyrack.cpp +++ b/src/block/lubyrack/lubyrack.cpp @@ -17,7 +17,7 @@ void LubyRackoff::encrypt_n(const byte in[], byte out[], size_t blocks) const { const size_t len = hash->output_length(); - SecureVector<byte> buffer_vec(len); + secure_vector<byte> buffer_vec(len); byte* buffer = &buffer_vec[0]; for(size_t i = 0; i != blocks; ++i) @@ -54,7 +54,7 @@ void LubyRackoff::decrypt_n(const byte in[], byte out[], size_t blocks) const { const size_t len = hash->output_length(); - SecureVector<byte> buffer_vec(len); + secure_vector<byte> buffer_vec(len); byte* buffer = &buffer_vec[0]; for(size_t i = 0; i != blocks; ++i) diff --git a/src/block/lubyrack/lubyrack.h b/src/block/lubyrack/lubyrack.h index 81dddf579..e28c60be7 100644 --- a/src/block/lubyrack/lubyrack.h +++ b/src/block/lubyrack/lubyrack.h @@ -42,7 +42,7 @@ class BOTAN_DLL LubyRackoff : public BlockCipher void key_schedule(const byte[], size_t); HashFunction* hash; - SecureVector<byte> K1, K2; + secure_vector<byte> K1, K2; }; } diff --git a/src/block/mars/mars.cpp b/src/block/mars/mars.cpp index 171ce2945..64ece83ab 100644 --- a/src/block/mars/mars.cpp +++ b/src/block/mars/mars.cpp @@ -320,7 +320,7 @@ void MARS::decrypt_n(const byte in[], byte out[], size_t blocks) const */ void MARS::key_schedule(const byte key[], size_t length) { - SecureVector<u32bit> T(15); + secure_vector<u32bit> T(15); for(size_t i = 0; i != length / 4; ++i) T[i] = load_le<u32bit>(key, i); diff --git a/src/block/mars/mars.h b/src/block/mars/mars.h index 5ca05f886..fc732ae10 100644 --- a/src/block/mars/mars.h +++ b/src/block/mars/mars.h @@ -29,7 +29,7 @@ class BOTAN_DLL MARS : public Block_Cipher_Fixed_Params<16, 16, 32, 4> private: void key_schedule(const byte[], size_t); - SecureVector<u32bit> EK; + secure_vector<u32bit> EK; }; } diff --git a/src/block/misty1/misty1.cpp b/src/block/misty1/misty1.cpp index 77d1047b1..64298ee92 100644 --- a/src/block/misty1/misty1.cpp +++ b/src/block/misty1/misty1.cpp @@ -204,7 +204,7 @@ void MISTY1::decrypt_n(const byte in[], byte out[], size_t blocks) const */ void MISTY1::key_schedule(const byte key[], size_t length) { - SecureVector<u16bit> KS(32); + secure_vector<u16bit> KS(32); for(size_t i = 0; i != length / 2; ++i) KS[i] = load_be<u16bit>(key, i); diff --git a/src/block/misty1/misty1.h b/src/block/misty1/misty1.h index 14d8a2958..a4bfa14b3 100644 --- a/src/block/misty1/misty1.h +++ b/src/block/misty1/misty1.h @@ -33,7 +33,7 @@ class BOTAN_DLL MISTY1 : public Block_Cipher_Fixed_Params<8, 16> private: void key_schedule(const byte[], size_t); - SecureVector<u16bit> EK, DK; + secure_vector<u16bit> EK, DK; }; } diff --git a/src/block/noekeon/noekeon.h b/src/block/noekeon/noekeon.h index 7c5c73dcb..8bcff64c9 100644 --- a/src/block/noekeon/noekeon.h +++ b/src/block/noekeon/noekeon.h @@ -35,16 +35,16 @@ class BOTAN_DLL Noekeon : public Block_Cipher_Fixed_Params<16, 16> /** * @return const reference to encryption subkeys */ - const SecureVector<u32bit>& get_EK() const { return EK; } + const secure_vector<u32bit>& get_EK() const { return EK; } /** * @return const reference to decryption subkeys */ - const SecureVector<u32bit>& get_DK() const { return DK; } + const secure_vector<u32bit>& get_DK() const { return DK; } private: void key_schedule(const byte[], size_t); - SecureVector<u32bit> EK, DK; + secure_vector<u32bit> EK, DK; }; } diff --git a/src/block/noekeon_simd/noekeon_simd.cpp b/src/block/noekeon_simd/noekeon_simd.cpp index b2beafc82..2a4c1fd74 100644 --- a/src/block/noekeon_simd/noekeon_simd.cpp +++ b/src/block/noekeon_simd/noekeon_simd.cpp @@ -65,7 +65,7 @@ namespace Botan { */ void Noekeon_SIMD::encrypt_n(const byte in[], byte out[], size_t blocks) const { - const SecureVector<u32bit>& EK = this->get_EK(); + const secure_vector<u32bit>& EK = this->get_EK(); SIMD_32 K0 = SIMD_32(EK[0]); SIMD_32 K1 = SIMD_32(EK[1]); @@ -122,7 +122,7 @@ void Noekeon_SIMD::encrypt_n(const byte in[], byte out[], size_t blocks) const */ void Noekeon_SIMD::decrypt_n(const byte in[], byte out[], size_t blocks) const { - const SecureVector<u32bit>& DK = this->get_DK(); + const secure_vector<u32bit>& DK = this->get_DK(); SIMD_32 K0 = SIMD_32(DK[0]); SIMD_32 K1 = SIMD_32(DK[1]); diff --git a/src/block/rc2/rc2.cpp b/src/block/rc2/rc2.cpp index 071e4e209..98e76ecfc 100644 --- a/src/block/rc2/rc2.cpp +++ b/src/block/rc2/rc2.cpp @@ -124,7 +124,7 @@ void RC2::key_schedule(const byte key[], size_t length) 0xC5, 0xF3, 0xDB, 0x47, 0xE5, 0xA5, 0x9C, 0x77, 0x0A, 0xA6, 0x20, 0x68, 0xFE, 0x7F, 0xC1, 0xAD }; - SecureVector<byte> L(128); + secure_vector<byte> L(128); copy_mem(&L[0], key, length); for(size_t i = length; i != 128; ++i) diff --git a/src/block/rc2/rc2.h b/src/block/rc2/rc2.h index 1ebad1e73..dc78b06fc 100644 --- a/src/block/rc2/rc2.h +++ b/src/block/rc2/rc2.h @@ -36,7 +36,7 @@ class BOTAN_DLL RC2 : public Block_Cipher_Fixed_Params<8, 1, 32> private: void key_schedule(const byte[], size_t); - SecureVector<u16bit> K; + secure_vector<u16bit> K; }; } diff --git a/src/block/rc5/rc5.cpp b/src/block/rc5/rc5.cpp index 981f73564..1ac421996 100644 --- a/src/block/rc5/rc5.cpp +++ b/src/block/rc5/rc5.cpp @@ -95,7 +95,7 @@ void RC5::key_schedule(const byte key[], size_t length) for(size_t i = 1; i != S.size(); ++i) S[i] = S[i-1] + 0x9E3779B9; - SecureVector<u32bit> K(8); + secure_vector<u32bit> K(8); for(s32bit i = length-1; i >= 0; --i) K[i/4] = (K[i/4] << 8) + key[i]; diff --git a/src/block/rc5/rc5.h b/src/block/rc5/rc5.h index c69705471..bf059a996 100644 --- a/src/block/rc5/rc5.h +++ b/src/block/rc5/rc5.h @@ -35,7 +35,7 @@ class BOTAN_DLL RC5 : public Block_Cipher_Fixed_Params<8, 1, 32> void key_schedule(const byte[], size_t); - SecureVector<u32bit> S; + secure_vector<u32bit> S; }; } diff --git a/src/block/rc6/rc6.cpp b/src/block/rc6/rc6.cpp index 53ca5a7a2..42d00878f 100644 --- a/src/block/rc6/rc6.cpp +++ b/src/block/rc6/rc6.cpp @@ -120,7 +120,7 @@ void RC6::key_schedule(const byte key[], size_t length) for(size_t i = 1; i != S.size(); ++i) S[i] = S[i-1] + 0x9E3779B9; - SecureVector<u32bit> K(8); + secure_vector<u32bit> K(8); for(s32bit i = length-1; i >= 0; --i) K[i/4] = (K[i/4] << 8) + key[i]; diff --git a/src/block/rc6/rc6.h b/src/block/rc6/rc6.h index af7b62316..d3270daf7 100644 --- a/src/block/rc6/rc6.h +++ b/src/block/rc6/rc6.h @@ -29,7 +29,7 @@ class BOTAN_DLL RC6 : public Block_Cipher_Fixed_Params<16, 1, 32> private: void key_schedule(const byte[], size_t); - SecureVector<u32bit> S; + secure_vector<u32bit> S; }; } diff --git a/src/block/safer/safer_sk.cpp b/src/block/safer/safer_sk.cpp index 5275a0781..f5fe4edd7 100644 --- a/src/block/safer/safer_sk.cpp +++ b/src/block/safer/safer_sk.cpp @@ -208,7 +208,7 @@ void SAFER_SK::key_schedule(const byte key[], size_t) 0x07, 0x08, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x11, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; - SecureVector<byte> KB(18); + secure_vector<byte> KB(18); for(size_t i = 0; i != 8; ++i) { diff --git a/src/block/safer/safer_sk.h b/src/block/safer/safer_sk.h index 564ea5c50..cf8ad90f7 100644 --- a/src/block/safer/safer_sk.h +++ b/src/block/safer/safer_sk.h @@ -34,7 +34,7 @@ class BOTAN_DLL SAFER_SK : public Block_Cipher_Fixed_Params<8, 16> size_t get_rounds() const { return (EK.size() - 8) / 16; } void key_schedule(const byte[], size_t); - SecureVector<byte> EK; + secure_vector<byte> EK; }; } diff --git a/src/block/seed/seed.cpp b/src/block/seed/seed.cpp index 408220013..40deb18bc 100644 --- a/src/block/seed/seed.cpp +++ b/src/block/seed/seed.cpp @@ -111,7 +111,7 @@ void SEED::key_schedule(const byte key[], size_t) 0x779B99E3, 0xEF3733C6, 0xDE6E678D, 0xBCDCCF1B }; - SecureVector<u32bit> WK(4); + secure_vector<u32bit> WK(4); for(size_t i = 0; i != 4; ++i) WK[i] = load_be<u32bit>(key, i); diff --git a/src/block/seed/seed.h b/src/block/seed/seed.h index 979312930..d5476de82 100644 --- a/src/block/seed/seed.h +++ b/src/block/seed/seed.h @@ -37,7 +37,7 @@ class BOTAN_DLL SEED : public Block_Cipher_Fixed_Params<16, 16> static const u32bit S0[256], S1[256], S2[256], S3[256]; }; - SecureVector<u32bit> K; + secure_vector<u32bit> K; }; } diff --git a/src/block/serpent/serpent.cpp b/src/block/serpent/serpent.cpp index b1e632c29..0f0a4fd63 100644 --- a/src/block/serpent/serpent.cpp +++ b/src/block/serpent/serpent.cpp @@ -358,7 +358,7 @@ void Serpent::key_schedule(const byte key[], size_t length) { const u32bit PHI = 0x9E3779B9; - SecureVector<u32bit> W(140); + secure_vector<u32bit> W(140); for(size_t i = 0; i != length / 4; ++i) W[i] = load_le<u32bit>(key, i); diff --git a/src/block/serpent/serpent.h b/src/block/serpent/serpent.h index df3f039aa..6191e50d7 100644 --- a/src/block/serpent/serpent.h +++ b/src/block/serpent/serpent.h @@ -31,7 +31,7 @@ class BOTAN_DLL Serpent : public Block_Cipher_Fixed_Params<16, 16, 32, 8> * For use by subclasses using SIMD, asm, etc * @return const reference to the key schedule */ - const SecureVector<u32bit>& get_round_keys() const + const secure_vector<u32bit>& get_round_keys() const { return round_key; } /** @@ -45,7 +45,7 @@ class BOTAN_DLL Serpent : public Block_Cipher_Fixed_Params<16, 16, 32, 8> private: void key_schedule(const byte key[], size_t length); - SecureVector<u32bit> round_key; + secure_vector<u32bit> round_key; }; } diff --git a/src/block/serpent_x86_32/serp_x86_32.cpp b/src/block/serpent_x86_32/serp_x86_32.cpp index 4cefe1d65..9566ed8a6 100644 --- a/src/block/serpent_x86_32/serp_x86_32.cpp +++ b/src/block/serpent_x86_32/serp_x86_32.cpp @@ -72,7 +72,7 @@ void Serpent_X86_32::decrypt_n(const byte in[], byte out[], size_t blocks) const */ void Serpent_X86_32::key_schedule(const byte key[], size_t length) { - SecureVector<u32bit> W(140); + secure_vector<u32bit> W(140); for(size_t i = 0; i != length / 4; ++i) W[i] = load_le<u32bit>(key, i); W[length / 4] |= u32bit(1) << ((length%4)*8); diff --git a/src/block/skipjack/skipjack.h b/src/block/skipjack/skipjack.h index 051d35351..9abd10d47 100644 --- a/src/block/skipjack/skipjack.h +++ b/src/block/skipjack/skipjack.h @@ -29,7 +29,7 @@ class BOTAN_DLL Skipjack : public Block_Cipher_Fixed_Params<8, 10> private: void key_schedule(const byte[], size_t); - SecureVector<byte> FTAB; + secure_vector<byte> FTAB; }; } diff --git a/src/block/square/square.cpp b/src/block/square/square.cpp index ff98c040e..bb9132e10 100644 --- a/src/block/square/square.cpp +++ b/src/block/square/square.cpp @@ -142,7 +142,7 @@ void Square::decrypt_n(const byte in[], byte out[], size_t blocks) const */ void Square::key_schedule(const byte key[], size_t) { - SecureVector<u32bit> XEK(36), XDK(36); + secure_vector<u32bit> XEK(36), XDK(36); for(size_t i = 0; i != 4; ++i) XEK[i] = load_be<u32bit>(key, i); diff --git a/src/block/square/square.h b/src/block/square/square.h index 5147c0383..f40ad0e31 100644 --- a/src/block/square/square.h +++ b/src/block/square/square.h @@ -45,8 +45,8 @@ class BOTAN_DLL Square : public Block_Cipher_Fixed_Params<16, 16> static const u32bit TD2[256]; static const u32bit TD3[256]; - SecureVector<u32bit> EK, DK; - SecureVector<byte> ME, MD; + secure_vector<u32bit> EK, DK; + secure_vector<byte> ME, MD; }; } diff --git a/src/block/tea/tea.h b/src/block/tea/tea.h index 0290b112f..5d418e084 100644 --- a/src/block/tea/tea.h +++ b/src/block/tea/tea.h @@ -28,7 +28,7 @@ class BOTAN_DLL TEA : public Block_Cipher_Fixed_Params<8, 16> TEA() : K(4) {} private: void key_schedule(const byte[], size_t); - SecureVector<u32bit> K; + secure_vector<u32bit> K; }; } diff --git a/src/block/twofish/twofish.cpp b/src/block/twofish/twofish.cpp index c0735e202..d0a4213fb 100644 --- a/src/block/twofish/twofish.cpp +++ b/src/block/twofish/twofish.cpp @@ -121,7 +121,7 @@ void Twofish::decrypt_n(const byte in[], byte out[], size_t blocks) const */ void Twofish::key_schedule(const byte key[], size_t length) { - SecureVector<byte> S(16); + secure_vector<byte> S(16); for(size_t i = 0; i != length; ++i) rs_mul(&S[4*(i/8)], key[i], i); diff --git a/src/block/twofish/twofish.h b/src/block/twofish/twofish.h index 7594bdcfd..cd84c6fe0 100644 --- a/src/block/twofish/twofish.h +++ b/src/block/twofish/twofish.h @@ -41,7 +41,7 @@ class BOTAN_DLL Twofish : public Block_Cipher_Fixed_Params<16, 16, 32, 8> static const byte EXP_TO_POLY[255]; static const byte POLY_TO_EXP[255]; - SecureVector<u32bit> SB, RK; + secure_vector<u32bit> SB, RK; }; } diff --git a/src/block/xtea/xtea.cpp b/src/block/xtea/xtea.cpp index 597eedd07..29287e5a0 100644 --- a/src/block/xtea/xtea.cpp +++ b/src/block/xtea/xtea.cpp @@ -123,7 +123,7 @@ void XTEA::decrypt_n(const byte in[], byte out[], size_t blocks) const */ void XTEA::key_schedule(const byte key[], size_t) { - SecureVector<u32bit> UK(4); + secure_vector<u32bit> UK(4); for(size_t i = 0; i != 4; ++i) UK[i] = load_be<u32bit>(key, i); diff --git a/src/block/xtea/xtea.h b/src/block/xtea/xtea.h index 985e9d6d1..2bf544696 100644 --- a/src/block/xtea/xtea.h +++ b/src/block/xtea/xtea.h @@ -30,11 +30,11 @@ class BOTAN_DLL XTEA : public Block_Cipher_Fixed_Params<8, 16> /** * @return const reference to the key schedule */ - const SecureVector<u32bit>& get_EK() const { return EK; } + const secure_vector<u32bit>& get_EK() const { return EK; } private: void key_schedule(const byte[], size_t); - SecureVector<u32bit> EK; + secure_vector<u32bit> EK; }; } |