• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*############################################################################
2 # Copyright 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 /// Comparators for tiny math types.
17 /*! \file */
18 
19 #include "epid/member/tiny/math/unittests/cmp-testhelper.h"
20 
21 #include <cstring>
22 
23 extern "C" {
24 #include "epid/member/tiny/math/efq.h"
25 #include "epid/member/tiny/math/efq2.h"
26 #include "epid/member/tiny/math/mathtypes.h"
27 }
28 
operator ==(VeryLargeInt const & lhs,VeryLargeInt const & rhs)29 bool operator==(VeryLargeInt const& lhs, VeryLargeInt const& rhs) {
30   return 0 == std::memcmp(&lhs, &rhs, sizeof(lhs));
31 }
32 
operator ==(VeryLargeIntProduct const & lhs,VeryLargeIntProduct const & rhs)33 bool operator==(VeryLargeIntProduct const& lhs,
34                 VeryLargeIntProduct const& rhs) {
35   return 0 == std::memcmp(&lhs, &rhs, sizeof(lhs));
36 }
operator ==(FpElem const & lhs,FpElem const & rhs)37 bool operator==(FpElem const& lhs, FpElem const& rhs) {
38   return 0 == std::memcmp(&lhs, &rhs, sizeof(lhs));
39 }
40 
operator ==(FqElem const & lhs,FqElem const & rhs)41 bool operator==(FqElem const& lhs, FqElem const& rhs) {
42   return 0 == std::memcmp(&lhs, &rhs, sizeof(lhs));
43 }
44 
operator ==(Fq2Elem const & lhs,Fq2Elem const & rhs)45 bool operator==(Fq2Elem const& lhs, Fq2Elem const& rhs) {
46   return 0 == std::memcmp(&lhs, &rhs, sizeof(lhs));
47 }
48 
operator ==(Fq6Elem const & lhs,Fq6Elem const & rhs)49 bool operator==(Fq6Elem const& lhs, Fq6Elem const& rhs) {
50   return 0 == std::memcmp(&lhs, &rhs, sizeof(lhs));
51 }
52 
operator ==(Fq12Elem const & lhs,Fq12Elem const & rhs)53 bool operator==(Fq12Elem const& lhs, Fq12Elem const& rhs) {
54   return 0 == std::memcmp(&lhs, &rhs, sizeof(lhs));
55 }
56 
operator ==(EccPointFq const & lhs,EccPointFq const & rhs)57 bool operator==(EccPointFq const& lhs, EccPointFq const& rhs) {
58   return 0 == std::memcmp(&lhs, &rhs, sizeof(lhs));
59 }
60 
operator ==(EccPointJacobiFq const & lhs,EccPointJacobiFq const & rhs)61 bool operator==(EccPointJacobiFq const& lhs, EccPointJacobiFq const& rhs) {
62   return 0 != EFqEq(&lhs, &rhs);
63 }
64 
operator ==(EccPointFq2 const & lhs,EccPointFq2 const & rhs)65 bool operator==(EccPointFq2 const& lhs, EccPointFq2 const& rhs) {
66   return 0 == std::memcmp(&lhs, &rhs, sizeof(lhs));
67 }
68 
operator ==(EccPointJacobiFq2 const & lhs,EccPointJacobiFq2 const & rhs)69 bool operator==(EccPointJacobiFq2 const& lhs, EccPointJacobiFq2 const& rhs) {
70   return 0 != EFq2Eq(&lhs, &rhs);
71 }
72