• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*############################################################################
2   # Copyright 2016-2017 Intel Corporation
3   #
4   # Licensed under the Apache License, Version 2.0 (the "License");
5   # you may not use this file except in compliance with the License.
6   # You may obtain a copy of the License at
7   #
8   #     http://www.apache.org/licenses/LICENSE-2.0
9   #
10   # Unless required by applicable law or agreed to in writing, software
11   # distributed under the License is distributed on an "AS IS" BASIS,
12   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   # See the License for the specific language governing permissions and
14   # limitations under the License.
15   ############################################################################*/
16 
17 /*!
18  * \file
19  * \brief Finite field private interface.
20  */
21 
22 #ifndef EPID_COMMON_MATH_SRC_FINITEFIELD_INTERNAL_H_
23 #define EPID_COMMON_MATH_SRC_FINITEFIELD_INTERNAL_H_
24 
25 #include "epid/common/math/bignum.h"
26 #include "epid/common/math/src/bignum-internal.h"
27 #include "ext/ipp/include/ippcp.h"
28 
29 /// Finite Field
30 struct FiniteField {
31   /// Internal implementation of finite field
32   IppsGFpState* ipp_ff;
33   /// Previous finitefield
34   struct FiniteField* ground_ff;
35   /// Degree of basic field
36   int basic_degree;
37   /// Degree of current field
38   int ground_degree;
39   /// Size of element in BNU units
40   int element_len;
41   /// Minimum number of bytes needed to serialize an element
42   size_t element_strlen_required;
43   /*!
44   Galois field prime or free standing coefficient of
45   irreducible polynomial of finite field extension.
46   */
47   BigNum* modulus_0;
48 };
49 
50 /// Finite Field Element
51 struct FfElement {
52   /// Internal implementation of finite field element
53   IppsGFpElement* ipp_ff_elem;
54   /// Element size of Finite Field element
55   int element_len;
56   /// Degree of Finite Field element
57   int degree;
58 };
59 
60 EpidStatus SetFfElementOctString(ConstOctStr ff_elem_str, int strlen,
61                                  struct FfElement* ff_elem,
62                                  struct FiniteField* ff);
63 
64 #endif  // EPID_COMMON_MATH_SRC_FINITEFIELD_INTERNAL_H_
65