From a151a774f4ce6c4b13c819502efcfe919bbf050b Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 25 Jun 2017 19:56:14 +0300 Subject: code style --- cxx/include/aesxx/aes.hpp | 36 ++++++++++++++++++------------------ cxx/include/aesxx/api.hpp | 24 ++++++++++++------------ cxx/include/aesxx/error.hpp | 2 +- 3 files changed, 31 insertions(+), 31 deletions(-) (limited to 'cxx/include') diff --git a/cxx/include/aesxx/aes.hpp b/cxx/include/aesxx/aes.hpp index d1f68d2..efac790 100644 --- a/cxx/include/aesxx/aes.hpp +++ b/cxx/include/aesxx/aes.hpp @@ -34,19 +34,19 @@ namespace aes }; template <> - std::size_t get_number_of_rounds() + inline std::size_t get_number_of_rounds() { return 11; } template <> - void from_string(aes128::Block& dest, const char* src) + inline void from_string(aes128::Block& dest, const char* src) { aes_AES128_parse_block(&dest, src, ErrorDetailsThrowsInDestructor{}); } template <> - std::string to_string(const aes128::Block& src) + inline std::string to_string(const aes128::Block& src) { AES_AES128_BlockString str; aes_AES128_format_block(&str, &src, ErrorDetailsThrowsInDestructor{}); @@ -54,7 +54,7 @@ namespace aes } template <> - std::string to_matrix_string(const aes128::Block& src) + inline std::string to_matrix_string(const aes128::Block& src) { AES_AES128_BlockMatrixString str; aes_AES128_format_block_as_matrix(&str, &src, ErrorDetailsThrowsInDestructor{}); @@ -62,13 +62,13 @@ namespace aes } template <> - void from_string(aes128::Key& dest, const char* src) + inline void from_string(aes128::Key& dest, const char* src) { aes_AES128_parse_key(&dest, src, ErrorDetailsThrowsInDestructor{}); } template <> - std::string to_string(const aes128::Key& src) + inline std::string to_string(const aes128::Key& src) { AES_AES128_KeyString str; aes_AES128_format_key(&str, &src, ErrorDetailsThrowsInDestructor{}); @@ -119,19 +119,19 @@ namespace aes }; template <> - std::size_t get_number_of_rounds() + inline std::size_t get_number_of_rounds() { return 13; } template <> - void from_string(aes192::Block& dest, const char* src) + inline void from_string(aes192::Block& dest, const char* src) { aes_AES192_parse_block(&dest, src, ErrorDetailsThrowsInDestructor{}); } template <> - std::string to_string(const aes192::Block& src) + inline std::string to_string(const aes192::Block& src) { AES_AES192_BlockString str; aes_AES192_format_block(&str, &src, ErrorDetailsThrowsInDestructor{}); @@ -139,7 +139,7 @@ namespace aes } template <> - std::string to_matrix_string(const aes192::Block& src) + inline std::string to_matrix_string(const aes192::Block& src) { AES_AES192_BlockMatrixString str; aes_AES192_format_block_as_matrix(&str, &src, ErrorDetailsThrowsInDestructor{}); @@ -147,13 +147,13 @@ namespace aes } template <> - void from_string(aes192::Key& dest, const char* src) + inline void from_string(aes192::Key& dest, const char* src) { aes_AES192_parse_key(&dest, src, ErrorDetailsThrowsInDestructor{}); } template <> - std::string to_string(const aes192::Key& src) + inline std::string to_string(const aes192::Key& src) { AES_AES192_KeyString str; aes_AES192_format_key(&str, &src, ErrorDetailsThrowsInDestructor{}); @@ -204,19 +204,19 @@ namespace aes }; template <> - std::size_t get_number_of_rounds() + inline std::size_t get_number_of_rounds() { return 15; } template <> - void from_string(aes256::Block& dest, const char* src) + inline void from_string(aes256::Block& dest, const char* src) { aes_AES256_parse_block(&dest, src, ErrorDetailsThrowsInDestructor{}); } template <> - std::string to_string(const aes256::Block& src) + inline std::string to_string(const aes256::Block& src) { AES_AES256_BlockString str; aes_AES256_format_block(&str, &src, ErrorDetailsThrowsInDestructor{}); @@ -224,7 +224,7 @@ namespace aes } template <> - std::string to_matrix_string(const aes256::Block& src) + inline std::string to_matrix_string(const aes256::Block& src) { AES_AES256_BlockMatrixString str; aes_AES256_format_block_as_matrix(&str, &src, ErrorDetailsThrowsInDestructor{}); @@ -232,13 +232,13 @@ namespace aes } template <> - void from_string(aes256::Key& dest, const char* src) + inline void from_string(aes256::Key& dest, const char* src) { aes_AES256_parse_key(&dest, src, ErrorDetailsThrowsInDestructor{}); } template <> - std::string to_string(const aes256::Key& src) + inline std::string to_string(const aes256::Key& src) { AES_AES256_KeyString str; aes_AES256_format_key(&str, &src, ErrorDetailsThrowsInDestructor{}); diff --git a/cxx/include/aesxx/api.hpp b/cxx/include/aesxx/api.hpp index 2d0871f..789320f 100644 --- a/cxx/include/aesxx/api.hpp +++ b/cxx/include/aesxx/api.hpp @@ -27,7 +27,7 @@ namespace aes const char*); template - inline void from_string( + void from_string( typename Types::Block& dest, const std::string& src) { @@ -46,7 +46,7 @@ namespace aes const char*); template - inline void from_string( + void from_string( typename Types::Key& dest, const std::string& src) { @@ -57,30 +57,30 @@ namespace aes std::string to_string(const typename Types::Key&); template - inline void expand_key( + void expand_key( const typename Types::Key& key, typename Types::RoundKeys& encryption_keys); template - inline void derive_decryption_keys( + void derive_decryption_keys( const typename Types::RoundKeys& encryption_keys, typename Types::RoundKeys& decryption_keys); template ::value>::type* = nullptr> - inline void encrypt_block( + void encrypt_block( const typename Types::Block& plaintext, const typename Types::RoundKeys& round_keys, typename Types::Block& iv, typename Types::Block& ciphertext); template ::value>::type* = nullptr> - inline void encrypt_block( + void encrypt_block( const typename Types::Block& plaintext, const typename Types::RoundKeys& round_keys, typename Types::Block& ciphertext); template ::value>::type* = nullptr> - inline void encrypt_block( + void encrypt_block( const typename Types::Block& plaintext, const typename Types::RoundKeys& round_keys, typename Types::Block&, @@ -90,20 +90,20 @@ namespace aes } template ::value>::type* = nullptr> - inline void decrypt_block( + void decrypt_block( const typename Types::Block& ciphertext, const typename Types::RoundKeys& round_keys, typename Types::Block& iv, typename Types::Block& plaintext); template ::value>::type* = nullptr> - inline void decrypt_block( + void decrypt_block( const typename Types::Block& ciphertext, const typename Types::RoundKeys& round_keys, typename Types::Block& plaintext); template ::value>::type* = nullptr> - inline void decrypt_block( + void decrypt_block( const typename Types::Block& ciphertext, const typename Types::RoundKeys& round_keys, typename Types::Block&, @@ -122,7 +122,7 @@ namespace aes expand_key(key, encryption_keys); } - inline void encrypt_block( + void encrypt_block( const typename Types::Block& plaintext, typename Types::Block& ciphertext) { @@ -154,7 +154,7 @@ namespace aes } } - inline void decrypt_block( + void decrypt_block( const typename Types::Block& ciphertext, typename Types::Block& plaintext) { diff --git a/cxx/include/aesxx/error.hpp b/cxx/include/aesxx/error.hpp index 21f65d5..4d2c783 100644 --- a/cxx/include/aesxx/error.hpp +++ b/cxx/include/aesxx/error.hpp @@ -69,7 +69,7 @@ namespace aes const void* call_stack[AES_MAX_CALL_STACK_LENGTH] = {nullptr}; }; - std::ostream& operator<<(std::ostream& os, const Error& error) + inline std::ostream& operator<<(std::ostream& os, const Error& error) { os << "AES error: " << error.what() << '\n'; os << "Call stack:\n"; -- cgit v1.2.3