gmac_policy.hpp
Go to the documentation of this file.
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2019 Mikhail Komarov <nemo@nil.foundation>
3 //
4 // MIT License
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in all
14 // copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 // SOFTWARE.
23 //---------------------------------------------------------------------------//
24 
25 #ifndef CRYPTO3_MAC_GMAC_POLICY_HPP
26 #define CRYPTO3_MAC_GMAC_POLICY_HPP
27 
28 #include <boost/integer.hpp>
29 
30 #include <nil/crypto3/mac/detail/static_digest.hpp>
31 
32 namespace nil {
33  namespace crypto3 {
34  namespace mac {
35  namespace detail {
36  template<typename BlockCipher, typename Hash>
37  struct gmac_policy {
39  typedef Hash hash_type;
40 
41  typedef typename boost::uint_t<CHAR_BIT>::exact byte_type;
42 
43  constexpr static const std::size_t block_bits = cipher_type::block_bits;
44  constexpr static const std::size_t block_words = cipher_type::block_words;
45  typedef typename cipher_type::block_type block_type;
46 
47  constexpr static const std::size_t digest_bits = block_bits;
49 
50  constexpr static const std::size_t key_words = cipher_type::key_words;
51  constexpr static const std::size_t key_bits = cipher_type::key_bits;
52  typedef typename cipher_type::key_type key_type;
53  };
54  } // namespace detail
55  } // namespace mac
56  } // namespace crypto3
57 } // namespace nil
58 
59 #endif // CRYPTO3_GMAC_POLICY_HPP
Definition: block/include/nil/crypto3/detail/static_digest.hpp:72
boost::mpl::apply< AccumulatorSet, tag::mac< ProcessingPolicy > >::type::result_type mac(const AccumulatorSet &acc)
Definition: accumulators/mac.hpp:99
boost::accumulators::accumulator_set< mac::digest< MessageAuthenticationCode::input_block_bits >, boost::accumulators::features< accumulators::tag::mac< MessageAuthenticationCode > >> BlockCipher
Definition: cbc_mac_state.hpp:40
Definition: pair.hpp:31
Definition: gmac_policy.hpp:37
cipher_type::key_type key_type
Definition: gmac_policy.hpp:52
boost::uint_t< CHAR_BIT >::exact byte_type
Definition: gmac_policy.hpp:41
BlockCipher cipher_type
Definition: gmac_policy.hpp:38
constexpr static const std::size_t block_words
Definition: gmac_policy.hpp:44
Hash hash_type
Definition: gmac_policy.hpp:39
constexpr static const std::size_t block_bits
Definition: gmac_policy.hpp:43
cipher_type::block_type block_type
Definition: gmac_policy.hpp:45
constexpr static const std::size_t key_bits
Definition: gmac_policy.hpp:51
static_digest< block_bits > digest_type
Definition: gmac_policy.hpp:48
constexpr static const std::size_t key_words
Definition: gmac_policy.hpp:50
constexpr static const std::size_t digest_bits
Definition: gmac_policy.hpp:47