gost_A.hpp
Go to the documentation of this file.
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2018-2021 Mikhail Komarov <nemo@nil.foundation>
3 // Copyright (c) 2020-2021 Nikita Kaskov <nbering@nil.foundation>
4 //
5 // MIT License
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a copy
8 // of this software and associated documentation files (the "Software"), to deal
9 // in the Software without restriction, including without limitation the rights
10 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 // copies of the Software, and to permit persons to whom the Software is
12 // furnished to do so, subject to the following conditions:
13 //
14 // The above copyright notice and this permission notice shall be included in all
15 // copies or substantial portions of the Software.
16 //
17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 // SOFTWARE.
24 //---------------------------------------------------------------------------//
25 
26 #ifndef CRYPTO3_ALGEBRA_CURVES_GOST_A_HPP
27 #define CRYPTO3_ALGEBRA_CURVES_GOST_A_HPP
28 
31 
33 
34 namespace nil {
35  namespace crypto3 {
36  namespace algebra {
37  namespace curves {
38 
39  template<std::size_t PBits>
40  struct gost_A { };
41 
42  template<>
43  struct gost_A<256> {
44  constexpr static const std::size_t base_field_bits = 256;
47  constexpr static const integral_type base_field_modulus = base_field_type::modulus;
48 
49  constexpr static const std::size_t scalar_field_bits = 256;
51  constexpr static const integral_type scalar_field_modulus = scalar_field_type::modulus;
52 
53  typedef typename detail::gost_A_g1<256> g1_type;
54  typedef typename detail::gost_A_g2<256> g2_type;
55 
56  typedef typename fields::fp ? ? <base_field_type>::value_type gt_type;
57 
58  constexpr static const integral_type p = base_field_modulus;
59  constexpr static const integral_type q = scalar_field_modulus;
60 
61  constexpr static const integral_type a =
62  0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD94_cppui256;
63  constexpr static const integral_type b = 0xA6_cppui256;
64  constexpr static const integral_type x = 0x1_cppui256;
65  constexpr static const integral_type y =
66  0x8D91E471E0989CDA27DF505A453F2B7635294F2DDF23E3B122ACC99C9E9F1E14_cppui256;
67  };
68  } // namespace curves
69  } // namespace algebra
70  } // namespace crypto3
71 } // namespace nil
72 
73 #endif // CRYPTO3_ALGEBRA_CURVES_GOST_A_HPP
Definition: pair.hpp:31
fields::gost_A_fq< base_field_bits > base_field_type
Definition: gost_A.hpp:45
detail::gost_A_g2< 256 > g2_type
Definition: gost_A.hpp:54
base_field_type::integral_type integral_type
Definition: gost_A.hpp:46
fields::gost_A_fr< scalar_field_bits > scalar_field_type
Definition: gost_A.hpp:50
fields::fp< base_field_type > ::value_type gt_type
Definition: gost_A.hpp:56
detail::gost_A_g1< 256 > g1_type
Definition: gost_A.hpp:53
Definition: gost_A.hpp:40
nil::crypto3::multiprecision::number< nil::crypto3::multiprecision::backends::cpp_int_backend< modulus_bits, modulus_bits, nil::crypto3::multiprecision::unsigned_magnitude, nil::crypto3::multiprecision::unchecked, void > > integral_type
Definition: field.hpp:54
IETF IPsec groups.
Definition: gost_A/base_field.hpp:46
IETF IPsec groups.
Definition: gost_A/scalar_field.hpp:46