/*############################################################################ # Copyright 2016 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################*/ /*! * \file * \brief Printutils unit tests. */ #ifndef EPID_ENABLE_DEBUG_PRINT #define EPID_ENABLE_DEBUG_PRINT #endif #include #include "gtest/gtest.h" extern "C" { #include "epid/common/math/bignum.h" #include "epid/common/math/printutils.h" } #include "epid/common-testhelper/errors-testhelper.h" #include "epid/common-testhelper/ffelement_wrapper-testhelper.h" #include "epid/common-testhelper/finite_field_wrapper-testhelper.h" #include "epid/common-testhelper/ecgroup_wrapper-testhelper.h" #include "epid/common-testhelper/ecpoint_wrapper-testhelper.h" #include "epid/common-testhelper/bignum_wrapper-testhelper.h" namespace { class PrintutilsTest : public ::testing::Test { public: /// Intel(R) EPID 2.0 parameter q static const BigNumStr epid20_q; static const BigNumStr epid20_p; static const FpElemStr p_str; static const FqElemStr beta_str; static const Fq2ElemStr xi_str; static const Fq6ElemStr v_str; static const Fq12ElemStr a_str; static const G1ElemStr g1_str; static const G2ElemStr g2_str; static const FqElemStr a1; static const FqElemStr b1; static const BigNumStr h1; static const G1ElemStr efq_a_str; static const G2ElemStr efq2_a_str; BigNumObj q; FiniteFieldObj fp; FiniteFieldObj fq; FiniteFieldObj fq2; FiniteFieldObj fq6; FiniteFieldObj fq12; FfElementObj fp_elem; FfElementObj fq_beta; FfElementObj fq2_xi; FfElementObj fq6_v; FfElementObj fq12_a; EcGroupObj efq; EcPointObj efq_a; EcGroupObj efq2; EcPointObj efq2_a; public: virtual void SetUp() { q = BigNumObj(epid20_q); ConstructFiniteFields(); ConstructEllipticCurveGroups(); } private: void ConstructFiniteFields() { // construct Fp finite field fp = FiniteFieldObj(epid20_p); fp_elem = FfElementObj(&fp, p_str); // construct Fq finite field fq = FiniteFieldObj(epid20_q); fq_beta = FfElementObj(&fq, beta_str); // construct Fq^2 finite field FfElementObj neg_beta(&fq); THROW_ON_EPIDERR(FfNeg(fq, FfElementObj(&fq, beta_str), neg_beta)); fq2 = FiniteFieldObj(fq, neg_beta, 2); fq2_xi = FfElementObj(&fq2, xi_str); // construct Fq^6 finite field FfElementObj neg_xi(&fq2); THROW_ON_EPIDERR(FfNeg(fq2, FfElementObj(&fq2, xi_str), neg_xi)); fq6 = FiniteFieldObj(fq2, neg_xi, 3); fq6_v = FfElementObj(&fq6, v_str); // construct Fq^12 finite field FfElementObj neg_v(&fq6); THROW_ON_EPIDERR(FfNeg(fq6, FfElementObj(&fq6, v_str), neg_v)); fq12 = FiniteFieldObj(fq6, neg_v, 2); fq12_a = FfElementObj(&fq12, a_str); } void ConstructEllipticCurveGroups() { // Create G1 // G1 is an elliptic curve group E(Fq).It can be initialized as follows : // Set G1 = E(Fq).init(p, q, n = p, h = 1, a = 0, b, g1.x, g1.y). efq = EcGroupObj(&fq, FfElementObj(&fq), FfElementObj(&fq, b1), FfElementObj(&fq, g1_str.x), FfElementObj(&fq, g1_str.y), BigNumObj(epid20_p), BigNumObj(h1)); // set h = 2q - p, aka cofactor std::vector cofactor_str( {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xf0, 0xcd, 0x46, 0xe5, 0xf2, 0x5e, 0xee, 0x71, 0xa4, 0xa0, 0x0c, 0xdc, 0x65, 0xfb, 0x12, 0x96, 0x82, 0xea, 0xb0, 0x25, 0x08, 0x4a, 0x8c, 0x9b, 0x10, 0x19}); // set n = p * h, AKA order std::vector order_str( {0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xe1, 0x9a, 0x8d, 0xcb, 0xe4, 0xc7, 0x38, 0xfa, 0x9b, 0x98, 0x4d, 0x1c, 0x12, 0x9f, 0x64, 0x97, 0xe8, 0x54, 0xa3, 0x0a, 0x81, 0xac, 0x42, 0xf9, 0x39, 0x16, 0xa7, 0x70, 0x21, 0xdc, 0xfb, 0xb6, 0xe7, 0x7e, 0x1f, 0x5b, 0x55, 0xcc, 0x4e, 0x84, 0xcd, 0x19, 0x4f, 0x49, 0x20, 0x94, 0xb5, 0xd8, 0x12, 0xa0, 0x2e, 0x7f, 0x40, 0x13, 0xb2, 0xfa, 0xa1, 0x45}); // Compute xi' = Fq2.inverse(xi). FfElementObj inv_xi(&fq2); THROW_ON_EPIDERR(FfInv(fq2, FfElementObj(&fq2, xi_str), inv_xi)); // Compute b' = Fq2.mul(xi', b). FfElementObj b_dash(&fq2); THROW_ON_EPIDERR(FfMul(fq2, inv_xi.get(), FfElementObj(&fq, b1), b_dash)); // Set G2 = E(Fq2).init(p, param(Fq2), n, h, 0, b', g2.x, g2.y) efq2 = EcGroupObj(&fq2, FfElementObj(&fq2), b_dash, FfElementObj(&fq2, &g2_str.x, sizeof(g2_str.x)), FfElementObj(&fq2, &g2_str.y, sizeof(g2_str.y)), BigNumObj(order_str), BigNumObj(cofactor_str)); efq_a = EcPointObj(&efq, efq_a_str); efq2_a = EcPointObj(&efq2, efq2_a_str); } }; /// Intel(R) EPID 2.0 parameter q const BigNumStr PrintutilsTest::epid20_q = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF0, 0xCD, 0x46, 0xE5, 0xF2, 0x5E, 0xEE, 0x71, 0xA4, 0x9F, 0x0C, 0xDC, 0x65, 0xFB, 0x12, 0x98, 0x0A, 0x82, 0xD3, 0x29, 0x2D, 0xDB, 0xAE, 0xD3, 0x30, 0x13}; const BigNumStr PrintutilsTest::epid20_p = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF0, 0xCD, 0x46, 0xE5, 0xF2, 0x5E, 0xEE, 0x71, 0xA4, 0x9E, 0x0C, 0xDC, 0x65, 0xFB, 0x12, 0x99, 0x92, 0x1A, 0xF6, 0x2D, 0x53, 0x6C, 0xD1, 0x0B, 0x50, 0x0D}; const FpElemStr PrintutilsTest::p_str = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF0, 0xCD, 0x46, 0xE5, 0xF2, 0x5E, 0xEE, 0x71, 0xA4, 0x9E, 0x0C, 0xDC, 0x65, 0xFB, 0x12, 0x99, 0x92, 0x1A, 0xF6, 0x2D, 0x53, 0x6C, 0xD1, 0x0B, 0x50, 0x00}; const FqElemStr PrintutilsTest::beta_str = { {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF0, 0xCD, 0x46, 0xE5, 0xF2, 0x5E, 0xEE, 0x71, 0xA4, 0x9F, 0x0C, 0xDC, 0x65, 0xFB, 0x12, 0x98, 0x0A, 0x82, 0xD3, 0x29, 0x2D, 0xDB, 0xAE, 0xD3, 0x30, 0x12}}; const Fq2ElemStr PrintutilsTest::xi_str = { {{{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}}}, {{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}}}}}; const Fq6ElemStr PrintutilsTest::v_str = { {{{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}}, {{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}}, {{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}}}}; const Fq12ElemStr PrintutilsTest::a_str = { 0xba, 0x10, 0x1f, 0xf6, 0x46, 0x8b, 0xe9, 0x32, 0x4f, 0xc0, 0xa5, 0x01, 0xad, 0x5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c, 0x8e, }; const FqElemStr PrintutilsTest::a1 = { {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}}; const FqElemStr PrintutilsTest::b1 = { {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03}}}; const BigNumStr PrintutilsTest::h1 = { {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}}}; const G1ElemStr PrintutilsTest::g1_str = { {{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}}}, {{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}}}}; const G2ElemStr PrintutilsTest::g2_str = { {{{{0xE2, 0x01, 0x71, 0xC5, 0x4A, 0xA3, 0xDA, 0x05, 0x21, 0x67, 0x04, 0x13, 0x74, 0x3C, 0xCF, 0x22, 0xD2, 0x5D, 0x52, 0x68, 0x3D, 0x32, 0x47, 0x0E, 0xF6, 0x02, 0x13, 0x43, 0xBF, 0x28, 0x23, 0x94}}}, {{{0x59, 0x2D, 0x1E, 0xF6, 0x53, 0xA8, 0x5A, 0x80, 0x46, 0xCC, 0xDC, 0x25, 0x4F, 0xBB, 0x56, 0x56, 0x43, 0x43, 0x3B, 0xF6, 0x28, 0x96, 0x53, 0xE2, 0x7D, 0xF7, 0xB2, 0x12, 0xBA, 0xA1, 0x89, 0xBE}}}}, {{{{0xAE, 0x60, 0xA4, 0xE7, 0x51, 0xFF, 0xD3, 0x50, 0xC6, 0x21, 0xE7, 0x03, 0x31, 0x28, 0x26, 0xBD, 0x55, 0xE8, 0xB5, 0x9A, 0x4D, 0x91, 0x68, 0x38, 0x41, 0x4D, 0xB8, 0x22, 0xDD, 0x23, 0x35, 0xAE}}}, {{{0x1A, 0xB4, 0x42, 0xF9, 0x89, 0xAF, 0xE5, 0xAD, 0xF8, 0x02, 0x74, 0xF8, 0x76, 0x45, 0xE2, 0x53, 0x2C, 0xDC, 0x61, 0x81, 0x90, 0x93, 0xD6, 0x13, 0x2C, 0x90, 0xFE, 0x89, 0x51, 0xB9, 0x24, 0x21}}}}}; const G1ElemStr PrintutilsTest::efq_a_str = { {{{0x12, 0xA6, 0x5B, 0xD6, 0x91, 0x8D, 0x50, 0xA7, 0x66, 0xEB, 0x7D, 0x52, 0xE3, 0x40, 0x17, 0x60, 0x7F, 0xDF, 0x6C, 0xA1, 0x2C, 0x1A, 0x37, 0xE0, 0x92, 0xC0, 0xF7, 0xB9, 0x76, 0xAB, 0xB1, 0x8A}}}, {{{0x78, 0x65, 0x28, 0xCB, 0xAF, 0x07, 0x52, 0x50, 0x55, 0x7A, 0x5F, 0x30, 0x0A, 0xC0, 0xB4, 0x6B, 0xEA, 0x6F, 0xE2, 0xF6, 0x6D, 0x96, 0xF7, 0xCD, 0xC8, 0xD3, 0x12, 0x7F, 0x1F, 0x3A, 0x8B, 0x42}}}}; const G2ElemStr PrintutilsTest::efq2_a_str = { { {0x2F, 0x8C, 0xC7, 0xD7, 0xD4, 0x1E, 0x4A, 0xCB, 0x82, 0x92, 0xC7, 0x9C, 0x0F, 0xA2, 0xF2, 0x1B, 0xDF, 0xEA, 0x96, 0x64, 0x8B, 0xA2, 0x32, 0x7C, 0xDF, 0xD8, 0x89, 0x10, 0xFD, 0xBB, 0x38, 0xCD}, {0xB1, 0x23, 0x46, 0x13, 0x4D, 0x9B, 0x8E, 0x8A, 0x95, 0x64, 0xDD, 0x37, 0x29, 0x44, 0x1F, 0x76, 0xB5, 0x3A, 0x47, 0xD3, 0xE0, 0x18, 0x1E, 0x60, 0xE9, 0x94, 0x13, 0xA4, 0x47, 0xCD, 0xBE, 0x03}, }, { {0xD3, 0x67, 0xA5, 0xCC, 0xEF, 0x7B, 0xD1, 0x8D, 0x4A, 0x7F, 0xF1, 0x8F, 0x66, 0xCB, 0x5E, 0x86, 0xAC, 0xCB, 0x36, 0x5F, 0x29, 0x90, 0x28, 0x55, 0xF0, 0xDC, 0x6E, 0x8B, 0x87, 0xB5, 0xD8, 0x32}, {0x6C, 0x0A, 0xC5, 0x58, 0xB1, 0x4E, 0xCA, 0x85, 0x44, 0x3E, 0xDE, 0x71, 0x9B, 0xC7, 0x90, 0x19, 0x06, 0xD2, 0xA0, 0x4E, 0xC7, 0x33, 0xF4, 0x5C, 0xE8, 0x16, 0xE2, 0x67, 0xDB, 0xBF, 0x64, 0x84}, }, }; TEST_F(PrintutilsTest, DISABLED_PrintutilsWorkWithAnnotatedFormat) { // Test intentionally disabled and has no predicate. // Enable for manual output inspection. PrintBigNum(q, "q"); PrintFfElement(fp, fp_elem, "fp_elem", kPrintUtilAnnotated); PrintFfElement(fq, fq_beta, "fq_beta", kPrintUtilAnnotated); PrintFfElement(fq2, fq2_xi, "fq2_xi", kPrintUtilAnnotated); PrintFfElement(fq6, fq6_v, "fq6_v", kPrintUtilAnnotated); PrintFfElement(fq12, fq12_a, "fq12_a", kPrintUtilAnnotated); PrintEcPoint(efq, efq_a, "efq_a", kPrintUtilAnnotated); PrintEcPoint(efq2, efq2_a, "efq2_a", kPrintUtilAnnotated); PrintBigNumStr(&epid20_q, "q_str"); PrintFqElemStr(&beta_str, "fq_beta_str"); PrintFq2ElemStr(&xi_str, "fq2_xi_str", kPrintUtilAnnotated); PrintFq6ElemStr(&v_str, "fq6_v_str", kPrintUtilAnnotated); PrintFq12ElemStr(&a_str, "fq12_a_str", kPrintUtilAnnotated); PrintG1ElemStr(&efq_a_str, "efq_a_str", kPrintUtilAnnotated); PrintG2ElemStr(&efq2_a_str, "efq_a_str", kPrintUtilAnnotated); } TEST_F(PrintutilsTest, DISABLED_PrintutilsWorkWithUnannotatedFormat) { // Test intentionally disabled and has no predicate. // Enable for manual output inspection. PrintFfElement(fp, fp_elem, "fp_elem", kPrintUtilUnannotated); PrintFfElement(fq, fq_beta, "fq_beta", kPrintUtilUnannotated); PrintFfElement(fq2, fq2_xi, "fq2_xi", kPrintUtilUnannotated); PrintFfElement(fq6, fq6_v, "fq6_v", kPrintUtilUnannotated); PrintFfElement(fq12, fq12_a, "fq12_a", kPrintUtilUnannotated); PrintEcPoint(efq, efq_a, "efq_a", kPrintUtilUnannotated); PrintEcPoint(efq2, efq2_a, "efq2_a", kPrintUtilUnannotated); PrintFq2ElemStr(&xi_str, "fq2_xi_str", kPrintUtilUnannotated); PrintFq6ElemStr(&v_str, "fq6_v_str", kPrintUtilUnannotated); PrintFq12ElemStr(&a_str, "fq12_a_str", kPrintUtilUnannotated); PrintG1ElemStr(&efq_a_str, "efq_a_str", kPrintUtilUnannotated); PrintG2ElemStr(&efq2_a_str, "efq_a_str", kPrintUtilUnannotated); } TEST_F(PrintutilsTest, DISABLED_PrintutilsReportNullPtr) { // Test intentionally disabled and has no predicate. // Enable for manual output inspection. PrintBigNum(nullptr, "q"); PrintFfElement(nullptr, fp_elem, "fp_elem", kPrintUtilUnannotated); PrintFfElement(fp, nullptr, "fp_elem", kPrintUtilUnannotated); PrintFfElement(nullptr, fq_beta, "fq_beta", kPrintUtilUnannotated); PrintFfElement(fq, nullptr, "fq_beta", kPrintUtilUnannotated); PrintEcPoint(nullptr, efq_a, "efq_a", kPrintUtilUnannotated); PrintEcPoint(efq, nullptr, "efq_a", kPrintUtilUnannotated); PrintBigNumStr(nullptr, "q_str"); PrintFqElemStr(nullptr, "fq_beta_str"); PrintFq2ElemStr(nullptr, "fq2_xi_str", kPrintUtilAnnotated); PrintFq6ElemStr(nullptr, "fq6_v_str", kPrintUtilAnnotated); PrintFq12ElemStr(nullptr, "fq12_a_str", kPrintUtilAnnotated); PrintG1ElemStr(nullptr, "efq_a_str", kPrintUtilAnnotated); PrintG2ElemStr(nullptr, "efq_a_str", kPrintUtilAnnotated); } TEST_F(PrintutilsTest, DISABLED_PrintutilsReportInvalidArgument) { // Test intentionally disabled and has no predicate. // Enable for manual output inspection. PrintFfElement(fp, fp_elem, "fp_elem", (PrintUtilFormat)100); PrintFfElement(fq, fq_beta, "fq_beta", (PrintUtilFormat)100); PrintFfElement(fq2, fq2_xi, "fq2_xi", (PrintUtilFormat)100); PrintFfElement(fq6, fq6_v, "fq6_v", (PrintUtilFormat)100); PrintFfElement(fq12, fq12_a, "fq12_a", (PrintUtilFormat)100); PrintEcPoint(efq, efq_a, "efq_a", (PrintUtilFormat)100); PrintEcPoint(efq2, efq2_a, "efq2_a", (PrintUtilFormat)100); PrintFq2ElemStr(&xi_str, "fq2_xi_str", (PrintUtilFormat)100); PrintFq6ElemStr(&v_str, "fq6_v_str", (PrintUtilFormat)100); PrintFq12ElemStr(&a_str, "fq12_a_str", (PrintUtilFormat)100); PrintG1ElemStr(&efq_a_str, "efq_a_str", (PrintUtilFormat)100); PrintG2ElemStr(&efq2_a_str, "efq_a_str", (PrintUtilFormat)100); } } // namespace