aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc A. Valle <marc.a.valle@intel.com>2017-07-25 16:11:02 -0700
committerMarc A. Valle <marc.a.valle@intel.com>2017-07-25 16:11:02 -0700
commit7d315f0c34d097074bd89cb2722449abee5cc884 (patch)
tree735fd18487afd353b88939ee26b82ae9fd502a70
parentc93541e53de8104f6d28629bd5d213a08ac7606b (diff)
downloadepid-sdk-7d315f0c34d097074bd89cb2722449abee5cc884.tar.gz
Release SDK 4.0.0
Added * The member implementation now provides an internal interface that gives guidance on partitioning member operations between highly sensitive ones that use f value of the private key, and less sensitive operations that can be performed in a host environment. * New member API `EpidAssemblePrivKey` was added to help assemble and validate the new member private key that is created when a member either joins a group (using the join protocol) or switches to a new group (as the result of a performance rekey). Changed * Updated Intel(R) IPP Cryptography library to version 2017 (Update 2). * The mechanism to set the signature based revocation list (SigRL) used for signing was changed. `EpidMemberSetSigRl` must be used to set the SigRL. The SigRL is no longer a parameter to `EpidSign`. This better models typical use case where a device stores a revocation list and updates it independently of signing operations. Removed * Removed `EpidWritePreSigs` API. Serialization of pre-computed signatures is a risky capability to provide, and simply expanding the internal pool via `EpidAddPreSigs` still provides most of the optimization benefits. * The `EpidIsPrivKeyInGroup` API is no longer exposed to clients. It is no longer needed because the new member API `EpidAssemblePrivKey` performs this check. Fixed * When building with commercial version of the Intel(R) IPP Cryptography library, optimized functions are now properly invoked, making signing and verification operations ~2 times faster * SHA-512/256 hash algorithm is now supported. * README for compressed data now correctly documents the number of entries in revocation lists. * The `verifysig` sample now reports a more clear error message for mismatched SigRLs. * The default scons build will now build for a 32-bit target on a 32-bit platform. Known Issues * Scons build will not work natively on ARM. You can still build using `make` or cross compile.
-rw-r--r--CHANGELOG.md83
-rw-r--r--LICENSE.txt44
-rw-r--r--Makefile.in100
-rw-r--r--NOTICE.txt17
-rw-r--r--README.md14
-rw-r--r--SConstruct209
-rw-r--r--configure135
-rw-r--r--configure.ac18
-rw-r--r--doc/html/1_81_2file__parser_8h.html4
-rw-r--r--doc/html/1_81_2types_8h.html4
-rw-r--r--doc/html/Basenames.html4
-rw-r--r--doc/html/BuildToolsInstallation.html14
-rw-r--r--doc/html/BuildingSdk.html51
-rw-r--r--doc/html/ChangeLog.html50
-rw-r--r--doc/html/ChoosingiKGF.html4
-rw-r--r--doc/html/EpidOverview.html25
-rw-r--r--doc/html/Glossary.html4
-rw-r--r--doc/html/HowValidated.html123
-rw-r--r--doc/html/ImplementationNotes.html9
-rw-r--r--doc/html/IssuerMaterial.html9
-rw-r--r--doc/html/LegalInformation.html4
-rw-r--r--doc/html/Revocation.html4
-rw-r--r--doc/html/SdkOverview.html27
-rw-r--r--doc/html/SignVerifyTutorial.html147
-rw-r--r--doc/html/UserManual_GeneratingAnIntelEpidSignature.html (renamed from doc/html/SignmsgWalkthru.html)59
-rw-r--r--doc/html/UserManual_VerifyingAnIntelEpidSignature.html (renamed from doc/html/VerifysigWalkthru.html)53
-rw-r--r--doc/html/annotated.html35
-rw-r--r--doc/html/basenames_8dox.html4
-rw-r--r--doc/html/basicdoc.pngbin19922 -> 26874 bytes
-rw-r--r--doc/html/bignum_8h.html16
-rw-r--r--doc/html/bitsupplier_8h.html4
-rw-r--r--doc/html/build__tools__installation_8dox.html4
-rw-r--r--doc/html/building__sdk_8dox.html4
-rw-r--r--doc/html/choosing__ikgf_8dox.html4
-rw-r--r--doc/html/classes.html49
-rw-r--r--doc/html/context_8h.html102
-rw-r--r--doc/html/decompress_8h.html92
-rw-r--r--doc/html/dir_02c945662023679b89476bd7126bc985.html4
-rw-r--r--doc/html/dir_12b90d9c027aaf878a834df729679a56.html4
-rw-r--r--doc/html/dir_512d3e62841a8535b716ec4cf8b9e950.html7
-rw-r--r--doc/html/dir_6048dbb18cb271412de4a010207fd345.html105
-rw-r--r--doc/html/dir_a32be19bc88f3d7aac6b7249da379f26.html4
-rw-r--r--doc/html/dir_ef364879bae02db2684040178ed9b186.html4
-rw-r--r--doc/html/dir_f169ebf8da29290a918fa4b3f7151050.html4
-rw-r--r--doc/html/dir_f6bef457d5f671b6e774bfccc16651f6.html4
-rw-r--r--doc/html/ecdsa_8h.html16
-rw-r--r--doc/html/ecgroup_8h.html34
-rw-r--r--doc/html/epid__overview_8dox.html4
-rw-r--r--doc/html/epid_diagram_basic_interaction.pngbin0 -> 34688 bytes
-rw-r--r--doc/html/epid_diagram_group.pngbin0 -> 25944 bytes
-rw-r--r--doc/html/epid_diagram_high_level_interaction.pngbin25513 -> 0 bytes
-rw-r--r--doc/html/epid_diagram_high_level_use_case.pngbin16041 -> 0 bytes
-rw-r--r--doc/html/epid_diagram_issuer_functionality.pngbin0 -> 58672 bytes
-rw-r--r--doc/html/epid_diagram_issuer_high_level.pngbin4857 -> 0 bytes
-rw-r--r--doc/html/epid_diagram_member_functionality.pngbin0 -> 25610 bytes
-rw-r--r--doc/html/epid_diagram_member_high_level.pngbin8319 -> 0 bytes
-rw-r--r--doc/html/epid_diagram_roles_summary.pngbin0 -> 25980 bytes
-rw-r--r--doc/html/epid_diagram_verifier_functionality.pngbin0 -> 36340 bytes
-rw-r--r--doc/html/epid_diagram_verifier_high_level.pngbin8897 -> 0 bytes
-rw-r--r--doc/html/errors_8h.html8
-rw-r--r--doc/html/examples.html8
-rw-r--r--doc/html/examples.js10
-rw-r--r--doc/html/examples_8dox.html4
-rw-r--r--doc/html/file__parser_8h.html4
-rw-r--r--doc/html/files.html23
-rw-r--r--doc/html/finitefield_8h.html22
-rw-r--r--doc/html/functions.html37
-rw-r--r--doc/html/functions_vars.html37
-rw-r--r--doc/html/globals.html4
-rw-r--r--doc/html/globals_b.html4
-rw-r--r--doc/html/globals_c.html79
-rw-r--r--doc/html/globals_d.html4
-rw-r--r--doc/html/globals_defs.html4
-rw-r--r--doc/html/globals_e.html30
-rw-r--r--doc/html/globals_enum.html4
-rw-r--r--doc/html/globals_eval.html7
-rw-r--r--doc/html/globals_f.html6
-rw-r--r--doc/html/globals_func.html95
-rw-r--r--doc/html/globals_g.html4
-rw-r--r--doc/html/globals_h.html4
-rw-r--r--doc/html/globals_i.html4
-rw-r--r--doc/html/globals_k.html7
-rw-r--r--doc/html/globals_m.html4
-rw-r--r--doc/html/globals_n.html4
-rw-r--r--doc/html/globals_o.html79
-rw-r--r--doc/html/globals_p.html6
-rw-r--r--doc/html/globals_r.html10
-rw-r--r--doc/html/globals_s.html4
-rw-r--r--doc/html/globals_t.html49
-rw-r--r--doc/html/globals_type.html10
-rw-r--r--doc/html/globals_v.html4
-rw-r--r--doc/html/globals_vars.html4
-rw-r--r--doc/html/globals_w.html10
-rw-r--r--doc/html/glossary_8dox.html4
-rw-r--r--doc/html/group___big_num_primitives.html24
-rw-r--r--doc/html/group___big_num_primitives.js4
-rw-r--r--doc/html/group___ec_group_primitives.html56
-rw-r--r--doc/html/group___ec_group_primitives.js10
-rw-r--r--doc/html/group___ecdsa_primitives.html28
-rw-r--r--doc/html/group___ecdsa_primitives.js4
-rw-r--r--doc/html/group___epid11_file_parser_module.html4
-rw-r--r--doc/html/group___epid11_pairing_primitives.html5
-rw-r--r--doc/html/group___epid11_types.html4
-rw-r--r--doc/html/group___epid11_verifier_module.html4
-rw-r--r--doc/html/group___epid_common.html17
-rw-r--r--doc/html/group___epid_math.html4
-rw-r--r--doc/html/group___epid_member_module.html324
-rw-r--r--doc/html/group___epid_member_module.js30
-rw-r--r--doc/html/group___epid_module.html4
-rw-r--r--doc/html/group___epid_print.html4
-rw-r--r--doc/html/group___epid_types.html15
-rw-r--r--doc/html/group___epid_types.js8
-rw-r--r--doc/html/group___epid_verifier_module.html51
-rw-r--r--doc/html/group___error_codes.html11
-rw-r--r--doc/html/group___error_codes.js3
-rw-r--r--doc/html/group___file_parser.html23
-rw-r--r--doc/html/group___finite_field_primitives.html41
-rw-r--r--doc/html/group___finite_field_primitives.js6
-rw-r--r--doc/html/group___hash_primitives.html4
-rw-r--r--doc/html/group___pairing_primitives.html27
-rw-r--r--doc/html/group___pairing_primitives.js2
-rw-r--r--doc/html/group___tpm_module.html929
-rw-r--r--doc/html/group___tpm_module.js30
-rw-r--r--doc/html/hash_8h.html4
-rw-r--r--doc/html/how__validated_8dox.html82
-rw-r--r--doc/html/implementation__notes_8dox.html4
-rw-r--r--doc/html/index.html16
-rw-r--r--doc/html/init_8h.html92
-rw-r--r--doc/html/issuer__material_8dox.html4
-rw-r--r--doc/html/join_8h.html95
-rw-r--r--doc/html/jquery.js14
-rw-r--r--doc/html/legal__information_8dox.html4
-rw-r--r--doc/html/mainpage_8dox.html4
-rw-r--r--doc/html/member_2api_8h.html38
-rw-r--r--doc/html/modules.html11
-rw-r--r--doc/html/navtreedata.js32
-rw-r--r--doc/html/navtreeindex0.js330
-rw-r--r--doc/html/navtreeindex1.js496
-rw-r--r--doc/html/navtreeindex2.js146
-rw-r--r--doc/html/nrprove_8h.html103
-rw-r--r--doc/html/organization_8dox.html4
-rw-r--r--doc/html/pageorder_8dox.html4
-rw-r--r--doc/html/pages.html11
-rw-r--r--doc/html/pairing_8h.html10
-rw-r--r--doc/html/presig_8h.html96
-rw-r--r--doc/html/printutils_8h.html4
-rw-r--r--doc/html/revocation_8dox.html4
-rw-r--r--doc/html/sdk__overview_8dox.html4
-rw-r--r--doc/html/sdk_block_diagram.pngbin12425 -> 16299 bytes
-rw-r--r--doc/html/sign_8h.html103
-rw-r--r--doc/html/sign__verify__tutorial_8dox.html4
-rw-r--r--doc/html/signmsg__walkthrough_8dox.html4
-rw-r--r--doc/html/stdtypes_8h.html4
-rw-r--r--doc/html/struct_basic_signature.html4
-rw-r--r--doc/html/struct_big_num_str.html4
-rw-r--r--doc/html/struct_compressed_priv_key.html4
-rw-r--r--doc/html/struct_ecdsa_private_key.html4
-rw-r--r--doc/html/struct_ecdsa_public_key.html4
-rw-r--r--doc/html/struct_ecdsa_signature.html4
-rw-r--r--doc/html/struct_epid11_basic_signature.html4
-rw-r--r--doc/html/struct_epid11_g2_elem_str.html4
-rw-r--r--doc/html/struct_epid11_group_pub_key.html4
-rw-r--r--doc/html/struct_epid11_group_rl.html4
-rw-r--r--doc/html/struct_epid11_gt_elem_str.html4
-rw-r--r--doc/html/struct_epid11_nr_proof.html4
-rw-r--r--doc/html/struct_epid11_params.html4
-rw-r--r--doc/html/struct_epid11_priv_rl.html4
-rw-r--r--doc/html/struct_epid11_sig_rl.html4
-rw-r--r--doc/html/struct_epid11_sig_rl_entry.html4
-rw-r--r--doc/html/struct_epid11_signature.html4
-rw-r--r--doc/html/struct_epid11_verifier_precomp.html4
-rw-r--r--doc/html/struct_epid2_params.html4
-rw-r--r--doc/html/struct_epid_ca_certificate.html4
-rw-r--r--doc/html/struct_epid_file_header.html4
-rw-r--r--doc/html/struct_epid_signature.html4
-rw-r--r--doc/html/struct_fp_elem_str.html4
-rw-r--r--doc/html/struct_fq12_elem_str.html4
-rw-r--r--doc/html/struct_fq2_elem_str.html4
-rw-r--r--doc/html/struct_fq3_elem_str.html4
-rw-r--r--doc/html/struct_fq6_elem_str.html4
-rw-r--r--doc/html/struct_fq_elem_str.html4
-rw-r--r--doc/html/struct_g1_elem_str.html4
-rw-r--r--doc/html/struct_g2_elem_str.html4
-rw-r--r--doc/html/struct_group_pub_key.html4
-rw-r--r--doc/html/struct_group_rl.html4
-rw-r--r--doc/html/struct_gt_elem_str.html4
-rw-r--r--doc/html/struct_i_priv_key.html4
-rw-r--r--doc/html/struct_join_request.html4
-rw-r--r--doc/html/struct_member_precomp.html10
-rw-r--r--doc/html/struct_membership_credential.html4
-rw-r--r--doc/html/struct_nr_proof.html4
-rw-r--r--doc/html/struct_nr_prove_commit_output.html105
-rw-r--r--doc/html/struct_oct_str128.html4
-rw-r--r--doc/html/struct_oct_str16.html4
-rw-r--r--doc/html/struct_oct_str256.html4
-rw-r--r--doc/html/struct_oct_str32.html4
-rw-r--r--doc/html/struct_oct_str512.html4
-rw-r--r--doc/html/struct_oct_str600.html4
-rw-r--r--doc/html/struct_oct_str64.html4
-rw-r--r--doc/html/struct_oct_str768.html4
-rw-r--r--doc/html/struct_oct_str8.html4
-rw-r--r--doc/html/struct_oct_str80.html4
-rw-r--r--doc/html/struct_pre_computed_signature.html138
-rw-r--r--doc/html/struct_priv_key.html4
-rw-r--r--doc/html/struct_priv_rl.html4
-rw-r--r--doc/html/struct_sha256_digest.html4
-rw-r--r--doc/html/struct_sig_rl.html4
-rw-r--r--doc/html/struct_sig_rl_entry.html4
-rw-r--r--doc/html/struct_sign_commit_output.html113
-rw-r--r--doc/html/struct_verifier_precomp.html4
-rw-r--r--doc/html/struct_verifier_rl.html4
-rw-r--r--doc/html/tatepairing_8h.html4
-rw-r--r--doc/html/types_8h.html15
-rw-r--r--doc/html/validatekey_8h.html93
-rw-r--r--doc/html/verifier_21_81_2api_8h.html4
-rw-r--r--doc/html/verifier_2api_8h.html4
-rw-r--r--doc/html/verifysig__walkthrough_8dox.html4
-rw-r--r--epid/common-testhelper/1.1/testdata/grp_x/corrupted_privrl.inc (renamed from ext/ipp/sources/ippcp/src/pcpbnresource.h)55
-rw-r--r--epid/common-testhelper/Makefile17
-rw-r--r--epid/common-testhelper/epid_gtest-testhelper.cc68
-rw-r--r--epid/common-testhelper/epid_gtest-testhelper.h (renamed from ext/ipp/sources/ippcp/src/precomp.h)18
-rw-r--r--epid/common-testhelper/octstr-testhelper.cc7
-rw-r--r--epid/common-testhelper/testdata/grp_x/corrupted_privrl.inc36
-rw-r--r--epid/common-testhelper/testdata/grp_x/member0/sig_sha512_256_bsn0_msg0.inc100
-rw-r--r--epid/common-testhelper/testdata/grp_x/member0/sig_sha512_256_rndbase_msg0.inc100
-rw-r--r--epid/common-testhelper/testdata/grp_x/member0/sig_sha512_256_rndbase_msg0_no_sigrl.inc88
-rw-r--r--epid/common-testhelper/testdata/grp_x/sigrl_member0_sig_sha512_rndbase_msg0_revoked_middle_entry.inc77
-rw-r--r--epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/sig_revoked0sha512_256bsn0msg0.inc100
-rw-r--r--epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/sig_revoked1sha512_256bsn0msg0.inc100
-rw-r--r--epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/sig_revoked2sha512_256bsn0msg0.inc100
-rw-r--r--epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/verrl_sha512_256.inc68
-rw-r--r--epid/common-testhelper/unittests/bignum_wrapper-test.cc3
-rw-r--r--epid/common-testhelper/unittests/ecgroup_wrapper-test.cc3
-rw-r--r--epid/common-testhelper/unittests/ecpoint_wrapper-test.cc3
-rw-r--r--epid/common-testhelper/unittests/ffelement_wrapper-test.cc3
-rw-r--r--epid/common-testhelper/unittests/finite_field_wrapper-test.cc3
-rw-r--r--epid/common-testhelper/unittests/main-test.cc3
-rw-r--r--epid/common/1.1/src/file_parser.c2
-rw-r--r--epid/common/1.1/unittests/file_parser-test.cc11
-rw-r--r--epid/common/Makefile17
-rw-r--r--epid/common/bitsupplier.h28
-rw-r--r--epid/common/common.parts5
-rw-r--r--epid/common/errors.h3
-rw-r--r--epid/common/file_parser.h16
-rw-r--r--epid/common/math/bignum.h6
-rw-r--r--epid/common/math/ecdsa.h6
-rw-r--r--epid/common/math/ecgroup.h18
-rw-r--r--epid/common/math/finitefield.h17
-rw-r--r--epid/common/math/pairing.h13
-rw-r--r--epid/common/math/src/bignum-internal.h19
-rw-r--r--epid/common/math/src/bignum.c34
-rw-r--r--epid/common/math/src/ecdsa_sign.c4
-rw-r--r--epid/common/math/src/ecdsa_verify.c23
-rw-r--r--epid/common/math/src/ecgroup-internal.h15
-rw-r--r--epid/common/math/src/ecgroup.c387
-rw-r--r--epid/common/math/src/finitefield-internal.h36
-rw-r--r--epid/common/math/src/finitefield.c580
-rw-r--r--epid/common/math/src/pairing-internal.h8
-rw-r--r--epid/common/math/src/pairing.c799
-rw-r--r--epid/common/math/src/printutils.c80
-rw-r--r--epid/common/math/src/sha256.c5
-rw-r--r--epid/common/math/src/tatepairing-internal.h6
-rw-r--r--epid/common/math/src/tatepairing.c417
-rw-r--r--epid/common/math/tatepairing.h5
-rw-r--r--epid/common/math/unittests/bignum-test.cc3
-rw-r--r--epid/common/math/unittests/ecdsa_sign-test.cc3
-rw-r--r--epid/common/math/unittests/ecdsa_verify-test.cc3
-rw-r--r--epid/common/math/unittests/ecgroup-test.cc190
-rw-r--r--epid/common/math/unittests/ffelement-test.cc28
-rw-r--r--epid/common/math/unittests/finitefield-test.cc3
-rw-r--r--epid/common/math/unittests/hash-test.cc3
-rw-r--r--epid/common/math/unittests/main-test.cc3
-rw-r--r--epid/common/math/unittests/octstrconvert-test.cc3
-rw-r--r--epid/common/math/unittests/pairing-test.cc99
-rw-r--r--epid/common/math/unittests/printutils-test.cc3
-rw-r--r--epid/common/math/unittests/tatepairing-test.cc3
-rw-r--r--epid/common/src/commitment.c6
-rw-r--r--epid/common/src/commitment.h33
-rw-r--r--epid/common/src/file_parser.c2
-rw-r--r--epid/common/types.h22
-rw-r--r--epid/common/unittests/file_parser-test.cc11
-rw-r--r--epid/member/Makefile18
-rw-r--r--epid/member/api.h218
-rw-r--r--epid/member/member.parts29
-rw-r--r--epid/member/src/allowed_basenames.c117
-rw-r--r--epid/member/src/allowed_basenames.h45
-rw-r--r--epid/member/src/assemble_privkey.c123
-rw-r--r--epid/member/src/context.c397
-rw-r--r--epid/member/src/context.h73
-rw-r--r--epid/member/src/decompress_privkey.c274
-rw-r--r--epid/member/src/hash_basename.c53
-rw-r--r--epid/member/src/hash_basename.h56
-rw-r--r--epid/member/src/join.c92
-rw-r--r--epid/member/src/join_commitment.c89
-rw-r--r--epid/member/src/join_commitment.h67
-rw-r--r--epid/member/src/nr_prove.c277
-rw-r--r--epid/member/src/nrprove.c91
-rw-r--r--epid/member/src/nrprove_commitment.c114
-rw-r--r--epid/member/src/nrprove_commitment.h77
-rw-r--r--epid/member/src/precomp.c91
-rw-r--r--epid/member/src/precomp.h60
-rw-r--r--epid/member/src/presig.c229
-rw-r--r--epid/member/src/privkey.c84
-rw-r--r--epid/member/src/privkey.h67
-rw-r--r--epid/member/src/request_join.c418
-rw-r--r--epid/member/src/sign.c51
-rw-r--r--epid/member/src/sign_commitment.c72
-rw-r--r--epid/member/src/sign_commitment.h64
-rw-r--r--epid/member/src/signbasic.c250
-rw-r--r--epid/member/tpm/context.h129
-rw-r--r--epid/member/tpm/decompress.h78
-rw-r--r--epid/member/tpm/init.h77
-rw-r--r--epid/member/tpm/join.h82
-rw-r--r--epid/member/tpm/nrprove.h106
-rw-r--r--epid/member/tpm/presig.h65
-rw-r--r--epid/member/tpm/sign.h107
-rw-r--r--epid/member/tpm/src/context.c180
-rw-r--r--epid/member/tpm/src/decompress.c271
-rw-r--r--epid/member/tpm/src/init.c115
-rw-r--r--epid/member/tpm/src/join.c123
-rw-r--r--epid/member/tpm/src/nrprove.c221
-rw-r--r--epid/member/tpm/src/presig-internal.h52
-rw-r--r--epid/member/tpm/src/presig.c265
-rw-r--r--epid/member/tpm/src/sign.c204
-rw-r--r--epid/member/tpm/src/types.h93
-rw-r--r--epid/member/tpm/src/validatekey.c130
-rw-r--r--epid/member/tpm/unittests/tpm-test.cc212
-rw-r--r--epid/member/tpm/unittests/tpm-testhelper.cc326
-rw-r--r--epid/member/tpm/unittests/tpm-testhelper.h116
-rw-r--r--epid/member/tpm/validatekey.h73
-rw-r--r--epid/member/unittests/compute_presig-test.cc93
-rw-r--r--epid/member/unittests/context-test.cc166
-rw-r--r--epid/member/unittests/decompress_privkey-test.cc3
-rw-r--r--epid/member/unittests/get_sigsize-test.cc3
-rw-r--r--epid/member/unittests/main-test.cc3
-rw-r--r--epid/member/unittests/member-testhelper.cc185
-rw-r--r--epid/member/unittests/member-testhelper.h16
-rw-r--r--epid/member/unittests/nr_prove-test.cc5
-rw-r--r--epid/member/unittests/presig-test.cc162
-rw-r--r--epid/member/unittests/request_join-test.cc159
-rw-r--r--epid/member/unittests/sign-test.cc370
-rw-r--r--epid/member/unittests/signbasic-test.cc41
-rw-r--r--epid/verifier/1.1/src/nrverify.c2
-rw-r--r--epid/verifier/1.1/src/verify.c12
-rw-r--r--epid/verifier/1.1/unittests/check_privrl_entry-test.cc3
-rw-r--r--epid/verifier/1.1/unittests/context-test.cc3
-rw-r--r--epid/verifier/1.1/unittests/nrverify-test.cc3
-rw-r--r--epid/verifier/1.1/unittests/sigs_linked-test.cc3
-rw-r--r--epid/verifier/1.1/unittests/verifier-testhelper.cc5
-rw-r--r--epid/verifier/1.1/unittests/verifier-testhelper.h5
-rw-r--r--epid/verifier/1.1/unittests/verify-test.cc41
-rw-r--r--epid/verifier/1.1/unittests/verifybasic-test.cc3
-rw-r--r--epid/verifier/Makefile17
-rw-r--r--epid/verifier/api.h43
-rw-r--r--epid/verifier/src/check_privrl_entry.c15
-rw-r--r--epid/verifier/src/context.c13
-rw-r--r--epid/verifier/src/verify.c4
-rw-r--r--epid/verifier/src/verifybasic.c4
-rw-r--r--epid/verifier/unittests/check_privrl_entry-test.cc3
-rw-r--r--epid/verifier/unittests/context-test.cc17
-rw-r--r--epid/verifier/unittests/main-test.cc3
-rw-r--r--epid/verifier/unittests/nrverify-test.cc42
-rw-r--r--epid/verifier/unittests/sigs_linked-test.cc3
-rw-r--r--epid/verifier/unittests/verifier-testhelper.cc22
-rw-r--r--epid/verifier/unittests/verifier-testhelper.h13
-rw-r--r--epid/verifier/unittests/verify-test.cc50
-rw-r--r--epid/verifier/unittests/verifybasic-test.cc14
-rw-r--r--example/Makefile8
-rw-r--r--example/compressed_data/README.md24
-rw-r--r--example/data/README.md4
-rw-r--r--example/signmsg/src/main.c61
-rw-r--r--example/signmsg/src/signmsg.c93
-rw-r--r--example/util/Makefile2
-rw-r--r--example/verifysig/src/main.c136
-rw-r--r--example/verifysig/src/verifysig.c49
-rw-r--r--example/verifysig/src/verifysig.h13
-rw-r--r--example/verifysig/src/verifysig11.c42
-rw-r--r--example/verifysig/src/verifysig11.h12
-rw-r--r--ext/dropt/Makefile2
-rw-r--r--ext/dropt/src/dropt_string.c8
-rw-r--r--ext/gtest/Makefile6
-rw-r--r--ext/ipp/include/ippbase.h4
-rw-r--r--ext/ipp/include/ippcp.h290
-rw-r--r--ext/ipp/include/ippcpdefs.h78
-rw-r--r--ext/ipp/include/ippcpepid.h218
-rw-r--r--ext/ipp/include/ippdefs.h17
-rw-r--r--ext/ipp/include/ipptypes.h75
-rw-r--r--ext/ipp/ippcommon.parts56
-rw-r--r--ext/ipp/ippcp.parts52
-rw-r--r--ext/ipp/ippcpepid.parts105
-rw-r--r--ext/ipp/sources/include/owndefs.h166
-rw-r--r--ext/ipp/sources/ippcp/Makefile6
-rw-r--r--ext/ipp/sources/ippcp/src/owncp.h44
-rw-r--r--ext/ipp/sources/ippcp/src/pcpbn.h9
-rw-r--r--ext/ipp/sources/ippcp/src/pcpbnca.c44
-rw-r--r--ext/ipp/sources/ippcp/src/pcpbnresourceca.c87
-rw-r--r--ext/ipp/sources/ippcp/src/pcpbnsetca.c2
-rw-r--r--ext/ipp/sources/ippcp/src/pcpbnu32arith.c20
-rw-r--r--ext/ipp/sources/ippcp/src/pcpbnu32arith.h15
-rw-r--r--ext/ipp/sources/ippcp/src/pcpbnu32misc.c2
-rw-r--r--ext/ipp/sources/ippcp/src/pcpbnu32misc.h5
-rw-r--r--ext/ipp/sources/ippcp/src/pcpbnuarith.c103
-rw-r--r--ext/ipp/sources/ippcp/src/pcpbnuarith.h21
-rw-r--r--ext/ipp/sources/ippcp/src/pcpbnuimpl.h6
-rw-r--r--ext/ipp/sources/ippcp/src/pcpbnumisc.c2
-rw-r--r--ext/ipp/sources/ippcp/src/pcpbnumisc.h18
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccp.h400
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccp256r1dpca.c50
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpdpca.c698
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpgenkeyca.c58
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpinitca.c297
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpmethod.h98
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpmethod128.h118
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpmethod128ca.c879
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpmethod192.h117
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpmethod192ca.c880
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpmethod224.h118
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpmethod224ca.c877
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpmethod256.h118
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpmethod256ca.c879
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpmethod384.h118
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpmethod384ca.c879
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpmethod521.h118
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpmethod521ca.c879
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpmethodcom.h133
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpmethodcomca.c1025
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpmethodsm2.h120
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpmethodsm2ca.c879
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccppoint.h54
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccppointca.c53
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccppointopca.c271
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccppublickeyca.c87
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpsetkeyca.c48
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpsigndsaca.c149
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpsscm.c160
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpsscm.h45
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpstdca.c586
-rw-r--r--ext/ipp/sources/ippcp/src/pcpeccpverifydsaca.c184
-rw-r--r--ext/ipp/sources/ippcp/src/pcpgfp.c (renamed from ext/ipp/sources/ippcpepid/src/pcpgfp.c)534
-rw-r--r--ext/ipp/sources/ippcp/src/pcpgfpec.c456
-rw-r--r--ext/ipp/sources/ippcp/src/pcpgfpecpoint.c (renamed from ext/ipp/sources/ippcpepid/src/pcpgfpecpoint.c)242
-rw-r--r--ext/ipp/sources/ippcp/src/pcpgfpecpointstuff.c1149
-rw-r--r--ext/ipp/sources/ippcp/src/pcpgfpecstuff.h (renamed from ext/ipp/sources/ippcpepid/src/pcpgfpecstuff.h)227
-rw-r--r--ext/ipp/sources/ippcp/src/pcpgfpmethod.h57
-rw-r--r--ext/ipp/sources/ippcp/src/pcpgfpmethod_256r1.c153
-rw-r--r--ext/ipp/sources/ippcp/src/pcpgfpmethod_com.c164
-rw-r--r--ext/ipp/sources/ippcp/src/pcpgfpstuff.c311
-rw-r--r--ext/ipp/sources/ippcp/src/pcpgfpstuff.h (renamed from ext/ipp/sources/ippcpepid/src/pcpgfpstuff.h)118
-rw-r--r--ext/ipp/sources/ippcp/src/pcpgfpx.c (renamed from ext/ipp/sources/ippcpepid/src/pcpgfpx.c)141
-rw-r--r--ext/ipp/sources/ippcp/src/pcpgfpxmethod_binom.c359
-rw-r--r--ext/ipp/sources/ippcp/src/pcpgfpxmethod_binom_epid2.c379
-rw-r--r--ext/ipp/sources/ippcp/src/pcpgfpxmethod_com.c284
-rw-r--r--ext/ipp/sources/ippcp/src/pcpgfpxmethod_com.h42
-rw-r--r--ext/ipp/sources/ippcp/src/pcpgfpxstuff.c687
-rw-r--r--ext/ipp/sources/ippcp/src/pcpgfpxstuff.h (renamed from ext/ipp/sources/ippcpepid/src/pcpgfpxstuff.h)53
-rw-r--r--ext/ipp/sources/ippcp/src/pcphash.h174
-rw-r--r--ext/ipp/sources/ippcp/src/pcphash_rmf.h51
-rw-r--r--ext/ipp/sources/ippcp/src/pcphashca.c744
-rw-r--r--ext/ipp/sources/ippcp/src/pcphashcnt.c4
-rw-r--r--ext/ipp/sources/ippcp/src/pcphashmd5px.c211
-rw-r--r--ext/ipp/sources/ippcp/src/pcphashmethod_rmf.h44
-rw-r--r--ext/ipp/sources/ippcp/src/pcphashsha1px.c14
-rw-r--r--ext/ipp/sources/ippcp/src/pcphashsha256px.c14
-rw-r--r--ext/ipp/sources/ippcp/src/pcphashsha512px.c14
-rw-r--r--ext/ipp/sources/ippcp/src/pcpmd5ca.c485
-rw-r--r--ext/ipp/sources/ippcp/src/pcpmontexpbinca.c4
-rw-r--r--ext/ipp/sources/ippcp/src/pcpmontgomery.h15
-rw-r--r--ext/ipp/sources/ippcp/src/pcpmontgomeryca.c13
-rw-r--r--ext/ipp/sources/ippcp/src/pcpmontred.c16
-rw-r--r--ext/ipp/sources/ippcp/src/pcpmulbnukara.h9
-rw-r--r--ext/ipp/sources/ippcp/src/pcppma.h106
-rw-r--r--ext/ipp/sources/ippcp/src/pcppma128.c169
-rw-r--r--ext/ipp/sources/ippcp/src/pcppma128.h79
-rw-r--r--ext/ipp/sources/ippcp/src/pcppma192.c153
-rw-r--r--ext/ipp/sources/ippcp/src/pcppma192.h84
-rw-r--r--ext/ipp/sources/ippcp/src/pcppma224.c169
-rw-r--r--ext/ipp/sources/ippcp/src/pcppma224.h81
-rw-r--r--ext/ipp/sources/ippcp/src/pcppma256.c181
-rw-r--r--ext/ipp/sources/ippcp/src/pcppma256.h82
-rw-r--r--ext/ipp/sources/ippcp/src/pcppma384.c191
-rw-r--r--ext/ipp/sources/ippcp/src/pcppma384.h82
-rw-r--r--ext/ipp/sources/ippcp/src/pcppma521.c124
-rw-r--r--ext/ipp/sources/ippcp/src/pcppma521.h80
-rw-r--r--ext/ipp/sources/ippcp/src/pcppmasm2.c311
-rw-r--r--ext/ipp/sources/ippcp/src/pcppmasm2.h121
-rw-r--r--ext/ipp/sources/ippcp/src/pcpprimeg.h72
-rw-r--r--ext/ipp/sources/ippcp/src/pcpprimeginitca.c158
-rw-r--r--ext/ipp/sources/ippcp/src/pcpprng.h3
-rw-r--r--ext/ipp/sources/ippcp/src/pcpprngenca.c20
-rw-r--r--ext/ipp/sources/ippcp/src/pcpprnginitca.c4
-rw-r--r--ext/ipp/sources/ippcp/src/pcpprngsetca.c4
-rw-r--r--ext/ipp/sources/ippcp/src/pcpsha1ca.c551
-rw-r--r--ext/ipp/sources/ippcp/src/pcpsha256ca.c676
-rw-r--r--ext/ipp/sources/ippcp/src/pcpsha512ca.c674
-rw-r--r--ext/ipp/sources/ippcp/src/pcptool.h40
-rw-r--r--ext/ipp/sources/ippcp/src/pcpvariant.h255
-rw-r--r--ext/ipp/sources/ippcpepid/Makefile32
-rw-r--r--ext/ipp/sources/ippcpepid/src/owncpepid.h52
-rw-r--r--ext/ipp/sources/ippcpepid/src/pcpgfpec.c322
-rw-r--r--ext/ipp/sources/ippcpepid/src/pcpgfpecpointstuff.c1227
-rw-r--r--ext/ipp/sources/ippcpepid/src/pcpgfphashstuff.h117
-rw-r--r--ext/ipp/sources/ippcpepid/src/pcpgfpstuff.c486
-rw-r--r--ext/ipp/sources/ippcpepid/src/pcpgfpxstuff.c1307
-rw-r--r--parts-site/configurations/debug/g++.py2
-rw-r--r--parts-site/configurations/debug/gcc.py2
-rw-r--r--parts-site/configurations/debug/intelc_posix-any.py2
-rw-r--r--parts-site/configurations/instr_release/__init__.py20
-rw-r--r--parts-site/configurations/instr_release/g++.py31
-rw-r--r--parts-site/configurations/instr_release/gcc.py31
-rw-r--r--parts-site/configurations/instr_release/intelc_posix-any.py33
-rw-r--r--parts-site/configurations/instr_release/intelc_win32-any.py35
-rw-r--r--parts-site/configurations/instr_release/msvc_win32-any.py35
-rw-r--r--parts-site/configurations/instr_size_optimized_release/__init__.py20
-rw-r--r--parts-site/configurations/instr_size_optimized_release/g++.py31
-rw-r--r--parts-site/configurations/instr_size_optimized_release/gcc.py31
-rw-r--r--parts-site/configurations/instr_size_optimized_release/intelc_posix-any.py33
-rw-r--r--parts-site/configurations/instr_size_optimized_release/intelc_win32-any.py35
-rw-r--r--parts-site/configurations/instr_size_optimized_release/msvc_win32-any.py35
-rw-r--r--parts-site/configurations/release/g++.py16
-rw-r--r--parts-site/configurations/release/gcc.py13
-rw-r--r--parts-site/configurations/release/intelc_posix-any.py16
-rw-r--r--parts-site/configurations/release/msvc_win32-any_win32-x86.py1
-rw-r--r--parts-site/configurations/release/msvc_win32-any_win32-x86_64.py1
-rw-r--r--parts-site/configurations/size_optimized_release/__init__.py20
-rw-r--r--parts-site/configurations/size_optimized_release/g++.py57
-rw-r--r--parts-site/configurations/size_optimized_release/gcc.py65
-rw-r--r--parts-site/configurations/size_optimized_release/intelc_posix-any_posix-x86.py58
-rw-r--r--parts-site/configurations/size_optimized_release/intelc_posix-any_posix-x86_64.py59
-rw-r--r--parts-site/configurations/size_optimized_release/intelc_win32-any_win32-x86.py59
-rw-r--r--parts-site/configurations/size_optimized_release/intelc_win32-any_win32-x86_64.py58
-rw-r--r--parts-site/configurations/size_optimized_release/msvc_win32-any_win32-x86.py65
-rw-r--r--parts-site/configurations/size_optimized_release/msvc_win32-any_win32-x86_64.py64
-rw-r--r--parts-site/pieces/arm_support.py23
-rw-r--r--parts-site/tools/g++.py74
-rw-r--r--parts-site/tools/gcc.py73
-rw-r--r--tools/Makefile14
-rw-r--r--tools/revokekey/src/main.c12
537 files changed, 21966 insertions, 26144 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 36657a3..3e68978 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,10 +1,72 @@
# Intel(R) EPID SDK ChangeLog {#ChangeLog}
-## [3.0.0]
+## [4.0.0] - 2017-04-25
-### New in This Release
+### Added
-* Support for verification of EPID 1.1 members.
+* The member implementation now provides an internal interface that
+ gives guidance on partitioning member operations between highly
+ sensitive ones that use f value of the private key, and less
+ sensitive operations that can be performed in a host environment.
+
+* New member API `EpidAssemblePrivKey` was added to help assemble and
+ validate the new member private key that is created when a member
+ either joins a group (using the join protocol) or switches to a new
+ group (as the result of a performance rekey).
+
+
+### Changed
+
+* Updated Intel(R) IPP Cryptography library to version 2017 (Update 2).
+
+* The mechanism to set the signature based revocation list (SigRL)
+ used for signing was changed. `EpidMemberSetSigRl` must be used to
+ set the SigRL. The SigRL is no longer a parameter to `EpidSign`.
+ This better models typical use case where a device stores a
+ revocation list and updates it independently of signing operations.
+
+
+### Removed
+
+* Removed `EpidWritePreSigs` API. Serialization of pre-computed
+ signatures is a risky capability to provide, and simply expanding
+ the internal pool via `EpidAddPreSigs` still provides most of the
+ optimization benefits.
+
+* The `EpidIsPrivKeyInGroup` API is no longer exposed to clients. It
+ is no longer needed because the new member API `EpidAssemblePrivKey`
+ performs this check.
+
+
+### Fixed
+
+* When building with commercial version of the Intel(R) IPP
+ Cryptography library, optimized functions are now properly invoked,
+ making signing and verification operations ~2 times faster
+
+* SHA-512/256 hash algorithm is now supported.
+
+* README for compressed data now correctly documents the number of
+ entries in revocation lists.
+
+* The `verifysig` sample now reports a more clear error message for
+ mismatched SigRLs.
+
+* The default scons build will now build for a 32-bit target on a
+ 32-bit platform.
+
+
+### Known Issues
+
+* Scons build will not work natively on ARM. You can still build using
+ `make` or cross compile.
+
+
+## [3.0.0] - 2016-11-22
+
+### Added
+
+* Support for verification of Intel(R) EPID 1.1 members.
* Make-based build system support.
@@ -23,12 +85,13 @@
### Changes
* A new verifier API has been added to set the basename to be used for
- verification. Verifier APIs that used to accept basenames now use
- the basename set via EpidVerifierSetBasename.
+ verification. Verifier APIs that used to accept basenames now use
+ the basename set via `EpidVerifierSetBasename`.
* The verifier pre-computation structure has been changed to include
the group ID to allow detection of errors that result from providing
- a pre-computation blob from a different group to EpidVerifierCreate.
+ a pre-computation blob from a different group to
+ `EpidVerifierCreate`.
### Fixes
@@ -44,7 +107,7 @@
## [2.0.0] - 2016-07-20
-### New in This Release
+### Added
* Signed binary issuer material support.
@@ -63,7 +126,7 @@
- WindRiver IDP
-### Changes
+### Changed
* The default hash algorithm has changed. It is now SHA-512.
@@ -71,14 +134,14 @@
instead.
-### Fixes
+### Fixed
* Updated build flags to work around GCC 4.8.5 defect.
## [1.0.0] - 2016-03-03
-### New in This Release
+### Added
* Basic sign and verify functionality
diff --git a/LICENSE.txt b/LICENSE.txt
index 38f89e4..cdce082 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -203,19 +203,20 @@
=======================================================================
-EPID SDK Subcomponents:
+SDK Subcomponents:
-The EPID SDK contains subcomponents with separate copyright notices
-and license terms. Your use of the source code for these subcomponents
-is subject to the terms and conditions of the following licenses.
+The Intel(R) EPID SDK contains subcomponents with separate copyright
+notices and license terms. Your use of the source code for these
+subcomponents is subject to the terms and conditions of the following
+licenses.
-----------------------------------------------------------------------
The BSD 3-Clause License
-----------------------------------------------------------------------
-The EPID SDK bundles portions of the following under the BSD 3-Clause
-License:
+The Intel(R) EPID SDK bundles portions of the following under the BSD
+3-Clause License:
- Google Test (https://github.com/google/googletest)
Copyright 2008, Google Inc.
@@ -247,3 +248,34 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+-----------------------------------------------------------------------
+zlib License
+-----------------------------------------------------------------------
+
+The Intel(R) EPID SDK bundles portions of the following under the zlib
+License:
+
+dropt
+Copyright (c) 2006-2012 James D. Lin <jameslin@cal.berkeley.edu>
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any damages
+arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source distribution.
+
+<http://www.opensource.org/licenses/zlib-license.php>
diff --git a/Makefile.in b/Makefile.in
index b4a7a81..c27ec1c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -7,53 +7,92 @@ epidinstalldir = $(installdir)/epid-sdk
CC = @CC@
CXX = @CXX@
CFLAGS = @CFLAGS@
+LDFLAGS = @LDFLAGS@
+RANLIB = @RANLIB@
+CONFIG = @CONFIG@
+
+#set performance affecting flags
+ifeq ($(CONFIG),release)
+ SIZE_CFLAGS := -O2
+else
+ SIZE_CFLAGS := -Os
+ ifeq ($(findstring icc,$(CC)),icc)
+ ifeq ($(findstring -m32,$(CFLAGS)),-m32)
+ SIZE_CFLAGS := -O2
+ endif
+ endif
+ SIZE_CFLAGS += -fdata-sections -ffunction-sections
+ LDFLAGS += -Xlinker --gc-sections
+endif
-#g++ flags
-CXX_FLAGS := $(CFLAGS) -O2 -Werror -Wall -Wextra -Wno-missing-braces \
- -Wno-missing-field-initializers -Wno-unknown-pragmas -Wno-unused-function \
- -fno-strict-aliasing -Wno-unused-but-set-variable -Wno-comment -DNDEBUG
#gcc flags
-CC_FLAGS := $(CXX_FLAGS) -D_IPP_v50_ -D_IPP_DEBUG
+CC_FLAGS := $(CFLAGS) $(SIZE_CFLAGS) -Werror -Wall -Wextra -Wno-missing-braces \
+ -Wno-missing-field-initializers -Wno-unknown-pragmas -Wno-unused-function \
+ -fno-strict-aliasing -Wno-unused-but-set-variable -Wno-comment -Wformat \
+ -Wformat-security -fstack-protector -fPIC -DNDEBUG -D_FORTIFY_SOURCE=2
+#g++ flags
+CXX_FLAGS := $(CC_FLAGS) -std=c++0x
-#intel c++ compiler flags
-ICPC_FLAGS := $(CFLAGS) -O2 -Werror -Wall -Wextra -DNDEBUG
#intel c compiler flags
-ICC_FLAGS := $(ICPC_FLAGS) -D_IPP_v50_ -D_IPP_DEBUG
+ICC_FLAGS := $(CFLAGS) $(SIZE_CFLAGS) -Werror -Wall -Wextra -DNDEBUG \
+ -fstack-protector -fPIC -D_FORTIFY_SOURCE=2 \
+ -Wformat -Wformat-security
+#intel c++ compiler flags
+ICPC_FLAGS := $(ICC_FLAGS) -std=c++0x
#check if architecture was specified
#or take it by shell command
ifeq ($(findstring -m32,$(CFLAGS)),-m32)
ARCH = x86
CXXFLAGS += -m32
+ LDFLAGS += -m32
else ifeq ($(findstring -m64,$(CFLAGS)),-m64)
ARCH = x86_64
CXXFLAGS += -m64
+ LDFLAGS += -m64
else
- ARCH := $(shell uname -m)
+ ifeq ($(findstring arm-,$(CC)),arm-)
+ ARCH = arm
+
+ ifneq (,$(findstring gnueabihf,$(CC)))
+ ARCH := $(addsuffix hf,$(ARCH))
+ endif
+
+ else
+ ARCH := $(shell uname -m)
+ endif
endif
+#set ippflags
+IPP_FLAGS := -Wno-misleading-indentation -D_IPP_v50_ -D_IPP_DEBUG \
+ -D_DISABLE_ALG_MD5_ -D_DISABLE_ALG_SM3_
+
#set tools and flags depending on specified compiler
-ifeq ($(CC),icc)
+ifeq ($(findstring icc,$(CC)),icc)
CFLAGS := $(ICC_FLAGS)
CXXFLAGS := $(ICPC_FLAGS)
- AR = xiar
+ AR = $(subst icc,xiar,$(CC))
else
CFLAGS := $(CC_FLAGS)
CXXFLAGS := $(CXX_FLAGS)
endif
-#set c++11 for all c++ compilers
-CXXFLAGS += -std=c++0x
+# ld flags
+LDFLAGS += -fstack-protector -z noexecstack -z relro -z now -pie
+
+#gtest defines
+GTEST_DEFINES := -DGTEST_HAS_PTHREAD=0 -D_VARIADIC_MAX=10
#set flags for unit tests executables
GTEST_FLAGS = --gtest_color=yes \
--gtest_print_time=1 \
--gtest_output=xml
-export CC AR LDFLAGS ARCH CFLAGS
+export CC LDFLAGS ARCH CFLAGS
export CXX CXXFLAGS
+export AR RANLIB
export epidinstalldir
-export GTEST_FLAGS
+export GTEST_FLAGS GTEST_DEFINES IPP_FLAGS
#just output
$(info $$ccompiler is [${CC}])
@@ -65,7 +104,6 @@ all: ipp common member verifier dropt examples_util examples epid_tools
clean:
$(MAKE) -C ./ext/ipp/sources/ippcp clean
- $(MAKE) -C ./ext/ipp/sources/ippcpepid clean
$(MAKE) -C ./epid/common/ clean
$(MAKE) -C ./epid/member/ clean
$(MAKE) -C ./epid/verifier/ clean
@@ -75,10 +113,12 @@ clean:
$(MAKE) -C ./ext/gtest/ clean
$(MAKE) -C ./epid/common-testhelper/ clean
$(MAKE) -C ./ext/dropt/ clean
+ifneq ("$(wildcard ./ext/google_benchmark)","")
+ $(MAKE) -C ./ext/google_benchmark/ clean
+endif
install:
$(MAKE) -C ./ext/ipp/sources/ippcp install
- $(MAKE) -C ./ext/ipp/sources/ippcpepid install
$(MAKE) -C ./epid/common/ install
$(MAKE) -C ./epid/member/ install
$(MAKE) -C ./epid/verifier/ install
@@ -91,7 +131,6 @@ uninstall:
ipp:
$(MAKE) -C ./ext/ipp/sources/ippcp all
- $(MAKE) -C ./ext/ipp/sources/ippcpepid all
common:
$(MAKE) -C ./epid/common/ all
@@ -108,13 +147,21 @@ dropt:
examples_util:
$(MAKE) -C ./example/util/ all
-check:
+utest:
$(MAKE) -C ./ext/gtest/ all
$(MAKE) -C ./epid/common-testhelper/ all
- $(MAKE) -C ./epid/common-testhelper/ check
- $(MAKE) -C ./epid/common/ check
- $(MAKE) -C ./epid/member/ check
- $(MAKE) -C ./epid/verifier/ check
+ $(MAKE) -C ./epid/common-testhelper/ utest
+ $(MAKE) -C ./epid/common/ utest
+ $(MAKE) -C ./epid/member/ utest
+ $(MAKE) -C ./epid/verifier/ utest
+
+run_utest:
+ $(MAKE) -C ./epid/common-testhelper/ run_utest
+ $(MAKE) -C ./epid/common/ run_utest
+ $(MAKE) -C ./epid/member/ run_utest
+ $(MAKE) -C ./epid/verifier/ run_utest
+
+check: utest run_utest
examples:
$(MAKE) -C ./example/ all
@@ -122,4 +169,11 @@ examples:
epid_tools:
$(MAKE) -C ./tools/ all
+perf:
+ifneq ("$(wildcard ./ext/google_benchmark/)","")
+ $(MAKE) -C ./ext/google_benchmark/ all
+ $(MAKE) -C ./ext/google_benchmark/ utest
+ $(MAKE) -C ./ext/google_benchmark/ run_utest
+endif
+
build: all check install
diff --git a/NOTICE.txt b/NOTICE.txt
index fc0c420..51a62a2 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -1,22 +1,21 @@
Intel(R) EPID SDK
-Copyright 2016 Intel Corporation
+Copyright 2016-2017 Intel Corporation
==========
-The Intel(R) EPID SDK contains subcomponents with separate copyright notices
-and license terms.
+The Intel(R) EPID SDK contains subcomponents with separate copyright
+notices and license terms.
Your use of the source code for the these subcomponents is subject to
the terms and conditions of their respective licenses.
-See the LICENSE.txt file for a list of subcomponents and dependencies and
-their respective licenses.
+See the LICENSE.txt file for a list of subcomponents and dependencies
+and their respective licenses.
----------
The source code used for math primitives in the Intel(R) EPID SDK is a
-subset of the Intel(R) IPP Cryptography library (v9.0.3) written in
-C. For higher performance, you can use the commercial version of the
-IPP Cryptography libraries, which are available at
+subset of Intel(R) IPP Cryptography 2017 Update 2 written in C. For
+higher performance, you can use the commercial version of the IPP
+Cryptography libraries, which are available at
https://software.intel.com/articles/download-ipp-cryptography-libraries.
-
diff --git a/README.md b/README.md
index 5cb5c5f..2c201e0 100644
--- a/README.md
+++ b/README.md
@@ -51,7 +51,13 @@ See [LICENSE.txt](LICENSE.txt).
## Math Primitives
The source code used for math primitives in the Intel(R) EPID SDK is a
-subset of the Intel(R) IPP Cryptography library (v9.0.3) written in
-C. For higher performance, you can use the commercial version of the
-IPP Cryptography libraries, which are available at
-https://software.intel.com/articles/download-ipp-cryptography-libraries.
+subset of the Intel(R) IPP Cryptography library (version 2017 Update
+2) written in pure C and not optimized for performance. For higher
+performance, you can use the commercial version of the IPP
+Cryptography library, which is available at
+[https://software.intel.com/articles/download-ipp-cryptography-libraries](https://software.intel.com/articles/download-ipp-cryptography-libraries).
+
+More information on the optimized versions of Intel(R) IPP
+Cryptography library, including mitigations for a potential
+side-channel issue are available at
+[https://security-center.intel.com/advisory.aspx?intelid=INTEL-SA-00060&languageid=en-fr](https://security-center.intel.com/advisory.aspx?intelid=INTEL-SA-00060&languageid=en-fr).
diff --git a/SConstruct b/SConstruct
index 195222d..7aacd89 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,5 +1,5 @@
############################################################################
-# Copyright 2016 Intel Corporation
+# Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,40 +20,119 @@ import string
import sys
import SCons.Script
import os.path
+import subprocess
+from subprocess import Popen, PIPE
from parts import *
+import re
+import tempfile
+import shutil
+from collections import OrderedDict
-print "**************** TOOLS ****************"
-print '* Python Version:', string.split(sys.version, " ", 1)[0]
-print '* SCons Version:', SCons.__version__
-print '* Parts Version:', PartsExtensionVersion()
-print "***************************************"
-def PrintCompilerVersion(env):
- """
- Function to print version of compilers used for build
+def get_parts_versions(env):
+ """Get Parts related versions given SCons environment env"""
+ return OrderedDict({'python': string.split(sys.version, " ", 1)[0],
+ 'scons': str(SCons.__version__),
+ 'parts': str(PartsExtensionVersion())})
+
+
+def get_toolchain_versions(env):
+ """Get version of compilation toolchain given SCons environment env"""
+ versions = OrderedDict()
+ if 'MSVC_VERSION' in env:
+ versions['compiler'] = 'MSVC ' + env['MSVC_VERSION']
+ cmd = env.subst('echo int main(){return 0;} > a.cpp'
+ ' | $CXX $CCFLAGS a.cpp /link /verbose')
+ defaultlib_regexp = r'.*Searching (.*\.lib).*'
+ elif 'GCC_VERSION' in env:
+ versions['compiler'] = 'GCC ' + env['GCC_VERSION']
+ if 'GXX_VERSION' in env:
+ versions['compiler'] += ' and GXX ' + env['GXX_VERSION']
+ cmd = env.subst('echo "int main(){return 0;}"'
+ ' | $CXX $CCFLAGS -xc++ -Wl,--verbose -')
+ else:
+ cmd = env.subst('echo "int main(){return 0;}"'
+ ' | $CC $CCFLAGS -xc -Wl,--verbose -')
+ defaultlib_regexp = r'[\n(](/.*\.so[-.\da-fA-F]*).*'
+
+ # Intel C compiler always depends from base toolchain
+ if 'INTELC_VERSION' in env:
+ versions['compiler'] = 'INTELC {0} with {1}'.format(env['INTELC_VERSION'],
+ versions['compiler'])
+
+ temp_dir = tempfile.mkdtemp()
+ try:
+ proc = subprocess.Popen(cmd,
+ cwd=temp_dir,
+ env=env['ENV'], shell=True,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, _ = proc.communicate()
+ if proc.returncode != 0:
+ versions['default_libs'] = 'failure executing: "{0}"'.format(cmd)
+ else:
+ default_libs = list(
+ set(re.findall(defaultlib_regexp, stdout, re.M)))
+ if 'MSVC_VERSION' in env:
+ # for windows additionally report versions of Windows Kit used
+ runtime_version_set = set()
+ for lib_path in default_libs:
+ path_components = os.path.realpath(lib_path).split(os.sep)
+ if 'Windows Kits' in path_components:
+ i = path_components.index('Windows Kits')
+ runtime_version_set.add(
+ 'Windows Kits {0} {1}'.format(path_components[i + 1],
+ path_components[i + 3]))
+ versions['sdk_or_libc'] = '; '.join(list(runtime_version_set))
+ else:
+ # for posix additionally report versions of libc used
+ versions['sdk_or_libc'] = os.path.split(os.path.realpath(
+ next((lib for lib in default_libs if
+ 'libc' in lib.lower() and 'libcilk' not in lib.lower()), None)))[1]
+ versions['default_libs'] = default_libs
+ finally:
+ shutil.rmtree(temp_dir)
+
+ return versions
+
+
+def log_versions(env, include_toolchain=True):
+ """Log tools and libraries versions given SCons environment env
+
Args:
- env: Environment to get compilers version
+ env: Scons environment.
+ include_toolchain: Log version of compilation toolchain if True.
"""
- res = ''
- if 'INTELC_VERSION' in env:
- res += 'ICC ' + env['INTELC_VERSION'] + ';'
- if 'MSVC_VERSION' in env:
- res += 'MS ' + env['MSVC_VERSION'] + ';'
- if 'GXX_VERSION' in env:
- res += 'GXX ' + env['GXX_VERSION'] + ';'
- if 'GCC_VERSION' in env:
- res += 'GCC ' + env['GCC_VERSION'] + ';'
- print 'Compiler Version: ', res
+
+ versions = get_parts_versions(env)
+ if include_toolchain:
+ versions.update(get_toolchain_versions(env))
+
+ print "**************** VERSIONS *************"
+ long_names = {
+ 'python': 'Python Version',
+ 'scons': 'SCons Version',
+ 'parts': 'Parts Version',
+ 'compiler': 'Compiler Version',
+ 'sdk_or_libc': 'Libc/SDK',
+ 'default_libs': 'Default Libs'
+ }
+ for name, value in versions.iteritems():
+ if not isinstance(value, list):
+ print '* {0}: {1}'.format(long_names.get(name, name), value)
+ else:
+ print '* {0}:\n* \t{1}'.format(long_names.get(name, name),
+ '\n* \t'.join(sorted(value)))
+ print "***************************************"
+
def include_parts(part_list, **kwargs):
for parts_file in part_list:
if os.path.isfile(DefaultEnvironment().subst(parts_file)):
Part(parts_file=parts_file, **kwargs)
+
######## Part groups ####################################################
-ipp_parts = ['ext/ipp/ippcp.parts',
- 'ext/ipp/ippcpepid.parts',
- 'ext/ipp/ippcommon.parts']
+ipp_parts = ['ext/ipp/ippcp.parts']
utest_parts = ['ext/gtest/gtest.parts',
'epid/common-testhelper/common-testhelper.parts']
common_parts = ['epid/common/common.parts']
@@ -65,6 +144,11 @@ example_parts = ['ext/dropt/dropt.parts',
'example/signmsg/signmsg.parts',
'example/data/data.parts',
'example/compressed_data/compressed_data.parts']
+sizing_parts = ['example/signmsg/signmsg_shared.parts',
+ 'example/verifysig/verifysig_shared.parts',
+ 'example/verifysig/verifysig11_shared.parts']
+example_static_parts = ['example/signmsg/signmsg_static.parts',
+ 'example/verifysig/verifysig_static.parts']
tools_parts = ['tools/revokegrp/revokegrp.parts',
'tools/revokekey/revokekey.parts',
'tools/revokesig/revokesig.parts',
@@ -79,40 +163,60 @@ testbot_test_parts = ['test/testbot/testbot.parts',
'test/testbot/revokekey/revokekey_testbot.parts',
'test/testbot/revokesig/revokesig_testbot.parts',
'test/testbot/extractkeys/extractkeys_testbot.parts',
- 'test/testbot/extractgrps/extractgrps_testbot.parts']
+ 'test/testbot/extractgrps/extractgrps_testbot.parts',
+ 'tools/reports/reports.parts']
package_parts = ['ext/gtest/gtest.parts',
- 'ext/ipp/ippcommon.parts',
'ext/ipp/ippcp.parts',
- 'ext/ipp/ippcpepid.parts',
'package.parts']
+memory_profiler_parts = ['tools/memory_profiler/memory_profiler.parts']
internal_tools_parts = ['ext/dropt/dropt.parts',
'tools/ikgfwrapper/ikgfwrapper.parts']
+epid_data = ['test/epid_data/epid_data.parts']
+perf_benchmark_parts = ['ext/google_benchmark/google_benchmark.parts',
+ 'test/performance/performance.parts']
+memory_benchmark_parts = ['test/dynamic_memory/dynamic_memory.parts']
######## End Part groups ###############################################
######## Commandline option setup #######################################
product_variants = [
'production',
'internal-test',
'package-epid-sdk',
- 'internal-tools'
+ 'internal-tools',
+ 'benchmark'
]
default_variant = 'production'
+
def is_production():
return GetOption("product-variant") == 'production'
+
def is_internal_test():
return GetOption("product-variant") == 'internal-test'
+
def is_internal_tools():
return GetOption("product-variant") == 'internal-tools'
+
def is_package():
return GetOption("product-variant") == 'package-epid-sdk'
+
+def is_benchmark():
+ return GetOption("product-variant") == 'benchmark'
+
+
def use_commercial_ipp():
return GetOption("use-commercial-ipp")
+
+def config_has_instrumentation():
+ return any(DefaultEnvironment().isConfigBasedOn(config_name)
+ for config_name in ['instr_release', 'instr_size_optimized_release'])
+
+
def variant_dirname():
s = GetOption("product-variant")
if s == 'production':
@@ -122,6 +226,7 @@ def variant_dirname():
else:
return s
+
AddOption("--product-variant", "--prod-var", nargs=1,
help=("Select product variant to build. Possible "
"options are: {0}. The default is {1} if no option "
@@ -136,6 +241,11 @@ AddOption("--use-commercial-ipp",
action='store_true', dest='use-commercial-ipp',
default=False)
+AddOption("--ipp-shared",
+ help=("Build /ext/ipp as shared library."),
+ action='store_true', dest='ipp-shared',
+ default=False)
+
SetOptionDefault("PRODUCT_VARIANT", variant_dirname())
######## End Commandline option setup ###################################
@@ -144,8 +254,8 @@ SetOptionDefault("PRODUCT_VARIANT", variant_dirname())
# fix for parts 0.10.8 until we get better logic to extract ${CC}
SetOptionDefault('PARTS_USE_SHORT_TOOL_NAMES', 1)
+
def set_default_production_options():
- SetOptionDefault('TARGET_PLATFORM', 'x86_64')
SetOptionDefault('CONFIG', 'release')
SetOptionDefault('TARGET_VARIANT', '${TARGET_OS}-${TARGET_ARCH}')
@@ -189,11 +299,14 @@ def set_default_production_options():
SetOptionDefault('PACKAGE_NAME',
'{PRODUCT_VARIANT}')
+
if is_production():
set_default_production_options()
ipp_mode = ['install_lib']
if use_commercial_ipp():
ipp_mode.append('use_commercial_ipp')
+ if GetOption('ipp-shared'):
+ ipp_mode.append('build_ipp_shared')
include_parts(ipp_parts, mode=ipp_mode,
INSTALL_INCLUDE='${INSTALL_IPP_INCLUDE}')
include_parts(utest_parts + common_parts +
@@ -207,7 +320,6 @@ if is_production():
include_parts(tools_parts,
INSTALL_BIN='${INSTALL_TOOLS_BIN}',
INSTALL_DATA='${INSTALL_TOOLS_DATA}')
- PrintCompilerVersion(DefaultEnvironment())
Default('all')
Default('run_utest::')
@@ -219,6 +331,8 @@ if is_internal_test():
include_parts(util_parts + example_parts,
INSTALL_BIN='${INSTALL_SAMPLE_BIN}',
INSTALL_DATA='${INSTALL_SAMPLE_DATA}')
+ include_parts(sizing_parts,
+ INSTALL_BIN='${INSTALL_SAMPLE_BIN}')
include_parts(tools_parts, INSTALL_BIN='${INSTALL_TOOLS_BIN}')
include_parts(testbot_test_parts)
Default('all')
@@ -226,8 +340,39 @@ if is_internal_test():
if is_internal_tools():
set_default_production_options()
include_parts(ipp_parts + utest_parts + common_parts + util_parts)
- include_parts(internal_tools_parts, INSTALL_BIN='${INSTALL_TOOLS_BIN}')
- Default('ikgfwrapper')
+ include_parts(internal_tools_parts + memory_profiler_parts,
+ INSTALL_BIN='${INSTALL_TOOLS_BIN}')
+ Default('ikgfwrapper', 'memory_profiler')
+ Default('run_utest::memory_profiler::')
+
+if is_benchmark():
+ set_default_production_options()
+ MODE = []
+ if config_has_instrumentation():
+ MODE.append('use_memory_profiler')
+ ipp_mode = []
+ if use_commercial_ipp():
+ ipp_mode.append('use_commercial_ipp')
+
+ # install ipp static and ipp shared builds into separate locations
+ if GetOption('ipp-shared'):
+ ipp_mode.append('build_ipp_shared')
+ SetOptionDefault('INSTALL_TEST_BIN',
+ '$INSTALL_ROOT/test_ipp_shared')
+ # do not allow file links to keep previous builds intact
+ SetOptionDefault('CCOPY_LOGIC', 'copy')
+
+ include_parts(ipp_parts, mode=MODE+ipp_mode, INSTALL_BIN='${INSTALL_TEST_BIN}')
+ include_parts(example_static_parts + utest_parts + perf_benchmark_parts +
+ common_parts + member_parts + verifier_parts +
+ sizing_parts + epid_data,
+ mode=MODE,
+ INSTALL_BIN='${INSTALL_TEST_BIN}')
+ if 'use_memory_profiler' in MODE:
+ include_parts(memory_benchmark_parts + memory_profiler_parts,
+ mode=MODE,
+ INSTALL_BIN='${INSTALL_TEST_BIN}')
+ Default('build::')
if is_package():
set_default_production_options()
@@ -235,3 +380,5 @@ if is_package():
mode=['install_package'],
INSTALL_TOP_LEVEL='${PACKAGE_ROOT}')
Default('package')
+
+log_versions(DefaultEnvironment(), not is_package())
diff --git a/configure b/configure
index 02a6d41..b098aea 100644
--- a/configure
+++ b/configure
@@ -584,6 +584,8 @@ PACKAGE_URL=''
ac_default_prefix=`pwd`/_install
ac_subst_vars='LTLIBOBJS
LIBOBJS
+CONFIG
+RANLIB
ac_ct_CXX
CXXFLAGS
CXX
@@ -613,6 +615,7 @@ infodir
docdir
oldincludedir
includedir
+runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -635,6 +638,7 @@ SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
+with_config
'
ac_precious_vars='build_alias
host_alias
@@ -685,6 +689,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -937,6 +942,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
+ -runstatedir | --runstatedir | --runstatedi | --runstated \
+ | --runstate | --runstat | --runsta | --runst | --runs \
+ | --run | --ru | --r)
+ ac_prev=runstatedir ;;
+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+ | --run=* | --ru=* | --r=*)
+ runstatedir=$ac_optarg ;;
+
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1074,7 +1088,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
+ libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1227,6 +1241,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -1253,6 +1268,14 @@ if test -n "$ac_init_help"; then
esac
cat <<\_ACEOF
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-config=type Choose config type. Possible options are:
+ --with-config=release,
+ --with-config=size_optimized_release. Default is
+ 'release' if no option is specified.
+
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
@@ -2632,11 +2655,121 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
+#define ranlib
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_RANLIB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
# restore flags
CFLAGS="$CFLAGS_OLD"
CPPFLAGS="$CPPFLAGS_OLD"
+
+# Check whether --with-config was given.
+if test "${with_config+set}" = set; then :
+ withval=$with_config;
+else
+ with_config=release
+
+fi
+
+
+CONFIG="release"
+
+if test "x$with_config" != "xrelease"; then :
+
+ CONFIG=size_optimized_release
+
+fi
+
# default install path is current directory
ac_config_files="$ac_config_files Makefile"
diff --git a/configure.ac b/configure.ac
index c5d3082..55a113e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,11 +8,27 @@ CPPFLAGS_OLD="$CPPFLAGS"
AC_PROG_CC([gcc icc cc])
#c++ compiler priority
AC_PROG_CXX([g++ icpc c++])
-
+#define ranlib
+AC_PROG_RANLIB()
# restore flags
CFLAGS="$CFLAGS_OLD"
CPPFLAGS="$CPPFLAGS_OLD"
+AC_ARG_WITH([config],
+ AS_HELP_STRING([--with-config=type],
+ [Choose config type. Possible options are:
+ --with-config=release,
+ --with-config=size_optimized_release.
+ Default is 'release' if no option is specified.]),
+ [],
+ [with_config=release]
+)
+
+AC_SUBST([CONFIG], ["release"])
+AS_IF([test "x$with_config" != "xrelease"], [
+ [CONFIG=size_optimized_release]
+])
+
# default install path is current directory
AC_PREFIX_DEFAULT([`pwd`/_install])
AC_CONFIG_FILES([Makefile])
diff --git a/doc/html/1_81_2file__parser_8h.html b/doc/html/1_81_2file__parser_8h.html
index 5019855..6b012c3 100644
--- a/doc/html/1_81_2file__parser_8h.html
+++ b/doc/html/1_81_2file__parser_8h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -96,7 +96,7 @@ Functions</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li><li class="navelem"><a class="el" href="dir_a32be19bc88f3d7aac6b7249da379f26.html">1.1</a></li><li class="navelem"><a class="el" href="1_81_2file__parser_8h.html">file_parser.h</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/1_81_2types_8h.html b/doc/html/1_81_2types_8h.html
index c5d3fb2..6e51db7 100644
--- a/doc/html/1_81_2types_8h.html
+++ b/doc/html/1_81_2types_8h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -143,7 +143,7 @@ typedef <a class="el" href="struct_oct_str32.html">OctStr32</a>&#160;</td><td cl
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li><li class="navelem"><a class="el" href="dir_a32be19bc88f3d7aac6b7249da379f26.html">1.1</a></li><li class="navelem"><a class="el" href="1_81_2types_8h.html">types.h</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/Basenames.html b/doc/html/Basenames.html
index 91d749d..6a7c031 100644
--- a/doc/html/Basenames.html
+++ b/doc/html/Basenames.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -85,7 +85,7 @@ Name Based Signatures</h1>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/BuildToolsInstallation.html b/doc/html/BuildToolsInstallation.html
index aa4a477..e65f91c 100644
--- a/doc/html/BuildToolsInstallation.html
+++ b/doc/html/BuildToolsInstallation.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -70,13 +70,13 @@ $(document).ready(function(){initNavTree('BuildToolsInstallation.html','');});
<div class="textblock"><p>Building SDK code out of the box requires a number of tools. This section explains how to install the following tools:</p>
<table class="doxtable">
<tr>
-<th>Prerequisite </th><th>Download Link </th></tr>
+<th>Prerequisite </th><th>URL </th><th>Downloads </th></tr>
<tr>
-<td><a href="https://www.python.org/downloads">Python</a> </td><td><a href="https://www.python.org/downloads/release/python-2712/">python 2.7.12 installers</a> </td></tr>
+<td>Python 2.7 </td><td><a href="https://www.python.org">https://www.python.org</a> </td><td><a href="https://www.python.org/downloads/release/python-2712/">python 2.7.12 installers</a> </td></tr>
<tr>
-<td><a href="http://www.scons.org">SCons</a> </td><td><a href="http://prdownloads.sourceforge.net/scons/scons-2.4.1.zip">scons-2.4.1.zip</a> </td></tr>
+<td>SCons 2.4 </td><td><a href="http://www.scons.org">http://www.scons.org</a> </td><td><a href="http://prdownloads.sourceforge.net/scons/scons-2.4.1.zip">scons-2.4.1.zip</a> </td></tr>
<tr>
-<td><a href="https://bitbucket.org/sconsparts/parts/downloads">Parts</a> </td><td><a href="https://bitbucket.org/sconsparts/parts/downloads/parts-0.11.0.zip">parts-0.11.0.zip</a> </td></tr>
+<td>Parts 0.11 </td><td><a href="https://bitbucket.org/sconsparts/parts/downloads">https://bitbucket.org/sconsparts/parts/downloads</a> </td><td><a href="https://bitbucket.org/sconsparts/parts/downloads/parts-0.11.0.zip">parts-0.11.0.zip</a> </td></tr>
</table>
<p><br />
</p>
@@ -112,6 +112,8 @@ Installing Parts</h1>
</ol>
<dl class="section note"><dt>Note</dt><dd>You may need administrative privileges to execute this command.</dd></dl>
<p><br />
+ To verify that Parts installed correctly, run: </p><pre class="fragment"> &gt; python -c "import pkgutil; print 'Parts is installed' if 'parts' in [str(n) for _, n, _ in pkgutil.iter_modules()] else 'Parts module is not found'"
+</pre><p><br />
</p>
</div></div><!-- contents -->
</div><!-- doc-content -->
@@ -120,7 +122,7 @@ Installing Parts</h1>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/BuildingSdk.html b/doc/html/BuildingSdk.html
index fcb2c1e..eed8ffa 100644
--- a/doc/html/BuildingSdk.html
+++ b/doc/html/BuildingSdk.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -66,6 +66,7 @@ $(document).ready(function(){initNavTree('BuildingSdk.html','');});
<li class="level1"><a href="#BuildingSdk_Building_SCons">Building SDK with SCons</a></li>
<li class="level1"><a href="#BuildingSdk_Building_Makefile">Alternate Makefile/Autoconf Based Build Approach</a></li>
<li class="level1"><a href="#BuildingSdk_CommercialIpp">Improving Performance with Commercial IPP</a></li>
+<li class="level1"><a href="#BuildingSdk_SizeOptimizedBuild">Optimizing Code Size over Performance</a></li>
<li class="level1"><a href="#BuildingSdk_Examples">Example Programs</a></li>
<li class="level1"><a href="#BuildingSdk_PortingBuildSystem">Building with Other Build Systems</a></li>
</ul>
@@ -75,24 +76,27 @@ $(document).ready(function(){initNavTree('BuildingSdk.html','');});
Prerequisites</h1>
<p>Building SDK code out of the box requires a number of tools. This section lists the tools used to build the SDK.</p>
<p>For more information on how to install these tools, refer to <a class="el" href="BuildToolsInstallation.html">Guide to Installing Build Tools</a>.</p>
+<p>For a list of compilers and libraries that the SDK was validated on, refer to <a class="el" href="HowValidated.html#validated_supported_compilers">Tested Libraries and Compilers</a>.</p>
<table class="doxtable">
<tr>
<th>Prerequisite </th><th>Notes </th></tr>
<tr>
<td>A C/C++ compiler </td><td>Core code in C. Unit tests need C++11 support. </td></tr>
<tr>
-<td><a href="http://www.python.org">Python</a> </td><td>Validated with v2.7.10 </td></tr>
+<td><a href="http://www.python.org">Python</a> </td><td>Validated with v2.7.12 </td></tr>
<tr>
<td><a href="http://www.scons.org">SCons</a> </td><td>Validated with v2.4.1 </td></tr>
<tr>
-<td><a href="https://bitbucket.org/sconsparts/parts">Parts</a> </td><td>0.10.9.2 or later </td></tr>
+<td><a href="https://bitbucket.org/sconsparts/parts">Parts</a> </td><td>0.11.0 or later </td></tr>
</table>
<h1><a class="anchor" id="BuildingSdk_Building_SCons"></a>
Building SDK with SCons</h1>
<p>To use the SDK, you need to build it to generate libraries compatible with your build environment.</p>
<p>To build based on the default SConstruct file in the root directory of the SDK, invoke scons with no arguments. </p><pre class="fragment">cd &lt;path/to/sdk-root&gt;
scons
-</pre><p>By default, this performs a 64 bit release build.</p>
+</pre><p>By default, this performs a release build of the SDK with unit tests for the current platform and runs unit tests.</p>
+<p>To skip unit test execution when doing cross platfrom build use: </p><pre class="fragment">scons build:: utest::
+</pre><p>Built components appear in the <code>_install</code> directory of the SDK root.</p>
<p>Potentially useful command line options:</p>
<table class="doxtable">
<tr>
@@ -102,15 +106,25 @@ scons
<tr>
<td><code>--cfg=release</code> </td><td>Build in release mode </td></tr>
<tr>
-<td><code>--target=x86</code> </td><td>Target x86 </td></tr>
+<td><code>--cfg=size_optimized_release</code> </td><td>Build in release mode optimized for code size </td></tr>
<tr>
-<td><code>--target=x86_64</code> </td><td>Target x86_64 </td></tr>
+<td><code>--target=x86</code> </td><td>Target x86 (i386) architecture </td></tr>
+<tr>
+<td><code>--target=x86_64</code> </td><td>Target x86-64 architecture </td></tr>
+<tr>
+<td><code>--target=arm</code> </td><td>Target 32-bit ARM architecture </td></tr>
+<tr>
+<td><code>--target=arm_hf</code> </td><td>Target 32-bit ARM architecture with hard float ABI </td></tr>
+<tr>
+<td><code>--target=aarch64</code> </td><td>Target AArch64 (64-bit ARM) architecture </td></tr>
<tr>
<td><code>--tc=cl</code> </td><td>Use MSVC to compile (Microsoft&reg;* C/C++ Optimizing Compiler) </td></tr>
<tr>
<td><code>--tc=gcc</code> </td><td>Use GCC to compile (GNU* Compiler Collection) </td></tr>
<tr>
-<td><code>--tc=icl,mstools</code> </td><td>Use Intel&reg; C++ compiler </td></tr>
+<td><code>--tc=icl,mstools</code> </td><td>Use Intel&reg; C++ compiler for Windows </td></tr>
+<tr>
+<td><code>--tc=icc,gnutools</code> </td><td>Use Intel&reg; C++ compiler for Linux </td></tr>
<tr>
<td><code>build::</code> </td><td>Build the SDK (does not build unit tests) </td></tr>
<tr>
@@ -120,7 +134,6 @@ scons
<tr>
<td><code>-c</code> </td><td>Clean the build </td></tr>
</table>
-<p>Built components appear in the <code>_install</code> directory of the SDK root.</p>
<h1><a class="anchor" id="BuildingSdk_Building_Makefile"></a>
Alternate Makefile/Autoconf Based Build Approach</h1>
<p>You can build with the <code>make</code> command on platforms that support Make/Autoconf.</p>
@@ -132,18 +145,28 @@ make install
<ul>
<li>The default compilers are GCC/G++. You can specify compilers via the CC and CXX variables. For example, <code>./configure CC=/opt/intel/bin/icc CXX=/opt/intel/bin/icpc</code></li>
<li>The default installation directory is <code>./_install</code>. You can specify the installation directory by using <code>./configure --prefix=/usr/local/epid_install</code></li>
-<li>To change OS bit version, use CFLAGS parameter <code>-m32</code> and <code>-m64</code>. For example, <code>./configure CFLAGS=-m32</code></li>
+<li>The default target matches the current environment. You may change it with the CFLAGS parameter. For example, <code>./configure CFLAGS=-m32</code> when run on x86_64 environment configures compilation to target x86.</li>
</ul>
<p><code>make check</code> is optional. It builds and runs the unit tests.</p>
<p>Alternatively, you can use <code>make build</code> as a shortcut to replace <code>make all</code>, <code>make check</code>, and <code>make install</code>.</p>
<p>To clean the build, run <code>make clean</code>.</p>
<p>To remove the install directory, run <code>make uninstall</code>.</p>
-<h1><a class="anchor" id="BuildingSdk_CommercialIpp"></a>
+<p>To configure cross compilation use <code>--host</code> option. For example, <code>./configure --host=arm-linux-gnueabi</code> configures cross compilation build targeting ARM architecture. Cross compiled tests will not run on the build machine so <code>make check</code> should be replaced to <code>make utest</code>. A typical build sequence for cross compilation is as follows: </p><pre class="fragment">./configure --host=&lt;target system&gt;
+make all
+make utest
+make install
+</pre><h1><a class="anchor" id="BuildingSdk_CommercialIpp"></a>
Improving Performance with Commercial IPP</h1>
<p>For higher performance, you can use the commercial version of Cryptography for Intel&reg; Integrated Performance Primitives, available at <a href="https://software.intel.com/articles/download-ipp-cryptography-libraries">https://software.intel.com/articles/download-ipp-cryptography-libraries</a>.</p>
-<dl class="section note"><dt>Note</dt><dd>The SDK has been validated with v9.0.3 of the cryptography library.</dd></dl>
-<p>To build the SDK using a commercial Intel&reg; IPP installation, the <code>IPPROOT</code> environment variable must be properly configured to point to the IPP installation directory, as described in Setting Environment Variables* in the <a href="https://software.intel.com/sites/default/files/managed/a7/15/ipp_userguide_0.pdf">Intel&reg; IPP User's Guide</a> (PDF link).</p>
+<dl class="section note"><dt>Note</dt><dd>The SDK has been validated with version 2017 (Update 2) of the cryptography library.</dd></dl>
+<p>To build the SDK using a commercial Intel&reg; IPP installation, the <code>IPPROOT</code> environment variable must be properly configured to point to the IPP installation directory, as described in Setting Environment Variables* in the <a href="https://software.intel.com/sites/default/files/managed/11/66/ipp_devguide_0.pdf">Intel&reg; IPP Developer Guide</a> (PDF link).</p>
<p>Once the environment is configured, you can build using commercial IPP by specifying <code>--use-commercial-ipp</code> as a command line option.</p>
+<h1><a class="anchor" id="BuildingSdk_SizeOptimizedBuild"></a>
+Optimizing Code Size over Performance</h1>
+<p>To build the SDK with optimization for size you should specify <code>size_optimized_release</code> configuration.</p>
+<p>If you use scons to build the SDK use the command line option <code>config=size_optimized_release</code>.</p>
+<p>If you use a make build system, use <code>./configure --with-config=size_optimized_release</code>.</p>
+<p>This configuration will enable size reducing compiler options and other necessary optimizations that reduce the size needed to run the SDK, but may impact performance.</p>
<h1><a class="anchor" id="BuildingSdk_Examples"></a>
Example Programs</h1>
<p>The SDK includes several examples that show you different aspects of how the Intel&reg; EPID scheme works. In the SDK build, these examples are located in <code>_install/epid-sdk/example</code>.</p>
@@ -163,7 +186,7 @@ Building with Other Build Systems</h1>
</div>
<p><br />
</p>
-<p>Other names and brands may be claimed as the property of others. </p>
+<p>*Other names and brands may be claimed as the property of others. </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.10-->
@@ -171,7 +194,7 @@ Building with Other Build Systems</h1>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/ChangeLog.html b/doc/html/ChangeLog.html
index 0e48d4f..73c3f3a 100644
--- a/doc/html/ChangeLog.html
+++ b/doc/html/ChangeLog.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -61,10 +61,38 @@ $(document).ready(function(){initNavTree('ChangeLog.html','');});
<div class="title">What's New </div> </div>
</div><!--header-->
<div class="contents">
-<div class="textblock"><h2>[3.0.0]</h2>
-<h3>New in This Release</h3>
+<div class="textblock"><h2>[4.0.0] - 2017-04-25</h2>
+<h3>Added</h3>
<ul>
-<li>Support for verification of EPID 1.1 members.</li>
+<li>The member implementation now provides an internal interface that gives guidance on partitioning member operations between highly sensitive ones that use f value of the private key, and less sensitive operations that can be performed in a host environment.</li>
+<li>New member API <code>EpidAssemblePrivKey</code> was added to help assemble and validate the new member private key that is created when a member either joins a group (using the join protocol) or switches to a new group (as the result of a performance rekey).</li>
+</ul>
+<h3>Changed</h3>
+<ul>
+<li>Updated Intel(R) IPP Cryptography library to version 2017 (Update 2).</li>
+<li>The mechanism to set the signature based revocation list (SigRL) used for signing was changed. <code>EpidMemberSetSigRl</code> must be used to set the SigRL. The SigRL is no longer a parameter to <code>EpidSign</code>. This better models typical use case where a device stores a revocation list and updates it independently of signing operations.</li>
+</ul>
+<h3>Removed</h3>
+<ul>
+<li>Removed <code>EpidWritePreSigs</code> API. Serialization of pre-computed signatures is a risky capability to provide, and simply expanding the internal pool via <code>EpidAddPreSigs</code> still provides most of the optimization benefits.</li>
+<li>The <code>EpidIsPrivKeyInGroup</code> API is no longer exposed to clients. It is no longer needed because the new member API <code>EpidAssemblePrivKey</code> performs this check.</li>
+</ul>
+<h3>Fixed</h3>
+<ul>
+<li>When building with commercial version of the Intel(R) IPP Cryptography library, optimized functions are now properly invoked, making signing and verification operations ~2 times faster</li>
+<li>SHA-512/256 hash algorithm is now supported.</li>
+<li>README for compressed data now correctly documents the number of entries in revocation lists.</li>
+<li>The <code>verifysig</code> sample now reports a more clear error message for mismatched SigRLs.</li>
+<li>The default scons build will now build for a 32-bit target on a 32-bit platform.</li>
+</ul>
+<h3>Known Issues</h3>
+<ul>
+<li>Scons build will not work natively on ARM. You can still build using <code>make</code> or cross compile.</li>
+</ul>
+<h2>[3.0.0] - 2016-11-22</h2>
+<h3>Added</h3>
+<ul>
+<li>Support for verification of Intel(R) EPID 1.1 members.</li>
<li>Make-based build system support.</li>
<li>Sample material includes compressed keys.</li>
<li>Enhanced documentation, including step-by-step walkthroughs of example applications.</li>
@@ -76,8 +104,8 @@ $(document).ready(function(){initNavTree('ChangeLog.html','');});
</ul>
<h3>Changes</h3>
<ul>
-<li>A new verifier API has been added to set the basename to be used for verification. Verifier APIs that used to accept basenames now use the basename set via EpidVerifierSetBasename.</li>
-<li>The verifier pre-computation structure has been changed to include the group ID to allow detection of errors that result from providing a pre-computation blob from a different group to EpidVerifierCreate.</li>
+<li>A new verifier API has been added to set the basename to be used for verification. Verifier APIs that used to accept basenames now use the basename set via <code>EpidVerifierSetBasename</code>.</li>
+<li>The verifier pre-computation structure has been changed to include the group ID to allow detection of errors that result from providing a pre-computation blob from a different group to <code>EpidVerifierCreate</code>.</li>
</ul>
<h3>Fixes</h3>
<ul>
@@ -88,7 +116,7 @@ $(document).ready(function(){initNavTree('ChangeLog.html','');});
<li>SHA-512/256 hash algorithm is not supported.</li>
</ul>
<h2>[2.0.0] - 2016-07-20</h2>
-<h3>New in This Release</h3>
+<h3>Added</h3>
<ul>
<li>Signed binary issuer material support.<ul>
<li>Binary issuer material validation APIs.</li>
@@ -103,17 +131,17 @@ $(document).ready(function(){initNavTree('ChangeLog.html','');});
</ul>
</li>
</ul>
-<h3>Changes</h3>
+<h3>Changed</h3>
<ul>
<li>The default hash algorithm has changed. It is now SHA-512.</li>
<li>Functions that returned <code>EpidNullPtrErr</code> now return <code>EpidBadArgErr</code> instead.</li>
</ul>
-<h3>Fixes</h3>
+<h3>Fixed</h3>
<ul>
<li>Updated build flags to work around GCC 4.8.5 defect.</li>
</ul>
<h2>[1.0.0] - 2016-03-03</h2>
-<h3>New in This Release</h3>
+<h3>Added</h3>
<ul>
<li>Basic sign and verify functionality</li>
<li>Dynamic join support for member</li>
@@ -126,7 +154,7 @@ $(document).ready(function(){initNavTree('ChangeLog.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/ChoosingiKGF.html b/doc/html/ChoosingiKGF.html
index 42c9de9..f1598d1 100644
--- a/doc/html/ChoosingiKGF.html
+++ b/doc/html/ChoosingiKGF.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -223,7 +223,7 @@ Options:
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/EpidOverview.html b/doc/html/EpidOverview.html
index f720905..64a02c8 100644
--- a/doc/html/EpidOverview.html
+++ b/doc/html/EpidOverview.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -82,7 +82,7 @@ Roles</h1>
<p>In the Intel&reg; EPID scheme, there are three roles: issuers, members, and verifiers.</p>
<p>The entities in these roles interact with each other in such a way that a member can prove to a verifier that it is a trusted member of a group without disclosing the identity of the member. Groups are created and managed by the issuer.</p>
<div class="image">
-<img src="epid_diagram_high_level_use_case.png" alt="epid_diagram_high_level_use_case.png"/>
+<img src="epid_diagram_roles_summary.png" alt="epid_diagram_roles_summary.png"/>
</div>
<h2><a class="anchor" id="EpidOverview_Issuers"></a>
Issuers</h2>
@@ -92,12 +92,12 @@ Issuers</h2>
<li>Creates groups by generating one issuing private key and one group certificate for each group. The group certificate contains the group public key.</li>
<li>Creates group members by generating unique Intel&reg; EPID member private keys through bulk provisioning. Member private keys are created from the issuing private key for the group.</li>
<li>Manages requests from prospective members to join existing groups by using the join protocol.</li>
-<li>Creates and maintains signature based revocation lists and private key based revocation lists. These lists of members no longer in good standing allow members to be dropped from a group.</li>
+<li>Creates and maintains signature revocation lists and member private key revocation lists. These lists of members no longer in good standing allow members to be dropped from a group.</li>
<li>Creates and maintains group revocation lists.</li>
<li>Makes group public keys and revocation lists available to verifiers.</li>
</ul>
<div class="image">
-<img src="epid_diagram_issuer_high_level.png" alt="epid_diagram_issuer_high_level.png"/>
+<img src="epid_diagram_issuer_functionality.png" alt="epid_diagram_issuer_functionality.png"/>
</div>
<h2><a class="anchor" id="EpidOverview_Members"></a>
Members</h2>
@@ -108,7 +108,7 @@ Members</h2>
<li>The member uses its member private key to sign a message to prove group membership to the verifier without revealing the identity of the member.</li>
</ul>
<div class="image">
-<img src="epid_diagram_member_high_level.png" alt="epid_diagram_member_high_level.png"/>
+<img src="epid_diagram_member_functionality.png" alt="epid_diagram_member_functionality.png"/>
</div>
<h2><a class="anchor" id="EpidOverview_Verifiers"></a>
Verifiers</h2>
@@ -122,7 +122,7 @@ Verifiers</h2>
<li>Manage a private list of revoked members, also called the verifier blacklist.</li>
</ul>
<div class="image">
-<img src="epid_diagram_verifier_high_level.png" alt="epid_diagram_verifier_high_level.png"/>
+<img src="epid_diagram_verifier_functionality.png" alt="epid_diagram_verifier_functionality.png"/>
</div>
<h1><a class="anchor" id="EpidOverview_Groups"></a>
Groups</h1>
@@ -130,11 +130,14 @@ Groups</h1>
<p>All groups have the following:</p>
<ul>
<li>Group public key, which corresponds to the issuing private key kept by the issuer</li>
-<li>Signature based revocation list</li>
-<li>Private key based revocation list</li>
+<li>Signature revocation list</li>
+<li>Member private key revocation list</li>
<li>Member private keys, generated from the issuing private key</li>
</ul>
-<p>If a signature based revocation list or private key based revocation list does not exist, it is assumed to be empty.</p>
+<p>If a signature revocation list or member private key revocation list does not exist, it is assumed to be empty.</p>
+<div class="image">
+<img src="epid_diagram_group.png" alt="epid_diagram_group.png"/>
+</div>
<h1><a class="anchor" id="EpidOverview_Keys"></a>
Keys</h1>
<p>The Intel&reg; EPID scheme works with three types of keys: the group public key, the issuing private key, and the member private key. A group public key corresponds to the unique member private keys that are part of the group. Member private keys are generated from the issuing private key.</p>
@@ -156,7 +159,7 @@ Member and Verifier Interaction</h1>
<p>The Intel&reg; EPID verifier uses the group public key to verify the correctness of an Intel&reg; EPID signature, i.e., to verify that the signature was indeed created by a member with a valid Intel&reg; EPID private key.</p>
<p>However, the Intel&reg; EPID signature does not convey any information about which unique private key was used to create the signature.</p>
<div class="image">
-<img src="epid_diagram_high_level_interaction.png" alt="epid_diagram_high_level_interaction.png"/>
+<img src="epid_diagram_basic_interaction.png" alt="epid_diagram_basic_interaction.png"/>
</div>
</div></div><!-- contents -->
</div><!-- doc-content -->
@@ -165,7 +168,7 @@ Member and Verifier Interaction</h1>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/Glossary.html b/doc/html/Glossary.html
index f4c563b..6f43609 100644
--- a/doc/html/Glossary.html
+++ b/doc/html/Glossary.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -166,7 +166,7 @@ Verifier</h1>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/HowValidated.html b/doc/html/HowValidated.html
new file mode 100644
index 0000000..0349ed4
--- /dev/null
+++ b/doc/html/HowValidated.html
@@ -0,0 +1,123 @@
+<!-- HTML header for doxygen 1.8.10-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.11"/>
+<title>Intel&reg; Enhanced Privacy ID SDK: Tested Libraries and Compilers</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="navtree.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="resize.js"></script>
+<script type="text/javascript" src="navtreedata.js"></script>
+<script type="text/javascript" src="navtree.js"></script>
+<script type="text/javascript">
+ $(document).ready(initResizable);
+ $(window).load(resizeHeight);
+</script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+<link href="epidstyle.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td id="projectalign" style="padding-left: 0.5em;">
+ <div id="projectname"><a
+ onclick="storeLink('index.html')"
+ id="projectlink"
+ class="index.html"
+ href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
+&#160;<span id="projectnumber">4.0.0</span>
+</div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.11 -->
+</div><!-- top -->
+<div id="side-nav" class="ui-resizable side-nav-resizable">
+ <div id="nav-tree">
+ <div id="nav-tree-contents">
+ <div id="nav-sync" class="sync"></div>
+ </div>
+ </div>
+ <div id="splitbar" style="-moz-user-select:none;"
+ class="ui-resizable-handle">
+ </div>
+</div>
+<script type="text/javascript">
+$(document).ready(function(){initNavTree('HowValidated.html','');});
+</script>
+<div id="doc-content">
+<div class="header">
+ <div class="headertitle">
+<div class="title">Tested Libraries and Compilers </div> </div>
+</div><!--header-->
+<div class="contents">
+<div class="textblock"><h1><a class="anchor" id="validated_supported_compilers"></a>
+Tested Libraries and Compilers</h1>
+<p>The Intel&reg; SDK was validated with the following compilers:</p>
+<table class="doxtable">
+<tr>
+<th>Runtime Library </th><th>Compiler </th></tr>
+<tr>
+<td>GNU* C Library (glibc) 2.23 </td><td>GNU* Compiler Collection version (GCC) 6.2.0 </td></tr>
+<tr>
+<td>glibc 2.23 </td><td>GCC 5.4.0 </td></tr>
+<tr>
+<td>glibc 2.20 </td><td>GCC 4.9.1 </td></tr>
+<tr>
+<td>glibc 2.23 </td><td>GCC 4.8.5 </td></tr>
+<tr>
+<td>glibc 2.23 </td><td>Intel&reg; C++ Compiler for Linux* (ICC) 17.0.1 with GCC 4.8.5 </td></tr>
+<tr>
+<td>glibc 2.23 </td><td>ICC 17.0.1 with GCC 5.4.0 </td></tr>
+<tr>
+<td>glibc 2.23 </td><td>ICC 17.0.1 with GCC 6.2.0 </td></tr>
+<tr>
+<td>glibc 2.23 </td><td>ICC 16.0.3 with GCC 4.8.5 </td></tr>
+<tr>
+<td>glibc 2.23 </td><td>ICC 16.0.3 with GCC 5.4.0 </td></tr>
+<tr>
+<td>glibc 2.23 </td><td>ICC 16.0.3 with GCC 6.2.0 </td></tr>
+<tr>
+<td>glibc 2.23 </td><td>ICC 15.0.7 with GCC 5.4.0 </td></tr>
+<tr>
+<td>glibc 2.23 </td><td>ICC 14.0.4 with GCC 4.8.5 </td></tr>
+<tr>
+<td>Microsoft* Windows* Kit 10 </td><td>Microsoft* Visual Studio*(VS) 2015 </td></tr>
+<tr>
+<td>Microsoft* Windows* Kit 8.1 </td><td>VS 2015 </td></tr>
+<tr>
+<td>Microsoft* Windows* Kit 8.1 </td><td>Intel&reg; C++ Compiler for Windows* (ICL) 16.0.207 with VS 2013 </td></tr>
+<tr>
+<td>Microsoft* Windows* Kit 10 </td><td>ICL 16.0.207 with VS 2015 </td></tr>
+<tr>
+<td>Microsoft* Windows* Kit 8.1 </td><td>ICL 15.0.287 with VS 2013 </td></tr>
+<tr>
+<td>Microsoft* Windows* Kit 10 </td><td>ICL 15.0.287 with VS 2015 </td></tr>
+<tr>
+<td>Microsoft* Windows* Kit 8.1 </td><td>ICL 14.0.241 with VS 2013 </td></tr>
+</table>
+<p><br />
+ *Other names and brands may be claimed as the property of others. </p>
+</div></div><!-- contents -->
+</div><!-- doc-content -->
+<!-- HTML footer for doxygen 1.8.10-->
+<!-- start footer part -->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ <li class="footer">
+ &copy; 2016-2017 Intel Corporation
+ </li>
+ </ul>
+</div>
+</body>
+</html>
diff --git a/doc/html/ImplementationNotes.html b/doc/html/ImplementationNotes.html
index 6aa26d7..cee7f88 100644
--- a/doc/html/ImplementationNotes.html
+++ b/doc/html/ImplementationNotes.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -69,13 +69,14 @@ $(document).ready(function(){initNavTree('ImplementationNotes.html','');});
<li class="level1"><a href="#ImplementationNotes_FlexibleArrays">Flexible Arrays</a></li>
</ul>
</div>
-<div class="textblock"><h1><a class="anchor" id="ImplementationNotes_Prng"></a>
+<div class="textblock"><p>This section is intended to provide additional guidance for users who want to modify the underlying code of the SDK. If you only want to call the SDK APIs without modifying them, you can safely ignore this section.</p>
+<h1><a class="anchor" id="ImplementationNotes_Prng"></a>
Random Number Generation</h1>
<p>Some SDK APIs require a random number data source. A <a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c" title="Generates random data. ">BitSupplier</a> provides a source of random data. This function should be a cryptographically secure random number generator.</p>
<dl class="section warning"><dt>Warning</dt><dd>The pseudo-random number generator provided with the examples is for sample use only and is not suitable for cryptographically secure applications.</dd></dl>
<h1><a class="anchor" id="ImplementationNotes_ProtectingSecrets"></a>
Protecting Secrets</h1>
-<p>Member code works with private keys, so member code must be run in a trusted environment.</p>
+<p>Member code works with private keys, so member code must be run in a trusted environment. The member component contains a TPM subcomponent which contains the most sensitive operations performed by the member.</p>
<dl class="section warning"><dt>Warning</dt><dd>If member memory is available to an untrusted source, the member private key could be exposed.</dd></dl>
<p>The <code>EpidZeroMemory</code> function is used by the memory allocation routines <code>EpidAlloc</code>, <code>EpidRealloc</code> and <code>EpidFree</code> to wipe the memory as memory is freed.</p>
<dl class="section warning"><dt>Warning</dt><dd>The <code>EpidZeroMemory</code> function may be optimized away by some compilers. If it is, you should consider using a compiler or operating system specific memory sanitization function (e.g. <code>memcpy_s</code> or <code>SecureZeroMemory</code>).</dd></dl>
@@ -102,7 +103,7 @@ Flexible Arrays</h1>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/IssuerMaterial.html b/doc/html/IssuerMaterial.html
index 8a9012a..8cc6a8f 100644
--- a/doc/html/IssuerMaterial.html
+++ b/doc/html/IssuerMaterial.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -67,7 +67,7 @@ $(document).ready(function(){initNavTree('IssuerMaterial.html','');});
</ul>
</li>
<li class="level1"><a href="#IssuerMaterial_GroupRls">Group Based Revocation Lists</a></li>
-<li class="level1"><a href="#IssuerMaterial_CmpGroups">Compressed Member Private Key</a><ul><li class="level2"><a href="#IssuerMaterial_CmpGroups_groupa">Compressed Sample Group A</a></li>
+<li class="level1"><a href="#IssuerMaterial_CmpGroups">Compressed Sample Groups</a><ul><li class="level2"><a href="#IssuerMaterial_CmpGroups_groupa">Compressed Sample Group A</a></li>
<li class="level2"><a href="#IssuerMaterial_CmpGroups_groupb">Compressed Sample Group B</a></li>
</ul>
</li>
@@ -181,8 +181,7 @@ Group Based Revocation Lists</h1>
<td><code>grprl.bin</code> </td><td>One entry in which <code>groupb</code> is revoked </td></tr>
</table>
<h1><a class="anchor" id="IssuerMaterial_CmpGroups"></a>
-Compressed Member Private Key</h1>
-<p>Sample Groups</p>
+Compressed Sample Groups</h1>
<p>Intel&reg; EPID SDK supports use of compressed member private keys. The groups described here use compressed compressed member private keys but structuarlly corospond to groups described above.</p>
<h2><a class="anchor" id="IssuerMaterial_CmpGroups_groupa"></a>
Compressed Sample Group A</h2>
@@ -285,7 +284,7 @@ Compressed Group Based Revocation Lists</h1>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/LegalInformation.html b/doc/html/LegalInformation.html
index e86d60f..3ee8118 100644
--- a/doc/html/LegalInformation.html
+++ b/doc/html/LegalInformation.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -76,7 +76,7 @@ $(document).ready(function(){initNavTree('LegalInformation.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/Revocation.html b/doc/html/Revocation.html
index 7191f2d..0cea37f 100644
--- a/doc/html/Revocation.html
+++ b/doc/html/Revocation.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -134,7 +134,7 @@ Reasons the Verifier Might Revoke an Intel® EPID Signature</h2>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/SdkOverview.html b/doc/html/SdkOverview.html
index 0cc6124..8bac140 100644
--- a/doc/html/SdkOverview.html
+++ b/doc/html/SdkOverview.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -105,7 +105,7 @@ SDK Components</h1>
<tr>
<td>Sample Issuer Material </td><td>Sample keys and revocation lists </td></tr>
</table>
-<p>Tools implement utility code to interact with Intel&reg; EPID related services such as <a class="el" href="ChoosingiKGF.html">the Intel&reg; Key Generation</a>Facility (iKGF)".</p>
+<p>Tools to interact with Intel&reg; EPID related services such those offered by the <a class="el" href="ChoosingiKGF.html">Intel&reg; Key Generation Facility</a>.</p>
<table class="doxtable">
<tr>
<th>Component </th><th>Description </th></tr>
@@ -128,6 +128,8 @@ SDK Components</h1>
<td>gtest </td><td>gtest unit test framework </td></tr>
<tr>
<td>Build Scripts </td><td>Scripts to configure and build the SDK </td></tr>
+<tr>
+<td>dropt </td><td>Library for parsing command line </td></tr>
</table>
<p>Math primitives are implemented in the <em>math</em> sub-component of <em>common</em>. The reference math primitive implementation is based on a non-optimized Vanilla C subset of the Intel&reg; Performance Primitives. <em>Math</em> is designed so that you can replace its implementation to call custom hardware IP blocks or optimized libraries.</p>
<h2>Intel&reg; EPID 1.1 Compatibility</h2>
@@ -166,18 +168,19 @@ Source Layout</h2>
| |__ verifysig/ Source for signature validation signing example
|
|__ ext/
-| |__ gtest/ Third party gtest library
-| |__ ipp/ IPP library
+| |__ dropt/ Third party library for parsing command-line options
+| |__ gtest/ Third party gtest library
+| |__ ipp/ IPP library
|
-|__ parts-site/ Parts platform config scripts
+|__ parts-site/ Parts platform config scripts
|
|__ tools/
- |__ extractgrps/ Tool to extract groups
- |__ extractkeys/ Tool to extract keys
- |__ revokegrp/ Tool to create group revocation request
- |__ revokekey/ Tool to create a member key revocation request
- |__ revokesig/ Tool to create a signature based revocation
- request
+ |__ extractgrps/ Tool to extract groups
+ |__ extractkeys/ Tool to extract keys
+ |__ revokegrp/ Tool to create group revocation request
+ |__ revokekey/ Tool to create a member key revocation request
+ |__ revokesig/ Tool to create a signature based revocation
+ request
</pre><h2><a class="anchor" id="SdkOverview_Files_InstallLayout"></a>
Install Layout</h2>
<p>The Install Layout contains the data developers need to develop and build their applications using the Intel&reg; EPID SDK. Once built, the Install Layout has no dependency on the Source Layout, allowing developers to build the SDK once and reuse the built files in other locations or on other computers. </p><pre class="fragment">_install/
@@ -195,7 +198,7 @@ Install Layout</h2>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/SignVerifyTutorial.html b/doc/html/SignVerifyTutorial.html
index 5fc86a4..1afa84e 100644
--- a/doc/html/SignVerifyTutorial.html
+++ b/doc/html/SignVerifyTutorial.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -62,10 +62,20 @@ $(document).ready(function(){initNavTree('SignVerifyTutorial.html','');});
</div><!--header-->
<div class="contents">
<div class="toc"><h3>Table of Contents</h3>
-<ul><li class="level1"><a href="#SignVerifyTutorial_Signmmsg">Creating an Intel&reg; EPID Signature of a Given Message</a></li>
-<li class="level1"><a href="#SignVerifyTutorial_Verifysig">Verifying an Intel&reg; EPID Signature</a></li>
-<li class="level1"><a href="#SignVerifyTutorial_Basename">Linking Intel&reg; EPID Signatures from the Same Member</a></li>
-<li class="level1"><a href="#SignVerifyTutorial_VerificationFailures">Expected Failures</a></li>
+<ul><li class="level1"><a href="#tutorial_signmmsgOverview">Creating an Intel&reg; EPID Signature of a Given Message</a><ul><li class="level2"><a href="#tutorial_signmsgList">What Do You Need to Create a Signature?</a></li>
+<li class="level2"><a href="#tutorial_signmsgExample">Signing Example</a></li>
+</ul>
+</li>
+<li class="level1"><a href="#tutorial_verifysigOverview">Verifying an Intel&reg; EPID Signature</a><ul><li class="level2"><a href="#tutorial_verifyList">What Do You Need to Verify a Signature?</a></li>
+<li class="level2"><a href="#tutorial_verifyExample">Verification Example</a></li>
+</ul>
+</li>
+<li class="level1"><a href="#SignVerifyTutorial_requirements">Parameter Matching Requirements</a><ul><li class="level2"><a href="#SignVerifyTutorial_message">Message</a></li>
+<li class="level2"><a href="#SignVerifyTutorial_hashalg">Hash Algorithm</a></li>
+<li class="level2"><a href="#SignVerifyTutorial_SigRL">Signature Revocation List</a></li>
+<li class="level2"><a href="#SignVerifyTutorial_basenames">Basenames</a></li>
+</ul>
+</li>
<li class="level1"><a href="#SignVerifyTutorial_Revocation_Group">Revocation</a><ul><li class="level2"><a href="#SignVerifyTutorial_GroupRevocation">Detecting Revoked Group from Group Revocation List</a></li>
<li class="level2"><a href="#SignVerifyTutorial_KeyRevocation">Detecting Revoked Member from Private Key Based Revocation List</a></li>
<li class="level2"><a href="#SignVerifyTutorial_SigRevocation">Detecting Revoked Member from Signature Based Revocation List</a></li>
@@ -73,14 +83,30 @@ $(document).ready(function(){initNavTree('SignVerifyTutorial.html','');});
</li>
</ul>
</div>
-<div class="textblock"><p>The Intel&reg; EPID SDK provides example tools to show you how to use the Intel&reg; EPID SDK APIs. These examples are called <em>signmsg</em> and <em>verifysig</em>.</p>
-<p>You can build these examples using the instructions in <a class="el" href="BuildingSdk.html">Building from Source</a>. The tutorial assumes <code>_install/epid-sdk/example</code> is the current directory.</p>
+<div class="textblock"><p>The Intel&reg; EPID SDK provides example tools to show you how to use the Intel&reg; EPID SDK APIs. These examples are called <code>signmsg</code> and <code>verifysig</code>.</p>
+<p>These examples use the pre-generated data described in <a class="el" href="IssuerMaterial.html">Sample Issuer Material</a>. After you build the SDK, the data is in the <code>_install/epid-sdk/example/data</code> directory. If you don't have genuine issuer material, you can use this data for validation purposes.</p>
+<p>You can follow along with the commands used in this tutorial if you first build these examples using the instructions in <a class="el" href="BuildingSdk.html">Building from Source</a>. The tutorial assumes <code>_install/epid-sdk/example</code> is the current directory.</p>
<p>All command lines in this tutorial use posix command line conventions; for other systems, adjust accordingly.</p>
-<p>For the code used in this tutorial, refer to <a class="el" href="Examples.html">Walkthroughs of Examples Showing API Usage</a>.</p>
-<dl class="section note"><dt>Note</dt><dd>The data for running this tutorial is pre-generated. Once the samples are built, the data is in the <code>_install/epid-sdk/example/data</code> directory. See <a class="el" href="IssuerMaterial.html">Sample Issuer Material</a>.</dd></dl>
-<h1><a class="anchor" id="SignVerifyTutorial_Signmmsg"></a>
+<p>For detailed walkthroughs of the code used in <code>signmsg</code> and <code>verifysig</code>, refer to <a class="el" href="Examples.html">Walkthroughs of Examples Showing API Usage</a>.</p>
+<h1><a class="anchor" id="tutorial_signmmsgOverview"></a>
Creating an Intel® EPID Signature of a Given Message</h1>
-<p>The example application <em>signmsg</em> shows you how to create an Intel&reg; EPID signature of a given message. </p><pre class="fragment">$ ./signmsg -h
+<p>The example application <code>signmsg</code> shows you how to create an Intel&reg; EPID signature of a given message.</p>
+<h2><a class="anchor" id="tutorial_signmsgList"></a>
+What Do You Need to Create a Signature?</h2>
+<p>To generate a signature, you need the following items:</p>
+<ul>
+<li><b>Group public key:</b> You need the group public key to specify which group the member belongs to.</li>
+<li><b>Member private key:</b> You need the member private key so that the member can create a signature that corresponds with the group public key.</li>
+<li><b>Message:</b> You need the message because the member needs something to sign.</li>
+<li><b>Hash algorithm:</b> You need the hash algorithm to encrypt the signature. If you don't specify a hash algorithm, a default hash algorithm is used.</li>
+<li><b>Signature based revocation list (SigRL):</b> You need the SigRL so that the member can create non-revoked proofs for each entry on the list. For more information, see <a class="el" href="Revocation.html">In-Depth Explanation of Revocation</a>.</li>
+<li><b>Member precomputation blob:</b> The precomputation blob is an optional parameter that you can use to improve performance when generating signatures repeatedly with the same member private key.</li>
+<li><b>Basename:</b> A basename is a parameter that is only provided when the member is generating a name based signature. If no basename is specified, a random value is chosen as the basename. For more information, see <a class="el" href="Basenames.html">In-Depth Explanation of Basenames</a>.</li>
+<li><b>Random number generator:</b> You need a cryptographically secure random number generator to ensure that signatures generated by the same member with the same message are different. The SDK provides the <a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c" title="Generates random data. ">BitSupplier</a> function prototype that specifies the interface for your random number generator implementation.</li>
+</ul>
+<h2><a class="anchor" id="tutorial_signmsgExample"></a>
+Signing Example</h2>
+<p>The signmsg command can be passed a number of options: </p><pre class="fragment">$ ./signmsg -h
Usage: signmsg [OPTION]...
Create Intel(R) EPID signature of message
@@ -91,9 +117,15 @@ Options:
--msg=MESSAGE
MESSAGE to sign
+ --msgfile=FILE
+ FILE containing message to sign
+
--bsn=BASENAME
BASENAME to sign with (default: random)
+ --bsnfile=FILE
+ FILE containing basename to sign with
+
--sigrl=FILE
load signature based revocation list from FILE
@@ -112,7 +144,7 @@ Options:
--capubkey=FILE
load IoT Issuing CA public key from FILE (default: cacert.bin)
- --hashalg={SHA-256 | SHA-384 | SHA-512}
+ --hashalg={SHA-256 | SHA-384 | SHA-512 | SHA-512/256}
use specified hash algorithm (default: SHA-512)
-h, --help
@@ -121,10 +153,30 @@ Options:
-v, --verbose
print status messages to stdout
</pre><p>To sign a message, a group member in good standing uses the following command: </p><pre class="fragment">$ ./signmsg --msg="test0"
-</pre><p>The above command signs a message "test0". <em>signmsg</em> uses default options for the group public key, member private key, hash algorithm and IoT Issuing CA public key. All other parameters that are not given are ignored. The command produces a signature file: <code>sig.dat</code></p>
-<h1><a class="anchor" id="SignVerifyTutorial_Verifysig"></a>
+</pre><p>The above command signs a message "test0". <code>signmsg</code> uses default options for the group public key, member private key, hash algorithm and IoT Issuing CA public key. All other parameters that are not given are ignored. The command produces a signature file: <code>sig.dat</code></p>
+<h1><a class="anchor" id="tutorial_verifysigOverview"></a>
Verifying an Intel® EPID Signature</h1>
-<p>The example application <em>verifysig</em> shows you how to verify that a given Intel&reg; EPID signature is produced by a member in good standing. </p><pre class="fragment">$ ./verifysig -h
+<p>The example application <code>verifysig</code> shows you how to verify that a given Intel&reg; EPID signature is produced by a member in good standing.</p>
+<h2><a class="anchor" id="tutorial_verifyList"></a>
+What Do You Need to Verify a Signature?</h2>
+<p>To verify a signature, you need the following items:</p>
+<ul>
+<li><b>Signature:</b> You need the signature that you want to verify.</li>
+<li><b>CA certificate:</b> You need the CA certificate to verify the authenticity of the issuer material before you use it. Depending on how your issuer protects its data, you may not need a CA certificate. For more information on issuer material, refer to <a class="el" href="ChoosingiKGF.html">If You Choose iKGF as Your Issuer</a> and <a class="el" href="IssuerMaterial.html">Sample Issuer Material</a>.</li>
+<li><b>Group certificate:</b> The group certificate comes from the issuer and contains the group public key. You need the group public key to determine if the signature came from a member of this group. The group public key corresponds to the member private key used to generate the signature.</li>
+<li><b>Message:</b> In order for verification to succeed, you need to specify the message that was signed.</li>
+<li><b>Hash algorithm:</b> In order for verification to succeed, you need to specify the hash algorithm that was used to sign the message. If you don't specify a hash algorithm, a default hash algorithm is used.</li>
+<li><b>Group based revocation list (GroupRL):</b> You need the GroupRL to ensure the member does not belong to a revoked group. The GroupRL comes from the issuer.</li>
+<li><b>Private key based revocation list (PrivRL):</b> You need the PrivRL to ensure that the member private key has not been revoked. The PrivRL comes from the issuer.</li>
+<li><b>Signature based revocation list (SigRL):</b> You need to compare the SigRL with non-revoked proofs from the member to ensure that the member did not create any revoked signaures. The SigRL comes from the issuer.</li>
+<li><b>Verifier revocation list:</b> The VerRL is optional. The verifier uses the VerRL to ensure that the member did not create any signatures that were revoked by the verifier. You can only use the VerRL if the signature is a name based signature. The VerRL comes from the verifier. For more information, refer to <a class="el" href="Revocation.html">In-Depth Explanation of Revocation</a> and <a class="el" href="Basenames.html">In-Depth Explanation of Basenames</a>.</li>
+<li><b>Verifier precomputation blob:</b> The verifier precomputation blob is optional. You can use the precomputation blob to increase performance when verifying signatures repeatedly with the same group public key.</li>
+<li><b>Basename:</b> A basename is a parameter that is only provided in instances where Intel&reg; EPID uses name based signatures. If a basename is used, the member and verifier have to use the same basename. If a basename is not specified, a random number is chosen as the basename. Because name-based signatures decrease the member's privacy, they must only be used with the knowledge and consent of the member. For more information, refer to <a class="el" href="Basenames.html">In-Depth Explanation of Basenames</a>.</li>
+<li><b>Precomputation blob:</b> You can optionally provide a precomputation blob to greatly speed up <a class="el" href="group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70" title="Creates a new verifier context. ">EpidVerifierCreate</a>. If you don't use one, the precomputation blob can be stored for use in a future session to verify membership in the same group using <a class="el" href="group___epid_verifier_module.html#ga92df4d00ea4ee59d7bfd35b23da03392" title="Serializes the pre-computed verifier settings. ">EpidVerifierWritePrecomp</a>.</li>
+</ul>
+<h2><a class="anchor" id="tutorial_verifyExample"></a>
+Verification Example</h2>
+<p>The verifysig command can be passed a number of options: </p><pre class="fragment">$ ./verifysig -h
Usage: verifysig [OPTION]...
Verify signature was created by group member in good standing
@@ -135,9 +187,15 @@ Options:
--msg=MESSAGE
MESSAGE that was signed (default: empty)
+ --msgfile=FILE
+ FILE containing message that was signed
+
--bsn=BASENAME
BASENAME used in signature (default: random)
+ --bsnfile=FILE
+ FILE containing basename to sign with
+
--privrl=FILE
load private key revocation list from FILE
@@ -164,7 +222,7 @@ Options:
load IoT Issuing CA public key from FILE
(default: cacert.bin)
- --hashalg={SHA-256 | SHA-384 | SHA-512}
+ --hashalg={SHA-256 | SHA-384 | SHA-512 | SHA-512/256}
use specified hash algorithm for 2.0 groups (default: SHA-512)
-h, --help
@@ -174,32 +232,45 @@ Options:
print status messages to stdout
</pre><p>To verify that a signature is from a member in good standing, the verifier uses the following command: </p><pre class="fragment">$ ./verifysig --msg="test0"
signature verified successfully
-</pre><p>This verifies that the default signature file <code>sig.dat</code> is generated for the message "test0" by a member in good standing. <em>verifysig</em> uses default inputs for group public key, hash algorithm and IoT Issuing CA public key. All other parameters are ignored. The output <code>verifysig: signature verified successfully</code> denotes that the verification is successful.</p>
-<h1><a class="anchor" id="SignVerifyTutorial_Basename"></a>
-Linking Intel® EPID Signatures from the Same Member</h1>
-<p>A name based signature is created using the additional parameter of a basename. If the member uses the same basename, the verifier can mathematically link signatures generated by the member, showing that the signatures are from the same member.</p>
-<p>To validate a signature with a basename, you need to use the same basename for signing and verification. The mechanism for ensuring that the member and verifier use the same basename is outside the scope of the SDK.</p>
-<p>If a basename is not provided, then the member uses a random basename and the signature generated by the member is anonymous.</p>
-<p>For more general information on why you might want to use a basename, refer to <a class="el" href="Basenames.html#name_based">Name Based Signatures</a>.</p>
-<dl class="section warning"><dt>Warning</dt><dd>The use of a name-based signature creates a platform unique pseudonymous identifier. Because it reduces the member's privacy, the user should be notified when it is used and should have control over its use.</dd></dl>
+</pre><p>This verifies that the default signature file <code>sig.dat</code> is generated for the message "test0" by a member in good standing. The <code>verifysig</code> example uses default inputs for group public key, hash algorithm, and IoT Issuing CA public key. All other parameters are ignored. The output <code>verifysig: signature verified successfully</code> denotes that the verification is successful.</p>
+<h1><a class="anchor" id="SignVerifyTutorial_requirements"></a>
+Parameter Matching Requirements</h1>
+<p>To successfully create and verify a signature, the member and verifier have to use the same message, hash algorithm, signature revocation list, and basename.</p>
+<p>The signature verification process fails if there is a parameter mismatch between sign and verify operations. The mechanism for avoiding a parameter mismatch is outside the scope of the SDK.</p>
+<h2><a class="anchor" id="SignVerifyTutorial_message"></a>
+Message</h2>
+<p>The member needs the message to generate the signature using the member private key. In order for verification to succeed, the verifier needs to use the same message that the member used.</p>
+<p>This comparison allows the verifier to determine if the signature fulfills the verifier's basic expectations of what a signature from a valid member should look like, given the original message and the group public key.</p>
+<p>Verification fails if the signing and verification operations don't use the same message: </p><pre class="fragment">$ ./signmsg --msg="test0"
+$ ./verifysig --msg="test1"
+verifysig: signature verification failed: invalid signature
+</pre><h2><a class="anchor" id="SignVerifyTutorial_hashalg"></a>
+Hash Algorithm</h2>
+<p>The member needs to encrypt the signature with the hash algorithm. The verifier needs to use the same hash algorithm that the member used.</p>
+<p>If you don't specify a hash algorithm, a default hash algorithm is used.</p>
+<p>The Intel&reg; EPID SDK supports the following hash algorithms: SHA-256, SHA-384, SHA-512.</p>
+<p>Verification fails if the signing and verification operations don't use the same hash algorithm: </p><pre class="fragment">$ ./signmsg --msg="test0" --hashalg=SHA-256
+$ ./verifysig --msg="test0" --hashalg=SHA-384
+verifysig: signature verification failed: invalid signature
+</pre><h2><a class="anchor" id="SignVerifyTutorial_SigRL"></a>
+Signature Revocation List</h2>
+<p>The member needs the signature based revocation list (SigRL) to create non-revoked proofs for each entry on the SigRL. The verifier needs to use the same SigRL to check the proofs.</p>
+<p>Verification fails if the signing and verification operations don't use the same SigRL. </p><pre class="fragment">$ ./signmsg --msg="test0" --sigrl=data\groupa\sigrl.bin
+$ ./verifysig --msg="test0" --sigrl=sigrl.bin
+verifysig: signature verification failed: bad arguments
+</pre><h2><a class="anchor" id="SignVerifyTutorial_basenames"></a>
+Basenames</h2>
+<p>For a verifier to be able to know that multiple signatures were generated by the same member, the verifier has to use the same basename that the member used for each name based signature. For more information, refer to <a class="el" href="Basenames.html">In-Depth Explanation of Basenames</a>.</p>
+<p>If a basename is not provided to the member, then the member uses a random basename and the signature generated by the member is anonymous.</p>
+<p>If a basename is not provided to the verifier, then the verifier does not check for a basename and it will verify the signature successfully without linking it to other signatures.</p>
<p>To sign message "test0" with a basename "base0": </p><pre class="fragment">$ ./signmsg --msg="test0" --bsn="base0"
</pre><p>To verify the signature: </p><pre class="fragment">$ ./verifysig --msg="test0" --bsn="base0"
verifysig: signature verified successfully
-</pre><p>To validate a signature, you need to use the same message for signing and verification. The mechanism for ensuring that the member and verifier use the same message is outside the scope of the SDK.</p>
-<p>Member and verifier must also use the same hash algorithm and basename, if applicable.</p>
-<h1><a class="anchor" id="SignVerifyTutorial_VerificationFailures"></a>
-Expected Failures</h1>
-<p>The signature verification process fails if there is a parameter mismatch between sign and verify operations. Here are some examples.</p>
-<p>Verification fails if there is a mismatch in the message: </p><pre class="fragment">$ ./signmsg --msg="test0"
-$ ./verifysig --msg="test1"
-verifysig: signature verification failed: invalid signature
-</pre><p>Verification fails if there is a mismatch in the basename: </p><pre class="fragment">$ ./signmsg --msg="test0" --bsn="base0"
+</pre><p>Verification fails if the signing and verification operations use different basenames: </p><pre class="fragment">$ ./signmsg --msg="test0" --bsn="base0"
$ ./verifysig --msg="test0" --bsn="base1"
verifysig: signature verification failed: invalid signature
-</pre><p>The Intel&reg; EPID SDK supports the following hash algorithms: SHA-256, SHA-384, SHA-512. The selected hash algorithm must be the same for both sign and verify. Mismatch in hash algorithm results in verification failure: </p><pre class="fragment">$ ./signmsg --msg="test0" --hashalg=SHA-256
-$ ./verifysig --msg="test0" --hashalg=SHA-384
-verifysig: signature verification failed: invalid signature
-</pre><h1><a class="anchor" id="SignVerifyTutorial_Revocation_Group"></a>
+</pre><dl class="section warning"><dt>Warning</dt><dd>The use of a name-based signature creates a platform unique pseudonymous identifier. Because it reduces the member's privacy, the user should be notified when it is used and should have control over its use.</dd></dl>
+<h1><a class="anchor" id="SignVerifyTutorial_Revocation_Group"></a>
Revocation</h1>
<p>Revocation lists are data structures used by the verifier to identify members that are no longer approved members of the group.</p>
<p>The verifier obtains the member private key based revocation list (PrivRL), signature based revocation list (SigRL), and group based revocation list (GroupRL) from the issuer. The verifier can also maintain its own verifier blacklist (VerifierRL).</p>
@@ -231,7 +302,7 @@ verifysig: signature verification failed: signature revoked in SigRl
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/SignmsgWalkthru.html b/doc/html/UserManual_GeneratingAnIntelEpidSignature.html
index f41b6bd..7ea42f4 100644
--- a/doc/html/SignmsgWalkthru.html
+++ b/doc/html/UserManual_GeneratingAnIntelEpidSignature.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -53,7 +53,7 @@
</div>
</div>
<script type="text/javascript">
-$(document).ready(function(){initNavTree('SignmsgWalkthru.html','');});
+$(document).ready(function(){initNavTree('UserManual_GeneratingAnIntelEpidSignature.html','');});
</script>
<div id="doc-content">
<div class="header">
@@ -61,17 +61,27 @@ $(document).ready(function(){initNavTree('SignmsgWalkthru.html','');});
<div class="title">Generating an Intel&reg; EPID Signature </div> </div>
</div><!--header-->
<div class="contents">
-<div class="textblock"><p>This walkthrough of the signmsg example shows you how to use SDK APIs to generate an Intel&reg; EPID signature. Signmsg is built during the <a class="el" href="BuildingSdk.html">SDK build</a>.</p>
+<div class="textblock"><p>This walkthrough of the <code>signmsg</code> example shows you how to use SDK APIs to generate an Intel&reg; EPID signature. <code>signmsg</code> is built during the <a class="el" href="BuildingSdk.html">SDK build</a>.</p>
+<h1><a class="anchor" id="signmsgWalktrhu_overview"></a>
+Summary</h1>
+<p>In the code example below, we take this approach:</p>
+<ul>
+<li>Extract and authenticate issuer provided material</li>
+<li>Create the member context to allow us to call other member APIs</li>
+<li>Generate the signature</li>
+<li>Clean up</li>
+</ul>
+<h1><a class="anchor" id="signmsgWalkthru_"></a>
+Signmsg Walkthrough</h1>
<p><br />
</p>
<p>First, we include headers so we have access to needed declarations.</p>
-<p><div class="fragment"><div class="line"><span class="preprocessor">#include &lt;stdlib.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;string.h&gt;</span></div><div class="line"><span class="preprocessor">#include &quot;src/signmsg.h&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;src/prng.h&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;util/envutil.h&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;util/stdtypes.h&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;util/buffutil.h&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="member_2api_8h.html">epid/member/api.h</a>&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="file__parser_8h.html">epid/common/file_parser.h</a>&quot;</span></div></div><!-- fragment --></p>
+<p><div class="fragment"><div class="line"><span class="preprocessor">#include &lt;stdlib.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;string.h&gt;</span></div><div class="line"><span class="preprocessor">#include &quot;src/signmsg.h&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;src/prng.h&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="member_2api_8h.html">epid/member/api.h</a>&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="file__parser_8h.html">epid/common/file_parser.h</a>&quot;</span></div></div><!-- fragment --></p>
<p>The <code>prng.h</code> header provides access to a pseudo-random number generator needed for signing, while the utility headers are used by <code>signmsg</code> for logging and buffer management. The <code><a class="el" href="member_2api_8h.html" title="Intel(R) EPID SDK member API. ">epid/member/api.h</a></code> header provides access to the core member APIs. The <code><a class="el" href="file__parser_8h.html" title="Epid issuer material parsing utilities. ">epid/common/file_parser.h</a></code> header provides an API for parsing buffers formatted according to the various IoT Intel&reg; EPID binary file formats.</p>
<p><br />
</p>
<p>We define a stub function responsible for checking that the CA certificate is authorized by the root CA.</p>
-<p><div class="fragment"><div class="line"><span class="keywordtype">bool</span> IsCaCertAuthorizedByRootCa(<span class="keywordtype">void</span> <span class="keyword">const</span>* data, <span class="keywordtype">size_t</span> size) {</div><div class="line"> (void)data;</div><div class="line"> (void)size;</div><div class="line"> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line">}</div></div><!-- fragment --></p>
-<p><code>IsCaCertAuthorizedByRootCa</code> is called from <code>main.c</code> to validate the CA certificate before calling <code>SignMsg</code>. In an actual implementation, you need to provide an implementation to validate the issuing CA certificate with the CA root certificate before using it in parse functions.</p>
+<p>In <code>main.c</code>, we define a stub function, IsCaCertAuthorizedByRootCa, which is responsible for checking that the CA certificate is authorized by the root CA. Before calling <code>signmsg</code>, we call this function, IsCaCertAuthorizedByRootCa. In an actual implementation, you need to provide an implementation to validate the issuing CA certificate with the CA root certificate before using it in parse functions.</p>
<p><br />
</p>
<p>The core signing functionality is contained in <code>SignMsg</code>.</p>
@@ -95,19 +105,6 @@ $(document).ready(function(){initNavTree('SignmsgWalkthru.html','');});
<p><a class="el" href="group___file_parser.html#ga43fdbc1bf2edd3695d21cb457365afbb" title="Extracts group public key from buffer in issuer binary format. ">EpidParseGroupPubKeyFile</a> takes a buffer containing a group public key in issuer binary format and validates that the public key is signed by the private key that corresponds to the provided CA certificate, extracting the key in the process.</p>
<p><br />
</p>
-<p>We authenticate and extract the signed SigRL using <a class="el" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f" title="Extracts signature revocation list from buffer in issuer binary format. ">EpidParseSigRlFile</a>.</p>
-<p><div class="fragment"><div class="line"> <span class="keywordflow">if</span> (signed_sig_rl) {</div><div class="line"> <span class="comment">// authenticate and determine space needed for SigRl</span></div><div class="line"> sts = <a class="code" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f">EpidParseSigRlFile</a>(signed_sig_rl, signed_sig_rl_size, cacert, NULL,</div><div class="line"> &amp;sig_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8">kEpidSigInvalid</a> == sts) {</div><div class="line"> <span class="comment">// authentication failure</span></div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != sts) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> sig_rl = AllocBuffer(sig_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (!sig_rl) {</div><div class="line"> sts = <a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a11a4d2f1c37064eb663de08dc57bcda8">kEpidMemAllocErr</a>;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// fill the SigRl</span></div><div class="line"> sts = <a class="code" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f">EpidParseSigRlFile</a>(signed_sig_rl, signed_sig_rl_size, cacert,</div><div class="line"> sig_rl, &amp;sig_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8">kEpidSigInvalid</a> == sts) {</div><div class="line"> <span class="comment">// authentication failure</span></div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != sts) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> } <span class="comment">// if (signed_sig_rl)</span></div></div><!-- fragment --></p>
-<p>We use <a class="el" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f" title="Extracts signature revocation list from buffer in issuer binary format. ">EpidParseSigRlFile</a> to:</p>
-<ul>
-<li>extract the signature based revocation list</li>
-<li>validate that the revocation list was signed by the private key corresponding to the provided CA certificate</li>
-<li>validate that the size of the input buffer is correct</li>
-<li>determine the required size of the revocation list output buffer</li>
-</ul>
-<p>To determine the required <code>sig_rl</code> output buffer size, we provide a null pointer for the output buffer when calling <a class="el" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f" title="Extracts signature revocation list from buffer in issuer binary format. ">EpidParseSigRlFile</a>. This updates <code>sig_rl_size</code> with the required size of the output buffer.</p>
-<p>After we find out the required size of the <code>sig_rl</code>, we allocate a buffer for the <code>sig_rl</code>. Then we fill the buffer using <a class="el" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f" title="Extracts signature revocation list from buffer in issuer binary format. ">EpidParseSigRlFile</a>.</p>
-<p><br />
-</p>
<p>Next, we fill the member private key.</p>
<p><div class="fragment"><div class="line"> <span class="keywordflow">if</span> (privkey_size == <span class="keyword">sizeof</span>(<a class="code" href="struct_priv_key.html">PrivKey</a>)) {</div><div class="line"> priv_key = *(<a class="code" href="struct_priv_key.html">PrivKey</a>*)priv_key_ptr;</div><div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (privkey_size == <span class="keyword">sizeof</span>(<a class="code" href="struct_compressed_priv_key.html">CompressedPrivKey</a>)) {</div><div class="line"> sts = <a class="code" href="group___epid_member_module.html#gaf8cd05388f017486f14da2ee48d067ef">EpidDecompressPrivKey</a>(&amp;pub_key, (<a class="code" href="struct_compressed_priv_key.html">CompressedPrivKey</a>*)priv_key_ptr,</div><div class="line"> &amp;priv_key);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != sts) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> } <span class="keywordflow">else</span> {</div><div class="line"> sts = <a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aa08f0d2e394b37694117a6a32bc71e6e">kEpidErr</a>;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> } <span class="comment">// if (privkey_size == sizeof(PrivKey))</span></div></div><!-- fragment --></p>
<p>If the member private key is compressed, then we decompress it using <a class="el" href="group___epid_member_module.html#gaf8cd05388f017486f14da2ee48d067ef" title="Decompresses compressed member private key. ">EpidDecompressPrivKey</a> before it can be passed to the member APIs. To determine if the member private key is compressed, we check if it is the known size of a compressed key.</p>
@@ -124,8 +121,8 @@ $(document).ready(function(){initNavTree('SignmsgWalkthru.html','');});
<p>If a pre-computation blob is provided to the top level application, we use it. Otherwise, we pass in <code>NULL</code>.</p>
<p><br />
</p>
-<p>We serialize pre-computed member data using <a class="el" href="group___epid_member_module.html#ga5c35798d62cf81c4ca62b22c38809721" title="Serializes the pre-computed member settings. ">EpidMemberWritePrecomp</a>.</p>
-<p><div class="fragment"><div class="line"> sts = <a class="code" href="group___epid_member_module.html#ga5c35798d62cf81c4ca62b22c38809721">EpidMemberWritePrecomp</a>(member, member_precomp);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != sts) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div></div><!-- fragment --></p>
+<p>Next, we serialize pre-computed member data using <a class="el" href="group___epid_member_module.html#ga5c35798d62cf81c4ca62b22c38809721" title="Serializes the pre-computed member settings. ">EpidMemberWritePrecomp</a>.</p>
+<p><div class="fragment"><div class="line"> <span class="keywordflow">if</span> (!member_precomp_is_input &amp;&amp; member_precomp) {</div><div class="line"> <span class="comment">// return member pre-computation blob if requested</span></div><div class="line"> sts = <a class="code" href="group___epid_member_module.html#ga5c35798d62cf81c4ca62b22c38809721">EpidMemberWritePrecomp</a>(member, member_precomp);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != sts) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div></div><!-- fragment --></p>
<p>The serialized member pre-computation blob can be used to greatly increase performance of <a class="el" href="group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb" title="Creates a new member context. ">EpidMemberCreate</a> in future sessions if the same member private key is used.</p>
<p><br />
</p>
@@ -135,14 +132,28 @@ $(document).ready(function(){initNavTree('SignmsgWalkthru.html','');});
<dl class="section warning"><dt>Warning</dt><dd>The use of a name-based signature creates a platform unique pseudonymous identifier. Because it reduces the member's privacy, the user should be notified when it is used and should have control over its use.</dd></dl>
<p><br />
</p>
+<p>We authenticate and extract the signed SigRL using <a class="el" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f" title="Extracts signature revocation list from buffer in issuer binary format. ">EpidParseSigRlFile</a>.</p>
+<p><div class="fragment"><div class="line"> <span class="keywordflow">if</span> (signed_sig_rl) {</div><div class="line"> <span class="comment">// authenticate and determine space needed for SigRl</span></div><div class="line"> sts = <a class="code" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f">EpidParseSigRlFile</a>(signed_sig_rl, signed_sig_rl_size, cacert, NULL,</div><div class="line"> &amp;sig_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8">kEpidSigInvalid</a> == sts) {</div><div class="line"> <span class="comment">// authentication failure</span></div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != sts) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> sig_rl = calloc(1, sig_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (!sig_rl) {</div><div class="line"> sts = <a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a11a4d2f1c37064eb663de08dc57bcda8">kEpidMemAllocErr</a>;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// fill the SigRl</span></div><div class="line"> sts = <a class="code" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f">EpidParseSigRlFile</a>(signed_sig_rl, signed_sig_rl_size, cacert,</div><div class="line"> sig_rl, &amp;sig_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8">kEpidSigInvalid</a> == sts) {</div><div class="line"> <span class="comment">// authentication failure</span></div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != sts) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> sts = <a class="code" href="group___epid_member_module.html#gaaae6f21f58c22fce58076f10d68159f4">EpidMemberSetSigRl</a>(member, sig_rl, sig_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != sts) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> } <span class="comment">// if (signed_sig_rl)</span></div></div><!-- fragment --></p>
+<p>We use <a class="el" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f" title="Extracts signature revocation list from buffer in issuer binary format. ">EpidParseSigRlFile</a> to:</p>
+<ul>
+<li>extract the signature based revocation list</li>
+<li>validate that the revocation list was signed by the private key corresponding to the provided CA certificate</li>
+<li>validate that the size of the input buffer is correct</li>
+<li>determine the required size of the revocation list output buffer</li>
+</ul>
+<p>To determine the required <code>sig_rl</code> output buffer size, we provide a null pointer for the output buffer when calling <a class="el" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f" title="Extracts signature revocation list from buffer in issuer binary format. ">EpidParseSigRlFile</a>. This updates <code>sig_rl_size</code> with the required size of the output buffer.</p>
+<p>After we find out the required size of the <code>sig_rl</code>, we allocate a buffer for the <code>sig_rl</code>. Then we fill the buffer using <a class="el" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f" title="Extracts signature revocation list from buffer in issuer binary format. ">EpidParseSigRlFile</a>.</p>
+<p>After we extracted the signature based revocation list we should assign it to the member context using <a class="el" href="group___epid_member_module.html#gaaae6f21f58c22fce58076f10d68159f4" title="Sets the signature based revocation list to be used by a member. ">EpidMemberSetSigRl</a>.</p>
+<p><br />
+</p>
<p>Then we set the hash algorithm to be used by the member using <a class="el" href="group___epid_member_module.html#ga9998eb454838ff5d232ff22ecbab31bf" title="Sets the hash algorithm to be used by a member. ">EpidMemberSetHashAlg</a>.</p>
<p><div class="fragment"><div class="line"> sts = <a class="code" href="group___epid_member_module.html#ga9998eb454838ff5d232ff22ecbab31bf">EpidMemberSetHashAlg</a>(member, hash_alg);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != sts) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div></div><!-- fragment --></p>
<p>After the hash algorithm is set, future calls to <code>EpidSign</code> will use the same algorithm.</p>
<p><br />
</p>
<p>Next, we sign the message, generating an Intel&reg; EPID signature.</p>
-<p><div class="fragment"><div class="line"> *sig_len = <a class="code" href="group___epid_member_module.html#ga76e535722467af7c16809b5b521e0000">EpidGetSigSize</a>(sig_rl);</div><div class="line"></div><div class="line"> *sig = AllocBuffer(*sig_len);</div><div class="line"> <span class="keywordflow">if</span> (!*sig) {</div><div class="line"> sts = <a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a11a4d2f1c37064eb663de08dc57bcda8">kEpidMemAllocErr</a>;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// sign message</span></div><div class="line"> sts = <a class="code" href="group___epid_member_module.html#ga759155a719254f734157722716dac640">EpidSign</a>(member, msg, msg_len, basename, basename_len, sig_rl,</div><div class="line"> sig_rl_size, *sig, *sig_len);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != sts) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div></div><!-- fragment --></p>
-<p>To create a signature, first we find out the required size of the signature using <a class="el" href="group___epid_member_module.html#ga76e535722467af7c16809b5b521e0000" title="Computes the size in bytes required for an Intel(R) EPID signature. ">EpidGetSigSize</a>. Then we allocate a buffer for the signature and fill the buffer using <a class="el" href="group___epid_member_module.html#ga759155a719254f734157722716dac640" title="Writes an Intel(R) EPID signature. ">EpidSign</a>.</p>
+<p><div class="fragment"><div class="line"> *sig_len = <a class="code" href="group___epid_member_module.html#ga76e535722467af7c16809b5b521e0000">EpidGetSigSize</a>(sig_rl);</div><div class="line"></div><div class="line"> *sig = calloc(1, *sig_len);</div><div class="line"> <span class="keywordflow">if</span> (!*sig) {</div><div class="line"> sts = <a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a11a4d2f1c37064eb663de08dc57bcda8">kEpidMemAllocErr</a>;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// sign message</span></div><div class="line"> sts =</div><div class="line"> <a class="code" href="group___epid_member_module.html#ga74d1409a816cb52633564b793072da5f">EpidSign</a>(member, msg, msg_len, basename, basename_len, *sig, *sig_len);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != sts) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div></div><!-- fragment --></p>
+<p>To create a signature, first we find out the required size of the signature using <a class="el" href="group___epid_member_module.html#ga76e535722467af7c16809b5b521e0000" title="Computes the size in bytes required for an Intel(R) EPID signature. ">EpidGetSigSize</a>. Then we allocate a buffer for the signature and fill the buffer using <a class="el" href="group___epid_member_module.html#ga74d1409a816cb52633564b793072da5f" title="Writes an Intel(R) EPID signature. ">EpidSign</a>.</p>
<p>It is important to compute signature size after loading <code>sig_rl</code> because the signature size varies with the size of the SigRL.</p>
<p><br />
</p>
@@ -162,7 +173,7 @@ $(document).ready(function(){initNavTree('SignmsgWalkthru.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/VerifysigWalkthru.html b/doc/html/UserManual_VerifyingAnIntelEpidSignature.html
index c66ada5..da840a4 100644
--- a/doc/html/VerifysigWalkthru.html
+++ b/doc/html/UserManual_VerifyingAnIntelEpidSignature.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -53,7 +53,7 @@
</div>
</div>
<script type="text/javascript">
-$(document).ready(function(){initNavTree('VerifysigWalkthru.html','');});
+$(document).ready(function(){initNavTree('UserManual_VerifyingAnIntelEpidSignature.html','');});
</script>
<div id="doc-content">
<div class="header">
@@ -61,22 +61,33 @@ $(document).ready(function(){initNavTree('VerifysigWalkthru.html','');});
<div class="title">Verifying an Intel&reg; EPID Signature </div> </div>
</div><!--header-->
<div class="contents">
-<div class="textblock"><p>This walkthrough of the <code>verifysig</code> example shows you how to use SDK APIs to verify an Intel&reg; EPID 2.0 signature. Verifysig is built during the <a class="el" href="BuildingSdk.html">SDK build</a>.</p>
+<div class="textblock"><p>This walkthrough of the <code>verifysig</code> example shows you how to use SDK APIs to verify an Intel&reg; EPID 2.0 signature. <code>verifysig</code> is built during the <a class="el" href="BuildingSdk.html">SDK build</a>.</p>
<p>To verify an Intel&reg; EPID 1.1 signature see the example code in <code>verifysig11.c</code>. For information on Intel&reg; EPID 1.1 speciifc APIs see <a href="group___epid11_verifier_module.html"><b>EPID 1.1 support</b></a>.</p>
<p><br />
</p>
+<h1><a class="anchor" id="verifysigWalktrhu_overview"></a>
+Summary</h1>
+<p>In the code example below, we take this approach:</p>
+<ul>
+<li>Extract and authenticate issuer provided material</li>
+<li>Create the verifier context to allow us to call other verifier APIs</li>
+<li>Verify signature</li>
+<li>Clean up</li>
+</ul>
+<p><br />
+</p>
+<h1><a class="anchor" id="verifysigWalkthrough_main"></a>
+Verifysig Walkthrough</h1>
<p>First, we include headers so we have access to needed declarations.</p>
-<p><div class="fragment"><div class="line"><span class="preprocessor">#include &quot;src/verifysig.h&quot;</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &lt;stdlib.h&gt;</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &quot;util/buffutil.h&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;util/envutil.h&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="verifier_2api_8h.html">epid/verifier/api.h</a>&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="file__parser_8h.html">epid/common/file_parser.h</a>&quot;</span></div></div><!-- fragment --></p>
+<p><div class="fragment"><div class="line"><span class="preprocessor">#include &quot;src/verifysig.h&quot;</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &lt;stdlib.h&gt;</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="verifier_2api_8h.html">epid/verifier/api.h</a>&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="file__parser_8h.html">epid/common/file_parser.h</a>&quot;</span></div></div><!-- fragment --></p>
<p>The utility headers are used by <code>verifysig</code> for logging and buffer management. The <code><a class="el" href="verifier_2api_8h.html" title="Intel(R) EPID SDK verifier API. ">epid/verifier/api.h</a></code> header provides access to the core verifier APIs, and the <code><a class="el" href="file__parser_8h.html" title="Epid issuer material parsing utilities. ">epid/common/file_parser.h</a></code> header provides an API for parsing buffers formatted according to the various IoT Intel&reg; EPID binary file formats.</p>
<p><br />
</p>
-<p>We define a stub function responsible for checking that the CA certificate is authorized by the root CA.</p>
-<p><div class="fragment"><div class="line"><span class="keywordtype">bool</span> IsCaCertAuthorizedByRootCa(<span class="keywordtype">void</span> <span class="keyword">const</span>* data, <span class="keywordtype">size_t</span> size) {</div><div class="line"> (void)data;</div><div class="line"> (void)size;</div><div class="line"> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line">}</div></div><!-- fragment --></p>
-<p>IsCaCertAuthorizedByRootCa is called from <code>main.c</code> to validate the CA certificate before calling <code>Verify</code>. In an actual implementation, you need to provide an implementation to validate the issuing CA certificate with the CA root certificate before using it in parse functions.</p>
+<p>In <code>main.c</code>, we define a stub function, IsCaCertAuthorizedByRootCa, which is responsible for checking that the CA certificate is authorized by the root CA. Before calling <code>verify</code>, we call this function, IsCaCertAuthorizedByRootCa. In an actual implementation, you need to provide an implementation to validate the issuing CA certificate with the CA root certificate before using it in parse functions.</p>
<p><br />
</p>
<p>We use <code>Verify</code> to verify an Intel&reg; EPID signature. <code>Verify</code> is a wrapper function that isolates SDK API functionality for the purpose of this walkthrough.</p>
-<p><div class="fragment"><div class="line"><a class="code" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> Verify(<a class="code" href="struct_epid_signature.html">EpidSignature</a> <span class="keyword">const</span>* sig, <span class="keywordtype">size_t</span> sig_len, <span class="keywordtype">void</span> <span class="keyword">const</span>* msg,</div><div class="line"> <span class="keywordtype">size_t</span> msg_len, <span class="keywordtype">void</span> <span class="keyword">const</span>* basename, <span class="keywordtype">size_t</span> basename_len,</div><div class="line"> <span class="keywordtype">void</span> <span class="keyword">const</span>* signed_priv_rl, <span class="keywordtype">size_t</span> signed_priv_rl_size,</div><div class="line"> <span class="keywordtype">void</span> <span class="keyword">const</span>* signed_sig_rl, <span class="keywordtype">size_t</span> signed_sig_rl_size,</div><div class="line"> <span class="keywordtype">void</span> <span class="keyword">const</span>* signed_grp_rl, <span class="keywordtype">size_t</span> signed_grp_rl_size,</div><div class="line"> <a class="code" href="struct_verifier_rl.html">VerifierRl</a> <span class="keyword">const</span>* ver_rl, <span class="keywordtype">size_t</span> ver_rl_size,</div><div class="line"> <span class="keywordtype">void</span> <span class="keyword">const</span>* signed_pub_key, <span class="keywordtype">size_t</span> signed_pub_key_size,</div><div class="line"> <a class="code" href="struct_epid_ca_certificate.html">EpidCaCertificate</a> <span class="keyword">const</span>* cacert, <a class="code" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890">HashAlg</a> hash_alg,</div><div class="line"> <a class="code" href="struct_verifier_precomp.html">VerifierPrecomp</a>* verifier_precomp,</div><div class="line"> <span class="keywordtype">bool</span> verifier_precomp_is_input) {</div></div><!-- fragment --></p>
+<p><div class="fragment"><div class="line"><a class="code" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> Verify(<a class="code" href="struct_epid_signature.html">EpidSignature</a> <span class="keyword">const</span>* sig, <span class="keywordtype">size_t</span> sig_len, <span class="keywordtype">void</span> <span class="keyword">const</span>* msg,</div><div class="line"> <span class="keywordtype">size_t</span> msg_len, <span class="keywordtype">void</span> <span class="keyword">const</span>* basename, <span class="keywordtype">size_t</span> basename_len,</div><div class="line"> <span class="keywordtype">void</span> <span class="keyword">const</span>* signed_priv_rl, <span class="keywordtype">size_t</span> signed_priv_rl_size,</div><div class="line"> <span class="keywordtype">void</span> <span class="keyword">const</span>* signed_sig_rl, <span class="keywordtype">size_t</span> signed_sig_rl_size,</div><div class="line"> <span class="keywordtype">void</span> <span class="keyword">const</span>* signed_grp_rl, <span class="keywordtype">size_t</span> signed_grp_rl_size,</div><div class="line"> <a class="code" href="struct_verifier_rl.html">VerifierRl</a> <span class="keyword">const</span>* ver_rl, <span class="keywordtype">size_t</span> ver_rl_size,</div><div class="line"> <span class="keywordtype">void</span> <span class="keyword">const</span>* signed_pub_key, <span class="keywordtype">size_t</span> signed_pub_key_size,</div><div class="line"> <a class="code" href="struct_epid_ca_certificate.html">EpidCaCertificate</a> <span class="keyword">const</span>* cacert, <a class="code" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890">HashAlg</a> hash_alg,</div><div class="line"> <span class="keywordtype">void</span>** verifier_precomp, <span class="keywordtype">size_t</span>* verifier_precomp_size) {</div></div><!-- fragment --></p>
<p>The <code>Verify</code> parameters were either sent by the verifier to the member, or they were part of the member's configuration. The exceptions are the <code>sig</code> and <code>sig_len</code> parameters, which we use to input the signature to be verified.</p>
<p>The verifier might send the message to the member or there may be another mechanism to choose the message, but the way the message is communicated is outside the scope of the Intel&reg; EPID scheme.</p>
<p>We use the parameters <code>verifier_precomp</code> and <code>verifier_precomp_is_input</code> to pass in a pre-computation blob if provided. We can use the pre-computation blob to increase performance when verifying signatures repeatedly with the same group public key.</p>
@@ -92,15 +103,17 @@ $(document).ready(function(){initNavTree('VerifysigWalkthru.html','');});
<p>Next, we authenticate and extract the group public key using <a class="el" href="group___file_parser.html#ga43fdbc1bf2edd3695d21cb457365afbb" title="Extracts group public key from buffer in issuer binary format. ">EpidParseGroupPubKeyFile</a>.</p>
<p><div class="fragment"><div class="line"> result = <a class="code" href="group___file_parser.html#ga43fdbc1bf2edd3695d21cb457365afbb">EpidParseGroupPubKeyFile</a>(signed_pub_key, signed_pub_key_size,</div><div class="line"> cacert, &amp;pub_key);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div></div><!-- fragment --></p>
<p><a class="el" href="group___file_parser.html#ga43fdbc1bf2edd3695d21cb457365afbb" title="Extracts group public key from buffer in issuer binary format. ">EpidParseGroupPubKeyFile</a> takes a buffer containing a group public key in issuer binary format and validates that the public key is signed by the private key that corresponds to the provided CA certificate, reading the key into <code>pub_key</code> in the process.</p>
+<p>Next, if a pre-computation blob is being used, we make sure that it is not in a legacy format.</p>
+<p><div class="fragment"><div class="line"> <span class="keywordflow">if</span> (*verifier_precomp &amp;&amp;</div><div class="line"> *verifier_precomp_size != <span class="keyword">sizeof</span>(<a class="code" href="struct_verifier_precomp.html">VerifierPrecomp</a>)) {</div><div class="line"> result = <a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ad134d6cc95a9dcb1b1a9f9c358047cbf">kEpidBadArgErr</a>;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> *verifier_precomp_size = <span class="keyword">sizeof</span>(<a class="code" href="struct_verifier_precomp.html">VerifierPrecomp</a>);</div></div><!-- fragment --></p>
<p><br />
</p>
<p>Next, we create a verifier context using <a class="el" href="group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70" title="Creates a new verifier context. ">EpidVerifierCreate</a>.</p>
-<p><div class="fragment"><div class="line"> result = <a class="code" href="group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70">EpidVerifierCreate</a>(</div><div class="line"> &amp;pub_key, verifier_precomp_is_input ? verifier_precomp : NULL, &amp;ctx);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div></div><!-- fragment --></p>
+<p><div class="fragment"><div class="line"> result = <a class="code" href="group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70">EpidVerifierCreate</a>(&amp;pub_key, *verifier_precomp, &amp;ctx);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div></div><!-- fragment --></p>
<p>If a pre-computation blob is provided to the top level application, we use it. Otherwise, we pass in <code>NULL</code>.</p>
<p><br />
</p>
<p>Then we serialize pre-computed verifier data using <a class="el" href="group___epid_verifier_module.html#ga92df4d00ea4ee59d7bfd35b23da03392" title="Serializes the pre-computed verifier settings. ">EpidVerifierWritePrecomp</a>.</p>
-<p><div class="fragment"><div class="line"> result = <a class="code" href="group___epid_verifier_module.html#ga92df4d00ea4ee59d7bfd35b23da03392">EpidVerifierWritePrecomp</a>(ctx, verifier_precomp);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div></div><!-- fragment --></p>
+<p><div class="fragment"><div class="line"> <span class="keywordflow">if</span> (!*verifier_precomp) {</div><div class="line"> *verifier_precomp = calloc(1, *verifier_precomp_size);</div><div class="line"> }</div><div class="line"> result = <a class="code" href="group___epid_verifier_module.html#ga92df4d00ea4ee59d7bfd35b23da03392">EpidVerifierWritePrecomp</a>(ctx, *verifier_precomp);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div></div><!-- fragment --></p>
<p>The serialized verifier pre-computation blob can be used to greatly increase performance of <a class="el" href="group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70" title="Creates a new verifier context. ">EpidVerifierCreate</a> in future sessions if the same group public key is used.</p>
<p><br />
</p>
@@ -118,11 +131,11 @@ $(document).ready(function(){initNavTree('VerifysigWalkthru.html','');});
<dl class="section note"><dt>Note</dt><dd>Configured revocation lists are referenced directly by the verifier until a new revocation list is set or the verifier is destroyed. Until the verifier is destroyed, we do not modify the revocation lists.</dd></dl>
<p><br />
</p>
-<p>We set the private key based revocation list using <a class="el" href="group___epid_verifier_module.html#gafab08180a43b58ce2e1d56c4b070bb0e" title="Sets the private key based revocation list. ">EpidVerifierSetPrivRl</a>.</p>
-<p><div class="fragment"><div class="line"> <span class="keywordflow">if</span> (signed_priv_rl) {</div><div class="line"> <span class="comment">// authenticate and determine space needed for RL</span></div><div class="line"> <span class="keywordtype">size_t</span> priv_rl_size = 0;</div><div class="line"> result = <a class="code" href="group___file_parser.html#gadc033fb23e3cbda56aa7e3d412060b7e">EpidParsePrivRlFile</a>(signed_priv_rl, signed_priv_rl_size, cacert,</div><div class="line"> NULL, &amp;priv_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8">kEpidSigInvalid</a> == result) {</div><div class="line"> <span class="comment">// authentication failure</span></div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> priv_rl = AllocBuffer(priv_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (!priv_rl) {</div><div class="line"> result = <a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a11a4d2f1c37064eb663de08dc57bcda8">kEpidMemAllocErr</a>;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// fill the rl</span></div><div class="line"> result = <a class="code" href="group___file_parser.html#gadc033fb23e3cbda56aa7e3d412060b7e">EpidParsePrivRlFile</a>(signed_priv_rl, signed_priv_rl_size, cacert,</div><div class="line"> priv_rl, &amp;priv_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// set private key based revocation list</span></div><div class="line"> result = <a class="code" href="group___epid_verifier_module.html#gafab08180a43b58ce2e1d56c4b070bb0e">EpidVerifierSetPrivRl</a>(ctx, priv_rl, priv_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> } <span class="comment">// if (signed_priv_rl)</span></div></div><!-- fragment --></p>
+<p>We set the private key revocation list using <a class="el" href="group___epid_verifier_module.html#gafab08180a43b58ce2e1d56c4b070bb0e" title="Sets the private key based revocation list. ">EpidVerifierSetPrivRl</a>.</p>
+<p><div class="fragment"><div class="line"> <span class="keywordflow">if</span> (signed_priv_rl) {</div><div class="line"> <span class="comment">// authenticate and determine space needed for RL</span></div><div class="line"> <span class="keywordtype">size_t</span> priv_rl_size = 0;</div><div class="line"> result = <a class="code" href="group___file_parser.html#gadc033fb23e3cbda56aa7e3d412060b7e">EpidParsePrivRlFile</a>(signed_priv_rl, signed_priv_rl_size, cacert,</div><div class="line"> NULL, &amp;priv_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> priv_rl = calloc(1, priv_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (!priv_rl) {</div><div class="line"> result = <a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a11a4d2f1c37064eb663de08dc57bcda8">kEpidMemAllocErr</a>;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// fill the rl</span></div><div class="line"> result = <a class="code" href="group___file_parser.html#gadc033fb23e3cbda56aa7e3d412060b7e">EpidParsePrivRlFile</a>(signed_priv_rl, signed_priv_rl_size, cacert,</div><div class="line"> priv_rl, &amp;priv_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// set private key based revocation list</span></div><div class="line"> result = <a class="code" href="group___epid_verifier_module.html#gafab08180a43b58ce2e1d56c4b070bb0e">EpidVerifierSetPrivRl</a>(ctx, priv_rl, priv_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> } <span class="comment">// if (signed_priv_rl)</span></div></div><!-- fragment --></p>
<p>We use <a class="el" href="group___file_parser.html#gadc033fb23e3cbda56aa7e3d412060b7e" title="Extracts private key revocation list from buffer in issuer binary format. ">EpidParsePrivRlFile</a> to:</p>
<ul>
-<li>extract the private key based revocation list</li>
+<li>extract the private key revocation list</li>
<li>validate that the revocation list was signed by the private key corresponding to the provided CA certificate</li>
<li>validate that the size of the input buffer is correct</li>
<li>determine the required size of the revocation list output buffer</li>
@@ -131,11 +144,11 @@ $(document).ready(function(){initNavTree('VerifysigWalkthru.html','');});
<p>After we find out the required size of the <code>priv_rl</code> buffer, we allocate memory for it. Then we fill the buffer using <a class="el" href="group___file_parser.html#gadc033fb23e3cbda56aa7e3d412060b7e" title="Extracts private key revocation list from buffer in issuer binary format. ">EpidParsePrivRlFile</a>.</p>
<p><br />
</p>
-<p>Next, we set the signature based revocation list using <a class="el" href="group___epid_verifier_module.html#ga4c7c9820409ee06f30bb8dc75fdd5dcf" title="Sets the signature based revocation list. ">EpidVerifierSetSigRl</a>.</p>
-<p><div class="fragment"><div class="line"> <span class="keywordflow">if</span> (signed_sig_rl) {</div><div class="line"> <span class="comment">// authenticate and determine space needed for RL</span></div><div class="line"> <span class="keywordtype">size_t</span> sig_rl_size = 0;</div><div class="line"> result = <a class="code" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f">EpidParseSigRlFile</a>(signed_sig_rl, signed_sig_rl_size, cacert,</div><div class="line"> NULL, &amp;sig_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8">kEpidSigInvalid</a> == result) {</div><div class="line"> <span class="comment">// authentication failure</span></div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> sig_rl = AllocBuffer(sig_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (!sig_rl) {</div><div class="line"> result = <a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a11a4d2f1c37064eb663de08dc57bcda8">kEpidMemAllocErr</a>;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// fill the rl</span></div><div class="line"> result = <a class="code" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f">EpidParseSigRlFile</a>(signed_sig_rl, signed_sig_rl_size, cacert,</div><div class="line"> sig_rl, &amp;sig_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// set signature based revocation list</span></div><div class="line"> result = <a class="code" href="group___epid_verifier_module.html#ga4c7c9820409ee06f30bb8dc75fdd5dcf">EpidVerifierSetSigRl</a>(ctx, sig_rl, sig_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> } <span class="comment">// if (signed_sig_rl)</span></div></div><!-- fragment --></p>
+<p>Next, we set the signature revocation list using <a class="el" href="group___epid_verifier_module.html#ga4c7c9820409ee06f30bb8dc75fdd5dcf" title="Sets the signature based revocation list. ">EpidVerifierSetSigRl</a>.</p>
+<p><div class="fragment"><div class="line"> <span class="keywordflow">if</span> (signed_sig_rl) {</div><div class="line"> <span class="comment">// authenticate and determine space needed for RL</span></div><div class="line"> <span class="keywordtype">size_t</span> sig_rl_size = 0;</div><div class="line"> result = <a class="code" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f">EpidParseSigRlFile</a>(signed_sig_rl, signed_sig_rl_size, cacert,</div><div class="line"> NULL, &amp;sig_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> sig_rl = calloc(1, sig_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (!sig_rl) {</div><div class="line"> result = <a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a11a4d2f1c37064eb663de08dc57bcda8">kEpidMemAllocErr</a>;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// fill the rl</span></div><div class="line"> result = <a class="code" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f">EpidParseSigRlFile</a>(signed_sig_rl, signed_sig_rl_size, cacert,</div><div class="line"> sig_rl, &amp;sig_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// set signature based revocation list</span></div><div class="line"> result = <a class="code" href="group___epid_verifier_module.html#ga4c7c9820409ee06f30bb8dc75fdd5dcf">EpidVerifierSetSigRl</a>(ctx, sig_rl, sig_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> } <span class="comment">// if (signed_sig_rl)</span></div></div><!-- fragment --></p>
<p>We use <a class="el" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f" title="Extracts signature revocation list from buffer in issuer binary format. ">EpidParseSigRlFile</a> to:</p>
<ul>
-<li>extract the signature based revocation list</li>
+<li>extract the signature revocation list</li>
<li>validate that the revocation list was signed by the private key corresponding to the provided CA certificate</li>
<li>validate that the size of the input buffer is correct</li>
<li>determine the required size of the revocation list output buffer</li>
@@ -144,11 +157,11 @@ $(document).ready(function(){initNavTree('VerifysigWalkthru.html','');});
<p>After we find out the required size of the <code>sig_rl</code> buffer, we allocate memory for it. Then we fill the buffer using <a class="el" href="group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f" title="Extracts signature revocation list from buffer in issuer binary format. ">EpidParseSigRlFile</a>.</p>
<p><br />
</p>
-<p>Next, we set the group based revocation list using <a class="el" href="group___epid_verifier_module.html#ga1d41d6ef4dabbc30ec28452edd6baffb" title="Sets the group based revocation list. ">EpidVerifierSetGroupRl</a>.</p>
-<p><div class="fragment"><div class="line"> <span class="keywordflow">if</span> (signed_grp_rl) {</div><div class="line"> <span class="comment">// authenticate and determine space needed for RL</span></div><div class="line"> <span class="keywordtype">size_t</span> grp_rl_size = 0;</div><div class="line"> result = <a class="code" href="group___file_parser.html#gad767f72dc55307b872a8b5600da3fd6f">EpidParseGroupRlFile</a>(signed_grp_rl, signed_grp_rl_size, cacert,</div><div class="line"> NULL, &amp;grp_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8">kEpidSigInvalid</a> == result) {</div><div class="line"> <span class="comment">// authentication failure</span></div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> grp_rl = AllocBuffer(grp_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (!grp_rl) {</div><div class="line"> result = <a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a11a4d2f1c37064eb663de08dc57bcda8">kEpidMemAllocErr</a>;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// fill the rl</span></div><div class="line"> result = <a class="code" href="group___file_parser.html#gad767f72dc55307b872a8b5600da3fd6f">EpidParseGroupRlFile</a>(signed_grp_rl, signed_grp_rl_size, cacert,</div><div class="line"> grp_rl, &amp;grp_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> <span class="comment">// set group revocation list</span></div><div class="line"> result = <a class="code" href="group___epid_verifier_module.html#ga1d41d6ef4dabbc30ec28452edd6baffb">EpidVerifierSetGroupRl</a>(ctx, grp_rl, grp_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> } <span class="comment">// if (signed_grp_rl)</span></div></div><!-- fragment --></p>
+<p>Next, we set the group revocation list using <a class="el" href="group___epid_verifier_module.html#ga1d41d6ef4dabbc30ec28452edd6baffb" title="Sets the group based revocation list. ">EpidVerifierSetGroupRl</a>.</p>
+<p><div class="fragment"><div class="line"> <span class="keywordflow">if</span> (signed_grp_rl) {</div><div class="line"> <span class="comment">// authenticate and determine space needed for RL</span></div><div class="line"> <span class="keywordtype">size_t</span> grp_rl_size = 0;</div><div class="line"> result = <a class="code" href="group___file_parser.html#gad767f72dc55307b872a8b5600da3fd6f">EpidParseGroupRlFile</a>(signed_grp_rl, signed_grp_rl_size, cacert,</div><div class="line"> NULL, &amp;grp_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> grp_rl = calloc(1, grp_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (!grp_rl) {</div><div class="line"> result = <a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a11a4d2f1c37064eb663de08dc57bcda8">kEpidMemAllocErr</a>;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// fill the rl</span></div><div class="line"> result = <a class="code" href="group___file_parser.html#gad767f72dc55307b872a8b5600da3fd6f">EpidParseGroupRlFile</a>(signed_grp_rl, signed_grp_rl_size, cacert,</div><div class="line"> grp_rl, &amp;grp_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> <span class="comment">// set group revocation list</span></div><div class="line"> result = <a class="code" href="group___epid_verifier_module.html#ga1d41d6ef4dabbc30ec28452edd6baffb">EpidVerifierSetGroupRl</a>(ctx, grp_rl, grp_rl_size);</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9">kEpidNoErr</a> != result) {</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> } <span class="comment">// if (signed_grp_rl)</span></div></div><!-- fragment --></p>
<p>We use <a class="el" href="group___file_parser.html#gad767f72dc55307b872a8b5600da3fd6f" title="Extracts group revocation list from buffer in issuer binary format. ">EpidParseGroupRlFile</a> to:</p>
<ul>
-<li>extract the group based revocation list</li>
+<li>extract the group revocation list</li>
<li>validate that the revocation list was signed by the private key corresponding to the provided CA certificate</li>
<li>validate that the size of the input buffer is correct</li>
<li>determine the required size of the revocation list output buffer</li>
@@ -182,7 +195,7 @@ $(document).ready(function(){initNavTree('VerifysigWalkthru.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/annotated.html b/doc/html/annotated.html
index e60838c..e4f28a2 100644
--- a/doc/html/annotated.html
+++ b/doc/html/annotated.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -101,24 +101,25 @@ $(document).ready(function(){initNavTree('annotated.html','');});
<tr id="row_35_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_member_precomp.html" target="_self">MemberPrecomp</a></td><td class="desc">Pre-computed member settings </td></tr>
<tr id="row_36_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_membership_credential.html" target="_self">MembershipCredential</a></td><td class="desc">Membership credential </td></tr>
<tr id="row_37_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_nr_proof.html" target="_self">NrProof</a></td><td class="desc">Non-revoked Proof </td></tr>
-<tr id="row_38_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str128.html" target="_self">OctStr128</a></td><td class="desc">128 bit octet string </td></tr>
-<tr id="row_39_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str16.html" target="_self">OctStr16</a></td><td class="desc">16 bit octet string </td></tr>
-<tr id="row_40_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str256.html" target="_self">OctStr256</a></td><td class="desc">256 bit octet string </td></tr>
-<tr id="row_41_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str32.html" target="_self">OctStr32</a></td><td class="desc">32 bit octet string </td></tr>
-<tr id="row_42_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str512.html" target="_self">OctStr512</a></td><td class="desc">512 bit octet string </td></tr>
-<tr id="row_43_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str600.html" target="_self">OctStr600</a></td><td class="desc">600 bit octet string </td></tr>
-<tr id="row_44_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str64.html" target="_self">OctStr64</a></td><td class="desc">64 bit octet string </td></tr>
-<tr id="row_45_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str768.html" target="_self">OctStr768</a></td><td class="desc">768 bit octet string </td></tr>
-<tr id="row_46_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str8.html" target="_self">OctStr8</a></td><td class="desc">8 bit octet string </td></tr>
-<tr id="row_47_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str80.html" target="_self">OctStr80</a></td><td class="desc">80 bit octet string </td></tr>
-<tr id="row_48_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_pre_computed_signature.html" target="_self">PreComputedSignature</a></td><td class="desc">Pre-computed signature </td></tr>
+<tr id="row_38_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_nr_prove_commit_output.html" target="_self">NrProveCommitOutput</a></td><td class="desc">Result of NrProve Commit </td></tr>
+<tr id="row_39_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str128.html" target="_self">OctStr128</a></td><td class="desc">128 bit octet string </td></tr>
+<tr id="row_40_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str16.html" target="_self">OctStr16</a></td><td class="desc">16 bit octet string </td></tr>
+<tr id="row_41_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str256.html" target="_self">OctStr256</a></td><td class="desc">256 bit octet string </td></tr>
+<tr id="row_42_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str32.html" target="_self">OctStr32</a></td><td class="desc">32 bit octet string </td></tr>
+<tr id="row_43_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str512.html" target="_self">OctStr512</a></td><td class="desc">512 bit octet string </td></tr>
+<tr id="row_44_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str600.html" target="_self">OctStr600</a></td><td class="desc">600 bit octet string </td></tr>
+<tr id="row_45_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str64.html" target="_self">OctStr64</a></td><td class="desc">64 bit octet string </td></tr>
+<tr id="row_46_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str768.html" target="_self">OctStr768</a></td><td class="desc">768 bit octet string </td></tr>
+<tr id="row_47_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str8.html" target="_self">OctStr8</a></td><td class="desc">8 bit octet string </td></tr>
+<tr id="row_48_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_oct_str80.html" target="_self">OctStr80</a></td><td class="desc">80 bit octet string </td></tr>
<tr id="row_49_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_priv_key.html" target="_self">PrivKey</a></td><td class="desc">Intel(R) EPID 2.0 private key </td></tr>
<tr id="row_50_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_priv_rl.html" target="_self">PrivRl</a></td><td class="desc">Private-key based revocation list </td></tr>
<tr id="row_51_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_sha256_digest.html" target="_self">Sha256Digest</a></td><td class="desc">SHA256 digest </td></tr>
-<tr id="row_52_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_sig_rl.html" target="_self">SigRl</a></td><td class="desc">Signature based revocation list </td></tr>
-<tr id="row_53_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_sig_rl_entry.html" target="_self">SigRlEntry</a></td><td class="desc">Entry in SigRL (B,K) </td></tr>
-<tr id="row_54_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_verifier_precomp.html" target="_self">VerifierPrecomp</a></td><td class="desc">Pre-computed verifier settings </td></tr>
-<tr id="row_55_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_verifier_rl.html" target="_self">VerifierRl</a></td><td class="desc"></td></tr>
+<tr id="row_52_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_sign_commit_output.html" target="_self">SignCommitOutput</a></td><td class="desc">Result of Sign Commit </td></tr>
+<tr id="row_53_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_sig_rl.html" target="_self">SigRl</a></td><td class="desc">Signature based revocation list </td></tr>
+<tr id="row_54_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_sig_rl_entry.html" target="_self">SigRlEntry</a></td><td class="desc">Entry in SigRL (B,K) </td></tr>
+<tr id="row_55_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_verifier_precomp.html" target="_self">VerifierPrecomp</a></td><td class="desc">Pre-computed verifier settings </td></tr>
+<tr id="row_56_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="struct_verifier_rl.html" target="_self">VerifierRl</a></td><td class="desc"></td></tr>
</table>
</div><!-- directory -->
</div><!-- contents -->
@@ -128,7 +129,7 @@ $(document).ready(function(){initNavTree('annotated.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/basenames_8dox.html b/doc/html/basenames_8dox.html
index 459857a..2ecf9e7 100644
--- a/doc/html/basenames_8dox.html
+++ b/doc/html/basenames_8dox.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('basenames_8dox.html','');});
<ul>
<li class="navelem"><a class="el" href="basenames_8dox.html">basenames.dox</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/basicdoc.png b/doc/html/basicdoc.png
index e092eb6..7464933 100644
--- a/doc/html/basicdoc.png
+++ b/doc/html/basicdoc.png
Binary files differ
diff --git a/doc/html/bignum_8h.html b/doc/html/bignum_8h.html
index da25593..f3099d4 100644
--- a/doc/html/bignum_8h.html
+++ b/doc/html/bignum_8h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -88,12 +88,12 @@ Functions</h2></td></tr>
<tr class="memitem:ga2d17600068b1d94000635c6644258a03"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___big_num_primitives.html#ga2d17600068b1d94000635c6644258a03">DeleteBigNum</a> (<a class="el" href="group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718">BigNum</a> **bignum)</td></tr>
<tr class="memdesc:ga2d17600068b1d94000635c6644258a03"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes a previously allocated BigNum. <a href="group___big_num_primitives.html#ga2d17600068b1d94000635c6644258a03">More...</a><br /></td></tr>
<tr class="separator:ga2d17600068b1d94000635c6644258a03"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga808cf477b70ed06358b11756bfe36024"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___big_num_primitives.html#ga808cf477b70ed06358b11756bfe36024">ReadBigNum</a> (void const *bn_str, size_t strlen, <a class="el" href="group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718">BigNum</a> *bn)</td></tr>
-<tr class="memdesc:ga808cf477b70ed06358b11756bfe36024"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deserializes a BigNum from a string. <a href="group___big_num_primitives.html#ga808cf477b70ed06358b11756bfe36024">More...</a><br /></td></tr>
-<tr class="separator:ga808cf477b70ed06358b11756bfe36024"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga79d86c872fe8da0f217e3ba069f98d38"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___big_num_primitives.html#ga79d86c872fe8da0f217e3ba069f98d38">WriteBigNum</a> (<a class="el" href="group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718">BigNum</a> const *bn, size_t strlen, void *bn_str)</td></tr>
-<tr class="memdesc:ga79d86c872fe8da0f217e3ba069f98d38"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serializes a BigNum to a string. <a href="group___big_num_primitives.html#ga79d86c872fe8da0f217e3ba069f98d38">More...</a><br /></td></tr>
-<tr class="separator:ga79d86c872fe8da0f217e3ba069f98d38"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gabe8e39d5788423f41770a71a4c911fbe"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___big_num_primitives.html#gabe8e39d5788423f41770a71a4c911fbe">ReadBigNum</a> (<a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a> bn_str, size_t strlen, <a class="el" href="group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718">BigNum</a> *bn)</td></tr>
+<tr class="memdesc:gabe8e39d5788423f41770a71a4c911fbe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deserializes a BigNum from a string. <a href="group___big_num_primitives.html#gabe8e39d5788423f41770a71a4c911fbe">More...</a><br /></td></tr>
+<tr class="separator:gabe8e39d5788423f41770a71a4c911fbe"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga904c16cc020e7196f22ac9abdc31b41f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___big_num_primitives.html#ga904c16cc020e7196f22ac9abdc31b41f">WriteBigNum</a> (<a class="el" href="group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718">BigNum</a> const *bn, size_t strlen, <a class="el" href="group___epid_types.html#ga3315fb24f4c5783b6d6eb107933390b0">OctStr</a> bn_str)</td></tr>
+<tr class="memdesc:ga904c16cc020e7196f22ac9abdc31b41f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serializes a BigNum to a string. <a href="group___big_num_primitives.html#ga904c16cc020e7196f22ac9abdc31b41f">More...</a><br /></td></tr>
+<tr class="separator:ga904c16cc020e7196f22ac9abdc31b41f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae70fd9b3026f0ab3c7e9601d0a3186b8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___big_num_primitives.html#gae70fd9b3026f0ab3c7e9601d0a3186b8">BigNumAdd</a> (<a class="el" href="group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718">BigNum</a> const *a, <a class="el" href="group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718">BigNum</a> const *b, <a class="el" href="group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718">BigNum</a> *r)</td></tr>
<tr class="memdesc:gae70fd9b3026f0ab3c7e9601d0a3186b8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds two BigNum values. <a href="group___big_num_primitives.html#gae70fd9b3026f0ab3c7e9601d0a3186b8">More...</a><br /></td></tr>
<tr class="separator:gae70fd9b3026f0ab3c7e9601d0a3186b8"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -129,7 +129,7 @@ Functions</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li><li class="navelem"><a class="el" href="dir_f169ebf8da29290a918fa4b3f7151050.html">math</a></li><li class="navelem"><a class="el" href="bignum_8h.html">bignum.h</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/bitsupplier_8h.html b/doc/html/bitsupplier_8h.html
index 24d6444..0e21810 100644
--- a/doc/html/bitsupplier_8h.html
+++ b/doc/html/bitsupplier_8h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -84,7 +84,7 @@ Typedefs</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li><li class="navelem"><a class="el" href="bitsupplier_8h.html">bitsupplier.h</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/build__tools__installation_8dox.html b/doc/html/build__tools__installation_8dox.html
index 52c1f0b..804dde0 100644
--- a/doc/html/build__tools__installation_8dox.html
+++ b/doc/html/build__tools__installation_8dox.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('build__tools__installation_8dox.html',
<ul>
<li class="navelem"><a class="el" href="build__tools__installation_8dox.html">build_tools_installation.dox</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/building__sdk_8dox.html b/doc/html/building__sdk_8dox.html
index 0b63f2c..6f39e23 100644
--- a/doc/html/building__sdk_8dox.html
+++ b/doc/html/building__sdk_8dox.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('building__sdk_8dox.html','');});
<ul>
<li class="navelem"><a class="el" href="building__sdk_8dox.html">building_sdk.dox</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/choosing__ikgf_8dox.html b/doc/html/choosing__ikgf_8dox.html
index d63d34a..1bf416c 100644
--- a/doc/html/choosing__ikgf_8dox.html
+++ b/doc/html/choosing__ikgf_8dox.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('choosing__ikgf_8dox.html','');});
<ul>
<li class="navelem"><a class="el" href="choosing__ikgf_8dox.html">choosing_ikgf.dox</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/classes.html b/doc/html/classes.html
index 6329f92..e7786a3 100644
--- a/doc/html/classes.html
+++ b/doc/html/classes.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -64,37 +64,36 @@ $(document).ready(function(){initNavTree('classes.html','');});
<div class="qindex"><a class="qindex" href="#letter_B">B</a>&#160;|&#160;<a class="qindex" href="#letter_C">C</a>&#160;|&#160;<a class="qindex" href="#letter_E">E</a>&#160;|&#160;<a class="qindex" href="#letter_F">F</a>&#160;|&#160;<a class="qindex" href="#letter_G">G</a>&#160;|&#160;<a class="qindex" href="#letter_I">I</a>&#160;|&#160;<a class="qindex" href="#letter_J">J</a>&#160;|&#160;<a class="qindex" href="#letter_M">M</a>&#160;|&#160;<a class="qindex" href="#letter_N">N</a>&#160;|&#160;<a class="qindex" href="#letter_O">O</a>&#160;|&#160;<a class="qindex" href="#letter_P">P</a>&#160;|&#160;<a class="qindex" href="#letter_S">S</a>&#160;|&#160;<a class="qindex" href="#letter_V">V</a></div>
<table class="classindex">
<tr><td rowspan="2" valign="bottom"><a name="letter_B"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;B&#160;&#160;</div></td></tr></table>
-</td><td valign="top"><a class="el" href="struct_epid11_nr_proof.html">Epid11NrProof</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_fq6_elem_str.html">Fq6ElemStr</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_membership_credential.html">MembershipCredential</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_priv_key.html">PrivKey</a>&#160;&#160;&#160;</td></tr>
+</td><td valign="top"><a class="el" href="struct_epid11_nr_proof.html">Epid11NrProof</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_fq6_elem_str.html">Fq6ElemStr</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_membership_credential.html">MembershipCredential</a>&#160;&#160;&#160;</td><td rowspan="2" valign="bottom"><a name="letter_P"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;P&#160;&#160;</div></td></tr></table>
+</td></tr>
<tr><td valign="top"><a class="el" href="struct_epid11_params.html">Epid11Params</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_fq_elem_str.html">FqElemStr</a>&#160;&#160;&#160;</td><td rowspan="2" valign="bottom"><a name="letter_N"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;N&#160;&#160;</div></td></tr></table>
-</td><td valign="top"><a class="el" href="struct_priv_rl.html">PrivRl</a>&#160;&#160;&#160;</td></tr>
-<tr><td valign="top"><a class="el" href="struct_basic_signature.html">BasicSignature</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_epid11_priv_rl.html">Epid11PrivRl</a>&#160;&#160;&#160;</td><td rowspan="2" valign="bottom"><a name="letter_G"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;G&#160;&#160;</div></td></tr></table>
-</td><td rowspan="2" valign="bottom"><a name="letter_S"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;S&#160;&#160;</div></td></tr></table>
</td></tr>
-<tr><td valign="top"><a class="el" href="struct_big_num_str.html">BigNumStr</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_epid11_signature.html">Epid11Signature</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_nr_proof.html">NrProof</a>&#160;&#160;&#160;</td></tr>
+<tr><td valign="top"><a class="el" href="struct_basic_signature.html">BasicSignature</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_epid11_priv_rl.html">Epid11PrivRl</a>&#160;&#160;&#160;</td><td rowspan="2" valign="bottom"><a name="letter_G"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;G&#160;&#160;</div></td></tr></table>
+</td><td valign="top"><a class="el" href="struct_priv_key.html">PrivKey</a>&#160;&#160;&#160;</td></tr>
+<tr><td valign="top"><a class="el" href="struct_big_num_str.html">BigNumStr</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_epid11_signature.html">Epid11Signature</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_nr_proof.html">NrProof</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_priv_rl.html">PrivRl</a>&#160;&#160;&#160;</td></tr>
<tr><td rowspan="2" valign="bottom"><a name="letter_C"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;C&#160;&#160;</div></td></tr></table>
-</td><td valign="top"><a class="el" href="struct_epid11_sig_rl.html">Epid11SigRl</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_g1_elem_str.html">G1ElemStr</a>&#160;&#160;&#160;</td><td rowspan="2" valign="bottom"><a name="letter_O"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;O&#160;&#160;</div></td></tr></table>
-</td><td valign="top"><a class="el" href="struct_sha256_digest.html">Sha256Digest</a>&#160;&#160;&#160;</td></tr>
-<tr><td valign="top"><a class="el" href="struct_epid11_sig_rl_entry.html">Epid11SigRlEntry</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_g2_elem_str.html">G2ElemStr</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_sig_rl.html">SigRl</a>&#160;&#160;&#160;</td></tr>
-<tr><td valign="top"><a class="el" href="struct_compressed_priv_key.html">CompressedPrivKey</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_epid11_verifier_precomp.html">Epid11VerifierPrecomp</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_group_pub_key.html">GroupPubKey</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_oct_str128.html">OctStr128</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_sig_rl_entry.html">SigRlEntry</a>&#160;&#160;&#160;</td></tr>
-<tr><td rowspan="2" valign="bottom"><a name="letter_E"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;E&#160;&#160;</div></td></tr></table>
-</td><td valign="top"><a class="el" href="struct_epid2_params.html">Epid2Params</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_group_rl.html">GroupRl</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_oct_str16.html">OctStr16</a>&#160;&#160;&#160;</td><td rowspan="2" valign="bottom"><a name="letter_V"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;V&#160;&#160;</div></td></tr></table>
+</td><td valign="top"><a class="el" href="struct_epid11_sig_rl.html">Epid11SigRl</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_g1_elem_str.html">G1ElemStr</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_nr_prove_commit_output.html">NrProveCommitOutput</a>&#160;&#160;&#160;</td><td rowspan="2" valign="bottom"><a name="letter_S"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;S&#160;&#160;</div></td></tr></table>
</td></tr>
-<tr><td valign="top"><a class="el" href="struct_epid_ca_certificate.html">EpidCaCertificate</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_gt_elem_str.html">GtElemStr</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_oct_str256.html">OctStr256</a>&#160;&#160;&#160;</td></tr>
+<tr><td valign="top"><a class="el" href="struct_epid11_sig_rl_entry.html">Epid11SigRlEntry</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_g2_elem_str.html">G2ElemStr</a>&#160;&#160;&#160;</td><td rowspan="2" valign="bottom"><a name="letter_O"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;O&#160;&#160;</div></td></tr></table>
+</td></tr>
+<tr><td valign="top"><a class="el" href="struct_compressed_priv_key.html">CompressedPrivKey</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_epid11_verifier_precomp.html">Epid11VerifierPrecomp</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_group_pub_key.html">GroupPubKey</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_sha256_digest.html">Sha256Digest</a>&#160;&#160;&#160;</td></tr>
+<tr><td rowspan="2" valign="bottom"><a name="letter_E"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;E&#160;&#160;</div></td></tr></table>
+</td><td valign="top"><a class="el" href="struct_epid2_params.html">Epid2Params</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_group_rl.html">GroupRl</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_oct_str128.html">OctStr128</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_sign_commit_output.html">SignCommitOutput</a>&#160;&#160;&#160;</td></tr>
+<tr><td valign="top"><a class="el" href="struct_epid_ca_certificate.html">EpidCaCertificate</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_gt_elem_str.html">GtElemStr</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_oct_str16.html">OctStr16</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_sig_rl.html">SigRl</a>&#160;&#160;&#160;</td></tr>
<tr><td valign="top"><a class="el" href="struct_ecdsa_private_key.html">EcdsaPrivateKey</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_epid_file_header.html">EpidFileHeader</a>&#160;&#160;&#160;</td><td rowspan="2" valign="bottom"><a name="letter_I"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;I&#160;&#160;</div></td></tr></table>
-</td><td valign="top"><a class="el" href="struct_oct_str32.html">OctStr32</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_verifier_precomp.html">VerifierPrecomp</a>&#160;&#160;&#160;</td></tr>
-<tr><td valign="top"><a class="el" href="struct_ecdsa_public_key.html">EcdsaPublicKey</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_epid_signature.html">EpidSignature</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_oct_str512.html">OctStr512</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_verifier_rl.html">VerifierRl</a>&#160;&#160;&#160;</td></tr>
+</td><td valign="top"><a class="el" href="struct_oct_str256.html">OctStr256</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_sig_rl_entry.html">SigRlEntry</a>&#160;&#160;&#160;</td></tr>
+<tr><td valign="top"><a class="el" href="struct_ecdsa_public_key.html">EcdsaPublicKey</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_epid_signature.html">EpidSignature</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_oct_str32.html">OctStr32</a>&#160;&#160;&#160;</td><td rowspan="2" valign="bottom"><a name="letter_V"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;V&#160;&#160;</div></td></tr></table>
+</td></tr>
<tr><td valign="top"><a class="el" href="struct_ecdsa_signature.html">EcdsaSignature</a>&#160;&#160;&#160;</td><td rowspan="2" valign="bottom"><a name="letter_F"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;F&#160;&#160;</div></td></tr></table>
-</td><td valign="top"><a class="el" href="struct_i_priv_key.html">IPrivKey</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_oct_str600.html">OctStr600</a>&#160;&#160;&#160;</td><td></td></tr>
+</td><td valign="top"><a class="el" href="struct_i_priv_key.html">IPrivKey</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_oct_str512.html">OctStr512</a>&#160;&#160;&#160;</td></tr>
<tr><td valign="top"><a class="el" href="struct_epid11_basic_signature.html">Epid11BasicSignature</a>&#160;&#160;&#160;</td><td rowspan="2" valign="bottom"><a name="letter_J"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;J&#160;&#160;</div></td></tr></table>
-</td><td valign="top"><a class="el" href="struct_oct_str64.html">OctStr64</a>&#160;&#160;&#160;</td><td></td></tr>
-<tr><td valign="top"><a class="el" href="struct_epid11_g2_elem_str.html">Epid11G2ElemStr</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_fp_elem_str.html">FpElemStr</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_oct_str768.html">OctStr768</a>&#160;&#160;&#160;</td><td></td></tr>
-<tr><td valign="top"><a class="el" href="struct_epid11_group_pub_key.html">Epid11GroupPubKey</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_fq12_elem_str.html">Fq12ElemStr</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_join_request.html">JoinRequest</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_oct_str8.html">OctStr8</a>&#160;&#160;&#160;</td><td></td></tr>
+</td><td valign="top"><a class="el" href="struct_oct_str600.html">OctStr600</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_verifier_precomp.html">VerifierPrecomp</a>&#160;&#160;&#160;</td></tr>
+<tr><td valign="top"><a class="el" href="struct_epid11_g2_elem_str.html">Epid11G2ElemStr</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_fp_elem_str.html">FpElemStr</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_oct_str64.html">OctStr64</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_verifier_rl.html">VerifierRl</a>&#160;&#160;&#160;</td></tr>
+<tr><td valign="top"><a class="el" href="struct_epid11_group_pub_key.html">Epid11GroupPubKey</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_fq12_elem_str.html">Fq12ElemStr</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_join_request.html">JoinRequest</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_oct_str768.html">OctStr768</a>&#160;&#160;&#160;</td><td></td></tr>
<tr><td valign="top"><a class="el" href="struct_epid11_group_rl.html">Epid11GroupRl</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_fq2_elem_str.html">Fq2ElemStr</a>&#160;&#160;&#160;</td><td rowspan="2" valign="bottom"><a name="letter_M"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;M&#160;&#160;</div></td></tr></table>
-</td><td valign="top"><a class="el" href="struct_oct_str80.html">OctStr80</a>&#160;&#160;&#160;</td><td></td></tr>
-<tr><td valign="top"><a class="el" href="struct_epid11_gt_elem_str.html">Epid11GtElemStr</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_fq3_elem_str.html">Fq3ElemStr</a>&#160;&#160;&#160;</td><td rowspan="2" valign="bottom"><a name="letter_P"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&#160;&#160;P&#160;&#160;</div></td></tr></table>
-</td><td></td></tr>
-<tr><td></td><td></td><td valign="top"><a class="el" href="struct_member_precomp.html">MemberPrecomp</a>&#160;&#160;&#160;</td><td></td></tr>
-<tr><td></td><td></td><td></td><td valign="top"><a class="el" href="struct_pre_computed_signature.html">PreComputedSignature</a>&#160;&#160;&#160;</td><td></td></tr>
+</td><td valign="top"><a class="el" href="struct_oct_str8.html">OctStr8</a>&#160;&#160;&#160;</td><td></td></tr>
+<tr><td valign="top"><a class="el" href="struct_epid11_gt_elem_str.html">Epid11GtElemStr</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_fq3_elem_str.html">Fq3ElemStr</a>&#160;&#160;&#160;</td><td valign="top"><a class="el" href="struct_oct_str80.html">OctStr80</a>&#160;&#160;&#160;</td><td></td></tr>
+<tr><td></td><td></td><td valign="top"><a class="el" href="struct_member_precomp.html">MemberPrecomp</a>&#160;&#160;&#160;</td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td><td></td></tr>
</table>
<div class="qindex"><a class="qindex" href="#letter_B">B</a>&#160;|&#160;<a class="qindex" href="#letter_C">C</a>&#160;|&#160;<a class="qindex" href="#letter_E">E</a>&#160;|&#160;<a class="qindex" href="#letter_F">F</a>&#160;|&#160;<a class="qindex" href="#letter_G">G</a>&#160;|&#160;<a class="qindex" href="#letter_I">I</a>&#160;|&#160;<a class="qindex" href="#letter_J">J</a>&#160;|&#160;<a class="qindex" href="#letter_M">M</a>&#160;|&#160;<a class="qindex" href="#letter_N">N</a>&#160;|&#160;<a class="qindex" href="#letter_O">O</a>&#160;|&#160;<a class="qindex" href="#letter_P">P</a>&#160;|&#160;<a class="qindex" href="#letter_S">S</a>&#160;|&#160;<a class="qindex" href="#letter_V">V</a></div>
@@ -105,7 +104,7 @@ $(document).ready(function(){initNavTree('classes.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/context_8h.html b/doc/html/context_8h.html
new file mode 100644
index 0000000..2b34549
--- /dev/null
+++ b/doc/html/context_8h.html
@@ -0,0 +1,102 @@
+<!-- HTML header for doxygen 1.8.10-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.11"/>
+<title>Intel&reg; Enhanced Privacy ID SDK: epid/member/tpm/context.h File Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="navtree.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="resize.js"></script>
+<script type="text/javascript" src="navtreedata.js"></script>
+<script type="text/javascript" src="navtree.js"></script>
+<script type="text/javascript">
+ $(document).ready(initResizable);
+ $(window).load(resizeHeight);
+</script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+<link href="epidstyle.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td id="projectalign" style="padding-left: 0.5em;">
+ <div id="projectname"><a
+ onclick="storeLink('index.html')"
+ id="projectlink"
+ class="index.html"
+ href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
+&#160;<span id="projectnumber">4.0.0</span>
+</div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.11 -->
+</div><!-- top -->
+<div id="side-nav" class="ui-resizable side-nav-resizable">
+ <div id="nav-tree">
+ <div id="nav-tree-contents">
+ <div id="nav-sync" class="sync"></div>
+ </div>
+ </div>
+ <div id="splitbar" style="-moz-user-select:none;"
+ class="ui-resizable-handle">
+ </div>
+</div>
+<script type="text/javascript">
+$(document).ready(function(){initNavTree('context_8h.html','');});
+</script>
+<div id="doc-content">
+<div class="header">
+ <div class="summary">
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">context.h File Reference</div> </div>
+</div><!--header-->
+<div class="contents">
+
+<p>Sensitive member context APIs.
+<a href="#details">More...</a></p>
+<div class="textblock"><code>#include &quot;<a class="el" href="errors_8h.html">epid/common/errors.h</a>&quot;</code><br />
+<code>#include &quot;<a class="el" href="bitsupplier_8h.html">epid/common/bitsupplier.h</a>&quot;</code><br />
+</div><table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr class="memitem:ga901cad19eb14a6a6a02e85f9d710d287"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287">TpmCreate</a> (<a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c">BitSupplier</a> rnd_func, void *rnd_param, Epid2Params_ const *epid2_params, TpmCtx **ctx)</td></tr>
+<tr class="memdesc:ga901cad19eb14a6a6a02e85f9d710d287"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new Tpm context. <a href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287">More...</a><br /></td></tr>
+<tr class="separator:ga901cad19eb14a6a6a02e85f9d710d287"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga95bc18225c1d87803be7965978e37449"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#ga95bc18225c1d87803be7965978e37449">TpmDelete</a> (TpmCtx **ctx)</td></tr>
+<tr class="memdesc:ga95bc18225c1d87803be7965978e37449"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes an existing Tpm context. <a href="group___tpm_module.html#ga95bc18225c1d87803be7965978e37449">More...</a><br /></td></tr>
+<tr class="separator:ga95bc18225c1d87803be7965978e37449"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga42b80d485cff39fe9ec14a0b5a81426d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#ga42b80d485cff39fe9ec14a0b5a81426d">TpmProvision</a> (TpmCtx *ctx, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *f_str)</td></tr>
+<tr class="memdesc:ga42b80d485cff39fe9ec14a0b5a81426d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Provisions Tpm with sensitive parameters. <a href="group___tpm_module.html#ga42b80d485cff39fe9ec14a0b5a81426d">More...</a><br /></td></tr>
+<tr class="separator:ga42b80d485cff39fe9ec14a0b5a81426d"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga688441f78f68aa53c41fcae4d31c6f50"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#ga688441f78f68aa53c41fcae4d31c6f50">TpmProvisionCompressed</a> (TpmCtx *ctx, <a class="el" href="struct_oct_str256.html">OctStr256</a> const *seed)</td></tr>
+<tr class="memdesc:ga688441f78f68aa53c41fcae4d31c6f50"><td class="mdescLeft">&#160;</td><td class="mdescRight">Provisions Tpm with compressed key seed. <a href="group___tpm_module.html#ga688441f78f68aa53c41fcae4d31c6f50">More...</a><br /></td></tr>
+<tr class="separator:ga688441f78f68aa53c41fcae4d31c6f50"><td class="memSeparator" colspan="2">&#160;</td></tr>
+</table>
+<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
+<div class="textblock"><p>Sensitive member context APIs. </p>
+</div></div><!-- contents -->
+</div><!-- doc-content -->
+<!-- HTML footer for doxygen 1.8.10-->
+<!-- start footer part -->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ <li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_512d3e62841a8535b716ec4cf8b9e950.html">member</a></li><li class="navelem"><a class="el" href="dir_6048dbb18cb271412de4a010207fd345.html">tpm</a></li><li class="navelem"><a class="el" href="context_8h.html">context.h</a></li>
+ <li class="footer">
+ &copy; 2016-2017 Intel Corporation
+ </li>
+ </ul>
+</div>
+</body>
+</html>
diff --git a/doc/html/decompress_8h.html b/doc/html/decompress_8h.html
new file mode 100644
index 0000000..9f5c1ca
--- /dev/null
+++ b/doc/html/decompress_8h.html
@@ -0,0 +1,92 @@
+<!-- HTML header for doxygen 1.8.10-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.11"/>
+<title>Intel&reg; Enhanced Privacy ID SDK: epid/member/tpm/decompress.h File Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="navtree.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="resize.js"></script>
+<script type="text/javascript" src="navtreedata.js"></script>
+<script type="text/javascript" src="navtree.js"></script>
+<script type="text/javascript">
+ $(document).ready(initResizable);
+ $(window).load(resizeHeight);
+</script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+<link href="epidstyle.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td id="projectalign" style="padding-left: 0.5em;">
+ <div id="projectname"><a
+ onclick="storeLink('index.html')"
+ id="projectlink"
+ class="index.html"
+ href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
+&#160;<span id="projectnumber">4.0.0</span>
+</div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.11 -->
+</div><!-- top -->
+<div id="side-nav" class="ui-resizable side-nav-resizable">
+ <div id="nav-tree">
+ <div id="nav-tree-contents">
+ <div id="nav-sync" class="sync"></div>
+ </div>
+ </div>
+ <div id="splitbar" style="-moz-user-select:none;"
+ class="ui-resizable-handle">
+ </div>
+</div>
+<script type="text/javascript">
+$(document).ready(function(){initNavTree('decompress_8h.html','');});
+</script>
+<div id="doc-content">
+<div class="header">
+ <div class="summary">
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">decompress.h File Reference</div> </div>
+</div><!--header-->
+<div class="contents">
+
+<p>TPM key decompression APIs.
+<a href="#details">More...</a></p>
+<div class="textblock"><code>#include &quot;<a class="el" href="errors_8h.html">epid/common/errors.h</a>&quot;</code><br />
+</div><table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr class="memitem:gaeb9bfaa9288263af9feccd0d0543c9bc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#gaeb9bfaa9288263af9feccd0d0543c9bc">TpmDecompressKey</a> (TpmCtx *ctx, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *h1_str, <a class="el" href="struct_g2_elem_str.html">G2ElemStr</a> const *w_str, <a class="el" href="struct_fq_elem_str.html">FqElemStr</a> const *Ax_str, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> *A_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *x_str)</td></tr>
+<tr class="memdesc:gaeb9bfaa9288263af9feccd0d0543c9bc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompresses provisioned key. <a href="group___tpm_module.html#gaeb9bfaa9288263af9feccd0d0543c9bc">More...</a><br /></td></tr>
+<tr class="separator:gaeb9bfaa9288263af9feccd0d0543c9bc"><td class="memSeparator" colspan="2">&#160;</td></tr>
+</table>
+<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
+<div class="textblock"><p>TPM key decompression APIs. </p>
+</div></div><!-- contents -->
+</div><!-- doc-content -->
+<!-- HTML footer for doxygen 1.8.10-->
+<!-- start footer part -->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ <li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_512d3e62841a8535b716ec4cf8b9e950.html">member</a></li><li class="navelem"><a class="el" href="dir_6048dbb18cb271412de4a010207fd345.html">tpm</a></li><li class="navelem"><a class="el" href="decompress_8h.html">decompress.h</a></li>
+ <li class="footer">
+ &copy; 2016-2017 Intel Corporation
+ </li>
+ </ul>
+</div>
+</body>
+</html>
diff --git a/doc/html/dir_02c945662023679b89476bd7126bc985.html b/doc/html/dir_02c945662023679b89476bd7126bc985.html
index 2da5253..fa564fd 100644
--- a/doc/html/dir_02c945662023679b89476bd7126bc985.html
+++ b/doc/html/dir_02c945662023679b89476bd7126bc985.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -85,7 +85,7 @@ Files</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_02c945662023679b89476bd7126bc985.html">verifier</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/dir_12b90d9c027aaf878a834df729679a56.html b/doc/html/dir_12b90d9c027aaf878a834df729679a56.html
index 3b6b938..7a4c933 100644
--- a/doc/html/dir_12b90d9c027aaf878a834df729679a56.html
+++ b/doc/html/dir_12b90d9c027aaf878a834df729679a56.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -88,7 +88,7 @@ Directories</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/dir_512d3e62841a8535b716ec4cf8b9e950.html b/doc/html/dir_512d3e62841a8535b716ec4cf8b9e950.html
index c2d5b41..5e26711 100644
--- a/doc/html/dir_512d3e62841a8535b716ec4cf8b9e950.html
+++ b/doc/html/dir_512d3e62841a8535b716ec4cf8b9e950.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -66,6 +66,9 @@ $(document).ready(function(){initNavTree('dir_512d3e62841a8535b716ec4cf8b9e950.h
<a href="#details">More...</a></p>
<table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="subdirs"></a>
+Directories</h2></td></tr>
+</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="files"></a>
Files</h2></td></tr>
<tr class="memitem:member_2api_8h"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="member_2api_8h.html">api.h</a></td></tr>
@@ -82,7 +85,7 @@ Files</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_512d3e62841a8535b716ec4cf8b9e950.html">member</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/dir_6048dbb18cb271412de4a010207fd345.html b/doc/html/dir_6048dbb18cb271412de4a010207fd345.html
new file mode 100644
index 0000000..7b7bb58
--- /dev/null
+++ b/doc/html/dir_6048dbb18cb271412de4a010207fd345.html
@@ -0,0 +1,105 @@
+<!-- HTML header for doxygen 1.8.10-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.11"/>
+<title>Intel&reg; Enhanced Privacy ID SDK: epid/member/tpm Directory Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="navtree.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="resize.js"></script>
+<script type="text/javascript" src="navtreedata.js"></script>
+<script type="text/javascript" src="navtree.js"></script>
+<script type="text/javascript">
+ $(document).ready(initResizable);
+ $(window).load(resizeHeight);
+</script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+<link href="epidstyle.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td id="projectalign" style="padding-left: 0.5em;">
+ <div id="projectname"><a
+ onclick="storeLink('index.html')"
+ id="projectlink"
+ class="index.html"
+ href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
+&#160;<span id="projectnumber">4.0.0</span>
+</div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.11 -->
+</div><!-- top -->
+<div id="side-nav" class="ui-resizable side-nav-resizable">
+ <div id="nav-tree">
+ <div id="nav-tree-contents">
+ <div id="nav-sync" class="sync"></div>
+ </div>
+ </div>
+ <div id="splitbar" style="-moz-user-select:none;"
+ class="ui-resizable-handle">
+ </div>
+</div>
+<script type="text/javascript">
+$(document).ready(function(){initNavTree('dir_6048dbb18cb271412de4a010207fd345.html','');});
+</script>
+<div id="doc-content">
+<div class="header">
+ <div class="headertitle">
+<div class="title">tpm Directory Reference</div> </div>
+</div><!--header-->
+<div class="contents">
+<table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="files"></a>
+Files</h2></td></tr>
+<tr class="memitem:context_8h"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="context_8h.html">context.h</a></td></tr>
+<tr class="memdesc:context_8h"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sensitive member context APIs. <br /></td></tr>
+<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:decompress_8h"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="decompress_8h.html">decompress.h</a></td></tr>
+<tr class="memdesc:decompress_8h"><td class="mdescLeft">&#160;</td><td class="mdescRight">TPM key decompression APIs. <br /></td></tr>
+<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:init_8h"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="init_8h.html">init.h</a></td></tr>
+<tr class="memdesc:init_8h"><td class="mdescLeft">&#160;</td><td class="mdescRight">Non-sensitive member context APIs. <br /></td></tr>
+<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:join_8h"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="join_8h.html">join.h</a></td></tr>
+<tr class="memdesc:join_8h"><td class="mdescLeft">&#160;</td><td class="mdescRight">TPM join APIs. <br /></td></tr>
+<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:nrprove_8h"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="nrprove_8h.html">nrprove.h</a></td></tr>
+<tr class="memdesc:nrprove_8h"><td class="mdescLeft">&#160;</td><td class="mdescRight">TPM NrProve APIs. <br /></td></tr>
+<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:presig_8h"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="presig_8h.html">presig.h</a></td></tr>
+<tr class="memdesc:presig_8h"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sensitive pre-computed signature APIs. <br /></td></tr>
+<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:sign_8h"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="sign_8h.html">sign.h</a></td></tr>
+<tr class="memdesc:sign_8h"><td class="mdescLeft">&#160;</td><td class="mdescRight">TPM signing APIs. <br /></td></tr>
+<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:validatekey_8h"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="validatekey_8h.html">validatekey.h</a></td></tr>
+<tr class="memdesc:validatekey_8h"><td class="mdescLeft">&#160;</td><td class="mdescRight">Non-sensitive member context APIs. <br /></td></tr>
+<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
+</table>
+</div><!-- contents -->
+</div><!-- doc-content -->
+<!-- HTML footer for doxygen 1.8.10-->
+<!-- start footer part -->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ <li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_512d3e62841a8535b716ec4cf8b9e950.html">member</a></li><li class="navelem"><a class="el" href="dir_6048dbb18cb271412de4a010207fd345.html">tpm</a></li>
+ <li class="footer">
+ &copy; 2016-2017 Intel Corporation
+ </li>
+ </ul>
+</div>
+</body>
+</html>
diff --git a/doc/html/dir_a32be19bc88f3d7aac6b7249da379f26.html b/doc/html/dir_a32be19bc88f3d7aac6b7249da379f26.html
index 446b40e..d5579b0 100644
--- a/doc/html/dir_a32be19bc88f3d7aac6b7249da379f26.html
+++ b/doc/html/dir_a32be19bc88f3d7aac6b7249da379f26.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -79,7 +79,7 @@ Files</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li><li class="navelem"><a class="el" href="dir_a32be19bc88f3d7aac6b7249da379f26.html">1.1</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/dir_ef364879bae02db2684040178ed9b186.html b/doc/html/dir_ef364879bae02db2684040178ed9b186.html
index 5a8f5eb..037ebae 100644
--- a/doc/html/dir_ef364879bae02db2684040178ed9b186.html
+++ b/doc/html/dir_ef364879bae02db2684040178ed9b186.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -76,7 +76,7 @@ Files</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_02c945662023679b89476bd7126bc985.html">verifier</a></li><li class="navelem"><a class="el" href="dir_ef364879bae02db2684040178ed9b186.html">1.1</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/dir_f169ebf8da29290a918fa4b3f7151050.html b/doc/html/dir_f169ebf8da29290a918fa4b3f7151050.html
index 3a07fce..5c36c0c 100644
--- a/doc/html/dir_f169ebf8da29290a918fa4b3f7151050.html
+++ b/doc/html/dir_f169ebf8da29290a918fa4b3f7151050.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -103,7 +103,7 @@ Files</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li><li class="navelem"><a class="el" href="dir_f169ebf8da29290a918fa4b3f7151050.html">math</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/dir_f6bef457d5f671b6e774bfccc16651f6.html b/doc/html/dir_f6bef457d5f671b6e774bfccc16651f6.html
index b454780..4ab2133 100644
--- a/doc/html/dir_f6bef457d5f671b6e774bfccc16651f6.html
+++ b/doc/html/dir_f6bef457d5f671b6e774bfccc16651f6.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -100,7 +100,7 @@ Files</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/ecdsa_8h.html b/doc/html/ecdsa_8h.html
index 1612334..33ced6d 100644
--- a/doc/html/ecdsa_8h.html
+++ b/doc/html/ecdsa_8h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -73,12 +73,12 @@ $(document).ready(function(){initNavTree('ecdsa_8h.html','');});
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
-<tr class="memitem:gaab68de7291db6e42a01e99c2fa40057f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ecdsa_primitives.html#gaab68de7291db6e42a01e99c2fa40057f">EcdsaVerifyBuffer</a> (void const *buf, size_t buf_len, <a class="el" href="struct_ecdsa_public_key.html">EcdsaPublicKey</a> const *pubkey, <a class="el" href="struct_ecdsa_signature.html">EcdsaSignature</a> const *sig)</td></tr>
-<tr class="memdesc:gaab68de7291db6e42a01e99c2fa40057f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Verifies authenticity of a digital signature over a buffer. <a href="group___ecdsa_primitives.html#gaab68de7291db6e42a01e99c2fa40057f">More...</a><br /></td></tr>
-<tr class="separator:gaab68de7291db6e42a01e99c2fa40057f"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga67091ecae643c1b8a0b0a4946eda7afe"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ecdsa_primitives.html#ga67091ecae643c1b8a0b0a4946eda7afe">EcdsaSignBuffer</a> (void const *buf, size_t buf_len, <a class="el" href="struct_ecdsa_private_key.html">EcdsaPrivateKey</a> const *privkey, <a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c">BitSupplier</a> rnd_func, void *rnd_param, <a class="el" href="struct_ecdsa_signature.html">EcdsaSignature</a> *sig)</td></tr>
-<tr class="memdesc:ga67091ecae643c1b8a0b0a4946eda7afe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates ECDSA signature of buffer. <a href="group___ecdsa_primitives.html#ga67091ecae643c1b8a0b0a4946eda7afe">More...</a><br /></td></tr>
-<tr class="separator:ga67091ecae643c1b8a0b0a4946eda7afe"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga07e4ebd3423e1f6f9ae35f0608dde7c0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ecdsa_primitives.html#ga07e4ebd3423e1f6f9ae35f0608dde7c0">EcdsaVerifyBuffer</a> (<a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a> buf, size_t buf_len, <a class="el" href="struct_ecdsa_public_key.html">EcdsaPublicKey</a> const *pubkey, <a class="el" href="struct_ecdsa_signature.html">EcdsaSignature</a> const *sig)</td></tr>
+<tr class="memdesc:ga07e4ebd3423e1f6f9ae35f0608dde7c0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Verifies authenticity of a digital signature over a buffer. <a href="group___ecdsa_primitives.html#ga07e4ebd3423e1f6f9ae35f0608dde7c0">More...</a><br /></td></tr>
+<tr class="separator:ga07e4ebd3423e1f6f9ae35f0608dde7c0"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gaef0e8a31e830fe9285b43a0969e6611a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ecdsa_primitives.html#gaef0e8a31e830fe9285b43a0969e6611a">EcdsaSignBuffer</a> (<a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a> buf, size_t buf_len, <a class="el" href="struct_ecdsa_private_key.html">EcdsaPrivateKey</a> const *privkey, <a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c">BitSupplier</a> rnd_func, void *rnd_param, <a class="el" href="struct_ecdsa_signature.html">EcdsaSignature</a> *sig)</td></tr>
+<tr class="memdesc:gaef0e8a31e830fe9285b43a0969e6611a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates ECDSA signature of buffer. <a href="group___ecdsa_primitives.html#gaef0e8a31e830fe9285b43a0969e6611a">More...</a><br /></td></tr>
+<tr class="separator:gaef0e8a31e830fe9285b43a0969e6611a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Ecdsa interface. </p>
@@ -90,7 +90,7 @@ Functions</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li><li class="navelem"><a class="el" href="dir_f169ebf8da29290a918fa4b3f7151050.html">math</a></li><li class="navelem"><a class="el" href="ecdsa_8h.html">ecdsa.h</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/ecgroup_8h.html b/doc/html/ecgroup_8h.html
index adf8f29..21003e0 100644
--- a/doc/html/ecgroup_8h.html
+++ b/doc/html/ecgroup_8h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -98,12 +98,12 @@ Functions</h2></td></tr>
<tr class="memitem:ga8cb086d792bffb79b3ca07e6ca4ce0e7"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#ga8cb086d792bffb79b3ca07e6ca4ce0e7">DeleteEcPoint</a> (<a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> **p)</td></tr>
<tr class="memdesc:ga8cb086d792bffb79b3ca07e6ca4ce0e7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes a previously allocated EcPoint. <a href="group___ec_group_primitives.html#ga8cb086d792bffb79b3ca07e6ca4ce0e7">More...</a><br /></td></tr>
<tr class="separator:ga8cb086d792bffb79b3ca07e6ca4ce0e7"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga2d433f567fa2419465a49604f4da21ad"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#ga2d433f567fa2419465a49604f4da21ad">ReadEcPoint</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, void const *p_str, size_t strlen, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> *p)</td></tr>
-<tr class="memdesc:ga2d433f567fa2419465a49604f4da21ad"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deserializes an EcPoint from a string. <a href="group___ec_group_primitives.html#ga2d433f567fa2419465a49604f4da21ad">More...</a><br /></td></tr>
-<tr class="separator:ga2d433f567fa2419465a49604f4da21ad"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga4bb7d6691ffbb6e947c1068453e27fbd"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#ga4bb7d6691ffbb6e947c1068453e27fbd">WriteEcPoint</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *p, void *p_str, size_t strlen)</td></tr>
-<tr class="memdesc:ga4bb7d6691ffbb6e947c1068453e27fbd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serializes an EcPoint to a string. <a href="group___ec_group_primitives.html#ga4bb7d6691ffbb6e947c1068453e27fbd">More...</a><br /></td></tr>
-<tr class="separator:ga4bb7d6691ffbb6e947c1068453e27fbd"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gad495a9f91b79984f7533c8ea4f92b3cb"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#gad495a9f91b79984f7533c8ea4f92b3cb">ReadEcPoint</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, <a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a> p_str, size_t strlen, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> *p)</td></tr>
+<tr class="memdesc:gad495a9f91b79984f7533c8ea4f92b3cb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deserializes an EcPoint from a string. <a href="group___ec_group_primitives.html#gad495a9f91b79984f7533c8ea4f92b3cb">More...</a><br /></td></tr>
+<tr class="separator:gad495a9f91b79984f7533c8ea4f92b3cb"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga7a8bdb9782d065bc32fd102e0ae73ccb"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#ga7a8bdb9782d065bc32fd102e0ae73ccb">WriteEcPoint</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *p, <a class="el" href="group___epid_types.html#ga3315fb24f4c5783b6d6eb107933390b0">OctStr</a> p_str, size_t strlen)</td></tr>
+<tr class="memdesc:ga7a8bdb9782d065bc32fd102e0ae73ccb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serializes an EcPoint to a string. <a href="group___ec_group_primitives.html#ga7a8bdb9782d065bc32fd102e0ae73ccb">More...</a><br /></td></tr>
+<tr class="separator:ga7a8bdb9782d065bc32fd102e0ae73ccb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga25c9013cc76907d73765eb7a96aa8c96"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#ga25c9013cc76907d73765eb7a96aa8c96">EcMul</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *a, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *b, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> *r)</td></tr>
<tr class="memdesc:ga25c9013cc76907d73765eb7a96aa8c96"><td class="mdescLeft">&#160;</td><td class="mdescRight">Multiplies two elements in an elliptic curve group. <a href="group___ec_group_primitives.html#ga25c9013cc76907d73765eb7a96aa8c96">More...</a><br /></td></tr>
<tr class="separator:ga25c9013cc76907d73765eb7a96aa8c96"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -125,15 +125,15 @@ Functions</h2></td></tr>
<tr class="memitem:ga3f96c43d14d24de0f7a5e214aef64196"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#ga3f96c43d14d24de0f7a5e214aef64196">EcGetRandom</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, <a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c">BitSupplier</a> rnd_func, void *rnd_func_param, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> *r)</td></tr>
<tr class="memdesc:ga3f96c43d14d24de0f7a5e214aef64196"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generates a random element from an elliptic curve group. <a href="group___ec_group_primitives.html#ga3f96c43d14d24de0f7a5e214aef64196">More...</a><br /></td></tr>
<tr class="separator:ga3f96c43d14d24de0f7a5e214aef64196"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga4d0f32aede3066eae500241b387bd970"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#ga4d0f32aede3066eae500241b387bd970">EcInGroup</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, void const *p_str, size_t strlen, <a class="el" href="stdtypes_8h.html#ad5c9d4ba3dc37783a528b0925dc981a0">bool</a> *in_group)</td></tr>
-<tr class="memdesc:ga4d0f32aede3066eae500241b387bd970"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks if a point is in an elliptic curve group. <a href="group___ec_group_primitives.html#ga4d0f32aede3066eae500241b387bd970">More...</a><br /></td></tr>
-<tr class="separator:ga4d0f32aede3066eae500241b387bd970"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:gadf83fa559585375faad9a8b1559249bc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#gadf83fa559585375faad9a8b1559249bc">Epid11EcHash</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, void const *msg, size_t msg_len, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> *r)</td></tr>
-<tr class="memdesc:gadf83fa559585375faad9a8b1559249bc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Hashes an arbitrary message to an Intel(R) EPID 1.1 element in an elliptic curve group. <a href="group___ec_group_primitives.html#gadf83fa559585375faad9a8b1559249bc">More...</a><br /></td></tr>
-<tr class="separator:gadf83fa559585375faad9a8b1559249bc"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:gadc22ee07864a7ee681a881029b69d76a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#gadc22ee07864a7ee681a881029b69d76a">EcHash</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, void const *msg, size_t msg_len, <a class="el" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890">HashAlg</a> hash_alg, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> *r)</td></tr>
-<tr class="memdesc:gadc22ee07864a7ee681a881029b69d76a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Hashes an arbitrary message to an element in an elliptic curve group. <a href="group___ec_group_primitives.html#gadc22ee07864a7ee681a881029b69d76a">More...</a><br /></td></tr>
-<tr class="separator:gadc22ee07864a7ee681a881029b69d76a"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga48ec5ae951c9f49d8d7d983234eea921"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#ga48ec5ae951c9f49d8d7d983234eea921">EcInGroup</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, <a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a> p_str, size_t strlen, <a class="el" href="stdtypes_8h.html#ad5c9d4ba3dc37783a528b0925dc981a0">bool</a> *in_group)</td></tr>
+<tr class="memdesc:ga48ec5ae951c9f49d8d7d983234eea921"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks if a point is in an elliptic curve group. <a href="group___ec_group_primitives.html#ga48ec5ae951c9f49d8d7d983234eea921">More...</a><br /></td></tr>
+<tr class="separator:ga48ec5ae951c9f49d8d7d983234eea921"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gaad96a1498b85d28f71514b8f7b154d82"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#gaad96a1498b85d28f71514b8f7b154d82">Epid11EcHash</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, <a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a> msg, size_t msg_len, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> *r)</td></tr>
+<tr class="memdesc:gaad96a1498b85d28f71514b8f7b154d82"><td class="mdescLeft">&#160;</td><td class="mdescRight">Hashes an arbitrary message to an Intel(R) EPID 1.1 element in an elliptic curve group. <a href="group___ec_group_primitives.html#gaad96a1498b85d28f71514b8f7b154d82">More...</a><br /></td></tr>
+<tr class="separator:gaad96a1498b85d28f71514b8f7b154d82"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gab647ccc031063807ff3860f51d0f6919"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#gab647ccc031063807ff3860f51d0f6919">EcHash</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, <a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a> msg, size_t msg_len, <a class="el" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890">HashAlg</a> hash_alg, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> *r)</td></tr>
+<tr class="memdesc:gab647ccc031063807ff3860f51d0f6919"><td class="mdescLeft">&#160;</td><td class="mdescRight">Hashes an arbitrary message to an element in an elliptic curve group. <a href="group___ec_group_primitives.html#gab647ccc031063807ff3860f51d0f6919">More...</a><br /></td></tr>
+<tr class="separator:gab647ccc031063807ff3860f51d0f6919"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8a6114a48214a327d4ec04fd25e5940e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#ga8a6114a48214a327d4ec04fd25e5940e">EcMakePoint</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> const *x, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> *r)</td></tr>
<tr class="memdesc:ga8a6114a48214a327d4ec04fd25e5940e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets an EcPoint variable to a point on a curve. <a href="group___ec_group_primitives.html#ga8a6114a48214a327d4ec04fd25e5940e">More...</a><br /></td></tr>
<tr class="separator:ga8a6114a48214a327d4ec04fd25e5940e"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -157,7 +157,7 @@ Functions</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li><li class="navelem"><a class="el" href="dir_f169ebf8da29290a918fa4b3f7151050.html">math</a></li><li class="navelem"><a class="el" href="ecgroup_8h.html">ecgroup.h</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/epid__overview_8dox.html b/doc/html/epid__overview_8dox.html
index 1aae71e..ee5b8d1 100644
--- a/doc/html/epid__overview_8dox.html
+++ b/doc/html/epid__overview_8dox.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('epid__overview_8dox.html','');});
<ul>
<li class="navelem"><a class="el" href="epid__overview_8dox.html">epid_overview.dox</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/epid_diagram_basic_interaction.png b/doc/html/epid_diagram_basic_interaction.png
new file mode 100644
index 0000000..2c0f236
--- /dev/null
+++ b/doc/html/epid_diagram_basic_interaction.png
Binary files differ
diff --git a/doc/html/epid_diagram_group.png b/doc/html/epid_diagram_group.png
new file mode 100644
index 0000000..2caf441
--- /dev/null
+++ b/doc/html/epid_diagram_group.png
Binary files differ
diff --git a/doc/html/epid_diagram_high_level_interaction.png b/doc/html/epid_diagram_high_level_interaction.png
deleted file mode 100644
index 1013eb0..0000000
--- a/doc/html/epid_diagram_high_level_interaction.png
+++ /dev/null
Binary files differ
diff --git a/doc/html/epid_diagram_high_level_use_case.png b/doc/html/epid_diagram_high_level_use_case.png
deleted file mode 100644
index acc6374..0000000
--- a/doc/html/epid_diagram_high_level_use_case.png
+++ /dev/null
Binary files differ
diff --git a/doc/html/epid_diagram_issuer_functionality.png b/doc/html/epid_diagram_issuer_functionality.png
new file mode 100644
index 0000000..7614b56
--- /dev/null
+++ b/doc/html/epid_diagram_issuer_functionality.png
Binary files differ
diff --git a/doc/html/epid_diagram_issuer_high_level.png b/doc/html/epid_diagram_issuer_high_level.png
deleted file mode 100644
index d03d6b9..0000000
--- a/doc/html/epid_diagram_issuer_high_level.png
+++ /dev/null
Binary files differ
diff --git a/doc/html/epid_diagram_member_functionality.png b/doc/html/epid_diagram_member_functionality.png
new file mode 100644
index 0000000..3b0a41a
--- /dev/null
+++ b/doc/html/epid_diagram_member_functionality.png
Binary files differ
diff --git a/doc/html/epid_diagram_member_high_level.png b/doc/html/epid_diagram_member_high_level.png
deleted file mode 100644
index 58d784f..0000000
--- a/doc/html/epid_diagram_member_high_level.png
+++ /dev/null
Binary files differ
diff --git a/doc/html/epid_diagram_roles_summary.png b/doc/html/epid_diagram_roles_summary.png
new file mode 100644
index 0000000..4c6f422
--- /dev/null
+++ b/doc/html/epid_diagram_roles_summary.png
Binary files differ
diff --git a/doc/html/epid_diagram_verifier_functionality.png b/doc/html/epid_diagram_verifier_functionality.png
new file mode 100644
index 0000000..c065129
--- /dev/null
+++ b/doc/html/epid_diagram_verifier_functionality.png
Binary files differ
diff --git a/doc/html/epid_diagram_verifier_high_level.png b/doc/html/epid_diagram_verifier_high_level.png
deleted file mode 100644
index bb92560..0000000
--- a/doc/html/epid_diagram_verifier_high_level.png
+++ /dev/null
Binary files differ
diff --git a/doc/html/errors_8h.html b/doc/html/errors_8h.html
index ecda4e4..cec6edb 100644
--- a/doc/html/errors_8h.html
+++ b/doc/html/errors_8h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -94,7 +94,9 @@ Enumerations</h2></td></tr>
&#160;&#160;<a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a61234ad9610406da6bf7977afd72a357">kEpidRandMaxIterErr</a>,
<a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a3706f895a660260033b5b91890516c0f">kEpidDuplicateErr</a>,
<a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a94ae9c9b9337afd2fefd3b4f9c3160df">kEpidInconsistentBasenameSetErr</a>,
-<a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ab2768a1a5c4374cb1ac6175c09c73129">kEpidMathQuadraticNonResidueError</a>
+<a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ab2768a1a5c4374cb1ac6175c09c73129">kEpidMathQuadraticNonResidueError</a>,
+<br />
+&#160;&#160;<a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a700953ded1af35781948e8ada6dedf43">kEpidOutOfSequenceError</a>
<br />
}<tr class="memdesc:gafdb27c77c2c4b32c807e326a8a0da360"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return status for SDK functions. <a href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">More...</a><br /></td></tr>
</td></tr>
@@ -116,7 +118,7 @@ Functions</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li><li class="navelem"><a class="el" href="errors_8h.html">errors.h</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/examples.html b/doc/html/examples.html
index a69755f..241bb40 100644
--- a/doc/html/examples.html
+++ b/doc/html/examples.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -66,9 +66,9 @@ $(document).ready(function(){initNavTree('Examples.html','');});
<tr>
<th>Example Application </th><th>Concept Demonstrated </th></tr>
<tr>
-<td><code>signmsg</code> </td><td><a class="el" href="SignmsgWalkthru.html">Generating an Intel&reg; EPID Signature</a> </td></tr>
+<td><code>signmsg</code> </td><td><a class="el" href="UserManual_GeneratingAnIntelEpidSignature.html">Generating an Intel&reg; EPID Signature</a> </td></tr>
<tr>
-<td><code>verifysig</code> </td><td><a class="el" href="VerifysigWalkthru.html">Verifying an Intel&reg; EPID Signature</a> </td></tr>
+<td><code>verifysig</code> </td><td><a class="el" href="UserManual_VerifyingAnIntelEpidSignature.html">Verifying an Intel&reg; EPID Signature</a> </td></tr>
</table>
</div></div><!-- contents -->
</div><!-- doc-content -->
@@ -77,7 +77,7 @@ $(document).ready(function(){initNavTree('Examples.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/examples.js b/doc/html/examples.js
index 35ebbda..450d9d9 100644
--- a/doc/html/examples.js
+++ b/doc/html/examples.js
@@ -1,5 +1,11 @@
var Examples =
[
- [ "Generating an Intel® EPID Signature", "SignmsgWalkthru.html", null ],
- [ "Verifying an Intel® EPID Signature", "VerifysigWalkthru.html", null ]
+ [ "Generating an Intel® EPID Signature", "UserManual_GeneratingAnIntelEpidSignature.html", [
+ [ "Summary", "UserManual_GeneratingAnIntelEpidSignature.html#signmsgWalktrhu_overview", null ],
+ [ "Signmsg Walkthrough", "UserManual_GeneratingAnIntelEpidSignature.html#signmsgWalkthru_", null ]
+ ] ],
+ [ "Verifying an Intel® EPID Signature", "UserManual_VerifyingAnIntelEpidSignature.html", [
+ [ "Summary", "UserManual_VerifyingAnIntelEpidSignature.html#verifysigWalktrhu_overview", null ],
+ [ "Verifysig Walkthrough", "UserManual_VerifyingAnIntelEpidSignature.html#verifysigWalkthrough_main", null ]
+ ] ]
]; \ No newline at end of file
diff --git a/doc/html/examples_8dox.html b/doc/html/examples_8dox.html
index 0114afb..34cfc3d 100644
--- a/doc/html/examples_8dox.html
+++ b/doc/html/examples_8dox.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('examples_8dox.html','');});
<ul>
<li class="navelem"><a class="el" href="examples_8dox.html">examples.dox</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/file__parser_8h.html b/doc/html/file__parser_8h.html
index 5b29071..0165205 100644
--- a/doc/html/file__parser_8h.html
+++ b/doc/html/file__parser_8h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -146,7 +146,7 @@ const <a class="el" href="struct_oct_str16.html">OctStr16</a>&#160;</td><td clas
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li><li class="navelem"><a class="el" href="file__parser_8h.html">file_parser.h</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/files.html b/doc/html/files.html
index ab34f5b..28117fc 100644
--- a/doc/html/files.html
+++ b/doc/html/files.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -83,11 +83,20 @@ $(document).ready(function(){initNavTree('files.html','');});
<tr id="row_0_0_5_"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="stdtypes_8h.html" target="_self">stdtypes.h</a></td><td class="desc">C99 standard data types </td></tr>
<tr id="row_0_0_6_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="types_8h.html" target="_self">types.h</a></td><td class="desc">SDK data types </td></tr>
<tr id="row_0_1_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span id="arr_0_1_" class="arrow" onclick="toggleFolder('0_1_')">&#9660;</span><span id="img_0_1_" class="iconfopen" onclick="toggleFolder('0_1_')">&#160;</span><a class="el" href="dir_512d3e62841a8535b716ec4cf8b9e950.html" target="_self">member</a></td><td class="desc">Member functionality </td></tr>
-<tr id="row_0_1_0_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="member_2api_8h.html" target="_self">api.h</a></td><td class="desc">Intel(R) EPID SDK member API </td></tr>
-<tr id="row_0_2_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span id="arr_0_2_" class="arrow" onclick="toggleFolder('0_2_')">&#9660;</span><span id="img_0_2_" class="iconfopen" onclick="toggleFolder('0_2_')">&#160;</span><a class="el" href="dir_02c945662023679b89476bd7126bc985.html" target="_self">verifier</a></td><td class="desc">Verifier functionality </td></tr>
-<tr id="row_0_2_0_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><span id="arr_0_2_0_" class="arrow" onclick="toggleFolder('0_2_0_')">&#9660;</span><span id="img_0_2_0_" class="iconfopen" onclick="toggleFolder('0_2_0_')">&#160;</span><a class="el" href="dir_ef364879bae02db2684040178ed9b186.html" target="_self">1.1</a></td><td class="desc"></td></tr>
-<tr id="row_0_2_0_0_"><td class="entry"><span style="width:64px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="verifier_21_81_2api_8h.html" target="_self">api.h</a></td><td class="desc">Intel(R) EPID SDK verifier Intel(R) EPID 1.1 API </td></tr>
-<tr id="row_0_2_1_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="verifier_2api_8h.html" target="_self">api.h</a></td><td class="desc">Intel(R) EPID SDK verifier API </td></tr>
+<tr id="row_0_1_0_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><span id="arr_0_1_0_" class="arrow" onclick="toggleFolder('0_1_0_')">&#9660;</span><span id="img_0_1_0_" class="iconfopen" onclick="toggleFolder('0_1_0_')">&#160;</span><a class="el" href="dir_6048dbb18cb271412de4a010207fd345.html" target="_self">tpm</a></td><td class="desc"></td></tr>
+<tr id="row_0_1_0_0_"><td class="entry"><span style="width:64px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="context_8h.html" target="_self">context.h</a></td><td class="desc">Sensitive member context APIs </td></tr>
+<tr id="row_0_1_0_1_" class="even"><td class="entry"><span style="width:64px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="decompress_8h.html" target="_self">decompress.h</a></td><td class="desc">TPM key decompression APIs </td></tr>
+<tr id="row_0_1_0_2_"><td class="entry"><span style="width:64px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="init_8h.html" target="_self">init.h</a></td><td class="desc">Non-sensitive member context APIs </td></tr>
+<tr id="row_0_1_0_3_" class="even"><td class="entry"><span style="width:64px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="join_8h.html" target="_self">join.h</a></td><td class="desc">TPM join APIs </td></tr>
+<tr id="row_0_1_0_4_"><td class="entry"><span style="width:64px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="nrprove_8h.html" target="_self">nrprove.h</a></td><td class="desc">TPM NrProve APIs </td></tr>
+<tr id="row_0_1_0_5_" class="even"><td class="entry"><span style="width:64px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="presig_8h.html" target="_self">presig.h</a></td><td class="desc">Sensitive pre-computed signature APIs </td></tr>
+<tr id="row_0_1_0_6_"><td class="entry"><span style="width:64px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="sign_8h.html" target="_self">sign.h</a></td><td class="desc">TPM signing APIs </td></tr>
+<tr id="row_0_1_0_7_" class="even"><td class="entry"><span style="width:64px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="validatekey_8h.html" target="_self">validatekey.h</a></td><td class="desc">Non-sensitive member context APIs </td></tr>
+<tr id="row_0_1_1_"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="member_2api_8h.html" target="_self">api.h</a></td><td class="desc">Intel(R) EPID SDK member API </td></tr>
+<tr id="row_0_2_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span id="arr_0_2_" class="arrow" onclick="toggleFolder('0_2_')">&#9660;</span><span id="img_0_2_" class="iconfopen" onclick="toggleFolder('0_2_')">&#160;</span><a class="el" href="dir_02c945662023679b89476bd7126bc985.html" target="_self">verifier</a></td><td class="desc">Verifier functionality </td></tr>
+<tr id="row_0_2_0_"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><span id="arr_0_2_0_" class="arrow" onclick="toggleFolder('0_2_0_')">&#9660;</span><span id="img_0_2_0_" class="iconfopen" onclick="toggleFolder('0_2_0_')">&#160;</span><a class="el" href="dir_ef364879bae02db2684040178ed9b186.html" target="_self">1.1</a></td><td class="desc"></td></tr>
+<tr id="row_0_2_0_0_" class="even"><td class="entry"><span style="width:64px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="verifier_21_81_2api_8h.html" target="_self">api.h</a></td><td class="desc">Intel(R) EPID SDK verifier Intel(R) EPID 1.1 API </td></tr>
+<tr id="row_0_2_1_"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><span class="icondoc"></span><a class="el" href="verifier_2api_8h.html" target="_self">api.h</a></td><td class="desc">Intel(R) EPID SDK verifier API </td></tr>
</table>
</div><!-- directory -->
</div><!-- contents -->
@@ -97,7 +106,7 @@ $(document).ready(function(){initNavTree('files.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/finitefield_8h.html b/doc/html/finitefield_8h.html
index ca7b07f..d89d041 100644
--- a/doc/html/finitefield_8h.html
+++ b/doc/html/finitefield_8h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -104,15 +104,15 @@ Functions</h2></td></tr>
<tr class="memitem:ga1bad3c6945d1d709fceb07a1dd03000e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#ga1bad3c6945d1d709fceb07a1dd03000e">DeleteFfElement</a> (<a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> **ff_elem)</td></tr>
<tr class="memdesc:ga1bad3c6945d1d709fceb07a1dd03000e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Frees a previously allocated FfElement. <a href="group___finite_field_primitives.html#ga1bad3c6945d1d709fceb07a1dd03000e">More...</a><br /></td></tr>
<tr class="separator:ga1bad3c6945d1d709fceb07a1dd03000e"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga884d9e1baadf29a410244a735853e3c7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#ga884d9e1baadf29a410244a735853e3c7">ReadFfElement</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, void const *ff_elem_str, size_t strlen, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *ff_elem)</td></tr>
-<tr class="memdesc:ga884d9e1baadf29a410244a735853e3c7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deserializes a FfElement from a string. <a href="group___finite_field_primitives.html#ga884d9e1baadf29a410244a735853e3c7">More...</a><br /></td></tr>
-<tr class="separator:ga884d9e1baadf29a410244a735853e3c7"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga8a143a5a815a62f4947be2de1653c50f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#ga8a143a5a815a62f4947be2de1653c50f">ReadFfElement</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, <a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a> ff_elem_str, size_t strlen, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *ff_elem)</td></tr>
+<tr class="memdesc:ga8a143a5a815a62f4947be2de1653c50f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deserializes a FfElement from a string. <a href="group___finite_field_primitives.html#ga8a143a5a815a62f4947be2de1653c50f">More...</a><br /></td></tr>
+<tr class="separator:ga8a143a5a815a62f4947be2de1653c50f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga90b2c192708973b54b7a3e82b34536ed"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#ga90b2c192708973b54b7a3e82b34536ed">InitFfElementFromBn</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, <a class="el" href="group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718">BigNum</a> *bn, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *ff_elem)</td></tr>
<tr class="memdesc:ga90b2c192708973b54b7a3e82b34536ed"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes an existing FfElement from a BigNum. <a href="group___finite_field_primitives.html#ga90b2c192708973b54b7a3e82b34536ed">More...</a><br /></td></tr>
<tr class="separator:ga90b2c192708973b54b7a3e82b34536ed"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga678694636708463b078d842d5c58a900"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#ga678694636708463b078d842d5c58a900">WriteFfElement</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> const *ff_elem, void *ff_elem_str, size_t strlen)</td></tr>
-<tr class="memdesc:ga678694636708463b078d842d5c58a900"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serializes a finite field element to a string. <a href="group___finite_field_primitives.html#ga678694636708463b078d842d5c58a900">More...</a><br /></td></tr>
-<tr class="separator:ga678694636708463b078d842d5c58a900"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gaa3c1f7515dd823ddad8764091ebc665f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#gaa3c1f7515dd823ddad8764091ebc665f">WriteFfElement</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> const *ff_elem, <a class="el" href="group___epid_types.html#ga3315fb24f4c5783b6d6eb107933390b0">OctStr</a> ff_elem_str, size_t strlen)</td></tr>
+<tr class="memdesc:gaa3c1f7515dd823ddad8764091ebc665f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serializes a finite field element to a string. <a href="group___finite_field_primitives.html#gaa3c1f7515dd823ddad8764091ebc665f">More...</a><br /></td></tr>
+<tr class="separator:gaa3c1f7515dd823ddad8764091ebc665f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae7a8c7503b6fc7a41bcaab4d45ca37b2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#gae7a8c7503b6fc7a41bcaab4d45ca37b2">FfNeg</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> const *a, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *r)</td></tr>
<tr class="memdesc:gae7a8c7503b6fc7a41bcaab4d45ca37b2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the additive inverse of a finite field element. <a href="group___finite_field_primitives.html#gae7a8c7503b6fc7a41bcaab4d45ca37b2">More...</a><br /></td></tr>
<tr class="separator:gae7a8c7503b6fc7a41bcaab4d45ca37b2"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -146,9 +146,9 @@ Functions</h2></td></tr>
<tr class="memitem:gaed2acb8583e9c9f6b49fdb660c672625"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#gaed2acb8583e9c9f6b49fdb660c672625">FfIsEqual</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> const *a, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> const *b, <a class="el" href="stdtypes_8h.html#ad5c9d4ba3dc37783a528b0925dc981a0">bool</a> *is_equal)</td></tr>
<tr class="memdesc:gaed2acb8583e9c9f6b49fdb660c672625"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks if two finite field elements are equal. <a href="group___finite_field_primitives.html#gaed2acb8583e9c9f6b49fdb660c672625">More...</a><br /></td></tr>
<tr class="separator:gaed2acb8583e9c9f6b49fdb660c672625"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga18a952cebb4a1274c73e6cb0c19e8aea"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#ga18a952cebb4a1274c73e6cb0c19e8aea">FfHash</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, void const *msg, size_t msg_len, <a class="el" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890">HashAlg</a> hash_alg, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *r)</td></tr>
-<tr class="memdesc:ga18a952cebb4a1274c73e6cb0c19e8aea"><td class="mdescLeft">&#160;</td><td class="mdescRight">Hashes an arbitrary message to an element in a finite field. <a href="group___finite_field_primitives.html#ga18a952cebb4a1274c73e6cb0c19e8aea">More...</a><br /></td></tr>
-<tr class="separator:ga18a952cebb4a1274c73e6cb0c19e8aea"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gabd511d79d9cbd1899e59258f149102c5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#gabd511d79d9cbd1899e59258f149102c5">FfHash</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, <a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a> msg, size_t msg_len, <a class="el" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890">HashAlg</a> hash_alg, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *r)</td></tr>
+<tr class="memdesc:gabd511d79d9cbd1899e59258f149102c5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Hashes an arbitrary message to an element in a finite field. <a href="group___finite_field_primitives.html#gabd511d79d9cbd1899e59258f149102c5">More...</a><br /></td></tr>
+<tr class="separator:gabd511d79d9cbd1899e59258f149102c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga6622db072782fd9e53b4d59dd3dbd8e8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#ga6622db072782fd9e53b4d59dd3dbd8e8">FfGetRandom</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, <a class="el" href="struct_big_num_str.html">BigNumStr</a> const *low_bound, <a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c">BitSupplier</a> rnd_func, void *rnd_param, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *r)</td></tr>
<tr class="memdesc:ga6622db072782fd9e53b4d59dd3dbd8e8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generate random finite field element. <a href="group___finite_field_primitives.html#ga6622db072782fd9e53b4d59dd3dbd8e8">More...</a><br /></td></tr>
<tr class="separator:ga6622db072782fd9e53b4d59dd3dbd8e8"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -166,7 +166,7 @@ Functions</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li><li class="navelem"><a class="el" href="dir_f169ebf8da29290a918fa4b3f7151050.html">math</a></li><li class="navelem"><a class="el" href="finitefield_8h.html">finitefield.h</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/functions.html b/doc/html/functions.html
index ee04435..248ebab 100644
--- a/doc/html/functions.html
+++ b/doc/html/functions.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -71,12 +71,7 @@ $(document).ready(function(){initNavTree('functions.html','');});
</li>
<li>A
: <a class="el" href="struct_membership_credential.html#a6d38ac3a9c5417833b8adb9b22bc9dc8">MembershipCredential</a>
-</li>
-<li>a
-: <a class="el" href="struct_pre_computed_signature.html#af23f3f9693857a33fe8564644612ea37">PreComputedSignature</a>
-</li>
-<li>A
-: <a class="el" href="struct_priv_key.html#a266c7e369b8b868ef5755e9cd3c0c849">PrivKey</a>
+, <a class="el" href="struct_priv_key.html#a266c7e369b8b868ef5755e9cd3c0c849">PrivKey</a>
</li>
<li>a_tick
: <a class="el" href="struct_epid11_params.html#ae8770bb921aac9214ff8c45c41dbb228">Epid11Params</a>
@@ -97,10 +92,9 @@ $(document).ready(function(){initNavTree('functions.html','');});
, <a class="el" href="struct_epid11_sig_rl_entry.html#abe47cfbd00684941f93a211417bedf0c">Epid11SigRlEntry</a>
, <a class="el" href="struct_epid2_params.html#a2f868edb49be49f645101ef5ebbbc551">Epid2Params</a>
, <a class="el" href="struct_epid_ca_certificate.html#a280e0b0238cf45834c21849ab8a7e124">EpidCaCertificate</a>
-, <a class="el" href="struct_pre_computed_signature.html#a666710432d9d54ca896647a976892c4f">PreComputedSignature</a>
</li>
<li>B
-: <a class="el" href="struct_pre_computed_signature.html#a9cc2eb61572a1aca9e6bc3d5e6f4c1fe">PreComputedSignature</a>
+: <a class="el" href="struct_sign_commit_output.html#ae2ebcc07395e60187d9ccca373665dba">SignCommitOutput</a>
</li>
<li>b
: <a class="el" href="struct_sig_rl_entry.html#ac6a47ff0d1b8ea1512e0ff14983ac5ce">SigRlEntry</a>
@@ -266,7 +260,7 @@ $(document).ready(function(){initNavTree('functions.html','');});
: <a class="el" href="struct_epid11_sig_rl_entry.html#a5de66e1352eafe95774a0d76bac8f01a">Epid11SigRlEntry</a>
</li>
<li>K
-: <a class="el" href="struct_pre_computed_signature.html#a2a4eaffe2717bd9c8c360599612adbe6">PreComputedSignature</a>
+: <a class="el" href="struct_sign_commit_output.html#a496bdc4d14fb73b1e85dfff3bc9fd3ba">SignCommitOutput</a>
</li>
<li>k
: <a class="el" href="struct_sig_rl_entry.html#a0dfeb058614e81878bfbf86ae3edac3c">SigRlEntry</a>
@@ -347,27 +341,17 @@ $(document).ready(function(){initNavTree('functions.html','');});
: <a class="el" href="struct_epid_ca_certificate.html#ab9d4c318b1fc8d38d3ce53b29f2dfee2">EpidCaCertificate</a>
</li>
<li>R1
-: <a class="el" href="struct_pre_computed_signature.html#a72be597624957e3d668c95ff6f445f94">PreComputedSignature</a>
+: <a class="el" href="struct_nr_prove_commit_output.html#af9c605d560f83ccd69e35d8b9cfe51b3">NrProveCommitOutput</a>
+, <a class="el" href="struct_sign_commit_output.html#ad01513f153f51f7ce211cf323a224499">SignCommitOutput</a>
</li>
<li>R2
-: <a class="el" href="struct_pre_computed_signature.html#a79f06fb57842597372e00dd34c1a804a">PreComputedSignature</a>
-</li>
-<li>ra
-: <a class="el" href="struct_pre_computed_signature.html#a54462643b8a2b4f2741bf8d2e6909d11">PreComputedSignature</a>
-</li>
-<li>rb
-: <a class="el" href="struct_pre_computed_signature.html#a6a1db672c609943fe7af84320dc68ba3">PreComputedSignature</a>
-</li>
-<li>rf
-: <a class="el" href="struct_pre_computed_signature.html#ac244bd559a96812bcee7671abc299b66">PreComputedSignature</a>
+: <a class="el" href="struct_nr_prove_commit_output.html#aab0f11e55d3b8d838e472242e27a1a43">NrProveCommitOutput</a>
+, <a class="el" href="struct_sign_commit_output.html#a0f35f1d619ea972acbdf9d45af630de0">SignCommitOutput</a>
</li>
<li>rl_ver
: <a class="el" href="struct_epid11_signature.html#a43cb3ed13c862ff05a9292623ad57c5e">Epid11Signature</a>
, <a class="el" href="struct_epid_signature.html#a4155f3f4f1223fc4ae50c94f5305def1">EpidSignature</a>
</li>
-<li>rx
-: <a class="el" href="struct_pre_computed_signature.html#acd0674d5b5e96244645e9abef7bdbddc">PreComputedSignature</a>
-</li>
</ul>
@@ -435,7 +419,8 @@ $(document).ready(function(){initNavTree('functions.html','');});
</li>
<li>T
: <a class="el" href="struct_nr_proof.html#ace535065bbf96502b893ac677dc8dcd3">NrProof</a>
-, <a class="el" href="struct_pre_computed_signature.html#a73471643dc757115701833ca2e831a72">PreComputedSignature</a>
+, <a class="el" href="struct_nr_prove_commit_output.html#a00234dfa2443d49f5a294c58fdacb064">NrProveCommitOutput</a>
+, <a class="el" href="struct_sign_commit_output.html#a9ce3b28916094f5fa108d5f5c86631b0">SignCommitOutput</a>
</li>
<li>T1
: <a class="el" href="struct_epid11_basic_signature.html#a58b058a9c5119a240177acfade328b3b">Epid11BasicSignature</a>
@@ -502,7 +487,7 @@ $(document).ready(function(){initNavTree('functions.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/functions_vars.html b/doc/html/functions_vars.html
index 056b9bc..071a59c 100644
--- a/doc/html/functions_vars.html
+++ b/doc/html/functions_vars.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -71,12 +71,7 @@ $(document).ready(function(){initNavTree('functions_vars.html','');});
</li>
<li>A
: <a class="el" href="struct_membership_credential.html#a6d38ac3a9c5417833b8adb9b22bc9dc8">MembershipCredential</a>
-</li>
-<li>a
-: <a class="el" href="struct_pre_computed_signature.html#af23f3f9693857a33fe8564644612ea37">PreComputedSignature</a>
-</li>
-<li>A
-: <a class="el" href="struct_priv_key.html#a266c7e369b8b868ef5755e9cd3c0c849">PrivKey</a>
+, <a class="el" href="struct_priv_key.html#a266c7e369b8b868ef5755e9cd3c0c849">PrivKey</a>
</li>
<li>a_tick
: <a class="el" href="struct_epid11_params.html#ae8770bb921aac9214ff8c45c41dbb228">Epid11Params</a>
@@ -97,10 +92,9 @@ $(document).ready(function(){initNavTree('functions_vars.html','');});
, <a class="el" href="struct_epid11_sig_rl_entry.html#abe47cfbd00684941f93a211417bedf0c">Epid11SigRlEntry</a>
, <a class="el" href="struct_epid2_params.html#a2f868edb49be49f645101ef5ebbbc551">Epid2Params</a>
, <a class="el" href="struct_epid_ca_certificate.html#a280e0b0238cf45834c21849ab8a7e124">EpidCaCertificate</a>
-, <a class="el" href="struct_pre_computed_signature.html#a666710432d9d54ca896647a976892c4f">PreComputedSignature</a>
</li>
<li>B
-: <a class="el" href="struct_pre_computed_signature.html#a9cc2eb61572a1aca9e6bc3d5e6f4c1fe">PreComputedSignature</a>
+: <a class="el" href="struct_sign_commit_output.html#ae2ebcc07395e60187d9ccca373665dba">SignCommitOutput</a>
</li>
<li>b
: <a class="el" href="struct_sig_rl_entry.html#ac6a47ff0d1b8ea1512e0ff14983ac5ce">SigRlEntry</a>
@@ -266,7 +260,7 @@ $(document).ready(function(){initNavTree('functions_vars.html','');});
: <a class="el" href="struct_epid11_sig_rl_entry.html#a5de66e1352eafe95774a0d76bac8f01a">Epid11SigRlEntry</a>
</li>
<li>K
-: <a class="el" href="struct_pre_computed_signature.html#a2a4eaffe2717bd9c8c360599612adbe6">PreComputedSignature</a>
+: <a class="el" href="struct_sign_commit_output.html#a496bdc4d14fb73b1e85dfff3bc9fd3ba">SignCommitOutput</a>
</li>
<li>k
: <a class="el" href="struct_sig_rl_entry.html#a0dfeb058614e81878bfbf86ae3edac3c">SigRlEntry</a>
@@ -347,27 +341,17 @@ $(document).ready(function(){initNavTree('functions_vars.html','');});
: <a class="el" href="struct_epid_ca_certificate.html#ab9d4c318b1fc8d38d3ce53b29f2dfee2">EpidCaCertificate</a>
</li>
<li>R1
-: <a class="el" href="struct_pre_computed_signature.html#a72be597624957e3d668c95ff6f445f94">PreComputedSignature</a>
+: <a class="el" href="struct_nr_prove_commit_output.html#af9c605d560f83ccd69e35d8b9cfe51b3">NrProveCommitOutput</a>
+, <a class="el" href="struct_sign_commit_output.html#ad01513f153f51f7ce211cf323a224499">SignCommitOutput</a>
</li>
<li>R2
-: <a class="el" href="struct_pre_computed_signature.html#a79f06fb57842597372e00dd34c1a804a">PreComputedSignature</a>
-</li>
-<li>ra
-: <a class="el" href="struct_pre_computed_signature.html#a54462643b8a2b4f2741bf8d2e6909d11">PreComputedSignature</a>
-</li>
-<li>rb
-: <a class="el" href="struct_pre_computed_signature.html#a6a1db672c609943fe7af84320dc68ba3">PreComputedSignature</a>
-</li>
-<li>rf
-: <a class="el" href="struct_pre_computed_signature.html#ac244bd559a96812bcee7671abc299b66">PreComputedSignature</a>
+: <a class="el" href="struct_nr_prove_commit_output.html#aab0f11e55d3b8d838e472242e27a1a43">NrProveCommitOutput</a>
+, <a class="el" href="struct_sign_commit_output.html#a0f35f1d619ea972acbdf9d45af630de0">SignCommitOutput</a>
</li>
<li>rl_ver
: <a class="el" href="struct_epid11_signature.html#a43cb3ed13c862ff05a9292623ad57c5e">Epid11Signature</a>
, <a class="el" href="struct_epid_signature.html#a4155f3f4f1223fc4ae50c94f5305def1">EpidSignature</a>
</li>
-<li>rx
-: <a class="el" href="struct_pre_computed_signature.html#acd0674d5b5e96244645e9abef7bdbddc">PreComputedSignature</a>
-</li>
</ul>
@@ -435,7 +419,8 @@ $(document).ready(function(){initNavTree('functions_vars.html','');});
</li>
<li>T
: <a class="el" href="struct_nr_proof.html#ace535065bbf96502b893ac677dc8dcd3">NrProof</a>
-, <a class="el" href="struct_pre_computed_signature.html#a73471643dc757115701833ca2e831a72">PreComputedSignature</a>
+, <a class="el" href="struct_nr_prove_commit_output.html#a00234dfa2443d49f5a294c58fdacb064">NrProveCommitOutput</a>
+, <a class="el" href="struct_sign_commit_output.html#a9ce3b28916094f5fa108d5f5c86631b0">SignCommitOutput</a>
</li>
<li>T1
: <a class="el" href="struct_epid11_basic_signature.html#a58b058a9c5119a240177acfade328b3b">Epid11BasicSignature</a>
@@ -502,7 +487,7 @@ $(document).ready(function(){initNavTree('functions_vars.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals.html b/doc/html/globals.html
index bc81e4f..c24a588 100644
--- a/doc/html/globals.html
+++ b/doc/html/globals.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -71,7 +71,7 @@ $(document).ready(function(){initNavTree('globals.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_b.html b/doc/html/globals_b.html
index 32e6596..14e995f 100644
--- a/doc/html/globals_b.html
+++ b/doc/html/globals_b.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -101,7 +101,7 @@ $(document).ready(function(){initNavTree('globals_b.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_c.html b/doc/html/globals_c.html
new file mode 100644
index 0000000..a8ecc88
--- /dev/null
+++ b/doc/html/globals_c.html
@@ -0,0 +1,79 @@
+<!-- HTML header for doxygen 1.8.10-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.11"/>
+<title>Intel&reg; Enhanced Privacy ID SDK: Globals</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="navtree.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="resize.js"></script>
+<script type="text/javascript" src="navtreedata.js"></script>
+<script type="text/javascript" src="navtree.js"></script>
+<script type="text/javascript">
+ $(document).ready(initResizable);
+ $(window).load(resizeHeight);
+</script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+<link href="epidstyle.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td id="projectalign" style="padding-left: 0.5em;">
+ <div id="projectname"><a
+ onclick="storeLink('index.html')"
+ id="projectlink"
+ class="index.html"
+ href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
+&#160;<span id="projectnumber">4.0.0</span>
+</div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.11 -->
+</div><!-- top -->
+<div id="side-nav" class="ui-resizable side-nav-resizable">
+ <div id="nav-tree">
+ <div id="nav-tree-contents">
+ <div id="nav-sync" class="sync"></div>
+ </div>
+ </div>
+ <div id="splitbar" style="-moz-user-select:none;"
+ class="ui-resizable-handle">
+ </div>
+</div>
+<script type="text/javascript">
+$(document).ready(function(){initNavTree('globals_c.html','');});
+</script>
+<div id="doc-content">
+<div class="contents">
+<div class="textblock">Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:</div>
+
+<h3><a class="anchor" id="index_c"></a>- c -</h3><ul>
+<li>ConstOctStr
+: <a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">types.h</a>
+</li>
+</ul>
+</div><!-- contents -->
+</div><!-- doc-content -->
+<!-- HTML footer for doxygen 1.8.10-->
+<!-- start footer part -->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ <li class="footer">
+ &copy; 2016-2017 Intel Corporation
+ </li>
+ </ul>
+</div>
+</body>
+</html>
diff --git a/doc/html/globals_d.html b/doc/html/globals_d.html
index 5a581ac..820f0cc 100644
--- a/doc/html/globals_d.html
+++ b/doc/html/globals_d.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ $(document).ready(function(){initNavTree('globals_d.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_defs.html b/doc/html/globals_defs.html
index 32be0f5..61272c2 100644
--- a/doc/html/globals_defs.html
+++ b/doc/html/globals_defs.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -75,7 +75,7 @@ $(document).ready(function(){initNavTree('globals_defs.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_e.html b/doc/html/globals_e.html
index 4d01760..25ed4b1 100644
--- a/doc/html/globals_e.html
+++ b/doc/html/globals_e.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -61,10 +61,10 @@ $(document).ready(function(){initNavTree('globals_e.html','');});
<h3><a class="anchor" id="index_e"></a>- e -</h3><ul>
<li>EcdsaSignBuffer()
-: <a class="el" href="group___ecdsa_primitives.html#ga67091ecae643c1b8a0b0a4946eda7afe">ecdsa.h</a>
+: <a class="el" href="group___ecdsa_primitives.html#gaef0e8a31e830fe9285b43a0969e6611a">ecdsa.h</a>
</li>
<li>EcdsaVerifyBuffer()
-: <a class="el" href="group___ecdsa_primitives.html#gaab68de7291db6e42a01e99c2fa40057f">ecdsa.h</a>
+: <a class="el" href="group___ecdsa_primitives.html#ga07e4ebd3423e1f6f9ae35f0608dde7c0">ecdsa.h</a>
</li>
<li>EcExp()
: <a class="el" href="group___ec_group_primitives.html#ga01bf8d6fa60a2e445490966b3a06c270">ecgroup.h</a>
@@ -76,10 +76,10 @@ $(document).ready(function(){initNavTree('globals_e.html','');});
: <a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">ecgroup.h</a>
</li>
<li>EcHash()
-: <a class="el" href="group___ec_group_primitives.html#gadc22ee07864a7ee681a881029b69d76a">ecgroup.h</a>
+: <a class="el" href="group___ec_group_primitives.html#gab647ccc031063807ff3860f51d0f6919">ecgroup.h</a>
</li>
<li>EcInGroup()
-: <a class="el" href="group___ec_group_primitives.html#ga4d0f32aede3066eae500241b387bd970">ecgroup.h</a>
+: <a class="el" href="group___ec_group_primitives.html#ga48ec5ae951c9f49d8d7d983234eea921">ecgroup.h</a>
</li>
<li>EcInverse()
: <a class="el" href="group___ec_group_primitives.html#ga0b6d7a3398251e9352fb29ef4abef466">ecgroup.h</a>
@@ -118,7 +118,7 @@ $(document).ready(function(){initNavTree('globals_e.html','');});
: <a class="el" href="group___epid11_verifier_module.html#ga0b79c79d09e3551158e1c38c7c335929">api.h</a>
</li>
<li>Epid11EcHash()
-: <a class="el" href="group___ec_group_primitives.html#gadf83fa559585375faad9a8b1559249bc">ecgroup.h</a>
+: <a class="el" href="group___ec_group_primitives.html#gaad96a1498b85d28f71514b8f7b154d82">ecgroup.h</a>
</li>
<li>Epid11G1ElemStr
: <a class="el" href="group___epid11_types.html#gadff9c05d5b7751024152b40dda545545">types.h</a>
@@ -181,11 +181,14 @@ $(document).ready(function(){initNavTree('globals_e.html','');});
: <a class="el" href="group___epid11_verifier_module.html#ga7b5d19277da043c2b79721975d7bd070">api.h</a>
</li>
<li>EpidAddPreSigs()
-: <a class="el" href="group___epid_member_module.html#gad2e3de5c6ce641a318f8a46b61e75236">api.h</a>
+: <a class="el" href="group___epid_member_module.html#gacb0547ec085a9ed324d323416bce4a78">api.h</a>
</li>
<li>EpidAreSigsLinked()
: <a class="el" href="group___epid_verifier_module.html#gae44bd8acbc1e7205aeedff0c7e2632a8">api.h</a>
</li>
+<li>EpidAssemblePrivKey()
+: <a class="el" href="group___epid_member_module.html#ga4ccaa8337931523c77567f5b846ef188">api.h</a>
+</li>
<li>EpidBlacklistSig()
: <a class="el" href="group___epid_verifier_module.html#ga8eaeb9f4a34e9e37ccdf342919f38c69">api.h</a>
</li>
@@ -207,9 +210,6 @@ $(document).ready(function(){initNavTree('globals_e.html','');});
<li>EpidGetVerifierRlSize()
: <a class="el" href="group___epid_verifier_module.html#ga2a75c7d5775e852a7b6e24178dd4054f">api.h</a>
</li>
-<li>EpidIsPrivKeyInGroup()
-: <a class="el" href="group___epid_member_module.html#ga8e3f201d1e9dc668659e08a3bdf543b6">api.h</a>
-</li>
<li>EpidMemberCreate()
: <a class="el" href="group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb">api.h</a>
</li>
@@ -219,6 +219,9 @@ $(document).ready(function(){initNavTree('globals_e.html','');});
<li>EpidMemberSetHashAlg()
: <a class="el" href="group___epid_member_module.html#ga9998eb454838ff5d232ff22ecbab31bf">api.h</a>
</li>
+<li>EpidMemberSetSigRl()
+: <a class="el" href="group___epid_member_module.html#gaaae6f21f58c22fce58076f10d68159f4">api.h</a>
+</li>
<li>EpidMemberWritePrecomp()
: <a class="el" href="group___epid_member_module.html#ga5c35798d62cf81c4ca62b22c38809721">api.h</a>
</li>
@@ -250,7 +253,7 @@ $(document).ready(function(){initNavTree('globals_e.html','');});
: <a class="el" href="group___epid_member_module.html#ga13dd0d72be9babf8194d472d7712a361">api.h</a>
</li>
<li>EpidSign()
-: <a class="el" href="group___epid_member_module.html#ga759155a719254f734157722716dac640">api.h</a>
+: <a class="el" href="group___epid_member_module.html#ga74d1409a816cb52633564b793072da5f">api.h</a>
</li>
<li>EpidSignBasic()
: <a class="el" href="group___epid_member_module.html#gae04a250d5981fcf9bd6f9f57e0468faa">api.h</a>
@@ -297,9 +300,6 @@ $(document).ready(function(){initNavTree('globals_e.html','');});
<li>EpidVersion
: <a class="el" href="group___file_parser.html#ga1562efc7c1891875d6b2b9180d65de9d">file_parser.h</a>
</li>
-<li>EpidWritePreSigs()
-: <a class="el" href="group___epid_member_module.html#ga9e12c7cec8d0c4e07b12c0e26a278c9d">api.h</a>
-</li>
<li>EpidWriteVerifierRl()
: <a class="el" href="group___epid_verifier_module.html#gac857bff47e7d80363eac15285471fe81">api.h</a>
</li>
@@ -311,7 +311,7 @@ $(document).ready(function(){initNavTree('globals_e.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_enum.html b/doc/html/globals_enum.html
index e5d8f31..64619c7 100644
--- a/doc/html/globals_enum.html
+++ b/doc/html/globals_enum.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -81,7 +81,7 @@ $(document).ready(function(){initNavTree('globals_enum.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_eval.html b/doc/html/globals_eval.html
index d509456..d838e67 100644
--- a/doc/html/globals_eval.html
+++ b/doc/html/globals_eval.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -102,6 +102,9 @@ $(document).ready(function(){initNavTree('globals_eval.html','');});
<li>kEpidNotImpl
: <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a5252da1ff519a098446723e9edd30cc7">errors.h</a>
</li>
+<li>kEpidOutOfSequenceError
+: <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a700953ded1af35781948e8ada6dedf43">errors.h</a>
+</li>
<li>kEpidRandMaxIterErr
: <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a61234ad9610406da6bf7977afd72a357">errors.h</a>
</li>
@@ -197,7 +200,7 @@ $(document).ready(function(){initNavTree('globals_eval.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_f.html b/doc/html/globals_f.html
index a7623e4..74ccfe8 100644
--- a/doc/html/globals_f.html
+++ b/doc/html/globals_f.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -76,7 +76,7 @@ $(document).ready(function(){initNavTree('globals_f.html','');});
: <a class="el" href="group___finite_field_primitives.html#ga6622db072782fd9e53b4d59dd3dbd8e8">finitefield.h</a>
</li>
<li>FfHash()
-: <a class="el" href="group___finite_field_primitives.html#ga18a952cebb4a1274c73e6cb0c19e8aea">finitefield.h</a>
+: <a class="el" href="group___finite_field_primitives.html#gabd511d79d9cbd1899e59258f149102c5">finitefield.h</a>
</li>
<li>FfInv()
: <a class="el" href="group___finite_field_primitives.html#ga26069d035d0f6ade33af2b5d5c14949a">finitefield.h</a>
@@ -119,7 +119,7 @@ $(document).ready(function(){initNavTree('globals_f.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_func.html b/doc/html/globals_func.html
index e172435..1236d09 100644
--- a/doc/html/globals_func.html
+++ b/doc/html/globals_func.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -114,10 +114,10 @@ $(document).ready(function(){initNavTree('globals_func.html','');});
<h3><a class="anchor" id="index_e"></a>- e -</h3><ul>
<li>EcdsaSignBuffer()
-: <a class="el" href="group___ecdsa_primitives.html#ga67091ecae643c1b8a0b0a4946eda7afe">ecdsa.h</a>
+: <a class="el" href="group___ecdsa_primitives.html#gaef0e8a31e830fe9285b43a0969e6611a">ecdsa.h</a>
</li>
<li>EcdsaVerifyBuffer()
-: <a class="el" href="group___ecdsa_primitives.html#gaab68de7291db6e42a01e99c2fa40057f">ecdsa.h</a>
+: <a class="el" href="group___ecdsa_primitives.html#ga07e4ebd3423e1f6f9ae35f0608dde7c0">ecdsa.h</a>
</li>
<li>EcExp()
: <a class="el" href="group___ec_group_primitives.html#ga01bf8d6fa60a2e445490966b3a06c270">ecgroup.h</a>
@@ -126,10 +126,10 @@ $(document).ready(function(){initNavTree('globals_func.html','');});
: <a class="el" href="group___ec_group_primitives.html#ga3f96c43d14d24de0f7a5e214aef64196">ecgroup.h</a>
</li>
<li>EcHash()
-: <a class="el" href="group___ec_group_primitives.html#gadc22ee07864a7ee681a881029b69d76a">ecgroup.h</a>
+: <a class="el" href="group___ec_group_primitives.html#gab647ccc031063807ff3860f51d0f6919">ecgroup.h</a>
</li>
<li>EcInGroup()
-: <a class="el" href="group___ec_group_primitives.html#ga4d0f32aede3066eae500241b387bd970">ecgroup.h</a>
+: <a class="el" href="group___ec_group_primitives.html#ga48ec5ae951c9f49d8d7d983234eea921">ecgroup.h</a>
</li>
<li>EcInverse()
: <a class="el" href="group___ec_group_primitives.html#ga0b6d7a3398251e9352fb29ef4abef466">ecgroup.h</a>
@@ -165,7 +165,7 @@ $(document).ready(function(){initNavTree('globals_func.html','');});
: <a class="el" href="group___epid11_verifier_module.html#ga0b79c79d09e3551158e1c38c7c335929">api.h</a>
</li>
<li>Epid11EcHash()
-: <a class="el" href="group___ec_group_primitives.html#gadf83fa559585375faad9a8b1559249bc">ecgroup.h</a>
+: <a class="el" href="group___ec_group_primitives.html#gaad96a1498b85d28f71514b8f7b154d82">ecgroup.h</a>
</li>
<li>Epid11NrVerify()
: <a class="el" href="group___epid11_verifier_module.html#ga3a2e320d7de6156b2ce9d73e9cdce813">api.h</a>
@@ -213,11 +213,14 @@ $(document).ready(function(){initNavTree('globals_func.html','');});
: <a class="el" href="group___epid11_verifier_module.html#ga7b5d19277da043c2b79721975d7bd070">api.h</a>
</li>
<li>EpidAddPreSigs()
-: <a class="el" href="group___epid_member_module.html#gad2e3de5c6ce641a318f8a46b61e75236">api.h</a>
+: <a class="el" href="group___epid_member_module.html#gacb0547ec085a9ed324d323416bce4a78">api.h</a>
</li>
<li>EpidAreSigsLinked()
: <a class="el" href="group___epid_verifier_module.html#gae44bd8acbc1e7205aeedff0c7e2632a8">api.h</a>
</li>
+<li>EpidAssemblePrivKey()
+: <a class="el" href="group___epid_member_module.html#ga4ccaa8337931523c77567f5b846ef188">api.h</a>
+</li>
<li>EpidBlacklistSig()
: <a class="el" href="group___epid_verifier_module.html#ga8eaeb9f4a34e9e37ccdf342919f38c69">api.h</a>
</li>
@@ -236,9 +239,6 @@ $(document).ready(function(){initNavTree('globals_func.html','');});
<li>EpidGetVerifierRlSize()
: <a class="el" href="group___epid_verifier_module.html#ga2a75c7d5775e852a7b6e24178dd4054f">api.h</a>
</li>
-<li>EpidIsPrivKeyInGroup()
-: <a class="el" href="group___epid_member_module.html#ga8e3f201d1e9dc668659e08a3bdf543b6">api.h</a>
-</li>
<li>EpidMemberCreate()
: <a class="el" href="group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb">api.h</a>
</li>
@@ -248,6 +248,9 @@ $(document).ready(function(){initNavTree('globals_func.html','');});
<li>EpidMemberSetHashAlg()
: <a class="el" href="group___epid_member_module.html#ga9998eb454838ff5d232ff22ecbab31bf">api.h</a>
</li>
+<li>EpidMemberSetSigRl()
+: <a class="el" href="group___epid_member_module.html#gaaae6f21f58c22fce58076f10d68159f4">api.h</a>
+</li>
<li>EpidMemberWritePrecomp()
: <a class="el" href="group___epid_member_module.html#ga5c35798d62cf81c4ca62b22c38809721">api.h</a>
</li>
@@ -279,7 +282,7 @@ $(document).ready(function(){initNavTree('globals_func.html','');});
: <a class="el" href="group___epid_member_module.html#ga13dd0d72be9babf8194d472d7712a361">api.h</a>
</li>
<li>EpidSign()
-: <a class="el" href="group___epid_member_module.html#ga759155a719254f734157722716dac640">api.h</a>
+: <a class="el" href="group___epid_member_module.html#ga74d1409a816cb52633564b793072da5f">api.h</a>
</li>
<li>EpidSignBasic()
: <a class="el" href="group___epid_member_module.html#gae04a250d5981fcf9bd6f9f57e0468faa">api.h</a>
@@ -320,9 +323,6 @@ $(document).ready(function(){initNavTree('globals_func.html','');});
<li>EpidVerifyBasicSig()
: <a class="el" href="group___epid_verifier_module.html#gac3b1f1a2bdba8eeeebbf1e0c8c00862e">api.h</a>
</li>
-<li>EpidWritePreSigs()
-: <a class="el" href="group___epid_member_module.html#ga9e12c7cec8d0c4e07b12c0e26a278c9d">api.h</a>
-</li>
<li>EpidWriteVerifierRl()
: <a class="el" href="group___epid_verifier_module.html#gac857bff47e7d80363eac15285471fe81">api.h</a>
</li>
@@ -340,7 +340,7 @@ $(document).ready(function(){initNavTree('globals_func.html','');});
: <a class="el" href="group___finite_field_primitives.html#ga6622db072782fd9e53b4d59dd3dbd8e8">finitefield.h</a>
</li>
<li>FfHash()
-: <a class="el" href="group___finite_field_primitives.html#ga18a952cebb4a1274c73e6cb0c19e8aea">finitefield.h</a>
+: <a class="el" href="group___finite_field_primitives.html#gabd511d79d9cbd1899e59258f149102c5">finitefield.h</a>
</li>
<li>FfInv()
: <a class="el" href="group___finite_field_primitives.html#ga26069d035d0f6ade33af2b5d5c14949a">finitefield.h</a>
@@ -415,7 +415,7 @@ $(document).ready(function(){initNavTree('globals_func.html','');});
<h3><a class="anchor" id="index_p"></a>- p -</h3><ul>
<li>Pairing()
-: <a class="el" href="group___pairing_primitives.html#ga5dd07d13536e27c37eaeee285297066c">pairing.h</a>
+: <a class="el" href="group___pairing_primitives.html#ga58a9d3cb6129274a04c72a35a52f768d">pairing.h</a>
</li>
<li>PrintBigNum()
: <a class="el" href="group___epid_print.html#ga45a933b44fc1dfe926e3af89c198070a">printutils.h</a>
@@ -458,13 +458,13 @@ $(document).ready(function(){initNavTree('globals_func.html','');});
<h3><a class="anchor" id="index_r"></a>- r -</h3><ul>
<li>ReadBigNum()
-: <a class="el" href="group___big_num_primitives.html#ga808cf477b70ed06358b11756bfe36024">bignum.h</a>
+: <a class="el" href="group___big_num_primitives.html#gabe8e39d5788423f41770a71a4c911fbe">bignum.h</a>
</li>
<li>ReadEcPoint()
-: <a class="el" href="group___ec_group_primitives.html#ga2d433f567fa2419465a49604f4da21ad">ecgroup.h</a>
+: <a class="el" href="group___ec_group_primitives.html#gad495a9f91b79984f7533c8ea4f92b3cb">ecgroup.h</a>
</li>
<li>ReadFfElement()
-: <a class="el" href="group___finite_field_primitives.html#ga884d9e1baadf29a410244a735853e3c7">finitefield.h</a>
+: <a class="el" href="group___finite_field_primitives.html#ga8a143a5a815a62f4947be2de1653c50f">finitefield.h</a>
</li>
</ul>
@@ -476,15 +476,64 @@ $(document).ready(function(){initNavTree('globals_func.html','');});
</ul>
+<h3><a class="anchor" id="index_t"></a>- t -</h3><ul>
+<li>TpmAddPreSigs()
+: <a class="el" href="group___tpm_module.html#ga2335ec4eb78b542cf87df9b0cd15358c">presig.h</a>
+</li>
+<li>TpmCreate()
+: <a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287">context.h</a>
+</li>
+<li>TpmDecompressKey()
+: <a class="el" href="group___tpm_module.html#gaeb9bfaa9288263af9feccd0d0543c9bc">decompress.h</a>
+</li>
+<li>TpmDelete()
+: <a class="el" href="group___tpm_module.html#ga95bc18225c1d87803be7965978e37449">context.h</a>
+</li>
+<li>TpmGetNumPreSigs()
+: <a class="el" href="group___tpm_module.html#gaa53a6bd52e22808bac21596a964bdece">presig.h</a>
+</li>
+<li>TpmInit()
+: <a class="el" href="group___tpm_module.html#ga5e62323b94837b847f3e869cf2ff3615">init.h</a>
+</li>
+<li>TpmIsKeyValid()
+: <a class="el" href="group___tpm_module.html#ga3318f97e4d1763815dace3779ae6564f">validatekey.h</a>
+</li>
+<li>TpmJoin()
+: <a class="el" href="group___tpm_module.html#gab80c411f070858fbe019d93f5ac6a6ec">join.h</a>
+</li>
+<li>TpmJoinCommit()
+: <a class="el" href="group___tpm_module.html#gae69218c9cba6a19d3ae1199c59772efc">join.h</a>
+</li>
+<li>TpmNrProve()
+: <a class="el" href="group___tpm_module.html#ga4346d22fb9fed6a161cb1ea178b50ed2">nrprove.h</a>
+</li>
+<li>TpmNrProveCommit()
+: <a class="el" href="group___tpm_module.html#gace6002b520db41d8e781b02c6f538dc0">nrprove.h</a>
+</li>
+<li>TpmProvision()
+: <a class="el" href="group___tpm_module.html#ga42b80d485cff39fe9ec14a0b5a81426d">context.h</a>
+</li>
+<li>TpmProvisionCompressed()
+: <a class="el" href="group___tpm_module.html#ga688441f78f68aa53c41fcae4d31c6f50">context.h</a>
+</li>
+<li>TpmSign()
+: <a class="el" href="group___tpm_module.html#gaa667fb3295e4533334bb32afcd43890f">sign.h</a>
+</li>
+<li>TpmSignCommit()
+: <a class="el" href="group___tpm_module.html#gaf9004ce8832c1acae497604d1deb49cd">sign.h</a>
+</li>
+</ul>
+
+
<h3><a class="anchor" id="index_w"></a>- w -</h3><ul>
<li>WriteBigNum()
-: <a class="el" href="group___big_num_primitives.html#ga79d86c872fe8da0f217e3ba069f98d38">bignum.h</a>
+: <a class="el" href="group___big_num_primitives.html#ga904c16cc020e7196f22ac9abdc31b41f">bignum.h</a>
</li>
<li>WriteEcPoint()
-: <a class="el" href="group___ec_group_primitives.html#ga4bb7d6691ffbb6e947c1068453e27fbd">ecgroup.h</a>
+: <a class="el" href="group___ec_group_primitives.html#ga7a8bdb9782d065bc32fd102e0ae73ccb">ecgroup.h</a>
</li>
<li>WriteFfElement()
-: <a class="el" href="group___finite_field_primitives.html#ga678694636708463b078d842d5c58a900">finitefield.h</a>
+: <a class="el" href="group___finite_field_primitives.html#gaa3c1f7515dd823ddad8764091ebc665f">finitefield.h</a>
</li>
</ul>
</div><!-- contents -->
@@ -494,7 +543,7 @@ $(document).ready(function(){initNavTree('globals_func.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_g.html b/doc/html/globals_g.html
index 73f98a5..acabe7c 100644
--- a/doc/html/globals_g.html
+++ b/doc/html/globals_g.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -71,7 +71,7 @@ $(document).ready(function(){initNavTree('globals_g.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_h.html b/doc/html/globals_h.html
index 227a488..5e4ebc2 100644
--- a/doc/html/globals_h.html
+++ b/doc/html/globals_h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -71,7 +71,7 @@ $(document).ready(function(){initNavTree('globals_h.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_i.html b/doc/html/globals_i.html
index cd8c032..9168758 100644
--- a/doc/html/globals_i.html
+++ b/doc/html/globals_i.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('globals_i.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_k.html b/doc/html/globals_k.html
index b403cac..56eef29 100644
--- a/doc/html/globals_k.html
+++ b/doc/html/globals_k.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -105,6 +105,9 @@ $(document).ready(function(){initNavTree('globals_k.html','');});
<li>kEpidNotImpl
: <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a5252da1ff519a098446723e9edd30cc7">errors.h</a>
</li>
+<li>kEpidOutOfSequenceError
+: <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a700953ded1af35781948e8ada6dedf43">errors.h</a>
+</li>
<li>kEpidRandMaxIterErr
: <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a61234ad9610406da6bf7977afd72a357">errors.h</a>
</li>
@@ -203,7 +206,7 @@ $(document).ready(function(){initNavTree('globals_k.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_m.html b/doc/html/globals_m.html
index 4e74e83..1176e0e 100644
--- a/doc/html/globals_m.html
+++ b/doc/html/globals_m.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -71,7 +71,7 @@ $(document).ready(function(){initNavTree('globals_m.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_n.html b/doc/html/globals_n.html
index 2edd5a5..2985516 100644
--- a/doc/html/globals_n.html
+++ b/doc/html/globals_n.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -95,7 +95,7 @@ $(document).ready(function(){initNavTree('globals_n.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_o.html b/doc/html/globals_o.html
new file mode 100644
index 0000000..bbb1e5b
--- /dev/null
+++ b/doc/html/globals_o.html
@@ -0,0 +1,79 @@
+<!-- HTML header for doxygen 1.8.10-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.11"/>
+<title>Intel&reg; Enhanced Privacy ID SDK: Globals</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="navtree.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="resize.js"></script>
+<script type="text/javascript" src="navtreedata.js"></script>
+<script type="text/javascript" src="navtree.js"></script>
+<script type="text/javascript">
+ $(document).ready(initResizable);
+ $(window).load(resizeHeight);
+</script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+<link href="epidstyle.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td id="projectalign" style="padding-left: 0.5em;">
+ <div id="projectname"><a
+ onclick="storeLink('index.html')"
+ id="projectlink"
+ class="index.html"
+ href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
+&#160;<span id="projectnumber">4.0.0</span>
+</div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.11 -->
+</div><!-- top -->
+<div id="side-nav" class="ui-resizable side-nav-resizable">
+ <div id="nav-tree">
+ <div id="nav-tree-contents">
+ <div id="nav-sync" class="sync"></div>
+ </div>
+ </div>
+ <div id="splitbar" style="-moz-user-select:none;"
+ class="ui-resizable-handle">
+ </div>
+</div>
+<script type="text/javascript">
+$(document).ready(function(){initNavTree('globals_o.html','');});
+</script>
+<div id="doc-content">
+<div class="contents">
+<div class="textblock">Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:</div>
+
+<h3><a class="anchor" id="index_o"></a>- o -</h3><ul>
+<li>OctStr
+: <a class="el" href="group___epid_types.html#ga3315fb24f4c5783b6d6eb107933390b0">types.h</a>
+</li>
+</ul>
+</div><!-- contents -->
+</div><!-- doc-content -->
+<!-- HTML footer for doxygen 1.8.10-->
+<!-- start footer part -->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ <li class="footer">
+ &copy; 2016-2017 Intel Corporation
+ </li>
+ </ul>
+</div>
+</body>
+</html>
diff --git a/doc/html/globals_p.html b/doc/html/globals_p.html
index 45b4ea4..454ff90 100644
--- a/doc/html/globals_p.html
+++ b/doc/html/globals_p.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -61,7 +61,7 @@ $(document).ready(function(){initNavTree('globals_p.html','');});
<h3><a class="anchor" id="index_p"></a>- p -</h3><ul>
<li>Pairing()
-: <a class="el" href="group___pairing_primitives.html#ga5dd07d13536e27c37eaeee285297066c">pairing.h</a>
+: <a class="el" href="group___pairing_primitives.html#ga58a9d3cb6129274a04c72a35a52f768d">pairing.h</a>
</li>
<li>PairingState
: <a class="el" href="group___pairing_primitives.html#ga3f1fa61d25487f96dfb0ffef4ad35607">pairing.h</a>
@@ -113,7 +113,7 @@ $(document).ready(function(){initNavTree('globals_p.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_r.html b/doc/html/globals_r.html
index 9d6af06..9cdf1b8 100644
--- a/doc/html/globals_r.html
+++ b/doc/html/globals_r.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -61,13 +61,13 @@ $(document).ready(function(){initNavTree('globals_r.html','');});
<h3><a class="anchor" id="index_r"></a>- r -</h3><ul>
<li>ReadBigNum()
-: <a class="el" href="group___big_num_primitives.html#ga808cf477b70ed06358b11756bfe36024">bignum.h</a>
+: <a class="el" href="group___big_num_primitives.html#gabe8e39d5788423f41770a71a4c911fbe">bignum.h</a>
</li>
<li>ReadEcPoint()
-: <a class="el" href="group___ec_group_primitives.html#ga2d433f567fa2419465a49604f4da21ad">ecgroup.h</a>
+: <a class="el" href="group___ec_group_primitives.html#gad495a9f91b79984f7533c8ea4f92b3cb">ecgroup.h</a>
</li>
<li>ReadFfElement()
-: <a class="el" href="group___finite_field_primitives.html#ga884d9e1baadf29a410244a735853e3c7">finitefield.h</a>
+: <a class="el" href="group___finite_field_primitives.html#ga8a143a5a815a62f4947be2de1653c50f">finitefield.h</a>
</li>
<li>ReKeySeed
: <a class="el" href="group___epid_types.html#ga54bd22670f2e348593db7ab631131d10">types.h</a>
@@ -80,7 +80,7 @@ $(document).ready(function(){initNavTree('globals_r.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_s.html b/doc/html/globals_s.html
index ffba267..df4e600 100644
--- a/doc/html/globals_s.html
+++ b/doc/html/globals_s.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('globals_s.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_t.html b/doc/html/globals_t.html
index 7e7f3e8..777151a 100644
--- a/doc/html/globals_t.html
+++ b/doc/html/globals_t.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -60,6 +60,51 @@ $(document).ready(function(){initNavTree('globals_t.html','');});
<div class="textblock">Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:</div>
<h3><a class="anchor" id="index_t"></a>- t -</h3><ul>
+<li>TpmAddPreSigs()
+: <a class="el" href="group___tpm_module.html#ga2335ec4eb78b542cf87df9b0cd15358c">presig.h</a>
+</li>
+<li>TpmCreate()
+: <a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287">context.h</a>
+</li>
+<li>TpmDecompressKey()
+: <a class="el" href="group___tpm_module.html#gaeb9bfaa9288263af9feccd0d0543c9bc">decompress.h</a>
+</li>
+<li>TpmDelete()
+: <a class="el" href="group___tpm_module.html#ga95bc18225c1d87803be7965978e37449">context.h</a>
+</li>
+<li>TpmGetNumPreSigs()
+: <a class="el" href="group___tpm_module.html#gaa53a6bd52e22808bac21596a964bdece">presig.h</a>
+</li>
+<li>TpmInit()
+: <a class="el" href="group___tpm_module.html#ga5e62323b94837b847f3e869cf2ff3615">init.h</a>
+</li>
+<li>TpmIsKeyValid()
+: <a class="el" href="group___tpm_module.html#ga3318f97e4d1763815dace3779ae6564f">validatekey.h</a>
+</li>
+<li>TpmJoin()
+: <a class="el" href="group___tpm_module.html#gab80c411f070858fbe019d93f5ac6a6ec">join.h</a>
+</li>
+<li>TpmJoinCommit()
+: <a class="el" href="group___tpm_module.html#gae69218c9cba6a19d3ae1199c59772efc">join.h</a>
+</li>
+<li>TpmNrProve()
+: <a class="el" href="group___tpm_module.html#ga4346d22fb9fed6a161cb1ea178b50ed2">nrprove.h</a>
+</li>
+<li>TpmNrProveCommit()
+: <a class="el" href="group___tpm_module.html#gace6002b520db41d8e781b02c6f538dc0">nrprove.h</a>
+</li>
+<li>TpmProvision()
+: <a class="el" href="group___tpm_module.html#ga42b80d485cff39fe9ec14a0b5a81426d">context.h</a>
+</li>
+<li>TpmProvisionCompressed()
+: <a class="el" href="group___tpm_module.html#ga688441f78f68aa53c41fcae4d31c6f50">context.h</a>
+</li>
+<li>TpmSign()
+: <a class="el" href="group___tpm_module.html#gaa667fb3295e4533334bb32afcd43890f">sign.h</a>
+</li>
+<li>TpmSignCommit()
+: <a class="el" href="group___tpm_module.html#gaf9004ce8832c1acae497604d1deb49cd">sign.h</a>
+</li>
<li>true
: <a class="el" href="stdtypes_8h.html#a41f9c5fb8b08eb5dc3edce4dcb37fee7">stdtypes.h</a>
</li>
@@ -71,7 +116,7 @@ $(document).ready(function(){initNavTree('globals_t.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_type.html b/doc/html/globals_type.html
index 1dfada3..7abeba3 100644
--- a/doc/html/globals_type.html
+++ b/doc/html/globals_type.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -67,6 +67,9 @@ $(document).ready(function(){initNavTree('globals_type.html','');});
<li>bool
: <a class="el" href="stdtypes_8h.html#ad5c9d4ba3dc37783a528b0925dc981a0">stdtypes.h</a>
</li>
+<li>ConstOctStr
+: <a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">types.h</a>
+</li>
<li>EcGroup
: <a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">ecgroup.h</a>
</li>
@@ -103,6 +106,9 @@ $(document).ready(function(){initNavTree('globals_type.html','');});
<li>MemberCtx
: <a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">api.h</a>
</li>
+<li>OctStr
+: <a class="el" href="group___epid_types.html#ga3315fb24f4c5783b6d6eb107933390b0">types.h</a>
+</li>
<li>PairingState
: <a class="el" href="group___pairing_primitives.html#ga3f1fa61d25487f96dfb0ffef4ad35607">pairing.h</a>
</li>
@@ -123,7 +129,7 @@ $(document).ready(function(){initNavTree('globals_type.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_v.html b/doc/html/globals_v.html
index dfd3098..0b44c14 100644
--- a/doc/html/globals_v.html
+++ b/doc/html/globals_v.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -71,7 +71,7 @@ $(document).ready(function(){initNavTree('globals_v.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_vars.html b/doc/html/globals_vars.html
index ea821a9..e6fcc1d 100644
--- a/doc/html/globals_vars.html
+++ b/doc/html/globals_vars.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -72,7 +72,7 @@ $(document).ready(function(){initNavTree('globals_vars.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/globals_w.html b/doc/html/globals_w.html
index 4907342..009cdb6 100644
--- a/doc/html/globals_w.html
+++ b/doc/html/globals_w.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -61,13 +61,13 @@ $(document).ready(function(){initNavTree('globals_w.html','');});
<h3><a class="anchor" id="index_w"></a>- w -</h3><ul>
<li>WriteBigNum()
-: <a class="el" href="group___big_num_primitives.html#ga79d86c872fe8da0f217e3ba069f98d38">bignum.h</a>
+: <a class="el" href="group___big_num_primitives.html#ga904c16cc020e7196f22ac9abdc31b41f">bignum.h</a>
</li>
<li>WriteEcPoint()
-: <a class="el" href="group___ec_group_primitives.html#ga4bb7d6691ffbb6e947c1068453e27fbd">ecgroup.h</a>
+: <a class="el" href="group___ec_group_primitives.html#ga7a8bdb9782d065bc32fd102e0ae73ccb">ecgroup.h</a>
</li>
<li>WriteFfElement()
-: <a class="el" href="group___finite_field_primitives.html#ga678694636708463b078d842d5c58a900">finitefield.h</a>
+: <a class="el" href="group___finite_field_primitives.html#gaa3c1f7515dd823ddad8764091ebc665f">finitefield.h</a>
</li>
</ul>
</div><!-- contents -->
@@ -77,7 +77,7 @@ $(document).ready(function(){initNavTree('globals_w.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/glossary_8dox.html b/doc/html/glossary_8dox.html
index e8cf60a..8f3c01d 100644
--- a/doc/html/glossary_8dox.html
+++ b/doc/html/glossary_8dox.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('glossary_8dox.html','');});
<ul>
<li class="navelem"><a class="el" href="glossary_8dox.html">glossary.dox</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___big_num_primitives.html b/doc/html/group___big_num_primitives.html
index b71ca76..5a88775 100644
--- a/doc/html/group___big_num_primitives.html
+++ b/doc/html/group___big_num_primitives.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -83,12 +83,12 @@ Functions</h2></td></tr>
<tr class="memitem:ga2d17600068b1d94000635c6644258a03"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___big_num_primitives.html#ga2d17600068b1d94000635c6644258a03">DeleteBigNum</a> (<a class="el" href="group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718">BigNum</a> **bignum)</td></tr>
<tr class="memdesc:ga2d17600068b1d94000635c6644258a03"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes a previously allocated BigNum. <a href="#ga2d17600068b1d94000635c6644258a03">More...</a><br /></td></tr>
<tr class="separator:ga2d17600068b1d94000635c6644258a03"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga808cf477b70ed06358b11756bfe36024"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___big_num_primitives.html#ga808cf477b70ed06358b11756bfe36024">ReadBigNum</a> (void const *bn_str, size_t strlen, <a class="el" href="group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718">BigNum</a> *bn)</td></tr>
-<tr class="memdesc:ga808cf477b70ed06358b11756bfe36024"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deserializes a BigNum from a string. <a href="#ga808cf477b70ed06358b11756bfe36024">More...</a><br /></td></tr>
-<tr class="separator:ga808cf477b70ed06358b11756bfe36024"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga79d86c872fe8da0f217e3ba069f98d38"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___big_num_primitives.html#ga79d86c872fe8da0f217e3ba069f98d38">WriteBigNum</a> (<a class="el" href="group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718">BigNum</a> const *bn, size_t strlen, void *bn_str)</td></tr>
-<tr class="memdesc:ga79d86c872fe8da0f217e3ba069f98d38"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serializes a BigNum to a string. <a href="#ga79d86c872fe8da0f217e3ba069f98d38">More...</a><br /></td></tr>
-<tr class="separator:ga79d86c872fe8da0f217e3ba069f98d38"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gabe8e39d5788423f41770a71a4c911fbe"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___big_num_primitives.html#gabe8e39d5788423f41770a71a4c911fbe">ReadBigNum</a> (<a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a> bn_str, size_t strlen, <a class="el" href="group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718">BigNum</a> *bn)</td></tr>
+<tr class="memdesc:gabe8e39d5788423f41770a71a4c911fbe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deserializes a BigNum from a string. <a href="#gabe8e39d5788423f41770a71a4c911fbe">More...</a><br /></td></tr>
+<tr class="separator:gabe8e39d5788423f41770a71a4c911fbe"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga904c16cc020e7196f22ac9abdc31b41f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___big_num_primitives.html#ga904c16cc020e7196f22ac9abdc31b41f">WriteBigNum</a> (<a class="el" href="group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718">BigNum</a> const *bn, size_t strlen, <a class="el" href="group___epid_types.html#ga3315fb24f4c5783b6d6eb107933390b0">OctStr</a> bn_str)</td></tr>
+<tr class="memdesc:ga904c16cc020e7196f22ac9abdc31b41f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serializes a BigNum to a string. <a href="#ga904c16cc020e7196f22ac9abdc31b41f">More...</a><br /></td></tr>
+<tr class="separator:ga904c16cc020e7196f22ac9abdc31b41f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae70fd9b3026f0ab3c7e9601d0a3186b8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___big_num_primitives.html#gae70fd9b3026f0ab3c7e9601d0a3186b8">BigNumAdd</a> (<a class="el" href="group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718">BigNum</a> const *a, <a class="el" href="group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718">BigNum</a> const *b, <a class="el" href="group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718">BigNum</a> *r)</td></tr>
<tr class="memdesc:gae70fd9b3026f0ab3c7e9601d0a3186b8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds two BigNum values. <a href="#gae70fd9b3026f0ab3c7e9601d0a3186b8">More...</a><br /></td></tr>
<tr class="separator:gae70fd9b3026f0ab3c7e9601d0a3186b8"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -515,14 +515,14 @@ Functions</h2></td></tr>
</div>
</div>
-<a class="anchor" id="ga808cf477b70ed06358b11756bfe36024"></a>
+<a class="anchor" id="gabe8e39d5788423f41770a71a4c911fbe"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> ReadBigNum </td>
<td>(</td>
- <td class="paramtype">void const *&#160;</td>
+ <td class="paramtype"><a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a>&#160;</td>
<td class="paramname"><em>bn_str</em>, </td>
</tr>
<tr>
@@ -558,7 +558,7 @@ Functions</h2></td></tr>
</div>
</div>
-<a class="anchor" id="ga79d86c872fe8da0f217e3ba069f98d38"></a>
+<a class="anchor" id="ga904c16cc020e7196f22ac9abdc31b41f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
@@ -577,7 +577,7 @@ Functions</h2></td></tr>
<tr>
<td class="paramkey"></td>
<td></td>
- <td class="paramtype">void *&#160;</td>
+ <td class="paramtype"><a class="el" href="group___epid_types.html#ga3315fb24f4c5783b6d6eb107933390b0">OctStr</a>&#160;</td>
<td class="paramname"><em>bn_str</em>&#160;</td>
</tr>
<tr>
@@ -608,7 +608,7 @@ Functions</h2></td></tr>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___big_num_primitives.js b/doc/html/group___big_num_primitives.js
index ccdcec2..63bda6f 100644
--- a/doc/html/group___big_num_primitives.js
+++ b/doc/html/group___big_num_primitives.js
@@ -11,6 +11,6 @@ var group___big_num_primitives =
[ "BigNumSub", "group___big_num_primitives.html#gacbec9669ab0fe768e2be74dcaca397ea", null ],
[ "DeleteBigNum", "group___big_num_primitives.html#ga2d17600068b1d94000635c6644258a03", null ],
[ "NewBigNum", "group___big_num_primitives.html#gad5f6f262bfd780fed3678bcee16f0aed", null ],
- [ "ReadBigNum", "group___big_num_primitives.html#ga808cf477b70ed06358b11756bfe36024", null ],
- [ "WriteBigNum", "group___big_num_primitives.html#ga79d86c872fe8da0f217e3ba069f98d38", null ]
+ [ "ReadBigNum", "group___big_num_primitives.html#gabe8e39d5788423f41770a71a4c911fbe", null ],
+ [ "WriteBigNum", "group___big_num_primitives.html#ga904c16cc020e7196f22ac9abdc31b41f", null ]
]; \ No newline at end of file
diff --git a/doc/html/group___ec_group_primitives.html b/doc/html/group___ec_group_primitives.html
index 8c143ca..5501a99 100644
--- a/doc/html/group___ec_group_primitives.html
+++ b/doc/html/group___ec_group_primitives.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -93,12 +93,12 @@ Functions</h2></td></tr>
<tr class="memitem:ga8cb086d792bffb79b3ca07e6ca4ce0e7"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#ga8cb086d792bffb79b3ca07e6ca4ce0e7">DeleteEcPoint</a> (<a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> **p)</td></tr>
<tr class="memdesc:ga8cb086d792bffb79b3ca07e6ca4ce0e7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes a previously allocated EcPoint. <a href="#ga8cb086d792bffb79b3ca07e6ca4ce0e7">More...</a><br /></td></tr>
<tr class="separator:ga8cb086d792bffb79b3ca07e6ca4ce0e7"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga2d433f567fa2419465a49604f4da21ad"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#ga2d433f567fa2419465a49604f4da21ad">ReadEcPoint</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, void const *p_str, size_t strlen, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> *p)</td></tr>
-<tr class="memdesc:ga2d433f567fa2419465a49604f4da21ad"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deserializes an EcPoint from a string. <a href="#ga2d433f567fa2419465a49604f4da21ad">More...</a><br /></td></tr>
-<tr class="separator:ga2d433f567fa2419465a49604f4da21ad"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga4bb7d6691ffbb6e947c1068453e27fbd"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#ga4bb7d6691ffbb6e947c1068453e27fbd">WriteEcPoint</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *p, void *p_str, size_t strlen)</td></tr>
-<tr class="memdesc:ga4bb7d6691ffbb6e947c1068453e27fbd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serializes an EcPoint to a string. <a href="#ga4bb7d6691ffbb6e947c1068453e27fbd">More...</a><br /></td></tr>
-<tr class="separator:ga4bb7d6691ffbb6e947c1068453e27fbd"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gad495a9f91b79984f7533c8ea4f92b3cb"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#gad495a9f91b79984f7533c8ea4f92b3cb">ReadEcPoint</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, <a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a> p_str, size_t strlen, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> *p)</td></tr>
+<tr class="memdesc:gad495a9f91b79984f7533c8ea4f92b3cb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deserializes an EcPoint from a string. <a href="#gad495a9f91b79984f7533c8ea4f92b3cb">More...</a><br /></td></tr>
+<tr class="separator:gad495a9f91b79984f7533c8ea4f92b3cb"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga7a8bdb9782d065bc32fd102e0ae73ccb"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#ga7a8bdb9782d065bc32fd102e0ae73ccb">WriteEcPoint</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *p, <a class="el" href="group___epid_types.html#ga3315fb24f4c5783b6d6eb107933390b0">OctStr</a> p_str, size_t strlen)</td></tr>
+<tr class="memdesc:ga7a8bdb9782d065bc32fd102e0ae73ccb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serializes an EcPoint to a string. <a href="#ga7a8bdb9782d065bc32fd102e0ae73ccb">More...</a><br /></td></tr>
+<tr class="separator:ga7a8bdb9782d065bc32fd102e0ae73ccb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga25c9013cc76907d73765eb7a96aa8c96"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#ga25c9013cc76907d73765eb7a96aa8c96">EcMul</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *a, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *b, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> *r)</td></tr>
<tr class="memdesc:ga25c9013cc76907d73765eb7a96aa8c96"><td class="mdescLeft">&#160;</td><td class="mdescRight">Multiplies two elements in an elliptic curve group. <a href="#ga25c9013cc76907d73765eb7a96aa8c96">More...</a><br /></td></tr>
<tr class="separator:ga25c9013cc76907d73765eb7a96aa8c96"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -120,15 +120,15 @@ Functions</h2></td></tr>
<tr class="memitem:ga3f96c43d14d24de0f7a5e214aef64196"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#ga3f96c43d14d24de0f7a5e214aef64196">EcGetRandom</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, <a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c">BitSupplier</a> rnd_func, void *rnd_func_param, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> *r)</td></tr>
<tr class="memdesc:ga3f96c43d14d24de0f7a5e214aef64196"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generates a random element from an elliptic curve group. <a href="#ga3f96c43d14d24de0f7a5e214aef64196">More...</a><br /></td></tr>
<tr class="separator:ga3f96c43d14d24de0f7a5e214aef64196"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga4d0f32aede3066eae500241b387bd970"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#ga4d0f32aede3066eae500241b387bd970">EcInGroup</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, void const *p_str, size_t strlen, <a class="el" href="stdtypes_8h.html#ad5c9d4ba3dc37783a528b0925dc981a0">bool</a> *in_group)</td></tr>
-<tr class="memdesc:ga4d0f32aede3066eae500241b387bd970"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks if a point is in an elliptic curve group. <a href="#ga4d0f32aede3066eae500241b387bd970">More...</a><br /></td></tr>
-<tr class="separator:ga4d0f32aede3066eae500241b387bd970"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:gadf83fa559585375faad9a8b1559249bc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#gadf83fa559585375faad9a8b1559249bc">Epid11EcHash</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, void const *msg, size_t msg_len, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> *r)</td></tr>
-<tr class="memdesc:gadf83fa559585375faad9a8b1559249bc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Hashes an arbitrary message to an Intel(R) EPID 1.1 element in an elliptic curve group. <a href="#gadf83fa559585375faad9a8b1559249bc">More...</a><br /></td></tr>
-<tr class="separator:gadf83fa559585375faad9a8b1559249bc"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:gadc22ee07864a7ee681a881029b69d76a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#gadc22ee07864a7ee681a881029b69d76a">EcHash</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, void const *msg, size_t msg_len, <a class="el" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890">HashAlg</a> hash_alg, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> *r)</td></tr>
-<tr class="memdesc:gadc22ee07864a7ee681a881029b69d76a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Hashes an arbitrary message to an element in an elliptic curve group. <a href="#gadc22ee07864a7ee681a881029b69d76a">More...</a><br /></td></tr>
-<tr class="separator:gadc22ee07864a7ee681a881029b69d76a"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga48ec5ae951c9f49d8d7d983234eea921"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#ga48ec5ae951c9f49d8d7d983234eea921">EcInGroup</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, <a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a> p_str, size_t strlen, <a class="el" href="stdtypes_8h.html#ad5c9d4ba3dc37783a528b0925dc981a0">bool</a> *in_group)</td></tr>
+<tr class="memdesc:ga48ec5ae951c9f49d8d7d983234eea921"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks if a point is in an elliptic curve group. <a href="#ga48ec5ae951c9f49d8d7d983234eea921">More...</a><br /></td></tr>
+<tr class="separator:ga48ec5ae951c9f49d8d7d983234eea921"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gaad96a1498b85d28f71514b8f7b154d82"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#gaad96a1498b85d28f71514b8f7b154d82">Epid11EcHash</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, <a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a> msg, size_t msg_len, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> *r)</td></tr>
+<tr class="memdesc:gaad96a1498b85d28f71514b8f7b154d82"><td class="mdescLeft">&#160;</td><td class="mdescRight">Hashes an arbitrary message to an Intel(R) EPID 1.1 element in an elliptic curve group. <a href="#gaad96a1498b85d28f71514b8f7b154d82">More...</a><br /></td></tr>
+<tr class="separator:gaad96a1498b85d28f71514b8f7b154d82"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gab647ccc031063807ff3860f51d0f6919"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#gab647ccc031063807ff3860f51d0f6919">EcHash</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, <a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a> msg, size_t msg_len, <a class="el" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890">HashAlg</a> hash_alg, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> *r)</td></tr>
+<tr class="memdesc:gab647ccc031063807ff3860f51d0f6919"><td class="mdescLeft">&#160;</td><td class="mdescRight">Hashes an arbitrary message to an element in an elliptic curve group. <a href="#gab647ccc031063807ff3860f51d0f6919">More...</a><br /></td></tr>
+<tr class="separator:gab647ccc031063807ff3860f51d0f6919"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8a6114a48214a327d4ec04fd25e5940e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ec_group_primitives.html#ga8a6114a48214a327d4ec04fd25e5940e">EcMakePoint</a> (<a class="el" href="group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159">EcGroup</a> *g, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> const *x, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> *r)</td></tr>
<tr class="memdesc:ga8a6114a48214a327d4ec04fd25e5940e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets an EcPoint variable to a point on a curve. <a href="#ga8a6114a48214a327d4ec04fd25e5940e">More...</a><br /></td></tr>
<tr class="separator:ga8a6114a48214a327d4ec04fd25e5940e"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -306,7 +306,7 @@ Functions</h2></td></tr>
</div>
</div>
-<a class="anchor" id="gadc22ee07864a7ee681a881029b69d76a"></a>
+<a class="anchor" id="gab647ccc031063807ff3860f51d0f6919"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
@@ -319,7 +319,7 @@ Functions</h2></td></tr>
<tr>
<td class="paramkey"></td>
<td></td>
- <td class="paramtype">void const *&#160;</td>
+ <td class="paramtype"><a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a>&#160;</td>
<td class="paramname"><em>msg</em>, </td>
</tr>
<tr>
@@ -366,7 +366,7 @@ Functions</h2></td></tr>
</div>
</div>
-<a class="anchor" id="ga4d0f32aede3066eae500241b387bd970"></a>
+<a class="anchor" id="ga48ec5ae951c9f49d8d7d983234eea921"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
@@ -379,7 +379,7 @@ Functions</h2></td></tr>
<tr>
<td class="paramkey"></td>
<td></td>
- <td class="paramtype">void const *&#160;</td>
+ <td class="paramtype"><a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a>&#160;</td>
<td class="paramname"><em>p_str</em>, </td>
</tr>
<tr>
@@ -906,7 +906,7 @@ Functions</h2></td></tr>
</div>
</div>
-<a class="anchor" id="gadf83fa559585375faad9a8b1559249bc"></a>
+<a class="anchor" id="gaad96a1498b85d28f71514b8f7b154d82"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
@@ -919,7 +919,7 @@ Functions</h2></td></tr>
<tr>
<td class="paramkey"></td>
<td></td>
- <td class="paramtype">void const *&#160;</td>
+ <td class="paramtype"><a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a>&#160;</td>
<td class="paramname"><em>msg</em>, </td>
</tr>
<tr>
@@ -1036,6 +1036,7 @@ Functions</h2></td></tr>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section attention"><dt>Attention</dt><dd>It is the responsibility of the caller to ensure that ff exists for the entire lifetime of the new EcGroup.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___ec_group_primitives.html#gab7af276256c27610eda85ff432b846ea" title="Deletes a previously allocated EcGroup. ">DeleteEcGroup</a> </dd></dl>
</div>
@@ -1075,13 +1076,14 @@ Functions</h2></td></tr>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section attention"><dt>Attention</dt><dd>It is the responsibility of the caller to ensure that g exists for the entire lifetime of the new EcPoint.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___ec_group_primitives.html#gaf4e23677dd378ef2e0cf55df79cbdb62" title="Constructs a new EcGroup. ">NewEcGroup</a> </dd>
<dd>
<a class="el" href="group___ec_group_primitives.html#ga8cb086d792bffb79b3ca07e6ca4ce0e7" title="Deletes a previously allocated EcPoint. ">DeleteEcPoint</a> </dd></dl>
</div>
</div>
-<a class="anchor" id="ga2d433f567fa2419465a49604f4da21ad"></a>
+<a class="anchor" id="gad495a9f91b79984f7533c8ea4f92b3cb"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
@@ -1094,7 +1096,7 @@ Functions</h2></td></tr>
<tr>
<td class="paramkey"></td>
<td></td>
- <td class="paramtype">void const *&#160;</td>
+ <td class="paramtype"><a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a>&#160;</td>
<td class="paramname"><em>p_str</em>, </td>
</tr>
<tr>
@@ -1132,7 +1134,7 @@ Functions</h2></td></tr>
</div>
</div>
-<a class="anchor" id="ga4bb7d6691ffbb6e947c1068453e27fbd"></a>
+<a class="anchor" id="ga7a8bdb9782d065bc32fd102e0ae73ccb"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
@@ -1151,7 +1153,7 @@ Functions</h2></td></tr>
<tr>
<td class="paramkey"></td>
<td></td>
- <td class="paramtype">void *&#160;</td>
+ <td class="paramtype"><a class="el" href="group___epid_types.html#ga3315fb24f4c5783b6d6eb107933390b0">OctStr</a>&#160;</td>
<td class="paramname"><em>p_str</em>, </td>
</tr>
<tr>
@@ -1190,7 +1192,7 @@ Functions</h2></td></tr>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___ec_group_primitives.js b/doc/html/group___ec_group_primitives.js
index af74b1c..c57ea10 100644
--- a/doc/html/group___ec_group_primitives.js
+++ b/doc/html/group___ec_group_primitives.js
@@ -6,8 +6,8 @@ var group___ec_group_primitives =
[ "DeleteEcPoint", "group___ec_group_primitives.html#ga8cb086d792bffb79b3ca07e6ca4ce0e7", null ],
[ "EcExp", "group___ec_group_primitives.html#ga01bf8d6fa60a2e445490966b3a06c270", null ],
[ "EcGetRandom", "group___ec_group_primitives.html#ga3f96c43d14d24de0f7a5e214aef64196", null ],
- [ "EcHash", "group___ec_group_primitives.html#gadc22ee07864a7ee681a881029b69d76a", null ],
- [ "EcInGroup", "group___ec_group_primitives.html#ga4d0f32aede3066eae500241b387bd970", null ],
+ [ "EcHash", "group___ec_group_primitives.html#gab647ccc031063807ff3860f51d0f6919", null ],
+ [ "EcInGroup", "group___ec_group_primitives.html#ga48ec5ae951c9f49d8d7d983234eea921", null ],
[ "EcInverse", "group___ec_group_primitives.html#ga0b6d7a3398251e9352fb29ef4abef466", null ],
[ "EcIsEqual", "group___ec_group_primitives.html#gad3b3c63c48fa24e8dea07837b05bc061", null ],
[ "EcIsIdentity", "group___ec_group_primitives.html#ga9cf15b34bc4ff12e58b169dd989d8210", null ],
@@ -17,9 +17,9 @@ var group___ec_group_primitives =
[ "EcMultiExpBn", "group___ec_group_primitives.html#ga76d24378455eb96a3257fe8045c0993a", null ],
[ "EcSscmExp", "group___ec_group_primitives.html#gaf3b6a548aa6f0d4f028a14feca251f57", null ],
[ "EcSscmMultiExp", "group___ec_group_primitives.html#ga40e3431d3dbe8cf7a65ada7b7811cba4", null ],
- [ "Epid11EcHash", "group___ec_group_primitives.html#gadf83fa559585375faad9a8b1559249bc", null ],
+ [ "Epid11EcHash", "group___ec_group_primitives.html#gaad96a1498b85d28f71514b8f7b154d82", null ],
[ "NewEcGroup", "group___ec_group_primitives.html#gaf4e23677dd378ef2e0cf55df79cbdb62", null ],
[ "NewEcPoint", "group___ec_group_primitives.html#ga6417b0ce72ba96de00c329e322fec7fb", null ],
- [ "ReadEcPoint", "group___ec_group_primitives.html#ga2d433f567fa2419465a49604f4da21ad", null ],
- [ "WriteEcPoint", "group___ec_group_primitives.html#ga4bb7d6691ffbb6e947c1068453e27fbd", null ]
+ [ "ReadEcPoint", "group___ec_group_primitives.html#gad495a9f91b79984f7533c8ea4f92b3cb", null ],
+ [ "WriteEcPoint", "group___ec_group_primitives.html#ga7a8bdb9782d065bc32fd102e0ae73ccb", null ]
]; \ No newline at end of file
diff --git a/doc/html/group___ecdsa_primitives.html b/doc/html/group___ecdsa_primitives.html
index 50d135d..41626d2 100644
--- a/doc/html/group___ecdsa_primitives.html
+++ b/doc/html/group___ecdsa_primitives.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -69,25 +69,25 @@ $(document).ready(function(){initNavTree('group___ecdsa_primitives.html','');});
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
-<tr class="memitem:gaab68de7291db6e42a01e99c2fa40057f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ecdsa_primitives.html#gaab68de7291db6e42a01e99c2fa40057f">EcdsaVerifyBuffer</a> (void const *buf, size_t buf_len, <a class="el" href="struct_ecdsa_public_key.html">EcdsaPublicKey</a> const *pubkey, <a class="el" href="struct_ecdsa_signature.html">EcdsaSignature</a> const *sig)</td></tr>
-<tr class="memdesc:gaab68de7291db6e42a01e99c2fa40057f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Verifies authenticity of a digital signature over a buffer. <a href="#gaab68de7291db6e42a01e99c2fa40057f">More...</a><br /></td></tr>
-<tr class="separator:gaab68de7291db6e42a01e99c2fa40057f"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga67091ecae643c1b8a0b0a4946eda7afe"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ecdsa_primitives.html#ga67091ecae643c1b8a0b0a4946eda7afe">EcdsaSignBuffer</a> (void const *buf, size_t buf_len, <a class="el" href="struct_ecdsa_private_key.html">EcdsaPrivateKey</a> const *privkey, <a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c">BitSupplier</a> rnd_func, void *rnd_param, <a class="el" href="struct_ecdsa_signature.html">EcdsaSignature</a> *sig)</td></tr>
-<tr class="memdesc:ga67091ecae643c1b8a0b0a4946eda7afe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates ECDSA signature of buffer. <a href="#ga67091ecae643c1b8a0b0a4946eda7afe">More...</a><br /></td></tr>
-<tr class="separator:ga67091ecae643c1b8a0b0a4946eda7afe"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga07e4ebd3423e1f6f9ae35f0608dde7c0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ecdsa_primitives.html#ga07e4ebd3423e1f6f9ae35f0608dde7c0">EcdsaVerifyBuffer</a> (<a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a> buf, size_t buf_len, <a class="el" href="struct_ecdsa_public_key.html">EcdsaPublicKey</a> const *pubkey, <a class="el" href="struct_ecdsa_signature.html">EcdsaSignature</a> const *sig)</td></tr>
+<tr class="memdesc:ga07e4ebd3423e1f6f9ae35f0608dde7c0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Verifies authenticity of a digital signature over a buffer. <a href="#ga07e4ebd3423e1f6f9ae35f0608dde7c0">More...</a><br /></td></tr>
+<tr class="separator:ga07e4ebd3423e1f6f9ae35f0608dde7c0"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gaef0e8a31e830fe9285b43a0969e6611a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ecdsa_primitives.html#gaef0e8a31e830fe9285b43a0969e6611a">EcdsaSignBuffer</a> (<a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a> buf, size_t buf_len, <a class="el" href="struct_ecdsa_private_key.html">EcdsaPrivateKey</a> const *privkey, <a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c">BitSupplier</a> rnd_func, void *rnd_param, <a class="el" href="struct_ecdsa_signature.html">EcdsaSignature</a> *sig)</td></tr>
+<tr class="memdesc:gaef0e8a31e830fe9285b43a0969e6611a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates ECDSA signature of buffer. <a href="#gaef0e8a31e830fe9285b43a0969e6611a">More...</a><br /></td></tr>
+<tr class="separator:gaef0e8a31e830fe9285b43a0969e6611a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Elliptic Curve Digital Signature Algorithm Primitives. </p>
<p>Provides APIs for computing and checking buffer signatures using the Elliptic Curve Digital Signature Algorithm. </p>
<h2 class="groupheader">Function Documentation</h2>
-<a class="anchor" id="ga67091ecae643c1b8a0b0a4946eda7afe"></a>
+<a class="anchor" id="gaef0e8a31e830fe9285b43a0969e6611a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> EcdsaSignBuffer </td>
<td>(</td>
- <td class="paramtype">void const *&#160;</td>
+ <td class="paramtype"><a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a>&#160;</td>
<td class="paramname"><em>buf</em>, </td>
</tr>
<tr>
@@ -149,18 +149,18 @@ Functions</h2></td></tr>
</table>
</dd>
</dl>
-<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___ecdsa_primitives.html#ga67091ecae643c1b8a0b0a4946eda7afe" title="Creates ECDSA signature of buffer. ">EcdsaSignBuffer</a> </dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___ecdsa_primitives.html#gaef0e8a31e830fe9285b43a0969e6611a" title="Creates ECDSA signature of buffer. ">EcdsaSignBuffer</a> </dd></dl>
</div>
</div>
-<a class="anchor" id="gaab68de7291db6e42a01e99c2fa40057f"></a>
+<a class="anchor" id="ga07e4ebd3423e1f6f9ae35f0608dde7c0"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> EcdsaVerifyBuffer </td>
<td>(</td>
- <td class="paramtype">void const *&#160;</td>
+ <td class="paramtype"><a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a>&#160;</td>
<td class="paramname"><em>buf</em>, </td>
</tr>
<tr>
@@ -210,7 +210,7 @@ Functions</h2></td></tr>
</table>
</dd>
</dl>
-<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___ecdsa_primitives.html#ga67091ecae643c1b8a0b0a4946eda7afe" title="Creates ECDSA signature of buffer. ">EcdsaSignBuffer</a> </dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___ecdsa_primitives.html#gaef0e8a31e830fe9285b43a0969e6611a" title="Creates ECDSA signature of buffer. ">EcdsaSignBuffer</a> </dd></dl>
</div>
</div>
@@ -221,7 +221,7 @@ Functions</h2></td></tr>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___ecdsa_primitives.js b/doc/html/group___ecdsa_primitives.js
index 37f85bf..e901408 100644
--- a/doc/html/group___ecdsa_primitives.js
+++ b/doc/html/group___ecdsa_primitives.js
@@ -1,5 +1,5 @@
var group___ecdsa_primitives =
[
- [ "EcdsaSignBuffer", "group___ecdsa_primitives.html#ga67091ecae643c1b8a0b0a4946eda7afe", null ],
- [ "EcdsaVerifyBuffer", "group___ecdsa_primitives.html#gaab68de7291db6e42a01e99c2fa40057f", null ]
+ [ "EcdsaSignBuffer", "group___ecdsa_primitives.html#gaef0e8a31e830fe9285b43a0969e6611a", null ],
+ [ "EcdsaVerifyBuffer", "group___ecdsa_primitives.html#ga07e4ebd3423e1f6f9ae35f0608dde7c0", null ]
]; \ No newline at end of file
diff --git a/doc/html/group___epid11_file_parser_module.html b/doc/html/group___epid11_file_parser_module.html
index 4f3dc04..9db82aa 100644
--- a/doc/html/group___epid11_file_parser_module.html
+++ b/doc/html/group___epid11_file_parser_module.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -354,7 +354,7 @@ Functions</h2></td></tr>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___epid11_pairing_primitives.html b/doc/html/group___epid11_pairing_primitives.html
index 0d60502..2cbe069 100644
--- a/doc/html/group___epid11_pairing_primitives.html
+++ b/doc/html/group___epid11_pairing_primitives.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -224,6 +224,7 @@ Functions</h2></td></tr>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section attention"><dt>Attention</dt><dd>It is the responsibility of the caller to ensure that ga, gb, and ff exist for the entire lifetime of the new Epid11PairingState.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid11_pairing_primitives.html#gaa3457d6f85889bc714910252fd21c758" title="Frees a previously allocated by Epid11PairingState. ">DeleteEpid11PairingState</a> </dd>
<dd>
<a href="group___epid11_verifier_module.html#details"><b>EPID 1.1 support</b></a> </dd></dl>
@@ -237,7 +238,7 @@ Functions</h2></td></tr>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___epid11_types.html b/doc/html/group___epid11_types.html
index 8b4241f..7438064 100644
--- a/doc/html/group___epid11_types.html
+++ b/doc/html/group___epid11_types.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -142,7 +142,7 @@ typedef <a class="el" href="struct_oct_str32.html">OctStr32</a>&#160;</td><td cl
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___epid11_verifier_module.html b/doc/html/group___epid11_verifier_module.html
index 8b383c3..29c5acb 100644
--- a/doc/html/group___epid11_verifier_module.html
+++ b/doc/html/group___epid11_verifier_module.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -772,7 +772,7 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___epid_common.html b/doc/html/group___epid_common.html
index 83665db..702e601 100644
--- a/doc/html/group___epid_common.html
+++ b/doc/html/group___epid_common.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -107,16 +107,19 @@ Typedefs</h2></td></tr>
</div><div class="memdoc">
<p>Generates random data. </p>
-<p>It is the responsibility of the caller of the SDK interfaces to implement a function of this prototype and to then pass a pointer to this function into methods that require it.</p>
+<p>The SDK provides the <a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c" title="Generates random data. ">BitSupplier</a> as a function prototype so that you will know the requirements for your own implementation of a random number generator.</p>
+<p>You need to pass a pointer to your implementation of the random number generator into methods that require it, such as <a class="el" href="group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb" title="Creates a new member context. ">EpidMemberCreate</a>.</p>
+<p>For an example of how a BitSupplier is created, see the <code>signmsg</code> example.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
- <tr><td class="paramdir">[out]</td><td class="paramname">rand_data</td><td>destination buffer </td></tr>
- <tr><td class="paramdir">[in]</td><td class="paramname">num_bits</td><td>size of rand_data in bits </td></tr>
- <tr><td class="paramdir">[in]</td><td class="paramname">user_data</td><td>user data passed through from api call.</td></tr>
+ <tr><td class="paramdir">[out]</td><td class="paramname">rand_data</td><td>destination buffer for random data generated by BitSupplier. The buffer will receive <code>num_bits</code> of random data. </td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">num_bits</td><td>specifies the size of the random data, in bits, to be generated. </td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">user_data</td><td>user data that will be passed to the random number generator. The usage of this data is specific to the implementation of the BitSupplier. For example, this could be used to pass a pointer to a data structure that maintains state across calls to your BitSupplier.</td></tr>
</table>
</dd>
</dl>
-<dl class="section return"><dt>Returns</dt><dd>zero on success and non-zero value on error. </dd></dl>
+<dl class="section return"><dt>Returns</dt><dd>zero on success and non-zero value on error.</dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb" title="Creates a new member context. ">EpidMemberCreate</a> </dd></dl>
</div>
</div>
@@ -127,7 +130,7 @@ Typedefs</h2></td></tr>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___epid_math.html b/doc/html/group___epid_math.html
index 8ced37b..b5a5158 100644
--- a/doc/html/group___epid_math.html
+++ b/doc/html/group___epid_math.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -98,7 +98,7 @@ Modules</h2></td></tr>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___epid_member_module.html b/doc/html/group___epid_member_module.html
index 156ea0b..771ded4 100644
--- a/doc/html/group___epid_member_module.html
+++ b/doc/html/group___epid_member_module.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -58,7 +58,7 @@ $(document).ready(function(){initNavTree('group___epid_member_module.html','');}
<div id="doc-content">
<div class="header">
<div class="summary">
-<a href="#nested-classes">Data Structures</a> &#124;
+<a href="#groups">Modules</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
@@ -69,13 +69,10 @@ $(document).ready(function(){initNavTree('group___epid_member_module.html','');}
<p>Member functionality.
<a href="#details">More...</a></p>
<table class="memberdecls">
-<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
-Data Structures</h2></td></tr>
-<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_member_precomp.html">MemberPrecomp</a></td></tr>
-<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pre-computed member settings. <a href="struct_member_precomp.html#details">More...</a><br /></td></tr>
-<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_pre_computed_signature.html">PreComputedSignature</a></td></tr>
-<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pre-computed signature. <a href="struct_pre_computed_signature.html#details">More...</a><br /></td></tr>
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
+Modules</h2></td></tr>
+<tr class="memitem:group___tpm_module"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html">tpm</a></td></tr>
+<tr class="memdesc:group___tpm_module"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal interface that models sensitive member functionality. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
@@ -99,24 +96,24 @@ Functions</h2></td></tr>
<tr class="memitem:ga9998eb454838ff5d232ff22ecbab31bf"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#ga9998eb454838ff5d232ff22ecbab31bf">EpidMemberSetHashAlg</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> *ctx, <a class="el" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890">HashAlg</a> hash_alg)</td></tr>
<tr class="memdesc:ga9998eb454838ff5d232ff22ecbab31bf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the hash algorithm to be used by a member. <a href="#ga9998eb454838ff5d232ff22ecbab31bf">More...</a><br /></td></tr>
<tr class="separator:ga9998eb454838ff5d232ff22ecbab31bf"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gaaae6f21f58c22fce58076f10d68159f4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#gaaae6f21f58c22fce58076f10d68159f4">EpidMemberSetSigRl</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> *ctx, <a class="el" href="struct_sig_rl.html">SigRl</a> const *sig_rl, size_t sig_rl_size)</td></tr>
+<tr class="memdesc:gaaae6f21f58c22fce58076f10d68159f4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the signature based revocation list to be used by a member. <a href="#gaaae6f21f58c22fce58076f10d68159f4">More...</a><br /></td></tr>
+<tr class="separator:gaaae6f21f58c22fce58076f10d68159f4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga76e535722467af7c16809b5b521e0000"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#ga76e535722467af7c16809b5b521e0000">EpidGetSigSize</a> (<a class="el" href="struct_sig_rl.html">SigRl</a> const *sig_rl)</td></tr>
<tr class="memdesc:ga76e535722467af7c16809b5b521e0000"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes the size in bytes required for an Intel(R) EPID signature. <a href="#ga76e535722467af7c16809b5b521e0000">More...</a><br /></td></tr>
<tr class="separator:ga76e535722467af7c16809b5b521e0000"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga759155a719254f734157722716dac640"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#ga759155a719254f734157722716dac640">EpidSign</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> const *ctx, void const *msg, size_t msg_len, void const *basename, size_t basename_len, <a class="el" href="struct_sig_rl.html">SigRl</a> const *sig_rl, size_t sig_rl_size, <a class="el" href="struct_epid_signature.html">EpidSignature</a> *sig, size_t sig_len)</td></tr>
-<tr class="memdesc:ga759155a719254f734157722716dac640"><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes an Intel(R) EPID signature. <a href="#ga759155a719254f734157722716dac640">More...</a><br /></td></tr>
-<tr class="separator:ga759155a719254f734157722716dac640"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga74d1409a816cb52633564b793072da5f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#ga74d1409a816cb52633564b793072da5f">EpidSign</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> const *ctx, void const *msg, size_t msg_len, void const *basename, size_t basename_len, <a class="el" href="struct_epid_signature.html">EpidSignature</a> *sig, size_t sig_len)</td></tr>
+<tr class="memdesc:ga74d1409a816cb52633564b793072da5f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes an Intel(R) EPID signature. <a href="#ga74d1409a816cb52633564b793072da5f">More...</a><br /></td></tr>
+<tr class="separator:ga74d1409a816cb52633564b793072da5f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad92d3c3266ae1833ffb1dba9ad76035d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#gad92d3c3266ae1833ffb1dba9ad76035d">EpidRegisterBaseName</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> *ctx, void const *basename, size_t basename_len)</td></tr>
<tr class="memdesc:gad92d3c3266ae1833ffb1dba9ad76035d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Registers a basename with a member. <a href="#gad92d3c3266ae1833ffb1dba9ad76035d">More...</a><br /></td></tr>
<tr class="separator:gad92d3c3266ae1833ffb1dba9ad76035d"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:gad2e3de5c6ce641a318f8a46b61e75236"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#gad2e3de5c6ce641a318f8a46b61e75236">EpidAddPreSigs</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> *ctx, size_t number_presigs, <a class="el" href="struct_pre_computed_signature.html">PreComputedSignature</a> *presigs)</td></tr>
-<tr class="memdesc:gad2e3de5c6ce641a318f8a46b61e75236"><td class="mdescLeft">&#160;</td><td class="mdescRight">Extends the member's pool of pre-computed signatures. <a href="#gad2e3de5c6ce641a318f8a46b61e75236">More...</a><br /></td></tr>
-<tr class="separator:gad2e3de5c6ce641a318f8a46b61e75236"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gacb0547ec085a9ed324d323416bce4a78"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#gacb0547ec085a9ed324d323416bce4a78">EpidAddPreSigs</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> *ctx, size_t number_presigs)</td></tr>
+<tr class="memdesc:gacb0547ec085a9ed324d323416bce4a78"><td class="mdescLeft">&#160;</td><td class="mdescRight">Extends the member's pool of pre-computed signatures. <a href="#gacb0547ec085a9ed324d323416bce4a78">More...</a><br /></td></tr>
+<tr class="separator:gacb0547ec085a9ed324d323416bce4a78"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad78ca056dfea2565bbacd5734d9dc075"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#gad78ca056dfea2565bbacd5734d9dc075">EpidGetNumPreSigs</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> const *ctx)</td></tr>
<tr class="memdesc:gad78ca056dfea2565bbacd5734d9dc075"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the number of pre-computed signatures in the member's pool. <a href="#gad78ca056dfea2565bbacd5734d9dc075">More...</a><br /></td></tr>
<tr class="separator:gad78ca056dfea2565bbacd5734d9dc075"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga9e12c7cec8d0c4e07b12c0e26a278c9d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#ga9e12c7cec8d0c4e07b12c0e26a278c9d">EpidWritePreSigs</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> *ctx, <a class="el" href="struct_pre_computed_signature.html">PreComputedSignature</a> *presigs, size_t number_presigs)</td></tr>
-<tr class="memdesc:ga9e12c7cec8d0c4e07b12c0e26a278c9d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serializes pre-computed signatures from the member's pool. <a href="#ga9e12c7cec8d0c4e07b12c0e26a278c9d">More...</a><br /></td></tr>
-<tr class="separator:ga9e12c7cec8d0c4e07b12c0e26a278c9d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga13dd0d72be9babf8194d472d7712a361"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#ga13dd0d72be9babf8194d472d7712a361">EpidRequestJoin</a> (<a class="el" href="struct_group_pub_key.html">GroupPubKey</a> const *pub_key, <a class="el" href="group___epid_types.html#ga55eb2193045bde31af3f551565126042">IssuerNonce</a> const *ni, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *f, <a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c">BitSupplier</a> rnd_func, void *rnd_param, <a class="el" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890">HashAlg</a> hash_alg, <a class="el" href="struct_join_request.html">JoinRequest</a> *join_request)</td></tr>
<tr class="memdesc:ga13dd0d72be9babf8194d472d7712a361"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a request to join a group. <a href="#ga13dd0d72be9babf8194d472d7712a361">More...</a><br /></td></tr>
<tr class="separator:ga13dd0d72be9babf8194d472d7712a361"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -126,18 +123,19 @@ Functions</h2></td></tr>
<tr class="memitem:gac8e2c6c1fead8030785a40427905a2cc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#gac8e2c6c1fead8030785a40427905a2cc">EpidNrProve</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> const *ctx, void const *msg, size_t msg_len, <a class="el" href="struct_basic_signature.html">BasicSignature</a> const *sig, <a class="el" href="struct_sig_rl_entry.html">SigRlEntry</a> const *sigrl_entry, <a class="el" href="struct_nr_proof.html">NrProof</a> *proof)</td></tr>
<tr class="memdesc:gac8e2c6c1fead8030785a40427905a2cc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates a non-revoked proof for a single signature based revocation list entry. <a href="#gac8e2c6c1fead8030785a40427905a2cc">More...</a><br /></td></tr>
<tr class="separator:gac8e2c6c1fead8030785a40427905a2cc"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga8e3f201d1e9dc668659e08a3bdf543b6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="stdtypes_8h.html#ad5c9d4ba3dc37783a528b0925dc981a0">bool</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#ga8e3f201d1e9dc668659e08a3bdf543b6">EpidIsPrivKeyInGroup</a> (<a class="el" href="struct_group_pub_key.html">GroupPubKey</a> const *pub_key, <a class="el" href="struct_priv_key.html">PrivKey</a> const *priv_key)</td></tr>
-<tr class="memdesc:ga8e3f201d1e9dc668659e08a3bdf543b6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Tests if a member private key is valid without checking revocation. <a href="#ga8e3f201d1e9dc668659e08a3bdf543b6">More...</a><br /></td></tr>
-<tr class="separator:ga8e3f201d1e9dc668659e08a3bdf543b6"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga4ccaa8337931523c77567f5b846ef188"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#ga4ccaa8337931523c77567f5b846ef188">EpidAssemblePrivKey</a> (<a class="el" href="struct_membership_credential.html">MembershipCredential</a> const *credential, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *f, <a class="el" href="struct_group_pub_key.html">GroupPubKey</a> const *pub_key, <a class="el" href="struct_priv_key.html">PrivKey</a> *priv_key)</td></tr>
+<tr class="memdesc:ga4ccaa8337931523c77567f5b846ef188"><td class="mdescLeft">&#160;</td><td class="mdescRight">Assembles member private key from membership credential and f value. <a href="#ga4ccaa8337931523c77567f5b846ef188">More...</a><br /></td></tr>
+<tr class="separator:ga4ccaa8337931523c77567f5b846ef188"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf8cd05388f017486f14da2ee48d067ef"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#gaf8cd05388f017486f14da2ee48d067ef">EpidDecompressPrivKey</a> (<a class="el" href="struct_group_pub_key.html">GroupPubKey</a> const *pub_key, <a class="el" href="struct_compressed_priv_key.html">CompressedPrivKey</a> const *compressed_privkey, <a class="el" href="struct_priv_key.html">PrivKey</a> *priv_key)</td></tr>
<tr class="memdesc:gaf8cd05388f017486f14da2ee48d067ef"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompresses compressed member private key. <a href="#gaf8cd05388f017486f14da2ee48d067ef">More...</a><br /></td></tr>
<tr class="separator:gaf8cd05388f017486f14da2ee48d067ef"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Member functionality. </p>
-<p>Defines the APIs needed by Intel(R) EPID members. Each member context (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817" title="Internal context of member. ">MemberCtx</a>) represents membership in a single group. </p>
+<p>Defines the APIs needed by Intel(R) EPID members. Each member context (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817" title="Internal context of member. ">MemberCtx</a>) represents membership in a single group.</p>
+<p>To use this module, include the header <a class="el" href="member_2api_8h.html" title="Intel(R) EPID SDK member API. ">epid/member/api.h</a>. </p>
<h2 class="groupheader">Function Documentation</h2>
-<a class="anchor" id="gad2e3de5c6ce641a318f8a46b61e75236"></a>
+<a class="anchor" id="gacb0547ec085a9ed324d323416bce4a78"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
@@ -151,13 +149,57 @@ Functions</h2></td></tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
- <td class="paramname"><em>number_presigs</em>, </td>
+ <td class="paramname"><em>number_presigs</em>&#160;</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Extends the member's pool of pre-computed signatures. </p>
+<p>Generate new pre-computed signatures and add them to the internal pool.</p>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramdir">[in]</td><td class="paramname">ctx</td><td>The member context. </td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">number_presigs</td><td>The number of pre-computed signatures to add to the internal pool.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb" title="Creates a new member context. ">EpidMemberCreate</a> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ga4ccaa8337931523c77567f5b846ef188"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> EpidAssemblePrivKey </td>
+ <td>(</td>
+ <td class="paramtype"><a class="el" href="struct_membership_credential.html">MembershipCredential</a> const *&#160;</td>
+ <td class="paramname"><em>credential</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
- <td class="paramtype"><a class="el" href="struct_pre_computed_signature.html">PreComputedSignature</a> *&#160;</td>
- <td class="paramname"><em>presigs</em>&#160;</td>
+ <td class="paramtype"><a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>f</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_group_pub_key.html">GroupPubKey</a> const *&#160;</td>
+ <td class="paramname"><em>pub_key</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_priv_key.html">PrivKey</a> *&#160;</td>
+ <td class="paramname"><em>priv_key</em>&#160;</td>
</tr>
<tr>
<td></td>
@@ -167,23 +209,20 @@ Functions</h2></td></tr>
</table>
</div><div class="memdoc">
-<p>Extends the member's pool of pre-computed signatures. </p>
-<p>Can either generate new pre-computed signatures or import existing ones. <a class="el" href="group___epid_member_module.html#ga9e12c7cec8d0c4e07b12c0e26a278c9d" title="Serializes pre-computed signatures from the member&#39;s pool. ">EpidWritePreSigs</a> can be used to export pre-computed signatures.</p>
+<p>Assembles member private key from membership credential and f value. </p>
+<p>Combines membership credential obtained from the issuer in response to a successful join request with the f value chosen by the member to create a complete member private key.</p>
+<p>The assembled private key is sanity checked to confirm it is a possible key in the group. If it is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ad134d6cc95a9dcb1b1a9f9c358047cbf" title="incorrect arg to function ">kEpidBadArgErr</a> is returned.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
- <tr><td class="paramdir">[in]</td><td class="paramname">ctx</td><td>The member context. </td></tr>
- <tr><td class="paramdir">[in]</td><td class="paramname">number_presigs</td><td>The number of pre-computed signatures to add to the internal pool. </td></tr>
- <tr><td class="paramdir">[in,out]</td><td class="paramname">presigs</td><td>Optional array of valid pre-computed signatures to import. If presigs is not NULL it most contain at least number_presigs pre-computed signatures.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">credential</td><td>Membership credential received. </td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">f</td><td>The f value used to generate the join request associated with the membership credential. </td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">pub_key</td><td>The public key of the group. </td></tr>
+ <tr><td class="paramdir">[out]</td><td class="paramname">priv_key</td><td>The private key.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
-<dl class="section note"><dt>Note</dt><dd>presigs buffer is zeroed out before return to prevent pre-computed signatures from being reused.</dd>
-<dd>
-If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9" title="no error ">kEpidNoErr</a> the state of the pre-computed signature pool, and of presigs, is undefined.</dd></dl>
-<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb" title="Creates a new member context. ">EpidMemberCreate</a> </dd>
-<dd>
-<a class="el" href="group___epid_member_module.html#ga9e12c7cec8d0c4e07b12c0e26a278c9d" title="Serializes pre-computed signatures from the member&#39;s pool. ">EpidWritePreSigs</a> </dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_member_module.html#ga13dd0d72be9babf8194d472d7712a361" title="Creates a request to join a group. ">EpidRequestJoin</a> </dd></dl>
</div>
</div>
@@ -227,7 +266,9 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
</table>
</dd>
</dl>
-<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a> </dd></dl>
+<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_GeneratingAnIntelEpidSignature.html">Generating an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -253,9 +294,7 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Number of remaining pre-computed signatures. Returns 0 if ctx is NULL.</dd></dl>
-<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb" title="Creates a new member context. ">EpidMemberCreate</a> </dd>
-<dd>
-<a class="el" href="group___epid_member_module.html#ga9e12c7cec8d0c4e07b12c0e26a278c9d" title="Serializes pre-computed signatures from the member&#39;s pool. ">EpidWritePreSigs</a> </dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb" title="Creates a new member context. ">EpidMemberCreate</a> </dd></dl>
</div>
</div>
@@ -281,52 +320,9 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Size in bytes of an Intel(R) EPID signature including proofs for each entry in the signature based revocation list.</dd></dl>
-<dl class="section see"><dt>See also</dt><dd><a class="el" href="struct_sig_rl.html" title="signature based revocation list ">SigRl</a> </dd></dl>
-
-</div>
-</div>
-<a class="anchor" id="ga8e3f201d1e9dc668659e08a3bdf543b6"></a>
-<div class="memitem">
-<div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname"><a class="el" href="stdtypes_8h.html#ad5c9d4ba3dc37783a528b0925dc981a0">bool</a> EpidIsPrivKeyInGroup </td>
- <td>(</td>
- <td class="paramtype"><a class="el" href="struct_group_pub_key.html">GroupPubKey</a> const *&#160;</td>
- <td class="paramname"><em>pub_key</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype"><a class="el" href="struct_priv_key.html">PrivKey</a> const *&#160;</td>
- <td class="paramname"><em>priv_key</em>&#160;</td>
- </tr>
- <tr>
- <td></td>
- <td>)</td>
- <td></td><td></td>
- </tr>
- </table>
-</div><div class="memdoc">
-
-<p>Tests if a member private key is valid without checking revocation. </p>
-<p>Used to check that a member private key is a valid key for a group. This is useful as a cross check when creating a new member private key as part of the join process</p>
-<dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramdir">[in]</td><td class="paramname">pub_key</td><td>The public key of the group. </td></tr>
- <tr><td class="paramdir">[in]</td><td class="paramname">priv_key</td><td>The private key to check.</td></tr>
- </table>
- </dd>
-</dl>
-<dl class="section return"><dt>Returns</dt><dd>bool</dd></dl>
-<dl class="retval"><dt>Return values</dt><dd>
- <table class="retval">
- <tr><td class="paramname">true</td><td>if the private key is valid for the group of the public key </td></tr>
- <tr><td class="paramname">false</td><td>if the private key is not valid for the group of the public key</td></tr>
- </table>
- </dd>
-</dl>
-<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_member_module.html#ga13dd0d72be9babf8194d472d7712a361" title="Creates a request to join a group. ">EpidRequestJoin</a> </dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="struct_sig_rl.html" title="signature based revocation list ">SigRl</a></dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_GeneratingAnIntelEpidSignature.html">Generating an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -382,13 +378,14 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
<p>Must be called to create the member context that is used by other "Member" APIs.</p>
<p>Allocates memory for the context, then initializes it.</p>
<p><a class="el" href="group___epid_member_module.html#ga3824589c683c5e0e59d483462fce65d6" title="Deletes an existing member context. ">EpidMemberDelete()</a> must be called to safely release the member context.</p>
+<p>You need to use a cryptographically secure random number generator to create a member context using <a class="el" href="group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb" title="Creates a new member context. ">EpidMemberCreate</a>. The <a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c" title="Generates random data. ">BitSupplier</a> is provided as a function prototype for your own implementation of the random number generator.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">pub_key</td><td>The group certificate. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">priv_key</td><td>The member private key. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">precomp</td><td>Optional pre-computed data. If NULL the value is computed internally and is readable using <a class="el" href="group___epid_member_module.html#ga5c35798d62cf81c4ca62b22c38809721" title="Serializes the pre-computed member settings. ">EpidMemberWritePrecomp()</a>. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">rnd_func</td><td>Random number generator. </td></tr>
- <tr><td class="paramdir">[in]</td><td class="paramname">rnd_param</td><td>Pass through context data for rnd_func. </td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">rnd_param</td><td>Pass through user data that will be passed to the user_data parameter of the random number generator. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">ctx</td><td>Newly constructed member context.</td></tr>
</table>
</dd>
@@ -398,7 +395,11 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
<dl class="section note"><dt>Note</dt><dd>If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9" title="no error ">kEpidNoErr</a> the content of ctx is undefined.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_member_module.html#ga3824589c683c5e0e59d483462fce65d6" title="Deletes an existing member context. ">EpidMemberDelete</a> </dd>
<dd>
-<a class="el" href="group___epid_member_module.html#ga5c35798d62cf81c4ca62b22c38809721" title="Serializes the pre-computed member settings. ">EpidMemberWritePrecomp</a> </dd></dl>
+<a class="el" href="group___epid_member_module.html#ga5c35798d62cf81c4ca62b22c38809721" title="Serializes the pre-computed member settings. ">EpidMemberWritePrecomp</a> </dd>
+<dd>
+<a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c" title="Generates random data. ">BitSupplier</a></dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_GeneratingAnIntelEpidSignature.html">Generating an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -425,7 +426,9 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
</table>
</dd>
</dl>
-<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb" title="Creates a new member context. ">EpidMemberCreate</a> </dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb" title="Creates a new member context. ">EpidMemberCreate</a></dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_GeneratingAnIntelEpidSignature.html">Generating an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -465,7 +468,60 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
<dl class="section note"><dt>Note</dt><dd>If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9" title="no error ">kEpidNoErr</a>, the hash algorithm used by the member is undefined.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb" title="Creates a new member context. ">EpidMemberCreate</a> </dd>
<dd>
-<a class="el" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890" title="Recognized hash algorithms. ">HashAlg</a> </dd></dl>
+<a class="el" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890" title="Recognized hash algorithms. ">HashAlg</a></dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_GeneratingAnIntelEpidSignature.html">Generating an Intel&reg; EPID Signature</a> </p>
+
+</div>
+</div>
+<a class="anchor" id="gaaae6f21f58c22fce58076f10d68159f4"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> EpidMemberSetSigRl </td>
+ <td>(</td>
+ <td class="paramtype"><a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> *&#160;</td>
+ <td class="paramname"><em>ctx</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_sig_rl.html">SigRl</a> const *&#160;</td>
+ <td class="paramname"><em>sig_rl</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">size_t&#160;</td>
+ <td class="paramname"><em>sig_rl_size</em>&#160;</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Sets the signature based revocation list to be used by a member. </p>
+<p>The caller is responsible for ensuring the revocation list is authorized, e.g. signed by the issuer. The caller is also responsible checking the version of the revocation list. The call fails if trying to set an older version of the revocation list than was last set.</p>
+<dl class="section attention"><dt>Attention</dt><dd>The memory pointed to by sig_rl is accessed directly by the member until a new list is set or the member is destroyed. Do not modify the contents of this memory. The behavior of subsequent operations that rely on the revocation list is undefined if the memory is modified.</dd>
+<dd>
+It is the responsibility of the caller to free the memory pointed to by sig_rl after the member is no longer using it.</dd></dl>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramdir">[in]</td><td class="paramname">ctx</td><td>The member context. </td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">sig_rl</td><td>The signature based revocation list. </td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">sig_rl_size</td><td>The size of the signature based revocation list in bytes.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section note"><dt>Note</dt><dd>If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9" title="no error ">kEpidNoErr</a> the signature based revocation list pointed to by the member is not changed.</dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb" title="Creates a new member context. ">EpidMemberCreate</a></dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_GeneratingAnIntelEpidSignature.html">Generating an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -502,7 +558,9 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
-<dl class="section note"><dt>Note</dt><dd>If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9" title="no error ">kEpidNoErr</a>, the content of precomp is undefined. </dd></dl>
+<dl class="section note"><dt>Note</dt><dd>If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9" title="no error ">kEpidNoErr</a>, the content of precomp is undefined.</dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_GeneratingAnIntelEpidSignature.html">Generating an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -625,7 +683,9 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
</table>
</dd>
</dl>
-<dl class="section note"><dt>Note</dt><dd>If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9" title="no error ">kEpidNoErr</a> or <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a3706f895a660260033b5b91890516c0f" title="argument would add duplicate entry ">kEpidDuplicateErr</a> it is undefined if the basename is registered. </dd></dl>
+<dl class="section note"><dt>Note</dt><dd>If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9" title="no error ">kEpidNoErr</a> or <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a3706f895a660260033b5b91890516c0f" title="argument would add duplicate entry ">kEpidDuplicateErr</a> it is undefined if the basename is registered.</dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_GeneratingAnIntelEpidSignature.html">Generating an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -706,7 +766,7 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
</div>
</div>
-<a class="anchor" id="ga759155a719254f734157722716dac640"></a>
+<a class="anchor" id="ga74d1409a816cb52633564b793072da5f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
@@ -743,18 +803,6 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
<tr>
<td class="paramkey"></td>
<td></td>
- <td class="paramtype"><a class="el" href="struct_sig_rl.html">SigRl</a> const *&#160;</td>
- <td class="paramname"><em>sig_rl</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">size_t&#160;</td>
- <td class="paramname"><em>sig_rl_size</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
<td class="paramtype"><a class="el" href="struct_epid_signature.html">EpidSignature</a> *&#160;</td>
<td class="paramname"><em>sig</em>, </td>
</tr>
@@ -779,9 +827,7 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
<tr><td class="paramdir">[in]</td><td class="paramname">msg</td><td>The message to sign. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">msg_len</td><td>The length in bytes of message. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">basename</td><td>Optional basename. If basename is NULL a random basename is used. Signatures generated using random basenames are anonymous. Signatures generated using the same basename are linkable by the verifier. If a basename is provided, it must already be registered, or <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ad134d6cc95a9dcb1b1a9f9c358047cbf" title="incorrect arg to function ">kEpidBadArgErr</a> is returned. </td></tr>
- <tr><td class="paramdir">[in]</td><td class="paramname">basename_len</td><td>The size of basename in bytes. Must be 0 basename is NULL. </td></tr>
- <tr><td class="paramdir">[in]</td><td class="paramname">sig_rl</td><td>The signature based revocation list. </td></tr>
- <tr><td class="paramdir">[in]</td><td class="paramname">sig_rl_size</td><td>The size in bytes of the signature based revocation list. </td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">basename_len</td><td>The size of basename in bytes. Must be 0 if basename is NULL. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">sig</td><td>The generated signature </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">sig_len</td><td>The size of signature in bytes. Must be equal to value returned by <a class="el" href="group___epid_member_module.html#ga76e535722467af7c16809b5b521e0000" title="Computes the size in bytes required for an Intel(R) EPID signature. ">EpidGetSigSize()</a>.</td></tr>
</table>
@@ -793,7 +839,11 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
<dd>
<a class="el" href="group___epid_member_module.html#ga9998eb454838ff5d232ff22ecbab31bf" title="Sets the hash algorithm to be used by a member. ">EpidMemberSetHashAlg</a> </dd>
<dd>
-<a class="el" href="group___epid_member_module.html#ga76e535722467af7c16809b5b521e0000" title="Computes the size in bytes required for an Intel(R) EPID signature. ">EpidGetSigSize</a> </dd></dl>
+<a class="el" href="group___epid_member_module.html#gaaae6f21f58c22fce58076f10d68159f4" title="Sets the signature based revocation list to be used by a member. ">EpidMemberSetSigRl</a> </dd>
+<dd>
+<a class="el" href="group___epid_member_module.html#ga76e535722467af7c16809b5b521e0000" title="Computes the size in bytes required for an Intel(R) EPID signature. ">EpidGetSigSize</a></dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_GeneratingAnIntelEpidSignature.html">Generating an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -853,7 +903,7 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
<tr><td class="paramdir">[in]</td><td class="paramname">msg</td><td>The message. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">msg_len</td><td>The length of message in bytes. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">basename</td><td>Optional basename. If basename is NULL a random basename is used. Signatures generated using random basenames are anonymous. Signatures generated using the same basename are linkable by the verifier. If a basename is provided it must already be registered or <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ad134d6cc95a9dcb1b1a9f9c358047cbf" title="incorrect arg to function ">kEpidBadArgErr</a> is returned. </td></tr>
- <tr><td class="paramdir">[in]</td><td class="paramname">basename_len</td><td>The size of basename in bytes. Must be 0 basename is NULL. </td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">basename_len</td><td>The size of basename in bytes. Must be 0 if basename is NULL. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">sig</td><td>The generated basic signature</td></tr>
</table>
</dd>
@@ -868,56 +918,6 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
</div>
</div>
-<a class="anchor" id="ga9e12c7cec8d0c4e07b12c0e26a278c9d"></a>
-<div class="memitem">
-<div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> EpidWritePreSigs </td>
- <td>(</td>
- <td class="paramtype"><a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> *&#160;</td>
- <td class="paramname"><em>ctx</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype"><a class="el" href="struct_pre_computed_signature.html">PreComputedSignature</a> *&#160;</td>
- <td class="paramname"><em>presigs</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">size_t&#160;</td>
- <td class="paramname"><em>number_presigs</em>&#160;</td>
- </tr>
- <tr>
- <td></td>
- <td>)</td>
- <td></td><td></td>
- </tr>
- </table>
-</div><div class="memdoc">
-
-<p>Serializes pre-computed signatures from the member's pool. </p>
-<p>Removes requested number of pre-computed signatures from member's pool and stores them in presigs array. Use <a class="el" href="group___epid_member_module.html#gad2e3de5c6ce641a318f8a46b61e75236" title="Extends the member&#39;s pool of pre-computed signatures. ">EpidAddPreSigs</a> to add pre-computed signatures to the pool.</p>
-<dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramdir">[in]</td><td class="paramname">ctx</td><td>The member context. </td></tr>
- <tr><td class="paramdir">[out]</td><td class="paramname">presigs</td><td>An existing buffer of pre-computed signatures. </td></tr>
- <tr><td class="paramdir">[in]</td><td class="paramname">number_presigs</td><td>Number of pre-computed signatures to read. Number_presigs must not be greater than the value returned by <a class="el" href="group___epid_member_module.html#gad78ca056dfea2565bbacd5734d9dc075" title="Gets the number of pre-computed signatures in the member&#39;s pool. ">EpidGetNumPreSigs</a>.</td></tr>
- </table>
- </dd>
-</dl>
-<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
-<dl class="section note"><dt>Note</dt><dd>If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9" title="no error ">kEpidNoErr</a> the state of the pre-computed signature pool, and of presigs, is undefined.</dd></dl>
-<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb" title="Creates a new member context. ">EpidMemberCreate</a> </dd>
-<dd>
-<a class="el" href="group___epid_member_module.html#gad78ca056dfea2565bbacd5734d9dc075" title="Gets the number of pre-computed signatures in the member&#39;s pool. ">EpidGetNumPreSigs</a> </dd>
-<dd>
-<a class="el" href="group___epid_member_module.html#gad2e3de5c6ce641a318f8a46b61e75236" title="Extends the member&#39;s pool of pre-computed signatures. ">EpidAddPreSigs</a> </dd></dl>
-
-</div>
-</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.10-->
@@ -925,7 +925,7 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___epid_member_module.js b/doc/html/group___epid_member_module.js
index cb9d1c7..373485f 100644
--- a/doc/html/group___epid_member_module.js
+++ b/doc/html/group___epid_member_module.js
@@ -1,38 +1,20 @@
var group___epid_member_module =
[
- [ "MemberPrecomp", "struct_member_precomp.html", [
- [ "e12", "struct_member_precomp.html#a55e5c4b25c8f0f426969a8d745260fe5", null ],
- [ "e22", "struct_member_precomp.html#a4e7412969bed3964f813b093b948e7b4", null ],
- [ "e2w", "struct_member_precomp.html#a879d5a7b0c30088b23f6e5c5fc62f834", null ],
- [ "ea2", "struct_member_precomp.html#a573551f6494e372f44fd3bdf5b02aeda", null ]
- ] ],
- [ "PreComputedSignature", "struct_pre_computed_signature.html", [
- [ "a", "struct_pre_computed_signature.html#af23f3f9693857a33fe8564644612ea37", null ],
- [ "B", "struct_pre_computed_signature.html#a9cc2eb61572a1aca9e6bc3d5e6f4c1fe", null ],
- [ "b", "struct_pre_computed_signature.html#a666710432d9d54ca896647a976892c4f", null ],
- [ "K", "struct_pre_computed_signature.html#a2a4eaffe2717bd9c8c360599612adbe6", null ],
- [ "R1", "struct_pre_computed_signature.html#a72be597624957e3d668c95ff6f445f94", null ],
- [ "R2", "struct_pre_computed_signature.html#a79f06fb57842597372e00dd34c1a804a", null ],
- [ "ra", "struct_pre_computed_signature.html#a54462643b8a2b4f2741bf8d2e6909d11", null ],
- [ "rb", "struct_pre_computed_signature.html#a6a1db672c609943fe7af84320dc68ba3", null ],
- [ "rf", "struct_pre_computed_signature.html#ac244bd559a96812bcee7671abc299b66", null ],
- [ "rx", "struct_pre_computed_signature.html#acd0674d5b5e96244645e9abef7bdbddc", null ],
- [ "T", "struct_pre_computed_signature.html#a73471643dc757115701833ca2e831a72", null ]
- ] ],
+ [ "tpm", "group___tpm_module.html", "group___tpm_module" ],
[ "MemberCtx", "group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817", null ],
- [ "EpidAddPreSigs", "group___epid_member_module.html#gad2e3de5c6ce641a318f8a46b61e75236", null ],
+ [ "EpidAddPreSigs", "group___epid_member_module.html#gacb0547ec085a9ed324d323416bce4a78", null ],
+ [ "EpidAssemblePrivKey", "group___epid_member_module.html#ga4ccaa8337931523c77567f5b846ef188", null ],
[ "EpidDecompressPrivKey", "group___epid_member_module.html#gaf8cd05388f017486f14da2ee48d067ef", null ],
[ "EpidGetNumPreSigs", "group___epid_member_module.html#gad78ca056dfea2565bbacd5734d9dc075", null ],
[ "EpidGetSigSize", "group___epid_member_module.html#ga76e535722467af7c16809b5b521e0000", null ],
- [ "EpidIsPrivKeyInGroup", "group___epid_member_module.html#ga8e3f201d1e9dc668659e08a3bdf543b6", null ],
[ "EpidMemberCreate", "group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb", null ],
[ "EpidMemberDelete", "group___epid_member_module.html#ga3824589c683c5e0e59d483462fce65d6", null ],
[ "EpidMemberSetHashAlg", "group___epid_member_module.html#ga9998eb454838ff5d232ff22ecbab31bf", null ],
+ [ "EpidMemberSetSigRl", "group___epid_member_module.html#gaaae6f21f58c22fce58076f10d68159f4", null ],
[ "EpidMemberWritePrecomp", "group___epid_member_module.html#ga5c35798d62cf81c4ca62b22c38809721", null ],
[ "EpidNrProve", "group___epid_member_module.html#gac8e2c6c1fead8030785a40427905a2cc", null ],
[ "EpidRegisterBaseName", "group___epid_member_module.html#gad92d3c3266ae1833ffb1dba9ad76035d", null ],
[ "EpidRequestJoin", "group___epid_member_module.html#ga13dd0d72be9babf8194d472d7712a361", null ],
- [ "EpidSign", "group___epid_member_module.html#ga759155a719254f734157722716dac640", null ],
- [ "EpidSignBasic", "group___epid_member_module.html#gae04a250d5981fcf9bd6f9f57e0468faa", null ],
- [ "EpidWritePreSigs", "group___epid_member_module.html#ga9e12c7cec8d0c4e07b12c0e26a278c9d", null ]
+ [ "EpidSign", "group___epid_member_module.html#ga74d1409a816cb52633564b793072da5f", null ],
+ [ "EpidSignBasic", "group___epid_member_module.html#gae04a250d5981fcf9bd6f9f57e0468faa", null ]
]; \ No newline at end of file
diff --git a/doc/html/group___epid_module.html b/doc/html/group___epid_module.html
index 300aed1..01d5c8e 100644
--- a/doc/html/group___epid_module.html
+++ b/doc/html/group___epid_module.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ Modules</h2></td></tr>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___epid_print.html b/doc/html/group___epid_print.html
index 0e1a1b3..7f78db2 100644
--- a/doc/html/group___epid_print.html
+++ b/doc/html/group___epid_print.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -656,7 +656,7 @@ Functions</h2></td></tr>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___epid_types.html b/doc/html/group___epid_types.html
index 6a65d8e..9d5e80f 100644
--- a/doc/html/group___epid_types.html
+++ b/doc/html/group___epid_types.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -161,6 +161,9 @@ Data Structures</h2></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_verifier_rl.html">VerifierRl</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_member_precomp.html">MemberPrecomp</a></td></tr>
+<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pre-computed member settings. <a href="struct_member_precomp.html#details">More...</a><br /></td></tr>
+<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_fq2_elem_str.html">Fq2ElemStr</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serialized Fq2 element. <a href="struct_fq2_elem_str.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -182,6 +185,14 @@ Data Structures</h2></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
+<tr class="memitem:ga3315fb24f4c5783b6d6eb107933390b0"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga3315fb24f4c5783b6d6eb107933390b0"></a>
+typedef void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_types.html#ga3315fb24f4c5783b6d6eb107933390b0">OctStr</a></td></tr>
+<tr class="memdesc:ga3315fb24f4c5783b6d6eb107933390b0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generic Octet String Style Number. <br /></td></tr>
+<tr class="separator:ga3315fb24f4c5783b6d6eb107933390b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gace6876a045f2c2694444b35ccb0844e2"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gace6876a045f2c2694444b35ccb0844e2"></a>
+typedef void const *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a></td></tr>
+<tr class="memdesc:gace6876a045f2c2694444b35ccb0844e2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generic Const Octet String Style Number. <br /></td></tr>
+<tr class="separator:gace6876a045f2c2694444b35ccb0844e2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gada666b48d0cbc301985405fde896f1de"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gada666b48d0cbc301985405fde896f1de"></a>
typedef <a class="el" href="struct_oct_str128.html">OctStr128</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_types.html#gada666b48d0cbc301985405fde896f1de">GroupId</a></td></tr>
<tr class="memdesc:gada666b48d0cbc301985405fde896f1de"><td class="mdescLeft">&#160;</td><td class="mdescRight">group ID <br /></td></tr>
@@ -269,7 +280,7 @@ Enumerations</h2></td></tr>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___epid_types.js b/doc/html/group___epid_types.js
index e83078b..3cd8a41 100644
--- a/doc/html/group___epid_types.js
+++ b/doc/html/group___epid_types.js
@@ -134,6 +134,12 @@ var group___epid_types =
[ "n4", "struct_verifier_rl.html#a1e3f84b873bccc0c882aa6432c42d2f7", null ],
[ "version", "struct_verifier_rl.html#afa44ab69ffff5a3508366aeb2131fdaa", null ]
] ],
+ [ "MemberPrecomp", "struct_member_precomp.html", [
+ [ "e12", "struct_member_precomp.html#a55e5c4b25c8f0f426969a8d745260fe5", null ],
+ [ "e22", "struct_member_precomp.html#a4e7412969bed3964f813b093b948e7b4", null ],
+ [ "e2w", "struct_member_precomp.html#a879d5a7b0c30088b23f6e5c5fc62f834", null ],
+ [ "ea2", "struct_member_precomp.html#a573551f6494e372f44fd3bdf5b02aeda", null ]
+ ] ],
[ "Fq2ElemStr", "struct_fq2_elem_str.html", [
[ "a", "struct_fq2_elem_str.html#ab1d253eb24ba30eaf516ac429daab915", null ]
] ],
@@ -154,8 +160,10 @@ var group___epid_types =
[ "EcdsaPrivateKey", "struct_ecdsa_private_key.html", [
[ "data", "struct_ecdsa_private_key.html#a97efee9b4079f95d94a104f9a6d8c96d", null ]
] ],
+ [ "ConstOctStr", "group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2", null ],
[ "GroupId", "group___epid_types.html#gada666b48d0cbc301985405fde896f1de", null ],
[ "IssuerNonce", "group___epid_types.html#ga55eb2193045bde31af3f551565126042", null ],
+ [ "OctStr", "group___epid_types.html#ga3315fb24f4c5783b6d6eb107933390b0", null ],
[ "ReKeySeed", "group___epid_types.html#ga54bd22670f2e348593db7ab631131d10", null ],
[ "Seed", "group___epid_types.html#ga888541b8148df69c634a92c64ed51317", null ],
[ "HashAlg", "group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890", [
diff --git a/doc/html/group___epid_verifier_module.html b/doc/html/group___epid_verifier_module.html
index 2e07e21..88ff90b 100644
--- a/doc/html/group___epid_verifier_module.html
+++ b/doc/html/group___epid_verifier_module.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -145,7 +145,8 @@ Functions</h2></td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Verifier functionality. </p>
-<p>Defines the APIs needed by Intel(R) EPID verifiers. Each verifier context (<a class="el" href="group___epid_verifier_module.html#gaf172a5f8f7f069d38c5838b723a1a85c" title="Internal context of verifier. ">VerifierCtx</a>) represents a verifier for a single group. </p>
+<p>Defines the APIs needed by Intel(R) EPID verifiers. Each verifier context (<a class="el" href="group___epid_verifier_module.html#gaf172a5f8f7f069d38c5838b723a1a85c" title="Internal context of verifier. ">VerifierCtx</a>) represents a verifier for a single group.</p>
+<p>To use this module, include the header <a class="el" href="verifier_2api_8h.html" title="Intel(R) EPID SDK verifier API. ">epid/verifier/api.h</a>. </p>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="gae44bd8acbc1e7205aeedff0c7e2632a8"></a>
<div class="memitem">
@@ -193,7 +194,7 @@ Functions</h2></td></tr>
<dd>
<a class="el" href="group___epid_member_module.html#gae04a250d5981fcf9bd6f9f57e0468faa" title="Creates a basic signature for use in constrained environment. ">EpidSignBasic</a> </dd>
<dd>
-<a class="el" href="group___epid_member_module.html#ga759155a719254f734157722716dac640" title="Writes an Intel(R) EPID signature. ">EpidSign</a> </dd></dl>
+<a class="el" href="group___epid_member_module.html#ga74d1409a816cb52633564b793072da5f" title="Writes an Intel(R) EPID signature. ">EpidSign</a> </dd></dl>
</div>
</div>
@@ -468,7 +469,9 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
<dl class="section note"><dt>Note</dt><dd>If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9" title="no error ">kEpidNoErr</a> the content of ctx is undefined.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_verifier_module.html#ga6707e691f4b3916f9c684d5bbd463d12" title="Deletes an existing verifier context. ">EpidVerifierDelete</a> </dd>
<dd>
-<a class="el" href="group___epid_verifier_module.html#ga92df4d00ea4ee59d7bfd35b23da03392" title="Serializes the pre-computed verifier settings. ">EpidVerifierWritePrecomp</a> </dd></dl>
+<a class="el" href="group___epid_verifier_module.html#ga92df4d00ea4ee59d7bfd35b23da03392" title="Serializes the pre-computed verifier settings. ">EpidVerifierWritePrecomp</a></dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_VerifyingAnIntelEpidSignature.html">Verifying an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -495,7 +498,9 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
</table>
</dd>
</dl>
-<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70" title="Creates a new verifier context. ">EpidVerifierCreate</a> </dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70" title="Creates a new verifier context. ">EpidVerifierCreate</a></dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_VerifyingAnIntelEpidSignature.html">Verifying an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -540,7 +545,9 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
-<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70" title="Creates a new verifier context. ">EpidVerifierCreate</a> </dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70" title="Creates a new verifier context. ">EpidVerifierCreate</a></dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_VerifyingAnIntelEpidSignature.html">Verifying an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -589,7 +596,9 @@ It is the responsibility of the caller to free the memory pointed to by grp_rl a
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
<dl class="section note"><dt>Note</dt><dd>If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9" title="no error ">kEpidNoErr</a> the group based revocation list pointed to by the verifier is undefined.</dd></dl>
-<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70" title="Creates a new verifier context. ">EpidVerifierCreate</a> </dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70" title="Creates a new verifier context. ">EpidVerifierCreate</a></dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_VerifyingAnIntelEpidSignature.html">Verifying an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -629,7 +638,9 @@ It is the responsibility of the caller to free the memory pointed to by grp_rl a
<dl class="section note"><dt>Note</dt><dd>If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9" title="no error ">kEpidNoErr</a>, the hash algorithm used by the verifier is undefined.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70" title="Creates a new verifier context. ">EpidVerifierCreate</a> </dd>
<dd>
-<a class="el" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890" title="Recognized hash algorithms. ">HashAlg</a> </dd></dl>
+<a class="el" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890" title="Recognized hash algorithms. ">HashAlg</a></dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_VerifyingAnIntelEpidSignature.html">Verifying an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -678,7 +689,9 @@ It is the responsibility of the caller to free the memory pointed to by priv_rl
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
<dl class="section note"><dt>Note</dt><dd>If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9" title="no error ">kEpidNoErr</a> the private key based revocation list pointed to by the verifier is undefined.</dd></dl>
-<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70" title="Creates a new verifier context. ">EpidVerifierCreate</a> </dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70" title="Creates a new verifier context. ">EpidVerifierCreate</a></dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_VerifyingAnIntelEpidSignature.html">Verifying an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -727,7 +740,9 @@ It is the responsibility of the caller to free the memory pointed to by sig_rl a
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
<dl class="section note"><dt>Note</dt><dd>If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9" title="no error ">kEpidNoErr</a> the signature based revocation list pointed to by the verifier is undefined.</dd></dl>
-<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70" title="Creates a new verifier context. ">EpidVerifierCreate</a> </dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70" title="Creates a new verifier context. ">EpidVerifierCreate</a></dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_VerifyingAnIntelEpidSignature.html">Verifying an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -778,7 +793,9 @@ It is the responsibility of the caller to free the memory pointed to by sig_rl a
<dd>
<a class="el" href="group___epid_verifier_module.html#ga8eaeb9f4a34e9e37ccdf342919f38c69" title="Adds a valid name-based signature to the verifier blacklist. ">EpidBlacklistSig</a> </dd>
<dd>
-<a class="el" href="group___epid_verifier_module.html#gac857bff47e7d80363eac15285471fe81" title="Serializes the verifier blacklist to a buffer. ">EpidWriteVerifierRl</a> </dd></dl>
+<a class="el" href="group___epid_verifier_module.html#gac857bff47e7d80363eac15285471fe81" title="Serializes the verifier blacklist to a buffer. ">EpidWriteVerifierRl</a></dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_VerifyingAnIntelEpidSignature.html">Verifying an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -815,7 +832,9 @@ It is the responsibility of the caller to free the memory pointed to by sig_rl a
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
-<dl class="section note"><dt>Note</dt><dd>If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9" title="no error ">kEpidNoErr</a> the content of precomp is undefined. </dd></dl>
+<dl class="section note"><dt>Note</dt><dd>If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9" title="no error ">kEpidNoErr</a> the content of precomp is undefined.</dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_VerifyingAnIntelEpidSignature.html">Verifying an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -889,7 +908,9 @@ It is the responsibility of the caller to free the memory pointed to by sig_rl a
<dd>
<a class="el" href="group___epid_member_module.html#gae04a250d5981fcf9bd6f9f57e0468faa" title="Creates a basic signature for use in constrained environment. ">EpidSignBasic</a> </dd>
<dd>
-<a class="el" href="group___epid_member_module.html#ga759155a719254f734157722716dac640" title="Writes an Intel(R) EPID signature. ">EpidSign</a> </dd></dl>
+<a class="el" href="group___epid_member_module.html#ga74d1409a816cb52633564b793072da5f" title="Writes an Intel(R) EPID signature. ">EpidSign</a></dd></dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_VerifyingAnIntelEpidSignature.html">Verifying an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -948,7 +969,7 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
<dd>
<a class="el" href="group___epid_member_module.html#gae04a250d5981fcf9bd6f9f57e0468faa" title="Creates a basic signature for use in constrained environment. ">EpidSignBasic</a> </dd>
<dd>
-<a class="el" href="group___epid_member_module.html#ga759155a719254f734157722716dac640" title="Writes an Intel(R) EPID signature. ">EpidSign</a> </dd></dl>
+<a class="el" href="group___epid_member_module.html#ga74d1409a816cb52633564b793072da5f" title="Writes an Intel(R) EPID signature. ">EpidSign</a> </dd></dl>
</div>
</div>
@@ -1011,7 +1032,7 @@ If the result is not <a class="el" href="group___error_codes.html#ggafdb27c77c2c
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___error_codes.html b/doc/html/group___error_codes.html
index 74b35b3..cdf7ec2 100644
--- a/doc/html/group___error_codes.html
+++ b/doc/html/group___error_codes.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -94,7 +94,9 @@ Enumerations</h2></td></tr>
&#160;&#160;<a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a61234ad9610406da6bf7977afd72a357">kEpidRandMaxIterErr</a>,
<a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a3706f895a660260033b5b91890516c0f">kEpidDuplicateErr</a>,
<a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a94ae9c9b9337afd2fefd3b4f9c3160df">kEpidInconsistentBasenameSetErr</a>,
-<a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ab2768a1a5c4374cb1ac6175c09c73129">kEpidMathQuadraticNonResidueError</a>
+<a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ab2768a1a5c4374cb1ac6175c09c73129">kEpidMathQuadraticNonResidueError</a>,
+<br />
+&#160;&#160;<a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a700953ded1af35781948e8ada6dedf43">kEpidOutOfSequenceError</a>
<br />
}<tr class="memdesc:gafdb27c77c2c4b32c807e326a8a0da360"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return status for SDK functions. <a href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">More...</a><br /></td></tr>
</td></tr>
@@ -187,6 +189,9 @@ Functions</h2></td></tr>
<tr><td class="fieldname"><a class="anchor" id="ggafdb27c77c2c4b32c807e326a8a0da360ab2768a1a5c4374cb1ac6175c09c73129"></a>kEpidMathQuadraticNonResidueError&#160;</td><td class="fielddoc">
<p>quadratic Non-Residue Error </p>
</td></tr>
+<tr><td class="fieldname"><a class="anchor" id="ggafdb27c77c2c4b32c807e326a8a0da360a700953ded1af35781948e8ada6dedf43"></a>kEpidOutOfSequenceError&#160;</td><td class="fielddoc">
+<p>operation was performed out of sequence </p>
+</td></tr>
</table>
</div>
@@ -224,7 +229,7 @@ Functions</h2></td></tr>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___error_codes.js b/doc/html/group___error_codes.js
index 5f02463..84205b4 100644
--- a/doc/html/group___error_codes.js
+++ b/doc/html/group___error_codes.js
@@ -20,7 +20,8 @@ var group___error_codes =
[ "kEpidRandMaxIterErr", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a61234ad9610406da6bf7977afd72a357", null ],
[ "kEpidDuplicateErr", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a3706f895a660260033b5b91890516c0f", null ],
[ "kEpidInconsistentBasenameSetErr", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a94ae9c9b9337afd2fefd3b4f9c3160df", null ],
- [ "kEpidMathQuadraticNonResidueError", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ab2768a1a5c4374cb1ac6175c09c73129", null ]
+ [ "kEpidMathQuadraticNonResidueError", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ab2768a1a5c4374cb1ac6175c09c73129", null ],
+ [ "kEpidOutOfSequenceError", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a700953ded1af35781948e8ada6dedf43", null ]
] ],
[ "EpidStatusToString", "group___error_codes.html#ga59e8680ce52509302fd58a987e45004d", null ]
]; \ No newline at end of file
diff --git a/doc/html/group___file_parser.html b/doc/html/group___file_parser.html
index e6445ef..e69716c 100644
--- a/doc/html/group___file_parser.html
+++ b/doc/html/group___file_parser.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -142,7 +142,8 @@ const <a class="el" href="struct_oct_str16.html">OctStr16</a>&#160;</td><td clas
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Parser for issuer material. </p>
-<p>Provides an API for parsing buffers formatted according to the various IoT Intel(R) EPID binary file formats. </p>
+<p>Provides an API for parsing buffers formatted according to the various IoT Intel(R) EPID binary file formats.</p>
+<p>To use this module, include the header <a class="el" href="file__parser_8h.html" title="Epid issuer material parsing utilities. ">epid/common/file_parser.h</a>. </p>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a class="anchor" id="ga9a33be7edc6b4c7a867fb07bd2bddecb"></a>
<div class="memitem">
@@ -314,10 +315,12 @@ const <a class="el" href="struct_oct_str16.html">OctStr16</a>&#160;</td><td clas
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
- <tr><td class="paramname"><a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8" title="Signature is invalid. ">kEpidSigInvalid</a></td><td>Parsing failed due to data authentication failure. </td></tr>
+ <tr><td class="paramname"><a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8" title="Signature is invalid. ">kEpidSigInvalid</a></td><td>Parsing failed due to data authentication failure.</td></tr>
</table>
</dd>
</dl>
+<p><b>Examples</b> </p>
+<p><a class="el" href="UserManual_GeneratingAnIntelEpidSignature.html">Generating an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -380,10 +383,12 @@ const <a class="el" href="struct_oct_str16.html">OctStr16</a>&#160;</td><td clas
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
- <tr><td class="paramname"><a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8" title="Signature is invalid. ">kEpidSigInvalid</a></td><td>Parsing failed due to data authentication failure. </td></tr>
+ <tr><td class="paramname"><a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8" title="Signature is invalid. ">kEpidSigInvalid</a></td><td>Parsing failed due to data authentication failure.</td></tr>
</table>
</dd>
</dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_VerifyingAnIntelEpidSignature.html">Verifying an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -446,10 +451,12 @@ const <a class="el" href="struct_oct_str16.html">OctStr16</a>&#160;</td><td clas
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
- <tr><td class="paramname"><a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8" title="Signature is invalid. ">kEpidSigInvalid</a></td><td>Parsing failed due to data authentication failure. </td></tr>
+ <tr><td class="paramname"><a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8" title="Signature is invalid. ">kEpidSigInvalid</a></td><td>Parsing failed due to data authentication failure.</td></tr>
</table>
</dd>
</dl>
+<p><b>Example</b> </p>
+<p><a class="el" href="UserManual_VerifyingAnIntelEpidSignature.html">Verifying an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -512,10 +519,12 @@ const <a class="el" href="struct_oct_str16.html">OctStr16</a>&#160;</td><td clas
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
- <tr><td class="paramname"><a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8" title="Signature is invalid. ">kEpidSigInvalid</a></td><td>Parsing failed due to data authentication failure. </td></tr>
+ <tr><td class="paramname"><a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8" title="Signature is invalid. ">kEpidSigInvalid</a></td><td>Parsing failed due to data authentication failure.</td></tr>
</table>
</dd>
</dl>
+<p><b>Examples</b> </p>
+<p><a class="el" href="UserManual_GeneratingAnIntelEpidSignature.html">Generating an Intel&reg; EPID Signature</a> </p>
</div>
</div>
@@ -526,7 +535,7 @@ const <a class="el" href="struct_oct_str16.html">OctStr16</a>&#160;</td><td clas
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___finite_field_primitives.html b/doc/html/group___finite_field_primitives.html
index 4d20c6c..e8ae94e 100644
--- a/doc/html/group___finite_field_primitives.html
+++ b/doc/html/group___finite_field_primitives.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -99,15 +99,15 @@ Functions</h2></td></tr>
<tr class="memitem:ga1bad3c6945d1d709fceb07a1dd03000e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#ga1bad3c6945d1d709fceb07a1dd03000e">DeleteFfElement</a> (<a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> **ff_elem)</td></tr>
<tr class="memdesc:ga1bad3c6945d1d709fceb07a1dd03000e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Frees a previously allocated FfElement. <a href="#ga1bad3c6945d1d709fceb07a1dd03000e">More...</a><br /></td></tr>
<tr class="separator:ga1bad3c6945d1d709fceb07a1dd03000e"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga884d9e1baadf29a410244a735853e3c7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#ga884d9e1baadf29a410244a735853e3c7">ReadFfElement</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, void const *ff_elem_str, size_t strlen, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *ff_elem)</td></tr>
-<tr class="memdesc:ga884d9e1baadf29a410244a735853e3c7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deserializes a FfElement from a string. <a href="#ga884d9e1baadf29a410244a735853e3c7">More...</a><br /></td></tr>
-<tr class="separator:ga884d9e1baadf29a410244a735853e3c7"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga8a143a5a815a62f4947be2de1653c50f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#ga8a143a5a815a62f4947be2de1653c50f">ReadFfElement</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, <a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a> ff_elem_str, size_t strlen, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *ff_elem)</td></tr>
+<tr class="memdesc:ga8a143a5a815a62f4947be2de1653c50f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deserializes a FfElement from a string. <a href="#ga8a143a5a815a62f4947be2de1653c50f">More...</a><br /></td></tr>
+<tr class="separator:ga8a143a5a815a62f4947be2de1653c50f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga90b2c192708973b54b7a3e82b34536ed"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#ga90b2c192708973b54b7a3e82b34536ed">InitFfElementFromBn</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, <a class="el" href="group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718">BigNum</a> *bn, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *ff_elem)</td></tr>
<tr class="memdesc:ga90b2c192708973b54b7a3e82b34536ed"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes an existing FfElement from a BigNum. <a href="#ga90b2c192708973b54b7a3e82b34536ed">More...</a><br /></td></tr>
<tr class="separator:ga90b2c192708973b54b7a3e82b34536ed"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga678694636708463b078d842d5c58a900"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#ga678694636708463b078d842d5c58a900">WriteFfElement</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> const *ff_elem, void *ff_elem_str, size_t strlen)</td></tr>
-<tr class="memdesc:ga678694636708463b078d842d5c58a900"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serializes a finite field element to a string. <a href="#ga678694636708463b078d842d5c58a900">More...</a><br /></td></tr>
-<tr class="separator:ga678694636708463b078d842d5c58a900"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gaa3c1f7515dd823ddad8764091ebc665f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#gaa3c1f7515dd823ddad8764091ebc665f">WriteFfElement</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> const *ff_elem, <a class="el" href="group___epid_types.html#ga3315fb24f4c5783b6d6eb107933390b0">OctStr</a> ff_elem_str, size_t strlen)</td></tr>
+<tr class="memdesc:gaa3c1f7515dd823ddad8764091ebc665f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serializes a finite field element to a string. <a href="#gaa3c1f7515dd823ddad8764091ebc665f">More...</a><br /></td></tr>
+<tr class="separator:gaa3c1f7515dd823ddad8764091ebc665f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae7a8c7503b6fc7a41bcaab4d45ca37b2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#gae7a8c7503b6fc7a41bcaab4d45ca37b2">FfNeg</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> const *a, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *r)</td></tr>
<tr class="memdesc:gae7a8c7503b6fc7a41bcaab4d45ca37b2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the additive inverse of a finite field element. <a href="#gae7a8c7503b6fc7a41bcaab4d45ca37b2">More...</a><br /></td></tr>
<tr class="separator:gae7a8c7503b6fc7a41bcaab4d45ca37b2"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -141,9 +141,9 @@ Functions</h2></td></tr>
<tr class="memitem:gaed2acb8583e9c9f6b49fdb660c672625"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#gaed2acb8583e9c9f6b49fdb660c672625">FfIsEqual</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> const *a, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> const *b, <a class="el" href="stdtypes_8h.html#ad5c9d4ba3dc37783a528b0925dc981a0">bool</a> *is_equal)</td></tr>
<tr class="memdesc:gaed2acb8583e9c9f6b49fdb660c672625"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks if two finite field elements are equal. <a href="#gaed2acb8583e9c9f6b49fdb660c672625">More...</a><br /></td></tr>
<tr class="separator:gaed2acb8583e9c9f6b49fdb660c672625"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga18a952cebb4a1274c73e6cb0c19e8aea"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#ga18a952cebb4a1274c73e6cb0c19e8aea">FfHash</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, void const *msg, size_t msg_len, <a class="el" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890">HashAlg</a> hash_alg, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *r)</td></tr>
-<tr class="memdesc:ga18a952cebb4a1274c73e6cb0c19e8aea"><td class="mdescLeft">&#160;</td><td class="mdescRight">Hashes an arbitrary message to an element in a finite field. <a href="#ga18a952cebb4a1274c73e6cb0c19e8aea">More...</a><br /></td></tr>
-<tr class="separator:ga18a952cebb4a1274c73e6cb0c19e8aea"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gabd511d79d9cbd1899e59258f149102c5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#gabd511d79d9cbd1899e59258f149102c5">FfHash</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, <a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a> msg, size_t msg_len, <a class="el" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890">HashAlg</a> hash_alg, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *r)</td></tr>
+<tr class="memdesc:gabd511d79d9cbd1899e59258f149102c5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Hashes an arbitrary message to an element in a finite field. <a href="#gabd511d79d9cbd1899e59258f149102c5">More...</a><br /></td></tr>
+<tr class="separator:gabd511d79d9cbd1899e59258f149102c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga6622db072782fd9e53b4d59dd3dbd8e8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___finite_field_primitives.html#ga6622db072782fd9e53b4d59dd3dbd8e8">FfGetRandom</a> (<a class="el" href="group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e">FiniteField</a> *ff, <a class="el" href="struct_big_num_str.html">BigNumStr</a> const *low_bound, <a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c">BitSupplier</a> rnd_func, void *rnd_param, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *r)</td></tr>
<tr class="memdesc:ga6622db072782fd9e53b4d59dd3dbd8e8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generate random finite field element. <a href="#ga6622db072782fd9e53b4d59dd3dbd8e8">More...</a><br /></td></tr>
<tr class="separator:ga6622db072782fd9e53b4d59dd3dbd8e8"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -378,7 +378,7 @@ Functions</h2></td></tr>
</div>
</div>
-<a class="anchor" id="ga18a952cebb4a1274c73e6cb0c19e8aea"></a>
+<a class="anchor" id="gabd511d79d9cbd1899e59258f149102c5"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
@@ -391,7 +391,7 @@ Functions</h2></td></tr>
<tr>
<td class="paramkey"></td>
<td></td>
- <td class="paramtype">void const *&#160;</td>
+ <td class="paramtype"><a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a>&#160;</td>
<td class="paramname"><em>msg</em>, </td>
</tr>
<tr>
@@ -1012,7 +1012,7 @@ Functions</h2></td></tr>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___finite_field_primitives.html#gacc54f315ede2dbeb8c5990c024a0de6c" title="Creates a new finite field element. ">NewFfElement</a> </dd>
<dd>
-<a class="el" href="group___finite_field_primitives.html#ga678694636708463b078d842d5c58a900" title="Serializes a finite field element to a string. ">WriteFfElement</a> </dd></dl>
+<a class="el" href="group___finite_field_primitives.html#gaa3c1f7515dd823ddad8764091ebc665f" title="Serializes a finite field element to a string. ">WriteFfElement</a> </dd></dl>
</div>
</div>
@@ -1051,6 +1051,7 @@ Functions</h2></td></tr>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section attention"><dt>Attention</dt><dd>It is the responsibility of the caller to ensure that ff exists for the entire lifetime of the new FfElement.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___finite_field_primitives.html#ga7d99fdc5e4573668a5744e49df7ab67c" title="Creates new finite field. ">NewFiniteField</a> </dd>
<dd>
<a class="el" href="group___finite_field_primitives.html#ga1bad3c6945d1d709fceb07a1dd03000e" title="Frees a previously allocated FfElement. ">DeleteFfElement</a> </dd></dl>
@@ -1145,6 +1146,7 @@ Functions</h2></td></tr>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section attention"><dt>Attention</dt><dd>It is the responsibility of the caller to ensure that ground_field exists for the entire lifetime of the new FiniteField.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___finite_field_primitives.html#gacbdd2871ecf93dadaac9d2c5b16e1e5f" title="Frees a previously allocated FiniteField. ">DeleteFiniteField</a> </dd></dl>
</div>
@@ -1199,11 +1201,12 @@ Functions</h2></td></tr>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section attention"><dt>Attention</dt><dd>It is the responsibility of the caller to ensure that ground_field exists for the entire lifetime of the new FiniteField.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___finite_field_primitives.html#gacbdd2871ecf93dadaac9d2c5b16e1e5f" title="Frees a previously allocated FiniteField. ">DeleteFiniteField</a> </dd></dl>
</div>
</div>
-<a class="anchor" id="ga884d9e1baadf29a410244a735853e3c7"></a>
+<a class="anchor" id="ga8a143a5a815a62f4947be2de1653c50f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
@@ -1216,7 +1219,7 @@ Functions</h2></td></tr>
<tr>
<td class="paramkey"></td>
<td></td>
- <td class="paramtype">void const *&#160;</td>
+ <td class="paramtype"><a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a>&#160;</td>
<td class="paramname"><em>ff_elem_str</em>, </td>
</tr>
<tr>
@@ -1252,11 +1255,11 @@ Functions</h2></td></tr>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___finite_field_primitives.html#gacc54f315ede2dbeb8c5990c024a0de6c" title="Creates a new finite field element. ">NewFfElement</a> </dd>
<dd>
-<a class="el" href="group___finite_field_primitives.html#ga678694636708463b078d842d5c58a900" title="Serializes a finite field element to a string. ">WriteFfElement</a> </dd></dl>
+<a class="el" href="group___finite_field_primitives.html#gaa3c1f7515dd823ddad8764091ebc665f" title="Serializes a finite field element to a string. ">WriteFfElement</a> </dd></dl>
</div>
</div>
-<a class="anchor" id="ga678694636708463b078d842d5c58a900"></a>
+<a class="anchor" id="gaa3c1f7515dd823ddad8764091ebc665f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
@@ -1275,7 +1278,7 @@ Functions</h2></td></tr>
<tr>
<td class="paramkey"></td>
<td></td>
- <td class="paramtype">void *&#160;</td>
+ <td class="paramtype"><a class="el" href="group___epid_types.html#ga3315fb24f4c5783b6d6eb107933390b0">OctStr</a>&#160;</td>
<td class="paramname"><em>ff_elem_str</em>, </td>
</tr>
<tr>
@@ -1320,7 +1323,7 @@ Functions</h2></td></tr>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___finite_field_primitives.js b/doc/html/group___finite_field_primitives.js
index 5d2ad45..e199c19 100644
--- a/doc/html/group___finite_field_primitives.js
+++ b/doc/html/group___finite_field_primitives.js
@@ -7,7 +7,7 @@ var group___finite_field_primitives =
[ "FfAdd", "group___finite_field_primitives.html#ga1a6e6d3c2319bb24eae8670b021e223b", null ],
[ "FfExp", "group___finite_field_primitives.html#gaf0ddbc1bad048d67771cba119eb44a6c", null ],
[ "FfGetRandom", "group___finite_field_primitives.html#ga6622db072782fd9e53b4d59dd3dbd8e8", null ],
- [ "FfHash", "group___finite_field_primitives.html#ga18a952cebb4a1274c73e6cb0c19e8aea", null ],
+ [ "FfHash", "group___finite_field_primitives.html#gabd511d79d9cbd1899e59258f149102c5", null ],
[ "FfInv", "group___finite_field_primitives.html#ga26069d035d0f6ade33af2b5d5c14949a", null ],
[ "FfIsEqual", "group___finite_field_primitives.html#gaed2acb8583e9c9f6b49fdb660c672625", null ],
[ "FfIsZero", "group___finite_field_primitives.html#ga20d9140e5670d679ef8183d9b5115f53", null ],
@@ -23,6 +23,6 @@ var group___finite_field_primitives =
[ "NewFiniteField", "group___finite_field_primitives.html#ga7d99fdc5e4573668a5744e49df7ab67c", null ],
[ "NewFiniteFieldViaBinomalExtension", "group___finite_field_primitives.html#ga83041e3be9984a4bd8f1021934bfa3a2", null ],
[ "NewFiniteFieldViaPolynomialExtension", "group___finite_field_primitives.html#gae69af62a03179718cac81b004549c598", null ],
- [ "ReadFfElement", "group___finite_field_primitives.html#ga884d9e1baadf29a410244a735853e3c7", null ],
- [ "WriteFfElement", "group___finite_field_primitives.html#ga678694636708463b078d842d5c58a900", null ]
+ [ "ReadFfElement", "group___finite_field_primitives.html#ga8a143a5a815a62f4947be2de1653c50f", null ],
+ [ "WriteFfElement", "group___finite_field_primitives.html#gaa3c1f7515dd823ddad8764091ebc665f", null ]
]; \ No newline at end of file
diff --git a/doc/html/group___hash_primitives.html b/doc/html/group___hash_primitives.html
index 4a31fcb..240969d 100644
--- a/doc/html/group___hash_primitives.html
+++ b/doc/html/group___hash_primitives.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -134,7 +134,7 @@ Functions</h2></td></tr>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___pairing_primitives.html b/doc/html/group___pairing_primitives.html
index 0ca3e2a..bc5801f 100644
--- a/doc/html/group___pairing_primitives.html
+++ b/doc/html/group___pairing_primitives.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -90,9 +90,9 @@ Functions</h2></td></tr>
<tr class="memitem:gad54aebdc331d39b73000fdca9e04f94d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___pairing_primitives.html#gad54aebdc331d39b73000fdca9e04f94d">DeletePairingState</a> (<a class="el" href="group___pairing_primitives.html#ga3f1fa61d25487f96dfb0ffef4ad35607">PairingState</a> **ps)</td></tr>
<tr class="memdesc:gad54aebdc331d39b73000fdca9e04f94d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Frees a previously allocated by PairingState. <a href="#gad54aebdc331d39b73000fdca9e04f94d">More...</a><br /></td></tr>
<tr class="separator:gad54aebdc331d39b73000fdca9e04f94d"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga5dd07d13536e27c37eaeee285297066c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___pairing_primitives.html#ga5dd07d13536e27c37eaeee285297066c">Pairing</a> (<a class="el" href="group___pairing_primitives.html#ga3f1fa61d25487f96dfb0ffef4ad35607">PairingState</a> *ps, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *d, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *a, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *b)</td></tr>
-<tr class="memdesc:ga5dd07d13536e27c37eaeee285297066c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes an Optimal Ate Pairing for two parameters. <a href="#ga5dd07d13536e27c37eaeee285297066c">More...</a><br /></td></tr>
-<tr class="separator:ga5dd07d13536e27c37eaeee285297066c"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga58a9d3cb6129274a04c72a35a52f768d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___pairing_primitives.html#ga58a9d3cb6129274a04c72a35a52f768d">Pairing</a> (<a class="el" href="group___pairing_primitives.html#ga3f1fa61d25487f96dfb0ffef4ad35607">PairingState</a> *ps, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *a, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *b, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *d)</td></tr>
+<tr class="memdesc:ga58a9d3cb6129274a04c72a35a52f768d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes an Optimal Ate Pairing for two parameters. <a href="#ga58a9d3cb6129274a04c72a35a52f768d">More...</a><br /></td></tr>
+<tr class="separator:ga58a9d3cb6129274a04c72a35a52f768d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Pairing operations. </p>
@@ -187,11 +187,12 @@ Functions</h2></td></tr>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section attention"><dt>Attention</dt><dd>It is the responsibility of the caller to ensure that ga, gb, and ff exist for the entire lifetime of the new PairingState.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___pairing_primitives.html#gad54aebdc331d39b73000fdca9e04f94d" title="Frees a previously allocated by PairingState. ">DeletePairingState</a> </dd></dl>
</div>
</div>
-<a class="anchor" id="ga5dd07d13536e27c37eaeee285297066c"></a>
+<a class="anchor" id="ga58a9d3cb6129274a04c72a35a52f768d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
@@ -204,20 +205,20 @@ Functions</h2></td></tr>
<tr>
<td class="paramkey"></td>
<td></td>
- <td class="paramtype"><a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *&#160;</td>
- <td class="paramname"><em>d</em>, </td>
+ <td class="paramtype"><a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *&#160;</td>
+ <td class="paramname"><em>a</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *&#160;</td>
- <td class="paramname"><em>a</em>, </td>
+ <td class="paramname"><em>b</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
- <td class="paramtype"><a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *&#160;</td>
- <td class="paramname"><em>b</em>&#160;</td>
+ <td class="paramtype"><a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *&#160;</td>
+ <td class="paramname"><em>d</em>&#160;</td>
</tr>
<tr>
<td></td>
@@ -231,9 +232,9 @@ Functions</h2></td></tr>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">ps</td><td>The pairing state. </td></tr>
- <tr><td class="paramdir">[out]</td><td class="paramname">d</td><td>The result of the pairing. Will be in ff used to create the pairing state. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">a</td><td>The first value to pair. Must be in ga used to create ps. </td></tr>
- <tr><td class="paramdir">[in]</td><td class="paramname">b</td><td>The second value to pair. Must be in gb used to create ps</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">b</td><td>The second value to pair. Must be in gb used to create ps </td></tr>
+ <tr><td class="paramdir">[out]</td><td class="paramname">d</td><td>The result of the pairing. Will be in ff used to create the pairing state.</td></tr>
</table>
</dd>
</dl>
@@ -248,7 +249,7 @@ Functions</h2></td></tr>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/group___pairing_primitives.js b/doc/html/group___pairing_primitives.js
index a594ea7..f66ceb1 100644
--- a/doc/html/group___pairing_primitives.js
+++ b/doc/html/group___pairing_primitives.js
@@ -4,5 +4,5 @@ var group___pairing_primitives =
[ "PairingState", "group___pairing_primitives.html#ga3f1fa61d25487f96dfb0ffef4ad35607", null ],
[ "DeletePairingState", "group___pairing_primitives.html#gad54aebdc331d39b73000fdca9e04f94d", null ],
[ "NewPairingState", "group___pairing_primitives.html#ga29f79a645871830754d396b9b4a2a0cc", null ],
- [ "Pairing", "group___pairing_primitives.html#ga5dd07d13536e27c37eaeee285297066c", null ]
+ [ "Pairing", "group___pairing_primitives.html#ga58a9d3cb6129274a04c72a35a52f768d", null ]
]; \ No newline at end of file
diff --git a/doc/html/group___tpm_module.html b/doc/html/group___tpm_module.html
new file mode 100644
index 0000000..41a6f92
--- /dev/null
+++ b/doc/html/group___tpm_module.html
@@ -0,0 +1,929 @@
+<!-- HTML header for doxygen 1.8.10-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.11"/>
+<title>Intel&reg; Enhanced Privacy ID SDK: tpm</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="navtree.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="resize.js"></script>
+<script type="text/javascript" src="navtreedata.js"></script>
+<script type="text/javascript" src="navtree.js"></script>
+<script type="text/javascript">
+ $(document).ready(initResizable);
+ $(window).load(resizeHeight);
+</script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+<link href="epidstyle.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td id="projectalign" style="padding-left: 0.5em;">
+ <div id="projectname"><a
+ onclick="storeLink('index.html')"
+ id="projectlink"
+ class="index.html"
+ href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
+&#160;<span id="projectnumber">4.0.0</span>
+</div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.11 -->
+</div><!-- top -->
+<div id="side-nav" class="ui-resizable side-nav-resizable">
+ <div id="nav-tree">
+ <div id="nav-tree-contents">
+ <div id="nav-sync" class="sync"></div>
+ </div>
+ </div>
+ <div id="splitbar" style="-moz-user-select:none;"
+ class="ui-resizable-handle">
+ </div>
+</div>
+<script type="text/javascript">
+$(document).ready(function(){initNavTree('group___tpm_module.html','');});
+</script>
+<div id="doc-content">
+<div class="header">
+ <div class="summary">
+<a href="#nested-classes">Data Structures</a> &#124;
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">tpm<div class="ingroups"><a class="el" href="group___epid_module.html">epid</a> &raquo; <a class="el" href="group___epid_member_module.html">member</a></div></div> </div>
+</div><!--header-->
+<div class="contents">
+
+<p>Internal interface that models sensitive member functionality.
+<a href="#details">More...</a></p>
+<table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
+Data Structures</h2></td></tr>
+<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_nr_prove_commit_output.html">NrProveCommitOutput</a></td></tr>
+<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Result of NrProve Commit. <a href="struct_nr_prove_commit_output.html#details">More...</a><br /></td></tr>
+<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_sign_commit_output.html">SignCommitOutput</a></td></tr>
+<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Result of Sign Commit. <a href="struct_sign_commit_output.html#details">More...</a><br /></td></tr>
+<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
+</table><table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr class="memitem:ga901cad19eb14a6a6a02e85f9d710d287"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287">TpmCreate</a> (<a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c">BitSupplier</a> rnd_func, void *rnd_param, Epid2Params_ const *epid2_params, TpmCtx **ctx)</td></tr>
+<tr class="memdesc:ga901cad19eb14a6a6a02e85f9d710d287"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new Tpm context. <a href="#ga901cad19eb14a6a6a02e85f9d710d287">More...</a><br /></td></tr>
+<tr class="separator:ga901cad19eb14a6a6a02e85f9d710d287"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga95bc18225c1d87803be7965978e37449"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#ga95bc18225c1d87803be7965978e37449">TpmDelete</a> (TpmCtx **ctx)</td></tr>
+<tr class="memdesc:ga95bc18225c1d87803be7965978e37449"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes an existing Tpm context. <a href="#ga95bc18225c1d87803be7965978e37449">More...</a><br /></td></tr>
+<tr class="separator:ga95bc18225c1d87803be7965978e37449"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga42b80d485cff39fe9ec14a0b5a81426d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#ga42b80d485cff39fe9ec14a0b5a81426d">TpmProvision</a> (TpmCtx *ctx, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *f_str)</td></tr>
+<tr class="memdesc:ga42b80d485cff39fe9ec14a0b5a81426d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Provisions Tpm with sensitive parameters. <a href="#ga42b80d485cff39fe9ec14a0b5a81426d">More...</a><br /></td></tr>
+<tr class="separator:ga42b80d485cff39fe9ec14a0b5a81426d"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga688441f78f68aa53c41fcae4d31c6f50"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#ga688441f78f68aa53c41fcae4d31c6f50">TpmProvisionCompressed</a> (TpmCtx *ctx, <a class="el" href="struct_oct_str256.html">OctStr256</a> const *seed)</td></tr>
+<tr class="memdesc:ga688441f78f68aa53c41fcae4d31c6f50"><td class="mdescLeft">&#160;</td><td class="mdescRight">Provisions Tpm with compressed key seed. <a href="#ga688441f78f68aa53c41fcae4d31c6f50">More...</a><br /></td></tr>
+<tr class="separator:ga688441f78f68aa53c41fcae4d31c6f50"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gaeb9bfaa9288263af9feccd0d0543c9bc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#gaeb9bfaa9288263af9feccd0d0543c9bc">TpmDecompressKey</a> (TpmCtx *ctx, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *h1_str, <a class="el" href="struct_g2_elem_str.html">G2ElemStr</a> const *w_str, <a class="el" href="struct_fq_elem_str.html">FqElemStr</a> const *Ax_str, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> *A_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *x_str)</td></tr>
+<tr class="memdesc:gaeb9bfaa9288263af9feccd0d0543c9bc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompresses provisioned key. <a href="#gaeb9bfaa9288263af9feccd0d0543c9bc">More...</a><br /></td></tr>
+<tr class="separator:gaeb9bfaa9288263af9feccd0d0543c9bc"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga5e62323b94837b847f3e869cf2ff3615"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#ga5e62323b94837b847f3e869cf2ff3615">TpmInit</a> (TpmCtx *ctx, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *A_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *x_str, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *h1_str, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *h2_str, <a class="el" href="struct_g2_elem_str.html">G2ElemStr</a> const *w_str, <a class="el" href="struct_member_precomp.html">MemberPrecomp</a> const *precomp_str)</td></tr>
+<tr class="memdesc:ga5e62323b94837b847f3e869cf2ff3615"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes Tpm with non-sensitive parameters. <a href="#ga5e62323b94837b847f3e869cf2ff3615">More...</a><br /></td></tr>
+<tr class="separator:ga5e62323b94837b847f3e869cf2ff3615"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gae69218c9cba6a19d3ae1199c59772efc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#gae69218c9cba6a19d3ae1199c59772efc">TpmJoinCommit</a> (TpmCtx *ctx, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> *F_str, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> *R_str)</td></tr>
+<tr class="memdesc:gae69218c9cba6a19d3ae1199c59772efc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs the first part of the join operation. <a href="#gae69218c9cba6a19d3ae1199c59772efc">More...</a><br /></td></tr>
+<tr class="separator:gae69218c9cba6a19d3ae1199c59772efc"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gab80c411f070858fbe019d93f5ac6a6ec"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#gab80c411f070858fbe019d93f5ac6a6ec">TpmJoin</a> (TpmCtx *ctx, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *c_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *s_str)</td></tr>
+<tr class="memdesc:gab80c411f070858fbe019d93f5ac6a6ec"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs the last part of the join operation. <a href="#gab80c411f070858fbe019d93f5ac6a6ec">More...</a><br /></td></tr>
+<tr class="separator:gab80c411f070858fbe019d93f5ac6a6ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gace6002b520db41d8e781b02c6f538dc0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#gace6002b520db41d8e781b02c6f538dc0">TpmNrProveCommit</a> (TpmCtx *ctx, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *B_str, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *K_str, <a class="el" href="struct_sig_rl_entry.html">SigRlEntry</a> const *sigrl_entry, <a class="el" href="struct_nr_prove_commit_output.html">NrProveCommitOutput</a> *commit_out)</td></tr>
+<tr class="memdesc:gace6002b520db41d8e781b02c6f538dc0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs the first part of the NrProve operation. <a href="#gace6002b520db41d8e781b02c6f538dc0">More...</a><br /></td></tr>
+<tr class="separator:gace6002b520db41d8e781b02c6f538dc0"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga4346d22fb9fed6a161cb1ea178b50ed2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#ga4346d22fb9fed6a161cb1ea178b50ed2">TpmNrProve</a> (TpmCtx *ctx, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *c_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *smu_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *snu_str)</td></tr>
+<tr class="memdesc:ga4346d22fb9fed6a161cb1ea178b50ed2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs the last part of the NrProve operation. <a href="#ga4346d22fb9fed6a161cb1ea178b50ed2">More...</a><br /></td></tr>
+<tr class="separator:ga4346d22fb9fed6a161cb1ea178b50ed2"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga2335ec4eb78b542cf87df9b0cd15358c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#ga2335ec4eb78b542cf87df9b0cd15358c">TpmAddPreSigs</a> (TpmCtx *ctx, size_t number_presigs)</td></tr>
+<tr class="memdesc:ga2335ec4eb78b542cf87df9b0cd15358c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Extends the TPM's pool of pre-computed signatures. <a href="#ga2335ec4eb78b542cf87df9b0cd15358c">More...</a><br /></td></tr>
+<tr class="separator:ga2335ec4eb78b542cf87df9b0cd15358c"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gaa53a6bd52e22808bac21596a964bdece"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#gaa53a6bd52e22808bac21596a964bdece">TpmGetNumPreSigs</a> (TpmCtx const *ctx)</td></tr>
+<tr class="memdesc:gaa53a6bd52e22808bac21596a964bdece"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the number of pre-computed signatures in the TPM's pool. <a href="#gaa53a6bd52e22808bac21596a964bdece">More...</a><br /></td></tr>
+<tr class="separator:gaa53a6bd52e22808bac21596a964bdece"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gaf9004ce8832c1acae497604d1deb49cd"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#gaf9004ce8832c1acae497604d1deb49cd">TpmSignCommit</a> (TpmCtx *ctx, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *B_in_str, <a class="el" href="struct_sign_commit_output.html">SignCommitOutput</a> *commit_out)</td></tr>
+<tr class="memdesc:gaf9004ce8832c1acae497604d1deb49cd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs the first part of the sign operation. <a href="#gaf9004ce8832c1acae497604d1deb49cd">More...</a><br /></td></tr>
+<tr class="separator:gaf9004ce8832c1acae497604d1deb49cd"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gaa667fb3295e4533334bb32afcd43890f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#gaa667fb3295e4533334bb32afcd43890f">TpmSign</a> (TpmCtx *ctx, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *c_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *sx_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *sf_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *sa_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *sb_str)</td></tr>
+<tr class="memdesc:gaa667fb3295e4533334bb32afcd43890f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs the last part of the sign operation. <a href="#gaa667fb3295e4533334bb32afcd43890f">More...</a><br /></td></tr>
+<tr class="separator:gaa667fb3295e4533334bb32afcd43890f"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga3318f97e4d1763815dace3779ae6564f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="stdtypes_8h.html#ad5c9d4ba3dc37783a528b0925dc981a0">bool</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#ga3318f97e4d1763815dace3779ae6564f">TpmIsKeyValid</a> (TpmCtx *ctx, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *A_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *x_str, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *h1_str, <a class="el" href="struct_g2_elem_str.html">G2ElemStr</a> const *w_str)</td></tr>
+<tr class="memdesc:ga3318f97e4d1763815dace3779ae6564f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks if provided parameters result in a valid key. <a href="#ga3318f97e4d1763815dace3779ae6564f">More...</a><br /></td></tr>
+<tr class="separator:ga3318f97e4d1763815dace3779ae6564f"><td class="memSeparator" colspan="2">&#160;</td></tr>
+</table>
+<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
+<p>Internal interface that models sensitive member functionality. </p>
+<p>Provides an interface that gives guidance on partitioning member operations between highly sensitive ones that use f value of the private key and the random engine, and less sensitive operations that can be performed in a host environment.</p>
+<p>The TPM set-up operations are intended to model phases in the provisioning of a device.</p>
+<p><a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287" title="Creates a new Tpm context. ">TpmCreate</a> represents hardware and firmware that is intrinsic to the device and is key independent.</p>
+<p><a class="el" href="group___tpm_module.html#ga42b80d485cff39fe9ec14a0b5a81426d" title="Provisions Tpm with sensitive parameters. ">TpmProvision</a> and <a class="el" href="group___tpm_module.html#ga688441f78f68aa53c41fcae4d31c6f50" title="Provisions Tpm with compressed key seed. ">TpmProvisionCompressed</a> represent the provisioning of the <code>f</code> portion of the secret key into the device. This is usually done by blowing of fuses or other one time programmable storage, and is not an operation that is typically done as part of normal member operation.</p>
+<p><a class="el" href="group___tpm_module.html#ga5e62323b94837b847f3e869cf2ff3615" title="Initializes Tpm with non-sensitive parameters. ">TpmInit</a> represents joining the device to a group. This may be called more than once in the event of a re-key or join event. <a class="el" href="group___tpm_module.html#ga3318f97e4d1763815dace3779ae6564f" title="Checks if provided parameters result in a valid key. ">TpmIsKeyValid</a> can be called to validate the parameters to <code>TpmInit</code>.</p>
+<p>The core member functionality of generating signatures, non-revoked proofs, and join requests is implemented using split operations. The host needs to call the commit portion of the split operation first, then it does some work on the output, and completes the operation by calling the second half of the split operation. </p>
+<h2 class="groupheader">Function Documentation</h2>
+<a class="anchor" id="ga2335ec4eb78b542cf87df9b0cd15358c"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> TpmAddPreSigs </td>
+ <td>(</td>
+ <td class="paramtype">TpmCtx *&#160;</td>
+ <td class="paramname"><em>ctx</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">size_t&#160;</td>
+ <td class="paramname"><em>number_presigs</em>&#160;</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Extends the TPM's pool of pre-computed signatures. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramdir">[in,out]</td><td class="paramname">ctx</td><td>The TPM context.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">number_presigs</td><td>The number of pre-computed signatures to add to the pool.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___tpm_module.html#gaa53a6bd52e22808bac21596a964bdece" title="Gets the number of pre-computed signatures in the TPM&#39;s pool. ">TpmGetNumPreSigs</a> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ga901cad19eb14a6a6a02e85f9d710d287"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> TpmCreate </td>
+ <td>(</td>
+ <td class="paramtype"><a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c">BitSupplier</a>&#160;</td>
+ <td class="paramname"><em>rnd_func</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">void *&#160;</td>
+ <td class="paramname"><em>rnd_param</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">Epid2Params_ const *&#160;</td>
+ <td class="paramname"><em>epid2_params</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">TpmCtx **&#160;</td>
+ <td class="paramname"><em>ctx</em>&#160;</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Creates a new Tpm context. </p>
+<p>Must be called to create the TPM context that is used by other TPM APIs.</p>
+<p><a class="el" href="group___tpm_module.html#ga95bc18225c1d87803be7965978e37449" title="Deletes an existing Tpm context. ">TpmDelete</a> must be called to safely release the TPM context.</p>
+<p>You need to use a cryptographically secure random number generator to create a TPM context using <a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287" title="Creates a new Tpm context. ">TpmCreate</a>. The <a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c" title="Generates random data. ">BitSupplier</a> is provided as a function prototype for your own implementation of the random number generator.</p>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramdir">[in]</td><td class="paramname">rnd_func</td><td>Random number generator.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">rnd_param</td><td>Pass through user data that will be passed to the user_data parameter of the random number generator.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">epid2_params</td><td>The field and group parameters.</td></tr>
+ <tr><td class="paramdir">[out]</td><td class="paramname">ctx</td><td>Newly constructed TPM context.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___tpm_module.html#ga95bc18225c1d87803be7965978e37449" title="Deletes an existing Tpm context. ">TpmDelete</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#ga42b80d485cff39fe9ec14a0b5a81426d" title="Provisions Tpm with sensitive parameters. ">TpmProvision</a> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="gaeb9bfaa9288263af9feccd0d0543c9bc"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> TpmDecompressKey </td>
+ <td>(</td>
+ <td class="paramtype">TpmCtx *&#160;</td>
+ <td class="paramname"><em>ctx</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>h1_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_g2_elem_str.html">G2ElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>w_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_fq_elem_str.html">FqElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>Ax_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> *&#160;</td>
+ <td class="paramname"><em>A_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *&#160;</td>
+ <td class="paramname"><em>x_str</em>&#160;</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Decompresses provisioned key. </p>
+<p>If you provision a compressed key using <a class="el" href="group___tpm_module.html#ga688441f78f68aa53c41fcae4d31c6f50" title="Provisions Tpm with compressed key seed. ">TpmProvisionCompressed</a>, you must call <a class="el" href="group___tpm_module.html#gaeb9bfaa9288263af9feccd0d0543c9bc" title="Decompresses provisioned key. ">TpmDecompressKey</a> before performing any other operations that use the TPM context. Once decompressed, the context will maintain the decompressed key for the lifetime of the context.</p>
+<dl class="section note"><dt>Note</dt><dd>If the compressed private key has not been provisioned, the result of the decompression is undefined.</dd></dl>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramdir">[in,out]</td><td class="paramname">ctx</td><td>The TPM context.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">h1_str</td><td>The h1 value of the group public key.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">w_str</td><td>The w value of the group public key.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">Ax_str</td><td>The Ax value of the compressed member private key.</td></tr>
+ <tr><td class="paramdir">[out]</td><td class="paramname">A_str</td><td>The A value of the member private key.</td></tr>
+ <tr><td class="paramdir">[out]</td><td class="paramname">x_str</td><td>The x value of the member private key.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287" title="Creates a new Tpm context. ">TpmCreate</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#ga688441f78f68aa53c41fcae4d31c6f50" title="Provisions Tpm with compressed key seed. ">TpmProvisionCompressed</a> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ga95bc18225c1d87803be7965978e37449"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">void TpmDelete </td>
+ <td>(</td>
+ <td class="paramtype">TpmCtx **&#160;</td>
+ <td class="paramname"><em>ctx</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Deletes an existing Tpm context. </p>
+<p>Must be called to safely release a TPM context created using <a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287" title="Creates a new Tpm context. ">TpmCreate</a>.</p>
+<p>De-initializes the context, frees memory used by the context, and sets the context pointer to NULL.</p>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramdir">[in,out]</td><td class="paramname">ctx</td><td>The TPM context. Can be NULL.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287" title="Creates a new Tpm context. ">TpmCreate</a> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="gaa53a6bd52e22808bac21596a964bdece"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">size_t TpmGetNumPreSigs </td>
+ <td>(</td>
+ <td class="paramtype">TpmCtx const *&#160;</td>
+ <td class="paramname"><em>ctx</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Gets the number of pre-computed signatures in the TPM's pool. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramdir">[in,out]</td><td class="paramname">ctx</td><td>The TPM context.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section return"><dt>Returns</dt><dd>Number of pre-computed signatures in TPM's pool</dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___tpm_module.html#ga2335ec4eb78b542cf87df9b0cd15358c" title="Extends the TPM&#39;s pool of pre-computed signatures. ">TpmAddPreSigs</a> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ga5e62323b94837b847f3e869cf2ff3615"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> TpmInit </td>
+ <td>(</td>
+ <td class="paramtype">TpmCtx *&#160;</td>
+ <td class="paramname"><em>ctx</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>A_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>x_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>h1_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>h2_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_g2_elem_str.html">G2ElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>w_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_member_precomp.html">MemberPrecomp</a> const *&#160;</td>
+ <td class="paramname"><em>precomp_str</em>&#160;</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Initializes Tpm with non-sensitive parameters. </p>
+<dl class="section note"><dt>Note</dt><dd>Does not check consistency with the provisioned f value. Use <a class="el" href="group___tpm_module.html#ga3318f97e4d1763815dace3779ae6564f" title="Checks if provided parameters result in a valid key. ">TpmIsKeyValid</a> to check that the parameters will result in a valid key pair.</dd></dl>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramdir">[in,out]</td><td class="paramname">ctx</td><td>The TPM context.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">A_str</td><td>The A value of the member private key.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">x_str</td><td>The x value of the member private key.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">h1_str</td><td>The h1 value of the group public key.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">h2_str</td><td>The h2 value of the group public key.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">w_str</td><td>The w value of the group public key.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">precomp_str</td><td>The member pre-computed data.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287" title="Creates a new Tpm context. ">TpmCreate</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#ga3318f97e4d1763815dace3779ae6564f" title="Checks if provided parameters result in a valid key. ">TpmIsKeyValid</a> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ga3318f97e4d1763815dace3779ae6564f"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="stdtypes_8h.html#ad5c9d4ba3dc37783a528b0925dc981a0">bool</a> TpmIsKeyValid </td>
+ <td>(</td>
+ <td class="paramtype">TpmCtx *&#160;</td>
+ <td class="paramname"><em>ctx</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>A_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>x_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>h1_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_g2_elem_str.html">G2ElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>w_str</em>&#160;</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Checks if provided parameters result in a valid key. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramdir">[in,out]</td><td class="paramname">ctx</td><td>The TPM context.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">A_str</td><td>The A value of the member private key.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">x_str</td><td>The x value of the member private key.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">h1_str</td><td>The h1 value of the group public key.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">w_str</td><td>The w value of the group public key.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="retval"><dt>Return values</dt><dd>
+ <table class="retval">
+ <tr><td class="paramname">true</td><td>if the input values would result in a valid member private key</td></tr>
+ <tr><td class="paramname">false</td><td>if the input values would result in an invalid member private key</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287" title="Creates a new Tpm context. ">TpmCreate</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#ga5e62323b94837b847f3e869cf2ff3615" title="Initializes Tpm with non-sensitive parameters. ">TpmInit</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#ga42b80d485cff39fe9ec14a0b5a81426d" title="Provisions Tpm with sensitive parameters. ">TpmProvision</a> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="gab80c411f070858fbe019d93f5ac6a6ec"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> TpmJoin </td>
+ <td>(</td>
+ <td class="paramtype">TpmCtx *&#160;</td>
+ <td class="paramname"><em>ctx</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>c_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *&#160;</td>
+ <td class="paramname"><em>s_str</em>&#160;</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Performs the last part of the join operation. </p>
+<dl class="section note"><dt>Note</dt><dd><a class="el" href="group___tpm_module.html#gab80c411f070858fbe019d93f5ac6a6ec" title="Performs the last part of the join operation. ">TpmJoin</a> must be preceded by a call to <a class="el" href="group___tpm_module.html#gae69218c9cba6a19d3ae1199c59772efc" title="Performs the first part of the join operation. ">TpmJoinCommit</a>. Two sequential calls to <a class="el" href="group___tpm_module.html#gab80c411f070858fbe019d93f5ac6a6ec" title="Performs the last part of the join operation. ">TpmJoin</a> will fail with <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a700953ded1af35781948e8ada6dedf43" title="operation was performed out of sequence ">kEpidOutOfSequenceError</a>.</dd></dl>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramdir">[in]</td><td class="paramname">ctx</td><td>The TPM context.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">c_str</td><td>The join commitment hash.</td></tr>
+ <tr><td class="paramdir">[out]</td><td class="paramname">s_str</td><td>The s value of the join request.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287" title="Creates a new Tpm context. ">TpmCreate</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#ga42b80d485cff39fe9ec14a0b5a81426d" title="Provisions Tpm with sensitive parameters. ">TpmProvision</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#gae69218c9cba6a19d3ae1199c59772efc" title="Performs the first part of the join operation. ">TpmJoinCommit</a> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="gae69218c9cba6a19d3ae1199c59772efc"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> TpmJoinCommit </td>
+ <td>(</td>
+ <td class="paramtype">TpmCtx *&#160;</td>
+ <td class="paramname"><em>ctx</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> *&#160;</td>
+ <td class="paramname"><em>F_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> *&#160;</td>
+ <td class="paramname"><em>R_str</em>&#160;</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Performs the first part of the join operation. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramdir">[in,out]</td><td class="paramname">ctx</td><td>The TPM context.</td></tr>
+ <tr><td class="paramdir">[out]</td><td class="paramname">F_str</td><td>The F value of the join commit.</td></tr>
+ <tr><td class="paramdir">[out]</td><td class="paramname">R_str</td><td>The R value of the join commit.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287" title="Creates a new Tpm context. ">TpmCreate</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#ga42b80d485cff39fe9ec14a0b5a81426d" title="Provisions Tpm with sensitive parameters. ">TpmProvision</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#gab80c411f070858fbe019d93f5ac6a6ec" title="Performs the last part of the join operation. ">TpmJoin</a> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ga4346d22fb9fed6a161cb1ea178b50ed2"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> TpmNrProve </td>
+ <td>(</td>
+ <td class="paramtype">TpmCtx *&#160;</td>
+ <td class="paramname"><em>ctx</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>c_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *&#160;</td>
+ <td class="paramname"><em>smu_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *&#160;</td>
+ <td class="paramname"><em>snu_str</em>&#160;</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Performs the last part of the NrProve operation. </p>
+<dl class="section note"><dt>Note</dt><dd><a class="el" href="group___tpm_module.html#ga4346d22fb9fed6a161cb1ea178b50ed2" title="Performs the last part of the NrProve operation. ">TpmNrProve</a> must be preceded by a call to <a class="el" href="group___tpm_module.html#gace6002b520db41d8e781b02c6f538dc0" title="Performs the first part of the NrProve operation. ">TpmNrProveCommit</a>. Two sequential calls to <a class="el" href="group___tpm_module.html#ga4346d22fb9fed6a161cb1ea178b50ed2" title="Performs the last part of the NrProve operation. ">TpmNrProve</a> will fail with <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a700953ded1af35781948e8ada6dedf43" title="operation was performed out of sequence ">kEpidOutOfSequenceError</a>.</dd></dl>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramdir">[in,out]</td><td class="paramname">ctx</td><td>The TPM context.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">c_str</td><td>The non-revoked proof commitment hash.</td></tr>
+ <tr><td class="paramdir">[out]</td><td class="paramname">smu_str</td><td>The smu value in the non-revoked proof.</td></tr>
+ <tr><td class="paramdir">[out]</td><td class="paramname">snu_str</td><td>The snu value in the non-revoked proof.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287" title="Creates a new Tpm context. ">TpmCreate</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#ga42b80d485cff39fe9ec14a0b5a81426d" title="Provisions Tpm with sensitive parameters. ">TpmProvision</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#ga5e62323b94837b847f3e869cf2ff3615" title="Initializes Tpm with non-sensitive parameters. ">TpmInit</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#gace6002b520db41d8e781b02c6f538dc0" title="Performs the first part of the NrProve operation. ">TpmNrProveCommit</a> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="gace6002b520db41d8e781b02c6f538dc0"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> TpmNrProveCommit </td>
+ <td>(</td>
+ <td class="paramtype">TpmCtx *&#160;</td>
+ <td class="paramname"><em>ctx</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>B_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>K_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_sig_rl_entry.html">SigRlEntry</a> const *&#160;</td>
+ <td class="paramname"><em>sigrl_entry</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_nr_prove_commit_output.html">NrProveCommitOutput</a> *&#160;</td>
+ <td class="paramname"><em>commit_out</em>&#160;</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Performs the first part of the NrProve operation. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramdir">[in,out]</td><td class="paramname">ctx</td><td>The TPM context.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">B_str</td><td>The B value from the <a class="el" href="struct_basic_signature.html" title="Intel(R) EPID 2.0 basic signature. ">BasicSignature</a>.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">K_str</td><td>The K value from the <a class="el" href="struct_basic_signature.html" title="Intel(R) EPID 2.0 basic signature. ">BasicSignature</a>.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">sigrl_entry</td><td>The signature based revocation list entry corresponding to this proof.</td></tr>
+ <tr><td class="paramdir">[out]</td><td class="paramname">commit_out</td><td>The resulting commitment value.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287" title="Creates a new Tpm context. ">TpmCreate</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#ga42b80d485cff39fe9ec14a0b5a81426d" title="Provisions Tpm with sensitive parameters. ">TpmProvision</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#ga5e62323b94837b847f3e869cf2ff3615" title="Initializes Tpm with non-sensitive parameters. ">TpmInit</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#ga4346d22fb9fed6a161cb1ea178b50ed2" title="Performs the last part of the NrProve operation. ">TpmNrProve</a> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ga42b80d485cff39fe9ec14a0b5a81426d"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> TpmProvision </td>
+ <td>(</td>
+ <td class="paramtype">TpmCtx *&#160;</td>
+ <td class="paramname"><em>ctx</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>f_str</em>&#160;</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Provisions Tpm with sensitive parameters. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramdir">[in,out]</td><td class="paramname">ctx</td><td>The TPM context.</td></tr>
+ <tr><td class="paramdir"></td><td class="paramname">f_str</td><td>The f value of the member private key.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287" title="Creates a new Tpm context. ">TpmCreate</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#ga5e62323b94837b847f3e869cf2ff3615" title="Initializes Tpm with non-sensitive parameters. ">TpmInit</a> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ga688441f78f68aa53c41fcae4d31c6f50"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> TpmProvisionCompressed </td>
+ <td>(</td>
+ <td class="paramtype">TpmCtx *&#160;</td>
+ <td class="paramname"><em>ctx</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_oct_str256.html">OctStr256</a> const *&#160;</td>
+ <td class="paramname"><em>seed</em>&#160;</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Provisions Tpm with compressed key seed. </p>
+<p>You must call <a class="el" href="group___tpm_module.html#gaeb9bfaa9288263af9feccd0d0543c9bc" title="Decompresses provisioned key. ">TpmDecompressKey</a> before performing any other operations that use the TPM context.</p>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramdir">[in,out]</td><td class="paramname">ctx</td><td>The TPM context.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">seed</td><td>The seed value of the compressed key.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287" title="Creates a new Tpm context. ">TpmCreate</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#ga5e62323b94837b847f3e869cf2ff3615" title="Initializes Tpm with non-sensitive parameters. ">TpmInit</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#gaeb9bfaa9288263af9feccd0d0543c9bc" title="Decompresses provisioned key. ">TpmDecompressKey</a> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="gaa667fb3295e4533334bb32afcd43890f"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> TpmSign </td>
+ <td>(</td>
+ <td class="paramtype">TpmCtx *&#160;</td>
+ <td class="paramname"><em>ctx</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>c_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *&#160;</td>
+ <td class="paramname"><em>sx_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *&#160;</td>
+ <td class="paramname"><em>sf_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *&#160;</td>
+ <td class="paramname"><em>sa_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *&#160;</td>
+ <td class="paramname"><em>sb_str</em>&#160;</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Performs the last part of the sign operation. </p>
+<dl class="section note"><dt>Note</dt><dd><a class="el" href="group___tpm_module.html#gaa667fb3295e4533334bb32afcd43890f" title="Performs the last part of the sign operation. ">TpmSign</a> must be preceded by a call to <a class="el" href="group___tpm_module.html#gaf9004ce8832c1acae497604d1deb49cd" title="Performs the first part of the sign operation. ">TpmSignCommit</a>. Two sequential calls to <a class="el" href="group___tpm_module.html#gaa667fb3295e4533334bb32afcd43890f" title="Performs the last part of the sign operation. ">TpmSign</a> will fail with <a class="el" href="group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a700953ded1af35781948e8ada6dedf43" title="operation was performed out of sequence ">kEpidOutOfSequenceError</a>.</dd></dl>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramdir">[in]</td><td class="paramname">ctx</td><td>The TPM context.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">c_str</td><td>The sign commitment hash.</td></tr>
+ <tr><td class="paramdir">[out]</td><td class="paramname">sx_str</td><td>The <a class="el" href="struct_basic_signature.html" title="Intel(R) EPID 2.0 basic signature. ">BasicSignature</a> sx value.</td></tr>
+ <tr><td class="paramdir">[out]</td><td class="paramname">sf_str</td><td>The <a class="el" href="struct_basic_signature.html" title="Intel(R) EPID 2.0 basic signature. ">BasicSignature</a> sf value.</td></tr>
+ <tr><td class="paramdir">[out]</td><td class="paramname">sa_str</td><td>The <a class="el" href="struct_basic_signature.html" title="Intel(R) EPID 2.0 basic signature. ">BasicSignature</a> sa value.</td></tr>
+ <tr><td class="paramdir">[out]</td><td class="paramname">sb_str</td><td>The <a class="el" href="struct_basic_signature.html" title="Intel(R) EPID 2.0 basic signature. ">BasicSignature</a> sb value.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287" title="Creates a new Tpm context. ">TpmCreate</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#ga42b80d485cff39fe9ec14a0b5a81426d" title="Provisions Tpm with sensitive parameters. ">TpmProvision</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#ga5e62323b94837b847f3e869cf2ff3615" title="Initializes Tpm with non-sensitive parameters. ">TpmInit</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#gaf9004ce8832c1acae497604d1deb49cd" title="Performs the first part of the sign operation. ">TpmSignCommit</a> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="gaf9004ce8832c1acae497604d1deb49cd"></a>
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a> TpmSignCommit </td>
+ <td>(</td>
+ <td class="paramtype">TpmCtx *&#160;</td>
+ <td class="paramname"><em>ctx</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *&#160;</td>
+ <td class="paramname"><em>B_in_str</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="struct_sign_commit_output.html">SignCommitOutput</a> *&#160;</td>
+ <td class="paramname"><em>commit_out</em>&#160;</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div><div class="memdoc">
+
+<p>Performs the first part of the sign operation. </p>
+<dl class="params"><dt>Parameters</dt><dd>
+ <table class="params">
+ <tr><td class="paramdir">[in,out]</td><td class="paramname">ctx</td><td>The TPM context.</td></tr>
+ <tr><td class="paramdir">[in]</td><td class="paramname">B_in_str</td><td>An optional serialized hash of basename. If NULL a random basename is used.</td></tr>
+ <tr><td class="paramdir">[out]</td><td class="paramname">commit_out</td><td>The resulting commitment value.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360" title="Return status for SDK functions. ">EpidStatus</a></dd></dl>
+<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287" title="Creates a new Tpm context. ">TpmCreate</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#ga42b80d485cff39fe9ec14a0b5a81426d" title="Provisions Tpm with sensitive parameters. ">TpmProvision</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#ga5e62323b94837b847f3e869cf2ff3615" title="Initializes Tpm with non-sensitive parameters. ">TpmInit</a> </dd>
+<dd>
+<a class="el" href="group___tpm_module.html#gaa667fb3295e4533334bb32afcd43890f" title="Performs the last part of the sign operation. ">TpmSign</a> </dd></dl>
+
+</div>
+</div>
+</div><!-- contents -->
+</div><!-- doc-content -->
+<!-- HTML footer for doxygen 1.8.10-->
+<!-- start footer part -->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ <li class="footer">
+ &copy; 2016-2017 Intel Corporation
+ </li>
+ </ul>
+</div>
+</body>
+</html>
diff --git a/doc/html/group___tpm_module.js b/doc/html/group___tpm_module.js
new file mode 100644
index 0000000..3e0b437
--- /dev/null
+++ b/doc/html/group___tpm_module.js
@@ -0,0 +1,30 @@
+var group___tpm_module =
+[
+ [ "NrProveCommitOutput", "struct_nr_prove_commit_output.html", [
+ [ "R1", "struct_nr_prove_commit_output.html#af9c605d560f83ccd69e35d8b9cfe51b3", null ],
+ [ "R2", "struct_nr_prove_commit_output.html#aab0f11e55d3b8d838e472242e27a1a43", null ],
+ [ "T", "struct_nr_prove_commit_output.html#a00234dfa2443d49f5a294c58fdacb064", null ]
+ ] ],
+ [ "SignCommitOutput", "struct_sign_commit_output.html", [
+ [ "B", "struct_sign_commit_output.html#ae2ebcc07395e60187d9ccca373665dba", null ],
+ [ "K", "struct_sign_commit_output.html#a496bdc4d14fb73b1e85dfff3bc9fd3ba", null ],
+ [ "R1", "struct_sign_commit_output.html#ad01513f153f51f7ce211cf323a224499", null ],
+ [ "R2", "struct_sign_commit_output.html#a0f35f1d619ea972acbdf9d45af630de0", null ],
+ [ "T", "struct_sign_commit_output.html#a9ce3b28916094f5fa108d5f5c86631b0", null ]
+ ] ],
+ [ "TpmAddPreSigs", "group___tpm_module.html#ga2335ec4eb78b542cf87df9b0cd15358c", null ],
+ [ "TpmCreate", "group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287", null ],
+ [ "TpmDecompressKey", "group___tpm_module.html#gaeb9bfaa9288263af9feccd0d0543c9bc", null ],
+ [ "TpmDelete", "group___tpm_module.html#ga95bc18225c1d87803be7965978e37449", null ],
+ [ "TpmGetNumPreSigs", "group___tpm_module.html#gaa53a6bd52e22808bac21596a964bdece", null ],
+ [ "TpmInit", "group___tpm_module.html#ga5e62323b94837b847f3e869cf2ff3615", null ],
+ [ "TpmIsKeyValid", "group___tpm_module.html#ga3318f97e4d1763815dace3779ae6564f", null ],
+ [ "TpmJoin", "group___tpm_module.html#gab80c411f070858fbe019d93f5ac6a6ec", null ],
+ [ "TpmJoinCommit", "group___tpm_module.html#gae69218c9cba6a19d3ae1199c59772efc", null ],
+ [ "TpmNrProve", "group___tpm_module.html#ga4346d22fb9fed6a161cb1ea178b50ed2", null ],
+ [ "TpmNrProveCommit", "group___tpm_module.html#gace6002b520db41d8e781b02c6f538dc0", null ],
+ [ "TpmProvision", "group___tpm_module.html#ga42b80d485cff39fe9ec14a0b5a81426d", null ],
+ [ "TpmProvisionCompressed", "group___tpm_module.html#ga688441f78f68aa53c41fcae4d31c6f50", null ],
+ [ "TpmSign", "group___tpm_module.html#gaa667fb3295e4533334bb32afcd43890f", null ],
+ [ "TpmSignCommit", "group___tpm_module.html#gaf9004ce8832c1acae497604d1deb49cd", null ]
+]; \ No newline at end of file
diff --git a/doc/html/hash_8h.html b/doc/html/hash_8h.html
index 1e6252a..6166734 100644
--- a/doc/html/hash_8h.html
+++ b/doc/html/hash_8h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -94,7 +94,7 @@ Functions</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li><li class="navelem"><a class="el" href="dir_f169ebf8da29290a918fa4b3f7151050.html">math</a></li><li class="navelem"><a class="el" href="hash_8h.html">hash.h</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/how__validated_8dox.html b/doc/html/how__validated_8dox.html
new file mode 100644
index 0000000..e5cf885
--- /dev/null
+++ b/doc/html/how__validated_8dox.html
@@ -0,0 +1,82 @@
+<!-- HTML header for doxygen 1.8.10-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.11"/>
+<title>Intel&reg; Enhanced Privacy ID SDK: doc/docsrc/how_validated.dox File Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="navtree.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="resize.js"></script>
+<script type="text/javascript" src="navtreedata.js"></script>
+<script type="text/javascript" src="navtree.js"></script>
+<script type="text/javascript">
+ $(document).ready(initResizable);
+ $(window).load(resizeHeight);
+</script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+<link href="epidstyle.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td id="projectalign" style="padding-left: 0.5em;">
+ <div id="projectname"><a
+ onclick="storeLink('index.html')"
+ id="projectlink"
+ class="index.html"
+ href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
+&#160;<span id="projectnumber">4.0.0</span>
+</div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.11 -->
+</div><!-- top -->
+<div id="side-nav" class="ui-resizable side-nav-resizable">
+ <div id="nav-tree">
+ <div id="nav-tree-contents">
+ <div id="nav-sync" class="sync"></div>
+ </div>
+ </div>
+ <div id="splitbar" style="-moz-user-select:none;"
+ class="ui-resizable-handle">
+ </div>
+</div>
+<script type="text/javascript">
+$(document).ready(function(){initNavTree('how__validated_8dox.html','');});
+</script>
+<div id="doc-content">
+<div class="header">
+ <div class="headertitle">
+<div class="title">doc/docsrc/how_validated.dox File Reference</div> </div>
+</div><!--header-->
+<div class="contents">
+
+<p>This file is used by Doxygen to generate documentation.
+<a href="#details">More...</a></p>
+<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
+<div class="textblock"><p>This file is used by Doxygen to generate documentation. </p>
+</div></div><!-- contents -->
+</div><!-- doc-content -->
+<!-- HTML footer for doxygen 1.8.10-->
+<!-- start footer part -->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ <li class="navelem"><a class="el" href="how__validated_8dox.html">how_validated.dox</a></li>
+ <li class="footer">
+ &copy; 2016-2017 Intel Corporation
+ </li>
+ </ul>
+</div>
+</body>
+</html>
diff --git a/doc/html/implementation__notes_8dox.html b/doc/html/implementation__notes_8dox.html
index a07d4bc..e81f729 100644
--- a/doc/html/implementation__notes_8dox.html
+++ b/doc/html/implementation__notes_8dox.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('implementation__notes_8dox.html','');}
<ul>
<li class="navelem"><a class="el" href="implementation__notes_8dox.html">implementation_notes.dox</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/index.html b/doc/html/index.html
index 7b34b80..5afffbe 100644
--- a/doc/html/index.html
+++ b/doc/html/index.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -62,7 +62,17 @@ $(document).ready(function(){initNavTree('index.html','');});
</div><!--header-->
<div class="contents">
<div class="textblock"><p>Intel&reg; EPID is a cryptographic protocol which enables the remote authentication of a trusted platform whilst preserving the user's privacy.</p>
-<p>The Intel&reg; EPID Software Development Kit provides an implementation of the Intel&reg; EPID specification that developers can use when developing their own applications using Intel&reg; EPID technology. </p>
+<p>The Intel&reg; EPID Software Development Kit provides an implementation of the Intel&reg; EPID specification that developers can use when developing their own applications using Intel&reg; EPID technology.</p>
+<h1><a class="anchor" id="mainpage_roadmap"></a>
+Getting Started</h1>
+<p>If you are learning to use the SDK, we recommend the following approach:</p>
+<ol type="1">
+<li><b>Get the Big Picture</b> The <a class="el" href="EpidOverview.html">Introduction to the Intel&reg; EPID Scheme</a> provides a non-implementation-specific overview of the interactions between the issuer, member, and verifier.</li>
+<li><b>Build the SDK</b> For instructions, refer to <a class="el" href="BuildingSdk.html">Building from Source</a>. For help installing the prerequisite build tools, refer to <a class="el" href="BuildToolsInstallation.html">Guide to Installing Build Tools</a>.</li>
+<li><b>Run the SDK Samples with Test Data</b> After you build the SDK, you can follow along with the commands in the implementation specific <a class="el" href="SignVerifyTutorial.html">Signing and Verification Tutorial</a>, using the provided samples and the test data from <a class="el" href="IssuerMaterial.html">Sample Issuer Material</a>.</li>
+<li><b>Check out the Code Examples</b> Refer to <a class="el" href="UserManual_GeneratingAnIntelEpidSignature.html">Generating an Intel&reg; EPID Signature</a> and <a class="el" href="UserManual_VerifyingAnIntelEpidSignature.html">Verifying an Intel&reg; EPID Signature</a> to see how SDK APIs are used by the code examples <code>signmsg</code> and <code>verifysig</code>.</li>
+<li><b>Check out the API Reference</b> The API reference shows you how to use all APIs included in the SDK. </li>
+</ol>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.10-->
@@ -70,7 +80,7 @@ $(document).ready(function(){initNavTree('index.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/init_8h.html b/doc/html/init_8h.html
new file mode 100644
index 0000000..9de3ced
--- /dev/null
+++ b/doc/html/init_8h.html
@@ -0,0 +1,92 @@
+<!-- HTML header for doxygen 1.8.10-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.11"/>
+<title>Intel&reg; Enhanced Privacy ID SDK: epid/member/tpm/init.h File Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="navtree.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="resize.js"></script>
+<script type="text/javascript" src="navtreedata.js"></script>
+<script type="text/javascript" src="navtree.js"></script>
+<script type="text/javascript">
+ $(document).ready(initResizable);
+ $(window).load(resizeHeight);
+</script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+<link href="epidstyle.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td id="projectalign" style="padding-left: 0.5em;">
+ <div id="projectname"><a
+ onclick="storeLink('index.html')"
+ id="projectlink"
+ class="index.html"
+ href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
+&#160;<span id="projectnumber">4.0.0</span>
+</div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.11 -->
+</div><!-- top -->
+<div id="side-nav" class="ui-resizable side-nav-resizable">
+ <div id="nav-tree">
+ <div id="nav-tree-contents">
+ <div id="nav-sync" class="sync"></div>
+ </div>
+ </div>
+ <div id="splitbar" style="-moz-user-select:none;"
+ class="ui-resizable-handle">
+ </div>
+</div>
+<script type="text/javascript">
+$(document).ready(function(){initNavTree('init_8h.html','');});
+</script>
+<div id="doc-content">
+<div class="header">
+ <div class="summary">
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">init.h File Reference</div> </div>
+</div><!--header-->
+<div class="contents">
+
+<p>Non-sensitive member context APIs.
+<a href="#details">More...</a></p>
+<div class="textblock"><code>#include &quot;<a class="el" href="errors_8h.html">epid/common/errors.h</a>&quot;</code><br />
+</div><table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr class="memitem:ga5e62323b94837b847f3e869cf2ff3615"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#ga5e62323b94837b847f3e869cf2ff3615">TpmInit</a> (TpmCtx *ctx, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *A_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *x_str, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *h1_str, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *h2_str, <a class="el" href="struct_g2_elem_str.html">G2ElemStr</a> const *w_str, <a class="el" href="struct_member_precomp.html">MemberPrecomp</a> const *precomp_str)</td></tr>
+<tr class="memdesc:ga5e62323b94837b847f3e869cf2ff3615"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes Tpm with non-sensitive parameters. <a href="group___tpm_module.html#ga5e62323b94837b847f3e869cf2ff3615">More...</a><br /></td></tr>
+<tr class="separator:ga5e62323b94837b847f3e869cf2ff3615"><td class="memSeparator" colspan="2">&#160;</td></tr>
+</table>
+<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
+<div class="textblock"><p>Non-sensitive member context APIs. </p>
+</div></div><!-- contents -->
+</div><!-- doc-content -->
+<!-- HTML footer for doxygen 1.8.10-->
+<!-- start footer part -->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ <li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_512d3e62841a8535b716ec4cf8b9e950.html">member</a></li><li class="navelem"><a class="el" href="dir_6048dbb18cb271412de4a010207fd345.html">tpm</a></li><li class="navelem"><a class="el" href="init_8h.html">init.h</a></li>
+ <li class="footer">
+ &copy; 2016-2017 Intel Corporation
+ </li>
+ </ul>
+</div>
+</body>
+</html>
diff --git a/doc/html/issuer__material_8dox.html b/doc/html/issuer__material_8dox.html
index 5a3a47e..3e5dad5 100644
--- a/doc/html/issuer__material_8dox.html
+++ b/doc/html/issuer__material_8dox.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('issuer__material_8dox.html','');});
<ul>
<li class="navelem"><a class="el" href="issuer__material_8dox.html">issuer_material.dox</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/join_8h.html b/doc/html/join_8h.html
new file mode 100644
index 0000000..0281f2d
--- /dev/null
+++ b/doc/html/join_8h.html
@@ -0,0 +1,95 @@
+<!-- HTML header for doxygen 1.8.10-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.11"/>
+<title>Intel&reg; Enhanced Privacy ID SDK: epid/member/tpm/join.h File Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="navtree.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="resize.js"></script>
+<script type="text/javascript" src="navtreedata.js"></script>
+<script type="text/javascript" src="navtree.js"></script>
+<script type="text/javascript">
+ $(document).ready(initResizable);
+ $(window).load(resizeHeight);
+</script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+<link href="epidstyle.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td id="projectalign" style="padding-left: 0.5em;">
+ <div id="projectname"><a
+ onclick="storeLink('index.html')"
+ id="projectlink"
+ class="index.html"
+ href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
+&#160;<span id="projectnumber">4.0.0</span>
+</div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.11 -->
+</div><!-- top -->
+<div id="side-nav" class="ui-resizable side-nav-resizable">
+ <div id="nav-tree">
+ <div id="nav-tree-contents">
+ <div id="nav-sync" class="sync"></div>
+ </div>
+ </div>
+ <div id="splitbar" style="-moz-user-select:none;"
+ class="ui-resizable-handle">
+ </div>
+</div>
+<script type="text/javascript">
+$(document).ready(function(){initNavTree('join_8h.html','');});
+</script>
+<div id="doc-content">
+<div class="header">
+ <div class="summary">
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">join.h File Reference</div> </div>
+</div><!--header-->
+<div class="contents">
+
+<p>TPM join APIs.
+<a href="#details">More...</a></p>
+<div class="textblock"><code>#include &quot;<a class="el" href="errors_8h.html">epid/common/errors.h</a>&quot;</code><br />
+</div><table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr class="memitem:gae69218c9cba6a19d3ae1199c59772efc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#gae69218c9cba6a19d3ae1199c59772efc">TpmJoinCommit</a> (TpmCtx *ctx, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> *F_str, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> *R_str)</td></tr>
+<tr class="memdesc:gae69218c9cba6a19d3ae1199c59772efc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs the first part of the join operation. <a href="group___tpm_module.html#gae69218c9cba6a19d3ae1199c59772efc">More...</a><br /></td></tr>
+<tr class="separator:gae69218c9cba6a19d3ae1199c59772efc"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gab80c411f070858fbe019d93f5ac6a6ec"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#gab80c411f070858fbe019d93f5ac6a6ec">TpmJoin</a> (TpmCtx *ctx, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *c_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *s_str)</td></tr>
+<tr class="memdesc:gab80c411f070858fbe019d93f5ac6a6ec"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs the last part of the join operation. <a href="group___tpm_module.html#gab80c411f070858fbe019d93f5ac6a6ec">More...</a><br /></td></tr>
+<tr class="separator:gab80c411f070858fbe019d93f5ac6a6ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
+</table>
+<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
+<div class="textblock"><p>TPM join APIs. </p>
+</div></div><!-- contents -->
+</div><!-- doc-content -->
+<!-- HTML footer for doxygen 1.8.10-->
+<!-- start footer part -->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ <li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_512d3e62841a8535b716ec4cf8b9e950.html">member</a></li><li class="navelem"><a class="el" href="dir_6048dbb18cb271412de4a010207fd345.html">tpm</a></li><li class="navelem"><a class="el" href="join_8h.html">join.h</a></li>
+ <li class="footer">
+ &copy; 2016-2017 Intel Corporation
+ </li>
+ </ul>
+</div>
+</body>
+</html>
diff --git a/doc/html/jquery.js b/doc/html/jquery.js
index 1f4d0b4..d52a1c7 100644
--- a/doc/html/jquery.js
+++ b/doc/html/jquery.js
@@ -1,4 +1,4 @@
-/*!
+/*
* jQuery JavaScript Library v1.7.1
* http://jquery.com/
*
@@ -14,13 +14,13 @@
* Date: Mon Nov 21 21:11:03 2011 -0500
*/
(function(bb,L){var av=bb.document,bu=bb.navigator,bl=bb.location;var b=(function(){var bF=function(b0,b1){return new bF.fn.init(b0,b1,bD)},bU=bb.jQuery,bH=bb.$,bD,bY=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,bM=/\S/,bI=/^\s+/,bE=/\s+$/,bA=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,bN=/^[\],:{}\s]*$/,bW=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,bP=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,bJ=/(?:^|:|,)(?:\s*\[)+/g,by=/(webkit)[ \/]([\w.]+)/,bR=/(opera)(?:.*version)?[ \/]([\w.]+)/,bQ=/(msie) ([\w.]+)/,bS=/(mozilla)(?:.*? rv:([\w.]+))?/,bB=/-([a-z]|[0-9])/ig,bZ=/^-ms-/,bT=function(b0,b1){return(b1+"").toUpperCase()},bX=bu.userAgent,bV,bC,e,bL=Object.prototype.toString,bG=Object.prototype.hasOwnProperty,bz=Array.prototype.push,bK=Array.prototype.slice,bO=String.prototype.trim,bv=Array.prototype.indexOf,bx={};bF.fn=bF.prototype={constructor:bF,init:function(b0,b4,b3){var b2,b5,b1,b6;if(!b0){return this}if(b0.nodeType){this.context=this[0]=b0;this.length=1;return this}if(b0==="body"&&!b4&&av.body){this.context=av;this[0]=av.body;this.selector=b0;this.length=1;return this}if(typeof b0==="string"){if(b0.charAt(0)==="<"&&b0.charAt(b0.length-1)===">"&&b0.length>=3){b2=[null,b0,null]}else{b2=bY.exec(b0)}if(b2&&(b2[1]||!b4)){if(b2[1]){b4=b4 instanceof bF?b4[0]:b4;b6=(b4?b4.ownerDocument||b4:av);b1=bA.exec(b0);if(b1){if(bF.isPlainObject(b4)){b0=[av.createElement(b1[1])];bF.fn.attr.call(b0,b4,true)}else{b0=[b6.createElement(b1[1])]}}else{b1=bF.buildFragment([b2[1]],[b6]);b0=(b1.cacheable?bF.clone(b1.fragment):b1.fragment).childNodes}return bF.merge(this,b0)}else{b5=av.getElementById(b2[2]);if(b5&&b5.parentNode){if(b5.id!==b2[2]){return b3.find(b0)}this.length=1;this[0]=b5}this.context=av;this.selector=b0;return this}}else{if(!b4||b4.jquery){return(b4||b3).find(b0)}else{return this.constructor(b4).find(b0)}}}else{if(bF.isFunction(b0)){return b3.ready(b0)}}if(b0.selector!==L){this.selector=b0.selector;this.context=b0.context}return bF.makeArray(b0,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return bK.call(this,0)},get:function(b0){return b0==null?this.toArray():(b0<0?this[this.length+b0]:this[b0])},pushStack:function(b1,b3,b0){var b2=this.constructor();if(bF.isArray(b1)){bz.apply(b2,b1)}else{bF.merge(b2,b1)}b2.prevObject=this;b2.context=this.context;if(b3==="find"){b2.selector=this.selector+(this.selector?" ":"")+b0}else{if(b3){b2.selector=this.selector+"."+b3+"("+b0+")"}}return b2},each:function(b1,b0){return bF.each(this,b1,b0)},ready:function(b0){bF.bindReady();bC.add(b0);return this},eq:function(b0){b0=+b0;return b0===-1?this.slice(b0):this.slice(b0,b0+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(bK.apply(this,arguments),"slice",bK.call(arguments).join(","))},map:function(b0){return this.pushStack(bF.map(this,function(b2,b1){return b0.call(b2,b1,b2)}))},end:function(){return this.prevObject||this.constructor(null)},push:bz,sort:[].sort,splice:[].splice};bF.fn.init.prototype=bF.fn;bF.extend=bF.fn.extend=function(){var b9,b2,b0,b1,b6,b7,b5=arguments[0]||{},b4=1,b3=arguments.length,b8=false;if(typeof b5==="boolean"){b8=b5;b5=arguments[1]||{};b4=2}if(typeof b5!=="object"&&!bF.isFunction(b5)){b5={}}if(b3===b4){b5=this;--b4}for(;b4<b3;b4++){if((b9=arguments[b4])!=null){for(b2 in b9){b0=b5[b2];b1=b9[b2];if(b5===b1){continue}if(b8&&b1&&(bF.isPlainObject(b1)||(b6=bF.isArray(b1)))){if(b6){b6=false;b7=b0&&bF.isArray(b0)?b0:[]}else{b7=b0&&bF.isPlainObject(b0)?b0:{}}b5[b2]=bF.extend(b8,b7,b1)}else{if(b1!==L){b5[b2]=b1}}}}}return b5};bF.extend({noConflict:function(b0){if(bb.$===bF){bb.$=bH}if(b0&&bb.jQuery===bF){bb.jQuery=bU}return bF},isReady:false,readyWait:1,holdReady:function(b0){if(b0){bF.readyWait++}else{bF.ready(true)}},ready:function(b0){if((b0===true&&!--bF.readyWait)||(b0!==true&&!bF.isReady)){if(!av.body){return setTimeout(bF.ready,1)}bF.isReady=true;if(b0!==true&&--bF.readyWait>0){return}bC.fireWith(av,[bF]);if(bF.fn.trigger){bF(av).trigger("ready").off("ready")}}},bindReady:function(){if(bC){return}bC=bF.Callbacks("once memory");if(av.readyState==="complete"){return setTimeout(bF.ready,1)}if(av.addEventListener){av.addEventListener("DOMContentLoaded",e,false);bb.addEventListener("load",bF.ready,false)}else{if(av.attachEvent){av.attachEvent("onreadystatechange",e);bb.attachEvent("onload",bF.ready);var b0=false;try{b0=bb.frameElement==null}catch(b1){}if(av.documentElement.doScroll&&b0){bw()}}}},isFunction:function(b0){return bF.type(b0)==="function"},isArray:Array.isArray||function(b0){return bF.type(b0)==="array"},isWindow:function(b0){return b0&&typeof b0==="object"&&"setInterval" in b0},isNumeric:function(b0){return !isNaN(parseFloat(b0))&&isFinite(b0)},type:function(b0){return b0==null?String(b0):bx[bL.call(b0)]||"object"},isPlainObject:function(b2){if(!b2||bF.type(b2)!=="object"||b2.nodeType||bF.isWindow(b2)){return false}try{if(b2.constructor&&!bG.call(b2,"constructor")&&!bG.call(b2.constructor.prototype,"isPrototypeOf")){return false}}catch(b1){return false}var b0;for(b0 in b2){}return b0===L||bG.call(b2,b0)},isEmptyObject:function(b1){for(var b0 in b1){return false}return true},error:function(b0){throw new Error(b0)},parseJSON:function(b0){if(typeof b0!=="string"||!b0){return null}b0=bF.trim(b0);if(bb.JSON&&bb.JSON.parse){return bb.JSON.parse(b0)}if(bN.test(b0.replace(bW,"@").replace(bP,"]").replace(bJ,""))){return(new Function("return "+b0))()}bF.error("Invalid JSON: "+b0)},parseXML:function(b2){var b0,b1;try{if(bb.DOMParser){b1=new DOMParser();b0=b1.parseFromString(b2,"text/xml")}else{b0=new ActiveXObject("Microsoft.XMLDOM");b0.async="false";b0.loadXML(b2)}}catch(b3){b0=L}if(!b0||!b0.documentElement||b0.getElementsByTagName("parsererror").length){bF.error("Invalid XML: "+b2)}return b0},noop:function(){},globalEval:function(b0){if(b0&&bM.test(b0)){(bb.execScript||function(b1){bb["eval"].call(bb,b1)})(b0)}},camelCase:function(b0){return b0.replace(bZ,"ms-").replace(bB,bT)},nodeName:function(b1,b0){return b1.nodeName&&b1.nodeName.toUpperCase()===b0.toUpperCase()},each:function(b3,b6,b2){var b1,b4=0,b5=b3.length,b0=b5===L||bF.isFunction(b3);if(b2){if(b0){for(b1 in b3){if(b6.apply(b3[b1],b2)===false){break}}}else{for(;b4<b5;){if(b6.apply(b3[b4++],b2)===false){break}}}}else{if(b0){for(b1 in b3){if(b6.call(b3[b1],b1,b3[b1])===false){break}}}else{for(;b4<b5;){if(b6.call(b3[b4],b4,b3[b4++])===false){break}}}}return b3},trim:bO?function(b0){return b0==null?"":bO.call(b0)}:function(b0){return b0==null?"":b0.toString().replace(bI,"").replace(bE,"")},makeArray:function(b3,b1){var b0=b1||[];if(b3!=null){var b2=bF.type(b3);if(b3.length==null||b2==="string"||b2==="function"||b2==="regexp"||bF.isWindow(b3)){bz.call(b0,b3)}else{bF.merge(b0,b3)}}return b0},inArray:function(b2,b3,b1){var b0;if(b3){if(bv){return bv.call(b3,b2,b1)}b0=b3.length;b1=b1?b1<0?Math.max(0,b0+b1):b1:0;for(;b1<b0;b1++){if(b1 in b3&&b3[b1]===b2){return b1}}}return -1},merge:function(b4,b2){var b3=b4.length,b1=0;if(typeof b2.length==="number"){for(var b0=b2.length;b1<b0;b1++){b4[b3++]=b2[b1]}}else{while(b2[b1]!==L){b4[b3++]=b2[b1++]}}b4.length=b3;return b4},grep:function(b1,b6,b0){var b2=[],b5;b0=!!b0;for(var b3=0,b4=b1.length;b3<b4;b3++){b5=!!b6(b1[b3],b3);if(b0!==b5){b2.push(b1[b3])}}return b2},map:function(b0,b7,b8){var b5,b6,b4=[],b2=0,b1=b0.length,b3=b0 instanceof bF||b1!==L&&typeof b1==="number"&&((b1>0&&b0[0]&&b0[b1-1])||b1===0||bF.isArray(b0));if(b3){for(;b2<b1;b2++){b5=b7(b0[b2],b2,b8);if(b5!=null){b4[b4.length]=b5}}}else{for(b6 in b0){b5=b7(b0[b6],b6,b8);if(b5!=null){b4[b4.length]=b5}}}return b4.concat.apply([],b4)},guid:1,proxy:function(b4,b3){if(typeof b3==="string"){var b2=b4[b3];b3=b4;b4=b2}if(!bF.isFunction(b4)){return L}var b0=bK.call(arguments,2),b1=function(){return b4.apply(b3,b0.concat(bK.call(arguments)))};b1.guid=b4.guid=b4.guid||b1.guid||bF.guid++;return b1},access:function(b0,b8,b6,b2,b5,b7){var b1=b0.length;if(typeof b8==="object"){for(var b3 in b8){bF.access(b0,b3,b8[b3],b2,b5,b6)}return b0}if(b6!==L){b2=!b7&&b2&&bF.isFunction(b6);for(var b4=0;b4<b1;b4++){b5(b0[b4],b8,b2?b6.call(b0[b4],b4,b5(b0[b4],b8)):b6,b7)}return b0}return b1?b5(b0[0],b8):L},now:function(){return(new Date()).getTime()},uaMatch:function(b1){b1=b1.toLowerCase();var b0=by.exec(b1)||bR.exec(b1)||bQ.exec(b1)||b1.indexOf("compatible")<0&&bS.exec(b1)||[];return{browser:b0[1]||"",version:b0[2]||"0"}},sub:function(){function b0(b3,b4){return new b0.fn.init(b3,b4)}bF.extend(true,b0,this);b0.superclass=this;b0.fn=b0.prototype=this();b0.fn.constructor=b0;b0.sub=this.sub;b0.fn.init=function b2(b3,b4){if(b4&&b4 instanceof bF&&!(b4 instanceof b0)){b4=b0(b4)}return bF.fn.init.call(this,b3,b4,b1)};b0.fn.init.prototype=b0.fn;var b1=b0(av);return b0},browser:{}});bF.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(b1,b0){bx["[object "+b0+"]"]=b0.toLowerCase()});bV=bF.uaMatch(bX);if(bV.browser){bF.browser[bV.browser]=true;bF.browser.version=bV.version}if(bF.browser.webkit){bF.browser.safari=true}if(bM.test("\xA0")){bI=/^[\s\xA0]+/;bE=/[\s\xA0]+$/}bD=bF(av);if(av.addEventListener){e=function(){av.removeEventListener("DOMContentLoaded",e,false);bF.ready()}}else{if(av.attachEvent){e=function(){if(av.readyState==="complete"){av.detachEvent("onreadystatechange",e);bF.ready()}}}}function bw(){if(bF.isReady){return}try{av.documentElement.doScroll("left")}catch(b0){setTimeout(bw,1);return}bF.ready()}return bF})();var a2={};function X(e){var bv=a2[e]={},bw,bx;e=e.split(/\s+/);for(bw=0,bx=e.length;bw<bx;bw++){bv[e[bw]]=true}return bv}b.Callbacks=function(bw){bw=bw?(a2[bw]||X(bw)):{};var bB=[],bC=[],bx,by,bv,bz,bA,bE=function(bF){var bG,bJ,bI,bH,bK;for(bG=0,bJ=bF.length;bG<bJ;bG++){bI=bF[bG];bH=b.type(bI);if(bH==="array"){bE(bI)}else{if(bH==="function"){if(!bw.unique||!bD.has(bI)){bB.push(bI)}}}}},e=function(bG,bF){bF=bF||[];bx=!bw.memory||[bG,bF];by=true;bA=bv||0;bv=0;bz=bB.length;for(;bB&&bA<bz;bA++){if(bB[bA].apply(bG,bF)===false&&bw.stopOnFalse){bx=true;break}}by=false;if(bB){if(!bw.once){if(bC&&bC.length){bx=bC.shift();bD.fireWith(bx[0],bx[1])}}else{if(bx===true){bD.disable()}else{bB=[]}}}},bD={add:function(){if(bB){var bF=bB.length;bE(arguments);if(by){bz=bB.length}else{if(bx&&bx!==true){bv=bF;e(bx[0],bx[1])}}}return this},remove:function(){if(bB){var bF=arguments,bH=0,bI=bF.length;for(;bH<bI;bH++){for(var bG=0;bG<bB.length;bG++){if(bF[bH]===bB[bG]){if(by){if(bG<=bz){bz--;if(bG<=bA){bA--}}}bB.splice(bG--,1);if(bw.unique){break}}}}}return this},has:function(bG){if(bB){var bF=0,bH=bB.length;for(;bF<bH;bF++){if(bG===bB[bF]){return true}}}return false},empty:function(){bB=[];return this},disable:function(){bB=bC=bx=L;return this},disabled:function(){return !bB},lock:function(){bC=L;if(!bx||bx===true){bD.disable()}return this},locked:function(){return !bC},fireWith:function(bG,bF){if(bC){if(by){if(!bw.once){bC.push([bG,bF])}}else{if(!(bw.once&&bx)){e(bG,bF)}}}return this},fire:function(){bD.fireWith(this,arguments);return this},fired:function(){return !!bx}};return bD};var aJ=[].slice;b.extend({Deferred:function(by){var bx=b.Callbacks("once memory"),bw=b.Callbacks("once memory"),bv=b.Callbacks("memory"),e="pending",bA={resolve:bx,reject:bw,notify:bv},bC={done:bx.add,fail:bw.add,progress:bv.add,state:function(){return e},isResolved:bx.fired,isRejected:bw.fired,then:function(bE,bD,bF){bB.done(bE).fail(bD).progress(bF);return this},always:function(){bB.done.apply(bB,arguments).fail.apply(bB,arguments);return this},pipe:function(bF,bE,bD){return b.Deferred(function(bG){b.each({done:[bF,"resolve"],fail:[bE,"reject"],progress:[bD,"notify"]},function(bI,bL){var bH=bL[0],bK=bL[1],bJ;if(b.isFunction(bH)){bB[bI](function(){bJ=bH.apply(this,arguments);if(bJ&&b.isFunction(bJ.promise)){bJ.promise().then(bG.resolve,bG.reject,bG.notify)}else{bG[bK+"With"](this===bB?bG:this,[bJ])}})}else{bB[bI](bG[bK])}})}).promise()},promise:function(bE){if(bE==null){bE=bC}else{for(var bD in bC){bE[bD]=bC[bD]}}return bE}},bB=bC.promise({}),bz;for(bz in bA){bB[bz]=bA[bz].fire;bB[bz+"With"]=bA[bz].fireWith}bB.done(function(){e="resolved"},bw.disable,bv.lock).fail(function(){e="rejected"},bx.disable,bv.lock);if(by){by.call(bB,bB)}return bB},when:function(bA){var bx=aJ.call(arguments,0),bv=0,e=bx.length,bB=new Array(e),bw=e,by=e,bC=e<=1&&bA&&b.isFunction(bA.promise)?bA:b.Deferred(),bE=bC.promise();function bD(bF){return function(bG){bx[bF]=arguments.length>1?aJ.call(arguments,0):bG;if(!(--bw)){bC.resolveWith(bC,bx)}}}function bz(bF){return function(bG){bB[bF]=arguments.length>1?aJ.call(arguments,0):bG;bC.notifyWith(bE,bB)}}if(e>1){for(;bv<e;bv++){if(bx[bv]&&bx[bv].promise&&b.isFunction(bx[bv].promise)){bx[bv].promise().then(bD(bv),bC.reject,bz(bv))}else{--bw}}if(!bw){bC.resolveWith(bC,bx)}}else{if(bC!==bA){bC.resolveWith(bC,e?[bA]:[])}}return bE}});b.support=(function(){var bJ,bI,bF,bG,bx,bE,bA,bD,bz,bK,bB,by,bw,bv=av.createElement("div"),bH=av.documentElement;bv.setAttribute("className","t");bv.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";bI=bv.getElementsByTagName("*");bF=bv.getElementsByTagName("a")[0];if(!bI||!bI.length||!bF){return{}}bG=av.createElement("select");bx=bG.appendChild(av.createElement("option"));bE=bv.getElementsByTagName("input")[0];bJ={leadingWhitespace:(bv.firstChild.nodeType===3),tbody:!bv.getElementsByTagName("tbody").length,htmlSerialize:!!bv.getElementsByTagName("link").length,style:/top/.test(bF.getAttribute("style")),hrefNormalized:(bF.getAttribute("href")==="/a"),opacity:/^0.55/.test(bF.style.opacity),cssFloat:!!bF.style.cssFloat,checkOn:(bE.value==="on"),optSelected:bx.selected,getSetAttribute:bv.className!=="t",enctype:!!av.createElement("form").enctype,html5Clone:av.createElement("nav").cloneNode(true).outerHTML!=="<:nav></:nav>",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true};bE.checked=true;bJ.noCloneChecked=bE.cloneNode(true).checked;bG.disabled=true;bJ.optDisabled=!bx.disabled;try{delete bv.test}catch(bC){bJ.deleteExpando=false}if(!bv.addEventListener&&bv.attachEvent&&bv.fireEvent){bv.attachEvent("onclick",function(){bJ.noCloneEvent=false});bv.cloneNode(true).fireEvent("onclick")}bE=av.createElement("input");bE.value="t";bE.setAttribute("type","radio");bJ.radioValue=bE.value==="t";bE.setAttribute("checked","checked");bv.appendChild(bE);bD=av.createDocumentFragment();bD.appendChild(bv.lastChild);bJ.checkClone=bD.cloneNode(true).cloneNode(true).lastChild.checked;bJ.appendChecked=bE.checked;bD.removeChild(bE);bD.appendChild(bv);bv.innerHTML="";if(bb.getComputedStyle){bA=av.createElement("div");bA.style.width="0";bA.style.marginRight="0";bv.style.width="2px";bv.appendChild(bA);bJ.reliableMarginRight=(parseInt((bb.getComputedStyle(bA,null)||{marginRight:0}).marginRight,10)||0)===0}if(bv.attachEvent){for(by in {submit:1,change:1,focusin:1}){bB="on"+by;bw=(bB in bv);if(!bw){bv.setAttribute(bB,"return;");bw=(typeof bv[bB]==="function")}bJ[by+"Bubbles"]=bw}}bD.removeChild(bv);bD=bG=bx=bA=bv=bE=null;b(function(){var bM,bU,bV,bT,bN,bO,bL,bS,bR,e,bP,bQ=av.getElementsByTagName("body")[0];if(!bQ){return}bL=1;bS="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";bR="visibility:hidden;border:0;";e="style='"+bS+"border:5px solid #000;padding:0;'";bP="<div "+e+"><div></div></div><table "+e+" cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";bM=av.createElement("div");bM.style.cssText=bR+"width:0;height:0;position:static;top:0;margin-top:"+bL+"px";bQ.insertBefore(bM,bQ.firstChild);bv=av.createElement("div");bM.appendChild(bv);bv.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";bz=bv.getElementsByTagName("td");bw=(bz[0].offsetHeight===0);bz[0].style.display="";bz[1].style.display="none";bJ.reliableHiddenOffsets=bw&&(bz[0].offsetHeight===0);bv.innerHTML="";bv.style.width=bv.style.paddingLeft="1px";b.boxModel=bJ.boxModel=bv.offsetWidth===2;if(typeof bv.style.zoom!=="undefined"){bv.style.display="inline";bv.style.zoom=1;bJ.inlineBlockNeedsLayout=(bv.offsetWidth===2);bv.style.display="";bv.innerHTML="<div style='width:4px;'></div>";bJ.shrinkWrapBlocks=(bv.offsetWidth!==2)}bv.style.cssText=bS+bR;bv.innerHTML=bP;bU=bv.firstChild;bV=bU.firstChild;bN=bU.nextSibling.firstChild.firstChild;bO={doesNotAddBorder:(bV.offsetTop!==5),doesAddBorderForTableAndCells:(bN.offsetTop===5)};bV.style.position="fixed";bV.style.top="20px";bO.fixedPosition=(bV.offsetTop===20||bV.offsetTop===15);bV.style.position=bV.style.top="";bU.style.overflow="hidden";bU.style.position="relative";bO.subtractsBorderForOverflowNotVisible=(bV.offsetTop===-5);bO.doesNotIncludeMarginInBodyOffset=(bQ.offsetTop!==bL);bQ.removeChild(bM);bv=bM=null;b.extend(bJ,bO)});return bJ})();var aS=/^(?:\{.*\}|\[.*\])$/,aA=/([A-Z])/g;b.extend({cache:{},uuid:0,expando:"jQuery"+(b.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(e){e=e.nodeType?b.cache[e[b.expando]]:e[b.expando];return !!e&&!S(e)},data:function(bx,bv,bz,by){if(!b.acceptData(bx)){return}var bG,bA,bD,bE=b.expando,bC=typeof bv==="string",bF=bx.nodeType,e=bF?b.cache:bx,bw=bF?bx[bE]:bx[bE]&&bE,bB=bv==="events";if((!bw||!e[bw]||(!bB&&!by&&!e[bw].data))&&bC&&bz===L){return}if(!bw){if(bF){bx[bE]=bw=++b.uuid}else{bw=bE}}if(!e[bw]){e[bw]={};if(!bF){e[bw].toJSON=b.noop}}if(typeof bv==="object"||typeof bv==="function"){if(by){e[bw]=b.extend(e[bw],bv)}else{e[bw].data=b.extend(e[bw].data,bv)}}bG=bA=e[bw];if(!by){if(!bA.data){bA.data={}}bA=bA.data}if(bz!==L){bA[b.camelCase(bv)]=bz}if(bB&&!bA[bv]){return bG.events}if(bC){bD=bA[bv];if(bD==null){bD=bA[b.camelCase(bv)]}}else{bD=bA}return bD},removeData:function(bx,bv,by){if(!b.acceptData(bx)){return}var bB,bA,bz,bC=b.expando,bD=bx.nodeType,e=bD?b.cache:bx,bw=bD?bx[bC]:bC;if(!e[bw]){return}if(bv){bB=by?e[bw]:e[bw].data;if(bB){if(!b.isArray(bv)){if(bv in bB){bv=[bv]}else{bv=b.camelCase(bv);if(bv in bB){bv=[bv]}else{bv=bv.split(" ")}}}for(bA=0,bz=bv.length;bA<bz;bA++){delete bB[bv[bA]]}if(!(by?S:b.isEmptyObject)(bB)){return}}}if(!by){delete e[bw].data;if(!S(e[bw])){return}}if(b.support.deleteExpando||!e.setInterval){delete e[bw]}else{e[bw]=null}if(bD){if(b.support.deleteExpando){delete bx[bC]}else{if(bx.removeAttribute){bx.removeAttribute(bC)}else{bx[bC]=null}}}},_data:function(bv,e,bw){return b.data(bv,e,bw,true)},acceptData:function(bv){if(bv.nodeName){var e=b.noData[bv.nodeName.toLowerCase()];if(e){return !(e===true||bv.getAttribute("classid")!==e)}}return true}});b.fn.extend({data:function(by,bA){var bB,e,bw,bz=null;if(typeof by==="undefined"){if(this.length){bz=b.data(this[0]);if(this[0].nodeType===1&&!b._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var bx=0,bv=e.length;bx<bv;bx++){bw=e[bx].name;if(bw.indexOf("data-")===0){bw=b.camelCase(bw.substring(5));a5(this[0],bw,bz[bw])}}b._data(this[0],"parsedAttrs",true)}}return bz}else{if(typeof by==="object"){return this.each(function(){b.data(this,by)})}}bB=by.split(".");bB[1]=bB[1]?"."+bB[1]:"";if(bA===L){bz=this.triggerHandler("getData"+bB[1]+"!",[bB[0]]);if(bz===L&&this.length){bz=b.data(this[0],by);bz=a5(this[0],by,bz)}return bz===L&&bB[1]?this.data(bB[0]):bz}else{return this.each(function(){var bC=b(this),bD=[bB[0],bA];bC.triggerHandler("setData"+bB[1]+"!",bD);b.data(this,by,bA);bC.triggerHandler("changeData"+bB[1]+"!",bD)})}},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function a5(bx,bw,by){if(by===L&&bx.nodeType===1){var bv="data-"+bw.replace(aA,"-$1").toLowerCase();by=bx.getAttribute(bv);if(typeof by==="string"){try{by=by==="true"?true:by==="false"?false:by==="null"?null:b.isNumeric(by)?parseFloat(by):aS.test(by)?b.parseJSON(by):by}catch(bz){}b.data(bx,bw,by)}else{by=L}}return by}function S(bv){for(var e in bv){if(e==="data"&&b.isEmptyObject(bv[e])){continue}if(e!=="toJSON"){return false}}return true}function bi(by,bx,bA){var bw=bx+"defer",bv=bx+"queue",e=bx+"mark",bz=b._data(by,bw);if(bz&&(bA==="queue"||!b._data(by,bv))&&(bA==="mark"||!b._data(by,e))){setTimeout(function(){if(!b._data(by,bv)&&!b._data(by,e)){b.removeData(by,bw,true);bz.fire()}},0)}}b.extend({_mark:function(bv,e){if(bv){e=(e||"fx")+"mark";b._data(bv,e,(b._data(bv,e)||0)+1)}},_unmark:function(by,bx,bv){if(by!==true){bv=bx;bx=by;by=false}if(bx){bv=bv||"fx";var e=bv+"mark",bw=by?0:((b._data(bx,e)||1)-1);if(bw){b._data(bx,e,bw)}else{b.removeData(bx,e,true);bi(bx,bv,"mark")}}},queue:function(bv,e,bx){var bw;if(bv){e=(e||"fx")+"queue";bw=b._data(bv,e);if(bx){if(!bw||b.isArray(bx)){bw=b._data(bv,e,b.makeArray(bx))}else{bw.push(bx)}}return bw||[]}},dequeue:function(by,bx){bx=bx||"fx";var bv=b.queue(by,bx),bw=bv.shift(),e={};if(bw==="inprogress"){bw=bv.shift()}if(bw){if(bx==="fx"){bv.unshift("inprogress")}b._data(by,bx+".run",e);bw.call(by,function(){b.dequeue(by,bx)},e)}if(!bv.length){b.removeData(by,bx+"queue "+bx+".run",true);bi(by,bx,"queue")}}});b.fn.extend({queue:function(e,bv){if(typeof e!=="string"){bv=e;e="fx"}if(bv===L){return b.queue(this[0],e)}return this.each(function(){var bw=b.queue(this,e,bv);if(e==="fx"&&bw[0]!=="inprogress"){b.dequeue(this,e)}})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(bv,e){bv=b.fx?b.fx.speeds[bv]||bv:bv;e=e||"fx";return this.queue(e,function(bx,bw){var by=setTimeout(bx,bv);bw.stop=function(){clearTimeout(by)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(bD,bw){if(typeof bD!=="string"){bw=bD;bD=L}bD=bD||"fx";var e=b.Deferred(),bv=this,by=bv.length,bB=1,bz=bD+"defer",bA=bD+"queue",bC=bD+"mark",bx;function bE(){if(!(--bB)){e.resolveWith(bv,[bv])}}while(by--){if((bx=b.data(bv[by],bz,L,true)||(b.data(bv[by],bA,L,true)||b.data(bv[by],bC,L,true))&&b.data(bv[by],bz,b.Callbacks("once memory"),true))){bB++;bx.add(bE)}}bE();return e.promise()}});var aP=/[\n\t\r]/g,af=/\s+/,aU=/\r/g,g=/^(?:button|input)$/i,D=/^(?:button|input|object|select|textarea)$/i,l=/^a(?:rea)?$/i,ao=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,F=b.support.getSetAttribute,be,aY,aF;b.fn.extend({attr:function(e,bv){return b.access(this,e,bv,true,b.attr)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,bv){return b.access(this,e,bv,true,b.prop)},removeProp:function(e){e=b.propFix[e]||e;return this.each(function(){try{this[e]=L;delete this[e]}catch(bv){}})},addClass:function(by){var bA,bw,bv,bx,bz,bB,e;if(b.isFunction(by)){return this.each(function(bC){b(this).addClass(by.call(this,bC,this.className))})}if(by&&typeof by==="string"){bA=by.split(af);for(bw=0,bv=this.length;bw<bv;bw++){bx=this[bw];if(bx.nodeType===1){if(!bx.className&&bA.length===1){bx.className=by}else{bz=" "+bx.className+" ";for(bB=0,e=bA.length;bB<e;bB++){if(!~bz.indexOf(" "+bA[bB]+" ")){bz+=bA[bB]+" "}}bx.className=b.trim(bz)}}}}return this},removeClass:function(bz){var bA,bw,bv,by,bx,bB,e;if(b.isFunction(bz)){return this.each(function(bC){b(this).removeClass(bz.call(this,bC,this.className))})}if((bz&&typeof bz==="string")||bz===L){bA=(bz||"").split(af);for(bw=0,bv=this.length;bw<bv;bw++){by=this[bw];if(by.nodeType===1&&by.className){if(bz){bx=(" "+by.className+" ").replace(aP," ");for(bB=0,e=bA.length;bB<e;bB++){bx=bx.replace(" "+bA[bB]+" "," ")}by.className=b.trim(bx)}else{by.className=""}}}}return this},toggleClass:function(bx,bv){var bw=typeof bx,e=typeof bv==="boolean";if(b.isFunction(bx)){return this.each(function(by){b(this).toggleClass(bx.call(this,by,this.className,bv),bv)})}return this.each(function(){if(bw==="string"){var bA,bz=0,by=b(this),bB=bv,bC=bx.split(af);while((bA=bC[bz++])){bB=e?bB:!by.hasClass(bA);by[bB?"addClass":"removeClass"](bA)}}else{if(bw==="undefined"||bw==="boolean"){if(this.className){b._data(this,"__className__",this.className)}this.className=this.className||bx===false?"":b._data(this,"__className__")||""}}})},hasClass:function(e){var bx=" "+e+" ",bw=0,bv=this.length;for(;bw<bv;bw++){if(this[bw].nodeType===1&&(" "+this[bw].className+" ").replace(aP," ").indexOf(bx)>-1){return true}}return false},val:function(bx){var e,bv,by,bw=this[0];if(!arguments.length){if(bw){e=b.valHooks[bw.nodeName.toLowerCase()]||b.valHooks[bw.type];if(e&&"get" in e&&(bv=e.get(bw,"value"))!==L){return bv}bv=bw.value;return typeof bv==="string"?bv.replace(aU,""):bv==null?"":bv}return}by=b.isFunction(bx);return this.each(function(bA){var bz=b(this),bB;if(this.nodeType!==1){return}if(by){bB=bx.call(this,bA,bz.val())}else{bB=bx}if(bB==null){bB=""}else{if(typeof bB==="number"){bB+=""}else{if(b.isArray(bB)){bB=b.map(bB,function(bC){return bC==null?"":bC+""})}}}e=b.valHooks[this.nodeName.toLowerCase()]||b.valHooks[this.type];if(!e||!("set" in e)||e.set(this,bB,"value")===L){this.value=bB}})}});b.extend({valHooks:{option:{get:function(e){var bv=e.attributes.value;return !bv||bv.specified?e.value:e.text}},select:{get:function(e){var bA,bv,bz,bx,by=e.selectedIndex,bB=[],bC=e.options,bw=e.type==="select-one";if(by<0){return null}bv=bw?by:0;bz=bw?by+1:bC.length;for(;bv<bz;bv++){bx=bC[bv];if(bx.selected&&(b.support.optDisabled?!bx.disabled:bx.getAttribute("disabled")===null)&&(!bx.parentNode.disabled||!b.nodeName(bx.parentNode,"optgroup"))){bA=b(bx).val();if(bw){return bA}bB.push(bA)}}if(bw&&!bB.length&&bC.length){return b(bC[by]).val()}return bB},set:function(bv,bw){var e=b.makeArray(bw);b(bv).find("option").each(function(){this.selected=b.inArray(b(this).val(),e)>=0});if(!e.length){bv.selectedIndex=-1}return e}}},attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(bA,bx,bB,bz){var bw,e,by,bv=bA.nodeType;if(!bA||bv===3||bv===8||bv===2){return}if(bz&&bx in b.attrFn){return b(bA)[bx](bB)}if(typeof bA.getAttribute==="undefined"){return b.prop(bA,bx,bB)}by=bv!==1||!b.isXMLDoc(bA);if(by){bx=bx.toLowerCase();e=b.attrHooks[bx]||(ao.test(bx)?aY:be)}if(bB!==L){if(bB===null){b.removeAttr(bA,bx);return}else{if(e&&"set" in e&&by&&(bw=e.set(bA,bB,bx))!==L){return bw}else{bA.setAttribute(bx,""+bB);return bB}}}else{if(e&&"get" in e&&by&&(bw=e.get(bA,bx))!==null){return bw}else{bw=bA.getAttribute(bx);return bw===null?L:bw}}},removeAttr:function(bx,bz){var by,bA,bv,e,bw=0;if(bz&&bx.nodeType===1){bA=bz.toLowerCase().split(af);e=bA.length;for(;bw<e;bw++){bv=bA[bw];if(bv){by=b.propFix[bv]||bv;b.attr(bx,bv,"");bx.removeAttribute(F?bv:by);if(ao.test(bv)&&by in bx){bx[by]=false}}}}},attrHooks:{type:{set:function(e,bv){if(g.test(e.nodeName)&&e.parentNode){b.error("type property can't be changed")}else{if(!b.support.radioValue&&bv==="radio"&&b.nodeName(e,"input")){var bw=e.value;e.setAttribute("type",bv);if(bw){e.value=bw}return bv}}}},value:{get:function(bv,e){if(be&&b.nodeName(bv,"button")){return be.get(bv,e)}return e in bv?bv.value:null},set:function(bv,bw,e){if(be&&b.nodeName(bv,"button")){return be.set(bv,bw,e)}bv.value=bw}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(bz,bx,bA){var bw,e,by,bv=bz.nodeType;if(!bz||bv===3||bv===8||bv===2){return}by=bv!==1||!b.isXMLDoc(bz);if(by){bx=b.propFix[bx]||bx;e=b.propHooks[bx]}if(bA!==L){if(e&&"set" in e&&(bw=e.set(bz,bA,bx))!==L){return bw}else{return(bz[bx]=bA)}}else{if(e&&"get" in e&&(bw=e.get(bz,bx))!==null){return bw}else{return bz[bx]}}},propHooks:{tabIndex:{get:function(bv){var e=bv.getAttributeNode("tabindex");return e&&e.specified?parseInt(e.value,10):D.test(bv.nodeName)||l.test(bv.nodeName)&&bv.href?0:L}}}});b.attrHooks.tabindex=b.propHooks.tabIndex;aY={get:function(bv,e){var bx,bw=b.prop(bv,e);return bw===true||typeof bw!=="boolean"&&(bx=bv.getAttributeNode(e))&&bx.nodeValue!==false?e.toLowerCase():L},set:function(bv,bx,e){var bw;if(bx===false){b.removeAttr(bv,e)}else{bw=b.propFix[e]||e;if(bw in bv){bv[bw]=true}bv.setAttribute(e,e.toLowerCase())}return e}};if(!F){aF={name:true,id:true};be=b.valHooks.button={get:function(bw,bv){var e;e=bw.getAttributeNode(bv);return e&&(aF[bv]?e.nodeValue!=="":e.specified)?e.nodeValue:L},set:function(bw,bx,bv){var e=bw.getAttributeNode(bv);if(!e){e=av.createAttribute(bv);bw.setAttributeNode(e)}return(e.nodeValue=bx+"")}};b.attrHooks.tabindex.set=be.set;b.each(["width","height"],function(bv,e){b.attrHooks[e]=b.extend(b.attrHooks[e],{set:function(bw,bx){if(bx===""){bw.setAttribute(e,"auto");return bx}}})});b.attrHooks.contenteditable={get:be.get,set:function(bv,bw,e){if(bw===""){bw="false"}be.set(bv,bw,e)}}}if(!b.support.hrefNormalized){b.each(["href","src","width","height"],function(bv,e){b.attrHooks[e]=b.extend(b.attrHooks[e],{get:function(bx){var bw=bx.getAttribute(e,2);return bw===null?L:bw}})})}if(!b.support.style){b.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||L},set:function(e,bv){return(e.style.cssText=""+bv)}}}if(!b.support.optSelected){b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(bv){var e=bv.parentNode;if(e){e.selectedIndex;if(e.parentNode){e.parentNode.selectedIndex}}return null}})}if(!b.support.enctype){b.propFix.enctype="encoding"}if(!b.support.checkOn){b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}})}b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,bv){if(b.isArray(bv)){return(e.checked=b.inArray(b(e).val(),bv)>=0)}}})});var bd=/^(?:textarea|input|select)$/i,n=/^([^\.]*)?(?:\.(.+))?$/,J=/\bhover(\.\S+)?\b/,aO=/^key/,bf=/^(?:mouse|contextmenu)|click/,T=/^(?:focusinfocus|focusoutblur)$/,U=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,Y=function(e){var bv=U.exec(e);if(bv){bv[1]=(bv[1]||"").toLowerCase();bv[3]=bv[3]&&new RegExp("(?:^|\\s)"+bv[3]+"(?:\\s|$)")}return bv},j=function(bw,e){var bv=bw.attributes||{};return((!e[1]||bw.nodeName.toLowerCase()===e[1])&&(!e[2]||(bv.id||{}).value===e[2])&&(!e[3]||e[3].test((bv["class"]||{}).value)))},bt=function(e){return b.event.special.hover?e:e.replace(J,"mouseenter$1 mouseleave$1")};b.event={add:function(bx,bC,bJ,bA,by){var bD,bB,bK,bI,bH,bF,e,bG,bv,bz,bw,bE;if(bx.nodeType===3||bx.nodeType===8||!bC||!bJ||!(bD=b._data(bx))){return}if(bJ.handler){bv=bJ;bJ=bv.handler}if(!bJ.guid){bJ.guid=b.guid++}bK=bD.events;if(!bK){bD.events=bK={}}bB=bD.handle;if(!bB){bD.handle=bB=function(bL){return typeof b!=="undefined"&&(!bL||b.event.triggered!==bL.type)?b.event.dispatch.apply(bB.elem,arguments):L};bB.elem=bx}bC=b.trim(bt(bC)).split(" ");for(bI=0;bI<bC.length;bI++){bH=n.exec(bC[bI])||[];bF=bH[1];e=(bH[2]||"").split(".").sort();bE=b.event.special[bF]||{};bF=(by?bE.delegateType:bE.bindType)||bF;bE=b.event.special[bF]||{};bG=b.extend({type:bF,origType:bH[1],data:bA,handler:bJ,guid:bJ.guid,selector:by,quick:Y(by),namespace:e.join(".")},bv);bw=bK[bF];if(!bw){bw=bK[bF]=[];bw.delegateCount=0;if(!bE.setup||bE.setup.call(bx,bA,e,bB)===false){if(bx.addEventListener){bx.addEventListener(bF,bB,false)}else{if(bx.attachEvent){bx.attachEvent("on"+bF,bB)}}}}if(bE.add){bE.add.call(bx,bG);if(!bG.handler.guid){bG.handler.guid=bJ.guid}}if(by){bw.splice(bw.delegateCount++,0,bG)}else{bw.push(bG)}b.event.global[bF]=true}bx=null},global:{},remove:function(bJ,bE,bv,bH,bB){var bI=b.hasData(bJ)&&b._data(bJ),bF,bx,bz,bL,bC,bA,bG,bw,by,bK,bD,e;if(!bI||!(bw=bI.events)){return}bE=b.trim(bt(bE||"")).split(" ");for(bF=0;bF<bE.length;bF++){bx=n.exec(bE[bF])||[];bz=bL=bx[1];bC=bx[2];if(!bz){for(bz in bw){b.event.remove(bJ,bz+bE[bF],bv,bH,true)}continue}by=b.event.special[bz]||{};bz=(bH?by.delegateType:by.bindType)||bz;bD=bw[bz]||[];bA=bD.length;bC=bC?new RegExp("(^|\\.)"+bC.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(bG=0;bG<bD.length;bG++){e=bD[bG];if((bB||bL===e.origType)&&(!bv||bv.guid===e.guid)&&(!bC||bC.test(e.namespace))&&(!bH||bH===e.selector||bH==="**"&&e.selector)){bD.splice(bG--,1);if(e.selector){bD.delegateCount--}if(by.remove){by.remove.call(bJ,e)}}}if(bD.length===0&&bA!==bD.length){if(!by.teardown||by.teardown.call(bJ,bC)===false){b.removeEvent(bJ,bz,bI.handle)}delete bw[bz]}}if(b.isEmptyObject(bw)){bK=bI.handle;if(bK){bK.elem=null}b.removeData(bJ,["events","handle"],true)}},customEvent:{getData:true,setData:true,changeData:true},trigger:function(bv,bD,bA,bJ){if(bA&&(bA.nodeType===3||bA.nodeType===8)){return}var bG=bv.type||bv,bx=[],e,bw,bC,bH,bz,by,bF,bE,bB,bI;if(T.test(bG+b.event.triggered)){return}if(bG.indexOf("!")>=0){bG=bG.slice(0,-1);bw=true}if(bG.indexOf(".")>=0){bx=bG.split(".");bG=bx.shift();bx.sort()}if((!bA||b.event.customEvent[bG])&&!b.event.global[bG]){return}bv=typeof bv==="object"?bv[b.expando]?bv:new b.Event(bG,bv):new b.Event(bG);bv.type=bG;bv.isTrigger=true;bv.exclusive=bw;bv.namespace=bx.join(".");bv.namespace_re=bv.namespace?new RegExp("(^|\\.)"+bx.join("\\.(?:.*\\.)?")+"(\\.|$)"):null;by=bG.indexOf(":")<0?"on"+bG:"";if(!bA){e=b.cache;for(bC in e){if(e[bC].events&&e[bC].events[bG]){b.event.trigger(bv,bD,e[bC].handle.elem,true)}}return}bv.result=L;if(!bv.target){bv.target=bA}bD=bD!=null?b.makeArray(bD):[];bD.unshift(bv);bF=b.event.special[bG]||{};if(bF.trigger&&bF.trigger.apply(bA,bD)===false){return}bB=[[bA,bF.bindType||bG]];if(!bJ&&!bF.noBubble&&!b.isWindow(bA)){bI=bF.delegateType||bG;bH=T.test(bI+bG)?bA:bA.parentNode;bz=null;for(;bH;bH=bH.parentNode){bB.push([bH,bI]);bz=bH}if(bz&&bz===bA.ownerDocument){bB.push([bz.defaultView||bz.parentWindow||bb,bI])}}for(bC=0;bC<bB.length&&!bv.isPropagationStopped();bC++){bH=bB[bC][0];bv.type=bB[bC][1];bE=(b._data(bH,"events")||{})[bv.type]&&b._data(bH,"handle");if(bE){bE.apply(bH,bD)}bE=by&&bH[by];if(bE&&b.acceptData(bH)&&bE.apply(bH,bD)===false){bv.preventDefault()}}bv.type=bG;if(!bJ&&!bv.isDefaultPrevented()){if((!bF._default||bF._default.apply(bA.ownerDocument,bD)===false)&&!(bG==="click"&&b.nodeName(bA,"a"))&&b.acceptData(bA)){if(by&&bA[bG]&&((bG!=="focus"&&bG!=="blur")||bv.target.offsetWidth!==0)&&!b.isWindow(bA)){bz=bA[by];if(bz){bA[by]=null}b.event.triggered=bG;bA[bG]();b.event.triggered=L;if(bz){bA[by]=bz}}}}return bv.result},dispatch:function(e){e=b.event.fix(e||bb.event);var bz=((b._data(this,"events")||{})[e.type]||[]),bA=bz.delegateCount,bG=[].slice.call(arguments,0),by=!e.exclusive&&!e.namespace,bH=[],bC,bB,bK,bx,bF,bE,bv,bD,bI,bw,bJ;bG[0]=e;e.delegateTarget=this;if(bA&&!e.target.disabled&&!(e.button&&e.type==="click")){bx=b(this);bx.context=this.ownerDocument||this;for(bK=e.target;bK!=this;bK=bK.parentNode||this){bE={};bD=[];bx[0]=bK;for(bC=0;bC<bA;bC++){bI=bz[bC];bw=bI.selector;if(bE[bw]===L){bE[bw]=(bI.quick?j(bK,bI.quick):bx.is(bw))}if(bE[bw]){bD.push(bI)}}if(bD.length){bH.push({elem:bK,matches:bD})}}}if(bz.length>bA){bH.push({elem:this,matches:bz.slice(bA)})}for(bC=0;bC<bH.length&&!e.isPropagationStopped();bC++){bv=bH[bC];e.currentTarget=bv.elem;for(bB=0;bB<bv.matches.length&&!e.isImmediatePropagationStopped();bB++){bI=bv.matches[bB];if(by||(!e.namespace&&!bI.namespace)||e.namespace_re&&e.namespace_re.test(bI.namespace)){e.data=bI.data;e.handleObj=bI;bF=((b.event.special[bI.origType]||{}).handle||bI.handler).apply(bv.elem,bG);if(bF!==L){e.result=bF;if(bF===false){e.preventDefault();e.stopPropagation()}}}}}return e.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(bv,e){if(bv.which==null){bv.which=e.charCode!=null?e.charCode:e.keyCode}return bv}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(bx,bw){var by,bz,e,bv=bw.button,bA=bw.fromElement;if(bx.pageX==null&&bw.clientX!=null){by=bx.target.ownerDocument||av;bz=by.documentElement;e=by.body;bx.pageX=bw.clientX+(bz&&bz.scrollLeft||e&&e.scrollLeft||0)-(bz&&bz.clientLeft||e&&e.clientLeft||0);bx.pageY=bw.clientY+(bz&&bz.scrollTop||e&&e.scrollTop||0)-(bz&&bz.clientTop||e&&e.clientTop||0)}if(!bx.relatedTarget&&bA){bx.relatedTarget=bA===bx.target?bw.toElement:bA}if(!bx.which&&bv!==L){bx.which=(bv&1?1:(bv&2?3:(bv&4?2:0)))}return bx}},fix:function(bw){if(bw[b.expando]){return bw}var bv,bz,e=bw,bx=b.event.fixHooks[bw.type]||{},by=bx.props?this.props.concat(bx.props):this.props;bw=b.Event(e);for(bv=by.length;bv;){bz=by[--bv];bw[bz]=e[bz]}if(!bw.target){bw.target=e.srcElement||av}if(bw.target.nodeType===3){bw.target=bw.target.parentNode}if(bw.metaKey===L){bw.metaKey=bw.ctrlKey}return bx.filter?bx.filter(bw,e):bw},special:{ready:{setup:b.bindReady},load:{noBubble:true},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(bw,bv,e){if(b.isWindow(this)){this.onbeforeunload=e}},teardown:function(bv,e){if(this.onbeforeunload===e){this.onbeforeunload=null}}}},simulate:function(bw,by,bx,bv){var bz=b.extend(new b.Event(),bx,{type:bw,isSimulated:true,originalEvent:{}});if(bv){b.event.trigger(bz,null,by)}else{b.event.dispatch.call(by,bz)}if(bz.isDefaultPrevented()){bx.preventDefault()}}};b.event.handle=b.event.dispatch;b.removeEvent=av.removeEventListener?function(bv,e,bw){if(bv.removeEventListener){bv.removeEventListener(e,bw,false)}}:function(bv,e,bw){if(bv.detachEvent){bv.detachEvent("on"+e,bw)}};b.Event=function(bv,e){if(!(this instanceof b.Event)){return new b.Event(bv,e)}if(bv&&bv.type){this.originalEvent=bv;this.type=bv.type;this.isDefaultPrevented=(bv.defaultPrevented||bv.returnValue===false||bv.getPreventDefault&&bv.getPreventDefault())?i:bk}else{this.type=bv}if(e){b.extend(this,e)}this.timeStamp=bv&&bv.timeStamp||b.now();this[b.expando]=true};function bk(){return false}function i(){return true}b.Event.prototype={preventDefault:function(){this.isDefaultPrevented=i;var bv=this.originalEvent;if(!bv){return}if(bv.preventDefault){bv.preventDefault()}else{bv.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=i;var bv=this.originalEvent;if(!bv){return}if(bv.stopPropagation){bv.stopPropagation()}bv.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=i;this.stopPropagation()},isDefaultPrevented:bk,isPropagationStopped:bk,isImmediatePropagationStopped:bk};b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(bv,e){b.event.special[bv]={delegateType:e,bindType:e,handle:function(bz){var bB=this,bA=bz.relatedTarget,by=bz.handleObj,bw=by.selector,bx;if(!bA||(bA!==bB&&!b.contains(bB,bA))){bz.type=by.origType;bx=by.handler.apply(this,arguments);bz.type=e}return bx}}});if(!b.support.submitBubbles){b.event.special.submit={setup:function(){if(b.nodeName(this,"form")){return false}b.event.add(this,"click._submit keypress._submit",function(bx){var bw=bx.target,bv=b.nodeName(bw,"input")||b.nodeName(bw,"button")?bw.form:L;if(bv&&!bv._submit_attached){b.event.add(bv,"submit._submit",function(e){if(this.parentNode&&!e.isTrigger){b.event.simulate("submit",this.parentNode,e,true)}});bv._submit_attached=true}})},teardown:function(){if(b.nodeName(this,"form")){return false}b.event.remove(this,"._submit")}}}if(!b.support.changeBubbles){b.event.special.change={setup:function(){if(bd.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio"){b.event.add(this,"propertychange._change",function(e){if(e.originalEvent.propertyName==="checked"){this._just_changed=true}});b.event.add(this,"click._change",function(e){if(this._just_changed&&!e.isTrigger){this._just_changed=false;b.event.simulate("change",this,e,true)}})}return false}b.event.add(this,"beforeactivate._change",function(bw){var bv=bw.target;if(bd.test(bv.nodeName)&&!bv._change_attached){b.event.add(bv,"change._change",function(e){if(this.parentNode&&!e.isSimulated&&!e.isTrigger){b.event.simulate("change",this.parentNode,e,true)}});bv._change_attached=true}})},handle:function(bv){var e=bv.target;if(this!==e||bv.isSimulated||bv.isTrigger||(e.type!=="radio"&&e.type!=="checkbox")){return bv.handleObj.handler.apply(this,arguments)}},teardown:function(){b.event.remove(this,"._change");return bd.test(this.nodeName)}}}if(!b.support.focusinBubbles){b.each({focus:"focusin",blur:"focusout"},function(bx,e){var bv=0,bw=function(by){b.event.simulate(e,by.target,b.event.fix(by),true)};b.event.special[e]={setup:function(){if(bv++===0){av.addEventListener(bx,bw,true)}},teardown:function(){if(--bv===0){av.removeEventListener(bx,bw,true)}}}})}b.fn.extend({on:function(bw,e,bz,by,bv){var bA,bx;if(typeof bw==="object"){if(typeof e!=="string"){bz=e;e=L}for(bx in bw){this.on(bx,e,bz,bw[bx],bv)}return this}if(bz==null&&by==null){by=e;bz=e=L}else{if(by==null){if(typeof e==="string"){by=bz;bz=L}else{by=bz;bz=e;e=L}}}if(by===false){by=bk}else{if(!by){return this}}if(bv===1){bA=by;by=function(bB){b().off(bB);return bA.apply(this,arguments)};by.guid=bA.guid||(bA.guid=b.guid++)}return this.each(function(){b.event.add(this,bw,by,bz,e)})},one:function(bv,e,bx,bw){return this.on.call(this,bv,e,bx,bw,1)},off:function(bw,e,by){if(bw&&bw.preventDefault&&bw.handleObj){var bv=bw.handleObj;b(bw.delegateTarget).off(bv.namespace?bv.type+"."+bv.namespace:bv.type,bv.selector,bv.handler);return this}if(typeof bw==="object"){for(var bx in bw){this.off(bx,e,bw[bx])}return this}if(e===false||typeof e==="function"){by=e;e=L}if(by===false){by=bk}return this.each(function(){b.event.remove(this,bw,by,e)})},bind:function(e,bw,bv){return this.on(e,null,bw,bv)},unbind:function(e,bv){return this.off(e,null,bv)},live:function(e,bw,bv){b(this.context).on(e,this.selector,bw,bv);return this},die:function(e,bv){b(this.context).off(e,this.selector||"**",bv);return this},delegate:function(e,bv,bx,bw){return this.on(bv,e,bx,bw)},undelegate:function(e,bv,bw){return arguments.length==1?this.off(e,"**"):this.off(bv,e,bw)},trigger:function(e,bv){return this.each(function(){b.event.trigger(e,bv,this)})},triggerHandler:function(e,bv){if(this[0]){return b.event.trigger(e,bv,this[0],true)}},toggle:function(bx){var bv=arguments,e=bx.guid||b.guid++,bw=0,by=function(bz){var bA=(b._data(this,"lastToggle"+bx.guid)||0)%bw;b._data(this,"lastToggle"+bx.guid,bA+1);bz.preventDefault();return bv[bA].apply(this,arguments)||false};by.guid=e;while(bw<bv.length){bv[bw++].guid=e}return this.click(by)},hover:function(e,bv){return this.mouseenter(e).mouseleave(bv||e)}});b.each(("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu").split(" "),function(bv,e){b.fn[e]=function(bx,bw){if(bw==null){bw=bx;bx=null}return arguments.length>0?this.on(e,null,bx,bw):this.trigger(e)};if(b.attrFn){b.attrFn[e]=true}if(aO.test(e)){b.event.fixHooks[e]=b.event.keyHooks}if(bf.test(e)){b.event.fixHooks[e]=b.event.mouseHooks}});
-/*!
+/*
* Sizzle CSS Selector Engine
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
-(function(){var bH=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,bC="sizcache"+(Math.random()+"").replace(".",""),bI=0,bL=Object.prototype.toString,bB=false,bA=true,bK=/\\/g,bO=/\r\n/g,bQ=/\W/;[0,0].sort(function(){bA=false;return 0});var by=function(bV,e,bY,bZ){bY=bY||[];e=e||av;var b1=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!bV||typeof bV!=="string"){return bY}var bS,b3,b6,bR,b2,b5,b4,bX,bU=true,bT=by.isXML(e),bW=[],b0=bV;do{bH.exec("");bS=bH.exec(b0);if(bS){b0=bS[3];bW.push(bS[1]);if(bS[2]){bR=bS[3];break}}}while(bS);if(bW.length>1&&bD.exec(bV)){if(bW.length===2&&bE.relative[bW[0]]){b3=bM(bW[0]+bW[1],e,bZ)}else{b3=bE.relative[bW[0]]?[e]:by(bW.shift(),e);while(bW.length){bV=bW.shift();if(bE.relative[bV]){bV+=bW.shift()}b3=bM(bV,b3,bZ)}}}else{if(!bZ&&bW.length>1&&e.nodeType===9&&!bT&&bE.match.ID.test(bW[0])&&!bE.match.ID.test(bW[bW.length-1])){b2=by.find(bW.shift(),e,bT);e=b2.expr?by.filter(b2.expr,b2.set)[0]:b2.set[0]}if(e){b2=bZ?{expr:bW.pop(),set:bF(bZ)}:by.find(bW.pop(),bW.length===1&&(bW[0]==="~"||bW[0]==="+")&&e.parentNode?e.parentNode:e,bT);b3=b2.expr?by.filter(b2.expr,b2.set):b2.set;if(bW.length>0){b6=bF(b3)}else{bU=false}while(bW.length){b5=bW.pop();b4=b5;if(!bE.relative[b5]){b5=""}else{b4=bW.pop()}if(b4==null){b4=e}bE.relative[b5](b6,b4,bT)}}else{b6=bW=[]}}if(!b6){b6=b3}if(!b6){by.error(b5||bV)}if(bL.call(b6)==="[object Array]"){if(!bU){bY.push.apply(bY,b6)}else{if(e&&e.nodeType===1){for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&(b6[bX]===true||b6[bX].nodeType===1&&by.contains(e,b6[bX]))){bY.push(b3[bX])}}}else{for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&b6[bX].nodeType===1){bY.push(b3[bX])}}}}}else{bF(b6,bY)}if(bR){by(bR,b1,bY,bZ);by.uniqueSort(bY)}return bY};by.uniqueSort=function(bR){if(bJ){bB=bA;bR.sort(bJ);if(bB){for(var e=1;e<bR.length;e++){if(bR[e]===bR[e-1]){bR.splice(e--,1)}}}}return bR};by.matches=function(e,bR){return by(e,null,null,bR)};by.matchesSelector=function(e,bR){return by(bR,null,null,[e]).length>0};by.find=function(bX,e,bY){var bW,bS,bU,bT,bV,bR;if(!bX){return[]}for(bS=0,bU=bE.order.length;bS<bU;bS++){bV=bE.order[bS];if((bT=bE.leftMatch[bV].exec(bX))){bR=bT[1];bT.splice(1,1);if(bR.substr(bR.length-1)!=="\\"){bT[1]=(bT[1]||"").replace(bK,"");bW=bE.find[bV](bT,e,bY);if(bW!=null){bX=bX.replace(bE.match[bV],"");break}}}}if(!bW){bW=typeof e.getElementsByTagName!=="undefined"?e.getElementsByTagName("*"):[]}return{set:bW,expr:bX}};by.filter=function(b1,b0,b4,bU){var bW,e,bZ,b6,b3,bR,bT,bV,b2,bS=b1,b5=[],bY=b0,bX=b0&&b0[0]&&by.isXML(b0[0]);while(b1&&b0.length){for(bZ in bE.filter){if((bW=bE.leftMatch[bZ].exec(b1))!=null&&bW[2]){bR=bE.filter[bZ];bT=bW[1];e=false;bW.splice(1,1);if(bT.substr(bT.length-1)==="\\"){continue}if(bY===b5){b5=[]}if(bE.preFilter[bZ]){bW=bE.preFilter[bZ](bW,bY,b4,b5,bU,bX);if(!bW){e=b6=true}else{if(bW===true){continue}}}if(bW){for(bV=0;(b3=bY[bV])!=null;bV++){if(b3){b6=bR(b3,bW,bV,bY);b2=bU^b6;if(b4&&b6!=null){if(b2){e=true}else{bY[bV]=false}}else{if(b2){b5.push(b3);e=true}}}}}if(b6!==L){if(!b4){bY=b5}b1=b1.replace(bE.match[bZ],"");if(!e){return[]}break}}}if(b1===bS){if(e==null){by.error(b1)}else{break}}bS=b1}return bY};by.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)};var bw=by.getText=function(bU){var bS,bT,e=bU.nodeType,bR="";if(e){if(e===1||e===9){if(typeof bU.textContent==="string"){return bU.textContent}else{if(typeof bU.innerText==="string"){return bU.innerText.replace(bO,"")}else{for(bU=bU.firstChild;bU;bU=bU.nextSibling){bR+=bw(bU)}}}}else{if(e===3||e===4){return bU.nodeValue}}}else{for(bS=0;(bT=bU[bS]);bS++){if(bT.nodeType!==8){bR+=bw(bT)}}}return bR};var bE=by.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")},type:function(e){return e.getAttribute("type")}},relative:{"+":function(bW,bR){var bT=typeof bR==="string",bV=bT&&!bQ.test(bR),bX=bT&&!bV;if(bV){bR=bR.toLowerCase()}for(var bS=0,e=bW.length,bU;bS<e;bS++){if((bU=bW[bS])){while((bU=bU.previousSibling)&&bU.nodeType!==1){}bW[bS]=bX||bU&&bU.nodeName.toLowerCase()===bR?bU||false:bU===bR}}if(bX){by.filter(bR,bW,true)}},">":function(bW,bR){var bV,bU=typeof bR==="string",bS=0,e=bW.length;if(bU&&!bQ.test(bR)){bR=bR.toLowerCase();for(;bS<e;bS++){bV=bW[bS];if(bV){var bT=bV.parentNode;bW[bS]=bT.nodeName.toLowerCase()===bR?bT:false}}}else{for(;bS<e;bS++){bV=bW[bS];if(bV){bW[bS]=bU?bV.parentNode:bV.parentNode===bR}}if(bU){by.filter(bR,bW,true)}}},"":function(bT,bR,bV){var bU,bS=bI++,e=bN;if(typeof bR==="string"&&!bQ.test(bR)){bR=bR.toLowerCase();bU=bR;e=bv}e("parentNode",bR,bS,bT,bU,bV)},"~":function(bT,bR,bV){var bU,bS=bI++,e=bN;if(typeof bR==="string"&&!bQ.test(bR)){bR=bR.toLowerCase();bU=bR;e=bv}e("previousSibling",bR,bS,bT,bU,bV)}},find:{ID:function(bR,bS,bT){if(typeof bS.getElementById!=="undefined"&&!bT){var e=bS.getElementById(bR[1]);return e&&e.parentNode?[e]:[]}},NAME:function(bS,bV){if(typeof bV.getElementsByName!=="undefined"){var bR=[],bU=bV.getElementsByName(bS[1]);for(var bT=0,e=bU.length;bT<e;bT++){if(bU[bT].getAttribute("name")===bS[1]){bR.push(bU[bT])}}return bR.length===0?null:bR}},TAG:function(e,bR){if(typeof bR.getElementsByTagName!=="undefined"){return bR.getElementsByTagName(e[1])}}},preFilter:{CLASS:function(bT,bR,bS,e,bW,bX){bT=" "+bT[1].replace(bK,"")+" ";if(bX){return bT}for(var bU=0,bV;(bV=bR[bU])!=null;bU++){if(bV){if(bW^(bV.className&&(" "+bV.className+" ").replace(/[\t\n\r]/g," ").indexOf(bT)>=0)){if(!bS){e.push(bV)}}else{if(bS){bR[bU]=false}}}}return false},ID:function(e){return e[1].replace(bK,"")},TAG:function(bR,e){return bR[1].replace(bK,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){if(!e[2]){by.error(e[0])}e[2]=e[2].replace(/^\+|\s*/g,"");var bR=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(bR[1]+(bR[2]||1))-0;e[3]=bR[3]-0}else{if(e[2]){by.error(e[0])}}e[0]=bI++;return e},ATTR:function(bU,bR,bS,e,bV,bW){var bT=bU[1]=bU[1].replace(bK,"");if(!bW&&bE.attrMap[bT]){bU[1]=bE.attrMap[bT]}bU[4]=(bU[4]||bU[5]||"").replace(bK,"");if(bU[2]==="~="){bU[4]=" "+bU[4]+" "}return bU},PSEUDO:function(bU,bR,bS,e,bV){if(bU[1]==="not"){if((bH.exec(bU[3])||"").length>1||/^\w/.test(bU[3])){bU[3]=by(bU[3],null,null,bR)}else{var bT=by.filter(bU[3],bR,bS,true^bV);if(!bS){e.push.apply(e,bT)}return false}}else{if(bE.match.POS.test(bU[0])||bE.match.CHILD.test(bU[0])){return true}}return bU},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(bS,bR,e){return !!by(e[3],bS).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(bS){var e=bS.getAttribute("type"),bR=bS.type;return bS.nodeName.toLowerCase()==="input"&&"text"===bR&&(e===bR||e===null)},radio:function(e){return e.nodeName.toLowerCase()==="input"&&"radio"===e.type},checkbox:function(e){return e.nodeName.toLowerCase()==="input"&&"checkbox"===e.type},file:function(e){return e.nodeName.toLowerCase()==="input"&&"file"===e.type},password:function(e){return e.nodeName.toLowerCase()==="input"&&"password"===e.type},submit:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"submit"===bR.type},image:function(e){return e.nodeName.toLowerCase()==="input"&&"image"===e.type},reset:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"reset"===bR.type},button:function(bR){var e=bR.nodeName.toLowerCase();return e==="input"&&"button"===bR.type||e==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(bR,e){return e===0},last:function(bS,bR,e,bT){return bR===bT.length-1},even:function(bR,e){return e%2===0},odd:function(bR,e){return e%2===1},lt:function(bS,bR,e){return bR<e[3]-0},gt:function(bS,bR,e){return bR>e[3]-0},nth:function(bS,bR,e){return e[3]-0===bR},eq:function(bS,bR,e){return e[3]-0===bR}},filter:{PSEUDO:function(bS,bX,bW,bY){var e=bX[1],bR=bE.filters[e];if(bR){return bR(bS,bW,bX,bY)}else{if(e==="contains"){return(bS.textContent||bS.innerText||bw([bS])||"").indexOf(bX[3])>=0}else{if(e==="not"){var bT=bX[3];for(var bV=0,bU=bT.length;bV<bU;bV++){if(bT[bV]===bS){return false}}return true}else{by.error(e)}}}},CHILD:function(bS,bU){var bT,b0,bW,bZ,e,bV,bY,bX=bU[1],bR=bS;switch(bX){case"only":case"first":while((bR=bR.previousSibling)){if(bR.nodeType===1){return false}}if(bX==="first"){return true}bR=bS;case"last":while((bR=bR.nextSibling)){if(bR.nodeType===1){return false}}return true;case"nth":bT=bU[2];b0=bU[3];if(bT===1&&b0===0){return true}bW=bU[0];bZ=bS.parentNode;if(bZ&&(bZ[bC]!==bW||!bS.nodeIndex)){bV=0;for(bR=bZ.firstChild;bR;bR=bR.nextSibling){if(bR.nodeType===1){bR.nodeIndex=++bV}}bZ[bC]=bW}bY=bS.nodeIndex-b0;if(bT===0){return bY===0}else{return(bY%bT===0&&bY/bT>=0)}}},ID:function(bR,e){return bR.nodeType===1&&bR.getAttribute("id")===e},TAG:function(bR,e){return(e==="*"&&bR.nodeType===1)||!!bR.nodeName&&bR.nodeName.toLowerCase()===e},CLASS:function(bR,e){return(" "+(bR.className||bR.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(bV,bT){var bS=bT[1],e=by.attr?by.attr(bV,bS):bE.attrHandle[bS]?bE.attrHandle[bS](bV):bV[bS]!=null?bV[bS]:bV.getAttribute(bS),bW=e+"",bU=bT[2],bR=bT[4];return e==null?bU==="!=":!bU&&by.attr?e!=null:bU==="="?bW===bR:bU==="*="?bW.indexOf(bR)>=0:bU==="~="?(" "+bW+" ").indexOf(bR)>=0:!bR?bW&&e!==false:bU==="!="?bW!==bR:bU==="^="?bW.indexOf(bR)===0:bU==="$="?bW.substr(bW.length-bR.length)===bR:bU==="|="?bW===bR||bW.substr(0,bR.length+1)===bR+"-":false},POS:function(bU,bR,bS,bV){var e=bR[2],bT=bE.setFilters[e];if(bT){return bT(bU,bS,bR,bV)}}}};var bD=bE.match.POS,bx=function(bR,e){return"\\"+(e-0+1)};for(var bz in bE.match){bE.match[bz]=new RegExp(bE.match[bz].source+(/(?![^\[]*\])(?![^\(]*\))/.source));bE.leftMatch[bz]=new RegExp(/(^(?:.|\r|\n)*?)/.source+bE.match[bz].source.replace(/\\(\d+)/g,bx))}var bF=function(bR,e){bR=Array.prototype.slice.call(bR,0);if(e){e.push.apply(e,bR);return e}return bR};try{Array.prototype.slice.call(av.documentElement.childNodes,0)[0].nodeType}catch(bP){bF=function(bU,bT){var bS=0,bR=bT||[];if(bL.call(bU)==="[object Array]"){Array.prototype.push.apply(bR,bU)}else{if(typeof bU.length==="number"){for(var e=bU.length;bS<e;bS++){bR.push(bU[bS])}}else{for(;bU[bS];bS++){bR.push(bU[bS])}}}return bR}}var bJ,bG;if(av.documentElement.compareDocumentPosition){bJ=function(bR,e){if(bR===e){bB=true;return 0}if(!bR.compareDocumentPosition||!e.compareDocumentPosition){return bR.compareDocumentPosition?-1:1}return bR.compareDocumentPosition(e)&4?-1:1}}else{bJ=function(bY,bX){if(bY===bX){bB=true;return 0}else{if(bY.sourceIndex&&bX.sourceIndex){return bY.sourceIndex-bX.sourceIndex}}var bV,bR,bS=[],e=[],bU=bY.parentNode,bW=bX.parentNode,bZ=bU;if(bU===bW){return bG(bY,bX)}else{if(!bU){return -1}else{if(!bW){return 1}}}while(bZ){bS.unshift(bZ);bZ=bZ.parentNode}bZ=bW;while(bZ){e.unshift(bZ);bZ=bZ.parentNode}bV=bS.length;bR=e.length;for(var bT=0;bT<bV&&bT<bR;bT++){if(bS[bT]!==e[bT]){return bG(bS[bT],e[bT])}}return bT===bV?bG(bY,e[bT],-1):bG(bS[bT],bX,1)};bG=function(bR,e,bS){if(bR===e){return bS}var bT=bR.nextSibling;while(bT){if(bT===e){return -1}bT=bT.nextSibling}return 1}}(function(){var bR=av.createElement("div"),bS="script"+(new Date()).getTime(),e=av.documentElement;bR.innerHTML="<a name='"+bS+"'/>";e.insertBefore(bR,e.firstChild);if(av.getElementById(bS)){bE.find.ID=function(bU,bV,bW){if(typeof bV.getElementById!=="undefined"&&!bW){var bT=bV.getElementById(bU[1]);return bT?bT.id===bU[1]||typeof bT.getAttributeNode!=="undefined"&&bT.getAttributeNode("id").nodeValue===bU[1]?[bT]:L:[]}};bE.filter.ID=function(bV,bT){var bU=typeof bV.getAttributeNode!=="undefined"&&bV.getAttributeNode("id");return bV.nodeType===1&&bU&&bU.nodeValue===bT}}e.removeChild(bR);e=bR=null})();(function(){var e=av.createElement("div");e.appendChild(av.createComment(""));if(e.getElementsByTagName("*").length>0){bE.find.TAG=function(bR,bV){var bU=bV.getElementsByTagName(bR[1]);if(bR[1]==="*"){var bT=[];for(var bS=0;bU[bS];bS++){if(bU[bS].nodeType===1){bT.push(bU[bS])}}bU=bT}return bU}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){bE.attrHandle.href=function(bR){return bR.getAttribute("href",2)}}e=null})();if(av.querySelectorAll){(function(){var e=by,bT=av.createElement("div"),bS="__sizzle__";bT.innerHTML="<p class='TEST'></p>";if(bT.querySelectorAll&&bT.querySelectorAll(".TEST").length===0){return}by=function(b4,bV,bZ,b3){bV=bV||av;if(!b3&&!by.isXML(bV)){var b2=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b4);if(b2&&(bV.nodeType===1||bV.nodeType===9)){if(b2[1]){return bF(bV.getElementsByTagName(b4),bZ)}else{if(b2[2]&&bE.find.CLASS&&bV.getElementsByClassName){return bF(bV.getElementsByClassName(b2[2]),bZ)}}}if(bV.nodeType===9){if(b4==="body"&&bV.body){return bF([bV.body],bZ)}else{if(b2&&b2[3]){var bY=bV.getElementById(b2[3]);if(bY&&bY.parentNode){if(bY.id===b2[3]){return bF([bY],bZ)}}else{return bF([],bZ)}}}try{return bF(bV.querySelectorAll(b4),bZ)}catch(b0){}}else{if(bV.nodeType===1&&bV.nodeName.toLowerCase()!=="object"){var bW=bV,bX=bV.getAttribute("id"),bU=bX||bS,b6=bV.parentNode,b5=/^\s*[+~]/.test(b4);if(!bX){bV.setAttribute("id",bU)}else{bU=bU.replace(/'/g,"\\$&")}if(b5&&b6){bV=bV.parentNode}try{if(!b5||b6){return bF(bV.querySelectorAll("[id='"+bU+"'] "+b4),bZ)}}catch(b1){}finally{if(!bX){bW.removeAttribute("id")}}}}}return e(b4,bV,bZ,b3)};for(var bR in e){by[bR]=e[bR]}bT=null})()}(function(){var e=av.documentElement,bS=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(bS){var bU=!bS.call(av.createElement("div"),"div"),bR=false;try{bS.call(av.documentElement,"[test!='']:sizzle")}catch(bT){bR=true}by.matchesSelector=function(bW,bY){bY=bY.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!by.isXML(bW)){try{if(bR||!bE.match.PSEUDO.test(bY)&&!/!=/.test(bY)){var bV=bS.call(bW,bY);if(bV||!bU||bW.document&&bW.document.nodeType!==11){return bV}}}catch(bX){}}return by(bY,null,null,[bW]).length>0}}})();(function(){var e=av.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}bE.order.splice(1,0,"CLASS");bE.find.CLASS=function(bR,bS,bT){if(typeof bS.getElementsByClassName!=="undefined"&&!bT){return bS.getElementsByClassName(bR[1])}};e=null})();function bv(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT<bS;bT++){var e=bZ[bT];if(e){var bU=false;e=e[bR];while(e){if(e[bC]===bV){bU=bZ[e.sizset];break}if(e.nodeType===1&&!bY){e[bC]=bV;e.sizset=bT}if(e.nodeName.toLowerCase()===bW){bU=e;break}e=e[bR]}bZ[bT]=bU}}}function bN(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT<bS;bT++){var e=bZ[bT];if(e){var bU=false;e=e[bR];while(e){if(e[bC]===bV){bU=bZ[e.sizset];break}if(e.nodeType===1){if(!bY){e[bC]=bV;e.sizset=bT}if(typeof bW!=="string"){if(e===bW){bU=true;break}}else{if(by.filter(bW,[e]).length>0){bU=e;break}}}e=e[bR]}bZ[bT]=bU}}}if(av.documentElement.contains){by.contains=function(bR,e){return bR!==e&&(bR.contains?bR.contains(e):true)}}else{if(av.documentElement.compareDocumentPosition){by.contains=function(bR,e){return !!(bR.compareDocumentPosition(e)&16)}}else{by.contains=function(){return false}}}by.isXML=function(e){var bR=(e?e.ownerDocument||e:0).documentElement;return bR?bR.nodeName!=="HTML":false};var bM=function(bS,e,bW){var bV,bX=[],bU="",bY=e.nodeType?[e]:e;while((bV=bE.match.PSEUDO.exec(bS))){bU+=bV[0];bS=bS.replace(bE.match.PSEUDO,"")}bS=bE.relative[bS]?bS+"*":bS;for(var bT=0,bR=bY.length;bT<bR;bT++){by(bS,bY[bT],bX,bW)}return by.filter(bU,bX)};by.attr=b.attr;by.selectors.attrMap={};b.find=by;b.expr=by.selectors;b.expr[":"]=b.expr.filters;b.unique=by.uniqueSort;b.text=by.getText;b.isXMLDoc=by.isXML;b.contains=by.contains})();var ab=/Until$/,aq=/^(?:parents|prevUntil|prevAll)/,a9=/,/,bp=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,H=b.expr.match.POS,ay={children:true,contents:true,next:true,prev:true};b.fn.extend({find:function(e){var bw=this,by,bv;if(typeof e!=="string"){return b(e).filter(function(){for(by=0,bv=bw.length;by<bv;by++){if(b.contains(bw[by],this)){return true}}})}var bx=this.pushStack("","find",e),bA,bB,bz;for(by=0,bv=this.length;by<bv;by++){bA=bx.length;b.find(e,this[by],bx);if(by>0){for(bB=bA;bB<bx.length;bB++){for(bz=0;bz<bA;bz++){if(bx[bz]===bx[bB]){bx.splice(bB--,1);break}}}}}return bx},has:function(bv){var e=b(bv);return this.filter(function(){for(var bx=0,bw=e.length;bx<bw;bx++){if(b.contains(this,e[bx])){return true}}})},not:function(e){return this.pushStack(aG(this,e,false),"not",e)},filter:function(e){return this.pushStack(aG(this,e,true),"filter",e)},is:function(e){return !!e&&(typeof e==="string"?H.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(by,bx){var bv=[],bw,e,bz=this[0];if(b.isArray(by)){var bB=1;while(bz&&bz.ownerDocument&&bz!==bx){for(bw=0;bw<by.length;bw++){if(b(bz).is(by[bw])){bv.push({selector:by[bw],elem:bz,level:bB})}}bz=bz.parentNode;bB++}return bv}var bA=H.test(by)||typeof by!=="string"?b(by,bx||this.context):0;for(bw=0,e=this.length;bw<e;bw++){bz=this[bw];while(bz){if(bA?bA.index(bz)>-1:b.find.matchesSelector(bz,by)){bv.push(bz);break}else{bz=bz.parentNode;if(!bz||!bz.ownerDocument||bz===bx||bz.nodeType===11){break}}}}bv=bv.length>1?b.unique(bv):bv;return this.pushStack(bv,"closest",by)},index:function(e){if(!e){return(this[0]&&this[0].parentNode)?this.prevAll().length:-1}if(typeof e==="string"){return b.inArray(this[0],b(e))}return b.inArray(e.jquery?e[0]:e,this)},add:function(e,bv){var bx=typeof e==="string"?b(e,bv):b.makeArray(e&&e.nodeType?[e]:e),bw=b.merge(this.get(),bx);return this.pushStack(C(bx[0])||C(bw[0])?bw:b.unique(bw))},andSelf:function(){return this.add(this.prevObject)}});function C(e){return !e||!e.parentNode||e.parentNode.nodeType===11}b.each({parent:function(bv){var e=bv.parentNode;return e&&e.nodeType!==11?e:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(bv,e,bw){return b.dir(bv,"parentNode",bw)},next:function(e){return b.nth(e,2,"nextSibling")},prev:function(e){return b.nth(e,2,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(bv,e,bw){return b.dir(bv,"nextSibling",bw)},prevUntil:function(bv,e,bw){return b.dir(bv,"previousSibling",bw)},siblings:function(e){return b.sibling(e.parentNode.firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.makeArray(e.childNodes)}},function(e,bv){b.fn[e]=function(by,bw){var bx=b.map(this,bv,by);if(!ab.test(e)){bw=by}if(bw&&typeof bw==="string"){bx=b.filter(bw,bx)}bx=this.length>1&&!ay[e]?b.unique(bx):bx;if((this.length>1||a9.test(bw))&&aq.test(e)){bx=bx.reverse()}return this.pushStack(bx,e,P.call(arguments).join(","))}});b.extend({filter:function(bw,e,bv){if(bv){bw=":not("+bw+")"}return e.length===1?b.find.matchesSelector(e[0],bw)?[e[0]]:[]:b.find.matches(bw,e)},dir:function(bw,bv,by){var e=[],bx=bw[bv];while(bx&&bx.nodeType!==9&&(by===L||bx.nodeType!==1||!b(bx).is(by))){if(bx.nodeType===1){e.push(bx)}bx=bx[bv]}return e},nth:function(by,e,bw,bx){e=e||1;var bv=0;for(;by;by=by[bw]){if(by.nodeType===1&&++bv===e){break}}return by},sibling:function(bw,bv){var e=[];for(;bw;bw=bw.nextSibling){if(bw.nodeType===1&&bw!==bv){e.push(bw)}}return e}});function aG(bx,bw,e){bw=bw||0;if(b.isFunction(bw)){return b.grep(bx,function(bz,by){var bA=!!bw.call(bz,by,bz);return bA===e})}else{if(bw.nodeType){return b.grep(bx,function(bz,by){return(bz===bw)===e})}else{if(typeof bw==="string"){var bv=b.grep(bx,function(by){return by.nodeType===1});if(bp.test(bw)){return b.filter(bw,bv,!e)}else{bw=b.filter(bw,bv)}}}}return b.grep(bx,function(bz,by){return(b.inArray(bz,bw)>=0)===e})}function a(e){var bw=aR.split("|"),bv=e.createDocumentFragment();if(bv.createElement){while(bw.length){bv.createElement(bw.pop())}}return bv}var aR="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ag=/ jQuery\d+="(?:\d+|null)"/g,ar=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,d=/<([\w:]+)/,w=/<tbody/i,W=/<|&#?\w+;/,ae=/<(?:script|style)/i,O=/<(?:script|object|embed|option|style)/i,ah=new RegExp("<(?:"+aR+")","i"),o=/checked\s*(?:[^=]|=\s*.checked.)/i,bm=/\/(java|ecma)script/i,aN=/^\s*<!(?:\[CDATA\[|\-\-)/,ax={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},ac=a(av);ax.optgroup=ax.option;ax.tbody=ax.tfoot=ax.colgroup=ax.caption=ax.thead;ax.th=ax.td;if(!b.support.htmlSerialize){ax._default=[1,"div<div>","</div>"]}b.fn.extend({text:function(e){if(b.isFunction(e)){return this.each(function(bw){var bv=b(this);bv.text(e.call(this,bw,bv.text()))})}if(typeof e!=="object"&&e!==L){return this.empty().append((this[0]&&this[0].ownerDocument||av).createTextNode(e))}return b.text(this)},wrapAll:function(e){if(b.isFunction(e)){return this.each(function(bw){b(this).wrapAll(e.call(this,bw))})}if(this[0]){var bv=b(e,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){bv.insertBefore(this[0])}bv.map(function(){var bw=this;while(bw.firstChild&&bw.firstChild.nodeType===1){bw=bw.firstChild}return bw}).append(this)}return this},wrapInner:function(e){if(b.isFunction(e)){return this.each(function(bv){b(this).wrapInner(e.call(this,bv))})}return this.each(function(){var bv=b(this),bw=bv.contents();if(bw.length){bw.wrapAll(e)}else{bv.append(e)}})},wrap:function(e){var bv=b.isFunction(e);return this.each(function(bw){b(this).wrapAll(bv?e.call(this,bw):e)})},unwrap:function(){return this.parent().each(function(){if(!b.nodeName(this,"body")){b(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.appendChild(e)}})},prepend:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.insertBefore(e,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this)})}else{if(arguments.length){var e=b.clean(arguments);e.push.apply(e,this.toArray());return this.pushStack(e,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this.nextSibling)})}else{if(arguments.length){var e=this.pushStack(this,"after",arguments);e.push.apply(e,b.clean(arguments));return e}}},remove:function(e,bx){for(var bv=0,bw;(bw=this[bv])!=null;bv++){if(!e||b.filter(e,[bw]).length){if(!bx&&bw.nodeType===1){b.cleanData(bw.getElementsByTagName("*"));b.cleanData([bw])}if(bw.parentNode){bw.parentNode.removeChild(bw)}}}return this},empty:function(){for(var e=0,bv;(bv=this[e])!=null;e++){if(bv.nodeType===1){b.cleanData(bv.getElementsByTagName("*"))}while(bv.firstChild){bv.removeChild(bv.firstChild)}}return this},clone:function(bv,e){bv=bv==null?false:bv;e=e==null?bv:e;return this.map(function(){return b.clone(this,bv,e)})},html:function(bx){if(bx===L){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(ag,""):null}else{if(typeof bx==="string"&&!ae.test(bx)&&(b.support.leadingWhitespace||!ar.test(bx))&&!ax[(d.exec(bx)||["",""])[1].toLowerCase()]){bx=bx.replace(R,"<$1></$2>");try{for(var bw=0,bv=this.length;bw<bv;bw++){if(this[bw].nodeType===1){b.cleanData(this[bw].getElementsByTagName("*"));this[bw].innerHTML=bx}}}catch(by){this.empty().append(bx)}}else{if(b.isFunction(bx)){this.each(function(bz){var e=b(this);e.html(bx.call(this,bz,e.html()))})}else{this.empty().append(bx)}}}return this},replaceWith:function(e){if(this[0]&&this[0].parentNode){if(b.isFunction(e)){return this.each(function(bx){var bw=b(this),bv=bw.html();bw.replaceWith(e.call(this,bx,bv))})}if(typeof e!=="string"){e=b(e).detach()}return this.each(function(){var bw=this.nextSibling,bv=this.parentNode;b(this).remove();if(bw){b(bw).before(e)}else{b(bv).append(e)}})}else{return this.length?this.pushStack(b(b.isFunction(e)?e():e),"replaceWith",e):this}},detach:function(e){return this.remove(e,true)},domManip:function(bB,bF,bE){var bx,by,bA,bD,bC=bB[0],bv=[];if(!b.support.checkClone&&arguments.length===3&&typeof bC==="string"&&o.test(bC)){return this.each(function(){b(this).domManip(bB,bF,bE,true)})}if(b.isFunction(bC)){return this.each(function(bH){var bG=b(this);bB[0]=bC.call(this,bH,bF?bG.html():L);bG.domManip(bB,bF,bE)})}if(this[0]){bD=bC&&bC.parentNode;if(b.support.parentNode&&bD&&bD.nodeType===11&&bD.childNodes.length===this.length){bx={fragment:bD}}else{bx=b.buildFragment(bB,this,bv)}bA=bx.fragment;if(bA.childNodes.length===1){by=bA=bA.firstChild}else{by=bA.firstChild}if(by){bF=bF&&b.nodeName(by,"tr");for(var bw=0,e=this.length,bz=e-1;bw<e;bw++){bE.call(bF?ba(this[bw],by):this[bw],bx.cacheable||(e>1&&bw<bz)?b.clone(bA,true,true):bA)}}if(bv.length){b.each(bv,bo)}}return this}});function ba(e,bv){return b.nodeName(e,"table")?(e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody"))):e}function t(bB,bv){if(bv.nodeType!==1||!b.hasData(bB)){return}var by,bx,e,bA=b._data(bB),bz=b._data(bv,bA),bw=bA.events;if(bw){delete bz.handle;bz.events={};for(by in bw){for(bx=0,e=bw[by].length;bx<e;bx++){b.event.add(bv,by+(bw[by][bx].namespace?".":"")+bw[by][bx].namespace,bw[by][bx],bw[by][bx].data)}}}if(bz.data){bz.data=b.extend({},bz.data)}}function ai(bv,e){var bw;if(e.nodeType!==1){return}if(e.clearAttributes){e.clearAttributes()}if(e.mergeAttributes){e.mergeAttributes(bv)}bw=e.nodeName.toLowerCase();if(bw==="object"){e.outerHTML=bv.outerHTML}else{if(bw==="input"&&(bv.type==="checkbox"||bv.type==="radio")){if(bv.checked){e.defaultChecked=e.checked=bv.checked}if(e.value!==bv.value){e.value=bv.value}}else{if(bw==="option"){e.selected=bv.defaultSelected}else{if(bw==="input"||bw==="textarea"){e.defaultValue=bv.defaultValue}}}}e.removeAttribute(b.expando)}b.buildFragment=function(bz,bx,bv){var by,e,bw,bA,bB=bz[0];if(bx&&bx[0]){bA=bx[0].ownerDocument||bx[0]}if(!bA.createDocumentFragment){bA=av}if(bz.length===1&&typeof bB==="string"&&bB.length<512&&bA===av&&bB.charAt(0)==="<"&&!O.test(bB)&&(b.support.checkClone||!o.test(bB))&&(b.support.html5Clone||!ah.test(bB))){e=true;bw=b.fragments[bB];if(bw&&bw!==1){by=bw}}if(!by){by=bA.createDocumentFragment();b.clean(bz,bA,by,bv)}if(e){b.fragments[bB]=bw?by:1}return{fragment:by,cacheable:e}};b.fragments={};b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,bv){b.fn[e]=function(bw){var bz=[],bC=b(bw),bB=this.length===1&&this[0].parentNode;if(bB&&bB.nodeType===11&&bB.childNodes.length===1&&bC.length===1){bC[bv](this[0]);return this}else{for(var bA=0,bx=bC.length;bA<bx;bA++){var by=(bA>0?this.clone(true):this).get();b(bC[bA])[bv](by);bz=bz.concat(by)}return this.pushStack(bz,e,bC.selector)}}});function bg(e){if(typeof e.getElementsByTagName!=="undefined"){return e.getElementsByTagName("*")}else{if(typeof e.querySelectorAll!=="undefined"){return e.querySelectorAll("*")}else{return[]}}}function az(e){if(e.type==="checkbox"||e.type==="radio"){e.defaultChecked=e.checked}}function E(e){var bv=(e.nodeName||"").toLowerCase();if(bv==="input"){az(e)}else{if(bv!=="script"&&typeof e.getElementsByTagName!=="undefined"){b.grep(e.getElementsByTagName("input"),az)}}}function al(e){var bv=av.createElement("div");ac.appendChild(bv);bv.innerHTML=e.outerHTML;return bv.firstChild}b.extend({clone:function(by,bA,bw){var e,bv,bx,bz=b.support.html5Clone||!ah.test("<"+by.nodeName)?by.cloneNode(true):al(by);if((!b.support.noCloneEvent||!b.support.noCloneChecked)&&(by.nodeType===1||by.nodeType===11)&&!b.isXMLDoc(by)){ai(by,bz);e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){if(bv[bx]){ai(e[bx],bv[bx])}}}if(bA){t(by,bz);if(bw){e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){t(e[bx],bv[bx])}}}e=bv=null;return bz},clean:function(bw,by,bH,bA){var bF;by=by||av;if(typeof by.createElement==="undefined"){by=by.ownerDocument||by[0]&&by[0].ownerDocument||av}var bI=[],bB;for(var bE=0,bz;(bz=bw[bE])!=null;bE++){if(typeof bz==="number"){bz+=""}if(!bz){continue}if(typeof bz==="string"){if(!W.test(bz)){bz=by.createTextNode(bz)}else{bz=bz.replace(R,"<$1></$2>");var bK=(d.exec(bz)||["",""])[1].toLowerCase(),bx=ax[bK]||ax._default,bD=bx[0],bv=by.createElement("div");if(by===av){ac.appendChild(bv)}else{a(by).appendChild(bv)}bv.innerHTML=bx[1]+bz+bx[2];while(bD--){bv=bv.lastChild}if(!b.support.tbody){var e=w.test(bz),bC=bK==="table"&&!e?bv.firstChild&&bv.firstChild.childNodes:bx[1]==="<table>"&&!e?bv.childNodes:[];for(bB=bC.length-1;bB>=0;--bB){if(b.nodeName(bC[bB],"tbody")&&!bC[bB].childNodes.length){bC[bB].parentNode.removeChild(bC[bB])}}}if(!b.support.leadingWhitespace&&ar.test(bz)){bv.insertBefore(by.createTextNode(ar.exec(bz)[0]),bv.firstChild)}bz=bv.childNodes}}var bG;if(!b.support.appendChecked){if(bz[0]&&typeof(bG=bz.length)==="number"){for(bB=0;bB<bG;bB++){E(bz[bB])}}else{E(bz)}}if(bz.nodeType){bI.push(bz)}else{bI=b.merge(bI,bz)}}if(bH){bF=function(bL){return !bL.type||bm.test(bL.type)};for(bE=0;bI[bE];bE++){if(bA&&b.nodeName(bI[bE],"script")&&(!bI[bE].type||bI[bE].type.toLowerCase()==="text/javascript")){bA.push(bI[bE].parentNode?bI[bE].parentNode.removeChild(bI[bE]):bI[bE])}else{if(bI[bE].nodeType===1){var bJ=b.grep(bI[bE].getElementsByTagName("script"),bF);bI.splice.apply(bI,[bE+1,0].concat(bJ))}bH.appendChild(bI[bE])}}}return bI},cleanData:function(bv){var by,bw,e=b.cache,bB=b.event.special,bA=b.support.deleteExpando;for(var bz=0,bx;(bx=bv[bz])!=null;bz++){if(bx.nodeName&&b.noData[bx.nodeName.toLowerCase()]){continue}bw=bx[b.expando];if(bw){by=e[bw];if(by&&by.events){for(var bC in by.events){if(bB[bC]){b.event.remove(bx,bC)}else{b.removeEvent(bx,bC,by.handle)}}if(by.handle){by.handle.elem=null}}if(bA){delete bx[b.expando]}else{if(bx.removeAttribute){bx.removeAttribute(b.expando)}}delete e[bw]}}}});function bo(e,bv){if(bv.src){b.ajax({url:bv.src,async:false,dataType:"script"})}else{b.globalEval((bv.text||bv.textContent||bv.innerHTML||"").replace(aN,"/*$0*/"))}if(bv.parentNode){bv.parentNode.removeChild(bv)}}var ak=/alpha\([^)]*\)/i,au=/opacity=([^)]*)/,z=/([A-Z]|^ms)/g,bc=/^-?\d+(?:px)?$/i,bn=/^-?\d/,I=/^([\-+])=([\-+.\de]+)/,a7={position:"absolute",visibility:"hidden",display:"block"},an=["Left","Right"],a1=["Top","Bottom"],Z,aI,aX;b.fn.css=function(e,bv){if(arguments.length===2&&bv===L){return this}return b.access(this,e,bv,true,function(bx,bw,by){return by!==L?b.style(bx,bw,by):b.css(bx,bw)})};b.extend({cssHooks:{opacity:{get:function(bw,bv){if(bv){var e=Z(bw,"opacity","opacity");return e===""?"1":e}else{return bw.style.opacity}}}},cssNumber:{fillOpacity:true,fontWeight:true,lineHeight:true,opacity:true,orphans:true,widows:true,zIndex:true,zoom:true},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(bx,bw,bD,by){if(!bx||bx.nodeType===3||bx.nodeType===8||!bx.style){return}var bB,bC,bz=b.camelCase(bw),bv=bx.style,bE=b.cssHooks[bz];bw=b.cssProps[bz]||bz;if(bD!==L){bC=typeof bD;if(bC==="string"&&(bB=I.exec(bD))){bD=(+(bB[1]+1)*+bB[2])+parseFloat(b.css(bx,bw));bC="number"}if(bD==null||bC==="number"&&isNaN(bD)){return}if(bC==="number"&&!b.cssNumber[bz]){bD+="px"}if(!bE||!("set" in bE)||(bD=bE.set(bx,bD))!==L){try{bv[bw]=bD}catch(bA){}}}else{if(bE&&"get" in bE&&(bB=bE.get(bx,false,by))!==L){return bB}return bv[bw]}},css:function(by,bx,bv){var bw,e;bx=b.camelCase(bx);e=b.cssHooks[bx];bx=b.cssProps[bx]||bx;if(bx==="cssFloat"){bx="float"}if(e&&"get" in e&&(bw=e.get(by,true,bv))!==L){return bw}else{if(Z){return Z(by,bx)}}},swap:function(bx,bw,by){var e={};for(var bv in bw){e[bv]=bx.style[bv];bx.style[bv]=bw[bv]}by.call(bx);for(bv in bw){bx.style[bv]=e[bv]}}});b.curCSS=b.css;b.each(["height","width"],function(bv,e){b.cssHooks[e]={get:function(by,bx,bw){var bz;if(bx){if(by.offsetWidth!==0){return p(by,e,bw)}else{b.swap(by,a7,function(){bz=p(by,e,bw)})}return bz}},set:function(bw,bx){if(bc.test(bx)){bx=parseFloat(bx);if(bx>=0){return bx+"px"}}else{return bx}}}});if(!b.support.opacity){b.cssHooks.opacity={get:function(bv,e){return au.test((e&&bv.currentStyle?bv.currentStyle.filter:bv.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":e?"1":""},set:function(by,bz){var bx=by.style,bv=by.currentStyle,e=b.isNumeric(bz)?"alpha(opacity="+bz*100+")":"",bw=bv&&bv.filter||bx.filter||"";bx.zoom=1;if(bz>=1&&b.trim(bw.replace(ak,""))===""){bx.removeAttribute("filter");if(bv&&!bv.filter){return}}bx.filter=ak.test(bw)?bw.replace(ak,e):bw+" "+e}}}b(function(){if(!b.support.reliableMarginRight){b.cssHooks.marginRight={get:function(bw,bv){var e;b.swap(bw,{display:"inline-block"},function(){if(bv){e=Z(bw,"margin-right","marginRight")}else{e=bw.style.marginRight}});return e}}}});if(av.defaultView&&av.defaultView.getComputedStyle){aI=function(by,bw){var bv,bx,e;bw=bw.replace(z,"-$1").toLowerCase();if((bx=by.ownerDocument.defaultView)&&(e=bx.getComputedStyle(by,null))){bv=e.getPropertyValue(bw);if(bv===""&&!b.contains(by.ownerDocument.documentElement,by)){bv=b.style(by,bw)}}return bv}}if(av.documentElement.currentStyle){aX=function(bz,bw){var bA,e,by,bv=bz.currentStyle&&bz.currentStyle[bw],bx=bz.style;if(bv===null&&bx&&(by=bx[bw])){bv=by}if(!bc.test(bv)&&bn.test(bv)){bA=bx.left;e=bz.runtimeStyle&&bz.runtimeStyle.left;if(e){bz.runtimeStyle.left=bz.currentStyle.left}bx.left=bw==="fontSize"?"1em":(bv||0);bv=bx.pixelLeft+"px";bx.left=bA;if(e){bz.runtimeStyle.left=e}}return bv===""?"auto":bv}}Z=aI||aX;function p(by,bw,bv){var bA=bw==="width"?by.offsetWidth:by.offsetHeight,bz=bw==="width"?an:a1,bx=0,e=bz.length;if(bA>0){if(bv!=="border"){for(;bx<e;bx++){if(!bv){bA-=parseFloat(b.css(by,"padding"+bz[bx]))||0}if(bv==="margin"){bA+=parseFloat(b.css(by,bv+bz[bx]))||0}else{bA-=parseFloat(b.css(by,"border"+bz[bx]+"Width"))||0}}}return bA+"px"}bA=Z(by,bw,bw);if(bA<0||bA==null){bA=by.style[bw]||0}bA=parseFloat(bA)||0;if(bv){for(;bx<e;bx++){bA+=parseFloat(b.css(by,"padding"+bz[bx]))||0;if(bv!=="padding"){bA+=parseFloat(b.css(by,"border"+bz[bx]+"Width"))||0}if(bv==="margin"){bA+=parseFloat(b.css(by,bv+bz[bx]))||0}}}return bA+"px"}if(b.expr&&b.expr.filters){b.expr.filters.hidden=function(bw){var bv=bw.offsetWidth,e=bw.offsetHeight;return(bv===0&&e===0)||(!b.support.reliableHiddenOffsets&&((bw.style&&bw.style.display)||b.css(bw,"display"))==="none")};b.expr.filters.visible=function(e){return !b.expr.filters.hidden(e)}}var k=/%20/g,ap=/\[\]$/,bs=/\r?\n/g,bq=/#.*$/,aD=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,aZ=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,aM=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,aQ=/^(?:GET|HEAD)$/,c=/^\/\//,M=/\?/,a6=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,q=/^(?:select|textarea)/i,h=/\s+/,br=/([?&])_=[^&]*/,K=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,A=b.fn.load,aa={},r={},aE,s,aV=["*/"]+["*"];try{aE=bl.href}catch(aw){aE=av.createElement("a");aE.href="";aE=aE.href}s=K.exec(aE.toLowerCase())||[];function f(e){return function(by,bA){if(typeof by!=="string"){bA=by;by="*"}if(b.isFunction(bA)){var bx=by.toLowerCase().split(h),bw=0,bz=bx.length,bv,bB,bC;for(;bw<bz;bw++){bv=bx[bw];bC=/^\+/.test(bv);if(bC){bv=bv.substr(1)||"*"}bB=e[bv]=e[bv]||[];bB[bC?"unshift":"push"](bA)}}}}function aW(bv,bE,bz,bD,bB,bx){bB=bB||bE.dataTypes[0];bx=bx||{};bx[bB]=true;var bA=bv[bB],bw=0,e=bA?bA.length:0,by=(bv===aa),bC;for(;bw<e&&(by||!bC);bw++){bC=bA[bw](bE,bz,bD);if(typeof bC==="string"){if(!by||bx[bC]){bC=L}else{bE.dataTypes.unshift(bC);bC=aW(bv,bE,bz,bD,bC,bx)}}}if((by||!bC)&&!bx["*"]){bC=aW(bv,bE,bz,bD,"*",bx)}return bC}function am(bw,bx){var bv,e,by=b.ajaxSettings.flatOptions||{};for(bv in bx){if(bx[bv]!==L){(by[bv]?bw:(e||(e={})))[bv]=bx[bv]}}if(e){b.extend(true,bw,e)}}b.fn.extend({load:function(bw,bz,bA){if(typeof bw!=="string"&&A){return A.apply(this,arguments)}else{if(!this.length){return this}}var by=bw.indexOf(" ");if(by>=0){var e=bw.slice(by,bw.length);bw=bw.slice(0,by)}var bx="GET";if(bz){if(b.isFunction(bz)){bA=bz;bz=L}else{if(typeof bz==="object"){bz=b.param(bz,b.ajaxSettings.traditional);bx="POST"}}}var bv=this;b.ajax({url:bw,type:bx,dataType:"html",data:bz,complete:function(bC,bB,bD){bD=bC.responseText;if(bC.isResolved()){bC.done(function(bE){bD=bE});bv.html(e?b("<div>").append(bD.replace(a6,"")).find(e):bD)}if(bA){bv.each(bA,[bD,bB,bC])}}});return this},serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?b.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||q.test(this.nodeName)||aZ.test(this.type))}).map(function(e,bv){var bw=b(this).val();return bw==null?null:b.isArray(bw)?b.map(bw,function(by,bx){return{name:bv.name,value:by.replace(bs,"\r\n")}}):{name:bv.name,value:bw.replace(bs,"\r\n")}}).get()}});b.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,bv){b.fn[bv]=function(bw){return this.on(bv,bw)}});b.each(["get","post"],function(e,bv){b[bv]=function(bw,by,bz,bx){if(b.isFunction(by)){bx=bx||bz;bz=by;by=L}return b.ajax({type:bv,url:bw,data:by,success:bz,dataType:bx})}});b.extend({getScript:function(e,bv){return b.get(e,L,bv,"script")},getJSON:function(e,bv,bw){return b.get(e,bv,bw,"json")},ajaxSetup:function(bv,e){if(e){am(bv,b.ajaxSettings)}else{e=bv;bv=b.ajaxSettings}am(bv,e);return bv},ajaxSettings:{url:aE,isLocal:aM.test(s[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":aV},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":bb.String,"text html":true,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{context:true,url:true}},ajaxPrefilter:f(aa),ajaxTransport:f(r),ajax:function(bz,bx){if(typeof bz==="object"){bx=bz;bz=L}bx=bx||{};var bD=b.ajaxSetup({},bx),bS=bD.context||bD,bG=bS!==bD&&(bS.nodeType||bS instanceof b)?b(bS):b.event,bR=b.Deferred(),bN=b.Callbacks("once memory"),bB=bD.statusCode||{},bC,bH={},bO={},bQ,by,bL,bE,bI,bA=0,bw,bK,bJ={readyState:0,setRequestHeader:function(bT,bU){if(!bA){var e=bT.toLowerCase();bT=bO[e]=bO[e]||bT;bH[bT]=bU}return this},getAllResponseHeaders:function(){return bA===2?bQ:null},getResponseHeader:function(bT){var e;if(bA===2){if(!by){by={};while((e=aD.exec(bQ))){by[e[1].toLowerCase()]=e[2]}}e=by[bT.toLowerCase()]}return e===L?null:e},overrideMimeType:function(e){if(!bA){bD.mimeType=e}return this},abort:function(e){e=e||"abort";if(bL){bL.abort(e)}bF(0,e);return this}};function bF(bZ,bU,b0,bW){if(bA===2){return}bA=2;if(bE){clearTimeout(bE)}bL=L;bQ=bW||"";bJ.readyState=bZ>0?4:0;var bT,b4,b3,bX=bU,bY=b0?bj(bD,bJ,b0):L,bV,b2;if(bZ>=200&&bZ<300||bZ===304){if(bD.ifModified){if((bV=bJ.getResponseHeader("Last-Modified"))){b.lastModified[bC]=bV}if((b2=bJ.getResponseHeader("Etag"))){b.etag[bC]=b2}}if(bZ===304){bX="notmodified";bT=true}else{try{b4=G(bD,bY);bX="success";bT=true}catch(b1){bX="parsererror";b3=b1}}}else{b3=bX;if(!bX||bZ){bX="error";if(bZ<0){bZ=0}}}bJ.status=bZ;bJ.statusText=""+(bU||bX);if(bT){bR.resolveWith(bS,[b4,bX,bJ])}else{bR.rejectWith(bS,[bJ,bX,b3])}bJ.statusCode(bB);bB=L;if(bw){bG.trigger("ajax"+(bT?"Success":"Error"),[bJ,bD,bT?b4:b3])}bN.fireWith(bS,[bJ,bX]);if(bw){bG.trigger("ajaxComplete",[bJ,bD]);if(!(--b.active)){b.event.trigger("ajaxStop")}}}bR.promise(bJ);bJ.success=bJ.done;bJ.error=bJ.fail;bJ.complete=bN.add;bJ.statusCode=function(bT){if(bT){var e;if(bA<2){for(e in bT){bB[e]=[bB[e],bT[e]]}}else{e=bT[bJ.status];bJ.then(e,e)}}return this};bD.url=((bz||bD.url)+"").replace(bq,"").replace(c,s[1]+"//");bD.dataTypes=b.trim(bD.dataType||"*").toLowerCase().split(h);if(bD.crossDomain==null){bI=K.exec(bD.url.toLowerCase());bD.crossDomain=!!(bI&&(bI[1]!=s[1]||bI[2]!=s[2]||(bI[3]||(bI[1]==="http:"?80:443))!=(s[3]||(s[1]==="http:"?80:443))))}if(bD.data&&bD.processData&&typeof bD.data!=="string"){bD.data=b.param(bD.data,bD.traditional)}aW(aa,bD,bx,bJ);if(bA===2){return false}bw=bD.global;bD.type=bD.type.toUpperCase();bD.hasContent=!aQ.test(bD.type);if(bw&&b.active++===0){b.event.trigger("ajaxStart")}if(!bD.hasContent){if(bD.data){bD.url+=(M.test(bD.url)?"&":"?")+bD.data;delete bD.data}bC=bD.url;if(bD.cache===false){var bv=b.now(),bP=bD.url.replace(br,"$1_="+bv);bD.url=bP+((bP===bD.url)?(M.test(bD.url)?"&":"?")+"_="+bv:"")}}if(bD.data&&bD.hasContent&&bD.contentType!==false||bx.contentType){bJ.setRequestHeader("Content-Type",bD.contentType)}if(bD.ifModified){bC=bC||bD.url;if(b.lastModified[bC]){bJ.setRequestHeader("If-Modified-Since",b.lastModified[bC])}if(b.etag[bC]){bJ.setRequestHeader("If-None-Match",b.etag[bC])}}bJ.setRequestHeader("Accept",bD.dataTypes[0]&&bD.accepts[bD.dataTypes[0]]?bD.accepts[bD.dataTypes[0]]+(bD.dataTypes[0]!=="*"?", "+aV+"; q=0.01":""):bD.accepts["*"]);for(bK in bD.headers){bJ.setRequestHeader(bK,bD.headers[bK])}if(bD.beforeSend&&(bD.beforeSend.call(bS,bJ,bD)===false||bA===2)){bJ.abort();return false}for(bK in {success:1,error:1,complete:1}){bJ[bK](bD[bK])}bL=aW(r,bD,bx,bJ);if(!bL){bF(-1,"No Transport")}else{bJ.readyState=1;if(bw){bG.trigger("ajaxSend",[bJ,bD])}if(bD.async&&bD.timeout>0){bE=setTimeout(function(){bJ.abort("timeout")},bD.timeout)}try{bA=1;bL.send(bH,bF)}catch(bM){if(bA<2){bF(-1,bM)}else{throw bM}}}return bJ},param:function(e,bw){var bv=[],by=function(bz,bA){bA=b.isFunction(bA)?bA():bA;bv[bv.length]=encodeURIComponent(bz)+"="+encodeURIComponent(bA)};if(bw===L){bw=b.ajaxSettings.traditional}if(b.isArray(e)||(e.jquery&&!b.isPlainObject(e))){b.each(e,function(){by(this.name,this.value)})}else{for(var bx in e){v(bx,e[bx],bw,by)}}return bv.join("&").replace(k,"+")}});function v(bw,by,bv,bx){if(b.isArray(by)){b.each(by,function(bA,bz){if(bv||ap.test(bw)){bx(bw,bz)}else{v(bw+"["+(typeof bz==="object"||b.isArray(bz)?bA:"")+"]",bz,bv,bx)}})}else{if(!bv&&by!=null&&typeof by==="object"){for(var e in by){v(bw+"["+e+"]",by[e],bv,bx)}}else{bx(bw,by)}}}b.extend({active:0,lastModified:{},etag:{}});function bj(bD,bC,bz){var bv=bD.contents,bB=bD.dataTypes,bw=bD.responseFields,by,bA,bx,e;for(bA in bw){if(bA in bz){bC[bw[bA]]=bz[bA]}}while(bB[0]==="*"){bB.shift();if(by===L){by=bD.mimeType||bC.getResponseHeader("content-type")}}if(by){for(bA in bv){if(bv[bA]&&bv[bA].test(by)){bB.unshift(bA);break}}}if(bB[0] in bz){bx=bB[0]}else{for(bA in bz){if(!bB[0]||bD.converters[bA+" "+bB[0]]){bx=bA;break}if(!e){e=bA}}bx=bx||e}if(bx){if(bx!==bB[0]){bB.unshift(bx)}return bz[bx]}}function G(bH,bz){if(bH.dataFilter){bz=bH.dataFilter(bz,bH.dataType)}var bD=bH.dataTypes,bG={},bA,bE,bw=bD.length,bB,bC=bD[0],bx,by,bF,bv,e;for(bA=1;bA<bw;bA++){if(bA===1){for(bE in bH.converters){if(typeof bE==="string"){bG[bE.toLowerCase()]=bH.converters[bE]}}}bx=bC;bC=bD[bA];if(bC==="*"){bC=bx}else{if(bx!=="*"&&bx!==bC){by=bx+" "+bC;bF=bG[by]||bG["* "+bC];if(!bF){e=L;for(bv in bG){bB=bv.split(" ");if(bB[0]===bx||bB[0]==="*"){e=bG[bB[1]+" "+bC];if(e){bv=bG[bv];if(bv===true){bF=e}else{if(e===true){bF=bv}}break}}}}if(!(bF||e)){b.error("No conversion from "+by.replace(" "," to "))}if(bF!==true){bz=bF?bF(bz):e(bv(bz))}}}}return bz}var aC=b.now(),u=/(\=)\?(&|$)|\?\?/i;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return b.expando+"_"+(aC++)}});b.ajaxPrefilter("json jsonp",function(bD,bA,bC){var bx=bD.contentType==="application/x-www-form-urlencoded"&&(typeof bD.data==="string");if(bD.dataTypes[0]==="jsonp"||bD.jsonp!==false&&(u.test(bD.url)||bx&&u.test(bD.data))){var bB,bw=bD.jsonpCallback=b.isFunction(bD.jsonpCallback)?bD.jsonpCallback():bD.jsonpCallback,bz=bb[bw],e=bD.url,by=bD.data,bv="$1"+bw+"$2";if(bD.jsonp!==false){e=e.replace(u,bv);if(bD.url===e){if(bx){by=by.replace(u,bv)}if(bD.data===by){e+=(/\?/.test(e)?"&":"?")+bD.jsonp+"="+bw}}}bD.url=e;bD.data=by;bb[bw]=function(bE){bB=[bE]};bC.always(function(){bb[bw]=bz;if(bB&&b.isFunction(bz)){bb[bw](bB[0])}});bD.converters["script json"]=function(){if(!bB){b.error(bw+" was not called")}return bB[0]};bD.dataTypes[0]="json";return"script"}});b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){b.globalEval(e);return e}}});b.ajaxPrefilter("script",function(e){if(e.cache===L){e.cache=false}if(e.crossDomain){e.type="GET";e.global=false}});b.ajaxTransport("script",function(bw){if(bw.crossDomain){var e,bv=av.head||av.getElementsByTagName("head")[0]||av.documentElement;return{send:function(bx,by){e=av.createElement("script");e.async="async";if(bw.scriptCharset){e.charset=bw.scriptCharset}e.src=bw.url;e.onload=e.onreadystatechange=function(bA,bz){if(bz||!e.readyState||/loaded|complete/.test(e.readyState)){e.onload=e.onreadystatechange=null;if(bv&&e.parentNode){bv.removeChild(e)}e=L;if(!bz){by(200,"success")}}};bv.insertBefore(e,bv.firstChild)},abort:function(){if(e){e.onload(0,1)}}}}});var B=bb.ActiveXObject?function(){for(var e in N){N[e](0,1)}}:false,y=0,N;function aL(){try{return new bb.XMLHttpRequest()}catch(bv){}}function aj(){try{return new bb.ActiveXObject("Microsoft.XMLHTTP")}catch(bv){}}b.ajaxSettings.xhr=bb.ActiveXObject?function(){return !this.isLocal&&aL()||aj()}:aL;(function(e){b.extend(b.support,{ajax:!!e,cors:!!e&&("withCredentials" in e)})})(b.ajaxSettings.xhr());if(b.support.ajax){b.ajaxTransport(function(e){if(!e.crossDomain||b.support.cors){var bv;return{send:function(bB,bw){var bA=e.xhr(),bz,by;if(e.username){bA.open(e.type,e.url,e.async,e.username,e.password)}else{bA.open(e.type,e.url,e.async)}if(e.xhrFields){for(by in e.xhrFields){bA[by]=e.xhrFields[by]}}if(e.mimeType&&bA.overrideMimeType){bA.overrideMimeType(e.mimeType)}if(!e.crossDomain&&!bB["X-Requested-With"]){bB["X-Requested-With"]="XMLHttpRequest"}try{for(by in bB){bA.setRequestHeader(by,bB[by])}}catch(bx){}bA.send((e.hasContent&&e.data)||null);bv=function(bK,bE){var bF,bD,bC,bI,bH;try{if(bv&&(bE||bA.readyState===4)){bv=L;if(bz){bA.onreadystatechange=b.noop;if(B){delete N[bz]}}if(bE){if(bA.readyState!==4){bA.abort()}}else{bF=bA.status;bC=bA.getAllResponseHeaders();bI={};bH=bA.responseXML;if(bH&&bH.documentElement){bI.xml=bH}bI.text=bA.responseText;try{bD=bA.statusText}catch(bJ){bD=""}if(!bF&&e.isLocal&&!e.crossDomain){bF=bI.text?200:404}else{if(bF===1223){bF=204}}}}}catch(bG){if(!bE){bw(-1,bG)}}if(bI){bw(bF,bD,bI,bC)}};if(!e.async||bA.readyState===4){bv()}else{bz=++y;if(B){if(!N){N={};b(bb).unload(B)}N[bz]=bv}bA.onreadystatechange=bv}},abort:function(){if(bv){bv(0,1)}}}}})}var Q={},a8,m,aB=/^(?:toggle|show|hide)$/,aT=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,a3,aH=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],a4;b.fn.extend({show:function(bx,bA,bz){var bw,by;if(bx||bx===0){return this.animate(a0("show",3),bx,bA,bz)}else{for(var bv=0,e=this.length;bv<e;bv++){bw=this[bv];if(bw.style){by=bw.style.display;if(!b._data(bw,"olddisplay")&&by==="none"){by=bw.style.display=""}if(by===""&&b.css(bw,"display")==="none"){b._data(bw,"olddisplay",x(bw.nodeName))}}}for(bv=0;bv<e;bv++){bw=this[bv];if(bw.style){by=bw.style.display;if(by===""||by==="none"){bw.style.display=b._data(bw,"olddisplay")||""}}}return this}},hide:function(bx,bA,bz){if(bx||bx===0){return this.animate(a0("hide",3),bx,bA,bz)}else{var bw,by,bv=0,e=this.length;for(;bv<e;bv++){bw=this[bv];if(bw.style){by=b.css(bw,"display");if(by!=="none"&&!b._data(bw,"olddisplay")){b._data(bw,"olddisplay",by)}}}for(bv=0;bv<e;bv++){if(this[bv].style){this[bv].style.display="none"}}return this}},_toggle:b.fn.toggle,toggle:function(bw,bv,bx){var e=typeof bw==="boolean";if(b.isFunction(bw)&&b.isFunction(bv)){this._toggle.apply(this,arguments)}else{if(bw==null||e){this.each(function(){var by=e?bw:b(this).is(":hidden");b(this)[by?"show":"hide"]()})}else{this.animate(a0("toggle",3),bw,bv,bx)}}return this},fadeTo:function(e,bx,bw,bv){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:bx},e,bw,bv)},animate:function(bz,bw,by,bx){var e=b.speed(bw,by,bx);if(b.isEmptyObject(bz)){return this.each(e.complete,[false])}bz=b.extend({},bz);function bv(){if(e.queue===false){b._mark(this)}var bE=b.extend({},e),bK=this.nodeType===1,bI=bK&&b(this).is(":hidden"),bB,bF,bD,bJ,bH,bC,bG,bL,bA;bE.animatedProperties={};for(bD in bz){bB=b.camelCase(bD);if(bD!==bB){bz[bB]=bz[bD];delete bz[bD]}bF=bz[bB];if(b.isArray(bF)){bE.animatedProperties[bB]=bF[1];bF=bz[bB]=bF[0]}else{bE.animatedProperties[bB]=bE.specialEasing&&bE.specialEasing[bB]||bE.easing||"swing"}if(bF==="hide"&&bI||bF==="show"&&!bI){return bE.complete.call(this)}if(bK&&(bB==="height"||bB==="width")){bE.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(b.css(this,"display")==="inline"&&b.css(this,"float")==="none"){if(!b.support.inlineBlockNeedsLayout||x(this.nodeName)==="inline"){this.style.display="inline-block"}else{this.style.zoom=1}}}}if(bE.overflow!=null){this.style.overflow="hidden"}for(bD in bz){bJ=new b.fx(this,bE,bD);bF=bz[bD];if(aB.test(bF)){bA=b._data(this,"toggle"+bD)||(bF==="toggle"?bI?"show":"hide":0);if(bA){b._data(this,"toggle"+bD,bA==="show"?"hide":"show");bJ[bA]()}else{bJ[bF]()}}else{bH=aT.exec(bF);bC=bJ.cur();if(bH){bG=parseFloat(bH[2]);bL=bH[3]||(b.cssNumber[bD]?"":"px");if(bL!=="px"){b.style(this,bD,(bG||1)+bL);bC=((bG||1)/bJ.cur())*bC;b.style(this,bD,bC+bL)}if(bH[1]){bG=((bH[1]==="-="?-1:1)*bG)+bC}bJ.custom(bC,bG,bL)}else{bJ.custom(bC,bF,"")}}}return true}return e.queue===false?this.each(bv):this.queue(e.queue,bv)},stop:function(bw,bv,e){if(typeof bw!=="string"){e=bv;bv=bw;bw=L}if(bv&&bw!==false){this.queue(bw||"fx",[])}return this.each(function(){var bx,by=false,bA=b.timers,bz=b._data(this);if(!e){b._unmark(true,this)}function bB(bE,bF,bD){var bC=bF[bD];b.removeData(bE,bD,true);bC.stop(e)}if(bw==null){for(bx in bz){if(bz[bx]&&bz[bx].stop&&bx.indexOf(".run")===bx.length-4){bB(this,bz,bx)}}}else{if(bz[bx=bw+".run"]&&bz[bx].stop){bB(this,bz,bx)}}for(bx=bA.length;bx--;){if(bA[bx].elem===this&&(bw==null||bA[bx].queue===bw)){if(e){bA[bx](true)}else{bA[bx].saveState()}by=true;bA.splice(bx,1)}}if(!(e&&by)){b.dequeue(this,bw)}})}});function bh(){setTimeout(at,0);return(a4=b.now())}function at(){a4=L}function a0(bv,e){var bw={};b.each(aH.concat.apply([],aH.slice(0,e)),function(){bw[this]=bv});return bw}b.each({slideDown:a0("show",1),slideUp:a0("hide",1),slideToggle:a0("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,bv){b.fn[e]=function(bw,by,bx){return this.animate(bv,bw,by,bx)}});b.extend({speed:function(bw,bx,bv){var e=bw&&typeof bw==="object"?b.extend({},bw):{complete:bv||!bv&&bx||b.isFunction(bw)&&bw,duration:bw,easing:bv&&bx||bx&&!b.isFunction(bx)&&bx};e.duration=b.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in b.fx.speeds?b.fx.speeds[e.duration]:b.fx.speeds._default;if(e.queue==null||e.queue===true){e.queue="fx"}e.old=e.complete;e.complete=function(by){if(b.isFunction(e.old)){e.old.call(this)}if(e.queue){b.dequeue(this,e.queue)}else{if(by!==false){b._unmark(this)}}};return e},easing:{linear:function(bw,bx,e,bv){return e+bv*bw},swing:function(bw,bx,e,bv){return((-Math.cos(bw*Math.PI)/2)+0.5)*bv+e}},timers:[],fx:function(bv,e,bw){this.options=e;this.elem=bv;this.prop=bw;e.orig=e.orig||{}}});b.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(b.fx.step[this.prop]||b.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var e,bv=b.css(this.elem,this.prop);return isNaN(e=parseFloat(bv))?!bv||bv==="auto"?0:bv:e},custom:function(bz,by,bx){var e=this,bw=b.fx;this.startTime=a4||bh();this.end=by;this.now=this.start=bz;this.pos=this.state=0;this.unit=bx||this.unit||(b.cssNumber[this.prop]?"":"px");function bv(bA){return e.step(bA)}bv.queue=this.options.queue;bv.elem=this.elem;bv.saveState=function(){if(e.options.hide&&b._data(e.elem,"fxshow"+e.prop)===L){b._data(e.elem,"fxshow"+e.prop,e.start)}};if(bv()&&b.timers.push(bv)&&!a3){a3=setInterval(bw.tick,bw.interval)}},show:function(){var e=b._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=e||b.style(this.elem,this.prop);this.options.show=true;if(e!==L){this.custom(this.cur(),e)}else{this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur())}b(this.elem).show()},hide:function(){this.options.orig[this.prop]=b._data(this.elem,"fxshow"+this.prop)||b.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(by){var bA,bB,bv,bx=a4||bh(),e=true,bz=this.elem,bw=this.options;if(by||bx>=bw.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();bw.animatedProperties[this.prop]=true;for(bA in bw.animatedProperties){if(bw.animatedProperties[bA]!==true){e=false}}if(e){if(bw.overflow!=null&&!b.support.shrinkWrapBlocks){b.each(["","X","Y"],function(bC,bD){bz.style["overflow"+bD]=bw.overflow[bC]})}if(bw.hide){b(bz).hide()}if(bw.hide||bw.show){for(bA in bw.animatedProperties){b.style(bz,bA,bw.orig[bA]);b.removeData(bz,"fxshow"+bA,true);b.removeData(bz,"toggle"+bA,true)}}bv=bw.complete;if(bv){bw.complete=false;bv.call(bz)}}return false}else{if(bw.duration==Infinity){this.now=bx}else{bB=bx-this.startTime;this.state=bB/bw.duration;this.pos=b.easing[bw.animatedProperties[this.prop]](this.state,bB,0,1,bw.duration);this.now=this.start+((this.end-this.start)*this.pos)}this.update()}return true}};b.extend(b.fx,{tick:function(){var bw,bv=b.timers,e=0;for(;e<bv.length;e++){bw=bv[e];if(!bw()&&bv[e]===bw){bv.splice(e--,1)}}if(!bv.length){b.fx.stop()}},interval:13,stop:function(){clearInterval(a3);a3=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(e){b.style(e.elem,"opacity",e.now)},_default:function(e){if(e.elem.style&&e.elem.style[e.prop]!=null){e.elem.style[e.prop]=e.now+e.unit}else{e.elem[e.prop]=e.now}}}});b.each(["width","height"],function(e,bv){b.fx.step[bv]=function(bw){b.style(bw.elem,bv,Math.max(0,bw.now)+bw.unit)}});if(b.expr&&b.expr.filters){b.expr.filters.animated=function(e){return b.grep(b.timers,function(bv){return e===bv.elem}).length}}function x(bx){if(!Q[bx]){var e=av.body,bv=b("<"+bx+">").appendTo(e),bw=bv.css("display");bv.remove();if(bw==="none"||bw===""){if(!a8){a8=av.createElement("iframe");a8.frameBorder=a8.width=a8.height=0}e.appendChild(a8);if(!m||!a8.createElement){m=(a8.contentWindow||a8.contentDocument).document;m.write((av.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>");m.close()}bv=m.createElement(bx);m.body.appendChild(bv);bw=b.css(bv,"display");e.removeChild(a8)}Q[bx]=bw}return Q[bx]}var V=/^t(?:able|d|h)$/i,ad=/^(?:body|html)$/i;if("getBoundingClientRect" in av.documentElement){b.fn.offset=function(bI){var by=this[0],bB;if(bI){return this.each(function(e){b.offset.setOffset(this,bI,e)})}if(!by||!by.ownerDocument){return null}if(by===by.ownerDocument.body){return b.offset.bodyOffset(by)}try{bB=by.getBoundingClientRect()}catch(bF){}var bH=by.ownerDocument,bw=bH.documentElement;if(!bB||!b.contains(bw,by)){return bB?{top:bB.top,left:bB.left}:{top:0,left:0}}var bC=bH.body,bD=aK(bH),bA=bw.clientTop||bC.clientTop||0,bE=bw.clientLeft||bC.clientLeft||0,bv=bD.pageYOffset||b.support.boxModel&&bw.scrollTop||bC.scrollTop,bz=bD.pageXOffset||b.support.boxModel&&bw.scrollLeft||bC.scrollLeft,bG=bB.top+bv-bA,bx=bB.left+bz-bE;return{top:bG,left:bx}}}else{b.fn.offset=function(bF){var bz=this[0];if(bF){return this.each(function(bG){b.offset.setOffset(this,bF,bG)})}if(!bz||!bz.ownerDocument){return null}if(bz===bz.ownerDocument.body){return b.offset.bodyOffset(bz)}var bC,bw=bz.offsetParent,bv=bz,bE=bz.ownerDocument,bx=bE.documentElement,bA=bE.body,bB=bE.defaultView,e=bB?bB.getComputedStyle(bz,null):bz.currentStyle,bD=bz.offsetTop,by=bz.offsetLeft;while((bz=bz.parentNode)&&bz!==bA&&bz!==bx){if(b.support.fixedPosition&&e.position==="fixed"){break}bC=bB?bB.getComputedStyle(bz,null):bz.currentStyle;bD-=bz.scrollTop;by-=bz.scrollLeft;if(bz===bw){bD+=bz.offsetTop;by+=bz.offsetLeft;if(b.support.doesNotAddBorder&&!(b.support.doesAddBorderForTableAndCells&&V.test(bz.nodeName))){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}bv=bw;bw=bz.offsetParent}if(b.support.subtractsBorderForOverflowNotVisible&&bC.overflow!=="visible"){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}e=bC}if(e.position==="relative"||e.position==="static"){bD+=bA.offsetTop;by+=bA.offsetLeft}if(b.support.fixedPosition&&e.position==="fixed"){bD+=Math.max(bx.scrollTop,bA.scrollTop);by+=Math.max(bx.scrollLeft,bA.scrollLeft)}return{top:bD,left:by}}}b.offset={bodyOffset:function(e){var bw=e.offsetTop,bv=e.offsetLeft;if(b.support.doesNotIncludeMarginInBodyOffset){bw+=parseFloat(b.css(e,"marginTop"))||0;bv+=parseFloat(b.css(e,"marginLeft"))||0}return{top:bw,left:bv}},setOffset:function(bx,bG,bA){var bB=b.css(bx,"position");if(bB==="static"){bx.style.position="relative"}var bz=b(bx),bv=bz.offset(),e=b.css(bx,"top"),bE=b.css(bx,"left"),bF=(bB==="absolute"||bB==="fixed")&&b.inArray("auto",[e,bE])>-1,bD={},bC={},bw,by;if(bF){bC=bz.position();bw=bC.top;by=bC.left}else{bw=parseFloat(e)||0;by=parseFloat(bE)||0}if(b.isFunction(bG)){bG=bG.call(bx,bA,bv)}if(bG.top!=null){bD.top=(bG.top-bv.top)+bw}if(bG.left!=null){bD.left=(bG.left-bv.left)+by}if("using" in bG){bG.using.call(bx,bD)}else{bz.css(bD)}}};b.fn.extend({position:function(){if(!this[0]){return null}var bw=this[0],bv=this.offsetParent(),bx=this.offset(),e=ad.test(bv[0].nodeName)?{top:0,left:0}:bv.offset();bx.top-=parseFloat(b.css(bw,"marginTop"))||0;bx.left-=parseFloat(b.css(bw,"marginLeft"))||0;e.top+=parseFloat(b.css(bv[0],"borderTopWidth"))||0;e.left+=parseFloat(b.css(bv[0],"borderLeftWidth"))||0;return{top:bx.top-e.top,left:bx.left-e.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||av.body;while(e&&(!ad.test(e.nodeName)&&b.css(e,"position")==="static")){e=e.offsetParent}return e})}});b.each(["Left","Top"],function(bv,e){var bw="scroll"+e;b.fn[bw]=function(bz){var bx,by;if(bz===L){bx=this[0];if(!bx){return null}by=aK(bx);return by?("pageXOffset" in by)?by[bv?"pageYOffset":"pageXOffset"]:b.support.boxModel&&by.document.documentElement[bw]||by.document.body[bw]:bx[bw]}return this.each(function(){by=aK(this);if(by){by.scrollTo(!bv?bz:b(by).scrollLeft(),bv?bz:b(by).scrollTop())}else{this[bw]=bz}})}});function aK(e){return b.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:false}b.each(["Height","Width"],function(bv,e){var bw=e.toLowerCase();b.fn["inner"+e]=function(){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,"padding")):this[bw]():null};b.fn["outer"+e]=function(by){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,by?"margin":"border")):this[bw]():null};b.fn[bw]=function(bz){var bA=this[0];if(!bA){return bz==null?null:this}if(b.isFunction(bz)){return this.each(function(bE){var bD=b(this);bD[bw](bz.call(this,bE,bD[bw]()))})}if(b.isWindow(bA)){var bB=bA.document.documentElement["client"+e],bx=bA.document.body;return bA.document.compatMode==="CSS1Compat"&&bB||bx&&bx["client"+e]||bB}else{if(bA.nodeType===9){return Math.max(bA.documentElement["client"+e],bA.body["scroll"+e],bA.documentElement["scroll"+e],bA.body["offset"+e],bA.documentElement["offset"+e])}else{if(bz===L){var bC=b.css(bA,bw),by=parseFloat(bC);return b.isNumeric(by)?by:bC}else{return this.css(bw,typeof bz==="string"?bz:bz+"px")}}}}});bb.jQuery=bb.$=b;if(typeof define==="function"&&define.amd&&define.amd.jQuery){define("jquery",[],function(){return b})}})(window);/*!
+(function(){var bH=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,bC="sizcache"+(Math.random()+"").replace(".",""),bI=0,bL=Object.prototype.toString,bB=false,bA=true,bK=/\\/g,bO=/\r\n/g,bQ=/\W/;[0,0].sort(function(){bA=false;return 0});var by=function(bV,e,bY,bZ){bY=bY||[];e=e||av;var b1=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!bV||typeof bV!=="string"){return bY}var bS,b3,b6,bR,b2,b5,b4,bX,bU=true,bT=by.isXML(e),bW=[],b0=bV;do{bH.exec("");bS=bH.exec(b0);if(bS){b0=bS[3];bW.push(bS[1]);if(bS[2]){bR=bS[3];break}}}while(bS);if(bW.length>1&&bD.exec(bV)){if(bW.length===2&&bE.relative[bW[0]]){b3=bM(bW[0]+bW[1],e,bZ)}else{b3=bE.relative[bW[0]]?[e]:by(bW.shift(),e);while(bW.length){bV=bW.shift();if(bE.relative[bV]){bV+=bW.shift()}b3=bM(bV,b3,bZ)}}}else{if(!bZ&&bW.length>1&&e.nodeType===9&&!bT&&bE.match.ID.test(bW[0])&&!bE.match.ID.test(bW[bW.length-1])){b2=by.find(bW.shift(),e,bT);e=b2.expr?by.filter(b2.expr,b2.set)[0]:b2.set[0]}if(e){b2=bZ?{expr:bW.pop(),set:bF(bZ)}:by.find(bW.pop(),bW.length===1&&(bW[0]==="~"||bW[0]==="+")&&e.parentNode?e.parentNode:e,bT);b3=b2.expr?by.filter(b2.expr,b2.set):b2.set;if(bW.length>0){b6=bF(b3)}else{bU=false}while(bW.length){b5=bW.pop();b4=b5;if(!bE.relative[b5]){b5=""}else{b4=bW.pop()}if(b4==null){b4=e}bE.relative[b5](b6,b4,bT)}}else{b6=bW=[]}}if(!b6){b6=b3}if(!b6){by.error(b5||bV)}if(bL.call(b6)==="[object Array]"){if(!bU){bY.push.apply(bY,b6)}else{if(e&&e.nodeType===1){for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&(b6[bX]===true||b6[bX].nodeType===1&&by.contains(e,b6[bX]))){bY.push(b3[bX])}}}else{for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&b6[bX].nodeType===1){bY.push(b3[bX])}}}}}else{bF(b6,bY)}if(bR){by(bR,b1,bY,bZ);by.uniqueSort(bY)}return bY};by.uniqueSort=function(bR){if(bJ){bB=bA;bR.sort(bJ);if(bB){for(var e=1;e<bR.length;e++){if(bR[e]===bR[e-1]){bR.splice(e--,1)}}}}return bR};by.matches=function(e,bR){return by(e,null,null,bR)};by.matchesSelector=function(e,bR){return by(bR,null,null,[e]).length>0};by.find=function(bX,e,bY){var bW,bS,bU,bT,bV,bR;if(!bX){return[]}for(bS=0,bU=bE.order.length;bS<bU;bS++){bV=bE.order[bS];if((bT=bE.leftMatch[bV].exec(bX))){bR=bT[1];bT.splice(1,1);if(bR.substr(bR.length-1)!=="\\"){bT[1]=(bT[1]||"").replace(bK,"");bW=bE.find[bV](bT,e,bY);if(bW!=null){bX=bX.replace(bE.match[bV],"");break}}}}if(!bW){bW=typeof e.getElementsByTagName!=="undefined"?e.getElementsByTagName("*"):[]}return{set:bW,expr:bX}};by.filter=function(b1,b0,b4,bU){var bW,e,bZ,b6,b3,bR,bT,bV,b2,bS=b1,b5=[],bY=b0,bX=b0&&b0[0]&&by.isXML(b0[0]);while(b1&&b0.length){for(bZ in bE.filter){if((bW=bE.leftMatch[bZ].exec(b1))!=null&&bW[2]){bR=bE.filter[bZ];bT=bW[1];e=false;bW.splice(1,1);if(bT.substr(bT.length-1)==="\\"){continue}if(bY===b5){b5=[]}if(bE.preFilter[bZ]){bW=bE.preFilter[bZ](bW,bY,b4,b5,bU,bX);if(!bW){e=b6=true}else{if(bW===true){continue}}}if(bW){for(bV=0;(b3=bY[bV])!=null;bV++){if(b3){b6=bR(b3,bW,bV,bY);b2=bU^b6;if(b4&&b6!=null){if(b2){e=true}else{bY[bV]=false}}else{if(b2){b5.push(b3);e=true}}}}}if(b6!==L){if(!b4){bY=b5}b1=b1.replace(bE.match[bZ],"");if(!e){return[]}break}}}if(b1===bS){if(e==null){by.error(b1)}else{break}}bS=b1}return bY};by.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)};var bw=by.getText=function(bU){var bS,bT,e=bU.nodeType,bR="";if(e){if(e===1||e===9){if(typeof bU.textContent==="string"){return bU.textContent}else{if(typeof bU.innerText==="string"){return bU.innerText.replace(bO,"")}else{for(bU=bU.firstChild;bU;bU=bU.nextSibling){bR+=bw(bU)}}}}else{if(e===3||e===4){return bU.nodeValue}}}else{for(bS=0;(bT=bU[bS]);bS++){if(bT.nodeType!==8){bR+=bw(bT)}}}return bR};var bE=by.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")},type:function(e){return e.getAttribute("type")}},relative:{"+":function(bW,bR){var bT=typeof bR==="string",bV=bT&&!bQ.test(bR),bX=bT&&!bV;if(bV){bR=bR.toLowerCase()}for(var bS=0,e=bW.length,bU;bS<e;bS++){if((bU=bW[bS])){while((bU=bU.previousSibling)&&bU.nodeType!==1){}bW[bS]=bX||bU&&bU.nodeName.toLowerCase()===bR?bU||false:bU===bR}}if(bX){by.filter(bR,bW,true)}},">":function(bW,bR){var bV,bU=typeof bR==="string",bS=0,e=bW.length;if(bU&&!bQ.test(bR)){bR=bR.toLowerCase();for(;bS<e;bS++){bV=bW[bS];if(bV){var bT=bV.parentNode;bW[bS]=bT.nodeName.toLowerCase()===bR?bT:false}}}else{for(;bS<e;bS++){bV=bW[bS];if(bV){bW[bS]=bU?bV.parentNode:bV.parentNode===bR}}if(bU){by.filter(bR,bW,true)}}},"":function(bT,bR,bV){var bU,bS=bI++,e=bN;if(typeof bR==="string"&&!bQ.test(bR)){bR=bR.toLowerCase();bU=bR;e=bv}e("parentNode",bR,bS,bT,bU,bV)},"~":function(bT,bR,bV){var bU,bS=bI++,e=bN;if(typeof bR==="string"&&!bQ.test(bR)){bR=bR.toLowerCase();bU=bR;e=bv}e("previousSibling",bR,bS,bT,bU,bV)}},find:{ID:function(bR,bS,bT){if(typeof bS.getElementById!=="undefined"&&!bT){var e=bS.getElementById(bR[1]);return e&&e.parentNode?[e]:[]}},NAME:function(bS,bV){if(typeof bV.getElementsByName!=="undefined"){var bR=[],bU=bV.getElementsByName(bS[1]);for(var bT=0,e=bU.length;bT<e;bT++){if(bU[bT].getAttribute("name")===bS[1]){bR.push(bU[bT])}}return bR.length===0?null:bR}},TAG:function(e,bR){if(typeof bR.getElementsByTagName!=="undefined"){return bR.getElementsByTagName(e[1])}}},preFilter:{CLASS:function(bT,bR,bS,e,bW,bX){bT=" "+bT[1].replace(bK,"")+" ";if(bX){return bT}for(var bU=0,bV;(bV=bR[bU])!=null;bU++){if(bV){if(bW^(bV.className&&(" "+bV.className+" ").replace(/[\t\n\r]/g," ").indexOf(bT)>=0)){if(!bS){e.push(bV)}}else{if(bS){bR[bU]=false}}}}return false},ID:function(e){return e[1].replace(bK,"")},TAG:function(bR,e){return bR[1].replace(bK,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){if(!e[2]){by.error(e[0])}e[2]=e[2].replace(/^\+|\s*/g,"");var bR=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(bR[1]+(bR[2]||1))-0;e[3]=bR[3]-0}else{if(e[2]){by.error(e[0])}}e[0]=bI++;return e},ATTR:function(bU,bR,bS,e,bV,bW){var bT=bU[1]=bU[1].replace(bK,"");if(!bW&&bE.attrMap[bT]){bU[1]=bE.attrMap[bT]}bU[4]=(bU[4]||bU[5]||"").replace(bK,"");if(bU[2]==="~="){bU[4]=" "+bU[4]+" "}return bU},PSEUDO:function(bU,bR,bS,e,bV){if(bU[1]==="not"){if((bH.exec(bU[3])||"").length>1||/^\w/.test(bU[3])){bU[3]=by(bU[3],null,null,bR)}else{var bT=by.filter(bU[3],bR,bS,true^bV);if(!bS){e.push.apply(e,bT)}return false}}else{if(bE.match.POS.test(bU[0])||bE.match.CHILD.test(bU[0])){return true}}return bU},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(bS,bR,e){return !!by(e[3],bS).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(bS){var e=bS.getAttribute("type"),bR=bS.type;return bS.nodeName.toLowerCase()==="input"&&"text"===bR&&(e===bR||e===null)},radio:function(e){return e.nodeName.toLowerCase()==="input"&&"radio"===e.type},checkbox:function(e){return e.nodeName.toLowerCase()==="input"&&"checkbox"===e.type},file:function(e){return e.nodeName.toLowerCase()==="input"&&"file"===e.type},password:function(e){return e.nodeName.toLowerCase()==="input"&&"password"===e.type},submit:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"submit"===bR.type},image:function(e){return e.nodeName.toLowerCase()==="input"&&"image"===e.type},reset:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"reset"===bR.type},button:function(bR){var e=bR.nodeName.toLowerCase();return e==="input"&&"button"===bR.type||e==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(bR,e){return e===0},last:function(bS,bR,e,bT){return bR===bT.length-1},even:function(bR,e){return e%2===0},odd:function(bR,e){return e%2===1},lt:function(bS,bR,e){return bR<e[3]-0},gt:function(bS,bR,e){return bR>e[3]-0},nth:function(bS,bR,e){return e[3]-0===bR},eq:function(bS,bR,e){return e[3]-0===bR}},filter:{PSEUDO:function(bS,bX,bW,bY){var e=bX[1],bR=bE.filters[e];if(bR){return bR(bS,bW,bX,bY)}else{if(e==="contains"){return(bS.textContent||bS.innerText||bw([bS])||"").indexOf(bX[3])>=0}else{if(e==="not"){var bT=bX[3];for(var bV=0,bU=bT.length;bV<bU;bV++){if(bT[bV]===bS){return false}}return true}else{by.error(e)}}}},CHILD:function(bS,bU){var bT,b0,bW,bZ,e,bV,bY,bX=bU[1],bR=bS;switch(bX){case"only":case"first":while((bR=bR.previousSibling)){if(bR.nodeType===1){return false}}if(bX==="first"){return true}bR=bS;case"last":while((bR=bR.nextSibling)){if(bR.nodeType===1){return false}}return true;case"nth":bT=bU[2];b0=bU[3];if(bT===1&&b0===0){return true}bW=bU[0];bZ=bS.parentNode;if(bZ&&(bZ[bC]!==bW||!bS.nodeIndex)){bV=0;for(bR=bZ.firstChild;bR;bR=bR.nextSibling){if(bR.nodeType===1){bR.nodeIndex=++bV}}bZ[bC]=bW}bY=bS.nodeIndex-b0;if(bT===0){return bY===0}else{return(bY%bT===0&&bY/bT>=0)}}},ID:function(bR,e){return bR.nodeType===1&&bR.getAttribute("id")===e},TAG:function(bR,e){return(e==="*"&&bR.nodeType===1)||!!bR.nodeName&&bR.nodeName.toLowerCase()===e},CLASS:function(bR,e){return(" "+(bR.className||bR.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(bV,bT){var bS=bT[1],e=by.attr?by.attr(bV,bS):bE.attrHandle[bS]?bE.attrHandle[bS](bV):bV[bS]!=null?bV[bS]:bV.getAttribute(bS),bW=e+"",bU=bT[2],bR=bT[4];return e==null?bU==="!=":!bU&&by.attr?e!=null:bU==="="?bW===bR:bU==="*="?bW.indexOf(bR)>=0:bU==="~="?(" "+bW+" ").indexOf(bR)>=0:!bR?bW&&e!==false:bU==="!="?bW!==bR:bU==="^="?bW.indexOf(bR)===0:bU==="$="?bW.substr(bW.length-bR.length)===bR:bU==="|="?bW===bR||bW.substr(0,bR.length+1)===bR+"-":false},POS:function(bU,bR,bS,bV){var e=bR[2],bT=bE.setFilters[e];if(bT){return bT(bU,bS,bR,bV)}}}};var bD=bE.match.POS,bx=function(bR,e){return"\\"+(e-0+1)};for(var bz in bE.match){bE.match[bz]=new RegExp(bE.match[bz].source+(/(?![^\[]*\])(?![^\(]*\))/.source));bE.leftMatch[bz]=new RegExp(/(^(?:.|\r|\n)*?)/.source+bE.match[bz].source.replace(/\\(\d+)/g,bx))}var bF=function(bR,e){bR=Array.prototype.slice.call(bR,0);if(e){e.push.apply(e,bR);return e}return bR};try{Array.prototype.slice.call(av.documentElement.childNodes,0)[0].nodeType}catch(bP){bF=function(bU,bT){var bS=0,bR=bT||[];if(bL.call(bU)==="[object Array]"){Array.prototype.push.apply(bR,bU)}else{if(typeof bU.length==="number"){for(var e=bU.length;bS<e;bS++){bR.push(bU[bS])}}else{for(;bU[bS];bS++){bR.push(bU[bS])}}}return bR}}var bJ,bG;if(av.documentElement.compareDocumentPosition){bJ=function(bR,e){if(bR===e){bB=true;return 0}if(!bR.compareDocumentPosition||!e.compareDocumentPosition){return bR.compareDocumentPosition?-1:1}return bR.compareDocumentPosition(e)&4?-1:1}}else{bJ=function(bY,bX){if(bY===bX){bB=true;return 0}else{if(bY.sourceIndex&&bX.sourceIndex){return bY.sourceIndex-bX.sourceIndex}}var bV,bR,bS=[],e=[],bU=bY.parentNode,bW=bX.parentNode,bZ=bU;if(bU===bW){return bG(bY,bX)}else{if(!bU){return -1}else{if(!bW){return 1}}}while(bZ){bS.unshift(bZ);bZ=bZ.parentNode}bZ=bW;while(bZ){e.unshift(bZ);bZ=bZ.parentNode}bV=bS.length;bR=e.length;for(var bT=0;bT<bV&&bT<bR;bT++){if(bS[bT]!==e[bT]){return bG(bS[bT],e[bT])}}return bT===bV?bG(bY,e[bT],-1):bG(bS[bT],bX,1)};bG=function(bR,e,bS){if(bR===e){return bS}var bT=bR.nextSibling;while(bT){if(bT===e){return -1}bT=bT.nextSibling}return 1}}(function(){var bR=av.createElement("div"),bS="script"+(new Date()).getTime(),e=av.documentElement;bR.innerHTML="<a name='"+bS+"'/>";e.insertBefore(bR,e.firstChild);if(av.getElementById(bS)){bE.find.ID=function(bU,bV,bW){if(typeof bV.getElementById!=="undefined"&&!bW){var bT=bV.getElementById(bU[1]);return bT?bT.id===bU[1]||typeof bT.getAttributeNode!=="undefined"&&bT.getAttributeNode("id").nodeValue===bU[1]?[bT]:L:[]}};bE.filter.ID=function(bV,bT){var bU=typeof bV.getAttributeNode!=="undefined"&&bV.getAttributeNode("id");return bV.nodeType===1&&bU&&bU.nodeValue===bT}}e.removeChild(bR);e=bR=null})();(function(){var e=av.createElement("div");e.appendChild(av.createComment(""));if(e.getElementsByTagName("*").length>0){bE.find.TAG=function(bR,bV){var bU=bV.getElementsByTagName(bR[1]);if(bR[1]==="*"){var bT=[];for(var bS=0;bU[bS];bS++){if(bU[bS].nodeType===1){bT.push(bU[bS])}}bU=bT}return bU}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){bE.attrHandle.href=function(bR){return bR.getAttribute("href",2)}}e=null})();if(av.querySelectorAll){(function(){var e=by,bT=av.createElement("div"),bS="__sizzle__";bT.innerHTML="<p class='TEST'></p>";if(bT.querySelectorAll&&bT.querySelectorAll(".TEST").length===0){return}by=function(b4,bV,bZ,b3){bV=bV||av;if(!b3&&!by.isXML(bV)){var b2=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b4);if(b2&&(bV.nodeType===1||bV.nodeType===9)){if(b2[1]){return bF(bV.getElementsByTagName(b4),bZ)}else{if(b2[2]&&bE.find.CLASS&&bV.getElementsByClassName){return bF(bV.getElementsByClassName(b2[2]),bZ)}}}if(bV.nodeType===9){if(b4==="body"&&bV.body){return bF([bV.body],bZ)}else{if(b2&&b2[3]){var bY=bV.getElementById(b2[3]);if(bY&&bY.parentNode){if(bY.id===b2[3]){return bF([bY],bZ)}}else{return bF([],bZ)}}}try{return bF(bV.querySelectorAll(b4),bZ)}catch(b0){}}else{if(bV.nodeType===1&&bV.nodeName.toLowerCase()!=="object"){var bW=bV,bX=bV.getAttribute("id"),bU=bX||bS,b6=bV.parentNode,b5=/^\s*[+~]/.test(b4);if(!bX){bV.setAttribute("id",bU)}else{bU=bU.replace(/'/g,"\\$&")}if(b5&&b6){bV=bV.parentNode}try{if(!b5||b6){return bF(bV.querySelectorAll("[id='"+bU+"'] "+b4),bZ)}}catch(b1){}finally{if(!bX){bW.removeAttribute("id")}}}}}return e(b4,bV,bZ,b3)};for(var bR in e){by[bR]=e[bR]}bT=null})()}(function(){var e=av.documentElement,bS=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(bS){var bU=!bS.call(av.createElement("div"),"div"),bR=false;try{bS.call(av.documentElement,"[test!='']:sizzle")}catch(bT){bR=true}by.matchesSelector=function(bW,bY){bY=bY.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!by.isXML(bW)){try{if(bR||!bE.match.PSEUDO.test(bY)&&!/!=/.test(bY)){var bV=bS.call(bW,bY);if(bV||!bU||bW.document&&bW.document.nodeType!==11){return bV}}}catch(bX){}}return by(bY,null,null,[bW]).length>0}}})();(function(){var e=av.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}bE.order.splice(1,0,"CLASS");bE.find.CLASS=function(bR,bS,bT){if(typeof bS.getElementsByClassName!=="undefined"&&!bT){return bS.getElementsByClassName(bR[1])}};e=null})();function bv(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT<bS;bT++){var e=bZ[bT];if(e){var bU=false;e=e[bR];while(e){if(e[bC]===bV){bU=bZ[e.sizset];break}if(e.nodeType===1&&!bY){e[bC]=bV;e.sizset=bT}if(e.nodeName.toLowerCase()===bW){bU=e;break}e=e[bR]}bZ[bT]=bU}}}function bN(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT<bS;bT++){var e=bZ[bT];if(e){var bU=false;e=e[bR];while(e){if(e[bC]===bV){bU=bZ[e.sizset];break}if(e.nodeType===1){if(!bY){e[bC]=bV;e.sizset=bT}if(typeof bW!=="string"){if(e===bW){bU=true;break}}else{if(by.filter(bW,[e]).length>0){bU=e;break}}}e=e[bR]}bZ[bT]=bU}}}if(av.documentElement.contains){by.contains=function(bR,e){return bR!==e&&(bR.contains?bR.contains(e):true)}}else{if(av.documentElement.compareDocumentPosition){by.contains=function(bR,e){return !!(bR.compareDocumentPosition(e)&16)}}else{by.contains=function(){return false}}}by.isXML=function(e){var bR=(e?e.ownerDocument||e:0).documentElement;return bR?bR.nodeName!=="HTML":false};var bM=function(bS,e,bW){var bV,bX=[],bU="",bY=e.nodeType?[e]:e;while((bV=bE.match.PSEUDO.exec(bS))){bU+=bV[0];bS=bS.replace(bE.match.PSEUDO,"")}bS=bE.relative[bS]?bS+"*":bS;for(var bT=0,bR=bY.length;bT<bR;bT++){by(bS,bY[bT],bX,bW)}return by.filter(bU,bX)};by.attr=b.attr;by.selectors.attrMap={};b.find=by;b.expr=by.selectors;b.expr[":"]=b.expr.filters;b.unique=by.uniqueSort;b.text=by.getText;b.isXMLDoc=by.isXML;b.contains=by.contains})();var ab=/Until$/,aq=/^(?:parents|prevUntil|prevAll)/,a9=/,/,bp=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,H=b.expr.match.POS,ay={children:true,contents:true,next:true,prev:true};b.fn.extend({find:function(e){var bw=this,by,bv;if(typeof e!=="string"){return b(e).filter(function(){for(by=0,bv=bw.length;by<bv;by++){if(b.contains(bw[by],this)){return true}}})}var bx=this.pushStack("","find",e),bA,bB,bz;for(by=0,bv=this.length;by<bv;by++){bA=bx.length;b.find(e,this[by],bx);if(by>0){for(bB=bA;bB<bx.length;bB++){for(bz=0;bz<bA;bz++){if(bx[bz]===bx[bB]){bx.splice(bB--,1);break}}}}}return bx},has:function(bv){var e=b(bv);return this.filter(function(){for(var bx=0,bw=e.length;bx<bw;bx++){if(b.contains(this,e[bx])){return true}}})},not:function(e){return this.pushStack(aG(this,e,false),"not",e)},filter:function(e){return this.pushStack(aG(this,e,true),"filter",e)},is:function(e){return !!e&&(typeof e==="string"?H.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(by,bx){var bv=[],bw,e,bz=this[0];if(b.isArray(by)){var bB=1;while(bz&&bz.ownerDocument&&bz!==bx){for(bw=0;bw<by.length;bw++){if(b(bz).is(by[bw])){bv.push({selector:by[bw],elem:bz,level:bB})}}bz=bz.parentNode;bB++}return bv}var bA=H.test(by)||typeof by!=="string"?b(by,bx||this.context):0;for(bw=0,e=this.length;bw<e;bw++){bz=this[bw];while(bz){if(bA?bA.index(bz)>-1:b.find.matchesSelector(bz,by)){bv.push(bz);break}else{bz=bz.parentNode;if(!bz||!bz.ownerDocument||bz===bx||bz.nodeType===11){break}}}}bv=bv.length>1?b.unique(bv):bv;return this.pushStack(bv,"closest",by)},index:function(e){if(!e){return(this[0]&&this[0].parentNode)?this.prevAll().length:-1}if(typeof e==="string"){return b.inArray(this[0],b(e))}return b.inArray(e.jquery?e[0]:e,this)},add:function(e,bv){var bx=typeof e==="string"?b(e,bv):b.makeArray(e&&e.nodeType?[e]:e),bw=b.merge(this.get(),bx);return this.pushStack(C(bx[0])||C(bw[0])?bw:b.unique(bw))},andSelf:function(){return this.add(this.prevObject)}});function C(e){return !e||!e.parentNode||e.parentNode.nodeType===11}b.each({parent:function(bv){var e=bv.parentNode;return e&&e.nodeType!==11?e:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(bv,e,bw){return b.dir(bv,"parentNode",bw)},next:function(e){return b.nth(e,2,"nextSibling")},prev:function(e){return b.nth(e,2,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(bv,e,bw){return b.dir(bv,"nextSibling",bw)},prevUntil:function(bv,e,bw){return b.dir(bv,"previousSibling",bw)},siblings:function(e){return b.sibling(e.parentNode.firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.makeArray(e.childNodes)}},function(e,bv){b.fn[e]=function(by,bw){var bx=b.map(this,bv,by);if(!ab.test(e)){bw=by}if(bw&&typeof bw==="string"){bx=b.filter(bw,bx)}bx=this.length>1&&!ay[e]?b.unique(bx):bx;if((this.length>1||a9.test(bw))&&aq.test(e)){bx=bx.reverse()}return this.pushStack(bx,e,P.call(arguments).join(","))}});b.extend({filter:function(bw,e,bv){if(bv){bw=":not("+bw+")"}return e.length===1?b.find.matchesSelector(e[0],bw)?[e[0]]:[]:b.find.matches(bw,e)},dir:function(bw,bv,by){var e=[],bx=bw[bv];while(bx&&bx.nodeType!==9&&(by===L||bx.nodeType!==1||!b(bx).is(by))){if(bx.nodeType===1){e.push(bx)}bx=bx[bv]}return e},nth:function(by,e,bw,bx){e=e||1;var bv=0;for(;by;by=by[bw]){if(by.nodeType===1&&++bv===e){break}}return by},sibling:function(bw,bv){var e=[];for(;bw;bw=bw.nextSibling){if(bw.nodeType===1&&bw!==bv){e.push(bw)}}return e}});function aG(bx,bw,e){bw=bw||0;if(b.isFunction(bw)){return b.grep(bx,function(bz,by){var bA=!!bw.call(bz,by,bz);return bA===e})}else{if(bw.nodeType){return b.grep(bx,function(bz,by){return(bz===bw)===e})}else{if(typeof bw==="string"){var bv=b.grep(bx,function(by){return by.nodeType===1});if(bp.test(bw)){return b.filter(bw,bv,!e)}else{bw=b.filter(bw,bv)}}}}return b.grep(bx,function(bz,by){return(b.inArray(bz,bw)>=0)===e})}function a(e){var bw=aR.split("|"),bv=e.createDocumentFragment();if(bv.createElement){while(bw.length){bv.createElement(bw.pop())}}return bv}var aR="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ag=/ jQuery\d+="(?:\d+|null)"/g,ar=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,d=/<([\w:]+)/,w=/<tbody/i,W=/<|&#?\w+;/,ae=/<(?:script|style)/i,O=/<(?:script|object|embed|option|style)/i,ah=new RegExp("<(?:"+aR+")","i"),o=/checked\s*(?:[^=]|=\s*.checked.)/i,bm=/\/(java|ecma)script/i,aN=/^\s*<!(?:\[CDATA\[|\-\-)/,ax={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},ac=a(av);ax.optgroup=ax.option;ax.tbody=ax.tfoot=ax.colgroup=ax.caption=ax.thead;ax.th=ax.td;if(!b.support.htmlSerialize){ax._default=[1,"div<div>","</div>"]}b.fn.extend({text:function(e){if(b.isFunction(e)){return this.each(function(bw){var bv=b(this);bv.text(e.call(this,bw,bv.text()))})}if(typeof e!=="object"&&e!==L){return this.empty().append((this[0]&&this[0].ownerDocument||av).createTextNode(e))}return b.text(this)},wrapAll:function(e){if(b.isFunction(e)){return this.each(function(bw){b(this).wrapAll(e.call(this,bw))})}if(this[0]){var bv=b(e,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){bv.insertBefore(this[0])}bv.map(function(){var bw=this;while(bw.firstChild&&bw.firstChild.nodeType===1){bw=bw.firstChild}return bw}).append(this)}return this},wrapInner:function(e){if(b.isFunction(e)){return this.each(function(bv){b(this).wrapInner(e.call(this,bv))})}return this.each(function(){var bv=b(this),bw=bv.contents();if(bw.length){bw.wrapAll(e)}else{bv.append(e)}})},wrap:function(e){var bv=b.isFunction(e);return this.each(function(bw){b(this).wrapAll(bv?e.call(this,bw):e)})},unwrap:function(){return this.parent().each(function(){if(!b.nodeName(this,"body")){b(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.appendChild(e)}})},prepend:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.insertBefore(e,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this)})}else{if(arguments.length){var e=b.clean(arguments);e.push.apply(e,this.toArray());return this.pushStack(e,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this.nextSibling)})}else{if(arguments.length){var e=this.pushStack(this,"after",arguments);e.push.apply(e,b.clean(arguments));return e}}},remove:function(e,bx){for(var bv=0,bw;(bw=this[bv])!=null;bv++){if(!e||b.filter(e,[bw]).length){if(!bx&&bw.nodeType===1){b.cleanData(bw.getElementsByTagName("*"));b.cleanData([bw])}if(bw.parentNode){bw.parentNode.removeChild(bw)}}}return this},empty:function(){for(var e=0,bv;(bv=this[e])!=null;e++){if(bv.nodeType===1){b.cleanData(bv.getElementsByTagName("*"))}while(bv.firstChild){bv.removeChild(bv.firstChild)}}return this},clone:function(bv,e){bv=bv==null?false:bv;e=e==null?bv:e;return this.map(function(){return b.clone(this,bv,e)})},html:function(bx){if(bx===L){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(ag,""):null}else{if(typeof bx==="string"&&!ae.test(bx)&&(b.support.leadingWhitespace||!ar.test(bx))&&!ax[(d.exec(bx)||["",""])[1].toLowerCase()]){bx=bx.replace(R,"<$1></$2>");try{for(var bw=0,bv=this.length;bw<bv;bw++){if(this[bw].nodeType===1){b.cleanData(this[bw].getElementsByTagName("*"));this[bw].innerHTML=bx}}}catch(by){this.empty().append(bx)}}else{if(b.isFunction(bx)){this.each(function(bz){var e=b(this);e.html(bx.call(this,bz,e.html()))})}else{this.empty().append(bx)}}}return this},replaceWith:function(e){if(this[0]&&this[0].parentNode){if(b.isFunction(e)){return this.each(function(bx){var bw=b(this),bv=bw.html();bw.replaceWith(e.call(this,bx,bv))})}if(typeof e!=="string"){e=b(e).detach()}return this.each(function(){var bw=this.nextSibling,bv=this.parentNode;b(this).remove();if(bw){b(bw).before(e)}else{b(bv).append(e)}})}else{return this.length?this.pushStack(b(b.isFunction(e)?e():e),"replaceWith",e):this}},detach:function(e){return this.remove(e,true)},domManip:function(bB,bF,bE){var bx,by,bA,bD,bC=bB[0],bv=[];if(!b.support.checkClone&&arguments.length===3&&typeof bC==="string"&&o.test(bC)){return this.each(function(){b(this).domManip(bB,bF,bE,true)})}if(b.isFunction(bC)){return this.each(function(bH){var bG=b(this);bB[0]=bC.call(this,bH,bF?bG.html():L);bG.domManip(bB,bF,bE)})}if(this[0]){bD=bC&&bC.parentNode;if(b.support.parentNode&&bD&&bD.nodeType===11&&bD.childNodes.length===this.length){bx={fragment:bD}}else{bx=b.buildFragment(bB,this,bv)}bA=bx.fragment;if(bA.childNodes.length===1){by=bA=bA.firstChild}else{by=bA.firstChild}if(by){bF=bF&&b.nodeName(by,"tr");for(var bw=0,e=this.length,bz=e-1;bw<e;bw++){bE.call(bF?ba(this[bw],by):this[bw],bx.cacheable||(e>1&&bw<bz)?b.clone(bA,true,true):bA)}}if(bv.length){b.each(bv,bo)}}return this}});function ba(e,bv){return b.nodeName(e,"table")?(e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody"))):e}function t(bB,bv){if(bv.nodeType!==1||!b.hasData(bB)){return}var by,bx,e,bA=b._data(bB),bz=b._data(bv,bA),bw=bA.events;if(bw){delete bz.handle;bz.events={};for(by in bw){for(bx=0,e=bw[by].length;bx<e;bx++){b.event.add(bv,by+(bw[by][bx].namespace?".":"")+bw[by][bx].namespace,bw[by][bx],bw[by][bx].data)}}}if(bz.data){bz.data=b.extend({},bz.data)}}function ai(bv,e){var bw;if(e.nodeType!==1){return}if(e.clearAttributes){e.clearAttributes()}if(e.mergeAttributes){e.mergeAttributes(bv)}bw=e.nodeName.toLowerCase();if(bw==="object"){e.outerHTML=bv.outerHTML}else{if(bw==="input"&&(bv.type==="checkbox"||bv.type==="radio")){if(bv.checked){e.defaultChecked=e.checked=bv.checked}if(e.value!==bv.value){e.value=bv.value}}else{if(bw==="option"){e.selected=bv.defaultSelected}else{if(bw==="input"||bw==="textarea"){e.defaultValue=bv.defaultValue}}}}e.removeAttribute(b.expando)}b.buildFragment=function(bz,bx,bv){var by,e,bw,bA,bB=bz[0];if(bx&&bx[0]){bA=bx[0].ownerDocument||bx[0]}if(!bA.createDocumentFragment){bA=av}if(bz.length===1&&typeof bB==="string"&&bB.length<512&&bA===av&&bB.charAt(0)==="<"&&!O.test(bB)&&(b.support.checkClone||!o.test(bB))&&(b.support.html5Clone||!ah.test(bB))){e=true;bw=b.fragments[bB];if(bw&&bw!==1){by=bw}}if(!by){by=bA.createDocumentFragment();b.clean(bz,bA,by,bv)}if(e){b.fragments[bB]=bw?by:1}return{fragment:by,cacheable:e}};b.fragments={};b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,bv){b.fn[e]=function(bw){var bz=[],bC=b(bw),bB=this.length===1&&this[0].parentNode;if(bB&&bB.nodeType===11&&bB.childNodes.length===1&&bC.length===1){bC[bv](this[0]);return this}else{for(var bA=0,bx=bC.length;bA<bx;bA++){var by=(bA>0?this.clone(true):this).get();b(bC[bA])[bv](by);bz=bz.concat(by)}return this.pushStack(bz,e,bC.selector)}}});function bg(e){if(typeof e.getElementsByTagName!=="undefined"){return e.getElementsByTagName("*")}else{if(typeof e.querySelectorAll!=="undefined"){return e.querySelectorAll("*")}else{return[]}}}function az(e){if(e.type==="checkbox"||e.type==="radio"){e.defaultChecked=e.checked}}function E(e){var bv=(e.nodeName||"").toLowerCase();if(bv==="input"){az(e)}else{if(bv!=="script"&&typeof e.getElementsByTagName!=="undefined"){b.grep(e.getElementsByTagName("input"),az)}}}function al(e){var bv=av.createElement("div");ac.appendChild(bv);bv.innerHTML=e.outerHTML;return bv.firstChild}b.extend({clone:function(by,bA,bw){var e,bv,bx,bz=b.support.html5Clone||!ah.test("<"+by.nodeName)?by.cloneNode(true):al(by);if((!b.support.noCloneEvent||!b.support.noCloneChecked)&&(by.nodeType===1||by.nodeType===11)&&!b.isXMLDoc(by)){ai(by,bz);e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){if(bv[bx]){ai(e[bx],bv[bx])}}}if(bA){t(by,bz);if(bw){e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){t(e[bx],bv[bx])}}}e=bv=null;return bz},clean:function(bw,by,bH,bA){var bF;by=by||av;if(typeof by.createElement==="undefined"){by=by.ownerDocument||by[0]&&by[0].ownerDocument||av}var bI=[],bB;for(var bE=0,bz;(bz=bw[bE])!=null;bE++){if(typeof bz==="number"){bz+=""}if(!bz){continue}if(typeof bz==="string"){if(!W.test(bz)){bz=by.createTextNode(bz)}else{bz=bz.replace(R,"<$1></$2>");var bK=(d.exec(bz)||["",""])[1].toLowerCase(),bx=ax[bK]||ax._default,bD=bx[0],bv=by.createElement("div");if(by===av){ac.appendChild(bv)}else{a(by).appendChild(bv)}bv.innerHTML=bx[1]+bz+bx[2];while(bD--){bv=bv.lastChild}if(!b.support.tbody){var e=w.test(bz),bC=bK==="table"&&!e?bv.firstChild&&bv.firstChild.childNodes:bx[1]==="<table>"&&!e?bv.childNodes:[];for(bB=bC.length-1;bB>=0;--bB){if(b.nodeName(bC[bB],"tbody")&&!bC[bB].childNodes.length){bC[bB].parentNode.removeChild(bC[bB])}}}if(!b.support.leadingWhitespace&&ar.test(bz)){bv.insertBefore(by.createTextNode(ar.exec(bz)[0]),bv.firstChild)}bz=bv.childNodes}}var bG;if(!b.support.appendChecked){if(bz[0]&&typeof(bG=bz.length)==="number"){for(bB=0;bB<bG;bB++){E(bz[bB])}}else{E(bz)}}if(bz.nodeType){bI.push(bz)}else{bI=b.merge(bI,bz)}}if(bH){bF=function(bL){return !bL.type||bm.test(bL.type)};for(bE=0;bI[bE];bE++){if(bA&&b.nodeName(bI[bE],"script")&&(!bI[bE].type||bI[bE].type.toLowerCase()==="text/javascript")){bA.push(bI[bE].parentNode?bI[bE].parentNode.removeChild(bI[bE]):bI[bE])}else{if(bI[bE].nodeType===1){var bJ=b.grep(bI[bE].getElementsByTagName("script"),bF);bI.splice.apply(bI,[bE+1,0].concat(bJ))}bH.appendChild(bI[bE])}}}return bI},cleanData:function(bv){var by,bw,e=b.cache,bB=b.event.special,bA=b.support.deleteExpando;for(var bz=0,bx;(bx=bv[bz])!=null;bz++){if(bx.nodeName&&b.noData[bx.nodeName.toLowerCase()]){continue}bw=bx[b.expando];if(bw){by=e[bw];if(by&&by.events){for(var bC in by.events){if(bB[bC]){b.event.remove(bx,bC)}else{b.removeEvent(bx,bC,by.handle)}}if(by.handle){by.handle.elem=null}}if(bA){delete bx[b.expando]}else{if(bx.removeAttribute){bx.removeAttribute(b.expando)}}delete e[bw]}}}});function bo(e,bv){if(bv.src){b.ajax({url:bv.src,async:false,dataType:"script"})}else{b.globalEval((bv.text||bv.textContent||bv.innerHTML||"").replace(aN,"/*$0*/"))}if(bv.parentNode){bv.parentNode.removeChild(bv)}}var ak=/alpha\([^)]*\)/i,au=/opacity=([^)]*)/,z=/([A-Z]|^ms)/g,bc=/^-?\d+(?:px)?$/i,bn=/^-?\d/,I=/^([\-+])=([\-+.\de]+)/,a7={position:"absolute",visibility:"hidden",display:"block"},an=["Left","Right"],a1=["Top","Bottom"],Z,aI,aX;b.fn.css=function(e,bv){if(arguments.length===2&&bv===L){return this}return b.access(this,e,bv,true,function(bx,bw,by){return by!==L?b.style(bx,bw,by):b.css(bx,bw)})};b.extend({cssHooks:{opacity:{get:function(bw,bv){if(bv){var e=Z(bw,"opacity","opacity");return e===""?"1":e}else{return bw.style.opacity}}}},cssNumber:{fillOpacity:true,fontWeight:true,lineHeight:true,opacity:true,orphans:true,widows:true,zIndex:true,zoom:true},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(bx,bw,bD,by){if(!bx||bx.nodeType===3||bx.nodeType===8||!bx.style){return}var bB,bC,bz=b.camelCase(bw),bv=bx.style,bE=b.cssHooks[bz];bw=b.cssProps[bz]||bz;if(bD!==L){bC=typeof bD;if(bC==="string"&&(bB=I.exec(bD))){bD=(+(bB[1]+1)*+bB[2])+parseFloat(b.css(bx,bw));bC="number"}if(bD==null||bC==="number"&&isNaN(bD)){return}if(bC==="number"&&!b.cssNumber[bz]){bD+="px"}if(!bE||!("set" in bE)||(bD=bE.set(bx,bD))!==L){try{bv[bw]=bD}catch(bA){}}}else{if(bE&&"get" in bE&&(bB=bE.get(bx,false,by))!==L){return bB}return bv[bw]}},css:function(by,bx,bv){var bw,e;bx=b.camelCase(bx);e=b.cssHooks[bx];bx=b.cssProps[bx]||bx;if(bx==="cssFloat"){bx="float"}if(e&&"get" in e&&(bw=e.get(by,true,bv))!==L){return bw}else{if(Z){return Z(by,bx)}}},swap:function(bx,bw,by){var e={};for(var bv in bw){e[bv]=bx.style[bv];bx.style[bv]=bw[bv]}by.call(bx);for(bv in bw){bx.style[bv]=e[bv]}}});b.curCSS=b.css;b.each(["height","width"],function(bv,e){b.cssHooks[e]={get:function(by,bx,bw){var bz;if(bx){if(by.offsetWidth!==0){return p(by,e,bw)}else{b.swap(by,a7,function(){bz=p(by,e,bw)})}return bz}},set:function(bw,bx){if(bc.test(bx)){bx=parseFloat(bx);if(bx>=0){return bx+"px"}}else{return bx}}}});if(!b.support.opacity){b.cssHooks.opacity={get:function(bv,e){return au.test((e&&bv.currentStyle?bv.currentStyle.filter:bv.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":e?"1":""},set:function(by,bz){var bx=by.style,bv=by.currentStyle,e=b.isNumeric(bz)?"alpha(opacity="+bz*100+")":"",bw=bv&&bv.filter||bx.filter||"";bx.zoom=1;if(bz>=1&&b.trim(bw.replace(ak,""))===""){bx.removeAttribute("filter");if(bv&&!bv.filter){return}}bx.filter=ak.test(bw)?bw.replace(ak,e):bw+" "+e}}}b(function(){if(!b.support.reliableMarginRight){b.cssHooks.marginRight={get:function(bw,bv){var e;b.swap(bw,{display:"inline-block"},function(){if(bv){e=Z(bw,"margin-right","marginRight")}else{e=bw.style.marginRight}});return e}}}});if(av.defaultView&&av.defaultView.getComputedStyle){aI=function(by,bw){var bv,bx,e;bw=bw.replace(z,"-$1").toLowerCase();if((bx=by.ownerDocument.defaultView)&&(e=bx.getComputedStyle(by,null))){bv=e.getPropertyValue(bw);if(bv===""&&!b.contains(by.ownerDocument.documentElement,by)){bv=b.style(by,bw)}}return bv}}if(av.documentElement.currentStyle){aX=function(bz,bw){var bA,e,by,bv=bz.currentStyle&&bz.currentStyle[bw],bx=bz.style;if(bv===null&&bx&&(by=bx[bw])){bv=by}if(!bc.test(bv)&&bn.test(bv)){bA=bx.left;e=bz.runtimeStyle&&bz.runtimeStyle.left;if(e){bz.runtimeStyle.left=bz.currentStyle.left}bx.left=bw==="fontSize"?"1em":(bv||0);bv=bx.pixelLeft+"px";bx.left=bA;if(e){bz.runtimeStyle.left=e}}return bv===""?"auto":bv}}Z=aI||aX;function p(by,bw,bv){var bA=bw==="width"?by.offsetWidth:by.offsetHeight,bz=bw==="width"?an:a1,bx=0,e=bz.length;if(bA>0){if(bv!=="border"){for(;bx<e;bx++){if(!bv){bA-=parseFloat(b.css(by,"padding"+bz[bx]))||0}if(bv==="margin"){bA+=parseFloat(b.css(by,bv+bz[bx]))||0}else{bA-=parseFloat(b.css(by,"border"+bz[bx]+"Width"))||0}}}return bA+"px"}bA=Z(by,bw,bw);if(bA<0||bA==null){bA=by.style[bw]||0}bA=parseFloat(bA)||0;if(bv){for(;bx<e;bx++){bA+=parseFloat(b.css(by,"padding"+bz[bx]))||0;if(bv!=="padding"){bA+=parseFloat(b.css(by,"border"+bz[bx]+"Width"))||0}if(bv==="margin"){bA+=parseFloat(b.css(by,bv+bz[bx]))||0}}}return bA+"px"}if(b.expr&&b.expr.filters){b.expr.filters.hidden=function(bw){var bv=bw.offsetWidth,e=bw.offsetHeight;return(bv===0&&e===0)||(!b.support.reliableHiddenOffsets&&((bw.style&&bw.style.display)||b.css(bw,"display"))==="none")};b.expr.filters.visible=function(e){return !b.expr.filters.hidden(e)}}var k=/%20/g,ap=/\[\]$/,bs=/\r?\n/g,bq=/#.*$/,aD=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,aZ=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,aM=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,aQ=/^(?:GET|HEAD)$/,c=/^\/\//,M=/\?/,a6=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,q=/^(?:select|textarea)/i,h=/\s+/,br=/([?&])_=[^&]*/,K=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,A=b.fn.load,aa={},r={},aE,s,aV=["*/"]+["*"];try{aE=bl.href}catch(aw){aE=av.createElement("a");aE.href="";aE=aE.href}s=K.exec(aE.toLowerCase())||[];function f(e){return function(by,bA){if(typeof by!=="string"){bA=by;by="*"}if(b.isFunction(bA)){var bx=by.toLowerCase().split(h),bw=0,bz=bx.length,bv,bB,bC;for(;bw<bz;bw++){bv=bx[bw];bC=/^\+/.test(bv);if(bC){bv=bv.substr(1)||"*"}bB=e[bv]=e[bv]||[];bB[bC?"unshift":"push"](bA)}}}}function aW(bv,bE,bz,bD,bB,bx){bB=bB||bE.dataTypes[0];bx=bx||{};bx[bB]=true;var bA=bv[bB],bw=0,e=bA?bA.length:0,by=(bv===aa),bC;for(;bw<e&&(by||!bC);bw++){bC=bA[bw](bE,bz,bD);if(typeof bC==="string"){if(!by||bx[bC]){bC=L}else{bE.dataTypes.unshift(bC);bC=aW(bv,bE,bz,bD,bC,bx)}}}if((by||!bC)&&!bx["*"]){bC=aW(bv,bE,bz,bD,"*",bx)}return bC}function am(bw,bx){var bv,e,by=b.ajaxSettings.flatOptions||{};for(bv in bx){if(bx[bv]!==L){(by[bv]?bw:(e||(e={})))[bv]=bx[bv]}}if(e){b.extend(true,bw,e)}}b.fn.extend({load:function(bw,bz,bA){if(typeof bw!=="string"&&A){return A.apply(this,arguments)}else{if(!this.length){return this}}var by=bw.indexOf(" ");if(by>=0){var e=bw.slice(by,bw.length);bw=bw.slice(0,by)}var bx="GET";if(bz){if(b.isFunction(bz)){bA=bz;bz=L}else{if(typeof bz==="object"){bz=b.param(bz,b.ajaxSettings.traditional);bx="POST"}}}var bv=this;b.ajax({url:bw,type:bx,dataType:"html",data:bz,complete:function(bC,bB,bD){bD=bC.responseText;if(bC.isResolved()){bC.done(function(bE){bD=bE});bv.html(e?b("<div>").append(bD.replace(a6,"")).find(e):bD)}if(bA){bv.each(bA,[bD,bB,bC])}}});return this},serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?b.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||q.test(this.nodeName)||aZ.test(this.type))}).map(function(e,bv){var bw=b(this).val();return bw==null?null:b.isArray(bw)?b.map(bw,function(by,bx){return{name:bv.name,value:by.replace(bs,"\r\n")}}):{name:bv.name,value:bw.replace(bs,"\r\n")}}).get()}});b.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,bv){b.fn[bv]=function(bw){return this.on(bv,bw)}});b.each(["get","post"],function(e,bv){b[bv]=function(bw,by,bz,bx){if(b.isFunction(by)){bx=bx||bz;bz=by;by=L}return b.ajax({type:bv,url:bw,data:by,success:bz,dataType:bx})}});b.extend({getScript:function(e,bv){return b.get(e,L,bv,"script")},getJSON:function(e,bv,bw){return b.get(e,bv,bw,"json")},ajaxSetup:function(bv,e){if(e){am(bv,b.ajaxSettings)}else{e=bv;bv=b.ajaxSettings}am(bv,e);return bv},ajaxSettings:{url:aE,isLocal:aM.test(s[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":aV},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":bb.String,"text html":true,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{context:true,url:true}},ajaxPrefilter:f(aa),ajaxTransport:f(r),ajax:function(bz,bx){if(typeof bz==="object"){bx=bz;bz=L}bx=bx||{};var bD=b.ajaxSetup({},bx),bS=bD.context||bD,bG=bS!==bD&&(bS.nodeType||bS instanceof b)?b(bS):b.event,bR=b.Deferred(),bN=b.Callbacks("once memory"),bB=bD.statusCode||{},bC,bH={},bO={},bQ,by,bL,bE,bI,bA=0,bw,bK,bJ={readyState:0,setRequestHeader:function(bT,bU){if(!bA){var e=bT.toLowerCase();bT=bO[e]=bO[e]||bT;bH[bT]=bU}return this},getAllResponseHeaders:function(){return bA===2?bQ:null},getResponseHeader:function(bT){var e;if(bA===2){if(!by){by={};while((e=aD.exec(bQ))){by[e[1].toLowerCase()]=e[2]}}e=by[bT.toLowerCase()]}return e===L?null:e},overrideMimeType:function(e){if(!bA){bD.mimeType=e}return this},abort:function(e){e=e||"abort";if(bL){bL.abort(e)}bF(0,e);return this}};function bF(bZ,bU,b0,bW){if(bA===2){return}bA=2;if(bE){clearTimeout(bE)}bL=L;bQ=bW||"";bJ.readyState=bZ>0?4:0;var bT,b4,b3,bX=bU,bY=b0?bj(bD,bJ,b0):L,bV,b2;if(bZ>=200&&bZ<300||bZ===304){if(bD.ifModified){if((bV=bJ.getResponseHeader("Last-Modified"))){b.lastModified[bC]=bV}if((b2=bJ.getResponseHeader("Etag"))){b.etag[bC]=b2}}if(bZ===304){bX="notmodified";bT=true}else{try{b4=G(bD,bY);bX="success";bT=true}catch(b1){bX="parsererror";b3=b1}}}else{b3=bX;if(!bX||bZ){bX="error";if(bZ<0){bZ=0}}}bJ.status=bZ;bJ.statusText=""+(bU||bX);if(bT){bR.resolveWith(bS,[b4,bX,bJ])}else{bR.rejectWith(bS,[bJ,bX,b3])}bJ.statusCode(bB);bB=L;if(bw){bG.trigger("ajax"+(bT?"Success":"Error"),[bJ,bD,bT?b4:b3])}bN.fireWith(bS,[bJ,bX]);if(bw){bG.trigger("ajaxComplete",[bJ,bD]);if(!(--b.active)){b.event.trigger("ajaxStop")}}}bR.promise(bJ);bJ.success=bJ.done;bJ.error=bJ.fail;bJ.complete=bN.add;bJ.statusCode=function(bT){if(bT){var e;if(bA<2){for(e in bT){bB[e]=[bB[e],bT[e]]}}else{e=bT[bJ.status];bJ.then(e,e)}}return this};bD.url=((bz||bD.url)+"").replace(bq,"").replace(c,s[1]+"//");bD.dataTypes=b.trim(bD.dataType||"*").toLowerCase().split(h);if(bD.crossDomain==null){bI=K.exec(bD.url.toLowerCase());bD.crossDomain=!!(bI&&(bI[1]!=s[1]||bI[2]!=s[2]||(bI[3]||(bI[1]==="http:"?80:443))!=(s[3]||(s[1]==="http:"?80:443))))}if(bD.data&&bD.processData&&typeof bD.data!=="string"){bD.data=b.param(bD.data,bD.traditional)}aW(aa,bD,bx,bJ);if(bA===2){return false}bw=bD.global;bD.type=bD.type.toUpperCase();bD.hasContent=!aQ.test(bD.type);if(bw&&b.active++===0){b.event.trigger("ajaxStart")}if(!bD.hasContent){if(bD.data){bD.url+=(M.test(bD.url)?"&":"?")+bD.data;delete bD.data}bC=bD.url;if(bD.cache===false){var bv=b.now(),bP=bD.url.replace(br,"$1_="+bv);bD.url=bP+((bP===bD.url)?(M.test(bD.url)?"&":"?")+"_="+bv:"")}}if(bD.data&&bD.hasContent&&bD.contentType!==false||bx.contentType){bJ.setRequestHeader("Content-Type",bD.contentType)}if(bD.ifModified){bC=bC||bD.url;if(b.lastModified[bC]){bJ.setRequestHeader("If-Modified-Since",b.lastModified[bC])}if(b.etag[bC]){bJ.setRequestHeader("If-None-Match",b.etag[bC])}}bJ.setRequestHeader("Accept",bD.dataTypes[0]&&bD.accepts[bD.dataTypes[0]]?bD.accepts[bD.dataTypes[0]]+(bD.dataTypes[0]!=="*"?", "+aV+"; q=0.01":""):bD.accepts["*"]);for(bK in bD.headers){bJ.setRequestHeader(bK,bD.headers[bK])}if(bD.beforeSend&&(bD.beforeSend.call(bS,bJ,bD)===false||bA===2)){bJ.abort();return false}for(bK in {success:1,error:1,complete:1}){bJ[bK](bD[bK])}bL=aW(r,bD,bx,bJ);if(!bL){bF(-1,"No Transport")}else{bJ.readyState=1;if(bw){bG.trigger("ajaxSend",[bJ,bD])}if(bD.async&&bD.timeout>0){bE=setTimeout(function(){bJ.abort("timeout")},bD.timeout)}try{bA=1;bL.send(bH,bF)}catch(bM){if(bA<2){bF(-1,bM)}else{throw bM}}}return bJ},param:function(e,bw){var bv=[],by=function(bz,bA){bA=b.isFunction(bA)?bA():bA;bv[bv.length]=encodeURIComponent(bz)+"="+encodeURIComponent(bA)};if(bw===L){bw=b.ajaxSettings.traditional}if(b.isArray(e)||(e.jquery&&!b.isPlainObject(e))){b.each(e,function(){by(this.name,this.value)})}else{for(var bx in e){v(bx,e[bx],bw,by)}}return bv.join("&").replace(k,"+")}});function v(bw,by,bv,bx){if(b.isArray(by)){b.each(by,function(bA,bz){if(bv||ap.test(bw)){bx(bw,bz)}else{v(bw+"["+(typeof bz==="object"||b.isArray(bz)?bA:"")+"]",bz,bv,bx)}})}else{if(!bv&&by!=null&&typeof by==="object"){for(var e in by){v(bw+"["+e+"]",by[e],bv,bx)}}else{bx(bw,by)}}}b.extend({active:0,lastModified:{},etag:{}});function bj(bD,bC,bz){var bv=bD.contents,bB=bD.dataTypes,bw=bD.responseFields,by,bA,bx,e;for(bA in bw){if(bA in bz){bC[bw[bA]]=bz[bA]}}while(bB[0]==="*"){bB.shift();if(by===L){by=bD.mimeType||bC.getResponseHeader("content-type")}}if(by){for(bA in bv){if(bv[bA]&&bv[bA].test(by)){bB.unshift(bA);break}}}if(bB[0] in bz){bx=bB[0]}else{for(bA in bz){if(!bB[0]||bD.converters[bA+" "+bB[0]]){bx=bA;break}if(!e){e=bA}}bx=bx||e}if(bx){if(bx!==bB[0]){bB.unshift(bx)}return bz[bx]}}function G(bH,bz){if(bH.dataFilter){bz=bH.dataFilter(bz,bH.dataType)}var bD=bH.dataTypes,bG={},bA,bE,bw=bD.length,bB,bC=bD[0],bx,by,bF,bv,e;for(bA=1;bA<bw;bA++){if(bA===1){for(bE in bH.converters){if(typeof bE==="string"){bG[bE.toLowerCase()]=bH.converters[bE]}}}bx=bC;bC=bD[bA];if(bC==="*"){bC=bx}else{if(bx!=="*"&&bx!==bC){by=bx+" "+bC;bF=bG[by]||bG["* "+bC];if(!bF){e=L;for(bv in bG){bB=bv.split(" ");if(bB[0]===bx||bB[0]==="*"){e=bG[bB[1]+" "+bC];if(e){bv=bG[bv];if(bv===true){bF=e}else{if(e===true){bF=bv}}break}}}}if(!(bF||e)){b.error("No conversion from "+by.replace(" "," to "))}if(bF!==true){bz=bF?bF(bz):e(bv(bz))}}}}return bz}var aC=b.now(),u=/(\=)\?(&|$)|\?\?/i;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return b.expando+"_"+(aC++)}});b.ajaxPrefilter("json jsonp",function(bD,bA,bC){var bx=bD.contentType==="application/x-www-form-urlencoded"&&(typeof bD.data==="string");if(bD.dataTypes[0]==="jsonp"||bD.jsonp!==false&&(u.test(bD.url)||bx&&u.test(bD.data))){var bB,bw=bD.jsonpCallback=b.isFunction(bD.jsonpCallback)?bD.jsonpCallback():bD.jsonpCallback,bz=bb[bw],e=bD.url,by=bD.data,bv="$1"+bw+"$2";if(bD.jsonp!==false){e=e.replace(u,bv);if(bD.url===e){if(bx){by=by.replace(u,bv)}if(bD.data===by){e+=(/\?/.test(e)?"&":"?")+bD.jsonp+"="+bw}}}bD.url=e;bD.data=by;bb[bw]=function(bE){bB=[bE]};bC.always(function(){bb[bw]=bz;if(bB&&b.isFunction(bz)){bb[bw](bB[0])}});bD.converters["script json"]=function(){if(!bB){b.error(bw+" was not called")}return bB[0]};bD.dataTypes[0]="json";return"script"}});b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){b.globalEval(e);return e}}});b.ajaxPrefilter("script",function(e){if(e.cache===L){e.cache=false}if(e.crossDomain){e.type="GET";e.global=false}});b.ajaxTransport("script",function(bw){if(bw.crossDomain){var e,bv=av.head||av.getElementsByTagName("head")[0]||av.documentElement;return{send:function(bx,by){e=av.createElement("script");e.async="async";if(bw.scriptCharset){e.charset=bw.scriptCharset}e.src=bw.url;e.onload=e.onreadystatechange=function(bA,bz){if(bz||!e.readyState||/loaded|complete/.test(e.readyState)){e.onload=e.onreadystatechange=null;if(bv&&e.parentNode){bv.removeChild(e)}e=L;if(!bz){by(200,"success")}}};bv.insertBefore(e,bv.firstChild)},abort:function(){if(e){e.onload(0,1)}}}}});var B=bb.ActiveXObject?function(){for(var e in N){N[e](0,1)}}:false,y=0,N;function aL(){try{return new bb.XMLHttpRequest()}catch(bv){}}function aj(){try{return new bb.ActiveXObject("Microsoft.XMLHTTP")}catch(bv){}}b.ajaxSettings.xhr=bb.ActiveXObject?function(){return !this.isLocal&&aL()||aj()}:aL;(function(e){b.extend(b.support,{ajax:!!e,cors:!!e&&("withCredentials" in e)})})(b.ajaxSettings.xhr());if(b.support.ajax){b.ajaxTransport(function(e){if(!e.crossDomain||b.support.cors){var bv;return{send:function(bB,bw){var bA=e.xhr(),bz,by;if(e.username){bA.open(e.type,e.url,e.async,e.username,e.password)}else{bA.open(e.type,e.url,e.async)}if(e.xhrFields){for(by in e.xhrFields){bA[by]=e.xhrFields[by]}}if(e.mimeType&&bA.overrideMimeType){bA.overrideMimeType(e.mimeType)}if(!e.crossDomain&&!bB["X-Requested-With"]){bB["X-Requested-With"]="XMLHttpRequest"}try{for(by in bB){bA.setRequestHeader(by,bB[by])}}catch(bx){}bA.send((e.hasContent&&e.data)||null);bv=function(bK,bE){var bF,bD,bC,bI,bH;try{if(bv&&(bE||bA.readyState===4)){bv=L;if(bz){bA.onreadystatechange=b.noop;if(B){delete N[bz]}}if(bE){if(bA.readyState!==4){bA.abort()}}else{bF=bA.status;bC=bA.getAllResponseHeaders();bI={};bH=bA.responseXML;if(bH&&bH.documentElement){bI.xml=bH}bI.text=bA.responseText;try{bD=bA.statusText}catch(bJ){bD=""}if(!bF&&e.isLocal&&!e.crossDomain){bF=bI.text?200:404}else{if(bF===1223){bF=204}}}}}catch(bG){if(!bE){bw(-1,bG)}}if(bI){bw(bF,bD,bI,bC)}};if(!e.async||bA.readyState===4){bv()}else{bz=++y;if(B){if(!N){N={};b(bb).unload(B)}N[bz]=bv}bA.onreadystatechange=bv}},abort:function(){if(bv){bv(0,1)}}}}})}var Q={},a8,m,aB=/^(?:toggle|show|hide)$/,aT=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,a3,aH=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],a4;b.fn.extend({show:function(bx,bA,bz){var bw,by;if(bx||bx===0){return this.animate(a0("show",3),bx,bA,bz)}else{for(var bv=0,e=this.length;bv<e;bv++){bw=this[bv];if(bw.style){by=bw.style.display;if(!b._data(bw,"olddisplay")&&by==="none"){by=bw.style.display=""}if(by===""&&b.css(bw,"display")==="none"){b._data(bw,"olddisplay",x(bw.nodeName))}}}for(bv=0;bv<e;bv++){bw=this[bv];if(bw.style){by=bw.style.display;if(by===""||by==="none"){bw.style.display=b._data(bw,"olddisplay")||""}}}return this}},hide:function(bx,bA,bz){if(bx||bx===0){return this.animate(a0("hide",3),bx,bA,bz)}else{var bw,by,bv=0,e=this.length;for(;bv<e;bv++){bw=this[bv];if(bw.style){by=b.css(bw,"display");if(by!=="none"&&!b._data(bw,"olddisplay")){b._data(bw,"olddisplay",by)}}}for(bv=0;bv<e;bv++){if(this[bv].style){this[bv].style.display="none"}}return this}},_toggle:b.fn.toggle,toggle:function(bw,bv,bx){var e=typeof bw==="boolean";if(b.isFunction(bw)&&b.isFunction(bv)){this._toggle.apply(this,arguments)}else{if(bw==null||e){this.each(function(){var by=e?bw:b(this).is(":hidden");b(this)[by?"show":"hide"]()})}else{this.animate(a0("toggle",3),bw,bv,bx)}}return this},fadeTo:function(e,bx,bw,bv){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:bx},e,bw,bv)},animate:function(bz,bw,by,bx){var e=b.speed(bw,by,bx);if(b.isEmptyObject(bz)){return this.each(e.complete,[false])}bz=b.extend({},bz);function bv(){if(e.queue===false){b._mark(this)}var bE=b.extend({},e),bK=this.nodeType===1,bI=bK&&b(this).is(":hidden"),bB,bF,bD,bJ,bH,bC,bG,bL,bA;bE.animatedProperties={};for(bD in bz){bB=b.camelCase(bD);if(bD!==bB){bz[bB]=bz[bD];delete bz[bD]}bF=bz[bB];if(b.isArray(bF)){bE.animatedProperties[bB]=bF[1];bF=bz[bB]=bF[0]}else{bE.animatedProperties[bB]=bE.specialEasing&&bE.specialEasing[bB]||bE.easing||"swing"}if(bF==="hide"&&bI||bF==="show"&&!bI){return bE.complete.call(this)}if(bK&&(bB==="height"||bB==="width")){bE.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(b.css(this,"display")==="inline"&&b.css(this,"float")==="none"){if(!b.support.inlineBlockNeedsLayout||x(this.nodeName)==="inline"){this.style.display="inline-block"}else{this.style.zoom=1}}}}if(bE.overflow!=null){this.style.overflow="hidden"}for(bD in bz){bJ=new b.fx(this,bE,bD);bF=bz[bD];if(aB.test(bF)){bA=b._data(this,"toggle"+bD)||(bF==="toggle"?bI?"show":"hide":0);if(bA){b._data(this,"toggle"+bD,bA==="show"?"hide":"show");bJ[bA]()}else{bJ[bF]()}}else{bH=aT.exec(bF);bC=bJ.cur();if(bH){bG=parseFloat(bH[2]);bL=bH[3]||(b.cssNumber[bD]?"":"px");if(bL!=="px"){b.style(this,bD,(bG||1)+bL);bC=((bG||1)/bJ.cur())*bC;b.style(this,bD,bC+bL)}if(bH[1]){bG=((bH[1]==="-="?-1:1)*bG)+bC}bJ.custom(bC,bG,bL)}else{bJ.custom(bC,bF,"")}}}return true}return e.queue===false?this.each(bv):this.queue(e.queue,bv)},stop:function(bw,bv,e){if(typeof bw!=="string"){e=bv;bv=bw;bw=L}if(bv&&bw!==false){this.queue(bw||"fx",[])}return this.each(function(){var bx,by=false,bA=b.timers,bz=b._data(this);if(!e){b._unmark(true,this)}function bB(bE,bF,bD){var bC=bF[bD];b.removeData(bE,bD,true);bC.stop(e)}if(bw==null){for(bx in bz){if(bz[bx]&&bz[bx].stop&&bx.indexOf(".run")===bx.length-4){bB(this,bz,bx)}}}else{if(bz[bx=bw+".run"]&&bz[bx].stop){bB(this,bz,bx)}}for(bx=bA.length;bx--;){if(bA[bx].elem===this&&(bw==null||bA[bx].queue===bw)){if(e){bA[bx](true)}else{bA[bx].saveState()}by=true;bA.splice(bx,1)}}if(!(e&&by)){b.dequeue(this,bw)}})}});function bh(){setTimeout(at,0);return(a4=b.now())}function at(){a4=L}function a0(bv,e){var bw={};b.each(aH.concat.apply([],aH.slice(0,e)),function(){bw[this]=bv});return bw}b.each({slideDown:a0("show",1),slideUp:a0("hide",1),slideToggle:a0("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,bv){b.fn[e]=function(bw,by,bx){return this.animate(bv,bw,by,bx)}});b.extend({speed:function(bw,bx,bv){var e=bw&&typeof bw==="object"?b.extend({},bw):{complete:bv||!bv&&bx||b.isFunction(bw)&&bw,duration:bw,easing:bv&&bx||bx&&!b.isFunction(bx)&&bx};e.duration=b.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in b.fx.speeds?b.fx.speeds[e.duration]:b.fx.speeds._default;if(e.queue==null||e.queue===true){e.queue="fx"}e.old=e.complete;e.complete=function(by){if(b.isFunction(e.old)){e.old.call(this)}if(e.queue){b.dequeue(this,e.queue)}else{if(by!==false){b._unmark(this)}}};return e},easing:{linear:function(bw,bx,e,bv){return e+bv*bw},swing:function(bw,bx,e,bv){return((-Math.cos(bw*Math.PI)/2)+0.5)*bv+e}},timers:[],fx:function(bv,e,bw){this.options=e;this.elem=bv;this.prop=bw;e.orig=e.orig||{}}});b.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(b.fx.step[this.prop]||b.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var e,bv=b.css(this.elem,this.prop);return isNaN(e=parseFloat(bv))?!bv||bv==="auto"?0:bv:e},custom:function(bz,by,bx){var e=this,bw=b.fx;this.startTime=a4||bh();this.end=by;this.now=this.start=bz;this.pos=this.state=0;this.unit=bx||this.unit||(b.cssNumber[this.prop]?"":"px");function bv(bA){return e.step(bA)}bv.queue=this.options.queue;bv.elem=this.elem;bv.saveState=function(){if(e.options.hide&&b._data(e.elem,"fxshow"+e.prop)===L){b._data(e.elem,"fxshow"+e.prop,e.start)}};if(bv()&&b.timers.push(bv)&&!a3){a3=setInterval(bw.tick,bw.interval)}},show:function(){var e=b._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=e||b.style(this.elem,this.prop);this.options.show=true;if(e!==L){this.custom(this.cur(),e)}else{this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur())}b(this.elem).show()},hide:function(){this.options.orig[this.prop]=b._data(this.elem,"fxshow"+this.prop)||b.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(by){var bA,bB,bv,bx=a4||bh(),e=true,bz=this.elem,bw=this.options;if(by||bx>=bw.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();bw.animatedProperties[this.prop]=true;for(bA in bw.animatedProperties){if(bw.animatedProperties[bA]!==true){e=false}}if(e){if(bw.overflow!=null&&!b.support.shrinkWrapBlocks){b.each(["","X","Y"],function(bC,bD){bz.style["overflow"+bD]=bw.overflow[bC]})}if(bw.hide){b(bz).hide()}if(bw.hide||bw.show){for(bA in bw.animatedProperties){b.style(bz,bA,bw.orig[bA]);b.removeData(bz,"fxshow"+bA,true);b.removeData(bz,"toggle"+bA,true)}}bv=bw.complete;if(bv){bw.complete=false;bv.call(bz)}}return false}else{if(bw.duration==Infinity){this.now=bx}else{bB=bx-this.startTime;this.state=bB/bw.duration;this.pos=b.easing[bw.animatedProperties[this.prop]](this.state,bB,0,1,bw.duration);this.now=this.start+((this.end-this.start)*this.pos)}this.update()}return true}};b.extend(b.fx,{tick:function(){var bw,bv=b.timers,e=0;for(;e<bv.length;e++){bw=bv[e];if(!bw()&&bv[e]===bw){bv.splice(e--,1)}}if(!bv.length){b.fx.stop()}},interval:13,stop:function(){clearInterval(a3);a3=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(e){b.style(e.elem,"opacity",e.now)},_default:function(e){if(e.elem.style&&e.elem.style[e.prop]!=null){e.elem.style[e.prop]=e.now+e.unit}else{e.elem[e.prop]=e.now}}}});b.each(["width","height"],function(e,bv){b.fx.step[bv]=function(bw){b.style(bw.elem,bv,Math.max(0,bw.now)+bw.unit)}});if(b.expr&&b.expr.filters){b.expr.filters.animated=function(e){return b.grep(b.timers,function(bv){return e===bv.elem}).length}}function x(bx){if(!Q[bx]){var e=av.body,bv=b("<"+bx+">").appendTo(e),bw=bv.css("display");bv.remove();if(bw==="none"||bw===""){if(!a8){a8=av.createElement("iframe");a8.frameBorder=a8.width=a8.height=0}e.appendChild(a8);if(!m||!a8.createElement){m=(a8.contentWindow||a8.contentDocument).document;m.write((av.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>");m.close()}bv=m.createElement(bx);m.body.appendChild(bv);bw=b.css(bv,"display");e.removeChild(a8)}Q[bx]=bw}return Q[bx]}var V=/^t(?:able|d|h)$/i,ad=/^(?:body|html)$/i;if("getBoundingClientRect" in av.documentElement){b.fn.offset=function(bI){var by=this[0],bB;if(bI){return this.each(function(e){b.offset.setOffset(this,bI,e)})}if(!by||!by.ownerDocument){return null}if(by===by.ownerDocument.body){return b.offset.bodyOffset(by)}try{bB=by.getBoundingClientRect()}catch(bF){}var bH=by.ownerDocument,bw=bH.documentElement;if(!bB||!b.contains(bw,by)){return bB?{top:bB.top,left:bB.left}:{top:0,left:0}}var bC=bH.body,bD=aK(bH),bA=bw.clientTop||bC.clientTop||0,bE=bw.clientLeft||bC.clientLeft||0,bv=bD.pageYOffset||b.support.boxModel&&bw.scrollTop||bC.scrollTop,bz=bD.pageXOffset||b.support.boxModel&&bw.scrollLeft||bC.scrollLeft,bG=bB.top+bv-bA,bx=bB.left+bz-bE;return{top:bG,left:bx}}}else{b.fn.offset=function(bF){var bz=this[0];if(bF){return this.each(function(bG){b.offset.setOffset(this,bF,bG)})}if(!bz||!bz.ownerDocument){return null}if(bz===bz.ownerDocument.body){return b.offset.bodyOffset(bz)}var bC,bw=bz.offsetParent,bv=bz,bE=bz.ownerDocument,bx=bE.documentElement,bA=bE.body,bB=bE.defaultView,e=bB?bB.getComputedStyle(bz,null):bz.currentStyle,bD=bz.offsetTop,by=bz.offsetLeft;while((bz=bz.parentNode)&&bz!==bA&&bz!==bx){if(b.support.fixedPosition&&e.position==="fixed"){break}bC=bB?bB.getComputedStyle(bz,null):bz.currentStyle;bD-=bz.scrollTop;by-=bz.scrollLeft;if(bz===bw){bD+=bz.offsetTop;by+=bz.offsetLeft;if(b.support.doesNotAddBorder&&!(b.support.doesAddBorderForTableAndCells&&V.test(bz.nodeName))){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}bv=bw;bw=bz.offsetParent}if(b.support.subtractsBorderForOverflowNotVisible&&bC.overflow!=="visible"){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}e=bC}if(e.position==="relative"||e.position==="static"){bD+=bA.offsetTop;by+=bA.offsetLeft}if(b.support.fixedPosition&&e.position==="fixed"){bD+=Math.max(bx.scrollTop,bA.scrollTop);by+=Math.max(bx.scrollLeft,bA.scrollLeft)}return{top:bD,left:by}}}b.offset={bodyOffset:function(e){var bw=e.offsetTop,bv=e.offsetLeft;if(b.support.doesNotIncludeMarginInBodyOffset){bw+=parseFloat(b.css(e,"marginTop"))||0;bv+=parseFloat(b.css(e,"marginLeft"))||0}return{top:bw,left:bv}},setOffset:function(bx,bG,bA){var bB=b.css(bx,"position");if(bB==="static"){bx.style.position="relative"}var bz=b(bx),bv=bz.offset(),e=b.css(bx,"top"),bE=b.css(bx,"left"),bF=(bB==="absolute"||bB==="fixed")&&b.inArray("auto",[e,bE])>-1,bD={},bC={},bw,by;if(bF){bC=bz.position();bw=bC.top;by=bC.left}else{bw=parseFloat(e)||0;by=parseFloat(bE)||0}if(b.isFunction(bG)){bG=bG.call(bx,bA,bv)}if(bG.top!=null){bD.top=(bG.top-bv.top)+bw}if(bG.left!=null){bD.left=(bG.left-bv.left)+by}if("using" in bG){bG.using.call(bx,bD)}else{bz.css(bD)}}};b.fn.extend({position:function(){if(!this[0]){return null}var bw=this[0],bv=this.offsetParent(),bx=this.offset(),e=ad.test(bv[0].nodeName)?{top:0,left:0}:bv.offset();bx.top-=parseFloat(b.css(bw,"marginTop"))||0;bx.left-=parseFloat(b.css(bw,"marginLeft"))||0;e.top+=parseFloat(b.css(bv[0],"borderTopWidth"))||0;e.left+=parseFloat(b.css(bv[0],"borderLeftWidth"))||0;return{top:bx.top-e.top,left:bx.left-e.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||av.body;while(e&&(!ad.test(e.nodeName)&&b.css(e,"position")==="static")){e=e.offsetParent}return e})}});b.each(["Left","Top"],function(bv,e){var bw="scroll"+e;b.fn[bw]=function(bz){var bx,by;if(bz===L){bx=this[0];if(!bx){return null}by=aK(bx);return by?("pageXOffset" in by)?by[bv?"pageYOffset":"pageXOffset"]:b.support.boxModel&&by.document.documentElement[bw]||by.document.body[bw]:bx[bw]}return this.each(function(){by=aK(this);if(by){by.scrollTo(!bv?bz:b(by).scrollLeft(),bv?bz:b(by).scrollTop())}else{this[bw]=bz}})}});function aK(e){return b.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:false}b.each(["Height","Width"],function(bv,e){var bw=e.toLowerCase();b.fn["inner"+e]=function(){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,"padding")):this[bw]():null};b.fn["outer"+e]=function(by){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,by?"margin":"border")):this[bw]():null};b.fn[bw]=function(bz){var bA=this[0];if(!bA){return bz==null?null:this}if(b.isFunction(bz)){return this.each(function(bE){var bD=b(this);bD[bw](bz.call(this,bE,bD[bw]()))})}if(b.isWindow(bA)){var bB=bA.document.documentElement["client"+e],bx=bA.document.body;return bA.document.compatMode==="CSS1Compat"&&bB||bx&&bx["client"+e]||bB}else{if(bA.nodeType===9){return Math.max(bA.documentElement["client"+e],bA.body["scroll"+e],bA.documentElement["scroll"+e],bA.body["offset"+e],bA.documentElement["offset"+e])}else{if(bz===L){var bC=b.css(bA,bw),by=parseFloat(bC);return b.isNumeric(by)?by:bC}else{return this.css(bw,typeof bz==="string"?bz:bz+"px")}}}}});bb.jQuery=bb.$=b;if(typeof define==="function"&&define.amd&&define.amd.jQuery){define("jquery",[],function(){return b})}})(window);/*
* jQuery UI 1.8.18
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
@@ -29,7 +29,7 @@
*
* http://docs.jquery.com/UI
*/
-(function(a,d){a.ui=a.ui||{};if(a.ui.version){return}a.extend(a.ui,{version:"1.8.18",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(e,f){return typeof e==="number"?this.each(function(){var g=this;setTimeout(function(){a(g).focus();if(f){f.call(g)}},e)}):this._focus.apply(this,arguments)},scrollParent:function(){var e;if((a.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){e=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(a.curCSS(this,"position",1))&&(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}else{e=this.parents().filter(function(){return(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!e.length?a(document):e},zIndex:function(h){if(h!==d){return this.css("zIndex",h)}if(this.length){var f=a(this[0]),e,g;while(f.length&&f[0]!==document){e=f.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){g=parseInt(f.css("zIndex"),10);if(!isNaN(g)&&g!==0){return g}}f=f.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});a.each(["Width","Height"],function(g,e){var f=e==="Width"?["Left","Right"]:["Top","Bottom"],h=e.toLowerCase(),k={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};function j(m,l,i,n){a.each(f,function(){l-=parseFloat(a.curCSS(m,"padding"+this,true))||0;if(i){l-=parseFloat(a.curCSS(m,"border"+this+"Width",true))||0}if(n){l-=parseFloat(a.curCSS(m,"margin"+this,true))||0}});return l}a.fn["inner"+e]=function(i){if(i===d){return k["inner"+e].call(this)}return this.each(function(){a(this).css(h,j(this,i)+"px")})};a.fn["outer"+e]=function(i,l){if(typeof i!=="number"){return k["outer"+e].call(this,i)}return this.each(function(){a(this).css(h,j(this,i,true,l)+"px")})}});function c(g,e){var j=g.nodeName.toLowerCase();if("area"===j){var i=g.parentNode,h=i.name,f;if(!g.href||!h||i.nodeName.toLowerCase()!=="map"){return false}f=a("img[usemap=#"+h+"]")[0];return !!f&&b(f)}return(/input|select|textarea|button|object/.test(j)?!g.disabled:"a"==j?g.href||e:e)&&b(g)}function b(e){return !a(e).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.extend(a.expr[":"],{data:function(g,f,e){return !!a.data(g,e[3])},focusable:function(e){return c(e,!isNaN(a.attr(e,"tabindex")))},tabbable:function(g){var e=a.attr(g,"tabindex"),f=isNaN(e);return(f||e>=0)&&c(g,!f)}});a(function(){var e=document.body,f=e.appendChild(f=document.createElement("div"));f.offsetHeight;a.extend(f.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});a.support.minHeight=f.offsetHeight===100;a.support.selectstart="onselectstart" in f;e.removeChild(f).style.display="none"});a.extend(a.ui,{plugin:{add:function(f,g,j){var h=a.ui[f].prototype;for(var e in j){h.plugins[e]=h.plugins[e]||[];h.plugins[e].push([g,j[e]])}},call:function(e,g,f){var j=e.plugins[g];if(!j||!e.element[0].parentNode){return}for(var h=0;h<j.length;h++){if(e.options[j[h][0]]){j[h][1].apply(e.element,f)}}}},contains:function(f,e){return document.compareDocumentPosition?f.compareDocumentPosition(e)&16:f!==e&&f.contains(e)},hasScroll:function(h,f){if(a(h).css("overflow")==="hidden"){return false}var e=(f&&f==="left")?"scrollLeft":"scrollTop",g=false;if(h[e]>0){return true}h[e]=1;g=(h[e]>0);h[e]=0;return g},isOverAxis:function(f,e,g){return(f>e)&&(f<(e+g))},isOver:function(j,f,i,h,e,g){return a.ui.isOverAxis(j,i,e)&&a.ui.isOverAxis(f,h,g)}})})(jQuery);/*!
+(function(a,d){a.ui=a.ui||{};if(a.ui.version){return}a.extend(a.ui,{version:"1.8.18",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(e,f){return typeof e==="number"?this.each(function(){var g=this;setTimeout(function(){a(g).focus();if(f){f.call(g)}},e)}):this._focus.apply(this,arguments)},scrollParent:function(){var e;if((a.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){e=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(a.curCSS(this,"position",1))&&(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}else{e=this.parents().filter(function(){return(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!e.length?a(document):e},zIndex:function(h){if(h!==d){return this.css("zIndex",h)}if(this.length){var f=a(this[0]),e,g;while(f.length&&f[0]!==document){e=f.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){g=parseInt(f.css("zIndex"),10);if(!isNaN(g)&&g!==0){return g}}f=f.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});a.each(["Width","Height"],function(g,e){var f=e==="Width"?["Left","Right"]:["Top","Bottom"],h=e.toLowerCase(),k={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};function j(m,l,i,n){a.each(f,function(){l-=parseFloat(a.curCSS(m,"padding"+this,true))||0;if(i){l-=parseFloat(a.curCSS(m,"border"+this+"Width",true))||0}if(n){l-=parseFloat(a.curCSS(m,"margin"+this,true))||0}});return l}a.fn["inner"+e]=function(i){if(i===d){return k["inner"+e].call(this)}return this.each(function(){a(this).css(h,j(this,i)+"px")})};a.fn["outer"+e]=function(i,l){if(typeof i!=="number"){return k["outer"+e].call(this,i)}return this.each(function(){a(this).css(h,j(this,i,true,l)+"px")})}});function c(g,e){var j=g.nodeName.toLowerCase();if("area"===j){var i=g.parentNode,h=i.name,f;if(!g.href||!h||i.nodeName.toLowerCase()!=="map"){return false}f=a("img[usemap=#"+h+"]")[0];return !!f&&b(f)}return(/input|select|textarea|button|object/.test(j)?!g.disabled:"a"==j?g.href||e:e)&&b(g)}function b(e){return !a(e).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.extend(a.expr[":"],{data:function(g,f,e){return !!a.data(g,e[3])},focusable:function(e){return c(e,!isNaN(a.attr(e,"tabindex")))},tabbable:function(g){var e=a.attr(g,"tabindex"),f=isNaN(e);return(f||e>=0)&&c(g,!f)}});a(function(){var e=document.body,f=e.appendChild(f=document.createElement("div"));f.offsetHeight;a.extend(f.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});a.support.minHeight=f.offsetHeight===100;a.support.selectstart="onselectstart" in f;e.removeChild(f).style.display="none"});a.extend(a.ui,{plugin:{add:function(f,g,j){var h=a.ui[f].prototype;for(var e in j){h.plugins[e]=h.plugins[e]||[];h.plugins[e].push([g,j[e]])}},call:function(e,g,f){var j=e.plugins[g];if(!j||!e.element[0].parentNode){return}for(var h=0;h<j.length;h++){if(e.options[j[h][0]]){j[h][1].apply(e.element,f)}}}},contains:function(f,e){return document.compareDocumentPosition?f.compareDocumentPosition(e)&16:f!==e&&f.contains(e)},hasScroll:function(h,f){if(a(h).css("overflow")==="hidden"){return false}var e=(f&&f==="left")?"scrollLeft":"scrollTop",g=false;if(h[e]>0){return true}h[e]=1;g=(h[e]>0);h[e]=0;return g},isOverAxis:function(f,e,g){return(f>e)&&(f<(e+g))},isOver:function(j,f,i,h,e,g){return a.ui.isOverAxis(j,i,e)&&a.ui.isOverAxis(f,h,g)}})})(jQuery);/*
* jQuery UI Widget 1.8.18
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
@@ -38,7 +38,7 @@
*
* http://docs.jquery.com/UI/Widget
*/
-(function(b,d){if(b.cleanData){var c=b.cleanData;b.cleanData=function(f){for(var g=0,h;(h=f[g])!=null;g++){try{b(h).triggerHandler("remove")}catch(j){}}c(f)}}else{var a=b.fn.remove;b.fn.remove=function(e,f){return this.each(function(){if(!f){if(!e||b.filter(e,[this]).length){b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(g){}})}}return a.call(b(this),e,f)})}}b.widget=function(f,h,e){var g=f.split(".")[0],j;f=f.split(".")[1];j=g+"-"+f;if(!e){e=h;h=b.Widget}b.expr[":"][j]=function(k){return !!b.data(k,f)};b[g]=b[g]||{};b[g][f]=function(k,l){if(arguments.length){this._createWidget(k,l)}};var i=new h();i.options=b.extend(true,{},i.options);b[g][f].prototype=b.extend(true,i,{namespace:g,widgetName:f,widgetEventPrefix:b[g][f].prototype.widgetEventPrefix||f,widgetBaseClass:j},e);b.widget.bridge(f,b[g][f])};b.widget.bridge=function(f,e){b.fn[f]=function(i){var g=typeof i==="string",h=Array.prototype.slice.call(arguments,1),j=this;i=!g&&h.length?b.extend.apply(null,[true,i].concat(h)):i;if(g&&i.charAt(0)==="_"){return j}if(g){this.each(function(){var k=b.data(this,f),l=k&&b.isFunction(k[i])?k[i].apply(k,h):k;if(l!==k&&l!==d){j=l;return false}})}else{this.each(function(){var k=b.data(this,f);if(k){k.option(i||{})._init()}else{b.data(this,f,new e(i,this))}})}return j}};b.Widget=function(e,f){if(arguments.length){this._createWidget(e,f)}};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(f,g){b.data(g,this.widgetName,this);this.element=b(g);this.options=b.extend(true,{},this.options,this._getCreateOptions(),f);var e=this;this.element.bind("remove."+this.widgetName,function(){e.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(f,g){var e=f;if(arguments.length===0){return b.extend({},this.options)}if(typeof f==="string"){if(g===d){return this.options[f]}e={};e[f]=g}this._setOptions(e);return this},_setOptions:function(f){var e=this;b.each(f,function(g,h){e._setOption(g,h)});return this},_setOption:function(e,f){this.options[e]=f;if(e==="disabled"){this.widget()[f?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",f)}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(e,f,g){var j,i,h=this.options[e];g=g||{};f=b.Event(f);f.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase();f.target=this.element[0];i=f.originalEvent;if(i){for(j in i){if(!(j in f)){f[j]=i[j]}}}this.element.trigger(f,g);return !(b.isFunction(h)&&h.call(this.element[0],f,g)===false||f.isDefaultPrevented())}}})(jQuery);/*!
+(function(b,d){if(b.cleanData){var c=b.cleanData;b.cleanData=function(f){for(var g=0,h;(h=f[g])!=null;g++){try{b(h).triggerHandler("remove")}catch(j){}}c(f)}}else{var a=b.fn.remove;b.fn.remove=function(e,f){return this.each(function(){if(!f){if(!e||b.filter(e,[this]).length){b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(g){}})}}return a.call(b(this),e,f)})}}b.widget=function(f,h,e){var g=f.split(".")[0],j;f=f.split(".")[1];j=g+"-"+f;if(!e){e=h;h=b.Widget}b.expr[":"][j]=function(k){return !!b.data(k,f)};b[g]=b[g]||{};b[g][f]=function(k,l){if(arguments.length){this._createWidget(k,l)}};var i=new h();i.options=b.extend(true,{},i.options);b[g][f].prototype=b.extend(true,i,{namespace:g,widgetName:f,widgetEventPrefix:b[g][f].prototype.widgetEventPrefix||f,widgetBaseClass:j},e);b.widget.bridge(f,b[g][f])};b.widget.bridge=function(f,e){b.fn[f]=function(i){var g=typeof i==="string",h=Array.prototype.slice.call(arguments,1),j=this;i=!g&&h.length?b.extend.apply(null,[true,i].concat(h)):i;if(g&&i.charAt(0)==="_"){return j}if(g){this.each(function(){var k=b.data(this,f),l=k&&b.isFunction(k[i])?k[i].apply(k,h):k;if(l!==k&&l!==d){j=l;return false}})}else{this.each(function(){var k=b.data(this,f);if(k){k.option(i||{})._init()}else{b.data(this,f,new e(i,this))}})}return j}};b.Widget=function(e,f){if(arguments.length){this._createWidget(e,f)}};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(f,g){b.data(g,this.widgetName,this);this.element=b(g);this.options=b.extend(true,{},this.options,this._getCreateOptions(),f);var e=this;this.element.bind("remove."+this.widgetName,function(){e.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(f,g){var e=f;if(arguments.length===0){return b.extend({},this.options)}if(typeof f==="string"){if(g===d){return this.options[f]}e={};e[f]=g}this._setOptions(e);return this},_setOptions:function(f){var e=this;b.each(f,function(g,h){e._setOption(g,h)});return this},_setOption:function(e,f){this.options[e]=f;if(e==="disabled"){this.widget()[f?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",f)}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(e,f,g){var j,i,h=this.options[e];g=g||{};f=b.Event(f);f.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase();f.target=this.element[0];i=f.originalEvent;if(i){for(j in i){if(!(j in f)){f[j]=i[j]}}}this.element.trigger(f,g);return !(b.isFunction(h)&&h.call(this.element[0],f,g)===false||f.isDefaultPrevented())}}})(jQuery);/*
* jQuery UI Mouse 1.8.18
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
@@ -50,7 +50,7 @@
* Depends:
* jquery.ui.widget.js
*/
-(function(b,c){var a=false;b(document).mouseup(function(d){a=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var d=this;this.element.bind("mousedown."+this.widgetName,function(e){return d._mouseDown(e)}).bind("click."+this.widgetName,function(e){if(true===b.data(e.target,d.widgetName+".preventClickEvent")){b.removeData(e.target,d.widgetName+".preventClickEvent");e.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(f){if(a){return}(this._mouseStarted&&this._mouseUp(f));this._mouseDownEvent=f;var e=this,g=(f.which==1),d=(typeof this.options.cancel=="string"&&f.target.nodeName?b(f.target).closest(this.options.cancel).length:false);if(!g||d||!this._mouseCapture(f)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){e.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(f)&&this._mouseDelayMet(f)){this._mouseStarted=(this._mouseStart(f)!==false);if(!this._mouseStarted){f.preventDefault();return true}}if(true===b.data(f.target,this.widgetName+".preventClickEvent")){b.removeData(f.target,this.widgetName+".preventClickEvent")}this._mouseMoveDelegate=function(h){return e._mouseMove(h)};this._mouseUpDelegate=function(h){return e._mouseUp(h)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);f.preventDefault();a=true;return true},_mouseMove:function(d){if(b.browser.msie&&!(document.documentMode>=9)&&!d.button){return this._mouseUp(d)}if(this._mouseStarted){this._mouseDrag(d);return d.preventDefault()}if(this._mouseDistanceMet(d)&&this._mouseDelayMet(d)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,d)!==false);(this._mouseStarted?this._mouseDrag(d):this._mouseUp(d))}return !this._mouseStarted},_mouseUp:function(d){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(d.target==this._mouseDownEvent.target){b.data(d.target,this.widgetName+".preventClickEvent",true)}this._mouseStop(d)}return false},_mouseDistanceMet:function(d){return(Math.max(Math.abs(this._mouseDownEvent.pageX-d.pageX),Math.abs(this._mouseDownEvent.pageY-d.pageY))>=this.options.distance)},_mouseDelayMet:function(d){return this.mouseDelayMet},_mouseStart:function(d){},_mouseDrag:function(d){},_mouseStop:function(d){},_mouseCapture:function(d){return true}})})(jQuery);(function(c,d){c.widget("ui.resizable",c.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000},_create:function(){var f=this,k=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(k.aspectRatio),aspectRatio:k.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:k.helper||k.ghost||k.animate?k.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){this.element.wrap(c('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=k.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var l=this.handles.split(",");this.handles={};for(var g=0;g<l.length;g++){var j=c.trim(l[g]),e="ui-resizable-"+j;var h=c('<div class="ui-resizable-handle '+e+'"></div>');if(/sw|se|ne|nw/.test(j)){h.css({zIndex:++k.zIndex})}if("se"==j){h.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[j]=".ui-resizable-"+j;this.element.append(h)}}this._renderAxis=function(q){q=q||this.element;for(var n in this.handles){if(this.handles[n].constructor==String){this.handles[n]=c(this.handles[n],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var o=c(this.handles[n],this.element),p=0;p=/sw|ne|nw|se|n|s/.test(n)?o.outerHeight():o.outerWidth();var m=["padding",/ne|nw|n/.test(n)?"Top":/se|sw|s/.test(n)?"Bottom":/^e$/.test(n)?"Right":"Left"].join("");q.css(m,p);this._proportionallyResize()}if(!c(this.handles[n]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!f.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}f.axis=i&&i[1]?i[1]:"se"}});if(k.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){if(k.disabled){return}c(this).removeClass("ui-resizable-autohide");f._handles.show()},function(){if(k.disabled){return}if(!f.resizing){c(this).addClass("ui-resizable-autohide");f._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var e=function(g){c(g).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){e(this.element);var f=this.element;f.after(this.originalElement.css({position:f.css("position"),width:f.outerWidth(),height:f.outerHeight(),top:f.css("top"),left:f.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);e(this.originalElement);return this},_mouseCapture:function(f){var g=false;for(var e in this.handles){if(c(this.handles[e])[0]==f.target){g=true}}return !this.options.disabled&&g},_mouseStart:function(g){var j=this.options,f=this.element.position(),e=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(e.is(".ui-draggable")||(/absolute/).test(e.css("position"))){e.css({position:"absolute",top:f.top,left:f.left})}this._renderProxy();var k=b(this.helper.css("left")),h=b(this.helper.css("top"));if(j.containment){k+=c(j.containment).scrollLeft()||0;h+=c(j.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:k,top:h};this.size=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalSize=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalPosition={left:k,top:h};this.sizeDiff={width:e.outerWidth()-e.width(),height:e.outerHeight()-e.height()};this.originalMousePosition={left:g.pageX,top:g.pageY};this.aspectRatio=(typeof j.aspectRatio=="number")?j.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var i=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",i=="auto"?this.axis+"-resize":i);e.addClass("ui-resizable-resizing");this._propagate("start",g);return true},_mouseDrag:function(e){var h=this.helper,g=this.options,m={},q=this,j=this.originalMousePosition,n=this.axis;var r=(e.pageX-j.left)||0,p=(e.pageY-j.top)||0;var i=this._change[n];if(!i){return false}var l=i.apply(this,[e,r,p]),k=c.browser.msie&&c.browser.version<7,f=this.sizeDiff;this._updateVirtualBoundaries(e.shiftKey);if(this._aspectRatio||e.shiftKey){l=this._updateRatio(l,e)}l=this._respectSize(l,e);this._propagate("resize",e);h.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(l);this._trigger("resize",e,this.ui());return false},_mouseStop:function(h){this.resizing=false;var i=this.options,m=this;if(this._helper){var g=this._proportionallyResizeElements,e=g.length&&(/textarea/i).test(g[0].nodeName),f=e&&c.ui.hasScroll(g[0],"left")?0:m.sizeDiff.height,k=e?0:m.sizeDiff.width;var n={width:(m.helper.width()-k),height:(m.helper.height()-f)},j=(parseInt(m.element.css("left"),10)+(m.position.left-m.originalPosition.left))||null,l=(parseInt(m.element.css("top"),10)+(m.position.top-m.originalPosition.top))||null;if(!i.animate){this.element.css(c.extend(n,{top:l,left:j}))}m.helper.height(m.size.height);m.helper.width(m.size.width);if(this._helper&&!i.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",h);if(this._helper){this.helper.remove()}return false},_updateVirtualBoundaries:function(g){var j=this.options,i,h,f,k,e;e={minWidth:a(j.minWidth)?j.minWidth:0,maxWidth:a(j.maxWidth)?j.maxWidth:Infinity,minHeight:a(j.minHeight)?j.minHeight:0,maxHeight:a(j.maxHeight)?j.maxHeight:Infinity};if(this._aspectRatio||g){i=e.minHeight*this.aspectRatio;f=e.minWidth/this.aspectRatio;h=e.maxHeight*this.aspectRatio;k=e.maxWidth/this.aspectRatio;if(i>e.minWidth){e.minWidth=i}if(f>e.minHeight){e.minHeight=f}if(h<e.maxWidth){e.maxWidth=h}if(k<e.maxHeight){e.maxHeight=k}}this._vBoundaries=e},_updateCache:function(e){var f=this.options;this.offset=this.helper.offset();if(a(e.left)){this.position.left=e.left}if(a(e.top)){this.position.top=e.top}if(a(e.height)){this.size.height=e.height}if(a(e.width)){this.size.width=e.width}},_updateRatio:function(h,g){var i=this.options,j=this.position,f=this.size,e=this.axis;if(a(h.height)){h.width=(h.height*this.aspectRatio)}else{if(a(h.width)){h.height=(h.width/this.aspectRatio)}}if(e=="sw"){h.left=j.left+(f.width-h.width);h.top=null}if(e=="nw"){h.top=j.top+(f.height-h.height);h.left=j.left+(f.width-h.width)}return h},_respectSize:function(l,g){var j=this.helper,i=this._vBoundaries,r=this._aspectRatio||g.shiftKey,q=this.axis,t=a(l.width)&&i.maxWidth&&(i.maxWidth<l.width),m=a(l.height)&&i.maxHeight&&(i.maxHeight<l.height),h=a(l.width)&&i.minWidth&&(i.minWidth>l.width),s=a(l.height)&&i.minHeight&&(i.minHeight>l.height);if(h){l.width=i.minWidth}if(s){l.height=i.minHeight}if(t){l.width=i.maxWidth}if(m){l.height=i.maxHeight}var f=this.originalPosition.left+this.originalSize.width,p=this.position.top+this.size.height;var k=/sw|nw|w/.test(q),e=/nw|ne|n/.test(q);if(h&&k){l.left=f-i.minWidth}if(t&&k){l.left=f-i.maxWidth}if(s&&e){l.top=p-i.minHeight}if(m&&e){l.top=p-i.maxHeight}var n=!l.width&&!l.height;if(n&&!l.left&&l.top){l.top=null}else{if(n&&!l.top&&l.left){l.left=null}}return l},_proportionallyResize:function(){var k=this.options;if(!this._proportionallyResizeElements.length){return}var g=this.helper||this.element;for(var f=0;f<this._proportionallyResizeElements.length;f++){var h=this._proportionallyResizeElements[f];if(!this.borderDif){var e=[h.css("borderTopWidth"),h.css("borderRightWidth"),h.css("borderBottomWidth"),h.css("borderLeftWidth")],j=[h.css("paddingTop"),h.css("paddingRight"),h.css("paddingBottom"),h.css("paddingLeft")];this.borderDif=c.map(e,function(l,n){var m=parseInt(l,10)||0,o=parseInt(j[n],10)||0;return m+o})}if(c.browser.msie&&!(!(c(g).is(":hidden")||c(g).parents(":hidden").length))){continue}h.css({height:(g.height()-this.borderDif[0]-this.borderDif[2])||0,width:(g.width()-this.borderDif[1]-this.borderDif[3])||0})}},_renderProxy:function(){var f=this.element,i=this.options;this.elementOffset=f.offset();if(this._helper){this.helper=this.helper||c('<div style="overflow:hidden;"></div>');var e=c.browser.msie&&c.browser.version<7,g=(e?1:0),h=(e?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+h,height:this.element.outerHeight()+h,position:"absolute",left:this.elementOffset.left-g+"px",top:this.elementOffset.top-g+"px",zIndex:++i.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(g,f,e){return{width:this.originalSize.width+f}},w:function(h,f,e){var j=this.options,g=this.originalSize,i=this.originalPosition;return{left:i.left+f,width:g.width-f}},n:function(h,f,e){var j=this.options,g=this.originalSize,i=this.originalPosition;return{top:i.top+e,height:g.height-e}},s:function(g,f,e){return{height:this.originalSize.height+e}},se:function(g,f,e){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[g,f,e]))},sw:function(g,f,e){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[g,f,e]))},ne:function(g,f,e){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[g,f,e]))},nw:function(g,f,e){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[g,f,e]))}},_propagate:function(f,e){c.ui.plugin.call(this,f,[e,this.ui()]);(f!="resize"&&this._trigger(f,e,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});c.extend(c.ui.resizable,{version:"1.8.18"});c.ui.plugin.add("resizable","alsoResize",{start:function(f,g){var e=c(this).data("resizable"),i=e.options;var h=function(j){c(j).each(function(){var k=c(this);k.data("resizable-alsoresize",{width:parseInt(k.width(),10),height:parseInt(k.height(),10),left:parseInt(k.css("left"),10),top:parseInt(k.css("top"),10)})})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.parentNode){if(i.alsoResize.length){i.alsoResize=i.alsoResize[0];h(i.alsoResize)}else{c.each(i.alsoResize,function(j){h(j)})}}else{h(i.alsoResize)}},resize:function(g,i){var f=c(this).data("resizable"),j=f.options,h=f.originalSize,l=f.originalPosition;var k={height:(f.size.height-h.height)||0,width:(f.size.width-h.width)||0,top:(f.position.top-l.top)||0,left:(f.position.left-l.left)||0},e=function(m,n){c(m).each(function(){var q=c(this),r=c(this).data("resizable-alsoresize"),p={},o=n&&n.length?n:q.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];c.each(o,function(s,u){var t=(r[u]||0)+(k[u]||0);if(t&&t>=0){p[u]=t||null}});q.css(p)})};if(typeof(j.alsoResize)=="object"&&!j.alsoResize.nodeType){c.each(j.alsoResize,function(m,n){e(m,n)})}else{e(j.alsoResize)}},stop:function(e,f){c(this).removeData("resizable-alsoresize")}});c.ui.plugin.add("resizable","animate",{stop:function(i,n){var p=c(this).data("resizable"),j=p.options;var h=p._proportionallyResizeElements,e=h.length&&(/textarea/i).test(h[0].nodeName),f=e&&c.ui.hasScroll(h[0],"left")?0:p.sizeDiff.height,l=e?0:p.sizeDiff.width;var g={width:(p.size.width-l),height:(p.size.height-f)},k=(parseInt(p.element.css("left"),10)+(p.position.left-p.originalPosition.left))||null,m=(parseInt(p.element.css("top"),10)+(p.position.top-p.originalPosition.top))||null;p.element.animate(c.extend(g,m&&k?{top:m,left:k}:{}),{duration:j.animateDuration,easing:j.animateEasing,step:function(){var o={width:parseInt(p.element.css("width"),10),height:parseInt(p.element.css("height"),10),top:parseInt(p.element.css("top"),10),left:parseInt(p.element.css("left"),10)};if(h&&h.length){c(h[0]).css({width:o.width,height:o.height})}p._updateCache(o);p._propagate("resize",i)}})}});c.ui.plugin.add("resizable","containment",{start:function(f,r){var t=c(this).data("resizable"),j=t.options,l=t.element;var g=j.containment,k=(g instanceof c)?g.get(0):(/parent/.test(g))?l.parent().get(0):g;if(!k){return}t.containerElement=c(k);if(/document/.test(g)||g==document){t.containerOffset={left:0,top:0};t.containerPosition={left:0,top:0};t.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var n=c(k),i=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){i[p]=b(n.css("padding"+o))});t.containerOffset=n.offset();t.containerPosition=n.position();t.containerSize={height:(n.innerHeight()-i[3]),width:(n.innerWidth()-i[1])};var q=t.containerOffset,e=t.containerSize.height,m=t.containerSize.width,h=(c.ui.hasScroll(k,"left")?k.scrollWidth:m),s=(c.ui.hasScroll(k)?k.scrollHeight:e);t.parentData={element:k,left:q.left,top:q.top,width:h,height:s}}},resize:function(g,q){var t=c(this).data("resizable"),i=t.options,f=t.containerSize,p=t.containerOffset,m=t.size,n=t.position,r=t._aspectRatio||g.shiftKey,e={top:0,left:0},h=t.containerElement;if(h[0]!=document&&(/static/).test(h.css("position"))){e=p}if(n.left<(t._helper?p.left:0)){t.size.width=t.size.width+(t._helper?(t.position.left-p.left):(t.position.left-e.left));if(r){t.size.height=t.size.width/i.aspectRatio}t.position.left=i.helper?p.left:0}if(n.top<(t._helper?p.top:0)){t.size.height=t.size.height+(t._helper?(t.position.top-p.top):t.position.top);if(r){t.size.width=t.size.height*i.aspectRatio}t.position.top=t._helper?p.top:0}t.offset.left=t.parentData.left+t.position.left;t.offset.top=t.parentData.top+t.position.top;var l=Math.abs((t._helper?t.offset.left-e.left:(t.offset.left-e.left))+t.sizeDiff.width),s=Math.abs((t._helper?t.offset.top-e.top:(t.offset.top-p.top))+t.sizeDiff.height);var k=t.containerElement.get(0)==t.element.parent().get(0),j=/relative|absolute/.test(t.containerElement.css("position"));if(k&&j){l-=t.parentData.left}if(l+t.size.width>=t.parentData.width){t.size.width=t.parentData.width-l;if(r){t.size.height=t.size.width/t.aspectRatio}}if(s+t.size.height>=t.parentData.height){t.size.height=t.parentData.height-s;if(r){t.size.width=t.size.height*t.aspectRatio}}},stop:function(f,n){var q=c(this).data("resizable"),g=q.options,l=q.position,m=q.containerOffset,e=q.containerPosition,i=q.containerElement;var j=c(q.helper),r=j.offset(),p=j.outerWidth()-q.sizeDiff.width,k=j.outerHeight()-q.sizeDiff.height;if(q._helper&&!g.animate&&(/relative/).test(i.css("position"))){c(this).css({left:r.left-e.left-m.left,width:p,height:k})}if(q._helper&&!g.animate&&(/static/).test(i.css("position"))){c(this).css({left:r.left-e.left-m.left,width:p,height:k})}}});c.ui.plugin.add("resizable","ghost",{start:function(g,h){var e=c(this).data("resizable"),i=e.options,f=e.size;e.ghost=e.originalElement.clone();e.ghost.css({opacity:0.25,display:"block",position:"relative",height:f.height,width:f.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof i.ghost=="string"?i.ghost:"");e.ghost.appendTo(e.helper)},resize:function(f,g){var e=c(this).data("resizable"),h=e.options;if(e.ghost){e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})}},stop:function(f,g){var e=c(this).data("resizable"),h=e.options;if(e.ghost&&e.helper){e.helper.get(0).removeChild(e.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(e,m){var p=c(this).data("resizable"),h=p.options,k=p.size,i=p.originalSize,j=p.originalPosition,n=p.axis,l=h._aspectRatio||e.shiftKey;h.grid=typeof h.grid=="number"?[h.grid,h.grid]:h.grid;var g=Math.round((k.width-i.width)/(h.grid[0]||1))*(h.grid[0]||1),f=Math.round((k.height-i.height)/(h.grid[1]||1))*(h.grid[1]||1);if(/^(se|s|e)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f}else{if(/^(ne)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f;p.position.top=j.top-f}else{if(/^(sw)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f;p.position.left=j.left-g}else{p.size.width=i.width+g;p.size.height=i.height+f;p.position.top=j.top-f;p.position.left=j.left-g}}}}});var b=function(e){return parseInt(e,10)||0};var a=function(e){return !isNaN(parseInt(e,10))}})(jQuery);/*!
+(function(b,c){var a=false;b(document).mouseup(function(d){a=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var d=this;this.element.bind("mousedown."+this.widgetName,function(e){return d._mouseDown(e)}).bind("click."+this.widgetName,function(e){if(true===b.data(e.target,d.widgetName+".preventClickEvent")){b.removeData(e.target,d.widgetName+".preventClickEvent");e.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(f){if(a){return}(this._mouseStarted&&this._mouseUp(f));this._mouseDownEvent=f;var e=this,g=(f.which==1),d=(typeof this.options.cancel=="string"&&f.target.nodeName?b(f.target).closest(this.options.cancel).length:false);if(!g||d||!this._mouseCapture(f)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){e.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(f)&&this._mouseDelayMet(f)){this._mouseStarted=(this._mouseStart(f)!==false);if(!this._mouseStarted){f.preventDefault();return true}}if(true===b.data(f.target,this.widgetName+".preventClickEvent")){b.removeData(f.target,this.widgetName+".preventClickEvent")}this._mouseMoveDelegate=function(h){return e._mouseMove(h)};this._mouseUpDelegate=function(h){return e._mouseUp(h)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);f.preventDefault();a=true;return true},_mouseMove:function(d){if(b.browser.msie&&!(document.documentMode>=9)&&!d.button){return this._mouseUp(d)}if(this._mouseStarted){this._mouseDrag(d);return d.preventDefault()}if(this._mouseDistanceMet(d)&&this._mouseDelayMet(d)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,d)!==false);(this._mouseStarted?this._mouseDrag(d):this._mouseUp(d))}return !this._mouseStarted},_mouseUp:function(d){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(d.target==this._mouseDownEvent.target){b.data(d.target,this.widgetName+".preventClickEvent",true)}this._mouseStop(d)}return false},_mouseDistanceMet:function(d){return(Math.max(Math.abs(this._mouseDownEvent.pageX-d.pageX),Math.abs(this._mouseDownEvent.pageY-d.pageY))>=this.options.distance)},_mouseDelayMet:function(d){return this.mouseDelayMet},_mouseStart:function(d){},_mouseDrag:function(d){},_mouseStop:function(d){},_mouseCapture:function(d){return true}})})(jQuery);(function(c,d){c.widget("ui.resizable",c.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000},_create:function(){var f=this,k=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(k.aspectRatio),aspectRatio:k.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:k.helper||k.ghost||k.animate?k.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){this.element.wrap(c('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=k.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var l=this.handles.split(",");this.handles={};for(var g=0;g<l.length;g++){var j=c.trim(l[g]),e="ui-resizable-"+j;var h=c('<div class="ui-resizable-handle '+e+'"></div>');if(/sw|se|ne|nw/.test(j)){h.css({zIndex:++k.zIndex})}if("se"==j){h.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[j]=".ui-resizable-"+j;this.element.append(h)}}this._renderAxis=function(q){q=q||this.element;for(var n in this.handles){if(this.handles[n].constructor==String){this.handles[n]=c(this.handles[n],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var o=c(this.handles[n],this.element),p=0;p=/sw|ne|nw|se|n|s/.test(n)?o.outerHeight():o.outerWidth();var m=["padding",/ne|nw|n/.test(n)?"Top":/se|sw|s/.test(n)?"Bottom":/^e$/.test(n)?"Right":"Left"].join("");q.css(m,p);this._proportionallyResize()}if(!c(this.handles[n]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!f.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}f.axis=i&&i[1]?i[1]:"se"}});if(k.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){if(k.disabled){return}c(this).removeClass("ui-resizable-autohide");f._handles.show()},function(){if(k.disabled){return}if(!f.resizing){c(this).addClass("ui-resizable-autohide");f._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var e=function(g){c(g).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){e(this.element);var f=this.element;f.after(this.originalElement.css({position:f.css("position"),width:f.outerWidth(),height:f.outerHeight(),top:f.css("top"),left:f.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);e(this.originalElement);return this},_mouseCapture:function(f){var g=false;for(var e in this.handles){if(c(this.handles[e])[0]==f.target){g=true}}return !this.options.disabled&&g},_mouseStart:function(g){var j=this.options,f=this.element.position(),e=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(e.is(".ui-draggable")||(/absolute/).test(e.css("position"))){e.css({position:"absolute",top:f.top,left:f.left})}this._renderProxy();var k=b(this.helper.css("left")),h=b(this.helper.css("top"));if(j.containment){k+=c(j.containment).scrollLeft()||0;h+=c(j.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:k,top:h};this.size=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalSize=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalPosition={left:k,top:h};this.sizeDiff={width:e.outerWidth()-e.width(),height:e.outerHeight()-e.height()};this.originalMousePosition={left:g.pageX,top:g.pageY};this.aspectRatio=(typeof j.aspectRatio=="number")?j.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var i=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",i=="auto"?this.axis+"-resize":i);e.addClass("ui-resizable-resizing");this._propagate("start",g);return true},_mouseDrag:function(e){var h=this.helper,g=this.options,m={},q=this,j=this.originalMousePosition,n=this.axis;var r=(e.pageX-j.left)||0,p=(e.pageY-j.top)||0;var i=this._change[n];if(!i){return false}var l=i.apply(this,[e,r,p]),k=c.browser.msie&&c.browser.version<7,f=this.sizeDiff;this._updateVirtualBoundaries(e.shiftKey);if(this._aspectRatio||e.shiftKey){l=this._updateRatio(l,e)}l=this._respectSize(l,e);this._propagate("resize",e);h.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(l);this._trigger("resize",e,this.ui());return false},_mouseStop:function(h){this.resizing=false;var i=this.options,m=this;if(this._helper){var g=this._proportionallyResizeElements,e=g.length&&(/textarea/i).test(g[0].nodeName),f=e&&c.ui.hasScroll(g[0],"left")?0:m.sizeDiff.height,k=e?0:m.sizeDiff.width;var n={width:(m.helper.width()-k),height:(m.helper.height()-f)},j=(parseInt(m.element.css("left"),10)+(m.position.left-m.originalPosition.left))||null,l=(parseInt(m.element.css("top"),10)+(m.position.top-m.originalPosition.top))||null;if(!i.animate){this.element.css(c.extend(n,{top:l,left:j}))}m.helper.height(m.size.height);m.helper.width(m.size.width);if(this._helper&&!i.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",h);if(this._helper){this.helper.remove()}return false},_updateVirtualBoundaries:function(g){var j=this.options,i,h,f,k,e;e={minWidth:a(j.minWidth)?j.minWidth:0,maxWidth:a(j.maxWidth)?j.maxWidth:Infinity,minHeight:a(j.minHeight)?j.minHeight:0,maxHeight:a(j.maxHeight)?j.maxHeight:Infinity};if(this._aspectRatio||g){i=e.minHeight*this.aspectRatio;f=e.minWidth/this.aspectRatio;h=e.maxHeight*this.aspectRatio;k=e.maxWidth/this.aspectRatio;if(i>e.minWidth){e.minWidth=i}if(f>e.minHeight){e.minHeight=f}if(h<e.maxWidth){e.maxWidth=h}if(k<e.maxHeight){e.maxHeight=k}}this._vBoundaries=e},_updateCache:function(e){var f=this.options;this.offset=this.helper.offset();if(a(e.left)){this.position.left=e.left}if(a(e.top)){this.position.top=e.top}if(a(e.height)){this.size.height=e.height}if(a(e.width)){this.size.width=e.width}},_updateRatio:function(h,g){var i=this.options,j=this.position,f=this.size,e=this.axis;if(a(h.height)){h.width=(h.height*this.aspectRatio)}else{if(a(h.width)){h.height=(h.width/this.aspectRatio)}}if(e=="sw"){h.left=j.left+(f.width-h.width);h.top=null}if(e=="nw"){h.top=j.top+(f.height-h.height);h.left=j.left+(f.width-h.width)}return h},_respectSize:function(l,g){var j=this.helper,i=this._vBoundaries,r=this._aspectRatio||g.shiftKey,q=this.axis,t=a(l.width)&&i.maxWidth&&(i.maxWidth<l.width),m=a(l.height)&&i.maxHeight&&(i.maxHeight<l.height),h=a(l.width)&&i.minWidth&&(i.minWidth>l.width),s=a(l.height)&&i.minHeight&&(i.minHeight>l.height);if(h){l.width=i.minWidth}if(s){l.height=i.minHeight}if(t){l.width=i.maxWidth}if(m){l.height=i.maxHeight}var f=this.originalPosition.left+this.originalSize.width,p=this.position.top+this.size.height;var k=/sw|nw|w/.test(q),e=/nw|ne|n/.test(q);if(h&&k){l.left=f-i.minWidth}if(t&&k){l.left=f-i.maxWidth}if(s&&e){l.top=p-i.minHeight}if(m&&e){l.top=p-i.maxHeight}var n=!l.width&&!l.height;if(n&&!l.left&&l.top){l.top=null}else{if(n&&!l.top&&l.left){l.left=null}}return l},_proportionallyResize:function(){var k=this.options;if(!this._proportionallyResizeElements.length){return}var g=this.helper||this.element;for(var f=0;f<this._proportionallyResizeElements.length;f++){var h=this._proportionallyResizeElements[f];if(!this.borderDif){var e=[h.css("borderTopWidth"),h.css("borderRightWidth"),h.css("borderBottomWidth"),h.css("borderLeftWidth")],j=[h.css("paddingTop"),h.css("paddingRight"),h.css("paddingBottom"),h.css("paddingLeft")];this.borderDif=c.map(e,function(l,n){var m=parseInt(l,10)||0,o=parseInt(j[n],10)||0;return m+o})}if(c.browser.msie&&!(!(c(g).is(":hidden")||c(g).parents(":hidden").length))){continue}h.css({height:(g.height()-this.borderDif[0]-this.borderDif[2])||0,width:(g.width()-this.borderDif[1]-this.borderDif[3])||0})}},_renderProxy:function(){var f=this.element,i=this.options;this.elementOffset=f.offset();if(this._helper){this.helper=this.helper||c('<div style="overflow:hidden;"></div>');var e=c.browser.msie&&c.browser.version<7,g=(e?1:0),h=(e?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+h,height:this.element.outerHeight()+h,position:"absolute",left:this.elementOffset.left-g+"px",top:this.elementOffset.top-g+"px",zIndex:++i.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(g,f,e){return{width:this.originalSize.width+f}},w:function(h,f,e){var j=this.options,g=this.originalSize,i=this.originalPosition;return{left:i.left+f,width:g.width-f}},n:function(h,f,e){var j=this.options,g=this.originalSize,i=this.originalPosition;return{top:i.top+e,height:g.height-e}},s:function(g,f,e){return{height:this.originalSize.height+e}},se:function(g,f,e){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[g,f,e]))},sw:function(g,f,e){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[g,f,e]))},ne:function(g,f,e){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[g,f,e]))},nw:function(g,f,e){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[g,f,e]))}},_propagate:function(f,e){c.ui.plugin.call(this,f,[e,this.ui()]);(f!="resize"&&this._trigger(f,e,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});c.extend(c.ui.resizable,{version:"1.8.18"});c.ui.plugin.add("resizable","alsoResize",{start:function(f,g){var e=c(this).data("resizable"),i=e.options;var h=function(j){c(j).each(function(){var k=c(this);k.data("resizable-alsoresize",{width:parseInt(k.width(),10),height:parseInt(k.height(),10),left:parseInt(k.css("left"),10),top:parseInt(k.css("top"),10)})})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.parentNode){if(i.alsoResize.length){i.alsoResize=i.alsoResize[0];h(i.alsoResize)}else{c.each(i.alsoResize,function(j){h(j)})}}else{h(i.alsoResize)}},resize:function(g,i){var f=c(this).data("resizable"),j=f.options,h=f.originalSize,l=f.originalPosition;var k={height:(f.size.height-h.height)||0,width:(f.size.width-h.width)||0,top:(f.position.top-l.top)||0,left:(f.position.left-l.left)||0},e=function(m,n){c(m).each(function(){var q=c(this),r=c(this).data("resizable-alsoresize"),p={},o=n&&n.length?n:q.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];c.each(o,function(s,u){var t=(r[u]||0)+(k[u]||0);if(t&&t>=0){p[u]=t||null}});q.css(p)})};if(typeof(j.alsoResize)=="object"&&!j.alsoResize.nodeType){c.each(j.alsoResize,function(m,n){e(m,n)})}else{e(j.alsoResize)}},stop:function(e,f){c(this).removeData("resizable-alsoresize")}});c.ui.plugin.add("resizable","animate",{stop:function(i,n){var p=c(this).data("resizable"),j=p.options;var h=p._proportionallyResizeElements,e=h.length&&(/textarea/i).test(h[0].nodeName),f=e&&c.ui.hasScroll(h[0],"left")?0:p.sizeDiff.height,l=e?0:p.sizeDiff.width;var g={width:(p.size.width-l),height:(p.size.height-f)},k=(parseInt(p.element.css("left"),10)+(p.position.left-p.originalPosition.left))||null,m=(parseInt(p.element.css("top"),10)+(p.position.top-p.originalPosition.top))||null;p.element.animate(c.extend(g,m&&k?{top:m,left:k}:{}),{duration:j.animateDuration,easing:j.animateEasing,step:function(){var o={width:parseInt(p.element.css("width"),10),height:parseInt(p.element.css("height"),10),top:parseInt(p.element.css("top"),10),left:parseInt(p.element.css("left"),10)};if(h&&h.length){c(h[0]).css({width:o.width,height:o.height})}p._updateCache(o);p._propagate("resize",i)}})}});c.ui.plugin.add("resizable","containment",{start:function(f,r){var t=c(this).data("resizable"),j=t.options,l=t.element;var g=j.containment,k=(g instanceof c)?g.get(0):(/parent/.test(g))?l.parent().get(0):g;if(!k){return}t.containerElement=c(k);if(/document/.test(g)||g==document){t.containerOffset={left:0,top:0};t.containerPosition={left:0,top:0};t.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var n=c(k),i=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){i[p]=b(n.css("padding"+o))});t.containerOffset=n.offset();t.containerPosition=n.position();t.containerSize={height:(n.innerHeight()-i[3]),width:(n.innerWidth()-i[1])};var q=t.containerOffset,e=t.containerSize.height,m=t.containerSize.width,h=(c.ui.hasScroll(k,"left")?k.scrollWidth:m),s=(c.ui.hasScroll(k)?k.scrollHeight:e);t.parentData={element:k,left:q.left,top:q.top,width:h,height:s}}},resize:function(g,q){var t=c(this).data("resizable"),i=t.options,f=t.containerSize,p=t.containerOffset,m=t.size,n=t.position,r=t._aspectRatio||g.shiftKey,e={top:0,left:0},h=t.containerElement;if(h[0]!=document&&(/static/).test(h.css("position"))){e=p}if(n.left<(t._helper?p.left:0)){t.size.width=t.size.width+(t._helper?(t.position.left-p.left):(t.position.left-e.left));if(r){t.size.height=t.size.width/i.aspectRatio}t.position.left=i.helper?p.left:0}if(n.top<(t._helper?p.top:0)){t.size.height=t.size.height+(t._helper?(t.position.top-p.top):t.position.top);if(r){t.size.width=t.size.height*i.aspectRatio}t.position.top=t._helper?p.top:0}t.offset.left=t.parentData.left+t.position.left;t.offset.top=t.parentData.top+t.position.top;var l=Math.abs((t._helper?t.offset.left-e.left:(t.offset.left-e.left))+t.sizeDiff.width),s=Math.abs((t._helper?t.offset.top-e.top:(t.offset.top-p.top))+t.sizeDiff.height);var k=t.containerElement.get(0)==t.element.parent().get(0),j=/relative|absolute/.test(t.containerElement.css("position"));if(k&&j){l-=t.parentData.left}if(l+t.size.width>=t.parentData.width){t.size.width=t.parentData.width-l;if(r){t.size.height=t.size.width/t.aspectRatio}}if(s+t.size.height>=t.parentData.height){t.size.height=t.parentData.height-s;if(r){t.size.width=t.size.height*t.aspectRatio}}},stop:function(f,n){var q=c(this).data("resizable"),g=q.options,l=q.position,m=q.containerOffset,e=q.containerPosition,i=q.containerElement;var j=c(q.helper),r=j.offset(),p=j.outerWidth()-q.sizeDiff.width,k=j.outerHeight()-q.sizeDiff.height;if(q._helper&&!g.animate&&(/relative/).test(i.css("position"))){c(this).css({left:r.left-e.left-m.left,width:p,height:k})}if(q._helper&&!g.animate&&(/static/).test(i.css("position"))){c(this).css({left:r.left-e.left-m.left,width:p,height:k})}}});c.ui.plugin.add("resizable","ghost",{start:function(g,h){var e=c(this).data("resizable"),i=e.options,f=e.size;e.ghost=e.originalElement.clone();e.ghost.css({opacity:0.25,display:"block",position:"relative",height:f.height,width:f.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof i.ghost=="string"?i.ghost:"");e.ghost.appendTo(e.helper)},resize:function(f,g){var e=c(this).data("resizable"),h=e.options;if(e.ghost){e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})}},stop:function(f,g){var e=c(this).data("resizable"),h=e.options;if(e.ghost&&e.helper){e.helper.get(0).removeChild(e.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(e,m){var p=c(this).data("resizable"),h=p.options,k=p.size,i=p.originalSize,j=p.originalPosition,n=p.axis,l=h._aspectRatio||e.shiftKey;h.grid=typeof h.grid=="number"?[h.grid,h.grid]:h.grid;var g=Math.round((k.width-i.width)/(h.grid[0]||1))*(h.grid[0]||1),f=Math.round((k.height-i.height)/(h.grid[1]||1))*(h.grid[1]||1);if(/^(se|s|e)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f}else{if(/^(ne)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f;p.position.top=j.top-f}else{if(/^(sw)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f;p.position.left=j.left-g}else{p.size.width=i.width+g;p.size.height=i.height+f;p.position.top=j.top-f;p.position.left=j.left-g}}}}});var b=function(e){return parseInt(e,10)||0};var a=function(e){return !isNaN(parseInt(e,10))}})(jQuery);/*
* jQuery hashchange event - v1.3 - 7/21/2010
* http://benalman.com/projects/jquery-hashchange-plugin/
*
@@ -58,7 +58,7 @@
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
-(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);(function(c){var a=c.scrollTo=function(f,e,d){c(window).scrollTo(f,e,d)};a.defaults={axis:"xy",duration:parseFloat(c.fn.jquery)>=1.3?0:1};a.window=function(d){return c(window)._scrollable()};c.fn._scrollable=function(){return this.map(function(){var e=this,d=!e.nodeName||c.inArray(e.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1;if(!d){return e}var f=(e.contentWindow||e).document||e.ownerDocument||e;return c.browser.safari||f.compatMode=="BackCompat"?f.body:f.documentElement})};c.fn.scrollTo=function(f,e,d){if(typeof e=="object"){d=e;e=0}if(typeof d=="function"){d={onAfter:d}}if(f=="max"){f=9000000000}d=c.extend({},a.defaults,d);e=e||d.speed||d.duration;d.queue=d.queue&&d.axis.length>1;if(d.queue){e/=2}d.offset=b(d.offset);d.over=b(d.over);return this._scrollable().each(function(){var l=this,j=c(l),k=f,i,g={},m=j.is("html,body");switch(typeof k){case"number":case"string":if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(k)){k=b(k);break}k=c(k,this);case"object":if(k.is||k.style){i=(k=c(k)).offset()}}c.each(d.axis.split(""),function(q,r){var s=r=="x"?"Left":"Top",u=s.toLowerCase(),p="scroll"+s,o=l[p],n=a.max(l,r);if(i){g[p]=i[u]+(m?0:o-j.offset()[u]);if(d.margin){g[p]-=parseInt(k.css("margin"+s))||0;g[p]-=parseInt(k.css("border"+s+"Width"))||0}g[p]+=d.offset[u]||0;if(d.over[u]){g[p]+=k[r=="x"?"width":"height"]()*d.over[u]}}else{var t=k[u];g[p]=t.slice&&t.slice(-1)=="%"?parseFloat(t)/100*n:t}if(/^\d+$/.test(g[p])){g[p]=g[p]<=0?0:Math.min(g[p],n)}if(!q&&d.queue){if(o!=g[p]){h(d.onAfterFirst)}delete g[p]}});h(d.onAfter);function h(n){j.animate(g,e,d.easing,n&&function(){n.call(this,f,d)})}}).end()};a.max=function(j,i){var h=i=="x"?"Width":"Height",e="scroll"+h;if(!c(j).is("html,body")){return j[e]-c(j)[h.toLowerCase()]()}var g="client"+h,f=j.ownerDocument.documentElement,d=j.ownerDocument.body;return Math.max(f[e],d[e])-Math.min(f[g],d[g])};function b(d){return typeof d=="object"?d:{top:d,left:d}}})(jQuery);/*!
+(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);(function(c){var a=c.scrollTo=function(f,e,d){c(window).scrollTo(f,e,d)};a.defaults={axis:"xy",duration:parseFloat(c.fn.jquery)>=1.3?0:1};a.window=function(d){return c(window)._scrollable()};c.fn._scrollable=function(){return this.map(function(){var e=this,d=!e.nodeName||c.inArray(e.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1;if(!d){return e}var f=(e.contentWindow||e).document||e.ownerDocument||e;return c.browser.safari||f.compatMode=="BackCompat"?f.body:f.documentElement})};c.fn.scrollTo=function(f,e,d){if(typeof e=="object"){d=e;e=0}if(typeof d=="function"){d={onAfter:d}}if(f=="max"){f=9000000000}d=c.extend({},a.defaults,d);e=e||d.speed||d.duration;d.queue=d.queue&&d.axis.length>1;if(d.queue){e/=2}d.offset=b(d.offset);d.over=b(d.over);return this._scrollable().each(function(){var l=this,j=c(l),k=f,i,g={},m=j.is("html,body");switch(typeof k){case"number":case"string":if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(k)){k=b(k);break}k=c(k,this);case"object":if(k.is||k.style){i=(k=c(k)).offset()}}c.each(d.axis.split(""),function(q,r){var s=r=="x"?"Left":"Top",u=s.toLowerCase(),p="scroll"+s,o=l[p],n=a.max(l,r);if(i){g[p]=i[u]+(m?0:o-j.offset()[u]);if(d.margin){g[p]-=parseInt(k.css("margin"+s))||0;g[p]-=parseInt(k.css("border"+s+"Width"))||0}g[p]+=d.offset[u]||0;if(d.over[u]){g[p]+=k[r=="x"?"width":"height"]()*d.over[u]}}else{var t=k[u];g[p]=t.slice&&t.slice(-1)=="%"?parseFloat(t)/100*n:t}if(/^\d+$/.test(g[p])){g[p]=g[p]<=0?0:Math.min(g[p],n)}if(!q&&d.queue){if(o!=g[p]){h(d.onAfterFirst)}delete g[p]}});h(d.onAfter);function h(n){j.animate(g,e,d.easing,n&&function(){n.call(this,f,d)})}}).end()};a.max=function(j,i){var h=i=="x"?"Width":"Height",e="scroll"+h;if(!c(j).is("html,body")){return j[e]-c(j)[h.toLowerCase()]()}var g="client"+h,f=j.ownerDocument.documentElement,d=j.ownerDocument.body;return Math.max(f[e],d[e])-Math.min(f[g],d[g])};function b(d){return typeof d=="object"?d:{top:d,left:d}}})(jQuery);/*
PowerTip - v1.2.0 - 2013-04-03
http://stevenbenner.github.com/jquery-powertip/
Copyright (c) 2013 Steven Benner (http://stevenbenner.com/).
diff --git a/doc/html/legal__information_8dox.html b/doc/html/legal__information_8dox.html
index 4f06dfe..53757da 100644
--- a/doc/html/legal__information_8dox.html
+++ b/doc/html/legal__information_8dox.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('legal__information_8dox.html','');});
<ul>
<li class="navelem"><a class="el" href="legal__information_8dox.html">legal_information.dox</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/mainpage_8dox.html b/doc/html/mainpage_8dox.html
index 7166462..b187da9 100644
--- a/doc/html/mainpage_8dox.html
+++ b/doc/html/mainpage_8dox.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('mainpage_8dox.html','');});
<ul>
<li class="navelem"><a class="el" href="mainpage_8dox.html">mainpage.dox</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/member_2api_8h.html b/doc/html/member_2api_8h.html
index 1c1518c..bcce81e 100644
--- a/doc/html/member_2api_8h.html
+++ b/doc/html/member_2api_8h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -58,7 +58,6 @@ $(document).ready(function(){initNavTree('member_2api_8h.html','');});
<div id="doc-content">
<div class="header">
<div class="summary">
-<a href="#nested-classes">Data Structures</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
@@ -74,15 +73,6 @@ $(document).ready(function(){initNavTree('member_2api_8h.html','');});
<code>#include &quot;<a class="el" href="errors_8h.html">epid/common/errors.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="bitsupplier_8h.html">epid/common/bitsupplier.h</a>&quot;</code><br />
</div><table class="memberdecls">
-<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
-Data Structures</h2></td></tr>
-<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_member_precomp.html">MemberPrecomp</a></td></tr>
-<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pre-computed member settings. <a href="struct_member_precomp.html#details">More...</a><br /></td></tr>
-<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_pre_computed_signature.html">PreComputedSignature</a></td></tr>
-<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pre-computed signature. <a href="struct_pre_computed_signature.html#details">More...</a><br /></td></tr>
-<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
-</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:gadfb10d5dfdadb0694792c7b06718e817"><td class="memItemLeft" align="right" valign="top">
@@ -104,24 +94,24 @@ Functions</h2></td></tr>
<tr class="memitem:ga9998eb454838ff5d232ff22ecbab31bf"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#ga9998eb454838ff5d232ff22ecbab31bf">EpidMemberSetHashAlg</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> *ctx, <a class="el" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890">HashAlg</a> hash_alg)</td></tr>
<tr class="memdesc:ga9998eb454838ff5d232ff22ecbab31bf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the hash algorithm to be used by a member. <a href="group___epid_member_module.html#ga9998eb454838ff5d232ff22ecbab31bf">More...</a><br /></td></tr>
<tr class="separator:ga9998eb454838ff5d232ff22ecbab31bf"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gaaae6f21f58c22fce58076f10d68159f4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#gaaae6f21f58c22fce58076f10d68159f4">EpidMemberSetSigRl</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> *ctx, <a class="el" href="struct_sig_rl.html">SigRl</a> const *sig_rl, size_t sig_rl_size)</td></tr>
+<tr class="memdesc:gaaae6f21f58c22fce58076f10d68159f4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the signature based revocation list to be used by a member. <a href="group___epid_member_module.html#gaaae6f21f58c22fce58076f10d68159f4">More...</a><br /></td></tr>
+<tr class="separator:gaaae6f21f58c22fce58076f10d68159f4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga76e535722467af7c16809b5b521e0000"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#ga76e535722467af7c16809b5b521e0000">EpidGetSigSize</a> (<a class="el" href="struct_sig_rl.html">SigRl</a> const *sig_rl)</td></tr>
<tr class="memdesc:ga76e535722467af7c16809b5b521e0000"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes the size in bytes required for an Intel(R) EPID signature. <a href="group___epid_member_module.html#ga76e535722467af7c16809b5b521e0000">More...</a><br /></td></tr>
<tr class="separator:ga76e535722467af7c16809b5b521e0000"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga759155a719254f734157722716dac640"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#ga759155a719254f734157722716dac640">EpidSign</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> const *ctx, void const *msg, size_t msg_len, void const *basename, size_t basename_len, <a class="el" href="struct_sig_rl.html">SigRl</a> const *sig_rl, size_t sig_rl_size, <a class="el" href="struct_epid_signature.html">EpidSignature</a> *sig, size_t sig_len)</td></tr>
-<tr class="memdesc:ga759155a719254f734157722716dac640"><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes an Intel(R) EPID signature. <a href="group___epid_member_module.html#ga759155a719254f734157722716dac640">More...</a><br /></td></tr>
-<tr class="separator:ga759155a719254f734157722716dac640"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga74d1409a816cb52633564b793072da5f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#ga74d1409a816cb52633564b793072da5f">EpidSign</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> const *ctx, void const *msg, size_t msg_len, void const *basename, size_t basename_len, <a class="el" href="struct_epid_signature.html">EpidSignature</a> *sig, size_t sig_len)</td></tr>
+<tr class="memdesc:ga74d1409a816cb52633564b793072da5f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes an Intel(R) EPID signature. <a href="group___epid_member_module.html#ga74d1409a816cb52633564b793072da5f">More...</a><br /></td></tr>
+<tr class="separator:ga74d1409a816cb52633564b793072da5f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad92d3c3266ae1833ffb1dba9ad76035d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#gad92d3c3266ae1833ffb1dba9ad76035d">EpidRegisterBaseName</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> *ctx, void const *basename, size_t basename_len)</td></tr>
<tr class="memdesc:gad92d3c3266ae1833ffb1dba9ad76035d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Registers a basename with a member. <a href="group___epid_member_module.html#gad92d3c3266ae1833ffb1dba9ad76035d">More...</a><br /></td></tr>
<tr class="separator:gad92d3c3266ae1833ffb1dba9ad76035d"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:gad2e3de5c6ce641a318f8a46b61e75236"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#gad2e3de5c6ce641a318f8a46b61e75236">EpidAddPreSigs</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> *ctx, size_t number_presigs, <a class="el" href="struct_pre_computed_signature.html">PreComputedSignature</a> *presigs)</td></tr>
-<tr class="memdesc:gad2e3de5c6ce641a318f8a46b61e75236"><td class="mdescLeft">&#160;</td><td class="mdescRight">Extends the member's pool of pre-computed signatures. <a href="group___epid_member_module.html#gad2e3de5c6ce641a318f8a46b61e75236">More...</a><br /></td></tr>
-<tr class="separator:gad2e3de5c6ce641a318f8a46b61e75236"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gacb0547ec085a9ed324d323416bce4a78"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#gacb0547ec085a9ed324d323416bce4a78">EpidAddPreSigs</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> *ctx, size_t number_presigs)</td></tr>
+<tr class="memdesc:gacb0547ec085a9ed324d323416bce4a78"><td class="mdescLeft">&#160;</td><td class="mdescRight">Extends the member's pool of pre-computed signatures. <a href="group___epid_member_module.html#gacb0547ec085a9ed324d323416bce4a78">More...</a><br /></td></tr>
+<tr class="separator:gacb0547ec085a9ed324d323416bce4a78"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad78ca056dfea2565bbacd5734d9dc075"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#gad78ca056dfea2565bbacd5734d9dc075">EpidGetNumPreSigs</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> const *ctx)</td></tr>
<tr class="memdesc:gad78ca056dfea2565bbacd5734d9dc075"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the number of pre-computed signatures in the member's pool. <a href="group___epid_member_module.html#gad78ca056dfea2565bbacd5734d9dc075">More...</a><br /></td></tr>
<tr class="separator:gad78ca056dfea2565bbacd5734d9dc075"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga9e12c7cec8d0c4e07b12c0e26a278c9d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#ga9e12c7cec8d0c4e07b12c0e26a278c9d">EpidWritePreSigs</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> *ctx, <a class="el" href="struct_pre_computed_signature.html">PreComputedSignature</a> *presigs, size_t number_presigs)</td></tr>
-<tr class="memdesc:ga9e12c7cec8d0c4e07b12c0e26a278c9d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serializes pre-computed signatures from the member's pool. <a href="group___epid_member_module.html#ga9e12c7cec8d0c4e07b12c0e26a278c9d">More...</a><br /></td></tr>
-<tr class="separator:ga9e12c7cec8d0c4e07b12c0e26a278c9d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga13dd0d72be9babf8194d472d7712a361"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#ga13dd0d72be9babf8194d472d7712a361">EpidRequestJoin</a> (<a class="el" href="struct_group_pub_key.html">GroupPubKey</a> const *pub_key, <a class="el" href="group___epid_types.html#ga55eb2193045bde31af3f551565126042">IssuerNonce</a> const *ni, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *f, <a class="el" href="group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c">BitSupplier</a> rnd_func, void *rnd_param, <a class="el" href="group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890">HashAlg</a> hash_alg, <a class="el" href="struct_join_request.html">JoinRequest</a> *join_request)</td></tr>
<tr class="memdesc:ga13dd0d72be9babf8194d472d7712a361"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a request to join a group. <a href="group___epid_member_module.html#ga13dd0d72be9babf8194d472d7712a361">More...</a><br /></td></tr>
<tr class="separator:ga13dd0d72be9babf8194d472d7712a361"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -131,9 +121,9 @@ Functions</h2></td></tr>
<tr class="memitem:gac8e2c6c1fead8030785a40427905a2cc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#gac8e2c6c1fead8030785a40427905a2cc">EpidNrProve</a> (<a class="el" href="group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817">MemberCtx</a> const *ctx, void const *msg, size_t msg_len, <a class="el" href="struct_basic_signature.html">BasicSignature</a> const *sig, <a class="el" href="struct_sig_rl_entry.html">SigRlEntry</a> const *sigrl_entry, <a class="el" href="struct_nr_proof.html">NrProof</a> *proof)</td></tr>
<tr class="memdesc:gac8e2c6c1fead8030785a40427905a2cc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates a non-revoked proof for a single signature based revocation list entry. <a href="group___epid_member_module.html#gac8e2c6c1fead8030785a40427905a2cc">More...</a><br /></td></tr>
<tr class="separator:gac8e2c6c1fead8030785a40427905a2cc"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga8e3f201d1e9dc668659e08a3bdf543b6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="stdtypes_8h.html#ad5c9d4ba3dc37783a528b0925dc981a0">bool</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#ga8e3f201d1e9dc668659e08a3bdf543b6">EpidIsPrivKeyInGroup</a> (<a class="el" href="struct_group_pub_key.html">GroupPubKey</a> const *pub_key, <a class="el" href="struct_priv_key.html">PrivKey</a> const *priv_key)</td></tr>
-<tr class="memdesc:ga8e3f201d1e9dc668659e08a3bdf543b6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Tests if a member private key is valid without checking revocation. <a href="group___epid_member_module.html#ga8e3f201d1e9dc668659e08a3bdf543b6">More...</a><br /></td></tr>
-<tr class="separator:ga8e3f201d1e9dc668659e08a3bdf543b6"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga4ccaa8337931523c77567f5b846ef188"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#ga4ccaa8337931523c77567f5b846ef188">EpidAssemblePrivKey</a> (<a class="el" href="struct_membership_credential.html">MembershipCredential</a> const *credential, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *f, <a class="el" href="struct_group_pub_key.html">GroupPubKey</a> const *pub_key, <a class="el" href="struct_priv_key.html">PrivKey</a> *priv_key)</td></tr>
+<tr class="memdesc:ga4ccaa8337931523c77567f5b846ef188"><td class="mdescLeft">&#160;</td><td class="mdescRight">Assembles member private key from membership credential and f value. <a href="group___epid_member_module.html#ga4ccaa8337931523c77567f5b846ef188">More...</a><br /></td></tr>
+<tr class="separator:ga4ccaa8337931523c77567f5b846ef188"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf8cd05388f017486f14da2ee48d067ef"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_member_module.html#gaf8cd05388f017486f14da2ee48d067ef">EpidDecompressPrivKey</a> (<a class="el" href="struct_group_pub_key.html">GroupPubKey</a> const *pub_key, <a class="el" href="struct_compressed_priv_key.html">CompressedPrivKey</a> const *compressed_privkey, <a class="el" href="struct_priv_key.html">PrivKey</a> *priv_key)</td></tr>
<tr class="memdesc:gaf8cd05388f017486f14da2ee48d067ef"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompresses compressed member private key. <a href="group___epid_member_module.html#gaf8cd05388f017486f14da2ee48d067ef">More...</a><br /></td></tr>
<tr class="separator:gaf8cd05388f017486f14da2ee48d067ef"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -148,7 +138,7 @@ Functions</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_512d3e62841a8535b716ec4cf8b9e950.html">member</a></li><li class="navelem"><a class="el" href="member_2api_8h.html">api.h</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/modules.html b/doc/html/modules.html
index 83d7a36..7432849 100644
--- a/doc/html/modules.html
+++ b/doc/html/modules.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -79,9 +79,10 @@ $(document).ready(function(){initNavTree('modules.html','');});
<tr id="row_0_0_3_"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a class="el" href="group___epid_print.html" target="_self">print_utils</a></td><td class="desc">Debug print routines </td></tr>
<tr id="row_0_0_4_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><span id="arr_0_0_4_" class="arrow" onclick="toggleFolder('0_0_4_')">&#9660;</span><a class="el" href="group___epid_types.html" target="_self">types</a></td><td class="desc">SDK data types </td></tr>
<tr id="row_0_0_4_0_"><td class="entry"><span style="width:64px;display:inline-block;">&#160;</span><a class="el" href="group___epid11_types.html" target="_self">EPID 1.1 specific types</a></td><td class="desc">Intel(R) EPID 1.1 specific data types </td></tr>
-<tr id="row_0_1_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a class="el" href="group___epid_member_module.html" target="_self">member</a></td><td class="desc">Member functionality </td></tr>
-<tr id="row_0_2_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span id="arr_0_2_" class="arrow" onclick="toggleFolder('0_2_')">&#9660;</span><a class="el" href="group___epid_verifier_module.html" target="_self">verifier</a></td><td class="desc">Verifier functionality </td></tr>
-<tr id="row_0_2_0_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a class="el" href="group___epid11_verifier_module.html" target="_self">EPID 1.1 support</a></td><td class="desc">Intel(R) EPID 1.1 Verifier functionality </td></tr>
+<tr id="row_0_1_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span id="arr_0_1_" class="arrow" onclick="toggleFolder('0_1_')">&#9660;</span><a class="el" href="group___epid_member_module.html" target="_self">member</a></td><td class="desc">Member functionality </td></tr>
+<tr id="row_0_1_0_"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a class="el" href="group___tpm_module.html" target="_self">tpm</a></td><td class="desc">Internal interface that models sensitive member functionality </td></tr>
+<tr id="row_0_2_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span id="arr_0_2_" class="arrow" onclick="toggleFolder('0_2_')">&#9660;</span><a class="el" href="group___epid_verifier_module.html" target="_self">verifier</a></td><td class="desc">Verifier functionality </td></tr>
+<tr id="row_0_2_0_"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a class="el" href="group___epid11_verifier_module.html" target="_self">EPID 1.1 support</a></td><td class="desc">Intel(R) EPID 1.1 Verifier functionality </td></tr>
</table>
</div><!-- directory -->
</div><!-- contents -->
@@ -91,7 +92,7 @@ $(document).ready(function(){initNavTree('modules.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/navtreedata.js b/doc/html/navtreedata.js
index 7609149..5822c41 100644
--- a/doc/html/navtreedata.js
+++ b/doc/html/navtreedata.js
@@ -2,7 +2,9 @@ var NAVTREE =
[
[ "Intel® Enhanced Privacy ID SDK", "index.html", [
[ " ", "user", null ],
- [ "Introducing the Intel® EPID SDK", "index.html", null ],
+ [ "Introducing the Intel® EPID SDK", "index.html", [
+ [ "Getting Started", "index.html#mainpage_roadmap", null ]
+ ] ],
[ "Legal Information", "LegalInformation.html", null ],
[ "What's New", "ChangeLog.html", null ],
[ "Introduction to the Intel® EPID Scheme", "EpidOverview.html", [
@@ -31,14 +33,25 @@ var NAVTREE =
[ "Building SDK with SCons", "BuildingSdk.html#BuildingSdk_Building_SCons", null ],
[ "Alternate Makefile/Autoconf Based Build Approach", "BuildingSdk.html#BuildingSdk_Building_Makefile", null ],
[ "Improving Performance with Commercial IPP", "BuildingSdk.html#BuildingSdk_CommercialIpp", null ],
+ [ "Optimizing Code Size over Performance", "BuildingSdk.html#BuildingSdk_SizeOptimizedBuild", null ],
[ "Example Programs", "BuildingSdk.html#BuildingSdk_Examples", null ],
[ "Building with Other Build Systems", "BuildingSdk.html#BuildingSdk_PortingBuildSystem", null ]
] ],
[ "Signing and Verification Tutorial", "SignVerifyTutorial.html", [
- [ "Creating an Intel® EPID Signature of a Given Message", "SignVerifyTutorial.html#SignVerifyTutorial_Signmmsg", null ],
- [ "Verifying an Intel® EPID Signature", "SignVerifyTutorial.html#SignVerifyTutorial_Verifysig", null ],
- [ "Linking Intel® EPID Signatures from the Same Member", "SignVerifyTutorial.html#SignVerifyTutorial_Basename", null ],
- [ "Expected Failures", "SignVerifyTutorial.html#SignVerifyTutorial_VerificationFailures", null ],
+ [ "Creating an Intel® EPID Signature of a Given Message", "SignVerifyTutorial.html#tutorial_signmmsgOverview", [
+ [ "What Do You Need to Create a Signature?", "SignVerifyTutorial.html#tutorial_signmsgList", null ],
+ [ "Signing Example", "SignVerifyTutorial.html#tutorial_signmsgExample", null ]
+ ] ],
+ [ "Verifying an Intel® EPID Signature", "SignVerifyTutorial.html#tutorial_verifysigOverview", [
+ [ "What Do You Need to Verify a Signature?", "SignVerifyTutorial.html#tutorial_verifyList", null ],
+ [ "Verification Example", "SignVerifyTutorial.html#tutorial_verifyExample", null ]
+ ] ],
+ [ "Parameter Matching Requirements", "SignVerifyTutorial.html#SignVerifyTutorial_requirements", [
+ [ "Message", "SignVerifyTutorial.html#SignVerifyTutorial_message", null ],
+ [ "Hash Algorithm", "SignVerifyTutorial.html#SignVerifyTutorial_hashalg", null ],
+ [ "Signature Revocation List", "SignVerifyTutorial.html#SignVerifyTutorial_SigRL", null ],
+ [ "Basenames", "SignVerifyTutorial.html#SignVerifyTutorial_basenames", null ]
+ ] ],
[ "Revocation", "SignVerifyTutorial.html#SignVerifyTutorial_Revocation_Group", [
[ "Detecting Revoked Group from Group Revocation List", "SignVerifyTutorial.html#SignVerifyTutorial_GroupRevocation", null ],
[ "Detecting Revoked Member from Private Key Based Revocation List", "SignVerifyTutorial.html#SignVerifyTutorial_KeyRevocation", null ],
@@ -51,7 +64,7 @@ var NAVTREE =
[ "Sample Group B", "IssuerMaterial.html#IssuerMaterial_Groups_groupb", null ]
] ],
[ "Group Based Revocation Lists", "IssuerMaterial.html#IssuerMaterial_GroupRls", null ],
- [ "Compressed Member Private Key", "IssuerMaterial.html#IssuerMaterial_CmpGroups", [
+ [ "Compressed Sample Groups", "IssuerMaterial.html#IssuerMaterial_CmpGroups", [
[ "Compressed Sample Group A", "IssuerMaterial.html#IssuerMaterial_CmpGroups_groupa", null ],
[ "Compressed Sample Group B", "IssuerMaterial.html#IssuerMaterial_CmpGroups_groupb", null ]
] ],
@@ -121,6 +134,9 @@ var NAVTREE =
[ "Installing SCons", "BuildToolsInstallation.html#build_tools_windows_scons", null ],
[ "Installing Parts", "BuildToolsInstallation.html#build_tools_windows_parts", null ]
] ],
+ [ "Tested Libraries and Compilers", "HowValidated.html", [
+ [ "Tested Libraries and Compilers", "HowValidated.html#validated_supported_compilers", null ]
+ ] ],
[ "Walkthroughs of Examples Showing API Usage", "Examples.html", "Examples" ],
[ "API Reference", "modules.html", "modules" ]
] ]
@@ -129,8 +145,8 @@ var NAVTREE =
var NAVTREEINDEX =
[
"Basenames.html",
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9",
-"struct_oct_str32.html#a5588a7e70f3d73f6ce58b567a9f5c5c8"
+"group___epid_verifier_module.html#gaeb05e6faea6f09c0665b13adc6e7ddea",
+"struct_group_rl.html"
];
var SYNCONMSG = 'click to disable panel synchronisation';
diff --git a/doc/html/navtreeindex0.js b/doc/html/navtreeindex0.js
index cf27e56..62b20a2 100644
--- a/doc/html/navtreeindex0.js
+++ b/doc/html/navtreeindex0.js
@@ -11,9 +11,10 @@ var NAVTREEINDEX0 =
"BuildingSdk.html#BuildingSdk_Building_Makefile":[6,2],
"BuildingSdk.html#BuildingSdk_Building_SCons":[6,1],
"BuildingSdk.html#BuildingSdk_CommercialIpp":[6,3],
-"BuildingSdk.html#BuildingSdk_Examples":[6,4],
-"BuildingSdk.html#BuildingSdk_PortingBuildSystem":[6,5],
+"BuildingSdk.html#BuildingSdk_Examples":[6,5],
+"BuildingSdk.html#BuildingSdk_PortingBuildSystem":[6,6],
"BuildingSdk.html#BuildingSdk_Prerequisites":[6,0],
+"BuildingSdk.html#BuildingSdk_SizeOptimizedBuild":[6,4],
"ChangeLog.html":[3],
"ChoosingiKGF.html":[9],
"ChoosingiKGF.html#ExtractionTools":[9,1],
@@ -34,7 +35,7 @@ var NAVTREEINDEX0 =
"EpidOverview.html#EpidOverview_Members":[4,0,1],
"EpidOverview.html#EpidOverview_Roles":[4,0],
"EpidOverview.html#EpidOverview_Verifiers":[4,0,2],
-"Examples.html":[15],
+"Examples.html":[16],
"Glossary.html":[13],
"Glossary.html#Glossary_Daa":[13,1],
"Glossary.html#Glossary_EllipticCurve":[13,2],
@@ -54,6 +55,8 @@ var NAVTREEINDEX0 =
"Glossary.html#Glossary_Revocation":[13,16],
"Glossary.html#Glossary_Verifier":[13,17],
"Glossary.html#Issuing_CA":[13,0],
+"HowValidated.html":[15],
+"HowValidated.html#validated_supported_compilers":[15,0],
"ImplementationNotes.html":[12],
"ImplementationNotes.html#ImplementationNotes_FlexibleArrays":[12,4],
"ImplementationNotes.html#ImplementationNotes_MathPrimitives":[12,2],
@@ -88,166 +91,163 @@ var NAVTREEINDEX0 =
"SdkOverview.html#SdkOverview_Files_InstallLayout":[5,1,1],
"SdkOverview.html#SdkOverview_Files_SourceLayout":[5,1,0],
"SignVerifyTutorial.html":[7],
-"SignVerifyTutorial.html#SignVerifyTutorial_Basename":[7,2],
-"SignVerifyTutorial.html#SignVerifyTutorial_GroupRevocation":[7,4,0],
-"SignVerifyTutorial.html#SignVerifyTutorial_KeyRevocation":[7,4,1],
-"SignVerifyTutorial.html#SignVerifyTutorial_Revocation_Group":[7,4],
-"SignVerifyTutorial.html#SignVerifyTutorial_SigRevocation":[7,4,2],
-"SignVerifyTutorial.html#SignVerifyTutorial_Signmmsg":[7,0],
-"SignVerifyTutorial.html#SignVerifyTutorial_VerificationFailures":[7,3],
-"SignVerifyTutorial.html#SignVerifyTutorial_Verifysig":[7,1],
-"SignmsgWalkthru.html":[15,0],
-"VerifysigWalkthru.html":[15,1],
-"group___big_num_primitives.html":[16,0,0,0,0],
-"group___big_num_primitives.html#ga03c89b8b8dd87de2c0f4b5822145d317":[16,0,0,0,0,6],
-"group___big_num_primitives.html#ga166134085464b0df2c8efcfccf8ec573":[16,0,0,0,0,2],
-"group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718":[16,0,0,0,0,0],
-"group___big_num_primitives.html#ga2d17600068b1d94000635c6644258a03":[16,0,0,0,0,9],
-"group___big_num_primitives.html#ga79d86c872fe8da0f217e3ba069f98d38":[16,0,0,0,0,12],
-"group___big_num_primitives.html#ga7dd6038987210d10bf843602fef0c929":[16,0,0,0,0,5],
-"group___big_num_primitives.html#ga808cf477b70ed06358b11756bfe36024":[16,0,0,0,0,11],
-"group___big_num_primitives.html#gacbec9669ab0fe768e2be74dcaca397ea":[16,0,0,0,0,8],
-"group___big_num_primitives.html#gacde6564a814617a96985b379be0dfabb":[16,0,0,0,0,4],
-"group___big_num_primitives.html#gad5f6f262bfd780fed3678bcee16f0aed":[16,0,0,0,0,10],
-"group___big_num_primitives.html#gae70fd9b3026f0ab3c7e9601d0a3186b8":[16,0,0,0,0,1],
-"group___big_num_primitives.html#gaf0366e47226563b17fcbc8e3ed766084":[16,0,0,0,0,3],
-"group___big_num_primitives.html#gafd64b66fc85dab0005f4a1bb67bdf7b4":[16,0,0,0,0,7],
-"group___ec_group_primitives.html":[16,0,0,0,2],
-"group___ec_group_primitives.html#ga01bf8d6fa60a2e445490966b3a06c270":[16,0,0,0,2,4],
-"group___ec_group_primitives.html#ga0b6d7a3398251e9352fb29ef4abef466":[16,0,0,0,2,8],
-"group___ec_group_primitives.html#ga25c9013cc76907d73765eb7a96aa8c96":[16,0,0,0,2,12],
-"group___ec_group_primitives.html#ga2d433f567fa2419465a49604f4da21ad":[16,0,0,0,2,20],
-"group___ec_group_primitives.html#ga3f96c43d14d24de0f7a5e214aef64196":[16,0,0,0,2,5],
-"group___ec_group_primitives.html#ga40e3431d3dbe8cf7a65ada7b7811cba4":[16,0,0,0,2,16],
-"group___ec_group_primitives.html#ga4bb7d6691ffbb6e947c1068453e27fbd":[16,0,0,0,2,21],
-"group___ec_group_primitives.html#ga4d0f32aede3066eae500241b387bd970":[16,0,0,0,2,7],
-"group___ec_group_primitives.html#ga6417b0ce72ba96de00c329e322fec7fb":[16,0,0,0,2,19],
-"group___ec_group_primitives.html#ga76d24378455eb96a3257fe8045c0993a":[16,0,0,0,2,14],
-"group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa":[16,0,0,0,2,1],
-"group___ec_group_primitives.html#ga8a6114a48214a327d4ec04fd25e5940e":[16,0,0,0,2,11],
-"group___ec_group_primitives.html#ga8cb086d792bffb79b3ca07e6ca4ce0e7":[16,0,0,0,2,3],
-"group___ec_group_primitives.html#ga9cf15b34bc4ff12e58b169dd989d8210":[16,0,0,0,2,10],
-"group___ec_group_primitives.html#gab7af276256c27610eda85ff432b846ea":[16,0,0,0,2,2],
-"group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159":[16,0,0,0,2,0],
-"group___ec_group_primitives.html#gad3b3c63c48fa24e8dea07837b05bc061":[16,0,0,0,2,9],
-"group___ec_group_primitives.html#gadc22ee07864a7ee681a881029b69d76a":[16,0,0,0,2,6],
-"group___ec_group_primitives.html#gadf83fa559585375faad9a8b1559249bc":[16,0,0,0,2,17],
-"group___ec_group_primitives.html#gae96c38e004ccd2211290ad6e66415ec4":[16,0,0,0,2,13],
-"group___ec_group_primitives.html#gaf3b6a548aa6f0d4f028a14feca251f57":[16,0,0,0,2,15],
-"group___ec_group_primitives.html#gaf4e23677dd378ef2e0cf55df79cbdb62":[16,0,0,0,2,18],
-"group___ecdsa_primitives.html":[16,0,0,0,1],
-"group___ecdsa_primitives.html#ga67091ecae643c1b8a0b0a4946eda7afe":[16,0,0,0,1,0],
-"group___ecdsa_primitives.html#gaab68de7291db6e42a01e99c2fa40057f":[16,0,0,0,1,1],
-"group___epid11_file_parser_module.html":[16,0,0,2,0],
-"group___epid11_file_parser_module.html#ga1f92d1cb6bd7d9815711fde515b40a4c":[16,0,0,2,0,0],
-"group___epid11_file_parser_module.html#gac3f6daaa5333627d4efe5438c1fe8868":[16,0,0,2,0,3],
-"group___epid11_file_parser_module.html#gae28a844eb68828480b2a76fcb7d252a3":[16,0,0,2,0,1],
-"group___epid11_file_parser_module.html#gae682077d315c39ed298ef198fd738546":[16,0,0,2,0,2],
-"group___epid11_pairing_primitives.html":[16,0,0,0,5,0],
-"group___epid11_pairing_primitives.html#ga0ee658e26e9f933ba2ffbf2504dfae7e":[16,0,0,0,5,0,3],
-"group___epid11_pairing_primitives.html#ga74236e8ebbfc30a7daa7fa1cf1df148b":[16,0,0,0,5,0,0],
-"group___epid11_pairing_primitives.html#gaa3457d6f85889bc714910252fd21c758":[16,0,0,0,5,0,1],
-"group___epid11_pairing_primitives.html#gaa4076dfe25e8e61ac6753333a322c059":[16,0,0,0,5,0,2],
-"group___epid11_types.html":[16,0,0,4,0],
-"group___epid11_types.html#ga7293cec8f937d6f5da42084403f978f1":[16,0,0,4,0,17],
-"group___epid11_types.html#gadff9c05d5b7751024152b40dda545545":[16,0,0,4,0,15],
-"group___epid11_types.html#gaf1f4f1d6f001895abe548cfb33611c23":[16,0,0,4,0,16],
-"group___epid11_verifier_module.html":[16,0,2,0],
-"group___epid11_verifier_module.html#ga0b79c79d09e3551158e1c38c7c335929":[16,0,2,0,3],
-"group___epid11_verifier_module.html#ga0cb6d30df527ee0d8f0a1b68d2b7c0c0":[16,0,2,0,7],
-"group___epid11_verifier_module.html#ga241520cb925e5be89893a2037451cf1c":[16,0,2,0,11],
-"group___epid11_verifier_module.html#ga3a2e320d7de6156b2ce9d73e9cdce813":[16,0,2,0,4],
-"group___epid11_verifier_module.html#ga63cae8d5abcf4d7e3af4157de18998f1":[16,0,2,0,6],
-"group___epid11_verifier_module.html#ga7b5d19277da043c2b79721975d7bd070":[16,0,2,0,13],
-"group___epid11_verifier_module.html#ga809c777908b2f9d029062d9424cb5f65":[16,0,2,0,8],
-"group___epid11_verifier_module.html#gab0b6560b226a37321f5ca5d4fb55eba7":[16,0,2,0,2],
-"group___epid11_verifier_module.html#gabe6a864a06322205ae7536ffea34c702":[16,0,2,0,1],
-"group___epid11_verifier_module.html#gac5a8f8d7624063ea428d81dbdbf61fa8":[16,0,2,0,5],
-"group___epid11_verifier_module.html#gafe5ad6bde38ad0c3e0a9960975fd5216":[16,0,2,0,12],
-"group___epid11_verifier_module.html#gaff5a014b0334be7e8583f0f99cb5e9b8":[16,0,2,0,10],
-"group___epid11_verifier_module.html#gaffbe6ac2bc7236ad65126a17ebdceb14":[16,0,2,0,9],
-"group___epid_common.html":[16,0,0],
-"group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c":[16,0,0,5],
-"group___epid_math.html":[16,0,0,0],
-"group___epid_member_module.html":[16,0,1],
-"group___epid_member_module.html#ga13dd0d72be9babf8194d472d7712a361":[16,0,1,14],
-"group___epid_member_module.html#ga3824589c683c5e0e59d483462fce65d6":[16,0,1,9],
-"group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb":[16,0,1,8],
-"group___epid_member_module.html#ga5c35798d62cf81c4ca62b22c38809721":[16,0,1,11],
-"group___epid_member_module.html#ga759155a719254f734157722716dac640":[16,0,1,15],
-"group___epid_member_module.html#ga76e535722467af7c16809b5b521e0000":[16,0,1,6],
-"group___epid_member_module.html#ga8e3f201d1e9dc668659e08a3bdf543b6":[16,0,1,7],
-"group___epid_member_module.html#ga9998eb454838ff5d232ff22ecbab31bf":[16,0,1,10],
-"group___epid_member_module.html#ga9e12c7cec8d0c4e07b12c0e26a278c9d":[16,0,1,17],
-"group___epid_member_module.html#gac8e2c6c1fead8030785a40427905a2cc":[16,0,1,12],
-"group___epid_member_module.html#gad2e3de5c6ce641a318f8a46b61e75236":[16,0,1,3],
-"group___epid_member_module.html#gad78ca056dfea2565bbacd5734d9dc075":[16,0,1,5],
-"group___epid_member_module.html#gad92d3c3266ae1833ffb1dba9ad76035d":[16,0,1,13],
-"group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817":[16,0,1,2],
-"group___epid_member_module.html#gae04a250d5981fcf9bd6f9f57e0468faa":[16,0,1,16],
-"group___epid_member_module.html#gaf8cd05388f017486f14da2ee48d067ef":[16,0,1,4],
-"group___epid_module.html":[16,0],
-"group___epid_print.html":[16,0,0,3],
-"group___epid_print.html#ga0d6377d9c1651d0101ec6b61feaa78ca":[16,0,0,3,3],
-"group___epid_print.html#ga138cd388247a58680d4701d59d6976d2":[16,0,0,3,12],
-"group___epid_print.html#ga3e215d157eb205ad596bb84bce694a83":[16,0,0,3,0],
-"group___epid_print.html#ga3f2961ef6b4c44a6205d422d8a293476":[16,0,0,3,8],
-"group___epid_print.html#ga45a933b44fc1dfe926e3af89c198070a":[16,0,0,3,1],
-"group___epid_print.html#ga5f249c594ed12e4a9b11b7bc101da85d":[16,0,0,3,2],
-"group___epid_print.html#ga6c9fea48fa0477f4a98abb50f891a5e4":[16,0,0,3,9],
-"group___epid_print.html#ga87168a3ce5306f9839b8e8d6c9a5f84f":[16,0,0,3,10],
-"group___epid_print.html#ga883a834ab1703365bb0bca4abd3104de":[16,0,0,3,7],
-"group___epid_print.html#gaa3b1cbbfc6f78562658953113e5798cf":[16,0,0,3,4],
-"group___epid_print.html#gab76a4cf0385dc4a76bb56ee9f0e3e87a":[16,0,0,3,11],
-"group___epid_print.html#gae553c3a156a0e4968b89635ab0757580":[16,0,0,3,5],
-"group___epid_print.html#gaf185fe3df270cd8b4a2969bf3cfc5d5f":[16,0,0,3,6],
-"group___epid_print.html#gga3e215d157eb205ad596bb84bce694a83ade23610605d0ba7dd48db5060e28995a":[16,0,0,3,0,2],
-"group___epid_print.html#gga3e215d157eb205ad596bb84bce694a83ae2d5345c14f57fc992a613003c3c443d":[16,0,0,3,0,1],
-"group___epid_print.html#gga3e215d157eb205ad596bb84bce694a83aeb475b793d8d357087d7fcc74702ffae":[16,0,0,3,0,0],
-"group___epid_types.html":[16,0,0,4],
-"group___epid_types.html#ga54bd22670f2e348593db7ab631131d10":[16,0,0,4,37],
-"group___epid_types.html#ga55eb2193045bde31af3f551565126042":[16,0,0,4,36],
-"group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890":[16,0,0,4,39],
-"group___epid_types.html#ga888541b8148df69c634a92c64ed51317":[16,0,0,4,38],
-"group___epid_types.html#gada666b48d0cbc301985405fde896f1de":[16,0,0,4,35],
-"group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890a0f4dde6e82b84f5769873f6704fcd290":[16,0,0,4,39,2],
-"group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890a4fa16d3867498f5e2f8ae5c94b0fab85":[16,0,0,4,39,5],
-"group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890a68b2137c7946583a99f0dac2286523eb":[16,0,0,4,39,0],
-"group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890a90d21c8885ab138f7cf91f253dd6ef86":[16,0,0,4,39,6],
-"group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890a9746b5049a62bca2f7b844925e6136ba":[16,0,0,4,39,4],
-"group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890ade8e74cf7910b3a71fe902a40abf7eee":[16,0,0,4,39,7],
-"group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890aefb89989305b5c34120b0f18ee8e2c5d":[16,0,0,4,39,1],
-"group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890afb78d98f37fecc53dd1637d94c5c0055":[16,0,0,4,39,3],
-"group___epid_verifier_module.html":[16,0,2],
-"group___epid_verifier_module.html#ga0909703a0a4dfe080374d0d99077465a":[16,0,2,15],
-"group___epid_verifier_module.html#ga1c3810ef361da678a1f77823bd9c37a6":[16,0,2,10],
-"group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70":[16,0,2,8],
-"group___epid_verifier_module.html#ga1d41d6ef4dabbc30ec28452edd6baffb":[16,0,2,11],
-"group___epid_verifier_module.html#ga2a75c7d5775e852a7b6e24178dd4054f":[16,0,2,6],
-"group___epid_verifier_module.html#ga4c7c9820409ee06f30bb8dc75fdd5dcf":[16,0,2,14],
-"group___epid_verifier_module.html#ga6707e691f4b3916f9c684d5bbd463d12":[16,0,2,9],
-"group___epid_verifier_module.html#ga8eaeb9f4a34e9e37ccdf342919f38c69":[16,0,2,4],
-"group___epid_verifier_module.html#ga92df4d00ea4ee59d7bfd35b23da03392":[16,0,2,16],
-"group___epid_verifier_module.html#ga97b58b2382f24756b66a357f1e825c92":[16,0,2,12],
-"group___epid_verifier_module.html#gac3b1f1a2bdba8eeeebbf1e0c8c00862e":[16,0,2,18],
-"group___epid_verifier_module.html#gac6e2fab59e3af8a33a74a5b201642700":[16,0,2,7],
-"group___epid_verifier_module.html#gac857bff47e7d80363eac15285471fe81":[16,0,2,19],
-"group___epid_verifier_module.html#gae3f9c37628e18b880d8bbee3e7f55064":[16,0,2,17],
-"group___epid_verifier_module.html#gae44bd8acbc1e7205aeedff0c7e2632a8":[16,0,2,3],
-"group___epid_verifier_module.html#gaeb05e6faea6f09c0665b13adc6e7ddea":[16,0,2,5],
-"group___epid_verifier_module.html#gaf172a5f8f7f069d38c5838b723a1a85c":[16,0,2,2],
-"group___epid_verifier_module.html#gafab08180a43b58ce2e1d56c4b070bb0e":[16,0,2,13],
-"group___error_codes.html":[16,0,0,1],
-"group___error_codes.html#ga59e8680ce52509302fd58a987e45004d":[16,0,0,1,1],
-"group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360":[16,0,0,1,0],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a11a4d2f1c37064eb663de08dc57bcda8":[16,0,0,1,0,11],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a1739ecb620f4bede2e1b84e52a96cee6":[16,0,0,1,0,12],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a1dc7b7e6ff97c7ed9ff4191d76ebd6e1":[16,0,0,1,0,4],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a3706f895a660260033b5b91890516c0f":[16,0,0,1,0,17],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a43c658cbf0d156850d71ce3f8efd461c":[16,0,0,1,0,5],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a486e052baa99c6c25ae5d5cc710de298":[16,0,0,1,0,6],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a5252da1ff519a098446723e9edd30cc7":[16,0,0,1,0,8],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a61234ad9610406da6bf7977afd72a357":[16,0,0,1,0,16],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a83a867b4f71ee13edbfca2f1b72abbec":[16,0,0,1,0,14],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a893cd0d417b139bb376d09c93695c3f3":[16,0,0,1,0,13]
+"SignVerifyTutorial.html#SignVerifyTutorial_GroupRevocation":[7,3,0],
+"SignVerifyTutorial.html#SignVerifyTutorial_KeyRevocation":[7,3,1],
+"SignVerifyTutorial.html#SignVerifyTutorial_Revocation_Group":[7,3],
+"SignVerifyTutorial.html#SignVerifyTutorial_SigRL":[7,2,2],
+"SignVerifyTutorial.html#SignVerifyTutorial_SigRevocation":[7,3,2],
+"SignVerifyTutorial.html#SignVerifyTutorial_basenames":[7,2,3],
+"SignVerifyTutorial.html#SignVerifyTutorial_hashalg":[7,2,1],
+"SignVerifyTutorial.html#SignVerifyTutorial_message":[7,2,0],
+"SignVerifyTutorial.html#SignVerifyTutorial_requirements":[7,2],
+"SignVerifyTutorial.html#tutorial_signmmsgOverview":[7,0],
+"SignVerifyTutorial.html#tutorial_signmsgExample":[7,0,1],
+"SignVerifyTutorial.html#tutorial_signmsgList":[7,0,0],
+"SignVerifyTutorial.html#tutorial_verifyExample":[7,1,1],
+"SignVerifyTutorial.html#tutorial_verifyList":[7,1,0],
+"SignVerifyTutorial.html#tutorial_verifysigOverview":[7,1],
+"UserManual_GeneratingAnIntelEpidSignature.html":[16,0],
+"UserManual_GeneratingAnIntelEpidSignature.html#signmsgWalkthru_":[16,0,1],
+"UserManual_GeneratingAnIntelEpidSignature.html#signmsgWalktrhu_overview":[16,0,0],
+"UserManual_VerifyingAnIntelEpidSignature.html":[16,1],
+"UserManual_VerifyingAnIntelEpidSignature.html#verifysigWalkthrough_main":[16,1,1],
+"UserManual_VerifyingAnIntelEpidSignature.html#verifysigWalktrhu_overview":[16,1,0],
+"group___big_num_primitives.html":[17,0,0,0,0],
+"group___big_num_primitives.html#ga03c89b8b8dd87de2c0f4b5822145d317":[17,0,0,0,0,6],
+"group___big_num_primitives.html#ga166134085464b0df2c8efcfccf8ec573":[17,0,0,0,0,2],
+"group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718":[17,0,0,0,0,0],
+"group___big_num_primitives.html#ga2d17600068b1d94000635c6644258a03":[17,0,0,0,0,9],
+"group___big_num_primitives.html#ga7dd6038987210d10bf843602fef0c929":[17,0,0,0,0,5],
+"group___big_num_primitives.html#ga904c16cc020e7196f22ac9abdc31b41f":[17,0,0,0,0,12],
+"group___big_num_primitives.html#gabe8e39d5788423f41770a71a4c911fbe":[17,0,0,0,0,11],
+"group___big_num_primitives.html#gacbec9669ab0fe768e2be74dcaca397ea":[17,0,0,0,0,8],
+"group___big_num_primitives.html#gacde6564a814617a96985b379be0dfabb":[17,0,0,0,0,4],
+"group___big_num_primitives.html#gad5f6f262bfd780fed3678bcee16f0aed":[17,0,0,0,0,10],
+"group___big_num_primitives.html#gae70fd9b3026f0ab3c7e9601d0a3186b8":[17,0,0,0,0,1],
+"group___big_num_primitives.html#gaf0366e47226563b17fcbc8e3ed766084":[17,0,0,0,0,3],
+"group___big_num_primitives.html#gafd64b66fc85dab0005f4a1bb67bdf7b4":[17,0,0,0,0,7],
+"group___ec_group_primitives.html":[17,0,0,0,2],
+"group___ec_group_primitives.html#ga01bf8d6fa60a2e445490966b3a06c270":[17,0,0,0,2,4],
+"group___ec_group_primitives.html#ga0b6d7a3398251e9352fb29ef4abef466":[17,0,0,0,2,8],
+"group___ec_group_primitives.html#ga25c9013cc76907d73765eb7a96aa8c96":[17,0,0,0,2,12],
+"group___ec_group_primitives.html#ga3f96c43d14d24de0f7a5e214aef64196":[17,0,0,0,2,5],
+"group___ec_group_primitives.html#ga40e3431d3dbe8cf7a65ada7b7811cba4":[17,0,0,0,2,16],
+"group___ec_group_primitives.html#ga48ec5ae951c9f49d8d7d983234eea921":[17,0,0,0,2,7],
+"group___ec_group_primitives.html#ga6417b0ce72ba96de00c329e322fec7fb":[17,0,0,0,2,19],
+"group___ec_group_primitives.html#ga76d24378455eb96a3257fe8045c0993a":[17,0,0,0,2,14],
+"group___ec_group_primitives.html#ga7a8bdb9782d065bc32fd102e0ae73ccb":[17,0,0,0,2,21],
+"group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa":[17,0,0,0,2,1],
+"group___ec_group_primitives.html#ga8a6114a48214a327d4ec04fd25e5940e":[17,0,0,0,2,11],
+"group___ec_group_primitives.html#ga8cb086d792bffb79b3ca07e6ca4ce0e7":[17,0,0,0,2,3],
+"group___ec_group_primitives.html#ga9cf15b34bc4ff12e58b169dd989d8210":[17,0,0,0,2,10],
+"group___ec_group_primitives.html#gaad96a1498b85d28f71514b8f7b154d82":[17,0,0,0,2,17],
+"group___ec_group_primitives.html#gab647ccc031063807ff3860f51d0f6919":[17,0,0,0,2,6],
+"group___ec_group_primitives.html#gab7af276256c27610eda85ff432b846ea":[17,0,0,0,2,2],
+"group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159":[17,0,0,0,2,0],
+"group___ec_group_primitives.html#gad3b3c63c48fa24e8dea07837b05bc061":[17,0,0,0,2,9],
+"group___ec_group_primitives.html#gad495a9f91b79984f7533c8ea4f92b3cb":[17,0,0,0,2,20],
+"group___ec_group_primitives.html#gae96c38e004ccd2211290ad6e66415ec4":[17,0,0,0,2,13],
+"group___ec_group_primitives.html#gaf3b6a548aa6f0d4f028a14feca251f57":[17,0,0,0,2,15],
+"group___ec_group_primitives.html#gaf4e23677dd378ef2e0cf55df79cbdb62":[17,0,0,0,2,18],
+"group___ecdsa_primitives.html":[17,0,0,0,1],
+"group___ecdsa_primitives.html#ga07e4ebd3423e1f6f9ae35f0608dde7c0":[17,0,0,0,1,1],
+"group___ecdsa_primitives.html#gaef0e8a31e830fe9285b43a0969e6611a":[17,0,0,0,1,0],
+"group___epid11_file_parser_module.html":[17,0,0,2,0],
+"group___epid11_file_parser_module.html#ga1f92d1cb6bd7d9815711fde515b40a4c":[17,0,0,2,0,0],
+"group___epid11_file_parser_module.html#gac3f6daaa5333627d4efe5438c1fe8868":[17,0,0,2,0,3],
+"group___epid11_file_parser_module.html#gae28a844eb68828480b2a76fcb7d252a3":[17,0,0,2,0,1],
+"group___epid11_file_parser_module.html#gae682077d315c39ed298ef198fd738546":[17,0,0,2,0,2],
+"group___epid11_pairing_primitives.html":[17,0,0,0,5,0],
+"group___epid11_pairing_primitives.html#ga0ee658e26e9f933ba2ffbf2504dfae7e":[17,0,0,0,5,0,3],
+"group___epid11_pairing_primitives.html#ga74236e8ebbfc30a7daa7fa1cf1df148b":[17,0,0,0,5,0,0],
+"group___epid11_pairing_primitives.html#gaa3457d6f85889bc714910252fd21c758":[17,0,0,0,5,0,1],
+"group___epid11_pairing_primitives.html#gaa4076dfe25e8e61ac6753333a322c059":[17,0,0,0,5,0,2],
+"group___epid11_types.html":[17,0,0,4,0],
+"group___epid11_types.html#ga7293cec8f937d6f5da42084403f978f1":[17,0,0,4,0,17],
+"group___epid11_types.html#gadff9c05d5b7751024152b40dda545545":[17,0,0,4,0,15],
+"group___epid11_types.html#gaf1f4f1d6f001895abe548cfb33611c23":[17,0,0,4,0,16],
+"group___epid11_verifier_module.html":[17,0,2,0],
+"group___epid11_verifier_module.html#ga0b79c79d09e3551158e1c38c7c335929":[17,0,2,0,3],
+"group___epid11_verifier_module.html#ga0cb6d30df527ee0d8f0a1b68d2b7c0c0":[17,0,2,0,7],
+"group___epid11_verifier_module.html#ga241520cb925e5be89893a2037451cf1c":[17,0,2,0,11],
+"group___epid11_verifier_module.html#ga3a2e320d7de6156b2ce9d73e9cdce813":[17,0,2,0,4],
+"group___epid11_verifier_module.html#ga63cae8d5abcf4d7e3af4157de18998f1":[17,0,2,0,6],
+"group___epid11_verifier_module.html#ga7b5d19277da043c2b79721975d7bd070":[17,0,2,0,13],
+"group___epid11_verifier_module.html#ga809c777908b2f9d029062d9424cb5f65":[17,0,2,0,8],
+"group___epid11_verifier_module.html#gab0b6560b226a37321f5ca5d4fb55eba7":[17,0,2,0,2],
+"group___epid11_verifier_module.html#gabe6a864a06322205ae7536ffea34c702":[17,0,2,0,1],
+"group___epid11_verifier_module.html#gac5a8f8d7624063ea428d81dbdbf61fa8":[17,0,2,0,5],
+"group___epid11_verifier_module.html#gafe5ad6bde38ad0c3e0a9960975fd5216":[17,0,2,0,12],
+"group___epid11_verifier_module.html#gaff5a014b0334be7e8583f0f99cb5e9b8":[17,0,2,0,10],
+"group___epid11_verifier_module.html#gaffbe6ac2bc7236ad65126a17ebdceb14":[17,0,2,0,9],
+"group___epid_common.html":[17,0,0],
+"group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c":[17,0,0,5],
+"group___epid_math.html":[17,0,0,0],
+"group___epid_member_module.html":[17,0,1],
+"group___epid_member_module.html#ga13dd0d72be9babf8194d472d7712a361":[17,0,1,14],
+"group___epid_member_module.html#ga3824589c683c5e0e59d483462fce65d6":[17,0,1,8],
+"group___epid_member_module.html#ga4ccaa8337931523c77567f5b846ef188":[17,0,1,3],
+"group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb":[17,0,1,7],
+"group___epid_member_module.html#ga5c35798d62cf81c4ca62b22c38809721":[17,0,1,11],
+"group___epid_member_module.html#ga74d1409a816cb52633564b793072da5f":[17,0,1,15],
+"group___epid_member_module.html#ga76e535722467af7c16809b5b521e0000":[17,0,1,6],
+"group___epid_member_module.html#ga9998eb454838ff5d232ff22ecbab31bf":[17,0,1,9],
+"group___epid_member_module.html#gaaae6f21f58c22fce58076f10d68159f4":[17,0,1,10],
+"group___epid_member_module.html#gac8e2c6c1fead8030785a40427905a2cc":[17,0,1,12],
+"group___epid_member_module.html#gacb0547ec085a9ed324d323416bce4a78":[17,0,1,2],
+"group___epid_member_module.html#gad78ca056dfea2565bbacd5734d9dc075":[17,0,1,5],
+"group___epid_member_module.html#gad92d3c3266ae1833ffb1dba9ad76035d":[17,0,1,13],
+"group___epid_member_module.html#gadfb10d5dfdadb0694792c7b06718e817":[17,0,1,1],
+"group___epid_member_module.html#gae04a250d5981fcf9bd6f9f57e0468faa":[17,0,1,16],
+"group___epid_member_module.html#gaf8cd05388f017486f14da2ee48d067ef":[17,0,1,4],
+"group___epid_module.html":[17,0],
+"group___epid_print.html":[17,0,0,3],
+"group___epid_print.html#ga0d6377d9c1651d0101ec6b61feaa78ca":[17,0,0,3,3],
+"group___epid_print.html#ga138cd388247a58680d4701d59d6976d2":[17,0,0,3,12],
+"group___epid_print.html#ga3e215d157eb205ad596bb84bce694a83":[17,0,0,3,0],
+"group___epid_print.html#ga3f2961ef6b4c44a6205d422d8a293476":[17,0,0,3,8],
+"group___epid_print.html#ga45a933b44fc1dfe926e3af89c198070a":[17,0,0,3,1],
+"group___epid_print.html#ga5f249c594ed12e4a9b11b7bc101da85d":[17,0,0,3,2],
+"group___epid_print.html#ga6c9fea48fa0477f4a98abb50f891a5e4":[17,0,0,3,9],
+"group___epid_print.html#ga87168a3ce5306f9839b8e8d6c9a5f84f":[17,0,0,3,10],
+"group___epid_print.html#ga883a834ab1703365bb0bca4abd3104de":[17,0,0,3,7],
+"group___epid_print.html#gaa3b1cbbfc6f78562658953113e5798cf":[17,0,0,3,4],
+"group___epid_print.html#gab76a4cf0385dc4a76bb56ee9f0e3e87a":[17,0,0,3,11],
+"group___epid_print.html#gae553c3a156a0e4968b89635ab0757580":[17,0,0,3,5],
+"group___epid_print.html#gaf185fe3df270cd8b4a2969bf3cfc5d5f":[17,0,0,3,6],
+"group___epid_print.html#gga3e215d157eb205ad596bb84bce694a83ade23610605d0ba7dd48db5060e28995a":[17,0,0,3,0,2],
+"group___epid_print.html#gga3e215d157eb205ad596bb84bce694a83ae2d5345c14f57fc992a613003c3c443d":[17,0,0,3,0,1],
+"group___epid_print.html#gga3e215d157eb205ad596bb84bce694a83aeb475b793d8d357087d7fcc74702ffae":[17,0,0,3,0,0],
+"group___epid_types.html":[17,0,0,4],
+"group___epid_types.html#ga3315fb24f4c5783b6d6eb107933390b0":[17,0,0,4,39],
+"group___epid_types.html#ga54bd22670f2e348593db7ab631131d10":[17,0,0,4,40],
+"group___epid_types.html#ga55eb2193045bde31af3f551565126042":[17,0,0,4,38],
+"group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890":[17,0,0,4,42],
+"group___epid_types.html#ga888541b8148df69c634a92c64ed51317":[17,0,0,4,41],
+"group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2":[17,0,0,4,36],
+"group___epid_types.html#gada666b48d0cbc301985405fde896f1de":[17,0,0,4,37],
+"group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890a0f4dde6e82b84f5769873f6704fcd290":[17,0,0,4,42,2],
+"group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890a4fa16d3867498f5e2f8ae5c94b0fab85":[17,0,0,4,42,5],
+"group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890a68b2137c7946583a99f0dac2286523eb":[17,0,0,4,42,0],
+"group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890a90d21c8885ab138f7cf91f253dd6ef86":[17,0,0,4,42,6],
+"group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890a9746b5049a62bca2f7b844925e6136ba":[17,0,0,4,42,4],
+"group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890ade8e74cf7910b3a71fe902a40abf7eee":[17,0,0,4,42,7],
+"group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890aefb89989305b5c34120b0f18ee8e2c5d":[17,0,0,4,42,1],
+"group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890afb78d98f37fecc53dd1637d94c5c0055":[17,0,0,4,42,3],
+"group___epid_verifier_module.html":[17,0,2],
+"group___epid_verifier_module.html#ga0909703a0a4dfe080374d0d99077465a":[17,0,2,15],
+"group___epid_verifier_module.html#ga1c3810ef361da678a1f77823bd9c37a6":[17,0,2,10],
+"group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70":[17,0,2,8],
+"group___epid_verifier_module.html#ga1d41d6ef4dabbc30ec28452edd6baffb":[17,0,2,11],
+"group___epid_verifier_module.html#ga2a75c7d5775e852a7b6e24178dd4054f":[17,0,2,6],
+"group___epid_verifier_module.html#ga4c7c9820409ee06f30bb8dc75fdd5dcf":[17,0,2,14],
+"group___epid_verifier_module.html#ga6707e691f4b3916f9c684d5bbd463d12":[17,0,2,9],
+"group___epid_verifier_module.html#ga8eaeb9f4a34e9e37ccdf342919f38c69":[17,0,2,4],
+"group___epid_verifier_module.html#ga92df4d00ea4ee59d7bfd35b23da03392":[17,0,2,16],
+"group___epid_verifier_module.html#ga97b58b2382f24756b66a357f1e825c92":[17,0,2,12],
+"group___epid_verifier_module.html#gac3b1f1a2bdba8eeeebbf1e0c8c00862e":[17,0,2,18],
+"group___epid_verifier_module.html#gac6e2fab59e3af8a33a74a5b201642700":[17,0,2,7],
+"group___epid_verifier_module.html#gac857bff47e7d80363eac15285471fe81":[17,0,2,19],
+"group___epid_verifier_module.html#gae3f9c37628e18b880d8bbee3e7f55064":[17,0,2,17],
+"group___epid_verifier_module.html#gae44bd8acbc1e7205aeedff0c7e2632a8":[17,0,2,3]
};
diff --git a/doc/html/navtreeindex1.js b/doc/html/navtreeindex1.js
index ad381c3..89cb4da 100644
--- a/doc/html/navtreeindex1.js
+++ b/doc/html/navtreeindex1.js
@@ -1,253 +1,253 @@
var NAVTREEINDEX1 =
{
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9":[16,0,0,1,0,0],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a94ae9c9b9337afd2fefd3b4f9c3160df":[16,0,0,1,0,18],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aa08f0d2e394b37694117a6a32bc71e6e":[16,0,0,1,0,7],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ab2768a1a5c4374cb1ac6175c09c73129":[16,0,0,1,0,19],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ab45ad60085d03c03ea30b40a0519897e":[16,0,0,1,0,1],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ab7dfec784192a827a91a4b8a6054d01c":[16,0,0,1,0,10],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ad134d6cc95a9dcb1b1a9f9c358047cbf":[16,0,0,1,0,9],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ad4d4ff24a7ef2cd7a50b8082265e9ff4":[16,0,0,1,0,15],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aedd43fb4043bef3b515fc23f1d9a5fe5":[16,0,0,1,0,3],
-"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8":[16,0,0,1,0,2],
-"group___file_parser.html":[16,0,0,2],
-"group___file_parser.html#ga1562efc7c1891875d6b2b9180d65de9d":[16,0,0,2,4],
-"group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f":[16,0,0,2,9],
-"group___file_parser.html#ga3770c39a0546c79447c9d4159d794c33":[16,0,0,2,10],
-"group___file_parser.html#ga43fdbc1bf2edd3695d21cb457365afbb":[16,0,0,2,6],
-"group___file_parser.html#ga8e38d1102eb1dd9b5af2e2f79236da55":[16,0,0,2,5],
-"group___file_parser.html#ga9a33be7edc6b4c7a867fb07bd2bddecb":[16,0,0,2,3],
-"group___file_parser.html#gaae808987ce82188dff42baa4e43cab82":[16,0,0,2,11],
-"group___file_parser.html#gad767f72dc55307b872a8b5600da3fd6f":[16,0,0,2,7],
-"group___file_parser.html#gadc033fb23e3cbda56aa7e3d412060b7e":[16,0,0,2,8],
-"group___file_parser.html#gga1562efc7c1891875d6b2b9180d65de9da5f270e2e8c2412bc07de293023f425cc":[16,0,0,2,4,0],
-"group___file_parser.html#gga1562efc7c1891875d6b2b9180d65de9da6af0ee9d9689f1d4325bdd0beb8a89e2":[16,0,0,2,4,1],
-"group___file_parser.html#gga1562efc7c1891875d6b2b9180d65de9da8bbd27765997dd10f1c0378dbecef01d":[16,0,0,2,4,2],
-"group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecba1f8d8c4b253403a35c51e05d34a7ca1e":[16,0,0,2,3,1],
-"group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecba692b4141bff8225bee6000750b0da322":[16,0,0,2,3,2],
-"group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecba8aead4b6aab87a1efb2d7e8c77a9b710":[16,0,0,2,3,3],
-"group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecba8e5247daee3999540e6cb24d4c2b3770":[16,0,0,2,3,4],
-"group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecbab772fa1e3f221af125ffb34b86b3f24c":[16,0,0,2,3,7],
-"group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecbac24554caafe2db01e2daed413188cd92":[16,0,0,2,3,0],
-"group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecbac52e5fe24a12424316f655b9b7c62600":[16,0,0,2,3,6],
-"group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecbac6d742ea3dd3b17f6d763970ac84b811":[16,0,0,2,3,8],
-"group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecbac708ba9e56eaeac0f1256457cbd45911":[16,0,0,2,3,5],
-"group___finite_field_primitives.html":[16,0,0,0,3],
-"group___finite_field_primitives.html#ga0d0c31a22bbfb665a16b2d25b0cd2634":[16,0,0,0,3,16],
-"group___finite_field_primitives.html#ga18a952cebb4a1274c73e6cb0c19e8aea":[16,0,0,0,3,7],
-"group___finite_field_primitives.html#ga1a6e6d3c2319bb24eae8670b021e223b":[16,0,0,0,3,4],
-"group___finite_field_primitives.html#ga1bad3c6945d1d709fceb07a1dd03000e":[16,0,0,0,3,2],
-"group___finite_field_primitives.html#ga1ef46fc83f9c11263a2aa1ec906c9144":[16,0,0,0,3,13],
-"group___finite_field_primitives.html#ga20d9140e5670d679ef8183d9b5115f53":[16,0,0,0,3,10],
-"group___finite_field_primitives.html#ga26069d035d0f6ade33af2b5d5c14949a":[16,0,0,0,3,8],
-"group___finite_field_primitives.html#ga39892fe2ab431e166dbbcf57756660f6":[16,0,0,0,3,15],
-"group___finite_field_primitives.html#ga4613a75bd001a974b3e3e494c3a112a5":[16,0,0,0,3,11],
-"group___finite_field_primitives.html#ga59d20610f245ff4bc3a17b7bfe289991":[16,0,0,0,3,17],
-"group___finite_field_primitives.html#ga6622db072782fd9e53b4d59dd3dbd8e8":[16,0,0,0,3,6],
-"group___finite_field_primitives.html#ga678694636708463b078d842d5c58a900":[16,0,0,0,3,24],
-"group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa":[16,0,0,0,3,0],
-"group___finite_field_primitives.html#ga7d99fdc5e4573668a5744e49df7ab67c":[16,0,0,0,3,20],
-"group___finite_field_primitives.html#ga83041e3be9984a4bd8f1021934bfa3a2":[16,0,0,0,3,21],
-"group___finite_field_primitives.html#ga84d21decc1c957bcf6e98e1492eb2ac3":[16,0,0,0,3,12],
-"group___finite_field_primitives.html#ga884d9e1baadf29a410244a735853e3c7":[16,0,0,0,3,23],
-"group___finite_field_primitives.html#ga90b2c192708973b54b7a3e82b34536ed":[16,0,0,0,3,18],
-"group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e":[16,0,0,0,3,1],
-"group___finite_field_primitives.html#gacbdd2871ecf93dadaac9d2c5b16e1e5f":[16,0,0,0,3,3],
-"group___finite_field_primitives.html#gacc54f315ede2dbeb8c5990c024a0de6c":[16,0,0,0,3,19],
-"group___finite_field_primitives.html#gae69af62a03179718cac81b004549c598":[16,0,0,0,3,22],
-"group___finite_field_primitives.html#gae7a8c7503b6fc7a41bcaab4d45ca37b2":[16,0,0,0,3,14],
-"group___finite_field_primitives.html#gaed2acb8583e9c9f6b49fdb660c672625":[16,0,0,0,3,9],
-"group___finite_field_primitives.html#gaf0ddbc1bad048d67771cba119eb44a6c":[16,0,0,0,3,5],
-"group___hash_primitives.html":[16,0,0,0,4],
-"group___hash_primitives.html#ga86d62aac9efd7445acee311b41846c6c":[16,0,0,0,4,1],
-"group___pairing_primitives.html":[16,0,0,0,5],
-"group___pairing_primitives.html#ga29f79a645871830754d396b9b4a2a0cc":[16,0,0,0,5,3],
-"group___pairing_primitives.html#ga3f1fa61d25487f96dfb0ffef4ad35607":[16,0,0,0,5,1],
-"group___pairing_primitives.html#ga5dd07d13536e27c37eaeee285297066c":[16,0,0,0,5,4],
-"group___pairing_primitives.html#gad54aebdc331d39b73000fdca9e04f94d":[16,0,0,0,5,2],
-"index.html":[],
+"group___epid_verifier_module.html#gaeb05e6faea6f09c0665b13adc6e7ddea":[17,0,2,5],
+"group___epid_verifier_module.html#gaf172a5f8f7f069d38c5838b723a1a85c":[17,0,2,2],
+"group___epid_verifier_module.html#gafab08180a43b58ce2e1d56c4b070bb0e":[17,0,2,13],
+"group___error_codes.html":[17,0,0,1],
+"group___error_codes.html#ga59e8680ce52509302fd58a987e45004d":[17,0,0,1,1],
+"group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360":[17,0,0,1,0],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a11a4d2f1c37064eb663de08dc57bcda8":[17,0,0,1,0,11],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a1739ecb620f4bede2e1b84e52a96cee6":[17,0,0,1,0,12],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a1dc7b7e6ff97c7ed9ff4191d76ebd6e1":[17,0,0,1,0,4],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a3706f895a660260033b5b91890516c0f":[17,0,0,1,0,17],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a43c658cbf0d156850d71ce3f8efd461c":[17,0,0,1,0,5],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a486e052baa99c6c25ae5d5cc710de298":[17,0,0,1,0,6],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a5252da1ff519a098446723e9edd30cc7":[17,0,0,1,0,8],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a61234ad9610406da6bf7977afd72a357":[17,0,0,1,0,16],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a700953ded1af35781948e8ada6dedf43":[17,0,0,1,0,20],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a83a867b4f71ee13edbfca2f1b72abbec":[17,0,0,1,0,14],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a893cd0d417b139bb376d09c93695c3f3":[17,0,0,1,0,13],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9":[17,0,0,1,0,0],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a94ae9c9b9337afd2fefd3b4f9c3160df":[17,0,0,1,0,18],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aa08f0d2e394b37694117a6a32bc71e6e":[17,0,0,1,0,7],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ab2768a1a5c4374cb1ac6175c09c73129":[17,0,0,1,0,19],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ab45ad60085d03c03ea30b40a0519897e":[17,0,0,1,0,1],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ab7dfec784192a827a91a4b8a6054d01c":[17,0,0,1,0,10],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ad134d6cc95a9dcb1b1a9f9c358047cbf":[17,0,0,1,0,9],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ad4d4ff24a7ef2cd7a50b8082265e9ff4":[17,0,0,1,0,15],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aedd43fb4043bef3b515fc23f1d9a5fe5":[17,0,0,1,0,3],
+"group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8":[17,0,0,1,0,2],
+"group___file_parser.html":[17,0,0,2],
+"group___file_parser.html#ga1562efc7c1891875d6b2b9180d65de9d":[17,0,0,2,4],
+"group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f":[17,0,0,2,9],
+"group___file_parser.html#ga3770c39a0546c79447c9d4159d794c33":[17,0,0,2,10],
+"group___file_parser.html#ga43fdbc1bf2edd3695d21cb457365afbb":[17,0,0,2,6],
+"group___file_parser.html#ga8e38d1102eb1dd9b5af2e2f79236da55":[17,0,0,2,5],
+"group___file_parser.html#ga9a33be7edc6b4c7a867fb07bd2bddecb":[17,0,0,2,3],
+"group___file_parser.html#gaae808987ce82188dff42baa4e43cab82":[17,0,0,2,11],
+"group___file_parser.html#gad767f72dc55307b872a8b5600da3fd6f":[17,0,0,2,7],
+"group___file_parser.html#gadc033fb23e3cbda56aa7e3d412060b7e":[17,0,0,2,8],
+"group___file_parser.html#gga1562efc7c1891875d6b2b9180d65de9da5f270e2e8c2412bc07de293023f425cc":[17,0,0,2,4,0],
+"group___file_parser.html#gga1562efc7c1891875d6b2b9180d65de9da6af0ee9d9689f1d4325bdd0beb8a89e2":[17,0,0,2,4,1],
+"group___file_parser.html#gga1562efc7c1891875d6b2b9180d65de9da8bbd27765997dd10f1c0378dbecef01d":[17,0,0,2,4,2],
+"group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecba1f8d8c4b253403a35c51e05d34a7ca1e":[17,0,0,2,3,1],
+"group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecba692b4141bff8225bee6000750b0da322":[17,0,0,2,3,2],
+"group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecba8aead4b6aab87a1efb2d7e8c77a9b710":[17,0,0,2,3,3],
+"group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecba8e5247daee3999540e6cb24d4c2b3770":[17,0,0,2,3,4],
+"group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecbab772fa1e3f221af125ffb34b86b3f24c":[17,0,0,2,3,7],
+"group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecbac24554caafe2db01e2daed413188cd92":[17,0,0,2,3,0],
+"group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecbac52e5fe24a12424316f655b9b7c62600":[17,0,0,2,3,6],
+"group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecbac6d742ea3dd3b17f6d763970ac84b811":[17,0,0,2,3,8],
+"group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecbac708ba9e56eaeac0f1256457cbd45911":[17,0,0,2,3,5],
+"group___finite_field_primitives.html":[17,0,0,0,3],
+"group___finite_field_primitives.html#ga0d0c31a22bbfb665a16b2d25b0cd2634":[17,0,0,0,3,16],
+"group___finite_field_primitives.html#ga1a6e6d3c2319bb24eae8670b021e223b":[17,0,0,0,3,4],
+"group___finite_field_primitives.html#ga1bad3c6945d1d709fceb07a1dd03000e":[17,0,0,0,3,2],
+"group___finite_field_primitives.html#ga1ef46fc83f9c11263a2aa1ec906c9144":[17,0,0,0,3,13],
+"group___finite_field_primitives.html#ga20d9140e5670d679ef8183d9b5115f53":[17,0,0,0,3,10],
+"group___finite_field_primitives.html#ga26069d035d0f6ade33af2b5d5c14949a":[17,0,0,0,3,8],
+"group___finite_field_primitives.html#ga39892fe2ab431e166dbbcf57756660f6":[17,0,0,0,3,15],
+"group___finite_field_primitives.html#ga4613a75bd001a974b3e3e494c3a112a5":[17,0,0,0,3,11],
+"group___finite_field_primitives.html#ga59d20610f245ff4bc3a17b7bfe289991":[17,0,0,0,3,17],
+"group___finite_field_primitives.html#ga6622db072782fd9e53b4d59dd3dbd8e8":[17,0,0,0,3,6],
+"group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa":[17,0,0,0,3,0],
+"group___finite_field_primitives.html#ga7d99fdc5e4573668a5744e49df7ab67c":[17,0,0,0,3,20],
+"group___finite_field_primitives.html#ga83041e3be9984a4bd8f1021934bfa3a2":[17,0,0,0,3,21],
+"group___finite_field_primitives.html#ga84d21decc1c957bcf6e98e1492eb2ac3":[17,0,0,0,3,12],
+"group___finite_field_primitives.html#ga8a143a5a815a62f4947be2de1653c50f":[17,0,0,0,3,23],
+"group___finite_field_primitives.html#ga90b2c192708973b54b7a3e82b34536ed":[17,0,0,0,3,18],
+"group___finite_field_primitives.html#gaa3c1f7515dd823ddad8764091ebc665f":[17,0,0,0,3,24],
+"group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e":[17,0,0,0,3,1],
+"group___finite_field_primitives.html#gabd511d79d9cbd1899e59258f149102c5":[17,0,0,0,3,7],
+"group___finite_field_primitives.html#gacbdd2871ecf93dadaac9d2c5b16e1e5f":[17,0,0,0,3,3],
+"group___finite_field_primitives.html#gacc54f315ede2dbeb8c5990c024a0de6c":[17,0,0,0,3,19],
+"group___finite_field_primitives.html#gae69af62a03179718cac81b004549c598":[17,0,0,0,3,22],
+"group___finite_field_primitives.html#gae7a8c7503b6fc7a41bcaab4d45ca37b2":[17,0,0,0,3,14],
+"group___finite_field_primitives.html#gaed2acb8583e9c9f6b49fdb660c672625":[17,0,0,0,3,9],
+"group___finite_field_primitives.html#gaf0ddbc1bad048d67771cba119eb44a6c":[17,0,0,0,3,5],
+"group___hash_primitives.html":[17,0,0,0,4],
+"group___hash_primitives.html#ga86d62aac9efd7445acee311b41846c6c":[17,0,0,0,4,1],
+"group___pairing_primitives.html":[17,0,0,0,5],
+"group___pairing_primitives.html#ga29f79a645871830754d396b9b4a2a0cc":[17,0,0,0,5,3],
+"group___pairing_primitives.html#ga3f1fa61d25487f96dfb0ffef4ad35607":[17,0,0,0,5,1],
+"group___pairing_primitives.html#ga58a9d3cb6129274a04c72a35a52f768d":[17,0,0,0,5,4],
+"group___pairing_primitives.html#gad54aebdc331d39b73000fdca9e04f94d":[17,0,0,0,5,2],
+"group___tpm_module.html":[17,0,1,0],
+"group___tpm_module.html#ga2335ec4eb78b542cf87df9b0cd15358c":[17,0,1,0,2],
+"group___tpm_module.html#ga3318f97e4d1763815dace3779ae6564f":[17,0,1,0,8],
+"group___tpm_module.html#ga42b80d485cff39fe9ec14a0b5a81426d":[17,0,1,0,13],
+"group___tpm_module.html#ga4346d22fb9fed6a161cb1ea178b50ed2":[17,0,1,0,11],
+"group___tpm_module.html#ga5e62323b94837b847f3e869cf2ff3615":[17,0,1,0,7],
+"group___tpm_module.html#ga688441f78f68aa53c41fcae4d31c6f50":[17,0,1,0,14],
+"group___tpm_module.html#ga901cad19eb14a6a6a02e85f9d710d287":[17,0,1,0,3],
+"group___tpm_module.html#ga95bc18225c1d87803be7965978e37449":[17,0,1,0,5],
+"group___tpm_module.html#gaa53a6bd52e22808bac21596a964bdece":[17,0,1,0,6],
+"group___tpm_module.html#gaa667fb3295e4533334bb32afcd43890f":[17,0,1,0,15],
+"group___tpm_module.html#gab80c411f070858fbe019d93f5ac6a6ec":[17,0,1,0,9],
+"group___tpm_module.html#gace6002b520db41d8e781b02c6f538dc0":[17,0,1,0,12],
+"group___tpm_module.html#gae69218c9cba6a19d3ae1199c59772efc":[17,0,1,0,10],
+"group___tpm_module.html#gaeb9bfaa9288263af9feccd0d0543c9bc":[17,0,1,0,4],
+"group___tpm_module.html#gaf9004ce8832c1acae497604d1deb49cd":[17,0,1,0,16],
"index.html":[1],
-"modules.html":[16],
+"index.html":[],
+"index.html#mainpage_roadmap":[1,0],
+"modules.html":[17],
"pages.html":[],
-"struct_basic_signature.html":[16,0,0,4,21],
-"struct_basic_signature.html#a0078cc83ecf6c7e31f96b7d44aa60e21":[16,0,0,4,21,2],
-"struct_basic_signature.html#a0e8ea6a2cd3af10e9b59d96d7d06bc69":[16,0,0,4,21,6],
-"struct_basic_signature.html#a4daa94db5068db3f10960f3dd178d603":[16,0,0,4,21,1],
-"struct_basic_signature.html#a69115a4776d15b48411dd6c3a76d0f3d":[16,0,0,4,21,3],
-"struct_basic_signature.html#a730f74d85cfb4fa4089d43c87b97a624":[16,0,0,4,21,7],
-"struct_basic_signature.html#a79d8dec8c5da176e497abf22e4c43adb":[16,0,0,4,21,5],
-"struct_basic_signature.html#a91daebc5b577688afeed2a7ee7913245":[16,0,0,4,21,4],
-"struct_basic_signature.html#ae90cb6af66b010ae39913f033c1e65ac":[16,0,0,4,21,0],
-"struct_big_num_str.html":[16,0,0,4,8],
-"struct_big_num_str.html#a442dcf33889b4f85c5b1228d2c8e6838":[16,0,0,4,8,0],
-"struct_compressed_priv_key.html":[16,0,0,4,18],
-"struct_compressed_priv_key.html#a0b0535f0567eb0e48f799d27991d0f66":[16,0,0,4,18,0],
-"struct_compressed_priv_key.html#a54b9af7699f517bbaef3d52d03e3fed8":[16,0,0,4,18,2],
-"struct_compressed_priv_key.html#ac6689899f1d9a6a8c5e4915563679840":[16,0,0,4,18,1],
-"struct_ecdsa_private_key.html":[16,0,0,4,34],
-"struct_ecdsa_private_key.html#a97efee9b4079f95d94a104f9a6d8c96d":[16,0,0,4,34,0],
-"struct_ecdsa_public_key.html":[16,0,0,4,33],
-"struct_ecdsa_public_key.html#a37c51614faf022eec491b4de8f3a13e1":[16,0,0,4,33,0],
-"struct_ecdsa_public_key.html#a4503c4613386cbc78add1dc245c99284":[16,0,0,4,33,1],
-"struct_ecdsa_signature.html":[16,0,0,4,32],
-"struct_ecdsa_signature.html#a2efd6bf37b12f35135bf325fa491b029":[16,0,0,4,32,1],
-"struct_ecdsa_signature.html#a64b623605a55a267a36df18f29142d0d":[16,0,0,4,32,0],
-"struct_epid11_basic_signature.html":[16,0,0,4,0,8],
-"struct_epid11_basic_signature.html#a1a73fc922f69e2499643dd4c53d0d42d":[16,0,0,4,0,8,5],
-"struct_epid11_basic_signature.html#a267cf4e17d10584736b0c38f3668d822":[16,0,0,4,0,8,12],
-"struct_epid11_basic_signature.html#a2718346665210b7e26521bf4a15cb3bd":[16,0,0,4,0,8,9],
-"struct_epid11_basic_signature.html#a27fd7ae99d1ada652e21e7508a467c0b":[16,0,0,4,0,8,0],
-"struct_epid11_basic_signature.html#a29a700f3bec251600e18b2292081df4b":[16,0,0,4,0,8,6],
-"struct_epid11_basic_signature.html#a5882fcbfd272774e12e50a2d77f0b139":[16,0,0,4,0,8,2],
-"struct_epid11_basic_signature.html#a58b058a9c5119a240177acfade328b3b":[16,0,0,4,0,8,11],
-"struct_epid11_basic_signature.html#a911441845fc9b82d514133371b5ba87c":[16,0,0,4,0,8,10],
-"struct_epid11_basic_signature.html#a9cc6efcd3d7270022779bd16776168ed":[16,0,0,4,0,8,1],
-"struct_epid11_basic_signature.html#ae17b45194997a6fa13c6014a51ec711c":[16,0,0,4,0,8,8],
-"struct_epid11_basic_signature.html#aeb221cf52bc2b1a9bf6e0a9779bfd20f":[16,0,0,4,0,8,4],
-"struct_epid11_basic_signature.html#af18200712d2cf3ed3ccaee328e8a4e0f":[16,0,0,4,0,8,3],
-"struct_epid11_basic_signature.html#afe28bad6328f81e6f7af011cc96ac2e5":[16,0,0,4,0,8,7],
-"struct_epid11_g2_elem_str.html":[16,0,0,4,0,4],
-"struct_epid11_g2_elem_str.html#a9e8984e479bcbe8bd36c65e80c340032":[16,0,0,4,0,4,1],
-"struct_epid11_g2_elem_str.html#af28558484298f4f56377ededf57a4a04":[16,0,0,4,0,4,0],
-"struct_epid11_group_pub_key.html":[16,0,0,4,0,7],
-"struct_epid11_group_pub_key.html#a056c7138246e2bdcd47eaad501b756bb":[16,0,0,4,0,7,3],
-"struct_epid11_group_pub_key.html#a36f688472e2655052d485eac67d8c362":[16,0,0,4,0,7,1],
-"struct_epid11_group_pub_key.html#a964344b3c595bdd585bb9b5d9d0ea762":[16,0,0,4,0,7,0],
-"struct_epid11_group_pub_key.html#aa724e9d2f0cb6019c05547d76a13b72a":[16,0,0,4,0,7,2],
-"struct_epid11_group_rl.html":[16,0,0,4,0,14],
-"struct_epid11_group_rl.html#a35cb954f598d4006b0f047cde77010a5":[16,0,0,4,0,14,1],
-"struct_epid11_group_rl.html#a63afa9863e8dcb63ff884e6e4093c481":[16,0,0,4,0,14,2],
-"struct_epid11_group_rl.html#a97f165c59bc447e3ca3c2148a096710f":[16,0,0,4,0,14,0],
-"struct_epid11_gt_elem_str.html":[16,0,0,4,0,5],
-"struct_epid11_gt_elem_str.html#aed8dd86f1696c2f3537154fc904bf2b0":[16,0,0,4,0,5,0],
-"struct_epid11_nr_proof.html":[16,0,0,4,0,9],
-"struct_epid11_nr_proof.html#a1ad7fe6b32c09f2504ee49731c0ad145":[16,0,0,4,0,9,1],
-"struct_epid11_nr_proof.html#a2e5ee8dc25d296538dce935397a93d68":[16,0,0,4,0,9,0],
-"struct_epid11_nr_proof.html#a5ad9ba3bfac4eac37fd4a4e33ea65ddc":[16,0,0,4,0,9,3],
-"struct_epid11_nr_proof.html#aa8406e938b2f87bded9e374e93a8ee5d":[16,0,0,4,0,9,2],
-"struct_epid11_params.html":[16,0,0,4,0,6],
-"struct_epid11_params.html#a01381f84b2d747b6273e21c71c58a1b0":[16,0,0,4,0,6,0],
-"struct_epid11_params.html#a02bd6fa2ab256e3a07533e947ab0101e":[16,0,0,4,0,6,10],
-"struct_epid11_params.html#a0fe238db4ebc0225899dc2dac97d11c0":[16,0,0,4,0,6,9],
-"struct_epid11_params.html#a1c6bbc4e066449d9c329f88cb653ef7c":[16,0,0,4,0,6,6],
-"struct_epid11_params.html#a27b45ed7771a3024d1d059b4b4ff6eae":[16,0,0,4,0,6,2],
-"struct_epid11_params.html#a2aa4d8a2ebe0dfeb6d930fd7b39f9d1a":[16,0,0,4,0,6,11],
-"struct_epid11_params.html#a49462f35596d07a456a731d0690fdd83":[16,0,0,4,0,6,14],
-"struct_epid11_params.html#a77a8350b97a7afb584a46eb5b32f03bf":[16,0,0,4,0,6,12],
-"struct_epid11_params.html#a7eb9a1371d7187ae81bccfa8d5595033":[16,0,0,4,0,6,7],
-"struct_epid11_params.html#a835e70da717cd5b0c94e242a6418a287":[16,0,0,4,0,6,5],
-"struct_epid11_params.html#aacc39ebe0cc625321039ffb6be0b0e87":[16,0,0,4,0,6,4],
-"struct_epid11_params.html#aad03fd1cc3955bb8879535fa7298123f":[16,0,0,4,0,6,13],
-"struct_epid11_params.html#ade3f88ce73d7de656ec67d9fdb0719d7":[16,0,0,4,0,6,3],
-"struct_epid11_params.html#ae2d1dc635d9d7cba496c3d64fb6f9d5b":[16,0,0,4,0,6,8],
-"struct_epid11_params.html#ae8770bb921aac9214ff8c45c41dbb228":[16,0,0,4,0,6,1],
-"struct_epid11_params.html#af22cfcd6c7ec0e7e7369b79554b963bd":[16,0,0,4,0,6,15],
-"struct_epid11_priv_rl.html":[16,0,0,4,0,11],
-"struct_epid11_priv_rl.html#a2b3899f5a35bf64f860d6d91bccb03c8":[16,0,0,4,0,11,3],
-"struct_epid11_priv_rl.html#aa8945d81e30674b52a6d0900b64feb3c":[16,0,0,4,0,11,1],
-"struct_epid11_priv_rl.html#abbb75fee81aecb2dde7e2daab895ad3b":[16,0,0,4,0,11,0],
-"struct_epid11_priv_rl.html#ad95f880f40e2f40c723f5bdbd22ecfa2":[16,0,0,4,0,11,2],
-"struct_epid11_sig_rl.html":[16,0,0,4,0,13],
-"struct_epid11_sig_rl.html#a6473f8a98f76c9f82183041ea5ae17e3":[16,0,0,4,0,13,0],
-"struct_epid11_sig_rl.html#a8c654d43df132db7874f4c84c177dc12":[16,0,0,4,0,13,2],
-"struct_epid11_sig_rl.html#aa38674729293f4879ff94328dd3c59b1":[16,0,0,4,0,13,3],
-"struct_epid11_sig_rl.html#ad45b0e3e1be59649150dd34c104000ac":[16,0,0,4,0,13,1],
-"struct_epid11_sig_rl_entry.html":[16,0,0,4,0,12],
-"struct_epid11_sig_rl_entry.html#a5de66e1352eafe95774a0d76bac8f01a":[16,0,0,4,0,12,1],
-"struct_epid11_sig_rl_entry.html#abe47cfbd00684941f93a211417bedf0c":[16,0,0,4,0,12,0],
-"struct_epid11_signature.html":[16,0,0,4,0,10],
-"struct_epid11_signature.html#a43cb3ed13c862ff05a9292623ad57c5e":[16,0,0,4,0,10,1],
-"struct_epid11_signature.html#a48526e73f02ad3f1544c4c71c481f153":[16,0,0,4,0,10,3],
-"struct_epid11_signature.html#abf24a8df563ba3f535486d8dad7384f4":[16,0,0,4,0,10,2],
-"struct_epid11_signature.html#ad25c277223a5210063163ea554d08ad4":[16,0,0,4,0,10,0],
-"struct_epid11_verifier_precomp.html":[16,0,2,0,0],
-"struct_epid11_verifier_precomp.html#a03138e937f4488bdbc52ed473dc313da":[16,0,2,0,0,3],
-"struct_epid11_verifier_precomp.html#a0a980adb039089263ec59a995600ee91":[16,0,2,0,0,0],
-"struct_epid11_verifier_precomp.html#a14ebadf105aff085edb9a817a2d1db89":[16,0,2,0,0,2],
-"struct_epid11_verifier_precomp.html#ad0ff2a13c2c87460296900dde72a2f30":[16,0,2,0,0,1],
-"struct_epid2_params.html":[16,0,0,4,14],
-"struct_epid2_params.html#a023603228fed2854ddae2e228938940f":[16,0,0,4,14,6],
-"struct_epid2_params.html#a200a0cba1c9e4ad512bece23f2461a5f":[16,0,0,4,14,7],
-"struct_epid2_params.html#a2f868edb49be49f645101ef5ebbbc551":[16,0,0,4,14,0],
-"struct_epid2_params.html#a4c5195b4fa9393a07a121336202531ad":[16,0,0,4,14,2],
-"struct_epid2_params.html#a609b0aac17fca34fe39bee29676a9618":[16,0,0,4,14,3],
-"struct_epid2_params.html#ac0e0dad45b10927860cd5fa4f8101f08":[16,0,0,4,14,5],
-"struct_epid2_params.html#ac2d7507c6f58c3451beacacb91b52695":[16,0,0,4,14,1],
-"struct_epid2_params.html#ae1d8f5d6036a82064e91bc137b278e74":[16,0,0,4,14,8],
-"struct_epid2_params.html#af23f07fb0e1745c0ad14aceeaa946928":[16,0,0,4,14,4],
-"struct_epid_ca_certificate.html":[16,0,0,2,2],
-"struct_epid_ca_certificate.html#a280e0b0238cf45834c21849ab8a7e124":[16,0,0,2,2,1],
-"struct_epid_ca_certificate.html#a2811c1914ffae913820f13da914c8f01":[16,0,0,2,2,0],
-"struct_epid_ca_certificate.html#a2f8f09ae02919c379c38386668b47418":[16,0,0,2,2,6],
-"struct_epid_ca_certificate.html#a3a44e8050ca2f5085652b2b4e15b779c":[16,0,0,2,2,3],
-"struct_epid_ca_certificate.html#a4f77996f90ed7da1d0503c4236b2c9d1":[16,0,0,2,2,7],
-"struct_epid_ca_certificate.html#a9d2fc21f46cf9fc96e2ea557b70e5356":[16,0,0,2,2,4],
-"struct_epid_ca_certificate.html#ab9d4c318b1fc8d38d3ce53b29f2dfee2":[16,0,0,2,2,5],
-"struct_epid_ca_certificate.html#abd69cce8d5e3940787ee0d17f72184ab":[16,0,0,2,2,8],
-"struct_epid_ca_certificate.html#ac03cf7257c52ad14e3dd3201b930dd50":[16,0,0,2,2,2],
-"struct_epid_file_header.html":[16,0,0,2,1],
-"struct_epid_file_header.html#a35d43c51c1739940381e4898ca87b824":[16,0,0,2,1,0],
-"struct_epid_file_header.html#af5d48c739cc6c00c6e1ce35abf4f1473":[16,0,0,2,1,1],
-"struct_epid_signature.html":[16,0,0,4,23],
-"struct_epid_signature.html#a4155f3f4f1223fc4ae50c94f5305def1":[16,0,0,4,23,1],
-"struct_epid_signature.html#a62a6b0ffcd5f68dd3d2786a58fe43017":[16,0,0,4,23,0],
-"struct_epid_signature.html#a89d2e38223944310b6eeeadf6061a2dd":[16,0,0,4,23,2],
-"struct_epid_signature.html#ab0fe5f98bff737fcfbfe0b4d658e83f2":[16,0,0,4,23,3],
-"struct_fp_elem_str.html":[16,0,0,4,9],
-"struct_fp_elem_str.html#a5ddb96a5567750f2834335851c906c45":[16,0,0,4,9,0],
-"struct_fq12_elem_str.html":[16,0,0,4,31],
-"struct_fq12_elem_str.html#a0520947335aaf52de90af1dec5bdd112":[16,0,0,4,31,0],
-"struct_fq2_elem_str.html":[16,0,0,4,29],
-"struct_fq2_elem_str.html#ab1d253eb24ba30eaf516ac429daab915":[16,0,0,4,29,0],
-"struct_fq3_elem_str.html":[16,0,0,4,0,3],
-"struct_fq3_elem_str.html#af1be0a4d5c9c674d75bec34f95e3c731":[16,0,0,4,0,3,0],
-"struct_fq6_elem_str.html":[16,0,0,4,30],
-"struct_fq6_elem_str.html#a89d656e5c815b4a2382d11ef6932a7d2":[16,0,0,4,30,0],
-"struct_fq_elem_str.html":[16,0,0,4,10],
-"struct_fq_elem_str.html#aac1a876b51a8d2c6d1510e4df2fd3f14":[16,0,0,4,10,0],
-"struct_g1_elem_str.html":[16,0,0,4,11],
-"struct_g1_elem_str.html#a3b0e658d6e5697763ad9c633c11d4ec4":[16,0,0,4,11,0],
-"struct_g1_elem_str.html#a8f2455ca314e885ea180dadf84bf27c3":[16,0,0,4,11,1],
-"struct_g2_elem_str.html":[16,0,0,4,12],
-"struct_g2_elem_str.html#a145ec5b20a6f4f00b080e11c8680afc3":[16,0,0,4,12,0],
-"struct_g2_elem_str.html#a43141b2458aecceed8ee2748270f7908":[16,0,0,4,12,1],
-"struct_group_pub_key.html":[16,0,0,4,15],
-"struct_group_pub_key.html#a2a4320ec99fd1a15df412fbf2a8d49f1":[16,0,0,4,15,2],
-"struct_group_pub_key.html#a86be439104fb60b324784baf24a943f9":[16,0,0,4,15,3],
-"struct_group_pub_key.html#a8c22c758ea186f95e3bf4b2ef8451da5":[16,0,0,4,15,1],
-"struct_group_pub_key.html#ae8e77ab4d5eb3c8e566c24a64cce56ee":[16,0,0,4,15,0],
-"struct_group_rl.html":[16,0,0,4,27],
-"struct_group_rl.html#a51022e172ab8b945efc69f1e63170107":[16,0,0,4,27,0],
-"struct_group_rl.html#a69c41d99cdfc5b6ece7442f466f7ec3f":[16,0,0,4,27,2],
-"struct_group_rl.html#a9067f01c63cdefbc8e23c3cf67a10172":[16,0,0,4,27,1],
-"struct_gt_elem_str.html":[16,0,0,4,13],
-"struct_gt_elem_str.html#aeaeb0e9e1c6efd378a475eb9a6c42132":[16,0,0,4,13,0],
-"struct_i_priv_key.html":[16,0,0,4,16],
-"struct_i_priv_key.html#a6d484175317aef09fb959c3ca55fc70a":[16,0,0,4,16,0],
-"struct_i_priv_key.html#ad400a4237b6d50855538fd40580eb1bb":[16,0,0,4,16,1],
-"struct_join_request.html":[16,0,0,4,20],
-"struct_join_request.html#a005651506fd4511e8a3537f6c3634532":[16,0,0,4,20,1],
-"struct_join_request.html#a55e30a274e83b808db6fbab5ae6c6cb8":[16,0,0,4,20,0],
-"struct_join_request.html#a73bf8989df5f90eb3d06e7a42ad74d1d":[16,0,0,4,20,2],
-"struct_member_precomp.html":[16,0,1,0],
-"struct_member_precomp.html#a4e7412969bed3964f813b093b948e7b4":[16,0,1,0,1],
-"struct_member_precomp.html#a55e5c4b25c8f0f426969a8d745260fe5":[16,0,1,0,0],
-"struct_member_precomp.html#a573551f6494e372f44fd3bdf5b02aeda":[16,0,1,0,3],
-"struct_member_precomp.html#a879d5a7b0c30088b23f6e5c5fc62f834":[16,0,1,0,2],
-"struct_membership_credential.html":[16,0,0,4,19],
-"struct_membership_credential.html#a2c5c0d22999d6917fea5ad6618883bcf":[16,0,0,4,19,2],
-"struct_membership_credential.html#a6d38ac3a9c5417833b8adb9b22bc9dc8":[16,0,0,4,19,0],
-"struct_membership_credential.html#afbff64ec55888c7e2a658eabb5e16671":[16,0,0,4,19,1],
-"struct_nr_proof.html":[16,0,0,4,22],
-"struct_nr_proof.html#a0de1aa69acf3d93da34cf4a613b359a1":[16,0,0,4,22,0],
-"struct_nr_proof.html#a717ec36a6c91acd01d9b642bb20fc178":[16,0,0,4,22,1],
-"struct_nr_proof.html#ace535065bbf96502b893ac677dc8dcd3":[16,0,0,4,22,3],
-"struct_nr_proof.html#ae2e9f22089793a4d44a0f7f5cdb78a0c":[16,0,0,4,22,2],
-"struct_oct_str128.html":[16,0,0,4,5],
-"struct_oct_str128.html#a7482aa9b0b580fdd50bd65419d52d4b9":[16,0,0,4,5,0],
-"struct_oct_str16.html":[16,0,0,4,2],
-"struct_oct_str16.html#a86ed6671693a3f60ec4ff7de2c1206c3":[16,0,0,4,2,0],
-"struct_oct_str256.html":[16,0,0,4,6],
-"struct_oct_str256.html#a359781bb84f5717a16094583a00ef14e":[16,0,0,4,6,0],
-"struct_oct_str32.html":[16,0,0,4,3]
+"struct_basic_signature.html":[17,0,0,4,21],
+"struct_basic_signature.html#a0078cc83ecf6c7e31f96b7d44aa60e21":[17,0,0,4,21,2],
+"struct_basic_signature.html#a0e8ea6a2cd3af10e9b59d96d7d06bc69":[17,0,0,4,21,6],
+"struct_basic_signature.html#a4daa94db5068db3f10960f3dd178d603":[17,0,0,4,21,1],
+"struct_basic_signature.html#a69115a4776d15b48411dd6c3a76d0f3d":[17,0,0,4,21,3],
+"struct_basic_signature.html#a730f74d85cfb4fa4089d43c87b97a624":[17,0,0,4,21,7],
+"struct_basic_signature.html#a79d8dec8c5da176e497abf22e4c43adb":[17,0,0,4,21,5],
+"struct_basic_signature.html#a91daebc5b577688afeed2a7ee7913245":[17,0,0,4,21,4],
+"struct_basic_signature.html#ae90cb6af66b010ae39913f033c1e65ac":[17,0,0,4,21,0],
+"struct_big_num_str.html":[17,0,0,4,8],
+"struct_big_num_str.html#a442dcf33889b4f85c5b1228d2c8e6838":[17,0,0,4,8,0],
+"struct_compressed_priv_key.html":[17,0,0,4,18],
+"struct_compressed_priv_key.html#a0b0535f0567eb0e48f799d27991d0f66":[17,0,0,4,18,0],
+"struct_compressed_priv_key.html#a54b9af7699f517bbaef3d52d03e3fed8":[17,0,0,4,18,2],
+"struct_compressed_priv_key.html#ac6689899f1d9a6a8c5e4915563679840":[17,0,0,4,18,1],
+"struct_ecdsa_private_key.html":[17,0,0,4,35],
+"struct_ecdsa_private_key.html#a97efee9b4079f95d94a104f9a6d8c96d":[17,0,0,4,35,0],
+"struct_ecdsa_public_key.html":[17,0,0,4,34],
+"struct_ecdsa_public_key.html#a37c51614faf022eec491b4de8f3a13e1":[17,0,0,4,34,0],
+"struct_ecdsa_public_key.html#a4503c4613386cbc78add1dc245c99284":[17,0,0,4,34,1],
+"struct_ecdsa_signature.html":[17,0,0,4,33],
+"struct_ecdsa_signature.html#a2efd6bf37b12f35135bf325fa491b029":[17,0,0,4,33,1],
+"struct_ecdsa_signature.html#a64b623605a55a267a36df18f29142d0d":[17,0,0,4,33,0],
+"struct_epid11_basic_signature.html":[17,0,0,4,0,8],
+"struct_epid11_basic_signature.html#a1a73fc922f69e2499643dd4c53d0d42d":[17,0,0,4,0,8,5],
+"struct_epid11_basic_signature.html#a267cf4e17d10584736b0c38f3668d822":[17,0,0,4,0,8,12],
+"struct_epid11_basic_signature.html#a2718346665210b7e26521bf4a15cb3bd":[17,0,0,4,0,8,9],
+"struct_epid11_basic_signature.html#a27fd7ae99d1ada652e21e7508a467c0b":[17,0,0,4,0,8,0],
+"struct_epid11_basic_signature.html#a29a700f3bec251600e18b2292081df4b":[17,0,0,4,0,8,6],
+"struct_epid11_basic_signature.html#a5882fcbfd272774e12e50a2d77f0b139":[17,0,0,4,0,8,2],
+"struct_epid11_basic_signature.html#a58b058a9c5119a240177acfade328b3b":[17,0,0,4,0,8,11],
+"struct_epid11_basic_signature.html#a911441845fc9b82d514133371b5ba87c":[17,0,0,4,0,8,10],
+"struct_epid11_basic_signature.html#a9cc6efcd3d7270022779bd16776168ed":[17,0,0,4,0,8,1],
+"struct_epid11_basic_signature.html#ae17b45194997a6fa13c6014a51ec711c":[17,0,0,4,0,8,8],
+"struct_epid11_basic_signature.html#aeb221cf52bc2b1a9bf6e0a9779bfd20f":[17,0,0,4,0,8,4],
+"struct_epid11_basic_signature.html#af18200712d2cf3ed3ccaee328e8a4e0f":[17,0,0,4,0,8,3],
+"struct_epid11_basic_signature.html#afe28bad6328f81e6f7af011cc96ac2e5":[17,0,0,4,0,8,7],
+"struct_epid11_g2_elem_str.html":[17,0,0,4,0,4],
+"struct_epid11_g2_elem_str.html#a9e8984e479bcbe8bd36c65e80c340032":[17,0,0,4,0,4,1],
+"struct_epid11_g2_elem_str.html#af28558484298f4f56377ededf57a4a04":[17,0,0,4,0,4,0],
+"struct_epid11_group_pub_key.html":[17,0,0,4,0,7],
+"struct_epid11_group_pub_key.html#a056c7138246e2bdcd47eaad501b756bb":[17,0,0,4,0,7,3],
+"struct_epid11_group_pub_key.html#a36f688472e2655052d485eac67d8c362":[17,0,0,4,0,7,1],
+"struct_epid11_group_pub_key.html#a964344b3c595bdd585bb9b5d9d0ea762":[17,0,0,4,0,7,0],
+"struct_epid11_group_pub_key.html#aa724e9d2f0cb6019c05547d76a13b72a":[17,0,0,4,0,7,2],
+"struct_epid11_group_rl.html":[17,0,0,4,0,14],
+"struct_epid11_group_rl.html#a35cb954f598d4006b0f047cde77010a5":[17,0,0,4,0,14,1],
+"struct_epid11_group_rl.html#a63afa9863e8dcb63ff884e6e4093c481":[17,0,0,4,0,14,2],
+"struct_epid11_group_rl.html#a97f165c59bc447e3ca3c2148a096710f":[17,0,0,4,0,14,0],
+"struct_epid11_gt_elem_str.html":[17,0,0,4,0,5],
+"struct_epid11_gt_elem_str.html#aed8dd86f1696c2f3537154fc904bf2b0":[17,0,0,4,0,5,0],
+"struct_epid11_nr_proof.html":[17,0,0,4,0,9],
+"struct_epid11_nr_proof.html#a1ad7fe6b32c09f2504ee49731c0ad145":[17,0,0,4,0,9,1],
+"struct_epid11_nr_proof.html#a2e5ee8dc25d296538dce935397a93d68":[17,0,0,4,0,9,0],
+"struct_epid11_nr_proof.html#a5ad9ba3bfac4eac37fd4a4e33ea65ddc":[17,0,0,4,0,9,3],
+"struct_epid11_nr_proof.html#aa8406e938b2f87bded9e374e93a8ee5d":[17,0,0,4,0,9,2],
+"struct_epid11_params.html":[17,0,0,4,0,6],
+"struct_epid11_params.html#a01381f84b2d747b6273e21c71c58a1b0":[17,0,0,4,0,6,0],
+"struct_epid11_params.html#a02bd6fa2ab256e3a07533e947ab0101e":[17,0,0,4,0,6,10],
+"struct_epid11_params.html#a0fe238db4ebc0225899dc2dac97d11c0":[17,0,0,4,0,6,9],
+"struct_epid11_params.html#a1c6bbc4e066449d9c329f88cb653ef7c":[17,0,0,4,0,6,6],
+"struct_epid11_params.html#a27b45ed7771a3024d1d059b4b4ff6eae":[17,0,0,4,0,6,2],
+"struct_epid11_params.html#a2aa4d8a2ebe0dfeb6d930fd7b39f9d1a":[17,0,0,4,0,6,11],
+"struct_epid11_params.html#a49462f35596d07a456a731d0690fdd83":[17,0,0,4,0,6,14],
+"struct_epid11_params.html#a77a8350b97a7afb584a46eb5b32f03bf":[17,0,0,4,0,6,12],
+"struct_epid11_params.html#a7eb9a1371d7187ae81bccfa8d5595033":[17,0,0,4,0,6,7],
+"struct_epid11_params.html#a835e70da717cd5b0c94e242a6418a287":[17,0,0,4,0,6,5],
+"struct_epid11_params.html#aacc39ebe0cc625321039ffb6be0b0e87":[17,0,0,4,0,6,4],
+"struct_epid11_params.html#aad03fd1cc3955bb8879535fa7298123f":[17,0,0,4,0,6,13],
+"struct_epid11_params.html#ade3f88ce73d7de656ec67d9fdb0719d7":[17,0,0,4,0,6,3],
+"struct_epid11_params.html#ae2d1dc635d9d7cba496c3d64fb6f9d5b":[17,0,0,4,0,6,8],
+"struct_epid11_params.html#ae8770bb921aac9214ff8c45c41dbb228":[17,0,0,4,0,6,1],
+"struct_epid11_params.html#af22cfcd6c7ec0e7e7369b79554b963bd":[17,0,0,4,0,6,15],
+"struct_epid11_priv_rl.html":[17,0,0,4,0,11],
+"struct_epid11_priv_rl.html#a2b3899f5a35bf64f860d6d91bccb03c8":[17,0,0,4,0,11,3],
+"struct_epid11_priv_rl.html#aa8945d81e30674b52a6d0900b64feb3c":[17,0,0,4,0,11,1],
+"struct_epid11_priv_rl.html#abbb75fee81aecb2dde7e2daab895ad3b":[17,0,0,4,0,11,0],
+"struct_epid11_priv_rl.html#ad95f880f40e2f40c723f5bdbd22ecfa2":[17,0,0,4,0,11,2],
+"struct_epid11_sig_rl.html":[17,0,0,4,0,13],
+"struct_epid11_sig_rl.html#a6473f8a98f76c9f82183041ea5ae17e3":[17,0,0,4,0,13,0],
+"struct_epid11_sig_rl.html#a8c654d43df132db7874f4c84c177dc12":[17,0,0,4,0,13,2],
+"struct_epid11_sig_rl.html#aa38674729293f4879ff94328dd3c59b1":[17,0,0,4,0,13,3],
+"struct_epid11_sig_rl.html#ad45b0e3e1be59649150dd34c104000ac":[17,0,0,4,0,13,1],
+"struct_epid11_sig_rl_entry.html":[17,0,0,4,0,12],
+"struct_epid11_sig_rl_entry.html#a5de66e1352eafe95774a0d76bac8f01a":[17,0,0,4,0,12,1],
+"struct_epid11_sig_rl_entry.html#abe47cfbd00684941f93a211417bedf0c":[17,0,0,4,0,12,0],
+"struct_epid11_signature.html":[17,0,0,4,0,10],
+"struct_epid11_signature.html#a43cb3ed13c862ff05a9292623ad57c5e":[17,0,0,4,0,10,1],
+"struct_epid11_signature.html#a48526e73f02ad3f1544c4c71c481f153":[17,0,0,4,0,10,3],
+"struct_epid11_signature.html#abf24a8df563ba3f535486d8dad7384f4":[17,0,0,4,0,10,2],
+"struct_epid11_signature.html#ad25c277223a5210063163ea554d08ad4":[17,0,0,4,0,10,0],
+"struct_epid11_verifier_precomp.html":[17,0,2,0,0],
+"struct_epid11_verifier_precomp.html#a03138e937f4488bdbc52ed473dc313da":[17,0,2,0,0,3],
+"struct_epid11_verifier_precomp.html#a0a980adb039089263ec59a995600ee91":[17,0,2,0,0,0],
+"struct_epid11_verifier_precomp.html#a14ebadf105aff085edb9a817a2d1db89":[17,0,2,0,0,2],
+"struct_epid11_verifier_precomp.html#ad0ff2a13c2c87460296900dde72a2f30":[17,0,2,0,0,1],
+"struct_epid2_params.html":[17,0,0,4,14],
+"struct_epid2_params.html#a023603228fed2854ddae2e228938940f":[17,0,0,4,14,6],
+"struct_epid2_params.html#a200a0cba1c9e4ad512bece23f2461a5f":[17,0,0,4,14,7],
+"struct_epid2_params.html#a2f868edb49be49f645101ef5ebbbc551":[17,0,0,4,14,0],
+"struct_epid2_params.html#a4c5195b4fa9393a07a121336202531ad":[17,0,0,4,14,2],
+"struct_epid2_params.html#a609b0aac17fca34fe39bee29676a9618":[17,0,0,4,14,3],
+"struct_epid2_params.html#ac0e0dad45b10927860cd5fa4f8101f08":[17,0,0,4,14,5],
+"struct_epid2_params.html#ac2d7507c6f58c3451beacacb91b52695":[17,0,0,4,14,1],
+"struct_epid2_params.html#ae1d8f5d6036a82064e91bc137b278e74":[17,0,0,4,14,8],
+"struct_epid2_params.html#af23f07fb0e1745c0ad14aceeaa946928":[17,0,0,4,14,4],
+"struct_epid_ca_certificate.html":[17,0,0,2,2],
+"struct_epid_ca_certificate.html#a280e0b0238cf45834c21849ab8a7e124":[17,0,0,2,2,1],
+"struct_epid_ca_certificate.html#a2811c1914ffae913820f13da914c8f01":[17,0,0,2,2,0],
+"struct_epid_ca_certificate.html#a2f8f09ae02919c379c38386668b47418":[17,0,0,2,2,6],
+"struct_epid_ca_certificate.html#a3a44e8050ca2f5085652b2b4e15b779c":[17,0,0,2,2,3],
+"struct_epid_ca_certificate.html#a4f77996f90ed7da1d0503c4236b2c9d1":[17,0,0,2,2,7],
+"struct_epid_ca_certificate.html#a9d2fc21f46cf9fc96e2ea557b70e5356":[17,0,0,2,2,4],
+"struct_epid_ca_certificate.html#ab9d4c318b1fc8d38d3ce53b29f2dfee2":[17,0,0,2,2,5],
+"struct_epid_ca_certificate.html#abd69cce8d5e3940787ee0d17f72184ab":[17,0,0,2,2,8],
+"struct_epid_ca_certificate.html#ac03cf7257c52ad14e3dd3201b930dd50":[17,0,0,2,2,2],
+"struct_epid_file_header.html":[17,0,0,2,1],
+"struct_epid_file_header.html#a35d43c51c1739940381e4898ca87b824":[17,0,0,2,1,0],
+"struct_epid_file_header.html#af5d48c739cc6c00c6e1ce35abf4f1473":[17,0,0,2,1,1],
+"struct_epid_signature.html":[17,0,0,4,23],
+"struct_epid_signature.html#a4155f3f4f1223fc4ae50c94f5305def1":[17,0,0,4,23,1],
+"struct_epid_signature.html#a62a6b0ffcd5f68dd3d2786a58fe43017":[17,0,0,4,23,0],
+"struct_epid_signature.html#a89d2e38223944310b6eeeadf6061a2dd":[17,0,0,4,23,2],
+"struct_epid_signature.html#ab0fe5f98bff737fcfbfe0b4d658e83f2":[17,0,0,4,23,3],
+"struct_fp_elem_str.html":[17,0,0,4,9],
+"struct_fp_elem_str.html#a5ddb96a5567750f2834335851c906c45":[17,0,0,4,9,0],
+"struct_fq12_elem_str.html":[17,0,0,4,32],
+"struct_fq12_elem_str.html#a0520947335aaf52de90af1dec5bdd112":[17,0,0,4,32,0],
+"struct_fq2_elem_str.html":[17,0,0,4,30],
+"struct_fq2_elem_str.html#ab1d253eb24ba30eaf516ac429daab915":[17,0,0,4,30,0],
+"struct_fq3_elem_str.html":[17,0,0,4,0,3],
+"struct_fq3_elem_str.html#af1be0a4d5c9c674d75bec34f95e3c731":[17,0,0,4,0,3,0],
+"struct_fq6_elem_str.html":[17,0,0,4,31],
+"struct_fq6_elem_str.html#a89d656e5c815b4a2382d11ef6932a7d2":[17,0,0,4,31,0],
+"struct_fq_elem_str.html":[17,0,0,4,10],
+"struct_fq_elem_str.html#aac1a876b51a8d2c6d1510e4df2fd3f14":[17,0,0,4,10,0],
+"struct_g1_elem_str.html":[17,0,0,4,11],
+"struct_g1_elem_str.html#a3b0e658d6e5697763ad9c633c11d4ec4":[17,0,0,4,11,0],
+"struct_g1_elem_str.html#a8f2455ca314e885ea180dadf84bf27c3":[17,0,0,4,11,1],
+"struct_g2_elem_str.html":[17,0,0,4,12],
+"struct_g2_elem_str.html#a145ec5b20a6f4f00b080e11c8680afc3":[17,0,0,4,12,0],
+"struct_g2_elem_str.html#a43141b2458aecceed8ee2748270f7908":[17,0,0,4,12,1],
+"struct_group_pub_key.html":[17,0,0,4,15],
+"struct_group_pub_key.html#a2a4320ec99fd1a15df412fbf2a8d49f1":[17,0,0,4,15,2],
+"struct_group_pub_key.html#a86be439104fb60b324784baf24a943f9":[17,0,0,4,15,3],
+"struct_group_pub_key.html#a8c22c758ea186f95e3bf4b2ef8451da5":[17,0,0,4,15,1],
+"struct_group_pub_key.html#ae8e77ab4d5eb3c8e566c24a64cce56ee":[17,0,0,4,15,0]
};
diff --git a/doc/html/navtreeindex2.js b/doc/html/navtreeindex2.js
index e4d77a3..e4b1623 100644
--- a/doc/html/navtreeindex2.js
+++ b/doc/html/navtreeindex2.js
@@ -1,61 +1,93 @@
var NAVTREEINDEX2 =
{
-"struct_oct_str32.html#a5588a7e70f3d73f6ce58b567a9f5c5c8":[16,0,0,4,3,0],
-"struct_oct_str512.html":[16,0,0,4,7],
-"struct_oct_str512.html#abd4d1b97fe49321571da86de1aeac653":[16,0,0,4,7,0],
-"struct_oct_str600.html":[16,0,0,4,0,1],
-"struct_oct_str600.html#a06d53af92a06e1decc6062fd16c43a59":[16,0,0,4,0,1,0],
-"struct_oct_str64.html":[16,0,0,4,4],
-"struct_oct_str64.html#a0e107d78192a5ae0b48ed9e5c4eab0fc":[16,0,0,4,4,0],
-"struct_oct_str768.html":[16,0,0,4,0,2],
-"struct_oct_str768.html#ae45eea89259bd22e60a8d960063921cc":[16,0,0,4,0,2,0],
-"struct_oct_str8.html":[16,0,0,4,1],
-"struct_oct_str8.html#a5e6c56fda48c88b419e621b464b03bef":[16,0,0,4,1,0],
-"struct_oct_str80.html":[16,0,0,4,0,0],
-"struct_oct_str80.html#af80e2b81554109d9a41c5e771aceb8c9":[16,0,0,4,0,0,0],
-"struct_pre_computed_signature.html":[16,0,1,1],
-"struct_pre_computed_signature.html#a2a4eaffe2717bd9c8c360599612adbe6":[16,0,1,1,3],
-"struct_pre_computed_signature.html#a54462643b8a2b4f2741bf8d2e6909d11":[16,0,1,1,6],
-"struct_pre_computed_signature.html#a666710432d9d54ca896647a976892c4f":[16,0,1,1,2],
-"struct_pre_computed_signature.html#a6a1db672c609943fe7af84320dc68ba3":[16,0,1,1,7],
-"struct_pre_computed_signature.html#a72be597624957e3d668c95ff6f445f94":[16,0,1,1,4],
-"struct_pre_computed_signature.html#a73471643dc757115701833ca2e831a72":[16,0,1,1,10],
-"struct_pre_computed_signature.html#a79f06fb57842597372e00dd34c1a804a":[16,0,1,1,5],
-"struct_pre_computed_signature.html#a9cc2eb61572a1aca9e6bc3d5e6f4c1fe":[16,0,1,1,1],
-"struct_pre_computed_signature.html#ac244bd559a96812bcee7671abc299b66":[16,0,1,1,8],
-"struct_pre_computed_signature.html#acd0674d5b5e96244645e9abef7bdbddc":[16,0,1,1,9],
-"struct_pre_computed_signature.html#af23f3f9693857a33fe8564644612ea37":[16,0,1,1,0],
-"struct_priv_key.html":[16,0,0,4,17],
-"struct_priv_key.html#a266c7e369b8b868ef5755e9cd3c0c849":[16,0,0,4,17,0],
-"struct_priv_key.html#aa805f9e124f05bdb733c85cb93614cbd":[16,0,0,4,17,3],
-"struct_priv_key.html#ab416dcb4366427c24b44c2a02e4ae7c8":[16,0,0,4,17,2],
-"struct_priv_key.html#ad7ee0392a583edd2e287cf8c1f9066ba":[16,0,0,4,17,1],
-"struct_priv_rl.html":[16,0,0,4,24],
-"struct_priv_rl.html#a4c6b51cec760f7e81ca8635422ac6a50":[16,0,0,4,24,3],
-"struct_priv_rl.html#a60d73f9ef5fc81f117b3abadf8c18466":[16,0,0,4,24,0],
-"struct_priv_rl.html#a6da9639ec4061689d1c30a58e0befd14":[16,0,0,4,24,2],
-"struct_priv_rl.html#af7317529b8e55476bd06b66ed8131d64":[16,0,0,4,24,1],
-"struct_sha256_digest.html":[16,0,0,0,4,0],
-"struct_sha256_digest.html#a4b6462ddd3f89e4c40220ceb6b1c7f28":[16,0,0,0,4,0,0],
-"struct_sig_rl.html":[16,0,0,4,26],
-"struct_sig_rl.html#a12757d30fcccd310716433948e0b603e":[16,0,0,4,26,1],
-"struct_sig_rl.html#a9dfb6b508db9051f4dc480a51d702af2":[16,0,0,4,26,2],
-"struct_sig_rl.html#ac23a919993d99d24a5150302f1778102":[16,0,0,4,26,0],
-"struct_sig_rl.html#ac9d4c343c539dba799e1f42eb38b351f":[16,0,0,4,26,3],
-"struct_sig_rl_entry.html":[16,0,0,4,25],
-"struct_sig_rl_entry.html#a0dfeb058614e81878bfbf86ae3edac3c":[16,0,0,4,25,1],
-"struct_sig_rl_entry.html#ac6a47ff0d1b8ea1512e0ff14983ac5ce":[16,0,0,4,25,0],
-"struct_verifier_precomp.html":[16,0,2,1],
-"struct_verifier_precomp.html#a8caf79578e3c0baf91921460391103ca":[16,0,2,1,2],
-"struct_verifier_precomp.html#ab061d6cc07d1467eeb5bf25f3ea7e306":[16,0,2,1,3],
-"struct_verifier_precomp.html#ad1106376f12772942af0331eb74de6e5":[16,0,2,1,0],
-"struct_verifier_precomp.html#af8fd90f3a5a2be932a97dcd86099d5b2":[16,0,2,1,1],
-"struct_verifier_precomp.html#afc3e29a325c95c62bb192d5f8cdd5c1c":[16,0,2,1,4],
-"struct_verifier_rl.html":[16,0,0,4,28],
-"struct_verifier_rl.html#a1e3f84b873bccc0c882aa6432c42d2f7":[16,0,0,4,28,3],
-"struct_verifier_rl.html#a5d9a9265fffa96fd5f9260543eb08c68":[16,0,0,4,28,0],
-"struct_verifier_rl.html#ab85c4666d16145ff16443e84468d2d7d":[16,0,0,4,28,1],
-"struct_verifier_rl.html#ac7d3dceab4772096bbbeb3fa735d18a9":[16,0,0,4,28,2],
-"struct_verifier_rl.html#afa44ab69ffff5a3508366aeb2131fdaa":[16,0,0,4,28,4],
+"struct_group_rl.html":[17,0,0,4,27],
+"struct_group_rl.html#a51022e172ab8b945efc69f1e63170107":[17,0,0,4,27,0],
+"struct_group_rl.html#a69c41d99cdfc5b6ece7442f466f7ec3f":[17,0,0,4,27,2],
+"struct_group_rl.html#a9067f01c63cdefbc8e23c3cf67a10172":[17,0,0,4,27,1],
+"struct_gt_elem_str.html":[17,0,0,4,13],
+"struct_gt_elem_str.html#aeaeb0e9e1c6efd378a475eb9a6c42132":[17,0,0,4,13,0],
+"struct_i_priv_key.html":[17,0,0,4,16],
+"struct_i_priv_key.html#a6d484175317aef09fb959c3ca55fc70a":[17,0,0,4,16,0],
+"struct_i_priv_key.html#ad400a4237b6d50855538fd40580eb1bb":[17,0,0,4,16,1],
+"struct_join_request.html":[17,0,0,4,20],
+"struct_join_request.html#a005651506fd4511e8a3537f6c3634532":[17,0,0,4,20,1],
+"struct_join_request.html#a55e30a274e83b808db6fbab5ae6c6cb8":[17,0,0,4,20,0],
+"struct_join_request.html#a73bf8989df5f90eb3d06e7a42ad74d1d":[17,0,0,4,20,2],
+"struct_member_precomp.html":[17,0,0,4,29],
+"struct_member_precomp.html#a4e7412969bed3964f813b093b948e7b4":[17,0,0,4,29,1],
+"struct_member_precomp.html#a55e5c4b25c8f0f426969a8d745260fe5":[17,0,0,4,29,0],
+"struct_member_precomp.html#a573551f6494e372f44fd3bdf5b02aeda":[17,0,0,4,29,3],
+"struct_member_precomp.html#a879d5a7b0c30088b23f6e5c5fc62f834":[17,0,0,4,29,2],
+"struct_membership_credential.html":[17,0,0,4,19],
+"struct_membership_credential.html#a2c5c0d22999d6917fea5ad6618883bcf":[17,0,0,4,19,2],
+"struct_membership_credential.html#a6d38ac3a9c5417833b8adb9b22bc9dc8":[17,0,0,4,19,0],
+"struct_membership_credential.html#afbff64ec55888c7e2a658eabb5e16671":[17,0,0,4,19,1],
+"struct_nr_proof.html":[17,0,0,4,22],
+"struct_nr_proof.html#a0de1aa69acf3d93da34cf4a613b359a1":[17,0,0,4,22,0],
+"struct_nr_proof.html#a717ec36a6c91acd01d9b642bb20fc178":[17,0,0,4,22,1],
+"struct_nr_proof.html#ace535065bbf96502b893ac677dc8dcd3":[17,0,0,4,22,3],
+"struct_nr_proof.html#ae2e9f22089793a4d44a0f7f5cdb78a0c":[17,0,0,4,22,2],
+"struct_nr_prove_commit_output.html":[17,0,1,0,0],
+"struct_nr_prove_commit_output.html#a00234dfa2443d49f5a294c58fdacb064":[17,0,1,0,0,2],
+"struct_nr_prove_commit_output.html#aab0f11e55d3b8d838e472242e27a1a43":[17,0,1,0,0,1],
+"struct_nr_prove_commit_output.html#af9c605d560f83ccd69e35d8b9cfe51b3":[17,0,1,0,0,0],
+"struct_oct_str128.html":[17,0,0,4,5],
+"struct_oct_str128.html#a7482aa9b0b580fdd50bd65419d52d4b9":[17,0,0,4,5,0],
+"struct_oct_str16.html":[17,0,0,4,2],
+"struct_oct_str16.html#a86ed6671693a3f60ec4ff7de2c1206c3":[17,0,0,4,2,0],
+"struct_oct_str256.html":[17,0,0,4,6],
+"struct_oct_str256.html#a359781bb84f5717a16094583a00ef14e":[17,0,0,4,6,0],
+"struct_oct_str32.html":[17,0,0,4,3],
+"struct_oct_str32.html#a5588a7e70f3d73f6ce58b567a9f5c5c8":[17,0,0,4,3,0],
+"struct_oct_str512.html":[17,0,0,4,7],
+"struct_oct_str512.html#abd4d1b97fe49321571da86de1aeac653":[17,0,0,4,7,0],
+"struct_oct_str600.html":[17,0,0,4,0,1],
+"struct_oct_str600.html#a06d53af92a06e1decc6062fd16c43a59":[17,0,0,4,0,1,0],
+"struct_oct_str64.html":[17,0,0,4,4],
+"struct_oct_str64.html#a0e107d78192a5ae0b48ed9e5c4eab0fc":[17,0,0,4,4,0],
+"struct_oct_str768.html":[17,0,0,4,0,2],
+"struct_oct_str768.html#ae45eea89259bd22e60a8d960063921cc":[17,0,0,4,0,2,0],
+"struct_oct_str8.html":[17,0,0,4,1],
+"struct_oct_str8.html#a5e6c56fda48c88b419e621b464b03bef":[17,0,0,4,1,0],
+"struct_oct_str80.html":[17,0,0,4,0,0],
+"struct_oct_str80.html#af80e2b81554109d9a41c5e771aceb8c9":[17,0,0,4,0,0,0],
+"struct_priv_key.html":[17,0,0,4,17],
+"struct_priv_key.html#a266c7e369b8b868ef5755e9cd3c0c849":[17,0,0,4,17,0],
+"struct_priv_key.html#aa805f9e124f05bdb733c85cb93614cbd":[17,0,0,4,17,3],
+"struct_priv_key.html#ab416dcb4366427c24b44c2a02e4ae7c8":[17,0,0,4,17,2],
+"struct_priv_key.html#ad7ee0392a583edd2e287cf8c1f9066ba":[17,0,0,4,17,1],
+"struct_priv_rl.html":[17,0,0,4,24],
+"struct_priv_rl.html#a4c6b51cec760f7e81ca8635422ac6a50":[17,0,0,4,24,3],
+"struct_priv_rl.html#a60d73f9ef5fc81f117b3abadf8c18466":[17,0,0,4,24,0],
+"struct_priv_rl.html#a6da9639ec4061689d1c30a58e0befd14":[17,0,0,4,24,2],
+"struct_priv_rl.html#af7317529b8e55476bd06b66ed8131d64":[17,0,0,4,24,1],
+"struct_sha256_digest.html":[17,0,0,0,4,0],
+"struct_sha256_digest.html#a4b6462ddd3f89e4c40220ceb6b1c7f28":[17,0,0,0,4,0,0],
+"struct_sig_rl.html":[17,0,0,4,26],
+"struct_sig_rl.html#a12757d30fcccd310716433948e0b603e":[17,0,0,4,26,1],
+"struct_sig_rl.html#a9dfb6b508db9051f4dc480a51d702af2":[17,0,0,4,26,2],
+"struct_sig_rl.html#ac23a919993d99d24a5150302f1778102":[17,0,0,4,26,0],
+"struct_sig_rl.html#ac9d4c343c539dba799e1f42eb38b351f":[17,0,0,4,26,3],
+"struct_sig_rl_entry.html":[17,0,0,4,25],
+"struct_sig_rl_entry.html#a0dfeb058614e81878bfbf86ae3edac3c":[17,0,0,4,25,1],
+"struct_sig_rl_entry.html#ac6a47ff0d1b8ea1512e0ff14983ac5ce":[17,0,0,4,25,0],
+"struct_sign_commit_output.html":[17,0,1,0,1],
+"struct_sign_commit_output.html#a0f35f1d619ea972acbdf9d45af630de0":[17,0,1,0,1,3],
+"struct_sign_commit_output.html#a496bdc4d14fb73b1e85dfff3bc9fd3ba":[17,0,1,0,1,1],
+"struct_sign_commit_output.html#a9ce3b28916094f5fa108d5f5c86631b0":[17,0,1,0,1,4],
+"struct_sign_commit_output.html#ad01513f153f51f7ce211cf323a224499":[17,0,1,0,1,2],
+"struct_sign_commit_output.html#ae2ebcc07395e60187d9ccca373665dba":[17,0,1,0,1,0],
+"struct_verifier_precomp.html":[17,0,2,1],
+"struct_verifier_precomp.html#a8caf79578e3c0baf91921460391103ca":[17,0,2,1,2],
+"struct_verifier_precomp.html#ab061d6cc07d1467eeb5bf25f3ea7e306":[17,0,2,1,3],
+"struct_verifier_precomp.html#ad1106376f12772942af0331eb74de6e5":[17,0,2,1,0],
+"struct_verifier_precomp.html#af8fd90f3a5a2be932a97dcd86099d5b2":[17,0,2,1,1],
+"struct_verifier_precomp.html#afc3e29a325c95c62bb192d5f8cdd5c1c":[17,0,2,1,4],
+"struct_verifier_rl.html":[17,0,0,4,28],
+"struct_verifier_rl.html#a1e3f84b873bccc0c882aa6432c42d2f7":[17,0,0,4,28,3],
+"struct_verifier_rl.html#a5d9a9265fffa96fd5f9260543eb08c68":[17,0,0,4,28,0],
+"struct_verifier_rl.html#ab85c4666d16145ff16443e84468d2d7d":[17,0,0,4,28,1],
+"struct_verifier_rl.html#ac7d3dceab4772096bbbeb3fa735d18a9":[17,0,0,4,28,2],
+"struct_verifier_rl.html#afa44ab69ffff5a3508366aeb2131fdaa":[17,0,0,4,28,4],
"user":[0]
};
diff --git a/doc/html/nrprove_8h.html b/doc/html/nrprove_8h.html
new file mode 100644
index 0000000..77d1f02
--- /dev/null
+++ b/doc/html/nrprove_8h.html
@@ -0,0 +1,103 @@
+<!-- HTML header for doxygen 1.8.10-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.11"/>
+<title>Intel&reg; Enhanced Privacy ID SDK: epid/member/tpm/nrprove.h File Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="navtree.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="resize.js"></script>
+<script type="text/javascript" src="navtreedata.js"></script>
+<script type="text/javascript" src="navtree.js"></script>
+<script type="text/javascript">
+ $(document).ready(initResizable);
+ $(window).load(resizeHeight);
+</script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+<link href="epidstyle.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td id="projectalign" style="padding-left: 0.5em;">
+ <div id="projectname"><a
+ onclick="storeLink('index.html')"
+ id="projectlink"
+ class="index.html"
+ href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
+&#160;<span id="projectnumber">4.0.0</span>
+</div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.11 -->
+</div><!-- top -->
+<div id="side-nav" class="ui-resizable side-nav-resizable">
+ <div id="nav-tree">
+ <div id="nav-tree-contents">
+ <div id="nav-sync" class="sync"></div>
+ </div>
+ </div>
+ <div id="splitbar" style="-moz-user-select:none;"
+ class="ui-resizable-handle">
+ </div>
+</div>
+<script type="text/javascript">
+$(document).ready(function(){initNavTree('nrprove_8h.html','');});
+</script>
+<div id="doc-content">
+<div class="header">
+ <div class="summary">
+<a href="#nested-classes">Data Structures</a> &#124;
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">nrprove.h File Reference</div> </div>
+</div><!--header-->
+<div class="contents">
+
+<p>TPM NrProve APIs.
+<a href="#details">More...</a></p>
+<div class="textblock"><code>#include &quot;<a class="el" href="errors_8h.html">epid/common/errors.h</a>&quot;</code><br />
+<code>#include &quot;<a class="el" href="types_8h.html">epid/common/types.h</a>&quot;</code><br />
+</div><table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
+Data Structures</h2></td></tr>
+<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_nr_prove_commit_output.html">NrProveCommitOutput</a></td></tr>
+<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Result of NrProve Commit. <a href="struct_nr_prove_commit_output.html#details">More...</a><br /></td></tr>
+<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
+</table><table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr class="memitem:gace6002b520db41d8e781b02c6f538dc0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#gace6002b520db41d8e781b02c6f538dc0">TpmNrProveCommit</a> (TpmCtx *ctx, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *B_str, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *K_str, <a class="el" href="struct_sig_rl_entry.html">SigRlEntry</a> const *sigrl_entry, <a class="el" href="struct_nr_prove_commit_output.html">NrProveCommitOutput</a> *commit_out)</td></tr>
+<tr class="memdesc:gace6002b520db41d8e781b02c6f538dc0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs the first part of the NrProve operation. <a href="group___tpm_module.html#gace6002b520db41d8e781b02c6f538dc0">More...</a><br /></td></tr>
+<tr class="separator:gace6002b520db41d8e781b02c6f538dc0"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga4346d22fb9fed6a161cb1ea178b50ed2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#ga4346d22fb9fed6a161cb1ea178b50ed2">TpmNrProve</a> (TpmCtx *ctx, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *c_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *smu_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *snu_str)</td></tr>
+<tr class="memdesc:ga4346d22fb9fed6a161cb1ea178b50ed2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs the last part of the NrProve operation. <a href="group___tpm_module.html#ga4346d22fb9fed6a161cb1ea178b50ed2">More...</a><br /></td></tr>
+<tr class="separator:ga4346d22fb9fed6a161cb1ea178b50ed2"><td class="memSeparator" colspan="2">&#160;</td></tr>
+</table>
+<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
+<div class="textblock"><p>TPM NrProve APIs. </p>
+</div></div><!-- contents -->
+</div><!-- doc-content -->
+<!-- HTML footer for doxygen 1.8.10-->
+<!-- start footer part -->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ <li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_512d3e62841a8535b716ec4cf8b9e950.html">member</a></li><li class="navelem"><a class="el" href="dir_6048dbb18cb271412de4a010207fd345.html">tpm</a></li><li class="navelem"><a class="el" href="nrprove_8h.html">nrprove.h</a></li>
+ <li class="footer">
+ &copy; 2016-2017 Intel Corporation
+ </li>
+ </ul>
+</div>
+</body>
+</html>
diff --git a/doc/html/organization_8dox.html b/doc/html/organization_8dox.html
index 69164cd..55ae4f6 100644
--- a/doc/html/organization_8dox.html
+++ b/doc/html/organization_8dox.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('organization_8dox.html','');});
<ul>
<li class="navelem"><a class="el" href="organization_8dox.html">organization.dox</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/pageorder_8dox.html b/doc/html/pageorder_8dox.html
index 94858a8..7556028 100644
--- a/doc/html/pageorder_8dox.html
+++ b/doc/html/pageorder_8dox.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -76,7 +76,7 @@ $(document).ready(function(){initNavTree('pageorder_8dox.html','');});
<ul>
<li class="navelem"><a class="el" href="pageorder_8dox.html">pageorder.dox</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/pages.html b/doc/html/pages.html
index 7c341f6..41b7cf4 100644
--- a/doc/html/pages.html
+++ b/doc/html/pages.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -76,9 +76,10 @@ $(document).ready(function(){initNavTree('pages.html','');});
<tr id="row_10_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><a class="el" href="ImplementationNotes.html" target="_self">Implementation Notes</a></td><td class="desc"></td></tr>
<tr id="row_11_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><a class="el" href="Glossary.html" target="_self">Glossary</a></td><td class="desc"></td></tr>
<tr id="row_12_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><a class="el" href="BuildToolsInstallation.html" target="_self">Guide to Installing Build Tools</a></td><td class="desc"></td></tr>
-<tr id="row_13_"><td class="entry"><span style="width:0px;display:inline-block;">&#160;</span><span id="arr_13_" class="arrow" onclick="toggleFolder('13_')">&#9660;</span><a class="el" href="Examples.html" target="_self">Walkthroughs of Examples Showing API Usage</a></td><td class="desc"></td></tr>
-<tr id="row_13_0_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a class="el" href="SignmsgWalkthru.html" target="_self">Generating an Intel&reg; EPID Signature</a></td><td class="desc"></td></tr>
-<tr id="row_13_1_"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a class="el" href="VerifysigWalkthru.html" target="_self">Verifying an Intel&reg; EPID Signature</a></td><td class="desc"></td></tr>
+<tr id="row_13_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><a class="el" href="HowValidated.html" target="_self">Tested Libraries and Compilers</a></td><td class="desc"></td></tr>
+<tr id="row_14_" class="even"><td class="entry"><span style="width:0px;display:inline-block;">&#160;</span><span id="arr_14_" class="arrow" onclick="toggleFolder('14_')">&#9660;</span><a class="el" href="Examples.html" target="_self">Walkthroughs of Examples Showing API Usage</a></td><td class="desc"></td></tr>
+<tr id="row_14_0_"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a class="el" href="UserManual_GeneratingAnIntelEpidSignature.html" target="_self">Generating an Intel&reg; EPID Signature</a></td><td class="desc"></td></tr>
+<tr id="row_14_1_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a class="el" href="UserManual_VerifyingAnIntelEpidSignature.html" target="_self">Verifying an Intel&reg; EPID Signature</a></td><td class="desc"></td></tr>
</table>
</div><!-- directory -->
</div><!-- contents -->
@@ -88,7 +89,7 @@ $(document).ready(function(){initNavTree('pages.html','');});
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/pairing_8h.html b/doc/html/pairing_8h.html
index 41d1aa0..203d1f6 100644
--- a/doc/html/pairing_8h.html
+++ b/doc/html/pairing_8h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -87,9 +87,9 @@ Functions</h2></td></tr>
<tr class="memitem:gad54aebdc331d39b73000fdca9e04f94d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___pairing_primitives.html#gad54aebdc331d39b73000fdca9e04f94d">DeletePairingState</a> (<a class="el" href="group___pairing_primitives.html#ga3f1fa61d25487f96dfb0ffef4ad35607">PairingState</a> **ps)</td></tr>
<tr class="memdesc:gad54aebdc331d39b73000fdca9e04f94d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Frees a previously allocated by PairingState. <a href="group___pairing_primitives.html#gad54aebdc331d39b73000fdca9e04f94d">More...</a><br /></td></tr>
<tr class="separator:gad54aebdc331d39b73000fdca9e04f94d"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ga5dd07d13536e27c37eaeee285297066c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___pairing_primitives.html#ga5dd07d13536e27c37eaeee285297066c">Pairing</a> (<a class="el" href="group___pairing_primitives.html#ga3f1fa61d25487f96dfb0ffef4ad35607">PairingState</a> *ps, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *d, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *a, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *b)</td></tr>
-<tr class="memdesc:ga5dd07d13536e27c37eaeee285297066c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes an Optimal Ate Pairing for two parameters. <a href="group___pairing_primitives.html#ga5dd07d13536e27c37eaeee285297066c">More...</a><br /></td></tr>
-<tr class="separator:ga5dd07d13536e27c37eaeee285297066c"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ga58a9d3cb6129274a04c72a35a52f768d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___pairing_primitives.html#ga58a9d3cb6129274a04c72a35a52f768d">Pairing</a> (<a class="el" href="group___pairing_primitives.html#ga3f1fa61d25487f96dfb0ffef4ad35607">PairingState</a> *ps, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *a, <a class="el" href="group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa">EcPoint</a> const *b, <a class="el" href="group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa">FfElement</a> *d)</td></tr>
+<tr class="memdesc:ga58a9d3cb6129274a04c72a35a52f768d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes an Optimal Ate Pairing for two parameters. <a href="group___pairing_primitives.html#ga58a9d3cb6129274a04c72a35a52f768d">More...</a><br /></td></tr>
+<tr class="separator:ga58a9d3cb6129274a04c72a35a52f768d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Pairing interface. </p>
@@ -101,7 +101,7 @@ Functions</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li><li class="navelem"><a class="el" href="dir_f169ebf8da29290a918fa4b3f7151050.html">math</a></li><li class="navelem"><a class="el" href="pairing_8h.html">pairing.h</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/presig_8h.html b/doc/html/presig_8h.html
new file mode 100644
index 0000000..3ee4f22
--- /dev/null
+++ b/doc/html/presig_8h.html
@@ -0,0 +1,96 @@
+<!-- HTML header for doxygen 1.8.10-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.11"/>
+<title>Intel&reg; Enhanced Privacy ID SDK: epid/member/tpm/presig.h File Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="navtree.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="resize.js"></script>
+<script type="text/javascript" src="navtreedata.js"></script>
+<script type="text/javascript" src="navtree.js"></script>
+<script type="text/javascript">
+ $(document).ready(initResizable);
+ $(window).load(resizeHeight);
+</script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+<link href="epidstyle.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td id="projectalign" style="padding-left: 0.5em;">
+ <div id="projectname"><a
+ onclick="storeLink('index.html')"
+ id="projectlink"
+ class="index.html"
+ href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
+&#160;<span id="projectnumber">4.0.0</span>
+</div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.11 -->
+</div><!-- top -->
+<div id="side-nav" class="ui-resizable side-nav-resizable">
+ <div id="nav-tree">
+ <div id="nav-tree-contents">
+ <div id="nav-sync" class="sync"></div>
+ </div>
+ </div>
+ <div id="splitbar" style="-moz-user-select:none;"
+ class="ui-resizable-handle">
+ </div>
+</div>
+<script type="text/javascript">
+$(document).ready(function(){initNavTree('presig_8h.html','');});
+</script>
+<div id="doc-content">
+<div class="header">
+ <div class="summary">
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">presig.h File Reference</div> </div>
+</div><!--header-->
+<div class="contents">
+
+<p>Sensitive pre-computed signature APIs.
+<a href="#details">More...</a></p>
+<div class="textblock"><code>#include &lt;stddef.h&gt;</code><br />
+<code>#include &quot;<a class="el" href="errors_8h.html">epid/common/errors.h</a>&quot;</code><br />
+</div><table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr class="memitem:ga2335ec4eb78b542cf87df9b0cd15358c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#ga2335ec4eb78b542cf87df9b0cd15358c">TpmAddPreSigs</a> (TpmCtx *ctx, size_t number_presigs)</td></tr>
+<tr class="memdesc:ga2335ec4eb78b542cf87df9b0cd15358c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Extends the TPM's pool of pre-computed signatures. <a href="group___tpm_module.html#ga2335ec4eb78b542cf87df9b0cd15358c">More...</a><br /></td></tr>
+<tr class="separator:ga2335ec4eb78b542cf87df9b0cd15358c"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gaa53a6bd52e22808bac21596a964bdece"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#gaa53a6bd52e22808bac21596a964bdece">TpmGetNumPreSigs</a> (TpmCtx const *ctx)</td></tr>
+<tr class="memdesc:gaa53a6bd52e22808bac21596a964bdece"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the number of pre-computed signatures in the TPM's pool. <a href="group___tpm_module.html#gaa53a6bd52e22808bac21596a964bdece">More...</a><br /></td></tr>
+<tr class="separator:gaa53a6bd52e22808bac21596a964bdece"><td class="memSeparator" colspan="2">&#160;</td></tr>
+</table>
+<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
+<div class="textblock"><p>Sensitive pre-computed signature APIs. </p>
+</div></div><!-- contents -->
+</div><!-- doc-content -->
+<!-- HTML footer for doxygen 1.8.10-->
+<!-- start footer part -->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ <li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_512d3e62841a8535b716ec4cf8b9e950.html">member</a></li><li class="navelem"><a class="el" href="dir_6048dbb18cb271412de4a010207fd345.html">tpm</a></li><li class="navelem"><a class="el" href="presig_8h.html">presig.h</a></li>
+ <li class="footer">
+ &copy; 2016-2017 Intel Corporation
+ </li>
+ </ul>
+</div>
+</body>
+</html>
diff --git a/doc/html/printutils_8h.html b/doc/html/printutils_8h.html
index 565f2c7..f47adbf 100644
--- a/doc/html/printutils_8h.html
+++ b/doc/html/printutils_8h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -130,7 +130,7 @@ Functions</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li><li class="navelem"><a class="el" href="dir_f169ebf8da29290a918fa4b3f7151050.html">math</a></li><li class="navelem"><a class="el" href="printutils_8h.html">printutils.h</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/revocation_8dox.html b/doc/html/revocation_8dox.html
index d33edd4..e5868ad 100644
--- a/doc/html/revocation_8dox.html
+++ b/doc/html/revocation_8dox.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('revocation_8dox.html','');});
<ul>
<li class="navelem"><a class="el" href="revocation_8dox.html">revocation.dox</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/sdk__overview_8dox.html b/doc/html/sdk__overview_8dox.html
index ff2e0d5..ad9d09e 100644
--- a/doc/html/sdk__overview_8dox.html
+++ b/doc/html/sdk__overview_8dox.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('sdk__overview_8dox.html','');});
<ul>
<li class="navelem"><a class="el" href="sdk__overview_8dox.html">sdk_overview.dox</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/sdk_block_diagram.png b/doc/html/sdk_block_diagram.png
index be144ec..e228685 100644
--- a/doc/html/sdk_block_diagram.png
+++ b/doc/html/sdk_block_diagram.png
Binary files differ
diff --git a/doc/html/sign_8h.html b/doc/html/sign_8h.html
new file mode 100644
index 0000000..1fbe55b
--- /dev/null
+++ b/doc/html/sign_8h.html
@@ -0,0 +1,103 @@
+<!-- HTML header for doxygen 1.8.10-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.11"/>
+<title>Intel&reg; Enhanced Privacy ID SDK: epid/member/tpm/sign.h File Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="navtree.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="resize.js"></script>
+<script type="text/javascript" src="navtreedata.js"></script>
+<script type="text/javascript" src="navtree.js"></script>
+<script type="text/javascript">
+ $(document).ready(initResizable);
+ $(window).load(resizeHeight);
+</script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+<link href="epidstyle.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td id="projectalign" style="padding-left: 0.5em;">
+ <div id="projectname"><a
+ onclick="storeLink('index.html')"
+ id="projectlink"
+ class="index.html"
+ href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
+&#160;<span id="projectnumber">4.0.0</span>
+</div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.11 -->
+</div><!-- top -->
+<div id="side-nav" class="ui-resizable side-nav-resizable">
+ <div id="nav-tree">
+ <div id="nav-tree-contents">
+ <div id="nav-sync" class="sync"></div>
+ </div>
+ </div>
+ <div id="splitbar" style="-moz-user-select:none;"
+ class="ui-resizable-handle">
+ </div>
+</div>
+<script type="text/javascript">
+$(document).ready(function(){initNavTree('sign_8h.html','');});
+</script>
+<div id="doc-content">
+<div class="header">
+ <div class="summary">
+<a href="#nested-classes">Data Structures</a> &#124;
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">sign.h File Reference</div> </div>
+</div><!--header-->
+<div class="contents">
+
+<p>TPM signing APIs.
+<a href="#details">More...</a></p>
+<div class="textblock"><code>#include &quot;<a class="el" href="errors_8h.html">epid/common/errors.h</a>&quot;</code><br />
+<code>#include &quot;<a class="el" href="types_8h.html">epid/common/types.h</a>&quot;</code><br />
+</div><table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
+Data Structures</h2></td></tr>
+<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_sign_commit_output.html">SignCommitOutput</a></td></tr>
+<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Result of Sign Commit. <a href="struct_sign_commit_output.html#details">More...</a><br /></td></tr>
+<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
+</table><table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr class="memitem:gaf9004ce8832c1acae497604d1deb49cd"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#gaf9004ce8832c1acae497604d1deb49cd">TpmSignCommit</a> (TpmCtx *ctx, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *B_in_str, <a class="el" href="struct_sign_commit_output.html">SignCommitOutput</a> *commit_out)</td></tr>
+<tr class="memdesc:gaf9004ce8832c1acae497604d1deb49cd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs the first part of the sign operation. <a href="group___tpm_module.html#gaf9004ce8832c1acae497604d1deb49cd">More...</a><br /></td></tr>
+<tr class="separator:gaf9004ce8832c1acae497604d1deb49cd"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gaa667fb3295e4533334bb32afcd43890f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360">EpidStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#gaa667fb3295e4533334bb32afcd43890f">TpmSign</a> (TpmCtx *ctx, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *c_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *sx_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *sf_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *sa_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> *sb_str)</td></tr>
+<tr class="memdesc:gaa667fb3295e4533334bb32afcd43890f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs the last part of the sign operation. <a href="group___tpm_module.html#gaa667fb3295e4533334bb32afcd43890f">More...</a><br /></td></tr>
+<tr class="separator:gaa667fb3295e4533334bb32afcd43890f"><td class="memSeparator" colspan="2">&#160;</td></tr>
+</table>
+<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
+<div class="textblock"><p>TPM signing APIs. </p>
+</div></div><!-- contents -->
+</div><!-- doc-content -->
+<!-- HTML footer for doxygen 1.8.10-->
+<!-- start footer part -->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ <li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_512d3e62841a8535b716ec4cf8b9e950.html">member</a></li><li class="navelem"><a class="el" href="dir_6048dbb18cb271412de4a010207fd345.html">tpm</a></li><li class="navelem"><a class="el" href="sign_8h.html">sign.h</a></li>
+ <li class="footer">
+ &copy; 2016-2017 Intel Corporation
+ </li>
+ </ul>
+</div>
+</body>
+</html>
diff --git a/doc/html/sign__verify__tutorial_8dox.html b/doc/html/sign__verify__tutorial_8dox.html
index 25d675c..f072c9f 100644
--- a/doc/html/sign__verify__tutorial_8dox.html
+++ b/doc/html/sign__verify__tutorial_8dox.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('sign__verify__tutorial_8dox.html','');
<ul>
<li class="navelem"><a class="el" href="sign__verify__tutorial_8dox.html">sign_verify_tutorial.dox</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/signmsg__walkthrough_8dox.html b/doc/html/signmsg__walkthrough_8dox.html
index 9f7ba33..d22e623 100644
--- a/doc/html/signmsg__walkthrough_8dox.html
+++ b/doc/html/signmsg__walkthrough_8dox.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('signmsg__walkthrough_8dox.html','');})
<ul>
<li class="navelem"><a class="el" href="signmsg__walkthrough_8dox.html">signmsg_walkthrough.dox</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/stdtypes_8h.html b/doc/html/stdtypes_8h.html
index ce9162c..d86aadf 100644
--- a/doc/html/stdtypes_8h.html
+++ b/doc/html/stdtypes_8h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -101,7 +101,7 @@ typedef char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" hr
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li><li class="navelem"><a class="el" href="stdtypes_8h.html">stdtypes.h</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_basic_signature.html b/doc/html/struct_basic_signature.html
index 786998e..81952cd 100644
--- a/doc/html/struct_basic_signature.html
+++ b/doc/html/struct_basic_signature.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -118,7 +118,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_basic_signature.html">BasicSignature</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_big_num_str.html b/doc/html/struct_big_num_str.html
index 2c8239f..6a4376c 100644
--- a/doc/html/struct_big_num_str.html
+++ b/doc/html/struct_big_num_str.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_big_num_str.html">BigNumStr</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_compressed_priv_key.html b/doc/html/struct_compressed_priv_key.html
index 1823c32..20ec67a 100644
--- a/doc/html/struct_compressed_priv_key.html
+++ b/doc/html/struct_compressed_priv_key.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -98,7 +98,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_compressed_priv_key.html">CompressedPrivKey</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_ecdsa_private_key.html b/doc/html/struct_ecdsa_private_key.html
index e3da810..3e30da7 100644
--- a/doc/html/struct_ecdsa_private_key.html
+++ b/doc/html/struct_ecdsa_private_key.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_ecdsa_private_key.html">EcdsaPrivateKey</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_ecdsa_public_key.html b/doc/html/struct_ecdsa_public_key.html
index 3b48d55..bcfc2ad 100644
--- a/doc/html/struct_ecdsa_public_key.html
+++ b/doc/html/struct_ecdsa_public_key.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -93,7 +93,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_ecdsa_public_key.html">EcdsaPublicKey</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_ecdsa_signature.html b/doc/html/struct_ecdsa_signature.html
index f04b9fb..8a24625 100644
--- a/doc/html/struct_ecdsa_signature.html
+++ b/doc/html/struct_ecdsa_signature.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -93,7 +93,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_ecdsa_signature.html">EcdsaSignature</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_epid11_basic_signature.html b/doc/html/struct_epid11_basic_signature.html
index c41bc64..5b4d4a1 100644
--- a/doc/html/struct_epid11_basic_signature.html
+++ b/doc/html/struct_epid11_basic_signature.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -138,7 +138,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_epid11_basic_signature.html">Epid11BasicSignature</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_epid11_g2_elem_str.html b/doc/html/struct_epid11_g2_elem_str.html
index 940bdaf..084c81a 100644
--- a/doc/html/struct_epid11_g2_elem_str.html
+++ b/doc/html/struct_epid11_g2_elem_str.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -93,7 +93,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_epid11_g2_elem_str.html">Epid11G2ElemStr</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_epid11_group_pub_key.html b/doc/html/struct_epid11_group_pub_key.html
index b50e2ed..193d90f 100644
--- a/doc/html/struct_epid11_group_pub_key.html
+++ b/doc/html/struct_epid11_group_pub_key.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -102,7 +102,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_epid11_group_pub_key.html">Epid11GroupPubKey</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_epid11_group_rl.html b/doc/html/struct_epid11_group_rl.html
index 95001a9..0071f0f 100644
--- a/doc/html/struct_epid11_group_rl.html
+++ b/doc/html/struct_epid11_group_rl.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -98,7 +98,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_epid11_group_rl.html">Epid11GroupRl</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_epid11_gt_elem_str.html b/doc/html/struct_epid11_gt_elem_str.html
index a6117ec..b55b2ef 100644
--- a/doc/html/struct_epid11_gt_elem_str.html
+++ b/doc/html/struct_epid11_gt_elem_str.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_epid11_gt_elem_str.html">Epid11GtElemStr</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_epid11_nr_proof.html b/doc/html/struct_epid11_nr_proof.html
index 71f918d..59b9cf8 100644
--- a/doc/html/struct_epid11_nr_proof.html
+++ b/doc/html/struct_epid11_nr_proof.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -102,7 +102,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_epid11_nr_proof.html">Epid11NrProof</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_epid11_params.html b/doc/html/struct_epid11_params.html
index df7dc38..bb6d47f 100644
--- a/doc/html/struct_epid11_params.html
+++ b/doc/html/struct_epid11_params.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -162,7 +162,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_epid11_params.html">Epid11Params</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_epid11_priv_rl.html b/doc/html/struct_epid11_priv_rl.html
index ecc3286..c20e2a2 100644
--- a/doc/html/struct_epid11_priv_rl.html
+++ b/doc/html/struct_epid11_priv_rl.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -102,7 +102,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_epid11_priv_rl.html">Epid11PrivRl</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_epid11_sig_rl.html b/doc/html/struct_epid11_sig_rl.html
index 8f381d5..8bd0a32 100644
--- a/doc/html/struct_epid11_sig_rl.html
+++ b/doc/html/struct_epid11_sig_rl.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -102,7 +102,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_epid11_sig_rl.html">Epid11SigRl</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_epid11_sig_rl_entry.html b/doc/html/struct_epid11_sig_rl_entry.html
index 4b13885..5fb17af 100644
--- a/doc/html/struct_epid11_sig_rl_entry.html
+++ b/doc/html/struct_epid11_sig_rl_entry.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -93,7 +93,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_epid11_sig_rl_entry.html">Epid11SigRlEntry</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_epid11_signature.html b/doc/html/struct_epid11_signature.html
index 713f607..48b26d0 100644
--- a/doc/html/struct_epid11_signature.html
+++ b/doc/html/struct_epid11_signature.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -102,7 +102,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_epid11_signature.html">Epid11Signature</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_epid11_verifier_precomp.html b/doc/html/struct_epid11_verifier_precomp.html
index ab3db86..9836628 100644
--- a/doc/html/struct_epid11_verifier_precomp.html
+++ b/doc/html/struct_epid11_verifier_precomp.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -105,7 +105,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_epid11_verifier_precomp.html">Epid11VerifierPrecomp</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_epid2_params.html b/doc/html/struct_epid2_params.html
index 17f661f..d577309 100644
--- a/doc/html/struct_epid2_params.html
+++ b/doc/html/struct_epid2_params.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -122,7 +122,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_epid2_params.html">Epid2Params</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_epid_ca_certificate.html b/doc/html/struct_epid_ca_certificate.html
index 5057459..3255426 100644
--- a/doc/html/struct_epid_ca_certificate.html
+++ b/doc/html/struct_epid_ca_certificate.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -121,7 +121,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_epid_ca_certificate.html">EpidCaCertificate</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_epid_file_header.html b/doc/html/struct_epid_file_header.html
index ff4caa4..8fb1c24 100644
--- a/doc/html/struct_epid_file_header.html
+++ b/doc/html/struct_epid_file_header.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -93,7 +93,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_epid_file_header.html">EpidFileHeader</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_epid_signature.html b/doc/html/struct_epid_signature.html
index 537ad36..246fa58 100644
--- a/doc/html/struct_epid_signature.html
+++ b/doc/html/struct_epid_signature.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -102,7 +102,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_epid_signature.html">EpidSignature</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_fp_elem_str.html b/doc/html/struct_fp_elem_str.html
index 9c21127..c892ca1 100644
--- a/doc/html/struct_fp_elem_str.html
+++ b/doc/html/struct_fp_elem_str.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_fp_elem_str.html">FpElemStr</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_fq12_elem_str.html b/doc/html/struct_fq12_elem_str.html
index 339ba52..ec99abf 100644
--- a/doc/html/struct_fq12_elem_str.html
+++ b/doc/html/struct_fq12_elem_str.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_fq12_elem_str.html">Fq12ElemStr</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_fq2_elem_str.html b/doc/html/struct_fq2_elem_str.html
index 3629780..0a38dfd 100644
--- a/doc/html/struct_fq2_elem_str.html
+++ b/doc/html/struct_fq2_elem_str.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_fq2_elem_str.html">Fq2ElemStr</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_fq3_elem_str.html b/doc/html/struct_fq3_elem_str.html
index 07892d8..bd94a64 100644
--- a/doc/html/struct_fq3_elem_str.html
+++ b/doc/html/struct_fq3_elem_str.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_fq3_elem_str.html">Fq3ElemStr</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_fq6_elem_str.html b/doc/html/struct_fq6_elem_str.html
index 06a9570..038434e 100644
--- a/doc/html/struct_fq6_elem_str.html
+++ b/doc/html/struct_fq6_elem_str.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_fq6_elem_str.html">Fq6ElemStr</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_fq_elem_str.html b/doc/html/struct_fq_elem_str.html
index cb4d66e..284921d 100644
--- a/doc/html/struct_fq_elem_str.html
+++ b/doc/html/struct_fq_elem_str.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_fq_elem_str.html">FqElemStr</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_g1_elem_str.html b/doc/html/struct_g1_elem_str.html
index f0b89ba..c7d5fd4 100644
--- a/doc/html/struct_g1_elem_str.html
+++ b/doc/html/struct_g1_elem_str.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -93,7 +93,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_g1_elem_str.html">G1ElemStr</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_g2_elem_str.html b/doc/html/struct_g2_elem_str.html
index 0e0e551..15dcd45 100644
--- a/doc/html/struct_g2_elem_str.html
+++ b/doc/html/struct_g2_elem_str.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -93,7 +93,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_g2_elem_str.html">G2ElemStr</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_group_pub_key.html b/doc/html/struct_group_pub_key.html
index 5f5426c..37dcf30 100644
--- a/doc/html/struct_group_pub_key.html
+++ b/doc/html/struct_group_pub_key.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -102,7 +102,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_group_pub_key.html">GroupPubKey</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_group_rl.html b/doc/html/struct_group_rl.html
index f6f68d4..2df4cc9 100644
--- a/doc/html/struct_group_rl.html
+++ b/doc/html/struct_group_rl.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -98,7 +98,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_group_rl.html">GroupRl</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_gt_elem_str.html b/doc/html/struct_gt_elem_str.html
index 59a3806..ad78f3d 100644
--- a/doc/html/struct_gt_elem_str.html
+++ b/doc/html/struct_gt_elem_str.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_gt_elem_str.html">GtElemStr</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_i_priv_key.html b/doc/html/struct_i_priv_key.html
index 928db56..c51a1b9 100644
--- a/doc/html/struct_i_priv_key.html
+++ b/doc/html/struct_i_priv_key.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -94,7 +94,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_i_priv_key.html">IPrivKey</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_join_request.html b/doc/html/struct_join_request.html
index de12951..e58a0b3 100644
--- a/doc/html/struct_join_request.html
+++ b/doc/html/struct_join_request.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -98,7 +98,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_join_request.html">JoinRequest</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_member_precomp.html b/doc/html/struct_member_precomp.html
index 42cbfee..a09de36 100644
--- a/doc/html/struct_member_precomp.html
+++ b/doc/html/struct_member_precomp.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -60,14 +60,14 @@ $(document).ready(function(){initNavTree('struct_member_precomp.html','');});
<div class="summary">
<a href="#pub-attribs">Data Fields</a> </div>
<div class="headertitle">
-<div class="title">MemberPrecomp Struct Reference<div class="ingroups"><a class="el" href="group___epid_module.html">epid</a> &raquo; <a class="el" href="group___epid_member_module.html">member</a></div></div> </div>
+<div class="title">MemberPrecomp Struct Reference<div class="ingroups"><a class="el" href="group___epid_module.html">epid</a> &raquo; <a class="el" href="group___epid_common.html">common</a> &raquo; <a class="el" href="group___epid_types.html">types</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p>Pre-computed member settings.
<a href="struct_member_precomp.html#details">More...</a></p>
-<p><code>#include &lt;epid/member/api.h&gt;</code></p>
+<p><code>#include &lt;epid/common/types.h&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
@@ -93,7 +93,7 @@ Data Fields</h2></td></tr>
<p>Serialized form of the information about a member that remains stable for a given set of keys.</p>
<dl class="section note"><dt>Note</dt><dd>e12 = 0 implies that this data is not valid </dd></dl>
</div><hr/>The documentation for this struct was generated from the following file:<ul>
-<li>epid/member/<a class="el" href="member_2api_8h.html">api.h</a></li>
+<li>epid/common/<a class="el" href="types_8h.html">types.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
@@ -103,7 +103,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_member_precomp.html">MemberPrecomp</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_membership_credential.html b/doc/html/struct_membership_credential.html
index 1b96f37..c9c8663 100644
--- a/doc/html/struct_membership_credential.html
+++ b/doc/html/struct_membership_credential.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -98,7 +98,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_membership_credential.html">MembershipCredential</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_nr_proof.html b/doc/html/struct_nr_proof.html
index eff3efb..1f39677 100644
--- a/doc/html/struct_nr_proof.html
+++ b/doc/html/struct_nr_proof.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -102,7 +102,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_nr_proof.html">NrProof</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_nr_prove_commit_output.html b/doc/html/struct_nr_prove_commit_output.html
new file mode 100644
index 0000000..3b24a32
--- /dev/null
+++ b/doc/html/struct_nr_prove_commit_output.html
@@ -0,0 +1,105 @@
+<!-- HTML header for doxygen 1.8.10-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.11"/>
+<title>Intel&reg; Enhanced Privacy ID SDK: NrProveCommitOutput Struct Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="navtree.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="resize.js"></script>
+<script type="text/javascript" src="navtreedata.js"></script>
+<script type="text/javascript" src="navtree.js"></script>
+<script type="text/javascript">
+ $(document).ready(initResizable);
+ $(window).load(resizeHeight);
+</script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+<link href="epidstyle.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td id="projectalign" style="padding-left: 0.5em;">
+ <div id="projectname"><a
+ onclick="storeLink('index.html')"
+ id="projectlink"
+ class="index.html"
+ href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
+&#160;<span id="projectnumber">4.0.0</span>
+</div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.11 -->
+</div><!-- top -->
+<div id="side-nav" class="ui-resizable side-nav-resizable">
+ <div id="nav-tree">
+ <div id="nav-tree-contents">
+ <div id="nav-sync" class="sync"></div>
+ </div>
+ </div>
+ <div id="splitbar" style="-moz-user-select:none;"
+ class="ui-resizable-handle">
+ </div>
+</div>
+<script type="text/javascript">
+$(document).ready(function(){initNavTree('struct_nr_prove_commit_output.html','');});
+</script>
+<div id="doc-content">
+<div class="header">
+ <div class="summary">
+<a href="#pub-attribs">Data Fields</a> </div>
+ <div class="headertitle">
+<div class="title">NrProveCommitOutput Struct Reference<div class="ingroups"><a class="el" href="group___epid_module.html">epid</a> &raquo; <a class="el" href="group___epid_member_module.html">member</a> &raquo; <a class="el" href="group___tpm_module.html">tpm</a></div></div> </div>
+</div><!--header-->
+<div class="contents">
+
+<p>Result of NrProve Commit.
+ <a href="struct_nr_prove_commit_output.html#details">More...</a></p>
+
+<p><code>#include &lt;epid/member/tpm/nrprove.h&gt;</code></p>
+<table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
+Data Fields</h2></td></tr>
+<tr class="memitem:a00234dfa2443d49f5a294c58fdacb064"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a00234dfa2443d49f5a294c58fdacb064"></a>
+<a class="el" href="struct_g1_elem_str.html">G1ElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_nr_prove_commit_output.html#a00234dfa2443d49f5a294c58fdacb064">T</a></td></tr>
+<tr class="memdesc:a00234dfa2443d49f5a294c58fdacb064"><td class="mdescLeft">&#160;</td><td class="mdescRight">T value for <a class="el" href="struct_nr_proof.html" title="non-revoked Proof. ">NrProof</a>. <br /></td></tr>
+<tr class="separator:a00234dfa2443d49f5a294c58fdacb064"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:af9c605d560f83ccd69e35d8b9cfe51b3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af9c605d560f83ccd69e35d8b9cfe51b3"></a>
+<a class="el" href="struct_g1_elem_str.html">G1ElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_nr_prove_commit_output.html#af9c605d560f83ccd69e35d8b9cfe51b3">R1</a></td></tr>
+<tr class="memdesc:af9c605d560f83ccd69e35d8b9cfe51b3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serialized G1 element. <br /></td></tr>
+<tr class="separator:af9c605d560f83ccd69e35d8b9cfe51b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:aab0f11e55d3b8d838e472242e27a1a43"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aab0f11e55d3b8d838e472242e27a1a43"></a>
+<a class="el" href="struct_g1_elem_str.html">G1ElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_nr_prove_commit_output.html#aab0f11e55d3b8d838e472242e27a1a43">R2</a></td></tr>
+<tr class="memdesc:aab0f11e55d3b8d838e472242e27a1a43"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serialized G1 element. <br /></td></tr>
+<tr class="separator:aab0f11e55d3b8d838e472242e27a1a43"><td class="memSeparator" colspan="2">&#160;</td></tr>
+</table>
+<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
+<div class="textblock"><p>Result of NrProve Commit. </p>
+</div><hr/>The documentation for this struct was generated from the following file:<ul>
+<li>epid/member/tpm/<a class="el" href="nrprove_8h.html">nrprove.h</a></li>
+</ul>
+</div><!-- contents -->
+</div><!-- doc-content -->
+<!-- HTML footer for doxygen 1.8.10-->
+<!-- start footer part -->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ <li class="navelem"><a class="el" href="struct_nr_prove_commit_output.html">NrProveCommitOutput</a></li>
+ <li class="footer">
+ &copy; 2016-2017 Intel Corporation
+ </li>
+ </ul>
+</div>
+</body>
+</html>
diff --git a/doc/html/struct_oct_str128.html b/doc/html/struct_oct_str128.html
index ca45266..9cc2419 100644
--- a/doc/html/struct_oct_str128.html
+++ b/doc/html/struct_oct_str128.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ unsigned char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" h
<ul>
<li class="navelem"><a class="el" href="struct_oct_str128.html">OctStr128</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_oct_str16.html b/doc/html/struct_oct_str16.html
index 118e14e..2d356a2 100644
--- a/doc/html/struct_oct_str16.html
+++ b/doc/html/struct_oct_str16.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ unsigned char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" h
<ul>
<li class="navelem"><a class="el" href="struct_oct_str16.html">OctStr16</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_oct_str256.html b/doc/html/struct_oct_str256.html
index ac0570a..928d973 100644
--- a/doc/html/struct_oct_str256.html
+++ b/doc/html/struct_oct_str256.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ unsigned char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" h
<ul>
<li class="navelem"><a class="el" href="struct_oct_str256.html">OctStr256</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_oct_str32.html b/doc/html/struct_oct_str32.html
index c834d79..30d8ca4 100644
--- a/doc/html/struct_oct_str32.html
+++ b/doc/html/struct_oct_str32.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ unsigned char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" h
<ul>
<li class="navelem"><a class="el" href="struct_oct_str32.html">OctStr32</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_oct_str512.html b/doc/html/struct_oct_str512.html
index 793004c..d1e272e 100644
--- a/doc/html/struct_oct_str512.html
+++ b/doc/html/struct_oct_str512.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ unsigned char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" h
<ul>
<li class="navelem"><a class="el" href="struct_oct_str512.html">OctStr512</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_oct_str600.html b/doc/html/struct_oct_str600.html
index 7acfc20..1ebe5d8 100644
--- a/doc/html/struct_oct_str600.html
+++ b/doc/html/struct_oct_str600.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ unsigned char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" h
<ul>
<li class="navelem"><a class="el" href="struct_oct_str600.html">OctStr600</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_oct_str64.html b/doc/html/struct_oct_str64.html
index 326acb4..df55982 100644
--- a/doc/html/struct_oct_str64.html
+++ b/doc/html/struct_oct_str64.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ unsigned char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" h
<ul>
<li class="navelem"><a class="el" href="struct_oct_str64.html">OctStr64</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_oct_str768.html b/doc/html/struct_oct_str768.html
index a5495e8..e603421 100644
--- a/doc/html/struct_oct_str768.html
+++ b/doc/html/struct_oct_str768.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ unsigned char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" h
<ul>
<li class="navelem"><a class="el" href="struct_oct_str768.html">OctStr768</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_oct_str8.html b/doc/html/struct_oct_str8.html
index 0001a9b..0dcdd94 100644
--- a/doc/html/struct_oct_str8.html
+++ b/doc/html/struct_oct_str8.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ unsigned char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" h
<ul>
<li class="navelem"><a class="el" href="struct_oct_str8.html">OctStr8</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_oct_str80.html b/doc/html/struct_oct_str80.html
index 4cff6da..2e6da78 100644
--- a/doc/html/struct_oct_str80.html
+++ b/doc/html/struct_oct_str80.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ unsigned char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" h
<ul>
<li class="navelem"><a class="el" href="struct_oct_str80.html">OctStr80</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_pre_computed_signature.html b/doc/html/struct_pre_computed_signature.html
deleted file mode 100644
index ab33400..0000000
--- a/doc/html/struct_pre_computed_signature.html
+++ /dev/null
@@ -1,138 +0,0 @@
-<!-- HTML header for doxygen 1.8.10-->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
-<meta http-equiv="X-UA-Compatible" content="IE=9"/>
-<meta name="generator" content="Doxygen 1.8.11"/>
-<title>Intel&reg; Enhanced Privacy ID SDK: PreComputedSignature Struct Reference</title>
-<link href="tabs.css" rel="stylesheet" type="text/css"/>
-<script type="text/javascript" src="jquery.js"></script>
-<script type="text/javascript" src="dynsections.js"></script>
-<link href="navtree.css" rel="stylesheet" type="text/css"/>
-<script type="text/javascript" src="resize.js"></script>
-<script type="text/javascript" src="navtreedata.js"></script>
-<script type="text/javascript" src="navtree.js"></script>
-<script type="text/javascript">
- $(document).ready(initResizable);
- $(window).load(resizeHeight);
-</script>
-<link href="doxygen.css" rel="stylesheet" type="text/css" />
-<link href="epidstyle.css" rel="stylesheet" type="text/css"/>
-</head>
-<body>
-<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
-<div id="titlearea">
-<table cellspacing="0" cellpadding="0">
- <tbody>
- <tr style="height: 56px;">
- <td id="projectalign" style="padding-left: 0.5em;">
- <div id="projectname"><a
- onclick="storeLink('index.html')"
- id="projectlink"
- class="index.html"
- href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
-</div>
- </td>
- </tr>
- </tbody>
-</table>
-</div>
-<!-- end header part -->
-<!-- Generated by Doxygen 1.8.11 -->
-</div><!-- top -->
-<div id="side-nav" class="ui-resizable side-nav-resizable">
- <div id="nav-tree">
- <div id="nav-tree-contents">
- <div id="nav-sync" class="sync"></div>
- </div>
- </div>
- <div id="splitbar" style="-moz-user-select:none;"
- class="ui-resizable-handle">
- </div>
-</div>
-<script type="text/javascript">
-$(document).ready(function(){initNavTree('struct_pre_computed_signature.html','');});
-</script>
-<div id="doc-content">
-<div class="header">
- <div class="summary">
-<a href="#pub-attribs">Data Fields</a> </div>
- <div class="headertitle">
-<div class="title">PreComputedSignature Struct Reference<div class="ingroups"><a class="el" href="group___epid_module.html">epid</a> &raquo; <a class="el" href="group___epid_member_module.html">member</a></div></div> </div>
-</div><!--header-->
-<div class="contents">
-
-<p>Pre-computed signature.
- <a href="struct_pre_computed_signature.html#details">More...</a></p>
-
-<p><code>#include &lt;epid/member/api.h&gt;</code></p>
-<table class="memberdecls">
-<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
-Data Fields</h2></td></tr>
-<tr class="memitem:a9cc2eb61572a1aca9e6bc3d5e6f4c1fe"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9cc2eb61572a1aca9e6bc3d5e6f4c1fe"></a>
-<a class="el" href="struct_g1_elem_str.html">G1ElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_pre_computed_signature.html#a9cc2eb61572a1aca9e6bc3d5e6f4c1fe">B</a></td></tr>
-<tr class="memdesc:a9cc2eb61572a1aca9e6bc3d5e6f4c1fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">an element in G1 <br /></td></tr>
-<tr class="separator:a9cc2eb61572a1aca9e6bc3d5e6f4c1fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:a2a4eaffe2717bd9c8c360599612adbe6"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2a4eaffe2717bd9c8c360599612adbe6"></a>
-<a class="el" href="struct_g1_elem_str.html">G1ElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_pre_computed_signature.html#a2a4eaffe2717bd9c8c360599612adbe6">K</a></td></tr>
-<tr class="memdesc:a2a4eaffe2717bd9c8c360599612adbe6"><td class="mdescLeft">&#160;</td><td class="mdescRight">an element in G1 <br /></td></tr>
-<tr class="separator:a2a4eaffe2717bd9c8c360599612adbe6"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:a73471643dc757115701833ca2e831a72"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a73471643dc757115701833ca2e831a72"></a>
-<a class="el" href="struct_g1_elem_str.html">G1ElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_pre_computed_signature.html#a73471643dc757115701833ca2e831a72">T</a></td></tr>
-<tr class="memdesc:a73471643dc757115701833ca2e831a72"><td class="mdescLeft">&#160;</td><td class="mdescRight">an element in G1 <br /></td></tr>
-<tr class="separator:a73471643dc757115701833ca2e831a72"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:a72be597624957e3d668c95ff6f445f94"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a72be597624957e3d668c95ff6f445f94"></a>
-<a class="el" href="struct_g1_elem_str.html">G1ElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_pre_computed_signature.html#a72be597624957e3d668c95ff6f445f94">R1</a></td></tr>
-<tr class="memdesc:a72be597624957e3d668c95ff6f445f94"><td class="mdescLeft">&#160;</td><td class="mdescRight">an element in G1 <br /></td></tr>
-<tr class="separator:a72be597624957e3d668c95ff6f445f94"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:a79f06fb57842597372e00dd34c1a804a"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a79f06fb57842597372e00dd34c1a804a"></a>
-<a class="el" href="struct_gt_elem_str.html">GtElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_pre_computed_signature.html#a79f06fb57842597372e00dd34c1a804a">R2</a></td></tr>
-<tr class="memdesc:a79f06fb57842597372e00dd34c1a804a"><td class="mdescLeft">&#160;</td><td class="mdescRight">an element in G1 <br /></td></tr>
-<tr class="separator:a79f06fb57842597372e00dd34c1a804a"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:af23f3f9693857a33fe8564644612ea37"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af23f3f9693857a33fe8564644612ea37"></a>
-<a class="el" href="struct_fp_elem_str.html">FpElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_pre_computed_signature.html#af23f3f9693857a33fe8564644612ea37">a</a></td></tr>
-<tr class="memdesc:af23f3f9693857a33fe8564644612ea37"><td class="mdescLeft">&#160;</td><td class="mdescRight">an integer between [0, p-1] <br /></td></tr>
-<tr class="separator:af23f3f9693857a33fe8564644612ea37"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:a666710432d9d54ca896647a976892c4f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a666710432d9d54ca896647a976892c4f"></a>
-<a class="el" href="struct_fp_elem_str.html">FpElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_pre_computed_signature.html#a666710432d9d54ca896647a976892c4f">b</a></td></tr>
-<tr class="memdesc:a666710432d9d54ca896647a976892c4f"><td class="mdescLeft">&#160;</td><td class="mdescRight">an integer between [0, p-1] <br /></td></tr>
-<tr class="separator:a666710432d9d54ca896647a976892c4f"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:acd0674d5b5e96244645e9abef7bdbddc"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acd0674d5b5e96244645e9abef7bdbddc"></a>
-<a class="el" href="struct_fp_elem_str.html">FpElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_pre_computed_signature.html#acd0674d5b5e96244645e9abef7bdbddc">rx</a></td></tr>
-<tr class="memdesc:acd0674d5b5e96244645e9abef7bdbddc"><td class="mdescLeft">&#160;</td><td class="mdescRight">an integer between [0, p-1] <br /></td></tr>
-<tr class="separator:acd0674d5b5e96244645e9abef7bdbddc"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:ac244bd559a96812bcee7671abc299b66"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac244bd559a96812bcee7671abc299b66"></a>
-<a class="el" href="struct_fp_elem_str.html">FpElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_pre_computed_signature.html#ac244bd559a96812bcee7671abc299b66">rf</a></td></tr>
-<tr class="memdesc:ac244bd559a96812bcee7671abc299b66"><td class="mdescLeft">&#160;</td><td class="mdescRight">an integer between [0, p-1] <br /></td></tr>
-<tr class="separator:ac244bd559a96812bcee7671abc299b66"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:a54462643b8a2b4f2741bf8d2e6909d11"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a54462643b8a2b4f2741bf8d2e6909d11"></a>
-<a class="el" href="struct_fp_elem_str.html">FpElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_pre_computed_signature.html#a54462643b8a2b4f2741bf8d2e6909d11">ra</a></td></tr>
-<tr class="memdesc:a54462643b8a2b4f2741bf8d2e6909d11"><td class="mdescLeft">&#160;</td><td class="mdescRight">an integer between [0, p-1] <br /></td></tr>
-<tr class="separator:a54462643b8a2b4f2741bf8d2e6909d11"><td class="memSeparator" colspan="2">&#160;</td></tr>
-<tr class="memitem:a6a1db672c609943fe7af84320dc68ba3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6a1db672c609943fe7af84320dc68ba3"></a>
-<a class="el" href="struct_fp_elem_str.html">FpElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_pre_computed_signature.html#a6a1db672c609943fe7af84320dc68ba3">rb</a></td></tr>
-<tr class="memdesc:a6a1db672c609943fe7af84320dc68ba3"><td class="mdescLeft">&#160;</td><td class="mdescRight">an integer between [0, p-1] <br /></td></tr>
-<tr class="separator:a6a1db672c609943fe7af84320dc68ba3"><td class="memSeparator" colspan="2">&#160;</td></tr>
-</table>
-<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
-<div class="textblock"><p>Pre-computed signature. </p>
-<p>Serialized form of an intermediate signature that does not depend on basename or message. This can be used to time-shift compute time needed to sign a message. </p>
-</div><hr/>The documentation for this struct was generated from the following file:<ul>
-<li>epid/member/<a class="el" href="member_2api_8h.html">api.h</a></li>
-</ul>
-</div><!-- contents -->
-</div><!-- doc-content -->
-<!-- HTML footer for doxygen 1.8.10-->
-<!-- start footer part -->
-<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
- <ul>
- <li class="navelem"><a class="el" href="struct_pre_computed_signature.html">PreComputedSignature</a></li>
- <li class="footer">
- &copy; 2016 Intel Corporation
- </li>
- </ul>
-</div>
-</body>
-</html>
diff --git a/doc/html/struct_priv_key.html b/doc/html/struct_priv_key.html
index a81978f..2a9f73c 100644
--- a/doc/html/struct_priv_key.html
+++ b/doc/html/struct_priv_key.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -102,7 +102,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_priv_key.html">PrivKey</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_priv_rl.html b/doc/html/struct_priv_rl.html
index fc65874..8bc9deb 100644
--- a/doc/html/struct_priv_rl.html
+++ b/doc/html/struct_priv_rl.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -102,7 +102,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_priv_rl.html">PrivRl</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_sha256_digest.html b/doc/html/struct_sha256_digest.html
index 350ebc9..b36ef58 100644
--- a/doc/html/struct_sha256_digest.html
+++ b/doc/html/struct_sha256_digest.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -89,7 +89,7 @@ unsigned char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" h
<ul>
<li class="navelem"><a class="el" href="struct_sha256_digest.html">Sha256Digest</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_sig_rl.html b/doc/html/struct_sig_rl.html
index 7572586..37f8bf6 100644
--- a/doc/html/struct_sig_rl.html
+++ b/doc/html/struct_sig_rl.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -102,7 +102,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_sig_rl.html">SigRl</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_sig_rl_entry.html b/doc/html/struct_sig_rl_entry.html
index 4cf161b..d51ec85 100644
--- a/doc/html/struct_sig_rl_entry.html
+++ b/doc/html/struct_sig_rl_entry.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -93,7 +93,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_sig_rl_entry.html">SigRlEntry</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_sign_commit_output.html b/doc/html/struct_sign_commit_output.html
new file mode 100644
index 0000000..7dca13d
--- /dev/null
+++ b/doc/html/struct_sign_commit_output.html
@@ -0,0 +1,113 @@
+<!-- HTML header for doxygen 1.8.10-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.11"/>
+<title>Intel&reg; Enhanced Privacy ID SDK: SignCommitOutput Struct Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="navtree.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="resize.js"></script>
+<script type="text/javascript" src="navtreedata.js"></script>
+<script type="text/javascript" src="navtree.js"></script>
+<script type="text/javascript">
+ $(document).ready(initResizable);
+ $(window).load(resizeHeight);
+</script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+<link href="epidstyle.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td id="projectalign" style="padding-left: 0.5em;">
+ <div id="projectname"><a
+ onclick="storeLink('index.html')"
+ id="projectlink"
+ class="index.html"
+ href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
+&#160;<span id="projectnumber">4.0.0</span>
+</div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.11 -->
+</div><!-- top -->
+<div id="side-nav" class="ui-resizable side-nav-resizable">
+ <div id="nav-tree">
+ <div id="nav-tree-contents">
+ <div id="nav-sync" class="sync"></div>
+ </div>
+ </div>
+ <div id="splitbar" style="-moz-user-select:none;"
+ class="ui-resizable-handle">
+ </div>
+</div>
+<script type="text/javascript">
+$(document).ready(function(){initNavTree('struct_sign_commit_output.html','');});
+</script>
+<div id="doc-content">
+<div class="header">
+ <div class="summary">
+<a href="#pub-attribs">Data Fields</a> </div>
+ <div class="headertitle">
+<div class="title">SignCommitOutput Struct Reference<div class="ingroups"><a class="el" href="group___epid_module.html">epid</a> &raquo; <a class="el" href="group___epid_member_module.html">member</a> &raquo; <a class="el" href="group___tpm_module.html">tpm</a></div></div> </div>
+</div><!--header-->
+<div class="contents">
+
+<p>Result of Sign Commit.
+ <a href="struct_sign_commit_output.html#details">More...</a></p>
+
+<p><code>#include &lt;epid/member/tpm/sign.h&gt;</code></p>
+<table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
+Data Fields</h2></td></tr>
+<tr class="memitem:ae2ebcc07395e60187d9ccca373665dba"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae2ebcc07395e60187d9ccca373665dba"></a>
+<a class="el" href="struct_g1_elem_str.html">G1ElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_sign_commit_output.html#ae2ebcc07395e60187d9ccca373665dba">B</a></td></tr>
+<tr class="memdesc:ae2ebcc07395e60187d9ccca373665dba"><td class="mdescLeft">&#160;</td><td class="mdescRight">B value for signature. <br /></td></tr>
+<tr class="separator:ae2ebcc07395e60187d9ccca373665dba"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a496bdc4d14fb73b1e85dfff3bc9fd3ba"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a496bdc4d14fb73b1e85dfff3bc9fd3ba"></a>
+<a class="el" href="struct_g1_elem_str.html">G1ElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_sign_commit_output.html#a496bdc4d14fb73b1e85dfff3bc9fd3ba">K</a></td></tr>
+<tr class="memdesc:a496bdc4d14fb73b1e85dfff3bc9fd3ba"><td class="mdescLeft">&#160;</td><td class="mdescRight">K value for signature. <br /></td></tr>
+<tr class="separator:a496bdc4d14fb73b1e85dfff3bc9fd3ba"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a9ce3b28916094f5fa108d5f5c86631b0"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9ce3b28916094f5fa108d5f5c86631b0"></a>
+<a class="el" href="struct_g1_elem_str.html">G1ElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_sign_commit_output.html#a9ce3b28916094f5fa108d5f5c86631b0">T</a></td></tr>
+<tr class="memdesc:a9ce3b28916094f5fa108d5f5c86631b0"><td class="mdescLeft">&#160;</td><td class="mdescRight">T value for signature. <br /></td></tr>
+<tr class="separator:a9ce3b28916094f5fa108d5f5c86631b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:ad01513f153f51f7ce211cf323a224499"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad01513f153f51f7ce211cf323a224499"></a>
+<a class="el" href="struct_g1_elem_str.html">G1ElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_sign_commit_output.html#ad01513f153f51f7ce211cf323a224499">R1</a></td></tr>
+<tr class="memdesc:ad01513f153f51f7ce211cf323a224499"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serialized G1 element. <br /></td></tr>
+<tr class="separator:ad01513f153f51f7ce211cf323a224499"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:a0f35f1d619ea972acbdf9d45af630de0"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0f35f1d619ea972acbdf9d45af630de0"></a>
+<a class="el" href="struct_gt_elem_str.html">GtElemStr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_sign_commit_output.html#a0f35f1d619ea972acbdf9d45af630de0">R2</a></td></tr>
+<tr class="memdesc:a0f35f1d619ea972acbdf9d45af630de0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serialized GT element. <br /></td></tr>
+<tr class="separator:a0f35f1d619ea972acbdf9d45af630de0"><td class="memSeparator" colspan="2">&#160;</td></tr>
+</table>
+<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
+<div class="textblock"><p>Result of Sign Commit. </p>
+</div><hr/>The documentation for this struct was generated from the following file:<ul>
+<li>epid/member/tpm/<a class="el" href="sign_8h.html">sign.h</a></li>
+</ul>
+</div><!-- contents -->
+</div><!-- doc-content -->
+<!-- HTML footer for doxygen 1.8.10-->
+<!-- start footer part -->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ <li class="navelem"><a class="el" href="struct_sign_commit_output.html">SignCommitOutput</a></li>
+ <li class="footer">
+ &copy; 2016-2017 Intel Corporation
+ </li>
+ </ul>
+</div>
+</body>
+</html>
diff --git a/doc/html/struct_verifier_precomp.html b/doc/html/struct_verifier_precomp.html
index 1293a72..86def45 100644
--- a/doc/html/struct_verifier_precomp.html
+++ b/doc/html/struct_verifier_precomp.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -107,7 +107,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_verifier_precomp.html">VerifierPrecomp</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/struct_verifier_rl.html b/doc/html/struct_verifier_rl.html
index 13b0169..fc32725 100644
--- a/doc/html/struct_verifier_rl.html
+++ b/doc/html/struct_verifier_rl.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -102,7 +102,7 @@ Data Fields</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="struct_verifier_rl.html">VerifierRl</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/tatepairing_8h.html b/doc/html/tatepairing_8h.html
index 85bedea..0dce09c 100644
--- a/doc/html/tatepairing_8h.html
+++ b/doc/html/tatepairing_8h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -101,7 +101,7 @@ Functions</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li><li class="navelem"><a class="el" href="dir_f169ebf8da29290a918fa4b3f7151050.html">math</a></li><li class="navelem"><a class="el" href="tatepairing_8h.html">tatepairing.h</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/types_8h.html b/doc/html/types_8h.html
index 2f09b6b..a598d3e 100644
--- a/doc/html/types_8h.html
+++ b/doc/html/types_8h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -155,6 +155,9 @@ Data Structures</h2></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_verifier_rl.html">VerifierRl</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_member_precomp.html">MemberPrecomp</a></td></tr>
+<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pre-computed member settings. <a href="struct_member_precomp.html#details">More...</a><br /></td></tr>
+<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_fq2_elem_str.html">Fq2ElemStr</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Serialized Fq2 element. <a href="struct_fq2_elem_str.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -176,6 +179,14 @@ Data Structures</h2></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
+<tr class="memitem:ga3315fb24f4c5783b6d6eb107933390b0"><td class="memItemLeft" align="right" valign="top">
+typedef void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_types.html#ga3315fb24f4c5783b6d6eb107933390b0">OctStr</a></td></tr>
+<tr class="memdesc:ga3315fb24f4c5783b6d6eb107933390b0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generic Octet String Style Number. <br /></td></tr>
+<tr class="separator:ga3315fb24f4c5783b6d6eb107933390b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
+<tr class="memitem:gace6876a045f2c2694444b35ccb0844e2"><td class="memItemLeft" align="right" valign="top">
+typedef void const *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_types.html#gace6876a045f2c2694444b35ccb0844e2">ConstOctStr</a></td></tr>
+<tr class="memdesc:gace6876a045f2c2694444b35ccb0844e2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generic Const Octet String Style Number. <br /></td></tr>
+<tr class="separator:gace6876a045f2c2694444b35ccb0844e2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gada666b48d0cbc301985405fde896f1de"><td class="memItemLeft" align="right" valign="top">
typedef <a class="el" href="struct_oct_str128.html">OctStr128</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___epid_types.html#gada666b48d0cbc301985405fde896f1de">GroupId</a></td></tr>
<tr class="memdesc:gada666b48d0cbc301985405fde896f1de"><td class="mdescLeft">&#160;</td><td class="mdescRight">group ID <br /></td></tr>
@@ -220,7 +231,7 @@ Enumerations</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_f6bef457d5f671b6e774bfccc16651f6.html">common</a></li><li class="navelem"><a class="el" href="types_8h.html">types.h</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/validatekey_8h.html b/doc/html/validatekey_8h.html
new file mode 100644
index 0000000..fa6f37c
--- /dev/null
+++ b/doc/html/validatekey_8h.html
@@ -0,0 +1,93 @@
+<!-- HTML header for doxygen 1.8.10-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.11"/>
+<title>Intel&reg; Enhanced Privacy ID SDK: epid/member/tpm/validatekey.h File Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="dynsections.js"></script>
+<link href="navtree.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="resize.js"></script>
+<script type="text/javascript" src="navtreedata.js"></script>
+<script type="text/javascript" src="navtree.js"></script>
+<script type="text/javascript">
+ $(document).ready(initResizable);
+ $(window).load(resizeHeight);
+</script>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+<link href="epidstyle.css" rel="stylesheet" type="text/css"/>
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td id="projectalign" style="padding-left: 0.5em;">
+ <div id="projectname"><a
+ onclick="storeLink('index.html')"
+ id="projectlink"
+ class="index.html"
+ href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
+&#160;<span id="projectnumber">4.0.0</span>
+</div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.11 -->
+</div><!-- top -->
+<div id="side-nav" class="ui-resizable side-nav-resizable">
+ <div id="nav-tree">
+ <div id="nav-tree-contents">
+ <div id="nav-sync" class="sync"></div>
+ </div>
+ </div>
+ <div id="splitbar" style="-moz-user-select:none;"
+ class="ui-resizable-handle">
+ </div>
+</div>
+<script type="text/javascript">
+$(document).ready(function(){initNavTree('validatekey_8h.html','');});
+</script>
+<div id="doc-content">
+<div class="header">
+ <div class="summary">
+<a href="#func-members">Functions</a> </div>
+ <div class="headertitle">
+<div class="title">validatekey.h File Reference</div> </div>
+</div><!--header-->
+<div class="contents">
+
+<p>Non-sensitive member context APIs.
+<a href="#details">More...</a></p>
+<div class="textblock"><code>#include &quot;<a class="el" href="stdtypes_8h.html">epid/common/stdtypes.h</a>&quot;</code><br />
+<code>#include &quot;<a class="el" href="errors_8h.html">epid/common/errors.h</a>&quot;</code><br />
+</div><table class="memberdecls">
+<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr class="memitem:ga3318f97e4d1763815dace3779ae6564f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="stdtypes_8h.html#ad5c9d4ba3dc37783a528b0925dc981a0">bool</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___tpm_module.html#ga3318f97e4d1763815dace3779ae6564f">TpmIsKeyValid</a> (TpmCtx *ctx, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *A_str, <a class="el" href="struct_fp_elem_str.html">FpElemStr</a> const *x_str, <a class="el" href="struct_g1_elem_str.html">G1ElemStr</a> const *h1_str, <a class="el" href="struct_g2_elem_str.html">G2ElemStr</a> const *w_str)</td></tr>
+<tr class="memdesc:ga3318f97e4d1763815dace3779ae6564f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks if provided parameters result in a valid key. <a href="group___tpm_module.html#ga3318f97e4d1763815dace3779ae6564f">More...</a><br /></td></tr>
+<tr class="separator:ga3318f97e4d1763815dace3779ae6564f"><td class="memSeparator" colspan="2">&#160;</td></tr>
+</table>
+<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
+<div class="textblock"><p>Non-sensitive member context APIs. </p>
+</div></div><!-- contents -->
+</div><!-- doc-content -->
+<!-- HTML footer for doxygen 1.8.10-->
+<!-- start footer part -->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ <li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_512d3e62841a8535b716ec4cf8b9e950.html">member</a></li><li class="navelem"><a class="el" href="dir_6048dbb18cb271412de4a010207fd345.html">tpm</a></li><li class="navelem"><a class="el" href="validatekey_8h.html">validatekey.h</a></li>
+ <li class="footer">
+ &copy; 2016-2017 Intel Corporation
+ </li>
+ </ul>
+</div>
+</body>
+</html>
diff --git a/doc/html/verifier_21_81_2api_8h.html b/doc/html/verifier_21_81_2api_8h.html
index a35abd0..fd74c4c 100644
--- a/doc/html/verifier_21_81_2api_8h.html
+++ b/doc/html/verifier_21_81_2api_8h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -136,7 +136,7 @@ Functions</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_02c945662023679b89476bd7126bc985.html">verifier</a></li><li class="navelem"><a class="el" href="dir_ef364879bae02db2684040178ed9b186.html">1.1</a></li><li class="navelem"><a class="el" href="verifier_21_81_2api_8h.html">api.h</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/verifier_2api_8h.html b/doc/html/verifier_2api_8h.html
index 6eeaf21..86a5972 100644
--- a/doc/html/verifier_2api_8h.html
+++ b/doc/html/verifier_2api_8h.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -150,7 +150,7 @@ Functions</h2></td></tr>
<ul>
<li class="navelem"><a class="el" href="dir_12b90d9c027aaf878a834df729679a56.html">epid</a></li><li class="navelem"><a class="el" href="dir_02c945662023679b89476bd7126bc985.html">verifier</a></li><li class="navelem"><a class="el" href="verifier_2api_8h.html">api.h</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/doc/html/verifysig__walkthrough_8dox.html b/doc/html/verifysig__walkthrough_8dox.html
index 9883f8e..9150010 100644
--- a/doc/html/verifysig__walkthrough_8dox.html
+++ b/doc/html/verifysig__walkthrough_8dox.html
@@ -32,7 +32,7 @@
id="projectlink"
class="index.html"
href="index.html">Intel&reg; Enhanced Privacy ID SDK</a>
-&#160;<span id="projectnumber">3.0.0</span>
+&#160;<span id="projectnumber">4.0.0</span>
</div>
</td>
</tr>
@@ -74,7 +74,7 @@ $(document).ready(function(){initNavTree('verifysig__walkthrough_8dox.html','');
<ul>
<li class="navelem"><a class="el" href="verifysig__walkthrough_8dox.html">verifysig_walkthrough.dox</a></li>
<li class="footer">
- &copy; 2016 Intel Corporation
+ &copy; 2016-2017 Intel Corporation
</li>
</ul>
</div>
diff --git a/ext/ipp/sources/ippcp/src/pcpbnresource.h b/epid/common-testhelper/1.1/testdata/grp_x/corrupted_privrl.inc
index 6e46c95..6972ab7 100644
--- a/ext/ipp/sources/ippcp/src/pcpbnresource.h
+++ b/epid/common-testhelper/1.1/testdata/grp_x/corrupted_privrl.inc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -13,36 +13,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.
############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal BN Resource Definitions & Function Prototypes
-//
-// Created: Sun 29-Jun-2003 12:16
-// Author(s): Sergey Kirillov
-//
-//
-*/
-
-#if !defined(_PCP_BNRESOURCE_H)
-#define _PCP_BNRESOURCE_H
-
-
-typedef struct {
- void* pNext;
- IppsBigNumState* pBN;
-} BigNumNode;
-
-
-/* size (byte) of BN resource */
-int cpBigNumListGetSize(int feBitSize, int nodes);
-
-/* init BN resource */
-void cpBigNumListInit(int feBitSize, int nodes, BigNumNode* pList);
-
-/* get BN from resource */
-IppsBigNumState* cpBigNumListGet(BigNumNode** pList);
-
-#endif /* _PCP_BNRESOURCE_H */
+/*!
+ * \file
+ * \brief Test data.
+ *
+ * Type : Intel(R) EPID 1.1 private-key based revocation list
+ * Group : grpX
+ */
+//unsigned char privrl_dat[] = {
+ // Group ID
+ 0x00, 0x00, 0x00, 0x7b,
+ // RLver
+ 0x00, 0x00, 0x00, 0x03,
+ // n1
+ 0x00, 0x00, 0x00, 0x01,
+ // f[1]
+ 0x00, 0x00, 0x89, 0x57, 0x3F, 0x17, 0x47, 0x30, 0x8C, 0x43, 0xD5, 0xEE,
+ 0x41, 0x97, 0x96, 0x19, 0x72, 0xBB, 0x86, 0x88, 0xED, 0x4B, 0xEF, 0x04,
+ 0xAB, 0xAE, 0xC3, 0x8E, 0xEC, 0x51, 0xC3, 0xD3
+//};
+// unsigned int privrl_dat_len = 44;
diff --git a/epid/common-testhelper/Makefile b/epid/common-testhelper/Makefile
index d3a4d7f..04f322b 100644
--- a/epid/common-testhelper/Makefile
+++ b/epid/common-testhelper/Makefile
@@ -17,26 +17,25 @@ COMMON_TESTHELPER_UTEST_EXE = ./unittests/common-testhelper-utest
LIB_COMMON_TESTHELPER_DIR = .
LIB_COMMON_DIR = ../common
LIB_IPPCP_DIR = ../../ext/ipp/sources/ippcp/src
-LIB_IPPCPEPID_DIR = ../../ext/ipp/sources/ippcpepid/src
#set flags for linker
LDFLAGS += -L$(GTEST_INCLUDE_DIR)/gtest -L$(LIB_COMMON_TESTHELPER_DIR) \
- -L$(LIB_COMMON_DIR) -L$(LIB_IPPCPEPID_DIR) -L$(LIB_IPPCP_DIR) \
- -lgtest -lcommon-testhelper -lcommon -lippcpepid -lippcp
+ -L$(LIB_COMMON_DIR) -L$(LIB_IPPCP_DIR) \
+ -lgtest -lcommon-testhelper -lcommon -lippcp
#target part
$(COMMON_TESTHELPER_LIB): $(COMMON_TESTHELPER_OBJ)
$(AR) rc $(COMMON_TESTHELPER_LIB) $(COMMON_TESTHELPER_OBJ)
- ranlib $(COMMON_TESTHELPER_LIB)
+ $(RANLIB) $(COMMON_TESTHELPER_LIB)
$(COMMON_TESTHELPER_OBJ): %.o: %.cc
$(CXX) -o $@ $(CXXFLAGS) -I$(COMMON_TESTHELPER_INCLUDE_DIR) -c $^
$(COMMON_TESTHELPER_UTEST_EXE): $(COMMON_TESTHELPER_UTEST_OBJ)
- $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
+ $(CXX) -o $@ $^ $(LDFLAGS)
$(COMMON_TESTHELPER_UTEST_OBJ): %.o: %.cc
- $(CXX) -o $@ $(CXXFLAGS) -I$(COMMON_TESTHELPER_INCLUDE_DIR) \
+ $(CXX) -o $@ $(CXXFLAGS) $(GTEST_DEFINES) -I$(COMMON_TESTHELPER_INCLUDE_DIR) \
-I$(COMMON_TESTHELPER_11_INCLUDE_DIR) -I$(GTEST_INCLUDE_DIR) -c $^
build: all
@@ -50,11 +49,13 @@ ifneq (,$(wildcard $(COMMON_TESTHELPER_UTEST_EXE)))
cp $(COMMON_TESTHELPER_UTEST_EXE) '$(TEST_INSTALL_DIR)'
endif
-check: $(COMMON_TESTHELPER_UTEST_EXE) run
+utest: $(COMMON_TESTHELPER_UTEST_EXE)
-run:
+run_utest:
$(COMMON_TESTHELPER_UTEST_EXE) $(GTEST_FLAGS)
+check: utest run_utest
+
clean:
rm -f $(COMMON_TESTHELPER_OBJ) \
$(COMMON_TESTHELPER_LIB) \
diff --git a/epid/common-testhelper/epid_gtest-testhelper.cc b/epid/common-testhelper/epid_gtest-testhelper.cc
new file mode 100644
index 0000000..930734e
--- /dev/null
+++ b/epid/common-testhelper/epid_gtest-testhelper.cc
@@ -0,0 +1,68 @@
+/*############################################################################
+ # Copyright 2017 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 Implementation of Epid specific predicates for gtest
+ */
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
+#include <string>
+
+/// Record mapping status code to string
+struct EpidStatusTextEntry {
+ /// error code
+ EpidStatus value;
+ /// name of error code
+ const char* value_name;
+};
+#define EPID_STATUS_TEXT_ENTRY_VALUE(sts) \
+ { sts, #sts }
+/// Mapping of status codes to strings
+static const struct EpidStatusTextEntry kEnumToText[] = {
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidNoErr),
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidErr),
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidSigInvalid),
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidSigRevokedInGroupRl),
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidSigRevokedInPrivRl),
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidSigRevokedInSigRl),
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidSigRevokedInVerifierRl),
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidNotImpl),
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidBadArgErr),
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidNoMemErr),
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidMemAllocErr),
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidMathErr),
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidDivByZeroErr),
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidUnderflowErr),
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidHashAlgorithmNotSupported),
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidRandMaxIterErr),
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidDuplicateErr),
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidInconsistentBasenameSetErr),
+ EPID_STATUS_TEXT_ENTRY_VALUE(kEpidMathQuadraticNonResidueError)};
+
+const char* EpidStatusToName(EpidStatus e) {
+ size_t i = 0;
+ const size_t num_entries = sizeof(kEnumToText) / sizeof(kEnumToText[0]);
+ for (i = 0; i < num_entries; i++) {
+ if (e == kEnumToText[i].value) {
+ return kEnumToText[i].value_name;
+ }
+ }
+ return "unknown";
+}
+std::ostream& operator<<(std::ostream& os, EpidStatus e) {
+ const char* enum_name = EpidStatusToName(e);
+ return os << enum_name << " (" << std::to_string(e) << ")";
+}
diff --git a/ext/ipp/sources/ippcp/src/precomp.h b/epid/common-testhelper/epid_gtest-testhelper.h
index afc4373..13b82a4 100644
--- a/ext/ipp/sources/ippcp/src/precomp.h
+++ b/epid/common-testhelper/epid_gtest-testhelper.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,9 +14,17 @@
# limitations under the License.
############################################################################*/
-#ifndef __PRECOMP_H__
-#define __PRECOMP_H__
+/*!
+ * \file
+ * \brief Epid specific predicates for gtest
+ */
+#ifndef EPID_COMMON_TESTHELPER_EPID_GTEST_TESTHELPER_H_
+#define EPID_COMMON_TESTHELPER_EPID_GTEST_TESTHELPER_H_
+#include <ostream>
+extern "C" {
+#include "epid/common/errors.h"
+}
-#include "owncp.h"
+std::ostream& operator<<(std::ostream& os, EpidStatus e);
-#endif /* __PRECOMP_H__ */
+#endif // EPID_COMMON_TESTHELPER_EPID_GTEST_TESTHELPER_H_
diff --git a/epid/common-testhelper/octstr-testhelper.cc b/epid/common-testhelper/octstr-testhelper.cc
index 86ce193..7364839 100644
--- a/epid/common-testhelper/octstr-testhelper.cc
+++ b/epid/common-testhelper/octstr-testhelper.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -23,6 +23,9 @@ extern "C" {
#include "epid/common/src/memory.h"
}
#include "ext/ipp/include/ippcp.h"
+#include "epid/common/types.h"
+
+typedef Ipp8u* IppOctStr;
/// Internal function to delete BigNum
void delete_BigNum(IppsBigNumState** bn) {
@@ -71,7 +74,7 @@ EpidStatus create_BigNum(IppsBigNumState** bn, const OctStr256* str) {
break;
}
- sts = ippsSetOctString_BN((Ipp8u*)str, byte_size, ipp_bn_ctx);
+ sts = ippsSetOctString_BN((IppOctStr)str, byte_size, ipp_bn_ctx);
if (sts != ippStsNoErr) {
if (sts == ippStsLengthErr) {
result = kEpidBadArgErr;
diff --git a/epid/common-testhelper/testdata/grp_x/corrupted_privrl.inc b/epid/common-testhelper/testdata/grp_x/corrupted_privrl.inc
new file mode 100644
index 0000000..4047117
--- /dev/null
+++ b/epid/common-testhelper/testdata/grp_x/corrupted_privrl.inc
@@ -0,0 +1,36 @@
+/*############################################################################
+ # Copyright 2017 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 Test data.
+ *
+ * Type : Intel(R) EPID 2.0 private-key based revocation list
+ * Group : grpX
+ */
+//unsigned char privrl_dat[] = {
+ // Group ID
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ // RLver
+ 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xee,
+ // n1
+ 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01,
+ // f[1]
+ 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,
+//};
+//unsigned int privrl_dat_len = 56;
diff --git a/epid/common-testhelper/testdata/grp_x/member0/sig_sha512_256_bsn0_msg0.inc b/epid/common-testhelper/testdata/grp_x/member0/sig_sha512_256_bsn0_msg0.inc
new file mode 100644
index 0000000..7decfde
--- /dev/null
+++ b/epid/common-testhelper/testdata/grp_x/member0/sig_sha512_256_bsn0_msg0.inc
@@ -0,0 +1,100 @@
+/*############################################################################
+ # Copyright 2017 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 Test data.
+ *
+ * Type : Intel(R) EPID 2.0 Signature
+ * Group : grpX
+ * Signer : member0
+ * HashAlg : Sha512256
+ * Message : "msg0"
+ * Basename: "bsn0"
+ * SigRl : group x sigrl
+ */
+// unsigned char sig[] = {
+0xcb, 0xc0, 0x78, 0x14, 0xbd, 0x94, 0x6f, 0xe6, 0xeb, 0x43, 0x37, 0x3b,
+0x7e, 0x22, 0x79, 0xf4, 0x4d, 0xc1, 0x55, 0x93, 0x7f, 0x5c, 0x22, 0x2f,
+0x87, 0x15, 0x18, 0x92, 0xbd, 0x23, 0x15, 0x83, 0x9e, 0x0d, 0x3b, 0x35,
+0xe9, 0xd0, 0xdd, 0xd5, 0xd8, 0x99, 0xac, 0x22, 0xaf, 0x2a, 0xa3, 0x52,
+0x25, 0xfa, 0x02, 0x50, 0x60, 0x60, 0xd3, 0x07, 0x7a, 0x59, 0xec, 0x8d,
+0xb2, 0xf6, 0x6e, 0x2d, 0x98, 0x59, 0x58, 0x94, 0x34, 0xda, 0x7a, 0x0b,
+0x66, 0xc4, 0xa5, 0x8f, 0x6a, 0x56, 0xf6, 0x91, 0x0b, 0xa8, 0x52, 0xde,
+0xb4, 0x1c, 0x36, 0xa7, 0x93, 0x6d, 0xbf, 0xd6, 0xca, 0x0e, 0x77, 0x9a,
+0xb1, 0xdf, 0xc4, 0x78, 0x61, 0x41, 0x17, 0xb2, 0x74, 0x7f, 0x92, 0xc8,
+0x26, 0x17, 0x89, 0xa0, 0x1b, 0xdb, 0x6a, 0x82, 0x1b, 0x7d, 0xb0, 0x3b,
+0x3e, 0x4e, 0x06, 0x81, 0x83, 0x3a, 0x79, 0x09, 0xba, 0xec, 0xaa, 0x96,
+0x22, 0xa9, 0xaa, 0xb3, 0x4f, 0x19, 0x9e, 0xf3, 0xed, 0x82, 0xcc, 0xf2,
+0x69, 0x4c, 0x17, 0x39, 0x27, 0xf4, 0x18, 0x98, 0x0f, 0xdc, 0xc9, 0x4e,
+0x93, 0x9c, 0x5e, 0xad, 0x77, 0xbd, 0xe2, 0x74, 0x0b, 0xa9, 0x8a, 0x8a,
+0xfc, 0xa6, 0x79, 0x0b, 0x72, 0x7b, 0x2a, 0x9b, 0xba, 0x25, 0x51, 0x06,
+0x06, 0x14, 0xc4, 0x6d, 0xa6, 0x2f, 0xf5, 0xdd, 0x3d, 0xd6, 0x49, 0x61,
+0x6c, 0x08, 0x7a, 0xff, 0x66, 0xbf, 0xf5, 0xbb, 0x08, 0x3d, 0x14, 0x89,
+0x15, 0x5a, 0xcf, 0xcd, 0x50, 0xbb, 0xab, 0x4d, 0xb2, 0xda, 0x9d, 0xac,
+0x6d, 0xee, 0xc3, 0xf7, 0x09, 0x9a, 0x84, 0xe1, 0x75, 0x2e, 0x1a, 0x7d,
+0x50, 0xa2, 0x62, 0xaf, 0xf4, 0x0a, 0x9a, 0x7c, 0x9d, 0x13, 0x0a, 0xd6,
+0x34, 0x5d, 0x97, 0xc7, 0x65, 0x2a, 0xda, 0x5e, 0xae, 0xf0, 0x6c, 0x4b,
+0x7d, 0x9f, 0x10, 0x99, 0x04, 0x1b, 0xde, 0x58, 0xe7, 0xa7, 0xa5, 0x31,
+0x0a, 0x5b, 0x51, 0x01, 0xc8, 0x65, 0x47, 0xf2, 0xbc, 0x19, 0xf2, 0xe0,
+0x7f, 0x43, 0x9d, 0x58, 0x50, 0xf2, 0xbf, 0x47, 0x94, 0xce, 0xa9, 0x50,
+0x81, 0x60, 0x72, 0x64, 0xf2, 0x6e, 0x62, 0x8b, 0x13, 0x6a, 0x95, 0x7f,
+0xf1, 0xfe, 0x3e, 0x6a, 0xc1, 0x5e, 0x59, 0x98, 0x24, 0x0b, 0xc7, 0x31,
+0x12, 0xe1, 0x96, 0x92, 0xdb, 0x39, 0x17, 0xcf, 0xb8, 0x0e, 0x02, 0xd5,
+0x3b, 0x5e, 0x8f, 0x32, 0xee, 0x58, 0x02, 0x6f, 0x9f, 0x08, 0xe1, 0xf7,
+0xe9, 0x63, 0xed, 0xae, 0xf0, 0xe5, 0x43, 0xcb, 0x31, 0x76, 0x78, 0x33,
+0x06, 0x84, 0xc2, 0x87, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03,
+0x43, 0x04, 0xf0, 0xea, 0xe0, 0xca, 0x02, 0x65, 0x22, 0xd4, 0x68, 0x5c,
+0x12, 0xfa, 0xe0, 0x39, 0x23, 0x5a, 0xde, 0x7e, 0xb2, 0xed, 0x02, 0x4f,
+0xcc, 0x10, 0xe4, 0xf7, 0x5f, 0x7d, 0x69, 0xbc, 0x6d, 0xf9, 0xe9, 0x0b,
+0x88, 0x1b, 0x60, 0xad, 0xee, 0xab, 0x56, 0xc1, 0x36, 0x44, 0x58, 0x92,
+0x28, 0x64, 0x87, 0xdc, 0x2a, 0xfb, 0x1e, 0x59, 0x24, 0xbb, 0x07, 0xf5,
+0x1c, 0x3a, 0xee, 0xe7, 0x33, 0xec, 0x48, 0xd3, 0xd3, 0x10, 0xf4, 0x0a,
+0x3c, 0xb6, 0xfd, 0x80, 0x0a, 0x95, 0x91, 0x67, 0xa6, 0x53, 0x34, 0x19,
+0x63, 0x4c, 0x4d, 0xff, 0x21, 0xe9, 0x0c, 0xc2, 0x53, 0x95, 0x27, 0xbd,
+0x7f, 0x60, 0x5f, 0x3c, 0xa6, 0x8f, 0xcb, 0xf8, 0x67, 0x91, 0xa9, 0xb9,
+0x11, 0x52, 0xa7, 0x49, 0x04, 0xde, 0x1d, 0x47, 0x4a, 0xc8, 0x9b, 0x27,
+0x31, 0x03, 0xa4, 0x4c, 0x3b, 0x29, 0xfc, 0xa4, 0x35, 0x11, 0x42, 0x86,
+0x3f, 0x67, 0x70, 0xac, 0x89, 0x66, 0x93, 0x39, 0x2a, 0xce, 0x34, 0x51,
+0xcc, 0x7d, 0x93, 0x5b, 0x0f, 0xe4, 0xbd, 0xdf, 0x70, 0xaa, 0xf2, 0x74,
+0x61, 0x2c, 0x6c, 0x63, 0x78, 0xd9, 0xf1, 0x6b, 0x41, 0x4f, 0xeb, 0xe4,
+0x25, 0x00, 0x45, 0xd4, 0xab, 0xce, 0xd2, 0x01, 0xa0, 0x18, 0xd1, 0x37,
+0x6c, 0xb1, 0xb4, 0x44, 0xef, 0x62, 0x18, 0x76, 0x2a, 0xd8, 0x56, 0x26,
+0xee, 0x6c, 0x68, 0xd9, 0xf8, 0x91, 0xd9, 0x5a, 0x10, 0x52, 0x75, 0xb0,
+0x3e, 0xe8, 0x98, 0xa9, 0x37, 0x3d, 0x18, 0x50, 0xfd, 0x7c, 0x18, 0x43,
+0xbd, 0x25, 0x4e, 0x08, 0x02, 0xc0, 0x9e, 0xa5, 0x47, 0xcb, 0x3c, 0xd4,
+0xb9, 0xe1, 0x7a, 0xdf, 0x70, 0x35, 0x7b, 0x61, 0x42, 0x1a, 0x86, 0xf0,
+0xab, 0x64, 0xf5, 0x5c, 0x5c, 0x7f, 0xfa, 0xd5, 0x73, 0x1e, 0xd6, 0x62,
+0x67, 0xad, 0xf2, 0xe7, 0x8b, 0xd0, 0xaf, 0xbb, 0x5f, 0x1f, 0xff, 0xb0,
+0xc0, 0x94, 0x6e, 0x68, 0xed, 0xc3, 0xdb, 0x8f, 0x2f, 0xeb, 0x72, 0x2c,
+0x65, 0xb8, 0x8b, 0x50, 0x2f, 0x28, 0xfa, 0xa0, 0xdd, 0x8a, 0x42, 0xd7,
+0xeb, 0xc3, 0xd2, 0x49, 0xb7, 0x56, 0x6d, 0xc1, 0x23, 0xa5, 0x8c, 0xe1,
+0x19, 0xde, 0x59, 0x46, 0xaf, 0x4e, 0x10, 0x77, 0x9c, 0x5e, 0x7f, 0x00,
+0x74, 0x83, 0x57, 0x04, 0xc1, 0xee, 0x48, 0xba, 0x13, 0xab, 0x06, 0x8b,
+0xb7, 0x07, 0xa0, 0x7c, 0x17, 0x1a, 0x62, 0xa3, 0xdf, 0x86, 0xcd, 0xd0,
+0x3a, 0xc1, 0x4f, 0x80, 0x0d, 0x64, 0x8e, 0xf8, 0xe6, 0xf9, 0xed, 0x35,
+0x26, 0xe5, 0x04, 0x3e, 0x61, 0xd9, 0x32, 0x5a, 0x5c, 0x56, 0x51, 0xb2,
+0xdf, 0xab, 0x5c, 0x7e, 0xce, 0xd6, 0xb7, 0x6d, 0x10, 0xc5, 0xb4, 0xf6,
+0x66, 0xe0, 0xb7, 0x1b, 0x36, 0x78, 0x05, 0xde, 0xa7, 0xdd, 0x93, 0xdd,
+0x6f, 0x74, 0xa6, 0xce, 0x3e, 0xb7, 0x52, 0x32, 0xdc, 0x09, 0xba, 0x25,
+0xb2, 0xc8, 0xa1, 0x6b, 0x67, 0xa3, 0xac, 0x77, 0xd9, 0xa8, 0x14, 0x09,
+0x7d, 0x2a, 0x66, 0x89, 0x3f, 0xc0, 0x3a, 0xaf, 0xef, 0x79, 0xfb, 0x38,
+0x59, 0x58, 0x78, 0xd1, 0x78, 0x73, 0x0d, 0xaf, 0x80, 0xe6, 0x2c, 0x90,
+0x21, 0x97, 0x7c, 0xa5, 0xa6, 0xe7, 0x4c, 0x30, 0xfe, 0x96, 0xea, 0x82,
+0xcd, 0x14, 0x20, 0xec, 0xc4, 0x81, 0x29, 0xec, 0x82, 0xc7, 0xfe, 0xe2,
+0x79, 0x92, 0x12, 0x61, 0x3f, 0xc8, 0xa2, 0x45, 0x2e, 0xe3, 0xe9, 0x11,
+0xfc, 0x22, 0xc3, 0xb4, 0x73, 0x5c, 0xcb, 0xc3, 0xd5, 0x24, 0x75, 0x9d,
+// }
+// unsigned int sig_len = 840;
diff --git a/epid/common-testhelper/testdata/grp_x/member0/sig_sha512_256_rndbase_msg0.inc b/epid/common-testhelper/testdata/grp_x/member0/sig_sha512_256_rndbase_msg0.inc
new file mode 100644
index 0000000..12d464b
--- /dev/null
+++ b/epid/common-testhelper/testdata/grp_x/member0/sig_sha512_256_rndbase_msg0.inc
@@ -0,0 +1,100 @@
+/*############################################################################
+ # Copyright 2017 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 Test data.
+ *
+ * Type : Intel(R) EPID 2.0 Signature
+ * Group : grpX
+ * Signer : member0
+ * HashAlg : Sha512256
+ * Message : "msg0"
+ * Basename: None (random base)
+ * SigRl : group x sigrl
+ */
+// unsigned char sig[] = {
+ 0xf9, 0x71, 0x8d, 0x87, 0x0c, 0x04, 0x6a, 0x5c, 0xea, 0x61, 0xee, 0xcd,
+ 0x41, 0x62, 0xc6, 0xc0, 0x30, 0x88, 0x34, 0x2d, 0x37, 0xd6, 0x47, 0xa8,
+ 0x39, 0xe1, 0x6a, 0xa5, 0x56, 0xae, 0x1c, 0x4f, 0x62, 0x36, 0xcb, 0x59,
+ 0x10, 0xf5, 0x81, 0x94, 0x08, 0xe6, 0xd0, 0x62, 0xab, 0x59, 0x9f, 0x29,
+ 0xc9, 0xaf, 0xe5, 0x75, 0xa5, 0xee, 0x30, 0xd8, 0x0c, 0xc4, 0x63, 0x4d,
+ 0x2a, 0x72, 0xee, 0xd4, 0xfc, 0x3a, 0xc1, 0x2a, 0xd9, 0xad, 0xb2, 0xc0,
+ 0xe1, 0x62, 0x7e, 0x01, 0xb0, 0x28, 0x2b, 0x74, 0x7d, 0xba, 0xab, 0x6a,
+ 0x12, 0x81, 0x81, 0x51, 0xad, 0x27, 0x8d, 0xc8, 0x66, 0xba, 0x29, 0xd0,
+ 0xdd, 0x0f, 0xa1, 0x41, 0xd8, 0xf7, 0xc3, 0xca, 0xcf, 0x71, 0x2d, 0xaf,
+ 0x90, 0x7b, 0x22, 0x7b, 0x63, 0x74, 0x5a, 0x74, 0x20, 0xe8, 0xa3, 0x93,
+ 0x17, 0xc4, 0x4e, 0xca, 0xf0, 0x5e, 0xc1, 0x5c, 0xd1, 0x1a, 0x6c, 0xc2,
+ 0x22, 0xdb, 0x9f, 0xff, 0x3b, 0x0c, 0x49, 0xe0, 0x22, 0x64, 0x46, 0x7a,
+ 0x87, 0x0e, 0x49, 0x42, 0x53, 0xf4, 0xbb, 0xdb, 0x6e, 0xd1, 0x15, 0xd5,
+ 0xec, 0x70, 0x6b, 0xed, 0x8c, 0x99, 0x85, 0x88, 0x77, 0xc8, 0x09, 0xb7,
+ 0x2f, 0xc4, 0x35, 0xbd, 0x0a, 0xe5, 0x3d, 0x1c, 0xd3, 0x23, 0x94, 0x07,
+ 0x42, 0x50, 0x02, 0x48, 0x5c, 0x4f, 0x22, 0x23, 0xce, 0xb8, 0x70, 0x44,
+ 0x9d, 0x55, 0xae, 0x3b, 0x4c, 0xa7, 0xe9, 0x58, 0xf7, 0x83, 0x1a, 0x11,
+ 0x97, 0x6b, 0x2b, 0x19, 0x6a, 0xf9, 0x5d, 0x45, 0x4f, 0xae, 0x6c, 0xb2,
+ 0x72, 0x40, 0xb0, 0x54, 0x6c, 0x8e, 0xbc, 0x64, 0x0c, 0x7e, 0xf5, 0x32,
+ 0x97, 0x4e, 0x2d, 0xb4, 0x88, 0x76, 0x26, 0xc5, 0x2a, 0x28, 0x5c, 0x46,
+ 0xe7, 0x1f, 0x04, 0xc0, 0xad, 0xe6, 0xcd, 0x51, 0xaf, 0x25, 0x89, 0x17,
+ 0xff, 0x3e, 0x90, 0xba, 0x8e, 0x50, 0xe5, 0x6d, 0xe6, 0x10, 0xbf, 0x99,
+ 0x56, 0x61, 0x47, 0xfb, 0xa9, 0x1a, 0x77, 0xd9, 0xdf, 0xe1, 0x62, 0x51,
+ 0xa8, 0xe1, 0x91, 0x64, 0xf4, 0x87, 0xa0, 0x1d, 0xe8, 0x46, 0x68, 0xcb,
+ 0x76, 0x9f, 0x51, 0x49, 0x7b, 0xe7, 0xfe, 0xde, 0x21, 0xb6, 0xca, 0x93,
+ 0x8b, 0x5e, 0x8e, 0x79, 0xa0, 0x9e, 0x69, 0xf3, 0xe5, 0x4d, 0x53, 0x3a,
+ 0x3b, 0x6c, 0x28, 0xe1, 0x56, 0x6a, 0xb9, 0x86, 0x0a, 0xc8, 0x81, 0xb9,
+ 0x87, 0xee, 0xe4, 0xb0, 0x41, 0x3a, 0x4a, 0x4b, 0xde, 0x39, 0x2b, 0x63,
+ 0x62, 0x2a, 0x97, 0xd6, 0x9c, 0xaa, 0xc9, 0xdd, 0x09, 0x77, 0x53, 0x5f,
+ 0xdb, 0xfe, 0x7d, 0x51, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03,
+ 0xad, 0x09, 0xe0, 0x35, 0xf5, 0xfb, 0xc9, 0xc0, 0xf4, 0x18, 0x23, 0x31,
+ 0x29, 0xed, 0xbb, 0x33, 0xf7, 0x38, 0x86, 0xe2, 0xd8, 0x69, 0x0e, 0x7d,
+ 0xf3, 0x94, 0xbb, 0xe8, 0xfb, 0xbe, 0xcd, 0xaf, 0x51, 0xd7, 0x38, 0x6b,
+ 0x52, 0x0d, 0x73, 0x0e, 0x1a, 0xda, 0x2c, 0x0c, 0xa3, 0x96, 0x00, 0x47,
+ 0x86, 0xc9, 0x59, 0xec, 0xc0, 0xe5, 0xb3, 0x36, 0xae, 0x3b, 0xd9, 0x1a,
+ 0xae, 0x73, 0x34, 0x94, 0xbd, 0x69, 0x6d, 0x36, 0xa6, 0xc4, 0x82, 0x0f,
+ 0xfa, 0xb9, 0x6b, 0x9e, 0x59, 0xb5, 0x4e, 0xe6, 0x15, 0x4f, 0x20, 0xcc,
+ 0xd4, 0x2c, 0x17, 0x29, 0xd0, 0xb1, 0x17, 0x88, 0xb4, 0xc7, 0xf3, 0xdb,
+ 0xff, 0x20, 0xa5, 0x40, 0x4b, 0x35, 0x8e, 0x03, 0x51, 0xa2, 0x18, 0x90,
+ 0x27, 0x24, 0x0b, 0x57, 0x3f, 0xb5, 0x6c, 0x97, 0x0c, 0x33, 0xe1, 0xb2,
+ 0x84, 0xbb, 0x37, 0xfc, 0x71, 0xd4, 0xb5, 0x9f, 0x51, 0xed, 0xe1, 0x59,
+ 0x14, 0x51, 0xb1, 0x9a, 0x63, 0x70, 0x3e, 0x93, 0x53, 0x52, 0x02, 0x70,
+ 0x02, 0xde, 0x05, 0xa5, 0x51, 0x85, 0x82, 0x12, 0xd2, 0x66, 0xa0, 0x41,
+ 0xae, 0x93, 0x29, 0x21, 0x9c, 0x35, 0x8f, 0xea, 0x2b, 0xee, 0xcd, 0x47,
+ 0xa8, 0xb8, 0xc1, 0x26, 0x6c, 0x73, 0x40, 0x9d, 0xdf, 0xf0, 0x67, 0x75,
+ 0x9d, 0x52, 0x5a, 0x50, 0x95, 0x57, 0xd1, 0x5d, 0x9f, 0x5f, 0x8a, 0xe8,
+ 0x1b, 0x9d, 0x65, 0x9a, 0x36, 0xe9, 0xb1, 0x6f, 0x74, 0x03, 0x18, 0x59,
+ 0x95, 0x01, 0x5a, 0x90, 0xc3, 0x95, 0x7b, 0x88, 0xa0, 0xf3, 0xdc, 0x05,
+ 0xa3, 0x95, 0xdc, 0x4b, 0x9d, 0x77, 0x5f, 0x2c, 0x43, 0x74, 0x04, 0xb7,
+ 0x56, 0xc5, 0xf7, 0x46, 0x46, 0xf8, 0x84, 0x30, 0x4b, 0x7c, 0x04, 0x89,
+ 0x73, 0xde, 0xaf, 0xb5, 0xd2, 0xbc, 0xaf, 0x30, 0xad, 0x91, 0x2d, 0x78,
+ 0x5a, 0x1f, 0x09, 0x89, 0x5f, 0xd4, 0x1f, 0x1e, 0x24, 0xe5, 0xb1, 0x2f,
+ 0xbe, 0xc3, 0x4e, 0xf4, 0x66, 0xa4, 0x84, 0x62, 0xd6, 0xcf, 0x2e, 0x89,
+ 0xf0, 0x57, 0xe7, 0xbe, 0x86, 0xe0, 0x20, 0xc0, 0x9f, 0xca, 0xd4, 0x5d,
+ 0x2e, 0x02, 0x3f, 0x8a, 0x9f, 0x8a, 0x12, 0x2e, 0x6a, 0x6c, 0x0f, 0x71,
+ 0xaa, 0x27, 0x44, 0x4f, 0xca, 0xf2, 0x56, 0x28, 0x49, 0x91, 0x9b, 0xa5,
+ 0x24, 0x91, 0x07, 0x6a, 0xfa, 0x7f, 0xdc, 0x96, 0x83, 0x81, 0x2c, 0x36,
+ 0x42, 0x8f, 0xe8, 0xf6, 0xa0, 0x42, 0x59, 0xbb, 0xd8, 0xf9, 0x17, 0x3c,
+ 0x7d, 0xd2, 0xa4, 0x9c, 0xb6, 0xcc, 0xbe, 0x0d, 0xbf, 0xc6, 0x42, 0x34,
+ 0x35, 0x6c, 0x7b, 0x8e, 0x86, 0x91, 0x40, 0x44, 0xc4, 0x13, 0xa4, 0x4b,
+ 0x4d, 0x73, 0xaf, 0xd9, 0x2e, 0xbf, 0xd2, 0x84, 0xbc, 0x74, 0x9b, 0x4f,
+ 0x63, 0x50, 0x57, 0xda, 0xe8, 0x2e, 0x10, 0x6f, 0xbb, 0x3b, 0x13, 0xc4,
+ 0xa3, 0x22, 0x6d, 0xc7, 0x42, 0x8b, 0x0c, 0xb5, 0x18, 0xe6, 0x99, 0x31,
+ 0xf7, 0xbe, 0xab, 0x42, 0x70, 0xee, 0x19, 0xea, 0x79, 0xab, 0xe4, 0xbe,
+ 0x07, 0xe5, 0xa9, 0x67, 0x78, 0xee, 0xdd, 0xf1, 0xd6, 0x94, 0x04, 0xf4,
+ 0xe2, 0x7b, 0x5a, 0xb3, 0xdd, 0x4b, 0x4f, 0x1b, 0x05, 0x41, 0x6b, 0x01,
+ 0x11, 0xf6, 0x0e, 0xec, 0x84, 0x04, 0xce, 0x9f, 0xaa, 0x9a, 0x75, 0x48,
+ 0x09, 0x3c, 0xc2, 0x0a, 0x31, 0x7f, 0x13, 0x71, 0x81, 0x20, 0x93, 0xd2,
+ 0x53, 0xce, 0xe7, 0xc6, 0x41, 0xd3, 0xfb, 0x7c, 0xc4, 0x05, 0xc6, 0x1c,
+ 0x83, 0x26, 0x00, 0x78, 0x67, 0xe5, 0xb3, 0x0a, 0x41, 0xe1, 0xec, 0x42
+// };
+// unsigned int sig_len = 840;
diff --git a/epid/common-testhelper/testdata/grp_x/member0/sig_sha512_256_rndbase_msg0_no_sigrl.inc b/epid/common-testhelper/testdata/grp_x/member0/sig_sha512_256_rndbase_msg0_no_sigrl.inc
new file mode 100644
index 0000000..3720cba
--- /dev/null
+++ b/epid/common-testhelper/testdata/grp_x/member0/sig_sha512_256_rndbase_msg0_no_sigrl.inc
@@ -0,0 +1,88 @@
+/*############################################################################
+ # Copyright 2017 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 Test data.
+ *
+ * Type : Intel(R) EPID 2.0 Signature
+ * Group : grpX
+ * Signer : member0
+ * HashAlg : Sha512256
+ * Message : "msg0"
+ * Basename: random
+ * SigRl : no sigrl
+ */
+ // unsigned char sig[] = {
+ 0xc2, 0x8c, 0xa4, 0x67, 0x82, 0xb2, 0x29, 0x10,
+ 0xe2, 0x21, 0x20, 0xf2, 0x6c, 0x10, 0x2b, 0x10,
+ 0x39, 0xea, 0x4f, 0x20, 0x6a, 0xb0, 0x2a, 0xfc,
+ 0x12, 0xba, 0xf8, 0xf7, 0x4b, 0xa6, 0x1c, 0x87,
+
+ 0x3e, 0x09, 0x74, 0xd1, 0x3a, 0x3f, 0x0e, 0x16,
+ 0x47, 0x75, 0x19, 0x2c, 0x5a, 0x90, 0xa2, 0xf3,
+ 0x5a, 0x3a, 0x17, 0xab, 0xeb, 0x0a, 0xe3, 0x41,
+ 0xd3, 0x77, 0xc2, 0xdd, 0x14, 0xcd, 0x52, 0x2c,
+
+ 0x60, 0xca, 0x87, 0x57, 0xc9, 0x91, 0x51, 0x48,
+ 0x7b, 0x48, 0x4a, 0x10, 0x81, 0xb3, 0x05, 0x77,
+ 0xdc, 0x5e, 0x1c, 0x9d, 0xcf, 0xbc, 0x18, 0x7c,
+ 0x1b, 0x97, 0x58, 0x45, 0xde, 0x2e, 0xce, 0x2c,
+
+ 0xd5, 0xa5, 0xf2, 0x79, 0x70, 0xbd, 0x72, 0x0d,
+ 0x11, 0x10, 0x60, 0x41, 0x01, 0x5c, 0x25, 0xd4,
+ 0x68, 0xa1, 0xe5, 0x86, 0x6e, 0x72, 0xa7, 0xc6,
+ 0x24, 0x22, 0x66, 0xe0, 0x63, 0x55, 0x07, 0xb9,
+
+ 0xe9, 0x6c, 0xad, 0xa7, 0xdc, 0x39, 0x5e, 0xb1,
+ 0xec, 0x7f, 0x42, 0x55, 0x60, 0x83, 0xd8, 0xda,
+ 0x9d, 0xb4, 0xb0, 0xef, 0x28, 0x37, 0x6a, 0xfd,
+ 0x65, 0xdd, 0xce, 0x93, 0x08, 0x22, 0x01, 0x19,
+
+ 0x22, 0x51, 0x58, 0x80, 0x27, 0x94, 0xaa, 0x15,
+ 0xd4, 0xff, 0xfa, 0x21, 0xd0, 0xa4, 0x07, 0x43,
+ 0xc5, 0x43, 0x16, 0x5a, 0x4b, 0x95, 0xfd, 0x4b,
+ 0xe7, 0x50, 0x7a, 0xee, 0x1e, 0x91, 0x81, 0x49,
+
+ 0xb1, 0x89, 0x7c, 0x8f, 0xed, 0x4f, 0x02, 0x66,
+ 0x52, 0xbf, 0xfb, 0x4f, 0xc7, 0x9b, 0x58, 0xb1,
+ 0x30, 0x8a, 0x00, 0x5a, 0x39, 0x99, 0x64, 0x67,
+ 0xfa, 0x7a, 0xc3, 0x62, 0xf8, 0x04, 0x4a, 0x21,
+
+ 0x9e, 0x91, 0xf9, 0x22, 0x64, 0x8c, 0x7d, 0x8e,
+ 0x7d, 0x9a, 0xe9, 0xb8, 0xd4, 0x95, 0xc6, 0x3e,
+ 0xda, 0xb3, 0xb9, 0x6b, 0x93, 0x5c, 0x21, 0x05,
+ 0x29, 0xb4, 0xbf, 0x16, 0x80, 0xc9, 0xba, 0xe2,
+
+ 0xd6, 0xf2, 0x1f, 0x4e, 0xdb, 0x1b, 0x79, 0x12,
+ 0x02, 0xb5, 0x11, 0xdf, 0x30, 0x21, 0xf4, 0x53,
+ 0xda, 0x00, 0x6b, 0xc7, 0x60, 0x6a, 0x85, 0x2a,
+ 0xfa, 0xec, 0x03, 0x0f, 0x6a, 0x2a, 0xe1, 0x60,
+
+ 0x94, 0x8f, 0x7e, 0x04, 0xea, 0x54, 0x06, 0x6c,
+ 0x0f, 0x44, 0x37, 0x89, 0xd7, 0x33, 0x76, 0x92,
+ 0xf9, 0xd4, 0x46, 0xd3, 0xbd, 0x93, 0xfe, 0x37,
+ 0x3e, 0x51, 0x0a, 0xfc, 0x8b, 0xa3, 0x2f, 0xa9,
+
+ 0xea, 0xd7, 0x8a, 0xa5, 0x2c, 0x94, 0xbe, 0xd4,
+ 0x40, 0x1f, 0xe3, 0x92, 0x7d, 0x60, 0xc3, 0x76,
+ 0x2b, 0xeb, 0x72, 0x7e, 0x0d, 0x70, 0x6c, 0xdb,
+ 0x1b, 0xa8, 0xec, 0xb6, 0x37, 0xf6, 0x8f, 0x15,
+
+ 0x00, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+// };
+// unsigned int sig_len = 360;
diff --git a/epid/common-testhelper/testdata/grp_x/sigrl_member0_sig_sha512_rndbase_msg0_revoked_middle_entry.inc b/epid/common-testhelper/testdata/grp_x/sigrl_member0_sig_sha512_rndbase_msg0_revoked_middle_entry.inc
new file mode 100644
index 0000000..9899c2b
--- /dev/null
+++ b/epid/common-testhelper/testdata/grp_x/sigrl_member0_sig_sha512_rndbase_msg0_revoked_middle_entry.inc
@@ -0,0 +1,77 @@
+/*############################################################################
+ # Copyright 2017 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 Test data.
+ *
+ * Type : Intel(R) EPID 2.0 signature based revocation list
+ * Group : grpX
+ * Revoked signature : Member0/sig_sha512_rndbase_msg0 middle entry
+ */
+//unsigned char sigrl_dat[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xee,
+ 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03,
+ 0x87, 0xe2, 0xb2, 0x6d, 0x2e, 0x6f, 0xd0, 0x1d,
+ 0x1f, 0x53, 0x11, 0xdb, 0x8f, 0x2c, 0x7f, 0x07,
+ 0xd2, 0x8b, 0x04, 0x00, 0x72, 0xae, 0x07, 0x40,
+ 0x95, 0x94, 0xc2, 0x7d, 0x25, 0x28, 0xd3, 0x3a,
+ 0x00, 0x4b, 0xa7, 0x92, 0x76, 0x3d, 0xd8, 0x51,
+ 0x32, 0x2d, 0x7b, 0x2e, 0x9d, 0x93, 0xd3, 0xfe,
+ 0x75, 0x3c, 0xf5, 0xc0, 0xbf, 0x69, 0xed, 0xc5,
+ 0xfa, 0x26, 0x5e, 0x4a, 0x6d, 0xea, 0x7d, 0xac,
+ 0x17, 0xe8, 0x8d, 0x5f, 0xcf, 0xeb, 0x35, 0x51,
+ 0x55, 0x1c, 0x41, 0x7e, 0xc9, 0x67, 0x0d, 0x87,
+ 0x25, 0x7d, 0xaa, 0x75, 0xc5, 0x2b, 0x86, 0x69,
+ 0xa3, 0x67, 0xf2, 0x95, 0x9c, 0xdb, 0x22, 0xb1,
+ 0x04, 0x0c, 0x8a, 0xae, 0x4f, 0xb3, 0xdd, 0x9b,
+ 0xb1, 0x6e, 0x79, 0x5f, 0x8f, 0xeb, 0x4a, 0x94,
+ 0x9e, 0x95, 0xf4, 0xbb, 0xb6, 0x1c, 0xe6, 0xbb,
+ 0x9c, 0x34, 0xc7, 0xa0, 0x61, 0x14, 0x3d, 0xfb,
+ 0x43, 0xa4, 0x74, 0x4b, 0xcb, 0x17, 0xfa, 0xaf,
+ 0xb8, 0x6e, 0xb4, 0xca, 0x94, 0x4d, 0xe8, 0x5b,
+ 0x40, 0x88, 0x6c, 0x9c, 0xfa, 0xba, 0x4a, 0x4c,
+ 0x65, 0x94, 0xd1, 0x17, 0x90, 0x5b, 0x66, 0x12,
+ 0x46, 0xcf, 0xcc, 0x6e, 0x47, 0x2c, 0x0c, 0xa7,
+ 0x4e, 0xb4, 0x62, 0x57, 0xdc, 0x70, 0xbb, 0xd0,
+ 0x52, 0xa7, 0x38, 0x97, 0xec, 0x34, 0x8c, 0xfd,
+ 0xe6, 0x5f, 0xa1, 0x8b, 0x8a, 0x1e, 0x0c, 0x41,
+ 0xa9, 0x86, 0x53, 0x85, 0x0e, 0xaa, 0xc2, 0x1d,
+ 0xe9, 0x42, 0x18, 0x2e, 0x1f, 0xca, 0xa0, 0x41,
+ 0x46, 0x04, 0x10, 0xb9, 0xc7, 0x15, 0x88, 0x41,
+ 0x92, 0x53, 0x7b, 0xb0, 0xc2, 0xf1, 0x96, 0x8f,
+ 0xc8, 0xe7, 0x4a, 0x43, 0x0a, 0xa2, 0x92, 0x08,
+ 0xd3, 0xdb, 0x09, 0xae, 0x31, 0x6c, 0xef, 0x9f,
+ 0xb7, 0x58, 0x4b, 0x41, 0x69, 0xf7, 0x5b, 0xbc,
+ 0x62, 0x3b, 0xa9, 0x9f, 0x4b, 0xcb, 0x17, 0x6f,
+ 0x6d, 0x5c, 0x55, 0x4b, 0xc8, 0xa4, 0x51, 0xb1,
+ 0xf3, 0xae, 0x18, 0x68, 0xaf, 0x45, 0x91, 0xe4,
+ 0x03, 0x96, 0x8c, 0x71, 0x2d, 0x7e, 0xe5, 0x96,
+ 0x03, 0x68, 0x4d, 0xc3, 0xb8, 0x59, 0x12, 0x41,
+ 0x57, 0xed, 0xcf, 0x41, 0xe4, 0xad, 0xf4, 0xcb,
+ 0x32, 0x38, 0x4c, 0x71, 0x8b, 0xa6, 0x5a, 0x4f,
+ 0x9c, 0xb7, 0x0e, 0x3c, 0x23, 0x82, 0x88, 0x95,
+ 0xc0, 0x5a, 0x5a, 0x28, 0xbe, 0xcd, 0xdc, 0xef,
+ 0x35, 0xd5, 0x83, 0x3f, 0x36, 0x88, 0x0f, 0xea,
+ 0x6e, 0x97, 0xab, 0xe2, 0x6f, 0x56, 0x67, 0x50,
+ 0x89, 0x9d, 0x40, 0xc3, 0xd9, 0x90, 0x04, 0x67,
+ 0xef, 0x1a, 0x38, 0x5d, 0xb6, 0xe4, 0xcb, 0xf1,
+ 0xf1, 0x22, 0x98, 0xb6, 0x5e, 0x4a, 0xdd, 0x71,
+ 0xb8, 0x98, 0xa6, 0x37, 0xfe, 0xd3, 0xdc, 0x0c,
+ 0x82, 0xb6, 0x6b, 0xed, 0x8b, 0x07, 0xbd, 0x0d,
+ 0xa3, 0x6b, 0x41, 0x9c, 0x26, 0xd0, 0xe5, 0xf9
+//};
+//unsigned int sigrl_dat_len = 408;
diff --git a/epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/sig_revoked0sha512_256bsn0msg0.inc b/epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/sig_revoked0sha512_256bsn0msg0.inc
new file mode 100644
index 0000000..916a4a1
--- /dev/null
+++ b/epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/sig_revoked0sha512_256bsn0msg0.inc
@@ -0,0 +1,100 @@
+/*############################################################################
+ # Copyright 2017 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 Test data.
+ *
+ * Type : Intel(R) EPID 2.0 Signature
+ * Group : grpX
+ * Signer : verrevoked/bsn0/mprivkey000
+ * HashAlg : Sha512256
+ * Message : "msg0"
+ * Basename: "bsn0"
+ * SigRl : group x sigrl
+ */
+ // unsigned char sig[] = {
+ 0x70, 0x91, 0x63, 0x2c, 0xbb, 0xfe, 0x06, 0x26, 0x5f, 0x20, 0xbd, 0x9e,
+ 0x49, 0x11, 0x31, 0xe0, 0x7c, 0x99, 0x5e, 0xa0, 0x58, 0x4f, 0x1b, 0x3f,
+ 0xb4, 0x6e, 0xcd, 0x17, 0x61, 0x79, 0xa0, 0xfd, 0x64, 0x60, 0xa4, 0xf8,
+ 0x17, 0x81, 0xc3, 0x0a, 0x4b, 0x6a, 0x72, 0x86, 0x96, 0xe3, 0xfa, 0x95,
+ 0x47, 0x45, 0xfb, 0x57, 0xef, 0xca, 0x82, 0x99, 0x72, 0xdc, 0xe6, 0x78,
+ 0xe3, 0x70, 0xa8, 0x28, 0x8b, 0xc9, 0x6e, 0xc0, 0x86, 0x04, 0x6f, 0x6c,
+ 0x89, 0xc2, 0x27, 0xfd, 0x61, 0x59, 0xb5, 0xd2, 0x73, 0x96, 0xfa, 0xd6,
+ 0xf8, 0xfa, 0x2c, 0x39, 0xfe, 0xee, 0xef, 0x3e, 0x73, 0xd2, 0x38, 0x3f,
+ 0x3c, 0x04, 0x07, 0x78, 0xfd, 0x32, 0x9b, 0xc3, 0x74, 0x90, 0xf2, 0xf5,
+ 0x50, 0xe4, 0x69, 0x5d, 0x30, 0x0c, 0x6a, 0x8a, 0x9c, 0xcf, 0xff, 0x78,
+ 0x28, 0x52, 0x6d, 0x20, 0x29, 0xef, 0x2d, 0x7a, 0xec, 0x31, 0x09, 0xa3,
+ 0x2f, 0x9a, 0x3d, 0x87, 0xa0, 0x9c, 0x7a, 0xb6, 0x25, 0x86, 0x47, 0x27,
+ 0x05, 0x14, 0x14, 0x2e, 0x72, 0xcd, 0x61, 0x0e, 0x2f, 0x3c, 0xb2, 0x83,
+ 0xdc, 0x4f, 0x3d, 0x5d, 0xa4, 0xa4, 0xcb, 0x10, 0x73, 0xf2, 0xae, 0x9f,
+ 0xae, 0x22, 0x90, 0x03, 0x69, 0xa4, 0x83, 0xf5, 0xf8, 0xf4, 0x2b, 0x59,
+ 0x50, 0xf3, 0x2a, 0x66, 0xb6, 0x2c, 0x0f, 0x23, 0x96, 0xc2, 0xee, 0x5d,
+ 0x42, 0xdf, 0x5b, 0xbc, 0x31, 0x76, 0xce, 0x8a, 0xce, 0xb0, 0x35, 0x82,
+ 0x79, 0x20, 0xee, 0xe2, 0x45, 0xf9, 0xb3, 0xc5, 0xb2, 0x59, 0xcf, 0x29,
+ 0x67, 0x3c, 0x80, 0xf8, 0x0c, 0xad, 0xe9, 0xdb, 0x26, 0x93, 0x42, 0xdd,
+ 0x9f, 0x41, 0x69, 0xd4, 0x28, 0x77, 0xfd, 0x32, 0xf3, 0x55, 0xcc, 0x10,
+ 0xbc, 0x49, 0xbc, 0xbf, 0xac, 0x87, 0xcb, 0xa0, 0xf3, 0x1a, 0xf4, 0xfd,
+ 0x28, 0xe3, 0x32, 0xee, 0xf1, 0x0c, 0x7a, 0x75, 0x20, 0xcf, 0x44, 0x17,
+ 0xd6, 0x9c, 0x87, 0x2f, 0xe7, 0xad, 0x8a, 0xc6, 0xa1, 0xea, 0x4a, 0x86,
+ 0xe0, 0x3d, 0x6f, 0x7d, 0xd1, 0xd4, 0x08, 0x9f, 0x64, 0x45, 0x7c, 0x35,
+ 0xe6, 0x5c, 0x97, 0x52, 0x58, 0xc4, 0x0a, 0xbc, 0x3c, 0x74, 0x56, 0x2c,
+ 0x2a, 0xc4, 0x4d, 0x29, 0x3d, 0xba, 0x45, 0x35, 0x55, 0x23, 0x05, 0xbf,
+ 0x0b, 0x95, 0xba, 0x06, 0x01, 0x9d, 0x31, 0xb4, 0x47, 0xa0, 0xe5, 0xf4,
+ 0xd1, 0xcd, 0x42, 0x07, 0x92, 0x60, 0x40, 0x15, 0x7d, 0x96, 0xdc, 0x1e,
+ 0xd5, 0x43, 0x85, 0xf3, 0x86, 0x8b, 0x98, 0xc6, 0x24, 0x44, 0x24, 0x77,
+ 0x54, 0x86, 0x03, 0xc4, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03,
+ 0x4d, 0xef, 0x88, 0xbf, 0xa9, 0x73, 0xfc, 0x06, 0x7e, 0x69, 0xba, 0xcc,
+ 0x30, 0xb5, 0x83, 0x33, 0x3a, 0xdd, 0xa8, 0x36, 0x95, 0x6c, 0xa5, 0x63,
+ 0xe6, 0x88, 0xbe, 0x4f, 0xa8, 0x61, 0xaf, 0x5a, 0x37, 0x48, 0x59, 0x6e,
+ 0xa8, 0x5f, 0x94, 0xc1, 0xae, 0x8d, 0xbf, 0xa2, 0x76, 0xa0, 0x3e, 0xb2,
+ 0x6b, 0x50, 0x6f, 0x84, 0x53, 0xc3, 0xd9, 0x52, 0xfc, 0x8e, 0xcb, 0x94,
+ 0x20, 0x10, 0x88, 0x8d, 0x8f, 0x77, 0xbb, 0x4c, 0xfa, 0x18, 0x2d, 0xa5,
+ 0x3e, 0x72, 0x62, 0x8f, 0x7b, 0x10, 0x99, 0x35, 0xd8, 0x9d, 0x61, 0x34,
+ 0xcd, 0xb7, 0x7f, 0x42, 0xe9, 0xe6, 0xaa, 0x7f, 0x7b, 0x8c, 0x1b, 0xa4,
+ 0xb6, 0xf7, 0xaa, 0x22, 0x2c, 0xd3, 0xff, 0x9b, 0xc0, 0xcf, 0x3e, 0x53,
+ 0xc6, 0x8f, 0x1d, 0x5f, 0x48, 0x4a, 0x6c, 0xec, 0x83, 0x6f, 0xf6, 0x4c,
+ 0xd4, 0xaf, 0x86, 0x50, 0xe2, 0x79, 0xe3, 0x64, 0xbd, 0x9d, 0xd7, 0x7b,
+ 0x83, 0xda, 0x98, 0x49, 0x4f, 0x70, 0xcf, 0xeb, 0xec, 0xa1, 0x3d, 0x40,
+ 0xc9, 0x49, 0x9a, 0x45, 0x00, 0xda, 0x7f, 0x85, 0xc1, 0x2c, 0x32, 0x5d,
+ 0x02, 0xa0, 0x57, 0x44, 0xc7, 0x1c, 0x7b, 0x1b, 0xa3, 0xf0, 0x9c, 0xbc,
+ 0xfd, 0x7d, 0x0c, 0x52, 0xc2, 0x07, 0x83, 0x9b, 0xd0, 0x26, 0x10, 0xec,
+ 0x9f, 0x54, 0x5d, 0xd7, 0x46, 0xb4, 0x2e, 0xe1, 0x76, 0xa1, 0x53, 0x18,
+ 0x06, 0x25, 0x91, 0x0a, 0xb8, 0xc2, 0x61, 0x9d, 0x0f, 0xa9, 0x5c, 0xb9,
+ 0x9d, 0xdd, 0x2b, 0xe3, 0x40, 0xab, 0x45, 0xd0, 0xfe, 0x9b, 0xc2, 0xa2,
+ 0xee, 0x19, 0xa8, 0xbb, 0xf0, 0x2b, 0x63, 0x98, 0x86, 0xc3, 0x2d, 0xbc,
+ 0x6c, 0x24, 0x0e, 0xd4, 0x8f, 0xca, 0x4a, 0xca, 0xa8, 0x83, 0x7f, 0x22,
+ 0x40, 0x54, 0x0f, 0xeb, 0x97, 0xfe, 0x4b, 0x78, 0xd9, 0xc5, 0x3f, 0x79,
+ 0x23, 0x5c, 0xc0, 0xd7, 0x7b, 0x0c, 0xa0, 0xce, 0x54, 0x96, 0x44, 0x81,
+ 0x68, 0xd2, 0x36, 0x5f, 0x56, 0x3d, 0xed, 0xaa, 0xa4, 0xff, 0x59, 0x3a,
+ 0x76, 0x0f, 0x9b, 0x29, 0xa8, 0x9c, 0x58, 0x1a, 0x93, 0x31, 0x3a, 0x9b,
+ 0xd1, 0x9c, 0xf3, 0xd1, 0x83, 0xf0, 0xb2, 0xf5, 0x4a, 0x0a, 0x24, 0xb4,
+ 0x60, 0x76, 0x4a, 0x11, 0x93, 0x24, 0x2e, 0xcb, 0x6d, 0x40, 0x76, 0x7f,
+ 0xb6, 0xd3, 0x1a, 0x12, 0x95, 0x6d, 0x47, 0xad, 0xed, 0xe7, 0x11, 0xce,
+ 0x13, 0x1b, 0x28, 0x5c, 0x45, 0xd1, 0x33, 0x71, 0xe8, 0x68, 0xb1, 0x45,
+ 0xd2, 0x56, 0x5a, 0xe0, 0xde, 0x8c, 0x60, 0x2f, 0x22, 0x29, 0x8f, 0x34,
+ 0x6f, 0xba, 0xf5, 0xb3, 0x00, 0x0f, 0xd9, 0xcb, 0xb5, 0x02, 0x58, 0x1a,
+ 0x27, 0x09, 0x8d, 0x88, 0x6e, 0x60, 0x7e, 0x89, 0x0b, 0x1d, 0xb8, 0x01,
+ 0x1c, 0x82, 0x2f, 0x39, 0x2c, 0x3f, 0xa0, 0x23, 0x72, 0x84, 0xb7, 0xb1,
+ 0x8c, 0x12, 0xd0, 0xfb, 0x4d, 0xff, 0xb9, 0x7f, 0xbc, 0x31, 0x11, 0x57,
+ 0xa0, 0x7e, 0x67, 0x43, 0xd8, 0x6a, 0x2c, 0x25, 0x79, 0x3f, 0x9a, 0x54,
+ 0xeb, 0x6f, 0x4a, 0xb9, 0xc2, 0x45, 0xfd, 0x03, 0x97, 0x14, 0x67, 0xf3,
+ 0x39, 0x08, 0xda, 0x92, 0x08, 0x2b, 0xe2, 0xe3, 0xc2, 0x68, 0x9b, 0x36,
+ 0xaf, 0xf1, 0x16, 0xde, 0x0f, 0x28, 0xd2, 0xc1, 0xeb, 0x2f, 0x99, 0x3c,
+ 0xa5, 0xa1, 0x54, 0x38, 0x25, 0x55, 0x1f, 0x94, 0xf1, 0xbf, 0xcd, 0x60,
+ 0xc0, 0x3b, 0x97, 0xbc, 0x36, 0x20, 0xd1, 0xfe, 0x61, 0xb1, 0x1a, 0x8f,
+ 0x56, 0xe6, 0xdf, 0xdb, 0x06, 0x4f, 0x78, 0xa9, 0xa7, 0xcb, 0x1c, 0x1c
+// };
+// unsigned int sig_len = 840;
diff --git a/epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/sig_revoked1sha512_256bsn0msg0.inc b/epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/sig_revoked1sha512_256bsn0msg0.inc
new file mode 100644
index 0000000..9fe16fd
--- /dev/null
+++ b/epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/sig_revoked1sha512_256bsn0msg0.inc
@@ -0,0 +1,100 @@
+/*############################################################################
+ # Copyright 2017 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 Test data.
+ *
+ * Type : Intel(R) EPID 2.0 Signature
+ * Group : grpX
+ * Signer : verrevoked/bsn0/mprivkey001
+ * HashAlg : Sha512256
+ * Message : "msg0"
+ * Basename: "bsn0"
+ * SigRl : group x sigrl
+ */
+ // unsigned char sig[] = {
+ 0x70, 0x91, 0x63, 0x2c, 0xbb, 0xfe, 0x06, 0x26, 0x5f, 0x20, 0xbd, 0x9e,
+ 0x49, 0x11, 0x31, 0xe0, 0x7c, 0x99, 0x5e, 0xa0, 0x58, 0x4f, 0x1b, 0x3f,
+ 0xb4, 0x6e, 0xcd, 0x17, 0x61, 0x79, 0xa0, 0xfd, 0x64, 0x60, 0xa4, 0xf8,
+ 0x17, 0x81, 0xc3, 0x0a, 0x4b, 0x6a, 0x72, 0x86, 0x96, 0xe3, 0xfa, 0x95,
+ 0x47, 0x45, 0xfb, 0x57, 0xef, 0xca, 0x82, 0x99, 0x72, 0xdc, 0xe6, 0x78,
+ 0xe3, 0x70, 0xa8, 0x28, 0x07, 0x46, 0xed, 0xb8, 0x6a, 0x4e, 0x7f, 0x4b,
+ 0x9d, 0xcc, 0x18, 0x91, 0x88, 0xf6, 0x76, 0x4d, 0x74, 0x02, 0x36, 0x62,
+ 0xe6, 0xd4, 0xb5, 0xf0, 0x2d, 0x70, 0x91, 0x49, 0x65, 0xdf, 0x19, 0x02,
+ 0x30, 0x6c, 0x11, 0xaa, 0x74, 0x8c, 0x55, 0x2e, 0x4b, 0xa3, 0x00, 0x00,
+ 0xb0, 0x38, 0xf4, 0xcd, 0x5d, 0xc9, 0x1d, 0xaa, 0x1e, 0x44, 0x98, 0xa4,
+ 0xe1, 0x3f, 0x2f, 0x4f, 0x6c, 0xc9, 0x15, 0xb0, 0xe6, 0x70, 0x62, 0x2c,
+ 0x21, 0xf0, 0xa3, 0x7b, 0x32, 0x5f, 0x96, 0xc7, 0x19, 0xef, 0x7b, 0x14,
+ 0xf2, 0x52, 0xaa, 0xc8, 0x16, 0x81, 0x71, 0xdb, 0x53, 0x07, 0x1f, 0x52,
+ 0x5b, 0x7b, 0xa9, 0x7a, 0x4f, 0x92, 0x1e, 0xda, 0x24, 0xc0, 0xdd, 0xcb,
+ 0x19, 0xb0, 0x4a, 0x8c, 0x25, 0x7a, 0x18, 0x62, 0x34, 0x23, 0x93, 0xb4,
+ 0xeb, 0x14, 0xd4, 0x4d, 0x4d, 0xbd, 0xf1, 0x88, 0xf5, 0xb0, 0xa4, 0x8f,
+ 0x82, 0x03, 0x3d, 0x95, 0x58, 0x4c, 0xd8, 0x7b, 0xe9, 0xac, 0x40, 0x25,
+ 0x5b, 0xba, 0xa5, 0x36, 0x36, 0xf5, 0x5c, 0xff, 0xd1, 0x55, 0x89, 0x85,
+ 0x74, 0xf6, 0xf8, 0x0d, 0x2c, 0x3a, 0x94, 0x5e, 0x6d, 0xd6, 0x07, 0x99,
+ 0x07, 0x2e, 0x4f, 0x89, 0x3f, 0x33, 0x2e, 0xe8, 0x20, 0x20, 0xcf, 0xea,
+ 0x80, 0xbc, 0x33, 0xe4, 0x4e, 0xc6, 0xdf, 0x7f, 0xff, 0x20, 0x33, 0x2d,
+ 0x09, 0x29, 0x66, 0x2f, 0xf1, 0xbb, 0xea, 0xe8, 0x7a, 0x95, 0x4b, 0x35,
+ 0xab, 0xb4, 0x50, 0xc1, 0xdc, 0x34, 0x42, 0x49, 0x5b, 0xf4, 0x85, 0xb3,
+ 0xe1, 0xce, 0xf4, 0x0a, 0xbd, 0x6a, 0xde, 0xad, 0x35, 0xef, 0xef, 0x18,
+ 0xea, 0x89, 0x0c, 0x80, 0x7e, 0x26, 0xd8, 0xc5, 0x6e, 0x55, 0x06, 0xb0,
+ 0xf4, 0x25, 0x4e, 0x3e, 0x4b, 0x5a, 0xea, 0x08, 0x3b, 0xe4, 0xcc, 0x3f,
+ 0x87, 0x6a, 0xd3, 0xb7, 0x29, 0x54, 0xdc, 0x89, 0xf8, 0x3d, 0x4f, 0x1b,
+ 0xd0, 0x8d, 0xe9, 0x03, 0x4e, 0xba, 0x15, 0x3a, 0xc0, 0xf5, 0xbf, 0x47,
+ 0x68, 0x4b, 0x45, 0xb0, 0x7d, 0x9b, 0x57, 0x87, 0xf5, 0x07, 0x9a, 0xad,
+ 0x4e, 0x0d, 0xaa, 0xe9, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03,
+ 0x93, 0x28, 0xdc, 0xca, 0x44, 0xca, 0xd1, 0x3b, 0x05, 0x4e, 0x68, 0xfb,
+ 0x37, 0xee, 0x91, 0xf0, 0x46, 0x7e, 0x33, 0xa5, 0xae, 0x5f, 0xd9, 0x3c,
+ 0x37, 0x7e, 0xe2, 0x9a, 0x6e, 0xfa, 0x91, 0x9f, 0xd8, 0x43, 0x75, 0xa7,
+ 0x8b, 0x18, 0x0b, 0x25, 0x5d, 0x46, 0x94, 0x72, 0xc0, 0x19, 0x8c, 0x42,
+ 0x1c, 0xbc, 0x5f, 0xa9, 0x67, 0xbf, 0x55, 0x84, 0x6e, 0x2b, 0x4b, 0x6f,
+ 0xeb, 0x42, 0x67, 0xb8, 0x42, 0xcc, 0xa7, 0xa2, 0x38, 0xf8, 0x6c, 0xf9,
+ 0x1c, 0xe3, 0xdb, 0xa2, 0x31, 0x6d, 0xd5, 0x5e, 0xe9, 0xb6, 0xef, 0xf9,
+ 0x7f, 0x20, 0x51, 0x45, 0x7d, 0x8c, 0xb6, 0x47, 0xed, 0xcf, 0x9f, 0x57,
+ 0x61, 0x44, 0x2e, 0x25, 0xb2, 0x4e, 0xea, 0x36, 0x0d, 0x32, 0xa2, 0x46,
+ 0xbe, 0xf8, 0xa9, 0xbb, 0x61, 0x11, 0x56, 0xc6, 0x15, 0xf2, 0xdd, 0x35,
+ 0xb4, 0xa2, 0x31, 0xba, 0x04, 0xd4, 0x4d, 0x36, 0xa0, 0x79, 0x37, 0x53,
+ 0x94, 0x91, 0x37, 0x56, 0xe1, 0xed, 0xdb, 0x67, 0x73, 0x69, 0xad, 0xf2,
+ 0x0b, 0xb2, 0x37, 0xbb, 0x44, 0xd0, 0xd9, 0x19, 0x0c, 0x9b, 0xd4, 0xb0,
+ 0x3f, 0x16, 0x2b, 0x2f, 0x41, 0x10, 0xdf, 0xea, 0x98, 0x36, 0xc1, 0xc1,
+ 0xca, 0x12, 0x46, 0x30, 0xcd, 0xad, 0x07, 0x18, 0x24, 0x54, 0x55, 0xb7,
+ 0x85, 0x3f, 0x5a, 0x35, 0x10, 0xf8, 0xf9, 0x96, 0xca, 0x0b, 0xbb, 0xf6,
+ 0x37, 0x76, 0x3a, 0xd8, 0x73, 0xec, 0x86, 0xf8, 0x5b, 0xdd, 0xae, 0x01,
+ 0x83, 0xc8, 0x0e, 0x6e, 0x18, 0x23, 0x63, 0x34, 0x0f, 0x09, 0xf0, 0x65,
+ 0x35, 0xad, 0xbe, 0x88, 0x97, 0x04, 0x39, 0x45, 0x90, 0x2a, 0xbd, 0x5d,
+ 0x96, 0x33, 0xdb, 0x04, 0xa0, 0xa1, 0x7b, 0x79, 0x25, 0xa1, 0x8f, 0x37,
+ 0xfc, 0xef, 0x68, 0x2a, 0xf7, 0xa8, 0x8a, 0x26, 0x56, 0xf1, 0xf4, 0x77,
+ 0x11, 0xa0, 0x39, 0xf5, 0xb6, 0x02, 0x2e, 0x7e, 0xa9, 0xfe, 0x9e, 0x49,
+ 0xb6, 0x6d, 0xd6, 0xf4, 0x34, 0xe6, 0xe2, 0x85, 0xc5, 0x64, 0xfc, 0xa0,
+ 0x1a, 0xf5, 0xed, 0xed, 0xde, 0xa9, 0x67, 0xcd, 0xf4, 0x97, 0x27, 0xa9,
+ 0xe8, 0x30, 0xeb, 0x81, 0x85, 0xe6, 0x1f, 0x0b, 0xb5, 0x79, 0xee, 0x4b,
+ 0x20, 0xbb, 0x77, 0xd5, 0x45, 0x08, 0xf5, 0xb9, 0x7d, 0xbd, 0xac, 0x82,
+ 0x78, 0xd9, 0x07, 0xde, 0x72, 0x9c, 0xe1, 0xc9, 0x8a, 0x45, 0x15, 0xb3,
+ 0x6f, 0xc7, 0xc7, 0xee, 0x78, 0x4d, 0x05, 0x70, 0xd4, 0x24, 0xc5, 0x24,
+ 0x20, 0x0e, 0xbc, 0xfa, 0xfc, 0xa7, 0x09, 0x14, 0x5c, 0xb4, 0x8a, 0xe7,
+ 0x4d, 0xb0, 0xa0, 0x6a, 0xc1, 0x50, 0x87, 0xbd, 0xc9, 0x9e, 0x67, 0xcb,
+ 0xc9, 0xf6, 0x8d, 0xc8, 0x8d, 0xee, 0x61, 0x81, 0xf6, 0xef, 0x60, 0x68,
+ 0x19, 0xc5, 0x0d, 0x67, 0x55, 0x24, 0xa8, 0x12, 0x84, 0xe7, 0x70, 0x86,
+ 0xf2, 0x99, 0x06, 0x0e, 0xfc, 0xfe, 0x08, 0x58, 0x56, 0xd8, 0xc1, 0x6d,
+ 0xab, 0xda, 0x90, 0xf5, 0x53, 0xda, 0x2d, 0x72, 0xe2, 0xf7, 0xdc, 0x0c,
+ 0x9d, 0x61, 0x9c, 0x91, 0xff, 0xc1, 0x67, 0xe0, 0x31, 0xc3, 0xbf, 0x10,
+ 0x0a, 0xce, 0x6c, 0xb5, 0x7f, 0x5d, 0xcc, 0x17, 0xaa, 0x57, 0xd9, 0x36,
+ 0xd0, 0x50, 0xfe, 0xc8, 0x24, 0x5d, 0x6e, 0xb5, 0x91, 0xc4, 0x8c, 0xf1,
+ 0x08, 0x50, 0xf3, 0x76, 0x29, 0xc6, 0x94, 0x04, 0xf8, 0x97, 0xa8, 0xa5,
+ 0x1b, 0x52, 0x4c, 0xd9, 0xc0, 0xcc, 0xe4, 0x00, 0xe1, 0x1f, 0xba, 0x6b,
+ 0xf5, 0x2c, 0x61, 0x53, 0x8b, 0x12, 0x04, 0xa0, 0x4c, 0xdd, 0x93, 0xff
+// };
+// unsigned int sig_len = 840;
diff --git a/epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/sig_revoked2sha512_256bsn0msg0.inc b/epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/sig_revoked2sha512_256bsn0msg0.inc
new file mode 100644
index 0000000..82425b4
--- /dev/null
+++ b/epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/sig_revoked2sha512_256bsn0msg0.inc
@@ -0,0 +1,100 @@
+/*############################################################################
+ # Copyright 2017 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 Test data.
+ *
+ * Type : Intel(R) EPID 2.0 Signature
+ * Group : grpX
+ * Signer : verrevoked/bsn0/mprivkey002
+ * HashAlg : Sha512256
+ * Message : "msg0"
+ * Basename: "bsn0"
+ * SigRl : group x sigrl
+ */
+ // unsigned char sig[] = {
+ 0x70, 0x91, 0x63, 0x2c, 0xbb, 0xfe, 0x06, 0x26, 0x5f, 0x20, 0xbd, 0x9e,
+ 0x49, 0x11, 0x31, 0xe0, 0x7c, 0x99, 0x5e, 0xa0, 0x58, 0x4f, 0x1b, 0x3f,
+ 0xb4, 0x6e, 0xcd, 0x17, 0x61, 0x79, 0xa0, 0xfd, 0x64, 0x60, 0xa4, 0xf8,
+ 0x17, 0x81, 0xc3, 0x0a, 0x4b, 0x6a, 0x72, 0x86, 0x96, 0xe3, 0xfa, 0x95,
+ 0x47, 0x45, 0xfb, 0x57, 0xef, 0xca, 0x82, 0x99, 0x72, 0xdc, 0xe6, 0x78,
+ 0xe3, 0x70, 0xa8, 0x28, 0x8c, 0x10, 0x2f, 0x17, 0xa0, 0xe4, 0x1f, 0xc6,
+ 0xaa, 0xea, 0xd4, 0x82, 0x67, 0x61, 0x96, 0x47, 0x9b, 0x46, 0x2c, 0x31,
+ 0xbd, 0x29, 0x62, 0x2d, 0xd8, 0x40, 0x44, 0xbc, 0x1d, 0xf0, 0x19, 0x02,
+ 0x4e, 0x4c, 0x2e, 0xc1, 0x0d, 0x43, 0x59, 0x8b, 0xe0, 0x0d, 0xb4, 0x29,
+ 0x20, 0x35, 0x1f, 0xb6, 0x00, 0x07, 0xa3, 0xd9, 0x28, 0xd9, 0x48, 0x08,
+ 0x5e, 0x14, 0xca, 0x56, 0x72, 0xa4, 0xb6, 0x5a, 0xbf, 0xaa, 0xfd, 0x90,
+ 0x46, 0xfb, 0xac, 0x86, 0x7c, 0x1d, 0xcd, 0x22, 0x48, 0xfb, 0xca, 0xa5,
+ 0x88, 0xfd, 0x8c, 0x3b, 0x3a, 0x16, 0xa6, 0x98, 0x77, 0x44, 0x45, 0xcc,
+ 0x03, 0x50, 0xf1, 0x76, 0x8f, 0x06, 0x81, 0x12, 0x4d, 0x5c, 0x58, 0x23,
+ 0xdb, 0x88, 0x1c, 0x40, 0x79, 0xa8, 0x5b, 0x31, 0x72, 0x76, 0x4f, 0x9b,
+ 0x34, 0x6e, 0x38, 0x1a, 0x5b, 0xda, 0xac, 0x1d, 0xf4, 0x6b, 0x89, 0xd8,
+ 0x64, 0xd7, 0x63, 0x80, 0x47, 0x59, 0x0b, 0xd0, 0xb6, 0x0d, 0xaf, 0x83,
+ 0x72, 0xac, 0xb5, 0x45, 0xce, 0xaf, 0x49, 0x61, 0x24, 0xb1, 0xcc, 0x75,
+ 0x6b, 0x48, 0x19, 0x5f, 0x49, 0x54, 0x66, 0xa4, 0x09, 0x73, 0x0c, 0x9a,
+ 0x1f, 0x9c, 0x2a, 0xf0, 0x03, 0x10, 0xf1, 0x9d, 0x6f, 0xf7, 0xa4, 0xf2,
+ 0x19, 0x01, 0x90, 0xfa, 0x5b, 0xa0, 0x89, 0xf9, 0xc2, 0x00, 0xc2, 0xed,
+ 0x53, 0xca, 0x0c, 0xfc, 0x54, 0x0f, 0x09, 0xa3, 0x0c, 0x4e, 0x8d, 0xf6,
+ 0x81, 0x9f, 0x2b, 0x0a, 0x09, 0x09, 0x2c, 0x1d, 0xb0, 0x39, 0x72, 0xd9,
+ 0x46, 0xe2, 0xf3, 0xfc, 0xa1, 0xb9, 0x4a, 0x46, 0xe4, 0x6e, 0xb5, 0x55,
+ 0x57, 0x5a, 0x3f, 0xa3, 0x84, 0x28, 0x2f, 0x77, 0x3c, 0x90, 0x0f, 0x66,
+ 0xc9, 0x9f, 0xb4, 0x51, 0xe3, 0x6f, 0x27, 0x73, 0xb0, 0xf3, 0x2e, 0xdf,
+ 0x94, 0x0a, 0x22, 0xf5, 0xdf, 0xaf, 0xa7, 0x94, 0x0f, 0x14, 0xb5, 0x05,
+ 0x76, 0x05, 0x5e, 0xb5, 0x15, 0xb5, 0x34, 0x99, 0xcb, 0xff, 0xbe, 0xf7,
+ 0xd2, 0x12, 0xc8, 0x58, 0xdb, 0x33, 0x28, 0xa9, 0xc1, 0xc6, 0x23, 0x07,
+ 0xbc, 0x50, 0xc4, 0xdd, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03,
+ 0x45, 0xd2, 0xd0, 0xb3, 0x22, 0xd3, 0xf2, 0x8b, 0x01, 0x6e, 0xba, 0xfa,
+ 0x0f, 0xac, 0x4c, 0x80, 0x29, 0x2c, 0xd0, 0x1d, 0x48, 0x99, 0x0a, 0xd2,
+ 0x78, 0x2b, 0x52, 0xd4, 0xe3, 0xbf, 0x12, 0xb9, 0x95, 0x45, 0x4a, 0x47,
+ 0xf4, 0x20, 0xd0, 0xa3, 0xc4, 0x55, 0x82, 0x1e, 0x6a, 0xbe, 0x00, 0x86,
+ 0x9c, 0x94, 0xe3, 0xd6, 0xac, 0xb5, 0x51, 0x25, 0x08, 0x5d, 0x0d, 0xf2,
+ 0x39, 0x37, 0x95, 0x88, 0xc9, 0xeb, 0xbe, 0xd5, 0xce, 0xff, 0x9b, 0x33,
+ 0x4e, 0xd0, 0xcc, 0x91, 0x2e, 0xf4, 0x5f, 0x0d, 0x0b, 0x9f, 0x93, 0xb7,
+ 0x63, 0xd1, 0x0f, 0x32, 0xd0, 0x64, 0x37, 0x42, 0x0c, 0x08, 0xc5, 0x3c,
+ 0xdf, 0xc3, 0xb0, 0xec, 0x8f, 0x51, 0xdc, 0x58, 0xe9, 0x99, 0xad, 0x58,
+ 0x58, 0x89, 0xa4, 0x35, 0xca, 0xc8, 0x14, 0xc0, 0x93, 0x78, 0x36, 0x08,
+ 0x3a, 0xf0, 0xac, 0x03, 0x20, 0x51, 0x59, 0x7e, 0x4c, 0x28, 0x3c, 0xf8,
+ 0x48, 0x9e, 0x91, 0x3a, 0xd4, 0x3b, 0xf4, 0xa9, 0x49, 0x7c, 0x61, 0x50,
+ 0x9c, 0xa5, 0xf1, 0xed, 0xc7, 0xb3, 0xbe, 0xca, 0x9e, 0x9a, 0x30, 0x91,
+ 0x77, 0x64, 0x5d, 0xdd, 0xf6, 0x83, 0x22, 0x63, 0x79, 0x52, 0xe9, 0x88,
+ 0xe8, 0x92, 0x64, 0x09, 0x0f, 0xa3, 0xbf, 0x77, 0x84, 0x37, 0x8e, 0xda,
+ 0xa8, 0xac, 0x9e, 0xfc, 0x49, 0xcf, 0x70, 0x2e, 0xe3, 0x2b, 0xdb, 0x11,
+ 0x0a, 0x6b, 0x5b, 0xc2, 0xa2, 0x0b, 0x2e, 0xa3, 0xa5, 0xed, 0x77, 0x1b,
+ 0xb5, 0x75, 0xe1, 0x8b, 0xec, 0x59, 0xbf, 0x80, 0xbb, 0x96, 0x80, 0xc2,
+ 0x1a, 0x57, 0x01, 0x9e, 0x1d, 0xdf, 0xcf, 0xf6, 0x86, 0x9e, 0x38, 0xed,
+ 0x46, 0xfa, 0x88, 0x1c, 0xcf, 0x56, 0xcc, 0x61, 0xe3, 0x8c, 0x06, 0xbb,
+ 0x80, 0xd4, 0xc4, 0x40, 0x3c, 0xa8, 0xce, 0x02, 0xc8, 0xb5, 0x2b, 0x5c,
+ 0xd2, 0xee, 0xd6, 0xc9, 0x4e, 0x5c, 0x82, 0x40, 0x00, 0xa5, 0xa8, 0x89,
+ 0x77, 0x4e, 0xa7, 0xd3, 0xa2, 0x0e, 0xc0, 0xb8, 0xfa, 0xa3, 0xdd, 0x53,
+ 0x12, 0x1d, 0x45, 0x04, 0x87, 0xd7, 0xe3, 0xd2, 0x99, 0x6f, 0xbe, 0xb4,
+ 0xb3, 0xb0, 0x35, 0x99, 0x22, 0xb8, 0x91, 0x83, 0x0d, 0x0a, 0xf6, 0x2c,
+ 0x51, 0x4c, 0xb8, 0xe5, 0x4a, 0x75, 0xca, 0xda, 0xd7, 0x3d, 0x8f, 0x0a,
+ 0x04, 0x04, 0xf8, 0x55, 0xb8, 0x01, 0xb7, 0xff, 0xf7, 0xed, 0x0a, 0x4b,
+ 0x62, 0x94, 0x79, 0x3d, 0x29, 0x1f, 0xfc, 0x40, 0xd1, 0xd2, 0x29, 0xbe,
+ 0x5d, 0x99, 0x3c, 0x04, 0xee, 0xa9, 0x20, 0x08, 0xea, 0xad, 0x08, 0x3d,
+ 0x8d, 0x35, 0x7f, 0x7c, 0x51, 0xf2, 0xe2, 0x00, 0x3e, 0x47, 0x7a, 0x98,
+ 0x53, 0x70, 0x23, 0xc2, 0xa0, 0x6d, 0x81, 0xc1, 0x78, 0xb0, 0xff, 0xfb,
+ 0xaf, 0xe4, 0x66, 0x4e, 0x7b, 0x79, 0xcd, 0x77, 0x09, 0x7b, 0x0e, 0x64,
+ 0xad, 0x30, 0xe2, 0x03, 0xe1, 0xed, 0x29, 0xa0, 0xb7, 0x8f, 0xa4, 0x62,
+ 0xc0, 0x09, 0xa8, 0xae, 0x8e, 0xf9, 0x91, 0x74, 0x2a, 0xf2, 0x87, 0x3b,
+ 0x0e, 0x02, 0x4e, 0x19, 0xb7, 0xef, 0xc8, 0x7e, 0x53, 0x40, 0x59, 0x9b,
+ 0x6e, 0x91, 0xcb, 0xcb, 0x8e, 0x80, 0xfd, 0x8e, 0x11, 0x94, 0xd3, 0x93,
+ 0x22, 0x6b, 0x7d, 0xbd, 0xa5, 0x1f, 0xa8, 0xf5, 0x64, 0x55, 0x31, 0xa6,
+ 0xd4, 0x21, 0x38, 0xfb, 0x8c, 0xc5, 0xaa, 0x1c, 0x71, 0x5f, 0xb6, 0x3f,
+ 0x3c, 0x0f, 0x3b, 0x66, 0xbf, 0x18, 0x69, 0xaa, 0x98, 0x84, 0x8d, 0x8c,
+ 0x5d, 0xa8, 0xec, 0x6f, 0x77, 0x41, 0x48, 0xfa, 0x25, 0x7d, 0x53, 0x54
+// };
+// unsigned int sig_len = 840;
diff --git a/epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/verrl_sha512_256.inc b/epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/verrl_sha512_256.inc
new file mode 100644
index 0000000..0159bbf
--- /dev/null
+++ b/epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/verrl_sha512_256.inc
@@ -0,0 +1,68 @@
+/*############################################################################
+ # Copyright 2017 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 Test data.
+ *
+ * Type : Intel(R) EPID 2.0 verifier revocation list
+ * Group : grpX
+ * Bsn : "bsn0"
+ * HashAlg : Sha512256
+ * Revoked : verrevoked/mprivatekey000
+ * verrevoked/mprivatekey001
+ * verrevoked/mprivatekey002
+ */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xee,
+
+ // B
+ 0xcb, 0xc0, 0x78, 0x14, 0xbd, 0x94, 0x6f, 0xe6,
+ 0xeb, 0x43, 0x37, 0x3b, 0x7e, 0x22, 0x79, 0xf4,
+ 0x4d, 0xc1, 0x55, 0x93, 0x7f, 0x5c, 0x22, 0x2f,
+ 0x87, 0x15, 0x18, 0x92, 0xbd, 0x23, 0x15, 0x83,
+ 0x9e, 0x0d, 0x3b, 0x35, 0xe9, 0xd0, 0xdd, 0xd5,
+ 0xd8, 0x99, 0xac, 0x22, 0xaf, 0x2a, 0xa3, 0x52,
+ 0x25, 0xfa, 0x02, 0x50, 0x60, 0x60, 0xd3, 0x07,
+ 0x7a, 0x59, 0xec, 0x8d, 0xb2, 0xf6, 0x6e, 0x2d,
+ // version | n4
+ 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03,
+
+ 0x8b, 0xc9, 0x6e, 0xc0, 0x86, 0x04, 0x6f, 0x6c,
+ 0x89, 0xc2, 0x27, 0xfd, 0x61, 0x59, 0xb5, 0xd2,
+ 0x73, 0x96, 0xfa, 0xd6, 0xf8, 0xfa, 0x2c, 0x39,
+ 0xfe, 0xee, 0xef, 0x3e, 0x73, 0xd2, 0x38, 0x3f,
+ 0x3c, 0x04, 0x07, 0x78, 0xfd, 0x32, 0x9b, 0xc3,
+ 0x74, 0x90, 0xf2, 0xf5, 0x50, 0xe4, 0x69, 0x5d,
+ 0x30, 0x0c, 0x6a, 0x8a, 0x9c, 0xcf, 0xff, 0x78,
+ 0x28, 0x52, 0x6d, 0x20, 0x29, 0xef, 0x2d, 0x7a,
+
+ 0x07, 0x46, 0xed, 0xb8, 0x6a, 0x4e, 0x7f, 0x4b,
+ 0x9d, 0xcc, 0x18, 0x91, 0x88, 0xf6, 0x76, 0x4d,
+ 0x74, 0x02, 0x36, 0x62, 0xe6, 0xd4, 0xb5, 0xf0,
+ 0x2d, 0x70, 0x91, 0x49, 0x65, 0xdf, 0x19, 0x02,
+ 0x30, 0x6c, 0x11, 0xaa, 0x74, 0x8c, 0x55, 0x2e,
+ 0x4b, 0xa3, 0x00, 0x00, 0xb0, 0x38, 0xf4, 0xcd,
+ 0x5d, 0xc9, 0x1d, 0xaa, 0x1e, 0x44, 0x98, 0xa4,
+ 0xe1, 0x3f, 0x2f, 0x4f, 0x6c, 0xc9, 0x15, 0xb0,
+
+ 0x8c, 0x10, 0x2f, 0x17, 0xa0, 0xe4, 0x1f, 0xc6,
+ 0xaa, 0xea, 0xd4, 0x82, 0x67, 0x61, 0x96, 0x47,
+ 0x9b, 0x46, 0x2c, 0x31, 0xbd, 0x29, 0x62, 0x2d,
+ 0xd8, 0x40, 0x44, 0xbc, 0x1d, 0xf0, 0x19, 0x02,
+ 0x4e, 0x4c, 0x2e, 0xc1, 0x0d, 0x43, 0x59, 0x8b,
+ 0xe0, 0x0d, 0xb4, 0x29, 0x20, 0x35, 0x1f, 0xb6,
+ 0x00, 0x07, 0xa3, 0xd9, 0x28, 0xd9, 0x48, 0x08,
+ 0x5e, 0x14, 0xca, 0x56, 0x72, 0xa4, 0xb6, 0x5a,
diff --git a/epid/common-testhelper/unittests/bignum_wrapper-test.cc b/epid/common-testhelper/unittests/bignum_wrapper-test.cc
index 83dba24..318532c 100644
--- a/epid/common-testhelper/unittests/bignum_wrapper-test.cc
+++ b/epid/common-testhelper/unittests/bignum_wrapper-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief Bignum C++ wrapper unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
#include "epid/common-testhelper/errors-testhelper.h"
diff --git a/epid/common-testhelper/unittests/ecgroup_wrapper-test.cc b/epid/common-testhelper/unittests/ecgroup_wrapper-test.cc
index 4cc399c..fae63e7 100644
--- a/epid/common-testhelper/unittests/ecgroup_wrapper-test.cc
+++ b/epid/common-testhelper/unittests/ecgroup_wrapper-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief EcGroup C++ wrapper unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
#include "epid/common-testhelper/errors-testhelper.h"
diff --git a/epid/common-testhelper/unittests/ecpoint_wrapper-test.cc b/epid/common-testhelper/unittests/ecpoint_wrapper-test.cc
index 780b70f..c35a060 100644
--- a/epid/common-testhelper/unittests/ecpoint_wrapper-test.cc
+++ b/epid/common-testhelper/unittests/ecpoint_wrapper-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief EcPoint C++ wrapper unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
#include "epid/common-testhelper/errors-testhelper.h"
diff --git a/epid/common-testhelper/unittests/ffelement_wrapper-test.cc b/epid/common-testhelper/unittests/ffelement_wrapper-test.cc
index 6f835ca..c9e1361 100644
--- a/epid/common-testhelper/unittests/ffelement_wrapper-test.cc
+++ b/epid/common-testhelper/unittests/ffelement_wrapper-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief FfElement C++ wrapper unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
#include "epid/common-testhelper/errors-testhelper.h"
diff --git a/epid/common-testhelper/unittests/finite_field_wrapper-test.cc b/epid/common-testhelper/unittests/finite_field_wrapper-test.cc
index 1ce59d0..36d9cdc 100644
--- a/epid/common-testhelper/unittests/finite_field_wrapper-test.cc
+++ b/epid/common-testhelper/unittests/finite_field_wrapper-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief FiniteField C++ wrapper unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
#include "epid/common-testhelper/errors-testhelper.h"
diff --git a/epid/common-testhelper/unittests/main-test.cc b/epid/common-testhelper/unittests/main-test.cc
index 70f2d3a..a8bb2fa 100644
--- a/epid/common-testhelper/unittests/main-test.cc
+++ b/epid/common-testhelper/unittests/main-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
* \brief Main entry point for unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
int main(int argc, char** argv) {
diff --git a/epid/common/1.1/src/file_parser.c b/epid/common/1.1/src/file_parser.c
index bf3d79d..ed78ad5 100644
--- a/epid/common/1.1/src/file_parser.c
+++ b/epid/common/1.1/src/file_parser.c
@@ -134,7 +134,7 @@ EpidStatus Epid11ParseGroupPubKeyFile(void const* buf, size_t len,
return kEpidBadArgErr;
}
- if (sizeof(Epid11GroupPubKeyCertificate) > len) {
+ if (len == 0 || len % sizeof(Epid11GroupPubKeyCertificate) != 0) {
return kEpidBadArgErr;
}
diff --git a/epid/common/1.1/unittests/file_parser-test.cc b/epid/common/1.1/unittests/file_parser-test.cc
index 59d1541..ab894e2 100644
--- a/epid/common/1.1/unittests/file_parser-test.cc
+++ b/epid/common/1.1/unittests/file_parser-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
#include <cstdint>
#include <vector>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
#include "epid/common/1.1/file_parser.h"
@@ -606,6 +607,14 @@ TEST_F(Epid11FileParser, RejectsGroupPubKeyFileWithInvalidSize) {
Epid11ParseGroupPubKeyFile((void*)this->kGroupPublicKeyFile.data(),
this->kGroupPublicKeyFile.size() - 1,
&this->kCert, &pubkey));
+ EXPECT_EQ(kEpidBadArgErr, Epid11ParseGroupPubKeyFile(
+ (void*)this->kGroupMultiPublicKeyFile.data(),
+ this->kGroupMultiPublicKeyFile.size() - 1,
+ &this->kCert, &pubkey));
+ EXPECT_EQ(kEpidBadArgErr, Epid11ParseGroupPubKeyFile(
+ (void*)this->kGroupMultiPublicKeyFile.data(),
+ this->kGroupMultiPublicKeyFile.size() + 1,
+ &this->kCert, &pubkey));
}
TEST_F(Epid11FileParser, RejectsInvalidGroupPubKeyFileType) {
diff --git a/epid/common/Makefile b/epid/common/Makefile
index d61f5db..0baf6a8 100644
--- a/epid/common/Makefile
+++ b/epid/common/Makefile
@@ -29,12 +29,11 @@ COMMON_UTEST_OBJ = $(COMMON_UTEST_SRC:.cc=.o)
LIB_COMMON_DIR = .
LIB_COMMON_TESTHELPER_DIR = ../common-testhelper
LIB_IPPCP_DIR = ../../ext/ipp/sources/ippcp/src
-LIB_IPPCPEPID_DIR = ../../ext/ipp/sources/ippcpepid/src
#set flags for linker
LDFLAGS += -L$(GTEST_INCLUDE_DIR)/gtest -L$(LIB_COMMON_TESTHELPER_DIR) \
- -L$(LIB_COMMON_DIR) -L$(LIB_IPPCPEPID_DIR) -L$(LIB_IPPCP_DIR) \
- -lgtest -lcommon-testhelper -lcommon -lippcpepid -lippcp
+ -L$(LIB_COMMON_DIR) -L$(LIB_IPPCP_DIR) \
+ -lgtest -lcommon-testhelper -lcommon -lippcp
#target part
$(COMMON_OBJ): %.o: %.c
@@ -42,13 +41,13 @@ $(COMMON_OBJ): %.o: %.c
$(COMMON_LIB): $(COMMON_OBJ)
$(AR) rc $(COMMON_LIB) $(COMMON_OBJ)
- ranlib $(COMMON_LIB)
+ $(RANLIB) $(COMMON_LIB)
$(COMMON_UTEST_EXE): $(COMMON_UTEST_OBJ)
- $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
+ $(CXX) -o $@ $^ $(LDFLAGS)
$(COMMON_UTEST_OBJ): %.o: %.cc
- $(CXX) -o $@ $(CXXFLAGS) -I$(COMMON_INCLUDE_DIR) -I$(GTEST_INCLUDE_DIR) -c $^
+ $(CXX) -o $@ $(CXXFLAGS) $(GTEST_DEFINES) -I$(COMMON_INCLUDE_DIR) -I$(GTEST_INCLUDE_DIR) -c $^
build: all
@@ -67,11 +66,13 @@ ifneq (,$(wildcard $(COMMON_UTEST_EXE)))
cp $(COMMON_UTEST_EXE) '$(TEST_INSTALL_DIR)'
endif
-check: $(COMMON_UTEST_EXE) run
+utest: $(COMMON_UTEST_EXE)
-run:
+run_utest:
$(COMMON_UTEST_EXE) $(GTEST_FLAGS)
+check: utest run_utest
+
clean:
rm -f $(COMMON_OBJ) \
$(COMMON_LIB) \
diff --git a/epid/common/bitsupplier.h b/epid/common/bitsupplier.h
index 7abee2d..85ec7fd 100644
--- a/epid/common/bitsupplier.h
+++ b/epid/common/bitsupplier.h
@@ -28,17 +28,33 @@
/// Generates random data.
/*!
- It is the responsibility of the caller of the SDK interfaces to
- implement a function of this prototype and to then pass a pointer
- to this function into methods that require it.
+ The SDK provides the ::BitSupplier as a function
+ prototype so that you will know the requirements for your
+ own implementation of a random number generator.
- \param[out] rand_data destination buffer
- \param[in] num_bits size of rand_data in bits
- \param[in] user_data user data passed through from api call.
+ You need to pass a pointer to your
+ implementation of the random number generator into
+ methods that require it, such as ::EpidMemberCreate.
+
+ For an example of how a BitSupplier is created, see
+ the `signmsg` example.
+
+ \param[out] rand_data destination buffer for random data
+ generated by BitSupplier. The buffer will receive
+ `num_bits` of random data.
+ \param[in] num_bits specifies the size of the random
+ data, in bits, to be generated.
+ \param[in] user_data user data that will be passed to the
+ random number generator. The usage of this data is specific
+ to the implementation of the BitSupplier. For example, this
+ could be used to pass a pointer to a data structure
+ that maintains state across calls to your BitSupplier.
\returns zero on success and non-zero value on error.
\ingroup EpidCommon
+
+ \see EpidMemberCreate
*/
typedef int(__STDCALL* BitSupplier)(unsigned int* rand_data, int num_bits,
void* user_data);
diff --git a/epid/common/common.parts b/epid/common/common.parts
index 3886d8c..dfa80b4 100644
--- a/epid/common/common.parts
+++ b/epid/common/common.parts
@@ -1,5 +1,5 @@
############################################################################
-# Copyright 2016 Intel Corporation
+# Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -83,8 +83,9 @@ if 'install_package' in env['MODE']:
else:
env.DependsOn([
Component('ippcp'),
- Component('ippcpepid'),
])
+ if 'use_memory_profiler' in env['MODE']:
+ env.DependsOn([Component('memory_profiler')])
env.Append(CPPPATH='#')
diff --git a/epid/common/errors.h b/epid/common/errors.h
index 15a29d0..7f4f485 100644
--- a/epid/common/errors.h
+++ b/epid/common/errors.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -58,6 +58,7 @@ typedef enum {
kEpidDuplicateErr, //!< argument would add duplicate entry
kEpidInconsistentBasenameSetErr, //!< set basename conflicts with arguments
kEpidMathQuadraticNonResidueError, //!< quadratic Non-Residue Error
+ kEpidOutOfSequenceError, //!< operation was performed out of sequence
} EpidStatus;
/// Returns string representation of error code.
diff --git a/epid/common/file_parser.h b/epid/common/file_parser.h
index a920b3b..f3d45a5 100644
--- a/epid/common/file_parser.h
+++ b/epid/common/file_parser.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -32,6 +32,8 @@
Provides an API for parsing buffers formatted according to the
various IoT Intel(R) EPID binary file formats.
+ To use this module, include the header epid/common/file_parser.h.
+
\ingroup EpidCommon
@{
*/
@@ -136,6 +138,9 @@ EpidStatus EpidParseFileHeader(void const* buf, size_t len,
\retval ::kEpidSigInvalid
Parsing failed due to data authentication failure.
+ \b Examples
+
+ \ref UserManual_GeneratingAnIntelEpidSignature
*/
EpidStatus EpidParseGroupPubKeyFile(void const* buf, size_t len,
EpidCaCertificate const* cert,
@@ -178,6 +183,9 @@ EpidStatus EpidParseGroupPubKeyFile(void const* buf, size_t len,
\retval ::kEpidSigInvalid
Parsing failed due to data authentication failure.
+ \b Example
+
+ \ref UserManual_VerifyingAnIntelEpidSignature
*/
EpidStatus EpidParsePrivRlFile(void const* buf, size_t len,
EpidCaCertificate const* cert, PrivRl* rl,
@@ -220,6 +228,9 @@ EpidStatus EpidParsePrivRlFile(void const* buf, size_t len,
\retval ::kEpidSigInvalid
Parsing failed due to data authentication failure.
+ \b Examples
+
+ \ref UserManual_GeneratingAnIntelEpidSignature
*/
EpidStatus EpidParseSigRlFile(void const* buf, size_t len,
EpidCaCertificate const* cert, SigRl* rl,
@@ -262,6 +273,9 @@ EpidStatus EpidParseSigRlFile(void const* buf, size_t len,
\retval ::kEpidSigInvalid
Parsing failed due to data authentication failure.
+ \b Example
+
+ \ref UserManual_VerifyingAnIntelEpidSignature
*/
EpidStatus EpidParseGroupRlFile(void const* buf, size_t len,
EpidCaCertificate const* cert, GroupRl* rl,
diff --git a/epid/common/math/bignum.h b/epid/common/math/bignum.h
index e9e9df4..e2b5712 100644
--- a/epid/common/math/bignum.h
+++ b/epid/common/math/bignum.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -84,7 +84,7 @@ void DeleteBigNum(BigNum** bignum);
\returns ::EpidStatus
*/
-EpidStatus ReadBigNum(void const* bn_str, size_t strlen, BigNum* bn);
+EpidStatus ReadBigNum(ConstOctStr bn_str, size_t strlen, BigNum* bn);
/// Serializes a BigNum to a string.
/*!
@@ -97,7 +97,7 @@ EpidStatus ReadBigNum(void const* bn_str, size_t strlen, BigNum* bn);
\returns ::EpidStatus
*/
-EpidStatus WriteBigNum(BigNum const* bn, size_t strlen, void* bn_str);
+EpidStatus WriteBigNum(BigNum const* bn, size_t strlen, OctStr bn_str);
/// Adds two BigNum values.
/*!
diff --git a/epid/common/math/ecdsa.h b/epid/common/math/ecdsa.h
index faeca4d..0ab5764 100644
--- a/epid/common/math/ecdsa.h
+++ b/epid/common/math/ecdsa.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -69,7 +69,7 @@
\see EcdsaSignBuffer
*/
-EpidStatus EcdsaVerifyBuffer(void const* buf, size_t buf_len,
+EpidStatus EcdsaVerifyBuffer(ConstOctStr buf, size_t buf_len,
EcdsaPublicKey const* pubkey,
EcdsaSignature const* sig);
@@ -103,7 +103,7 @@ EpidStatus EcdsaVerifyBuffer(void const* buf, size_t buf_len,
\see EcdsaSignBuffer
*/
-EpidStatus EcdsaSignBuffer(void const* buf, size_t buf_len,
+EpidStatus EcdsaSignBuffer(ConstOctStr buf, size_t buf_len,
EcdsaPrivateKey const* privkey, BitSupplier rnd_func,
void* rnd_param, EcdsaSignature* sig);
diff --git a/epid/common/math/ecgroup.h b/epid/common/math/ecgroup.h
index 3f21d88..bd19179 100644
--- a/epid/common/math/ecgroup.h
+++ b/epid/common/math/ecgroup.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -72,6 +72,9 @@ typedef struct EcGroup EcGroup;
\returns ::EpidStatus
+ \attention It is the responsibility of the caller to ensure that ff exists
+ for the entire lifetime of the new EcGroup.
+
\see DeleteEcGroup
*/
EpidStatus NewEcGroup(FiniteField const* ff, FfElement const* a,
@@ -106,6 +109,9 @@ typedef struct EcPoint EcPoint;
\returns ::EpidStatus
+ \attention It is the responsibility of the caller to ensure that g exists
+ for the entire lifetime of the new EcPoint.
+
\see NewEcGroup
\see DeleteEcPoint
*/
@@ -138,7 +144,7 @@ void DeleteEcPoint(EcPoint** p);
\see NewEcPoint
*/
-EpidStatus ReadEcPoint(EcGroup* g, void const* p_str, size_t strlen,
+EpidStatus ReadEcPoint(EcGroup* g, ConstOctStr p_str, size_t strlen,
EcPoint* p);
/// Serializes an EcPoint to a string.
@@ -156,7 +162,7 @@ EpidStatus ReadEcPoint(EcGroup* g, void const* p_str, size_t strlen,
\see NewEcPoint
*/
-EpidStatus WriteEcPoint(EcGroup* g, EcPoint const* p, void* p_str,
+EpidStatus WriteEcPoint(EcGroup* g, EcPoint const* p, OctStr p_str,
size_t strlen);
/// Multiplies two elements in an elliptic curve group.
@@ -355,7 +361,7 @@ EpidStatus EcGetRandom(EcGroup* g, BitSupplier rnd_func, void* rnd_func_param,
\see NewEcPoint
*/
-EpidStatus EcInGroup(EcGroup* g, void const* p_str, size_t strlen,
+EpidStatus EcInGroup(EcGroup* g, ConstOctStr p_str, size_t strlen,
bool* in_group);
/// Hashes an arbitrary message to an Intel(R) EPID 1.1 element in an elliptic
@@ -375,7 +381,7 @@ The hashed value.
\see NewEcGroup
\see NewEcPoint
*/
-EpidStatus Epid11EcHash(EcGroup* g, void const* msg, size_t msg_len,
+EpidStatus Epid11EcHash(EcGroup* g, ConstOctStr msg, size_t msg_len,
EcPoint* r);
/// Hashes an arbitrary message to an element in an elliptic curve group.
@@ -396,7 +402,7 @@ EpidStatus Epid11EcHash(EcGroup* g, void const* msg, size_t msg_len,
\see NewEcGroup
\see NewEcPoint
*/
-EpidStatus EcHash(EcGroup* g, void const* msg, size_t msg_len, HashAlg hash_alg,
+EpidStatus EcHash(EcGroup* g, ConstOctStr msg, size_t msg_len, HashAlg hash_alg,
EcPoint* r);
/// Sets an EcPoint variable to a point on a curve.
diff --git a/epid/common/math/finitefield.h b/epid/common/math/finitefield.h
index 3754ef3..cc87186 100644
--- a/epid/common/math/finitefield.h
+++ b/epid/common/math/finitefield.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -86,6 +86,9 @@ EpidStatus NewFiniteField(BigNumStr const* prime, FiniteField** ff);
\returns ::EpidStatus
+ \attention It is the responsibility of the caller to ensure that ground_field
+ exists for the entire lifetime of the new FiniteField.
+
\see DeleteFiniteField
*/
EpidStatus NewFiniteFieldViaBinomalExtension(FiniteField const* ground_field,
@@ -112,6 +115,9 @@ EpidStatus NewFiniteFieldViaBinomalExtension(FiniteField const* ground_field,
\returns ::EpidStatus
+ \attention It is the responsibility of the caller to ensure that ground_field
+ exists for the entire lifetime of the new FiniteField.
+
\see DeleteFiniteField
*/
EpidStatus NewFiniteFieldViaPolynomialExtension(FiniteField const* ground_field,
@@ -143,6 +149,9 @@ The Newly constructed finite field element.
\returns ::EpidStatus
+ \attention It is the responsibility of the caller to ensure that ff
+ exists for the entire lifetime of the new FfElement.
+
\see NewFiniteField
\see DeleteFfElement
*/
@@ -175,7 +184,7 @@ void DeleteFfElement(FfElement** ff_elem);
\see NewFfElement
\see WriteFfElement
*/
-EpidStatus ReadFfElement(FiniteField* ff, void const* ff_elem_str,
+EpidStatus ReadFfElement(FiniteField* ff, ConstOctStr ff_elem_str,
size_t strlen, FfElement* ff_elem);
/// Initializes an existing FfElement from a BigNum.
@@ -213,7 +222,7 @@ EpidStatus InitFfElementFromBn(FiniteField* ff, BigNum* bn, FfElement* ff_elem);
\see GtElemStr
*/
EpidStatus WriteFfElement(FiniteField* ff, FfElement const* ff_elem,
- void* ff_elem_str, size_t strlen);
+ OctStr ff_elem_str, size_t strlen);
/// Calculates the additive inverse of a finite field element.
/*!
@@ -454,7 +463,7 @@ EpidStatus FfIsEqual(FiniteField* ff, FfElement const* a, FfElement const* b,
\see NewFiniteField
\see NewFfElement
*/
-EpidStatus FfHash(FiniteField* ff, void const* msg, size_t msg_len,
+EpidStatus FfHash(FiniteField* ff, ConstOctStr msg, size_t msg_len,
HashAlg hash_alg, FfElement* r);
/// Generate random finite field element.
diff --git a/epid/common/math/pairing.h b/epid/common/math/pairing.h
index 5aab91a..31d0e09 100644
--- a/epid/common/math/pairing.h
+++ b/epid/common/math/pairing.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -62,6 +62,9 @@ typedef struct PairingState PairingState;
\returns ::EpidStatus
+ \attention It is the responsibility of the caller to ensure that ga, gb, and
+ ff exist for the entire lifetime of the new PairingState.
+
\see DeletePairingState
*/
EpidStatus NewPairingState(EcGroup const* ga, EcGroup const* gb,
@@ -83,17 +86,17 @@ void DeletePairingState(PairingState** ps);
/*!
\param[in] ps
The pairing state.
- \param[out] d
- The result of the pairing. Will be in ff used to create the pairing state.
\param[in] a
The first value to pair. Must be in ga used to create ps.
\param[in] b
The second value to pair. Must be in gb used to create ps
+ \param[out] d
+ The result of the pairing. Will be in ff used to create the pairing state.
\returns ::EpidStatus
*/
-EpidStatus Pairing(PairingState* ps, FfElement* d, EcPoint const* a,
- EcPoint const* b);
+EpidStatus Pairing(PairingState* ps, EcPoint const* a, EcPoint const* b,
+ FfElement* d);
/*!
@}
diff --git a/epid/common/math/src/bignum-internal.h b/epid/common/math/src/bignum-internal.h
index e30b6f8..3c6fc19 100644
--- a/epid/common/math/src/bignum-internal.h
+++ b/epid/common/math/src/bignum-internal.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -22,10 +22,18 @@
#ifndef EPID_COMMON_MATH_SRC_BIGNUM_INTERNAL_H_
#define EPID_COMMON_MATH_SRC_BIGNUM_INTERNAL_H_
-#include "ext/ipp/include/ippcpepid.h"
+#include "ext/ipp/include/ippcp.h"
#include "epid/common/stdtypes.h"
+#include "epid/common/types.h"
#include "epid/common/errors.h"
+typedef void* BNU;
+typedef void const* ConstBNU;
+typedef Ipp32u* IppBNU;
+typedef Ipp32u const* ConstIppBNU;
+typedef Ipp8u* IppOctStr;
+typedef Ipp8u const* ConstIppOctStr;
+
/// Big Number
struct BigNum {
/// Internal implementation of bignum
@@ -50,7 +58,7 @@ Length of octet string, should be multiple of 4
\returns length of big number unsigned in uint32_t chunks
\returns -1 in case of any error
*/
-int OctStr2Bnu(uint32_t* bnu_ptr, void const* octstr_ptr, int octstr_len);
+int OctStr2Bnu(BNU bnu_ptr, ConstOctStr octstr_ptr, int octstr_len);
/// Get octet string size in bits
/*!
@@ -61,7 +69,7 @@ Length of octet string in bytes.
\returns bit size of big number value from octet string
*/
-size_t OctStrBitSize(uint8_t const* octstr_ptr, size_t octstr_len);
+size_t OctStrBitSize(ConstOctStr octstr_ptr, size_t octstr_len);
/// Initializes a BigNum from a BNU.
/*!
@@ -77,7 +85,6 @@ size_t OctStrBitSize(uint8_t const* octstr_ptr, size_t octstr_len);
\returns ::EpidStatus
*/
-EpidStatus InitBigNumFromBnu(uint32_t const* bnu, size_t bnu_len,
- struct BigNum* bn);
+EpidStatus InitBigNumFromBnu(ConstBNU bnu, size_t bnu_len, struct BigNum* bn);
#endif // EPID_COMMON_MATH_SRC_BIGNUM_INTERNAL_H_
diff --git a/epid/common/math/src/bignum.c b/epid/common/math/src/bignum.c
index 5ab4fdb..cd8df13 100644
--- a/epid/common/math/src/bignum.c
+++ b/epid/common/math/src/bignum.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -92,7 +92,7 @@ void DeleteBigNum(BigNum** bignum) {
}
}
-EpidStatus ReadBigNum(void const* bn_str, size_t strlen, BigNum* bn) {
+EpidStatus ReadBigNum(ConstOctStr bn_str, size_t strlen, BigNum* bn) {
IppStatus sts;
size_t i;
bool is_zero = true;
@@ -156,8 +156,7 @@ EpidStatus ReadBigNum(void const* bn_str, size_t strlen, BigNum* bn) {
\note This is re-documented here because doxygen does not pull in the
internal headers
*/
-EpidStatus InitBigNumFromBnu(uint32_t const* bnu, size_t bnu_len,
- struct BigNum* bn) {
+EpidStatus InitBigNumFromBnu(ConstBNU bnu, size_t bnu_len, struct BigNum* bn) {
IppStatus sts;
if (!bn || !bnu) return kEpidBadArgErr;
@@ -177,14 +176,14 @@ EpidStatus InitBigNumFromBnu(uint32_t const* bnu, size_t bnu_len,
return kEpidNoErr;
}
-EpidStatus WriteBigNum(BigNum const* bn, size_t strlen, void* bn_str) {
+EpidStatus WriteBigNum(BigNum const* bn, size_t strlen, OctStr bn_str) {
IppStatus sts;
int ipp_strlen = (int)strlen;
if (!bn || !bn_str) return kEpidBadArgErr;
if (!bn->ipp_bn) return kEpidBadArgErr;
- sts = ippsGetOctString_BN((Ipp8u*)bn_str, ipp_strlen, bn->ipp_bn);
+ sts = ippsGetOctString_BN((OctStr)bn_str, ipp_strlen, bn->ipp_bn);
if (ippStsNoErr != sts) {
if (ippStsContextMatchErr == sts || ippStsRangeErr == sts ||
ippStsLengthErr == sts)
@@ -197,36 +196,37 @@ EpidStatus WriteBigNum(BigNum const* bn, size_t strlen, void* bn_str) {
}
/// convert octet string into "big number unsigned" representation
-int OctStr2Bnu(uint32_t* bnu_ptr, void const* octstr_ptr, int octstr_len) {
+int OctStr2Bnu(BNU bnu_ptr, ConstOctStr octstr_ptr, int octstr_len) {
int bnusize = 0;
- uint8_t const* byte_str = (uint8_t const*)octstr_ptr;
+ ConstIppOctStr byte_str = (ConstIppOctStr)octstr_ptr;
+ IppBNU bnu = (IppBNU)bnu_ptr;
if (!bnu_ptr || !octstr_ptr) {
return -1;
}
if (octstr_len < 4 || octstr_len % 4 != 0) return -1;
- *bnu_ptr = 0;
+ *bnu = 0;
/* start from the end of string */
for (; octstr_len >= 4; bnusize++, octstr_len -= 4) {
/* pack 4 bytes into single Ipp32u value*/
- *bnu_ptr++ = (byte_str[octstr_len - 4] << (8 * 3)) +
- (byte_str[octstr_len - 3] << (8 * 2)) +
- (byte_str[octstr_len - 2] << (8 * 1)) +
- byte_str[octstr_len - 1];
+ *bnu++ = (byte_str[octstr_len - 4] << (8 * 3)) +
+ (byte_str[octstr_len - 3] << (8 * 2)) +
+ (byte_str[octstr_len - 2] << (8 * 1)) + byte_str[octstr_len - 1];
}
return bnusize ? bnusize : -1;
}
/// Get octet string size in bits
-size_t OctStrBitSize(uint8_t const* octstr_ptr, size_t octstr_len) {
+size_t OctStrBitSize(ConstOctStr octstr_ptr, size_t octstr_len) {
uint8_t byte;
size_t bitsize = 0;
+ ConstIppOctStr octstr = (ConstIppOctStr)octstr_ptr;
// find highest non zero byte
size_t i = 0;
- while (i < octstr_len && !octstr_ptr[i]) i++;
+ while (i < octstr_len && !octstr[i]) i++;
if (i == octstr_len) return 0;
- byte = octstr_ptr[i];
+ byte = octstr[i];
// refine bit size
if (0 == byte) return 0;
@@ -358,7 +358,7 @@ EpidStatus BigNumIsEven(BigNum const* a, bool* is_even) {
IppStatus sts = ippStsNoErr;
IppsBigNumSGN sgn;
int bit_size;
- Ipp32u* data;
+ IppBNU data;
// Check required parameters
if (!a || !is_even) {
return kEpidBadArgErr;
diff --git a/epid/common/math/src/ecdsa_sign.c b/epid/common/math/src/ecdsa_sign.c
index fffaab0..bbc927e 100644
--- a/epid/common/math/src/ecdsa_sign.c
+++ b/epid/common/math/src/ecdsa_sign.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@
/// The number of attempts to generate ephemeral key pair
#define EPHKEYGEN_WATCHDOG (10)
-EpidStatus EcdsaSignBuffer(void const* buf, size_t buf_len,
+EpidStatus EcdsaSignBuffer(ConstOctStr buf, size_t buf_len,
EcdsaPrivateKey const* privkey, BitSupplier rnd_func,
void* rnd_param, EcdsaSignature* sig) {
EpidStatus result = kEpidMathErr;
diff --git a/epid/common/math/src/ecdsa_verify.c b/epid/common/math/src/ecdsa_verify.c
index cf3c7c4..3bebfb9 100644
--- a/epid/common/math/src/ecdsa_verify.c
+++ b/epid/common/math/src/ecdsa_verify.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@ static EpidStatus ReadCurvePoint(IppsECCPState* ec,
EcdsaPublicKey const* pubkey,
IppsECCPPointState* p);
-static EpidStatus CalcHashBn(void const* buf, size_t buf_len,
+static EpidStatus CalcHashBn(ConstOctStr buf, size_t buf_len,
BigNum* bn_digest);
static void DeleteCurvePoint(IppsECCPPointState** p);
@@ -55,7 +55,7 @@ static void DeleteCurvePoint(IppsECCPPointState** p);
static EpidStatus ValidateSignature(BigNum const* bn_sig_x,
BigNum const* bn_sig_y);
-EpidStatus EcdsaVerifyBuffer(void const* buf, size_t buf_len,
+EpidStatus EcdsaVerifyBuffer(ConstOctStr buf, size_t buf_len,
EcdsaPublicKey const* pubkey,
EcdsaSignature const* sig) {
EpidStatus result = kEpidErr;
@@ -104,7 +104,12 @@ EpidStatus EcdsaVerifyBuffer(void const* buf, size_t buf_len,
epid_status = NewCurvePoint(ec_state, &ecp_pubkey);
if (kEpidNoErr != epid_status) break;
epid_status = ReadCurvePoint(ec_state, pubkey, ecp_pubkey);
- if (kEpidNoErr != epid_status) break;
+ if (kEpidBadArgErr == epid_status) {
+ result = kEpidBadArgErr;
+ break;
+ } else if (kEpidNoErr != epid_status) {
+ break;
+ }
// check for invalid pubkey
ipp_status = ippsECCPCheckPoint(ecp_pubkey, &ec_result, ec_state);
@@ -249,7 +254,13 @@ static EpidStatus ReadCurvePoint(IppsECCPState* ec,
ipp_status =
ippsECCPSetPoint(bn_pubkey_x->ipp_bn, bn_pubkey_y->ipp_bn, p, ec);
- BREAK_ON_IPP_ERROR(ipp_status, result);
+ if (ipp_status == ippStsOutOfRangeErr) {
+ result = kEpidBadArgErr;
+ break;
+ } else if (ipp_status != ippStsNoErr) {
+ result = kEpidMathErr;
+ break;
+ }
} while (0);
DeleteBigNum(&bn_pubkey_x);
@@ -258,7 +269,7 @@ static EpidStatus ReadCurvePoint(IppsECCPState* ec,
return result;
}
-static EpidStatus CalcHashBn(void const* buf, size_t buf_len,
+static EpidStatus CalcHashBn(ConstOctStr buf, size_t buf_len,
BigNum* bn_digest) {
EpidStatus result = kEpidErr;
BigNum* bn_ec_order = NULL;
diff --git a/epid/common/math/src/ecgroup-internal.h b/epid/common/math/src/ecgroup-internal.h
index 3e99867..ed3c83c 100644
--- a/epid/common/math/src/ecgroup-internal.h
+++ b/epid/common/math/src/ecgroup-internal.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -22,23 +22,24 @@
#ifndef EPID_COMMON_MATH_SRC_ECGROUP_INTERNAL_H_
#define EPID_COMMON_MATH_SRC_ECGROUP_INTERNAL_H_
-#include "ext/ipp/include/ippcpepid.h"
+#include "ext/ipp/include/ippcp.h"
+#include "epid/common/math/src/finitefield-internal.h"
/// Elpitic Curve Group
struct EcGroup {
/// Internal implementation of elliptic curve group
IppsGFpECState* ipp_ec;
/// Scratch buffer for operations over elliptic curve group
- Ipp8u* scratch_buffer;
- /// Information about finite field of elliptic curve group created
- IppsGFpInfo info;
+ OctStr scratch_buffer;
+ /// Information about finite field of elliptic curve group
+ struct FiniteField* ff;
};
/// Elpitic Curve Point
struct EcPoint {
/// Internal implementation of elliptic curve point
IppsGFpECPoint* ipp_ec_pt;
- /// Information about finite field element of elliptic curve group created
- IppsGFpInfo info;
+ /// length of the finite field element of elliptic curve group
+ int element_len;
};
#endif // EPID_COMMON_MATH_SRC_ECGROUP_INTERNAL_H_
diff --git a/epid/common/math/src/ecgroup.c b/epid/common/math/src/ecgroup.c
index 2629bd6..717d6a8 100644
--- a/epid/common/math/src/ecgroup.c
+++ b/epid/common/math/src/ecgroup.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@
#include "epid/common/src/memory.h"
#include "epid/common/src/endian_convert.h"
#include "ext/ipp/include/ippcp.h"
-#include "ext/ipp/include/ippcpepid.h"
+#include "ext/ipp/include/ippcpdefs.h"
#include "epid/common/1.1/types.h"
/// Handle SDK Error with Break
@@ -55,14 +55,14 @@ EpidStatus NewEcGroup(FiniteField const* ff, FfElement const* a,
BigNum const* cofactor, EcGroup** g) {
EpidStatus result = kEpidNoErr;
IppsGFpECState* state = NULL;
- Ipp8u* scratch_buffer = NULL;
+ OctStr scratch_buffer = NULL;
EcGroup* grp = NULL;
do {
IppStatus ipp_status;
int stateSize = 0;
int scratch_size = 0;
- Ipp32u* order_bnu;
- Ipp32u* cofactor_bnu;
+ IppBNU order_bnu;
+ IppBNU cofactor_bnu;
int order_bnu_size;
int cofactor_bnu_size;
IppsBigNumSGN sgn;
@@ -71,16 +71,10 @@ EpidStatus NewEcGroup(FiniteField const* ff, FfElement const* a,
result = kEpidBadArgErr;
break;
}
- if (ff->info.elementLen != a->info.elementLen ||
- ff->info.elementLen != b->info.elementLen ||
- ff->info.elementLen != x->info.elementLen ||
- ff->info.elementLen != y->info.elementLen ||
- a->info.elementLen != b->info.elementLen ||
- a->info.elementLen != x->info.elementLen ||
- a->info.elementLen != y->info.elementLen ||
- b->info.elementLen != x->info.elementLen ||
- b->info.elementLen != y->info.elementLen ||
- x->info.elementLen != y->info.elementLen) {
+ if (ff->element_len != a->element_len ||
+ ff->element_len != b->element_len ||
+ ff->element_len != x->element_len ||
+ ff->element_len != y->element_len) {
result = kEpidBadArgErr;
break;
}
@@ -124,9 +118,13 @@ EpidStatus NewEcGroup(FiniteField const* ff, FfElement const* a,
}
ipp_status =
- ippsGFpECInit(a->ipp_ff_elem, b->ipp_ff_elem, x->ipp_ff_elem,
- y->ipp_ff_elem, order_bnu, order_bnu_size, cofactor_bnu,
- cofactor_bnu_size, ff->ipp_ff, state);
+ ippsGFpECInit(ff->ipp_ff, a->ipp_ff_elem, b->ipp_ff_elem, state);
+ if (ippStsNoErr != ipp_status) {
+ result = kEpidMathErr;
+ break;
+ }
+ ipp_status = ippsGFpECSetSubgroup(x->ipp_ff_elem, y->ipp_ff_elem,
+ order->ipp_bn, cofactor->ipp_bn, state);
if (ippStsNoErr != ipp_status) {
result = kEpidMathErr;
break;
@@ -136,21 +134,23 @@ EpidStatus NewEcGroup(FiniteField const* ff, FfElement const* a,
ipp_status = ippsGFpECScratchBufferSize(1, state, &scratch_size);
// check return codes
if (ippStsNoErr != ipp_status) {
- if (ippStsContextMatchErr == ipp_status)
- result = kEpidBadArgErr;
- else
- result = kEpidMathErr;
+ // ippStsContextMatchErr not possible since we create the state
+ // in this function
+ result = kEpidMathErr;
break;
}
// allocate scratch buffer
- scratch_buffer = (Ipp8u*)SAFE_ALLOC(scratch_size);
+ scratch_buffer = (OctStr)SAFE_ALLOC(scratch_size);
if (!scratch_buffer) {
result = kEpidMemAllocErr;
break;
}
-
- grp->info = ff->info;
+ // Warning: once assigned ground field must never be modified. this was not
+ // made const
+ // to allow the FiniteField structure to be used in context when we want to
+ // modify the parameters.
+ grp->ff = (FiniteField*)ff;
grp->ipp_ec = state;
grp->scratch_buffer = scratch_buffer;
*g = grp;
@@ -225,7 +225,11 @@ EpidStatus NewEcPoint(EcGroup const* g, EcPoint** p) {
result = kEpidMemAllocErr;
break;
}
- ecpoint->info = g->info;
+ if (!g->ff) {
+ result = kEpidBadArgErr;
+ break;
+ }
+ ecpoint->element_len = g->ff->element_len;
ecpoint->ipp_ec_pt = ec_pt_context;
*p = ecpoint;
result = kEpidNoErr;
@@ -271,21 +275,21 @@ void DeleteEcPoint(EcPoint** p) {
\see NewEcPoint
*/
-EpidStatus eccontains(EcGroup* g, void const* p_str, size_t strlen, EcPoint* p,
+EpidStatus eccontains(EcGroup* g, ConstOctStr p_str, size_t strlen, EcPoint* p,
bool* in_group) {
EpidStatus result = kEpidErr;
IppStatus sts = ippStsNoErr;
- FiniteField fp;
+ FiniteField* fp = NULL;
FfElement* fp_x = NULL;
FfElement* fp_y = NULL;
- Ipp8u const* byte_str = (Ipp8u const*)p_str;
+ ConstIppOctStr byte_str = (ConstIppOctStr)p_str;
IppECResult ec_result = ippECPointIsNotValid;
int ipp_half_strlen = (int)strlen / 2;
if (!g || !p_str || !p || !in_group) {
return kEpidBadArgErr;
}
- if (!g->ipp_ec || !p->ipp_ec_pt) {
+ if (!g->ff || !g->ipp_ec || !p->ipp_ec_pt) {
return kEpidBadArgErr;
}
@@ -317,51 +321,29 @@ EpidStatus eccontains(EcGroup* g, void const* p_str, size_t strlen, EcPoint* p,
break;
}
// get finite field
- sts = ippsGFpECGet(g->ipp_ec, (const IppsGFpState**)&(fp.ipp_ff), 0, 0, 0,
- 0, 0, 0, 0, 0);
- // check return codes
- if (ippStsNoErr != sts) {
- if (ippStsContextMatchErr == sts)
- result = kEpidBadArgErr;
- else
- result = kEpidMathErr;
- break;
- }
-
+ fp = g->ff;
// create element X
- result = NewFfElement(&fp, &fp_x);
+ result = NewFfElement(fp, &fp_x);
if (kEpidNoErr != result) {
break;
}
// create element Y
- result = NewFfElement(&fp, &fp_y);
+ result = NewFfElement(fp, &fp_y);
if (kEpidNoErr != result) {
break;
}
// set element X data
- sts = ippsGFpSetElementOctString(byte_str, ipp_half_strlen,
- fp_x->ipp_ff_elem, fp.ipp_ff);
- // check return codes
- if (ippStsNoErr != sts) {
- if (ippStsContextMatchErr == sts || ippStsOutOfRangeErr == sts)
- result = kEpidBadArgErr;
- else
- result = kEpidMathErr;
+ result = SetFfElementOctString(byte_str, ipp_half_strlen, fp_x, fp);
+ if (kEpidNoErr != result) {
break;
}
// set element Y data
- sts =
- ippsGFpSetElementOctString(byte_str + ipp_half_strlen, ipp_half_strlen,
- fp_y->ipp_ff_elem, fp.ipp_ff);
- // check return codes
- if (ippStsNoErr != sts) {
- if (ippStsContextMatchErr == sts || ippStsOutOfRangeErr == sts)
- result = kEpidBadArgErr;
- else
- result = kEpidMathErr;
+ result = SetFfElementOctString(byte_str + ipp_half_strlen, ipp_half_strlen,
+ fp_y, fp);
+ if (kEpidNoErr != result) {
break;
}
@@ -378,8 +360,7 @@ EpidStatus eccontains(EcGroup* g, void const* p_str, size_t strlen, EcPoint* p,
}
// verify the point is actually on the curve
- sts = ippsGFpECTstPoint(p->ipp_ec_pt, &ec_result, g->ipp_ec,
- g->scratch_buffer);
+ sts = ippsGFpECTstPoint(p->ipp_ec_pt, &ec_result, g->ipp_ec);
// check return codes
if (ippStsNoErr != sts) {
if (ippStsContextMatchErr == sts)
@@ -388,7 +369,6 @@ EpidStatus eccontains(EcGroup* g, void const* p_str, size_t strlen, EcPoint* p,
result = kEpidMathErr;
break;
}
-
*in_group = (ippECValid == ec_result);
result = kEpidNoErr;
} while (0);
@@ -398,7 +378,7 @@ EpidStatus eccontains(EcGroup* g, void const* p_str, size_t strlen, EcPoint* p,
return result;
}
-EpidStatus ReadEcPoint(EcGroup* g, void const* p_str, size_t strlen,
+EpidStatus ReadEcPoint(EcGroup* g, ConstOctStr p_str, size_t strlen,
EcPoint* p) {
EpidStatus result;
bool in_group = false;
@@ -426,20 +406,20 @@ EpidStatus ReadEcPoint(EcGroup* g, void const* p_str, size_t strlen,
return kEpidNoErr;
}
-EpidStatus WriteEcPoint(EcGroup* g, EcPoint const* p, void* p_str,
+EpidStatus WriteEcPoint(EcGroup* g, EcPoint const* p, OctStr p_str,
size_t strlen) {
EpidStatus result = kEpidErr;
- FiniteField fp;
+ FiniteField* fp = NULL;
FfElement* fp_x = NULL;
FfElement* fp_y = NULL;
- Ipp8u* byte_str = (Ipp8u*)p_str;
+ IppOctStr byte_str = (IppOctStr)p_str;
IppStatus sts = ippStsNoErr;
int ipp_half_strlen = (int)strlen / 2;
if (!g || !p || !p_str) {
return kEpidBadArgErr;
}
- if (!g->ipp_ec || !p->ipp_ec_pt) {
+ if (!g->ff || !g->ipp_ec || !p->ipp_ec_pt) {
return kEpidBadArgErr;
}
if (INT_MAX < strlen) {
@@ -452,25 +432,16 @@ EpidStatus WriteEcPoint(EcGroup* g, EcPoint const* p, void* p_str,
do {
// get finite field
- sts = ippsGFpECGet(g->ipp_ec, (const IppsGFpState**)&(fp.ipp_ff), 0, 0, 0,
- 0, 0, 0, 0, 0);
- // check return codes
- if (ippStsNoErr != sts) {
- if (ippStsContextMatchErr == sts)
- result = kEpidBadArgErr;
- else
- result = kEpidMathErr;
- break;
- }
+ fp = g->ff;
// create element X
- result = NewFfElement(&fp, &fp_x);
+ result = NewFfElement(fp, &fp_x);
if (kEpidNoErr != result) {
break;
}
// create element Y
- result = NewFfElement(&fp, &fp_y);
+ result = NewFfElement(fp, &fp_y);
if (kEpidNoErr != result) {
break;
}
@@ -483,7 +454,7 @@ EpidStatus WriteEcPoint(EcGroup* g, EcPoint const* p, void* p_str,
if (ippStsPointAtInfinity == sts) {
memset(p_str, 0, strlen);
result = kEpidNoErr;
- } else if (ippStsContextMatchErr == sts) {
+ } else if (ippStsContextMatchErr == sts || ippStsOutOfRangeErr == sts) {
result = kEpidBadArgErr;
} else {
result = kEpidMathErr;
@@ -493,7 +464,7 @@ EpidStatus WriteEcPoint(EcGroup* g, EcPoint const* p, void* p_str,
// get element X data
sts = ippsGFpGetElementOctString(fp_x->ipp_ff_elem, byte_str,
- ipp_half_strlen, fp.ipp_ff);
+ ipp_half_strlen, fp->ipp_ff);
// check return codes
if (ippStsNoErr != sts) {
if (ippStsContextMatchErr == sts)
@@ -506,7 +477,7 @@ EpidStatus WriteEcPoint(EcGroup* g, EcPoint const* p, void* p_str,
// get element Y data
sts = ippsGFpGetElementOctString(fp_y->ipp_ff_elem,
byte_str + ipp_half_strlen,
- ipp_half_strlen, fp.ipp_ff);
+ ipp_half_strlen, fp->ipp_ff);
// check return codes
if (ippStsNoErr != sts) {
if (ippStsContextMatchErr == sts)
@@ -528,15 +499,13 @@ EpidStatus EcMul(EcGroup* g, EcPoint const* a, EcPoint const* b, EcPoint* r) {
IppStatus sts = ippStsNoErr;
if (!g || !a || !b || !r) {
return kEpidBadArgErr;
- } else if (!g->ipp_ec || !a->ipp_ec_pt || !b->ipp_ec_pt || !r->ipp_ec_pt) {
+ } else if (!g->ff || !g->ipp_ec || !a->ipp_ec_pt || !b->ipp_ec_pt ||
+ !r->ipp_ec_pt) {
return kEpidBadArgErr;
}
- if (g->info.elementLen != a->info.elementLen ||
- g->info.elementLen != b->info.elementLen ||
- g->info.elementLen != r->info.elementLen ||
- a->info.elementLen != b->info.elementLen ||
- a->info.elementLen != r->info.elementLen ||
- b->info.elementLen != r->info.elementLen) {
+ if (g->ff->element_len != a->element_len ||
+ g->ff->element_len != b->element_len ||
+ g->ff->element_len != r->element_len) {
return kEpidBadArgErr;
}
// Multiplies elliptic curve points
@@ -561,13 +530,12 @@ EpidStatus EcExp(EcGroup* g, EcPoint const* a, BigNumStr const* b, EcPoint* r) {
if (!g || !a || !b || !r) {
result = kEpidBadArgErr;
break;
- } else if (!g->ipp_ec || !a->ipp_ec_pt || !r->ipp_ec_pt) {
+ } else if (!g->ff || !g->ipp_ec || !a->ipp_ec_pt || !r->ipp_ec_pt) {
result = kEpidBadArgErr;
break;
}
- if (g->info.elementLen != a->info.elementLen ||
- g->info.elementLen != r->info.elementLen ||
- a->info.elementLen != r->info.elementLen) {
+ if (g->ff->element_len != a->element_len ||
+ g->ff->element_len != r->element_len) {
result = kEpidBadArgErr;
break;
}
@@ -577,7 +545,6 @@ EpidStatus EcExp(EcGroup* g, EcPoint const* a, BigNumStr const* b, EcPoint* r) {
if (kEpidNoErr != result) break;
result = ReadBigNum(b, sizeof(*b), b_bn);
if (kEpidNoErr != result) break;
-
sts = ippsGFpECMulPoint(a->ipp_ec_pt, b_bn->ipp_bn, r->ipp_ec_pt, g->ipp_ec,
g->scratch_buffer);
if (ippStsNoErr != sts) {
@@ -606,41 +573,35 @@ EpidStatus EcMultiExp(EcGroup* g, EcPoint const** a, BigNumStr const** b,
EpidStatus result = kEpidErr;
BigNum* b_bn = NULL;
EcPoint* ecp_t = NULL;
- int i = 0;
- int ii = 0;
- int ipp_m = 0;
+ size_t i = 0;
+ size_t ii = 0;
if (!g || !a || !b || !r) {
return kEpidBadArgErr;
}
- if (!g->ipp_ec || m <= 0) {
- return kEpidBadArgErr;
- }
- // because we use ipp function with number of items parameter
- // defined as "int" we need to verify that input length
- // do not exceed INT_MAX to avoid overflow
- if (m > INT_MAX) {
+ if (!g->ff || !g->ipp_ec || m <= 0) {
return kEpidBadArgErr;
}
- ipp_m = (int)m;
+
// Verify that ec points are not NULL
- for (i = 0; i < ipp_m; i++) {
+ for (i = 0; i < m; i++) {
if (!a[i]) {
return kEpidBadArgErr;
}
if (!a[i]->ipp_ec_pt) {
return kEpidBadArgErr;
}
- if (g->info.elementLen != a[i]->info.elementLen) {
+ if (g->ff->element_len != a[i]->element_len) {
return kEpidBadArgErr;
}
- for (ii = i + 1; ii < ipp_m; ii++) {
- if (a[i]->info.elementLen != a[ii]->info.elementLen) {
+ for (ii = 0; ii < i; ii++) {
+ if (a[i]->element_len != a[ii]->element_len) {
return kEpidBadArgErr;
}
}
}
- if (g->info.elementLen != r->info.elementLen) {
+
+ if (g->ff->element_len != r->element_len) {
return kEpidBadArgErr;
}
@@ -654,11 +615,10 @@ EpidStatus EcMultiExp(EcGroup* g, EcPoint const** a, BigNumStr const** b,
result = NewEcPoint(g, &ecp_t);
if (kEpidNoErr != result) break;
- for (i = 0; i < ipp_m; i++) {
+ for (i = 0; i < m; i++) {
// Initialize big number element for ipp call
result = ReadBigNum(b[i], sizeof(BigNumStr), b_bn);
if (kEpidNoErr != result) break;
-
sts = ippsGFpECMulPoint(a[i]->ipp_ec_pt, b_bn->ipp_bn, ecp_t->ipp_ec_pt,
g->ipp_ec, g->scratch_buffer);
if (ippStsNoErr != sts) {
@@ -669,7 +629,7 @@ EpidStatus EcMultiExp(EcGroup* g, EcPoint const** a, BigNumStr const** b,
result = kEpidMathErr;
break;
}
- if (1 == m) {
+ if (i == 0) {
sts = ippsGFpECCpyPoint(ecp_t->ipp_ec_pt, r->ipp_ec_pt, g->ipp_ec);
if (ippStsNoErr != sts) {
result = kEpidMathErr;
@@ -698,25 +658,18 @@ EpidStatus EcMultiExpBn(EcGroup* g, EcPoint const** a, BigNum const** b,
size_t m, EcPoint* r) {
EpidStatus result = kEpidErr;
EcPoint* ecp_t = NULL;
- int i = 0;
- int ii = 0;
- int ipp_m = 0;
+ size_t i = 0;
+ size_t ii = 0;
if (!g || !a || !b || !r) {
return kEpidBadArgErr;
}
- if (!g->ipp_ec || m <= 0) {
- return kEpidBadArgErr;
- }
- // because we use ipp function with number of items parameter
- // defined as "int" we need to verify that input length
- // do not exceed INT_MAX to avoid overflow
- if (m > INT_MAX) {
+ if (!g->ff || !g->ipp_ec || m <= 0) {
return kEpidBadArgErr;
}
- ipp_m = (int)m;
+
// Verify that ec points are not NULL
- for (i = 0; i < ipp_m; i++) {
+ for (i = 0; i < m; i++) {
if (!a[i]) {
return kEpidBadArgErr;
}
@@ -729,27 +682,28 @@ EpidStatus EcMultiExpBn(EcGroup* g, EcPoint const** a, BigNum const** b,
if (!b[i]->ipp_bn) {
return kEpidBadArgErr;
}
- if (g->info.elementLen != a[i]->info.elementLen) {
+
+ if (g->ff->element_len != a[i]->element_len) {
return kEpidBadArgErr;
}
- for (ii = i + 1; ii < ipp_m; ii++) {
- if (a[i]->info.elementLen != a[ii]->info.elementLen) {
+ for (ii = 0; ii < i; ii++) {
+ if (a[i]->element_len != a[ii]->element_len) {
return kEpidBadArgErr;
}
}
}
- if (g->info.elementLen != r->info.elementLen) {
+
+ if (g->ff->element_len != r->element_len) {
return kEpidBadArgErr;
}
do {
IppStatus sts = ippStsNoErr;
-
// Create temporal EcPoint element
result = NewEcPoint(g, &ecp_t);
if (kEpidNoErr != result) break;
- for (i = 0; i < ipp_m; i++) {
+ for (i = 0; i < m; i++) {
sts = ippsGFpECMulPoint(a[i]->ipp_ec_pt, b[i]->ipp_bn, ecp_t->ipp_ec_pt,
g->ipp_ec, g->scratch_buffer);
if (ippStsNoErr != sts) {
@@ -760,7 +714,7 @@ EpidStatus EcMultiExpBn(EcGroup* g, EcPoint const** a, BigNum const** b,
result = kEpidMathErr;
break;
}
- if (1 == m) {
+ if (i == 0) {
sts = ippsGFpECCpyPoint(ecp_t->ipp_ec_pt, r->ipp_ec_pt, g->ipp_ec);
if (ippStsNoErr != sts) {
result = kEpidMathErr;
@@ -797,15 +751,17 @@ EpidStatus EcGetRandom(EcGroup* g, BitSupplier rnd_func, void* rnd_func_param,
if (!g || !rnd_func || !r) {
return kEpidBadArgErr;
}
- if (!g->ipp_ec || !g->scratch_buffer) {
+ if (!g->ff || !g->ipp_ec || !g->scratch_buffer) {
return kEpidBadArgErr;
}
- if (g->info.elementLen != r->info.elementLen) {
+
+ if (g->ff->element_len != r->element_len) {
return kEpidBadArgErr;
}
- sts = ippsGFpECSetPointRandom((IppBitSupplier)rnd_func, rnd_func_param,
- r->ipp_ec_pt, g->ipp_ec, g->scratch_buffer);
+ sts =
+ ippsGFpECSetPointRandom(r->ipp_ec_pt, g->ipp_ec, (IppBitSupplier)rnd_func,
+ rnd_func_param, g->scratch_buffer);
if (ippStsNoErr != sts) {
if (ippStsContextMatchErr == sts) {
return kEpidBadArgErr;
@@ -816,7 +772,7 @@ EpidStatus EcGetRandom(EcGroup* g, BitSupplier rnd_func, void* rnd_func_param,
return kEpidNoErr;
}
-EpidStatus EcInGroup(EcGroup* g, void const* p_str, size_t strlen,
+EpidStatus EcInGroup(EcGroup* g, ConstOctStr p_str, size_t strlen,
bool* in_group) {
EpidStatus result = kEpidErr;
EcPoint* p = NULL;
@@ -824,6 +780,9 @@ EpidStatus EcInGroup(EcGroup* g, void const* p_str, size_t strlen,
if (!g || !p_str || !in_group) {
return kEpidBadArgErr;
}
+ if (!g->ff) {
+ return kEpidBadArgErr;
+ }
if (0 == strlen) {
return kEpidBadArgErr;
}
@@ -833,15 +792,15 @@ EpidStatus EcInGroup(EcGroup* g, void const* p_str, size_t strlen,
return kEpidBadArgErr;
} else {
if (strlen == sizeof(G1ElemStr)) {
- // check info.elementlen with strlen
+ // check finitefield.elementlen with strlen
// multiply by 2 for x,y and 4 multiply to convert dword to bytes
- size_t info_elementLen_in_byte = (g->info.elementLen) * 2 * 4;
+ size_t info_elementLen_in_byte = (g->ff->element_len) * 2 * 4;
if (info_elementLen_in_byte != strlen) {
*in_group = false;
return kEpidBadArgErr;
}
// check Fq basic and ground degree
- if (g->info.basicGFdegree != 1 || g->info.groundGFdegree != 1) {
+ if (g->ff->basic_degree != 1 || g->ff->ground_degree != 1) {
*in_group = false;
return kEpidBadArgErr;
}
@@ -849,31 +808,25 @@ EpidStatus EcInGroup(EcGroup* g, void const* p_str, size_t strlen,
if (strlen == sizeof(G2ElemStr)) {
// check info.elementlen with strlen
// multiply by 2 for x,y and 4 multiply to convert dword to bytes
- size_t info_elementLen_in_byte = (g->info.elementLen) * 2 * 4;
- IppStatus sts = ippStsNoErr;
- IppsGFpInfo ground_info = {0};
+ size_t info_elementLen_in_byte = (g->ff->element_len) * 2 * 4;
+ FiniteField* ground_ff = NULL;
if (info_elementLen_in_byte != strlen) {
*in_group = false;
return kEpidBadArgErr;
}
// check Fq2 basic and ground degree
- if (g->info.basicGFdegree != 2 || g->info.groundGFdegree != 2) {
+ if (g->ff->basic_degree != 2 || g->ff->ground_degree != 2) {
*in_group = false;
return kEpidBadArgErr;
}
// check Fq basic and ground degree
- sts = ippsGFpGetInfo(g->info.pGroundGF, &ground_info);
- if (ippStsNoErr != sts) {
- if (ippStsContextMatchErr == sts) {
- *in_group = false;
- return kEpidMathErr;
- } else {
- *in_group = false;
- return kEpidBadArgErr;
- }
+ ground_ff = g->ff->ground_ff;
+ if (ground_ff == NULL) {
+ *in_group = false;
+ return kEpidBadArgErr;
}
- if (ground_info.basicGFdegree != 1 || ground_info.groundGFdegree != 1) {
+ if (ground_ff->basic_degree != 1 || ground_ff->ground_degree != 1) {
*in_group = false;
return kEpidBadArgErr;
}
@@ -916,30 +869,30 @@ Returns the first bit and the next 336 bits of str in octet string.
\returns ::EpidStatus
*/
-static EpidStatus SplitHashBits(void const* str, size_t str_len,
+static EpidStatus SplitHashBits(ConstOctStr str, size_t str_len,
uint32_t* first_bit, OctStr336* t) {
// this is 336bits /8 bits per byte = 42 bytes
OctStr336 next336 = {0};
size_t i = 0;
+ ConstIppOctStr data = (ConstIppOctStr)str;
if (!str || !first_bit || !t) return kEpidBadArgErr;
if (str_len < sizeof(next336) + 1) {
// we need at least 337 bits!
return kEpidBadArgErr;
}
-
for (i = 0; i < sizeof(next336); i++) {
// This is not overflowing since str length was assured to
// be at least one byte greater than needed for 336 bits. We are
// carrying in the first bit of that byte.
- uint8_t carry = ((((uint8_t const*)str)[i + 1] & 0x80) >> 7);
- next336.data[i] = (((((uint8_t const*)str)[i] << 1) & 0xFF) | carry) & 0xFF;
+ uint8_t carry = ((data[i + 1] & 0x80) >> 7);
+ next336.data[i] = (((data[i] << 1) & 0xFF) | carry) & 0xFF;
}
- *first_bit = ((((uint8_t const*)str)[0] & 0x80) >> 7);
+ *first_bit = ((data[0] & 0x80) >> 7);
*t = next336;
return kEpidNoErr;
}
-EpidStatus Epid11EcHash(EcGroup* g, void const* msg, size_t msg_len,
+EpidStatus Epid11EcHash(EcGroup* g, ConstOctStr msg, size_t msg_len,
EcPoint* r) {
EpidStatus result = kEpidErr;
@@ -962,16 +915,17 @@ EpidStatus Epid11EcHash(EcGroup* g, void const* msg, size_t msg_len,
BigNum* t_bn = NULL;
BigNum* h_bn = NULL;
- FiniteField ff = {0};
+ FiniteField* ff = NULL;
// check parameters
if ((!msg && msg_len > 0) || !r || !g) {
return kEpidBadArgErr;
}
- if (!g->ipp_ec || !r->ipp_ec_pt) {
+ if (!g->ff || !g->ipp_ec || !r->ipp_ec_pt) {
return kEpidBadArgErr;
}
- if (g->info.elementLen != r->info.elementLen) {
+
+ if (g->ff->element_len != r->element_len) {
return kEpidBadArgErr;
}
@@ -987,8 +941,6 @@ EpidStatus Epid11EcHash(EcGroup* g, void const* msg, size_t msg_len,
uint32_t high_bit = 0;
IppsGFpState* ipp_ff = NULL;
- uint32_t const* h = NULL; // cofactor
- int h_len = 0;
int sqrt_loop_count = 2 * EPID_ECHASH_WATCHDOG;
Sha256Digest message_digest[2] = {0};
@@ -1001,34 +953,30 @@ EpidStatus Epid11EcHash(EcGroup* g, void const* msg, size_t msg_len,
break;
}
- sts = ippsGFpECGet(g->ipp_ec, (const IppsGFpState**)&ipp_ff, 0, 0, 0, 0, 0,
- 0, &h, &h_len);
- BREAK_ON_IPP_ERROR(sts, result);
- result = InitFiniteFieldFromIpp(ipp_ff, &ff);
+ result = NewBigNum(sizeof(BigNumStr), &h_bn);
BREAK_ON_EPID_ERROR(result);
+ sts = ippsGFpECGet(&ipp_ff, 0, 0, g->ipp_ec);
+ BREAK_ON_IPP_ERROR(sts, result);
+ sts = ippsGFpECGetSubgroup(&ipp_ff, 0, 0, 0, h_bn->ipp_bn, g->ipp_ec);
+ BREAK_ON_IPP_ERROR(sts, result);
+ ff = g->ff;
- result = NewFfElement(&ff, &a);
+ result = NewFfElement(ff, &a);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ff, &b);
+ result = NewFfElement(ff, &b);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ff, &rx);
+ result = NewFfElement(ff, &rx);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ff, &t1);
+ result = NewFfElement(ff, &t1);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ff, &t2);
+ result = NewFfElement(ff, &t2);
BREAK_ON_EPID_ERROR(result);
result = NewBigNum(sizeof(t), &t_bn);
BREAK_ON_EPID_ERROR(result);
- result = NewBigNum(h_len, &h_bn);
- BREAK_ON_EPID_ERROR(result);
- sts = ippsGFpECGet(g->ipp_ec, 0, a->ipp_ff_elem, b->ipp_ff_elem, 0, 0, 0, 0,
- 0, 0);
+ sts = ippsGFpECGet(0, a->ipp_ff_elem, b->ipp_ff_elem, g->ipp_ec);
BREAK_ON_IPP_ERROR(sts, result);
- result = InitBigNumFromBnu(h, h_len, h_bn);
- BREAK_ON_EPID_ERROR(result);
-
// compute H = hash (i || m) || Hash (i+1 || m) where (i =ipp32u)
// copy variable length message to the buffer to hash
if (0 != memcpy_S(hash_buf->msg,
@@ -1058,23 +1006,23 @@ EpidStatus Epid11EcHash(EcGroup* g, void const* msg, size_t msg_len,
result = ReadBigNum(&t, sizeof(t), t_bn);
BREAK_ON_EPID_ERROR(result);
// compute rx = t mod q (aka prime field based on q)
- result = InitFfElementFromBn(&ff, t_bn, rx);
+ result = InitFfElementFromBn(ff, t_bn, rx);
BREAK_ON_EPID_ERROR(result);
// t1 = (rx^3 + a*rx + b) mod q
- result = FfMul(&ff, rx, rx, t1);
+ result = FfMul(ff, rx, rx, t1);
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ff, t1, rx, t1);
+ result = FfMul(ff, t1, rx, t1);
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ff, a, rx, t2);
+ result = FfMul(ff, a, rx, t2);
BREAK_ON_EPID_ERROR(result);
- result = FfAdd(&ff, t1, t2, t1);
+ result = FfAdd(ff, t1, t2, t1);
BREAK_ON_EPID_ERROR(result);
- result = FfAdd(&ff, t1, b, t1);
+ result = FfAdd(ff, t1, b, t1);
BREAK_ON_EPID_ERROR(result);
// t2 = &ff.sqrt(t1)
- result = FfSqrt(&ff, t1, t2);
+ result = FfSqrt(ff, t1, t2);
if (kEpidMathQuadraticNonResidueError == result) {
// if sqrt fail set i = i+ 2 and repeat from top
i += 2;
@@ -1092,7 +1040,7 @@ EpidStatus Epid11EcHash(EcGroup* g, void const* msg, size_t msg_len,
// y[0] = min (t2, q-t2), y[1] = max(t2, q-t2)
if (0 == high_bit) {
// q-t2 = &ff.neg(t2)
- result = FfNeg(&ff, t2, t2);
+ result = FfNeg(ff, t2, t2);
BREAK_ON_EPID_ERROR(result);
}
@@ -1121,15 +1069,15 @@ EpidStatus Epid11EcHash(EcGroup* g, void const* msg, size_t msg_len,
return result;
}
-EpidStatus EcHash(EcGroup* g, void const* msg, size_t msg_len, HashAlg hash_alg,
+EpidStatus EcHash(EcGroup* g, ConstOctStr msg, size_t msg_len, HashAlg hash_alg,
EcPoint* r) {
IppStatus sts = ippStsNoErr;
- IppHashID hash_id;
+ IppHashAlgId hash_id;
int ipp_msg_len = 0;
Ipp32u i = 0;
if (!g || (!msg && msg_len > 0) || !r) {
return kEpidBadArgErr;
- } else if (!g->ipp_ec || !r->ipp_ec_pt) {
+ } else if (!g->ff || !g->ipp_ec || !r->ipp_ec_pt) {
return kEpidBadArgErr;
}
// because we use ipp function with message length parameter
@@ -1140,21 +1088,24 @@ EpidStatus EcHash(EcGroup* g, void const* msg, size_t msg_len, HashAlg hash_alg,
}
ipp_msg_len = (int)msg_len;
if (kSha256 == hash_alg) {
- hash_id = ippSHA256;
+ hash_id = ippHashAlg_SHA256;
} else if (kSha384 == hash_alg) {
- hash_id = ippSHA384;
+ hash_id = ippHashAlg_SHA384;
} else if (kSha512 == hash_alg) {
- hash_id = ippSHA512;
+ hash_id = ippHashAlg_SHA512;
+ } else if (kSha512_256 == hash_alg) {
+ hash_id = ippHashAlg_SHA512_256;
} else {
return kEpidHashAlgorithmNotSupported;
}
- if (g->info.elementLen != r->info.elementLen) {
+
+ if (g->ff->element_len != r->element_len) {
return kEpidBadArgErr;
}
do {
- sts = ippsGFpECSetPointHash(i, msg, ipp_msg_len, hash_id, r->ipp_ec_pt,
- g->ipp_ec, g->scratch_buffer);
+ sts = ippsGFpECSetPointHash(i, msg, ipp_msg_len, r->ipp_ec_pt, g->ipp_ec,
+ hash_id, g->scratch_buffer);
} while (ippStsQuadraticNonResidueErr == sts && i++ < EPID_ECHASH_WATCHDOG);
if (ippStsContextMatchErr == sts || ippStsBadArgErr == sts ||
@@ -1173,12 +1124,12 @@ EpidStatus EcMakePoint(EcGroup* g, FfElement const* x, EcPoint* r) {
if (!g || !x || !r) {
return kEpidBadArgErr;
}
- if (!g->ipp_ec || !x->ipp_ff_elem || !r->ipp_ec_pt) {
+ if (!g->ff || !g->ipp_ec || !x->ipp_ff_elem || !r->ipp_ec_pt) {
return kEpidBadArgErr;
}
- if (g->info.elementLen != x->info.elementLen ||
- g->info.elementLen != r->info.elementLen ||
- x->info.elementLen != r->info.elementLen) {
+
+ if (g->ff->element_len != x->element_len ||
+ g->ff->element_len != r->element_len) {
return kEpidBadArgErr;
}
sts = ippsGFpECMakePoint(x->ipp_ff_elem, r->ipp_ec_pt, g->ipp_ec);
@@ -1196,12 +1147,12 @@ EpidStatus EcInverse(EcGroup* g, EcPoint const* p, EcPoint* r) {
IppStatus sts = ippStsNoErr;
if (!g || !p || !r) {
return kEpidBadArgErr;
- } else if (!g->ipp_ec || !p->ipp_ec_pt || !r->ipp_ec_pt) {
+ } else if (!g->ff || !g->ipp_ec || !p->ipp_ec_pt || !r->ipp_ec_pt) {
return kEpidBadArgErr;
}
- if (g->info.elementLen != p->info.elementLen ||
- g->info.elementLen != r->info.elementLen ||
- p->info.elementLen != r->info.elementLen) {
+
+ if (g->ff->element_len != p->element_len ||
+ g->ff->element_len != r->element_len) {
return kEpidBadArgErr;
}
// Inverses elliptic curve point
@@ -1224,12 +1175,11 @@ EpidStatus EcIsEqual(EcGroup* g, EcPoint const* a, EcPoint const* b,
if (!g || !a || !b || !is_equal) {
return kEpidBadArgErr;
}
- if (!g->ipp_ec || !a->ipp_ec_pt || !b->ipp_ec_pt) {
+ if (!g->ff || !g->ipp_ec || !a->ipp_ec_pt || !b->ipp_ec_pt) {
return kEpidBadArgErr;
}
- if (g->info.elementLen != a->info.elementLen ||
- g->info.elementLen != b->info.elementLen ||
- a->info.elementLen != b->info.elementLen) {
+ if (g->ff->element_len != a->element_len ||
+ g->ff->element_len != b->element_len) {
return kEpidBadArgErr;
}
@@ -1253,14 +1203,23 @@ EpidStatus EcIsIdentity(EcGroup* g, EcPoint const* p, bool* is_identity) {
if (!g || !p || !is_identity) {
return kEpidBadArgErr;
}
- if (!g->ipp_ec || !p->ipp_ec_pt) {
+ if (!g->ff || !g->ipp_ec || !p->ipp_ec_pt) {
return kEpidBadArgErr;
}
- if (g->info.elementLen != p->info.elementLen) {
+ if (g->ff->element_len != p->element_len) {
return kEpidBadArgErr;
}
- sts = ippsGFpECTstPoint(p->ipp_ec_pt, &result, g->ipp_ec, g->scratch_buffer);
+ sts = ippsGFpECTstPoint(p->ipp_ec_pt, &result, g->ipp_ec);
+ if (ippStsNoErr != sts) {
+ if (ippStsContextMatchErr == sts) {
+ return kEpidBadArgErr;
+ } else {
+ return kEpidMathErr;
+ }
+ }
+ sts = ippsGFpECTstPointInSubgroup(p->ipp_ec_pt, &result, g->ipp_ec,
+ g->scratch_buffer);
if (ippStsNoErr != sts) {
if (ippStsContextMatchErr == sts) {
return kEpidBadArgErr;
diff --git a/epid/common/math/src/finitefield-internal.h b/epid/common/math/src/finitefield-internal.h
index 4b68a6e..fa1e0ea 100644
--- a/epid/common/math/src/finitefield-internal.h
+++ b/epid/common/math/src/finitefield-internal.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -22,27 +22,43 @@
#ifndef EPID_COMMON_MATH_SRC_FINITEFIELD_INTERNAL_H_
#define EPID_COMMON_MATH_SRC_FINITEFIELD_INTERNAL_H_
-#include "ext/ipp/include/ippcpepid.h"
+#include "ext/ipp/include/ippcp.h"
+#include "epid/common/math/bignum.h"
+#include "epid/common/math/src/bignum-internal.h"
/// Finite Field
struct FiniteField {
/// Internal implementation of finite field
IppsGFpState* ipp_ff;
- /// Information about finite field created
- IppsGFpInfo info;
- /// Prime modulus size in bytes
- size_t prime_modulus_size;
+ /// Previous finitefield
+ struct FiniteField* ground_ff;
+ /// Degree of basic field
+ int basic_degree;
+ /// Degree of current field
+ int ground_degree;
+ /// Size of element in BNU units
+ int element_len;
+ /// Minimum number of bytes needed to serialize an element
+ size_t element_strlen_required;
+ /*!
+ Galois field prime or free standing coefficient of
+ irreducible polynomial of finite field extension.
+ */
+ BigNum* modulus_0;
};
/// Finite Field Element
struct FfElement {
/// Internal implementation of finite field element
IppsGFpElement* ipp_ff_elem;
- /// Information about finite field element was created for
- IppsGFpInfo info;
+ /// Element size of Finite Field element
+ int element_len;
+ /// Degree of Finite Field element
+ int degree;
};
-/// Initialize FiniteField structure
-EpidStatus InitFiniteFieldFromIpp(IppsGFpState* ipp_ff, FiniteField* ff);
+EpidStatus SetFfElementOctString(ConstOctStr ff_elem_str, int strlen,
+ struct FfElement* ff_elem,
+ struct FiniteField* ff);
#endif // EPID_COMMON_MATH_SRC_FINITEFIELD_INTERNAL_H_
diff --git a/epid/common/math/src/finitefield.c b/epid/common/math/src/finitefield.c
index 27e994c..b02b43f 100644
--- a/epid/common/math/src/finitefield.c
+++ b/epid/common/math/src/finitefield.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -23,11 +23,13 @@
#include <string.h>
#include <stdint.h>
#include "epid/common/math/finitefield.h"
-#include "epid/common/math/src/bignum-internal.h"
#include "epid/common/math/src/finitefield-internal.h"
#include "epid/common/src/memory.h"
-#include "ext/ipp/include/ippcp.h"
-#include "ext/ipp/include/ippcpepid.h"
+
+#ifndef MIN
+/// Evaluate to minimum of two values
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif // MIN
/// Number of leading zero bits in 32 bit integer x.
static size_t Nlz32(uint32_t x) {
@@ -64,63 +66,13 @@ static size_t Nlz32(uint32_t x) {
/// Convert bit size to byte size
#define BIT2BYTE_SIZE(bits) (((bits) + 7) >> 3)
-/// Initializes a FiniteField structure
-EpidStatus InitFiniteFieldFromIpp(IppsGFpState* ipp_ff, FiniteField* ff) {
- EpidStatus result = kEpidErr;
- IppStatus sts = ippStsNoErr;
- IppsGFpInfo basic_info;
- Ipp32u* basic_modulus = NULL;
-
- if (!ipp_ff || !ff) return kEpidBadArgErr;
-
- do {
- memset(ff, 0, sizeof(*ff));
-
- // set FiniteField::info
- sts = ippsGFpGetInfo(ipp_ff, &(ff->info));
- if (ippStsNoErr != sts) {
- result = kEpidMathErr;
- break;
- }
-
- // set FiniteField::ipp_ff context
- ff->ipp_ff = ipp_ff;
-
- // set FiniteField::prime_modulus_size
- sts = ippsGFpGetInfo(ff->info.pBasicGF, &basic_info);
- if (ippStsNoErr != sts) {
- result = kEpidMathErr;
- break;
- }
-
- basic_modulus = (Ipp32u*)SAFE_ALLOC(basic_info.elementLen * sizeof(Ipp32u));
- if (!basic_modulus) {
- result = kEpidMemAllocErr;
- break;
- }
-
- sts = ippsGFpGetModulus(ff->info.pBasicGF, basic_modulus);
- if (ippStsNoErr != sts) {
- result = kEpidMathErr;
- break;
- }
-
- ff->prime_modulus_size =
- BIT2BYTE_SIZE(BNU_BITSIZE(basic_modulus, basic_info.elementLen));
-
- result = kEpidNoErr;
- } while (0);
-
- SAFE_FREE(basic_modulus);
-
- return result;
-}
-
EpidStatus NewFiniteField(BigNumStr const* prime, FiniteField** ff) {
EpidStatus result = kEpidErr;
IppsGFpState* ipp_finitefield_ctx = NULL;
FiniteField* finitefield_ptr = NULL;
+ BigNum* prime_bn = NULL;
do {
+ EpidStatus status = kEpidErr;
IppStatus sts = ippStsNoErr;
Ipp32u bnu[sizeof(BigNumStr) / sizeof(Ipp32u)];
int bnu_size;
@@ -161,8 +113,21 @@ EpidStatus NewFiniteField(BigNumStr const* prime, FiniteField** ff) {
result = kEpidMemAllocErr;
break;
}
+
+ status = NewBigNum(sizeof(BigNumStr), &prime_bn);
+ if (kEpidNoErr != status) {
+ result = kEpidMathErr;
+ break;
+ }
+
+ status = ReadBigNum(prime, sizeof(BigNumStr), prime_bn);
+ if (kEpidNoErr != status) {
+ result = kEpidMathErr;
+ break;
+ }
// Initialize ipp finite field context
- sts = ippsGFpInit(bnu, bit_size, ipp_finitefield_ctx);
+ sts = ippsGFpInit(prime_bn->ipp_bn, bit_size, ippsGFpMethod_pArb(),
+ ipp_finitefield_ctx);
if (ippStsNoErr != sts) {
if (ippStsSizeErr == sts) {
result = kEpidBadArgErr;
@@ -176,15 +141,21 @@ EpidStatus NewFiniteField(BigNumStr const* prime, FiniteField** ff) {
result = kEpidMemAllocErr;
break;
}
- result = InitFiniteFieldFromIpp(ipp_finitefield_ctx, finitefield_ptr);
- if (kEpidNoErr != result) break;
-
+ finitefield_ptr->element_strlen_required =
+ BIT2BYTE_SIZE(BNU_BITSIZE(bnu, bnu_size));
+ finitefield_ptr->modulus_0 = prime_bn;
+ finitefield_ptr->basic_degree = 1;
+ finitefield_ptr->ground_degree = 1;
+ finitefield_ptr->element_len = bnu_size;
+ finitefield_ptr->ground_ff = NULL;
+ finitefield_ptr->ipp_ff = ipp_finitefield_ctx;
*ff = finitefield_ptr;
result = kEpidNoErr;
} while (0);
if (kEpidNoErr != result) {
SAFE_FREE(finitefield_ptr);
+ SAFE_FREE(prime_bn);
SAFE_FREE(ipp_finitefield_ctx);
}
return result;
@@ -195,8 +166,11 @@ EpidStatus NewFiniteFieldViaBinomalExtension(FiniteField const* ground_field,
int degree, FiniteField** ff) {
EpidStatus result = kEpidErr;
IppsGFpState* ipp_finitefield_ctx = NULL;
+ IppOctStr ff_elem_str = NULL;
FiniteField* finitefield_ptr = NULL;
+ BigNum* modulus_0 = NULL;
do {
+ EpidStatus status = kEpidErr;
IppStatus sts = ippStsNoErr;
int state_size_in_bytes = 0;
if (!ground_field || !ground_element || !ff) {
@@ -227,9 +201,13 @@ EpidStatus NewFiniteFieldViaBinomalExtension(FiniteField const* ground_field,
}
// Initialize ipp binomial extension finite field context
- sts =
- ippsGFpxInitBinomial(ground_field->ipp_ff, ground_element->ipp_ff_elem,
- degree, ipp_finitefield_ctx);
+ sts = ippsGFpxInitBinomial(
+ ground_field->ipp_ff, degree, ground_element->ipp_ff_elem,
+ 2 == degree
+ ? (3 == ground_field->basic_degree ? ippsGFpxMethod_binom2()
+ : ippsGFpxMethod_binom2_epid2())
+ : ippsGFpxMethod_binom3_epid2(),
+ ipp_finitefield_ctx);
if (ippStsNoErr != sts) {
if (ippStsSizeErr == sts) {
result = kEpidBadArgErr;
@@ -243,15 +221,52 @@ EpidStatus NewFiniteFieldViaBinomalExtension(FiniteField const* ground_field,
result = kEpidMemAllocErr;
break;
}
- result = InitFiniteFieldFromIpp(ipp_finitefield_ctx, finitefield_ptr);
+ finitefield_ptr->element_strlen_required =
+ ground_field->element_strlen_required * degree;
+ ff_elem_str =
+ (IppOctStr)SAFE_ALLOC(ground_field->element_len * sizeof(Ipp32u));
+ if (!ff_elem_str) {
+ result = kEpidMemAllocErr;
+ break;
+ }
+ status = NewBigNum(ground_field->element_len * sizeof(Ipp32u), &modulus_0);
+ if (kEpidNoErr != status) {
+ break;
+ }
+ if (kEpidNoErr != status) {
+ result = kEpidMathErr;
+ break;
+ }
+ result =
+ WriteFfElement((FiniteField*)ground_field, ground_element, ff_elem_str,
+ ground_field->element_len * sizeof(Ipp32u));
if (kEpidNoErr != result) break;
+ status = ReadBigNum(ff_elem_str, ground_field->element_len * sizeof(Ipp32u),
+ modulus_0);
+ if (kEpidNoErr != status) {
+ result = kEpidMathErr;
+ break;
+ }
+ finitefield_ptr->basic_degree = ground_field->basic_degree * degree;
+ finitefield_ptr->ground_degree = degree;
+ finitefield_ptr->element_len = ground_field->element_len * degree;
+ finitefield_ptr->modulus_0 = modulus_0;
+ // Warning: once assigned ground field must never be modified. this was not
+ // made const
+ // to allow the FiniteField structure to be used in context when we want to
+ // modify the parameters.
+ finitefield_ptr->ground_ff = (FiniteField*)ground_field;
+ finitefield_ptr->ipp_ff = ipp_finitefield_ctx;
*ff = finitefield_ptr;
result = kEpidNoErr;
} while (0);
+ SAFE_FREE(ff_elem_str);
+
if (kEpidNoErr != result) {
SAFE_FREE(finitefield_ptr);
+ SAFE_FREE(modulus_0);
SAFE_FREE(ipp_finitefield_ctx);
}
return result;
@@ -263,9 +278,12 @@ EpidStatus NewFiniteFieldViaPolynomialExtension(FiniteField const* ground_field,
EpidStatus result = kEpidErr;
IppsGFpState* ipp_finitefield_ctx = NULL;
FiniteField* finitefield_ptr = NULL;
- Ipp32u* irr_polynomial_bnu = NULL;
+ FfElement** ff_elems = NULL;
+ IppsGFpElement** ff_elems_state = NULL;
+ BigNum* modulus_0 = NULL;
int i;
do {
+ EpidStatus status = kEpidErr;
IppStatus sts = ippStsNoErr;
int state_size_in_bytes = 0;
if (!ground_field || !irr_polynomial || !ff) {
@@ -278,17 +296,6 @@ EpidStatus NewFiniteFieldViaPolynomialExtension(FiniteField const* ground_field,
break;
}
- // irr_polynomial to IPP representation
- irr_polynomial_bnu = (Ipp32u*)SAFE_ALLOC(sizeof(BigNumStr) * degree);
- if (!irr_polynomial_bnu) {
- result = kEpidMemAllocErr;
- break;
- }
- for (i = 0; i < degree; ++i) {
- OctStr2Bnu(irr_polynomial_bnu + (i * sizeof(BigNumStr) / 4),
- &irr_polynomial[i], sizeof(irr_polynomial[i]));
- }
-
// Determine the memory requirement for finite field context
sts = ippsGFpxGetSize(ground_field->ipp_ff, degree, &state_size_in_bytes);
if (ippStsNoErr != sts) {
@@ -306,10 +313,36 @@ EpidStatus NewFiniteFieldViaPolynomialExtension(FiniteField const* ground_field,
result = kEpidMemAllocErr;
break;
}
+ ff_elems = (FfElement**)SAFE_ALLOC(sizeof(FfElement*) * degree);
+ if (!ff_elems) {
+ result = kEpidMemAllocErr;
+ break;
+ }
+ ff_elems_state =
+ (IppsGFpElement**)SAFE_ALLOC(sizeof(IppsGFpElement*) * degree);
+ if (!ff_elems_state) {
+ result = kEpidMemAllocErr;
+ break;
+ }
+ for (i = 0; i < degree; ++i) {
+ status = NewFfElement(ground_field, &ff_elems[i]);
+ if (kEpidNoErr != status) {
+ result = kEpidMathErr;
+ break;
+ }
+ status = ReadFfElement((FiniteField*)ground_field, &irr_polynomial[i],
+ sizeof(BigNumStr), ff_elems[i]);
+ if (kEpidNoErr != status) {
+ result = kEpidMathErr;
+ break;
+ }
+ ff_elems_state[i] = ff_elems[i]->ipp_ff_elem;
+ }
// Initialize ipp binomial extension finite field context
- sts = ippsGFpxInit(ground_field->ipp_ff, irr_polynomial_bnu, degree,
- ipp_finitefield_ctx);
+ sts = ippsGFpxInit(ground_field->ipp_ff, degree,
+ (const IppsGFpElement* const*)ff_elems_state, degree,
+ ippsGFpxMethod_com(), ipp_finitefield_ctx);
if (ippStsNoErr != sts) {
if (ippStsSizeErr == sts) {
result = kEpidBadArgErr;
@@ -318,21 +351,47 @@ EpidStatus NewFiniteFieldViaPolynomialExtension(FiniteField const* ground_field,
}
break;
}
+ status = NewBigNum(sizeof(irr_polynomial[0]), &modulus_0);
+ if (kEpidNoErr != status) {
+ break;
+ }
+ status =
+ ReadBigNum(&irr_polynomial[0], sizeof(irr_polynomial[0]), modulus_0);
+ if (kEpidNoErr != status) {
+ break;
+ }
finitefield_ptr = (FiniteField*)SAFE_ALLOC(sizeof(FiniteField));
if (!finitefield_ptr) {
result = kEpidMemAllocErr;
break;
}
- result = InitFiniteFieldFromIpp(ipp_finitefield_ctx, finitefield_ptr);
- if (kEpidNoErr != result) break;
-
+ finitefield_ptr->element_strlen_required =
+ ground_field->element_len * sizeof(Ipp32u) * degree;
+ finitefield_ptr->modulus_0 = modulus_0;
+ finitefield_ptr->basic_degree = ground_field->basic_degree * degree;
+ finitefield_ptr->ground_degree = degree;
+ finitefield_ptr->element_len = ground_field->element_len * degree;
+ // Warning: once assigned ground field must never be modified. this was not
+ // made const
+ // to allow the FiniteField structure to be used in context when we want to
+ // modify the parameters.
+ finitefield_ptr->ground_ff = (FiniteField*)ground_field;
+ finitefield_ptr->ipp_ff = ipp_finitefield_ctx;
*ff = finitefield_ptr;
result = kEpidNoErr;
} while (0);
- SAFE_FREE(irr_polynomial_bnu);
+ if (ff_elems != NULL) {
+ for (i = 0; i < degree; i++) {
+ DeleteFfElement(&ff_elems[i]);
+ }
+ }
+ SAFE_FREE(ff_elems);
+ SAFE_FREE(ff_elems_state);
+
if (kEpidNoErr != result) {
SAFE_FREE(finitefield_ptr);
+ SAFE_FREE(modulus_0)
SAFE_FREE(ipp_finitefield_ctx);
}
return result;
@@ -342,6 +401,7 @@ void DeleteFiniteField(FiniteField** ff) {
if (ff) {
if (*ff) {
SAFE_FREE((*ff)->ipp_ff);
+ DeleteBigNum(&(*ff)->modulus_0);
}
SAFE_FREE((*ff));
}
@@ -390,12 +450,8 @@ EpidStatus NewFfElement(FiniteField const* ff, FfElement** new_ff_elem) {
}
ff_elem->ipp_ff_elem = ipp_ff_elem;
-
- sts = ippsGFpGetInfo(ff->ipp_ff, &(ff_elem->info));
- if (ippStsNoErr != sts) {
- result = kEpidMathErr;
- break;
- }
+ ff_elem->element_len = ff->element_len;
+ ff_elem->degree = ff->ground_degree;
*new_ff_elem = ff_elem;
result = kEpidNoErr;
@@ -417,12 +473,109 @@ void DeleteFfElement(FfElement** ff_elem) {
}
}
-EpidStatus ReadFfElement(FiniteField* ff, void const* ff_elem_str,
+EpidStatus IsValidFfElemOctString(ConstOctStr ff_elem_str, int strlen,
+ FiniteField const* ff) {
+ int i;
+ EpidStatus result = kEpidNoErr;
+ IppStatus sts = ippStsNoErr;
+ FiniteField const* basic_ff;
+ BigNum* pData = NULL;
+ int prime_length;
+ IppOctStr ff_elem_str_p;
+ Ipp32u cmp_res;
+ int tmp_strlen = strlen;
+ if (!ff || !ff_elem_str) {
+ return kEpidBadArgErr;
+ }
+ basic_ff = ff;
+ while (basic_ff->ground_ff != NULL) {
+ basic_ff = basic_ff->ground_ff;
+ }
+ prime_length = basic_ff->element_len * sizeof(Ipp32u);
+ ff_elem_str_p = (IppOctStr)ff_elem_str;
+ for (i = 0; (i < ff->basic_degree) && (tmp_strlen > 0); i++) {
+ int length;
+ length = MIN(prime_length, tmp_strlen);
+ result = NewBigNum(length, &pData);
+ if (kEpidNoErr != result) {
+ break;
+ }
+ result = ReadBigNum(ff_elem_str_p, length, pData);
+ if (kEpidNoErr != result) {
+ break;
+ }
+ sts = ippsCmp_BN(basic_ff->modulus_0->ipp_bn, pData->ipp_bn, &cmp_res);
+ // check return codes
+ if (ippStsNoErr != sts) {
+ if (ippStsContextMatchErr == sts)
+ result = kEpidBadArgErr;
+ else
+ result = kEpidMathErr;
+ break;
+ }
+ if (cmp_res != IPP_IS_GT) {
+ result = kEpidBadArgErr;
+ break;
+ }
+ DeleteBigNum(&pData);
+ tmp_strlen -= length;
+ ff_elem_str_p += length;
+ }
+ DeleteBigNum(&pData);
+ return result;
+}
+
+EpidStatus SetFfElementOctString(ConstOctStr ff_elem_str, int strlen,
+ FfElement* ff_elem, FiniteField* ff) {
+ EpidStatus result = kEpidErr;
+ IppOctStr extended_ff_elem_str = NULL;
+ if (!ff || !ff_elem || !ff_elem_str) {
+ return kEpidBadArgErr;
+ }
+ do {
+ IppStatus sts;
+ // Ipp2017u2 contians a bug in ippsGFpSetElementOctString, does not check
+ // whether ff_elem_str < modulus
+ result = IsValidFfElemOctString(ff_elem_str, strlen, ff);
+ if (kEpidNoErr != result) {
+ break;
+ }
+ // workaround because of bug in ipp2017u2
+ if (strlen < (int)(ff->element_len * sizeof(Ipp32u))) {
+ int length = ff->element_len * sizeof(Ipp32u);
+ extended_ff_elem_str = (IppOctStr)SAFE_ALLOC(length);
+ if (!extended_ff_elem_str) {
+ result = kEpidMemAllocErr;
+ break;
+ }
+ memset(extended_ff_elem_str, 0, length);
+ memcpy_S(extended_ff_elem_str, length, ff_elem_str, strlen);
+ strlen = length;
+ sts = ippsGFpSetElementOctString(extended_ff_elem_str, strlen,
+ ff_elem->ipp_ff_elem, ff->ipp_ff);
+ } else {
+ sts = ippsGFpSetElementOctString(ff_elem_str, strlen,
+ ff_elem->ipp_ff_elem, ff->ipp_ff);
+ }
+ if (ippStsNoErr != sts) {
+ if (ippStsContextMatchErr == sts || ippStsOutOfRangeErr == sts) {
+ result = kEpidBadArgErr;
+ } else {
+ result = kEpidMathErr;
+ }
+ break;
+ }
+ } while (0);
+ SAFE_FREE(extended_ff_elem_str);
+ return result;
+}
+
+EpidStatus ReadFfElement(FiniteField* ff, ConstOctStr ff_elem_str,
size_t strlen, FfElement* ff_elem) {
- IppStatus sts;
size_t strlen_required = 0;
int ipp_str_size = 0;
- uint8_t const* str = (uint8_t const*)ff_elem_str;
+ EpidStatus result = kEpidNoErr;
+ ConstIppOctStr str = (ConstIppOctStr)ff_elem_str;
if (!ff || !ff_elem_str || !ff_elem) {
return kEpidBadArgErr;
@@ -430,18 +583,17 @@ EpidStatus ReadFfElement(FiniteField* ff, void const* ff_elem_str,
if (!ff_elem->ipp_ff_elem || !ff->ipp_ff) {
return kEpidBadArgErr;
}
- if (ff->info.elementLen != ff_elem->info.elementLen) {
+
+ if (ff->element_len != ff_elem->element_len) {
return kEpidBadArgErr;
}
- // ippsGFpSetElementOctString expects serialized value consists
- // of "degree" number of chunks, where each chunk is of modulus byte size.
- strlen_required = ff->prime_modulus_size * ff->info.basicGFdegree;
+ strlen_required = ff->element_strlen_required;
- // Remove leading zeros when de-serealizing finite field of degree 1.
+ // Remove leading zeros when de-serializing finite field of degree 1.
// This takes care of serialization chunk size adjustments when importing
// a big numbers.
- if (1 == ff->info.basicGFdegree) {
+ if (1 == ff->basic_degree) {
while (strlen_required < strlen && 0 == *str) {
str++;
strlen--;
@@ -459,24 +611,15 @@ EpidStatus ReadFfElement(FiniteField* ff, void const* ff_elem_str,
return kEpidBadArgErr;
}
- sts = ippsGFpSetElementOctString(str, ipp_str_size, ff_elem->ipp_ff_elem,
- ff->ipp_ff);
- if (ippStsNoErr != sts) {
- if (ippStsContextMatchErr == sts || ippStsOutOfRangeErr == sts) {
- return kEpidBadArgErr;
- } else {
- return kEpidMathErr;
- }
- }
+ result = SetFfElementOctString(str, ipp_str_size, ff_elem, ff);
- return kEpidNoErr;
+ return result;
}
/// Gets the prime value of a finite field
/*!
- This function returns a new bignum containing the field's prime value.
- A new bignum is returned so that callers do not have to figure out the proper
- size.
+ This function returns a reference to the bignum containing the field's prime
+ value.
This function only works with non-composite fields.
@@ -488,53 +631,25 @@ EpidStatus ReadFfElement(FiniteField* ff, void const* ff_elem_str,
\returns ::EpidStatus
*/
EpidStatus GetFiniteFieldPrime(FiniteField* ff, BigNum** bn) {
- EpidStatus result = kEpidErr;
- IppStatus sts;
- BigNum* prime_bn = NULL;
- Ipp32u* prime_bnu = NULL;
if (!ff || !bn) {
return kEpidBadArgErr;
}
if (!ff->ipp_ff) {
return kEpidBadArgErr;
}
- if (ff->info.basicGFdegree != 1 || ff->info.groundGFdegree != 1) {
+ if (ff->basic_degree != 1 || ff->ground_degree != 1) {
return kEpidBadArgErr;
}
- do {
- size_t elem_dword_size = ff->info.elementLen;
- size_t elem_bytes_size = elem_dword_size * sizeof(Ipp32u);
- result = NewBigNum(elem_bytes_size, &prime_bn);
- if (kEpidNoErr != result) {
- break;
- }
- prime_bnu = (Ipp32u*)SAFE_ALLOC(elem_bytes_size);
- if (NULL == prime_bnu) {
- result = kEpidMemAllocErr;
- break;
- }
- sts = ippsGFpGetModulus(ff->ipp_ff, prime_bnu);
- result = InitBigNumFromBnu(prime_bnu, elem_dword_size, prime_bn);
- if (kEpidNoErr != result) {
- break;
- }
- result = kEpidNoErr;
- } while (0);
- SAFE_FREE(prime_bnu);
- if (kEpidNoErr != result) {
- DeleteBigNum(&prime_bn);
- } else {
- *bn = prime_bn;
- }
- return result;
+ *bn = ff->modulus_0;
+ return kEpidNoErr;
}
EpidStatus InitFfElementFromBn(FiniteField* ff, BigNum* bn,
FfElement* ff_elem) {
EpidStatus result = kEpidErr;
- BigNum* prime_bn = NULL;
+ BigNum* prime_bn = NULL; // non-owning reference
BigNum* mod_bn = NULL;
- Ipp32u* mod_str = NULL;
+ BNU mod_str = NULL;
if (!ff || !bn || !ff_elem) {
return kEpidBadArgErr;
@@ -542,14 +657,14 @@ EpidStatus InitFfElementFromBn(FiniteField* ff, BigNum* bn,
if (!ff_elem->ipp_ff_elem || !ff->ipp_ff) {
return kEpidBadArgErr;
}
- if (ff->info.basicGFdegree != 1 || ff->info.groundGFdegree != 1) {
+ if (ff->basic_degree != 1 || ff->ground_degree != 1) {
return kEpidBadArgErr;
}
- if (ff->info.elementLen != ff_elem->info.elementLen) {
+ if (ff->element_len != ff_elem->element_len) {
return kEpidBadArgErr;
}
do {
- size_t elem_size = ff->info.elementLen * sizeof(Ipp32u);
+ size_t elem_size = ff->element_len * sizeof(Ipp32u);
result = NewBigNum(elem_size, &mod_bn);
if (kEpidNoErr != result) {
break;
@@ -563,7 +678,7 @@ EpidStatus InitFfElementFromBn(FiniteField* ff, BigNum* bn,
if (kEpidNoErr != result) {
break;
}
- mod_str = (Ipp32u*)SAFE_ALLOC(elem_size);
+ mod_str = (BNU)SAFE_ALLOC(elem_size);
if (NULL == mod_str) {
result = kEpidMemAllocErr;
break;
@@ -579,17 +694,17 @@ EpidStatus InitFfElementFromBn(FiniteField* ff, BigNum* bn,
result = kEpidNoErr;
} while (0);
SAFE_FREE(mod_str);
- DeleteBigNum(&prime_bn);
+ prime_bn = NULL;
DeleteBigNum(&mod_bn);
return result;
}
EpidStatus WriteFfElement(FiniteField* ff, FfElement const* ff_elem,
- void* ff_elem_str, size_t strlen) {
+ OctStr ff_elem_str, size_t strlen) {
IppStatus sts;
size_t strlen_required = 0;
size_t pad = 0;
- uint8_t* str = (uint8_t*)ff_elem_str;
+ IppOctStr str = (IppOctStr)ff_elem_str;
if (!ff || !ff_elem_str || !ff_elem) {
return kEpidBadArgErr;
@@ -600,17 +715,15 @@ EpidStatus WriteFfElement(FiniteField* ff, FfElement const* ff_elem,
if (INT_MAX < strlen) {
return kEpidBadArgErr;
}
- if (ff->info.elementLen != ff_elem->info.elementLen) {
+ if (ff->element_len != ff_elem->element_len) {
return kEpidBadArgErr;
}
- // ippsGFpGetElementOctString serialize value into a buffer consists
- // of "degree" number of chunks, where each chunk is of modulus byte size.
- strlen_required = ff->prime_modulus_size * ff->info.basicGFdegree;
+ strlen_required = ff->element_strlen_required;
// add zero padding for extension of a degree 1 (a prime field)
// so it can be deserialized into big number correctly.
- if (1 == ff->info.basicGFdegree && strlen_required < strlen) {
+ if (1 == ff->basic_degree && strlen_required < strlen) {
pad = strlen - strlen_required;
memset(str, 0, pad);
strlen -= pad;
@@ -641,9 +754,7 @@ EpidStatus FfNeg(FiniteField* ff, FfElement const* a, FfElement* r) {
} else if (!ff->ipp_ff || !a->ipp_ff_elem || !r->ipp_ff_elem) {
return kEpidBadArgErr;
}
- if (ff->info.elementLen != a->info.elementLen ||
- ff->info.elementLen != r->info.elementLen ||
- a->info.elementLen != r->info.elementLen) {
+ if (ff->element_len != a->element_len || ff->element_len != r->element_len) {
return kEpidBadArgErr;
}
sts = ippsGFpNeg(a->ipp_ff_elem, r->ipp_ff_elem, ff->ipp_ff);
@@ -665,9 +776,7 @@ EpidStatus FfInv(FiniteField* ff, FfElement const* a, FfElement* r) {
} else if (!ff->ipp_ff || !a->ipp_ff_elem || !r->ipp_ff_elem) {
return kEpidBadArgErr;
}
- if (ff->info.elementLen != a->info.elementLen ||
- ff->info.elementLen != r->info.elementLen ||
- a->info.elementLen != r->info.elementLen) {
+ if (ff->element_len != a->element_len || ff->element_len != r->element_len) {
return kEpidBadArgErr;
}
// Invert the element
@@ -693,11 +802,8 @@ EpidStatus FfAdd(FiniteField* ff, FfElement const* a, FfElement const* b,
!r->ipp_ff_elem) {
return kEpidBadArgErr;
}
- if (ff->info.elementLen != a->info.elementLen ||
- ff->info.elementLen != b->info.elementLen ||
- ff->info.elementLen != r->info.elementLen ||
- a->info.elementLen != b->info.elementLen ||
- a->info.elementLen != r->info.elementLen) {
+ if (ff->element_len != a->element_len || ff->element_len != b->element_len ||
+ ff->element_len != r->element_len) {
return kEpidBadArgErr;
}
@@ -719,11 +825,9 @@ EpidStatus FfSub(FiniteField* ff, FfElement const* a, FfElement const* b,
!r->ipp_ff_elem) {
return kEpidBadArgErr;
}
- if (ff->info.elementLen != a->info.elementLen ||
- ff->info.elementLen != b->info.elementLen ||
- ff->info.elementLen != r->info.elementLen ||
- a->info.elementLen != b->info.elementLen ||
- a->info.elementLen != r->info.elementLen) {
+
+ if (ff->element_len != a->element_len || ff->element_len != b->element_len ||
+ ff->element_len != r->element_len) {
return kEpidBadArgErr;
}
@@ -747,16 +851,14 @@ EpidStatus FfMul(FiniteField* ff, FfElement const* a, FfElement const* b,
return kEpidBadArgErr;
}
// Multiplies elements
- if (a->info.elementLen != b->info.elementLen &&
- a->info.elementLen == a->info.groundGFdegree * b->info.elementLen) {
- sts = ippsGFpMul_GFpE(a->ipp_ff_elem, b->ipp_ff_elem, r->ipp_ff_elem,
- ff->ipp_ff);
+ if (a->element_len != b->element_len &&
+ a->element_len == a->degree * b->element_len) {
+ sts = ippsGFpMul_PE(a->ipp_ff_elem, b->ipp_ff_elem, r->ipp_ff_elem,
+ ff->ipp_ff);
} else {
- if (ff->info.elementLen != a->info.elementLen ||
- ff->info.elementLen != b->info.elementLen ||
- ff->info.elementLen != r->info.elementLen ||
- a->info.elementLen != b->info.elementLen ||
- a->info.elementLen != r->info.elementLen) {
+ if (ff->element_len != a->element_len ||
+ ff->element_len != b->element_len ||
+ ff->element_len != r->element_len) {
return kEpidBadArgErr;
}
sts =
@@ -781,7 +883,7 @@ EpidStatus FfIsZero(FiniteField* ff, FfElement const* a, bool* is_zero) {
} else if (!ff->ipp_ff || !a->ipp_ff_elem) {
return kEpidBadArgErr;
}
- if (ff->info.elementLen != a->info.elementLen) {
+ if (ff->element_len != a->element_len) {
return kEpidBadArgErr;
}
// Check if the element is zero
@@ -804,7 +906,7 @@ EpidStatus FfIsZero(FiniteField* ff, FfElement const* a, bool* is_zero) {
EpidStatus FfExp(FiniteField* ff, FfElement const* a, BigNum const* b,
FfElement* r) {
EpidStatus result = kEpidErr;
- Ipp8u* scratch_buffer = NULL;
+ OctStr scratch_buffer = NULL;
int exp_bit_size = 0;
int element_size = 0;
@@ -818,9 +920,8 @@ EpidStatus FfExp(FiniteField* ff, FfElement const* a, BigNum const* b,
result = kEpidBadArgErr;
break;
}
- if (ff->info.elementLen != a->info.elementLen ||
- ff->info.elementLen != r->info.elementLen ||
- a->info.elementLen != r->info.elementLen) {
+ if (ff->element_len != a->element_len ||
+ ff->element_len != r->element_len) {
return kEpidBadArgErr;
}
@@ -836,7 +937,7 @@ EpidStatus FfExp(FiniteField* ff, FfElement const* a, BigNum const* b,
break;
}
- scratch_buffer = (Ipp8u*)SAFE_ALLOC(element_size);
+ scratch_buffer = (OctStr)SAFE_ALLOC(element_size);
if (!scratch_buffer) {
result = kEpidMemAllocErr;
break;
@@ -864,7 +965,7 @@ EpidStatus FfMultiExp(FiniteField* ff, FfElement const** p, BigNumStr const** b,
IppsGFpElement** ipp_p = NULL;
IppsBigNumState** ipp_b = NULL;
BigNum** bignums = NULL;
- Ipp8u* scratch_buffer = NULL;
+ OctStr scratch_buffer = NULL;
int i = 0;
int ipp_m = 0;
@@ -889,11 +990,11 @@ EpidStatus FfMultiExp(FiniteField* ff, FfElement const** p, BigNumStr const** b,
if (!p[i]->ipp_ff_elem) {
return kEpidBadArgErr;
}
- if (ff->info.elementLen != p[i]->info.elementLen) {
+ if (ff->element_len != p[i]->element_len) {
return kEpidBadArgErr;
}
}
- if (ff->info.elementLen != r->info.elementLen) {
+ if (ff->element_len != r->element_len) {
return kEpidBadArgErr;
}
@@ -942,7 +1043,7 @@ EpidStatus FfMultiExp(FiniteField* ff, FfElement const** p, BigNumStr const** b,
break;
}
// allocate memory for scratch buffer
- scratch_buffer = (Ipp8u*)SAFE_ALLOC(scratch_buffer_size);
+ scratch_buffer = (OctStr)SAFE_ALLOC(scratch_buffer_size);
if (!scratch_buffer) {
result = kEpidMemAllocErr;
break;
@@ -978,9 +1079,8 @@ EpidStatus FfMultiExpBn(FiniteField* ff, FfElement const** p, BigNum const** b,
EpidStatus result = kEpidErr;
IppsGFpElement** ipp_p = NULL;
IppsBigNumState** ipp_b = NULL;
- Ipp8u* scratch_buffer = NULL;
+ OctStr scratch_buffer = NULL;
- size_t s = 0;
int exp_bit_size = 0;
size_t i = 0;
int ipp_m = 0;
@@ -990,15 +1090,9 @@ EpidStatus FfMultiExpBn(FiniteField* ff, FfElement const** p, BigNum const** b,
return kEpidBadArgErr;
} else if (!ff->ipp_ff || !r->ipp_ff_elem || m <= 0) {
return kEpidBadArgErr;
- } else if (ff->info.elementLen != r->info.elementLen) {
+ } else if (ff->element_len != r->element_len) {
return kEpidBadArgErr;
}
- for (s = 0; s < m; s++) {
- if (!p[s] || !b[s]) {
- return kEpidBadArgErr;
- }
- }
-
// because we use ipp function with number of items parameter
// defined as "int" we need to verify that input length
// do not exceed INT_MAX to avoid overflow
@@ -1008,13 +1102,10 @@ EpidStatus FfMultiExpBn(FiniteField* ff, FfElement const** p, BigNum const** b,
ipp_m = (int)m;
for (i = 0; i < m; i++) {
int b_size = 0;
- if (!p[i]) {
- return kEpidBadArgErr;
- }
- if (!p[i]->ipp_ff_elem) {
+ if (!p[i] || !p[i]->ipp_ff_elem || !b[i] || !b[i]->ipp_bn) {
return kEpidBadArgErr;
}
- if (ff->info.elementLen != p[i]->info.elementLen) {
+ if (ff->element_len != p[i]->element_len) {
return kEpidBadArgErr;
}
sts = ippsGetSize_BN(b[i]->ipp_bn, &b_size);
@@ -1058,7 +1149,7 @@ EpidStatus FfMultiExpBn(FiniteField* ff, FfElement const** p, BigNum const** b,
break;
}
// allocate memory for scratch buffer
- scratch_buffer = (Ipp8u*)SAFE_ALLOC(scratch_buffer_size);
+ scratch_buffer = (OctStr)SAFE_ALLOC(scratch_buffer_size);
if (!scratch_buffer) {
result = kEpidMemAllocErr;
break;
@@ -1102,9 +1193,7 @@ EpidStatus FfIsEqual(FiniteField* ff, FfElement const* a, FfElement const* b,
if (!ff->ipp_ff || !a->ipp_ff_elem || !b->ipp_ff_elem) {
return kEpidBadArgErr;
}
- if (ff->info.elementLen != a->info.elementLen ||
- ff->info.elementLen != b->info.elementLen ||
- a->info.elementLen != b->info.elementLen) {
+ if (ff->element_len != a->element_len || ff->element_len != b->element_len) {
return kEpidBadArgErr;
}
@@ -1121,12 +1210,12 @@ EpidStatus FfIsEqual(FiniteField* ff, FfElement const* a, FfElement const* b,
return kEpidNoErr;
}
-EpidStatus FfHash(FiniteField* ff, void const* msg, size_t msg_len,
+EpidStatus FfHash(FiniteField* ff, ConstOctStr msg, size_t msg_len,
HashAlg hash_alg, FfElement* r) {
EpidStatus result = kEpidErr;
do {
IppStatus sts = ippStsNoErr;
- IppHashID hash_id;
+ IppHashAlgId hash_id;
int ipp_msg_len = 0;
if (!ff || !msg || !r) {
result = kEpidBadArgErr;
@@ -1145,20 +1234,22 @@ EpidStatus FfHash(FiniteField* ff, void const* msg, size_t msg_len,
ipp_msg_len = (int)msg_len;
if (kSha256 == hash_alg) {
- hash_id = ippSHA256;
+ hash_id = ippHashAlg_SHA256;
} else if (kSha384 == hash_alg) {
- hash_id = ippSHA384;
+ hash_id = ippHashAlg_SHA384;
} else if (kSha512 == hash_alg) {
- hash_id = ippSHA512;
+ hash_id = ippHashAlg_SHA512;
+ } else if (kSha512_256 == hash_alg) {
+ hash_id = ippHashAlg_SHA512_256;
} else {
result = kEpidHashAlgorithmNotSupported;
break;
}
- if (ff->info.elementLen != r->info.elementLen) {
+ if (ff->element_len != r->element_len) {
return kEpidBadArgErr;
}
- sts = ippsGFpSetElementHash(msg, ipp_msg_len, hash_id, r->ipp_ff_elem,
- ff->ipp_ff);
+ sts = ippsGFpSetElementHash(msg, ipp_msg_len, r->ipp_ff_elem, ff->ipp_ff,
+ hash_id);
if (ippStsNoErr != sts) {
if (ippStsContextMatchErr == sts || ippStsBadArgErr == sts ||
ippStsLengthErr == sts) {
@@ -1177,13 +1268,10 @@ EpidStatus FfHash(FiniteField* ff, void const* msg, size_t msg_len,
EpidStatus FfGetRandom(FiniteField* ff, BigNumStr const* low_bound,
BitSupplier rnd_func, void* rnd_param, FfElement* r) {
EpidStatus result = kEpidErr;
- IppsGFpElement* low = NULL;
+ FfElement* low = NULL;
do {
IppStatus sts = ippStsNoErr;
- unsigned int ctxsize = 0;
unsigned int rngloopCount = RNG_WATCHDOG;
- Ipp32u bnu_low_bound[sizeof(BigNumStr) / sizeof(Ipp32u)];
- int bnu_size;
if (!ff || !low_bound || !rnd_func || !r) {
result = kEpidBadArgErr;
break;
@@ -1192,41 +1280,28 @@ EpidStatus FfGetRandom(FiniteField* ff, BigNumStr const* low_bound,
result = kEpidBadArgErr;
break;
}
- if (ff->info.elementLen != r->info.elementLen) {
+ if (ff->element_len != r->element_len) {
return kEpidBadArgErr;
}
// create a new FfElement to hold low_bound
- sts = ippsGFpElementGetSize(ff->ipp_ff, (int*)&ctxsize);
- if (ippStsNoErr != sts) {
- result = kEpidMathErr;
- break;
- }
- // Allocate space for ipp Ff Element context
- low = (IppsGFpElement*)SAFE_ALLOC(ctxsize);
- if (!low) {
- result = kEpidMemAllocErr;
- break;
- }
- bnu_size = OctStr2Bnu(bnu_low_bound, low_bound, sizeof(*low_bound));
- if (bnu_size < 0) {
- result = kEpidMathErr;
+ result = NewFfElement(ff, &low);
+ if (kEpidNoErr != result) {
break;
}
- // initialize state
- sts = ippsGFpElementInit(bnu_low_bound, bnu_size, low, ff->ipp_ff);
- if (ippStsNoErr != sts) {
- result = kEpidMathErr;
+ result = ReadFfElement(ff, low_bound, sizeof(*low_bound), low);
+ if (kEpidNoErr != result) {
break;
}
do {
int cmpResult = IPP_IS_NE;
- sts = ippsGFpSetElementRandom((IppBitSupplier)rnd_func, rnd_param,
- r->ipp_ff_elem, ff->ipp_ff);
+ sts = ippsGFpSetElementRandom(r->ipp_ff_elem, ff->ipp_ff,
+ (IppBitSupplier)rnd_func, rnd_param);
if (ippStsNoErr != sts) {
result = kEpidMathErr;
break;
}
- sts = ippsGFpCmpElement(r->ipp_ff_elem, low, &cmpResult, ff->ipp_ff);
+ sts = ippsGFpCmpElement(r->ipp_ff_elem, low->ipp_ff_elem, &cmpResult,
+ ff->ipp_ff);
if (ippStsNoErr != sts) {
result = kEpidMathErr;
break;
@@ -1241,20 +1316,12 @@ EpidStatus FfGetRandom(FiniteField* ff, BigNumStr const* low_bound,
}
} while (--rngloopCount);
} while (0);
- SAFE_FREE(low);
+ DeleteFfElement(&low);
return result;
}
EpidStatus FfSqrt(FiniteField* ff, FfElement const* a, FfElement* r) {
EpidStatus result = kEpidErr;
- Ipp8u one_str = 1;
- BigNumStr qm1_str;
- const BigNumStr zero_str = {0};
- bool is_equal = false;
- unsigned int s;
- bool is_even = false;
- unsigned int i;
- BigNum* prime = NULL;
BigNum* qm1 = NULL;
BigNum* one = NULL;
FfElement* qm1_ffe = NULL;
@@ -1281,6 +1348,15 @@ EpidStatus FfSqrt(FiniteField* ff, FfElement const* a, FfElement* r) {
return kEpidBadArgErr;
}
do {
+ BigNum* prime = NULL; // non-owning reference
+ bool is_equal = false;
+ unsigned int s;
+ bool is_even = false;
+ unsigned int i;
+ Ipp8u one_str = 1;
+ BigNumStr qm1_str;
+ const BigNumStr zero_str = {0};
+
result = GetFiniteFieldPrime(ff, &prime);
if (kEpidNoErr != result) {
break;
@@ -1556,6 +1632,7 @@ EpidStatus FfSqrt(FiniteField* ff, FfElement const* a, FfElement* r) {
break;
}
result = kEpidNoErr;
+ prime = NULL;
} while (0);
DeleteFfElement(&dd);
DeleteFfElement(&gtp1d2);
@@ -1578,6 +1655,5 @@ EpidStatus FfSqrt(FiniteField* ff, FfElement const* a, FfElement* r) {
DeleteFfElement(&qm1_ffe);
DeleteBigNum(&one);
DeleteBigNum(&qm1);
- DeleteBigNum(&prime);
return result;
}
diff --git a/epid/common/math/src/pairing-internal.h b/epid/common/math/src/pairing-internal.h
index 5903706..af14ac6 100644
--- a/epid/common/math/src/pairing-internal.h
+++ b/epid/common/math/src/pairing-internal.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -31,9 +31,9 @@ struct PairingState {
/// parameters of G1
bool neg; ///< 8-bit integer representing a Boolean value
FfElement* g[3][5]; ///< 15 elements in Fq2
- FiniteField Fq; ///< Fq
- FiniteField Fq2; ///< Fq2
- FiniteField Fq6; ///< Fq6
+ FiniteField* Fq; ///< Fq
+ FiniteField* Fq2; ///< Fq2
+ FiniteField* Fq6; ///< Fq6
};
#endif // EPID_COMMON_MATH_SRC_PAIRING_INTERNAL_H_
diff --git a/epid/common/math/src/pairing.c b/epid/common/math/src/pairing.c
index 079ffff..ef4c224 100644
--- a/epid/common/math/src/pairing.c
+++ b/epid/common/math/src/pairing.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -27,7 +27,6 @@
#include "epid/common/math/src/pairing-internal.h"
#include "epid/common/src/memory.h"
#include "ext/ipp/include/ippcp.h"
-#include "ext/ipp/include/ippcpepid.h"
/// Handle Ipp Errors with Break
#define BREAK_ON_IPP_ERROR(sts, ret) \
@@ -128,23 +127,22 @@ EpidStatus NewPairingState(EcGroup const* ga, EcGroup const* gb,
PairingState** ps) {
EpidStatus result = kEpidErr;
FfElement* xi = NULL;
- PairingState* paring_state_ctx = NULL;
+ PairingState* pairing_state_ctx = NULL;
BigNum* e = NULL;
BigNum* one = NULL;
- BigNum* q = NULL;
BigNum* six = NULL;
- Ipp8u* scratch_buffer = NULL;
+ OctStr scratch_buffer = NULL;
do {
IppStatus sts = ippStsNoErr;
IppsGFpState* Fq6 = NULL;
IppsGFpState* Fq2 = NULL;
IppsGFpState* Fq = NULL;
- FiniteField Ffq2;
- IppsGFpInfo info = {0};
- Fq2ElemDat Fq6IrrPolynomial[3 + 1] = {0};
+ FiniteField* Ffq6 = NULL;
+ FiniteField* Ffq2 = NULL;
+ FiniteField* Ffq = NULL;
+ Fq2ElemDat Fq6IrrPolynomial = {0};
uint8_t one_str[] = {1};
uint8_t six_str[] = {6};
- FqElemDat qDat = {0};
int i = 0;
int j = 0;
int bufferSize = 0;
@@ -159,59 +157,60 @@ EpidStatus NewPairingState(EcGroup const* ga, EcGroup const* gb,
break;
}
// get Fq6, Fq2, Fq
- sts = ippsGFpGetInfo(ff->ipp_ff, &info);
- BREAK_ON_IPP_ERROR(sts, result);
- Fq6 = (IppsGFpState*)info.pGroundGF;
- sts = ippsGFpGetInfo(Fq6, &info);
- BREAK_ON_IPP_ERROR(sts, result);
- Fq2 = (IppsGFpState*)info.pGroundGF;
- result = InitFiniteFieldFromIpp(Fq2, &Ffq2);
- BREAK_ON_EPID_ERROR(result);
- sts = ippsGFpGetInfo(Fq2, &info);
- BREAK_ON_IPP_ERROR(sts, result);
- Fq = (IppsGFpState*)info.pGroundGF;
- // now get ref to modulus of Fq
- sts = ippsGFpGetModulus(Fq, (Ipp32u*)&qDat);
- BREAK_ON_IPP_ERROR(sts, result);
+ Ffq6 = ff->ground_ff;
+ if (!Ffq6) {
+ result = kEpidBadArgErr;
+ break;
+ }
+ Fq6 = Ffq6->ipp_ff;
+ Ffq2 = Ffq6->ground_ff;
+ if (!Ffq2) {
+ result = kEpidBadArgErr;
+ break;
+ }
+ Fq2 = Ffq2->ipp_ff;
+ Ffq = Ffq2->ground_ff;
+ if (!Ffq) {
+ result = kEpidBadArgErr;
+ break;
+ }
+ Fq = Ffq->ipp_ff;
// extract xi from Fq6 irr poly
- result = NewFfElement(&Ffq2, &xi);
+ result = NewFfElement(Ffq2, &xi);
+ BREAK_ON_EPID_ERROR(result);
+ result = WriteBigNum(Ffq6->modulus_0, sizeof(Fq6IrrPolynomial),
+ &Fq6IrrPolynomial);
+ BREAK_ON_EPID_ERROR(result);
+ result = SetFfElementOctString(&Fq6IrrPolynomial, sizeof(Fq6IrrPolynomial),
+ xi, Ffq2);
BREAK_ON_EPID_ERROR(result);
- sts = ippsGFpGetModulus(Fq6, (Ipp32u*)&Fq6IrrPolynomial[0]);
- BREAK_ON_IPP_ERROR(sts, result);
- sts = ippsGFpSetElement((Ipp32u const*)&Fq6IrrPolynomial[0],
- sizeof(Fq6IrrPolynomial[0]) / sizeof(Ipp32u),
- xi->ipp_ff_elem, Fq2);
- BREAK_ON_IPP_ERROR(sts, result);
// first coefficent is -xi
sts = ippsGFpNeg(xi->ipp_ff_elem, xi->ipp_ff_elem, Fq2);
BREAK_ON_IPP_ERROR(sts, result);
- paring_state_ctx = (PairingState*)SAFE_ALLOC(sizeof(PairingState));
- if (!paring_state_ctx) {
+ pairing_state_ctx = (PairingState*)SAFE_ALLOC(sizeof(PairingState));
+ if (!pairing_state_ctx) {
result = kEpidMemAllocErr;
break;
}
// 1. Set param(pairing) = (param(G1), param(G2), param(GT), t, neg)
- paring_state_ctx->ga = (EcGroup*)ga;
- paring_state_ctx->gb = (EcGroup*)gb;
- paring_state_ctx->ff = ff;
- result = NewBigNum(sizeof(BigNumStr), &paring_state_ctx->t);
- BREAK_ON_EPID_ERROR(result);
- result = ReadBigNum(t, sizeof(BigNumStr), paring_state_ctx->t);
- BREAK_ON_EPID_ERROR(result);
- paring_state_ctx->neg = neg;
- result = InitFiniteFieldFromIpp(Fq6, &(paring_state_ctx->Fq6));
+ pairing_state_ctx->ga = (EcGroup*)ga;
+ pairing_state_ctx->gb = (EcGroup*)gb;
+ pairing_state_ctx->ff = ff;
+ result = NewBigNum(sizeof(BigNumStr), &pairing_state_ctx->t);
BREAK_ON_EPID_ERROR(result);
- result = InitFiniteFieldFromIpp(Fq2, &(paring_state_ctx->Fq2));
- BREAK_ON_EPID_ERROR(result);
- result = InitFiniteFieldFromIpp(Fq, &(paring_state_ctx->Fq));
+ result = ReadBigNum(t, sizeof(BigNumStr), pairing_state_ctx->t);
BREAK_ON_EPID_ERROR(result);
+ pairing_state_ctx->neg = neg;
+ pairing_state_ctx->Fq6 = Ffq6;
+ pairing_state_ctx->Fq2 = Ffq2;
+ pairing_state_ctx->Fq = Ffq;
// 2. Let g[0][0], ..., g[0][4], g[1][0], ..., g[1][4], g[2][0], ...,
// g[2][4] be 15 elements in Fq2.
for (i = 0; i < 3; i++) {
for (j = 0; j < 5; j++) {
- result = NewFfElement(&Ffq2, &paring_state_ctx->g[i][j]);
+ result = NewFfElement(Ffq2, &pairing_state_ctx->g[i][j]);
BREAK_ON_EPID_ERROR(result);
}
}
@@ -220,15 +219,10 @@ EpidStatus NewPairingState(EcGroup const* ga, EcGroup const* gb,
BREAK_ON_EPID_ERROR(result);
result = ReadBigNum(one_str, sizeof(one_str), one);
BREAK_ON_EPID_ERROR(result);
- result = NewBigNum(sizeof(BigNumStr), &q);
- BREAK_ON_EPID_ERROR(result);
- sts = ippsSet_BN(IppsBigNumPOS, sizeof(qDat) / sizeof(Ipp32u),
- (Ipp32u*)&qDat, q->ipp_bn);
- BREAK_ON_IPP_ERROR(sts, result);
result = NewBigNum(sizeof(BigNumStr), &e);
BREAK_ON_EPID_ERROR(result);
// q - 1
- sts = ippsSub_BN(q->ipp_bn, one->ipp_bn, e->ipp_bn);
+ sts = ippsSub_BN(Ffq->modulus_0->ipp_bn, one->ipp_bn, e->ipp_bn);
BREAK_ON_IPP_ERROR(sts, result);
result = NewBigNum(sizeof(BigNumStr), &six);
BREAK_ON_EPID_ERROR(result);
@@ -243,58 +237,57 @@ EpidStatus NewPairingState(EcGroup const* ga, EcGroup const* gb,
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpScratchBufferSize(1, bitSize, Fq2, &bufferSize);
BREAK_ON_IPP_ERROR(sts, result);
- scratch_buffer = (Ipp8u*)SAFE_ALLOC(bufferSize);
+ scratch_buffer = (OctStr)SAFE_ALLOC(bufferSize);
if (!scratch_buffer) {
result = kEpidMemAllocErr;
break;
}
- sts =
- ippsGFpExp(xi->ipp_ff_elem, e->ipp_bn,
- paring_state_ctx->g[0][0]->ipp_ff_elem, Fq2, scratch_buffer);
+ sts = ippsGFpExp(xi->ipp_ff_elem, e->ipp_bn,
+ pairing_state_ctx->g[0][0]->ipp_ff_elem, Fq2,
+ scratch_buffer);
BREAK_ON_IPP_ERROR(sts, result);
// 5. For i = 0, ..., 4, compute
for (i = 0; i < 5; i++) {
// a. If i > 0, compute g[0][i] = Fq2.mul(g[0][i-1], g[0][0]).
if (i > 0) {
- sts = ippsGFpMul(paring_state_ctx->g[0][i - 1]->ipp_ff_elem,
- paring_state_ctx->g[0][0]->ipp_ff_elem,
- paring_state_ctx->g[0][i]->ipp_ff_elem, Fq2);
+ sts = ippsGFpMul(pairing_state_ctx->g[0][i - 1]->ipp_ff_elem,
+ pairing_state_ctx->g[0][0]->ipp_ff_elem,
+ pairing_state_ctx->g[0][i]->ipp_ff_elem, Fq2);
}
// b. Compute g[1][i] = Fq2.conjugate(g[0][i]),
- sts = ippsGFpConj(paring_state_ctx->g[0][i]->ipp_ff_elem,
- paring_state_ctx->g[1][i]->ipp_ff_elem, Fq2);
+ sts = ippsGFpConj(pairing_state_ctx->g[0][i]->ipp_ff_elem,
+ pairing_state_ctx->g[1][i]->ipp_ff_elem, Fq2);
// c. Compute g[1][i] = Fq2.mul(g[0][i], g[1][i]),
- sts = ippsGFpMul(paring_state_ctx->g[0][i]->ipp_ff_elem,
- paring_state_ctx->g[1][i]->ipp_ff_elem,
- paring_state_ctx->g[1][i]->ipp_ff_elem, Fq2);
+ sts = ippsGFpMul(pairing_state_ctx->g[0][i]->ipp_ff_elem,
+ pairing_state_ctx->g[1][i]->ipp_ff_elem,
+ pairing_state_ctx->g[1][i]->ipp_ff_elem, Fq2);
// d. Compute g[2][i] = Fq2.mul(g[0][i], g[1][i]).
- sts = ippsGFpMul(paring_state_ctx->g[0][i]->ipp_ff_elem,
- paring_state_ctx->g[1][i]->ipp_ff_elem,
- paring_state_ctx->g[2][i]->ipp_ff_elem, Fq2);
+ sts = ippsGFpMul(pairing_state_ctx->g[0][i]->ipp_ff_elem,
+ pairing_state_ctx->g[1][i]->ipp_ff_elem,
+ pairing_state_ctx->g[2][i]->ipp_ff_elem, Fq2);
}
// 6. Save g[0][0], ..., g[0][4], g[1][0], ..., g[1][4], g[2][0], ...,
// g[2][4]
// for the pairing operations.
- *ps = paring_state_ctx;
+ *ps = pairing_state_ctx;
result = kEpidNoErr;
} while (0);
SAFE_FREE(scratch_buffer)
DeleteBigNum(&six);
DeleteBigNum(&e);
- DeleteBigNum(&q);
DeleteBigNum(&one);
DeleteFfElement(&xi);
if (kEpidNoErr != result) {
- if (paring_state_ctx) {
+ if (pairing_state_ctx) {
int i = 0;
int j = 0;
for (i = 0; i < 3; i++) {
for (j = 0; j < 5; j++) {
- DeleteFfElement(&paring_state_ctx->g[i][j]);
+ DeleteFfElement(&pairing_state_ctx->g[i][j]);
}
}
- DeleteBigNum(&paring_state_ctx->t);
- SAFE_FREE(paring_state_ctx);
+ DeleteBigNum(&pairing_state_ctx->t);
+ SAFE_FREE(pairing_state_ctx);
}
}
return result;
@@ -325,8 +318,8 @@ void DeletePairingState(PairingState** ps) {
}
}
-EpidStatus Pairing(PairingState* ps, FfElement* d, EcPoint const* a,
- EcPoint const* b) {
+EpidStatus Pairing(PairingState* ps, EcPoint const* a, EcPoint const* b,
+ FfElement* d) {
EpidStatus result = kEpidErr;
FfElement* ax = NULL;
FfElement* ay = NULL;
@@ -349,6 +342,9 @@ EpidStatus Pairing(PairingState* ps, FfElement* d, EcPoint const* a,
Ipp32u two_dat[] = {2};
Ipp32u six_dat[] = {6};
Ipp32u one_dat[] = {1};
+ G1ElemStr first_val_str = {0};
+ G2ElemStr second_val_str = {0};
+ bool in_group = true;
int s_ternary[sizeof(BigNumStr) * CHAR_BIT] = {0};
int i = 0;
int n = 0;
@@ -357,8 +353,12 @@ EpidStatus Pairing(PairingState* ps, FfElement* d, EcPoint const* a,
result = kEpidBadArgErr;
break;
}
+ if (!ps->Fq || !ps->Fq2) {
+ result = kEpidBadArgErr;
+ break;
+ }
if (!d->ipp_ff_elem || !a->ipp_ec_pt || !b->ipp_ec_pt || !ps->ff ||
- !ps->ff->ipp_ff || !ps->Fq.ipp_ff || !ps->Fq2.ipp_ff || !ps->t ||
+ !ps->ff->ipp_ff || !ps->Fq->ipp_ff || !ps->Fq2->ipp_ff || !ps->t ||
!ps->t->ipp_bn || !ps->ga || !ps->ga->ipp_ec || !ps->gb ||
!ps->gb->ipp_ec) {
result = kEpidBadArgErr;
@@ -366,29 +366,29 @@ EpidStatus Pairing(PairingState* ps, FfElement* d, EcPoint const* a,
}
// Let ax, ay be elements in Fq. Let bx, by, x, y, z, z2, bx', by'
// be elements in Fq2. Let f be a variable in GT.
- result = NewFfElement(&ps->Fq, &ax);
+ result = NewFfElement(ps->Fq, &ax);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq, &ay);
+ result = NewFfElement(ps->Fq, &ay);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq2, &bx);
+ result = NewFfElement(ps->Fq2, &bx);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq2, &by);
+ result = NewFfElement(ps->Fq2, &by);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq2, &x);
+ result = NewFfElement(ps->Fq2, &x);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq2, &y);
+ result = NewFfElement(ps->Fq2, &y);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq2, &z);
+ result = NewFfElement(ps->Fq2, &z);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq2, &z2);
+ result = NewFfElement(ps->Fq2, &z2);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq2, &bx_);
+ result = NewFfElement(ps->Fq2, &bx_);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq2, &by_);
+ result = NewFfElement(ps->Fq2, &by_);
BREAK_ON_EPID_ERROR(result);
result = NewFfElement(ps->ff, &f);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq2, &neg_qy);
+ result = NewFfElement(ps->Fq2, &neg_qy);
BREAK_ON_EPID_ERROR(result);
// 1. If neg = 0, compute integer s = 6t + 2, otherwise, compute
@@ -420,23 +420,43 @@ EpidStatus Pairing(PairingState* ps, FfElement* d, EcPoint const* a,
Ternary(s_ternary, &n, sizeof(s_ternary) / sizeof(s_ternary[0]), s);
BREAK_ON_EPID_ERROR(result);
// 3. Set (ax, ay) = E(Fq).outputPoint(a)
+ // check if a is in ga that was used to create ps
+ result = WriteEcPoint(ps->ga, a, &first_val_str, sizeof(first_val_str));
+ BREAK_ON_EPID_ERROR(result);
+ result =
+ EcInGroup(ps->ga, &first_val_str, sizeof(first_val_str), &in_group);
+ BREAK_ON_EPID_ERROR(result);
+ if (false == in_group) {
+ result = kEpidBadArgErr;
+ break;
+ }
sts = ippsGFpECGetPoint(a->ipp_ec_pt, ax->ipp_ff_elem, ay->ipp_ff_elem,
ps->ga->ipp_ec);
BREAK_ON_IPP_ERROR(sts, result);
// 4. Set (bx, by) = E(Fq2).outputPoint(b).
+ // check if b is in gb that was used to create ps
+ result = WriteEcPoint(ps->gb, b, &second_val_str, sizeof(second_val_str));
+ BREAK_ON_EPID_ERROR(result);
+ result =
+ EcInGroup(ps->gb, &second_val_str, sizeof(second_val_str), &in_group);
+ BREAK_ON_EPID_ERROR(result);
+ if (false == in_group) {
+ result = kEpidBadArgErr;
+ break;
+ }
sts = ippsGFpECGetPoint(b->ipp_ec_pt, bx->ipp_ff_elem, by->ipp_ff_elem,
ps->gb->ipp_ec);
BREAK_ON_IPP_ERROR(sts, result);
// 5. Set X = bx, Y = by, Z = Z2 = 1.
- sts = ippsGFpCpyElement(bx->ipp_ff_elem, x->ipp_ff_elem, ps->Fq2.ipp_ff);
+ sts = ippsGFpCpyElement(bx->ipp_ff_elem, x->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
- sts = ippsGFpCpyElement(by->ipp_ff_elem, y->ipp_ff_elem, ps->Fq2.ipp_ff);
+ sts = ippsGFpCpyElement(by->ipp_ff_elem, y->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSetElement(one_dat, sizeof(one_dat) / sizeof(Ipp32u),
- z->ipp_ff_elem, ps->Fq2.ipp_ff);
+ z->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSetElement(one_dat, sizeof(one_dat) / sizeof(Ipp32u),
- z2->ipp_ff_elem, ps->Fq2.ipp_ff);
+ z2->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// 6. Set d = 1.
sts = ippsGFpSetElement(one_dat, sizeof(one_dat) / sizeof(Ipp32u),
@@ -459,7 +479,7 @@ EpidStatus Pairing(PairingState* ps, FfElement* d, EcPoint const* a,
// i. Set (f, x, y, z, z2) = line(ax, ay, x, y, z, z2, bx,
// -by),
BREAK_ON_EPID_ERROR(result);
- sts = ippsGFpNeg(by->ipp_ff_elem, neg_qy->ipp_ff_elem, ps->Fq2.ipp_ff);
+ sts = ippsGFpNeg(by->ipp_ff_elem, neg_qy->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
result = Line(ps->ff, f, x, y, z, z2, ax, ay, x, y, z, z2, bx, neg_qy);
BREAK_ON_EPID_ERROR(result);
@@ -482,7 +502,7 @@ EpidStatus Pairing(PairingState* ps, FfElement* d, EcPoint const* a,
// 8. if neg = true,
if (ps->neg) {
// a. Set Y = Fq2.negate(y),
- sts = ippsGFpNeg(y->ipp_ff_elem, y->ipp_ff_elem, ps->Fq2.ipp_ff);
+ sts = ippsGFpNeg(y->ipp_ff_elem, y->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// b. Set d = Fq12.conjugate(d).
sts = ippsGFpConj(d->ipp_ff_elem, d->ipp_ff_elem, ps->ff->ipp_ff);
@@ -501,7 +521,7 @@ EpidStatus Pairing(PairingState* ps, FfElement* d, EcPoint const* a,
result = PiOp(ps, bx_, by_, bx, by, 2);
BREAK_ON_EPID_ERROR(result);
// 13. Set by' = Fq2.negate(by').
- sts = ippsGFpNeg(by_->ipp_ff_elem, by_->ipp_ff_elem, ps->Fq2.ipp_ff);
+ sts = ippsGFpNeg(by_->ipp_ff_elem, by_->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// 14. Set (f, x, y, z, z2) = line(ax, ay, x, y, z, z2, bx', by').
result = Line(ps->ff, f, x, y, z, z2, ax, ay, x, y, z, z2, bx_, by_);
@@ -791,8 +811,9 @@ static EpidStatus PiOp(PairingState* ps, FfElement* x_out, FfElement* y_out,
IppStatus sts = ippStsNoErr;
IppsGFpState* Fq2 = 0;
IppsGFpState* Fq6 = 0;
- FiniteField* Fq12 = 0;
- IppsGFpInfo info = {0};
+ FiniteField* Ffq12 = 0;
+ FiniteField* Ffq6 = 0;
+ FiniteField* Ffq2 = 0;
// check parameters
if (!ps || !x_out || !y_out || !x || !y) {
return kEpidBadArgErr;
@@ -800,14 +821,21 @@ static EpidStatus PiOp(PairingState* ps, FfElement* x_out, FfElement* y_out,
if (e < 1 || e > 3) {
return kEpidBadArgErr;
}
- Fq12 = ps->ff;
+ Ffq12 = ps->ff;
// get Fq6, Fq2
- sts = ippsGFpGetInfo(Fq12->ipp_ff, &info);
- RETURN_ON_IPP_ERROR(sts);
- Fq6 = (IppsGFpState*)info.pGroundGF;
- sts = ippsGFpGetInfo(Fq6, &info);
- RETURN_ON_IPP_ERROR(sts);
- Fq2 = (IppsGFpState*)info.pGroundGF;
+ if (!Ffq12) {
+ return kEpidBadArgErr;
+ }
+ Ffq6 = Ffq12->ground_ff;
+ if (!Ffq6) {
+ return kEpidBadArgErr;
+ }
+ Fq6 = Ffq6->ipp_ff;
+ Ffq2 = Ffq6->ground_ff;
+ if (!Ffq2) {
+ return kEpidBadArgErr;
+ }
+ Fq2 = Ffq2->ipp_ff;
// 1. Set x' = x and y' = y.
sts = ippsGFpCpyElement(x->ipp_ff_elem, x_out->ipp_ff_elem, Fq2);
RETURN_ON_IPP_ERROR(sts);
@@ -853,18 +881,21 @@ static EpidStatus FrobeniusOp(PairingState* ps, FfElement* d_out,
if (!ps || !d_out || !a) {
return kEpidBadArgErr;
}
- if (e < 1 || e > 3 || !d_out->ipp_ff_elem || !a->ipp_ff_elem || !ps->ff ||
- !ps->ff->ipp_ff || !ps->Fq2.ipp_ff) {
+ if (!ps->ff || !ps->Fq2) {
+ return kEpidBadArgErr;
+ }
+ if (e < 1 || e > 3 || !d_out->ipp_ff_elem || !a->ipp_ff_elem ||
+ !ps->ff->ipp_ff || !ps->Fq2->ipp_ff) {
return kEpidBadArgErr;
}
for (i = 0; i < sizeof(d) / sizeof(FfElement*); i++) {
- result = NewFfElement(&ps->Fq2, &d[i]);
+ result = NewFfElement(ps->Fq2, &d[i]);
BREAK_ON_EPID_ERROR(result);
}
// 1. Let a = ((a[0], a[2], a[4]), (a[1], a[3], a[5])).
- sts = ippsGFpGetElement(a->ipp_ff_elem, (Ipp32u*)&a_dat,
+ sts = ippsGFpGetElement(a->ipp_ff_elem, (BNU)&a_dat,
sizeof(a_dat) / sizeof(Ipp32u), ps->ff->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// 2. Let d = ((d[0], d[2], d[4]), (d[1], d[3], d[5])).
@@ -872,66 +903,67 @@ static EpidStatus FrobeniusOp(PairingState* ps, FfElement* d_out,
// a. set d[i] = a[i].
sts = ippsGFpSetElement((Ipp32u*)&a_dat.x[0].x[0],
sizeof(a_dat.x[0].x[0]) / sizeof(Ipp32u),
- d[0]->ipp_ff_elem, ps->Fq2.ipp_ff);
+ d[0]->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSetElement((Ipp32u*)&a_dat.x[0].x[1],
sizeof(a_dat.x[0].x[1]) / sizeof(Ipp32u),
- d[2]->ipp_ff_elem, ps->Fq2.ipp_ff);
+ d[2]->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSetElement((Ipp32u*)&a_dat.x[0].x[2],
sizeof(a_dat.x[0].x[2]) / sizeof(Ipp32u),
- d[4]->ipp_ff_elem, ps->Fq2.ipp_ff);
+ d[4]->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSetElement((Ipp32u*)&a_dat.x[1].x[0],
sizeof(a_dat.x[1].x[0]) / sizeof(Ipp32u),
- d[1]->ipp_ff_elem, ps->Fq2.ipp_ff);
+ d[1]->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSetElement((Ipp32u*)&a_dat.x[1].x[1],
sizeof(a_dat.x[1].x[1]) / sizeof(Ipp32u),
- d[3]->ipp_ff_elem, ps->Fq2.ipp_ff);
+ d[3]->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSetElement((Ipp32u*)&a_dat.x[1].x[2],
sizeof(a_dat.x[1].x[2]) / sizeof(Ipp32u),
- d[5]->ipp_ff_elem, ps->Fq2.ipp_ff);
+ d[5]->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// b. If e = 1 or 3, set d[i] = Fq2.conjugate(d[i]).
if (1 == e || 3 == e) {
for (i = 0; i < sizeof(d) / sizeof(FfElement*); i++) {
- sts = ippsGFpConj(d[i]->ipp_ff_elem, d[i]->ipp_ff_elem, ps->Fq2.ipp_ff);
+ sts =
+ ippsGFpConj(d[i]->ipp_ff_elem, d[i]->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
}
}
// 4. For i = 1, ..., 5, compute d[i] = Fq2.mul(d[i], g[e-1][i-1]).
for (i = 1; i < sizeof(d) / sizeof(FfElement*); i++) {
sts = ippsGFpMul(d[i]->ipp_ff_elem, ps->g[e - 1][i - 1]->ipp_ff_elem,
- d[i]->ipp_ff_elem, ps->Fq2.ipp_ff);
+ d[i]->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
}
// 5. Return d.
- sts = ippsGFpGetElement(d[0]->ipp_ff_elem, (Ipp32u*)&d_dat.x[0].x[0],
+ sts = ippsGFpGetElement(d[0]->ipp_ff_elem, (BNU)&d_dat.x[0].x[0],
sizeof(d_dat.x[0].x[0]) / sizeof(Ipp32u),
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
- sts = ippsGFpGetElement(d[2]->ipp_ff_elem, (Ipp32u*)&d_dat.x[0].x[1],
+ sts = ippsGFpGetElement(d[2]->ipp_ff_elem, (BNU)&d_dat.x[0].x[1],
sizeof(d_dat.x[0].x[0]) / sizeof(Ipp32u),
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
- sts = ippsGFpGetElement(d[4]->ipp_ff_elem, (Ipp32u*)&d_dat.x[0].x[2],
+ sts = ippsGFpGetElement(d[4]->ipp_ff_elem, (BNU)&d_dat.x[0].x[2],
sizeof(d_dat.x[0].x[0]) / sizeof(Ipp32u),
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
- sts = ippsGFpGetElement(d[1]->ipp_ff_elem, (Ipp32u*)&d_dat.x[1].x[0],
+ sts = ippsGFpGetElement(d[1]->ipp_ff_elem, (BNU)&d_dat.x[1].x[0],
sizeof(d_dat.x[1].x[0]) / sizeof(Ipp32u),
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
- sts = ippsGFpGetElement(d[3]->ipp_ff_elem, (Ipp32u*)&d_dat.x[1].x[1],
+ sts = ippsGFpGetElement(d[3]->ipp_ff_elem, (BNU)&d_dat.x[1].x[1],
sizeof(d_dat.x[1].x[0]) / sizeof(Ipp32u),
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
- sts = ippsGFpGetElement(d[5]->ipp_ff_elem, (Ipp32u*)&d_dat.x[1].x[2],
+ sts = ippsGFpGetElement(d[5]->ipp_ff_elem, (BNU)&d_dat.x[1].x[2],
sizeof(d_dat.x[1].x[0]) / sizeof(Ipp32u),
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSetElement((Ipp32u*)&d_dat, sizeof(d_dat) / sizeof(Ipp32u),
d_out->ipp_ff_elem, ps->ff->ipp_ff);
@@ -977,8 +1009,8 @@ static EpidStatus Line(FiniteField* gt, FfElement* f, FfElement* x_out,
IppStatus sts = ippStsNoErr;
IppsGFpState* Fq2 = 0;
IppsGFpState* Fq6 = 0;
- IppsGFpInfo info = {0};
- FiniteField Ffq2;
+ FiniteField* Ffq6 = 0;
+ FiniteField* Ffq2 = 0;
// check parameters
if (!f || !x_out || !y_out || !z_out || !z2_out || !px || !py || !x || !y ||
@@ -995,62 +1027,64 @@ static EpidStatus Line(FiniteField* gt, FfElement* f, FfElement* x_out,
break;
}
// get Fq6, Fq2
- sts = ippsGFpGetInfo(gt->ipp_ff, &info);
- BREAK_ON_IPP_ERROR(sts, result);
- Fq6 = (IppsGFpState*)info.pGroundGF;
- sts = ippsGFpGetInfo(Fq6, &info);
- BREAK_ON_IPP_ERROR(sts, result);
- Fq2 = (IppsGFpState*)info.pGroundGF;
- result = InitFiniteFieldFromIpp(Fq2, &Ffq2);
- BREAK_ON_EPID_ERROR(result);
+ Ffq6 = gt->ground_ff;
+ if (!Ffq6) {
+ return kEpidBadArgErr;
+ }
+ Fq6 = Ffq6->ipp_ff;
+ Ffq2 = Ffq6->ground_ff;
+ if (!Ffq2) {
+ return kEpidBadArgErr;
+ }
+ Fq2 = Ffq2->ipp_ff;
// Let t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10 be temporary
// elements in Fq2. All the following operations are computed in
// Fq2 unless explicitly specified.
- result = NewFfElement(&Ffq2, &t0);
+ result = NewFfElement(Ffq2, &t0);
if (kEpidNoErr != result) {
break;
}
- result = NewFfElement(&Ffq2, &t1);
+ result = NewFfElement(Ffq2, &t1);
if (kEpidNoErr != result) {
break;
}
- result = NewFfElement(&Ffq2, &t2);
+ result = NewFfElement(Ffq2, &t2);
if (kEpidNoErr != result) {
break;
}
- result = NewFfElement(&Ffq2, &t3);
+ result = NewFfElement(Ffq2, &t3);
if (kEpidNoErr != result) {
break;
}
- result = NewFfElement(&Ffq2, &t4);
+ result = NewFfElement(Ffq2, &t4);
if (kEpidNoErr != result) {
break;
}
- result = NewFfElement(&Ffq2, &t5);
+ result = NewFfElement(Ffq2, &t5);
if (kEpidNoErr != result) {
break;
}
- result = NewFfElement(&Ffq2, &t6);
+ result = NewFfElement(Ffq2, &t6);
if (kEpidNoErr != result) {
break;
}
- result = NewFfElement(&Ffq2, &t7);
+ result = NewFfElement(Ffq2, &t7);
if (kEpidNoErr != result) {
break;
}
- result = NewFfElement(&Ffq2, &t8);
+ result = NewFfElement(Ffq2, &t8);
if (kEpidNoErr != result) {
break;
}
- result = NewFfElement(&Ffq2, &t9);
+ result = NewFfElement(Ffq2, &t9);
if (kEpidNoErr != result) {
break;
}
- result = NewFfElement(&Ffq2, &t10);
+ result = NewFfElement(Ffq2, &t10);
if (kEpidNoErr != result) {
break;
}
- result = NewFfElement(&Ffq2, &t);
+ result = NewFfElement(Ffq2, &t);
if (kEpidNoErr != result) {
break;
}
@@ -1158,8 +1192,8 @@ static EpidStatus Line(FiniteField* gt, FfElement* f, FfElement* x_out,
sts = ippsGFpSub(t9->ipp_ff_elem, t10->ipp_ff_elem, t9->ipp_ff_elem, Fq2);
BREAK_ON_IPP_ERROR(sts, result);
// 20. Set t10 = Fq2.mul(Z', Py).
- sts = ippsGFpMul_GFpE(z_out->ipp_ff_elem, py->ipp_ff_elem, t10->ipp_ff_elem,
- Fq2);
+ sts = ippsGFpMul_PE(z_out->ipp_ff_elem, py->ipp_ff_elem, t10->ipp_ff_elem,
+ Fq2);
BREAK_ON_IPP_ERROR(sts, result);
// 21. Set t10 = t10 + t10.
sts = ippsGFpAdd(t10->ipp_ff_elem, t10->ipp_ff_elem, t10->ipp_ff_elem, Fq2);
@@ -1168,20 +1202,19 @@ static EpidStatus Line(FiniteField* gt, FfElement* f, FfElement* x_out,
sts = ippsGFpNeg(t6->ipp_ff_elem, t6->ipp_ff_elem, Fq2);
BREAK_ON_IPP_ERROR(sts, result);
// 23. Set t1 = Fq2.mul(t6, Px).
- sts =
- ippsGFpMul_GFpE(t6->ipp_ff_elem, px->ipp_ff_elem, t1->ipp_ff_elem, Fq2);
+ sts = ippsGFpMul_PE(t6->ipp_ff_elem, px->ipp_ff_elem, t1->ipp_ff_elem, Fq2);
BREAK_ON_IPP_ERROR(sts, result);
// 24. Set t1 = t1 + t1.
sts = ippsGFpAdd(t1->ipp_ff_elem, t1->ipp_ff_elem, t1->ipp_ff_elem, Fq2);
BREAK_ON_IPP_ERROR(sts, result);
// 25. Set f = ((t10, 0, 0), (t1, t9, 0)).
- sts = ippsGFpGetElement(t10->ipp_ff_elem, (Ipp32u*)&fDat.x[0].x[0],
+ sts = ippsGFpGetElement(t10->ipp_ff_elem, (BNU)&fDat.x[0].x[0],
sizeof(fDat.x[0].x[0]) / sizeof(Ipp32u), Fq2);
BREAK_ON_IPP_ERROR(sts, result);
- sts = ippsGFpGetElement(t1->ipp_ff_elem, (Ipp32u*)&fDat.x[1].x[0],
+ sts = ippsGFpGetElement(t1->ipp_ff_elem, (BNU)&fDat.x[1].x[0],
sizeof(fDat.x[1].x[0]) / sizeof(Ipp32u), Fq2);
BREAK_ON_IPP_ERROR(sts, result);
- sts = ippsGFpGetElement(t9->ipp_ff_elem, (Ipp32u*)&fDat.x[1].x[1],
+ sts = ippsGFpGetElement(t9->ipp_ff_elem, (BNU)&fDat.x[1].x[1],
sizeof(fDat.x[1].x[1]) / sizeof(Ipp32u), Fq2);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSetElement((Ipp32u*)&fDat, sizeof(fDat) / sizeof(Ipp32u),
@@ -1230,8 +1263,9 @@ static EpidStatus Tangent(FiniteField* gt, FfElement* f, FfElement* x_out,
IppStatus sts = ippStsNoErr;
IppsGFpState* Fq2 = NULL;
IppsGFpState* Fq6 = NULL;
- FiniteField Ffq2;
- IppsGFpInfo info = {0};
+ FiniteField* Ffq2 = NULL;
+ FiniteField* Ffq6 = NULL;
+
int i = 0;
// validate input
if (!gt || !f || !x_out || !y_out || !z_out || !z2_out || !px || !py ||
@@ -1247,33 +1281,37 @@ static EpidStatus Tangent(FiniteField* gt, FfElement* f, FfElement* x_out,
break;
}
// get Fq2, Fq6
- sts = ippsGFpGetInfo(gt->ipp_ff, &info);
- BREAK_ON_IPP_ERROR(sts, result);
- Fq6 = (IppsGFpState*)info.pGroundGF;
- sts = ippsGFpGetInfo(Fq6, &info);
- BREAK_ON_IPP_ERROR(sts, result);
- Fq2 = (IppsGFpState*)info.pGroundGF;
- result = InitFiniteFieldFromIpp(Fq2, &Ffq2);
- BREAK_ON_EPID_ERROR(result);
+ Ffq6 = gt->ground_ff;
+ if (!Ffq6) {
+ result = kEpidBadArgErr;
+ break;
+ }
+ Fq6 = Ffq6->ipp_ff;
+ Ffq2 = Ffq6->ground_ff;
+ if (!Ffq2) {
+ result = kEpidBadArgErr;
+ break;
+ }
+ Fq2 = Ffq2->ipp_ff;
// Let t0, t1, t2, t3, t4, t5, t6 be elements in Fq2. All the following
// operations are computed in Fq2 unless explicitly specified.
// 1. Set t0 = X * X.
- result = NewFfElement(&Ffq2, &t0);
+ result = NewFfElement(Ffq2, &t0);
BREAK_ON_EPID_ERROR(result);
sts = ippsGFpMul(x->ipp_ff_elem, x->ipp_ff_elem, t0->ipp_ff_elem, Fq2);
BREAK_ON_IPP_ERROR(sts, result);
// 2. Set t1 = Y * Y.
- result = NewFfElement(&Ffq2, &t1);
+ result = NewFfElement(Ffq2, &t1);
BREAK_ON_EPID_ERROR(result);
sts = ippsGFpMul(y->ipp_ff_elem, y->ipp_ff_elem, t1->ipp_ff_elem, Fq2);
BREAK_ON_IPP_ERROR(sts, result);
// 3. Set t2 = t1 * t1.
- result = NewFfElement(&Ffq2, &t2);
+ result = NewFfElement(Ffq2, &t2);
BREAK_ON_EPID_ERROR(result);
sts = ippsGFpMul(t1->ipp_ff_elem, t1->ipp_ff_elem, t2->ipp_ff_elem, Fq2);
BREAK_ON_IPP_ERROR(sts, result);
// 4. Set t3 = (t1 + X)^2 - t0 - t2.
- result = NewFfElement(&Ffq2, &t3);
+ result = NewFfElement(Ffq2, &t3);
BREAK_ON_EPID_ERROR(result);
sts = ippsGFpAdd(t1->ipp_ff_elem, x->ipp_ff_elem, t3->ipp_ff_elem, Fq2);
BREAK_ON_IPP_ERROR(sts, result);
@@ -1287,19 +1325,19 @@ static EpidStatus Tangent(FiniteField* gt, FfElement* f, FfElement* x_out,
sts = ippsGFpAdd(t3->ipp_ff_elem, t3->ipp_ff_elem, t3->ipp_ff_elem, Fq2);
BREAK_ON_IPP_ERROR(sts, result);
// 6. Set t4 = 3 * t0.
- result = NewFfElement(&Ffq2, &t4);
+ result = NewFfElement(Ffq2, &t4);
BREAK_ON_EPID_ERROR(result);
sts = ippsGFpAdd(t0->ipp_ff_elem, t0->ipp_ff_elem, t4->ipp_ff_elem, Fq2);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpAdd(t4->ipp_ff_elem, t0->ipp_ff_elem, t4->ipp_ff_elem, Fq2);
BREAK_ON_IPP_ERROR(sts, result);
// 7. Set t6 = X + t4.
- result = NewFfElement(&Ffq2, &t6);
+ result = NewFfElement(Ffq2, &t6);
BREAK_ON_EPID_ERROR(result);
sts = ippsGFpAdd(x->ipp_ff_elem, t4->ipp_ff_elem, t6->ipp_ff_elem, Fq2);
BREAK_ON_IPP_ERROR(sts, result);
// 8. Set t5 = t4 * t4.
- result = NewFfElement(&Ffq2, &t5);
+ result = NewFfElement(Ffq2, &t5);
BREAK_ON_EPID_ERROR(result);
sts = ippsGFpMul(t4->ipp_ff_elem, t4->ipp_ff_elem, t5->ipp_ff_elem, Fq2);
BREAK_ON_IPP_ERROR(sts, result);
@@ -1341,8 +1379,7 @@ static EpidStatus Tangent(FiniteField* gt, FfElement* f, FfElement* x_out,
sts = ippsGFpNeg(t3->ipp_ff_elem, t3->ipp_ff_elem, Fq2);
BREAK_ON_IPP_ERROR(sts, result);
// 13.Set t3 = Fq2.mul(t3, Px).
- sts =
- ippsGFpMul_GFpE(t3->ipp_ff_elem, px->ipp_ff_elem, t3->ipp_ff_elem, Fq2);
+ sts = ippsGFpMul_PE(t3->ipp_ff_elem, px->ipp_ff_elem, t3->ipp_ff_elem, Fq2);
BREAK_ON_IPP_ERROR(sts, result);
// 14.Set t6 = t6 * t6 - t0 - t5 - 4 * t1.
sts = ippsGFpMul(t6->ipp_ff_elem, t6->ipp_ff_elem, t6->ipp_ff_elem, Fq2);
@@ -1361,17 +1398,16 @@ static EpidStatus Tangent(FiniteField* gt, FfElement* f, FfElement* x_out,
sts = ippsGFpAdd(t0->ipp_ff_elem, t0->ipp_ff_elem, t0->ipp_ff_elem, Fq2);
BREAK_ON_IPP_ERROR(sts, result);
// 16.Set t0 = Fq2.mul(t0, Py).
- sts =
- ippsGFpMul_GFpE(t0->ipp_ff_elem, py->ipp_ff_elem, t0->ipp_ff_elem, Fq2);
+ sts = ippsGFpMul_PE(t0->ipp_ff_elem, py->ipp_ff_elem, t0->ipp_ff_elem, Fq2);
BREAK_ON_IPP_ERROR(sts, result);
// 17.Set f = ((t0, 0, 0), (t3, t6, 0)).
- sts = ippsGFpGetElement(t0->ipp_ff_elem, (Ipp32u*)&fDat.x[0].x[0],
+ sts = ippsGFpGetElement(t0->ipp_ff_elem, (BNU)&fDat.x[0].x[0],
sizeof(fDat.x[0].x[0]) / sizeof(Ipp32u), Fq2);
BREAK_ON_IPP_ERROR(sts, result);
- sts = ippsGFpGetElement(t3->ipp_ff_elem, (Ipp32u*)&fDat.x[1].x[0],
+ sts = ippsGFpGetElement(t3->ipp_ff_elem, (BNU)&fDat.x[1].x[0],
sizeof(fDat.x[1].x[0]) / sizeof(Ipp32u), Fq2);
BREAK_ON_IPP_ERROR(sts, result);
- sts = ippsGFpGetElement(t6->ipp_ff_elem, (Ipp32u*)&fDat.x[1].x[1],
+ sts = ippsGFpGetElement(t6->ipp_ff_elem, (BNU)&fDat.x[1].x[1],
sizeof(fDat.x[1].x[1]) / sizeof(Ipp32u), Fq2);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSetElement((Ipp32u*)&fDat, sizeof(fDat) / sizeof(Ipp32u),
@@ -1425,7 +1461,7 @@ static EpidStatus Ternary(int* s, int* n, int max_elements, BigNum const* x) {
int flag = 0;
int i = 0;
int num_bits = 0;
- Ipp32u* data = 0;
+ IppBNU data = 0;
// check parameters
if (!s || !n || !x || !x->ipp_bn) {
@@ -1525,59 +1561,65 @@ static EpidStatus MulXiFast(FfElement* e, FfElement const* a,
retvalue = kEpidBadArgErr;
BREAK_ON_EPID_ERROR(retvalue);
}
- if (!e->ipp_ff_elem || !a->ipp_ff_elem || !ps->Fq.ipp_ff ||
- !ps->Fq2.ipp_ff) {
+ if (!ps->Fq || !ps->Fq2) {
+ retvalue = kEpidBadArgErr;
+ BREAK_ON_EPID_ERROR(retvalue);
+ }
+ if (!e->ipp_ff_elem || !a->ipp_ff_elem || !ps->Fq->ipp_ff ||
+ !ps->Fq2->ipp_ff) {
retvalue = kEpidBadArgErr;
BREAK_ON_EPID_ERROR(retvalue);
}
// All the following arithmetic operations are in ps->Fq.
// 1. Let a = (a[0], a[1]), xi = (xi[0], xi[1]), and e = (e[0], e[1]).
- retvalue = NewFfElement(&(ps->Fq), &a0);
+ retvalue = NewFfElement(ps->Fq, &a0);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq), &a1);
+ retvalue = NewFfElement(ps->Fq, &a1);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq), &e0);
+ retvalue = NewFfElement(ps->Fq, &e0);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq), &e1);
+ retvalue = NewFfElement(ps->Fq, &e1);
BREAK_ON_EPID_ERROR(retvalue);
- sts = ippsGFpGetElement(a->ipp_ff_elem, (Ipp32u*)&a_dat,
- sizeof(a_dat) / sizeof(Ipp32u), ps->Fq2.ipp_ff);
+ sts = ippsGFpGetElement(a->ipp_ff_elem, (BNU)&a_dat,
+ sizeof(a_dat) / sizeof(Ipp32u), ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts = ippsGFpSetElement((Ipp32u*)&a_dat.x[0],
sizeof(a_dat.x[0]) / sizeof(Ipp32u),
- a0->ipp_ff_elem, ps->Fq.ipp_ff);
+ a0->ipp_ff_elem, ps->Fq->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts = ippsGFpSetElement((Ipp32u*)&a_dat.x[1],
sizeof(a_dat.x[1]) / sizeof(Ipp32u),
- a1->ipp_ff_elem, ps->Fq.ipp_ff);
+ a1->ipp_ff_elem, ps->Fq->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 4. If xi[0] = 2, xi[1] = 1, beta = -1, then e[0] and e[1] can
// be computed as
// a. e[0] = a[0] + a[0] - a[1].
sts = ippsGFpAdd(a0->ipp_ff_elem, a0->ipp_ff_elem, e0->ipp_ff_elem,
- ps->Fq.ipp_ff);
+ ps->Fq->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts = ippsGFpSub(e0->ipp_ff_elem, a1->ipp_ff_elem, e0->ipp_ff_elem,
- ps->Fq.ipp_ff);
+ ps->Fq->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// b. e[1] = a[0] + a[1] + a[1].
sts = ippsGFpAdd(a0->ipp_ff_elem, a1->ipp_ff_elem, e1->ipp_ff_elem,
- ps->Fq.ipp_ff);
+ ps->Fq->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts = ippsGFpAdd(e1->ipp_ff_elem, a1->ipp_ff_elem, e1->ipp_ff_elem,
- ps->Fq.ipp_ff);
+ ps->Fq->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 5. Return e = (e[0], e[1]).
- sts = ippsGFpGetElement(e0->ipp_ff_elem, (Ipp32u*)&e_dat.x[0],
- sizeof(e_dat.x[0]) / sizeof(Ipp32u), ps->Fq.ipp_ff);
+ sts =
+ ippsGFpGetElement(e0->ipp_ff_elem, (BNU)&e_dat.x[0],
+ sizeof(e_dat.x[0]) / sizeof(Ipp32u), ps->Fq->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
- sts = ippsGFpGetElement(e1->ipp_ff_elem, (Ipp32u*)&e_dat.x[1],
- sizeof(e_dat.x[1]) / sizeof(Ipp32u), ps->Fq.ipp_ff);
+ sts =
+ ippsGFpGetElement(e1->ipp_ff_elem, (BNU)&e_dat.x[1],
+ sizeof(e_dat.x[1]) / sizeof(Ipp32u), ps->Fq->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts = ippsGFpSetElement((Ipp32u*)&e_dat, sizeof(e_dat) / sizeof(Ipp32u),
- e->ipp_ff_elem, ps->Fq2.ipp_ff);
+ e->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
retvalue = kEpidNoErr;
} while (0);
@@ -1614,27 +1656,31 @@ static EpidStatus MulV(FfElement* e, FfElement* a, PairingState* ps) {
retvalue = kEpidBadArgErr;
BREAK_ON_EPID_ERROR(retvalue);
}
- if (!e->ipp_ff_elem || !a->ipp_ff_elem || !ps->Fq2.ipp_ff ||
- !ps->Fq6.ipp_ff) {
+ if (!ps->Fq2 || !ps->Fq6) {
+ retvalue = kEpidBadArgErr;
+ BREAK_ON_EPID_ERROR(retvalue);
+ }
+ if (!e->ipp_ff_elem || !a->ipp_ff_elem || !ps->Fq2->ipp_ff ||
+ !ps->Fq6->ipp_ff) {
retvalue = kEpidBadArgErr;
BREAK_ON_EPID_ERROR(retvalue);
}
// 1. Let a = (a[0], a[1], a[2]) and e = (e[0], e[1], e[2]).
- retvalue = NewFfElement(&(ps->Fq2), &a2);
+ retvalue = NewFfElement(ps->Fq2, &a2);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq2), &e0);
+ retvalue = NewFfElement(ps->Fq2, &e0);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq2), &e1);
+ retvalue = NewFfElement(ps->Fq2, &e1);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq2), &e2);
+ retvalue = NewFfElement(ps->Fq2, &e2);
BREAK_ON_EPID_ERROR(retvalue);
- sts = ippsGFpGetElement(a->ipp_ff_elem, (Ipp32u*)&a_dat,
- sizeof(a_dat) / sizeof(Ipp32u), ps->Fq6.ipp_ff);
+ sts = ippsGFpGetElement(a->ipp_ff_elem, (BNU)&a_dat,
+ sizeof(a_dat) / sizeof(Ipp32u), ps->Fq6->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts = ippsGFpSetElement((Ipp32u*)&a_dat.x[2],
sizeof(a_dat.x[2]) / sizeof(Ipp32u),
- a2->ipp_ff_elem, ps->Fq2.ipp_ff);
+ a2->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 2. e[0] = Fq2.mulXi(a[2]).
retvalue = MulXiFast(e0, a2, ps);
@@ -1645,11 +1691,11 @@ static EpidStatus MulV(FfElement* e, FfElement* a, PairingState* ps) {
e_dat.x[2] = a_dat.x[1];
sts =
- ippsGFpGetElement(e0->ipp_ff_elem, (Ipp32u*)&e_dat.x[0],
- sizeof(e_dat.x[0]) / sizeof(Ipp32u), ps->Fq2.ipp_ff);
+ ippsGFpGetElement(e0->ipp_ff_elem, (BNU)&e_dat.x[0],
+ sizeof(e_dat.x[0]) / sizeof(Ipp32u), ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts = ippsGFpSetElement((Ipp32u*)&e_dat, sizeof(e_dat) / sizeof(Ipp32u),
- e->ipp_ff_elem, ps->Fq6.ipp_ff);
+ e->ipp_ff_elem, ps->Fq6->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
retvalue = kEpidNoErr;
} while (0);
@@ -1696,121 +1742,125 @@ static EpidStatus Fq6MulGFpE2(FfElement* e, FfElement* a, FfElement* b0,
retvalue = kEpidBadArgErr;
BREAK_ON_EPID_ERROR(retvalue);
}
+ if (!ps->Fq2 || !ps->Fq6) {
+ retvalue = kEpidBadArgErr;
+ BREAK_ON_EPID_ERROR(retvalue);
+ }
if (!e->ipp_ff_elem || !a->ipp_ff_elem || !b0->ipp_ff_elem ||
- !b1->ipp_ff_elem || !ps->Fq2.ipp_ff || !ps->Fq6.ipp_ff) {
+ !b1->ipp_ff_elem || !ps->Fq2->ipp_ff || !ps->Fq6->ipp_ff) {
retvalue = kEpidBadArgErr;
BREAK_ON_EPID_ERROR(retvalue);
}
// Let t0, t1, t3, t4 be temporary variables in Fq2. All the
// following arithmetic operations are in Fq2.
- retvalue = NewFfElement(&(ps->Fq2), &t0);
+ retvalue = NewFfElement(ps->Fq2, &t0);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq2), &t1);
+ retvalue = NewFfElement(ps->Fq2, &t1);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq2), &t2);
+ retvalue = NewFfElement(ps->Fq2, &t2);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq2), &t3);
+ retvalue = NewFfElement(ps->Fq2, &t3);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq2), &t4);
+ retvalue = NewFfElement(ps->Fq2, &t4);
BREAK_ON_EPID_ERROR(retvalue);
// 1. Let a = (a[0], a[1], a[2]) and e = (e[0], e[1], e[2]).
- retvalue = NewFfElement(&(ps->Fq2), &a0);
+ retvalue = NewFfElement(ps->Fq2, &a0);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq2), &a1);
+ retvalue = NewFfElement(ps->Fq2, &a1);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq2), &a2);
+ retvalue = NewFfElement(ps->Fq2, &a2);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq2), &e0);
+ retvalue = NewFfElement(ps->Fq2, &e0);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq2), &e1);
+ retvalue = NewFfElement(ps->Fq2, &e1);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq2), &e2);
+ retvalue = NewFfElement(ps->Fq2, &e2);
BREAK_ON_EPID_ERROR(retvalue);
- sts = ippsGFpGetElement(a->ipp_ff_elem, (Ipp32u*)&a_dat,
- sizeof(a_dat) / sizeof(Ipp32u), ps->Fq6.ipp_ff);
+ sts = ippsGFpGetElement(a->ipp_ff_elem, (BNU)&a_dat,
+ sizeof(a_dat) / sizeof(Ipp32u), ps->Fq6->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts = ippsGFpSetElement((Ipp32u*)&a_dat.x[0],
sizeof(a_dat.x[0]) / sizeof(Ipp32u),
- a0->ipp_ff_elem, ps->Fq2.ipp_ff);
+ a0->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts = ippsGFpSetElement((Ipp32u*)&a_dat.x[1],
sizeof(a_dat.x[1]) / sizeof(Ipp32u),
- a1->ipp_ff_elem, ps->Fq2.ipp_ff);
+ a1->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts = ippsGFpSetElement((Ipp32u*)&a_dat.x[2],
sizeof(a_dat.x[2]) / sizeof(Ipp32u),
- a2->ipp_ff_elem, ps->Fq2.ipp_ff);
+ a2->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 2. t0 = a[0] * b[0].
sts = ippsGFpMul(a0->ipp_ff_elem, b0->ipp_ff_elem, t0->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 3. t1 = a[1] * b[1].
sts = ippsGFpMul(a1->ipp_ff_elem, b1->ipp_ff_elem, t1->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 4. t3 = a[1] + a[2].
sts = ippsGFpAdd(a1->ipp_ff_elem, a2->ipp_ff_elem, t3->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 5. t3 = t3 * b[1].
sts = ippsGFpMul(t3->ipp_ff_elem, b1->ipp_ff_elem, t3->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 6. t3 = t3 - t1.
sts = ippsGFpSub(t3->ipp_ff_elem, t1->ipp_ff_elem, t3->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 7. e[0] = Fq2.mulXi(t3) + t0.
retvalue = MulXiFast(e0, t3, ps);
BREAK_ON_EPID_ERROR(retvalue);
sts = ippsGFpAdd(e0->ipp_ff_elem, t0->ipp_ff_elem, e0->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 8. t3 = a[0] + a[1].
sts = ippsGFpAdd(a0->ipp_ff_elem, a1->ipp_ff_elem, t3->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 9. t4 = b[0] + b[1].
sts = ippsGFpAdd(b0->ipp_ff_elem, b1->ipp_ff_elem, t4->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 10. t3 = t3 * t4.
sts = ippsGFpMul(t3->ipp_ff_elem, t4->ipp_ff_elem, t3->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 11. e[1] = t3 - t0 - t1.
sts = ippsGFpSub(t3->ipp_ff_elem, t0->ipp_ff_elem, e1->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts = ippsGFpSub(e1->ipp_ff_elem, t1->ipp_ff_elem, e1->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 12. t3 = a[2] * b[0].
sts = ippsGFpMul(a2->ipp_ff_elem, b0->ipp_ff_elem, t3->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 13. e[2] = t3 + t1.
sts = ippsGFpAdd(t3->ipp_ff_elem, t1->ipp_ff_elem, e2->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 14. Return e.
sts =
- ippsGFpGetElement(e0->ipp_ff_elem, (Ipp32u*)&e_dat.x[0],
- sizeof(e_dat.x[0]) / sizeof(Ipp32u), ps->Fq2.ipp_ff);
+ ippsGFpGetElement(e0->ipp_ff_elem, (BNU)&e_dat.x[0],
+ sizeof(e_dat.x[0]) / sizeof(Ipp32u), ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts =
- ippsGFpGetElement(e1->ipp_ff_elem, (Ipp32u*)&e_dat.x[1],
- sizeof(e_dat.x[1]) / sizeof(Ipp32u), ps->Fq2.ipp_ff);
+ ippsGFpGetElement(e1->ipp_ff_elem, (BNU)&e_dat.x[1],
+ sizeof(e_dat.x[1]) / sizeof(Ipp32u), ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts =
- ippsGFpGetElement(e2->ipp_ff_elem, (Ipp32u*)&e_dat.x[2],
- sizeof(e_dat.x[2]) / sizeof(Ipp32u), ps->Fq2.ipp_ff);
+ ippsGFpGetElement(e2->ipp_ff_elem, (BNU)&e_dat.x[2],
+ sizeof(e_dat.x[2]) / sizeof(Ipp32u), ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts = ippsGFpSetElement((Ipp32u*)&e_dat, sizeof(e_dat) / sizeof(Ipp32u),
- e->ipp_ff_elem, ps->Fq6.ipp_ff);
+ e->ipp_ff_elem, ps->Fq6->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
retvalue = kEpidNoErr;
} while (0);
@@ -1863,73 +1913,78 @@ static EpidStatus MulSpecial(FfElement* e, FfElement const* a,
retvalue = kEpidBadArgErr;
BREAK_ON_EPID_ERROR(retvalue);
}
+ if (!ps->Fq2 || !ps->Fq6) {
+ retvalue = kEpidBadArgErr;
+ BREAK_ON_EPID_ERROR(retvalue);
+ }
if (!e->ipp_ff_elem || !a->ipp_ff_elem || !b->ipp_ff_elem ||
- !ps->Fq2.ipp_ff || !ps->Fq6.ipp_ff || !ps->ff || !ps->ff->ipp_ff) {
+ !ps->Fq2->ipp_ff || !ps->Fq6->ipp_ff || !ps->ff || !ps->ff->ipp_ff) {
retvalue = kEpidBadArgErr;
BREAK_ON_EPID_ERROR(retvalue);
}
// Let t0, t1, t2 be temporary variables in ps->Fq6.
- retvalue = NewFfElement(&(ps->Fq6), &t0);
+ retvalue = NewFfElement(ps->Fq6, &t0);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq6), &t1);
+ retvalue = NewFfElement(ps->Fq6, &t1);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq6), &t2);
+ retvalue = NewFfElement(ps->Fq6, &t2);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq2), &b0plusb1);
+ retvalue = NewFfElement(ps->Fq2, &b0plusb1);
BREAK_ON_EPID_ERROR(retvalue);
// 1. Let a = (a[0], a[1]) and e = (e[0], e[1]).
- retvalue = NewFfElement(&(ps->Fq6), &a0);
+ retvalue = NewFfElement(ps->Fq6, &a0);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq6), &a1);
+ retvalue = NewFfElement(ps->Fq6, &a1);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq6), &e0);
+ retvalue = NewFfElement(ps->Fq6, &e0);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq6), &e1);
+ retvalue = NewFfElement(ps->Fq6, &e1);
BREAK_ON_EPID_ERROR(retvalue);
- sts = ippsGFpGetElement(a->ipp_ff_elem, (Ipp32u*)&a_dat,
+ sts = ippsGFpGetElement(a->ipp_ff_elem, (BNU)&a_dat,
sizeof(a_dat) / sizeof(Ipp32u), ps->ff->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts = ippsGFpSetElement((Ipp32u*)&a_dat.x[0],
sizeof(a_dat.x[0]) / sizeof(Ipp32u),
- a0->ipp_ff_elem, ps->Fq6.ipp_ff);
+ a0->ipp_ff_elem, ps->Fq6->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts = ippsGFpSetElement((Ipp32u*)&a_dat.x[1],
sizeof(a_dat.x[1]) / sizeof(Ipp32u),
- a1->ipp_ff_elem, ps->Fq6.ipp_ff);
+ a1->ipp_ff_elem, ps->Fq6->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 2. Let b = ((b[0], b[2], b[4]), (b[1], b[3], b[5])) where
// b[0], ..., b[5] are elements in ps->Fq2 and b[2] = b[4] = b[5]
// = 0.
- retvalue = NewFfElement(&(ps->Fq2), &b0);
+ retvalue = NewFfElement(ps->Fq2, &b0);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq2), &b1);
+ retvalue = NewFfElement(ps->Fq2, &b1);
BREAK_ON_EPID_ERROR(retvalue);
- retvalue = NewFfElement(&(ps->Fq2), &b3);
+ retvalue = NewFfElement(ps->Fq2, &b3);
BREAK_ON_EPID_ERROR(retvalue);
- sts = ippsGFpGetElement(b->ipp_ff_elem, (Ipp32u*)&b_dat,
+ sts = ippsGFpGetElement(b->ipp_ff_elem, (BNU)&b_dat,
sizeof(b_dat) / sizeof(Ipp32u), ps->ff->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts = ippsGFpSetElement((Ipp32u*)&b_dat.x[0].x[0],
sizeof(a_dat.x[0].x[0]) / sizeof(Ipp32u),
- b0->ipp_ff_elem, ps->Fq2.ipp_ff);
+ b0->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts = ippsGFpSetElement((Ipp32u*)&b_dat.x[1].x[0],
sizeof(a_dat.x[1].x[0]) / sizeof(Ipp32u),
- b1->ipp_ff_elem, ps->Fq2.ipp_ff);
+ b1->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts = ippsGFpSetElement((Ipp32u*)&b_dat.x[1].x[1],
sizeof(a_dat.x[1].x[1]) / sizeof(Ipp32u),
- b3->ipp_ff_elem, ps->Fq2.ipp_ff);
+ b3->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 3. t0 = ps->Fq6.mul(a[0], b[0]).
- sts = ippsGFpMul_GFpE(a0->ipp_ff_elem, b0->ipp_ff_elem, t0->ipp_ff_elem,
- ps->Fq6.ipp_ff);
+
+ sts = ippsGFpMul_PE(a0->ipp_ff_elem, b0->ipp_ff_elem, t0->ipp_ff_elem,
+ ps->Fq6->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 4. t1 = ps->Fq6.mul(a[1], b[1], b[3]).
retvalue = Fq6MulGFpE2(t1, a1, b1, b3, ps);
@@ -1939,34 +1994,34 @@ static EpidStatus MulSpecial(FfElement* e, FfElement const* a,
BREAK_ON_EPID_ERROR(retvalue);
// 6. e[0] = ps->Fq6.add(t0, e[0]).
sts = ippsGFpAdd(t0->ipp_ff_elem, e0->ipp_ff_elem, e0->ipp_ff_elem,
- ps->Fq6.ipp_ff);
+ ps->Fq6->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 7. t2 = ps->Fq6.add(a[0], a[1]).
sts = ippsGFpAdd(a0->ipp_ff_elem, a1->ipp_ff_elem, t2->ipp_ff_elem,
- ps->Fq6.ipp_ff);
+ ps->Fq6->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 8. e[1] = ps->Fq6.mul(t2, b[0] + b[1], b[3]).
sts = ippsGFpAdd(b0->ipp_ff_elem, b1->ipp_ff_elem, b0plusb1->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
retvalue = Fq6MulGFpE2(e1, t2, b0plusb1, b3, ps);
BREAK_ON_EPID_ERROR(retvalue);
// 9. e[1] = ps->Fq6.subtract(e[1], t0).
sts = ippsGFpSub(e1->ipp_ff_elem, t0->ipp_ff_elem, e1->ipp_ff_elem,
- ps->Fq6.ipp_ff);
+ ps->Fq6->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 10. e[1] = ps->Fq6.subtract(e[1], t1).
sts = ippsGFpSub(e1->ipp_ff_elem, t1->ipp_ff_elem, e1->ipp_ff_elem,
- ps->Fq6.ipp_ff);
+ ps->Fq6->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
// 11. Return e.
sts =
- ippsGFpGetElement(e0->ipp_ff_elem, (Ipp32u*)&e_dat.x[0],
- sizeof(e_dat.x[0]) / sizeof(Ipp32u), ps->Fq6.ipp_ff);
+ ippsGFpGetElement(e0->ipp_ff_elem, (BNU)&e_dat.x[0],
+ sizeof(e_dat.x[0]) / sizeof(Ipp32u), ps->Fq6->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts =
- ippsGFpGetElement(e1->ipp_ff_elem, (Ipp32u*)&e_dat.x[1],
- sizeof(e_dat.x[1]) / sizeof(Ipp32u), ps->Fq6.ipp_ff);
+ ippsGFpGetElement(e1->ipp_ff_elem, (BNU)&e_dat.x[1],
+ sizeof(e_dat.x[1]) / sizeof(Ipp32u), ps->Fq6->ipp_ff);
BREAK_ON_IPP_ERROR(sts, retvalue);
sts = ippsGFpSetElement((Ipp32u*)&e_dat, sizeof(e_dat) / sizeof(Ipp32u),
e->ipp_ff_elem, ps->ff->ipp_ff);
@@ -2002,74 +2057,76 @@ static EpidStatus SquareForFq4(PairingState* ps, FfElement* e0, FfElement* e1,
FfElement* t0 = NULL;
FfElement* t1 = NULL;
FfElement* xi = NULL;
- Fq2ElemStr Fq6IrrPolynomial[3 + 1] = {0};
+ Fq2ElemStr Fq6IrrPolynomial = {0};
// check parameters
if (!e0 || !e1 || !a0 || !a1 || !ps) return kEpidBadArgErr;
-
+ if (!ps->Fq2 || !ps->Fq6) {
+ return kEpidBadArgErr;
+ }
if (!e0->ipp_ff_elem || !e1->ipp_ff_elem || !a0->ipp_ff_elem ||
- !a1->ipp_ff_elem || !ps->ff || !ps->ff->ipp_ff || !ps->Fq2.ipp_ff ||
- !ps->Fq6.ipp_ff)
+ !a1->ipp_ff_elem || !ps->ff || !ps->ff->ipp_ff || !ps->Fq2->ipp_ff ||
+ !ps->Fq6->ipp_ff)
return kEpidBadArgErr;
do {
IppStatus sts = ippStsNoErr;
// extract xi from Fq6 irr poly
- result = NewFfElement(&(ps->Fq2), &xi);
+ result = NewFfElement(ps->Fq2, &xi);
+ BREAK_ON_EPID_ERROR(result);
+ result = WriteBigNum(ps->Fq6->modulus_0, sizeof(Fq6IrrPolynomial),
+ &Fq6IrrPolynomial);
+ BREAK_ON_EPID_ERROR(result);
+ result = SetFfElementOctString(&Fq6IrrPolynomial, sizeof(Fq6IrrPolynomial),
+ xi, ps->Fq2);
BREAK_ON_EPID_ERROR(result);
- sts = ippsGFpGetModulus(ps->Fq6.ipp_ff, (Ipp32u*)&Fq6IrrPolynomial[0]);
- BREAK_ON_IPP_ERROR(sts, result);
- sts = ippsGFpSetElement((Ipp32u const*)&Fq6IrrPolynomial[0],
- sizeof(Fq6IrrPolynomial[0]) / sizeof(Ipp32u),
- xi->ipp_ff_elem, ps->Fq2.ipp_ff);
- BREAK_ON_IPP_ERROR(sts, result);
// first coefficent is -xi
- sts = ippsGFpNeg(xi->ipp_ff_elem, xi->ipp_ff_elem, ps->Fq2.ipp_ff);
+ sts = ippsGFpNeg(xi->ipp_ff_elem, xi->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// Let t0, t1 be temporary variables in Fq2. All the following
// operations are computed in Fq2.
- result = NewFfElement(&(ps->Fq2), &t0);
+ result = NewFfElement(ps->Fq2, &t0);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&(ps->Fq2), &t1);
+ result = NewFfElement(ps->Fq2, &t1);
BREAK_ON_EPID_ERROR(result);
// 1. Set t0 = a0 * a0.
sts = ippsGFpMul(a0->ipp_ff_elem, a0->ipp_ff_elem, t0->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// 2. Set t1 = a1 * a1.
sts = ippsGFpMul(a1->ipp_ff_elem, a1->ipp_ff_elem, t1->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// 3. Set e0 = t1 * xi.
sts = ippsGFpMul(t1->ipp_ff_elem, xi->ipp_ff_elem, e0->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// 4. Set e0 = e0 + t0.
sts = ippsGFpAdd(e0->ipp_ff_elem, t0->ipp_ff_elem, e0->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// 5. Set e1 = a0 + a1.
sts = ippsGFpAdd(a0->ipp_ff_elem, a1->ipp_ff_elem, e1->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// 6. Set e1 = e1 * e1 - t0 - t1.
sts = ippsGFpMul(e1->ipp_ff_elem, e1->ipp_ff_elem, e1->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSub(e1->ipp_ff_elem, t0->ipp_ff_elem, e1->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSub(e1->ipp_ff_elem, t1->ipp_ff_elem, e1->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// 7. Return (e0, e1).
result = kEpidNoErr;
} while (0);
- EpidZeroMemory(Fq6IrrPolynomial, sizeof(Fq6IrrPolynomial));
+ EpidZeroMemory(&Fq6IrrPolynomial, sizeof(Fq6IrrPolynomial));
DeleteFfElement(&t0);
DeleteFfElement(&t1);
DeleteFfElement(&xi);
@@ -2099,80 +2156,82 @@ static EpidStatus SquareCyclotomic(PairingState* ps, FfElement* e_out,
int i = 0;
Fq12ElemStr a_str = {0};
Fq12ElemStr e_str = {0};
- Fq2ElemStr Fq6IrrPolynomial[3 + 1] = {0};
+ Fq2ElemStr Fq6IrrPolynomial = {0};
// check parameters
if (!e_out || !a_in || !ps) return kEpidBadArgErr;
-
+ if (!ps->Fq || !ps->Fq2 || !ps->Fq6) {
+ return kEpidBadArgErr;
+ }
if (!e_out->ipp_ff_elem || !a_in->ipp_ff_elem || !ps->ff || !ps->ff->ipp_ff ||
- !ps->Fq.ipp_ff || !ps->Fq2.ipp_ff || !ps->Fq6.ipp_ff)
+ !ps->Fq->ipp_ff || !ps->Fq2->ipp_ff || !ps->Fq6->ipp_ff)
return kEpidBadArgErr;
do {
IppStatus sts = ippStsNoErr;
// extract xi from Fq6 irr poly
- result = NewFfElement(&(ps->Fq2), &xi);
+ result = NewFfElement(ps->Fq2, &xi);
+ BREAK_ON_EPID_ERROR(result);
+ result = WriteBigNum(ps->Fq6->modulus_0, sizeof(Fq6IrrPolynomial),
+ &Fq6IrrPolynomial);
+ BREAK_ON_EPID_ERROR(result);
+ result = SetFfElementOctString(&Fq6IrrPolynomial, sizeof(Fq6IrrPolynomial),
+ xi, ps->Fq2);
BREAK_ON_EPID_ERROR(result);
- sts = ippsGFpGetModulus(ps->Fq6.ipp_ff, (Ipp32u*)&Fq6IrrPolynomial);
- BREAK_ON_IPP_ERROR(sts, result);
- sts = ippsGFpSetElement((Ipp32u const*)&Fq6IrrPolynomial[0],
- sizeof(Fq6IrrPolynomial[0]) / sizeof(Ipp32u),
- xi->ipp_ff_elem, ps->Fq2.ipp_ff);
- BREAK_ON_IPP_ERROR(sts, result);
// first coefficent is -xi
- sts = ippsGFpNeg(xi->ipp_ff_elem, xi->ipp_ff_elem, ps->Fq2.ipp_ff);
+ sts = ippsGFpNeg(xi->ipp_ff_elem, xi->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// Let t00, t01, t02, t10, t11, t12 be temporary variables in
// Fq2. All the following operations are computed in Fq2 unless
// specified otherwise.
- result = NewFfElement(&(ps->Fq2), &t00);
+ result = NewFfElement(ps->Fq2, &t00);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&(ps->Fq2), &t01);
+ result = NewFfElement(ps->Fq2, &t01);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&(ps->Fq2), &t02);
+ result = NewFfElement(ps->Fq2, &t02);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&(ps->Fq2), &t10);
+ result = NewFfElement(ps->Fq2, &t10);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&(ps->Fq2), &t11);
+ result = NewFfElement(ps->Fq2, &t11);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&(ps->Fq2), &t12);
+ result = NewFfElement(ps->Fq2, &t12);
BREAK_ON_EPID_ERROR(result);
for (i = 0; i < 6; i++) {
- result = NewFfElement(&(ps->Fq2), &a[i]);
+ result = NewFfElement(ps->Fq2, &a[i]);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&(ps->Fq2), &e[i]);
+ result = NewFfElement(ps->Fq2, &e[i]);
BREAK_ON_EPID_ERROR(result);
}
BREAK_ON_EPID_ERROR(result);
// 1. Let a = ((a[0], a[2], a[4]), (a[1], a[3], a[5])).
- sts = ippsGFpGetElement(a_in->ipp_ff_elem, (Ipp32u*)&a_str,
+ sts = ippsGFpGetElement(a_in->ipp_ff_elem, (BNU)&a_str,
sizeof(a_str) / sizeof(Ipp32u), ps->ff->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSetElement((Ipp32u*)&a_str.a[0].a[0],
sizeof(a_str.a[0].a[0]) / sizeof(Ipp32u),
- a[0]->ipp_ff_elem, ps->Fq2.ipp_ff);
+ a[0]->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSetElement((Ipp32u*)&a_str.a[0].a[1],
sizeof(a_str.a[0].a[1]) / sizeof(Ipp32u),
- a[2]->ipp_ff_elem, ps->Fq2.ipp_ff);
+ a[2]->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSetElement((Ipp32u*)&a_str.a[0].a[2],
sizeof(a_str.a[0].a[2]) / sizeof(Ipp32u),
- a[4]->ipp_ff_elem, ps->Fq2.ipp_ff);
+ a[4]->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSetElement((Ipp32u*)&a_str.a[1].a[0],
sizeof(a_str.a[1].a[0]) / sizeof(Ipp32u),
- a[1]->ipp_ff_elem, ps->Fq2.ipp_ff);
+ a[1]->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSetElement((Ipp32u*)&a_str.a[1].a[1],
sizeof(a_str.a[1].a[1]) / sizeof(Ipp32u),
- a[3]->ipp_ff_elem, ps->Fq2.ipp_ff);
+ a[3]->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSetElement((Ipp32u*)&a_str.a[1].a[2],
sizeof(a_str.a[1].a[2]) / sizeof(Ipp32u),
- a[5]->ipp_ff_elem, ps->Fq2.ipp_ff);
+ a[5]->ipp_ff_elem, ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// 2. Let e = ((e[0], e[2], e[4]), (e[1], e[3], e[5])).
@@ -2187,110 +2246,110 @@ static EpidStatus SquareCyclotomic(PairingState* ps, FfElement* e_out,
BREAK_ON_EPID_ERROR(result);
// 6. Set t10 = t10 * xi.
sts = ippsGFpMul(t10->ipp_ff_elem, xi->ipp_ff_elem, t10->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// 7. Set e[0] = 3 * t00 - 2 * a[0].
sts = ippsGFpAdd(t00->ipp_ff_elem, t00->ipp_ff_elem, e[0]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpAdd(e[0]->ipp_ff_elem, t00->ipp_ff_elem, e[0]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSub(e[0]->ipp_ff_elem, a[0]->ipp_ff_elem, e[0]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSub(e[0]->ipp_ff_elem, a[0]->ipp_ff_elem, e[0]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// 8. Set e[2] = 3 * t01 - 2 * a[2].
sts = ippsGFpAdd(t01->ipp_ff_elem, t01->ipp_ff_elem, e[2]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpAdd(e[2]->ipp_ff_elem, t01->ipp_ff_elem, e[2]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSub(e[2]->ipp_ff_elem, a[2]->ipp_ff_elem, e[2]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSub(e[2]->ipp_ff_elem, a[2]->ipp_ff_elem, e[2]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// 9. Set e[4] = 3 * t02 - 2 * a[4].
sts = ippsGFpAdd(t02->ipp_ff_elem, t02->ipp_ff_elem, e[4]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpAdd(e[4]->ipp_ff_elem, t02->ipp_ff_elem, e[4]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSub(e[4]->ipp_ff_elem, a[4]->ipp_ff_elem, e[4]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSub(e[4]->ipp_ff_elem, a[4]->ipp_ff_elem, e[4]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// 10. Set e[1] = 3 * t10 + 2 * a[1].
sts = ippsGFpAdd(t10->ipp_ff_elem, t10->ipp_ff_elem, e[1]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpAdd(e[1]->ipp_ff_elem, t10->ipp_ff_elem, e[1]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpAdd(e[1]->ipp_ff_elem, a[1]->ipp_ff_elem, e[1]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpAdd(e[1]->ipp_ff_elem, a[1]->ipp_ff_elem, e[1]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// 11. Set e[3] = 3 * t11 + 2 * a[3].
sts = ippsGFpAdd(t11->ipp_ff_elem, t11->ipp_ff_elem, e[3]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpAdd(e[3]->ipp_ff_elem, t11->ipp_ff_elem, e[3]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpAdd(e[3]->ipp_ff_elem, a[3]->ipp_ff_elem, e[3]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpAdd(e[3]->ipp_ff_elem, a[3]->ipp_ff_elem, e[3]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// 12. Set e[5] = 3 * t12 + 2 * a[5].
sts = ippsGFpAdd(t12->ipp_ff_elem, t12->ipp_ff_elem, e[5]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpAdd(e[5]->ipp_ff_elem, t12->ipp_ff_elem, e[5]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpAdd(e[5]->ipp_ff_elem, a[5]->ipp_ff_elem, e[5]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpAdd(e[5]->ipp_ff_elem, a[5]->ipp_ff_elem, e[5]->ipp_ff_elem,
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
// 13. Return e.
- sts = ippsGFpGetElement(e[0]->ipp_ff_elem, (Ipp32u*)&e_str.a[0].a[0],
+ sts = ippsGFpGetElement(e[0]->ipp_ff_elem, (BNU)&e_str.a[0].a[0],
sizeof(e_str.a[0].a[0]) / sizeof(Ipp32u),
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
- sts = ippsGFpGetElement(e[2]->ipp_ff_elem, (Ipp32u*)&e_str.a[0].a[1],
+ sts = ippsGFpGetElement(e[2]->ipp_ff_elem, (BNU)&e_str.a[0].a[1],
sizeof(e_str.a[0].a[0]) / sizeof(Ipp32u),
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
- sts = ippsGFpGetElement(e[4]->ipp_ff_elem, (Ipp32u*)&e_str.a[0].a[2],
+ sts = ippsGFpGetElement(e[4]->ipp_ff_elem, (BNU)&e_str.a[0].a[2],
sizeof(e_str.a[0].a[0]) / sizeof(Ipp32u),
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
- sts = ippsGFpGetElement(e[1]->ipp_ff_elem, (Ipp32u*)&e_str.a[1].a[0],
+ sts = ippsGFpGetElement(e[1]->ipp_ff_elem, (BNU)&e_str.a[1].a[0],
sizeof(e_str.a[0].a[0]) / sizeof(Ipp32u),
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
- sts = ippsGFpGetElement(e[3]->ipp_ff_elem, (Ipp32u*)&e_str.a[1].a[1],
+ sts = ippsGFpGetElement(e[3]->ipp_ff_elem, (BNU)&e_str.a[1].a[1],
sizeof(e_str.a[0].a[0]) / sizeof(Ipp32u),
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
- sts = ippsGFpGetElement(e[5]->ipp_ff_elem, (Ipp32u*)&e_str.a[1].a[2],
+ sts = ippsGFpGetElement(e[5]->ipp_ff_elem, (BNU)&e_str.a[1].a[2],
sizeof(e_str.a[0].a[0]) / sizeof(Ipp32u),
- ps->Fq2.ipp_ff);
+ ps->Fq2->ipp_ff);
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpSetElement((Ipp32u*)&e_str, sizeof(e_str) / sizeof(Ipp32u),
e_out->ipp_ff_elem, ps->ff->ipp_ff);
@@ -2300,7 +2359,7 @@ static EpidStatus SquareCyclotomic(PairingState* ps, FfElement* e_out,
EpidZeroMemory(&a_str, sizeof(a_str));
EpidZeroMemory(&e_str, sizeof(e_str));
- EpidZeroMemory(Fq6IrrPolynomial, sizeof(Fq6IrrPolynomial));
+ EpidZeroMemory(&Fq6IrrPolynomial, sizeof(Fq6IrrPolynomial));
DeleteFfElement(&t00);
DeleteFfElement(&t01);
DeleteFfElement(&t02);
@@ -2336,15 +2395,17 @@ static EpidStatus ExpCyclotomic(PairingState* ps, FfElement* e,
// check parameters
if (!e || !a || !b || !ps) return kEpidBadArgErr;
-
- if (!e->ipp_ff_elem || !a->ipp_ff_elem || !ps->Fq.ipp_ff || !ps->Fq2.ipp_ff ||
- !b->ipp_bn)
+ if (!ps->Fq || !ps->Fq2) {
+ return kEpidBadArgErr;
+ }
+ if (!e->ipp_ff_elem || !a->ipp_ff_elem || !ps->Fq->ipp_ff ||
+ !ps->Fq2->ipp_ff || !b->ipp_bn)
return kEpidBadArgErr;
do {
IppStatus sts = ippStsNoErr;
int num_bits = 0;
- Ipp32u* b_str = 0;
+ IppBNU b_str = 0;
int i = 0;
// 1. Let bn...b1b0 be the binary representation of b.
diff --git a/epid/common/math/src/printutils.c b/epid/common/math/src/printutils.c
index d1b1e81..48fd00a 100644
--- a/epid/common/math/src/printutils.c
+++ b/epid/common/math/src/printutils.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@
/// Print to specified stream
#define PRINT(...) fprintf(stdout, __VA_ARGS__)
-static int PrintBuf(void const* buf, size_t size) {
+static int PrintBuf(ConstOctStr buf, size_t size) {
size_t curr_column = 0;
size_t i = 0;
if (!buf || size == 0) {
@@ -117,14 +117,14 @@ void PrintBigNum(BigNum const* big_num, char const* var_name) {
PRINT("<invalid>\n");
break;
}
- sts = ippsGetOctString_BN((Ipp8u*)buf, ipp_word_buf_size * sizeof(Ipp32u),
+ sts = ippsGetOctString_BN((OctStr)buf, ipp_word_buf_size * sizeof(Ipp32u),
big_num->ipp_bn);
if (ippStsNoErr != sts) {
MAKE_INDENT();
PRINT("<invalid>\n");
break;
}
- if (0 != PrintBuf((const void*)buf, ipp_word_buf_size * sizeof(Ipp32u))) {
+ if (0 != PrintBuf((ConstOctStr)buf, ipp_word_buf_size * sizeof(Ipp32u))) {
MAKE_INDENT();
PRINT("<invalid>\n");
break;
@@ -157,9 +157,9 @@ void PrintFfElement(FiniteField const* ff, FfElement const* ff_element,
}
// get the data
- ipp_ff_element_size = ff_element->info.elementLen * sizeof(Ipp32u);
+ ipp_ff_element_size = ff_element->element_len * sizeof(Ipp32u);
sts = ippsGFpGetElementOctString(ff_element->ipp_ff_elem,
- (Ipp8u*)&ff_element_str, ipp_ff_element_size,
+ (OctStr)&ff_element_str, ipp_ff_element_size,
ff->ipp_ff);
if (ippStsNoErr != sts) {
PRINT("%s (FfElement):\n", var_name);
@@ -189,7 +189,7 @@ void PrintFfElement(FiniteField const* ff, FfElement const* ff_element,
void PrintEcPoint(EcGroup const* g, EcPoint const* ec_point,
char const* var_name, PrintUtilFormat format) {
- FiniteField fp;
+ FiniteField* fp = NULL;
FfElement* fp_x = NULL;
FfElement* fp_y = NULL;
uint8_t ec_point_str[sizeof(G2ElemStr)];
@@ -202,7 +202,7 @@ void PrintEcPoint(EcGroup const* g, EcPoint const* ec_point,
PRINT("<null>\n");
return;
}
- if (!ec_point->ipp_ec_pt || !g->ipp_ec) {
+ if (!ec_point->ipp_ec_pt || !g->ff || !g->ipp_ec) {
PRINT("%s (EcPoint):\n", var_name);
MAKE_INDENT();
PRINT("<invalid>\n");
@@ -212,31 +212,24 @@ void PrintEcPoint(EcGroup const* g, EcPoint const* ec_point,
IppStatus sts = ippStsNoErr;
int ipp_half_strlen;
// get finite field
- sts = ippsGFpECGet(g->ipp_ec, (const IppsGFpState**)&(fp.ipp_ff), 0, 0, 0,
- 0, 0, 0, 0, 0);
- if (ippStsNoErr != sts) {
- PRINT("%s (EcPoint):\n", var_name);
- MAKE_INDENT();
- PRINT("<invalid>\n");
- break;
- }
+ fp = g->ff;
// create element X
- if (kEpidNoErr != NewFfElement(&fp, &fp_x)) {
+ if (kEpidNoErr != NewFfElement(fp, &fp_x)) {
PRINT("%s (EcPoint):\n", var_name);
MAKE_INDENT();
PRINT("<invalid>\n");
break;
}
// create element Y
- if (kEpidNoErr != NewFfElement(&fp, &fp_y)) {
+ if (kEpidNoErr != NewFfElement(fp, &fp_y)) {
PRINT("%s (EcPoint):\n", var_name);
MAKE_INDENT();
PRINT("<invalid>\n");
break;
}
- ipp_half_strlen = fp_x->info.elementLen * sizeof(Ipp32u);
+ ipp_half_strlen = fp_x->element_len * sizeof(Ipp32u);
// get elements from point
sts = ippsGFpECGetPoint(ec_point->ipp_ec_pt, fp_x->ipp_ff_elem,
@@ -250,8 +243,9 @@ void PrintEcPoint(EcGroup const* g, EcPoint const* ec_point,
}
// get element X data
- sts = ippsGFpGetElementOctString(fp_x->ipp_ff_elem, (Ipp8u*)&ec_point_str,
- ipp_half_strlen, fp.ipp_ff);
+ sts =
+ ippsGFpGetElementOctString(fp_x->ipp_ff_elem, (IppOctStr)&ec_point_str,
+ ipp_half_strlen, fp->ipp_ff);
// check return codes
if (ippStsNoErr != sts) {
PRINT("%s (EcPoint):\n", var_name);
@@ -261,8 +255,8 @@ void PrintEcPoint(EcGroup const* g, EcPoint const* ec_point,
}
// get element Y data
sts = ippsGFpGetElementOctString(fp_y->ipp_ff_elem,
- (Ipp8u*)&ec_point_str + ipp_half_strlen,
- ipp_half_strlen, fp.ipp_ff);
+ (IppOctStr)&ec_point_str + ipp_half_strlen,
+ ipp_half_strlen, fp->ipp_ff);
// check return codes
if (ippStsNoErr != sts) {
PRINT("%s (EcPoint):\n", var_name);
@@ -297,7 +291,7 @@ void PrintBigNumStr(BigNumStr const* big_num_str, char const* var_name) {
PRINT("<null>\n");
return;
}
- if (0 != PrintBuf((const void*)big_num_str, sizeof(*big_num_str))) {
+ if (0 != PrintBuf((ConstOctStr)big_num_str, sizeof(*big_num_str))) {
MAKE_INDENT();
PRINT("<invalid>\n");
return;
@@ -314,7 +308,7 @@ void PrintFpElemStr(FpElemStr const* fp_elem_str, char const* var_name) {
PRINT("<null>\n");
return;
}
- if (0 != PrintBuf((const void*)fp_elem_str, sizeof(*fp_elem_str))) {
+ if (0 != PrintBuf((ConstOctStr)fp_elem_str, sizeof(*fp_elem_str))) {
MAKE_INDENT();
PRINT("<invalid>\n");
return;
@@ -331,7 +325,7 @@ void PrintFqElemStr(FqElemStr const* fq_elem_str, char const* var_name) {
PRINT("<null>\n");
return;
}
- if (0 != PrintBuf((const void*)fq_elem_str, sizeof(*fq_elem_str))) {
+ if (0 != PrintBuf((ConstOctStr)fq_elem_str, sizeof(*fq_elem_str))) {
MAKE_INDENT();
PRINT("<invalid>\n");
return;
@@ -352,7 +346,7 @@ void PrintFq2ElemStr(Fq2ElemStr const* fq2_elem_str, char const* var_name,
if (format == kPrintUtilAnnotated) {
MAKE_INDENT();
PRINT("a0:\n");
- if (0 != PrintBuf((const void*)&fq2_elem_str->a[0],
+ if (0 != PrintBuf((ConstOctStr)&fq2_elem_str->a[0],
sizeof(fq2_elem_str->a[0]))) {
MAKE_INDENT();
PRINT("<invalid>\n");
@@ -360,14 +354,14 @@ void PrintFq2ElemStr(Fq2ElemStr const* fq2_elem_str, char const* var_name,
}
MAKE_INDENT();
PRINT("a1:\n");
- if (0 != PrintBuf((const void*)&fq2_elem_str->a[1],
+ if (0 != PrintBuf((ConstOctStr)&fq2_elem_str->a[1],
sizeof(fq2_elem_str->a[1]))) {
MAKE_INDENT();
PRINT("<invalid>\n");
return;
}
} else if (format == kPrintUtilUnannotated) {
- if (0 != PrintBuf((const void*)fq2_elem_str, sizeof(*fq2_elem_str))) {
+ if (0 != PrintBuf((ConstOctStr)fq2_elem_str, sizeof(*fq2_elem_str))) {
MAKE_INDENT();
PRINT("<invalid>\n");
return;
@@ -399,7 +393,7 @@ void PrintFq6ElemStr(Fq6ElemStr const* fq6_elem_str, char const* var_name,
j++) {
MAKE_INDENT();
PRINT("a%u.%u:\n", i, j);
- if (0 != PrintBuf((const void*)&fq6_elem_str->a[i].a[j],
+ if (0 != PrintBuf((ConstOctStr)&fq6_elem_str->a[i].a[j],
sizeof(fq6_elem_str->a[i].a[j]))) {
MAKE_INDENT();
PRINT("<invalid>\n");
@@ -408,7 +402,7 @@ void PrintFq6ElemStr(Fq6ElemStr const* fq6_elem_str, char const* var_name,
}
}
} else if (format == kPrintUtilUnannotated) {
- if (0 != PrintBuf((const void*)fq6_elem_str, sizeof(*fq6_elem_str))) {
+ if (0 != PrintBuf((ConstOctStr)fq6_elem_str, sizeof(*fq6_elem_str))) {
MAKE_INDENT();
PRINT("<invalid>\n");
return;
@@ -445,7 +439,7 @@ void PrintFq12ElemStr(Fq12ElemStr const* fq12_elem_str, char const* var_name,
k++) {
MAKE_INDENT();
PRINT("a%u.%u.%u:\n", i, j, k);
- if (0 != PrintBuf((const void*)&fq12_elem_str->a[i].a[j].a[k],
+ if (0 != PrintBuf((ConstOctStr)&fq12_elem_str->a[i].a[j].a[k],
sizeof(fq12_elem_str->a[i].a[j].a[k]))) {
MAKE_INDENT();
PRINT("<invalid>\n");
@@ -455,7 +449,7 @@ void PrintFq12ElemStr(Fq12ElemStr const* fq12_elem_str, char const* var_name,
}
}
} else if (format == kPrintUtilUnannotated) {
- if (0 != PrintBuf((const void*)fq12_elem_str, sizeof(*fq12_elem_str))) {
+ if (0 != PrintBuf((ConstOctStr)fq12_elem_str, sizeof(*fq12_elem_str))) {
MAKE_INDENT();
PRINT("<invalid>\n");
return;
@@ -481,20 +475,20 @@ void PrintG1ElemStr(G1ElemStr const* g1_elem_str, char const* var_name,
if (format == kPrintUtilAnnotated) {
MAKE_INDENT();
PRINT("x:\n");
- if (0 != PrintBuf((const void*)&g1_elem_str->x, sizeof(g1_elem_str->x))) {
+ if (0 != PrintBuf((ConstOctStr)&g1_elem_str->x, sizeof(g1_elem_str->x))) {
MAKE_INDENT();
PRINT("<invalid>\n");
return;
}
MAKE_INDENT();
PRINT("y:\n");
- if (0 != PrintBuf((const void*)&g1_elem_str->y, sizeof(g1_elem_str->y))) {
+ if (0 != PrintBuf((ConstOctStr)&g1_elem_str->y, sizeof(g1_elem_str->y))) {
MAKE_INDENT();
PRINT("<invalid>\n");
return;
}
} else if (format == kPrintUtilUnannotated) {
- if (0 != PrintBuf((const void*)g1_elem_str, sizeof(*g1_elem_str))) {
+ if (0 != PrintBuf((ConstOctStr)g1_elem_str, sizeof(*g1_elem_str))) {
MAKE_INDENT();
PRINT("<invalid>\n");
return;
@@ -521,7 +515,7 @@ void PrintG2ElemStr(G2ElemStr const* g2_elem_str, char const* var_name,
MAKE_INDENT();
PRINT("x0:\n");
if (0 !=
- PrintBuf((const void*)&g2_elem_str->x[0], sizeof(g2_elem_str->x[0]))) {
+ PrintBuf((ConstOctStr)&g2_elem_str->x[0], sizeof(g2_elem_str->x[0]))) {
MAKE_INDENT();
PRINT("<invalid>\n");
return;
@@ -529,7 +523,7 @@ void PrintG2ElemStr(G2ElemStr const* g2_elem_str, char const* var_name,
MAKE_INDENT();
PRINT("x1:\n");
if (0 !=
- PrintBuf((const void*)&g2_elem_str->x[1], sizeof(g2_elem_str->x[1]))) {
+ PrintBuf((ConstOctStr)&g2_elem_str->x[1], sizeof(g2_elem_str->x[1]))) {
MAKE_INDENT();
PRINT("<invalid>\n");
return;
@@ -537,7 +531,7 @@ void PrintG2ElemStr(G2ElemStr const* g2_elem_str, char const* var_name,
MAKE_INDENT();
PRINT("y0:\n");
if (0 !=
- PrintBuf((const void*)&g2_elem_str->y[0], sizeof(g2_elem_str->y[0]))) {
+ PrintBuf((ConstOctStr)&g2_elem_str->y[0], sizeof(g2_elem_str->y[0]))) {
MAKE_INDENT();
PRINT("<invalid>\n");
return;
@@ -545,13 +539,13 @@ void PrintG2ElemStr(G2ElemStr const* g2_elem_str, char const* var_name,
MAKE_INDENT();
PRINT("y1:\n");
if (0 !=
- PrintBuf((const void*)&g2_elem_str->y[1], sizeof(g2_elem_str->y[1]))) {
+ PrintBuf((ConstOctStr)&g2_elem_str->y[1], sizeof(g2_elem_str->y[1]))) {
MAKE_INDENT();
PRINT("<invalid>\n");
return;
}
} else if (format == kPrintUtilUnannotated) {
- if (0 != PrintBuf((const void*)g2_elem_str, sizeof(*g2_elem_str))) {
+ if (0 != PrintBuf((ConstOctStr)g2_elem_str, sizeof(*g2_elem_str))) {
MAKE_INDENT();
PRINT("<invalid>\n");
return;
@@ -579,7 +573,7 @@ void PrintGtElemStr(GtElemStr const* gt_elem_str, char const* var_name,
for (i = 0; i < sizeof(gt_elem_str->x) / sizeof(gt_elem_str->x[0]); i++) {
MAKE_INDENT();
PRINT("x%u:\n", i);
- if (0 != PrintBuf((const void*)&gt_elem_str->x[i],
+ if (0 != PrintBuf((ConstOctStr)&gt_elem_str->x[i],
sizeof(gt_elem_str->x[i]))) {
MAKE_INDENT();
PRINT("<invalid>\n");
@@ -587,7 +581,7 @@ void PrintGtElemStr(GtElemStr const* gt_elem_str, char const* var_name,
}
}
} else if (format == kPrintUtilUnannotated) {
- if (0 != PrintBuf((const void*)gt_elem_str, sizeof(*gt_elem_str))) {
+ if (0 != PrintBuf((ConstOctStr)gt_elem_str, sizeof(*gt_elem_str))) {
MAKE_INDENT();
PRINT("<invalid>\n");
return;
diff --git a/epid/common/math/src/sha256.c b/epid/common/math/src/sha256.c
index 7f1b3f3..cea65de 100644
--- a/epid/common/math/src/sha256.c
+++ b/epid/common/math/src/sha256.c
@@ -1,5 +1,5 @@
/*############################################################################
-# Copyright 2016 Intel Corporation
+# Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief SHA256 implementation.
*/
#include "epid/common/math/hash.h"
+#include "epid/common/math/src/bignum-internal.h"
#include "ext/ipp/include/ippcp.h"
EpidStatus Sha256MessageDigest(void const* msg, size_t len,
@@ -30,7 +31,7 @@ EpidStatus Sha256MessageDigest(void const* msg, size_t len,
if (INT_MAX < len) return kEpidBadArgErr;
- sts = ippsSHA256MessageDigest(msg, ipp_len, (Ipp8u*)digest);
+ sts = ippsSHA256MessageDigest(msg, ipp_len, (IppOctStr)digest);
if (ippStsNoErr != sts) {
if (ippStsLengthErr == sts) {
return kEpidBadArgErr;
diff --git a/epid/common/math/src/tatepairing-internal.h b/epid/common/math/src/tatepairing-internal.h
index 019f3ff..163f4f3 100644
--- a/epid/common/math/src/tatepairing-internal.h
+++ b/epid/common/math/src/tatepairing-internal.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -33,8 +33,8 @@ struct Epid11PairingState {
BigNum* final_exp_constant; ///< (q^2 - q + 1)/p
FfElement* fq3_inv_constant; ///< (inverse(qnr), 0) in Fq3
FfElement* fq3_inv2_constant; ///< (inverse(qnr)^2, 0) in Fq3
- FiniteField Fq; ///< Fq
- FiniteField Fq3; ///< Fq3
+ FiniteField* Fq; ///< Fq
+ FiniteField* Fq3; ///< Fq3
FfElement* alpha_q[3]; ///< {t^(0*q), t^(1*q), t^(2*q)}
};
diff --git a/epid/common/math/src/tatepairing.c b/epid/common/math/src/tatepairing.c
index 0267eb9..dd65789 100644
--- a/epid/common/math/src/tatepairing.c
+++ b/epid/common/math/src/tatepairing.c
@@ -1,5 +1,5 @@
/*############################################################################
-# Copyright 2016 Intel Corporation
+# Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -27,7 +27,6 @@
#include "epid/common/math/src/tatepairing-internal.h"
#include "epid/common/src/memory.h"
#include "ext/ipp/include/ippcp.h"
-#include "ext/ipp/include/ippcpepid.h"
/// Handle Ipp Errors with Break
#define BREAK_ON_IPP_ERROR(sts, ret) \
@@ -83,162 +82,148 @@ EpidStatus NewEpid11PairingState(EcGroup const* ga, EcGroup const* gb,
FiniteField const* ff,
Epid11PairingState** ps) {
EpidStatus result = kEpidErr;
- Epid11PairingState* paring_state_ctx = NULL;
+ Epid11PairingState* pairing_state_ctx = NULL;
BigNum* tmp = NULL;
BigNum* p = NULL;
- BigNum* q = NULL;
FfElement* qnr = NULL;
FfElement* inv_qnr = NULL;
FfElement* neg_qnr = NULL;
Fq3ElemStr fq3_str = {0};
- FqElemDat q_data = {0};
int i = 0;
do {
IppStatus sts = ippStsNoErr;
IppsGFpState* Fq3 = NULL;
IppsGFpState* Fq = NULL;
- IppsGFpInfo info = {0};
- Fq3ElemDat ff_modulus[3] = {0};
+ Fq3ElemDat ff_modulus = {0};
uint8_t one_str[] = {1};
- const Ipp32u* p_data = NULL;
- int p_len = 0;
uint8_t remainder_str = 0xff;
Fq3ElemStr trans_100 = {0};
Fq3ElemStr trans_010 = {0};
+ FiniteField* Ffq = NULL;
// validate inputs
if (!ga || !gb || !ff || !ps) {
result = kEpidBadArgErr;
break;
}
- if (!ga->ipp_ec || !gb->ipp_ec || !ff->ipp_ff) {
+ if (!ga->ff || !ga->ipp_ec || !gb->ff || !gb->ipp_ec || !ff->ipp_ff) {
result = kEpidBadArgErr;
break;
}
- if (1 != ga->info.basicGFdegree || 3 != gb->info.basicGFdegree ||
- 6 != ff->info.basicGFdegree ||
- sizeof(Epid11G1ElemStr) != (ga->info.elementLen << 3) ||
- sizeof(Epid11G2ElemStr) != (gb->info.elementLen << 3) ||
- sizeof(Epid11GtElemStr) != (ff->info.elementLen << 2)) {
+ if (1 != ga->ff->basic_degree || 3 != gb->ff->basic_degree ||
+ 6 != ff->basic_degree ||
+ sizeof(Epid11G1ElemStr) != (ga->ff->element_len << 3) ||
+ sizeof(Epid11G2ElemStr) != (gb->ff->element_len << 3) ||
+ sizeof(Epid11GtElemStr) != (ff->element_len << 2)) {
result = kEpidBadArgErr;
break;
}
- paring_state_ctx =
+ pairing_state_ctx =
(Epid11PairingState*)SAFE_ALLOC(sizeof(Epid11PairingState));
- if (!paring_state_ctx) {
+ if (!pairing_state_ctx) {
result = kEpidMemAllocErr;
break;
}
// store EPID fields and groups
- paring_state_ctx->ga = (EcGroup*)ga;
- paring_state_ctx->gb = (EcGroup*)gb;
- paring_state_ctx->ff = (FiniteField*)ff;
+ pairing_state_ctx->ga = (EcGroup*)ga;
+ pairing_state_ctx->gb = (EcGroup*)gb;
+ pairing_state_ctx->ff = (FiniteField*)ff;
// get Fq3, Fq
- sts = ippsGFpGetInfo(ff->ipp_ff, &info);
- BREAK_ON_IPP_ERROR(sts, result);
- Fq3 = (IppsGFpState*)info.pGroundGF;
- result = InitFiniteFieldFromIpp(Fq3, &(paring_state_ctx->Fq3));
- BREAK_ON_EPID_ERROR(result);
-
- sts = ippsGFpGetInfo(Fq3, &info);
- BREAK_ON_IPP_ERROR(sts, result);
- Fq = (IppsGFpState*)info.pGroundGF;
- result = InitFiniteFieldFromIpp(Fq, &(paring_state_ctx->Fq));
- BREAK_ON_EPID_ERROR(result);
+ pairing_state_ctx->Fq3 = ff->ground_ff;
+ if (!pairing_state_ctx->Fq3) {
+ result = kEpidBadArgErr;
+ break;
+ }
+ Fq3 = pairing_state_ctx->Fq3->ipp_ff;
+ pairing_state_ctx->Fq = pairing_state_ctx->Fq3->ground_ff;
+ Ffq = pairing_state_ctx->Fq;
+ if (!pairing_state_ctx->Fq) {
+ result = kEpidBadArgErr;
+ break;
+ }
+ Fq = pairing_state_ctx->Fq->ipp_ff;
// compute fq3_inv_constant = (inverse(qnr), 0, 0)
- result = NewFfElement(&paring_state_ctx->Fq3,
- &paring_state_ctx->fq3_inv_constant);
+ result = NewFfElement(pairing_state_ctx->Fq3,
+ &pairing_state_ctx->fq3_inv_constant);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&paring_state_ctx->Fq, &neg_qnr);
+ result = NewFfElement(pairing_state_ctx->Fq, &neg_qnr);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&paring_state_ctx->Fq, &qnr);
+ result = NewFfElement(pairing_state_ctx->Fq, &qnr);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&paring_state_ctx->Fq, &inv_qnr);
+ result = NewFfElement(pairing_state_ctx->Fq, &inv_qnr);
BREAK_ON_EPID_ERROR(result);
- sts = ippsGFpGetModulus(ff->ipp_ff, (Ipp32u*)&ff_modulus);
- BREAK_ON_IPP_ERROR(sts, result);
- sts =
- ippsGFpSetElement(ff_modulus[0].x[0].x, COUNT_OF(ff_modulus[0].x[0].x),
- neg_qnr->ipp_ff_elem, Fq);
- BREAK_ON_IPP_ERROR(sts, result);
- result = FfNeg(&paring_state_ctx->Fq, neg_qnr, qnr);
+ result = WriteBigNum(ff->modulus_0, sizeof(ff_modulus), &ff_modulus);
BREAK_ON_EPID_ERROR(result);
- result = FfInv(&paring_state_ctx->Fq, qnr, inv_qnr);
+ result = SetFfElementOctString((ConstOctStr)ff_modulus.x[0].x,
+ sizeof(ff_modulus.x[0].x), neg_qnr,
+ pairing_state_ctx->Fq);
BREAK_ON_EPID_ERROR(result);
- result = WriteFfElement(&paring_state_ctx->Fq, inv_qnr, &fq3_str.a[0],
+ result = FfNeg(pairing_state_ctx->Fq, neg_qnr, qnr);
+ BREAK_ON_EPID_ERROR(result);
+ result = FfInv(pairing_state_ctx->Fq, qnr, inv_qnr);
+ BREAK_ON_EPID_ERROR(result);
+ result = WriteFfElement(pairing_state_ctx->Fq, inv_qnr, &fq3_str.a[0],
sizeof(fq3_str.a[0]));
BREAK_ON_EPID_ERROR(result);
- result = ReadFfElement(&paring_state_ctx->Fq3, &fq3_str, sizeof(fq3_str),
- paring_state_ctx->fq3_inv_constant);
+ result = ReadFfElement(pairing_state_ctx->Fq3, &fq3_str, sizeof(fq3_str),
+ pairing_state_ctx->fq3_inv_constant);
BREAK_ON_EPID_ERROR(result);
// compute fq3_inv2_constant = (inverse(qnr)^2, 0, 0)
// inv_qnr = inv_qnr^2
- result = NewFfElement(&paring_state_ctx->Fq3,
- &paring_state_ctx->fq3_inv2_constant);
+ result = NewFfElement(pairing_state_ctx->Fq3,
+ &pairing_state_ctx->fq3_inv2_constant);
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&paring_state_ctx->Fq, inv_qnr, inv_qnr, inv_qnr);
+ result = FfMul(pairing_state_ctx->Fq, inv_qnr, inv_qnr, inv_qnr);
BREAK_ON_EPID_ERROR(result);
- result = WriteFfElement(&paring_state_ctx->Fq, inv_qnr, &fq3_str.a[0],
+ result = WriteFfElement(pairing_state_ctx->Fq, inv_qnr, &fq3_str.a[0],
sizeof(fq3_str.a[0]));
BREAK_ON_EPID_ERROR(result);
- result = ReadFfElement(&paring_state_ctx->Fq3, &fq3_str, sizeof(fq3_str),
- paring_state_ctx->fq3_inv2_constant);
+ result = ReadFfElement(pairing_state_ctx->Fq3, &fq3_str, sizeof(fq3_str),
+ pairing_state_ctx->fq3_inv2_constant);
BREAK_ON_EPID_ERROR(result);
- // save parameter q for future use
- sts = ippsGFpGetModulus(Fq, (Ipp32u*)&q_data);
- BREAK_ON_IPP_ERROR(sts, result);
- result = NewBigNum(sizeof(BigNumStr), &q);
- BREAK_ON_EPID_ERROR(result);
- sts = ippsSet_BN(IppsBigNumPOS, sizeof(q_data) / sizeof(Ipp32u),
- (Ipp32u*)&q_data, q->ipp_bn);
- BREAK_ON_IPP_ERROR(sts, result);
-
// save parameters a and p for future use
- result = NewFfElement(&paring_state_ctx->Fq, &paring_state_ctx->a);
+ result = NewFfElement(pairing_state_ctx->Fq, &pairing_state_ctx->a);
BREAK_ON_EPID_ERROR(result);
result = NewBigNum(sizeof(BigNumStr), &p);
BREAK_ON_EPID_ERROR(result);
- sts = ippsGFpECGet(ga->ipp_ec, NULL, paring_state_ctx->a->ipp_ff_elem, NULL,
- NULL, NULL, &p_data, &p_len, NULL, NULL);
+ sts =
+ ippsGFpECGet(NULL, pairing_state_ctx->a->ipp_ff_elem, NULL, ga->ipp_ec);
BREAK_ON_IPP_ERROR(sts, result);
- if (p_len * sizeof(*p_data) > sizeof(BigNumStr)) {
- result = kEpidErr; // order size is unexpected
- break;
- }
- sts = ippsSet_BN(IppsBigNumPOS, p_len, p_data, p->ipp_bn);
+ sts = ippsGFpECGetSubgroup(NULL, NULL, NULL, p->ipp_bn, NULL, ga->ipp_ec);
BREAK_ON_IPP_ERROR(sts, result);
// compute p bit size requred for pairing
- sts = ippsGetOctString_BN((Ipp8u*)&paring_state_ctx->p,
- sizeof(paring_state_ctx->p), p->ipp_bn);
+ sts = ippsGetOctString_BN((OctStr)&pairing_state_ctx->p,
+ sizeof(pairing_state_ctx->p), p->ipp_bn);
BREAK_ON_IPP_ERROR(sts, result);
- paring_state_ctx->p_bitsize = OctStrBitSize(
- paring_state_ctx->p.data.data, sizeof(paring_state_ctx->p.data.data));
+ pairing_state_ctx->p_bitsize = OctStrBitSize(
+ pairing_state_ctx->p.data.data, sizeof(pairing_state_ctx->p.data.data));
// compute final_exp_constant = (q^2 - q + 1)/p
- result =
- NewBigNum(2 * sizeof(BigNumStr), &paring_state_ctx->final_exp_constant);
+ result = NewBigNum(2 * sizeof(BigNumStr),
+ &pairing_state_ctx->final_exp_constant);
BREAK_ON_EPID_ERROR(result);
result = NewBigNum(sizeof(BigNumStr), &tmp);
BREAK_ON_EPID_ERROR(result);
result = ReadBigNum(one_str, sizeof(one_str), tmp);
BREAK_ON_EPID_ERROR(result);
- result = BigNumMul(q, q, paring_state_ctx->final_exp_constant);
+ result = BigNumMul(Ffq->modulus_0, Ffq->modulus_0,
+ pairing_state_ctx->final_exp_constant);
BREAK_ON_EPID_ERROR(result);
- result = BigNumSub(paring_state_ctx->final_exp_constant, q,
- paring_state_ctx->final_exp_constant);
+ result = BigNumSub(pairing_state_ctx->final_exp_constant, Ffq->modulus_0,
+ pairing_state_ctx->final_exp_constant);
BREAK_ON_EPID_ERROR(result);
- result = BigNumAdd(paring_state_ctx->final_exp_constant, tmp,
- paring_state_ctx->final_exp_constant);
+ result = BigNumAdd(pairing_state_ctx->final_exp_constant, tmp,
+ pairing_state_ctx->final_exp_constant);
BREAK_ON_EPID_ERROR(result);
- result = BigNumDiv(paring_state_ctx->final_exp_constant, p,
- paring_state_ctx->final_exp_constant, tmp);
+ result = BigNumDiv(pairing_state_ctx->final_exp_constant, p,
+ pairing_state_ctx->final_exp_constant, tmp);
BREAK_ON_EPID_ERROR(result);
result = WriteBigNum(tmp, sizeof(remainder_str), &remainder_str);
if (kEpidNoErr != result || 0 != remainder_str) {
@@ -247,51 +232,50 @@ EpidStatus NewEpid11PairingState(EcGroup const* ga, EcGroup const* gb,
}
for (i = 0; i < 3; i++) {
- result =
- NewFfElement(&paring_state_ctx->Fq3, &(paring_state_ctx->alpha_q[i]));
+ result = NewFfElement(pairing_state_ctx->Fq3,
+ &(pairing_state_ctx->alpha_q[i]));
BREAK_ON_EPID_ERROR(result);
}
BREAK_ON_EPID_ERROR(result);
/* t^(0*q) */
trans_100.a[0].data.data[31] = 1;
- result = ReadFfElement(&paring_state_ctx->Fq3, &trans_100,
- sizeof(trans_100), paring_state_ctx->alpha_q[0]);
+ result = ReadFfElement(pairing_state_ctx->Fq3, &trans_100,
+ sizeof(trans_100), pairing_state_ctx->alpha_q[0]);
BREAK_ON_EPID_ERROR(result);
/* t^(1*q) */
trans_010.a[1].data.data[31] = 1;
- result = ReadFfElement(&paring_state_ctx->Fq3, &trans_010,
- sizeof(trans_010), paring_state_ctx->alpha_q[1]);
+ result = ReadFfElement(pairing_state_ctx->Fq3, &trans_010,
+ sizeof(trans_010), pairing_state_ctx->alpha_q[1]);
BREAK_ON_EPID_ERROR(result);
- result = FfExp(&paring_state_ctx->Fq3, paring_state_ctx->alpha_q[1], q,
- paring_state_ctx->alpha_q[1]);
+ result = FfExp(pairing_state_ctx->Fq3, pairing_state_ctx->alpha_q[1],
+ Ffq->modulus_0, pairing_state_ctx->alpha_q[1]);
BREAK_ON_EPID_ERROR(result);
/* t^(2*q) */
- result = FfMul(&paring_state_ctx->Fq3, paring_state_ctx->alpha_q[1],
- paring_state_ctx->alpha_q[1], paring_state_ctx->alpha_q[2]);
+ result =
+ FfMul(pairing_state_ctx->Fq3, pairing_state_ctx->alpha_q[1],
+ pairing_state_ctx->alpha_q[1], pairing_state_ctx->alpha_q[2]);
BREAK_ON_EPID_ERROR(result);
- *ps = paring_state_ctx;
+ *ps = pairing_state_ctx;
result = kEpidNoErr;
} while (0);
EpidZeroMemory(&fq3_str, sizeof(fq3_str));
- EpidZeroMemory(&q_data, sizeof(q_data));
DeleteBigNum(&p);
- DeleteBigNum(&q);
DeleteBigNum(&tmp);
DeleteFfElement(&qnr);
DeleteFfElement(&inv_qnr);
DeleteFfElement(&neg_qnr);
if (kEpidNoErr != result) {
- if (paring_state_ctx) {
- DeleteFfElement(&paring_state_ctx->a);
- DeleteFfElement(&paring_state_ctx->fq3_inv_constant);
- DeleteFfElement(&paring_state_ctx->fq3_inv2_constant);
- DeleteBigNum(&paring_state_ctx->final_exp_constant);
+ if (pairing_state_ctx) {
+ DeleteFfElement(&pairing_state_ctx->a);
+ DeleteFfElement(&pairing_state_ctx->fq3_inv_constant);
+ DeleteFfElement(&pairing_state_ctx->fq3_inv2_constant);
+ DeleteBigNum(&pairing_state_ctx->final_exp_constant);
for (i = 0; i < 3; i++) {
- DeleteFfElement(&(paring_state_ctx->alpha_q[i]));
+ DeleteFfElement(&(pairing_state_ctx->alpha_q[i]));
}
- SAFE_FREE(paring_state_ctx);
+ SAFE_FREE(pairing_state_ctx);
}
}
return result;
@@ -347,7 +331,12 @@ EpidStatus Epid11Pairing(Epid11PairingState* ps, EcPoint const* a,
int i;
if (!ps || !a || !b || !d) return kEpidBadArgErr;
-
+ if (!ps->Fq || !ps->Fq3) {
+ return kEpidBadArgErr;
+ }
+ if (!ps->Fq->ipp_ff || !ps->Fq3->ipp_ff) {
+ return kEpidBadArgErr;
+ }
do {
Epid11GtElemStr one_fq6 = {0};
FqElemStr one_fq = {0};
@@ -365,15 +354,15 @@ EpidStatus Epid11Pairing(Epid11PairingState* ps, EcPoint const* a,
}
// Let Q = (Q.x, Q.y), where Q.x and Q.y are elements in Fqd.
- result = NewFfElement(&ps->Fq3, &b0);
+ result = NewFfElement(ps->Fq3, &b0);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq3, &b1);
+ result = NewFfElement(ps->Fq3, &b1);
BREAK_ON_EPID_ERROR(result);
result = WriteEcPoint(ps->gb, b, &b_str, sizeof(b_str));
BREAK_ON_EPID_ERROR(result);
- result = ReadFfElement(&ps->Fq3, &b_str.x, sizeof(b_str.x), b0);
+ result = ReadFfElement(ps->Fq3, &b_str.x, sizeof(b_str.x), b0);
BREAK_ON_EPID_ERROR(result);
- result = ReadFfElement(&ps->Fq3, &b_str.y, sizeof(b_str.y), b1);
+ result = ReadFfElement(ps->Fq3, &b_str.y, sizeof(b_str.y), b1);
BREAK_ON_EPID_ERROR(result);
// Now we compute Qx, Qy, two elements in GT, as follows.
@@ -383,59 +372,59 @@ EpidStatus Epid11Pairing(Epid11PairingState* ps, EcPoint const* a,
BREAK_ON_EPID_ERROR(result);
// Compute Qx = (inv * Q.x, 0).
- result = FfMul(&ps->Fq3, ps->fq3_inv_constant, b0, b0);
+ result = FfMul(ps->Fq3, ps->fq3_inv_constant, b0, b0);
BREAK_ON_EPID_ERROR(result);
- result = WriteFfElement(&ps->Fq3, b0, &bx_str.a[0], sizeof(bx_str.a[0]));
+ result = WriteFfElement(ps->Fq3, b0, &bx_str.a[0], sizeof(bx_str.a[0]));
BREAK_ON_EPID_ERROR(result);
result = ReadFfElement(ps->ff, &bx_str, sizeof(bx_str), pQx);
BREAK_ON_EPID_ERROR(result);
// Compute Qy = (0, inv^2 * Q.y).
- result = FfMul(&ps->Fq3, ps->fq3_inv2_constant, b1, b1);
+ result = FfMul(ps->Fq3, ps->fq3_inv2_constant, b1, b1);
BREAK_ON_EPID_ERROR(result);
- result = WriteFfElement(&ps->Fq3, b1, &by_str.a[1], sizeof(by_str.a[1]));
+ result = WriteFfElement(ps->Fq3, b1, &by_str.a[1], sizeof(by_str.a[1]));
BREAK_ON_EPID_ERROR(result);
result = ReadFfElement(ps->ff, &by_str, sizeof(by_str), pQy);
BREAK_ON_EPID_ERROR(result);
// Let P = (px, py), where px, py are big integers.
- result = NewFfElement(&ps->Fq, &px);
+ result = NewFfElement(ps->Fq, &px);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq, &py);
+ result = NewFfElement(ps->Fq, &py);
BREAK_ON_EPID_ERROR(result);
result = WriteEcPoint(ps->ga, a, &a_str, sizeof(a_str));
BREAK_ON_EPID_ERROR(result);
- result = ReadFfElement(&ps->Fq, &a_str.x, sizeof(a_str.x), px);
+ result = ReadFfElement(ps->Fq, &a_str.x, sizeof(a_str.x), px);
BREAK_ON_EPID_ERROR(result);
- result = ReadFfElement(&ps->Fq, &a_str.y, sizeof(a_str.y), py);
+ result = ReadFfElement(ps->Fq, &a_str.y, sizeof(a_str.y), py);
BREAK_ON_EPID_ERROR(result);
// Let X, Y, Z, X', Y', Z', w, v, ty, ry be elements in Fq.
- result = NewFfElement(&ps->Fq, &X);
+ result = NewFfElement(ps->Fq, &X);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq, &Y);
+ result = NewFfElement(ps->Fq, &Y);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq, &Z);
+ result = NewFfElement(ps->Fq, &Z);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq, &X2);
+ result = NewFfElement(ps->Fq, &X2);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq, &Y2);
+ result = NewFfElement(ps->Fq, &Y2);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq, &Z2);
+ result = NewFfElement(ps->Fq, &Z2);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq, &w);
+ result = NewFfElement(ps->Fq, &w);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq, &v);
+ result = NewFfElement(ps->Fq, &v);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq, &ty);
+ result = NewFfElement(ps->Fq, &ty);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq, &ry);
+ result = NewFfElement(ps->Fq, &ry);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq, &t1);
+ result = NewFfElement(ps->Fq, &t1);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq, &t2);
+ result = NewFfElement(ps->Fq, &t2);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq, &t3);
+ result = NewFfElement(ps->Fq, &t3);
BREAK_ON_EPID_ERROR(result);
// Let tx, rx be elements in GT.
@@ -451,19 +440,19 @@ EpidStatus Epid11Pairing(Epid11PairingState* ps, EcPoint const* a,
BREAK_ON_EPID_ERROR(result);
// Set X = px,
- result = ReadFfElement(&ps->Fq, &a_str.x, sizeof(a_str.x), X);
+ result = ReadFfElement(ps->Fq, &a_str.x, sizeof(a_str.x), X);
BREAK_ON_EPID_ERROR(result);
// Y = py,
- result = ReadFfElement(&ps->Fq, &a_str.y, sizeof(a_str.y), Y);
+ result = ReadFfElement(ps->Fq, &a_str.y, sizeof(a_str.y), Y);
BREAK_ON_EPID_ERROR(result);
// Z = 1,
- result = ReadFfElement(&ps->Fq, &one_fq, sizeof(one_fq), Z);
+ result = ReadFfElement(ps->Fq, &one_fq, sizeof(one_fq), Z);
BREAK_ON_EPID_ERROR(result);
// ry = 1.
- result = ReadFfElement(&ps->Fq, &one_fq, sizeof(one_fq), ry);
+ result = ReadFfElement(ps->Fq, &one_fq, sizeof(one_fq), ry);
BREAK_ON_EPID_ERROR(result);
// Set rx = 1, identity element of GT.
@@ -475,88 +464,88 @@ EpidStatus Epid11Pairing(Epid11PairingState* ps, EcPoint const* a,
for (i = (int)ps->p_bitsize - 2; i >= 0; i--) {
bool pi = ps->p.data.data[sizeof(ps->p) - 1 - (i >> 3)] & (1 << (i & 7));
- result = FfMul(&ps->Fq, Z, Z, ty); // ty = Z^2
+ result = FfMul(ps->Fq, Z, Z, ty); // ty = Z^2
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, ty, ty, t1); // t1 = Z^4
+ result = FfMul(ps->Fq, ty, ty, t1); // t1 = Z^4
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, t1, ps->a, t1); // t1 = a*Z^4
+ result = FfMul(ps->Fq, t1, ps->a, t1); // t1 = a*Z^4
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, X, X, w); // w = X^2
+ result = FfMul(ps->Fq, X, X, w); // w = X^2
BREAK_ON_EPID_ERROR(result);
- result = FfAdd(&ps->Fq, w, w, t2); // t2 = 2 * X^2
+ result = FfAdd(ps->Fq, w, w, t2); // t2 = 2 * X^2
BREAK_ON_EPID_ERROR(result);
- result = FfAdd(&ps->Fq, w, t2, w); // w = 3 * X^2
+ result = FfAdd(ps->Fq, w, t2, w); // w = 3 * X^2
BREAK_ON_EPID_ERROR(result);
- result = FfAdd(&ps->Fq, w, t1, w); // w = 3 * X^2 + a * Z^4
+ result = FfAdd(ps->Fq, w, t1, w); // w = 3 * X^2 + a * Z^4
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, Y, Y, t1); // t1 = Y^2
+ result = FfMul(ps->Fq, Y, Y, t1); // t1 = Y^2
BREAK_ON_EPID_ERROR(result);
- result = FfAdd(&ps->Fq, t1, t1, t3); // t3 = 2* Y^2
+ result = FfAdd(ps->Fq, t1, t1, t3); // t3 = 2* Y^2
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, t3, X, v); // v = 2 * X * Y^2
+ result = FfMul(ps->Fq, t3, X, v); // v = 2 * X * Y^2
BREAK_ON_EPID_ERROR(result);
- result = FfAdd(&ps->Fq, v, v, v); // v = 4 * X * Y^2
+ result = FfAdd(ps->Fq, v, v, v); // v = 4 * X * Y^2
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, w, w, X2); // X2 = w^2
+ result = FfMul(ps->Fq, w, w, X2); // X2 = w^2
BREAK_ON_EPID_ERROR(result);
- result = FfSub(&ps->Fq, X2, v, X2); // X2 = w^2 - v
+ result = FfSub(ps->Fq, X2, v, X2); // X2 = w^2 - v
BREAK_ON_EPID_ERROR(result);
- result = FfSub(&ps->Fq, X2, v, X2); // X2 = w^2 - 2 * w
+ result = FfSub(ps->Fq, X2, v, X2); // X2 = w^2 - 2 * w
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, t3, t3, t3); // t3 = 4 * Y^4
+ result = FfMul(ps->Fq, t3, t3, t3); // t3 = 4 * Y^4
BREAK_ON_EPID_ERROR(result);
- result = FfAdd(&ps->Fq, t3, t3, t3); // t3 = 8 * Y^4
+ result = FfAdd(ps->Fq, t3, t3, t3); // t3 = 8 * Y^4
BREAK_ON_EPID_ERROR(result);
- result = FfSub(&ps->Fq, v, X2, Y2); // Y2 = v - X2
+ result = FfSub(ps->Fq, v, X2, Y2); // Y2 = v - X2
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, Y2, w, Y2); // Y2 = w * (v - X2)
+ result = FfMul(ps->Fq, Y2, w, Y2); // Y2 = w * (v - X2)
BREAK_ON_EPID_ERROR(result);
- result = FfSub(&ps->Fq, Y2, t3, Y2); // Y2 = w * (v - X2) - 8 * Y^4
+ result = FfSub(ps->Fq, Y2, t3, Y2); // Y2 = w * (v - X2) - 8 * Y^4
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, Y, Z, Z2); // Z2 = Y * Z
+ result = FfMul(ps->Fq, Y, Z, Z2); // Z2 = Y * Z
BREAK_ON_EPID_ERROR(result);
- result = FfAdd(&ps->Fq, Z2, Z2, Z2); // Z2 = 2 * Y * Z
+ result = FfAdd(ps->Fq, Z2, Z2, Z2); // Z2 = 2 * Y * Z
BREAK_ON_EPID_ERROR(result);
/* compute line */
- result = FfMul(&ps->Fq, ty, w, t2); // t2 = w * Z^2
+ result = FfMul(ps->Fq, ty, w, t2); // t2 = w * Z^2
BREAK_ON_EPID_ERROR(result);
- result = Fq6FromFq(ps->ff, &ps->Fq, t2, tt2);
+ result = Fq6FromFq(ps->ff, ps->Fq, t2, tt2);
BREAK_ON_EPID_ERROR(result);
result = FfMul(ps->ff, pQx, tt2, tt1); // tt1 = w * Z^2 * Qx
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, w, X, t2); // t2 = w * X
+ result = FfMul(ps->Fq, w, X, t2); // t2 = w * X
BREAK_ON_EPID_ERROR(result);
- result = FfSub(&ps->Fq, t2, t1, t2); // t2 = w * X - Y^2
+ result = FfSub(ps->Fq, t2, t1, t2); // t2 = w * X - Y^2
BREAK_ON_EPID_ERROR(result);
- result = FfSub(&ps->Fq, t2, t1, t2); // t2 = w * X - 2 * Y^2
+ result = FfSub(ps->Fq, t2, t1, t2); // t2 = w * X - 2 * Y^2
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, ty, Z2, ty); // ty = Z2 * Z^2
+ result = FfMul(ps->Fq, ty, Z2, ty); // ty = Z2 * Z^2
BREAK_ON_EPID_ERROR(result);
- result = Fq6FromFq(ps->ff, &ps->Fq, ty, tt2);
+ result = Fq6FromFq(ps->ff, ps->Fq, ty, tt2);
BREAK_ON_EPID_ERROR(result);
result = FfMul(ps->ff, pQy, tt2, tx); // tx = ty * Qy
BREAK_ON_EPID_ERROR(result);
result = FfSub(ps->ff, tx, tt1, tx); // tx = ty * Qy - w * Z^2 * Qx
BREAK_ON_EPID_ERROR(result);
- result = Fq6FromFq(ps->ff, &ps->Fq, t2, tt2);
+ result = Fq6FromFq(ps->ff, ps->Fq, t2, tt2);
BREAK_ON_EPID_ERROR(result);
result = FfAdd(ps->ff, tx, tt2,
tx); // tx = ty * Qy - w * Z^2 * Qx + w * X - 2 * Y^2
BREAK_ON_EPID_ERROR(result);
sts = ippsGFpCpyElement(X2->ipp_ff_elem, X->ipp_ff_elem,
- ps->Fq.ipp_ff); // X = X2
+ ps->Fq->ipp_ff); // X = X2
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpCpyElement(Y2->ipp_ff_elem, Y->ipp_ff_elem,
- ps->Fq.ipp_ff); // Y = Y2
+ ps->Fq->ipp_ff); // Y = Y2
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpCpyElement(Z2->ipp_ff_elem, Z->ipp_ff_elem,
- ps->Fq.ipp_ff); // Z = Z2
+ ps->Fq->ipp_ff); // Z = Z2
BREAK_ON_IPP_ERROR(sts, result);
/* udpate rx, ry */
@@ -564,68 +553,68 @@ EpidStatus Epid11Pairing(Epid11PairingState* ps, EcPoint const* a,
BREAK_ON_EPID_ERROR(result);
result = FfMul(ps->ff, tx, tt1, rx); // rx = tx * rx * rx
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, ry, ry, t1); // t1 = ry * ry
+ result = FfMul(ps->Fq, ry, ry, t1); // t1 = ry * ry
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, ty, t1, ry); // ry = ty * ry * ry
+ result = FfMul(ps->Fq, ty, t1, ry); // ry = ty * ry * ry
BREAK_ON_EPID_ERROR(result);
if (pi && i) {
- result = FfMul(&ps->Fq, Z, Z, t1); // t1 = Z^2
+ result = FfMul(ps->Fq, Z, Z, t1); // t1 = Z^2
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, px, t1, w); // w = px * Z^2
+ result = FfMul(ps->Fq, px, t1, w); // w = px * Z^2
BREAK_ON_EPID_ERROR(result);
- result = FfSub(&ps->Fq, w, X, w); // w = px * Z^2 - X
+ result = FfSub(ps->Fq, w, X, w); // w = px * Z^2 - X
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, t1, Z, t1); // t1 = Z^3
+ result = FfMul(ps->Fq, t1, Z, t1); // t1 = Z^3
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, py, t1, v); // v = py * Z^3
+ result = FfMul(ps->Fq, py, t1, v); // v = py * Z^3
BREAK_ON_EPID_ERROR(result);
- result = FfSub(&ps->Fq, v, Y, v); // v = py * Z^3 - Y
+ result = FfSub(ps->Fq, v, Y, v); // v = py * Z^3 - Y
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, w, w, t1); // t1 = w^2
+ result = FfMul(ps->Fq, w, w, t1); // t1 = w^2
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, w, t1, t2); // t2 = w^3
+ result = FfMul(ps->Fq, w, t1, t2); // t2 = w^3
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, X, t1, t3); // t3 = X * w^2
+ result = FfMul(ps->Fq, X, t1, t3); // t3 = X * w^2
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, v, v, X2); // X2 = v^2
+ result = FfMul(ps->Fq, v, v, X2); // X2 = v^2
BREAK_ON_EPID_ERROR(result);
- result = FfSub(&ps->Fq, X2, t2, X2); // X2 = v^2 - w^3
+ result = FfSub(ps->Fq, X2, t2, X2); // X2 = v^2 - w^3
BREAK_ON_EPID_ERROR(result);
- result = FfSub(&ps->Fq, X2, t3, X2); // X2 = v^2 - w^3 - X * w^2
+ result = FfSub(ps->Fq, X2, t3, X2); // X2 = v^2 - w^3 - X * w^2
BREAK_ON_EPID_ERROR(result);
- result = FfSub(&ps->Fq, X2, t3, X2); // X2 = v^2 - w^3 - 2 * X * w^2
+ result = FfSub(ps->Fq, X2, t3, X2); // X2 = v^2 - w^3 - 2 * X * w^2
BREAK_ON_EPID_ERROR(result);
- result = FfSub(&ps->Fq, t3, X2, Y2); // Y2 = X * w^2 - X2
+ result = FfSub(ps->Fq, t3, X2, Y2); // Y2 = X * w^2 - X2
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, Y2, v, Y2); // Y2 = v * (X * w^2 - X2)
+ result = FfMul(ps->Fq, Y2, v, Y2); // Y2 = v * (X * w^2 - X2)
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, t2, Y, t2); // t2 = Y * w^3
+ result = FfMul(ps->Fq, t2, Y, t2); // t2 = Y * w^3
BREAK_ON_EPID_ERROR(result);
result =
- FfSub(&ps->Fq, Y2, t2, Y2); // Y2 = v * (X * w^2 - X2) - Y * w^3
+ FfSub(ps->Fq, Y2, t2, Y2); // Y2 = v * (X * w^2 - X2) - Y * w^3
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, w, Z, Z2); // Z2 = w * Z
+ result = FfMul(ps->Fq, w, Z, Z2); // Z2 = w * Z
BREAK_ON_EPID_ERROR(result);
/* compute tx, ty */
sts = ippsGFpCpyElement(Z2->ipp_ff_elem, ty->ipp_ff_elem,
- ps->Fq.ipp_ff); // ty = Z2
+ ps->Fq->ipp_ff); // ty = Z2
BREAK_ON_IPP_ERROR(sts, result);
- result = Fq6FromFq(ps->ff, &ps->Fq, py, tt2);
+ result = Fq6FromFq(ps->ff, ps->Fq, py, tt2);
BREAK_ON_EPID_ERROR(result);
result = FfSub(ps->ff, pQy, tt2, tx); // tx = Qy - py
BREAK_ON_EPID_ERROR(result);
- result = Fq6FromFq(ps->ff, &ps->Fq, Z2, tt2);
+ result = Fq6FromFq(ps->ff, ps->Fq, Z2, tt2);
BREAK_ON_EPID_ERROR(result);
result = FfMul(ps->ff, tx, tt2, tx); // tx = Z2 * (Qy - py)
BREAK_ON_EPID_ERROR(result);
- result = Fq6FromFq(ps->ff, &ps->Fq, px, tt2);
+ result = Fq6FromFq(ps->ff, ps->Fq, px, tt2);
BREAK_ON_EPID_ERROR(result);
result = FfSub(ps->ff, pQx, tt2, tt1); // tt1 = Qx - px
BREAK_ON_EPID_ERROR(result);
- result = Fq6FromFq(ps->ff, &ps->Fq, v, tt2);
+ result = Fq6FromFq(ps->ff, ps->Fq, v, tt2);
BREAK_ON_EPID_ERROR(result);
result = FfMul(ps->ff, tt1, tt2, tt1); // tt1 = v * (Qx - px)
BREAK_ON_EPID_ERROR(result);
@@ -634,27 +623,27 @@ EpidStatus Epid11Pairing(Epid11PairingState* ps, EcPoint const* a,
BREAK_ON_EPID_ERROR(result);
sts = ippsGFpCpyElement(X2->ipp_ff_elem, X->ipp_ff_elem,
- ps->Fq.ipp_ff); // X = X2
+ ps->Fq->ipp_ff); // X = X2
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpCpyElement(Y2->ipp_ff_elem, Y->ipp_ff_elem,
- ps->Fq.ipp_ff); // Y = Y2
+ ps->Fq->ipp_ff); // Y = Y2
BREAK_ON_IPP_ERROR(sts, result);
sts = ippsGFpCpyElement(Z2->ipp_ff_elem, Z->ipp_ff_elem,
- ps->Fq.ipp_ff); // Z = Z2
+ ps->Fq->ipp_ff); // Z = Z2
BREAK_ON_IPP_ERROR(sts, result);
/* udpate rx, ry */
result = FfMul(ps->ff, rx, tx, rx); // rx = rx * tx
BREAK_ON_EPID_ERROR(result);
- result = FfMul(&ps->Fq, ry, ty, ry); // ry = ry * ty
+ result = FfMul(ps->Fq, ry, ty, ry); // ry = ry * ty
BREAK_ON_EPID_ERROR(result);
}
}
BREAK_ON_EPID_ERROR(result);
- result = FfInv(&ps->Fq, ry, ry); // ry = ry^-1
+ result = FfInv(ps->Fq, ry, ry); // ry = ry^-1
BREAK_ON_EPID_ERROR(result);
- result = Fq6FromFq(ps->ff, &ps->Fq, ry, tt2);
+ result = Fq6FromFq(ps->ff, ps->Fq, ry, tt2);
BREAK_ON_EPID_ERROR(result);
result = FfMul(ps->ff, rx, tt2, r); // r = rx * ry
BREAK_ON_EPID_ERROR(result);
@@ -729,9 +718,9 @@ static EpidStatus JoinFq3(Epid11PairingState* ps, FfElement const* a,
result = kEpidBadArgErr;
break;
}
- result = WriteFfElement(&ps->Fq3, a, &r_str.a[0], sizeof(r_str.a[0]));
+ result = WriteFfElement(ps->Fq3, a, &r_str.a[0], sizeof(r_str.a[0]));
BREAK_ON_EPID_ERROR(result);
- result = WriteFfElement(&ps->Fq3, b, &r_str.a[1], sizeof(r_str.a[1]));
+ result = WriteFfElement(ps->Fq3, b, &r_str.a[1], sizeof(r_str.a[1]));
BREAK_ON_EPID_ERROR(result);
result = ReadFfElement(ps->ff, &r_str, sizeof(r_str), r);
BREAK_ON_EPID_ERROR(result);
@@ -756,9 +745,9 @@ static EpidStatus SplitFq6(Epid11PairingState* ps, FfElement const* a,
}
result = WriteFfElement(ps->ff, a, &a_str, sizeof(a_str));
BREAK_ON_EPID_ERROR(result);
- result = ReadFfElement(&ps->Fq3, &a_str.a[0], sizeof(a_str.a[0]), a0);
+ result = ReadFfElement(ps->Fq3, &a_str.a[0], sizeof(a_str.a[0]), a0);
BREAK_ON_EPID_ERROR(result);
- result = ReadFfElement(&ps->Fq3, &a_str.a[1], sizeof(a_str.a[1]), a1);
+ result = ReadFfElement(ps->Fq3, &a_str.a[1], sizeof(a_str.a[1]), a1);
BREAK_ON_EPID_ERROR(result);
result = kEpidNoErr;
} while (0);
@@ -791,21 +780,21 @@ static EpidStatus FinalExp(Epid11PairingState* ps, FfElement const* r,
}
// a.Let r = (r[0], r[1]), where r[0] and r[1] are elements in Fqd,
- result = NewFfElement(&ps->Fq3, &r0);
+ result = NewFfElement(ps->Fq3, &r0);
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq3, &r1);
+ result = NewFfElement(ps->Fq3, &r1);
BREAK_ON_EPID_ERROR(result);
result = SplitFq6(ps, r, r0, r1);
BREAK_ON_EPID_ERROR(result);
// b.Compute x = transform(r[0]), where x is an element in Fqd,
- result = NewFfElement(&ps->Fq3, &x);
+ result = NewFfElement(ps->Fq3, &x);
BREAK_ON_EPID_ERROR(result);
result = Transform(ps, r0, x);
BREAK_ON_EPID_ERROR(result);
// c.Compute y = transform(r[1]), where x is an element in Fqd,
- result = NewFfElement(&ps->Fq3, &y);
+ result = NewFfElement(ps->Fq3, &y);
BREAK_ON_EPID_ERROR(result);
result = Transform(ps, r1, y);
BREAK_ON_EPID_ERROR(result);
@@ -828,17 +817,17 @@ static EpidStatus FinalExp(Epid11PairingState* ps, FfElement const* r,
BREAK_ON_EPID_ERROR(result);
// t2 = (r[0], -r[1])
- result = NewFfElement(&ps->Fq3, &neg_r1);
+ result = NewFfElement(ps->Fq3, &neg_r1);
BREAK_ON_EPID_ERROR(result);
- result = FfNeg(&ps->Fq3, r1, neg_r1);
+ result = FfNeg(ps->Fq3, r1, neg_r1);
BREAK_ON_EPID_ERROR(result);
result = JoinFq3(ps, r0, neg_r1, t2);
BREAK_ON_EPID_ERROR(result);
// t3 = (x, -y)
- result = NewFfElement(&ps->Fq3, &neg_y);
+ result = NewFfElement(ps->Fq3, &neg_y);
BREAK_ON_EPID_ERROR(result);
- result = FfNeg(&ps->Fq3, y, neg_y);
+ result = FfNeg(ps->Fq3, y, neg_y);
BREAK_ON_EPID_ERROR(result);
result = JoinFq3(ps, x, neg_y, t3);
BREAK_ON_EPID_ERROR(result);
@@ -906,23 +895,23 @@ static EpidStatus Transform(Epid11PairingState* ps, FfElement const* a,
if (!ps || !a || !b) return kEpidBadArgErr;
do {
- result = WriteFfElement(&ps->Fq3, a, &a_str, sizeof(a_str));
+ result = WriteFfElement(ps->Fq3, a, &a_str, sizeof(a_str));
BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(&ps->Fq3, &tmp);
+ result = NewFfElement(ps->Fq3, &tmp);
BREAK_ON_EPID_ERROR(result);
// b = 0
- result = ReadFfElement(&ps->Fq3, &zero, sizeof(zero), b);
+ result = ReadFfElement(ps->Fq3, &zero, sizeof(zero), b);
BREAK_ON_EPID_ERROR(result);
for (i = 0; i < 3; i++) {
// tmp = (a[0][i], 0, 0)
tmp_str.a[0] = a_str.a[i];
- result = ReadFfElement(&ps->Fq3, &tmp_str, sizeof(tmp_str), tmp);
+ result = ReadFfElement(ps->Fq3, &tmp_str, sizeof(tmp_str), tmp);
BREAK_ON_EPID_ERROR(result);
// tmp *= alpha_q[i]
- result = FfMul(&ps->Fq3, ps->alpha_q[i], tmp, tmp);
+ result = FfMul(ps->Fq3, ps->alpha_q[i], tmp, tmp);
BREAK_ON_EPID_ERROR(result);
// b += tmp
- result = FfAdd(&ps->Fq3, tmp, b, b);
+ result = FfAdd(ps->Fq3, tmp, b, b);
BREAK_ON_EPID_ERROR(result);
}
BREAK_ON_EPID_ERROR(result);
diff --git a/epid/common/math/tatepairing.h b/epid/common/math/tatepairing.h
index 3abeb74..8849c87 100644
--- a/epid/common/math/tatepairing.h
+++ b/epid/common/math/tatepairing.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -66,6 +66,9 @@ typedef struct Epid11PairingState Epid11PairingState;
\returns ::EpidStatus
+ \attention It is the responsibility of the caller to ensure that ga, gb, and
+ ff exist for the entire lifetime of the new Epid11PairingState.
+
\see DeleteEpid11PairingState
\see <a href="group___epid11_verifier_module.html#details"><b>EPID 1.1
support</b></a>
diff --git a/epid/common/math/unittests/bignum-test.cc b/epid/common/math/unittests/bignum-test.cc
index bd8c360..0c84d5e 100644
--- a/epid/common/math/unittests/bignum-test.cc
+++ b/epid/common/math/unittests/bignum-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief BigNum unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
#include "epid/common-testhelper/errors-testhelper.h"
diff --git a/epid/common/math/unittests/ecdsa_sign-test.cc b/epid/common/math/unittests/ecdsa_sign-test.cc
index a9759cb..167b65a 100644
--- a/epid/common/math/unittests/ecdsa_sign-test.cc
+++ b/epid/common/math/unittests/ecdsa_sign-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@
#include <cstring>
#include <vector>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
diff --git a/epid/common/math/unittests/ecdsa_verify-test.cc b/epid/common/math/unittests/ecdsa_verify-test.cc
index 7f28330..e7cb2bf 100644
--- a/epid/common/math/unittests/ecdsa_verify-test.cc
+++ b/epid/common/math/unittests/ecdsa_verify-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@
#include <cstdint>
#include <vector>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
diff --git a/epid/common/math/unittests/ecgroup-test.cc b/epid/common/math/unittests/ecgroup-test.cc
index b8b3aa6..665a6e7 100644
--- a/epid/common/math/unittests/ecgroup-test.cc
+++ b/epid/common/math/unittests/ecgroup-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@
#include <stdexcept>
#include <vector>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
@@ -163,6 +164,7 @@ class EcGroupTest : public ::testing::Test {
static const G1ElemStr efq_r_sha256_str;
static const G1ElemStr efq_r_sha384_str;
static const G1ElemStr efq_r_sha512_str;
+ static const G1ElemStr efq_r_sha512256_str;
static const uint8_t sha_msg[];
static const G2ElemStr efq2_a_str;
@@ -399,6 +401,14 @@ const G1ElemStr EcGroupTest::efq_r_sha512_str = {
0xE0, 0x2B, 0x87, 0xF7, 0x69, 0x54, 0x0C, 0xC6, 0xAD, 0xF2, 0xF2, 0x7B,
0xE6, 0x91, 0xD8, 0xF3, 0x40, 0x6C, 0x8F, 0x03}}}};
+const G1ElemStr EcGroupTest::efq_r_sha512256_str = {
+ {{{0x63, 0x28, 0x40, 0x14, 0x73, 0xd5, 0x91, 0xc4, 0xa2, 0xa4, 0xb6, 0xd8,
+ 0xa8, 0x75, 0x21, 0xd1, 0x26, 0x4e, 0x42, 0x13, 0x1f, 0xfa, 0xed, 0x90,
+ 0x8d, 0x56, 0x34, 0x57, 0x8a, 0x3a, 0x47, 0xa0}}},
+ {{{0x30, 0xbe, 0x3f, 0x12, 0x00, 0x74, 0x48, 0xaa, 0x91, 0x90, 0x84, 0x12,
+ 0x4d, 0x58, 0x54, 0xe7, 0x04, 0x65, 0x37, 0x97, 0x88, 0xcf, 0x67, 0xa0,
+ 0x8c, 0x56, 0x93, 0xa7, 0x7f, 0xe8, 0x74, 0xfc}}}};
+
const G2ElemStr EcGroupTest::efq2_a_str = {
{
{0x2F, 0x8C, 0xC7, 0xD7, 0xD4, 0x1E, 0x4A, 0xCB, 0x82, 0x92, 0xC7, 0x9C,
@@ -941,11 +951,6 @@ TEST_F(EcGroupTest, ExpResultIsCorrect) {
WriteEcPoint(this->efq, this->efq_r, &efq_r_str, sizeof(efq_r_str)));
EXPECT_EQ(this->efq_exp_ax_str, efq_r_str);
}
-TEST_F(EcGroupTest, ExpFailsGivenOutOfRangeExponent) {
- // The exponent should be less than elliptic curve group order
- EXPECT_EQ(kEpidBadArgErr,
- EcExp(this->efq, this->efq_a, &this->p, this->efq_r));
-}
TEST_F(EcGroupTest, ExpSucceedsGivenG2ZeroExponent) {
G2ElemStr efq2_r_str;
BigNumStr zero_bn_str = {0};
@@ -1002,11 +1007,6 @@ TEST_F(EcGroupTest, SscmExpResultIsCorrect) {
WriteEcPoint(this->efq, this->efq_r, &efq_r_str, sizeof(efq_r_str)));
EXPECT_EQ(this->efq_exp_ax_str, efq_r_str);
}
-TEST_F(EcGroupTest, SscmExpFailsGivenOutOfRangeExponent) {
- // The exponent should be less than elliptic curve group order
- EXPECT_EQ(kEpidBadArgErr,
- EcSscmExp(this->efq, this->efq_a, &this->p, this->efq_r));
-}
TEST_F(EcGroupTest, SscmExpSucceedsGivenG2ZeroExponent) {
G2ElemStr efq2_r_str;
BigNumStr zero_bn_str = {0};
@@ -1072,42 +1072,6 @@ TEST_F(EcGroupTest, MultiExpFailsGivenNullPointer) {
EXPECT_EQ(kEpidBadArgErr,
EcMultiExp(this->efq, pts, b_withnull, m, this->efq_r));
}
-TEST_F(EcGroupTest, MultiExpFailsGivenIncorrectMLen) {
- EcPoint const* pts[] = {this->efq_a, this->efq_b};
- const BigNumStr bnm0 = {{0x11, 0xFF, 0xFF, 0xFF, 0x4F, 0x59, 0xB1, 0xD3, 0x6B,
- 0x08, 0xFF, 0xFF, 0x0B, 0xF3, 0xAF, 0x27, 0xFF, 0xB8,
- 0xFF, 0xFF, 0x98, 0xFF, 0xEB, 0xFF, 0xF2, 0x6A, 0xFF,
- 0xFF, 0xEA, 0x31, 0xFF, 0xFF}};
- const BigNumStr bnm1 = {{0xE2, 0xFF, 0x03, 0x1D, 0xFF, 0x19, 0x81, 0xCB, 0xFF,
- 0xFF, 0x6B, 0xD5, 0x3E, 0xFF, 0xFF, 0xFF, 0xFF, 0xBD,
- 0xFF, 0x5A, 0xFF, 0x5C, 0x7C, 0xFF, 0x84, 0xFF, 0xFF,
- 0x8C, 0x03, 0xB2, 0x26, 0xFF}};
- BigNumStr const* b[] = {&bnm0, &bnm1};
- EXPECT_EQ(kEpidBadArgErr, EcMultiExp(this->efq, pts, b, 0, this->efq_r));
- EXPECT_EQ(kEpidBadArgErr,
- EcMultiExp(this->efq, pts, b, std::numeric_limits<size_t>::max(),
- this->efq_r));
- EXPECT_EQ(kEpidBadArgErr,
- EcMultiExp(this->efq, pts, b, (size_t)INT_MAX + 1, this->efq_r));
-}
-TEST_F(EcGroupTest, MultiExpFailsGivenOutOfRangeExponent) {
- EcPoint const* pts[] = {this->efq_a};
- BigNumStr const* b_1[] = {&this->p};
- // The exponent should be less than elliptic curve group order
- EXPECT_EQ(kEpidBadArgErr, EcMultiExp(this->efq, pts, b_1, 1, this->efq_r));
-}
-TEST_F(EcGroupTest, MultiExpFailsGivenOutOfRangeExponents) {
- EcPoint const* pts[] = {this->efq_a, this->efq_b};
- const BigNumStr bnm_1 = {{0x11, 0xFF, 0xFF, 0xFF, 0x4F, 0x59, 0xB1, 0xD3,
- 0x6B, 0x08, 0xFF, 0xFF, 0x0B, 0xF3, 0xAF, 0x27,
- 0xFF, 0xB8, 0xFF, 0xFF, 0x98, 0xFF, 0xEB, 0xFF,
- 0xF2, 0x6A, 0xFF, 0xFF, 0xEA, 0x31, 0xFF, 0xFF}};
- BigNumStr const* b_1[] = {&bnm_1, &this->p};
- BigNumStr const* b_2[] = {&this->p, &bnm_1};
- // The exponent should be less than elliptic curve group order
- EXPECT_EQ(kEpidBadArgErr, EcMultiExp(this->efq, pts, b_1, 2, this->efq_r));
- EXPECT_EQ(kEpidBadArgErr, EcMultiExp(this->efq, pts, b_2, 2, this->efq_r));
-}
TEST_F(EcGroupTest, MultiExpWorksGivenOneZeroExponent) {
G1ElemStr efq_r_str;
BigNumStr zero_bn_str = {0};
@@ -1218,6 +1182,21 @@ TEST_F(EcGroupTest, MultiExpWorksGivenTwoG2Exponents) {
WriteEcPoint(this->efq2, this->efq2_r, &efq2_r_str, sizeof(efq2_r_str)));
EXPECT_EQ(this->efq2_multiexp_abxy_str, efq2_r_str);
}
+TEST_F(EcGroupTest, MultiExpWorksTwiceGivenSameOutputBuf) {
+ G2ElemStr efq2_r_str;
+ EcPoint const* pts[] = {this->efq2_a, this->efq2_b};
+ BigNumStr const* b[] = {&this->x_str, &this->y_str};
+ size_t m = 2;
+ EcPointObj temp(&this->efq2);
+ G2ElemStr temp_str;
+ EXPECT_EQ(kEpidNoErr, EcMultiExp(this->efq2, pts, b, m, this->efq2_r));
+ temp = this->efq2_r;
+ EXPECT_EQ(kEpidNoErr, EcMultiExp(this->efq2, pts, b, m, this->efq2_r));
+ THROW_ON_EPIDERR(
+ WriteEcPoint(this->efq2, this->efq2_r, &efq2_r_str, sizeof(efq2_r_str)));
+ THROW_ON_EPIDERR(WriteEcPoint(this->efq2, temp, &temp_str, sizeof(temp_str)));
+ EXPECT_EQ(temp_str, efq2_r_str);
+}
///////////////////////////////////////////////////////////////////////
// EcMultiExpBn
TEST_F(EcGroupTest, MultiExpBnFailsGivenArgumentsMismatch) {
@@ -1272,42 +1251,6 @@ TEST_F(EcGroupTest, MultiExpBnFailsGivenNullPointer) {
EXPECT_EQ(kEpidBadArgErr,
EcMultiExpBn(this->efq, pts, b_withnull, m, this->efq_r));
}
-TEST_F(EcGroupTest, MultiExpBnFailsGivenIncorrectMLen) {
- EcPoint const* pts[] = {this->efq_a, this->efq_b};
- const BigNumStr bnm0 = {{0x11, 0xFF, 0xFF, 0xFF, 0x4F, 0x59, 0xB1, 0xD3, 0x6B,
- 0x08, 0xFF, 0xFF, 0x0B, 0xF3, 0xAF, 0x27, 0xFF, 0xB8,
- 0xFF, 0xFF, 0x98, 0xFF, 0xEB, 0xFF, 0xF2, 0x6A, 0xFF,
- 0xFF, 0xEA, 0x31, 0xFF, 0xFF}};
- const BigNumStr bnm1 = {{0xE2, 0xFF, 0x03, 0x1D, 0xFF, 0x19, 0x81, 0xCB, 0xFF,
- 0xFF, 0x6B, 0xD5, 0x3E, 0xFF, 0xFF, 0xFF, 0xFF, 0xBD,
- 0xFF, 0x5A, 0xFF, 0x5C, 0x7C, 0xFF, 0x84, 0xFF, 0xFF,
- 0x8C, 0x03, 0xB2, 0x26, 0xFF}};
- BigNumObj bno0(bnm0);
- BigNumObj bno1(bnm1);
- BigNum const* b[] = {bno0, bno1};
- EXPECT_EQ(kEpidBadArgErr, EcMultiExpBn(this->efq, pts, b, 0, this->efq_r));
- EXPECT_EQ(kEpidBadArgErr,
- EcMultiExpBn(this->efq, pts, b, std::numeric_limits<size_t>::max(),
- this->efq_r));
- EXPECT_EQ(kEpidBadArgErr,
- EcMultiExpBn(this->efq, pts, b, (size_t)INT_MAX + 1, this->efq_r));
-}
-TEST_F(EcGroupTest, MultiExpBnFailsGivenOutOfRangeExponent) {
- EcPoint const* pt[] = {this->efq_a};
- BigNumObj bno_p(this->p);
- BigNum const* b[] = {bno_p};
- EcPoint const* pts[] = {this->efq_a, this->efq_b};
- const BigNumStr bnm_1 = {{0x11, 0xFF, 0xFF, 0xFF, 0x4F, 0x59, 0xB1, 0xD3,
- 0x6B, 0x08, 0xFF, 0xFF, 0x0B, 0xF3, 0xAF, 0x27,
- 0xFF, 0xB8, 0xFF, 0xFF, 0x98, 0xFF, 0xEB, 0xFF,
- 0xF2, 0x6A, 0xFF, 0xFF, 0xEA, 0x31, 0xFF, 0xFF}};
- BigNumObj bno_1(bnm_1);
- BigNum const* b_1[] = {bno_1, bno_p};
- BigNum const* b_2[] = {bno_p, bno_1};
- EXPECT_EQ(kEpidBadArgErr, EcMultiExpBn(this->efq, pt, b, 1, this->efq_r));
- EXPECT_EQ(kEpidBadArgErr, EcMultiExpBn(this->efq, pts, b_1, 2, this->efq_r));
- EXPECT_EQ(kEpidBadArgErr, EcMultiExpBn(this->efq, pts, b_2, 2, this->efq_r));
-}
TEST_F(EcGroupTest, MultiExpBnWorksGivenOneZeroExponent) {
G1ElemStr efq_r_str;
BigNumStr zero_bn_str = {0};
@@ -1442,6 +1385,23 @@ TEST_F(EcGroupTest, MultiExpBnWorksGivenTwoG2Exponents) {
WriteEcPoint(this->efq2, this->efq2_r, &efq2_r_str, sizeof(efq2_r_str)));
EXPECT_EQ(this->efq2_multiexp_abxy_str, efq2_r_str);
}
+TEST_F(EcGroupTest, MultiExpBnWorksTwiceGivenSameOutputBuf) {
+ G2ElemStr efq2_r_str;
+ EcPoint const* pts[] = {this->efq2_a, this->efq2_b};
+ BigNumObj bno_x(this->x_str);
+ BigNumObj bno_y(this->y_str);
+ BigNum const* b[] = {bno_x, bno_y};
+ size_t m = 2;
+ EcPointObj temp(&this->efq2);
+ G2ElemStr temp_str;
+ EXPECT_EQ(kEpidNoErr, EcMultiExpBn(this->efq2, pts, b, m, this->efq2_r));
+ temp = this->efq2_r;
+ EXPECT_EQ(kEpidNoErr, EcMultiExpBn(this->efq2, pts, b, m, this->efq2_r));
+ THROW_ON_EPIDERR(
+ WriteEcPoint(this->efq2, this->efq2_r, &efq2_r_str, sizeof(efq2_r_str)));
+ THROW_ON_EPIDERR(WriteEcPoint(this->efq2, temp, &temp_str, sizeof(temp_str)));
+ EXPECT_EQ(temp_str, efq2_r_str);
+}
TEST_F(EcGroupTest, MultiExpBnWorksGivenTwoDifferentSizeG3Exponents) {
const G1ElemStr g3_b_str = {
{{{
@@ -1556,45 +1516,6 @@ TEST_F(EcGroupTest, SscmMultiExpFailsGivenNullPointer) {
EXPECT_EQ(kEpidBadArgErr,
EcSscmMultiExp(this->efq, pts, b_withnull, m, this->efq_r));
}
-TEST_F(EcGroupTest, SscmMultiExpFailsGivenIncorrectMLen) {
- EcPoint const* pts[] = {this->efq_a, this->efq_b};
- const BigNumStr bnm0 = {{0x11, 0xFF, 0xFF, 0xFF, 0x4F, 0x59, 0xB1, 0xD3, 0x6B,
- 0x08, 0xFF, 0xFF, 0x0B, 0xF3, 0xAF, 0x27, 0xFF, 0xB8,
- 0xFF, 0xFF, 0x98, 0xFF, 0xEB, 0xFF, 0xF2, 0x6A, 0xFF,
- 0xFF, 0xEA, 0x31, 0xFF, 0xFF}};
- const BigNumStr bnm1 = {{0xE2, 0xFF, 0x03, 0x1D, 0xFF, 0x19, 0x81, 0xCB, 0xFF,
- 0xFF, 0x6B, 0xD5, 0x3E, 0xFF, 0xFF, 0xFF, 0xFF, 0xBD,
- 0xFF, 0x5A, 0xFF, 0x5C, 0x7C, 0xFF, 0x84, 0xFF, 0xFF,
- 0x8C, 0x03, 0xB2, 0x26, 0xFF}};
- BigNumStr const* b[] = {&bnm0, &bnm1};
- EXPECT_EQ(kEpidBadArgErr, EcSscmMultiExp(this->efq, pts, b, 0, this->efq_r));
- EXPECT_EQ(kEpidBadArgErr,
- EcSscmMultiExp(this->efq, pts, b,
- std::numeric_limits<size_t>::max(), this->efq_r));
- EXPECT_EQ(kEpidBadArgErr, EcSscmMultiExp(this->efq, pts, b,
- (size_t)INT_MAX + 1, this->efq_r));
-}
-TEST_F(EcGroupTest, SscmMultiExpFailsGivenOutOfRangeExponent) {
- EcPoint const* pts[] = {this->efq_a};
- BigNumStr const* b_1[] = {&this->p};
- // The exponent should be less than elliptic curve group order
- EXPECT_EQ(kEpidBadArgErr,
- EcSscmMultiExp(this->efq, pts, b_1, 1, this->efq_r));
-}
-TEST_F(EcGroupTest, SscmMultiExpFailsGivenOutOfRangeExponents) {
- EcPoint const* pts[] = {this->efq_a, this->efq_b};
- const BigNumStr bnm_1 = {{0x11, 0xFF, 0xFF, 0xFF, 0x4F, 0x59, 0xB1, 0xD3,
- 0x6B, 0x08, 0xFF, 0xFF, 0x0B, 0xF3, 0xAF, 0x27,
- 0xFF, 0xB8, 0xFF, 0xFF, 0x98, 0xFF, 0xEB, 0xFF,
- 0xF2, 0x6A, 0xFF, 0xFF, 0xEA, 0x31, 0xFF, 0xFF}};
- BigNumStr const* b_1[] = {&bnm_1, &this->p};
- BigNumStr const* b_2[] = {&this->p, &bnm_1};
- // The exponent should be less than elliptic curve group order
- EXPECT_EQ(kEpidBadArgErr,
- EcSscmMultiExp(this->efq, pts, b_1, 2, this->efq_r));
- EXPECT_EQ(kEpidBadArgErr,
- EcSscmMultiExp(this->efq, pts, b_2, 2, this->efq_r));
-}
TEST_F(EcGroupTest, SscmMultiExpWorksGivenOneZeroExponent) {
G1ElemStr efq_r_str;
BigNumStr zero_bn_str = {0};
@@ -1705,6 +1626,21 @@ TEST_F(EcGroupTest, SscmMultiExpWorksGivenTwoG2Exponents) {
WriteEcPoint(this->efq2, this->efq2_r, &efq2_r_str, sizeof(efq2_r_str)));
EXPECT_EQ(this->efq2_multiexp_abxy_str, efq2_r_str);
}
+TEST_F(EcGroupTest, SscmMultiExpWorksTwiceGivenSameOutputBuf) {
+ G2ElemStr efq2_r_str;
+ EcPoint const* pts[] = {this->efq2_a, this->efq2_b};
+ BigNumStr const* b[] = {&this->x_str, &this->y_str};
+ size_t m = 2;
+ EcPointObj temp(&this->efq2);
+ G2ElemStr temp_str;
+ EXPECT_EQ(kEpidNoErr, EcSscmMultiExp(this->efq2, pts, b, m, this->efq2_r));
+ temp = this->efq2_r;
+ EXPECT_EQ(kEpidNoErr, EcSscmMultiExp(this->efq2, pts, b, m, this->efq2_r));
+ THROW_ON_EPIDERR(
+ WriteEcPoint(this->efq2, this->efq2_r, &efq2_r_str, sizeof(efq2_r_str)));
+ THROW_ON_EPIDERR(WriteEcPoint(this->efq2, temp, &temp_str, sizeof(temp_str)));
+ EXPECT_EQ(temp_str, efq2_r_str);
+}
///////////////////////////////////////////////////////////////////////
// EcGetRandom
TEST_F(EcGroupTest, GetRandomFailsGivenArgumentsMismatch) {
@@ -1816,8 +1752,6 @@ TEST_F(EcGroupTest, HashFailsGivenNullPointer) {
TEST_F(EcGroupTest, HashFailsGivenUnsupportedHashAlg) {
uint8_t const msg[] = {0};
EXPECT_EQ(kEpidHashAlgorithmNotSupported,
- EcHash(this->efq, msg, sizeof(msg), kSha512_256, this->efq_r));
- EXPECT_EQ(kEpidHashAlgorithmNotSupported,
EcHash(this->efq, msg, sizeof(msg), kSha3_256, this->efq_r));
EXPECT_EQ(kEpidHashAlgorithmNotSupported,
EcHash(this->efq, msg, sizeof(msg), kSha3_384, this->efq_r));
@@ -1865,6 +1799,14 @@ TEST_F(EcGroupTest, HashWorksGivenSHA512HashAlg) {
WriteEcPoint(this->efq, this->efq_r, &efq_r_str, sizeof(efq_r_str)));
EXPECT_EQ(this->efq_r_sha512_str, efq_r_str);
}
+TEST_F(EcGroupTest, HashWorksGivenSHA512256HashAlg) {
+ G1ElemStr efq_r_str;
+ EXPECT_EQ(kEpidNoErr, EcHash(this->efq, sha_msg, sizeof(sha_msg), kSha512_256,
+ this->efq_r));
+ THROW_ON_EPIDERR(
+ WriteEcPoint(this->efq, this->efq_r, &efq_r_str, sizeof(efq_r_str)));
+ EXPECT_EQ(this->efq_r_sha512256_str, efq_r_str);
+}
///////////////////////////////////////////////////////////////////////
// 1.1 EcHash
TEST_F(EcGroupTest, Epid11HashFailsGivenMismatchedArguments) {
diff --git a/epid/common/math/unittests/ffelement-test.cc b/epid/common/math/unittests/ffelement-test.cc
index 9a9c5d1..2f6a910 100644
--- a/epid/common/math/unittests/ffelement-test.cc
+++ b/epid/common/math/unittests/ffelement-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@
#include <limits>
#include <algorithm>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
#include "epid/common-testhelper/errors-testhelper.h"
@@ -286,6 +287,7 @@ class FfElementTest : public ::testing::Test {
static const FqElemStr fq_abc_sha256_str;
static const FqElemStr fq_abc_sha384_str;
static const FqElemStr fq_abc_sha512_str;
+ static const FqElemStr fq_abc_sha512256_str;
// arbitrary Fq12 constant a (unrelated to a above)
static const Fq12ElemStr fq12_g_str;
@@ -651,6 +653,13 @@ const FqElemStr FfElementTest::fq_abc_sha512_str = {
0x50, 0xD1, 0x3B, 0xF2, 0x35, 0xF7, 0x97, 0x91, 0x05, 0x3D, 0x64,
0xC0, 0x06, 0x45, 0x9F, 0xEC, 0xD8, 0xDB, 0x53, 0x3E, 0xC3,
};
+
+const FqElemStr FfElementTest::fq_abc_sha512256_str = {
+ 0x53, 0x04, 0x8E, 0x26, 0x81, 0x94, 0x1E, 0xF9, 0x9B, 0x2E, 0x29,
+ 0xB7, 0x6B, 0x4C, 0x7D, 0xAB, 0xE4, 0xC2, 0xD0, 0xC6, 0x34, 0xFC,
+ 0x6D, 0x46, 0xE0, 0xE2, 0xF1, 0x31, 0x07, 0xE7, 0xAF, 0x23,
+};
+
const Fq12ElemStr FfElementTest::fq12_g_str = {
{{{{{{0xBA, 0x10, 0x1F, 0xF6, 0x46, 0x8B, 0xE9, 0x32, 0x4F, 0xC0, 0xA5,
0x01, 0xAD, 0x5E, 0xE2, 0x31, 0x16, 0x29, 0x96, 0xED, 0xA7, 0xDE,
@@ -1468,11 +1477,10 @@ TEST_F(FfElementTest, ReadFailsGivenNullPointer) {
}
TEST_F(FfElementTest, ReadFailsGivenInvalidBufferSize) {
- FqElemStr ff_elem_str;
EXPECT_EQ(kEpidBadArgErr,
- ReadFfElement(this->fq, &ff_elem_str, 0, this->fq_a));
+ ReadFfElement(this->fq, &this->fq_qm1_str, 0, this->fq_a));
EXPECT_EQ(kEpidBadArgErr,
- ReadFfElement(this->fq, &ff_elem_str,
+ ReadFfElement(this->fq, &this->fq_qm1_str,
std::numeric_limits<size_t>::max(), this->fq_a));
}
@@ -2135,8 +2143,6 @@ TEST_F(FfElementTest, FfHashFailsGivenNullPointer) {
TEST_F(FfElementTest, FfHashFailsGivenUnsupportedHashAlg) {
uint8_t const msg[] = {0};
EXPECT_EQ(kEpidHashAlgorithmNotSupported,
- FfHash(this->fq, msg, sizeof(msg), kSha512_256, this->fq_result));
- EXPECT_EQ(kEpidHashAlgorithmNotSupported,
FfHash(this->fq, msg, sizeof(msg), kSha3_256, this->fq_result));
EXPECT_EQ(kEpidHashAlgorithmNotSupported,
FfHash(this->fq, msg, sizeof(msg), kSha3_384, this->fq_result));
@@ -2184,7 +2190,15 @@ TEST_F(FfElementTest, FfHashWorksGivenSHA512HashAlg) {
EXPECT_EQ(this->fq_abc_sha512_str, fq_r_str)
<< "FfHash: Hash element does not match to reference value";
}
-
+TEST_F(FfElementTest, FfHashWorksGivenSHA512256HashAlg) {
+ FqElemStr fq_r_str;
+ EXPECT_EQ(kEpidNoErr, FfHash(this->fq, sha_msg, sizeof(sha_msg), kSha512_256,
+ this->fq_result));
+ THROW_ON_EPIDERR(
+ WriteFfElement(this->fq, this->fq_result, &fq_r_str, sizeof(fq_r_str)));
+ EXPECT_EQ(this->fq_abc_sha512256_str, fq_r_str)
+ << "FfHash: Hash element does not match to reference value";
+}
////////////////////////////////////////////////
// FfMultiExp
diff --git a/epid/common/math/unittests/finitefield-test.cc b/epid/common/math/unittests/finitefield-test.cc
index badce2c..b6dcbb8 100644
--- a/epid/common/math/unittests/finitefield-test.cc
+++ b/epid/common/math/unittests/finitefield-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief FiniteField unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
#include "epid/common-testhelper/errors-testhelper.h"
diff --git a/epid/common/math/unittests/hash-test.cc b/epid/common/math/unittests/hash-test.cc
index eea7d08..69127f9 100644
--- a/epid/common/math/unittests/hash-test.cc
+++ b/epid/common/math/unittests/hash-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
#include <cstring>
#include <limits>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
#include "epid/common-testhelper/errors-testhelper.h"
diff --git a/epid/common/math/unittests/main-test.cc b/epid/common/math/unittests/main-test.cc
index 70f2d3a..a8bb2fa 100644
--- a/epid/common/math/unittests/main-test.cc
+++ b/epid/common/math/unittests/main-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
* \brief Main entry point for unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
int main(int argc, char** argv) {
diff --git a/epid/common/math/unittests/octstrconvert-test.cc b/epid/common/math/unittests/octstrconvert-test.cc
index 2ad606b..0794f9e 100644
--- a/epid/common/math/unittests/octstrconvert-test.cc
+++ b/epid/common/math/unittests/octstrconvert-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@
*/
#include "epid/common/stdtypes.h"
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
diff --git a/epid/common/math/unittests/pairing-test.cc b/epid/common/math/unittests/pairing-test.cc
index a688307..04783a2 100644
--- a/epid/common/math/unittests/pairing-test.cc
+++ b/epid/common/math/unittests/pairing-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
#include <cstring>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
#include "epid/common-testhelper/errors-testhelper.h"
@@ -47,6 +48,8 @@ namespace {
class PairingTest : public Epid20Params, public ::testing::Test {
public:
static const BigNumStr t_str;
+ static const G1ElemStr ga_elem_str;
+ static const G2ElemStr gb_elem_str;
virtual void SetUp() { params = new Epid20Params(); }
virtual void TearDown() { delete params; }
@@ -59,6 +62,27 @@ const BigNumStr PairingTest::t_str = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x68, 0x82, 0xF5, 0xC0, 0x30, 0xB0, 0xA8, 0x01};
+const G1ElemStr PairingTest::ga_elem_str = {
+ 0xd7, 0xe2, 0xf9, 0x37, 0x21, 0x0f, 0x09, 0x97, 0x0f, 0xca, 0xa6,
+ 0x03, 0x7d, 0x91, 0xc3, 0x75, 0x8a, 0xc9, 0x44, 0x11, 0xfc, 0xaa,
+ 0x55, 0x67, 0xba, 0xce, 0xaf, 0x8d, 0xf6, 0x7c, 0x84, 0x83, 0x04,
+ 0xb7, 0xa6, 0xff, 0x9f, 0x0d, 0x26, 0x73, 0xaf, 0x6c, 0xd0, 0x0a,
+ 0xf6, 0x13, 0xc9, 0x44, 0x3f, 0xf0, 0x82, 0x58, 0x48, 0x59, 0x03,
+ 0x3f, 0x88, 0xe2, 0x46, 0xd6, 0x0f, 0x93, 0x42, 0x4b,
+};
+const G2ElemStr PairingTest::gb_elem_str = {
+ 0x3f, 0x4c, 0xb5, 0x2d, 0xbc, 0x72, 0xb0, 0x9c, 0x6f, 0xb2, 0xb5, 0xc1,
+ 0xdc, 0xfb, 0xda, 0x35, 0x91, 0xa6, 0x8d, 0x51, 0x37, 0x70, 0xe2, 0x17,
+ 0xad, 0x53, 0x23, 0xdc, 0xa3, 0xc3, 0xfd, 0x4c, 0x90, 0xfa, 0x4f, 0xa2,
+ 0xcb, 0x35, 0xf3, 0x50, 0x5e, 0x8e, 0xf4, 0xce, 0x7f, 0xb0, 0x8a, 0x69,
+ 0x49, 0xdf, 0xf5, 0x4f, 0xb0, 0xc1, 0xd7, 0xf9, 0xb8, 0xfb, 0x89, 0xd1,
+ 0xb6, 0xf8, 0x74, 0x04, 0xef, 0xc6, 0x60, 0x05, 0x62, 0xf3, 0x17, 0x5a,
+ 0x80, 0xf4, 0x4b, 0x97, 0x08, 0x3e, 0x43, 0xa1, 0x44, 0x4c, 0x54, 0x86,
+ 0x16, 0x20, 0xb9, 0xcc, 0xfb, 0xbd, 0x00, 0x5f, 0xc8, 0x01, 0xfb, 0x5b,
+ 0xc1, 0x6e, 0x2b, 0x46, 0xe2, 0x04, 0x70, 0xeb, 0xa2, 0xaa, 0x86, 0x5a,
+ 0x35, 0x14, 0x0e, 0xc9, 0xdf, 0xba, 0x9b, 0x6f, 0x3a, 0xca, 0x94, 0x9c,
+ 0x44, 0x89, 0x94, 0xa3, 0xeb, 0x61, 0x8b, 0x01,
+};
///////////////////////////////////////////////////////////////////////
// NewPairingState / DeletePairingState
@@ -184,42 +208,67 @@ TEST_F(PairingTest, PairingWorksFromG1AndG2ToGt) {
0x16, 0xfd, 0x0b, 0xfe, 0x42, 0x1e, 0x17, 0x37, 0x2a, 0x04, 0xea, 0x26,
0xba, 0x6e, 0x2c, 0x36, 0xaf, 0x35, 0x1b, 0x75, 0x6d, 0x17, 0xdc, 0x8e,
};
- G1ElemStr ga_elem_str = {
- 0xd7, 0xe2, 0xf9, 0x37, 0x21, 0x0f, 0x09, 0x97, 0x0f, 0xca, 0xa6,
- 0x03, 0x7d, 0x91, 0xc3, 0x75, 0x8a, 0xc9, 0x44, 0x11, 0xfc, 0xaa,
- 0x55, 0x67, 0xba, 0xce, 0xaf, 0x8d, 0xf6, 0x7c, 0x84, 0x83, 0x04,
- 0xb7, 0xa6, 0xff, 0x9f, 0x0d, 0x26, 0x73, 0xaf, 0x6c, 0xd0, 0x0a,
- 0xf6, 0x13, 0xc9, 0x44, 0x3f, 0xf0, 0x82, 0x58, 0x48, 0x59, 0x03,
- 0x3f, 0x88, 0xe2, 0x46, 0xd6, 0x0f, 0x93, 0x42, 0x4b,
- };
- G2ElemStr gb_elem_str = {
- 0x3f, 0x4c, 0xb5, 0x2d, 0xbc, 0x72, 0xb0, 0x9c, 0x6f, 0xb2, 0xb5, 0xc1,
- 0xdc, 0xfb, 0xda, 0x35, 0x91, 0xa6, 0x8d, 0x51, 0x37, 0x70, 0xe2, 0x17,
- 0xad, 0x53, 0x23, 0xdc, 0xa3, 0xc3, 0xfd, 0x4c, 0x90, 0xfa, 0x4f, 0xa2,
- 0xcb, 0x35, 0xf3, 0x50, 0x5e, 0x8e, 0xf4, 0xce, 0x7f, 0xb0, 0x8a, 0x69,
- 0x49, 0xdf, 0xf5, 0x4f, 0xb0, 0xc1, 0xd7, 0xf9, 0xb8, 0xfb, 0x89, 0xd1,
- 0xb6, 0xf8, 0x74, 0x04, 0xef, 0xc6, 0x60, 0x05, 0x62, 0xf3, 0x17, 0x5a,
- 0x80, 0xf4, 0x4b, 0x97, 0x08, 0x3e, 0x43, 0xa1, 0x44, 0x4c, 0x54, 0x86,
- 0x16, 0x20, 0xb9, 0xcc, 0xfb, 0xbd, 0x00, 0x5f, 0xc8, 0x01, 0xfb, 0x5b,
- 0xc1, 0x6e, 0x2b, 0x46, 0xe2, 0x04, 0x70, 0xeb, 0xa2, 0xaa, 0x86, 0x5a,
- 0x35, 0x14, 0x0e, 0xc9, 0xdf, 0xba, 0x9b, 0x6f, 0x3a, 0xca, 0x94, 0x9c,
- 0x44, 0x89, 0x94, 0xa3, 0xeb, 0x61, 0x8b, 0x01,
- };
GtElemStr r_str = {0};
FfElementObj r(&this->params->GT);
- EcPointObj ga_elem(&this->params->G1, ga_elem_str);
- EcPointObj gb_elem(&this->params->G2, gb_elem_str);
+ EcPointObj ga_elem(&this->params->G1, this->ga_elem_str);
+ EcPointObj gb_elem(&this->params->G2, this->gb_elem_str);
PairingState* ps = nullptr;
THROW_ON_EPIDERR(NewPairingState(this->params->G1, this->params->G2,
this->params->GT, &this->t_str, neg, &ps));
- EXPECT_EQ(kEpidNoErr, Pairing(ps, r, ga_elem, gb_elem));
+ EXPECT_EQ(kEpidNoErr, Pairing(ps, ga_elem, gb_elem, r));
DeletePairingState(&ps);
THROW_ON_EPIDERR(WriteFfElement(this->params->GT, r, &r_str, sizeof(r_str)));
EXPECT_EQ(r_expected_str, r_str);
}
+// test that pairing fails if any options are NULL
+TEST_F(PairingTest, PairingFailsGivenNullParameters) {
+ const bool neg = true;
+
+ FfElementObj r(&this->params->GT);
+ EcPointObj ga_elem(&this->params->G1, this->ga_elem_str);
+ EcPointObj gb_elem(&this->params->G2, this->gb_elem_str);
+
+ PairingState* ps = nullptr;
+ THROW_ON_EPIDERR(NewPairingState(this->params->G1, this->params->G2,
+ this->params->GT, &this->t_str, neg, &ps));
+ EXPECT_EQ(kEpidBadArgErr, Pairing(NULL, ga_elem, gb_elem, r));
+ EXPECT_EQ(kEpidBadArgErr, Pairing(ps, NULL, gb_elem, r));
+ EXPECT_EQ(kEpidBadArgErr, Pairing(ps, ga_elem, NULL, r));
+ EXPECT_EQ(kEpidBadArgErr, Pairing(ps, ga_elem, gb_elem, NULL));
+ DeletePairingState(&ps);
+}
+// test that pairing checks that the first parameter of the pairing is in a
+// EcGroup, that was used to create pairing state.
+TEST_F(PairingTest, PairingFailsGivenInvalidGaElem) {
+ const bool neg = true;
+
+ FfElementObj r(&this->params->GT);
+ // put G2 element instead of G1
+ EcPointObj mismatched_ga_elem(&this->params->G2, this->gb_elem_str);
+ EcPointObj gb_elem(&this->params->G2, this->gb_elem_str);
+ PairingState* ps = nullptr;
+ THROW_ON_EPIDERR(NewPairingState(this->params->G1, this->params->G2,
+ this->params->GT, &this->t_str, neg, &ps));
+ EXPECT_EQ(kEpidBadArgErr, Pairing(ps, mismatched_ga_elem, gb_elem, r));
+ DeletePairingState(&ps);
+}
+// test that pairing checks that the second parameter of the pairing is in a
+// EcGroup, that was used to create pairing state.
+TEST_F(PairingTest, PairingFailsGivenInvalidGbElem) {
+ const bool neg = true;
+ FfElementObj r(&this->params->GT);
+ EcPointObj ga_elem(&this->params->G1, this->ga_elem_str);
+ // put G1 element instead of G2
+ EcPointObj mismatched_gb_elem(&this->params->G1, this->ga_elem_str);
+ PairingState* ps = nullptr;
+ THROW_ON_EPIDERR(NewPairingState(this->params->G1, this->params->G2,
+ this->params->GT, &this->t_str, neg, &ps));
+ EXPECT_EQ(kEpidBadArgErr, Pairing(ps, ga_elem, mismatched_gb_elem, r));
+ DeletePairingState(&ps);
+}
} // namespace
diff --git a/epid/common/math/unittests/printutils-test.cc b/epid/common/math/unittests/printutils-test.cc
index 14e4c82..f3c3fde 100644
--- a/epid/common/math/unittests/printutils-test.cc
+++ b/epid/common/math/unittests/printutils-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@
#include <cstring>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
diff --git a/epid/common/math/unittests/tatepairing-test.cc b/epid/common/math/unittests/tatepairing-test.cc
index 1a15f6a..91a46c7 100644
--- a/epid/common/math/unittests/tatepairing-test.cc
+++ b/epid/common/math/unittests/tatepairing-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
#include <cstring>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
#include "epid/common-testhelper/errors-testhelper.h"
diff --git a/epid/common/src/commitment.c b/epid/common/src/commitment.c
index 790a2be..24b8936 100644
--- a/epid/common/src/commitment.c
+++ b/epid/common/src/commitment.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,8 +18,10 @@
* \file
* \brief Commitment hash implementation.
*/
-#include <limits.h>
#include "epid/common/src/commitment.h"
+
+#include <limits.h>
+#include "epid/common/math/ecgroup.h"
#include "epid/common/src/memory.h"
EpidStatus SetKeySpecificCommitValues(GroupPubKey const* pub_key,
diff --git a/epid/common/src/commitment.h b/epid/common/src/commitment.h
index 4676cd9..d23274e 100644
--- a/epid/common/src/commitment.h
+++ b/epid/common/src/commitment.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -21,25 +21,30 @@
* \addtogroup EpidCommon
* @{
*/
+#include <stddef.h>
+
#include "epid/common/errors.h"
#include "epid/common/types.h"
-#include "epid/common/math/ecgroup.h"
-#include "epid/common/math/finitefield.h"
+
+typedef struct FiniteField FiniteField;
+typedef struct EcPoint EcPoint;
+typedef struct EcGroup EcGroup;
+typedef struct FfElement FfElement;
#pragma pack(1)
/// Storage for values to create commitment in Sign and Verify algorithms
typedef struct CommitValues {
- BigNumStr p; ///< Intel(R) EPID2.0 parameter p
- G1ElemStr g1; ///< Intel(R) EPID2.0 parameter g1
- G2ElemStr g2; ///< Intel(R) EPID2.0 parameter g2
- G1ElemStr h1; ///< Group public key value h1
- G1ElemStr h2; ///< Group public key value h2
- G2ElemStr w; ///< Group public key value w
- G1ElemStr B; ///< Variable B computed in algorithm
- G1ElemStr K; ///< Variable K computed in algorithm
- G1ElemStr T; ///< Variable T computed in algorithm
- G1ElemStr R1; ///< Variable R1 computed in algorithm
- Fq12ElemStr R2; ///< Variable R2 computed in algorithm
+ BigNumStr p; ///< Intel(R) EPID2.0 parameter p
+ G1ElemStr g1; ///< Intel(R) EPID2.0 parameter g1
+ G2ElemStr g2; ///< Intel(R) EPID2.0 parameter g2
+ G1ElemStr h1; ///< Group public key value h1
+ G1ElemStr h2; ///< Group public key value h2
+ G2ElemStr w; ///< Group public key value w
+ G1ElemStr B; ///< Variable B computed in algorithm
+ G1ElemStr K; ///< Variable K computed in algorithm
+ G1ElemStr T; ///< Variable T computed in algorithm
+ G1ElemStr R1; ///< Variable R1 computed in algorithm
+ GtElemStr R2; ///< Variable R2 computed in algorithm
} CommitValues;
#pragma pack()
diff --git a/epid/common/src/file_parser.c b/epid/common/src/file_parser.c
index b452f8d..84df2c6 100644
--- a/epid/common/src/file_parser.c
+++ b/epid/common/src/file_parser.c
@@ -282,7 +282,7 @@ EpidStatus EpidParseGroupPubKeyFile(void const* buf, size_t len,
return kEpidBadArgErr;
}
- if (sizeof(EpidGroupPubKeyCertificate) > len) {
+ if (len == 0 || len % sizeof(EpidGroupPubKeyCertificate) != 0) {
return kEpidBadArgErr;
}
diff --git a/epid/common/types.h b/epid/common/types.h
index 38b13e9..3d648fb 100644
--- a/epid/common/types.h
+++ b/epid/common/types.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -40,6 +40,12 @@
@{
*/
+/// Generic Octet String Style Number
+typedef void* OctStr;
+
+/// Generic Const Octet String Style Number
+typedef void const* ConstOctStr;
+
/// Recognized hash algorithms
typedef enum {
/// Invalid
@@ -302,6 +308,20 @@ typedef struct VerifierRl {
G1ElemStr K[1]; ///< elements in G1 (flexible array)
} VerifierRl;
+/// Pre-computed member settings.
+/*!
+ * Serialized form of the information about a member that remains
+ * stable for a given set of keys.
+ *
+ * \note e12 = 0 implies that this data is not valid
+ */
+typedef struct MemberPrecomp {
+ GtElemStr e12; ///< an element in GT
+ GtElemStr e22; ///< an element in GT
+ GtElemStr e2w; ///< an element in GT
+ GtElemStr ea2; ///< an element in GT
+} MemberPrecomp;
+
/// element to store seed values for later rekey
typedef G1ElemStr ReKeySeed;
diff --git a/epid/common/unittests/file_parser-test.cc b/epid/common/unittests/file_parser-test.cc
index 77cccfa..5024b8e 100644
--- a/epid/common/unittests/file_parser-test.cc
+++ b/epid/common/unittests/file_parser-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
#include <cstdint>
#include <vector>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
#include "epid/common/file_parser.h"
@@ -463,6 +464,14 @@ TEST_F(EpidFileParser, RejectsGroupPubKeyFileWithInvalidSize) {
EpidParseGroupPubKeyFile((void*)this->kGroupPublicKeyFile.data(),
this->kGroupPublicKeyFile.size() - 1,
&this->kCert, &pubkey));
+ EXPECT_EQ(kEpidBadArgErr, EpidParseGroupPubKeyFile(
+ (void*)this->kGroupMultiPublicKeyFile.data(),
+ this->kGroupMultiPublicKeyFile.size() - 1,
+ &this->kCert, &pubkey));
+ EXPECT_EQ(kEpidBadArgErr, EpidParseGroupPubKeyFile(
+ (void*)this->kGroupMultiPublicKeyFile.data(),
+ this->kGroupMultiPublicKeyFile.size() + 1,
+ &this->kCert, &pubkey));
}
TEST_F(EpidFileParser, RejectsInvalidGroupPubKeyFileType) {
diff --git a/epid/member/Makefile b/epid/member/Makefile
index 9312916..8278bdd 100644
--- a/epid/member/Makefile
+++ b/epid/member/Makefile
@@ -14,6 +14,7 @@ API_HEADERS_INSTALL = ./api.h
MEMBER_INCLUDE_DIR = ../../
MEMBER_SRC = $(wildcard ./src/*.c)
+MEMBER_SRC += $(wildcard ./tpm/src/*.c)
MEMBER_OBJ = $(MEMBER_SRC:.c=.o)
MEMBER_LIB = ./libmember.a
@@ -25,13 +26,12 @@ LIB_VERIFIER_DIR = ../verifier
LIB_COMMON_TESTHELPER_DIR = ../common-testhelper
LIB_COMMON_DIR = ../common
LIB_IPPCP_DIR = ../../ext/ipp/sources/ippcp/src
-LIB_IPPCPEPID_DIR = ../../ext/ipp/sources/ippcpepid/src
#set flags for linker
LDFLAGS += -L$(GTEST_INCLUDE_DIR)/gtest -L$(LIB_COMMON_TESTHELPER_DIR) \
-L$(LIB_MEMBER_DIR) -L$(LIB_VERIFIER_DIR) -L$(LIB_COMMON_DIR) \
- -L$(LIB_IPPCPEPID_DIR) -L$(LIB_IPPCP_DIR) -lgtest -lcommon-testhelper \
- -lmember -lverifier -lcommon -lippcpepid -lippcp
+ -L$(LIB_IPPCP_DIR) -lgtest -lcommon-testhelper \
+ -lmember -lverifier -lcommon -lippcp
$(MEMBER_OBJ): %.o: %.c
$(CC) $(CFLAGS) -I$(IPP_INCLUDE_DIR) -I$(IPP_SRC_INCLUDE_DIR) \
@@ -39,13 +39,13 @@ $(MEMBER_OBJ): %.o: %.c
$(MEMBER_LIB): $(MEMBER_OBJ)
$(AR) rc $(MEMBER_LIB) $(MEMBER_OBJ)
- ranlib $(MEMBER_LIB)
+ $(RANLIB) $(MEMBER_LIB)
$(MEMBER_UTEST_EXE): $(MEMBER_UTEST_OBJ)
- $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
+ $(CXX) -o $@ $^ $(LDFLAGS)
$(MEMBER_UTEST_OBJ): %.o: %.cc
- $(CXX) -o $@ $(CXXFLAGS) -I$(MEMBER_INCLUDE_DIR) \
+ $(CXX) -o $@ $(CXXFLAGS) $(GTEST_DEFINES) -I$(MEMBER_INCLUDE_DIR) \
-I$(GTEST_INCLUDE_DIR) -c $^
build: all
@@ -63,11 +63,13 @@ ifneq (,$(wildcard $(MEMBER_UTEST_EXE)))
cp $(MEMBER_UTEST_EXE) '$(TEST_INSTALL_DIR)'
endif
-check: $(MEMBER_UTEST_EXE) run
+utest: $(MEMBER_UTEST_EXE)
-run:
+run_utest:
$(MEMBER_UTEST_EXE) $(GTEST_FLAGS)
+check: utest run_utest
+
clean:
rm -f $(MEMBER_OBJ) \
$(MEMBER_LIB) \
diff --git a/epid/member/api.h b/epid/member/api.h
index f888d92..b8dffed 100644
--- a/epid/member/api.h
+++ b/epid/member/api.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -34,6 +34,8 @@
Defines the APIs needed by Intel(R) EPID members. Each member
context (::MemberCtx) represents membership in a single group.
+ To use this module, include the header epid/member/api.h.
+
\ingroup EpidModule
@{
*/
@@ -41,42 +43,6 @@
/// Internal context of member.
typedef struct MemberCtx MemberCtx;
-/// Pre-computed member settings.
-/*!
- Serialized form of the information about a member that remains stable for
- a given set of keys.
-
- \note e12 = 0 implies that this data is not valid
- */
-#pragma pack(1)
-typedef struct MemberPrecomp {
- GtElemStr e12; ///< an element in GT
- GtElemStr e22; ///< an element in GT
- GtElemStr e2w; ///< an element in GT
- GtElemStr ea2; ///< an element in GT
-} MemberPrecomp;
-
-/// Pre-computed signature.
-/*!
- Serialized form of an intermediate signature that does not depend on
- basename or message. This can be used to time-shift compute time needed to
- sign a message.
- */
-typedef struct PreComputedSignature {
- G1ElemStr B; ///< an element in G1
- G1ElemStr K; ///< an element in G1
- G1ElemStr T; ///< an element in G1
- G1ElemStr R1; ///< an element in G1
- GtElemStr R2; ///< an element in G1
- FpElemStr a; ///< an integer between [0, p-1]
- FpElemStr b; ///< an integer between [0, p-1]
- FpElemStr rx; ///< an integer between [0, p-1]
- FpElemStr rf; ///< an integer between [0, p-1]
- FpElemStr ra; ///< an integer between [0, p-1]
- FpElemStr rb; ///< an integer between [0, p-1]
-} PreComputedSignature;
-#pragma pack()
-
/// Creates a new member context.
/*!
Must be called to create the member context that is used by
@@ -86,6 +52,12 @@ typedef struct PreComputedSignature {
EpidMemberDelete() must be called to safely release the member context.
+ You need to use a cryptographically secure random
+ number generator to create a member context using
+ ::EpidMemberCreate. The ::BitSupplier is provided
+ as a function prototype for your own implementation
+ of the random number generator.
+
\param[in] pub_key
The group certificate.
\param[in] priv_key
@@ -96,7 +68,8 @@ typedef struct PreComputedSignature {
\param[in] rnd_func
Random number generator.
\param[in] rnd_param
- Pass through context data for rnd_func.
+ Pass through user data that will be passed to the user_data
+ parameter of the random number generator.
\param[out] ctx
Newly constructed member context.
@@ -111,6 +84,11 @@ typedef struct PreComputedSignature {
\see EpidMemberDelete
\see EpidMemberWritePrecomp
+ \see BitSupplier
+
+ \b Example
+
+ \ref UserManual_GeneratingAnIntelEpidSignature
*/
EpidStatus EpidMemberCreate(GroupPubKey const* pub_key, PrivKey const* priv_key,
MemberPrecomp const* precomp, BitSupplier rnd_func,
@@ -128,6 +106,10 @@ EpidStatus EpidMemberCreate(GroupPubKey const* pub_key, PrivKey const* priv_key,
The member context. Can be NULL.
\see EpidMemberCreate
+
+ \b Example
+
+ \ref UserManual_GeneratingAnIntelEpidSignature
*/
void EpidMemberDelete(MemberCtx** ctx);
@@ -142,6 +124,10 @@ void EpidMemberDelete(MemberCtx** ctx);
\note
If the result is not ::kEpidNoErr, the content of precomp is undefined.
+
+ \b Example
+
+ \ref UserManual_GeneratingAnIntelEpidSignature
*/
EpidStatus EpidMemberWritePrecomp(MemberCtx const* ctx, MemberPrecomp* precomp);
@@ -160,9 +146,52 @@ EpidStatus EpidMemberWritePrecomp(MemberCtx const* ctx, MemberPrecomp* precomp);
\see EpidMemberCreate
\see ::HashAlg
+
+ \b Example
+
+ \ref UserManual_GeneratingAnIntelEpidSignature
*/
EpidStatus EpidMemberSetHashAlg(MemberCtx* ctx, HashAlg hash_alg);
+/// Sets the signature based revocation list to be used by a member.
+/*!
+ The caller is responsible for ensuring the revocation list is authorized,
+ e.g. signed by the issuer. The caller is also responsible checking the version
+ of the revocation list. The call fails if trying to set an older version
+ of the revocation list than was last set.
+
+ \attention
+ The memory pointed to by sig_rl is accessed directly by the member
+ until a new list is set or the member is destroyed. Do not modify the
+ contents of this memory. The behavior of subsequent operations that rely on
+ the revocation list is undefined if the memory is modified.
+
+ \attention
+ It is the responsibility of the caller to free the memory pointed to by sig_rl
+ after the member is no longer using it.
+
+ \param[in] ctx
+ The member context.
+ \param[in] sig_rl
+ The signature based revocation list.
+ \param[in] sig_rl_size
+ The size of the signature based revocation list in bytes.
+
+ \returns ::EpidStatus
+
+ \note
+ If the result is not ::kEpidNoErr the signature based revocation list pointed
+ to by the member is not changed.
+
+ \see EpidMemberCreate
+
+ \b Example
+
+ \ref UserManual_GeneratingAnIntelEpidSignature
+ */
+EpidStatus EpidMemberSetSigRl(MemberCtx* ctx, SigRl const* sig_rl,
+ size_t sig_rl_size);
+
/// Computes the size in bytes required for an Intel(R) EPID signature.
/*!
\param[in] sig_rl
@@ -174,6 +203,10 @@ EpidStatus EpidMemberSetHashAlg(MemberCtx* ctx, HashAlg hash_alg);
in the signature based revocation list.
\see ::SigRl
+
+ \b Example
+
+ \ref UserManual_GeneratingAnIntelEpidSignature
*/
size_t EpidGetSigSize(SigRl const* sig_rl);
@@ -192,11 +225,7 @@ size_t EpidGetSigSize(SigRl const* sig_rl);
basename is provided, it must already be registered, or
::kEpidBadArgErr is returned.
\param[in] basename_len
- The size of basename in bytes. Must be 0 basename is NULL.
- \param[in] sig_rl
- The signature based revocation list.
- \param[in] sig_rl_size
- The size in bytes of the signature based revocation list.
+ The size of basename in bytes. Must be 0 if basename is NULL.
\param[out] sig
The generated signature
\param[in] sig_len
@@ -213,12 +242,17 @@ size_t EpidGetSigSize(SigRl const* sig_rl);
\see
EpidMemberSetHashAlg
\see
+ EpidMemberSetSigRl
+ \see
EpidGetSigSize
+
+ \b Example
+
+ \ref UserManual_GeneratingAnIntelEpidSignature
*/
EpidStatus EpidSign(MemberCtx const* ctx, void const* msg, size_t msg_len,
void const* basename, size_t basename_len,
- SigRl const* sig_rl, size_t sig_rl_size, EpidSignature* sig,
- size_t sig_len);
+ EpidSignature* sig, size_t sig_len);
/// Registers a basename with a member.
/*!
@@ -249,38 +283,28 @@ EpidStatus EpidSign(MemberCtx const* ctx, void const* msg, size_t msg_len,
\note
If the result is not ::kEpidNoErr or ::kEpidDuplicateErr it is undefined if the
basename is registered.
+
+ \b Example
+
+ \ref UserManual_GeneratingAnIntelEpidSignature
*/
EpidStatus EpidRegisterBaseName(MemberCtx* ctx, void const* basename,
size_t basename_len);
/// Extends the member's pool of pre-computed signatures.
/*!
- Can either generate new pre-computed signatures or import existing ones.
- ::EpidWritePreSigs can be used to export pre-computed signatures.
+ Generate new pre-computed signatures and add them to the internal pool.
\param[in] ctx
The member context.
\param[in] number_presigs
The number of pre-computed signatures to add to the internal pool.
- \param[in,out] presigs
- Optional array of valid pre-computed signatures to import. If presigs is not
- NULL it most contain at least number_presigs pre-computed signatures.
\returns ::EpidStatus
- \note
- presigs buffer is zeroed out before return to prevent pre-computed
- signatures from being reused.
-
- \note
- If the result is not ::kEpidNoErr the state of the pre-computed signature
- pool, and of presigs, is undefined.
-
\see ::EpidMemberCreate
- \see ::EpidWritePreSigs
*/
-EpidStatus EpidAddPreSigs(MemberCtx* ctx, size_t number_presigs,
- PreComputedSignature* presigs);
+EpidStatus EpidAddPreSigs(MemberCtx* ctx, size_t number_presigs);
/// Gets the number of pre-computed signatures in the member's pool.
/*!
@@ -291,37 +315,9 @@ EpidStatus EpidAddPreSigs(MemberCtx* ctx, size_t number_presigs,
Number of remaining pre-computed signatures. Returns 0 if ctx is NULL.
\see ::EpidMemberCreate
- \see ::EpidWritePreSigs
*/
size_t EpidGetNumPreSigs(MemberCtx const* ctx);
-/// Serializes pre-computed signatures from the member's pool.
-/*!
- Removes requested number of pre-computed signatures from member's pool and
- stores them in presigs array. Use ::EpidAddPreSigs to add pre-computed
- signatures to the pool.
-
- \param[in] ctx
- The member context.
- \param[out] presigs
- An existing buffer of pre-computed signatures.
- \param[in] number_presigs
- Number of pre-computed signatures to read. Number_presigs must not be greater
- than the value returned by ::EpidGetNumPreSigs.
-
- \returns ::EpidStatus
-
- \note
- If the result is not ::kEpidNoErr the state of the pre-computed signature
- pool, and of presigs, is undefined.
-
- \see ::EpidMemberCreate
- \see ::EpidGetNumPreSigs
- \see ::EpidAddPreSigs
-*/
-EpidStatus EpidWritePreSigs(MemberCtx* ctx, PreComputedSignature* presigs,
- size_t number_presigs);
-
/// Creates a request to join a group.
/*!
The created request is part of the interaction with an issuer needed to join
@@ -382,7 +378,7 @@ EpidStatus EpidRequestJoin(GroupPubKey const* pub_key, IssuerNonce const* ni,
basename is provided it must already be registered or
::kEpidBadArgErr is returned.
\param[in] basename_len
- The size of basename in bytes. Must be 0 basename is NULL.
+ The size of basename in bytes. Must be 0 if basename is NULL.
\param[out] sig
The generated basic signature
@@ -436,28 +432,34 @@ EpidStatus EpidNrProve(MemberCtx const* ctx, void const* msg, size_t msg_len,
BasicSignature const* sig, SigRlEntry const* sigrl_entry,
NrProof* proof);
-/// Tests if a member private key is valid without checking revocation.
+/// Assembles member private key from membership credential and f value.
/*!
- Used to check that a member private key is a valid key for a group. This
- is useful as a cross check when creating a new member private key as part of
- the join process
- \param[in] pub_key
- The public key of the group.
- \param[in] priv_key
- The private key to check.
+ Combines membership credential obtained from the issuer in response
+ to a successful join request with the f value chosen by the member
+ to create a complete member private key.
- \result bool
+ The assembled private key is sanity checked to confirm it is a
+ possible key in the group. If it is not ::kEpidBadArgErr is
+ returned.
- \retval true
- if the private key is valid for the group of the public key
- \retval false
- if the private key is not valid for the group of the public key
+ \param[in] credential
+ Membership credential received.
+ \param[in] f
+ The f value used to generate the join request associated with the
+ membership credential.
+ \param[in] pub_key
+ The public key of the group.
+ \param[out] priv_key
+ The private key.
+ \returns ::EpidStatus
- \see EpidRequestJoin
- */
-bool EpidIsPrivKeyInGroup(GroupPubKey const* pub_key, PrivKey const* priv_key);
+ \see EpidRequestJoin
+*/
+EpidStatus EpidAssemblePrivKey(MembershipCredential const* credential,
+ FpElemStr const* f, GroupPubKey const* pub_key,
+ PrivKey* priv_key);
/// Decompresses compressed member private key.
/*!
@@ -473,6 +475,10 @@ bool EpidIsPrivKeyInGroup(GroupPubKey const* pub_key, PrivKey const* priv_key);
The member private key.
\returns ::EpidStatus
+
+ \b Example
+
+ \ref UserManual_GeneratingAnIntelEpidSignature
*/
EpidStatus EpidDecompressPrivKey(GroupPubKey const* pub_key,
CompressedPrivKey const* compressed_privkey,
diff --git a/epid/member/member.parts b/epid/member/member.parts
index ee56010..2f881fe 100644
--- a/epid/member/member.parts
+++ b/epid/member/member.parts
@@ -1,5 +1,5 @@
############################################################################
-# Copyright 2016 Intel Corporation
+# Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -26,6 +26,23 @@ internal_headers = Pattern(src_dir='src',
includes=['*.h'],
recursive=False).files()
+tpm_src_files = Pattern(src_dir='tpm/src',
+ includes=['*.c'],
+ recursive=False).files()
+tpm_internal_headers = Pattern(src_dir='tpm/src',
+ includes=['*.h'],
+ recursive=False).files()
+tpm_headers = Pattern(src_dir='tpm',
+ includes=['*.h'],
+ recursive=False).files()
+tpm_utest_files = Pattern(src_dir='tpm/unittests',
+ includes=['*-test.cc',
+ '*-testhelper.cc',],
+ recursive=False).files()
+tpm_utest_headers = Pattern(src_dir='tpm/unittests',
+ includes=['*-testhelper.h',],
+ recursive=False).files()
+
utest_files = Pattern(src_dir='unittests',
includes=['*-test.cc',
'*-testhelper.cc',],
@@ -45,6 +62,12 @@ if 'install_package' in env['MODE']:
sub_dir='epid/${PART_SHORT_NAME}/src')
env.InstallTopLevel(utest_files + utest_headers,
sub_dir='epid/${PART_SHORT_NAME}/unittests')
+ env.InstallTopLevel(tpm_headers,
+ sub_dir='epid/${PART_SHORT_NAME}/tpm')
+ env.InstallTopLevel(tpm_src_files + tpm_internal_headers,
+ sub_dir='epid/${PART_SHORT_NAME}/tpm/src')
+ env.InstallTopLevel(tpm_utest_files + tpm_utest_headers,
+ sub_dir='epid/${PART_SHORT_NAME}/tpm/unittests')
env.InstallTopLevel(build_files, sub_dir='epid/${PART_SHORT_NAME}')
@@ -57,7 +80,7 @@ else:
testenv = env.Clone()
- outputs = env.Library('${PART_NAME}', src_files)
+ outputs = env.Library('${PART_NAME}', src_files + tpm_src_files)
env.Sdk(outputs)
env.SdkInclude(api_headers, sub_dir='epid/${PART_SHORT_NAME}')
@@ -68,7 +91,7 @@ else:
#unit tests
testenv['UNIT_TEST_TARGET_NAME'] = "${PART_NAME}-${UNIT_TEST_TARGET}"
testenv.UnitTest("utest",
- utest_files,
+ utest_files + tpm_utest_files,
command_args=[
'--gtest_color=yes',
'--gtest_print_time=1',
diff --git a/epid/member/src/allowed_basenames.c b/epid/member/src/allowed_basenames.c
new file mode 100644
index 0000000..e3da4e6
--- /dev/null
+++ b/epid/member/src/allowed_basenames.c
@@ -0,0 +1,117 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Basename management implementation
+/*! \file */
+
+#include "epid/member/src/allowed_basenames.h"
+
+#include <stdint.h>
+
+#include "epid/common/src/memory.h"
+
+typedef struct AllowedBasename {
+ struct AllowedBasename* next; ///< pointer to the next base name
+ size_t length; ///< size of base name
+ uint8_t name[1]; ///< base name (flexible array)
+} AllowedBasename;
+
+typedef struct AllowedBasenames { AllowedBasename* data; } AllowedBasenames;
+
+/// Creates empty list of allowed basenames
+EpidStatus CreateBasenames(AllowedBasenames** basename_container) {
+ AllowedBasenames* new_container = NULL;
+ if (!basename_container) {
+ return kEpidBadArgErr;
+ }
+ new_container = SAFE_ALLOC(sizeof(AllowedBasenames));
+ if (!new_container) {
+ return kEpidMemAllocErr;
+ }
+ new_container->data = NULL;
+ *basename_container = new_container;
+
+ return kEpidNoErr;
+}
+
+/// Checks if given basename is in the allowed list
+bool IsBasenameAllowed(AllowedBasenames const* basenames, void const* basename,
+ size_t length) {
+ if (!basenames || !length) {
+ return false;
+ } else {
+ AllowedBasename* rootnode = basenames->data;
+ while (rootnode != NULL) {
+ if (rootnode->length == length) {
+ if (!memcmp(rootnode->name, basename, length)) {
+ return true;
+ }
+ }
+ rootnode = rootnode->next;
+ }
+ }
+ return false;
+}
+
+/// Adds a new allowed basename
+EpidStatus AllowBasename(AllowedBasenames* basenames, void const* basename,
+ size_t length) {
+ AllowedBasename* newnode = NULL;
+
+ if (length > (SIZE_MAX - sizeof(AllowedBasename)) + 1) {
+ return kEpidBadArgErr;
+ }
+ if (!basenames || !basename) {
+ return kEpidBadArgErr;
+ }
+
+ newnode = SAFE_ALLOC(sizeof(AllowedBasename) + (length - 1));
+ if (!newnode) {
+ return kEpidMemAllocErr;
+ }
+
+ newnode->next = NULL;
+ newnode->length = length;
+ // Memory copy is used to copy a flexible array
+ if (0 != memcpy_S(newnode->name, length, basename, length)) {
+ SAFE_FREE(newnode);
+ return kEpidBadArgErr;
+ }
+
+ if (!basenames->data) {
+ basenames->data = newnode;
+ } else {
+ AllowedBasename* currentnode = basenames->data;
+ while (NULL != currentnode->next) {
+ currentnode = currentnode->next;
+ }
+ currentnode->next = newnode;
+ }
+ return kEpidNoErr;
+}
+
+/// Deletes list of allowed basenames
+void DeleteBasenames(AllowedBasenames** basename_container) {
+ if (basename_container && *basename_container) {
+ AllowedBasename* rootnode = (*basename_container)->data;
+ while (rootnode) {
+ AllowedBasename* deletenode = rootnode;
+ rootnode = rootnode->next;
+ SAFE_FREE(deletenode);
+ }
+ (*basename_container)->data = NULL;
+ SAFE_FREE(*basename_container);
+ }
+}
diff --git a/epid/member/src/allowed_basenames.h b/epid/member/src/allowed_basenames.h
new file mode 100644
index 0000000..8600eff
--- /dev/null
+++ b/epid/member/src/allowed_basenames.h
@@ -0,0 +1,45 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Basename management APIs
+/*! \file */
+
+#ifndef EPID_MEMBER_SRC_ALLOWED_BASENAMES_H_
+#define EPID_MEMBER_SRC_ALLOWED_BASENAMES_H_
+
+#include <stddef.h>
+#include "epid/common/errors.h"
+#include "epid/common/stdtypes.h"
+
+/// \cond
+typedef struct AllowedBasenames AllowedBasenames;
+typedef struct AllowedBasename AllowedBasename;
+/// \endcond
+
+/// Creates empty list of allowed basenames
+EpidStatus CreateBasenames(AllowedBasenames** basename_container);
+
+/// Checks if given basename is in the allowed list
+bool IsBasenameAllowed(AllowedBasenames const* basenames, void const* basename,
+ size_t length);
+
+/// Adds a new allowed basename
+EpidStatus AllowBasename(AllowedBasenames* basenames, void const* basename,
+ size_t length);
+
+/// Deletes list of allowed basenames
+void DeleteBasenames(AllowedBasenames** basename_container);
+
+#endif // EPID_MEMBER_SRC_ALLOWED_BASENAMES_H_
diff --git a/epid/member/src/assemble_privkey.c b/epid/member/src/assemble_privkey.c
new file mode 100644
index 0000000..4f89f47
--- /dev/null
+++ b/epid/member/src/assemble_privkey.c
@@ -0,0 +1,123 @@
+/*############################################################################
+ # Copyright 2017 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 EpidAssemblePrivKey implementation.
+ */
+
+#include <epid/member/api.h>
+
+#include <string.h>
+
+#include "epid/common/src/epid2params.h"
+#include "epid/common/src/memory.h"
+#include "epid/member/tpm/context.h"
+#include "epid/member/tpm/validatekey.h"
+#include "epid/common/math/finitefield.h"
+#include "epid/common/math/ecgroup.h"
+#include "epid/common/types.h"
+
+/// Handle SDK Error with Break
+#define BREAK_ON_EPID_ERROR(ret) \
+ if (kEpidNoErr != (ret)) { \
+ break; \
+ }
+
+// implements section 3.2.2 "Validation of Private Key" from
+// Intel(R) EPID 2.0 Spec
+static bool EpidIsPrivKeyInGroup(GroupPubKey const* pub_key,
+ PrivKey const* priv_key) {
+ bool result = false;
+ Epid2Params_* params = NULL;
+ TpmCtx* ctx = NULL;
+ FfElement* x = NULL;
+ EcPoint* h2 = NULL;
+
+ if (!pub_key || !priv_key) {
+ return false;
+ }
+
+ do {
+ EpidStatus sts;
+ sts = CreateEpid2Params(&params);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // check if x and h2 are valid
+ sts = NewFfElement(params->Fp, &x);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadFfElement(params->Fp, &priv_key->x, sizeof(priv_key->x), x);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewEcPoint(params->G1, &h2);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadEcPoint(params->G1, &pub_key->h2, sizeof(pub_key->h2), h2);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = TpmCreate(NULL, NULL, params, &ctx);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = TpmProvision(ctx, &priv_key->f);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // Step 1. The member verifies that the gid in the public key matches the
+ // gid in the private key.
+ if (0 != memcmp(&pub_key->gid, &priv_key->gid, sizeof(priv_key->gid))) {
+ result = false;
+ break;
+ }
+
+ result = TpmIsKeyValid(ctx, &priv_key->A, &priv_key->x, &pub_key->h1,
+ &pub_key->w);
+ } while (0);
+
+ TpmDelete(&ctx);
+ DeleteEpid2Params(&params);
+ DeleteEcPoint(&h2);
+ DeleteFfElement(&x);
+
+ return result;
+}
+
+// Implements step 8 of 3.4 Join Protocol from Intel(R) EPID 2.0 Spec.
+EpidStatus EpidAssemblePrivKey(MembershipCredential const* credential,
+ FpElemStr const* f, GroupPubKey const* pub_key,
+ PrivKey* priv_key) {
+ EpidStatus sts = kEpidErr;
+ bool is_key_valid = false;
+ PrivKey priv_key_tmp = {0};
+ if (!credential || !f || !priv_key) {
+ return kEpidBadArgErr;
+ }
+ do {
+ priv_key_tmp.gid = credential->gid;
+ priv_key_tmp.A = credential->A;
+ priv_key_tmp.x = credential->x;
+ priv_key_tmp.f = *f;
+
+ is_key_valid = EpidIsPrivKeyInGroup(pub_key, &priv_key_tmp);
+ if (!is_key_valid) {
+ sts = kEpidBadArgErr;
+ break;
+ }
+
+ *priv_key = priv_key_tmp;
+ sts = kEpidNoErr;
+ } while (0);
+
+ EpidZeroMemory(&priv_key_tmp, sizeof(priv_key_tmp));
+
+ return sts;
+}
diff --git a/epid/member/src/context.c b/epid/member/src/context.c
index 227bf12..3a672ff 100644
--- a/epid/member/src/context.c
+++ b/epid/member/src/context.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,24 +19,31 @@
* \brief Member context implementation.
*/
+#include <epid/member/api.h>
+
#include <string.h>
-#include "epid/member/api.h"
+#include "epid/member/tpm/context.h"
+#include "epid/member/tpm/init.h"
#include "epid/member/src/context.h"
-#include "epid/member/src/privkey.h"
#include "epid/common/src/memory.h"
+#include "epid/common/src/endian_convert.h"
+#include "epid/common/src/sigrlvalid.h"
+#include "epid/common/src/epid2params.h"
+#include "epid/member/tpm/presig.h"
+#include "epid/member/src/precomp.h"
+#include "epid/member/src/allowed_basenames.h"
-/// Perform pre-computation and store in context
-static EpidStatus DoPrecomputation(MemberCtx* ctx);
-
-/// Read Member precomp
-static EpidStatus ReadPrecomputation(MemberPrecomp const* precomp_str,
- MemberCtx* ctx);
+/// Handle SDK Error with Break
+#define BREAK_ON_EPID_ERROR(ret) \
+ if (kEpidNoErr != (ret)) { \
+ break; \
+ }
EpidStatus EpidMemberCreate(GroupPubKey const* pub_key, PrivKey const* priv_key,
MemberPrecomp const* precomp, BitSupplier rnd_func,
void* rnd_param, MemberCtx** ctx) {
- EpidStatus result = kEpidErr;
+ EpidStatus sts = kEpidErr;
MemberCtx* member_ctx = NULL;
if (!pub_key || !priv_key || !rnd_func || !ctx) {
@@ -49,7 +56,7 @@ EpidStatus EpidMemberCreate(GroupPubKey const* pub_key, PrivKey const* priv_key,
return kEpidBadArgErr;
}
- // Allocate memory for VerifierCtx
+ // Allocate memory for MemberCtx
member_ctx = SAFE_ALLOC(sizeof(MemberCtx));
if (!member_ctx) {
return kEpidMemAllocErr;
@@ -58,366 +65,134 @@ EpidStatus EpidMemberCreate(GroupPubKey const* pub_key, PrivKey const* priv_key,
do {
// set the default hash algorithm to sha512
member_ctx->hash_alg = kSha512;
+ member_ctx->rnd_func = rnd_func;
+ member_ctx->rnd_param = rnd_param;
+ member_ctx->pub_key = *pub_key;
+ member_ctx->sig_rl = NULL;
+ sts = CreateBasenames(&member_ctx->allowed_basenames);
+ BREAK_ON_EPID_ERROR(sts);
// Internal representation of Epid2Params
- result = CreateEpid2Params(&member_ctx->epid2_params);
- if (kEpidNoErr != result) {
- break;
- }
- // Internal representation of Group Pub Key
- result =
- CreateGroupPubKey(pub_key, member_ctx->epid2_params->G1,
- member_ctx->epid2_params->G2, &member_ctx->pub_key);
- if (kEpidNoErr != result) {
- break;
- }
- // Internal representation of Member Priv Key
- result = CreatePrivKey(priv_key, member_ctx->epid2_params->G1,
- member_ctx->epid2_params->Fp, &member_ctx->priv_key);
- if (kEpidNoErr != result) {
- break;
- }
- // Allocate member_ctx->e12
- result = NewFfElement(member_ctx->epid2_params->GT, &member_ctx->e12);
- if (kEpidNoErr != result) {
- break;
- }
- // Allocate member_ctx->e22
- result = NewFfElement(member_ctx->epid2_params->GT, &member_ctx->e22);
- if (kEpidNoErr != result) {
- break;
- }
- // Allocate member_ctx->e2w
- result = NewFfElement(member_ctx->epid2_params->GT, &member_ctx->e2w);
- if (kEpidNoErr != result) {
- break;
- }
- // Allocate member_ctx->ea2
- result = NewFfElement(member_ctx->epid2_params->GT, &member_ctx->ea2);
- if (kEpidNoErr != result) {
- break;
- }
- // precomputation
- if (precomp != NULL) {
- result = ReadPrecomputation(precomp, member_ctx);
- } else {
- result = DoPrecomputation(member_ctx);
- }
- if (kEpidNoErr != result) {
- break;
- }
- result = SetKeySpecificCommitValues(pub_key, &member_ctx->commit_values);
- if (kEpidNoErr != result) {
- break;
- }
+ sts = CreateEpid2Params(&member_ctx->epid2_params);
+ BREAK_ON_EPID_ERROR(sts);
- member_ctx->rnd_func = rnd_func;
- member_ctx->rnd_param = rnd_param;
- member_ctx->allowed_basenames = NULL;
+ // create and minimally provision TPM
+ sts = TpmCreate(rnd_func, rnd_param, member_ctx->epid2_params,
+ &member_ctx->tpm_ctx);
+ BREAK_ON_EPID_ERROR(sts);
- if (!CreateStack(sizeof(PreComputedSignature), &member_ctx->presigs)) {
- result = kEpidMemAllocErr;
- break;
+ sts = TpmProvision(member_ctx->tpm_ctx, &priv_key->f);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // pre-computation
+ if (precomp) {
+ member_ctx->precomp = *precomp;
+ } else {
+ sts = PrecomputeMemberPairing(member_ctx->epid2_params, pub_key,
+ &priv_key->A, &member_ctx->precomp);
+ BREAK_ON_EPID_ERROR(sts);
}
+ // complete initialization of TPM
+ sts = TpmInit(member_ctx->tpm_ctx, &priv_key->A, &priv_key->x, &pub_key->h1,
+ &pub_key->h2, &pub_key->w, &member_ctx->precomp);
+ BREAK_ON_EPID_ERROR(sts);
+
*ctx = member_ctx;
- result = kEpidNoErr;
+ sts = kEpidNoErr;
} while (0);
- if (kEpidNoErr != result) {
- DeleteFfElement(&member_ctx->ea2);
- DeleteFfElement(&member_ctx->e2w);
- DeleteFfElement(&member_ctx->e22);
- DeleteFfElement(&member_ctx->e12);
- DeleteEpid2Params(&member_ctx->epid2_params);
- DeleteGroupPubKey(&member_ctx->pub_key);
- DeletePrivKey(&member_ctx->priv_key);
- DeleteStack(&member_ctx->presigs);
- SAFE_FREE(member_ctx);
+ if (kEpidNoErr != sts) {
+ EpidMemberDelete(&member_ctx);
}
- return (result);
+ return (sts);
}
void EpidMemberDelete(MemberCtx** ctx) {
if (ctx && *ctx) {
- DeleteGroupPubKey(&(*ctx)->pub_key);
- DeleteFfElement(&(*ctx)->e12);
- DeleteFfElement(&(*ctx)->e22);
- DeleteFfElement(&(*ctx)->e2w);
- DeleteFfElement(&(*ctx)->ea2);
+ TpmDelete(&(*ctx)->tpm_ctx);
DeleteEpid2Params(&(*ctx)->epid2_params);
- DeletePrivKey(&(*ctx)->priv_key);
DeleteBasenames(&(*ctx)->allowed_basenames);
- DeleteStack(&(*ctx)->presigs);
SAFE_FREE(*ctx);
}
}
EpidStatus EpidMemberWritePrecomp(MemberCtx const* ctx,
MemberPrecomp* precomp) {
- EpidStatus result = kEpidErr;
- FfElement* e12 = NULL; // an element in GT
- FfElement* e22 = NULL; // an element in GT
- FfElement* e2w = NULL; // an element in GT
- FfElement* ea2 = NULL; // an element in GT
- FiniteField* GT = NULL; // Finite field GT(Fq12 )
if (!ctx) {
return kEpidBadArgErr;
}
if (!precomp) {
return kEpidBadArgErr;
}
- if (!ctx->e12 || !ctx->e22 || !ctx->e2w || !ctx->ea2 || !ctx->epid2_params ||
- !(ctx->epid2_params->GT)) {
- return kEpidBadArgErr;
- }
- e12 = ctx->e12;
- e22 = ctx->e22;
- e2w = ctx->e2w;
- ea2 = ctx->ea2;
- GT = ctx->epid2_params->GT;
- result = WriteFfElement(GT, e12, &(precomp->e12), sizeof(precomp->e12));
- if (kEpidNoErr != result) {
- return result;
- }
- result = WriteFfElement(GT, e22, &(precomp->e22), sizeof(precomp->e22));
- if (kEpidNoErr != result) {
- return result;
- }
- result = WriteFfElement(GT, e2w, &(precomp->e2w), sizeof(precomp->e2w));
- if (kEpidNoErr != result) {
- return result;
- }
- result = WriteFfElement(GT, ea2, &(precomp->ea2), sizeof(precomp->ea2));
- if (kEpidNoErr != result) {
- return result;
- }
- return result;
+
+ *precomp = ctx->precomp;
+ return kEpidNoErr;
}
EpidStatus EpidMemberSetHashAlg(MemberCtx* ctx, HashAlg hash_alg) {
if (!ctx) return kEpidBadArgErr;
- if (kSha256 != hash_alg && kSha384 != hash_alg && kSha512 != hash_alg)
+ if (kSha256 != hash_alg && kSha384 != hash_alg && kSha512 != hash_alg &&
+ kSha512_256 != hash_alg)
return kEpidBadArgErr;
ctx->hash_alg = hash_alg;
return kEpidNoErr;
}
-EpidStatus EpidRegisterBaseName(MemberCtx* ctx, void const* basename,
- size_t basename_len) {
- EpidStatus result = kEpidErr;
- if (basename_len == 0) {
+EpidStatus EpidMemberSetSigRl(MemberCtx* ctx, SigRl const* sig_rl,
+ size_t sig_rl_size) {
+ if (!ctx || !sig_rl) {
return kEpidBadArgErr;
}
- if (!ctx || !basename) {
+ if (!IsSigRlValid(&ctx->pub_key.gid, sig_rl, sig_rl_size)) {
return kEpidBadArgErr;
}
-
- if (ContainsBasename(ctx->allowed_basenames, basename, basename_len)) {
- return kEpidDuplicateErr;
- }
-
- result = AddBasename(&ctx->allowed_basenames, basename, basename_len);
-
- return result;
-}
-
-void DeleteBasenames(AllowedBasename** rootnode) {
- if (rootnode && *rootnode) {
- AllowedBasename* currentnode = *rootnode;
- while (currentnode) {
- AllowedBasename* deletenode = currentnode;
- currentnode = currentnode->next;
- SAFE_FREE(deletenode);
+ // Do not set an older version of sig rl
+ if (ctx->sig_rl) {
+ unsigned int current_ver = 0;
+ unsigned int incoming_ver = 0;
+ current_ver = ntohl(ctx->sig_rl->version);
+ incoming_ver = ntohl(sig_rl->version);
+ if (current_ver >= incoming_ver) {
+ return kEpidBadArgErr;
}
- *rootnode = NULL;
}
+ ctx->sig_rl = sig_rl;
+
+ return kEpidNoErr;
}
-EpidStatus AddBasename(AllowedBasename** rootnode, void const* basename,
- size_t length) {
- EpidStatus result = kEpidErr;
- AllowedBasename* newnode = NULL;
- AllowedBasename* currentnode = NULL;
- if (length > (SIZE_MAX - sizeof(AllowedBasename)) + 1) {
- return kEpidBadArgErr;
- }
- if (!basename) {
+EpidStatus EpidRegisterBaseName(MemberCtx* ctx, void const* basename,
+ size_t basename_len) {
+ EpidStatus sts = kEpidErr;
+ if (basename_len == 0) {
return kEpidBadArgErr;
}
-
- newnode = SAFE_ALLOC(sizeof(AllowedBasename) + (length - 1));
- if (!newnode) {
- return kEpidMemAllocErr;
- }
- newnode->next = NULL;
- newnode->length = length;
- // Memory copy is used to copy a flexible array
- if (0 != memcpy_S(newnode->name, length, basename, length)) {
- SAFE_FREE(newnode);
+ if (!ctx || !basename) {
return kEpidBadArgErr;
}
- if (*rootnode == NULL) {
- *rootnode = newnode;
- return kEpidNoErr;
- }
- currentnode = *rootnode;
- while (currentnode->next != NULL) {
- currentnode = currentnode->next;
- }
- currentnode->next = newnode;
- result = kEpidNoErr;
-
- return result;
-}
-bool ContainsBasename(AllowedBasename const* rootnode, void const* basename,
- size_t length) {
- if (length != 0) {
- while (rootnode != NULL) {
- if (rootnode->length == length) {
- if (!memcmp(rootnode->name, basename, length)) {
- return true;
- }
- }
- rootnode = rootnode->next;
- }
+ if (IsBasenameAllowed(ctx->allowed_basenames, basename, basename_len)) {
+ return kEpidDuplicateErr;
}
- return false;
-}
-
-EpidStatus EpidAddPreSigs(MemberCtx* ctx, size_t number_presigs,
- PreComputedSignature* presigs) {
- PreComputedSignature* new_presigs;
- if (!ctx) return kEpidBadArgErr;
- if (!ctx->presigs) return kEpidBadArgErr;
- if (0 == number_presigs) return kEpidNoErr;
- if (number_presigs > SIZE_MAX / sizeof(PreComputedSignature))
- return kEpidBadArgErr; // integer overflow
+ sts = AllowBasename(ctx->allowed_basenames, basename, basename_len);
- new_presigs =
- (PreComputedSignature*)StackPushN(ctx->presigs, number_presigs, presigs);
- if (!new_presigs) return kEpidMemAllocErr;
-
- if (presigs) {
- memset(presigs, 0, number_presigs * sizeof(PreComputedSignature));
- } else {
- size_t i;
- for (i = 0; i < number_presigs; i++) {
- EpidStatus sts = EpidComputePreSig(ctx, &new_presigs[i]);
- if (kEpidNoErr != sts) {
- // roll back pre-computed-signature pool
- StackPopN(ctx->presigs, number_presigs, 0);
- return sts;
- }
- }
- }
- return kEpidNoErr;
+ return sts;
}
-size_t EpidGetNumPreSigs(MemberCtx const* ctx) {
- return (ctx && ctx->presigs) ? StackGetSize(ctx->presigs) : (size_t)0;
-}
-
-EpidStatus EpidWritePreSigs(MemberCtx* ctx, PreComputedSignature* presigs,
- size_t number_presigs) {
- if (!ctx || (!presigs && (0 != number_presigs))) return kEpidBadArgErr;
- if (!ctx->presigs) return kEpidBadArgErr;
-
- if (0 == number_presigs) return kEpidNoErr;
-
- return StackPopN(ctx->presigs, number_presigs, presigs) ? kEpidNoErr
- : kEpidBadArgErr;
-}
-
-static EpidStatus DoPrecomputation(MemberCtx* ctx) {
- EpidStatus result = kEpidErr;
- FfElement* e12 = NULL;
- FfElement* e22 = NULL;
- FfElement* e2w = NULL;
- FfElement* ea2 = NULL;
- Epid2Params_* params = NULL;
- GroupPubKey_* pub_key = NULL;
- PairingState* ps_ctx = NULL;
+EpidStatus EpidAddPreSigs(MemberCtx* ctx, size_t number_presigs) {
if (!ctx) {
return kEpidBadArgErr;
}
- if (!ctx->epid2_params || !ctx->epid2_params->GT ||
- !ctx->epid2_params->pairing_state || !ctx->pub_key || !ctx->priv_key ||
- !ctx->e12 || !ctx->e22 || !ctx->e2w || !ctx->ea2) {
- return kEpidBadArgErr;
- }
- pub_key = ctx->pub_key;
- params = ctx->epid2_params;
- e12 = ctx->e12;
- e22 = ctx->e22;
- e2w = ctx->e2w;
- ea2 = ctx->ea2;
- ps_ctx = params->pairing_state;
- // do precomputation
- // 1. The member computes e12 = pairing(h1, g2).
- result = Pairing(ps_ctx, e12, pub_key->h1, params->g2);
- if (kEpidNoErr != result) {
- return result;
- }
- // 2. The member computes e22 = pairing(h2, g2).
- result = Pairing(ps_ctx, e22, pub_key->h2, params->g2);
- if (kEpidNoErr != result) {
- return result;
- }
- // 3. The member computes e2w = pairing(h2, w).
- result = Pairing(ps_ctx, e2w, pub_key->h2, pub_key->w);
- if (kEpidNoErr != result) {
- return result;
- }
- // 4. The member computes ea2 = pairing(A, g2).
- result = Pairing(ps_ctx, ea2, ctx->priv_key->A, params->g2);
- if (kEpidNoErr != result) {
- return result;
- }
- return kEpidNoErr;
-}
-static EpidStatus ReadPrecomputation(MemberPrecomp const* precomp_str,
- MemberCtx* ctx) {
- EpidStatus result = kEpidErr;
- FfElement* e12 = NULL;
- FfElement* e22 = NULL;
- FfElement* e2w = NULL;
- FfElement* ea2 = NULL;
- FiniteField* GT = NULL;
- Epid2Params_* params = NULL;
- if (!ctx || !precomp_str) {
- return kEpidBadArgErr;
- }
- if (!ctx->epid2_params || !ctx->epid2_params->GT || !ctx->e12 || !ctx->e22 ||
- !ctx->e2w || !ctx->ea2) {
- return kEpidBadArgErr;
- }
- params = ctx->epid2_params;
- GT = params->GT;
- e12 = ctx->e12;
- e22 = ctx->e22;
- e2w = ctx->e2w;
- ea2 = ctx->ea2;
+ return TpmAddPreSigs(ctx->tpm_ctx, number_presigs);
+}
- result = ReadFfElement(GT, &precomp_str->e12, sizeof(precomp_str->e12), e12);
- if (kEpidNoErr != result) {
- return result;
- }
- result = ReadFfElement(GT, &precomp_str->e22, sizeof(precomp_str->e22), e22);
- if (kEpidNoErr != result) {
- return result;
- }
- result = ReadFfElement(GT, &precomp_str->e2w, sizeof(precomp_str->e2w), e2w);
- if (kEpidNoErr != result) {
- return result;
- }
- result = ReadFfElement(GT, &precomp_str->ea2, sizeof(precomp_str->ea2), ea2);
- if (kEpidNoErr != result) {
- return result;
+size_t EpidGetNumPreSigs(MemberCtx const* ctx) {
+ if (!ctx) {
+ return 0;
}
- return kEpidNoErr;
+ return TpmGetNumPreSigs(ctx->tpm_ctx);
}
diff --git a/epid/member/src/context.h b/epid/member/src/context.h
index 73adb2e..48695c7 100644
--- a/epid/member/src/context.h
+++ b/epid/member/src/context.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,66 +20,31 @@
* \brief Member context interface.
*/
+#include <epid/member/api.h>
+
#include <stddef.h>
-#include "epid/member/api.h"
+
#include "epid/common/errors.h"
-#include "epid/common/src/epid2params.h"
-#include "epid/common/src/grouppubkey.h"
-#include "epid/common/src/stack.h"
-#include "epid/common/src/commitment.h"
-#include "epid/member/src/privkey.h"
+#include "epid/common/types.h"
+#include "epid/common/bitsupplier.h"
-/// Internal implementation of base name
-typedef struct AllowedBasename {
- struct AllowedBasename* next; ///< pointer to the next base name
- size_t length; ///< size of base name
- uint8_t name[1]; ///< base name (flexible array)
-} AllowedBasename;
+/// \cond
+typedef struct TpmCtx TpmCtx;
+typedef struct Epid2Params_ Epid2Params_;
+typedef struct AllowedBasenames AllowedBasenames;
+/// \endcond
/// Member context definition
struct MemberCtx {
- GroupPubKey_* pub_key; ///< group public key
- FfElement* e12; ///< an element in GT
- FfElement* e22; ///< an element in GT
- FfElement* e2w; ///< an element in GT
- FfElement* ea2; ///< an element in GT
Epid2Params_* epid2_params; ///< Intel(R) EPID 2.0 params
- PrivKey_* priv_key; ///< Member private key
-
- BitSupplier rnd_func; ///< Pseudo random number generation function
- void* rnd_param; ///< Pointer to user context for rnd_func
- HashAlg hash_alg; ///< Hash algorithm to use
- AllowedBasename* allowed_basenames; ///< Base name list
- Stack* presigs; ///< Pre-computed signatures pool
- CommitValues commit_values; ///< Values that are hashed to create commitment
+ TpmCtx* tpm_ctx; ///< TPM context
+ GroupPubKey pub_key; ///< group public key
+ MemberPrecomp precomp; ///< Member pre-computed data
+ BitSupplier rnd_func; ///< Pseudo random number generation function
+ void* rnd_param; ///< Pointer to user context for rnd_func
+ SigRl const* sig_rl; ///< Signature based revocation list - not owned
+ AllowedBasenames* allowed_basenames; ///< Base name list
+ HashAlg hash_alg; ///< Hash algorithm to use
};
-/// Delete base name list
-void DeleteBasenames(AllowedBasename** rootnode);
-
-/// Add new base name to list
-EpidStatus AddBasename(AllowedBasename** rootnode, void const* basename,
- size_t length);
-
-/// Check if given base name exist in the list
-bool ContainsBasename(AllowedBasename const* rootnode, void const* basename,
- size_t length);
-
-/// Performs Pre-computation that can be used to speed up signing
-/*!
- \warning
- Do not re-use the same pre-computed signature to generate more than
- one signature. If a pre-computed signature is used for computing
- two signatures, an attacker could learn the Intel(R) EPID private key.
-
- \param[in] ctx
- The member context.
- \param[out] precompsig
- The pre-computed signature.
-
- \returns ::EpidStatus
- */
-EpidStatus EpidComputePreSig(MemberCtx const* ctx,
- PreComputedSignature* precompsig);
-
#endif // EPID_MEMBER_SRC_CONTEXT_H_
diff --git a/epid/member/src/decompress_privkey.c b/epid/member/src/decompress_privkey.c
index acba773..460d049 100644
--- a/epid/member/src/decompress_privkey.c
+++ b/epid/member/src/decompress_privkey.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -21,11 +21,12 @@
#include "epid/member/api.h"
-#include "epid/common/src/memory.h"
+#include "epid/member/tpm/context.h"
+#include "epid/member/tpm/decompress.h"
#include "epid/common/src/epid2params.h"
-#include "epid/common/math/src/bignum-internal.h"
-#include "epid/common/math/hash.h"
-#include "epid/member/src/privkey.h"
+
+#include "epid/member/tpm/src/types.h"
+#include "epid/common/math/finitefield.h"
/// Handle Intel(R) EPID Error with Break
#define BREAK_ON_EPID_ERROR(ret) \
@@ -33,263 +34,44 @@
break; \
}
-/// Implements the derivation method used by private key decompression
-/// Derives two integers x, f between [1, p-1] from the seed value
-static EpidStatus DeriveXF(FpElemStr* x, FpElemStr* f, Seed const* seed,
- FpElemStr const* p);
-
EpidStatus EpidDecompressPrivKey(GroupPubKey const* pub_key,
CompressedPrivKey const* compressed_privkey,
PrivKey* priv_key) {
- EpidStatus result = kEpidErr;
- Epid2Params_* epid2_params = 0;
- PrivKey_ priv_key_ = {{{0}}, 0, 0, 0};
- FfElement* Ax = 0;
- EcPoint* t1 = 0;
- EcPoint* t2 = 0;
- FfElement* t3 = 0;
- FfElement* t4 = 0;
- BigNum* bn_pminus1 = 0;
- BigNum* bn_one = 0;
- EcPoint* h1 = 0;
- EcPoint* w = 0;
+ EpidStatus sts = kEpidErr;
+
+ Epid2Params_* params = NULL;
+ TpmCtx* ctx = NULL;
- // check parameters
if (!pub_key || !compressed_privkey || !priv_key) {
return kEpidBadArgErr;
}
- // Internal representation of Epid2Params
- result = CreateEpid2Params(&epid2_params);
- if (kEpidNoErr != result) {
- return result;
- }
-
- do {
- uint8_t bn_one_str = 1;
- FpElemStr p_str = {0};
- bool is_valid = false;
- // shortcuts
- EcGroup* G1 = epid2_params->G1;
- EcGroup* G2 = epid2_params->G2;
- FiniteField* GT = epid2_params->GT;
- EcPoint* g1 = epid2_params->g1;
- EcPoint* g2 = epid2_params->g2;
- PairingState* ps_ctx = epid2_params->pairing_state;
- FiniteField* Fp = epid2_params->Fp;
- FiniteField* Fq = epid2_params->Fq;
- BigNum* p = epid2_params->p;
-
- // In the following process, temporary variables t1 (an element of
- // G2), t2 (an element of G1), t3, t4 (elements of GT) are used.
- // Let the compressed private key be (gid, A.x, seed). Let the
- // Intel(R) EPID public key be (gid, h1, h2, w).
-
- // Create a new Priv Key
- result = NewEcPoint(G1, &priv_key_.A);
- BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(Fp, &priv_key_.x);
- BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(Fp, &priv_key_.f);
- BREAK_ON_EPID_ERROR(result);
-
- result = NewFfElement(Fq, &Ax);
- BREAK_ON_EPID_ERROR(result);
- result = NewEcPoint(G2, &t1);
- BREAK_ON_EPID_ERROR(result);
- result = NewEcPoint(G1, &t2);
- BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(GT, &t3);
- BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(GT, &t4);
- BREAK_ON_EPID_ERROR(result);
- result = NewBigNum(sizeof(BigNumStr), &bn_pminus1);
- BREAK_ON_EPID_ERROR(result);
- result = NewBigNum(sizeof(bn_one_str), &bn_one);
- BREAK_ON_EPID_ERROR(result);
-
- result = NewEcPoint(G1, &h1);
- BREAK_ON_EPID_ERROR(result);
- result = ReadEcPoint(G1, &(pub_key->h1), sizeof(pub_key->h1), h1);
- BREAK_ON_EPID_ERROR(result);
- result = NewEcPoint(G2, &w);
- BREAK_ON_EPID_ERROR(result);
- result = ReadEcPoint(G2, &(pub_key->w), sizeof(pub_key->w), w);
- BREAK_ON_EPID_ERROR(result);
-
- result = WriteBigNum(p, sizeof(p_str), &p_str);
- BREAK_ON_EPID_ERROR(result);
-
- result = ReadBigNum(&bn_one_str, sizeof(bn_one_str), bn_one);
- BREAK_ON_EPID_ERROR(result);
-
- // 1. The member derives x and f from seed. The derivation
- // function must be the same as the one used in the key
- // generation above. This step is out of scope of this
- // specification.
- result =
- DeriveXF(&priv_key->x, &priv_key->f, &compressed_privkey->seed, &p_str);
- BREAK_ON_EPID_ERROR(result);
- // 2. The member computes A = G1.makePoint(A.x).
- result = ReadFfElement(Fq, &compressed_privkey->ax,
- sizeof(compressed_privkey->ax), Ax);
- BREAK_ON_EPID_ERROR(result);
- result = EcMakePoint(G1, Ax, priv_key_.A);
- BREAK_ON_EPID_ERROR(result);
- // 3. The member tests whether (A, x, f) is a valid Intel(R) EPID
- // private key as follows:
- // a. It computes t1 = G2.sscmExp(g2, x).
- result = EcSscmExp(G2, g2, (BigNumStr const*)&priv_key->x, t1);
- BREAK_ON_EPID_ERROR(result);
- // b. It computes t1 = G2.mul(t1, w).
- result = EcMul(G2, t1, w, t1);
- BREAK_ON_EPID_ERROR(result);
- // c. It computes t3 = pairing(A, t1).
- result = Pairing(ps_ctx, t3, priv_key_.A, t1);
- BREAK_ON_EPID_ERROR(result);
- // d. It computes t2 = G1.sscmExp(h1, f).
- result = EcSscmExp(G1, h1, (BigNumStr const*)&priv_key->f, t2);
- BREAK_ON_EPID_ERROR(result);
- // e. It computes t2 = G1.mul(t2, g1).
- result = EcMul(G1, t2, g1, t2);
- BREAK_ON_EPID_ERROR(result);
- // f. It computes t4 = pairing(t2, g2).
- result = Pairing(ps_ctx, t4, t2, g2);
- BREAK_ON_EPID_ERROR(result);
- // g. If GT.isEqual(t3, t4) = false
- result = FfIsEqual(GT, t3, t4, &is_valid);
- BREAK_ON_EPID_ERROR(result);
- if (!is_valid) {
- // i. It computes t3 = GT.exp(t3, p-1).
- result = BigNumSub(p, bn_one, bn_pminus1);
- BREAK_ON_EPID_ERROR(result);
- result = FfExp(GT, t3, bn_pminus1, t3);
- BREAK_ON_EPID_ERROR(result);
- // ii. If GT.isEqual(t3, t4) = false again, it reports bad
- // Intel(R) EPID private key and exits.
- result = FfIsEqual(GT, t3, t4, &is_valid);
- BREAK_ON_EPID_ERROR(result);
- if (!is_valid) {
- result = kEpidBadArgErr; // Invalid Member key
- break;
- }
- // iii. It sets A = G1.inverse(A).
- result = EcInverse(G1, priv_key_.A, priv_key_.A);
- BREAK_ON_EPID_ERROR(result);
- // NOTE A is modified here in this step.
- }
- // 4. The decompressed Intel(R) EPID private key is (gid, A, x, f).
- // x, f already filled in.
- priv_key->gid = pub_key->gid;
- result = WriteEcPoint(G1, priv_key_.A, &priv_key->A, sizeof(priv_key->A));
- BREAK_ON_EPID_ERROR(result);
-
- result = kEpidNoErr;
- } while (0);
-
- DeleteEcPoint(&priv_key_.A);
- DeleteFfElement(&priv_key_.x);
- DeleteFfElement(&priv_key_.f);
- DeleteFfElement(&Ax);
- DeleteEcPoint(&t1);
- DeleteEcPoint(&t2);
- DeleteFfElement(&t3);
- DeleteFfElement(&t4);
- DeleteBigNum(&bn_pminus1);
- DeleteBigNum(&bn_one);
- DeleteEcPoint(&h1);
- DeleteEcPoint(&w);
- DeleteEpid2Params(&epid2_params);
-
- return result;
-}
-
-/// Hash message buffer
-typedef struct HashMsg {
- /// Message to be hashed
- char data[11];
-} HashMsg;
-
-static EpidStatus DeriveXF(FpElemStr* x, FpElemStr* f, Seed const* seed,
- FpElemStr const* p) {
- EpidStatus result = kEpidErr;
-
- BigNum* bn_x = 0;
- BigNum* bn_f = 0;
- BigNum* bn_p = 0;
-
do {
- HashMsg msgstr = {{
- 0x00, 0x45, 0x43, 0x43, 0x2d, 0x53, 0x61, 0x66, 0x65, 0x49, 0x44,
- }};
-#pragma pack(1)
- struct {
- Seed seed;
- HashMsg msg;
- } hashbuf;
-#pragma pack()
-
- Sha256Digest digest[2];
- Ipp8u str512[512 / 8];
-
- result = NewBigNum(sizeof(*p), &bn_p);
- BREAK_ON_EPID_ERROR(result);
- result = ReadBigNum(p, sizeof(*p), bn_p);
- BREAK_ON_EPID_ERROR(result);
-
- result = NewBigNum(sizeof(digest), &bn_x);
- BREAK_ON_EPID_ERROR(result);
- result = NewBigNum(sizeof(digest), &bn_f);
- BREAK_ON_EPID_ERROR(result);
-
- // compute x
- hashbuf.seed = *seed;
- hashbuf.msg = msgstr;
- hashbuf.msg.data[0] = 0x06;
- result = Sha256MessageDigest(&hashbuf, sizeof(hashbuf), &digest[0]);
- BREAK_ON_EPID_ERROR(result);
- hashbuf.msg.data[0] = 0x07;
- result = Sha256MessageDigest(&hashbuf, sizeof(hashbuf), &digest[1]);
- BREAK_ON_EPID_ERROR(result);
-
- result = ReadBigNum(&digest, sizeof(digest), bn_x);
- BREAK_ON_EPID_ERROR(result);
-
- result = BigNumMod(bn_x, bn_p, bn_x);
- BREAK_ON_EPID_ERROR(result);
-
- result = WriteBigNum(bn_x, sizeof(str512), str512);
- BREAK_ON_EPID_ERROR(result);
-
- *x = *(FpElemStr*)&str512[sizeof(str512) / 2];
+ PrivKey key = {0};
+ sts = CreateEpid2Params(&params);
+ BREAK_ON_EPID_ERROR(sts);
- // compute f
- hashbuf.seed = *seed;
- hashbuf.msg = msgstr;
- hashbuf.msg.data[0] = 0x08;
- result = Sha256MessageDigest(&hashbuf, sizeof(hashbuf), &digest[0]);
- BREAK_ON_EPID_ERROR(result);
- hashbuf.msg.data[0] = 0x09;
- result = Sha256MessageDigest(&hashbuf, sizeof(hashbuf), &digest[1]);
- BREAK_ON_EPID_ERROR(result);
+ sts = TpmCreate(NULL, NULL, params, &ctx);
+ BREAK_ON_EPID_ERROR(sts);
- result = ReadBigNum(&digest, sizeof(digest), bn_f);
- BREAK_ON_EPID_ERROR(result);
+ sts = TpmProvisionCompressed(ctx, &compressed_privkey->seed);
+ BREAK_ON_EPID_ERROR(sts);
- result = BigNumMod(bn_f, bn_p, bn_f);
- BREAK_ON_EPID_ERROR(result);
+ sts = TpmDecompressKey(ctx, &pub_key->h1, &pub_key->w,
+ &compressed_privkey->ax, &key.A, &key.x);
+ BREAK_ON_EPID_ERROR(sts);
- result = WriteBigNum(bn_f, sizeof(str512), str512);
- BREAK_ON_EPID_ERROR(result);
+ sts = WriteFfElement(params->Fp, ctx->secret.f, &key.f, sizeof(key.f));
+ BREAK_ON_EPID_ERROR(sts);
- *f = *(FpElemStr*)&str512[sizeof(str512) / 2];
+ key.gid = pub_key->gid;
+ *priv_key = key;
- result = kEpidNoErr;
+ sts = kEpidNoErr;
} while (0);
- DeleteBigNum(&bn_x);
- DeleteBigNum(&bn_f);
- DeleteBigNum(&bn_p);
+ TpmDelete(&ctx);
+ DeleteEpid2Params(&params);
- return result;
+ return sts;
}
diff --git a/epid/member/src/hash_basename.c b/epid/member/src/hash_basename.c
new file mode 100644
index 0000000..c2cc01d
--- /dev/null
+++ b/epid/member/src/hash_basename.c
@@ -0,0 +1,53 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Basename hashing helper implementation
+/*! \file */
+
+#include "epid/member/src/hash_basename.h"
+
+#include "epid/common/math/ecgroup.h"
+
+/// Handle SDK Error with Break
+#define BREAK_ON_EPID_ERROR(ret) \
+ if (kEpidNoErr != (ret)) { \
+ break; \
+ }
+
+EpidStatus HashBaseName(EcGroup* G1, HashAlg hash_alg, void const* basename,
+ size_t basename_len, G1ElemStr* B_str) {
+ EpidStatus sts = kEpidErr;
+ EcPoint* B = NULL;
+
+ if (!G1 || (0 != basename_len && !basename) || !B_str) {
+ return kEpidBadArgErr;
+ }
+
+ do {
+ sts = NewEcPoint(G1, &B);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = EcHash(G1, basename, basename_len, hash_alg, B);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteEcPoint(G1, B, B_str, sizeof(*B_str));
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ DeleteEcPoint(&B);
+
+ return sts;
+}
diff --git a/epid/member/src/hash_basename.h b/epid/member/src/hash_basename.h
new file mode 100644
index 0000000..598a1bb
--- /dev/null
+++ b/epid/member/src/hash_basename.h
@@ -0,0 +1,56 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Basename hashing helper API
+/*! \file */
+#ifndef EPID_MEMBER_SRC_HASH_BASENAME_H_
+#define EPID_MEMBER_SRC_HASH_BASENAME_H_
+
+#include <stddef.h>
+#include "epid/common/errors.h"
+#include "epid/common/types.h" // HashAlg
+
+/// \cond
+typedef struct EcGroup EcGroup;
+typedef struct G1ElemStr G1ElemStr;
+/// \endcond
+
+/// Calculates hash of basename
+/*!
+
+ \param[in] G1
+ The elliptic curve group.
+
+ \param[in] hash_alg
+ The hash algorithm.
+
+ \param[in] basename
+ The basename.
+
+ \param[in] basename_len
+ The size of the basename in bytes.
+
+ \param[out] B_str
+ The resulting hashed basename.
+
+ \returns ::EpidStatus
+
+ \see TpmSignCommit
+
+*/
+EpidStatus HashBaseName(EcGroup* G1, HashAlg hash_alg, void const* basename,
+ size_t basename_len, G1ElemStr* B_str);
+
+#endif // EPID_MEMBER_SRC_HASH_BASENAME_H_
diff --git a/epid/member/src/join.c b/epid/member/src/join.c
new file mode 100644
index 0000000..8185145
--- /dev/null
+++ b/epid/member/src/join.c
@@ -0,0 +1,92 @@
+/*############################################################################
+ # Copyright 2017 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 EpidRequestJoin implementation.
+ */
+
+#include <epid/member/api.h>
+
+#include "epid/common/src/epid2params.h"
+#include "epid/member/tpm/context.h"
+#include "epid/member/tpm/join.h"
+#include "epid/common/types.h"
+#include "epid/common/src/grouppubkey.h"
+#include "epid/member/src/join_commitment.h"
+
+/// Handle SDK Error with Break
+#define BREAK_ON_EPID_ERROR(ret) \
+ if (kEpidNoErr != (ret)) { \
+ break; \
+ }
+
+EpidStatus EpidRequestJoin(GroupPubKey const* pub_key, IssuerNonce const* ni,
+ FpElemStr const* f, BitSupplier rnd_func,
+ void* rnd_param, HashAlg hash_alg,
+ JoinRequest* join_request) {
+ EpidStatus sts = kEpidErr;
+ Epid2Params_* params = NULL;
+ TpmCtx* ctx = NULL;
+ GroupPubKey_* pub_key_ = NULL;
+
+ if (!pub_key || !ni || !f || !rnd_func || !join_request) {
+ return kEpidBadArgErr;
+ }
+ if (kSha256 != hash_alg && kSha384 != hash_alg && kSha512 != hash_alg &&
+ kSha512_256 != hash_alg) {
+ return kEpidBadArgErr;
+ }
+
+ do {
+ JoinRequest request = {0};
+ G1ElemStr R = {0};
+
+ sts = CreateEpid2Params(&params);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // validate public key by creating
+ sts = CreateGroupPubKey(pub_key, params->G1, params->G2, &pub_key_);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = TpmCreate(rnd_func, rnd_param, params, &ctx);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = TpmProvision(ctx, f);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = TpmJoinCommit(ctx, &request.F, &R);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = HashJoinCommitment(params->Fp, hash_alg, pub_key, &request.F, &R, ni,
+ &request.c);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = TpmJoin(ctx, &request.c, &request.s);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // Step 6. The output join request is (F, c, s).
+ *join_request = request;
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ DeleteGroupPubKey(&pub_key_);
+ TpmDelete(&ctx);
+ DeleteEpid2Params(&params);
+
+ return sts;
+}
diff --git a/epid/member/src/join_commitment.c b/epid/member/src/join_commitment.c
new file mode 100644
index 0000000..96af97c
--- /dev/null
+++ b/epid/member/src/join_commitment.c
@@ -0,0 +1,89 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Host join helper implementation
+/*! \file */
+
+#include "epid/member/src/join_commitment.h"
+
+#include "epid/common/types.h"
+#include "epid/common/math/finitefield.h"
+
+/// Handle SDK Error with Break
+#define BREAK_ON_EPID_ERROR(ret) \
+ if (kEpidNoErr != (ret)) { \
+ break; \
+ }
+
+#pragma pack(1)
+/// Storage for values to create commitment in Sign and Verify algorithms
+typedef struct JoinPCommitValues {
+ BigNumStr p; ///< Intel(R) EPID 2.0 parameter p
+ G1ElemStr g1; ///< Intel(R) EPID 2.0 parameter g1
+ G2ElemStr g2; ///< Intel(R) EPID 2.0 parameter g2
+ G1ElemStr h1; ///< Group public key value h1
+ G1ElemStr h2; ///< Group public key value h2
+ G2ElemStr w; ///< Group public key value w
+ G1ElemStr F; ///< Variable F computed in algorithm
+ G1ElemStr R; ///< Variable R computed in algorithm
+ IssuerNonce NI; ///< Nonce
+} JoinPCommitValues;
+#pragma pack()
+
+EpidStatus HashJoinCommitment(FiniteField* Fp, HashAlg hash_alg,
+ GroupPubKey const* pub_key,
+ G1ElemStr const* F_str, G1ElemStr const* R_str,
+ IssuerNonce const* NI, FpElemStr* c_str) {
+ EpidStatus sts = kEpidErr;
+ FfElement* c = NULL;
+
+ if (!Fp || !pub_key || !F_str || !R_str || !NI || !c_str) {
+ return kEpidBadArgErr;
+ }
+
+ do {
+ JoinPCommitValues commit_values = {0};
+ Epid2Params params = {
+#include "epid/common/src/epid2params_ate.inc"
+ };
+
+ commit_values.p = params.p;
+ commit_values.g1 = params.g1;
+ commit_values.g2 = params.g2;
+ commit_values.h1 = pub_key->h1;
+ commit_values.h2 = pub_key->h2;
+ commit_values.w = pub_key->w;
+ commit_values.F = *F_str;
+ commit_values.R = *R_str;
+ commit_values.NI = *NI;
+
+ sts = NewFfElement(Fp, &c);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // Step 4. The member computes c = Fp.hash(p || g1 || g2 || h1 ||
+ // h2 || w || F || R || NI).
+ sts = FfHash(Fp, &commit_values, sizeof(commit_values), hash_alg, c);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = WriteFfElement(Fp, c, c_str, sizeof(*c_str));
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ DeleteFfElement(&c);
+
+ return sts;
+}
diff --git a/epid/member/src/join_commitment.h b/epid/member/src/join_commitment.h
new file mode 100644
index 0000000..24e8eb0
--- /dev/null
+++ b/epid/member/src/join_commitment.h
@@ -0,0 +1,67 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Host join helper APIs
+/*! \file */
+#ifndef EPID_MEMBER_SRC_JOIN_COMMITMENT_H_
+#define EPID_MEMBER_SRC_JOIN_COMMITMENT_H_
+
+#include "epid/common/errors.h"
+#include "epid/common/types.h" // HashAlg
+
+/// \cond
+typedef struct FiniteField FiniteField;
+typedef struct G1ElemStr G1ElemStr;
+typedef struct FpElemStr FpElemStr;
+typedef struct OctStr256 OctStr256;
+typedef struct OctStr256 IssuerNonce;
+/// \endcond
+
+/// Calculates commitment hash of join commit
+/*!
+
+ \param[in] Fp
+ The finite field.
+
+ \param[in] hash_alg
+ The hash algorithm.
+
+ \param[in] pub_key
+ The public key of the group being joined.
+
+ \param[in] F_str
+ The F value of the join commit.
+
+ \param[in] R_str
+ The R value of the join commit.
+
+ \param[in] NI
+ The nonce chosen by issuer as part of join protocol.
+
+ \param[out] c_str
+ The resulting commitment hash.
+
+ \returns ::EpidStatus
+
+ \see TpmJoinCommit
+ \see TpmJoin
+
+ */
+EpidStatus HashJoinCommitment(FiniteField* Fp, HashAlg hash_alg,
+ GroupPubKey const* pub_key,
+ G1ElemStr const* F_str, G1ElemStr const* R_str,
+ IssuerNonce const* NI, FpElemStr* c_str);
+
+#endif // EPID_MEMBER_SRC_JOIN_COMMITMENT_H_
diff --git a/epid/member/src/nr_prove.c b/epid/member/src/nr_prove.c
deleted file mode 100644
index 6fc7613..0000000
--- a/epid/member/src/nr_prove.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/*############################################################################
- # 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 EpidNrProve implementation.
- */
-#include "epid/common/src/memory.h"
-#include "epid/member/api.h"
-#include "epid/member/src/context.h"
-
-/// Handle SDK Error with Break
-#define BREAK_ON_EPID_ERROR(ret) \
- if (kEpidNoErr != (ret)) { \
- break; \
- }
-
-/// Count of elements in array
-#define COUNT_OF(A) (sizeof(A) / sizeof((A)[0]))
-
-#pragma pack(1)
-/// Storage for values to create commitment in NrProve algorithm
-typedef struct NrVerifyCommitValues {
- BigNumStr p; //!< A large prime (256-bit)
- G1ElemStr g1; //!< Generator of G1 (512-bit)
- G1ElemStr b; //!< (element of G1): part of basic signature Sigma0
- G1ElemStr k; //!< (element of G1): part of basic signature Sigma0
- G1ElemStr bp; //!< (element of G1): one entry in SigRL
- G1ElemStr kp; //!< (element of G1): one entry in SigRL
- G1ElemStr t; //!< element of G1
- G1ElemStr r1; //!< element of G1
- G1ElemStr r2; //!< element of G1
- uint8_t msg[1]; //!< message
-} NrVerifyCommitValues;
-#pragma pack()
-
-EpidStatus EpidNrProve(MemberCtx const* ctx, void const* msg, size_t msg_len,
- BasicSignature const* sig, SigRlEntry const* sigrl_entry,
- NrProof* proof) {
- EpidStatus res = kEpidErr;
- NrVerifyCommitValues* commit_values = NULL;
- size_t const commit_len = sizeof(*commit_values) - 1 + msg_len;
- EcPoint* T = NULL;
- EcPoint* R1 = NULL;
- EcPoint* R2 = NULL;
- FfElement* mu = NULL;
- FfElement* nu = NULL;
- FfElement* rmu = NULL;
- FfElement* rnu = NULL;
- FfElement* c = NULL;
- FfElement* smu = NULL;
- FfElement* snu = NULL;
- EcPoint* B = NULL;
- EcPoint* K = NULL;
- EcPoint* rlB = NULL;
- EcPoint* rlK = NULL;
- FfElement const* f = NULL;
- if (!ctx || (0 != msg_len && !msg) || !sig || !sigrl_entry || !proof)
- return kEpidBadArgErr;
- if (msg_len > ((SIZE_MAX - sizeof(*commit_values)) + 1))
- return kEpidBadArgErr;
- if (!ctx->epid2_params || !ctx->priv_key) return kEpidBadArgErr;
-
- do {
- bool is_identity = false;
- BigNumStr mu_str = {0};
- BigNumStr nu_str = {0};
- BigNumStr rmu_str = {0};
- BigNumStr rnu_str = {0};
- BitSupplier rnd_func = ctx->rnd_func;
- void* rnd_param = ctx->rnd_param;
- FiniteField* Fp = ctx->epid2_params->Fp;
- EcGroup* G1 = ctx->epid2_params->G1;
- static const BigNumStr one = {
- {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}};
-
- // Check required parameters
- if (!ctx->priv_key->f || !rnd_func || !Fp || !G1) return kEpidBadArgErr;
-
- f = ctx->priv_key->f;
-
- commit_values = SAFE_ALLOC(commit_len);
- if (!commit_values) {
- res = kEpidMemAllocErr;
- break;
- }
-
- // The following variables T, R1, R2 (elements of G1), and mu, nu,
- // rmu, rnu, c, smu, snu (256-bit integers) are used.
- res = NewEcPoint(G1, &T);
- BREAK_ON_EPID_ERROR(res);
- res = NewEcPoint(G1, &R1);
- BREAK_ON_EPID_ERROR(res);
- res = NewEcPoint(G1, &R2);
- BREAK_ON_EPID_ERROR(res);
- res = NewFfElement(Fp, &mu);
- BREAK_ON_EPID_ERROR(res);
- res = NewFfElement(Fp, &nu);
- BREAK_ON_EPID_ERROR(res);
- res = NewFfElement(Fp, &rmu);
- BREAK_ON_EPID_ERROR(res);
- res = NewFfElement(Fp, &rnu);
- BREAK_ON_EPID_ERROR(res);
- res = NewFfElement(Fp, &c);
- BREAK_ON_EPID_ERROR(res);
- res = NewFfElement(Fp, &smu);
- BREAK_ON_EPID_ERROR(res);
- res = NewFfElement(Fp, &snu);
- BREAK_ON_EPID_ERROR(res);
- res = NewEcPoint(G1, &B);
- BREAK_ON_EPID_ERROR(res);
- res = NewEcPoint(G1, &K);
- BREAK_ON_EPID_ERROR(res);
- res = NewEcPoint(G1, &rlB);
- BREAK_ON_EPID_ERROR(res);
- res = NewEcPoint(G1, &rlK);
- BREAK_ON_EPID_ERROR(res);
-
- res = ReadEcPoint(G1, (const uint8_t*)&(sig->B), sizeof(sig->B), B);
- BREAK_ON_EPID_ERROR(res);
- res = ReadEcPoint(G1, (const uint8_t*)&(sig->K), sizeof(sig->K), K);
- BREAK_ON_EPID_ERROR(res);
- res = ReadEcPoint(G1, (const uint8_t*)&(sigrl_entry->b),
- sizeof(sigrl_entry->b), rlB);
- BREAK_ON_EPID_ERROR(res);
- res = ReadEcPoint(G1, (const uint8_t*)&(sigrl_entry->k),
- sizeof(sigrl_entry->k), rlK);
- BREAK_ON_EPID_ERROR(res);
-
- // 1. The member chooses random mu from [1, p-1].
- res = FfGetRandom(Fp, &one, rnd_func, rnd_param, mu);
- BREAK_ON_EPID_ERROR(res);
- // 2. The member computes nu = (- f * mu) mod p.
- res = FfMul(Fp, mu, f, nu);
- BREAK_ON_EPID_ERROR(res);
- res = FfNeg(Fp, nu, nu);
- BREAK_ON_EPID_ERROR(res);
- // 3. The member computes T = G1.sscmMultiExp(K', mu, B', nu).
- res = WriteFfElement(Fp, mu, (uint8_t*)&mu_str, sizeof(mu_str));
- BREAK_ON_EPID_ERROR(res);
- res = WriteFfElement(Fp, nu, (uint8_t*)&nu_str, sizeof(nu_str));
- BREAK_ON_EPID_ERROR(res);
- {
- EcPoint const* points[2];
- BigNumStr const* exponents[2];
- points[0] = rlK;
- points[1] = rlB;
- exponents[0] = &mu_str;
- exponents[1] = &nu_str;
- res = EcSscmMultiExp(G1, points, exponents, COUNT_OF(points), T);
- BREAK_ON_EPID_ERROR(res);
- }
- // 4. The member chooses rmu, rnu randomly from [1, p-1].
- res = FfGetRandom(Fp, &one, rnd_func, rnd_param, rmu);
- BREAK_ON_EPID_ERROR(res);
- res = FfGetRandom(Fp, &one, rnd_func, rnd_param, rnu);
- BREAK_ON_EPID_ERROR(res);
- // 5. The member computes R1 = G1.sscmMultiExp(K, rmu, B, rnu).
- res = WriteFfElement(Fp, rmu, (uint8_t*)&rmu_str, sizeof(rmu_str));
- BREAK_ON_EPID_ERROR(res);
- res = WriteFfElement(Fp, rnu, (uint8_t*)&rnu_str, sizeof(rnu_str));
- BREAK_ON_EPID_ERROR(res);
- {
- EcPoint const* points[2];
- BigNumStr const* exponents[2];
- points[0] = K;
- points[1] = B;
- exponents[0] = &rmu_str;
- exponents[1] = &rnu_str;
- res = EcSscmMultiExp(G1, points, exponents, COUNT_OF(points), R1);
- BREAK_ON_EPID_ERROR(res);
- }
- // 6. The member computes R2 = G1.sscmMultiExp(K', rmu, B', rnu).
- {
- EcPoint const* points[2];
- BigNumStr const* exponents[2];
- points[0] = rlK;
- points[1] = rlB;
- exponents[0] = &rmu_str;
- exponents[1] = &rnu_str;
- res = EcSscmMultiExp(G1, points, exponents, COUNT_OF(points), R2);
- BREAK_ON_EPID_ERROR(res);
- }
- // 7. The member computes c = Fp.hash(p || g1 || B || K || B' ||
- // K' || T || R1 || R2 || m). Refer to Section 7.1 for hash
- // operation over a prime field.
-
- // commit_values is allocated such that there are msg_len bytes available
- // starting at commit_values->msg
- if (msg) {
- // Memory copy is used to copy a message of variable length
- if (0 != memcpy_S(&commit_values->msg[0], msg_len, msg, msg_len)) {
- res = kEpidBadArgErr;
- break;
- }
- }
- commit_values->p = ctx->commit_values.p;
- commit_values->g1 = ctx->commit_values.g1;
- commit_values->b = sig->B;
- commit_values->k = sig->K;
- commit_values->bp = sigrl_entry->b;
- commit_values->kp = sigrl_entry->k;
- res = WriteEcPoint(G1, T, (uint8_t*)&commit_values->t,
- sizeof(commit_values->t));
- BREAK_ON_EPID_ERROR(res);
- res = WriteEcPoint(G1, R1, (uint8_t*)&commit_values->r1,
- sizeof(commit_values->r1));
- BREAK_ON_EPID_ERROR(res);
- res = WriteEcPoint(G1, R2, (uint8_t*)&commit_values->r2,
- sizeof(commit_values->r2));
- BREAK_ON_EPID_ERROR(res);
- res = FfHash(Fp, (uint8_t*)commit_values, commit_len, ctx->hash_alg, c);
- BREAK_ON_EPID_ERROR(res);
-
- // 8. The member computes smu = (rmu + c * mu) mod p.
- res = FfMul(Fp, c, mu, smu);
- BREAK_ON_EPID_ERROR(res);
- res = FfAdd(Fp, rmu, smu, smu);
- BREAK_ON_EPID_ERROR(res);
- // 9. The member computes snu = (rnu + c * nu) mod p.
- res = FfMul(Fp, c, nu, snu);
- BREAK_ON_EPID_ERROR(res);
- res = FfAdd(Fp, rnu, snu, snu);
- BREAK_ON_EPID_ERROR(res);
- // 10. The member outputs sigma = (T, c, smu, snu), a non-revoked
- // proof. If G1.is_identity(T) = true, the member also outputs
- // "failed".
-
- proof->T = commit_values->t;
- res = WriteFfElement(Fp, c, (uint8_t*)&proof->c, sizeof(proof->c));
- BREAK_ON_EPID_ERROR(res);
- res = WriteFfElement(Fp, smu, (uint8_t*)&proof->smu, sizeof(proof->smu));
- BREAK_ON_EPID_ERROR(res);
- res = WriteFfElement(Fp, snu, (uint8_t*)&proof->snu, sizeof(proof->snu));
- BREAK_ON_EPID_ERROR(res);
-
- res = EcIsIdentity(G1, T, &is_identity);
- BREAK_ON_EPID_ERROR(res);
- if (is_identity) {
- res = kEpidSigRevokedInSigRl;
- BREAK_ON_EPID_ERROR(res);
- }
- res = kEpidNoErr;
- } while (0);
-
- f = NULL;
- SAFE_FREE(commit_values)
- DeleteEcPoint(&T);
- DeleteEcPoint(&R1);
- DeleteEcPoint(&R2);
- DeleteFfElement(&mu);
- DeleteFfElement(&nu);
- DeleteFfElement(&rmu);
- DeleteFfElement(&rnu);
- DeleteFfElement(&c);
- DeleteFfElement(&smu);
- DeleteFfElement(&snu);
- DeleteEcPoint(&B);
- DeleteEcPoint(&K);
- DeleteEcPoint(&rlB);
- DeleteEcPoint(&rlK);
-
- return res;
-}
diff --git a/epid/member/src/nrprove.c b/epid/member/src/nrprove.c
new file mode 100644
index 0000000..8bc05e2
--- /dev/null
+++ b/epid/member/src/nrprove.c
@@ -0,0 +1,91 @@
+/*############################################################################
+ # Copyright 2016-2017 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 EpidNrProve implementation.
+ */
+#include <epid/member/api.h>
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "epid/common/stdtypes.h"
+#include "epid/member/src/context.h"
+#include "epid/common/types.h"
+#include "epid/common/src/epid2params.h"
+#include "epid/member/tpm/nrprove.h"
+#include "epid/member/src/nrprove_commitment.h"
+
+/// Handle SDK Error with Break
+#define BREAK_ON_EPID_ERROR(ret) \
+ if (kEpidNoErr != (ret)) { \
+ break; \
+ }
+
+static bool IsIdentity(G1ElemStr const* elem_str) {
+ unsigned char* bytes = (unsigned char*)elem_str;
+ if (!bytes) {
+ return false;
+ } else {
+ size_t i = 0;
+ for (i = 0; i < sizeof(*elem_str); i++) {
+ if (0 != bytes[i]) return false;
+ }
+ }
+ return true;
+}
+
+EpidStatus EpidNrProve(MemberCtx const* ctx, void const* msg, size_t msg_len,
+ BasicSignature const* sig, SigRlEntry const* sigrl_entry,
+ NrProof* proof) {
+ EpidStatus sts = kEpidErr;
+
+ if (!ctx || (0 != msg_len && !msg) || !sig || !sigrl_entry || !proof)
+ return kEpidBadArgErr;
+ if (!ctx->epid2_params) return kEpidBadArgErr;
+
+ do {
+ NrProveCommitOutput commit_out = {0};
+ FiniteField* Fp = ctx->epid2_params->Fp;
+ FpElemStr c_str = {0};
+
+ sts = TpmNrProveCommit(ctx->tpm_ctx, &sig->B, &sig->K, sigrl_entry,
+ &commit_out);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = HashNrProveCommitment(Fp, ctx->hash_alg, &sig->B, &sig->K,
+ sigrl_entry, &commit_out, msg, msg_len, &c_str);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 10. The member outputs sigma = (T, c, smu, snu), a non-revoked
+ // proof. If G1.is_identity(T) = true, the member also outputs
+ // "failed".
+ sts = TpmNrProve(ctx->tpm_ctx, &c_str, &proof->smu, &proof->snu);
+ BREAK_ON_EPID_ERROR(sts);
+
+ proof->T = commit_out.T;
+ proof->c = c_str;
+
+ if (IsIdentity(&proof->T)) {
+ sts = kEpidSigRevokedInSigRl;
+ BREAK_ON_EPID_ERROR(sts);
+ }
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ return sts;
+}
diff --git a/epid/member/src/nrprove_commitment.c b/epid/member/src/nrprove_commitment.c
new file mode 100644
index 0000000..176b992
--- /dev/null
+++ b/epid/member/src/nrprove_commitment.c
@@ -0,0 +1,114 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Host non-revoked proof helper implementation
+/*! \file */
+
+#include "epid/member/src/nrprove_commitment.h"
+
+#include <stdint.h>
+#include "epid/member/tpm/nrprove.h"
+#include "epid/common/math/finitefield.h"
+#include "epid/common/src/memory.h"
+
+/// Handle SDK Error with Break
+#define BREAK_ON_EPID_ERROR(ret) \
+ if (kEpidNoErr != (ret)) { \
+ break; \
+ }
+
+#pragma pack(1)
+/// Storage for values to create commitment in NrProve algorithm
+typedef struct NrProveCommitValues {
+ BigNumStr p; //!< A large prime (256-bit)
+ G1ElemStr g1; //!< Generator of G1 (512-bit)
+ G1ElemStr B; //!< (element of G1): part of basic signature Sigma0
+ G1ElemStr K; //!< (element of G1): part of basic signature Sigma0
+ G1ElemStr rlB; //!< (element of G1): one entry in SigRL
+ G1ElemStr rlK; //!< (element of G1): one entry in SigRL
+ NrProveCommitOutput commit_out; //!< output of NrProveCommit
+ uint8_t msg[1]; //!< message
+} NrProveCommitValues;
+#pragma pack()
+
+EpidStatus HashNrProveCommitment(FiniteField* Fp, HashAlg hash_alg,
+ G1ElemStr const* B_str, G1ElemStr const* K_str,
+ SigRlEntry const* sigrl_entry,
+ NrProveCommitOutput const* commit_out,
+ void const* msg, size_t msg_len,
+ FpElemStr* c_str) {
+ EpidStatus sts = kEpidErr;
+ FfElement* c = NULL;
+ NrProveCommitValues* commit_values = NULL;
+
+ if (!Fp || !B_str || !K_str || !sigrl_entry || !commit_out ||
+ (0 != msg_len && !msg) || !c_str) {
+ return kEpidBadArgErr;
+ }
+
+ if (msg_len >
+ ((SIZE_MAX - sizeof(*commit_values)) + sizeof(*commit_values->msg)))
+ return kEpidBadArgErr;
+
+ do {
+ size_t const commit_len =
+ sizeof(*commit_values) - sizeof(*commit_values->msg) + msg_len;
+ Epid2Params params = {
+#include "epid/common/src/epid2params_ate.inc"
+ };
+
+ commit_values = SAFE_ALLOC(commit_len);
+ if (!commit_values) {
+ sts = kEpidMemAllocErr;
+ BREAK_ON_EPID_ERROR(sts);
+ }
+
+ commit_values->p = params.p;
+ commit_values->g1 = params.g1;
+ commit_values->B = *B_str;
+ commit_values->K = *K_str;
+ commit_values->rlB = sigrl_entry->b;
+ commit_values->rlK = sigrl_entry->k;
+ commit_values->commit_out = *commit_out;
+
+ // commit_values is allocated such that there are msg_len bytes available
+ // starting at commit_values->msg
+ if (msg) {
+ // Memory copy is used to copy a message of variable length
+ if (0 != memcpy_S(&commit_values->msg[0], msg_len, msg, msg_len)) {
+ sts = kEpidBadArgErr;
+ BREAK_ON_EPID_ERROR(sts);
+ }
+ }
+
+ sts = NewFfElement(Fp, &c);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 7. The member computes c = Fp.hash(p || g1 || B || K || B' ||
+ // K' || T || R1 || R2 || m).
+ sts = FfHash(Fp, commit_values, commit_len, hash_alg, c);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = WriteFfElement(Fp, c, c_str, sizeof(*c_str));
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ SAFE_FREE(commit_values);
+ DeleteFfElement(&c);
+
+ return sts;
+}
diff --git a/epid/member/src/nrprove_commitment.h b/epid/member/src/nrprove_commitment.h
new file mode 100644
index 0000000..e6c4cfa
--- /dev/null
+++ b/epid/member/src/nrprove_commitment.h
@@ -0,0 +1,77 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Host non-revoked proof helper APIs
+/*! \file */
+#ifndef EPID_MEMBER_SRC_NRPROVE_COMMITMENT_H_
+#define EPID_MEMBER_SRC_NRPROVE_COMMITMENT_H_
+
+#include <stddef.h>
+#include "epid/common/errors.h"
+#include "epid/common/types.h" // HashAlg
+
+/// \cond
+typedef struct FiniteField FiniteField;
+typedef struct G1ElemStr G1ElemStr;
+typedef struct FpElemStr FpElemStr;
+typedef struct SigRlEntry SigRlEntry;
+typedef struct NrProveCommitOutput NrProveCommitOutput;
+/// \endcond
+
+/// Calculates commitment hash of NrProve commit
+/*!
+
+ \param[in] Fp
+ The finite field.
+
+ \param[in] hash_alg
+ The hash algorithm.
+
+ \param[in] B_str
+ The B value from the ::BasicSignature.
+
+ \param[in] K_str
+ The K value from the ::BasicSignature.
+
+ \param[in] sigrl_entry
+ The signature based revocation list entry corresponding to this
+ proof.
+
+ \param[in] commit_out
+ The output from the NrProve commit.
+
+ \param[in] msg
+ The message.
+
+ \param[in] msg_len
+ The size of message in bytes.
+
+ \param[out] c_str
+ The resulting commitment hash.
+
+ \returns ::EpidStatus
+
+ \see TpmNrProveCommit
+ \see TpmNrProve
+
+ */
+EpidStatus HashNrProveCommitment(FiniteField* Fp, HashAlg hash_alg,
+ G1ElemStr const* B_str, G1ElemStr const* K_str,
+ SigRlEntry const* sigrl_entry,
+ NrProveCommitOutput const* commit_out,
+ void const* msg, size_t msg_len,
+ FpElemStr* c_str);
+
+#endif // EPID_MEMBER_SRC_NRPROVE_COMMITMENT_H_
diff --git a/epid/member/src/precomp.c b/epid/member/src/precomp.c
new file mode 100644
index 0000000..ff7f9cb
--- /dev/null
+++ b/epid/member/src/precomp.c
@@ -0,0 +1,91 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Member pre-computation implementation
+/*! \file */
+#include "epid/member/src/precomp.h"
+
+#include "epid/common/types.h"
+#include "epid/common/src/epid2params.h"
+#include "epid/common/src/grouppubkey.h"
+
+/// Handle SDK Error with Break
+#define BREAK_ON_EPID_ERROR(ret) \
+ if (kEpidNoErr != (ret)) { \
+ break; \
+ }
+
+EpidStatus PrecomputeMemberPairing(Epid2Params_ const* epid2_params,
+ GroupPubKey const* pub_key,
+ G1ElemStr const* A_str,
+ MemberPrecomp* precomp) {
+ EpidStatus sts = kEpidErr;
+
+ GroupPubKey_* pub_key_ = NULL;
+ EcPoint* A = NULL;
+ FfElement* e = NULL;
+
+ if (!epid2_params || !pub_key || !A_str || !precomp) return kEpidBadArgErr;
+
+ do {
+ EcGroup* G1 = epid2_params->G1;
+ EcGroup* G2 = epid2_params->G2;
+ FiniteField* GT = epid2_params->GT;
+ PairingState* ps_ctx = epid2_params->pairing_state;
+ EcPoint* g2 = epid2_params->g2;
+
+ sts = CreateGroupPubKey(pub_key, G1, G2, &pub_key_);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = NewFfElement(GT, &e);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 1. The member computes e12 = pairing(h1, g2).
+ sts = Pairing(ps_ctx, pub_key_->h1, g2, e);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(GT, e, &precomp->e12, sizeof(precomp->e12));
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 2. The member computes e22 = pairing(h2, g2).
+ sts = Pairing(ps_ctx, pub_key_->h2, g2, e);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(GT, e, &precomp->e22, sizeof(precomp->e22));
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 3. The member computes e2w = pairing(h2, w).
+ sts = Pairing(ps_ctx, pub_key_->h2, pub_key_->w, e);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(GT, e, &precomp->e2w, sizeof(precomp->e2w));
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 4. The member computes ea2 = pairing(A, g2).
+ sts = NewEcPoint(G1, &A);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadEcPoint(G1, A_str, sizeof(*A_str), A);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = Pairing(ps_ctx, A, g2, e);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(GT, e, &precomp->ea2, sizeof(precomp->ea2));
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ DeleteGroupPubKey(&pub_key_);
+ DeleteEcPoint(&A);
+ DeleteFfElement(&e);
+
+ return sts;
+}
diff --git a/epid/member/src/precomp.h b/epid/member/src/precomp.h
new file mode 100644
index 0000000..bb361c9
--- /dev/null
+++ b/epid/member/src/precomp.h
@@ -0,0 +1,60 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Member pre-computation API
+/*! \file */
+#ifndef EPID_MEMBER_SRC_PRECOMP_H_
+#define EPID_MEMBER_SRC_PRECOMP_H_
+
+#include "epid/common/errors.h"
+
+/// \cond
+typedef struct Epid2Params_ Epid2Params_;
+typedef struct GroupPubKey GroupPubKey;
+typedef struct G1ElemStr G1ElemStr;
+typedef struct MemberPrecomp MemberPrecomp;
+/// \endcond
+
+/// Precomputes pairing values for member
+/*!
+
+ The the result of the expensive pairing operations can be
+ pre-computed. The pre-computation result can be saved for future
+ sign operations using the same group and private key.
+
+ \param[in] epid2_params
+ The field and group parameters.
+
+ \param[in] pub_key
+ The public key of the group.
+
+ \param[in] A_str
+ The A value of the member private key.
+
+ \param[out] precomp
+ The member pre-computed data.
+
+ \returns ::EpidStatus
+
+ \see TpmJoinCommit
+ \see TpmJoin
+
+ */
+EpidStatus PrecomputeMemberPairing(Epid2Params_ const* epid2_params,
+ GroupPubKey const* pub_key,
+ G1ElemStr const* A_str,
+ MemberPrecomp* precomp);
+
+#endif // EPID_MEMBER_SRC_PRECOMP_H_
diff --git a/epid/member/src/presig.c b/epid/member/src/presig.c
deleted file mode 100644
index 9f057f8..0000000
--- a/epid/member/src/presig.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*############################################################################
- # 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 EpidComputePreSig implementation.
- */
-
-#include "epid/member/src/context.h"
-
-/// Handle SDK Error with Break
-#define BREAK_ON_EPID_ERROR(ret) \
- if (kEpidNoErr != (ret)) { \
- break; \
- }
-
-/// Count of elements in array
-#define COUNT_OF(A) (sizeof(A) / sizeof((A)[0]))
-
-EpidStatus EpidComputePreSig(MemberCtx const* ctx,
- PreComputedSignature* precompsig) {
- EpidStatus res = kEpidNotImpl;
-
- EcPoint* B = NULL;
- EcPoint* K = NULL;
- EcPoint* T = NULL;
- EcPoint* R1 = NULL;
-
- FfElement* R2 = NULL;
-
- FfElement* a = NULL;
- FfElement* b = NULL;
- FfElement* rx = NULL;
- FfElement* rf = NULL;
- FfElement* ra = NULL;
- FfElement* rb = NULL;
- FfElement* t1 = NULL;
- FfElement* t2 = NULL;
- FfElement* f = NULL;
-
- if (!ctx || !precompsig) return kEpidBadArgErr;
- if (!ctx->epid2_params || !ctx->pub_key || !ctx->priv_key)
- return kEpidBadArgErr;
-
- do {
- // handy shorthands:
- EcGroup* G1 = ctx->epid2_params->G1;
- FiniteField* GT = ctx->epid2_params->GT;
- FiniteField* Fp = ctx->epid2_params->Fp;
- EcPoint* h2 = ctx->pub_key->h2;
- EcPoint* A = ctx->priv_key->A;
- FfElement* x = ctx->priv_key->x;
- BigNumStr f_str = {0};
- BigNumStr a_str = {0};
- BigNumStr t1_str = {0};
- BigNumStr rf_str = {0};
- BigNumStr t2_str = {0};
- BigNumStr ra_str = {0};
- static const BigNumStr one = {
- {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}};
-
- if (!G1 || !GT || !Fp || !h2 || !A || !x || !ctx->priv_key->f ||
- !ctx->e12 || !ctx->e22 || !ctx->e2w || !ctx->ea2) {
- res = kEpidBadArgErr;
- BREAK_ON_EPID_ERROR(res);
- }
- f = ctx->priv_key->f;
- // The following variables B, K, T, R1 (elements of G1), R2
- // (elements of GT), a, b, rx, rf, ra, rb, t1, t2 (256-bit
- // integers) are used.
- res = NewEcPoint(G1, &B);
- BREAK_ON_EPID_ERROR(res);
- res = NewEcPoint(G1, &K);
- BREAK_ON_EPID_ERROR(res);
- res = NewEcPoint(G1, &T);
- BREAK_ON_EPID_ERROR(res);
- res = NewEcPoint(G1, &R1);
- BREAK_ON_EPID_ERROR(res);
- res = NewFfElement(GT, &R2);
- BREAK_ON_EPID_ERROR(res);
- res = NewFfElement(Fp, &a);
- BREAK_ON_EPID_ERROR(res);
- res = NewFfElement(Fp, &b);
- BREAK_ON_EPID_ERROR(res);
- res = NewFfElement(Fp, &rx);
- BREAK_ON_EPID_ERROR(res);
- res = NewFfElement(Fp, &rf);
- BREAK_ON_EPID_ERROR(res);
- res = NewFfElement(Fp, &ra);
- BREAK_ON_EPID_ERROR(res);
- res = NewFfElement(Fp, &rb);
- BREAK_ON_EPID_ERROR(res);
- res = NewFfElement(Fp, &t1);
- BREAK_ON_EPID_ERROR(res);
- res = NewFfElement(Fp, &t2);
- BREAK_ON_EPID_ERROR(res);
- // 1. The member expects the pre-computation is done (e12, e22, e2w,
- // ea2). Refer to Section 3.5 for the computation of these
- // values.
-
- // 2. The member verifies gid in public key matches gid in private
- // key.
- // 3. The member computes B = G1.getRandom().
- res = EcGetRandom(G1, ctx->rnd_func, ctx->rnd_param, B);
- BREAK_ON_EPID_ERROR(res);
- // 4. The member computes K = G1.sscmExp(B, f).
- res = WriteFfElement(Fp, f, &f_str, sizeof(f_str));
- BREAK_ON_EPID_ERROR(res);
- res = EcExp(G1, B, &f_str, K);
- BREAK_ON_EPID_ERROR(res);
- // 5. The member chooses randomly an integers a from [1, p-1].
- res = FfGetRandom(Fp, &one, ctx->rnd_func, ctx->rnd_param, a);
- BREAK_ON_EPID_ERROR(res);
- // 6. The member computes T = G1.sscmExp(h2, a).
- res = WriteFfElement(Fp, a, &a_str, sizeof(a_str));
- BREAK_ON_EPID_ERROR(res);
- res = EcExp(G1, h2, &a_str, T);
- BREAK_ON_EPID_ERROR(res);
- // 7. The member computes T = G1.mul(T, A).
- res = EcMul(G1, T, A, T);
- BREAK_ON_EPID_ERROR(res);
- // 8. The member computes b = (a * x) mod p.
- res = FfMul(Fp, a, x, b);
- BREAK_ON_EPID_ERROR(res);
- // 9. The member chooses rx, rf, ra, rb randomly from [1, p-1].
- res = FfGetRandom(Fp, &one, ctx->rnd_func, ctx->rnd_param, rx);
- BREAK_ON_EPID_ERROR(res);
- res = FfGetRandom(Fp, &one, ctx->rnd_func, ctx->rnd_param, rf);
- BREAK_ON_EPID_ERROR(res);
- res = FfGetRandom(Fp, &one, ctx->rnd_func, ctx->rnd_param, ra);
- BREAK_ON_EPID_ERROR(res);
- res = FfGetRandom(Fp, &one, ctx->rnd_func, ctx->rnd_param, rb);
- BREAK_ON_EPID_ERROR(res);
- // 10. The member computes t1 = (- rx) mod p.
- res = FfNeg(Fp, rx, t1);
- BREAK_ON_EPID_ERROR(res);
- // 11. The member computes t2 = (rb - a * rx) mod p.
- res = FfMul(Fp, a, rx, t2);
- BREAK_ON_EPID_ERROR(res);
- res = FfNeg(Fp, t2, t2);
- BREAK_ON_EPID_ERROR(res);
- res = FfAdd(Fp, rb, t2, t2);
- BREAK_ON_EPID_ERROR(res);
- // 12. The member computes R1 = G1.sscmExp(B, rf).
- res = WriteFfElement(Fp, rf, &rf_str, sizeof(rf_str));
- BREAK_ON_EPID_ERROR(res);
- res = EcExp(G1, B, &rf_str, R1);
- BREAK_ON_EPID_ERROR(res);
- // 13. The member computes R2 = GT.sscmMultiExp(ea2, t1, e12, rf,
- // e22, t2, e2w, ra).
- res = WriteFfElement(Fp, t1, &t1_str, sizeof(t1_str));
- BREAK_ON_EPID_ERROR(res);
- res = WriteFfElement(Fp, t2, &t2_str, sizeof(t2_str));
- BREAK_ON_EPID_ERROR(res);
- res = WriteFfElement(Fp, ra, &ra_str, sizeof(ra_str));
- BREAK_ON_EPID_ERROR(res);
- {
- FfElement const* points[4];
- BigNumStr const* exponents[4];
- points[0] = ctx->ea2;
- points[1] = ctx->e12;
- points[2] = ctx->e22;
- points[3] = ctx->e2w;
- exponents[0] = &t1_str;
- exponents[1] = &rf_str;
- exponents[2] = &t2_str;
- exponents[3] = &ra_str;
- res = FfMultiExp(GT, points, exponents, COUNT_OF(points), R2);
- BREAK_ON_EPID_ERROR(res);
- }
- // 14. The member sets and outputs pre-sigma = (B, K, T, a, b, rx,
- // rf, ra, rb, R1, R2).
- res = WriteEcPoint(G1, B, &precompsig->B, sizeof(precompsig->B));
- BREAK_ON_EPID_ERROR(res);
- res = WriteEcPoint(G1, K, &precompsig->K, sizeof(precompsig->K));
- BREAK_ON_EPID_ERROR(res);
- res = WriteEcPoint(G1, T, &precompsig->T, sizeof(precompsig->T));
- BREAK_ON_EPID_ERROR(res);
- res = WriteFfElement(Fp, a, &precompsig->a, sizeof(precompsig->a));
- BREAK_ON_EPID_ERROR(res);
- res = WriteFfElement(Fp, b, &precompsig->b, sizeof(precompsig->b));
- BREAK_ON_EPID_ERROR(res);
- res = WriteFfElement(Fp, rx, &precompsig->rx, sizeof(precompsig->rx));
- BREAK_ON_EPID_ERROR(res);
- res = WriteFfElement(Fp, rf, &precompsig->rf, sizeof(precompsig->rf));
- BREAK_ON_EPID_ERROR(res);
- res = WriteFfElement(Fp, ra, &precompsig->ra, sizeof(precompsig->ra));
- BREAK_ON_EPID_ERROR(res);
- res = WriteFfElement(Fp, rb, &precompsig->rb, sizeof(precompsig->rb));
- BREAK_ON_EPID_ERROR(res);
- res = WriteEcPoint(G1, R1, &precompsig->R1, sizeof(precompsig->R1));
- BREAK_ON_EPID_ERROR(res);
- res = WriteFfElement(GT, R2, &precompsig->R2, sizeof(precompsig->R2));
- BREAK_ON_EPID_ERROR(res);
- // 15. The member stores pre-sigma in the secure storage of the
- // member.
- res = kEpidNoErr;
- } while (0);
-
- f = NULL;
- DeleteEcPoint(&B);
- DeleteEcPoint(&K);
- DeleteEcPoint(&T);
- DeleteEcPoint(&R1);
- DeleteFfElement(&R2);
- DeleteFfElement(&a);
- DeleteFfElement(&b);
- DeleteFfElement(&rx);
- DeleteFfElement(&rf);
- DeleteFfElement(&ra);
- DeleteFfElement(&rb);
- DeleteFfElement(&t1);
- DeleteFfElement(&t2);
-
- return (res);
-}
diff --git a/epid/member/src/privkey.c b/epid/member/src/privkey.c
deleted file mode 100644
index a34d896..0000000
--- a/epid/member/src/privkey.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*############################################################################
- # 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 Private key implementation.
- */
-
-#include "epid/common/src/memory.h"
-#include "epid/member/src/privkey.h"
-
-EpidStatus CreatePrivKey(PrivKey const* priv_key_str, EcGroup* G1,
- FiniteField* Fp, PrivKey_** priv_key) {
- EpidStatus result = kEpidErr;
- PrivKey_* priv_key_ = NULL;
-
- // check parameters
- if (!priv_key_str || !G1 || !Fp || !priv_key) return kEpidBadArgErr;
-
- do {
- priv_key_ = SAFE_ALLOC(sizeof(*priv_key_));
-
- if (!priv_key_) {
- result = kEpidMemAllocErr;
- break;
- }
-
- result = NewEcPoint(G1, &priv_key_->A);
- if (kEpidNoErr != result) break;
-
- result = NewFfElement(Fp, &priv_key_->x);
- if (kEpidNoErr != result) break;
-
- result = NewFfElement(Fp, &priv_key_->f);
- if (kEpidNoErr != result) break;
-
- priv_key_->gid = priv_key_str->gid;
-
- result = ReadEcPoint(G1, &priv_key_str->A, sizeof(priv_key_str->A),
- priv_key_->A);
- if (kEpidNoErr != result) break;
-
- result = ReadFfElement(Fp, &priv_key_str->x, sizeof(priv_key_str->x),
- priv_key_->x);
- if (kEpidNoErr != result) break;
-
- result = ReadFfElement(Fp, &priv_key_str->f, sizeof(priv_key_str->f),
- priv_key_->f);
- if (kEpidNoErr != result) break;
-
- *priv_key = priv_key_;
- result = kEpidNoErr;
- } while (0);
-
- if (kEpidNoErr != result) {
- DeletePrivKey(&priv_key_);
- }
-
- return (result);
-}
-
-void DeletePrivKey(PrivKey_** priv_key) {
- if (priv_key) {
- if (*priv_key) {
- DeleteEcPoint(&((*priv_key)->A));
- DeleteFfElement(&((*priv_key)->x));
- DeleteFfElement(&((*priv_key)->f));
- }
- SAFE_FREE(*priv_key);
- }
-}
diff --git a/epid/member/src/privkey.h b/epid/member/src/privkey.h
deleted file mode 100644
index 1981a67..0000000
--- a/epid/member/src/privkey.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-#ifndef EPID_MEMBER_SRC_PRIVKEY_H_
-#define EPID_MEMBER_SRC_PRIVKEY_H_
-/*!
-* \file
- * \brief Private key private interface.
-* \addtogroup EpidCommon
-* @{
-*/
-#include "epid/common/errors.h"
-#include "epid/common/math/ecgroup.h"
-#include "epid/common/types.h"
-
-/*!
- * \brief
- * Internal implementation of PrivKey
- */
-typedef struct PrivKey_ {
- GroupId gid; ///< group ID
- EcPoint* A; ///< an element in G1
- FfElement* x; ///< an integer between [0, p-1]
- FfElement* f; ///< an integer between [0, p-1]
-} PrivKey_;
-
-/// Constructs internal representation of PrivKey
-/*!
- This function allocates memory and initializes gid, A, x, f parameters.
-
- \param[in] priv_key_str
- Serialized representation of private key
- \param[in] G1
- EcGroup containing element A
- \param[in] Fp
- FiniteField containing elements x and f
- \param[out] priv_key
- Newly created private key: (gid, A, x, f)
-
- \returns ::EpidStatus
-*/
-EpidStatus CreatePrivKey(PrivKey const* priv_key_str, EcGroup* G1,
- FiniteField* Fp, PrivKey_** priv_key);
-
-/// Deallocate storage for internal representation of PrivKey
-/*!
- Frees memory pointed to by Member private key. Nulls the pointer.
-
- \param[in] priv_key
- Member private key to be freed
-*/
-void DeletePrivKey(PrivKey_** priv_key);
-
-/*! @} */
-#endif // EPID_MEMBER_SRC_PRIVKEY_H_
diff --git a/epid/member/src/request_join.c b/epid/member/src/request_join.c
deleted file mode 100644
index 981bfff..0000000
--- a/epid/member/src/request_join.c
+++ /dev/null
@@ -1,418 +0,0 @@
-/*############################################################################
- # 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 EpidRequestJoin implementation.
- */
-
-#include <epid/member/api.h>
-#include <string.h>
-#include "epid/common/src/epid2params.h"
-#include "epid/common/math/finitefield.h"
-#include "epid/common/math/ecgroup.h"
-
-#pragma pack(1)
-/// Storage for values to create commitment in Sign and Verify algorithms
-typedef struct JoinPCommitValues {
- BigNumStr p; ///< Intel(R) EPID 2.0 parameter p
- G1ElemStr g1; ///< Intel(R) EPID 2.0 parameter g1
- G2ElemStr g2; ///< Intel(R) EPID 2.0 parameter g2
- G1ElemStr h1; ///< Group public key value h1
- G1ElemStr h2; ///< Group public key value h2
- G2ElemStr w; ///< Group public key value w
- G1ElemStr F; ///< Variable F computed in algorithm
- G1ElemStr R; ///< Variable R computed in algorithm
- IssuerNonce NI; ///< Nonce
-} JoinPCommitValues;
-#pragma pack()
-
-/// Handle SDK Error with Break
-#define BREAK_ON_EPID_ERROR(ret) \
- if (kEpidNoErr != (ret)) { \
- break; \
- }
-
-EpidStatus EpidRequestJoin(GroupPubKey const* pub_key, IssuerNonce const* ni,
- FpElemStr const* f, BitSupplier rnd_func,
- void* rnd_param, HashAlg hash_alg,
- JoinRequest* join_request) {
- EpidStatus sts;
- static const BigNumStr one = {
- {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}};
- BigNumStr r_str;
- JoinPCommitValues commit_values;
- Epid2Params_* params = NULL;
- FfElement* r_el = NULL;
- FfElement* f_el = NULL;
- FfElement* c_el = NULL;
- FfElement* cf_el = NULL;
- FfElement* s_el = NULL;
- EcPoint* f_pt = NULL;
- EcPoint* r_pt = NULL;
- EcPoint* h1_pt = NULL;
-
- if (!pub_key || !ni || !f || !rnd_func || !join_request) {
- return kEpidBadArgErr;
- }
- if (kSha256 != hash_alg && kSha384 != hash_alg && kSha512 != hash_alg) {
- return kEpidBadArgErr;
- }
-
- do {
- sts = CreateEpid2Params(&params);
- BREAK_ON_EPID_ERROR(sts);
- if (!params->Fp || !params->G1) {
- sts = kEpidBadArgErr;
- break;
- }
- sts = NewFfElement(params->Fp, &r_el);
- BREAK_ON_EPID_ERROR(sts);
- sts = NewFfElement(params->Fp, &f_el);
- BREAK_ON_EPID_ERROR(sts);
- sts = NewFfElement(params->Fp, &c_el);
- BREAK_ON_EPID_ERROR(sts);
- sts = NewFfElement(params->Fp, &cf_el);
- BREAK_ON_EPID_ERROR(sts);
- sts = NewFfElement(params->Fp, &s_el);
- BREAK_ON_EPID_ERROR(sts);
- sts = NewEcPoint(params->G1, &f_pt);
- BREAK_ON_EPID_ERROR(sts);
- sts = NewEcPoint(params->G1, &h1_pt);
- BREAK_ON_EPID_ERROR(sts);
- sts = NewEcPoint(params->G1, &r_pt);
- BREAK_ON_EPID_ERROR(sts);
-
- sts = ReadFfElement(params->Fp, (uint8_t const*)f, sizeof(*f), f_el);
- BREAK_ON_EPID_ERROR(sts);
- sts = ReadEcPoint(params->G1, (uint8_t*)&pub_key->h1, sizeof(pub_key->h1),
- h1_pt);
- BREAK_ON_EPID_ERROR(sts);
-
- // Step 1. The member chooses a random integer r from [1, p-1].
- sts = FfGetRandom(params->Fp, &one, rnd_func, rnd_param, r_el);
- BREAK_ON_EPID_ERROR(sts);
- sts = WriteFfElement(params->Fp, r_el, (uint8_t*)&r_str, sizeof(r_str));
-
- // Step 2. The member computes F = G1.sscmExp(h1, f).
- sts = EcExp(params->G1, h1_pt, (BigNumStr const*)f, f_pt);
- BREAK_ON_EPID_ERROR(sts);
-
- // Step 3. The member computes R = G1.sscmExp(h1, r).
- sts = EcExp(params->G1, h1_pt, (BigNumStr const*)&r_str, r_pt);
- BREAK_ON_EPID_ERROR(sts);
-
- // Step 4. The member computes c = Fp.hash(p || g1 || g2 || h1 || h2 || w ||
- // F || R || NI). Refer to Section 7.1 for hash operation over a prime
- // field.
- sts = WriteBigNum(params->p, sizeof(commit_values.p),
- (uint8_t*)&commit_values.p);
- BREAK_ON_EPID_ERROR(sts);
- sts = WriteEcPoint(params->G1, params->g1, (uint8_t*)&commit_values.g1,
- sizeof(commit_values.g1));
- BREAK_ON_EPID_ERROR(sts);
- sts = WriteEcPoint(params->G2, params->g2, (uint8_t*)&commit_values.g2,
- sizeof(commit_values.g2));
- BREAK_ON_EPID_ERROR(sts);
- commit_values.h1 = pub_key->h1;
- commit_values.h2 = pub_key->h2;
- commit_values.w = pub_key->w;
- sts = WriteEcPoint(params->G1, f_pt, (uint8_t*)&commit_values.F,
- sizeof(commit_values.F));
- BREAK_ON_EPID_ERROR(sts);
- sts = WriteEcPoint(params->G1, r_pt, (uint8_t*)&commit_values.R,
- sizeof(commit_values.R));
- BREAK_ON_EPID_ERROR(sts);
- commit_values.NI = *ni;
- sts = FfHash(params->Fp, (uint8_t*)&commit_values, sizeof(commit_values),
- hash_alg, c_el);
- BREAK_ON_EPID_ERROR(sts);
-
- // Step 5. The member computes s = (r + c * f) mod p.
- sts = FfMul(params->Fp, c_el, f_el, cf_el);
- BREAK_ON_EPID_ERROR(sts);
- sts = FfAdd(params->Fp, r_el, cf_el, s_el);
- BREAK_ON_EPID_ERROR(sts);
-
- // Step 6. The output join request is (F, c, s).
- sts = WriteFfElement(params->Fp, c_el, (uint8_t*)&join_request->c,
- sizeof(join_request->c));
- BREAK_ON_EPID_ERROR(sts);
- sts = WriteFfElement(params->Fp, s_el, (uint8_t*)&join_request->s,
- sizeof(join_request->s));
- BREAK_ON_EPID_ERROR(sts);
- sts = WriteEcPoint(params->G1, f_pt, (uint8_t*)&join_request->F,
- sizeof(join_request->F));
- BREAK_ON_EPID_ERROR(sts);
-
- sts = kEpidNoErr;
- } while (0);
- DeleteEcPoint(&h1_pt);
- DeleteEcPoint(&r_pt);
- DeleteEcPoint(&f_pt);
- DeleteFfElement(&s_el);
- DeleteFfElement(&cf_el);
- DeleteFfElement(&c_el);
- DeleteFfElement(&f_el);
- DeleteFfElement(&r_el);
- DeleteEpid2Params(&params);
- return sts;
-}
-
-// implements section 3.2.2 "Validation of Private Key" from
-// Intel(R) EPID 2.0 Spec
-bool EpidIsPrivKeyInGroup(GroupPubKey const* pub_key, PrivKey const* priv_key) {
- bool result;
-
- // Intel(R) EPID Parameters
- Epid2Params_* params = NULL;
- PairingState* ps = NULL;
-
- // private key
- EcPoint* a_pt = NULL; // an element in G1
- FfElement* x_el = NULL; // an integer between [1, p-1]
- FfElement* f_el = NULL; // an integer between [1, p-1]
-
- // public key
- EcPoint* h1_pt = NULL; // an element in G1
- EcPoint* h2_pt = NULL; // an element in G1
- EcPoint* w_pt = NULL; // an element in G2
-
- // local variables
- EcPoint* t1_pt = NULL; // an element in G2
- EcPoint* t2_pt = NULL; // an element in G1
- FfElement* t3_el = NULL; // an element in GT
- FfElement* t4_el = NULL; // an element in GT
-
- if (!pub_key || !priv_key) {
- return false;
- }
-
- do {
- EpidStatus sts;
- EcGroup* G1 = NULL;
- EcGroup* G2 = NULL;
- FiniteField* GT = NULL;
- FiniteField* Fp = NULL;
- BigNumStr t_str = {0};
-
- sts = CreateEpid2Params(&params);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- G1 = params->G1;
- G2 = params->G2;
- GT = params->GT;
- Fp = params->Fp;
-
- sts = WriteBigNum(params->t, sizeof(t_str), &t_str);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- sts = NewPairingState(G1, G2, GT, &t_str, params->neg, &ps);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- // Load private key
- sts = NewEcPoint(G1, &a_pt);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- sts = ReadEcPoint(G1, &priv_key->A, sizeof(priv_key->A), a_pt);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- sts = NewFfElement(Fp, &x_el);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- sts = ReadFfElement(Fp, &priv_key->x, sizeof(priv_key->x), x_el);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- sts = NewFfElement(Fp, &f_el);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- sts = ReadFfElement(Fp, &priv_key->f, sizeof(priv_key->f), f_el);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- // Load public key
- sts = NewEcPoint(G1, &h1_pt);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- sts = ReadEcPoint(G1, &pub_key->h1, sizeof(pub_key->h1), h1_pt);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- sts = NewEcPoint(G1, &h2_pt);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- sts = ReadEcPoint(G1, &pub_key->h2, sizeof(pub_key->h2), h2_pt);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- sts = NewEcPoint(G2, &w_pt);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- sts = ReadEcPoint(G2, &pub_key->w, sizeof(pub_key->w), w_pt);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- // local variables
- sts = NewEcPoint(G2, &t1_pt);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- sts = NewEcPoint(G1, &t2_pt);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- sts = NewFfElement(GT, &t3_el);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- sts = NewFfElement(GT, &t4_el);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- // Step 1. The member verifies that the gid in the public key matches the
- // gid in the private key.
- if (0 != memcmp(&pub_key->gid, &priv_key->gid, sizeof(priv_key->gid))) {
- result = false;
- break;
- }
-
- // Step 2. The member computes t1 = G2.sscmExp(g2, x).
- sts = EcSscmExp(G2, params->g2, (BigNumStr const*)&priv_key->x, t1_pt);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- // Step 3. The member computes t1 = G2.mul(t1, w).
- sts = EcMul(G2, t1_pt, w_pt, t1_pt);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- // Step 4. The member computes t3 = pairing(A, t1).
- sts = Pairing(ps, t3_el, a_pt, t1_pt);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- // Step 5. The member computes t2 = G1.sscmExp(h1, f).
- sts = EcSscmExp(G1, h1_pt, (BigNumStr const*)&priv_key->f, t2_pt);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- // Step 6. The member computes t2 = G1.mul(t2, g1).
- sts = EcMul(G1, t2_pt, params->g1, t2_pt);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- // Step 7. The member computes t4 = pairing(t2, g2).
- sts = WriteBigNum(params->t, sizeof(t_str), &t_str);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- sts = Pairing(ps, t4_el, t2_pt, params->g2);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
-
- // Step 8. If GT.isEqual(t3, t4) = false, reports bad private key.
- sts = FfIsEqual(GT, t3_el, t4_el, &result);
- if (kEpidNoErr != sts) {
- result = false;
- break;
- }
- } while (0);
-
- // local variables
- DeleteFfElement(&t4_el);
- DeleteFfElement(&t3_el);
- DeleteEcPoint(&t2_pt);
- DeleteEcPoint(&t1_pt);
-
- // public key
- DeleteEcPoint(&w_pt);
- DeleteEcPoint(&h2_pt);
- DeleteEcPoint(&h1_pt);
-
- // private key
- DeleteFfElement(&f_el);
- DeleteFfElement(&x_el);
- DeleteEcPoint(&a_pt);
-
- // Intel(R) EPID Parameters
- DeletePairingState(&ps);
- DeleteEpid2Params(&params);
-
- return result;
-}
diff --git a/epid/member/src/sign.c b/epid/member/src/sign.c
index 976271f..d9ba323 100644
--- a/epid/member/src/sign.c
+++ b/epid/member/src/sign.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,26 +19,29 @@
* \brief EpidSign implementation.
*/
+#include <epid/member/api.h>
+
#include <string.h>
#include "epid/common/src/endian_convert.h"
#include "epid/common/src/memory.h"
#include "epid/common/src/sigrlvalid.h"
-#include "epid/member/api.h"
#include "epid/member/src/context.h"
+/// Handle SDK Error with Break
+#define BREAK_ON_EPID_ERROR(ret) \
+ if (kEpidNoErr != (ret)) { \
+ break; \
+ }
+
EpidStatus EpidSign(MemberCtx const* ctx, void const* msg, size_t msg_len,
void const* basename, size_t basename_len,
- SigRl const* sig_rl, size_t sig_rl_size, EpidSignature* sig,
- size_t sig_len) {
- EpidStatus result = kEpidErr;
+ EpidSignature* sig, size_t sig_len) {
+ EpidStatus sts = kEpidErr;
uint32_t num_sig_rl = 0;
OctStr32 octstr32_0 = {{0x00, 0x00, 0x00, 0x00}};
if (!ctx || !sig) {
return kEpidBadArgErr;
}
- if (!ctx->pub_key) {
- return kEpidBadArgErr;
- }
if (!msg && (0 != msg_len)) {
// if message is non-empty it must have both length and content
return kEpidBadArgErr;
@@ -47,21 +50,17 @@ EpidStatus EpidSign(MemberCtx const* ctx, void const* msg, size_t msg_len,
// if basename is non-empty it must have both length and content
return kEpidBadArgErr;
}
- if (sig_rl && (sig_rl_size < sizeof(SigRl) - sizeof(SigRlEntry))) {
- return kEpidBadArgErr;
- }
- if (sig_rl && EpidGetSigSize(sig_rl) > sig_len) {
+ if (EpidGetSigSize(ctx->sig_rl) > sig_len) {
return kEpidBadArgErr;
}
// 11. The member sets sigma0 = (B, K, T, c, sx, sf, sa, sb).
- result =
- EpidSignBasic(ctx, msg, msg_len, basename, basename_len, &sig->sigma0);
- if (kEpidNoErr != result) {
- return result;
+ sts = EpidSignBasic(ctx, msg, msg_len, basename, basename_len, &sig->sigma0);
+ if (kEpidNoErr != sts) {
+ return sts;
}
- if (!sig_rl) {
+ if (!ctx->sig_rl) {
// 12. If SigRL is not provided as input,
// a. The member sets RLver = 0 and n2 = 0.
// b. The member outputs (sigma0, RLver, n2) and returns "succeeded".
@@ -75,22 +74,20 @@ EpidStatus EpidSign(MemberCtx const* ctx, void const* msg, size_t msg_len,
// the following steps:
// a. The member verifies that gid in public key and in SigRL
// match.
- if (!IsSigRlValid(&ctx->pub_key->gid, sig_rl, sig_rl_size)) {
- return kEpidBadArgErr;
- }
+ // This was done under EpidMemberSetSigRl function.
// b. The member copies RLver and n2 values in SigRL to the
// signature.
- sig->rl_ver = sig_rl->version;
- sig->n2 = sig_rl->n2;
+ sig->rl_ver = ctx->sig_rl->version;
+ sig->n2 = ctx->sig_rl->n2;
// c. For i = 0, ..., n2-1, the member computes sigma[i] =
// nrProve(f, B, K, B[i], K[i]). The details of nrProve()
// will be given in the next subsection.
- num_sig_rl = ntohl(sig_rl->n2);
+ num_sig_rl = ntohl(ctx->sig_rl->n2);
for (i = 0; i < num_sig_rl; i++) {
- result = EpidNrProve(ctx, msg, msg_len, &sig->sigma0, &sig_rl->bk[i],
- &sig->sigma[i]);
- if (kEpidNoErr != result) {
- nr_prove_status = result;
+ sts = EpidNrProve(ctx, msg, msg_len, &sig->sigma0, &ctx->sig_rl->bk[i],
+ &sig->sigma[i]);
+ if (kEpidNoErr != sts) {
+ nr_prove_status = sts;
}
}
if (kEpidNoErr != nr_prove_status) {
diff --git a/epid/member/src/sign_commitment.c b/epid/member/src/sign_commitment.c
new file mode 100644
index 0000000..47d1425
--- /dev/null
+++ b/epid/member/src/sign_commitment.c
@@ -0,0 +1,72 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Host signing helper implementation
+/*! \file */
+
+#include "epid/member/src/sign_commitment.h"
+
+#include "epid/common/math/ecgroup.h"
+#include "epid/common/src/commitment.h"
+#include "epid/member/tpm/sign.h"
+
+/// Handle SDK Error with Break
+#define BREAK_ON_EPID_ERROR(ret) \
+ if (kEpidNoErr != (ret)) { \
+ break; \
+ }
+
+EpidStatus HashSignCommitment(FiniteField* Fp, HashAlg hash_alg,
+ GroupPubKey const* pub_key,
+ SignCommitOutput const* commit_out,
+ void const* msg, size_t msg_len,
+ FpElemStr* c_str) {
+ EpidStatus sts = kEpidErr;
+ FfElement* c = NULL;
+
+ if (!Fp || !commit_out || (0 != msg_len && !msg) || !c_str) {
+ return kEpidBadArgErr;
+ }
+
+ do {
+ CommitValues values = {0};
+ sts = SetKeySpecificCommitValues(pub_key, &values);
+ BREAK_ON_EPID_ERROR(sts);
+
+ values.B = commit_out->B;
+ values.K = commit_out->K;
+ values.T = commit_out->T;
+ values.R1 = commit_out->R1;
+ values.R2 = commit_out->R2;
+
+ sts = NewFfElement(Fp, &c);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 5. The member computes t3 = Fp.hash(p || g1 || g2 || h1 || h2
+ // || w || B || K || T || R1 || R2).
+ // 6. The member computes c = Fp.hash(t3 || m).
+ sts = CalculateCommitmentHash(&values, Fp, hash_alg, msg, msg_len, c);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = WriteFfElement(Fp, c, c_str, sizeof(*c_str));
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ DeleteFfElement(&c);
+
+ return sts;
+}
diff --git a/epid/member/src/sign_commitment.h b/epid/member/src/sign_commitment.h
new file mode 100644
index 0000000..4a7d731
--- /dev/null
+++ b/epid/member/src/sign_commitment.h
@@ -0,0 +1,64 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Host signing helper APIs
+/*! \file */
+#ifndef EPID_MEMBER_SRC_SIGN_COMMITMENT_H_
+#define EPID_MEMBER_SRC_SIGN_COMMITMENT_H_
+
+#include <stddef.h>
+#include "epid/common/errors.h"
+#include "epid/common/types.h" // HashAlg
+
+/// \cond
+typedef struct FiniteField FiniteField;
+typedef struct FpElemStr FpElemStr;
+typedef struct SignCommitOutput SignCommitOutput;
+/// \endcond
+
+/// Calculates commitment hash of sign commit
+/*!
+
+ \param[in] Fp
+ The finite field.
+
+ \param[in] hash_alg
+ The hash algorithm.
+
+ \param[in] commit_out
+ The output from the sign commit.
+
+ \param[in] msg
+ The message.
+
+ \param[in] msg_len
+ The size of message in bytes.
+
+ \param[out] c_str
+ The resulting commitment hash.
+
+ \returns ::EpidStatus
+
+ \see TpmSignCommit
+ \see TpmSign
+
+ */
+EpidStatus HashSignCommitment(FiniteField* Fp, HashAlg hash_alg,
+ GroupPubKey const* pub_key,
+ SignCommitOutput const* commit_out,
+ void const* msg, size_t msg_len,
+ FpElemStr* c_str);
+
+#endif // EPID_MEMBER_SRC_SIGN_COMMITMENT_H_
diff --git a/epid/member/src/signbasic.c b/epid/member/src/signbasic.c
index a8dccb3..62d63d7 100644
--- a/epid/member/src/signbasic.c
+++ b/epid/member/src/signbasic.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -21,9 +21,15 @@
#include <string.h> // memset
-#include "epid/common/src/stack.h"
#include "epid/member/api.h"
#include "epid/member/src/context.h"
+#include "epid/member/tpm/sign.h"
+#include "epid/common/math/ecgroup.h"
+#include "epid/common/math/finitefield.h"
+#include "epid/common/src/epid2params.h"
+#include "epid/member/src/hash_basename.h"
+#include "epid/member/src/sign_commitment.h"
+#include "epid/member/src/allowed_basenames.h"
/// Handle SDK Error with Break
#define BREAK_ON_EPID_ERROR(ret) \
@@ -34,29 +40,8 @@
EpidStatus EpidSignBasic(MemberCtx const* ctx, void const* msg, size_t msg_len,
void const* basename, size_t basename_len,
BasicSignature* sig) {
- EpidStatus result = kEpidErr;
- // Values to be affected by basename
- EcPoint* B = NULL;
- EcPoint* K = NULL;
- EcPoint* R1 = NULL;
- // data from presig
- EcPoint* T = NULL;
- FfElement* a = NULL;
- FfElement* b = NULL;
- FfElement* rx = NULL;
- FfElement* rf = NULL;
- FfElement* ra = NULL;
- FfElement* rb = NULL;
- FfElement* R2 = NULL;
+ EpidStatus sts = kEpidErr;
- // final calculatoin data
- FfElement* sx = NULL;
- FfElement* sf = NULL;
- FfElement* sa = NULL;
- FfElement* sb = NULL;
- FfElement* c_hash = NULL;
- // priv key data, need to clear after use
- BigNumStr f_str = {0};
if (!ctx || !sig) {
return kEpidBadArgErr;
}
@@ -68,205 +53,44 @@ EpidStatus EpidSignBasic(MemberCtx const* ctx, void const* msg, size_t msg_len,
// if basename is non-empty it must have both length and content
return kEpidBadArgErr;
}
- if (!ctx->epid2_params || !ctx->priv_key || !ctx->epid2_params->G1 ||
- !ctx->epid2_params->GT || !ctx->epid2_params->Fp || !ctx->priv_key->f) {
+ if (!ctx->epid2_params) {
return kEpidBadArgErr;
}
do {
- PreComputedSignature curr_presig;
+ FiniteField* Fp = ctx->epid2_params->Fp;
+ EcGroup* G1 = ctx->epid2_params->G1;
G1ElemStr B_str = {0};
- G1ElemStr K_str = {0};
- CommitValues commit_values = ctx->commit_values;
+ SignCommitOutput commit_out = {0};
+ FpElemStr c_str = {0};
- // create all required elemnts
- result = NewEcPoint(ctx->epid2_params->G1, &B);
- BREAK_ON_EPID_ERROR(result);
- result = NewEcPoint(ctx->epid2_params->G1, &K);
- BREAK_ON_EPID_ERROR(result);
- result = NewEcPoint(ctx->epid2_params->G1, &R1);
- BREAK_ON_EPID_ERROR(result);
-
- result = NewEcPoint(ctx->epid2_params->G1, &T);
- BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(ctx->epid2_params->GT, &R2);
- BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(ctx->epid2_params->Fp, &sx);
- BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(ctx->epid2_params->Fp, &sf);
- BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(ctx->epid2_params->Fp, &sa);
- BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(ctx->epid2_params->Fp, &sb);
- BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(ctx->epid2_params->Fp, &c_hash);
- BREAK_ON_EPID_ERROR(result);
-
- result = NewFfElement(ctx->epid2_params->Fp, &a);
- BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(ctx->epid2_params->Fp, &b);
- BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(ctx->epid2_params->Fp, &rx);
- BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(ctx->epid2_params->Fp, &rf);
- BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(ctx->epid2_params->Fp, &ra);
- BREAK_ON_EPID_ERROR(result);
- result = NewFfElement(ctx->epid2_params->Fp, &rb);
- BREAK_ON_EPID_ERROR(result);
-
- if (StackGetSize(ctx->presigs)) {
- // Use existing pre-computed signature
- if (!StackPopN(ctx->presigs, 1, &curr_presig)) {
- result = kEpidErr;
- break;
+ if (basename) {
+ if (!IsBasenameAllowed(ctx->allowed_basenames, basename, basename_len)) {
+ sts = kEpidBadArgErr;
+ BREAK_ON_EPID_ERROR(sts);
}
+ sts = HashBaseName(G1, ctx->hash_alg, basename, basename_len, &B_str);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = TpmSignCommit(ctx->tpm_ctx, &B_str, &commit_out);
} else {
- // generate a new pre-computed signature
- result = EpidComputePreSig(ctx, &curr_presig);
- BREAK_ON_EPID_ERROR(result);
+ sts = TpmSignCommit(ctx->tpm_ctx, NULL, &commit_out);
}
- // 3. If the pre-computed signature pre-sigma exists, the member
- // loads (B, K, T, a, b, rx, rf, ra, rb, R1, R2) from
- // pre-sigma. Refer to Section 4.4 for the computation of
- // these values.
- result = ReadEcPoint(ctx->epid2_params->G1, &curr_presig.B,
- sizeof(curr_presig.B), B);
- BREAK_ON_EPID_ERROR(result);
- result = ReadEcPoint(ctx->epid2_params->G1, &curr_presig.K,
- sizeof(curr_presig.K), K);
- BREAK_ON_EPID_ERROR(result);
- result = ReadEcPoint(ctx->epid2_params->G1, &curr_presig.T,
- sizeof(curr_presig.T), T);
- BREAK_ON_EPID_ERROR(result);
- result = ReadFfElement(ctx->epid2_params->Fp, &curr_presig.a,
- sizeof(curr_presig.a), a);
- BREAK_ON_EPID_ERROR(result);
- result = ReadFfElement(ctx->epid2_params->Fp, &curr_presig.b,
- sizeof(curr_presig.b), b);
- BREAK_ON_EPID_ERROR(result);
- result = ReadFfElement(ctx->epid2_params->Fp, &curr_presig.rx,
- sizeof(curr_presig.rx), rx);
- BREAK_ON_EPID_ERROR(result);
- result = ReadFfElement(ctx->epid2_params->Fp, &curr_presig.rf,
- sizeof(curr_presig.rf), rf);
- BREAK_ON_EPID_ERROR(result);
- result = ReadFfElement(ctx->epid2_params->Fp, &curr_presig.ra,
- sizeof(curr_presig.ra), ra);
- BREAK_ON_EPID_ERROR(result);
- result = ReadFfElement(ctx->epid2_params->Fp, &curr_presig.rb,
- sizeof(curr_presig.rb), rb);
- BREAK_ON_EPID_ERROR(result);
- result = ReadEcPoint(ctx->epid2_params->G1, &curr_presig.R1,
- sizeof(curr_presig.R1), R1);
- BREAK_ON_EPID_ERROR(result);
- result = ReadFfElement(ctx->epid2_params->GT, &curr_presig.R2,
- sizeof(curr_presig.R2), R2);
- BREAK_ON_EPID_ERROR(result);
+ BREAK_ON_EPID_ERROR(sts);
- if (basename) {
- // If basename is provided, the member does the following:
- // make sure basename is registered/allowed
- if (!ContainsBasename(ctx->allowed_basenames, basename, basename_len)) {
- result = kEpidBadArgErr;
- break;
- } else {
- // basename valid, can modify parameters
- // a. The member computes B = G1.hash(bsn).
- result = EcHash(ctx->epid2_params->G1, basename, basename_len,
- ctx->hash_alg, B);
- BREAK_ON_EPID_ERROR(result);
- // b. The member computes K = G1.sscmExp(B, f), where B comes
- // from step a.
- result = WriteFfElement(ctx->epid2_params->Fp, ctx->priv_key->f, &f_str,
- sizeof(f_str));
- BREAK_ON_EPID_ERROR(result);
- result = EcSscmExp(ctx->epid2_params->G1, B, &f_str, K);
- BREAK_ON_EPID_ERROR(result);
- // c. The member computes R1 = G1.sscmExp(B, rf), where B comes
- // from step a.
- result = EcSscmExp(ctx->epid2_params->G1, B,
- (const BigNumStr*)&curr_presig.rf, R1);
- BREAK_ON_EPID_ERROR(result);
- // d. The member over-writes the B, K, and R1 values.
- }
- }
- // 5. The member computes t3 = Fp.hash(p || g1 || g2 || h1 || h2
- // || w || B || K || T || R1 || R2). Refer to Section 7.1 for
- // hash operation over a prime field.
- // 6. The member computes c = Fp.hash(t3 || m).
- result = WriteEcPoint(ctx->epid2_params->G1, B, &B_str, sizeof(B_str));
- BREAK_ON_EPID_ERROR(result);
- result = WriteEcPoint(ctx->epid2_params->G1, K, &K_str, sizeof(K_str));
- BREAK_ON_EPID_ERROR(result);
- result = SetCalculatedCommitValues(&B_str, &K_str, &curr_presig.T, R1,
- ctx->epid2_params->G1, R2,
- ctx->epid2_params->GT, &commit_values);
- BREAK_ON_EPID_ERROR(result);
- result = CalculateCommitmentHash(&commit_values, ctx->epid2_params->Fp,
- ctx->hash_alg, msg, msg_len, c_hash);
- BREAK_ON_EPID_ERROR(result);
- // 7. The member computes sx = (rx + c * x) mod p.
- result = FfMul(ctx->epid2_params->Fp, c_hash, ctx->priv_key->x, sx);
- BREAK_ON_EPID_ERROR(result);
- result = FfAdd(ctx->epid2_params->Fp, rx, sx, sx);
- // 8. The member computes sf = (rf + c * f) mod p.
- result = FfMul(ctx->epid2_params->Fp, c_hash, ctx->priv_key->f, sf);
- BREAK_ON_EPID_ERROR(result);
- result = FfAdd(ctx->epid2_params->Fp, rf, sf, sf);
- BREAK_ON_EPID_ERROR(result);
- // 9. The member computes sa = (ra + c * a) mod p.
- result = FfMul(ctx->epid2_params->Fp, c_hash, a, sa);
- BREAK_ON_EPID_ERROR(result);
- result = FfAdd(ctx->epid2_params->Fp, ra, sa, sa);
- BREAK_ON_EPID_ERROR(result);
- // 10. The member computes sb = (rb + c * b) mod p.
- result = FfMul(ctx->epid2_params->Fp, c_hash, b, sb);
- BREAK_ON_EPID_ERROR(result);
- result = FfAdd(ctx->epid2_params->Fp, rb, sb, sb);
- BREAK_ON_EPID_ERROR(result);
- // 11. The member sets sigma0 = (B, K, T, c, sx, sf, sa, sb).
- result = WriteEcPoint(ctx->epid2_params->G1, B, &sig->B, sizeof(sig->B));
- BREAK_ON_EPID_ERROR(result);
- result = WriteEcPoint(ctx->epid2_params->G1, K, &sig->K, sizeof(sig->K));
- BREAK_ON_EPID_ERROR(result);
- result = WriteEcPoint(ctx->epid2_params->G1, T, &sig->T, sizeof(sig->T));
- BREAK_ON_EPID_ERROR(result);
- result =
- WriteFfElement(ctx->epid2_params->Fp, c_hash, &sig->c, sizeof(sig->c));
- BREAK_ON_EPID_ERROR(result);
- result =
- WriteFfElement(ctx->epid2_params->Fp, sx, &sig->sx, sizeof(sig->sx));
- BREAK_ON_EPID_ERROR(result);
- result =
- WriteFfElement(ctx->epid2_params->Fp, sf, &sig->sf, sizeof(sig->sf));
- BREAK_ON_EPID_ERROR(result);
- result =
- WriteFfElement(ctx->epid2_params->Fp, sa, &sig->sa, sizeof(sig->sa));
- BREAK_ON_EPID_ERROR(result);
- result =
- WriteFfElement(ctx->epid2_params->Fp, sb, &sig->sb, sizeof(sig->sb));
- BREAK_ON_EPID_ERROR(result);
- result = kEpidNoErr;
- } while (0);
- // remove all data
- DeleteEcPoint(&B);
- DeleteEcPoint(&K);
- DeleteEcPoint(&R1);
+ sts = HashSignCommitment(Fp, ctx->hash_alg, &ctx->pub_key, &commit_out, msg,
+ msg_len, &c_str);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = TpmSign(ctx->tpm_ctx, &c_str, &sig->sx, &sig->sf, &sig->sa, &sig->sb);
+ BREAK_ON_EPID_ERROR(sts);
- DeleteEcPoint(&T);
- DeleteFfElement(&R2);
- DeleteFfElement(&sx);
- DeleteFfElement(&sf);
- DeleteFfElement(&sa);
- DeleteFfElement(&sb);
- DeleteFfElement(&c_hash);
- DeleteFfElement(&a);
- DeleteFfElement(&b);
- DeleteFfElement(&rx);
- DeleteFfElement(&rf);
- DeleteFfElement(&ra);
- DeleteFfElement(&rb);
+ sig->B = commit_out.B;
+ sig->K = commit_out.K;
+ sig->T = commit_out.T;
+ sig->c = c_str;
+
+ sts = kEpidNoErr;
+ } while (0);
- return result;
+ return sts;
}
diff --git a/epid/member/tpm/context.h b/epid/member/tpm/context.h
new file mode 100644
index 0000000..dbea8c1
--- /dev/null
+++ b/epid/member/tpm/context.h
@@ -0,0 +1,129 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Sensitive member context APIs
+/*! \file */
+
+#ifndef EPID_MEMBER_TPM_CONTEXT_H_
+#define EPID_MEMBER_TPM_CONTEXT_H_
+
+#include "epid/common/errors.h"
+#include "epid/common/bitsupplier.h"
+
+/// \cond
+typedef struct TpmCtx TpmCtx;
+typedef struct FpElemStr FpElemStr;
+typedef struct Epid2Params_ Epid2Params_;
+typedef struct OctStr256 OctStr256;
+/// \endcond
+
+/*!
+ \addtogroup TpmModule tpm
+ \ingroup EpidMemberModule
+ @{
+*/
+
+/// Creates a new Tpm context
+/*!
+
+ Must be called to create the TPM context that is used by other TPM
+ APIs.
+
+ ::TpmDelete must be called to safely release the TPM context.
+
+ You need to use a cryptographically secure random number generator
+ to create a TPM context using ::TpmCreate. The ::BitSupplier is
+ provided as a function prototype for your own implementation of the
+ random number generator.
+
+ \param[in] rnd_func
+ Random number generator.
+
+ \param[in] rnd_param
+ Pass through user data that will be passed to the user_data
+ parameter of the random number generator.
+
+ \param[in] epid2_params
+ The field and group parameters.
+
+ \param[out] ctx
+ Newly constructed TPM context.
+
+ \returns ::EpidStatus
+
+ \see TpmDelete
+ \see TpmProvision
+
+ */
+EpidStatus TpmCreate(BitSupplier rnd_func, void* rnd_param,
+ Epid2Params_ const* epid2_params, TpmCtx** ctx);
+
+/// Deletes an existing Tpm context.
+/*!
+
+ Must be called to safely release a TPM context created using
+ ::TpmCreate.
+
+ De-initializes the context, frees memory used by the context, and
+ sets the context pointer to NULL.
+
+ \param[in,out] ctx
+ The TPM context. Can be NULL.
+
+ \see TpmCreate
+ */
+void TpmDelete(TpmCtx** ctx);
+
+/// Provisions Tpm with sensitive parameters
+/*!
+
+ \param[in,out] ctx
+ The TPM context.
+
+ \param f_str
+ The f value of the member private key.
+
+ \returns ::EpidStatus
+
+ \see TpmCreate
+ \see TpmInit
+
+ */
+EpidStatus TpmProvision(TpmCtx* ctx, FpElemStr const* f_str);
+
+/// Provisions Tpm with compressed key seed
+/*!
+
+ You must call ::TpmDecompressKey before performing any other
+ operations that use the TPM context.
+
+ \param[in,out] ctx
+ The TPM context.
+
+ \param[in] seed
+ The seed value of the compressed key.
+
+ \returns ::EpidStatus
+
+ \see TpmCreate
+ \see TpmInit
+ \see TpmDecompressKey
+
+ */
+EpidStatus TpmProvisionCompressed(TpmCtx* ctx, OctStr256 const* seed);
+
+/*! @} */
+
+#endif // EPID_MEMBER_TPM_CONTEXT_H_
diff --git a/epid/member/tpm/decompress.h b/epid/member/tpm/decompress.h
new file mode 100644
index 0000000..ee78d45
--- /dev/null
+++ b/epid/member/tpm/decompress.h
@@ -0,0 +1,78 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// TPM key decompression APIs
+/*! \file */
+
+#ifndef EPID_MEMBER_TPM_DECOMPRESS_H_
+#define EPID_MEMBER_TPM_DECOMPRESS_H_
+
+#include "epid/common/errors.h"
+
+/// \cond
+typedef struct TpmCtx TpmCtx;
+typedef struct G1ElemStr G1ElemStr;
+typedef struct G2ElemStr G2ElemStr;
+typedef struct FpElemStr FpElemStr;
+typedef struct FqElemStr FqElemStr;
+/// \endcond
+
+/*!
+ \addtogroup TpmModule tpm
+ \ingroup EpidMemberModule
+ @{
+*/
+
+/// Decompresses provisioned key
+/*!
+
+ If you provision a compressed key using ::TpmProvisionCompressed,
+ you must call ::TpmDecompressKey before performing any other
+ operations that use the TPM context. Once decompressed, the context
+ will maintain the decompressed key for the lifetime of the context.
+
+ \note
+ If the compressed private key has not been provisioned, the result
+ of the decompression is undefined.
+
+ \param[in,out] ctx
+ The TPM context.
+
+ \param[in] h1_str
+ The h1 value of the group public key.
+
+ \param[in] w_str
+ The w value of the group public key.
+
+ \param[in] Ax_str
+ The Ax value of the compressed member private key.
+
+ \param[out] A_str
+ The A value of the member private key.
+
+ \param[out] x_str
+ The x value of the member private key.
+
+ \returns ::EpidStatus
+
+ \see TpmCreate
+ \see TpmProvisionCompressed
+ */
+EpidStatus TpmDecompressKey(TpmCtx* ctx, G1ElemStr const* h1_str,
+ G2ElemStr const* w_str, FqElemStr const* Ax_str,
+ G1ElemStr* A_str, FpElemStr* x_str);
+
+/*! @} */
+#endif // EPID_MEMBER_TPM_DECOMPRESS_H_
diff --git a/epid/member/tpm/init.h b/epid/member/tpm/init.h
new file mode 100644
index 0000000..84de1d3
--- /dev/null
+++ b/epid/member/tpm/init.h
@@ -0,0 +1,77 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Non-sensitive member context APIs
+/*! \file */
+
+#ifndef EPID_MEMBER_TPM_INIT_H_
+#define EPID_MEMBER_TPM_INIT_H_
+
+#include "epid/common/errors.h"
+
+/// \cond
+typedef struct TpmCtx TpmCtx;
+typedef struct G1ElemStr G1ElemStr;
+typedef struct G2ElemStr G2ElemStr;
+typedef struct FpElemStr FpElemStr;
+typedef struct MemberPrecomp MemberPrecomp;
+/// \endcond
+
+/*!
+ \addtogroup TpmModule tpm
+ \ingroup EpidMemberModule
+ @{
+*/
+
+/// Initializes Tpm with non-sensitive parameters
+/*!
+
+ \note Does not check consistency with the provisioned f value. Use
+ ::TpmIsKeyValid to check that the parameters will result in a valid
+ key pair.
+
+ \param[in,out] ctx
+ The TPM context.
+
+ \param[in] A_str
+ The A value of the member private key.
+
+ \param[in] x_str
+ The x value of the member private key.
+
+ \param[in] h1_str
+ The h1 value of the group public key.
+
+ \param[in] h2_str
+ The h2 value of the group public key.
+
+ \param[in] w_str
+ The w value of the group public key.
+
+ \param[in] precomp_str
+ The member pre-computed data.
+
+ \returns ::EpidStatus
+
+ \see TpmCreate
+ \see TpmIsKeyValid
+ */
+EpidStatus TpmInit(TpmCtx* ctx, G1ElemStr const* A_str, FpElemStr const* x_str,
+ G1ElemStr const* h1_str, G1ElemStr const* h2_str,
+ G2ElemStr const* w_str, MemberPrecomp const* precomp_str);
+
+/*! @} */
+
+#endif // EPID_MEMBER_TPM_INIT_H_
diff --git a/epid/member/tpm/join.h b/epid/member/tpm/join.h
new file mode 100644
index 0000000..564ec37
--- /dev/null
+++ b/epid/member/tpm/join.h
@@ -0,0 +1,82 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// TPM join APIs
+/*! \file */
+
+#ifndef EPID_MEMBER_TPM_JOIN_H_
+#define EPID_MEMBER_TPM_JOIN_H_
+
+#include "epid/common/errors.h"
+
+/// \cond
+typedef struct TpmCtx TpmCtx;
+typedef struct G1ElemStr G1ElemStr;
+typedef struct FpElemStr FpElemStr;
+/// \endcond
+
+/*!
+ \addtogroup TpmModule tpm
+ \ingroup EpidMemberModule
+ @{
+*/
+
+/// Performs the first part of the join operation
+/*!
+
+ \param[in,out] ctx
+ The TPM context.
+
+ \param[out] F_str
+ The F value of the join commit.
+
+ \param[out] R_str
+ The R value of the join commit.
+
+ \returns ::EpidStatus
+
+ \see TpmCreate
+ \see TpmProvision
+ \see TpmJoin
+*/
+EpidStatus TpmJoinCommit(TpmCtx* ctx, G1ElemStr* F_str, G1ElemStr* R_str);
+
+/// Performs the last part of the join operation
+/*!
+
+ \note
+ ::TpmJoin must be preceded by a call to ::TpmJoinCommit. Two
+ sequential calls to ::TpmJoin will fail with
+ ::kEpidOutOfSequenceError.
+
+ \param[in] ctx
+ The TPM context.
+
+ \param[in] c_str
+ The join commitment hash.
+
+ \param[out] s_str
+ The s value of the join request.
+
+ \returns ::EpidStatus
+
+ \see TpmCreate
+ \see TpmProvision
+ \see TpmJoinCommit
+ */
+EpidStatus TpmJoin(TpmCtx* ctx, FpElemStr const* c_str, FpElemStr* s_str);
+
+/*! @} */
+#endif // EPID_MEMBER_TPM_JOIN_H_
diff --git a/epid/member/tpm/nrprove.h b/epid/member/tpm/nrprove.h
new file mode 100644
index 0000000..4aa57e7
--- /dev/null
+++ b/epid/member/tpm/nrprove.h
@@ -0,0 +1,106 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// TPM NrProve APIs
+/*! \file */
+
+#ifndef EPID_MEMBER_TPM_NRPROVE_H_
+#define EPID_MEMBER_TPM_NRPROVE_H_
+
+#include "epid/common/errors.h"
+#include "epid/common/types.h"
+
+/// \cond
+typedef struct TpmCtx TpmCtx;
+/// \endcond
+
+/*!
+ \addtogroup TpmModule tpm
+ \ingroup EpidMemberModule
+ @{
+*/
+
+#pragma pack(1)
+/// Result of NrProve Commit
+typedef struct NrProveCommitOutput {
+ G1ElemStr T; ///< T value for NrProof
+ G1ElemStr R1; ///< Serialized G1 element
+ G1ElemStr R2; ///< Serialized G1 element
+} NrProveCommitOutput;
+#pragma pack()
+
+/// Performs the first part of the NrProve operation
+/*!
+
+ \param[in,out] ctx
+ The TPM context.
+
+ \param[in] B_str
+ The B value from the ::BasicSignature.
+
+ \param[in] K_str
+ The K value from the ::BasicSignature.
+
+ \param[in] sigrl_entry
+ The signature based revocation list entry corresponding to this
+ proof.
+
+ \param[out] commit_out
+ The resulting commitment value.
+
+ \returns ::EpidStatus
+
+ \see TpmCreate
+ \see TpmProvision
+ \see TpmInit
+ \see TpmNrProve
+*/
+EpidStatus TpmNrProveCommit(TpmCtx* ctx, G1ElemStr const* B_str,
+ G1ElemStr const* K_str,
+ SigRlEntry const* sigrl_entry,
+ NrProveCommitOutput* commit_out);
+
+/// Performs the last part of the NrProve operation
+/*!
+
+ \note
+ ::TpmNrProve must be preceded by a call to ::TpmNrProveCommit. Two
+ sequential calls to ::TpmNrProve will fail with
+ ::kEpidOutOfSequenceError.
+
+ \param[in,out] ctx
+ The TPM context.
+
+ \param[in] c_str
+ The non-revoked proof commitment hash.
+
+ \param[out] smu_str
+ The smu value in the non-revoked proof.
+
+ \param[out] snu_str
+ The snu value in the non-revoked proof.
+
+ \returns ::EpidStatus
+
+ \see TpmCreate
+ \see TpmProvision
+ \see TpmInit
+ \see TpmNrProveCommit
+ */
+EpidStatus TpmNrProve(TpmCtx* ctx, FpElemStr const* c_str, FpElemStr* smu_str,
+ FpElemStr* snu_str);
+
+/*! @} */
+#endif // EPID_MEMBER_TPM_NRPROVE_H_
diff --git a/epid/member/tpm/presig.h b/epid/member/tpm/presig.h
new file mode 100644
index 0000000..281b204
--- /dev/null
+++ b/epid/member/tpm/presig.h
@@ -0,0 +1,65 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Sensitive pre-computed signature APIs
+/*! \file */
+
+#ifndef EPID_MEMBER_TPM_PRESIG_H_
+#define EPID_MEMBER_TPM_PRESIG_H_
+
+#include <stddef.h>
+
+#include "epid/common/errors.h"
+
+/// \cond
+typedef struct TpmCtx TpmCtx;
+/// \endcond
+
+/*!
+ \addtogroup TpmModule tpm
+ \ingroup EpidMemberModule
+ @{
+*/
+
+/// Extends the TPM's pool of pre-computed signatures.
+/*!
+
+ \param[in,out] ctx
+ The TPM context.
+
+ \param[in] number_presigs
+ The number of pre-computed signatures to add to the pool.
+
+ \returns ::EpidStatus
+
+ \see TpmGetNumPreSigs
+ */
+EpidStatus TpmAddPreSigs(TpmCtx* ctx, size_t number_presigs);
+
+/// Gets the number of pre-computed signatures in the TPM's pool.
+/*!
+
+ \param[in,out] ctx
+ The TPM context.
+
+ \returns
+ Number of pre-computed signatures in TPM's pool
+
+ \see TpmAddPreSigs
+ */
+size_t TpmGetNumPreSigs(TpmCtx const* ctx);
+
+/*! @} */
+#endif // EPID_MEMBER_TPM_PRESIG_H_
diff --git a/epid/member/tpm/sign.h b/epid/member/tpm/sign.h
new file mode 100644
index 0000000..3700d17
--- /dev/null
+++ b/epid/member/tpm/sign.h
@@ -0,0 +1,107 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// TPM signing APIs
+/*! \file */
+
+#ifndef EPID_MEMBER_TPM_SIGN_H_
+#define EPID_MEMBER_TPM_SIGN_H_
+
+#include "epid/common/errors.h"
+#include "epid/common/types.h"
+
+/// \cond
+typedef struct TpmCtx TpmCtx;
+/// \endcond
+
+/*!
+ \addtogroup TpmModule tpm
+ \ingroup EpidMemberModule
+ @{
+*/
+
+#pragma pack(1)
+/// Result of Sign Commit
+typedef struct SignCommitOutput {
+ G1ElemStr B; ///< B value for signature
+ G1ElemStr K; ///< K value for signature
+ G1ElemStr T; ///< T value for signature
+ G1ElemStr R1; ///< Serialized G1 element
+ GtElemStr R2; ///< Serialized GT element
+} SignCommitOutput;
+#pragma pack()
+
+/// Performs the first part of the sign operation
+/*!
+
+ \param[in,out] ctx
+ The TPM context.
+
+ \param[in] B_in_str
+ An optional serialized hash of basename. If NULL a random basename
+ is used.
+
+ \param[out] commit_out
+ The resulting commitment value.
+
+ \returns ::EpidStatus
+
+ \see TpmCreate
+ \see TpmProvision
+ \see TpmInit
+ \see TpmSign
+*/
+EpidStatus TpmSignCommit(TpmCtx* ctx, G1ElemStr const* B_in_str,
+ SignCommitOutput* commit_out);
+
+/// Performs the last part of the sign operation
+/*!
+
+ \note
+ ::TpmSign must be preceded by a call to ::TpmSignCommit. Two
+ sequential calls to ::TpmSign will fail with
+ ::kEpidOutOfSequenceError.
+
+ \param[in] ctx
+ The TPM context.
+
+ \param[in] c_str
+ The sign commitment hash.
+
+ \param[out] sx_str
+ The ::BasicSignature sx value.
+
+ \param[out] sf_str
+ The ::BasicSignature sf value.
+
+ \param[out] sa_str
+ The ::BasicSignature sa value.
+
+ \param[out] sb_str
+ The ::BasicSignature sb value.
+
+
+ \returns ::EpidStatus
+
+ \see TpmCreate
+ \see TpmProvision
+ \see TpmInit
+ \see TpmSignCommit
+ */
+EpidStatus TpmSign(TpmCtx* ctx, FpElemStr const* c_str, FpElemStr* sx_str,
+ FpElemStr* sf_str, FpElemStr* sa_str, FpElemStr* sb_str);
+
+/*! @} */
+#endif // EPID_MEMBER_TPM_SIGN_H_
diff --git a/epid/member/tpm/src/context.c b/epid/member/tpm/src/context.c
new file mode 100644
index 0000000..d968d13
--- /dev/null
+++ b/epid/member/tpm/src/context.c
@@ -0,0 +1,180 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Sensitive member context implementation
+/*! \file */
+
+#include "epid/member/tpm/context.h"
+
+#include <stddef.h>
+
+#include "epid/member/tpm/src/types.h"
+#include "epid/common/src/memory.h"
+#include "epid/common/src/epid2params.h"
+#include "epid/common/src/stack.h"
+#include "epid/common/types.h" // MemberPrecomp
+#include "epid/common/math/finitefield.h"
+#include "epid/common/math/ecgroup.h"
+
+/// Handle Intel(R) EPID Error with Break
+#define BREAK_ON_EPID_ERROR(ret) \
+ if (kEpidNoErr != (ret)) { \
+ break; \
+ }
+
+EpidStatus TpmCreate(BitSupplier rnd_func, void* rnd_param,
+ Epid2Params_ const* epid2_params, TpmCtx** ctx) {
+ EpidStatus sts = kEpidErr;
+ TpmCtx* tpm_ctx = NULL;
+
+ if (!epid2_params || !ctx) {
+ return kEpidBadArgErr;
+ }
+
+ tpm_ctx = SAFE_ALLOC(sizeof(TpmCtx));
+ if (!tpm_ctx) {
+ return kEpidMemAllocErr;
+ }
+
+ do {
+ FiniteField* Fp = epid2_params->Fp;
+
+ if (!CreateStack(sizeof(PreComputedSignature), &tpm_ctx->secret.presigs)) {
+ sts = kEpidMemAllocErr;
+ BREAK_ON_EPID_ERROR(sts);
+ }
+
+ tpm_ctx->epid2_params = epid2_params;
+ tpm_ctx->rnd_func = rnd_func;
+ tpm_ctx->secret.rnd_param = rnd_param;
+ tpm_ctx->secret.sign_pending = false;
+ tpm_ctx->secret.nrprove_pending = false;
+ tpm_ctx->secret.join_pending = false;
+
+ sts = NewFfElement(Fp, &tpm_ctx->secret.a);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(Fp, &tpm_ctx->secret.b);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(Fp, &tpm_ctx->secret.rx);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(Fp, &tpm_ctx->secret.rf);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(Fp, &tpm_ctx->secret.ra);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(Fp, &tpm_ctx->secret.rb);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(Fp, &tpm_ctx->secret.mu);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(Fp, &tpm_ctx->secret.nu);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(Fp, &tpm_ctx->secret.rmu);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(Fp, &tpm_ctx->secret.rnu);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(Fp, &tpm_ctx->secret.r);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = NewFfElement(Fp, (FfElement**)&tpm_ctx->secret.f);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = NewEcPoint(tpm_ctx->epid2_params->G1, (EcPoint**)&tpm_ctx->A);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(Fp, (FfElement**)&tpm_ctx->x);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = NewEcPoint(tpm_ctx->epid2_params->G1, (EcPoint**)&tpm_ctx->h1);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewEcPoint(tpm_ctx->epid2_params->G1, (EcPoint**)&tpm_ctx->h2);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewEcPoint(tpm_ctx->epid2_params->G2, (EcPoint**)&tpm_ctx->w);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = NewFfElement(tpm_ctx->epid2_params->GT, (FfElement**)&tpm_ctx->e12);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(tpm_ctx->epid2_params->GT, (FfElement**)&tpm_ctx->e22);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(tpm_ctx->epid2_params->GT, (FfElement**)&tpm_ctx->e2w);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(tpm_ctx->epid2_params->GT, (FfElement**)&tpm_ctx->ea2);
+ BREAK_ON_EPID_ERROR(sts);
+
+ *ctx = tpm_ctx;
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ if (kEpidNoErr != sts) {
+ TpmDelete(&tpm_ctx);
+ }
+
+ return sts;
+}
+
+void TpmDelete(TpmCtx** ctx) {
+ if (ctx && *ctx) {
+ (*ctx)->secret.rnd_param = NULL;
+ DeleteStack(&(*ctx)->secret.presigs);
+ DeleteFfElement((FfElement**)&(*ctx)->secret.f);
+ DeleteFfElement((FfElement**)&(*ctx)->secret.a);
+ DeleteFfElement((FfElement**)&(*ctx)->secret.b);
+ DeleteFfElement((FfElement**)&(*ctx)->secret.rx);
+ DeleteFfElement((FfElement**)&(*ctx)->secret.rf);
+ DeleteFfElement((FfElement**)&(*ctx)->secret.ra);
+ DeleteFfElement((FfElement**)&(*ctx)->secret.rb);
+ DeleteFfElement((FfElement**)&(*ctx)->secret.mu);
+ DeleteFfElement((FfElement**)&(*ctx)->secret.nu);
+ DeleteFfElement((FfElement**)&(*ctx)->secret.rmu);
+ DeleteFfElement((FfElement**)&(*ctx)->secret.rnu);
+ DeleteFfElement((FfElement**)&(*ctx)->secret.r);
+ DeleteEcPoint((EcPoint**)&((*ctx)->h1));
+ DeleteEcPoint((EcPoint**)&((*ctx)->h2));
+ DeleteEcPoint((EcPoint**)&((*ctx)->A));
+ DeleteFfElement((FfElement**)&(*ctx)->x);
+ DeleteEcPoint((EcPoint**)&((*ctx)->w));
+ DeleteFfElement((FfElement**)&(*ctx)->e12);
+ DeleteFfElement((FfElement**)&(*ctx)->e22);
+ DeleteFfElement((FfElement**)&(*ctx)->e2w);
+ DeleteFfElement((FfElement**)&(*ctx)->ea2);
+ SAFE_FREE(*ctx);
+ }
+}
+
+EpidStatus TpmProvision(TpmCtx* ctx, FpElemStr const* f_str) {
+ EpidStatus sts = kEpidErr;
+ if (!ctx || !ctx->epid2_params) {
+ return kEpidBadArgErr;
+ }
+
+ do {
+ FiniteField* Fp = ctx->epid2_params->Fp;
+ FfElement* f = (FfElement*)ctx->secret.f;
+
+ sts = ReadFfElement(Fp, f_str, sizeof(*f_str), f);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = kEpidNoErr;
+ } while (0);
+
+ return sts;
+}
+
+EpidStatus TpmProvisionCompressed(TpmCtx* ctx, OctStr256 const* seed) {
+ if (!ctx || !seed) {
+ return kEpidBadArgErr;
+ } else {
+ OctStr256* ctx_seed = (OctStr256*)&ctx->secret.seed;
+ *ctx_seed = *seed;
+ }
+ return kEpidNoErr;
+}
diff --git a/epid/member/tpm/src/decompress.c b/epid/member/tpm/src/decompress.c
new file mode 100644
index 0000000..ccd234b
--- /dev/null
+++ b/epid/member/tpm/src/decompress.c
@@ -0,0 +1,271 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// TPM key decompression implementation
+/*! \file */
+
+#include "epid/member/tpm/decompress.h"
+
+#include "epid/member/tpm/src/types.h"
+#include "epid/common/src/epid2params.h"
+#include "epid/common/math/bignum.h"
+#include "epid/common/math/ecgroup.h"
+#include "epid/common/math/finitefield.h"
+#include "epid/common/math/pairing.h"
+#include "epid/common/math/hash.h"
+#include "epid/common/src/memory.h"
+
+/// Handle Intel(R) EPID Error with Break
+#define BREAK_ON_EPID_ERROR(ret) \
+ if (kEpidNoErr != (ret)) { \
+ break; \
+ }
+
+/// Implements the derivation method used by private key decompression
+/// Derives two integers x, f between [1, p-1] from the seed value
+static EpidStatus DeriveXF(Seed const* seed, FpElemStr const* p, FpElemStr* x,
+ FpElemStr* f);
+
+EpidStatus TpmDecompressKey(TpmCtx* ctx, G1ElemStr const* h1_str,
+ G2ElemStr const* w_str, FqElemStr const* Ax_str,
+ G1ElemStr* A_str, FpElemStr* x_str) {
+ EpidStatus sts = kEpidErr;
+
+ FfElement* Ax = NULL;
+ EcPoint* A = NULL;
+ EcPoint* t1 = NULL;
+ EcPoint* w = NULL;
+ FfElement* t3 = NULL;
+ EcPoint* h1 = NULL;
+ EcPoint* t2 = NULL;
+ FfElement* t4 = NULL;
+ BigNum* bn_pminus1 = NULL;
+ FpElemStr f_str = {0};
+
+ if (!ctx || !h1_str || !w_str || !Ax_str || !A_str || !x_str ||
+ !ctx->epid2_params) {
+ return kEpidBadArgErr;
+ }
+
+ do {
+ EcGroup* G1 = ctx->epid2_params->G1;
+ EcGroup* G2 = ctx->epid2_params->G2;
+ FiniteField* GT = ctx->epid2_params->GT;
+ FiniteField* Fp = ctx->epid2_params->Fp;
+ FiniteField* Fq = ctx->epid2_params->Fq;
+ EcPoint const* g1 = ctx->epid2_params->g1;
+ EcPoint const* g2 = ctx->epid2_params->g2;
+ BigNum const* p = ctx->epid2_params->p;
+ PairingState* ps_ctx = ctx->epid2_params->pairing_state;
+ Seed const* seed = &ctx->secret.seed;
+ FfElement* f = (FfElement*)ctx->secret.f;
+
+ FpElemStr p_str = {0};
+ FpElemStr temp_x_str = {0};
+ uint8_t bn_one_str = 1;
+ bool is_valid = false;
+
+ // 1. The member derives x and f from seed. The derivation
+ // function must be the same as the one used in the key
+ // generation above.
+ sts = WriteBigNum(p, sizeof(p_str), &p_str);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = DeriveXF(seed, &p_str, &temp_x_str, &f_str);
+ BREAK_ON_EPID_ERROR(sts);
+ // 2. The member computes A = G1.makePoint(A.x).
+ sts = NewFfElement(Fq, &Ax);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadFfElement(Fq, Ax_str, sizeof(*Ax_str), Ax);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewEcPoint(G1, &A);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = EcMakePoint(G1, Ax, A);
+ BREAK_ON_EPID_ERROR(sts);
+ // 3. The member tests whether (A, x, f) is a valid Intel(R) EPID
+ // private key as follows:
+ // a. It computes t1 = G2.sscmExp(g2, x).
+ sts = NewEcPoint(G2, &t1);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = EcSscmExp(G2, g2, (BigNumStr const*)&temp_x_str, t1);
+ BREAK_ON_EPID_ERROR(sts);
+ // b. It computes t1 = G2.mul(t1, w).
+ sts = NewEcPoint(G2, &w);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadEcPoint(G2, w_str, sizeof(*w_str), w);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = EcMul(G2, t1, w, t1);
+ BREAK_ON_EPID_ERROR(sts);
+ // c. It computes t3 = pairing(A, t1).
+ sts = NewFfElement(GT, &t3);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = Pairing(ps_ctx, A, t1, t3);
+ BREAK_ON_EPID_ERROR(sts);
+ // d. It computes t2 = G1.sscmExp(h1, f).
+ sts = NewEcPoint(G1, &h1);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadEcPoint(G1, h1_str, sizeof(*h1_str), h1);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewEcPoint(G1, &t2);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = EcSscmExp(G1, h1, (BigNumStr const*)&f_str, t2);
+ BREAK_ON_EPID_ERROR(sts);
+ // e. It computes t2 = G1.mul(t2, g1).
+ sts = EcMul(G1, t2, g1, t2);
+ BREAK_ON_EPID_ERROR(sts);
+ // f. It computes t4 = pairing(t2, g2).
+ sts = NewFfElement(GT, &t4);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = Pairing(ps_ctx, t2, g2, t4);
+ BREAK_ON_EPID_ERROR(sts);
+ // g. If GT.isEqual(t3, t4) = false
+ sts = FfIsEqual(GT, t3, t4, &is_valid);
+ BREAK_ON_EPID_ERROR(sts);
+ if (!is_valid) {
+ // i. It computes t3 = GT.exp(t3, p-1).
+ sts = NewBigNum(sizeof(BigNumStr), &bn_pminus1);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadBigNum(&bn_one_str, sizeof(bn_one_str), bn_pminus1);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = BigNumSub(p, bn_pminus1, bn_pminus1);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = FfExp(GT, t3, bn_pminus1, t3);
+ BREAK_ON_EPID_ERROR(sts);
+ // ii. If GT.isEqual(t3, t4) = false again, it reports bad
+ // Intel(R) EPID private key and exits.
+ sts = FfIsEqual(GT, t3, t4, &is_valid);
+ BREAK_ON_EPID_ERROR(sts);
+ if (!is_valid) {
+ sts = kEpidBadArgErr; // Invalid Member key
+ BREAK_ON_EPID_ERROR(sts);
+ }
+ // iii. It sets A = G1.inverse(A).
+ sts = EcInverse(G1, A, A);
+ BREAK_ON_EPID_ERROR(sts);
+ }
+ // 4. The decompressed Intel(R) EPID private key is (gid, A, x, f).
+ sts = WriteEcPoint(G1, A, A_str, sizeof(*A_str));
+ BREAK_ON_EPID_ERROR(sts);
+ *x_str = temp_x_str;
+ sts = ReadFfElement(Fp, &f_str, sizeof(f_str), f);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ EpidZeroMemory(&f_str, sizeof(f_str));
+ DeleteFfElement(&Ax);
+ DeleteEcPoint(&A);
+ DeleteEcPoint(&t1);
+ DeleteEcPoint(&w);
+ DeleteFfElement(&t3);
+ DeleteEcPoint(&h1);
+ DeleteEcPoint(&t2);
+ DeleteFfElement(&t4);
+ DeleteBigNum(&bn_pminus1);
+
+ return sts;
+}
+
+/// Hash message buffer
+typedef struct HashMsg {
+ /// Message to be hashed
+ char data[11];
+} HashMsg;
+
+static EpidStatus DeriveXF(Seed const* seed, FpElemStr const* p, FpElemStr* x,
+ FpElemStr* f) {
+ EpidStatus sts = kEpidErr;
+
+ BigNum* bn_x = 0;
+ BigNum* bn_f = 0;
+ BigNum* bn_p = 0;
+
+#pragma pack(1)
+ struct {
+ Seed seed;
+ HashMsg msg;
+ } hashbuf;
+#pragma pack()
+
+ do {
+ HashMsg msgstr = {{
+ 0x00, 0x45, 0x43, 0x43, 0x2d, 0x53, 0x61, 0x66, 0x65, 0x49, 0x44,
+ }};
+
+ Sha256Digest digest[2] = {0};
+ uint8_t str512[512 / 8] = {0};
+
+ sts = NewBigNum(sizeof(*p), &bn_p);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadBigNum(p, sizeof(*p), bn_p);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = NewBigNum(sizeof(digest), &bn_x);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewBigNum(sizeof(digest), &bn_f);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // compute x
+ hashbuf.seed = *seed;
+ hashbuf.msg = msgstr;
+ hashbuf.msg.data[0] = 0x06;
+ sts = Sha256MessageDigest(&hashbuf, sizeof(hashbuf), &digest[0]);
+ BREAK_ON_EPID_ERROR(sts);
+ hashbuf.msg.data[0] = 0x07;
+ sts = Sha256MessageDigest(&hashbuf, sizeof(hashbuf), &digest[1]);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = ReadBigNum(&digest, sizeof(digest), bn_x);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = BigNumMod(bn_x, bn_p, bn_x);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = WriteBigNum(bn_x, sizeof(str512), str512);
+ BREAK_ON_EPID_ERROR(sts);
+
+ *x = *(FpElemStr*)&str512[sizeof(str512) / 2];
+
+ // compute f
+ hashbuf.seed = *seed;
+ hashbuf.msg = msgstr;
+ hashbuf.msg.data[0] = 0x08;
+ sts = Sha256MessageDigest(&hashbuf, sizeof(hashbuf), &digest[0]);
+ BREAK_ON_EPID_ERROR(sts);
+ hashbuf.msg.data[0] = 0x09;
+ sts = Sha256MessageDigest(&hashbuf, sizeof(hashbuf), &digest[1]);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = ReadBigNum(&digest, sizeof(digest), bn_f);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = BigNumMod(bn_f, bn_p, bn_f);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = WriteBigNum(bn_f, sizeof(str512), str512);
+ BREAK_ON_EPID_ERROR(sts);
+
+ *f = *(FpElemStr*)&str512[sizeof(str512) / 2];
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ EpidZeroMemory(&hashbuf.seed, sizeof(hashbuf.seed));
+ DeleteBigNum(&bn_x);
+ DeleteBigNum(&bn_f);
+ DeleteBigNum(&bn_p);
+
+ return sts;
+}
diff --git a/epid/member/tpm/src/init.c b/epid/member/tpm/src/init.c
new file mode 100644
index 0000000..a17bdc5
--- /dev/null
+++ b/epid/member/tpm/src/init.c
@@ -0,0 +1,115 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Non-sensitive member context implementation
+/*! \file */
+
+#include "epid/member/tpm/init.h"
+
+#include <stddef.h>
+
+#include "epid/member/tpm/src/types.h"
+#include "epid/common/src/epid2params.h"
+#include "epid/common/types.h" // MemberPrecomp
+#include "epid/common/math/finitefield.h"
+#include "epid/common/math/ecgroup.h"
+#include "epid/common/math/pairing.h"
+#include "epid/common/src/memory.h"
+
+/// Handle Intel(R) EPID Error with Break
+#define BREAK_ON_EPID_ERROR(ret) \
+ if (kEpidNoErr != (ret)) { \
+ break; \
+ }
+
+static EpidStatus TpmReadMemberPrecomputation(TpmCtx* ctx,
+ MemberPrecomp const* precomp);
+
+EpidStatus TpmInit(TpmCtx* ctx, G1ElemStr const* A_str, FpElemStr const* x_str,
+ G1ElemStr const* h1_str, G1ElemStr const* h2_str,
+ G2ElemStr const* w_str, MemberPrecomp const* precomp_str) {
+ EpidStatus sts = kEpidErr;
+
+ if (!ctx || !A_str || !x_str || !h1_str || !h2_str || !w_str ||
+ !ctx->epid2_params) {
+ return kEpidBadArgErr;
+ }
+
+ do {
+ EcGroup* G1 = ctx->epid2_params->G1;
+ EcGroup* G2 = ctx->epid2_params->G2;
+ FiniteField* Fp = ctx->epid2_params->Fp;
+ EcPoint* A = (EcPoint*)ctx->A;
+ FfElement* x = (FfElement*)ctx->x;
+ EcPoint* h1 = (EcPoint*)ctx->h1;
+ EcPoint* h2 = (EcPoint*)ctx->h2;
+ EcPoint* w = (EcPoint*)ctx->w;
+
+ sts = ReadEcPoint(G1, A_str, sizeof(*A_str), A);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = ReadFfElement(Fp, x_str, sizeof(*x_str), x);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = ReadEcPoint(G1, h1_str, sizeof(*h1_str), h1);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = ReadEcPoint(G1, h2_str, sizeof(*h2_str), h2);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = ReadEcPoint(G2, w_str, sizeof(*w_str), w);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = TpmReadMemberPrecomputation(ctx, precomp_str);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ return sts;
+}
+
+static EpidStatus TpmReadMemberPrecomputation(TpmCtx* ctx,
+ MemberPrecomp const* precomp) {
+ EpidStatus sts = kEpidErr;
+
+ if (!ctx || !precomp || !ctx->epid2_params) {
+ return kEpidBadArgErr;
+ }
+
+ do {
+ FiniteField* GT = ctx->epid2_params->GT;
+ FfElement* e12 = (FfElement*)ctx->e12;
+ FfElement* e22 = (FfElement*)ctx->e22;
+ FfElement* e2w = (FfElement*)ctx->e2w;
+ FfElement* ea2 = (FfElement*)ctx->ea2;
+
+ sts = ReadFfElement(GT, &precomp->e12, sizeof(precomp->e12), e12);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = ReadFfElement(GT, &precomp->e22, sizeof(precomp->e22), e22);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = ReadFfElement(GT, &precomp->e2w, sizeof(precomp->e2w), e2w);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = ReadFfElement(GT, &precomp->ea2, sizeof(precomp->ea2), ea2);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ return sts;
+}
diff --git a/epid/member/tpm/src/join.c b/epid/member/tpm/src/join.c
new file mode 100644
index 0000000..48db2bc
--- /dev/null
+++ b/epid/member/tpm/src/join.c
@@ -0,0 +1,123 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// TPM join implementation
+/*! \file */
+
+#include "epid/member/tpm/join.h"
+
+#include "epid/member/tpm/src/types.h"
+#include "epid/common/src/epid2params.h"
+#include "epid/common/math/bignum.h"
+#include "epid/common/math/ecgroup.h"
+#include "epid/common/math/finitefield.h"
+
+/// Handle Intel(R) EPID Error with Break
+#define BREAK_ON_EPID_ERROR(ret) \
+ if (kEpidNoErr != (ret)) { \
+ break; \
+ }
+
+EpidStatus TpmJoinCommit(TpmCtx* ctx, G1ElemStr* F_str, G1ElemStr* R_str) {
+ EpidStatus sts = kEpidErr;
+
+ EcPoint* t = NULL; // temporary used for F and R
+
+ if (!ctx || !F_str || !R_str || !ctx->epid2_params) {
+ return kEpidBadArgErr;
+ }
+
+ do {
+ FiniteField* Fp = ctx->epid2_params->Fp;
+ EcGroup* G1 = ctx->epid2_params->G1;
+ FfElement const* f = ctx->secret.f;
+ FfElement* r = ctx->secret.r;
+ EcPoint const* h1 = ctx->h1;
+ const BigNumStr one = {{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}};
+ BigNumStr exp_str = {0};
+
+ sts = NewEcPoint(G1, &t);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 2. The member computes F = G1.sscmExp(h1, f).
+ sts = WriteFfElement(Fp, f, &exp_str, sizeof(exp_str));
+ BREAK_ON_EPID_ERROR(sts);
+ sts = EcExp(G1, h1, (BigNumStr const*)&exp_str, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteEcPoint(G1, t, F_str, sizeof(F_str));
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 1. The member chooses a random integer r from [1, p-1].
+ sts = FfGetRandom(Fp, &one, ctx->rnd_func, ctx->secret.rnd_param, r);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(Fp, r, &exp_str, sizeof(exp_str));
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 3. The member computes R = G1.sscmExp(h1, r).
+ sts = EcExp(G1, h1, (BigNumStr const*)&exp_str, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteEcPoint(G1, t, R_str, sizeof(R_str));
+ BREAK_ON_EPID_ERROR(sts);
+
+ ctx->secret.join_pending = true;
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ DeleteEcPoint(&t);
+
+ return sts;
+}
+
+/// Performs the last part of the join operation
+EpidStatus TpmJoin(TpmCtx* ctx, FpElemStr const* c_str, FpElemStr* s_str) {
+ EpidStatus sts = kEpidErr;
+
+ FfElement* t = NULL; // temporary multiplication sts
+
+ if (!ctx || !c_str || !s_str || !ctx->epid2_params) {
+ return kEpidBadArgErr;
+ }
+
+ if (!ctx->secret.join_pending) {
+ return kEpidOutOfSequenceError;
+ }
+
+ do {
+ FiniteField* Fp = ctx->epid2_params->Fp;
+ FfElement const* f = ctx->secret.f;
+ FfElement* r = ctx->secret.r;
+
+ // Step 5. The member computes s = (r + c * f) mod p.
+ sts = NewFfElement(Fp, &t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadFfElement(Fp, c_str, sizeof(*c_str), t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = FfMul(Fp, t, f, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = FfAdd(Fp, r, t, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(Fp, t, s_str, sizeof(*s_str));
+ BREAK_ON_EPID_ERROR(sts);
+
+ ctx->secret.join_pending = false;
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ DeleteFfElement(&t);
+
+ return sts;
+}
diff --git a/epid/member/tpm/src/nrprove.c b/epid/member/tpm/src/nrprove.c
new file mode 100644
index 0000000..db9ee64
--- /dev/null
+++ b/epid/member/tpm/src/nrprove.c
@@ -0,0 +1,221 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// TPM NrProve implementation
+/*! \file */
+
+#include "epid/member/tpm/nrprove.h"
+
+#include "epid/common/math/ecgroup.h"
+#include "epid/common/math/finitefield.h"
+#include "epid/member/tpm/src/types.h"
+#include "epid/common/src/epid2params.h"
+#include "epid/common/src/memory.h"
+
+/// Handle Intel(R) EPID Error with Break
+#define BREAK_ON_EPID_ERROR(ret) \
+ if (kEpidNoErr != (ret)) { \
+ break; \
+ }
+
+/// Count of elements in array
+#define COUNT_OF(A) (sizeof(A) / sizeof((A)[0]))
+
+EpidStatus TpmNrProveCommit(TpmCtx* ctx, G1ElemStr const* B_str,
+ G1ElemStr const* K_str,
+ SigRlEntry const* sigrl_entry,
+ NrProveCommitOutput* commit_out) {
+ EpidStatus sts = kEpidErr;
+
+ EcPoint* B = NULL; // Also reused for B'
+ EcPoint* K = NULL; // Also reused for K'
+ EcPoint* t = NULL; // temp value in G1 either T, R1, R2
+
+ BigNumStr mu_str = {0};
+ BigNumStr nu_str = {0};
+ BigNumStr rmu_str = {0};
+ BigNumStr rnu_str = {0};
+
+ if (!ctx || !sigrl_entry || !commit_out || !ctx->epid2_params) {
+ return kEpidBadArgErr;
+ }
+
+ do {
+ FiniteField* Fp = ctx->epid2_params->Fp;
+ EcGroup* G1 = ctx->epid2_params->G1;
+ BitSupplier rnd_func = ctx->rnd_func;
+ void* rnd_param = ctx->secret.rnd_param;
+ FfElement const* f = ctx->secret.f;
+ FfElement* mu = ctx->secret.mu;
+ FfElement* nu = ctx->secret.nu;
+ FfElement* rmu = ctx->secret.rmu;
+ FfElement* rnu = ctx->secret.rnu;
+ const BigNumStr one = {{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}};
+
+ sts = NewEcPoint(G1, &B);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewEcPoint(G1, &K);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewEcPoint(G1, &t);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = ReadEcPoint(G1, B_str, sizeof(*B_str), B);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadEcPoint(G1, K_str, sizeof(*K_str), K);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 1. The member chooses random mu from [1, p-1].
+ sts = FfGetRandom(Fp, &one, rnd_func, rnd_param, mu);
+ BREAK_ON_EPID_ERROR(sts);
+ // 2. The member computes nu = (- f * mu) mod p.
+ sts = FfMul(Fp, mu, f, nu);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = FfNeg(Fp, nu, nu);
+ BREAK_ON_EPID_ERROR(sts);
+ // 4. The member chooses rmu, rnu randomly from [1, p-1].
+ sts = FfGetRandom(Fp, &one, rnd_func, rnd_param, rmu);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = FfGetRandom(Fp, &one, rnd_func, rnd_param, rnu);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 5. The member computes R1 = G1.sscmMultiExp(K, rmu, B, rnu).
+ sts = WriteFfElement(Fp, rmu, &rmu_str, sizeof(rmu_str));
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(Fp, rnu, &rnu_str, sizeof(rnu_str));
+ BREAK_ON_EPID_ERROR(sts);
+ {
+ EcPoint const* points[2];
+ BigNumStr const* exponents[2];
+ points[0] = K;
+ points[1] = B;
+ exponents[0] = &rmu_str;
+ exponents[1] = &rnu_str;
+ sts = EcSscmMultiExp(G1, points, exponents, COUNT_OF(points), t);
+ BREAK_ON_EPID_ERROR(sts);
+ }
+ sts = WriteEcPoint(G1, t, &commit_out->R1, sizeof(commit_out->R1));
+ BREAK_ON_EPID_ERROR(sts);
+
+ // re-using B for B' and K for K'
+ sts = ReadEcPoint(G1, &(sigrl_entry->b), sizeof(sigrl_entry->b), B);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadEcPoint(G1, &(sigrl_entry->k), sizeof(sigrl_entry->k), K);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 3. The member computes T = G1.sscmMultiExp(K', mu, B', nu).
+ sts = WriteFfElement(Fp, mu, &mu_str, sizeof(mu_str));
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(Fp, nu, &nu_str, sizeof(nu_str));
+ BREAK_ON_EPID_ERROR(sts);
+ {
+ EcPoint const* points[2];
+ BigNumStr const* exponents[2];
+ points[0] = K;
+ points[1] = B;
+ exponents[0] = &mu_str;
+ exponents[1] = &nu_str;
+ sts = EcSscmMultiExp(G1, points, exponents, COUNT_OF(points), t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteEcPoint(G1, t, &commit_out->T, sizeof(commit_out->T));
+ BREAK_ON_EPID_ERROR(sts);
+ }
+
+ // 6. The member computes R2 = G1.sscmMultiExp(K', rmu, B', rnu).
+ {
+ EcPoint const* points[2];
+ BigNumStr const* exponents[2];
+ points[0] = K;
+ points[1] = B;
+ exponents[0] = &rmu_str;
+ exponents[1] = &rnu_str;
+ sts = EcSscmMultiExp(G1, points, exponents, COUNT_OF(points), t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteEcPoint(G1, t, &commit_out->R2, sizeof(commit_out->R2));
+ BREAK_ON_EPID_ERROR(sts);
+ }
+
+ ctx->secret.nrprove_pending = true;
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ EpidZeroMemory(&mu_str, sizeof(mu_str));
+ EpidZeroMemory(&nu_str, sizeof(nu_str));
+ EpidZeroMemory(&rmu_str, sizeof(rmu_str));
+ EpidZeroMemory(&rnu_str, sizeof(rnu_str));
+ DeleteEcPoint(&B);
+ DeleteEcPoint(&K);
+ DeleteEcPoint(&t);
+
+ return sts;
+}
+
+EpidStatus TpmNrProve(TpmCtx* ctx, FpElemStr const* c_str, FpElemStr* smu_str,
+ FpElemStr* snu_str) {
+ EpidStatus sts = kEpidErr;
+
+ FfElement* t = NULL; // temporary multiplication sts
+ FfElement* c = NULL;
+
+ if (!ctx || !c_str || !smu_str || !snu_str || !ctx->epid2_params) {
+ return kEpidBadArgErr;
+ }
+
+ if (!ctx->secret.nrprove_pending) {
+ return kEpidOutOfSequenceError;
+ }
+
+ do {
+ FiniteField* Fp = ctx->epid2_params->Fp;
+ FfElement const* mu = ctx->secret.mu;
+ FfElement const* nu = ctx->secret.nu;
+ FfElement const* rmu = ctx->secret.rmu;
+ FfElement const* rnu = ctx->secret.rnu;
+
+ sts = NewFfElement(Fp, &t);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = NewFfElement(Fp, &c);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = ReadFfElement(Fp, c_str, sizeof(*c_str), c);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 8. The member computes smu = (rmu + c * mu) mod p.
+ sts = FfMul(Fp, c, mu, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = FfAdd(Fp, rmu, t, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(Fp, t, smu_str, sizeof(*smu_str));
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 9. The member computes snu = (rnu + c * nu) mod p.
+ sts = FfMul(Fp, c, nu, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = FfAdd(Fp, rnu, t, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(Fp, t, snu_str, sizeof(*snu_str));
+ BREAK_ON_EPID_ERROR(sts);
+
+ ctx->secret.nrprove_pending = false;
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ DeleteFfElement(&t);
+ DeleteFfElement(&c);
+
+ return sts;
+}
diff --git a/epid/member/tpm/src/presig-internal.h b/epid/member/tpm/src/presig-internal.h
new file mode 100644
index 0000000..53c5afe
--- /dev/null
+++ b/epid/member/tpm/src/presig-internal.h
@@ -0,0 +1,52 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Pre-computed signature APIs that must only be called inside TPM
+/*! \file */
+
+#ifndef EPID_MEMBER_TPM_SRC_PRESIG_INTERNAL_H_
+#define EPID_MEMBER_TPM_SRC_PRESIG_INTERNAL_H_
+
+#include "epid/common/errors.h"
+
+/// \cond
+typedef struct TpmCtx TpmCtx;
+typedef struct PreComputedSignature PreComputedSignature;
+/// \endcond
+
+/// Provides a precomputed signature
+/*!
+
+ Provides and removes a pre-computed signatures from TPM's pool if
+ available, otherwise provides a newly calculated a precomputed
+ signature.
+
+ \warning
+ Pre-computed signatures must not be accessed outside of the TPM boundary.
+
+ \param[in,out] ctx
+ The TPM context.
+
+ \param[out] presig
+ The pre-computed signature removed from TPM's pool
+
+ \returns ::EpidStatus
+
+ */
+EpidStatus TpmGetPreSig(TpmCtx* ctx, PreComputedSignature* presig);
+
+///@}
+/*! @} */
+#endif // EPID_MEMBER_TPM_SRC_PRESIG_INTERNAL_H_
diff --git a/epid/member/tpm/src/presig.c b/epid/member/tpm/src/presig.c
new file mode 100644
index 0000000..d91ddee
--- /dev/null
+++ b/epid/member/tpm/src/presig.c
@@ -0,0 +1,265 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Sensitive pre-computed signature implementation
+/*! \file */
+
+#include "epid/member/tpm/presig.h"
+
+#include <string.h>
+
+#include "epid/member/tpm/src/types.h"
+#include "epid/common/src/stack.h"
+#include "epid/common/math/ecgroup.h"
+#include "epid/common/math/finitefield.h"
+#include "epid/common/src/epid2params.h"
+#include "epid/common/src/memory.h"
+
+/// Handle Intel(R) EPID Error with Break
+#define BREAK_ON_EPID_ERROR(ret) \
+ if (kEpidNoErr != (ret)) { \
+ break; \
+ }
+
+/// Count of elements in array
+#define COUNT_OF(A) (sizeof(A) / sizeof((A)[0]))
+
+static EpidStatus TpmComputePreSig(TpmCtx const* ctx,
+ PreComputedSignature* precompsig);
+
+EpidStatus TpmAddPreSigs(TpmCtx* ctx, size_t number_presigs) {
+ PreComputedSignature* new_presigs = NULL;
+ size_t i = 0;
+ if (!ctx || !ctx->secret.presigs) return kEpidBadArgErr;
+
+ if (0 == number_presigs) return kEpidNoErr;
+
+ new_presigs = (PreComputedSignature*)StackPushN(ctx->secret.presigs,
+ number_presigs, NULL);
+ if (!new_presigs) return kEpidMemAllocErr;
+
+ for (i = 0; i < number_presigs; i++) {
+ EpidStatus sts = TpmComputePreSig(ctx, &new_presigs[i]);
+ if (kEpidNoErr != sts) {
+ // roll back pre-computed-signature pool
+ StackPopN(ctx->secret.presigs, number_presigs, 0);
+ return sts;
+ }
+ }
+
+ return kEpidNoErr;
+}
+
+size_t TpmGetNumPreSigs(TpmCtx const* ctx) {
+ return (ctx && ctx->secret.presigs) ? StackGetSize(ctx->secret.presigs)
+ : (size_t)0;
+}
+
+EpidStatus TpmGetPreSig(TpmCtx* ctx, PreComputedSignature* presig) {
+ EpidStatus sts = kEpidErr;
+ if (!ctx || !presig) {
+ return kEpidBadArgErr;
+ }
+
+ if (StackGetSize(ctx->secret.presigs)) {
+ // Use existing pre-computed signature
+ if (!StackPopN(ctx->secret.presigs, 1, presig)) {
+ return kEpidErr;
+ }
+ }
+ // generate a new pre-computed signature
+ sts = TpmComputePreSig(ctx, presig);
+ return sts;
+}
+
+/// Performs Pre-computation that can be used to speed up signing
+static EpidStatus TpmComputePreSig(TpmCtx const* ctx,
+ PreComputedSignature* precompsig) {
+ EpidStatus sts = kEpidErr;
+
+ EcPoint* B = NULL;
+ EcPoint* t = NULL; // temporary, used for K, T, R1
+
+ FfElement* R2 = NULL;
+
+ FfElement* a = NULL;
+ FfElement* rx = NULL; // reused for rf
+ FfElement* rb = NULL; // reused for ra
+
+ FfElement* t1 = NULL;
+ FfElement* t2 = NULL;
+ BigNumStr f_str = {0};
+ BigNumStr t1_str = {0};
+ BigNumStr t2_str = {0};
+
+ if (!ctx || !precompsig || !ctx->epid2_params) {
+ return kEpidBadArgErr;
+ }
+
+ do {
+ // handy shorthands:
+ EcGroup* G1 = ctx->epid2_params->G1;
+ FiniteField* GT = ctx->epid2_params->GT;
+ FiniteField* Fp = ctx->epid2_params->Fp;
+ EcPoint const* h2 = ctx->h2;
+ EcPoint const* A = ctx->A;
+ FfElement const* x = ctx->x;
+ FfElement const* f = ctx->secret.f;
+
+ const BigNumStr one = {{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}};
+ // 1. The member expects the pre-computation is done (e12, e22, e2w,
+ // ea2). Refer to Section 3.5 for the computation of these
+ // values.
+
+ // The following variables B, K, T, R1 (elements of G1), R2
+ // (elements of GT), a, b, rx, rf, ra, rb, t1, t2 (256-bit
+ // integers) are used.
+ sts = NewEcPoint(G1, &B);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewEcPoint(G1, &t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(GT, &R2);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(Fp, &a);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(Fp, &rx);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(Fp, &rb);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(Fp, &t1);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewFfElement(Fp, &t2);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 3. The member computes B = G1.getRandom().
+ sts = EcGetRandom(G1, ctx->rnd_func, ctx->secret.rnd_param, B);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = WriteEcPoint(G1, B, &precompsig->B, sizeof(precompsig->B));
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 4. The member computes K = G1.sscmExp(B, f).
+ sts = WriteFfElement(Fp, f, &f_str, sizeof(f_str));
+ BREAK_ON_EPID_ERROR(sts);
+ sts = EcExp(G1, B, &f_str, t);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = WriteEcPoint(G1, t, &precompsig->K, sizeof(precompsig->K));
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 5. The member chooses randomly an integer a from [1, p-1].
+ sts = FfGetRandom(Fp, &one, ctx->rnd_func, ctx->secret.rnd_param, a);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(Fp, a, &precompsig->a, sizeof(precompsig->a));
+ BREAK_ON_EPID_ERROR(sts);
+ // 6. The member computes T = G1.sscmExp(h2, a).
+ sts = EcExp(G1, h2, (BigNumStr*)&precompsig->a, t);
+ BREAK_ON_EPID_ERROR(sts);
+ // 7. The member computes T = G1.mul(T, A).
+ sts = EcMul(G1, t, A, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteEcPoint(G1, t, &precompsig->T, sizeof(precompsig->T));
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 9. The member chooses rx, rf, ra, rb randomly from [1, p-1].
+
+ // note : rx & rb are reused as rf & ra respectively
+ sts = FfGetRandom(Fp, &one, ctx->rnd_func, ctx->secret.rnd_param, rx);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = FfGetRandom(Fp, &one, ctx->rnd_func, ctx->secret.rnd_param, rb);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = WriteFfElement(Fp, rx, &precompsig->rx, sizeof(precompsig->rx));
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(Fp, rb, &precompsig->rb, sizeof(precompsig->rb));
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 10. The member computes t1 = (- rx) mod p.
+ sts = FfNeg(Fp, rx, t1);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 11. The member computes t2 = (rb - a * rx) mod p.
+ sts = FfMul(Fp, a, rx, t2);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = FfNeg(Fp, t2, t2);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = FfAdd(Fp, rb, t2, t2);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 8. The member computes b = (a * x) mod p.
+ sts = FfMul(Fp, a, x, a);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(Fp, a, &precompsig->b, sizeof(precompsig->b));
+ BREAK_ON_EPID_ERROR(sts);
+
+ // reusing rx as rf and rb as ra
+ sts = FfGetRandom(Fp, &one, ctx->rnd_func, ctx->secret.rnd_param, rx);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = FfGetRandom(Fp, &one, ctx->rnd_func, ctx->secret.rnd_param, rb);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = WriteFfElement(Fp, rx, &precompsig->rf, sizeof(precompsig->rf));
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(Fp, rb, &precompsig->ra, sizeof(precompsig->ra));
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 12. The member computes R1 = G1.sscmExp(B, rf).
+ sts = EcExp(G1, B, (BigNumStr*)&precompsig->rf, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteEcPoint(G1, t, &precompsig->R1, sizeof(precompsig->R1));
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 13. The member computes R2 = GT.sscmMultiExp(ea2, t1, e12, rf,
+ // e22, t2, e2w, ra).
+ sts = WriteFfElement(Fp, t1, &t1_str, sizeof(t1_str));
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(Fp, t2, &t2_str, sizeof(t2_str));
+ BREAK_ON_EPID_ERROR(sts);
+ {
+ FfElement const* points[4];
+ BigNumStr const* exponents[4];
+ points[0] = ctx->ea2;
+ points[1] = ctx->e12;
+ points[2] = ctx->e22;
+ points[3] = ctx->e2w;
+ exponents[0] = &t1_str;
+ exponents[1] = (BigNumStr*)&precompsig->rf;
+ exponents[2] = &t2_str;
+ exponents[3] = (BigNumStr*)&precompsig->ra;
+ sts = FfMultiExp(GT, points, exponents, COUNT_OF(points), R2);
+ BREAK_ON_EPID_ERROR(sts);
+ }
+
+ sts = WriteFfElement(GT, R2, &precompsig->R2, sizeof(precompsig->R2));
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ EpidZeroMemory(&f_str, sizeof(f_str));
+ EpidZeroMemory(&t1_str, sizeof(t1_str));
+ EpidZeroMemory(&t2_str, sizeof(t2_str));
+
+ DeleteEcPoint(&B);
+ DeleteEcPoint(&t);
+ DeleteFfElement(&R2);
+ DeleteFfElement(&a);
+ DeleteFfElement(&rx);
+ DeleteFfElement(&rb);
+ DeleteFfElement(&t1);
+ DeleteFfElement(&t2);
+
+ return sts;
+}
diff --git a/epid/member/tpm/src/sign.c b/epid/member/tpm/src/sign.c
new file mode 100644
index 0000000..23d2e83
--- /dev/null
+++ b/epid/member/tpm/src/sign.c
@@ -0,0 +1,204 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// TPM signing implementation
+/*! \file */
+
+#include "epid/member/tpm/sign.h"
+
+#include "epid/common/src/epid2params.h"
+#include "epid/common/math/finitefield.h"
+#include "epid/common/math/ecgroup.h"
+#include "epid/member/tpm/src/types.h"
+#include "epid/member/tpm/src/presig-internal.h"
+#include "epid/common/src/memory.h"
+
+/// Handle Intel(R) EPID Error with Break
+#define BREAK_ON_EPID_ERROR(ret) \
+ if (kEpidNoErr != (ret)) { \
+ break; \
+ }
+
+EpidStatus TpmSignCommit(TpmCtx* ctx, G1ElemStr const* B_in_str,
+ SignCommitOutput* commit_out) {
+ EpidStatus sts = kEpidErr;
+
+ EcPoint* B = NULL;
+ EcPoint* t = NULL; // temp value in G1
+ BigNumStr f_str = {0};
+ PreComputedSignature curr_presig = {0};
+
+ if (!ctx || !commit_out || !ctx->epid2_params) {
+ return kEpidBadArgErr;
+ }
+
+ do {
+ FiniteField* Fp = ctx->epid2_params->Fp;
+ EcGroup* G1 = ctx->epid2_params->G1;
+ FfElement const* f = ctx->secret.f;
+ FfElement* a = ctx->secret.a;
+ FfElement* b = ctx->secret.b;
+ FfElement* rx = ctx->secret.rx;
+ FfElement* rf = ctx->secret.rf;
+ FfElement* ra = ctx->secret.ra;
+ FfElement* rb = ctx->secret.rb;
+
+ sts = NewEcPoint(G1, &B);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewEcPoint(G1, &t);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = TpmGetPreSig(ctx, &curr_presig);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 3. If the pre-computed signature pre-sigma exists, the member
+ // loads (B, K, T, a, b, rx, rf, ra, rb, R1, R2) from
+ // pre-sigma. Refer to Section 4.4 for the computation of
+ // these values.
+ sts = ReadFfElement(Fp, &curr_presig.a, sizeof(curr_presig.a), a);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadFfElement(Fp, &curr_presig.b, sizeof(curr_presig.b), b);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadFfElement(Fp, &curr_presig.rx, sizeof(curr_presig.rx), rx);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadFfElement(Fp, &curr_presig.rf, sizeof(curr_presig.rf), rf);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadFfElement(Fp, &curr_presig.ra, sizeof(curr_presig.ra), ra);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadFfElement(Fp, &curr_presig.rb, sizeof(curr_presig.rb), rb);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // If the basename is provided, use it, otherwise use presig B
+ if (B_in_str) {
+ sts = ReadEcPoint(G1, B_in_str, sizeof(*B_in_str), B);
+ BREAK_ON_EPID_ERROR(sts);
+ commit_out->B = *B_in_str;
+ } else {
+ sts = ReadEcPoint(G1, &curr_presig.B, sizeof(curr_presig.B), B);
+ BREAK_ON_EPID_ERROR(sts);
+ commit_out->B = curr_presig.B;
+ }
+
+ // b. The member computes K = G1.sscmExp(B, f), where B comes
+ // from step a.
+ sts = WriteFfElement(Fp, f, &f_str, sizeof(f_str));
+ BREAK_ON_EPID_ERROR(sts);
+ sts = EcSscmExp(G1, B, &f_str, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteEcPoint(G1, t, &commit_out->K, sizeof(commit_out->K));
+ BREAK_ON_EPID_ERROR(sts);
+
+ // c. The member computes R1 = G1.sscmExp(B, rf), where B comes
+ // from step a.
+ sts = EcSscmExp(G1, B, (const BigNumStr*)&curr_presig.rf, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteEcPoint(G1, t, &commit_out->R1, sizeof(commit_out->R1));
+ BREAK_ON_EPID_ERROR(sts);
+
+ commit_out->T = curr_presig.T;
+ commit_out->R2 = curr_presig.R2;
+ ctx->secret.sign_pending = true;
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ EpidZeroMemory(&f_str, sizeof(f_str));
+ EpidZeroMemory(&curr_presig, sizeof(curr_presig));
+
+ DeleteEcPoint(&B);
+ DeleteEcPoint(&t);
+
+ return sts;
+}
+
+EpidStatus TpmSign(TpmCtx* ctx, FpElemStr const* c_str, FpElemStr* sx_str,
+ FpElemStr* sf_str, FpElemStr* sa_str, FpElemStr* sb_str) {
+ EpidStatus sts = kEpidErr;
+
+ FfElement* t = NULL; // temporary multiplication sts
+ FfElement* c = NULL;
+
+ if (!ctx || !c_str || !sx_str || !sf_str || !sa_str || !sb_str ||
+ !ctx->epid2_params) {
+ return kEpidBadArgErr;
+ }
+
+ if (!ctx->secret.sign_pending) {
+ return kEpidOutOfSequenceError;
+ }
+
+ do {
+ FiniteField* Fp = ctx->epid2_params->Fp;
+ FfElement const* a = ctx->secret.a;
+ FfElement const* b = ctx->secret.b;
+ FfElement const* rx = ctx->secret.rx;
+ FfElement const* rf = ctx->secret.rf;
+ FfElement const* ra = ctx->secret.ra;
+ FfElement const* rb = ctx->secret.rb;
+
+ FfElement const* x = ctx->x;
+ FfElement const* f = ctx->secret.f;
+
+ sts = NewFfElement(Fp, &t);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = NewFfElement(Fp, &c);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = ReadFfElement(Fp, c_str, sizeof(*c_str), c);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 7. The member computes sx = (rx + c * x) mod p.
+ sts = FfMul(Fp, c, x, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = FfAdd(Fp, rx, t, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(Fp, t, sx_str, sizeof(*sx_str));
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 8. The member computes sf = (rf + c * f) mod p.
+ sts = FfMul(Fp, c, f, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = FfAdd(Fp, rf, t, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(Fp, t, sf_str, sizeof(*sf_str));
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 9. The member computes sa = (ra + c * a) mod p.
+ sts = FfMul(Fp, c, a, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = FfAdd(Fp, ra, t, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(Fp, t, sa_str, sizeof(*sa_str));
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 10. The member computes sb = (rb + c * b) mod p.
+ sts = FfMul(Fp, c, b, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = FfAdd(Fp, rb, t, t);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(Fp, t, sb_str, sizeof(*sb_str));
+ BREAK_ON_EPID_ERROR(sts);
+
+ ctx->secret.sign_pending = false;
+
+ sts = kEpidNoErr;
+ } while (0);
+
+ DeleteFfElement(&t);
+ DeleteFfElement(&c);
+
+ return sts;
+}
diff --git a/epid/member/tpm/src/types.h b/epid/member/tpm/src/types.h
new file mode 100644
index 0000000..d22995c
--- /dev/null
+++ b/epid/member/tpm/src/types.h
@@ -0,0 +1,93 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// TPM context structures
+/*! \file */
+
+#ifndef EPID_MEMBER_TPM_SRC_TYPES_H_
+#define EPID_MEMBER_TPM_SRC_TYPES_H_
+
+#include "epid/common/stdtypes.h"
+#include "epid/common/bitsupplier.h"
+#include "epid/common/types.h"
+
+/// \cond
+typedef struct EcPoint EcPoint;
+typedef struct FfElement FfElement;
+typedef struct Stack Stack;
+typedef struct Epid2Params_ Epid2Params_;
+/// \endcond
+
+/// Sensitive Tpm values
+typedef struct TpmSecrets {
+ Seed const seed; ///< Provisioned seed for compressed key
+ FfElement const* f; ///< Member private key f value
+ Stack* presigs; ///< Pre-computed signature pool
+ void* rnd_param; ///< Pointer to user context for rnd_func
+ FfElement* a; ///< Sign related random value
+ FfElement* b; ///< Sign related intermediate value
+ FfElement* rx; ///< Sign related random value
+ FfElement* rf; ///< Sign related random value
+ FfElement* ra; ///< Sign related random value
+ FfElement* rb; ///< Sign related random value
+ FfElement* mu; ///< Nr Proof related random value
+ FfElement* nu; ///< Nr Proof related random value
+ FfElement* rmu; ///< Nr Proof related random value
+ FfElement* rnu; ///< Nr Proof related random value
+ FfElement* r; ///< Join related random value
+ bool sign_pending; ///< split sign in progress
+ bool nrprove_pending; ///< split Nr Proof in progress
+ bool join_pending; ///< split Nr Proof in progress
+} TpmSecrets;
+
+/// TPM State
+typedef struct TpmCtx {
+ Epid2Params_ const* epid2_params; ///< Intel(R) EPID 2.0 params
+ TpmSecrets secret; ///< Tpm information that must be stored securely
+ BitSupplier rnd_func; ///< Pseudo random number generation function
+ EcPoint const* h1; ///< Group public key h1 value
+ EcPoint const* h2; ///< Group group public key h2 value
+ EcPoint const* A; ///< Membership Credential A value
+ FfElement const* x; ///< Membership Credential x value
+ EcPoint const* w; ///< Group group public key w value
+ FfElement const* e12; ///< an element in GT, = pairing (h1, g2)
+ FfElement const* e22; ///< an element in GT, = pairing (h2, g2)
+ FfElement const* e2w; ///< an element in GT, = pairing (h2, w)
+ FfElement const* ea2; ///< an element in GT, = pairing (g1, g2)
+} TpmCtx;
+
+/// Pre-computed signature.
+/*!
+ Serialized form of an intermediate signature that does not depend on
+ basename or message. This can be used to time-shift compute time needed to
+ sign a message.
+ */
+#pragma pack(1)
+typedef struct PreComputedSignature {
+ G1ElemStr B; ///< an element in G1
+ G1ElemStr K; ///< an element in G1
+ G1ElemStr T; ///< an element in G1
+ G1ElemStr R1; ///< an element in G1
+ GtElemStr R2; ///< an element in G1
+ FpElemStr a; ///< an integer between [0, p-1]
+ FpElemStr b; ///< an integer between [0, p-1]
+ FpElemStr rx; ///< an integer between [0, p-1]
+ FpElemStr rf; ///< an integer between [0, p-1]
+ FpElemStr ra; ///< an integer between [0, p-1]
+ FpElemStr rb; ///< an integer between [0, p-1]
+} PreComputedSignature;
+#pragma pack()
+
+#endif // EPID_MEMBER_TPM_SRC_TYPES_H_
diff --git a/epid/member/tpm/src/validatekey.c b/epid/member/tpm/src/validatekey.c
new file mode 100644
index 0000000..0374436
--- /dev/null
+++ b/epid/member/tpm/src/validatekey.c
@@ -0,0 +1,130 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Non-sensitive member context implementation
+/*! \file */
+
+#include "epid/member/tpm/validatekey.h"
+
+#include <stddef.h>
+
+#include "epid/member/tpm/src/types.h"
+#include "epid/common/src/epid2params.h"
+#include "epid/common/types.h" // MemberPrecomp
+#include "epid/common/math/finitefield.h"
+#include "epid/common/math/ecgroup.h"
+#include "epid/common/math/pairing.h"
+#include "epid/common/src/memory.h"
+
+/// Handle Intel(R) EPID Error with Break
+#define BREAK_ON_EPID_ERROR(ret) \
+ if (kEpidNoErr != (ret)) { \
+ break; \
+ }
+
+bool TpmIsKeyValid(TpmCtx* ctx, G1ElemStr const* A_str, FpElemStr const* x_str,
+ G1ElemStr const* h1_str, G2ElemStr const* w_str) {
+ bool key_is_valid = false;
+ EcPoint* t1 = NULL;
+ EcPoint* t2 = NULL;
+ FfElement* t3 = NULL;
+ FfElement* t4 = NULL;
+ EcPoint* A = NULL;
+ EcPoint* h1 = NULL;
+ EcPoint* w = NULL;
+ BigNumStr f_str = {0};
+
+ if (!ctx || !A_str || !x_str || !h1_str || !w_str || !ctx->epid2_params) {
+ return false;
+ }
+
+ do {
+ EpidStatus sts = kEpidErr;
+ FiniteField* Fp = ctx->epid2_params->Fp;
+ EcGroup* G1 = ctx->epid2_params->G1;
+ EcGroup* G2 = ctx->epid2_params->G2;
+ FiniteField* GT = ctx->epid2_params->GT;
+ EcPoint* g1 = ctx->epid2_params->g1;
+ EcPoint* g2 = ctx->epid2_params->g2;
+ PairingState* ps_ctx = ctx->epid2_params->pairing_state;
+ FfElement const* f = ctx->secret.f;
+
+ // 2. The member computes t1 = G2.sscmExp(g2, x).
+ sts = NewEcPoint(G2, &t1);
+ BREAK_ON_EPID_ERROR(sts);
+
+ sts = EcSscmExp(G2, g2, (BigNumStr const*)x_str, t1);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 3. The member computes t1 = G2.mul(t1, w).
+ sts = NewEcPoint(G2, &w);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadEcPoint(G2, w_str, sizeof(*w_str), w);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = EcMul(G2, t1, w, t1);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 4. The member computes t3 = pairing(A, t1).
+ sts = NewFfElement(GT, &t3);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewEcPoint(G1, &A);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadEcPoint(G1, A_str, sizeof(*A_str), A);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = Pairing(ps_ctx, A, t1, t3);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 5. The member computes t2 = G1.sscmExp(h1, f).
+ sts = NewEcPoint(G1, &t2);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = NewEcPoint(G1, &h1);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = ReadEcPoint(G1, h1_str, sizeof(*h1_str), h1);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = WriteFfElement(Fp, f, &f_str, sizeof(f_str));
+ BREAK_ON_EPID_ERROR(sts);
+ sts = EcSscmExp(G1, h1, &f_str, t2);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 6. The member computes t2 = G1.mul(t2, g1).
+ sts = EcMul(G1, t2, g1, t2);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // Step 7. The member computes t4 = pairing(t2, g2).
+ sts = NewFfElement(GT, &t4);
+ BREAK_ON_EPID_ERROR(sts);
+ sts = Pairing(ps_ctx, t2, g2, t4);
+ BREAK_ON_EPID_ERROR(sts);
+
+ // 8. If GT.isEqual(t3, t4) = false, reports bad private key.
+ sts = FfIsEqual(GT, t3, t4, &key_is_valid);
+ if (kEpidNoErr != sts) {
+ key_is_valid = false;
+ BREAK_ON_EPID_ERROR(sts);
+ }
+ } while (0);
+
+ EpidZeroMemory(&f_str, sizeof(f_str));
+
+ DeleteEcPoint(&t1);
+ DeleteEcPoint(&t2);
+ DeleteFfElement(&t3);
+ DeleteFfElement(&t4);
+ DeleteEcPoint(&A);
+ DeleteEcPoint(&h1);
+ DeleteEcPoint(&w);
+
+ return key_is_valid;
+}
diff --git a/epid/member/tpm/unittests/tpm-test.cc b/epid/member/tpm/unittests/tpm-test.cc
new file mode 100644
index 0000000..41fa371
--- /dev/null
+++ b/epid/member/tpm/unittests/tpm-test.cc
@@ -0,0 +1,212 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Tpm unit tests.
+/*!
+ * \file
+ */
+#include <cstring>
+
+#include "gtest/gtest.h"
+
+#include "epid/member/tpm/unittests/tpm-testhelper.h"
+#include "epid/common-testhelper/prng-testhelper.h"
+#include "epid/common-testhelper/errors-testhelper.h"
+#include "epid/common-testhelper/verifier_wrapper-testhelper.h"
+
+extern "C" {
+#include "epid/member/tpm/context.h"
+#include "epid/member/tpm/init.h"
+#include "epid/member/tpm/validatekey.h"
+#include "epid/member/tpm/sign.h"
+#include "epid/common/types.h"
+#include "epid/member/tpm/join.h"
+#include "epid/member/tpm/nrprove.h"
+
+#include "epid/member/src/sign_commitment.h"
+#include "epid/member/src/hash_basename.h"
+#include "epid/member/src/nrprove_commitment.h"
+#include "epid/member/src/precomp.h"
+
+#include "epid/verifier/api.h"
+}
+
+#if !defined(ntohl)
+/// Macro to transform oct str 32 into uint_32
+#define ntohl(u32) \
+ ((uint32_t)(((((unsigned char*)&(u32))[0]) << 24) + \
+ ((((unsigned char*)&(u32))[1]) << 16) + \
+ ((((unsigned char*)&(u32))[2]) << 8) + \
+ (((unsigned char*)&(u32))[3])))
+#endif
+
+namespace {
+//////////////////////////////////////////////////////////////////////////
+// Test showing how to do host signing
+
+// SignsMessageUsingBasenameWithSigRl
+TEST_F(EpidTpmTest, SignsMessageUsingBasenameWithSigRl) {
+ // create TPM
+ Prng my_prng;
+ Epid2ParamsObj epid2params;
+ TpmCtxObj tpm(&Prng::Generate, &my_prng, epid2params);
+
+ // provision TPM
+ const GroupPubKey pub_key = this->kGroupPublicKey;
+ const PrivKey priv_key = this->kMemberPrivateKey;
+ MemberPrecomp precomp = {0};
+ EXPECT_EQ(kEpidNoErr, PrecomputeMemberPairing(epid2params, &pub_key,
+ &priv_key.A, &precomp));
+
+ EXPECT_EQ(kEpidNoErr, TpmProvision(tpm, &priv_key.f));
+ // optional validity check. May not be needed if validity is ensured
+ // by other means
+ EXPECT_TRUE(
+ TpmIsKeyValid(tpm, &priv_key.A, &priv_key.x, &pub_key.h1, &pub_key.w));
+ EXPECT_EQ(kEpidNoErr, TpmInit(tpm, &priv_key.A, &priv_key.x, &pub_key.h1,
+ &pub_key.h2, &pub_key.w, &precomp));
+
+ HashAlg hash_alg = kSha512;
+ auto& bsn = this->kBsn0;
+
+ // In actual implementation check the basename is allowed before
+ // hashing
+
+ G1ElemStr B = {0};
+ EXPECT_EQ(kEpidNoErr, HashBaseName(epid2params.G1(), hash_alg, bsn.data(),
+ bsn.size(), &B));
+
+ // Begin Basic signing
+ SignCommitOutput commit_out = {0};
+ EXPECT_EQ(kEpidNoErr, TpmSignCommit(tpm, &B, &commit_out));
+
+ std::vector<uint8_t> sig_data(sizeof(EpidSignature) - sizeof(NrProof));
+ EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
+ sig->sigma0.B = commit_out.B;
+ sig->sigma0.K = commit_out.K;
+ sig->sigma0.T = commit_out.T;
+
+ auto& msg = this->kMsg0;
+ EXPECT_EQ(kEpidNoErr, HashSignCommitment(epid2params.Fp(), hash_alg, &pub_key,
+ &commit_out, msg.data(), msg.size(),
+ &sig->sigma0.c));
+
+ EXPECT_EQ(kEpidNoErr,
+ TpmSign(tpm, &sig->sigma0.c, &sig->sigma0.sx, &sig->sigma0.sf,
+ &sig->sigma0.sa, &sig->sigma0.sb));
+
+ // Compute non-revoked proofs
+ SigRl const* sigrl =
+ reinterpret_cast<SigRl const*>(this->kSigRl5EntryData.data());
+ const size_t sigrl_len = this->kSigRl5EntryData.size();
+
+ const uint32_t n2 = ntohl(sigrl->n2);
+ sig_data.resize(sig_data.size() + n2 * sizeof(NrProof));
+ sig = reinterpret_cast<EpidSignature*>(sig_data.data()); // after resize!
+ sig->rl_ver = sigrl->version;
+ sig->n2 = sigrl->n2;
+
+ for (uint32_t i = 0; i < n2; i++) {
+ NrProveCommitOutput nrp_commit_out = {0};
+ EXPECT_EQ(kEpidNoErr, TpmNrProveCommit(tpm, &sig->sigma0.B, &sig->sigma0.K,
+ &sigrl->bk[i], &nrp_commit_out));
+ NrProof* nr_proof = &sig->sigma[i];
+ nr_proof->T = nrp_commit_out.T;
+ EXPECT_EQ(kEpidNoErr, HashNrProveCommitment(
+ epid2params.Fp(), hash_alg, &sig->sigma0.B,
+ &sig->sigma0.K, &sigrl->bk[i], &nrp_commit_out,
+ msg.data(), msg.size(), &nr_proof->c));
+ EXPECT_EQ(kEpidNoErr,
+ TpmNrProve(tpm, &nr_proof->c, &nr_proof->smu, &nr_proof->snu));
+ }
+
+ // verify
+ VerifierCtxObj ctx(pub_key);
+ THROW_ON_EPIDERR(EpidVerifierSetBasename(ctx, bsn.data(), bsn.size()));
+ THROW_ON_EPIDERR(EpidVerifierSetSigRl(ctx, sigrl, sigrl_len));
+ EXPECT_EQ(kEpidSigValid,
+ EpidVerify(ctx, sig, sig_data.size(), msg.data(), msg.size()));
+}
+
+//////////////////////////////////////////////////////////////////////////
+// Split operation sequence Tests
+TEST_F(EpidTpmTest, TpmSignFollowedByTpmSignDisallowed) {
+ Prng my_prng;
+ Epid2ParamsObj epid2params;
+ TpmCtxObj tpm(&Prng::Generate, &my_prng, epid2params);
+ // auto& msg = this->kMsg0;
+ // auto& bsn = this->kBsn0;
+ BasicSignature sigma0;
+ THROW_ON_EPIDERR(TpmProvision(tpm, &this->kMemberPrivateKey.f));
+ THROW_ON_EPIDERR(TpmInit(tpm, &this->kMemberPrivateKey.A,
+ &this->kMemberPrivateKey.x,
+ &this->kGroupPublicKey.h1, &this->kGroupPublicKey.h2,
+ &this->kGroupPublicKey.w, &this->kMemberPrecomp));
+ SignCommitOutput commit_out = {0};
+
+ THROW_ON_EPIDERR(TpmSignCommit(tpm, nullptr, &commit_out));
+
+ EXPECT_EQ(kEpidNoErr, TpmSign(tpm, &sigma0.c, &sigma0.sx, &sigma0.sf,
+ &sigma0.sa, &sigma0.sb));
+ EXPECT_EQ(
+ kEpidOutOfSequenceError,
+ TpmSign(tpm, &sigma0.c, &sigma0.sx, &sigma0.sf, &sigma0.sa, &sigma0.sb));
+
+ EXPECT_EQ(kEpidNoErr, TpmSignCommit(tpm, nullptr, &commit_out));
+}
+
+TEST_F(EpidTpmTest, TpmJoinFollowedByTpmJoinDisallowed) {
+ Prng my_prng;
+ Epid2ParamsObj epid2params;
+ TpmCtxObj tpm(&Prng::Generate, &my_prng, epid2params);
+ THROW_ON_EPIDERR(TpmProvision(tpm, &this->kMemberPrivateKey.f));
+
+ JoinRequest join_request;
+ G1ElemStr R_str = {0};
+ THROW_ON_EPIDERR(TpmJoinCommit(tpm, &join_request.F, &R_str));
+
+ EXPECT_EQ(kEpidNoErr, TpmJoin(tpm, &join_request.c, &join_request.s));
+ EXPECT_EQ(kEpidOutOfSequenceError,
+ TpmJoin(tpm, &join_request.c, &join_request.s));
+
+ EXPECT_EQ(kEpidNoErr, TpmJoinCommit(tpm, &join_request.F, &R_str));
+}
+
+TEST_F(EpidTpmTest, TpmNrProveFollowedByTpmNrProveDisallowed) {
+ Prng my_prng;
+ Epid2ParamsObj epid2params;
+ TpmCtxObj tpm(&Prng::Generate, &my_prng, epid2params);
+ THROW_ON_EPIDERR(TpmProvision(tpm, &this->kMemberPrivateKey.f));
+
+ G1ElemStr B_str = {0};
+ G1ElemStr K_str = {0};
+ SigRlEntry sigrl_entry = {0};
+ NrProveCommitOutput commit_out;
+ THROW_ON_EPIDERR(
+ TpmNrProveCommit(tpm, &B_str, &K_str, &sigrl_entry, &commit_out));
+
+ NrProof nr_proof;
+ nr_proof.T = commit_out.T;
+
+ EXPECT_EQ(kEpidNoErr,
+ TpmNrProve(tpm, &nr_proof.c, &nr_proof.smu, &nr_proof.snu));
+ EXPECT_EQ(kEpidOutOfSequenceError,
+ TpmNrProve(tpm, &nr_proof.c, &nr_proof.smu, &nr_proof.snu));
+
+ EXPECT_EQ(kEpidNoErr,
+ TpmNrProveCommit(tpm, &B_str, &K_str, &sigrl_entry, &commit_out));
+}
+
+} // namespace
diff --git a/epid/member/tpm/unittests/tpm-testhelper.cc b/epid/member/tpm/unittests/tpm-testhelper.cc
new file mode 100644
index 0000000..abc4325
--- /dev/null
+++ b/epid/member/tpm/unittests/tpm-testhelper.cc
@@ -0,0 +1,326 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Tpm C++ wrapper implementation.
+/*!
+ * \file
+ */
+
+#include "epid/member/tpm/unittests/tpm-testhelper.h"
+
+#include <cstdio>
+#include <stdexcept>
+#include <string>
+
+extern "C" {
+#include "epid/member/tpm/context.h"
+#include "epid/common/src/epid2params.h"
+}
+
+Epid2ParamsObj::Epid2ParamsObj() : params_(nullptr) {
+ EpidStatus sts = kEpidNoErr;
+ sts = CreateEpid2Params(&params_);
+ if (kEpidNoErr != sts) {
+ printf("%s(%d): %s\n", __FILE__, __LINE__, "test defect:");
+ throw std::logic_error(std::string("Failed to call: ") + "TpmCreate()");
+ }
+}
+
+Epid2ParamsObj::~Epid2ParamsObj() { DeleteEpid2Params(&params_); }
+
+Epid2Params_* Epid2ParamsObj::ctx() const { return params_; }
+
+Epid2ParamsObj::operator Epid2Params_*() const { return params_; }
+
+Epid2ParamsObj::operator const Epid2Params_*() const { return params_; }
+
+FiniteField* Epid2ParamsObj::Fp() const { return params_->Fp; }
+
+EcGroup* Epid2ParamsObj::G1() const { return params_->G1; }
+
+TpmCtxObj::TpmCtxObj(BitSupplier rnd_func, void* rnd_param,
+ Epid2ParamsObj const& params)
+ : ctx_(nullptr), params_(params) {
+ EpidStatus sts = kEpidNoErr;
+ sts = TpmCreate(rnd_func, rnd_param, params_, &ctx_);
+ if (kEpidNoErr != sts) {
+ printf("%s(%d): %s\n", __FILE__, __LINE__, "test defect:");
+ throw std::logic_error(std::string("Failed to call: ") + "TpmCreate()");
+ }
+}
+
+TpmCtxObj::~TpmCtxObj() { TpmDelete(&ctx_); }
+
+TpmCtx* TpmCtxObj::ctx() const { return ctx_; }
+
+TpmCtxObj::operator TpmCtx*() const { return ctx_; }
+
+TpmCtxObj::operator const TpmCtx*() const { return ctx_; }
+
+/// Arbitrary test data were generated based on Intel(R) EPID 2.0 parameters
+const GroupPubKey EpidTpmTest::kGroupPublicKey = {
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x01}, // group id
+ {{{{0xb3, 0x6f, 0xff, 0x81, 0xe2, 0x1b, 0x17, 0xeb, 0x3d, 0x75, 0x3d, 0x61,
+ 0x7e, 0x27, 0xb0, 0xcb, 0xd0, 0x6d, 0x8f, 0x9d, 0x64, 0xce, 0xe3, 0xce,
+ 0x43, 0x4c, 0x62, 0xfd, 0xb5, 0x80, 0xe0, 0x99}}},
+ {{{0x3a, 0x07, 0x56, 0x80, 0xe0, 0x88, 0x59, 0xa4, 0xfd, 0xb5, 0xb7, 0x9d,
+ 0xe9, 0x4d, 0xae, 0x9c, 0xee, 0x3d, 0x66, 0x42, 0x82, 0x45, 0x7e, 0x7f,
+ 0xd8, 0x69, 0x3e, 0xa1, 0x74, 0xf4, 0x59, 0xee}}}}, // h1
+ {{{{0xd2, 0x74, 0x2e, 0x9f, 0x63, 0xc2, 0x51, 0x8e, 0xd5, 0xdb, 0xca, 0x1c,
+ 0x54, 0x74, 0x10, 0x7b, 0xdc, 0x99, 0xed, 0x42, 0xd5, 0x5b, 0xa7, 0x04,
+ 0x29, 0x66, 0x61, 0x63, 0xbc, 0xdd, 0x7f, 0xe1}}},
+ {{{0x76, 0x5d, 0xc0, 0x6e, 0xe3, 0x14, 0xac, 0x72, 0x48, 0x12, 0x0a, 0xa6,
+ 0xe8, 0x5b, 0x08, 0x7b, 0xda, 0x3f, 0x51, 0x7d, 0xde, 0x4c, 0xea, 0xcb,
+ 0x93, 0xa5, 0x6e, 0xcc, 0xe7, 0x8e, 0x10, 0x84}}}}, // h2
+ {{{{{0xbd, 0x19, 0x5a, 0x95, 0xe2, 0x0f, 0xca, 0x1c, 0x50, 0x71, 0x94, 0x51,
+ 0x40, 0x1b, 0xa5, 0xb6, 0x78, 0x87, 0x53, 0xf6, 0x6a, 0x95, 0xca, 0xc6,
+ 0x8d, 0xcd, 0x36, 0x88, 0x7, 0x28, 0xe8, 0x96}}},
+ {{{0xca, 0x78, 0x11, 0x5b, 0xb8, 0x6a, 0xe7, 0xe5, 0xa6, 0x65, 0x7a, 0x68,
+ 0x15, 0xd7, 0x75, 0xf8, 0x24, 0x14, 0xcf, 0xd1, 0x0f, 0x6c, 0x56, 0xf5,
+ 0x22, 0xd9, 0xfd, 0xe0, 0xe2, 0xf4, 0xb3, 0xa1}}}},
+ {{{{0x90, 0x21, 0xa7, 0xe0, 0xe8, 0xb3, 0xc7, 0x25, 0xbc, 0x07, 0x72, 0x30,
+ 0x5d, 0xee, 0xf5, 0x6a, 0x89, 0x88, 0x46, 0xdd, 0x89, 0xc2, 0x39, 0x9c,
+ 0x0a, 0x3b, 0x58, 0x96, 0x57, 0xe4, 0xf3, 0x3c}}},
+ {{{0x79, 0x51, 0x69, 0x36, 0x1b, 0xb6, 0xf7, 0x05, 0x5d, 0x0a, 0x88, 0xdb,
+ 0x1f, 0x3d, 0xea, 0xa2, 0xba, 0x6b, 0xf0, 0xda, 0x8e, 0x25, 0xc6, 0xad,
+ 0x83, 0x7d, 0x3e, 0x31, 0xee, 0x11, 0x40, 0xa9}}}}} // w
+};
+
+const PrivKey EpidTpmTest::kMemberPrivateKey = {
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x01}, // group id
+ {{{{0x46, 0xc9, 0x69, 0xee, 0xf4, 0x68, 0xe1, 0x5f, 0xac, 0xbf, 0xdd, 0x77,
+ 0xeb, 0x4c, 0xaf, 0x8a, 0x87, 0x68, 0x3f, 0x4e, 0xda, 0xf2, 0x96, 0xec,
+ 0x57, 0x08, 0x90, 0xe8, 0x19, 0x62, 0x54, 0xdb}}},
+ {{{0x1e, 0x52, 0x23, 0x16, 0x91, 0xe4, 0xa8, 0x1d, 0x9a, 0x1b, 0x8a, 0xad,
+ 0x0a, 0xcf, 0x36, 0x4f, 0xae, 0x43, 0xde, 0x62, 0xff, 0xa6, 0x4b, 0xa8,
+ 0x16, 0x24, 0x98, 0x80, 0x82, 0x80, 0x37, 0x77}}}}, // A
+ {0x0a, 0x30, 0xae, 0x43, 0xa1, 0xe0, 0xd7, 0xdf, 0x10, 0x5e, 0xaf, 0xd8,
+ 0x5a, 0x61, 0x10, 0x86, 0xd0, 0x9d, 0xb9, 0xe4, 0x46, 0xdd, 0xb7, 0x1b,
+ 0x00, 0x14, 0x7c, 0x6b, 0x13, 0x72, 0xc3, 0x77}, // x
+ {0x48, 0x40, 0xb5, 0x6c, 0x6d, 0x47, 0x09, 0x0b, 0x05, 0xd6, 0x43, 0x56,
+ 0xe0, 0x7c, 0xc6, 0x8e, 0xa1, 0x65, 0x67, 0xfd, 0xa7, 0x07, 0x87, 0x9b,
+ 0x36, 0x2d, 0x41, 0x35, 0x63, 0x61, 0x31, 0xc7} // f
+};
+
+const MemberPrecomp EpidTpmTest::kMemberPrecomp = {
+ {0xd8, 0x14, 0xba, 0x4b, 0x44, 0x03, 0x55, 0x6c, 0xf6, 0x42, 0xe8, 0xf0,
+ 0x4c, 0xb5, 0xe7, 0xd4, 0xa2, 0xa3, 0x69, 0x47, 0xf5, 0xd4, 0xc8, 0xe9,
+ 0xc5, 0x5a, 0x39, 0xb5, 0x55, 0xa5, 0xd3, 0xfb, 0xf3, 0x85, 0x5a, 0x0d,
+ 0xd5, 0xee, 0xde, 0xf4, 0xa8, 0xb1, 0x8b, 0xcf, 0xa9, 0x0d, 0x29, 0xbf,
+ 0x86, 0x27, 0x9c, 0x1f, 0x96, 0xed, 0xd8, 0x44, 0x01, 0x35, 0x1a, 0xce,
+ 0xfd, 0x4e, 0x6f, 0xa1, 0x66, 0x0d, 0x59, 0x08, 0x6d, 0xa2, 0xe4, 0x99,
+ 0x83, 0xdc, 0x39, 0x28, 0xb7, 0x1c, 0x1a, 0x33, 0xad, 0xca, 0x5c, 0x35,
+ 0x26, 0x1f, 0xab, 0xba, 0x0d, 0x53, 0xaf, 0xe0, 0x72, 0x14, 0xc5, 0xa7,
+ 0x2e, 0x58, 0x26, 0xc9, 0x8e, 0xfa, 0x6f, 0x62, 0xfc, 0xf0, 0x08, 0x3e,
+ 0xa3, 0x11, 0x3a, 0xf0, 0xb8, 0x3b, 0x2d, 0x3e, 0xec, 0xd5, 0xbc, 0xf2,
+ 0x05, 0x68, 0xf4, 0x40, 0xce, 0x2c, 0x8f, 0xdd, 0xa4, 0xe5, 0xe1, 0xb5,
+ 0xbe, 0xbd, 0x3e, 0xd4, 0xf6, 0x9a, 0xb3, 0x37, 0x24, 0x0d, 0xea, 0x13,
+ 0xd7, 0x1f, 0xa2, 0x75, 0x68, 0xa1, 0xbe, 0x2c, 0x01, 0x42, 0x2a, 0xae,
+ 0x6f, 0xae, 0x7a, 0x72, 0x3a, 0x11, 0x03, 0x58, 0x02, 0x0d, 0xf0, 0xb0,
+ 0xd9, 0x6f, 0xb1, 0xe4, 0xf2, 0x70, 0xb8, 0xff, 0x22, 0x56, 0x7c, 0xb3,
+ 0x80, 0xfd, 0xdf, 0xe5, 0xab, 0xcc, 0x18, 0x7a, 0xfd, 0x91, 0xd0, 0xb0,
+ 0x63, 0x40, 0xd4, 0x71, 0xfa, 0x03, 0xf5, 0xf1, 0x26, 0xe1, 0xa5, 0x5a,
+ 0xd9, 0x6d, 0xf5, 0x5a, 0x7b, 0x2a, 0x3a, 0xfe, 0x94, 0x9e, 0x74, 0x41,
+ 0x79, 0x49, 0x7e, 0x48, 0x1d, 0x58, 0x5e, 0xf6, 0x98, 0xa3, 0x6e, 0x61,
+ 0x8e, 0x9f, 0x1f, 0xcd, 0x15, 0x01, 0x16, 0xa5, 0xe0, 0xab, 0xd6, 0xd6,
+ 0x1f, 0x1c, 0xf5, 0x81, 0x76, 0xc1, 0xec, 0x10, 0xc2, 0xcc, 0x68, 0x59,
+ 0x4d, 0x47, 0xef, 0x4b, 0x7f, 0xd8, 0x78, 0x9c, 0xfe, 0x9a, 0x86, 0x7e,
+ 0x0c, 0xfd, 0x3e, 0x0a, 0x7a, 0x72, 0x8b, 0x14, 0x5f, 0xe6, 0x5f, 0x19,
+ 0xa3, 0x0a, 0x1b, 0x71, 0xdc, 0xd2, 0xae, 0x35, 0xc3, 0x11, 0xa5, 0xd3,
+ 0xea, 0xe1, 0xa9, 0xe7, 0x70, 0x0c, 0x7a, 0x39, 0x56, 0x3c, 0xe4, 0xe7,
+ 0xf9, 0xb6, 0xf1, 0x15, 0x40, 0xab, 0xb6, 0xc4, 0xad, 0xbd, 0xf4, 0xcc,
+ 0x13, 0xb7, 0xa8, 0xb6, 0x92, 0x1e, 0x72, 0x27, 0xa7, 0xff, 0xd9, 0xea,
+ 0x2f, 0x91, 0x96, 0x22, 0xd2, 0xc4, 0x4d, 0x80, 0xdc, 0x47, 0x66, 0x87,
+ 0xcc, 0xcf, 0xc5, 0x64, 0xf7, 0xb2, 0x34, 0xed, 0xd5, 0x44, 0x44, 0xcc,
+ 0x57, 0x41, 0xc7, 0x92, 0xb7, 0x5c, 0x12, 0xf7, 0x81, 0xf2, 0x92, 0x35,
+ 0x3e, 0x4b, 0xdf, 0xf8, 0xda, 0x68, 0xac, 0x30, 0xe3, 0xdd, 0x9e, 0x22,
+ 0xaa, 0x6d, 0x77, 0xdd, 0xac, 0xd9, 0x11, 0x6e, 0xfb, 0x1a, 0x88,
+ 0xb3}, // e12
+ {
+ 0x07, 0x3f, 0x9d, 0x47, 0x82, 0xb8, 0x3d, 0x6a, 0xe0, 0x36, 0xab, 0xa6,
+ 0xfa, 0xe6, 0xd2, 0x1c, 0xc8, 0xb2, 0xd0, 0x01, 0xd4, 0x96, 0xdc, 0x2e,
+ 0xf8, 0x19, 0xdc, 0x70, 0x1b, 0xf9, 0x73, 0x0c, 0x2b, 0xc2, 0xe2, 0x1d,
+ 0x85, 0x53, 0x81, 0x51, 0xfb, 0xca, 0x16, 0x86, 0xd4, 0x4e, 0xfd, 0x1a,
+ 0x59, 0xe3, 0x97, 0xc4, 0x7f, 0x99, 0xd8, 0x66, 0x08, 0xa1, 0xe4, 0x9f,
+ 0xbb, 0x3a, 0xce, 0xa5, 0x23, 0x9c, 0x83, 0x13, 0xc5, 0xc8, 0xf2, 0x16,
+ 0x1e, 0xe8, 0xe6, 0xc5, 0x36, 0x57, 0x2c, 0xdf, 0x73, 0xb4, 0xe2, 0xb2,
+ 0xcb, 0xeb, 0xbb, 0xf7, 0x45, 0xd1, 0x44, 0xbd, 0x6e, 0x92, 0x95, 0x00,
+ 0xe5, 0x89, 0xb5, 0x91, 0x78, 0xc7, 0x44, 0xb1, 0x2f, 0x37, 0xdf, 0xfb,
+ 0xe7, 0x8a, 0x44, 0x3f, 0x3d, 0x06, 0x5f, 0x5b, 0x1c, 0x5f, 0xce, 0x11,
+ 0x05, 0x35, 0x3c, 0xad, 0x92, 0x7e, 0x79, 0xb8, 0xff, 0x28, 0x05, 0xe4,
+ 0x04, 0x2c, 0xb6, 0x1d, 0x22, 0xab, 0x36, 0x00, 0x5f, 0x74, 0xf1, 0xe3,
+ 0xf6, 0xa6, 0x68, 0xe6, 0x7b, 0x25, 0xb8, 0xcf, 0x19, 0xb0, 0x1a, 0xdd,
+ 0x0f, 0xad, 0x63, 0x73, 0x62, 0x1b, 0xe7, 0x94, 0x5d, 0xbf, 0x3d, 0xf1,
+ 0xf9, 0x8e, 0xab, 0x59, 0xe5, 0xd1, 0x7c, 0x62, 0xdd, 0xbc, 0x40, 0x07,
+ 0x70, 0x5b, 0x13, 0xf6, 0x12, 0x09, 0xb4, 0x0d, 0x3e, 0xab, 0x8b, 0x70,
+ 0x60, 0x1d, 0xd4, 0x61, 0x37, 0x28, 0x98, 0x3e, 0x7e, 0xdc, 0xfd, 0xd2,
+ 0xc0, 0x2f, 0x4b, 0x71, 0x31, 0x34, 0xd7, 0x69, 0x41, 0x5e, 0xaa, 0x72,
+ 0xe4, 0xdf, 0xeb, 0xfe, 0x8d, 0xcd, 0x68, 0xfc, 0x68, 0x55, 0xbe, 0x32,
+ 0x7d, 0x24, 0xc5, 0x07, 0x0f, 0xa8, 0xbd, 0x5a, 0xfe, 0xe7, 0xec, 0xdb,
+ 0xfd, 0x19, 0xc8, 0xa9, 0x20, 0xa2, 0x7f, 0x6c, 0xa6, 0x62, 0xec, 0xed,
+ 0x9b, 0x79, 0xbf, 0x9c, 0x0e, 0x31, 0x0b, 0x25, 0x2f, 0xd3, 0xcc, 0xa0,
+ 0xdd, 0xb2, 0xf2, 0x69, 0x26, 0x85, 0x21, 0x06, 0x94, 0x56, 0x5f, 0x59,
+ 0x5c, 0xf5, 0xb7, 0x82, 0xce, 0x0f, 0xdd, 0x40, 0xdb, 0x83, 0xac, 0x3c,
+ 0x41, 0xa0, 0x1b, 0xb1, 0xaf, 0xda, 0x55, 0xbf, 0x6b, 0x1a, 0xef, 0xe6,
+ 0x90, 0xe7, 0xaa, 0x0f, 0x04, 0x3c, 0x9f, 0x5b, 0xb7, 0xcd, 0x98, 0xa8,
+ 0x9e, 0xff, 0x54, 0x26, 0xc8, 0xd5, 0x5c, 0x30, 0x5e, 0xa2, 0x99, 0x8e,
+ 0x34, 0xd5, 0x98, 0x9f, 0xcd, 0x57, 0xd1, 0x4d, 0x1d, 0xee, 0x01, 0x5d,
+ 0x5a, 0x6d, 0xb2, 0xf1, 0xcf, 0x4b, 0xc0, 0x21, 0x23, 0x96, 0x05, 0xf9,
+ 0xc9, 0x66, 0xe5, 0x25, 0x9d, 0xa3, 0x8e, 0x78, 0x43, 0x19, 0xc1, 0x7f,
+ 0x7b, 0xef, 0xf5, 0xed, 0x00, 0xb7, 0x45, 0x1f, 0x4e, 0xa9, 0xfa, 0xe3,
+ 0xff, 0x54, 0xf2, 0x21, 0x73, 0xf8, 0x6b, 0xa1, 0xc7, 0x31, 0x4d, 0x6a,
+ }, // e22
+ {
+ 0x49, 0x0d, 0x0f, 0x2a, 0x5c, 0x6a, 0x3b, 0xad, 0x71, 0xc9, 0x22, 0x49,
+ 0xe8, 0x08, 0xdd, 0xba, 0x79, 0x57, 0xb7, 0xc7, 0x61, 0xe4, 0xdb, 0x84,
+ 0x68, 0x57, 0xb9, 0x30, 0x83, 0xa4, 0xdc, 0xef, 0x70, 0x93, 0x28, 0xe2,
+ 0x6f, 0xb9, 0xbc, 0x15, 0x28, 0x3a, 0x30, 0xbd, 0x96, 0x83, 0xdb, 0xf2,
+ 0x9d, 0x1e, 0xc7, 0x64, 0x6d, 0x2e, 0x7c, 0xa2, 0xf3, 0xaa, 0x2f, 0x4b,
+ 0x6d, 0x86, 0x9e, 0x48, 0x20, 0x29, 0x4b, 0x1f, 0x8d, 0xc2, 0x93, 0xc3,
+ 0x55, 0x25, 0x8e, 0xb0, 0x8a, 0x7e, 0x64, 0x45, 0x3f, 0xf4, 0x1d, 0x16,
+ 0x4c, 0x88, 0x2d, 0x54, 0xbe, 0xa8, 0x67, 0x70, 0x81, 0xc5, 0xb9, 0x5c,
+ 0x16, 0x00, 0xef, 0x78, 0xf6, 0x4d, 0x6a, 0xeb, 0xfd, 0xa2, 0x0d, 0x52,
+ 0x86, 0xf3, 0x04, 0x4b, 0xd8, 0xf0, 0x7d, 0x50, 0x8b, 0xad, 0xc0, 0x37,
+ 0xdb, 0x38, 0xf2, 0x7d, 0x1f, 0x8b, 0x13, 0x83, 0x7b, 0xcc, 0xe8, 0x25,
+ 0xfe, 0xfa, 0x0c, 0x02, 0x05, 0x2e, 0x75, 0x12, 0xa1, 0x0a, 0x89, 0xab,
+ 0xf1, 0xb2, 0x08, 0x47, 0x9a, 0xea, 0xef, 0x1d, 0xa4, 0x9f, 0xde, 0x89,
+ 0x47, 0x3e, 0x7c, 0x5e, 0x4a, 0x40, 0xdc, 0xec, 0xc5, 0x1b, 0x7e, 0x33,
+ 0x0a, 0x19, 0x69, 0x27, 0xa6, 0xcc, 0x25, 0xfc, 0xf9, 0xeb, 0xbd, 0xb7,
+ 0x8a, 0xdb, 0x45, 0x5f, 0x9d, 0x9e, 0x01, 0xde, 0x3d, 0x91, 0x10, 0x99,
+ 0x13, 0xbf, 0xc0, 0xfa, 0x9d, 0xd4, 0x0f, 0xb3, 0x09, 0xf3, 0xa1, 0xae,
+ 0x68, 0xe1, 0x1b, 0x48, 0x85, 0x9f, 0x81, 0x66, 0x91, 0xe2, 0xf0, 0x7b,
+ 0x29, 0xdb, 0x8f, 0x5d, 0x99, 0xa9, 0xd3, 0x39, 0x30, 0xd9, 0x1b, 0x94,
+ 0x2a, 0x1c, 0x5c, 0xe9, 0xc0, 0x3f, 0x6e, 0xb2, 0x27, 0xbe, 0x74, 0x7a,
+ 0xca, 0xe1, 0x0f, 0x6a, 0x43, 0x2e, 0x98, 0x65, 0xaf, 0x7f, 0x6e, 0x5a,
+ 0x55, 0x98, 0xc1, 0x58, 0x29, 0xb3, 0x86, 0x54, 0x0f, 0x57, 0x91, 0x89,
+ 0x29, 0xb1, 0x98, 0x79, 0xcc, 0x95, 0x39, 0xd0, 0xab, 0xe0, 0x9f, 0xf3,
+ 0xda, 0xf9, 0x5e, 0xd9, 0x34, 0xbb, 0x72, 0xda, 0xe5, 0x72, 0xd3, 0xf8,
+ 0x9b, 0xf9, 0x14, 0x84, 0x48, 0x81, 0x54, 0x4f, 0xe6, 0x2b, 0x80, 0xc8,
+ 0xc1, 0x79, 0xfe, 0x83, 0xff, 0x76, 0xa3, 0x6d, 0xfe, 0x37, 0x78, 0xc5,
+ 0x30, 0x7a, 0x50, 0xe2, 0x5d, 0x12, 0xdc, 0x72, 0xe9, 0x58, 0x7c, 0x07,
+ 0x4f, 0xff, 0x15, 0x8a, 0x97, 0x3b, 0xcb, 0x60, 0xfa, 0x4e, 0xde, 0x8c,
+ 0x80, 0x3a, 0x8b, 0x0b, 0xc6, 0x1d, 0xa3, 0xce, 0x6a, 0xb3, 0x50, 0x69,
+ 0x03, 0x96, 0xca, 0xc0, 0xb6, 0x94, 0x6f, 0x8f, 0xab, 0x6f, 0x5b, 0x00,
+ 0x2a, 0x1d, 0x90, 0xa7, 0x81, 0xc6, 0x15, 0x77, 0x79, 0xf3, 0x36, 0x23,
+ 0xd1, 0x46, 0x25, 0x58, 0x6f, 0x7b, 0x22, 0xac, 0x4c, 0x7a, 0xf3, 0x9f,
+ }, // e2w
+ {
+ 0x8d, 0x71, 0xe2, 0xb0, 0x73, 0x2f, 0x4a, 0xba, 0x64, 0xe8, 0x7a, 0x12,
+ 0xaf, 0xe4, 0x4f, 0xdb, 0x6b, 0x3e, 0x38, 0x07, 0x0c, 0x79, 0x22, 0x48,
+ 0x1b, 0x9d, 0x33, 0x53, 0x5c, 0x75, 0x3b, 0x40, 0x5e, 0x18, 0xd1, 0x92,
+ 0x4a, 0xd1, 0x82, 0x1c, 0xc7, 0x3a, 0xf7, 0x7e, 0x32, 0x19, 0x99, 0x5d,
+ 0x01, 0x0e, 0xb0, 0xf2, 0x8f, 0x80, 0xc6, 0xb9, 0xeb, 0x1f, 0x9e, 0xae,
+ 0x9e, 0xe0, 0x99, 0xfd, 0xe8, 0x93, 0x11, 0x61, 0x7d, 0xc2, 0x49, 0xdb,
+ 0xa8, 0x73, 0xa4, 0xa9, 0x33, 0xe2, 0x04, 0xd1, 0x7d, 0x8b, 0xe1, 0xd6,
+ 0x2b, 0x10, 0x6c, 0x79, 0x02, 0xbf, 0xfc, 0x53, 0x03, 0xa9, 0xbc, 0x30,
+ 0x4d, 0x4d, 0xf4, 0x32, 0xce, 0x9a, 0x4a, 0xfa, 0xd6, 0x7f, 0x26, 0x17,
+ 0xc5, 0xf6, 0xed, 0xe4, 0xcc, 0xb9, 0x79, 0xe2, 0xa8, 0x86, 0xbb, 0xd7,
+ 0xfb, 0x05, 0xd2, 0x81, 0xbe, 0x07, 0x1c, 0x47, 0x48, 0x4f, 0x6d, 0x6b,
+ 0x52, 0x42, 0xe4, 0xc6, 0x20, 0x46, 0xa3, 0xae, 0x5b, 0x55, 0x55, 0xfe,
+ 0x4a, 0xad, 0xf2, 0x32, 0x07, 0x0f, 0x91, 0xa9, 0xe5, 0xd3, 0x86, 0x08,
+ 0x73, 0x93, 0xc7, 0x1e, 0x6b, 0xcd, 0x69, 0xd0, 0xfb, 0xc1, 0x74, 0xc2,
+ 0xb8, 0x90, 0xc8, 0xf8, 0x93, 0xbf, 0x08, 0x0f, 0x15, 0x19, 0x26, 0x71,
+ 0x4a, 0x9e, 0xdf, 0xdf, 0xca, 0x6f, 0xca, 0xfd, 0x67, 0xec, 0x4d, 0x21,
+ 0x5b, 0x99, 0xbd, 0x4b, 0x79, 0x22, 0x2d, 0xe4, 0x24, 0x72, 0x88, 0x93,
+ 0xce, 0xe6, 0x7f, 0xef, 0x35, 0x83, 0x67, 0x39, 0xb9, 0x34, 0x80, 0x64,
+ 0x0a, 0xf4, 0xff, 0x42, 0x9d, 0xee, 0xda, 0xb8, 0xd3, 0xdc, 0x1d, 0x0d,
+ 0x9f, 0x45, 0xe9, 0xbe, 0xf4, 0x3e, 0xa6, 0x58, 0x8b, 0xf0, 0xfd, 0x01,
+ 0x73, 0x63, 0xd0, 0xc6, 0x9d, 0xb9, 0x32, 0xd1, 0x91, 0xfe, 0xb1, 0xf5,
+ 0x4b, 0x48, 0xb4, 0x46, 0xae, 0x61, 0xd7, 0x90, 0xfe, 0x86, 0x74, 0x68,
+ 0xee, 0x78, 0x86, 0x65, 0x99, 0x6d, 0x7b, 0xf0, 0x17, 0x1a, 0x4c, 0xb0,
+ 0x37, 0x73, 0xdc, 0x38, 0x41, 0xfa, 0x02, 0xd2, 0x13, 0x8f, 0x71, 0xb4,
+ 0x0a, 0x72, 0x70, 0x0f, 0xe1, 0x2c, 0x9a, 0xa9, 0x51, 0xfa, 0xb2, 0xbf,
+ 0x84, 0xf2, 0xa6, 0xfb, 0xc3, 0x83, 0x16, 0x7e, 0x27, 0xec, 0x06, 0x5d,
+ 0x64, 0x79, 0xe7, 0x42, 0x30, 0xf8, 0x2d, 0xbc, 0x0f, 0x07, 0x8b, 0xf2,
+ 0x99, 0xda, 0x91, 0x4c, 0x65, 0xcf, 0x7f, 0x57, 0x2d, 0x2f, 0x67, 0xe7,
+ 0xfb, 0x75, 0xe9, 0xb2, 0xa3, 0x72, 0x60, 0x88, 0x2b, 0x14, 0x31, 0x62,
+ 0xbc, 0x45, 0x59, 0x5c, 0x58, 0x39, 0xb3, 0x4a, 0xeb, 0xb9, 0x18, 0x24,
+ 0x05, 0xcb, 0xda, 0xd3, 0x5e, 0x54, 0xba, 0xda, 0xfd, 0xfc, 0xa0, 0x02,
+ 0xb3, 0xde, 0x52, 0x3e, 0xc0, 0xd0, 0xb8, 0x19, 0x85, 0x1b, 0x7b, 0xe3,
+ } // ea2
+};
+
+const std::vector<uint8_t> EpidTpmTest::kMsg0 = {'m', 's', 'g', '0'};
+const std::vector<uint8_t> EpidTpmTest::kBsn0 = {'b', 's', 'n', '0'};
+
+std::vector<uint8_t> EpidTpmTest::kSigRl5EntryData = {
+ // gid
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x01,
+ // version
+ 0x00, 0x00, 0x00, 0x00,
+ // n2
+ 0x00, 0x00, 0x00, 0x05,
+ // bk's
+ 0x9c, 0xa5, 0xe5, 0xae, 0x5f, 0xae, 0x51, 0x59, 0x33, 0x35, 0x27, 0xd, 0x8,
+ 0xb1, 0xbe, 0x5d, 0x69, 0x50, 0x84, 0xc5, 0xfe, 0xe2, 0x87, 0xea, 0x2e,
+ 0xef, 0xfa, 0xee, 0x67, 0xf2, 0xd8, 0x28, 0x56, 0x43, 0xc6, 0x94, 0x67,
+ 0xa6, 0x72, 0xf6, 0x41, 0x15, 0x4, 0x58, 0x42, 0x16, 0x88, 0x57, 0x9d, 0xc7,
+ 0x71, 0xd1, 0xc, 0x84, 0x13, 0xa, 0x90, 0x23, 0x18, 0x8, 0xad, 0x7d, 0xfe,
+ 0xf5, 0xc8, 0xae, 0xfc, 0x51, 0x40, 0xa7, 0xd1, 0x28, 0xc2, 0x89, 0xb2,
+ 0x6b, 0x4e, 0xb4, 0xc1, 0x55, 0x87, 0x98, 0xbd, 0x72, 0xf9, 0xcf, 0xd, 0x40,
+ 0x15, 0xee, 0x32, 0xc, 0xf3, 0x56, 0xc5, 0xc, 0x61, 0x9d, 0x4f, 0x7a, 0xb5,
+ 0x2b, 0x16, 0xa9, 0xa3, 0x97, 0x38, 0xe2, 0xdd, 0x3a, 0x33, 0xad, 0xf6,
+ 0x7b, 0x68, 0x8b, 0x68, 0xcf, 0xa3, 0xd3, 0x98, 0x37, 0xce, 0xec, 0xd1,
+ 0xa8, 0xc, 0x8b,
+
+ 0x71, 0x8a, 0xb5, 0x1, 0x7f, 0x7c, 0x92, 0x9a, 0xa2, 0xc9, 0x81, 0x10, 0xfe,
+ 0xbf, 0xc, 0x53, 0xa4, 0x43, 0xaf, 0x31, 0x74, 0x12, 0x25, 0x60, 0x3e, 0xc0,
+ 0x21, 0xe6, 0x63, 0x9a, 0xd2, 0x67, 0x2d, 0xb5, 0xd5, 0x82, 0xc4, 0x49,
+ 0x29, 0x51, 0x42, 0x8f, 0xe0, 0xe, 0xd1, 0x73, 0x27, 0xf5, 0x77, 0x16, 0x4,
+ 0x40, 0x8a, 0x0, 0xe, 0x3a, 0x5d, 0x37, 0x42, 0xd3, 0x8, 0x40, 0xbd, 0x69,
+ 0xf7, 0x5f, 0x74, 0x21, 0x50, 0xf4, 0xce, 0xfe, 0xd9, 0xdd, 0x97, 0x6c,
+ 0xa8, 0xa5, 0x60, 0x6b, 0xf8, 0x1b, 0xba, 0x2, 0xb2, 0xca, 0x5, 0x44, 0x9b,
+ 0xb1, 0x5e, 0x3a, 0xa4, 0x35, 0x7a, 0x51, 0xfa, 0xcf, 0xa4, 0x4, 0xe9, 0xf3,
+ 0xbf, 0x38, 0xd4, 0x24, 0x9, 0x52, 0xf3, 0x58, 0x3d, 0x9d, 0x4b, 0xb3, 0x37,
+ 0x4b, 0xec, 0x87, 0xe1, 0x64, 0x60, 0x3c, 0xb6, 0xf7, 0x7b, 0xff, 0x40,
+ 0x11,
+
+ 0x6e, 0x22, 0xaa, 0x10, 0x84, 0x58, 0x8b, 0xff, 0xd8, 0x37, 0x8, 0xa9, 0xe9,
+ 0xdb, 0xf6, 0x1f, 0x69, 0x10, 0x95, 0x6c, 0xbf, 0xd, 0x11, 0x48, 0x6f, 0x1b,
+ 0x3c, 0x62, 0x46, 0x13, 0x89, 0x13, 0x5f, 0xa1, 0x3, 0x62, 0xed, 0x62, 0xdf,
+ 0x3d, 0xbf, 0xcd, 0xb7, 0x41, 0x48, 0x81, 0x3, 0x9f, 0x54, 0xa, 0xe, 0xb3,
+ 0x35, 0xf9, 0xde, 0x24, 0xba, 0x6d, 0x4c, 0x7f, 0xfc, 0xc1, 0xb4, 0xce,
+ 0x6d, 0xa1, 0x73, 0x7c, 0xaa, 0xb, 0xad, 0x2, 0xd6, 0x37, 0x85, 0xe, 0xbb,
+ 0x48, 0x11, 0x38, 0xc4, 0xaa, 0x1b, 0xf, 0xcf, 0xc1, 0x9c, 0x26, 0xcc, 0x95,
+ 0xc2, 0x5b, 0x49, 0x9, 0x3d, 0xe9, 0x7d, 0xce, 0xc7, 0xa6, 0x4, 0x3e, 0x7c,
+ 0x9e, 0x28, 0xde, 0x8, 0x11, 0xe, 0x61, 0x3b, 0xc0, 0x9c, 0x6b, 0x58, 0x23,
+ 0xe6, 0x40, 0x7b, 0xbd, 0xb8, 0x72, 0xf, 0xe0, 0xee, 0xcf, 0xba, 0xb4,
+
+ 0xc4, 0xff, 0xaf, 0x48, 0x15, 0xda, 0x60, 0x40, 0xcc, 0xd7, 0xf2, 0x68,
+ 0xf7, 0xe2, 0x70, 0x12, 0x8d, 0x15, 0xa5, 0xb7, 0xe6, 0x4c, 0x23, 0xea,
+ 0x4d, 0x8a, 0x51, 0x6, 0x67, 0x3, 0x4c, 0x83, 0x6f, 0x28, 0x67, 0xcf, 0x63,
+ 0x46, 0x3e, 0x8a, 0x45, 0x9f, 0xed, 0x1a, 0xde, 0xa7, 0xad, 0xb2, 0x2b, 0xf,
+ 0x8b, 0xab, 0x7c, 0x70, 0xff, 0xc3, 0xa8, 0x6e, 0x8c, 0xaa, 0xb1, 0xf6,
+ 0x20, 0xe3, 0xb9, 0xf1, 0xc3, 0x3d, 0x5, 0x6a, 0x1e, 0x26, 0x2d, 0xf4, 0xd,
+ 0xe4, 0x53, 0x63, 0x67, 0x23, 0x48, 0xa8, 0x1, 0xa8, 0xee, 0xe1, 0x5f, 0x64,
+ 0xe3, 0x2c, 0x71, 0xe2, 0x10, 0x82, 0x0, 0x52, 0xd7, 0x74, 0x87, 0xff, 0x1c,
+ 0x0, 0x19, 0xe6, 0x4d, 0x15, 0x91, 0x6d, 0xf3, 0x38, 0x3b, 0xee, 0xf3, 0xd5,
+ 0xd1, 0xc7, 0x6d, 0xd9, 0x8e, 0x55, 0x70, 0x90, 0xb0, 0xb, 0x3c, 0x4a, 0x67,
+ 0x19,
+
+ 0x4f, 0x98, 0x92, 0xf9, 0x18, 0x38, 0xf5, 0xb4, 0xf7, 0x2f, 0xa7, 0x21,
+ 0x71, 0x52, 0x27, 0xd0, 0x57, 0x4f, 0x9c, 0x30, 0xe, 0xb2, 0x27, 0xce, 0xd7,
+ 0xb2, 0x9f, 0xc0, 0xf6, 0xc3, 0xb0, 0x7c, 0x40, 0x18, 0x75, 0x4a, 0xde,
+ 0xb0, 0x9f, 0x46, 0x8a, 0x5a, 0xeb, 0x4f, 0xcb, 0x5e, 0x60, 0xf5, 0xca,
+ 0xf4, 0x98, 0xaf, 0x62, 0x9b, 0x7e, 0x10, 0xda, 0xba, 0x2f, 0x47, 0x64,
+ 0xf2, 0xc0, 0x84, 0x19, 0x75, 0xe0, 0xe4, 0xff, 0x20, 0xda, 0x7d, 0xe5, 0xd,
+ 0xc8, 0xf8, 0xe3, 0x83, 0x61, 0x19, 0x17, 0xf1, 0xa9, 0x1b, 0xff, 0x39,
+ 0x79, 0x88, 0x1, 0xfb, 0xe7, 0x23, 0xd2, 0xac, 0xe0, 0x49, 0x12, 0x2a, 0x38,
+ 0xb4, 0x7c, 0xc2, 0x1b, 0x88, 0x5f, 0x68, 0x32, 0x11, 0xd9, 0xfd, 0xdc,
+ 0x65, 0x2, 0xb3, 0x74, 0x2c, 0x13, 0xf2, 0xd8, 0xf1, 0x45, 0xc5, 0xd1, 0xf4,
+ 0xa3, 0x38, 0x81, 0x92};
diff --git a/epid/member/tpm/unittests/tpm-testhelper.h b/epid/member/tpm/unittests/tpm-testhelper.h
new file mode 100644
index 0000000..5645dbe
--- /dev/null
+++ b/epid/member/tpm/unittests/tpm-testhelper.h
@@ -0,0 +1,116 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Tpm C++ wrapper interface.
+/*!
+ * \file
+ */
+#ifndef EPID_MEMBER_TPM_UNITTESTS_TPM_TESTHELPER_H_
+#define EPID_MEMBER_TPM_UNITTESTS_TPM_TESTHELPER_H_
+
+#include <cstdint>
+#include <vector>
+
+#include "gtest/gtest.h"
+extern "C" {
+#include "epid/common/bitsupplier.h"
+#include "epid/common/types.h"
+#include "epid/member/api.h" // for MemberPrecomp
+}
+
+typedef struct TpmCtx TpmCtx;
+typedef struct Epid2Params_ Epid2Params_;
+typedef struct FiniteField FiniteField;
+typedef struct EcGroup EcGroup;
+
+/// Test fixture class for Tpm
+class EpidTpmTest : public ::testing::Test {
+ public:
+ /// test data
+ static const GroupPubKey kGroupPublicKey;
+ /// test data
+ static const PrivKey kMemberPrivateKey;
+ /// test data
+ static const MemberPrecomp kMemberPrecomp;
+ /// signature based revocation list with 5 entries
+ static std::vector<uint8_t> kSigRl5EntryData;
+ /// a message
+ static const std::vector<uint8_t> kMsg0;
+ /// a basename
+ static const std::vector<uint8_t> kBsn0;
+
+ /// setup called before each TEST_F starts
+ virtual void SetUp() {}
+ /// teardown called after each TEST_F finishes
+ virtual void TearDown() {}
+};
+
+/// C++ Wrapper to manage memory for Epid2Params via RAII
+class Epid2ParamsObj {
+ public:
+ /// Create a Epid2Params
+ Epid2ParamsObj();
+
+ // This class instances are not meant to be copied.
+ // Explicitly delete copy constructor and assignment operator.
+ Epid2ParamsObj(const Epid2ParamsObj&) = delete;
+ Epid2ParamsObj& operator=(const Epid2ParamsObj&) = delete;
+
+ /// Destroy the Epid2Params
+ ~Epid2ParamsObj();
+ /// get a pointer to the stored Epid2Params
+ Epid2Params_* ctx() const;
+ /// cast operator to get the pointer to the stored Epid2Params
+ operator Epid2Params_*() const;
+ /// const cast operator to get the pointer to the stored Epid2Params
+ operator const Epid2Params_*() const;
+ /// get a pointer to the prime field Fp
+ FiniteField* Fp() const;
+ /// get a pointer to elliptic curve group G1
+ EcGroup* G1() const;
+
+ private:
+ /// The stored parameters
+ Epid2Params_* params_;
+};
+
+/// C++ Wrapper to manage memory for TpmCtx via RAII
+class TpmCtxObj {
+ public:
+ /// Create a TpmCtx
+ TpmCtxObj(BitSupplier rnd_func, void* rnd_param,
+ Epid2ParamsObj const& params);
+
+ // This class instances are not meant to be copied.
+ // Explicitly delete copy constructor and assignment operator.
+ TpmCtxObj(const TpmCtxObj&) = delete;
+ TpmCtxObj& operator=(const TpmCtxObj&) = delete;
+
+ /// Destroy the TpmCtx
+ ~TpmCtxObj();
+ /// get a pointer to the stored TpmCtx
+ TpmCtx* ctx() const;
+ /// cast operator to get the pointer to the stored TpmCtx
+ operator TpmCtx*() const;
+ /// const cast operator to get the pointer to the stored TpmCtx
+ operator const TpmCtx*() const;
+
+ private:
+ /// The stored TpmCtx
+ TpmCtx* ctx_;
+ Epid2ParamsObj const& params_;
+};
+
+#endif // EPID_MEMBER_TPM_UNITTESTS_TPM_TESTHELPER_H_
diff --git a/epid/member/tpm/validatekey.h b/epid/member/tpm/validatekey.h
new file mode 100644
index 0000000..c4331b0
--- /dev/null
+++ b/epid/member/tpm/validatekey.h
@@ -0,0 +1,73 @@
+/*############################################################################
+ # Copyright 2017 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.
+ ############################################################################*/
+/// Non-sensitive member context APIs
+/*! \file */
+
+#ifndef EPID_MEMBER_TPM_VALIDATEKEY_H_
+#define EPID_MEMBER_TPM_VALIDATEKEY_H_
+
+#include "epid/common/stdtypes.h"
+#include "epid/common/errors.h"
+
+/// \cond
+typedef struct TpmCtx TpmCtx;
+typedef struct G1ElemStr G1ElemStr;
+typedef struct G2ElemStr G2ElemStr;
+typedef struct FpElemStr FpElemStr;
+/// \endcond
+
+/*!
+ \addtogroup TpmModule tpm
+ \ingroup EpidMemberModule
+ @{
+*/
+
+/// Checks if provided parameters result in a valid key
+/*!
+
+
+ \param[in,out] ctx
+ The TPM context.
+
+ \param[in] A_str
+ The A value of the member private key.
+
+ \param[in] x_str
+ The x value of the member private key.
+
+ \param[in] h1_str
+ The h1 value of the group public key.
+
+ \param[in] w_str
+ The w value of the group public key.
+
+ \retval true
+ if the input values would result in a valid member private key
+
+ \retval false
+ if the input values would result in an invalid member private key
+
+ \see TpmCreate
+ \see TpmInit
+ \see TpmProvision
+
+ */
+bool TpmIsKeyValid(TpmCtx* ctx, G1ElemStr const* A_str, FpElemStr const* x_str,
+ G1ElemStr const* h1_str, G2ElemStr const* w_str);
+
+/*! @} */
+
+#endif // EPID_MEMBER_TPM_VALIDATEKEY_H_
diff --git a/epid/member/unittests/compute_presig-test.cc b/epid/member/unittests/compute_presig-test.cc
deleted file mode 100644
index 87b524b..0000000
--- a/epid/member/unittests/compute_presig-test.cc
+++ /dev/null
@@ -1,93 +0,0 @@
-/*############################################################################
- # 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 ComputePreSig unit tests.
- */
-
-#include "gtest/gtest.h"
-
-extern "C" {
-#include "epid/member/api.h"
-#include "epid/member/src/context.h"
-}
-
-#include "epid/member/unittests/member-testhelper.h"
-#include "epid/common-testhelper/prng-testhelper.h"
-#include "epid/common-testhelper/errors-testhelper.h"
-#include "epid/common-testhelper/finite_field_wrapper-testhelper.h"
-#include "epid/common-testhelper/ffelement_wrapper-testhelper.h"
-#include "epid/common-testhelper/epid_params-testhelper.h"
-
-namespace {
-
-TEST_F(EpidMemberTest, ComputePreSigFailsGivenNullPointer) {
- Prng my_prng;
- MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
- this->kMemberPrecomp, &Prng::Generate, &my_prng);
-
- PreComputedSignature presig;
- EXPECT_EQ(kEpidBadArgErr, EpidComputePreSig(nullptr, &presig));
- EXPECT_EQ(kEpidBadArgErr, EpidComputePreSig(member, nullptr));
-}
-
-TEST_F(EpidMemberTest,
- ComputePreSigGeneratedPreComputedSignatureCanBeDeserialized) {
- const BigNumStr 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, 0x0D}}};
-
- Prng my_prng;
- MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
- this->kMemberPrecomp, &Prng::Generate, &my_prng);
-
- PreComputedSignature presig;
- EXPECT_EQ(kEpidNoErr, EpidComputePreSig(member, &presig));
-
- Epid20Params params;
- FiniteFieldObj Fp(p_str);
- FfElementObj Fp_element(&Fp);
-
- FfElementObj GT_element(&params.GT);
- EcPointObj G1_pt(&params.G1);
-
- EXPECT_EQ(kEpidNoErr,
- ReadEcPoint(params.G1, &presig.B, sizeof(presig.B), G1_pt));
- EXPECT_EQ(kEpidNoErr,
- ReadEcPoint(params.G1, &presig.K, sizeof(presig.K), G1_pt));
- EXPECT_EQ(kEpidNoErr,
- ReadEcPoint(params.G1, &presig.T, sizeof(presig.T), G1_pt));
- EXPECT_EQ(kEpidNoErr,
- ReadEcPoint(params.G1, &presig.R1, sizeof(presig.R1), G1_pt));
- EXPECT_EQ(kEpidNoErr, ReadFfElement(params.GT, &presig.R2, sizeof(presig.R2),
- GT_element));
- EXPECT_EQ(kEpidNoErr,
- ReadFfElement(Fp, &presig.a, sizeof(presig.a), Fp_element));
- EXPECT_EQ(kEpidNoErr,
- ReadFfElement(Fp, &presig.b, sizeof(presig.b), Fp_element));
- EXPECT_EQ(kEpidNoErr,
- ReadFfElement(Fp, &presig.rx, sizeof(presig.rx), Fp_element));
- EXPECT_EQ(kEpidNoErr,
- ReadFfElement(Fp, &presig.rf, sizeof(presig.rf), Fp_element));
- EXPECT_EQ(kEpidNoErr,
- ReadFfElement(Fp, &presig.ra, sizeof(presig.ra), Fp_element));
- EXPECT_EQ(kEpidNoErr,
- ReadFfElement(Fp, &presig.rb, sizeof(presig.rb), Fp_element));
-}
-
-} // namespace
diff --git a/epid/member/unittests/context-test.cc b/epid/member/unittests/context-test.cc
index de4d27f..5b6d561 100644
--- a/epid/member/unittests/context-test.cc
+++ b/epid/member/unittests/context-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,9 +20,11 @@
*/
#include <cstring>
#include <vector>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
#include "epid/common-testhelper/prng-testhelper.h"
+#include "epid/common-testhelper/errors-testhelper.h"
#include "epid/member/unittests/member-testhelper.h"
extern "C" {
@@ -168,25 +170,183 @@ TEST_F(EpidMemberTest, CreateFailsForInvalidPrivateKey) {
TEST_F(EpidMemberTest, SetHashAlgFailsGivenNullPtr) {
EXPECT_EQ(kEpidBadArgErr, EpidMemberSetHashAlg(nullptr, kSha256));
}
-TEST_F(EpidMemberTest, SetHashAlgCanSetValidAlgorithm) {
+TEST_F(EpidMemberTest, CanSetHashAlgoToSHA256) {
Prng my_prng;
MemberCtxObj member_ctx(this->kGroupPublicKey, this->kMemberPrivateKey,
&Prng::Generate, &my_prng);
EXPECT_EQ(kEpidNoErr, EpidMemberSetHashAlg(member_ctx, kSha256));
+}
+TEST_F(EpidMemberTest, CanSetHashAlgoToSHA384) {
+ Prng my_prng;
+ MemberCtxObj member_ctx(this->kGroupPublicKey, this->kMemberPrivateKey,
+ &Prng::Generate, &my_prng);
EXPECT_EQ(kEpidNoErr, EpidMemberSetHashAlg(member_ctx, kSha384));
+}
+TEST_F(EpidMemberTest, CanSetHashAlgoToSHA512) {
+ Prng my_prng;
+ MemberCtxObj member_ctx(this->kGroupPublicKey, this->kMemberPrivateKey,
+ &Prng::Generate, &my_prng);
EXPECT_EQ(kEpidNoErr, EpidMemberSetHashAlg(member_ctx, kSha512));
}
+TEST_F(EpidMemberTest, CanSetHashAlgoToSHA512256) {
+ Prng my_prng;
+ MemberCtxObj member_ctx(this->kGroupPublicKey, this->kMemberPrivateKey,
+ &Prng::Generate, &my_prng);
+ EXPECT_EQ(kEpidNoErr, EpidMemberSetHashAlg(member_ctx, kSha512_256));
+}
TEST_F(EpidMemberTest, SetHashAlgFailsForNonSupportedAlgorithm) {
Prng my_prng;
MemberCtxObj member_ctx(this->kGroupPublicKey, this->kMemberPrivateKey,
&Prng::Generate, &my_prng);
- EXPECT_EQ(kEpidBadArgErr, EpidMemberSetHashAlg(member_ctx, kSha512_256));
EXPECT_EQ(kEpidBadArgErr, EpidMemberSetHashAlg(member_ctx, kSha3_256));
EXPECT_EQ(kEpidBadArgErr, EpidMemberSetHashAlg(member_ctx, kSha3_384));
EXPECT_EQ(kEpidBadArgErr, EpidMemberSetHashAlg(member_ctx, kSha3_512));
EXPECT_EQ(kEpidBadArgErr, EpidMemberSetHashAlg(member_ctx, (HashAlg)-1));
}
//////////////////////////////////////////////////////////////////////////
+// EpidMemberSetSigRl
+TEST_F(EpidMemberTest, SetSigRlFailsGivenNullPointer) {
+ Prng my_prng;
+ MemberCtxObj member_ctx(this->kGroupPublicKey, this->kMemberPrivateKey,
+ &Prng::Generate, &my_prng);
+ SigRl srl = {{{0}}, {{0}}, {{0}}, {{{{0}, {0}}, {{0}, {0}}}}};
+ srl.gid = this->kGroupPublicKey.gid;
+ EXPECT_EQ(kEpidBadArgErr, EpidMemberSetSigRl(nullptr, &srl, sizeof(SigRl)));
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidMemberSetSigRl(member_ctx, nullptr, sizeof(SigRl)));
+}
+TEST_F(EpidMemberTest, SetSigRlFailsGivenZeroSize) {
+ Prng my_prng;
+ MemberCtxObj member_ctx(this->kGroupPublicKey, this->kMemberPrivateKey,
+ &Prng::Generate, &my_prng);
+ SigRl srl = {{{0}}, {{0}}, {{0}}, {{{{0}, {0}}, {{0}, {0}}}}};
+ srl.gid = this->kGroupPublicKey.gid;
+ EXPECT_EQ(kEpidBadArgErr, EpidMemberSetSigRl(member_ctx, &srl, 0));
+}
+// Size parameter must be at least big enough for n2 == 0 case
+TEST_F(EpidMemberTest, SetSigRlFailsGivenTooSmallSize) {
+ Prng my_prng;
+ MemberCtxObj member_ctx(this->kGroupPublicKey, this->kMemberPrivateKey,
+ &Prng::Generate, &my_prng);
+ SigRl srl = {{{0}}, {{0}}, {{0}}, {{{{0}, {0}}, {{0}, {0}}}}};
+ srl.gid = this->kGroupPublicKey.gid;
+ EXPECT_EQ(
+ kEpidBadArgErr,
+ EpidMemberSetSigRl(member_ctx, &srl, (sizeof(srl) - sizeof(srl.bk)) - 1));
+ srl.n2 = this->kOctStr32_1;
+ EXPECT_EQ(
+ kEpidBadArgErr,
+ EpidMemberSetSigRl(member_ctx, &srl, (sizeof(srl) - sizeof(srl.bk)) - 1));
+}
+TEST_F(EpidMemberTest, SetSigRlFailsGivenN2TooBigForSize) {
+ Prng my_prng;
+ MemberCtxObj member_ctx(this->kGroupPublicKey, this->kMemberPrivateKey,
+ &Prng::Generate, &my_prng);
+ SigRl srl = {{{0}}, {{0}}, {{0}}, {{{{0}, {0}}, {{0}, {0}}}}};
+ srl.gid = this->kGroupPublicKey.gid;
+ srl.n2 = this->kOctStr32_1;
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidMemberSetSigRl(member_ctx, &srl, sizeof(srl) - sizeof(srl.bk)));
+}
+TEST_F(EpidMemberTest, SetSigRlFailsGivenN2TooSmallForSize) {
+ Prng my_prng;
+ MemberCtxObj member_ctx(this->kGroupPublicKey, this->kMemberPrivateKey,
+ &Prng::Generate, &my_prng);
+ SigRl srl = {{{0}}, {{0}}, {{0}}, {{{{0}, {0}}, {{0}, {0}}}}};
+ srl.gid = this->kGroupPublicKey.gid;
+ EXPECT_EQ(kEpidBadArgErr, EpidMemberSetSigRl(member_ctx, &srl, sizeof(srl)));
+}
+TEST_F(EpidMemberTest, SetSigRlFailsGivenBadGroupId) {
+ Prng my_prng;
+ MemberCtxObj member_ctx(this->kGroupPublicKey, this->kMemberPrivateKey,
+ &Prng::Generate, &my_prng);
+ SigRl srl = {{{0}}, {{0}}, {{0}}, {{{{0}, {0}}, {{0}, {0}}}}};
+ srl.gid = this->kGroupPublicKey.gid;
+ srl.gid.data[0] = ~srl.gid.data[0];
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidMemberSetSigRl(member_ctx, &srl, sizeof(srl) - sizeof(srl.bk)));
+}
+TEST_F(EpidMemberTest, SetPrivRlFailsGivenEmptySigRlFromDifferentGroup) {
+ Prng my_prng;
+ MemberCtxObj member_ctx(this->kGroupPublicKey, this->kMemberPrivateKey,
+ &Prng::Generate, &my_prng);
+ SigRl const* sig_rl = reinterpret_cast<SigRl const*>(this->kGrpXSigRl.data());
+ size_t sig_rl_size = this->kGrpXSigRl.size();
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidMemberSetSigRl(member_ctx, sig_rl, sig_rl_size));
+}
+TEST_F(EpidMemberTest, SetSigRlFailsGivenOldVersion) {
+ Prng my_prng;
+ MemberCtxObj member_ctx(this->kGroupPublicKey, this->kMemberPrivateKey,
+ &Prng::Generate, &my_prng);
+ SigRl srl = {{{0}}, {{0}}, {{0}}, {{{{0}, {0}}, {{0}, {0}}}}};
+ srl.gid = this->kGroupPublicKey.gid;
+ srl.version = this->kOctStr32_1;
+ EXPECT_EQ(kEpidNoErr,
+ EpidMemberSetSigRl(member_ctx, &srl, sizeof(srl) - sizeof(srl.bk)));
+ OctStr32 octstr32_0 = {0x00, 0x00, 0x00, 0x00};
+ srl.version = octstr32_0;
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidMemberSetSigRl(member_ctx, &srl, sizeof(srl) - sizeof(srl.bk)));
+}
+TEST_F(EpidMemberTest, SetSigRlPreservesOldRlOnFailure) {
+ Prng my_prng;
+ MemberCtxObj member_ctx(this->kGrpXKey, this->kGrpXSigrevokedMember0PrivKey,
+ &Prng::Generate, &my_prng);
+ SigRl const* sig_rl = reinterpret_cast<SigRl const*>(this->kGrpXSigRl.data());
+ size_t sig_rl_size = this->kGrpXSigRl.size();
+ EXPECT_EQ(kEpidNoErr, EpidMemberSetSigRl(member_ctx, sig_rl, sig_rl_size));
+ // wrong sigrl contains revoked member0 and has lower version
+ SigRl const* wrong_sig_rl =
+ reinterpret_cast<SigRl const*>(this->kGrpXSigRlSingleEntry.data());
+ size_t wrong_sig_rl_size = this->kGrpXSigRlSingleEntry.size();
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidMemberSetSigRl(member_ctx, wrong_sig_rl, wrong_sig_rl_size));
+ auto& msg = this->kMsg0;
+ std::vector<uint8_t> sig_data(EpidGetSigSize(sig_rl));
+ EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
+ size_t sig_len = sig_data.size() * sizeof(uint8_t);
+ THROW_ON_EPIDERR(EpidMemberSetHashAlg(member_ctx, kSha256));
+ // Check that sigrevoked member is still in SigRl
+ EXPECT_EQ(kEpidSigRevokedInSigRl, EpidSign(member_ctx, msg.data(), msg.size(),
+ nullptr, 0, sig, sig_len));
+}
+TEST_F(EpidMemberTest, SetSigRlWorksGivenValidSigRl) {
+ Prng my_prng;
+ MemberCtxObj member_ctx(this->kGrpXKey, this->kGrpXMember0PrivKey,
+ &Prng::Generate, &my_prng);
+ SigRl const* sig_rl = reinterpret_cast<SigRl const*>(this->kGrpXSigRl.data());
+ size_t sig_rl_size = this->kGrpXSigRl.size();
+ EXPECT_EQ(kEpidNoErr, EpidMemberSetSigRl(member_ctx, sig_rl, sig_rl_size));
+}
+TEST_F(EpidMemberTest, SetSigRlWorksGivenEmptySigRl) {
+ Prng my_prng;
+ MemberCtxObj member_ctx(this->kGroupPublicKey, this->kMemberPrivateKey,
+ &Prng::Generate, &my_prng);
+ uint8_t sig_rl_data_n2_zero[] = {
+ // gid
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x01,
+ // version
+ 0x00, 0x00, 0x00, 0x00,
+ // n2
+ 0x0, 0x00, 0x00, 0x00,
+ // not bk's
+ };
+ SigRl* sig_rl = reinterpret_cast<SigRl*>(sig_rl_data_n2_zero);
+ size_t sig_rl_size = sizeof(sig_rl_data_n2_zero);
+ EXPECT_EQ(kEpidNoErr, EpidMemberSetSigRl(member_ctx, sig_rl, sig_rl_size));
+}
+TEST_F(EpidMemberTest, SetSigRlWorksGivenSigRlWithOneEntry) {
+ Prng my_prng;
+ MemberCtxObj member_ctx(this->kGrpXKey, this->kGrpXMember0PrivKey,
+ &Prng::Generate, &my_prng);
+ SigRl const* sig_rl =
+ reinterpret_cast<SigRl const*>(this->kGrpXSigRlSingleEntry.data());
+ size_t sig_rl_size = this->kGrpXSigRlSingleEntry.size();
+ EXPECT_EQ(kEpidNoErr, EpidMemberSetSigRl(member_ctx, sig_rl, sig_rl_size));
+}
+//////////////////////////////////////////////////////////////////////////
// EpidRegisterBaseName
TEST_F(EpidMemberTest, RegisterBaseNameFailsGivenNullPtr) {
Prng my_prng;
diff --git a/epid/member/unittests/decompress_privkey-test.cc b/epid/member/unittests/decompress_privkey-test.cc
index 380e1dd..1ba2453 100644
--- a/epid/member/unittests/decompress_privkey-test.cc
+++ b/epid/member/unittests/decompress_privkey-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief DecompressPrivKey unit tests.
*/
#include <cstring>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
diff --git a/epid/member/unittests/get_sigsize-test.cc b/epid/member/unittests/get_sigsize-test.cc
index b5202da..50858b9 100644
--- a/epid/member/unittests/get_sigsize-test.cc
+++ b/epid/member/unittests/get_sigsize-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief GetSigSize unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
diff --git a/epid/member/unittests/main-test.cc b/epid/member/unittests/main-test.cc
index 70f2d3a..a8bb2fa 100644
--- a/epid/member/unittests/main-test.cc
+++ b/epid/member/unittests/main-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
* \brief Main entry point for unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
int main(int argc, char** argv) {
diff --git a/epid/member/unittests/member-testhelper.cc b/epid/member/unittests/member-testhelper.cc
index c06b9cb..00e907f 100644
--- a/epid/member/unittests/member-testhelper.cc
+++ b/epid/member/unittests/member-testhelper.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -241,174 +241,7 @@ const MemberPrecomp EpidMemberTest::kMemberPrecomp = {
0xb3, 0xde, 0x52, 0x3e, 0xc0, 0xd0, 0xb8, 0x19, 0x85, 0x1b, 0x7b, 0xe3,
} // ea2
};
-const PreComputedSignature EpidMemberTest::kPrecomputedSignatures[2] = {
- {
- {{{{0x5c, 0x1b, 0x75, 0x1c, 0xc7, 0x2c, 0xf7, 0x4a, 0x97, 0x43, 0xf2,
- 0x1a, 0x70, 0x80, 0x90, 0x61, 0xf5, 0x9e, 0x9b, 0x43, 0x92, 0x2f,
- 0x05, 0x28, 0xcc, 0x4c, 0xb4, 0xb2, 0x80, 0x15, 0x58, 0x14}}},
- {{{
- 0x3f, 0x7f, 0xd0, 0x95, 0x08, 0x98, 0x0b, 0xae, 0x88, 0xf8, 0x2c,
- 0x18, 0x8b, 0x72, 0x50, 0x95, 0x78, 0x41, 0xae, 0x4e, 0x6e, 0xea,
- 0x3d, 0xa6, 0x23, 0x91, 0x4a, 0x02, 0x5d, 0x3f, 0x97, 0xd9,
- }}}}, // B
- {{{{0xb0, 0xdb, 0x88, 0x23, 0x18, 0x95, 0xba, 0x60, 0x72, 0x43, 0xb4,
- 0x57, 0xbd, 0x20, 0xd2, 0x28, 0x97, 0xf7, 0x3a, 0x50, 0x06, 0xc5,
- 0x89, 0xc9, 0x9f, 0x7a, 0x2a, 0x80, 0x91, 0xee, 0x7a, 0xf8}}},
- {{{0x70, 0xf3, 0x95, 0x12, 0xe4, 0x95, 0xca, 0x19, 0x43, 0x1a, 0x5d,
- 0x47, 0x33, 0x71, 0x69, 0xfb, 0x14, 0x5f, 0xbd, 0x3f, 0xb2, 0x72,
- 0x22, 0x3f, 0x63, 0xc3, 0xe9, 0x7c, 0x18, 0x82, 0x88,
- 0x03}}}}, // K
- {{{{0x75, 0x39, 0x21, 0x47, 0x04, 0xfd, 0xb7, 0x71, 0xb2, 0xf5, 0xa9,
- 0x83, 0x7f, 0x27, 0x1d, 0x8f, 0xff, 0x07, 0x3c, 0xfb, 0xe9, 0x0d,
- 0x14, 0x9c, 0xa6, 0xee, 0x06, 0x1e, 0x3d, 0xd3, 0xfb, 0x92}}},
- {{{0x51, 0x64, 0x11, 0x6d, 0x22, 0xc7, 0xed, 0x67, 0x21, 0xfe, 0x76,
- 0x27, 0xf9, 0x43, 0x43, 0x64, 0x11, 0x01, 0x63, 0xc8, 0xda, 0x42,
- 0x4e, 0x02, 0xe7, 0xf2, 0xb8, 0xa4, 0x16, 0x5b, 0x39,
- 0xc2}}}}, // T
- {{{{0x60, 0x25, 0xeb, 0xe8, 0x51, 0xd5, 0xe0, 0xf3, 0xcc, 0xb2, 0xc2,
- 0xe3, 0xd7, 0x5c, 0x84, 0x41, 0x57, 0x2b, 0x5b, 0x00, 0xac, 0x1d,
- 0x14, 0x89, 0xba, 0xb3, 0x34, 0xf0, 0x8a, 0xd4, 0x72, 0x5e}}},
- {{{0x93, 0xb7, 0xed, 0x03, 0xdd, 0xc7, 0xc9, 0xfa, 0x2c, 0x32, 0x84,
- 0x40, 0xd4, 0xa2, 0x74, 0x76, 0x02, 0xef, 0x0c, 0xc6, 0xe4, 0xc2,
- 0x9f, 0xd7, 0x18, 0x96, 0xdc, 0x97, 0x22, 0x4e, 0xbf,
- 0xfc}}}}, // R1
- {
- 0xe4, 0x5f, 0x6c, 0x74, 0x0b, 0xb7, 0x26, 0x59, 0x62, 0x5e, 0x69,
- 0x71, 0x01, 0xa8, 0x32, 0xc1, 0xa7, 0xae, 0x32, 0x9e, 0xc2, 0xaf,
- 0x9a, 0x55, 0x6c, 0x71, 0x37, 0x80, 0xc7, 0xe1, 0x8b, 0x1c, 0xa1,
- 0x0c, 0xce, 0x60, 0x10, 0x18, 0x14, 0xe9, 0x66, 0x84, 0xe0, 0x52,
- 0x9d, 0xee, 0x42, 0x0f, 0x47, 0xba, 0xcc, 0xc1, 0xea, 0xeb, 0x93,
- 0x18, 0x04, 0x39, 0x7e, 0x36, 0x59, 0x73, 0xd3, 0xf8, 0xa4, 0x67,
- 0x64, 0x6a, 0x24, 0x00, 0xd3, 0x4b, 0x0b, 0x17, 0x7f, 0xc6, 0xca,
- 0x1a, 0xe3, 0x29, 0x4a, 0x4d, 0x23, 0x7d, 0x02, 0xa4, 0xd3, 0x26,
- 0xed, 0xe6, 0x4d, 0xb7, 0xc6, 0x2d, 0x70, 0x85, 0xf0, 0xa4, 0x54,
- 0x7f, 0xe9, 0x6e, 0x17, 0xb3, 0x36, 0xa4, 0x30, 0xfc, 0xca, 0x80,
- 0x8c, 0x8b, 0x17, 0x6f, 0xe8, 0x22, 0x76, 0x27, 0xd7, 0x42, 0xd5,
- 0x14, 0x27, 0x9a, 0x8d, 0x0c, 0x9c, 0x43, 0x7e, 0x41, 0x7a, 0x73,
- 0xd9, 0xee, 0xef, 0xc7, 0x42, 0x77, 0xbe, 0x27, 0xa3, 0x8f, 0xa1,
- 0x77, 0xaf, 0xdc, 0xa2, 0xfc, 0xf1, 0x3d, 0xd6, 0x00, 0xf3, 0x9c,
- 0x43, 0xe9, 0xff, 0xc7, 0x9f, 0x5f, 0x6c, 0xa9, 0x16, 0x47, 0x73,
- 0xbb, 0x31, 0x45, 0xb1, 0xcf, 0x7f, 0x39, 0xdd, 0x27, 0x78, 0x03,
- 0x45, 0x24, 0x67, 0x08, 0x04, 0xf1, 0xbf, 0xfa, 0x7f, 0xe2, 0x2f,
- 0x1f, 0x2c, 0x68, 0xfe, 0x4e, 0x0a, 0xcf, 0xd7, 0xf5, 0x0b, 0xd2,
- 0xe2, 0x55, 0x54, 0x15, 0xa6, 0x3d, 0x0c, 0xc3, 0x49, 0xcd, 0x86,
- 0xa7, 0x51, 0x12, 0x08, 0x4c, 0xf6, 0x05, 0xbc, 0xdc, 0xb1, 0x22,
- 0xe4, 0x92, 0x33, 0x92, 0x8f, 0x6b, 0xee, 0x74, 0x96, 0xaf, 0x7c,
- 0x47, 0x65, 0xb6, 0x4d, 0xd8, 0xd4, 0x21, 0xa8, 0xfa, 0xf9, 0x03,
- 0xc7, 0xf4, 0x82, 0xde, 0x0a, 0xd9, 0x4c, 0x92, 0xfc, 0x48, 0x65,
- 0x1a, 0x4c, 0xb9, 0xf9, 0x91, 0x9e, 0xf4, 0x88, 0x9e, 0x83, 0xa9,
- 0x3a, 0x2e, 0x50, 0x94, 0xde, 0xb0, 0x24, 0xf3, 0x9b, 0xa0, 0x9e,
- 0x0c, 0x49, 0xb2, 0xe2, 0x53, 0xfc, 0x52, 0x9b, 0x4b, 0x3b, 0x53,
- 0xdf, 0xfe, 0x76, 0x99, 0x19, 0x90, 0xb8, 0xf2, 0x8c, 0xda, 0x57,
- 0xfc, 0x35, 0xf6, 0xeb, 0xb4, 0x3c, 0xde, 0xff, 0x75, 0xf2, 0x50,
- 0x27, 0x20, 0x42, 0x33, 0xd8, 0x6c, 0x5f, 0xba, 0x3d, 0xed, 0x90,
- 0x77, 0xbc, 0x97, 0x10, 0xe0, 0x37, 0x21, 0x9e, 0x37, 0xf4, 0x89,
- 0x34, 0x7c, 0x4a, 0x27, 0x8b, 0x58, 0x99, 0x83, 0x0a, 0xa7, 0x80,
- 0x11, 0xc4, 0x88, 0xf2, 0xbb, 0xc0, 0x99, 0x9f, 0x6f, 0x60, 0x12,
- 0x2d, 0x52, 0x20, 0x3a, 0xc0, 0x50, 0x75, 0x97, 0xc9, 0xdb, 0x01,
- 0x3d, 0x05, 0x21, 0x3a, 0x16, 0x67, 0x0f, 0x7b, 0x51, 0x4a, 0x33,
- 0x93, 0x53, 0x78, 0xd0, 0xb4, 0x91, 0xfc, 0x32, 0x49, 0x5e,
- }, // R2
- {0x02, 0x5c, 0x15, 0x7e, 0x0f, 0x00, 0x82, 0x32, 0x45, 0xcf, 0x91, 0xd3,
- 0x64, 0x5f, 0xf6, 0x0a, 0x83, 0x83, 0xc6, 0x3c, 0x0a, 0x68, 0x2c, 0x1e,
- 0x96, 0x4b, 0xfa, 0xde, 0x06, 0xfe, 0x1a, 0x73}, // a
- {0xea, 0x9d, 0xe1, 0x57, 0x32, 0x2e, 0x74, 0xd5, 0xbe, 0x49, 0xc4, 0xc8,
- 0x23, 0x7d, 0x93, 0x74, 0x05, 0xee, 0xc2, 0x3d, 0xec, 0xd5, 0xbd, 0x4c,
- 0x2f, 0x1d, 0x77, 0x88, 0x2b, 0x81, 0x5e, 0xc4}, // b
- {0x98, 0x43, 0xdc, 0x08, 0x7b, 0x99, 0xff, 0x4a, 0x38, 0xbd, 0x5f, 0xe9,
- 0xfc, 0xb9, 0x40, 0x3c, 0x31, 0x9b, 0x57, 0x7e, 0xff, 0x1c, 0x80, 0x92,
- 0x79, 0x97, 0x3d, 0xa9, 0xbb, 0x70, 0xe7, 0x4b}, // rx
- {0x85, 0x09, 0xac, 0xad, 0xcb, 0x5f, 0x24, 0x36, 0x21, 0x9e, 0xc7, 0x3a,
- 0x2b, 0xf6, 0x63, 0xe7, 0x0d, 0xef, 0x3f, 0x4d, 0x40, 0x94, 0x49, 0x7b,
- 0x2c, 0x89, 0xfe, 0xdc, 0xe7, 0x5b, 0xc5, 0x72}, // rf
- {0x0d, 0x6b, 0x41, 0x78, 0x87, 0xb7, 0x90, 0x17, 0x5c, 0xe1, 0x9d, 0xcb,
- 0x5d, 0x87, 0x69, 0xe6, 0xdd, 0xc0, 0xef, 0xbb, 0x3f, 0x4d, 0xaf, 0xec,
- 0x3a, 0x66, 0x66, 0xb3, 0x51, 0x49, 0xb8, 0xae}, // ra
- {0xaa, 0x42, 0x63, 0x36, 0x47, 0xe3, 0x9d, 0x5e, 0x7f, 0xcd, 0x07, 0xee,
- 0x26, 0xdc, 0xaf, 0x88, 0xf1, 0x9b, 0xae, 0xa4, 0x7c, 0xff, 0x2e, 0x4f,
- 0x7b, 0x6d, 0xb1, 0x42, 0x50, 0x9d, 0x89, 0x39} // rb
- },
- {
- {{{{0x10, 0x11, 0x7a, 0x7a, 0xbd, 0xe9, 0x4f, 0x96, 0xd7, 0x1e, 0x53,
- 0x05, 0x8d, 0x69, 0xb1, 0xdb, 0x3e, 0xf1, 0x3c, 0x24, 0xe2, 0x83,
- 0x06, 0x4b, 0xd6, 0xd9, 0xc6, 0x24, 0xf4, 0x7f, 0x67, 0x2c}}},
- {{{0x1a, 0xaf, 0x95, 0xfa, 0x7e, 0x59, 0xd2, 0x93, 0x39, 0x09, 0xae,
- 0x0b, 0xc3, 0xe8, 0xe5, 0xf7, 0x36, 0xe7, 0x06, 0xbf, 0xe3, 0xd2,
- 0x20, 0xbf, 0xd2, 0x31, 0x3f, 0xc1, 0x15, 0x61, 0x61,
- 0x03}}}}, // B
- {{{{0xcc, 0x9e, 0x80, 0x5e, 0x0c, 0x32, 0x44, 0x70, 0xe0, 0x44, 0x27,
- 0x7a, 0x01, 0xee, 0x51, 0x19, 0xa1, 0x4d, 0x0a, 0x24, 0x8b, 0xa2,
- 0xf8, 0xa3, 0x26, 0x56, 0x8c, 0x70, 0xe1, 0xa1, 0x83, 0x70}}},
- {{{0x4d, 0xf0, 0x73, 0x6f, 0xf4, 0x62, 0xc4, 0x30, 0x3e, 0xde, 0xff,
- 0xc0, 0x93, 0x92, 0xa4, 0x03, 0x6f, 0x84, 0x3a, 0x3c, 0x34, 0x25,
- 0x83, 0xb5, 0x2b, 0x90, 0x95, 0x6b, 0x24, 0x82, 0x6e,
- 0xe6}}}}, // K
- {{{{0xc6, 0x4c, 0xc8, 0x9d, 0xdc, 0x63, 0x46, 0x5b, 0xab, 0x79, 0xea,
- 0x49, 0x76, 0x47, 0x68, 0xe6, 0x2e, 0x7d, 0x0b, 0x49, 0xc0, 0x29,
- 0xe4, 0xc8, 0x84, 0xb5, 0x04, 0x2d, 0x15, 0xaa, 0x0d, 0xd4}}},
- {{{0x71, 0x43, 0xd0, 0x24, 0x3e, 0x00, 0xf4, 0x94, 0xad, 0x1e, 0x1e,
- 0x32, 0xea, 0x21, 0x4d, 0x83, 0xae, 0x63, 0x3c, 0x5a, 0xd4, 0xa5,
- 0x79, 0x9b, 0x2c, 0xad, 0x03, 0x50, 0xb6, 0x57, 0x0a,
- 0xbf}}}}, // T
- {{{{0xdd, 0x13, 0x14, 0x5a, 0x7d, 0x23, 0xc5, 0xf0, 0xcb, 0xa7, 0xd1,
- 0x79, 0x7a, 0x59, 0x91, 0xf3, 0x8f, 0xb3, 0xff, 0x27, 0x52, 0x0e,
- 0xe4, 0xc8, 0xb2, 0xe1, 0xc5, 0x29, 0x16, 0x2e, 0x0f, 0xcf}}},
- {{{0xcd, 0xb1, 0xed, 0x9a, 0xf3, 0x8a, 0xdd, 0x97, 0xe3, 0x58, 0xd8,
- 0x66, 0xc0, 0xb9, 0xe6, 0x5e, 0x86, 0x6b, 0xfc, 0xde, 0x25, 0x2b,
- 0x3c, 0x97, 0x4e, 0xc9, 0x26, 0x12, 0xf7, 0xde, 0xa6,
- 0x88}}}}, // R1
- {0x75, 0x5e, 0x75, 0xe8, 0x80, 0xa3, 0x3b, 0x5d, 0xb7, 0xf1, 0x93, 0x4e,
- 0x55, 0x6a, 0x14, 0x24, 0x8c, 0x74, 0xcd, 0x58, 0x25, 0xf8, 0x26, 0x6f,
- 0x21, 0xc1, 0x1f, 0xb1, 0x7a, 0xc5, 0x48, 0x6b, 0x01, 0x4e, 0xa0, 0xa7,
- 0xac, 0x55, 0x5b, 0x68, 0xba, 0x69, 0x17, 0xb0, 0x1e, 0x4a, 0x88, 0x70,
- 0xbc, 0xb8, 0x12, 0xd7, 0x3d, 0x1b, 0xb4, 0xee, 0x79, 0xdb, 0xa1, 0x31,
- 0xfb, 0x09, 0x3e, 0x89, 0xf6, 0x92, 0x0a, 0x81, 0x6a, 0xde, 0xe6, 0xb9,
- 0x26, 0x9e, 0x5f, 0x2a, 0x52, 0xa2, 0x2e, 0x44, 0x0c, 0x15, 0xce, 0xbf,
- 0x1f, 0xcf, 0x95, 0xe5, 0x17, 0x1c, 0xf3, 0xd2, 0x90, 0x04, 0xa4, 0xfa,
- 0x0e, 0x92, 0x8b, 0xa4, 0xcd, 0x2b, 0xdf, 0x78, 0x71, 0x98, 0xd7, 0x9f,
- 0xcd, 0xd1, 0x5e, 0x06, 0xdb, 0x6b, 0xdb, 0xff, 0x8d, 0xb4, 0x10, 0x73,
- 0xc8, 0xf6, 0xb9, 0x42, 0x54, 0xc4, 0x6a, 0xc3, 0xbb, 0xdc, 0xec, 0x6d,
- 0x2f, 0xec, 0xda, 0xb7, 0x74, 0x02, 0x59, 0xb9, 0xe0, 0x4c, 0xc5, 0x41,
- 0x8a, 0x00, 0x2b, 0x10, 0x45, 0x9a, 0xc3, 0x77, 0x98, 0x66, 0xcf, 0xcb,
- 0x44, 0xe7, 0x9a, 0x56, 0x40, 0xde, 0x74, 0x9b, 0x9f, 0x34, 0x9f, 0xc0,
- 0x59, 0x28, 0x27, 0x3f, 0x90, 0xe0, 0xaa, 0xba, 0x0d, 0x13, 0x8a, 0xec,
- 0x97, 0x2a, 0xef, 0xe7, 0xc9, 0x8f, 0xfa, 0xef, 0x14, 0x3a, 0xc2, 0x39,
- 0xf6, 0x54, 0xab, 0x28, 0x15, 0x9f, 0x8d, 0x91, 0x49, 0x94, 0x27, 0x72,
- 0x47, 0x97, 0x2a, 0x88, 0xb4, 0x95, 0xf4, 0xb7, 0xf3, 0x4d, 0xe3, 0xf0,
- 0x53, 0x69, 0x58, 0xaf, 0xb7, 0x22, 0x52, 0x05, 0x9c, 0xac, 0x52, 0xbb,
- 0x39, 0xc6, 0x6b, 0xfd, 0xfd, 0xdb, 0x1c, 0xf8, 0xa6, 0xce, 0xd6, 0xe6,
- 0x4a, 0xd5, 0xb4, 0xcf, 0x68, 0x24, 0x79, 0xf6, 0xb0, 0xb8, 0x62, 0x37,
- 0xc6, 0xa9, 0x14, 0x25, 0x07, 0xec, 0xde, 0x3a, 0x18, 0x13, 0xf9, 0x35,
- 0x8d, 0xd7, 0x40, 0x34, 0x8c, 0xe9, 0x3f, 0x97, 0xe1, 0x6e, 0xcf, 0x9e,
- 0xb0, 0x5d, 0x15, 0x5f, 0xd7, 0xd4, 0x92, 0x26, 0xa4, 0x87, 0x77, 0x47,
- 0x95, 0x53, 0x78, 0x4b, 0x77, 0xd4, 0xb4, 0xd4, 0xad, 0xd2, 0xeb, 0xfb,
- 0x70, 0x7b, 0xea, 0x6d, 0x88, 0x9b, 0xb6, 0xf9, 0x95, 0xa2, 0xae, 0x77,
- 0xd3, 0x29, 0x43, 0xeb, 0x25, 0x09, 0x3c, 0x68, 0xc5, 0xba, 0x6f, 0x6e,
- 0x19, 0x6a, 0x41, 0xb5, 0x02, 0x3f, 0x2e, 0xbe, 0x8e, 0xc4, 0x72, 0x47,
- 0x65, 0x7d, 0x2a, 0xbb, 0x55, 0xea, 0x01, 0x2c, 0x24, 0x28, 0x1d, 0x90,
- 0x63, 0xe5, 0x8e, 0x4f, 0xb7, 0x0e, 0x86, 0x09, 0x18, 0x5f, 0x1d, 0x69,
- 0x72, 0x1a, 0xff, 0x25, 0xb2, 0x82, 0x19, 0x66, 0xbc, 0x68, 0x02, 0x07,
- 0x02, 0x05, 0x07, 0x80, 0x88, 0xc9, 0x85, 0xf7, 0xa9, 0x32, 0x0a,
- 0x48}, // R2
- {0xb2, 0x9f, 0x28, 0x17, 0xa9, 0x3b, 0x93, 0x5d, 0x84, 0xaa, 0xb9, 0xd2,
- 0x61, 0x4c, 0xe4, 0x64, 0x79, 0x2b, 0xc2, 0x87, 0xe4, 0x7f, 0xe2, 0xd6,
- 0xe7, 0x20, 0x7f, 0x3f, 0x65, 0x3d, 0x03, 0xa5}, // a
- {0xf2, 0xfa, 0x9f, 0x28, 0x8f, 0x1f, 0xd0, 0x6b, 0xa2, 0xe3, 0x37, 0xce,
- 0x1c, 0x43, 0x82, 0x81, 0x18, 0x01, 0x75, 0x04, 0xf0, 0x2b, 0xb5, 0xb0,
- 0x46, 0x5d, 0x44, 0x7f, 0xaa, 0xb3, 0x8a, 0xd2}, // b
- {0xf3, 0xe0, 0xab, 0x75, 0x37, 0x41, 0x61, 0x0d, 0xf5, 0x4a, 0x1f, 0xa6,
- 0xee, 0xa5, 0xc6, 0x55, 0xd2, 0xa6, 0xce, 0x1c, 0x08, 0x64, 0x75, 0x22,
- 0x15, 0x81, 0x45, 0x76, 0x21, 0x2c, 0x32, 0xca}, // rx
- {0x6e, 0xfc, 0x5c, 0x0a, 0x79, 0x3a, 0x5d, 0xca, 0xe6, 0xdc, 0x30, 0x12,
- 0x96, 0x5a, 0x95, 0x3f, 0x8b, 0xa6, 0x86, 0x6d, 0x43, 0xf4, 0x4e, 0xfd,
- 0x4f, 0xf2, 0x7a, 0x80, 0xa5, 0xcc, 0x05, 0x56}, // rf
- {0xcb, 0x58, 0xde, 0x49, 0xd7, 0x19, 0xfa, 0xbf, 0x5f, 0x82, 0x19, 0x0e,
- 0x60, 0xb5, 0x0d, 0xde, 0xda, 0xb5, 0xf2, 0xb0, 0xcc, 0x2f, 0x65, 0x5e,
- 0x71, 0x08, 0xd6, 0xb5, 0xd5, 0xbc, 0x67, 0xc1}, // ra
- {0xe0, 0x3a, 0x71, 0xa7, 0x86, 0x56, 0xea, 0xd0, 0x19, 0xce, 0xa9, 0x65,
- 0xe8, 0x26, 0x11, 0x56, 0x5c, 0xcb, 0x04, 0x65, 0x36, 0xfd, 0xd9, 0x39,
- 0x35, 0xfa, 0x78, 0xa5, 0xc2, 0x3c, 0x2e, 0x17} // rb
- }};
+
const std::vector<uint8_t> EpidMemberTest::kGroupPublicKeyDataIkgf = {
#include "epid/common-testhelper/testdata/ikgf/groupa/pubkey.inc"
};
@@ -505,6 +338,18 @@ const std::vector<uint8_t> EpidMemberTest::kBsn1 = {'b', 's', 'n', '1'};
const GroupPubKey EpidMemberTest::kGrpXKey = {
#include "epid/common-testhelper/testdata/grp_x/pubkey.inc"
};
+const PrivKey EpidMemberTest::kGrpXMember0PrivKey = {
+#include "epid/common-testhelper/testdata/grp_x/member0/mprivkey.inc"
+};
+const PrivKey EpidMemberTest::kGrpXSigrevokedMember0PrivKey = {
+#include "epid/common-testhelper/testdata/grp_x/sigrevoked/mprivatekey000.inc"
+};
+const std::vector<uint8_t> EpidMemberTest::kGrpXSigRl = {
+#include "epid/common-testhelper/testdata/grp_x/sigrl.inc"
+};
+const std::vector<uint8_t> EpidMemberTest::kGrpXSigRlSingleEntry = {
+#include "epid/common-testhelper/testdata/grp_x/sigrl_single_entry.inc"
+};
const CompressedPrivKey EpidMemberTest::kGrpXMember9CompressedKey = {
#include "epid/common-testhelper/testdata/grp_x/cmember9/cmpprivkey.inc"
@@ -520,3 +365,5 @@ const GroupPubKey EpidMemberTest::kGrpYKey = {
const CompressedPrivKey EpidMemberTest::kGrpYMember9CompressedKey = {
#include "epid/common-testhelper/testdata/grp_y/cmember9/cmpprivkey.inc"
};
+
+const OctStr32 EpidMemberTest::kOctStr32_1 = {0x00, 0x00, 0x00, 0x01};
diff --git a/epid/member/unittests/member-testhelper.h b/epid/member/unittests/member-testhelper.h
index 5d720d2..614b585 100644
--- a/epid/member/unittests/member-testhelper.h
+++ b/epid/member/unittests/member-testhelper.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@
#include <vector>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
@@ -73,8 +74,6 @@ class EpidMemberTest : public ::testing::Test {
/// test data
static const MemberPrecomp kMemberPrecomp;
/// test data
- static const PreComputedSignature kPrecomputedSignatures[2];
- /// test data
static const std::vector<uint8_t> kGrp01Member0SigTest1Sha256;
/// test data
static const std::vector<uint8_t> kGrp01Member0SigTest1Sha384;
@@ -97,6 +96,14 @@ class EpidMemberTest : public ::testing::Test {
/// a group key in group X
static const GroupPubKey kGrpXKey;
+ /// a member 0 private key in group X
+ static const PrivKey kGrpXMember0PrivKey;
+ /// a member private key in group X revoked in SigRl
+ static const PrivKey kGrpXSigrevokedMember0PrivKey;
+ /// a SigRl of group X
+ static const std::vector<uint8_t> kGrpXSigRl;
+ /// a SigRl with single entry of group X
+ static const std::vector<uint8_t> kGrpXSigRlSingleEntry;
/// a compressed private key in group X
static const CompressedPrivKey kGrpXMember9CompressedKey;
/// a private key in group X
@@ -107,6 +114,9 @@ class EpidMemberTest : public ::testing::Test {
/// a compressed private key in group Y
static const CompressedPrivKey kGrpYMember9CompressedKey;
+ /// value "1" represented as an octstr constant
+ static const OctStr32 kOctStr32_1;
+
/// setup called before each TEST_F starts
virtual void SetUp() {}
/// teardown called after each TEST_F finishes
diff --git a/epid/member/unittests/nr_prove-test.cc b/epid/member/unittests/nr_prove-test.cc
index ebc4a59..a77873c 100644
--- a/epid/member/unittests/nr_prove-test.cc
+++ b/epid/member/unittests/nr_prove-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief NrProve unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
@@ -263,7 +264,7 @@ TEST_F(EpidMemberTest, GeneratesNrProofUsingSha512HashAlg) {
&sig_rl->bk[0], &proof));
}
-TEST_F(EpidMemberTest, DISABLED_GeneratesNrProofUsingSha512256HashAlg) {
+TEST_F(EpidMemberTest, GeneratesNrProofUsingSha512256HashAlg) {
Prng my_prng;
MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
this->kMemberPrecomp, &Prng::Generate, &my_prng);
diff --git a/epid/member/unittests/presig-test.cc b/epid/member/unittests/presig-test.cc
index 95538ac..70c79a0 100644
--- a/epid/member/unittests/presig-test.cc
+++ b/epid/member/unittests/presig-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@
#include <algorithm>
#include <vector>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
@@ -36,16 +37,6 @@ extern "C" {
/// Count of elements in array
#define COUNT_OF(A) (sizeof(A) / sizeof((A)[0]))
-bool operator==(PreComputedSignature const& lhs,
- PreComputedSignature const& rhs) {
- return 0 == std::memcmp(&lhs, &rhs, sizeof(lhs));
-}
-
-bool operator!=(PreComputedSignature const& lhs,
- PreComputedSignature const& rhs) {
- return !(lhs == rhs);
-}
-
namespace {
///////////////////////////////////////////////////////////////////////
@@ -55,9 +46,7 @@ TEST_F(EpidMemberTest, AddPreSigsFailsGivenNullPointer) {
MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
this->kMemberPrecomp, &Prng::Generate, &my_prng);
- PreComputedSignature presig = this->kPrecomputedSignatures[0];
-
- EXPECT_EQ(kEpidBadArgErr, EpidAddPreSigs(nullptr, 1, &presig));
+ EXPECT_EQ(kEpidBadArgErr, EpidAddPreSigs(nullptr, 1));
}
TEST_F(EpidMemberTest, AddPreSigsFailsGivenHugeNumberOfPreSigs) {
@@ -65,11 +54,8 @@ TEST_F(EpidMemberTest, AddPreSigsFailsGivenHugeNumberOfPreSigs) {
MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
this->kMemberPrecomp, &Prng::Generate, &my_prng);
- PreComputedSignature presig = this->kPrecomputedSignatures[0];
-
// number_presigs = 0x80..01 of size equal to sizeof(size_t)
- EXPECT_EQ(kEpidBadArgErr,
- EpidAddPreSigs(member, (SIZE_MAX >> 1) + 2, &presig));
+ EXPECT_NE(kEpidNoErr, EpidAddPreSigs(member, (SIZE_MAX >> 1) + 2));
}
TEST_F(EpidMemberTest,
@@ -78,50 +64,28 @@ TEST_F(EpidMemberTest,
MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
this->kMemberPrecomp, &Prng::Generate, &my_prng);
- ASSERT_EQ(kEpidNoErr, EpidAddPreSigs(member, 2, nullptr));
- ASSERT_EQ(kEpidNoErr, EpidAddPreSigs(member, 1, nullptr));
+ ASSERT_EQ(kEpidNoErr, EpidAddPreSigs(member, 2));
+ ASSERT_EQ(kEpidNoErr, EpidAddPreSigs(member, 1));
// request to generate 0 pre-computed signatures do nothing
- ASSERT_EQ(kEpidNoErr, EpidAddPreSigs(member, 0, nullptr));
+ ASSERT_EQ(kEpidNoErr, EpidAddPreSigs(member, 0));
EXPECT_EQ((size_t)3, EpidGetNumPreSigs(member));
}
-TEST_F(EpidMemberTest, AddPreSigsClearsInputPresigBuffer) {
- Prng my_prng;
- MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
- this->kMemberPrecomp, &Prng::Generate, &my_prng);
-
- // For a test purposes allocate an array of precomputed signatures with
- // all elements initialized to the same precomputed signature.
- // Warning: Do not use precomputed signatures twice in production code!
- std::vector<PreComputedSignature> presigs(2, this->kPrecomputedSignatures[0]);
-
- ASSERT_EQ(kEpidNoErr, EpidAddPreSigs(member, presigs.size(), presigs.data()));
- EXPECT_TRUE(std::all_of((uint8_t*)presigs.data(),
- (uint8_t*)(presigs.data() + presigs.size()),
- [](uint8_t a) { return 0 == a; }));
-}
-
TEST_F(EpidMemberTest, AddPreSigsAddsCorrectNumberOfPresigsGivenValidInput) {
Prng my_prng;
MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
this->kMemberPrecomp, &Prng::Generate, &my_prng);
- // For a test purposes allocate an arrays of precomputed signatures with
- // all elements initialized to the same precomputed signature.
- // Warning: Do not use precomputed signatures twice in production code!
- std::vector<PreComputedSignature> presigs1(2,
- this->kPrecomputedSignatures[0]);
- std::vector<PreComputedSignature> presigs2 = presigs1;
+ const size_t presigs1_added = 2;
+ const size_t presigs2_added = 3;
// add
- ASSERT_EQ(kEpidNoErr,
- EpidAddPreSigs(member, presigs1.size(), presigs1.data()));
+ ASSERT_EQ(kEpidNoErr, EpidAddPreSigs(member, presigs1_added));
// extend
- ASSERT_EQ(kEpidNoErr,
- EpidAddPreSigs(member, presigs2.size(), presigs2.data()));
+ ASSERT_EQ(kEpidNoErr, EpidAddPreSigs(member, presigs2_added));
// add empty pre-computed signatures array does not affect internal pool
- ASSERT_EQ(kEpidNoErr, EpidAddPreSigs(member, 0, presigs2.data()));
- EXPECT_EQ(presigs1.size() + presigs2.size(), EpidGetNumPreSigs(member));
+ ASSERT_EQ(kEpidNoErr, EpidAddPreSigs(member, 0));
+ EXPECT_EQ(presigs1_added + presigs2_added, EpidGetNumPreSigs(member));
}
///////////////////////////////////////////////////////////////////////
@@ -143,104 +107,10 @@ TEST_F(EpidMemberTest, GetNumPreSigsReturnsNumberOfAddedPresigs) {
MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
this->kMemberPrecomp, &Prng::Generate, &my_prng);
- // For a test purposes allocate an array of precomputed signatures with
- // all elements initialized to the same precomputed signature.
- // Warning: Do not use precomputed signatures twice in production code!
- std::vector<PreComputedSignature> presigs(5, this->kPrecomputedSignatures[0]);
-
- THROW_ON_EPIDERR(EpidAddPreSigs(member, presigs.size(), presigs.data()));
- EXPECT_EQ(presigs.size(), EpidGetNumPreSigs(member));
-}
-///////////////////////////////////////////////////////////////////////
-// EpidWritePreSigs
-TEST_F(EpidMemberTest, WritePreSigsFailsGivenNullPointer) {
- Prng my_prng;
- MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
- this->kMemberPrecomp, &Prng::Generate, &my_prng);
- PreComputedSignature presig;
-
- EXPECT_EQ(kEpidBadArgErr, EpidWritePreSigs(nullptr, &presig, 0));
-}
-
-TEST_F(EpidMemberTest, WritePreSigsFailsGivenWrongNumberOfPresigs) {
- Prng my_prng;
- MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
- this->kMemberPrecomp, &Prng::Generate, &my_prng);
-
- PreComputedSignature presig = this->kPrecomputedSignatures[0];
-
- // add one pre-computed signature
- THROW_ON_EPIDERR(EpidAddPreSigs(member, 1, &presig));
- // export more pre-computed signatures than available
- EXPECT_EQ(kEpidBadArgErr, EpidWritePreSigs(member, &presig, 2));
-}
-
-TEST_F(EpidMemberTest, WritePreSigsClearsPresigsOnSuccess) {
- Prng my_prng;
- MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
- this->kMemberPrecomp, &Prng::Generate, &my_prng);
-
- std::vector<PreComputedSignature> presigs(
- COUNT_OF(this->kPrecomputedSignatures));
- presigs.assign(std::begin(this->kPrecomputedSignatures),
- std::end(this->kPrecomputedSignatures));
-
- THROW_ON_EPIDERR(EpidAddPreSigs(member, presigs.size(), presigs.data()));
-
- // can export some but not all
- EXPECT_EQ(kEpidNoErr, EpidWritePreSigs(member, presigs.data(), 1));
- EXPECT_EQ(presigs.size() - 1, EpidGetNumPreSigs(member));
- // can export all the rest
- EXPECT_EQ(kEpidNoErr,
- EpidWritePreSigs(member, presigs.data() + 1, presigs.size() - 1));
- // check that all exported
- EXPECT_EQ((size_t)0, EpidGetNumPreSigs(member));
- // check that both write operations export (and leave) correct values.
- EXPECT_EQ(presigs.end(), std::unique(presigs.begin(), presigs.end()));
-}
-
-TEST_F(EpidMemberTest, CanWriteAddedPresigs) {
- Prng my_prng;
- MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
- this->kMemberPrecomp, &Prng::Generate, &my_prng);
-
- PreComputedSignature presig0 = this->kPrecomputedSignatures[0];
- PreComputedSignature presig1 = this->kPrecomputedSignatures[1];
- PreComputedSignature presigs[2] = {presig0, presig1};
-
- THROW_ON_EPIDERR(EpidAddPreSigs(member, COUNT_OF(presigs), presigs));
-
- EXPECT_EQ(kEpidNoErr, EpidWritePreSigs(member, presigs, COUNT_OF(presigs)));
- // compare ignoring order
- EXPECT_TRUE((presig0 == presigs[0] && presig1 == presigs[1]) ||
- (presig0 == presigs[1] && presig1 == presigs[0]));
-}
-
-TEST_F(EpidMemberTest, CanWriteGeneratedPresigs) {
- Prng my_prng;
- MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
- this->kMemberPrecomp, &Prng::Generate, &my_prng);
-
- PreComputedSignature zero_buffer;
- memset(&zero_buffer, 0, sizeof(zero_buffer));
- PreComputedSignature presigs[2] = {zero_buffer, zero_buffer};
-
- THROW_ON_EPIDERR(EpidAddPreSigs(member, COUNT_OF(presigs), nullptr));
-
- EXPECT_EQ(kEpidNoErr, EpidWritePreSigs(member, presigs, COUNT_OF(presigs)));
- // check pre-computed signature were written
- EXPECT_NE(zero_buffer, presigs[0]);
- EXPECT_NE(zero_buffer, presigs[1]);
-}
-
-TEST_F(EpidMemberTest, WritePreSigsCanWriteZeroPresigs) {
- Prng my_prng;
- MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
- this->kMemberPrecomp, &Prng::Generate, &my_prng);
-
- PreComputedSignature presig;
+ const size_t presigs_added = 5;
- EXPECT_EQ(kEpidNoErr, EpidWritePreSigs(member, &presig, 0));
+ THROW_ON_EPIDERR(EpidAddPreSigs(member, presigs_added));
+ EXPECT_EQ(presigs_added, EpidGetNumPreSigs(member));
}
} // namespace
diff --git a/epid/member/unittests/request_join-test.cc b/epid/member/unittests/request_join-test.cc
index d444974..3ddce19 100644
--- a/epid/member/unittests/request_join-test.cc
+++ b/epid/member/unittests/request_join-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
*/
#include <memory>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
@@ -211,110 +212,164 @@ TEST_F(EpidMemberTest, GeneratesDiffJoinRequestsGivenDiffHashAlgs) {
EXPECT_NE(0, memcmp(&join_request1, &join_request2, sizeof(join_request1)));
}
-TEST_F(EpidMemberTest, PrivateKeyValidationFailsGivenNullParameters) {
- EXPECT_FALSE(EpidIsPrivKeyInGroup(&this->kGrpXKey, nullptr));
- EXPECT_FALSE(EpidIsPrivKeyInGroup(nullptr, &this->kGrpXMember9PrivKey));
+TEST_F(EpidMemberTest, EpidAssemblePrivKeyFailsGivenNullParameters) {
+ MembershipCredential credential = {this->kGrpXMember9PrivKey.gid,
+ this->kGrpXMember9PrivKey.A,
+ this->kGrpXMember9PrivKey.x};
+ PrivKey new_priv_key;
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidAssemblePrivKey(nullptr, &this->kGrpXMember9PrivKey.f,
+ &this->kGrpXKey, &new_priv_key));
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidAssemblePrivKey(&credential, nullptr, &this->kGrpXKey,
+ &new_priv_key));
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidAssemblePrivKey(&credential, &this->kGrpXMember9PrivKey.f,
+ nullptr, &new_priv_key));
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidAssemblePrivKey(&credential, &this->kGrpXMember9PrivKey.f,
+ &this->kGrpXKey, nullptr));
}
-TEST_F(EpidMemberTest, PrivateKeyValidationFailsGivenGroupIDMissmatch) {
+TEST_F(EpidMemberTest, EpidAssemblePrivKeyFailsGivenGroupIdMissmatch) {
// Check wrong gid for GroupPubKey
+ PrivKey new_priv_key;
+ MembershipCredential credential = {this->kGrpXMember9PrivKey.gid,
+ this->kGrpXMember9PrivKey.A,
+ this->kGrpXMember9PrivKey.x};
+ FpElemStr f = this->kGrpXMember9PrivKey.f;
GroupPubKey group_pub_key = this->kGrpXKey;
group_pub_key.gid.data[0] = group_pub_key.gid.data[0] ^ 0xFF;
- EXPECT_FALSE(
- EpidIsPrivKeyInGroup(&group_pub_key, &this->kGrpXMember9PrivKey));
+ EXPECT_EQ(kEpidBadArgErr, EpidAssemblePrivKey(&credential, &f, &group_pub_key,
+ &new_priv_key));
// Check wrong gid for PrivKey
- PrivKey priv_key = this->kGrpXMember9PrivKey;
- priv_key.gid.data[sizeof(priv_key.gid.data) - 1] =
- priv_key.gid.data[sizeof(priv_key.gid.data) - 1] ^ 0xFF;
- EXPECT_FALSE(EpidIsPrivKeyInGroup(&this->kGrpXKey, &priv_key));
+ credential.gid.data[sizeof(credential.gid.data) - 1] =
+ credential.gid.data[sizeof(credential.gid.data) - 1] ^ 0xFF;
+ EXPECT_EQ(
+ kEpidBadArgErr,
+ EpidAssemblePrivKey(&credential, &f, &this->kGrpXKey, &new_priv_key));
// Check wrong gid for both GroupPubKey and PrivKey
- EXPECT_FALSE(EpidIsPrivKeyInGroup(&group_pub_key, &priv_key));
+ EXPECT_EQ(kEpidBadArgErr, EpidAssemblePrivKey(&credential, &f, &group_pub_key,
+ &new_priv_key));
}
-TEST_F(EpidMemberTest, PrivateKeyValidationRejectsInvalidPrivKey) {
+TEST_F(EpidMemberTest, EpidAssemblePrivKeyRejectsInvalidPrivKey) {
// test for invalid key components values (eg. out of range, not in EC group)
- PrivKey priv_key = this->kGrpXMember9PrivKey;
- priv_key.A.x.data.data[0] = 0xFF;
- EXPECT_FALSE(EpidIsPrivKeyInGroup(&this->kGrpXKey, &priv_key));
+ PrivKey new_priv_key;
+ MembershipCredential credential = {this->kGrpXMember9PrivKey.gid,
+ this->kGrpXMember9PrivKey.A,
+ this->kGrpXMember9PrivKey.x};
+ FpElemStr f = this->kGrpXMember9PrivKey.f;
+ credential.A.x.data.data[0] = 0xFF;
+ EXPECT_EQ(
+ kEpidBadArgErr,
+ EpidAssemblePrivKey(&credential, &f, &this->kGrpXKey, &new_priv_key));
+ credential.A = this->kGrpXMember9PrivKey.A;
+
+ credential.A.y.data.data[0] = 0xFF;
+ EXPECT_EQ(
+ kEpidBadArgErr,
+ EpidAssemblePrivKey(&credential, &f, &this->kGrpXKey, &new_priv_key));
+ credential.A = this->kGrpXMember9PrivKey.A;
- priv_key = this->kGrpXMember9PrivKey;
- priv_key.A.y.data.data[0] = 0xFF;
- EXPECT_FALSE(EpidIsPrivKeyInGroup(&this->kGrpXKey, &priv_key));
-
- priv_key = this->kGrpXMember9PrivKey;
FpElemStr inv_f = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
};
- priv_key.f = inv_f;
- EXPECT_FALSE(EpidIsPrivKeyInGroup(&this->kGrpXKey, &priv_key));
-
- priv_key = this->kGrpXMember9PrivKey;
- priv_key.x.data.data[0] = 0xFF;
- EXPECT_FALSE(EpidIsPrivKeyInGroup(&this->kGrpXKey, &priv_key));
+ EXPECT_EQ(
+ kEpidBadArgErr,
+ EpidAssemblePrivKey(&credential, &inv_f, &this->kGrpXKey, &new_priv_key));
+
+ credential.x.data.data[0] = 0xFF;
+ EXPECT_EQ(
+ kEpidBadArgErr,
+ EpidAssemblePrivKey(&credential, &f, &this->kGrpXKey, &new_priv_key));
}
-TEST_F(EpidMemberTest, PrivateKeyValidationRejectsInvalidGroupKey) {
+TEST_F(EpidMemberTest, EpidAssemblePrivKeyRejectsInvalidGroupKey) {
// test for invalid key components values (eg. out of range, not in EC group)
+ PrivKey new_priv_key;
+ MembershipCredential credential = {this->kGrpXMember9PrivKey.gid,
+ this->kGrpXMember9PrivKey.A,
+ this->kGrpXMember9PrivKey.x};
+ FpElemStr f = this->kGrpXMember9PrivKey.f;
GroupPubKey pub_key = this->kGrpXKey;
pub_key.h1.x.data.data[0] = 0xFF;
- EXPECT_FALSE(EpidIsPrivKeyInGroup(&pub_key, &this->kGrpXMember9PrivKey));
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidAssemblePrivKey(&credential, &f, &pub_key, &new_priv_key));
pub_key = this->kGrpXKey;
pub_key.h1.y.data.data[0] = 0xFF;
- EXPECT_FALSE(EpidIsPrivKeyInGroup(&pub_key, &this->kGrpXMember9PrivKey));
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidAssemblePrivKey(&credential, &f, &pub_key, &new_priv_key));
pub_key = this->kGrpXKey;
pub_key.h2.x.data.data[0] = 0xFF;
- EXPECT_FALSE(EpidIsPrivKeyInGroup(&pub_key, &this->kGrpXMember9PrivKey));
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidAssemblePrivKey(&credential, &f, &pub_key, &new_priv_key));
pub_key = this->kGrpXKey;
pub_key.h2.y.data.data[0] = 0xFF;
- EXPECT_FALSE(EpidIsPrivKeyInGroup(&pub_key, &this->kGrpXMember9PrivKey));
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidAssemblePrivKey(&credential, &f, &pub_key, &new_priv_key));
pub_key = this->kGrpXKey;
pub_key.w.x[0].data.data[0] = 0xFF;
- EXPECT_FALSE(EpidIsPrivKeyInGroup(&pub_key, &this->kGrpXMember9PrivKey));
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidAssemblePrivKey(&credential, &f, &pub_key, &new_priv_key));
pub_key = this->kGrpXKey;
pub_key.w.x[1].data.data[0] = 0xFF;
- EXPECT_FALSE(EpidIsPrivKeyInGroup(&pub_key, &this->kGrpXMember9PrivKey));
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidAssemblePrivKey(&credential, &f, &pub_key, &new_priv_key));
pub_key = this->kGrpXKey;
pub_key.w.y[0].data.data[0] = 0xFF;
- EXPECT_FALSE(EpidIsPrivKeyInGroup(&pub_key, &this->kGrpXMember9PrivKey));
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidAssemblePrivKey(&credential, &f, &pub_key, &new_priv_key));
pub_key = this->kGrpXKey;
pub_key.w.y[1].data.data[0] = 0xFF;
- EXPECT_FALSE(EpidIsPrivKeyInGroup(&pub_key, &this->kGrpXMember9PrivKey));
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidAssemblePrivKey(&credential, &f, &pub_key, &new_priv_key));
}
-TEST_F(EpidMemberTest, PrivateKeyValidationRejectsKeyNotInGroup) {
- EXPECT_FALSE(
- EpidIsPrivKeyInGroup(&this->kGrpYKey, &this->kGrpXMember9PrivKey));
+TEST_F(EpidMemberTest, EpidAssemblePrivKeyRejectsKeyNotInGroup) {
+ PrivKey new_priv_key;
+ MembershipCredential credential = {this->kGrpXMember9PrivKey.gid,
+ this->kGrpXMember9PrivKey.A,
+ this->kGrpXMember9PrivKey.x};
+ FpElemStr f = this->kGrpXMember9PrivKey.f;
+ EXPECT_EQ(
+ kEpidBadArgErr,
+ EpidAssemblePrivKey(&credential, &f, &this->kGrpYKey, &new_priv_key));
}
-TEST_F(EpidMemberTest, PrivateKeyValidationRejectsKeyNotInGroupUsingIKGFData) {
+TEST_F(EpidMemberTest, EpidAssemblePrivKeyRejectsKeyNotInGroupUsingIKGFData) {
const GroupPubKey* grp_public_key = reinterpret_cast<const GroupPubKey*>(
this->kGroupPublicKeyDataIkgf.data());
const PrivKey mbr_private_key = {
#include "epid/common-testhelper/testdata/ikgf/groupb/member0/mprivkey.inc"
};
- EXPECT_FALSE(EpidIsPrivKeyInGroup(grp_public_key, &mbr_private_key));
-}
-
-TEST_F(EpidMemberTest, PrivateKeyValidationAcceptsKeyInGroup) {
- EXPECT_TRUE(
- EpidIsPrivKeyInGroup(&this->kGrpXKey, &this->kGrpXMember9PrivKey));
+ PrivKey new_priv_key;
+ MembershipCredential credential = {mbr_private_key.gid, mbr_private_key.A,
+ mbr_private_key.x};
+ FpElemStr f = mbr_private_key.f;
+ EXPECT_EQ(kEpidBadArgErr, EpidAssemblePrivKey(&credential, &f, grp_public_key,
+ &new_priv_key));
}
-TEST_F(EpidMemberTest, PrivateKeyValidationAcceptsKeyInGroupUsingIKGFData) {
- const GroupPubKey* grp_public_key = reinterpret_cast<const GroupPubKey*>(
- this->kGroupPublicKeyDataIkgf.data());
- const PrivKey* mbr_private_key =
- reinterpret_cast<const PrivKey*>(this->kMemberPrivateKeyDataIkgf.data());
- EXPECT_TRUE(EpidIsPrivKeyInGroup(grp_public_key, mbr_private_key));
+TEST_F(EpidMemberTest, EpidAssemblePrivKeyAssemblesKeyInGroup) {
+ MembershipCredential credential = {this->kGrpXMember9PrivKey.gid,
+ this->kGrpXMember9PrivKey.A,
+ this->kGrpXMember9PrivKey.x};
+ PrivKey new_priv_key;
+ EXPECT_EQ(kEpidNoErr,
+ EpidAssemblePrivKey(&credential, &this->kGrpXMember9PrivKey.f,
+ &this->kGrpXKey, &new_priv_key));
+ EXPECT_EQ(0, memcmp(&this->kGrpXMember9PrivKey, &new_priv_key,
+ sizeof(new_priv_key)));
}
} // namespace
diff --git a/epid/member/unittests/sign-test.cc b/epid/member/unittests/sign-test.cc
index ce24b8a..46dc838 100644
--- a/epid/member/unittests/sign-test.cc
+++ b/epid/member/unittests/sign-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief Sign unit tests.
*/
#include <vector>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
@@ -48,18 +49,19 @@ TEST_F(EpidMemberTest, SignFailsGivenNullParameters) {
SigRl srl = {{{0}}, {{0}}, {{0}}, {{{{0}, {0}}, {{0}, {0}}}}};
srl.gid = this->kGroupPublicKey.gid;
std::vector<uint8_t> sig(EpidGetSigSize(&srl));
- EXPECT_EQ(kEpidBadArgErr, EpidSign(nullptr, msg.data(), msg.size(),
- bsn.data(), bsn.size(), &srl, sizeof(srl),
- (EpidSignature*)sig.data(), sig.size()));
+ THROW_ON_EPIDERR(
+ EpidMemberSetSigRl(member, &srl, sizeof(srl) - sizeof(srl.bk)));
EXPECT_EQ(kEpidBadArgErr,
- EpidSign(member, msg.data(), msg.size(), bsn.data(), bsn.size(),
- &srl, sizeof(srl), nullptr, sig.size()));
+ EpidSign(nullptr, msg.data(), msg.size(), bsn.data(), bsn.size(),
+ (EpidSignature*)sig.data(), sig.size()));
+ EXPECT_EQ(kEpidBadArgErr, EpidSign(member, msg.data(), msg.size(), bsn.data(),
+ bsn.size(), nullptr, sig.size()));
EXPECT_EQ(kEpidBadArgErr,
- EpidSign(member, nullptr, msg.size(), bsn.data(), bsn.size(), &srl,
- sizeof(srl), (EpidSignature*)sig.data(), sig.size()));
+ EpidSign(member, nullptr, msg.size(), bsn.data(), bsn.size(),
+ (EpidSignature*)sig.data(), sig.size()));
EXPECT_EQ(kEpidBadArgErr,
- EpidSign(member, msg.data(), msg.size(), nullptr, bsn.size(), &srl,
- sizeof(srl), (EpidSignature*)sig.data(), sig.size()));
+ EpidSign(member, msg.data(), msg.size(), nullptr, bsn.size(),
+ (EpidSignature*)sig.data(), sig.size()));
}
TEST_F(EpidMemberTest, SignFailsGivenWrongSigLen) {
@@ -70,37 +72,20 @@ TEST_F(EpidMemberTest, SignFailsGivenWrongSigLen) {
auto& bsn = this->kBsn0;
SigRl srl = {{{0}}, {{0}}, {{0}}, {{{{0}, {0}}, {{0}, {0}}}}};
srl.gid = this->kGroupPublicKey.gid;
+ THROW_ON_EPIDERR(
+ EpidMemberSetSigRl(member, &srl, sizeof(srl) - sizeof(srl.bk)));
// signature buffer one byte less than needed
std::vector<uint8_t> sig_small(EpidGetSigSize(&srl) - 1);
EXPECT_EQ(kEpidBadArgErr,
EpidSign(member, msg.data(), msg.size(), bsn.data(), bsn.size(),
- &srl, sizeof(srl), (EpidSignature*)sig_small.data(),
- sig_small.size()));
+ (EpidSignature*)sig_small.data(), sig_small.size()));
// signature buffer is one byte - a less than allowed for EpidSignature
std::vector<uint8_t> sig_one(1);
- EXPECT_EQ(
- kEpidBadArgErr,
- EpidSign(member, msg.data(), msg.size(), bsn.data(), bsn.size(), &srl,
- sizeof(srl), (EpidSignature*)sig_one.data(), sig_one.size()));
-}
-
-TEST_F(EpidMemberTest, SignFailsGivenWrongSigRlLen) {
- Prng my_prng;
- MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
- this->kMemberPrecomp, &Prng::Generate, &my_prng);
- auto& msg = this->kMsg0;
- auto& bsn = this->kBsn0;
- SigRl srl = {{{0}}, {{0}}, {{0}}, {{{{0}, {0}}, {{0}, {0}}}}};
- srl.gid = this->kGroupPublicKey.gid;
-
- std::vector<uint8_t> sig(EpidGetSigSize(&srl));
- std::vector<uint8_t> srl_reduced(1);
EXPECT_EQ(kEpidBadArgErr,
EpidSign(member, msg.data(), msg.size(), bsn.data(), bsn.size(),
- (SigRl*)srl_reduced.data(), srl_reduced.size(),
- (EpidSignature*)sig.data(), sig.size()));
+ (EpidSignature*)sig_one.data(), sig_one.size()));
}
TEST_F(EpidMemberTest, SignFailsGivenUnregisteredBasename) {
@@ -113,11 +98,12 @@ TEST_F(EpidMemberTest, SignFailsGivenUnregisteredBasename) {
SigRl srl = {{{0}}, {{0}}, {{0}}, {{{{0}, {0}}, {{0}, {0}}}}};
srl.gid = this->kGroupPublicKey.gid;
std::vector<uint8_t> sig(EpidGetSigSize(&srl));
+ THROW_ON_EPIDERR(
+ EpidMemberSetSigRl(member, &srl, sizeof(srl) - sizeof(srl.bk)));
THROW_ON_EPIDERR(EpidRegisterBaseName(member, bsn.data(), bsn.size()));
- EXPECT_EQ(
- kEpidBadArgErr,
- EpidSign(member, msg.data(), msg.size(), bsn1.data(), bsn1.size(), &srl,
- sizeof(srl), (EpidSignature*)sig.data(), sig.size()));
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidSign(member, msg.data(), msg.size(), bsn1.data(), bsn1.size(),
+ (EpidSignature*)sig.data(), sig.size()));
}
/////////////////////////////////////////////////////////////////////////
@@ -131,12 +117,10 @@ TEST_F(EpidMemberTest, SignaturesOfSameMessageAreDifferent) {
std::vector<uint8_t> sig1(EpidGetSigSize(nullptr));
std::vector<uint8_t> sig2(EpidGetSigSize(nullptr));
// without signature based revocation list
- EXPECT_EQ(kEpidNoErr,
- EpidSign(member, msg.data(), msg.size(), nullptr, 0, nullptr, 0,
- (EpidSignature*)sig1.data(), sig1.size()));
- EXPECT_EQ(kEpidNoErr,
- EpidSign(member, msg.data(), msg.size(), nullptr, 0, nullptr, 0,
- (EpidSignature*)sig2.data(), sig2.size()));
+ EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
+ (EpidSignature*)sig1.data(), sig1.size()));
+ EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
+ (EpidSignature*)sig2.data(), sig2.size()));
EXPECT_TRUE(sig1.size() == sig2.size() &&
0 != memcmp(sig1.data(), sig2.data(), sig1.size()));
// with signature based revocation list
@@ -164,12 +148,11 @@ TEST_F(EpidMemberTest, SignaturesOfSameMessageAreDifferent) {
size_t srl1_size = sizeof(sig_rl_data_n2_one);
std::vector<uint8_t> sig3(EpidGetSigSize(srl1));
std::vector<uint8_t> sig4(EpidGetSigSize(srl1));
- EXPECT_EQ(kEpidNoErr,
- EpidSign(member, msg.data(), msg.size(), nullptr, 0, srl1,
- srl1_size, (EpidSignature*)sig3.data(), sig3.size()));
- EXPECT_EQ(kEpidNoErr,
- EpidSign(member, msg.data(), msg.size(), nullptr, 0, srl1,
- srl1_size, (EpidSignature*)sig4.data(), sig4.size()));
+ THROW_ON_EPIDERR(EpidMemberSetSigRl(member, srl1, srl1_size));
+ EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
+ (EpidSignature*)sig3.data(), sig3.size()));
+ EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
+ (EpidSignature*)sig4.data(), sig4.size()));
EXPECT_TRUE(sig3.size() == sig4.size() &&
0 != memcmp(sig3.data(), sig4.data(), sig3.size()));
}
@@ -185,10 +168,10 @@ TEST_F(EpidMemberTest, SignaturesOfSameMessageWithSameBasenameAreDifferent) {
THROW_ON_EPIDERR(EpidRegisterBaseName(member, bsn.data(), bsn.size()));
EXPECT_EQ(kEpidNoErr,
EpidSign(member, msg.data(), msg.size(), bsn.data(), bsn.size(),
- nullptr, 0, (EpidSignature*)sig1.data(), sig1.size()));
+ (EpidSignature*)sig1.data(), sig1.size()));
EXPECT_EQ(kEpidNoErr,
EpidSign(member, msg.data(), msg.size(), bsn.data(), bsn.size(),
- nullptr, 0, (EpidSignature*)sig2.data(), sig2.size()));
+ (EpidSignature*)sig2.data(), sig2.size()));
EXPECT_TRUE(sig1.size() == sig2.size() &&
0 != memcmp(sig1.data(), sig2.data(), sig1.size()));
@@ -217,12 +200,13 @@ TEST_F(EpidMemberTest, SignaturesOfSameMessageWithSameBasenameAreDifferent) {
size_t srl1_size = sizeof(sig_rl_data_n2_one);
std::vector<uint8_t> sig3(EpidGetSigSize(srl1));
std::vector<uint8_t> sig4(EpidGetSigSize(srl1));
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), bsn.data(),
- bsn.size(), srl1, srl1_size,
- (EpidSignature*)sig3.data(), sig3.size()));
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), bsn.data(),
- bsn.size(), srl1, srl1_size,
- (EpidSignature*)sig4.data(), sig4.size()));
+ THROW_ON_EPIDERR(EpidMemberSetSigRl(member, srl1, srl1_size));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), bsn.data(), bsn.size(),
+ (EpidSignature*)sig3.data(), sig3.size()));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), bsn.data(), bsn.size(),
+ (EpidSignature*)sig4.data(), sig4.size()));
EXPECT_TRUE(sig3.size() == sig4.size() &&
0 != memcmp(sig3.data(), sig4.data(), sig3.size()));
}
@@ -240,8 +224,8 @@ TEST_F(EpidMemberTest, SignsMessageUsingRandomBaseNoSigRl) {
std::vector<uint8_t> sig_data(EpidGetSigSize(nullptr));
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- nullptr, 0, sig, sig_len));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
VerifierCtxObj ctx(this->kGroupPublicKey);
EXPECT_EQ(kEpidSigValid,
EpidVerify(ctx, sig, sig_len, msg.data(), msg.size()));
@@ -257,8 +241,9 @@ TEST_F(EpidMemberTest, SignsMessageUsingRandomBaseWithSigRl) {
std::vector<uint8_t> sig_data(EpidGetSigSize(srl));
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- srl, srl_size, sig, sig_len));
+ THROW_ON_EPIDERR(EpidMemberSetSigRl(member, srl, srl_size));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
VerifierCtxObj ctx(this->kGroupPublicKey);
THROW_ON_EPIDERR(EpidVerifierSetSigRl(ctx, srl, srl_size));
EXPECT_EQ(kEpidSigValid,
@@ -276,7 +261,7 @@ TEST_F(EpidMemberTest, SignsMessageUsingBasenameNoSigRl) {
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), bsn.data(),
- bsn.size(), nullptr, 0, sig, sig_len));
+ bsn.size(), sig, sig_len));
// verify basic signature
VerifierCtxObj ctx(this->kGroupPublicKey);
THROW_ON_EPIDERR(EpidVerifierSetBasename(ctx, bsn.data(), bsn.size()));
@@ -297,8 +282,9 @@ TEST_F(EpidMemberTest, SignsMessageUsingBasenameWithSigRl) {
std::vector<uint8_t> sig_data(EpidGetSigSize(srl));
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
+ THROW_ON_EPIDERR(EpidMemberSetSigRl(member, srl, srl_size));
EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), bsn.data(),
- bsn.size(), srl, srl_size, sig, sig_len));
+ bsn.size(), sig, sig_len));
VerifierCtxObj ctx(this->kGroupPublicKey);
THROW_ON_EPIDERR(EpidVerifierSetBasename(ctx, bsn.data(), bsn.size()));
THROW_ON_EPIDERR(EpidVerifierSetSigRl(ctx, srl, srl_size));
@@ -316,8 +302,8 @@ TEST_F(EpidMemberTest, SignsUsingRandomBaseWithRegisteredBasenamesNoSigRl) {
std::vector<uint8_t> sig_data(EpidGetSigSize(nullptr));
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- nullptr, 0, sig, sig_len));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
VerifierCtxObj ctx(this->kGroupPublicKey);
EXPECT_EQ(kEpidSigValid,
EpidVerify(ctx, sig, sig_len, msg.data(), msg.size()));
@@ -335,8 +321,9 @@ TEST_F(EpidMemberTest, SignsUsingRandomBaseWithRegisteredBasenamesWithSigRl) {
std::vector<uint8_t> sig_data(EpidGetSigSize(srl));
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- srl, srl_size, sig, sig_len));
+ THROW_ON_EPIDERR(EpidMemberSetSigRl(member, srl, srl_size));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
VerifierCtxObj ctx(this->kGroupPublicKey);
THROW_ON_EPIDERR(EpidVerifierSetSigRl(ctx, srl, srl_size));
EXPECT_EQ(kEpidSigValid,
@@ -351,8 +338,8 @@ TEST_F(EpidMemberTest, SignsUsingRandomBaseWithoutRegisteredBasenamesNoSigRl) {
std::vector<uint8_t> sig_data(EpidGetSigSize(nullptr));
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- nullptr, 0, sig, sig_len));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
VerifierCtxObj ctx(this->kGroupPublicKey);
EXPECT_EQ(kEpidSigValid,
EpidVerify(ctx, sig, sig_len, msg.data(), msg.size()));
@@ -369,8 +356,9 @@ TEST_F(EpidMemberTest,
std::vector<uint8_t> sig_data(EpidGetSigSize(srl));
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- srl, srl_size, sig, sig_len));
+ THROW_ON_EPIDERR(EpidMemberSetSigRl(member, srl, srl_size));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
VerifierCtxObj ctx(this->kGroupPublicKey);
THROW_ON_EPIDERR(EpidVerifierSetSigRl(ctx, srl, srl_size));
EXPECT_EQ(kEpidSigValid,
@@ -380,73 +368,6 @@ TEST_F(EpidMemberTest,
/////////////////////////////////////////////////////////////////////////
// Variable sigRL
-TEST_F(EpidMemberTest, SignFailsGivenInvalidSigRl) {
- Prng my_prng;
- MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
- this->kMemberPrecomp, &Prng::Generate, &my_prng);
- auto& msg = this->kMsg0;
-
- // sign fail with mismatch gid
- uint8_t sig_rl_data_n2_one[] = {
- // gid
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x02,
- // version
- 0x00, 0x00, 0x00, 0x00,
- // n2
- 0x0, 0x00, 0x00, 0x01,
- // one bk
- 0x9c, 0xa5, 0xe5, 0xae, 0x5f, 0xae, 0x51, 0x59, 0x33, 0x35, 0x27, 0xd,
- 0x8, 0xb1, 0xbe, 0x5d, 0x69, 0x50, 0x84, 0xc5, 0xfe, 0xe2, 0x87, 0xea,
- 0x2e, 0xef, 0xfa, 0xee, 0x67, 0xf2, 0xd8, 0x28, 0x56, 0x43, 0xc6, 0x94,
- 0x67, 0xa6, 0x72, 0xf6, 0x41, 0x15, 0x4, 0x58, 0x42, 0x16, 0x88, 0x57,
- 0x9d, 0xc7, 0x71, 0xd1, 0xc, 0x84, 0x13, 0xa, 0x90, 0x23, 0x18, 0x8, 0xad,
- 0x7d, 0xfe, 0xf5, 0xc8, 0xae, 0xfc, 0x51, 0x40, 0xa7, 0xd1, 0x28, 0xc2,
- 0x89, 0xb2, 0x6b, 0x4e, 0xb4, 0xc1, 0x55, 0x87, 0x98, 0xbd, 0x72, 0xf9,
- 0xcf, 0xd, 0x40, 0x15, 0xee, 0x32, 0xc, 0xf3, 0x56, 0xc5, 0xc, 0x61, 0x9d,
- 0x4f, 0x7a, 0xb5, 0x2b, 0x16, 0xa9, 0xa3, 0x97, 0x38, 0xe2, 0xdd, 0x3a,
- 0x33, 0xad, 0xf6, 0x7b, 0x68, 0x8b, 0x68, 0xcf, 0xa3, 0xd3, 0x98, 0x37,
- 0xce, 0xec, 0xd1, 0xa8, 0xc, 0x8b};
- SigRl* srl = reinterpret_cast<SigRl*>(sig_rl_data_n2_one);
- size_t srl_size = sizeof(sig_rl_data_n2_one);
- size_t sig_len = EpidGetSigSize(srl);
- std::vector<uint8_t> newsig(sig_len);
- EpidSignature* sig = (EpidSignature*)newsig.data();
-
- EXPECT_EQ(kEpidBadArgErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- srl, srl_size, sig, sig_len));
-
- // sign fail given invalid sigrl size
- uint8_t sig_rl_data_n_one[] = {
- // gid
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- // version
- 0x00, 0x00, 0x00, 0x00,
- // n2
- 0x0, 0x00, 0x00, 0x00,
- // one bk
- 0x9c, 0xa5, 0xe5, 0xae, 0x5f, 0xae, 0x51, 0x59, 0x33, 0x35, 0x27, 0xd,
- 0x8, 0xb1, 0xbe, 0x5d, 0x69, 0x50, 0x84, 0xc5, 0xfe, 0xe2, 0x87, 0xea,
- 0x2e, 0xef, 0xfa, 0xee, 0x67, 0xf2, 0xd8, 0x28, 0x56, 0x43, 0xc6, 0x94,
- 0x67, 0xa6, 0x72, 0xf6, 0x41, 0x15, 0x4, 0x58, 0x42, 0x16, 0x88, 0x57,
- 0x9d, 0xc7, 0x71, 0xd1, 0xc, 0x84, 0x13, 0xa, 0x90, 0x23, 0x18, 0x8, 0xad,
- 0x7d, 0xfe, 0xf5, 0xc8, 0xae, 0xfc, 0x51, 0x40, 0xa7, 0xd1, 0x28, 0xc2,
- 0x89, 0xb2, 0x6b, 0x4e, 0xb4, 0xc1, 0x55, 0x87, 0x98, 0xbd, 0x72, 0xf9,
- 0xcf, 0xd, 0x40, 0x15, 0xee, 0x32, 0xc, 0xf3, 0x56, 0xc5, 0xc, 0x61, 0x9d,
- 0x4f, 0x7a, 0xb5, 0x2b, 0x16, 0xa9, 0xa3, 0x97, 0x38, 0xe2, 0xdd, 0x3a,
- 0x33, 0xad, 0xf6, 0x7b, 0x68, 0x8b, 0x68, 0xcf, 0xa3, 0xd3, 0x98, 0x37,
- 0xce, 0xec, 0xd1, 0xa8, 0xc, 0x8b};
- SigRl* srl1 = reinterpret_cast<SigRl*>(sig_rl_data_n_one);
- size_t srl1_size = sizeof(sig_rl_data_n_one);
- size_t sig_len1 = EpidGetSigSize(srl1);
- std::vector<uint8_t> newsig1(sig_len1);
- EpidSignature* sig1 = (EpidSignature*)newsig1.data();
-
- EXPECT_EQ(kEpidBadArgErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- srl1, srl1_size, sig1, sig_len1));
-}
-
TEST_F(EpidMemberTest, SignsMessageGivenNoSigRl) {
Prng my_prng;
MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
@@ -457,8 +378,8 @@ TEST_F(EpidMemberTest, SignsMessageGivenNoSigRl) {
std::vector<uint8_t> newsig(sig_len);
EpidSignature* sig = (EpidSignature*)newsig.data();
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- nullptr, 0, sig, sig_len));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
// verify signature
VerifierCtxObj ctx(this->kGroupPublicKey);
EXPECT_EQ(kEpidSigValid,
@@ -478,8 +399,8 @@ TEST_F(EpidMemberTest, SignsMessageGivenNoSigRlUsingIKGFData) {
MemberCtxObj member(grp_public_key, mbr_private_key, &Prng::Generate,
&my_prng);
EpidSignature* sig = (EpidSignature*)newsig.data();
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- nullptr, 0, sig, sig_len));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
// verify signature
VerifierCtxObj ctx(grp_public_key);
EXPECT_EQ(kEpidSigValid,
@@ -507,8 +428,9 @@ TEST_F(EpidMemberTest, SignsMessageGivenSigRlWithNoEntries) {
std::vector<uint8_t> sig_data(EpidGetSigSize(srl));
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- srl, srl_size, sig, sig_len));
+ THROW_ON_EPIDERR(EpidMemberSetSigRl(member, srl, srl_size));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
VerifierCtxObj ctx(this->kGroupPublicKey);
THROW_ON_EPIDERR(EpidVerifierSetSigRl(ctx, srl, srl_size));
EXPECT_EQ(kEpidSigValid,
@@ -534,8 +456,9 @@ TEST_F(EpidMemberTest, SignsMessageGivenSigRlWithNoEntriesUsingIkgfData) {
EpidSignature* sig_ikgf =
reinterpret_cast<EpidSignature*>(sig_data_ikgf.data());
size_t sig_len = sig_data_ikgf.size() * sizeof(uint8_t);
+ THROW_ON_EPIDERR(EpidMemberSetSigRl(member_ikgf, srl_ikgf, srl_size));
EXPECT_EQ(kEpidNoErr, EpidSign(member_ikgf, msg.data(), msg.size(), nullptr,
- 0, srl_ikgf, srl_size, sig_ikgf, sig_len));
+ 0, sig_ikgf, sig_len));
VerifierCtxObj ctx_ikgf(grp_public_key);
THROW_ON_EPIDERR(EpidVerifierSetSigRl(ctx_ikgf, srl_ikgf, srl_size));
EXPECT_EQ(kEpidSigValid,
@@ -584,8 +507,9 @@ TEST_F(EpidMemberTest, SignsMessageGivenSigRlWithEntries) {
std::vector<uint8_t> sig_data(EpidGetSigSize(srl));
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- srl, srl_size, sig, sig_len));
+ THROW_ON_EPIDERR(EpidMemberSetSigRl(member, srl, srl_size));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
VerifierCtxObj ctx(this->kGroupPublicKey);
THROW_ON_EPIDERR(EpidVerifierSetSigRl(ctx, srl, srl_size));
EXPECT_EQ(kEpidSigValid,
@@ -640,8 +564,9 @@ TEST_F(EpidMemberTest, SignsMessageGivenSigRlWithEntriesUsingIKGFData) {
EpidSignature* sig_ikgf =
reinterpret_cast<EpidSignature*>(sig_data_ikgf.data());
size_t sig_len = sig_data_ikgf.size() * sizeof(uint8_t);
+ THROW_ON_EPIDERR(EpidMemberSetSigRl(member_ikgf, srl_ikgf, srl_size));
EXPECT_EQ(kEpidNoErr, EpidSign(member_ikgf, msg.data(), msg.size(), nullptr,
- 0, srl_ikgf, srl_size, sig_ikgf, sig_len));
+ 0, sig_ikgf, sig_len));
VerifierCtxObj ctx_ikgf(grp_public_key);
THROW_ON_EPIDERR(EpidVerifierSetSigRl(ctx_ikgf, srl_ikgf, srl_size));
EXPECT_EQ(kEpidSigValid,
@@ -650,36 +575,29 @@ TEST_F(EpidMemberTest, SignsMessageGivenSigRlWithEntriesUsingIKGFData) {
TEST_F(EpidMemberTest, SignMessageReportsIfMemberRevoked) {
// note: a complete sig + nr proof should still be returned!!
- const GroupPubKey pub_key = {
-#include "epid/common-testhelper/testdata/grp_x/pubkey.inc"
- };
- const PrivKey priv_key = {
-#include "epid/common-testhelper/testdata/grp_x/member0/mprivkey.inc"
- };
- Prng my_prng;
- MemberCtxObj member(pub_key, priv_key, this->kMemberPrecomp, &Prng::Generate,
- &my_prng);
+ auto& pub_key = this->kGrpXKey;
+ auto& priv_key = this->kGrpXMember0PrivKey;
auto& msg = this->kMsg0;
- auto& bsn = this->kBsn0;
- THROW_ON_EPIDERR(EpidRegisterBaseName(member, bsn.data(), bsn.size()));
- const std::vector<uint8_t> kGrpXSigRlMember0Sha256Bsn0Msg0FirstEntry = {
-#include "epid/common-testhelper/testdata/grp_x/sigrl_member0_sig_sha256_bsn0_msg0_revoked_middle_entry.inc"
+ Prng my_prng;
+ MemberCtxObj member(pub_key, priv_key, &Prng::Generate, &my_prng);
+ const std::vector<uint8_t> kGrpXSigRlMember0Sha512Rndbase0Msg0MiddleEntry = {
+#include "epid/common-testhelper/testdata/grp_x/sigrl_member0_sig_sha512_rndbase_msg0_revoked_middle_entry.inc"
};
auto srl = reinterpret_cast<SigRl const*>(
- kGrpXSigRlMember0Sha256Bsn0Msg0FirstEntry.data());
- size_t srl_size = kGrpXSigRlMember0Sha256Bsn0Msg0FirstEntry.size();
+ kGrpXSigRlMember0Sha512Rndbase0Msg0MiddleEntry.data());
+ size_t srl_size = kGrpXSigRlMember0Sha512Rndbase0Msg0MiddleEntry.size();
std::vector<uint8_t> sig_data(EpidGetSigSize(srl));
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
- EXPECT_EQ(kEpidBadArgErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- srl, srl_size, sig, sig_len));
+ THROW_ON_EPIDERR(EpidMemberSetSigRl(member, srl, srl_size));
+ EXPECT_EQ(kEpidSigRevokedInSigRl,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
VerifierCtxObj ctx(pub_key);
- THROW_ON_EPIDERR(EpidVerifierSetBasename(ctx, bsn.data(), bsn.size()));
THROW_ON_EPIDERR(EpidVerifierSetSigRl(ctx, srl, srl_size));
- EXPECT_EQ(kEpidSigInvalid,
+ EXPECT_EQ(kEpidSigRevokedInSigRl,
EpidVerify(ctx, sig, sig_len, msg.data(), msg.size()));
}
@@ -694,8 +612,6 @@ TEST_F(EpidMemberTest, SignMessageReportsIfMemberRevokedUsingIKGFData) {
MemberCtxObj member(grp_public_key, member_private_key_revoked_by_sig,
&Prng::Generate, &my_prng);
auto& msg = this->kMsg0;
- auto& bsn = this->kBsn0;
- THROW_ON_EPIDERR(EpidRegisterBaseName(member, bsn.data(), bsn.size()));
const std::vector<uint8_t> sig_Rl = {
#include "epid/common-testhelper/testdata/ikgf/groupa/sigrl.inc"
};
@@ -705,15 +621,14 @@ TEST_F(EpidMemberTest, SignMessageReportsIfMemberRevokedUsingIKGFData) {
std::vector<uint8_t> sig_data(EpidGetSigSize(srl));
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
+ THROW_ON_EPIDERR(EpidMemberSetSigRl(member, srl, srl_size));
EXPECT_EQ(kEpidSigRevokedInSigRl,
- EpidSign(member, msg.data(), msg.size(), nullptr, 0, srl, srl_size,
- sig, sig_len));
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
VerifierCtxObj ctx(grp_public_key);
- THROW_ON_EPIDERR(EpidVerifierSetBasename(ctx, bsn.data(), bsn.size()));
THROW_ON_EPIDERR(EpidVerifierSetSigRl(ctx, srl, srl_size));
- EXPECT_EQ(kEpidSigInvalid,
+ EXPECT_EQ(kEpidSigRevokedInSigRl,
EpidVerify(ctx, sig, sig_len, msg.data(), msg.size()));
}
/////////////////////////////////////////////////////////////////////////
@@ -728,8 +643,8 @@ TEST_F(EpidMemberTest, SignsMessageUsingSha256HashAlg) {
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
THROW_ON_EPIDERR(EpidMemberSetHashAlg(member, kSha256));
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- nullptr, 0, sig, sig_len));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
// verify signature
VerifierCtxObj ctx(this->kGroupPublicKey);
THROW_ON_EPIDERR(EpidVerifierSetHashAlg(ctx, kSha256));
@@ -746,8 +661,8 @@ TEST_F(EpidMemberTest, SignsMessageUsingSha384HashAlg) {
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
THROW_ON_EPIDERR(EpidMemberSetHashAlg(member, kSha384));
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- nullptr, 0, sig, sig_len));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
// verify signature
VerifierCtxObj ctx(this->kGroupPublicKey);
THROW_ON_EPIDERR(EpidVerifierSetHashAlg(ctx, kSha384));
@@ -764,8 +679,8 @@ TEST_F(EpidMemberTest, SignsMessageUsingSha512HashAlg) {
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
THROW_ON_EPIDERR(EpidMemberSetHashAlg(member, kSha512));
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- nullptr, 0, sig, sig_len));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
// verify signature
VerifierCtxObj ctx(this->kGroupPublicKey);
THROW_ON_EPIDERR(EpidVerifierSetHashAlg(ctx, kSha512));
@@ -773,7 +688,7 @@ TEST_F(EpidMemberTest, SignsMessageUsingSha512HashAlg) {
EpidVerify(ctx, sig, sig_len, msg.data(), msg.size()));
}
-TEST_F(EpidMemberTest, DISABLED_SignsMessageUsingSha512256HashAlg) {
+TEST_F(EpidMemberTest, SignsMessageUsingSha512256HashAlg) {
Prng my_prng;
MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
this->kMemberPrecomp, &Prng::Generate, &my_prng);
@@ -782,8 +697,8 @@ TEST_F(EpidMemberTest, DISABLED_SignsMessageUsingSha512256HashAlg) {
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
THROW_ON_EPIDERR(EpidMemberSetHashAlg(member, kSha512_256));
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- nullptr, 0, sig, sig_len));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
// verify signature
VerifierCtxObj ctx(this->kGroupPublicKey);
THROW_ON_EPIDERR(EpidVerifierSetHashAlg(ctx, kSha512_256));
@@ -798,13 +713,13 @@ TEST_F(EpidMemberTest, SignConsumesPrecomputedSignaturesNoSigRl) {
Prng my_prng;
MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
this->kMemberPrecomp, &Prng::Generate, &my_prng);
- THROW_ON_EPIDERR(EpidAddPreSigs(member, 3, nullptr));
+ THROW_ON_EPIDERR(EpidAddPreSigs(member, 3));
auto& msg = this->kMsg0;
std::vector<uint8_t> sig_data(EpidGetSigSize(nullptr));
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- nullptr, 0, sig, sig_len));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
EXPECT_EQ((size_t)2, EpidGetNumPreSigs(member));
}
@@ -812,7 +727,7 @@ TEST_F(EpidMemberTest, SignConsumesPrecomputedSignaturesWithSigRl) {
Prng my_prng;
MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
this->kMemberPrecomp, &Prng::Generate, &my_prng);
- THROW_ON_EPIDERR(EpidAddPreSigs(member, 3, nullptr));
+ THROW_ON_EPIDERR(EpidAddPreSigs(member, 3));
auto& msg = this->kMsg0;
SigRl const* srl =
reinterpret_cast<SigRl const*>(this->kSigRl5EntryData.data());
@@ -820,8 +735,9 @@ TEST_F(EpidMemberTest, SignConsumesPrecomputedSignaturesWithSigRl) {
std::vector<uint8_t> sig_data(EpidGetSigSize(srl));
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- srl, srl_size, sig, sig_len));
+ THROW_ON_EPIDERR(EpidMemberSetSigRl(member, srl, srl_size));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
EXPECT_EQ((size_t)2, EpidGetNumPreSigs(member));
}
@@ -829,13 +745,13 @@ TEST_F(EpidMemberTest, SignsMessageWithPrecomputedSignaturesNoSigRl) {
Prng my_prng;
MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
this->kMemberPrecomp, &Prng::Generate, &my_prng);
- THROW_ON_EPIDERR(EpidAddPreSigs(member, 1, nullptr));
+ THROW_ON_EPIDERR(EpidAddPreSigs(member, 1));
auto& msg = this->kMsg0;
std::vector<uint8_t> sig_data(EpidGetSigSize(nullptr));
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- nullptr, 0, sig, sig_len));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
// verify basic signature
VerifierCtxObj ctx(this->kGroupPublicKey);
EXPECT_EQ(kEpidSigValid,
@@ -846,7 +762,7 @@ TEST_F(EpidMemberTest, SignsMessageWithPrecomputedSignaturesWithSigRl) {
Prng my_prng;
MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
this->kMemberPrecomp, &Prng::Generate, &my_prng);
- THROW_ON_EPIDERR(EpidAddPreSigs(member, 1, nullptr));
+ THROW_ON_EPIDERR(EpidAddPreSigs(member, 1));
auto& msg = this->kMsg0;
SigRl const* srl =
reinterpret_cast<SigRl const*>(this->kSigRl5EntryData.data());
@@ -854,8 +770,9 @@ TEST_F(EpidMemberTest, SignsMessageWithPrecomputedSignaturesWithSigRl) {
std::vector<uint8_t> sig_data(EpidGetSigSize(srl));
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- srl, srl_size, sig, sig_len));
+ THROW_ON_EPIDERR(EpidMemberSetSigRl(member, srl, srl_size));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
// verify basic signature
VerifierCtxObj ctx(this->kGroupPublicKey);
THROW_ON_EPIDERR(EpidVerifierSetSigRl(ctx, srl, srl_size));
@@ -872,8 +789,8 @@ TEST_F(EpidMemberTest, SignsMessageWithoutPrecomputedSignaturesNoSigRl) {
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
// test sign without precomputed signatures
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- nullptr, 0, sig, sig_len));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
// verify basic signature
VerifierCtxObj ctx(this->kGroupPublicKey);
EXPECT_EQ(kEpidSigValid,
@@ -891,9 +808,10 @@ TEST_F(EpidMemberTest, SignsMessageWithoutPrecomputedSignaturesWithSigRl) {
std::vector<uint8_t> sig_data(EpidGetSigSize(srl));
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
+ THROW_ON_EPIDERR(EpidMemberSetSigRl(member, srl, srl_size));
// test sign without precomputed signatures
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- srl, srl_size, sig, sig_len));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len));
// verify basic signature
VerifierCtxObj ctx(this->kGroupPublicKey);
THROW_ON_EPIDERR(EpidVerifierSetSigRl(ctx, srl, srl_size));
@@ -901,41 +819,6 @@ TEST_F(EpidMemberTest, SignsMessageWithoutPrecomputedSignaturesWithSigRl) {
EpidVerify(ctx, sig, sig_len, msg.data(), msg.size()));
}
-TEST_F(EpidMemberTest, SignFailsOnBadPrecomputedSignaturesNoSigRl) {
- Prng my_prng;
- MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
- this->kMemberPrecomp, &Prng::Generate, &my_prng);
- PreComputedSignature precompsig;
- precompsig = this->kPrecomputedSignatures[0];
- precompsig.B.x.data.data[0]++;
- THROW_ON_EPIDERR(EpidAddPreSigs(member, 1, &precompsig));
- auto& msg = this->kMsg0;
- std::vector<uint8_t> sig_data(EpidGetSigSize(nullptr));
- EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
- size_t sig_len = sig_data.size() * sizeof(uint8_t);
- EXPECT_EQ(kEpidBadArgErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- nullptr, 0, sig, sig_len));
-}
-
-TEST_F(EpidMemberTest, SignFailsOnBadPrecomputedSignaturesWithSigRl) {
- Prng my_prng;
- MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
- this->kMemberPrecomp, &Prng::Generate, &my_prng);
- PreComputedSignature precompsig;
- precompsig = this->kPrecomputedSignatures[0];
- precompsig.B.x.data.data[0]++;
- THROW_ON_EPIDERR(EpidAddPreSigs(member, 1, &precompsig));
- auto& msg = this->kMsg0;
- SigRl const* srl =
- reinterpret_cast<SigRl const*>(this->kSigRl5EntryData.data());
- size_t srl_size = this->kSigRl5EntryData.size() * sizeof(uint8_t);
- std::vector<uint8_t> sig_data(EpidGetSigSize(srl));
- EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
- size_t sig_len = sig_data.size() * sizeof(uint8_t);
- EXPECT_EQ(kEpidBadArgErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- srl, srl_size, sig, sig_len));
-}
-
/////////////////////////////////////////////////////////////////////////
// Variable messages
@@ -950,7 +833,7 @@ TEST_F(EpidMemberTest, SignsEmptyMessageNoSigRl) {
size_t sig_len = sig_data.size() * sizeof(uint8_t);
THROW_ON_EPIDERR(EpidRegisterBaseName(member, bsn.data(), bsn.size()));
EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), 0, bsn.data(), bsn.size(),
- nullptr, 0, sig, sig_len));
+ sig, sig_len));
VerifierCtxObj ctx(this->kGroupPublicKey);
THROW_ON_EPIDERR(EpidVerifierSetBasename(ctx, bsn.data(), bsn.size()));
EXPECT_EQ(kEpidSigValid, EpidVerify(ctx, sig, sig_len, msg.data(), 0));
@@ -967,8 +850,9 @@ TEST_F(EpidMemberTest, SignsEmptyMessageWithSigRl) {
std::vector<uint8_t> sig_data(EpidGetSigSize(srl));
EpidSignature* sig = reinterpret_cast<EpidSignature*>(sig_data.data());
size_t sig_len = sig_data.size() * sizeof(uint8_t);
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), 0, nullptr, 0, srl,
- srl_size, sig, sig_len));
+ THROW_ON_EPIDERR(EpidMemberSetSigRl(member, srl, srl_size));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), 0, nullptr, 0, sig, sig_len));
// verify basic signature
VerifierCtxObj ctx(this->kGroupPublicKey);
THROW_ON_EPIDERR(EpidVerifierSetSigRl(ctx, srl, srl_size));
@@ -993,8 +877,8 @@ TEST_F(EpidMemberTest, SignsShortMessageNoSigRl) {
msg[n] = (uint8_t)n;
}
for (auto length : lengths) {
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), length, nullptr, 0,
- nullptr, 0, sig, sig_len))
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), length, nullptr, 0, sig, sig_len))
<< "EpidSign for message_len: " << length << " failed";
EXPECT_EQ(kEpidSigValid, EpidVerify(ctx, sig, sig_len, msg.data(), length))
<< "EpidVerify for message_len: " << length << " failed";
@@ -1023,9 +907,10 @@ TEST_F(EpidMemberTest, SignsShortMessageWithSigRl) {
for (size_t n = 0; n < msg.size(); n++) {
msg.at(n) = (uint8_t)n;
}
+ THROW_ON_EPIDERR(EpidMemberSetSigRl(member, srl, srl_size));
for (auto length : lengths) {
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), length, nullptr, 0, srl,
- srl_size, sig, sig_len))
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), length, nullptr, 0, sig, sig_len))
<< "EpidSign for message_len: " << message_len << " failed";
EXPECT_EQ(kEpidSigValid, EpidVerify(ctx, sig, sig_len, msg.data(), length))
<< "EpidVerify for message_len: " << message_len << " failed";
@@ -1044,8 +929,8 @@ TEST_F(EpidMemberTest, SignsLongMessageNoSigRl) {
for (size_t n = 0; n < msg.size(); n++) {
msg.at(n) = (uint8_t)n;
}
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- nullptr, 0, sig, sig_len))
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len))
<< "EpidSign for message_len: " << 1000000 << " failed";
EXPECT_EQ(kEpidSigValid,
EpidVerify(ctx, sig, sig_len, msg.data(), msg.size()))
@@ -1068,8 +953,9 @@ TEST_F(EpidMemberTest, SignsLongMessageWithSigRl) {
for (size_t n = 0; n < msg.size(); n++) {
msg.at(n) = (uint8_t)n;
}
- EXPECT_EQ(kEpidNoErr, EpidSign(member, msg.data(), msg.size(), nullptr, 0,
- srl, srl_size, sig, sig_len))
+ THROW_ON_EPIDERR(EpidMemberSetSigRl(member, srl, srl_size));
+ EXPECT_EQ(kEpidNoErr,
+ EpidSign(member, msg.data(), msg.size(), nullptr, 0, sig, sig_len))
<< "EpidSign for message_len: " << 1000000 << " failed";
EXPECT_EQ(kEpidSigValid,
EpidVerify(ctx, sig, sig_len, msg.data(), msg.size()))
diff --git a/epid/member/unittests/signbasic-test.cc b/epid/member/unittests/signbasic-test.cc
index d5f75c8..3dd4302 100644
--- a/epid/member/unittests/signbasic-test.cc
+++ b/epid/member/unittests/signbasic-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief SignBasic unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
@@ -84,8 +85,8 @@ TEST_F(EpidMemberTest, BasicSignaturesOfSameMessageAreDifferent) {
MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
this->kMemberPrecomp, &Prng::Generate, &my_prng);
auto& msg = this->kMsg0;
- BasicSignature basic_sig1;
- BasicSignature basic_sig2;
+ BasicSignature basic_sig1 = {0};
+ BasicSignature basic_sig2 = {0};
EXPECT_EQ(kEpidNoErr, EpidSignBasic(member, msg.data(), msg.size(), nullptr,
0, &basic_sig1));
EXPECT_EQ(kEpidNoErr, EpidSignBasic(member, msg.data(), msg.size(), nullptr,
@@ -243,7 +244,7 @@ TEST_F(EpidMemberTest, SignBasicSucceedsUsingSha512HashAlg) {
EXPECT_EQ(kEpidSigValid,
EpidVerifyBasicSig(ctx, &basic_sig, msg.data(), msg.size()));
}
-TEST_F(EpidMemberTest, DISABLED_SignBasicSucceedsUsingSha512256HashAlg) {
+TEST_F(EpidMemberTest, SignBasicSucceedsUsingSha512256HashAlg) {
Prng my_prng;
MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
this->kMemberPrecomp, &Prng::Generate, &my_prng);
@@ -261,37 +262,11 @@ TEST_F(EpidMemberTest, DISABLED_SignBasicSucceedsUsingSha512256HashAlg) {
EpidVerifyBasicSig(ctx, &basic_sig, msg.data(), msg.size()));
}
/////////////////////////////////////////////////////////////////////////
-TEST_F(EpidMemberTest, SignBasicFailsForInvalidMemberPrecomp) {
- Prng my_prng;
- MemberPrecomp mbr_precomp = this->kMemberPrecomp;
- mbr_precomp.e12.x[0].data.data[0]++;
- MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
- mbr_precomp, &Prng::Generate, &my_prng);
- auto& msg = this->kMsg0;
- BasicSignature basic_sig;
- auto& bsn = this->kBsn0;
- EXPECT_EQ(kEpidBadArgErr, EpidSignBasic(member, msg.data(), msg.size(),
- bsn.data(), bsn.size(), &basic_sig));
-}
-// Variable precomputed signatures
-TEST_F(EpidMemberTest, SignBasicFailsForInvalidPrecomputedSignature) {
- Prng my_prng;
- MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
- this->kMemberPrecomp, &Prng::Generate, &my_prng);
- PreComputedSignature precompsig = this->kPrecomputedSignatures[0];
- precompsig.B.x.data.data[0]++;
- THROW_ON_EPIDERR(EpidAddPreSigs(member, 1, &precompsig));
- auto& msg = this->kMsg0;
- BasicSignature basic_sig;
- auto& bsn = this->kBsn0;
- EXPECT_EQ(kEpidBadArgErr, EpidSignBasic(member, msg.data(), msg.size(),
- bsn.data(), bsn.size(), &basic_sig));
-}
TEST_F(EpidMemberTest, SignBasicConsumesPrecomputedSignatures) {
Prng my_prng;
MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
this->kMemberPrecomp, &Prng::Generate, &my_prng);
- THROW_ON_EPIDERR(EpidAddPreSigs(member, 3, nullptr));
+ THROW_ON_EPIDERR(EpidAddPreSigs(member, 3));
auto& msg = this->kMsg0;
BasicSignature basic_sig;
auto& bsn = this->kBsn0;
@@ -305,7 +280,7 @@ TEST_F(EpidMemberTest, SignBasicSucceedsWithPrecomputedSignatures) {
Prng my_prng;
MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
this->kMemberPrecomp, &Prng::Generate, &my_prng);
- THROW_ON_EPIDERR(EpidAddPreSigs(member, 1, nullptr));
+ THROW_ON_EPIDERR(EpidAddPreSigs(member, 1));
auto& msg = this->kMsg0;
BasicSignature basic_sig;
auto& bsn = this->kBsn0;
@@ -322,7 +297,7 @@ TEST_F(EpidMemberTest, SignBasicSucceedsWithoutPrecomputedSignatures) {
Prng my_prng;
MemberCtxObj member(this->kGroupPublicKey, this->kMemberPrivateKey,
this->kMemberPrecomp, &Prng::Generate, &my_prng);
- THROW_ON_EPIDERR(EpidAddPreSigs(member, 1, nullptr));
+ THROW_ON_EPIDERR(EpidAddPreSigs(member, 1));
auto& msg = this->kMsg0;
BasicSignature basic_sig;
auto& bsn = this->kBsn0;
diff --git a/epid/verifier/1.1/src/nrverify.c b/epid/verifier/1.1/src/nrverify.c
index a52e5f4..dc834d8 100644
--- a/epid/verifier/1.1/src/nrverify.c
+++ b/epid/verifier/1.1/src/nrverify.c
@@ -1,5 +1,5 @@
/*############################################################################
-# Copyright 2016 Intel Corporation
+# Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/epid/verifier/1.1/src/verify.c b/epid/verifier/1.1/src/verify.c
index aff1da4..98d062e 100644
--- a/epid/verifier/1.1/src/verify.c
+++ b/epid/verifier/1.1/src/verify.c
@@ -1,5 +1,5 @@
/*############################################################################
-# Copyright 2016 Intel Corporation
+# Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -69,6 +69,11 @@ EpidStatus Epid11PrVerify(Epid11VerifierCtx const* ctx,
FiniteField* Fp = ctx->epid11_params->Fp;
bool eq = false;
do {
+ sts = NewFfElement(Fp, &f);
+ if (kEpidNoErr != sts) {
+ sts = kEpidMathErr;
+ break;
+ }
sts = NewEcPoint(G3, &B);
if (kEpidNoErr != sts) {
sts = kEpidMathErr;
@@ -84,7 +89,8 @@ EpidStatus Epid11PrVerify(Epid11VerifierCtx const* ctx,
sts = kEpidMathErr;
break;
}
- sts = NewFfElement(Fp, &f);
+ // ReadFfElement checks that the value f_str is in the field
+ sts = ReadFfElement(Fp, f_str, sizeof(BigNumStr), f);
if (kEpidNoErr != sts) {
sts = kEpidMathErr;
break;
@@ -194,7 +200,7 @@ EpidStatus Epid11Verify(Epid11VerifierCtx const* ctx,
// values in s match with the values in SIG-RL....
if (0 != memcmp(&ctx->sig_rl->version, &sig->rl_ver,
sizeof(ctx->sig_rl->version))) {
- return kEpidBadArgErr;
+ return kEpidErr;
}
if (sigrl_count != rl_count) {
diff --git a/epid/verifier/1.1/unittests/check_privrl_entry-test.cc b/epid/verifier/1.1/unittests/check_privrl_entry-test.cc
index ba0f6ea..7fe6072 100644
--- a/epid/verifier/1.1/unittests/check_privrl_entry-test.cc
+++ b/epid/verifier/1.1/unittests/check_privrl_entry-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief Epid11CheckPrivRlEntry unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
diff --git a/epid/verifier/1.1/unittests/context-test.cc b/epid/verifier/1.1/unittests/context-test.cc
index 798f636..b3e2172 100644
--- a/epid/verifier/1.1/unittests/context-test.cc
+++ b/epid/verifier/1.1/unittests/context-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
#include <cstring>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
diff --git a/epid/verifier/1.1/unittests/nrverify-test.cc b/epid/verifier/1.1/unittests/nrverify-test.cc
index 41d9851..a384822 100644
--- a/epid/verifier/1.1/unittests/nrverify-test.cc
+++ b/epid/verifier/1.1/unittests/nrverify-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
-# Copyright 2016 Intel Corporation
+# Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief Epid11NrVerify unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
diff --git a/epid/verifier/1.1/unittests/sigs_linked-test.cc b/epid/verifier/1.1/unittests/sigs_linked-test.cc
index a32a470..edebf6d 100644
--- a/epid/verifier/1.1/unittests/sigs_linked-test.cc
+++ b/epid/verifier/1.1/unittests/sigs_linked-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief Epid11AreSigsLinkable unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
diff --git a/epid/verifier/1.1/unittests/verifier-testhelper.cc b/epid/verifier/1.1/unittests/verifier-testhelper.cc
index 8dd541d..6ae3af0 100644
--- a/epid/verifier/1.1/unittests/verifier-testhelper.cc
+++ b/epid/verifier/1.1/unittests/verifier-testhelper.cc
@@ -1,5 +1,5 @@
/*############################################################################
-# Copyright 2016 Intel Corporation
+# Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -65,6 +65,9 @@ const Epid11Params Epid11VerifierTest::kParamsStr = {
const std::vector<uint8_t> Epid11VerifierTest::kGrpXPrivRl = {
#include "epid/common-testhelper/1.1/testdata/grp_x/privrl.inc"
};
+const std::vector<uint8_t> Epid11VerifierTest::kGrpXCorruptedPrivRl = {
+#include "epid/common-testhelper/1.1/testdata/grp_x/corrupted_privrl.inc"
+};
const std::vector<uint8_t> Epid11VerifierTest::kGrpXPrivRlSingleEntry = {
#include "epid/common-testhelper/1.1/testdata/grp_x/privrl_single_entry.inc"
};
diff --git a/epid/verifier/1.1/unittests/verifier-testhelper.h b/epid/verifier/1.1/unittests/verifier-testhelper.h
index 9f44fd4..7dac1e8 100644
--- a/epid/verifier/1.1/unittests/verifier-testhelper.h
+++ b/epid/verifier/1.1/unittests/verifier-testhelper.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@
#include <vector>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
@@ -42,6 +43,8 @@ class Epid11VerifierTest : public ::testing::Test {
static const std::vector<uint8_t> kBsn0;
/// the privrl of group X
static const std::vector<uint8_t> kGrpXPrivRl;
+ /// currpted privrl of group X
+ static const std::vector<uint8_t> kGrpXCorruptedPrivRl;
/// a single entry privrl for group X
static const std::vector<uint8_t> kGrpXPrivRlSingleEntry;
/// verifier pre-computation data associated with pub_key_str
diff --git a/epid/verifier/1.1/unittests/verify-test.cc b/epid/verifier/1.1/unittests/verify-test.cc
index e755b15..e389f43 100644
--- a/epid/verifier/1.1/unittests/verify-test.cc
+++ b/epid/verifier/1.1/unittests/verify-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
-# Copyright 2016 Intel Corporation
+# Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief Epid11Verify unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
@@ -213,15 +214,14 @@ TEST_F(Epid11VerifierTest, VerifyFailsOnSigRlverNotMatchSigRlRlver) {
auto bsn = this->kBsn0;
auto sig_rl = this->kGrpXSigRlMember0Bsn0Msg0SingleEntry;
auto sig_rl_size = sig_rl.size();
- auto sig = this->kGrpXSigRlMember0Bsn0Msg0FirstEntry;
+ auto sig = this->kSigGrpXMember0Sha256Bsn0Msg0;
Epid11SigRl sig_rl_wrong_ver = *(Epid11SigRl const*)sig_rl.data();
sig_rl_wrong_ver.version.data[0]++;
THROW_ON_EPIDERR(
Epid11VerifierSetSigRl(verifier, &sig_rl_wrong_ver, sig_rl_size));
THROW_ON_EPIDERR(Epid11VerifierSetBasename(verifier, bsn.data(), bsn.size()));
- EXPECT_EQ(kEpidBadArgErr,
- Epid11Verify(verifier, (Epid11Signature const*)sig.data(),
- sig.size(), msg.data(), msg.size()));
+ EXPECT_EQ(kEpidErr, Epid11Verify(verifier, (Epid11Signature const*)sig.data(),
+ sig.size(), msg.data(), msg.size()));
}
TEST_F(Epid11VerifierTest, VerifyFailsOnSigN2NotMatchSigRlN2) {
@@ -230,14 +230,16 @@ TEST_F(Epid11VerifierTest, VerifyFailsOnSigN2NotMatchSigRlN2) {
Epid11VerifierCtxObj verifier(this->kPubKeyStr);
auto msg = this->kMsg0;
auto bsn = this->kBsn0;
- auto sig_rl = this->kGrpXSigRlMember0Bsn0Msg0MiddleEntry;
- auto sig = this->kSigGrpXMember0Sha256Bsn0Msg0SingleEntry;
- THROW_ON_EPIDERR(Epid11VerifierSetSigRl(
- verifier, (Epid11SigRl const*)sig_rl.data(), sig_rl.size()));
+ auto* sig_rl =
+ (Epid11SigRl const*)this->kGrpXSigRlMember0Bsn0Msg0MiddleEntry.data();
+ size_t sig_rl_size = this->kGrpXSigRlMember0Bsn0Msg0MiddleEntry.size();
+ auto sig_raw = this->kSigGrpXMember0Sha256Bsn0Msg0SingleEntry;
+ Epid11Signature* sig = (Epid11Signature*)sig_raw.data();
+ sig->rl_ver = sig_rl->version;
+ THROW_ON_EPIDERR(Epid11VerifierSetSigRl(verifier, sig_rl, sig_rl_size));
THROW_ON_EPIDERR(Epid11VerifierSetBasename(verifier, bsn.data(), bsn.size()));
- EXPECT_EQ(kEpidBadArgErr,
- Epid11Verify(verifier, (Epid11Signature const*)sig.data(),
- sig.size(), msg.data(), msg.size()));
+ EXPECT_EQ(kEpidBadArgErr, Epid11Verify(verifier, sig, sig_raw.size(),
+ msg.data(), msg.size()));
}
TEST_F(Epid11VerifierTest, VerifyFailsSigIsNotBasicAndSigRlIsNotProvided) {
@@ -580,6 +582,21 @@ TEST_F(Epid11VerifierTest, VerifyRejectsSigFromPrivRlLastEntry) {
sig.size(), msg.data(), msg.size()));
}
+TEST_F(Epid11VerifierTest, VerifyRejectsSigUsingCorruptedPrivRlEntry) {
+ auto& pub_key = this->kPubKeyStr;
+ auto& msg = this->kMsg0;
+ auto& bsn = this->kBsn0;
+ auto& priv_rl = this->kGrpXCorruptedPrivRl;
+ auto& sig = this->kSigGrpXMember0Sha256Bsn0Msg0;
+ Epid11VerifierCtxObj verifier(pub_key);
+ THROW_ON_EPIDERR(Epid11VerifierSetPrivRl(
+ verifier, (Epid11PrivRl const*)priv_rl.data(), priv_rl.size()));
+ THROW_ON_EPIDERR(Epid11VerifierSetBasename(verifier, bsn.data(), bsn.size()));
+ EXPECT_EQ(kEpidSigRevokedInPrivRl,
+ Epid11Verify(verifier, (Epid11Signature const*)sig.data(),
+ sig.size(), msg.data(), msg.size()));
+}
+
/////////////////////////////////////////////////////////////////////
//
// 4.1.2 step 32 - For i = 0, ..., n2-1, the verifier verifies
diff --git a/epid/verifier/1.1/unittests/verifybasic-test.cc b/epid/verifier/1.1/unittests/verifybasic-test.cc
index 6f88206..b32379a 100644
--- a/epid/verifier/1.1/unittests/verifybasic-test.cc
+++ b/epid/verifier/1.1/unittests/verifybasic-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief Epid11VerifyBasicSig unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
diff --git a/epid/verifier/Makefile b/epid/verifier/Makefile
index 3be1e4d..8cb293f 100644
--- a/epid/verifier/Makefile
+++ b/epid/verifier/Makefile
@@ -30,13 +30,12 @@ LIB_VERIFIER_DIR = .
LIB_COMMON_TESTHELPER_DIR = ../common-testhelper
LIB_COMMON_DIR = ../common
LIB_IPPCP_DIR = ../../ext/ipp/sources/ippcp/src
-LIB_IPPCPEPID_DIR = ../../ext/ipp/sources/ippcpepid/src
#set flags for linker
LDFLAGS += -L$(GTEST_INCLUDE_DIR)/gtest -L$(LIB_COMMON_TESTHELPER_DIR) \
- -L$(LIB_VERIFIER_DIR) -L$(LIB_COMMON_DIR) -L$(LIB_IPPCPEPID_DIR) \
+ -L$(LIB_VERIFIER_DIR) -L$(LIB_COMMON_DIR) \
-L$(LIB_IPPCP_DIR) -lgtest -lcommon-testhelper -lverifier -lcommon \
- -lippcpepid -lippcp
+ -lippcp
#target part
$(VERIFIER_OBJ): %.o: %.c
@@ -45,13 +44,13 @@ $(VERIFIER_OBJ): %.o: %.c
$(VERIFIER_LIB): $(VERIFIER_OBJ)
$(AR) rc $(VERIFIER_LIB) $(VERIFIER_OBJ)
- ranlib $(VERIFIER_LIB)
+ $(RANLIB) $(VERIFIER_LIB)
$(VERIFIER_UTEST_EXE): $(VERIFIER_UTEST_OBJ)
- $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
+ $(CXX) -o $@ $^ $(LDFLAGS)
$(VERIFIER_UTEST_OBJ): %.o: %.cc
- $(CXX) -o $@ $(CXXFLAGS) -I$(VERIFIER_INCLUDE_DIR) \
+ $(CXX) -o $@ $(CXXFLAGS) $(GTEST_DEFINES) -I$(VERIFIER_INCLUDE_DIR) \
-I$(VERIFIER_11_INCLUDE_DIR) -I$(GTEST_INCLUDE_DIR) -c $^
@@ -72,11 +71,13 @@ ifneq (,$(wildcard $(VERIFIER_UTEST_EXE)))
cp $(VERIFIER_UTEST_EXE) '$(TEST_INSTALL_DIR)'
endif
-check: $(VERIFIER_UTEST_EXE) run
+utest: $(VERIFIER_UTEST_EXE)
-run:
+run_utest:
$(VERIFIER_UTEST_EXE) $(GTEST_FLAGS)
+check: utest run_utest
+
clean:
rm -f $(VERIFIER_OBJ) \
$(VERIFIER_LIB) \
diff --git a/epid/verifier/api.h b/epid/verifier/api.h
index a0fcbc0..2555ce6 100644
--- a/epid/verifier/api.h
+++ b/epid/verifier/api.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -33,6 +33,8 @@
Defines the APIs needed by Intel(R) EPID verifiers. Each verifier
context (::VerifierCtx) represents a verifier for a single group.
+ To use this module, include the header epid/verifier/api.h.
+
\ingroup EpidModule
@{
*/
@@ -82,6 +84,10 @@ typedef struct VerifierPrecomp {
\see EpidVerifierDelete
\see EpidVerifierWritePrecomp
+
+ \b Example
+
+ \ref UserManual_VerifyingAnIntelEpidSignature
*/
EpidStatus EpidVerifierCreate(GroupPubKey const* pub_key,
VerifierPrecomp const* precomp,
@@ -99,6 +105,10 @@ EpidStatus EpidVerifierCreate(GroupPubKey const* pub_key,
The verifier context. Can be NULL.
\see EpidVerifierCreate
+
+ \b Example
+
+ \ref UserManual_VerifyingAnIntelEpidSignature
*/
void EpidVerifierDelete(VerifierCtx** ctx);
@@ -112,6 +122,10 @@ void EpidVerifierDelete(VerifierCtx** ctx);
\note
If the result is not ::kEpidNoErr the content of precomp is undefined.
+
+ \b Example
+
+ \ref UserManual_VerifyingAnIntelEpidSignature
*/
EpidStatus EpidVerifierWritePrecomp(VerifierCtx const* ctx,
VerifierPrecomp* precomp);
@@ -147,6 +161,10 @@ EpidStatus EpidVerifierWritePrecomp(VerifierCtx const* ctx,
pointed to by the verifier is undefined.
\see EpidVerifierCreate
+
+ \b Example
+
+ \ref UserManual_VerifyingAnIntelEpidSignature
*/
EpidStatus EpidVerifierSetPrivRl(VerifierCtx* ctx, PrivRl const* priv_rl,
size_t priv_rl_size);
@@ -182,6 +200,10 @@ EpidStatus EpidVerifierSetPrivRl(VerifierCtx* ctx, PrivRl const* priv_rl,
to by the verifier is undefined.
\see EpidVerifierCreate
+
+ \b Example
+
+ \ref UserManual_VerifyingAnIntelEpidSignature
*/
EpidStatus EpidVerifierSetSigRl(VerifierCtx* ctx, SigRl const* sig_rl,
size_t sig_rl_size);
@@ -217,6 +239,10 @@ EpidStatus EpidVerifierSetSigRl(VerifierCtx* ctx, SigRl const* sig_rl,
to by the verifier is undefined.
\see EpidVerifierCreate
+
+ \b Example
+
+ \ref UserManual_VerifyingAnIntelEpidSignature
*/
EpidStatus EpidVerifierSetGroupRl(VerifierCtx* ctx, GroupRl const* grp_rl,
size_t grp_rl_size);
@@ -248,6 +274,10 @@ EpidStatus EpidVerifierSetGroupRl(VerifierCtx* ctx, GroupRl const* grp_rl,
\see EpidVerifierCreate
\see EpidBlacklistSig
\see EpidWriteVerifierRl
+
+ \b Example
+
+ \ref UserManual_VerifyingAnIntelEpidSignature
*/
EpidStatus EpidVerifierSetVerifierRl(VerifierCtx* ctx, VerifierRl const* ver_rl,
size_t ver_rl_size);
@@ -267,6 +297,10 @@ EpidStatus EpidVerifierSetVerifierRl(VerifierCtx* ctx, VerifierRl const* ver_rl,
\see EpidVerifierCreate
\see ::HashAlg
+
+ \b Example
+
+ \ref UserManual_VerifyingAnIntelEpidSignature
*/
EpidStatus EpidVerifierSetHashAlg(VerifierCtx* ctx, HashAlg hash_alg);
@@ -288,6 +322,9 @@ EpidStatus EpidVerifierSetHashAlg(VerifierCtx* ctx, HashAlg hash_alg);
\see EpidVerifierCreate
+ \b Example
+
+ \ref UserManual_VerifyingAnIntelEpidSignature
*/
EpidStatus EpidVerifierSetBasename(VerifierCtx* ctx, void const* basename,
size_t basename_len);
@@ -327,6 +364,10 @@ EpidStatus EpidVerifierSetBasename(VerifierCtx* ctx, void const* basename,
\see EpidVerifierCreate
\see EpidSignBasic
\see EpidSign
+
+ \b Example
+
+ \ref UserManual_VerifyingAnIntelEpidSignature
*/
EpidStatus EpidVerify(VerifierCtx const* ctx, EpidSignature const* sig,
size_t sig_len, void const* msg, size_t msg_len);
diff --git a/epid/verifier/src/check_privrl_entry.c b/epid/verifier/src/check_privrl_entry.c
index 631e19f..23577ae 100644
--- a/epid/verifier/src/check_privrl_entry.c
+++ b/epid/verifier/src/check_privrl_entry.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ EpidStatus EpidCheckPrivRlEntry(VerifierCtx const* ctx,
EcPoint* k = NULL;
EcPoint* t4 = NULL;
EcGroup* G1 = NULL;
+ FfElement* ff_elem = NULL;
if (!ctx || !sig || !f) {
return kEpidBadArgErr;
}
@@ -38,7 +39,12 @@ EpidStatus EpidCheckPrivRlEntry(VerifierCtx const* ctx,
// Section 4.1.2 Step 4.b For i = 0, ... , n1-1, the verifier computes t4
// =G1.exp(B, f[i]) and verifies that G1.isEqual(t4, K) = false.
bool compare_result = false;
+ FiniteField* Fp = ctx->epid2_params->Fp;
G1 = ctx->epid2_params->G1;
+ result = NewFfElement(Fp, &ff_elem);
+ if (kEpidNoErr != result) {
+ break;
+ }
result = NewEcPoint(G1, &b);
if (kEpidNoErr != result) {
break;
@@ -51,6 +57,11 @@ EpidStatus EpidCheckPrivRlEntry(VerifierCtx const* ctx,
if (kEpidNoErr != result) {
break;
}
+ // ReadFfElement checks that the value f is in the field
+ result = ReadFfElement(Fp, (BigNumStr const*)f, sizeof(BigNumStr), ff_elem);
+ if (kEpidNoErr != result) {
+ break;
+ }
result = ReadEcPoint(G1, &sig->B, sizeof(sig->B), b);
if (kEpidNoErr != result) {
break;
@@ -74,7 +85,7 @@ EpidStatus EpidCheckPrivRlEntry(VerifierCtx const* ctx,
result = kEpidNoErr;
}
} while (0);
-
+ DeleteFfElement(&ff_elem);
DeleteEcPoint(&t4);
DeleteEcPoint(&k);
DeleteEcPoint(&b);
diff --git a/epid/verifier/src/context.c b/epid/verifier/src/context.c
index 811dabb..6350c49 100644
--- a/epid/verifier/src/context.c
+++ b/epid/verifier/src/context.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -507,7 +507,8 @@ EpidStatus EpidVerifierSetHashAlg(VerifierCtx* ctx, HashAlg hash_alg) {
if (!ctx) {
return kEpidBadArgErr;
}
- if (kSha256 != hash_alg && kSha384 != hash_alg && kSha512 != hash_alg)
+ if (kSha256 != hash_alg && kSha384 != hash_alg && kSha512 != hash_alg &&
+ kSha512_256 != hash_alg)
return kEpidBadArgErr;
if (ctx->hash_alg != hash_alg) {
@@ -613,22 +614,22 @@ static EpidStatus DoPrecomputation(VerifierCtx* ctx) {
ps_ctx = params->pairing_state;
// do precomputation
// 1. The verifier computes e12 = pairing(h1, g2).
- result = Pairing(ps_ctx, e12, pub_key->h1, params->g2);
+ result = Pairing(ps_ctx, pub_key->h1, params->g2, e12);
if (kEpidNoErr != result) {
return result;
}
// 2. The verifier computes e22 = pairing(h2, g2).
- result = Pairing(ps_ctx, e22, pub_key->h2, params->g2);
+ result = Pairing(ps_ctx, pub_key->h2, params->g2, e22);
if (kEpidNoErr != result) {
return result;
}
// 3. The verifier computes e2w = pairing(h2, w).
- result = Pairing(ps_ctx, e2w, pub_key->h2, pub_key->w);
+ result = Pairing(ps_ctx, pub_key->h2, pub_key->w, e2w);
if (kEpidNoErr != result) {
return result;
}
// 4. The verifier computes eg12 = pairing(g1, g2).
- result = Pairing(ps_ctx, eg12, params->g1, params->g2);
+ result = Pairing(ps_ctx, params->g1, params->g2, eg12);
if (kEpidNoErr != result) {
return result;
}
diff --git a/epid/verifier/src/verify.c b/epid/verifier/src/verify.c
index 6fce3db..5c37b68 100644
--- a/epid/verifier/src/verify.c
+++ b/epid/verifier/src/verify.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -146,7 +146,7 @@ EpidStatus EpidVerify(VerifierCtx const* ctx, EpidSignature const* sig,
// mismatch, abort and output "operation failed".
if (0 != memcmp(&ctx->sig_rl->version, &sig->rl_ver,
sizeof(ctx->sig_rl->version))) {
- return kEpidBadArgErr;
+ return kEpidErr;
}
// c. The verifier verifies that n2 in Sigma and in SigRL match. If
diff --git a/epid/verifier/src/verifybasic.c b/epid/verifier/src/verifybasic.c
index 3e7b15b..d3ab4de 100644
--- a/epid/verifier/src/verifybasic.c
+++ b/epid/verifier/src/verifybasic.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -245,7 +245,7 @@ EpidStatus EpidVerifyBasicSig(VerifierCtx const* ctx, BasicSignature const* sig,
BREAK_ON_EPID_ERROR(res);
}
// k. The verifier computes R2 = pairing(T, t1).
- res = Pairing(ctx->epid2_params->pairing_state, R2, T, t1);
+ res = Pairing(ctx->epid2_params->pairing_state, T, t1, R2);
BREAK_ON_EPID_ERROR(res);
// l. The verifier compute t2 = GT.multiExp(e12, sf, e22, sb,
// e2w, sa, eg12, c).
diff --git a/epid/verifier/unittests/check_privrl_entry-test.cc b/epid/verifier/unittests/check_privrl_entry-test.cc
index 20ceb07..d8164c1 100644
--- a/epid/verifier/unittests/check_privrl_entry-test.cc
+++ b/epid/verifier/unittests/check_privrl_entry-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief CheckPrivRlEntry unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
diff --git a/epid/verifier/unittests/context-test.cc b/epid/verifier/unittests/context-test.cc
index 119baea..0b637b4 100644
--- a/epid/verifier/unittests/context-test.cc
+++ b/epid/verifier/unittests/context-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@
#include <vector>
#include <cstring>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
@@ -995,13 +996,21 @@ TEST_F(EpidVerifierTest,
TEST_F(EpidVerifierTest, SetHashAlgFailsGivenNullPointer) {
EXPECT_EQ(kEpidBadArgErr, EpidVerifierSetHashAlg(nullptr, kSha256));
}
-TEST_F(EpidVerifierTest, SetHashAlgCanSetValidAlgoritm) {
+TEST_F(EpidVerifierTest, CanSetHashAlgoToSHA256) {
VerifierCtxObj verifier(this->kPubKeyStr, this->kVerifierPrecompStr);
EXPECT_EQ(kEpidNoErr, EpidVerifierSetHashAlg(verifier, kSha256));
+}
+TEST_F(EpidVerifierTest, CanSetHashAlgoToSHA384) {
+ VerifierCtxObj verifier(this->kPubKeyStr, this->kVerifierPrecompStr);
EXPECT_EQ(kEpidNoErr, EpidVerifierSetHashAlg(verifier, kSha384));
+}
+TEST_F(EpidVerifierTest, CanSetHashAlgoToSHA512) {
+ VerifierCtxObj verifier(this->kPubKeyStr, this->kVerifierPrecompStr);
EXPECT_EQ(kEpidNoErr, EpidVerifierSetHashAlg(verifier, kSha512));
- // DE2089 - SHA-512/256 Hash Alg is not supported by EpidMemberSetHashAlg
- // EXPECT_EQ(kEpidNoErr, EpidVerifierSetHashAlg(verifier, kSha512_256));
+}
+TEST_F(EpidVerifierTest, CanSetHashAlgoToSHA512256) {
+ VerifierCtxObj verifier(this->kPubKeyStr, this->kVerifierPrecompStr);
+ EXPECT_EQ(kEpidNoErr, EpidVerifierSetHashAlg(verifier, kSha512_256));
}
TEST_F(EpidVerifierTest, SetHashAlgCanFailForNonSupportedAlgoritms) {
VerifierCtxObj verifier(this->kPubKeyStr, this->kVerifierPrecompStr);
diff --git a/epid/verifier/unittests/main-test.cc b/epid/verifier/unittests/main-test.cc
index 70f2d3a..a8bb2fa 100644
--- a/epid/verifier/unittests/main-test.cc
+++ b/epid/verifier/unittests/main-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
* \brief Main entry point for unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
int main(int argc, char** argv) {
diff --git a/epid/verifier/unittests/nrverify-test.cc b/epid/verifier/unittests/nrverify-test.cc
index 9eb7e08..045fcf4 100644
--- a/epid/verifier/unittests/nrverify-test.cc
+++ b/epid/verifier/unittests/nrverify-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief NrVerify unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
@@ -177,25 +178,32 @@ TEST_F(EpidVerifierTest, NrVerifyRejectsSigWithValidCommitmentDiffHashAlg) {
// Refer to Section 7.1 for hash operation over a
// prime field.
// result must be kEpidBadArgErr
- VerifierCtxObj verifier(this->kGrp01Key);
+ VerifierCtxObj verifier(this->kGrpXKey);
EpidSignature const* epid_signature_sha256 =
reinterpret_cast<EpidSignature const*>(
- this->kSigGrp01Member0Sha256RandombaseTest0.data());
+ this->kSigGrpXMember0Sha256RandbaseMsg0.data());
EpidSignature const* epid_signature_sha384 =
reinterpret_cast<EpidSignature const*>(
- this->kSigGrp01Member0Sha384RandombaseTest0.data());
- SigRl const* sig_rl =
- reinterpret_cast<SigRl const*>(this->kGrp01SigRl.data());
+ this->kSigGrpXMember0Sha384RandbaseMsg0.data());
+ EpidSignature const* epid_signature_sha512 =
+ reinterpret_cast<EpidSignature const*>(
+ this->kSigGrpXMember0Sha512RandbaseMsg0.data());
+ SigRl const* sig_rl = reinterpret_cast<SigRl const*>(this->kGrpXSigRl.data());
THROW_ON_EPIDERR(EpidVerifierSetHashAlg(verifier, kSha384));
EXPECT_EQ(kEpidBadArgErr,
EpidNrVerify(verifier, &epid_signature_sha256->sigma0,
- this->kTest0.data(), this->kTest0.size(),
- &sig_rl->bk[0], &epid_signature_sha256->sigma[0]));
+ this->kMsg0.data(), this->kMsg0.size(), &sig_rl->bk[0],
+ &epid_signature_sha256->sigma[0]));
THROW_ON_EPIDERR(EpidVerifierSetHashAlg(verifier, kSha512));
EXPECT_EQ(kEpidBadArgErr,
EpidNrVerify(verifier, &epid_signature_sha384->sigma0,
- this->kTest0.data(), this->kTest0.size(),
- &sig_rl->bk[0], &epid_signature_sha384->sigma[0]));
+ this->kMsg0.data(), this->kMsg0.size(), &sig_rl->bk[0],
+ &epid_signature_sha384->sigma[0]));
+ THROW_ON_EPIDERR(EpidVerifierSetHashAlg(verifier, kSha512_256));
+ EXPECT_EQ(kEpidBadArgErr,
+ EpidNrVerify(verifier, &epid_signature_sha512->sigma0,
+ this->kMsg0.data(), this->kMsg0.size(), &sig_rl->bk[0],
+ &epid_signature_sha512->sigma[0]));
}
/////////////////////////////////////////////////////////////////////
@@ -256,17 +264,15 @@ TEST_F(EpidVerifierTest, NrVerifyAcceptsSigWithRandomBaseNameSha512) {
&epid_signature->sigma[0]));
}
-TEST_F(EpidVerifierTest,
- DISABLED_NrVerifyAcceptsSigWithRandomBaseNameSha512256) {
- VerifierCtxObj verifier(this->kGrp01Key);
+TEST_F(EpidVerifierTest, NrVerifyAcceptsSigWithRandomBaseNameSha512256) {
+ VerifierCtxObj verifier(this->kGrpXKey);
EpidSignature const* epid_signature = reinterpret_cast<EpidSignature const*>(
- this->kSigGrp01Member0Sha512256RandombaseTest1.data());
- SigRl const* sig_rl =
- reinterpret_cast<SigRl const*>(this->kGrp01SigRl.data());
+ this->kSigGrpXMember0Sha512256RandombaseMsg0.data());
+ SigRl const* sig_rl = reinterpret_cast<SigRl const*>(this->kGrpXSigRl.data());
THROW_ON_EPIDERR(EpidVerifierSetHashAlg(verifier, kSha512_256));
EXPECT_EQ(kEpidSigValid,
- EpidNrVerify(verifier, &epid_signature->sigma0, this->kTest1.data(),
- this->kTest1.size(), &sig_rl->bk[0],
+ EpidNrVerify(verifier, &epid_signature->sigma0, this->kMsg0.data(),
+ this->kMsg0.size(), &sig_rl->bk[0],
&epid_signature->sigma[0]));
}
diff --git a/epid/verifier/unittests/sigs_linked-test.cc b/epid/verifier/unittests/sigs_linked-test.cc
index a131cdb..debf4a2 100644
--- a/epid/verifier/unittests/sigs_linked-test.cc
+++ b/epid/verifier/unittests/sigs_linked-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief AreSigsLinkable unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
diff --git a/epid/verifier/unittests/verifier-testhelper.cc b/epid/verifier/unittests/verifier-testhelper.cc
index ab9d870..9decb75 100644
--- a/epid/verifier/unittests/verifier-testhelper.cc
+++ b/epid/verifier/unittests/verifier-testhelper.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -489,7 +489,9 @@ const std::vector<uint8_t>
#include "epid/common-testhelper/testdata/grp01/member0/sig_test0_sha512_sigrl.inc"
};
const std::vector<uint8_t>
- EpidVerifierTest::kSigGrp01Member0Sha512256RandombaseTest1 = {0};
+ EpidVerifierTest::kSigGrpXMember0Sha512256RandombaseMsg0 = {
+#include "epid/common-testhelper/testdata/grp_x/member0/sig_sha512_256_rndbase_msg0.inc"
+};
const std::vector<uint8_t>
EpidVerifierTest::kSigGrp01Member0Sha256RandombaseTest1NoSigRl = {
#include "epid/common-testhelper/testdata/grp01/member0/sig_test1_sha256.inc"
@@ -510,6 +512,10 @@ const std::vector<uint8_t>
EpidVerifierTest::kSigGrp01Member0Sha512RandombaseTest1NoSigRl = {
#include "epid/common-testhelper/testdata/grp01/member0/sig_test1_sha512.inc"
};
+const std::vector<uint8_t>
+ EpidVerifierTest::kSigGrpXMember0Sha512256RandombaseMsg0NoSigRl = {
+#include "epid/common-testhelper/testdata/grp_x/member0/sig_sha512_256_rndbase_msg0_no_sigrl.inc"
+};
const std::vector<uint8_t> EpidVerifierTest::kTest0 = {
't', 'e', 's', 't', ' ', 'm', 'e', 's', 's', 'a', 'g', 'e', 0x0};
@@ -568,6 +574,9 @@ const GroupPubKey EpidVerifierTest::kGrpXKey = {
const std::vector<uint8_t> EpidVerifierTest::kGrpXPrivRl = {
#include "epid/common-testhelper/testdata/grp_x/privrl.inc"
};
+const std::vector<uint8_t> EpidVerifierTest::kGrpXCorruptedPrivRl = {
+#include "epid/common-testhelper/testdata/grp_x/corrupted_privrl.inc"
+};
const std::vector<uint8_t> EpidVerifierTest::kPrivRlIkgf = {
#include "epid/common-testhelper/testdata/ikgf/groupa/privrl.inc"
};
@@ -613,7 +622,7 @@ const std::vector<uint8_t> EpidVerifierTest::kGrpXBsn0Sha512VerRl = {
#include "epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/verrl_sha512.inc"
};
const std::vector<uint8_t> EpidVerifierTest::kGrpXBsn0Sha512256VerRl = {
- // #include "testdata/grp_x/verrevoked/bsn0/verrl_sha512_256.inc"
+#include "epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/verrl_sha512_256.inc"
};
const std::vector<uint8_t> EpidVerifierTest::kGrpXBsn0VerRlSingleEntry = {
#include "epid/common-testhelper/testdata/grp_x/verrevoked/bsn0/verrl_1entry.inc"
@@ -717,12 +726,11 @@ EpidVerifierTest::kSigGrpXMember0Sha512RandbaseMsg0 = {
};
const std::vector<uint8_t>
EpidVerifierTest::kSigGrpXMember0Sha512256Bsn0Msg0 = {
- // #include "testdata/grp_x/member0/sig_sha512256_bsn0_msg0.inc"
+#include "epid/common-testhelper/testdata/grp_x/member0/sig_sha512_256_bsn0_msg0.inc"
};
const std::vector<uint8_t>
-EpidVerifierTest::kSigGrpXMember0Sha512256RandbaseMsg0 = {
- // #include "testdata/grp_x/member0/sig_sha512256_rndbase_msg0.inc"
-};
+EpidVerifierTest::kSigGrpXMember0Sha512256RandbaseMsg0 =
+ kSigGrpXMember0Sha512256RandombaseMsg0;
const std::vector<uint8_t> EpidVerifierTest::kSigGrpXMember1Sha256Bsn0Msg0 = {
#include "epid/common-testhelper/testdata/grp_x/member1/sig_sha256_bsn0_msg0.inc"
};
diff --git a/epid/verifier/unittests/verifier-testhelper.h b/epid/verifier/unittests/verifier-testhelper.h
index 4bbb7d1..2ca7848 100644
--- a/epid/verifier/unittests/verifier-testhelper.h
+++ b/epid/verifier/unittests/verifier-testhelper.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@
#include <vector>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
@@ -80,8 +81,8 @@ class EpidVerifierTest : public ::testing::Test {
static const std::vector<uint8_t> kSigGrp01Member0Sha384RandombaseTest0;
/// Signature of Test1 with RandomBase by Grp01 Member0 using Sha512
static const std::vector<uint8_t> kSigGrp01Member0Sha512RandombaseTest0;
- /// Signature of Test1 with RandomBase by Grp01 Member0 using Sha512_256
- static const std::vector<uint8_t> kSigGrp01Member0Sha512256RandombaseTest1;
+ /// Signature of msg0 with RandomBase by GrpX Member0 using Sha512/256
+ static const std::vector<uint8_t> kSigGrpXMember0Sha512256RandombaseMsg0;
/// Sig of Test1 with RandomBase by Grp01(no SigRl) Member0 using Sha256
static const std::vector<uint8_t>
kSigGrp01Member0Sha256RandombaseTest1NoSigRl;
@@ -95,6 +96,9 @@ class EpidVerifierTest : public ::testing::Test {
/// Sig of Test1 with RandomBase by Grp01(no SigRl) Member0 using Sha512
static const std::vector<uint8_t>
kSigGrp01Member0Sha512RandombaseTest1NoSigRl;
+ /// Sig of msg0 with RandomBase by GrpX(no SigRl) Member0 using Sha512/256
+ static const std::vector<uint8_t>
+ kSigGrpXMember0Sha512256RandombaseMsg0NoSigRl;
/// group based rl test data (empty rl)
static const std::vector<uint8_t> kGroupRlEmptyBuf;
/// group based rl test data (v=3, n=3, 3 revoked gid)
@@ -135,7 +139,8 @@ class EpidVerifierTest : public ::testing::Test {
static const GroupPubKey kGrpXKey;
/// the privrl of group X
static const std::vector<uint8_t> kGrpXPrivRl;
-
+ /// currpted privrl of group X
+ static const std::vector<uint8_t> kGrpXCorruptedPrivRl;
/// the privrl of group X with single entry PrivKey000 revoked
static const std::vector<uint8_t> kGrpXPrivRlRevokedPrivKey000OnlyEntry;
/// the sigrl of group X
diff --git a/epid/verifier/unittests/verify-test.cc b/epid/verifier/unittests/verify-test.cc
index ffac4d2..85c8d2e 100644
--- a/epid/verifier/unittests/verify-test.cc
+++ b/epid/verifier/unittests/verify-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
* \brief Verify unit tests.
*/
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
@@ -595,6 +596,24 @@ TEST_F(EpidVerifierTest, VerifyRejectsSigFromPrivRlLastEntry) {
msg.data(), msg.size()));
}
+TEST_F(EpidVerifierTest, VerifyRejectsSigUsingCorruptedPrivRlEntry) {
+ auto& pub_key = this->kGrpXKey;
+ auto& msg = this->kMsg0;
+ auto& bsn = this->kBsn0;
+ auto& priv_rl = this->kGrpXCorruptedPrivRl;
+ auto& sig = this->kSigGrpXMember0Sha256Bsn0Msg0;
+
+ VerifierCtxObj verifier(pub_key);
+ THROW_ON_EPIDERR(EpidVerifierSetHashAlg(verifier, kSha256));
+ THROW_ON_EPIDERR(EpidVerifierSetBasename(verifier, bsn.data(), bsn.size()));
+ THROW_ON_EPIDERR(EpidVerifierSetPrivRl(
+ verifier, (PrivRl const*)priv_rl.data(), priv_rl.size()));
+
+ EXPECT_EQ(kEpidSigRevokedInPrivRl,
+ EpidVerify(verifier, (EpidSignature const*)sig.data(), sig.size(),
+ msg.data(), msg.size()));
+}
+
TEST_F(EpidVerifierTest, VerifyAcceptsSigFromEmptyPrivRlUsingIkgfData) {
auto& pub_key = this->kPubKeyIkgfStr;
auto& msg = this->kMsg0;
@@ -640,9 +659,8 @@ TEST_F(EpidVerifierTest, VerifyFailsOnSigRlverNotMatchSigRlRlver) {
THROW_ON_EPIDERR(EpidVerifierSetSigRl(verifier, (SigRl const*)sig_rl.data(),
sig_rl.size()));
- EXPECT_EQ(kEpidBadArgErr,
- EpidVerify(verifier, (EpidSignature const*)sig.data(), sig.size(),
- msg.data(), msg.size()));
+ EXPECT_EQ(kEpidErr, EpidVerify(verifier, (EpidSignature const*)sig.data(),
+ sig.size(), msg.data(), msg.size()));
}
TEST_F(EpidVerifierTest, VerifyFailsOnSigN2NotMatchSigRlN2) {
@@ -652,17 +670,19 @@ TEST_F(EpidVerifierTest, VerifyFailsOnSigN2NotMatchSigRlN2) {
auto& pub_key = this->kGrpXKey;
auto& msg = this->kMsg0;
auto& bsn = this->kBsn0;
- auto& sig_rl = this->kGrpXSigRlMember0Sha256Bsn0Msg0OnlyEntry;
- auto& sig = this->kSigGrpXMember0Sha256Bsn0Msg0;
+ auto* sig_rl =
+ (SigRl const*)this->kGrpXSigRlMember0Sha256Bsn0Msg0OnlyEntry.data();
+ size_t sig_rl_size = this->kGrpXSigRlMember0Sha256Bsn0Msg0OnlyEntry.size();
+ auto sig_raw = this->kSigGrpXMember0Sha256Bsn0Msg0;
+ EpidSignature* sig = (EpidSignature*)sig_raw.data();
+ sig->rl_ver = sig_rl->version;
VerifierCtxObj verifier(pub_key);
THROW_ON_EPIDERR(EpidVerifierSetHashAlg(verifier, kSha256));
THROW_ON_EPIDERR(EpidVerifierSetBasename(verifier, bsn.data(), bsn.size()));
- THROW_ON_EPIDERR(EpidVerifierSetSigRl(verifier, (SigRl const*)sig_rl.data(),
- sig_rl.size()));
+ THROW_ON_EPIDERR(EpidVerifierSetSigRl(verifier, sig_rl, sig_rl_size));
EXPECT_EQ(kEpidBadArgErr,
- EpidVerify(verifier, (EpidSignature const*)sig.data(), sig.size(),
- msg.data(), msg.size()));
+ EpidVerify(verifier, sig, sig_raw.size(), msg.data(), msg.size()));
}
TEST_F(EpidVerifierTest, VerifyRejectsSigFromSigRlSingleEntry) {
@@ -779,9 +799,8 @@ TEST_F(EpidVerifierTest,
THROW_ON_EPIDERR(EpidVerifierSetSigRl(verifier, (SigRl const*)sig_rl.data(),
sig_rl.size()));
- EXPECT_EQ(kEpidBadArgErr,
- EpidVerify(verifier, (EpidSignature const*)sig.data(), sig.size(),
- msg.data(), msg.size()));
+ EXPECT_EQ(kEpidErr, EpidVerify(verifier, (EpidSignature const*)sig.data(),
+ sig.size(), msg.data(), msg.size()));
}
TEST_F(EpidVerifierTest, VerifyAcceptsSigFromEmptySigRlUsingIkgfData) {
@@ -1143,7 +1162,7 @@ TEST_F(EpidVerifierTest, VerifyAcceptsSigWithRandomBaseNameAllRlSha512) {
msg.data(), msg.size()));
}
-TEST_F(EpidVerifierTest, DISABLED_VerifyAcceptsSigWithBaseNameAllRlSha512256) {
+TEST_F(EpidVerifierTest, VerifyAcceptsSigWithBaseNameAllRlSha512256) {
auto& pub_key = this->kGrpXKey;
auto& msg = this->kMsg0;
auto& bsn = this->kBsn0;
@@ -1170,8 +1189,7 @@ TEST_F(EpidVerifierTest, DISABLED_VerifyAcceptsSigWithBaseNameAllRlSha512256) {
msg.data(), msg.size()));
}
-TEST_F(EpidVerifierTest,
- DISABLED_VerifyAcceptsSigWithRandomBaseNameAllRlSha512256) {
+TEST_F(EpidVerifierTest, VerifyAcceptsSigWithRandomBaseNameAllRlSha512256) {
auto& pub_key = this->kGrpXKey;
auto& msg = this->kMsg0;
auto& grp_rl = this->kGrpRl;
diff --git a/epid/verifier/unittests/verifybasic-test.cc b/epid/verifier/unittests/verifybasic-test.cc
index 9f6b3e5..af984f5 100644
--- a/epid/verifier/unittests/verifybasic-test.cc
+++ b/epid/verifier/unittests/verifybasic-test.cc
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@
#include <cstring>
#include <vector>
+#include "epid/common-testhelper/epid_gtest-testhelper.h"
#include "gtest/gtest.h"
extern "C" {
@@ -96,6 +97,17 @@ TEST_F(EpidVerifierTest, VerifyBasicSigCanVerifyValidSignatureWithSHA512) {
EpidVerifyBasicSig(verifier, &basic_sig, msg.data(), msg.size()));
}
+TEST_F(EpidVerifierTest, VerifyBasicSigCanVerifyValidSignatureWithSHA512256) {
+ VerifierCtxObj verifier(this->kGrpXKey);
+ auto const& sig = (EpidSignature const*)this
+ ->kSigGrpXMember0Sha512256RandombaseMsg0NoSigRl.data();
+ const BasicSignature basic_sig = sig->sigma0;
+ auto& msg = this->kMsg0;
+ THROW_ON_EPIDERR(EpidVerifierSetHashAlg(verifier, kSha512_256));
+ EXPECT_EQ(kEpidNoErr,
+ EpidVerifyBasicSig(verifier, &basic_sig, msg.data(), msg.size()));
+}
+
TEST_F(EpidVerifierTest,
VerifyBasicSigDetectsInvalidSignatureGivenMatchingMessage) {
VerifierCtxObj verifier(this->kGrp01Key);
diff --git a/example/Makefile b/example/Makefile
index 1589500..762a2b6 100644
--- a/example/Makefile
+++ b/example/Makefile
@@ -19,7 +19,6 @@ VERIFYSIG_EXE = ./verifysig/src/verifysig
LIB_UTIL_DIR = ./util/src
LIB_DROPT_DIR = ../ext/dropt/src
LIB_IPPCP_DIR = ../ext/ipp/sources/ippcp/src
-LIB_IPPCPEPID_DIR = ../ext/ipp/sources/ippcpepid/src
LIB_MEMBER_DIR = ../epid/member
LIB_VERIFIER_DIR = ../epid/verifier
LIB_COMMON_DIR = ../epid/common
@@ -29,12 +28,11 @@ LDFLAGS += -L$(LIB_UTIL_DIR) \
-L$(LIB_DROPT_DIR) \
-L$(LIB_IPPCP_DIR) \
-L$(LIB_COMMON_DIR) \
- -L$(LIB_IPPCPEPID_DIR) \
- -lcommon -lippcpepid \
+ -lcommon \
-lippcp -lutil -ldropt
$(VERIFYSIG_EXE): $(VERIFYSIG_OBJ)
- $(CC) -o $@ $^ $(CFLAGS) -L$(LIB_VERIFIER_DIR) -lverifier $(LDFLAGS)
+ $(CC) -o $@ $^ -L$(LIB_VERIFIER_DIR) -lverifier $(LDFLAGS)
$(VERIFYSIG_OBJ): %.o: %.c
$(CC) -o $@ $(CFLAGS) -I$(LIB_UTIL_DIR)/../.. \
@@ -45,7 +43,7 @@ $(VERIFYSIG_OBJ): %.o: %.c
$(SIGNMSG_EXE): $(SIGNMSG_OBJ)
- $(CC) -o $@ $^ $(CFLAGS) -L$(LIB_MEMBER_DIR) -lmember $(LDFLAGS)
+ $(CC) -o $@ $^ -L$(LIB_MEMBER_DIR) -lmember $(LDFLAGS)
$(SIGNMSG_OBJ): %.o: %.c
$(CC) -o $@ $(CFLAGS) -I$(LIB_UTIL_DIR)/../.. \
diff --git a/example/compressed_data/README.md b/example/compressed_data/README.md
index 4075c75..9b48b15 100644
--- a/example/compressed_data/README.md
+++ b/example/compressed_data/README.md
@@ -8,7 +8,7 @@ corresponding uncompressed groups and members._
## Directory Structure
- data
+ compressed_data
|__ groupa
| |__ member0
| | |__ mprivkey.dat
@@ -134,7 +134,7 @@ In addition, **groupb** contain the following revocation lists:
- `privrl.bin` - private key based revocation list with 1 entry -
**privrevokedmember0**
-- `sigrl.bin` - signature based revocation list with 1 entries -
+- `sigrl.bin` - signature based revocation list with 1 entry -
**sigrevokedmember0**
- `privrl_empty.bin` - private key based revocation list with 0 entries
@@ -144,36 +144,36 @@ In addition, **groupb** contain the following revocation lists:
### Default files
-- `/data/cacert.bin` - CA certificate used as default input to signmsg
+- `cacert.bin` - CA certificate used as default input to signmsg
and `verifysig`
-- `/data/grprl.bin` - group revocation list with one entry **groupb** used
+- `grprl.bin` - group revocation list with one entry **groupb** used
as default input to `verifysig`
-- `/data/pubkey.bin` - public key in **groupa** used as default input
+- `pubkey.bin` - public key in **groupa** used as default input
to signmsg and `verifysig`
-- `/data/mprivkey.dat` - private key of a **member0** in the
+- `mprivkey.dat` - private key of a **member0** in the
**groupa** used as default input to `signmsg`
-- `/data/privrl.bin` - private key based revocation list in the
- **groupa** with 0 entries used as default input to `verifysig`
+- `privrl.bin` - private key based revocation list in the
+ **groupa** with 3 entries used as default input to `verifysig`
-- `/data/sigrl.bin` - signature based revocation list in the
- **groupa** with 0 entries used as default input to `signmsg`
+- `sigrl.bin` - signature based revocation list in the
+ **groupa** with 3 entries used as default input to `signmsg`
and `verifysig`
### Group revocation lists
There are 2 group revocation lists:
-- `grprl.bin` - group revocation list with 1 entry - **groupb**
+- `grprl.bin` - group revocation list with 100 entries
- `grprl_empty.bin` - group revocation list with 0 entries
### IoT EPID Issuing CA certificate
-- `/data/cacert.bin` - CA certificate used to check that revocation
+- `cacert.bin` - CA certificate used to check that revocation
lists and group public keys are authorized by the issuer, e.g.,
signed by the issuer
diff --git a/example/data/README.md b/example/data/README.md
index 5e3c43c..d4a4658 100644
--- a/example/data/README.md
+++ b/example/data/README.md
@@ -134,7 +134,7 @@ In addition, **groupb** contain the following revocation lists:
- `privrl.bin` - private key based revocation list with 1 entry -
**privrevokedmember0**
-- `sigrl.bin` - signature based revocation list with 1 entries -
+- `sigrl.bin` - signature based revocation list with 1 entry -
**sigrevokedmember0**
- `privrl_empty.bin` - private key based revocation list with 0 entries
@@ -167,7 +167,7 @@ In addition, **groupb** contain the following revocation lists:
There are 2 group revocation lists:
-- `grprl.bin` - group revocation list with 1 entry - **groupb**
+- `grprl.bin` - group revocation list with 50 entries
- `grprl_empty.bin` - group revocation list with 0 entries
diff --git a/example/signmsg/src/main.c b/example/signmsg/src/main.c
index 8bd9000..79debf1 100644
--- a/example/signmsg/src/main.c
+++ b/example/signmsg/src/main.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -16,20 +16,16 @@
/*!
* \file
- *
* \brief Signmsg example implementation.
- *
*/
-#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-
#include <dropt.h>
+
#include "util/buffutil.h"
#include "util/convutil.h"
#include "util/envutil.h"
-#include "util/stdtypes.h"
#include "src/signmsg.h"
// Defaults
@@ -40,6 +36,15 @@
#define CACERT_DEFAULT "cacert.bin"
#define HASHALG_DEFAULT "SHA-512"
+bool IsCaCertAuthorizedByRootCa(void const* data, size_t size) {
+ // Implementation of this function is out of scope of the sample.
+ // In an actual implementation Issuing CA certificate must be validated
+ // with CA Root certificate before using it in parse functions.
+ (void)data;
+ (void)size;
+ return true;
+}
+
/// parses string to a hashalg type
static dropt_error HandleHashalg(dropt_context* context,
const char* option_argument,
@@ -76,10 +81,14 @@ int main(int argc, char* argv[]) {
// Message string parameter
static char* msg_str = NULL;
size_t msg_size = 0;
+ static char* msg_file = NULL;
+ char* msg_buf = NULL; // message loaded from msg_file
// Basename string parameter
static char* basename_str = NULL;
size_t basename_size = 0;
+ static char* basename_file = NULL;
+ char* basename_buf = NULL; // basename loaded from basename_file
// SigRl file name parameter
static char* sigrl_file = NULL;
@@ -140,8 +149,12 @@ int main(int argc, char* argv[]) {
"FILE", dropt_handle_string, &sig_file},
{'\0', "msg", "MESSAGE to sign", "MESSAGE", dropt_handle_string,
&msg_str},
+ {'\0', "msgfile", "FILE containing message to sign", "FILE",
+ dropt_handle_string, &msg_file},
{'\0', "bsn", "BASENAME to sign with (default: random)", "BASENAME",
dropt_handle_string, &basename_str},
+ {'\0', "bsnfile", "FILE containing basename to sign with", "FILE",
+ dropt_handle_string, &basename_file},
{'\0', "sigrl", "load signature based revocation list from FILE", "FILE",
dropt_handle_string, &sigrl_file},
@@ -162,7 +175,7 @@ int main(int argc, char* argv[]) {
{'\0', "hashalg",
"use specified hash algorithm (default: " HASHALG_DEFAULT ")",
- "{SHA-256 | SHA-384 | SHA-512}", HandleHashalg, &hashalg},
+ "{SHA-256 | SHA-384 | SHA-512 | SHA-512/256}", HandleHashalg, &hashalg},
{'h', "help", "display this help and exit", NULL, dropt_handle_bool,
&show_help, dropt_attr_halt},
{'v', "verbose", "print status messages to stdout", NULL,
@@ -228,11 +241,39 @@ int main(int argc, char* argv[]) {
cacert_file = CACERT_DEFAULT;
}
- if (msg_str) {
+ if (msg_str && msg_file) {
+ log_error("options --msg and --msgfile cannot be used together");
+ ret_value = EXIT_FAILURE;
+ break;
+ } else if (msg_str) {
msg_size = strlen(msg_str);
+ } else if (msg_file) {
+ msg_buf = NewBufferFromFile(msg_file, &msg_size);
+ if (!msg_buf) {
+ ret_value = EXIT_FAILURE;
+ break;
+ }
+ msg_str = msg_buf;
+ } else {
+ msg_size = 0;
}
- if (basename_str) {
+
+ if (basename_str && basename_file) {
+ log_error("options --bsn and --bsnfile cannot be used together");
+ ret_value = EXIT_FAILURE;
+ break;
+ } else if (basename_str) {
basename_size = strlen(basename_str);
+ } else if (basename_file) {
+ basename_buf = NewBufferFromFile(basename_file, &basename_size);
+ if (!basename_buf) {
+ log_error("Failed in reading basename from %s", basename_file);
+ ret_value = EXIT_FAILURE;
+ break;
+ }
+ basename_str = basename_buf;
+ } else {
+ basename_size = 0;
}
if (verbose) {
log_msg("\nOption values:");
@@ -400,6 +441,8 @@ int main(int argc, char* argv[]) {
// Free allocated buffers
if (sig) free(sig);
+ if (msg_buf) free(msg_buf);
+ if (basename_buf) free(basename_buf);
if (signed_sig_rl) free(signed_sig_rl);
if (signed_pubkey) free(signed_pubkey);
if (mprivkey) free(mprivkey);
diff --git a/example/signmsg/src/signmsg.c b/example/signmsg/src/signmsg.c
index 7b95d0d..b6a78a9 100644
--- a/example/signmsg/src/signmsg.c
+++ b/example/signmsg/src/signmsg.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -26,21 +26,9 @@
#include <string.h>
#include "src/signmsg.h"
#include "src/prng.h"
-#include "util/envutil.h"
-#include "util/stdtypes.h"
-#include "util/buffutil.h"
#include "epid/member/api.h"
#include "epid/common/file_parser.h"
-bool IsCaCertAuthorizedByRootCa(void const* data, size_t size) {
- // Implementation of this function is out of scope of the sample.
- // In an actual implementation Issuing CA certificate must be validated
- // with CA Root certificate before using it in parse functions.
- (void)data;
- (void)size;
- return true;
-}
-
EpidStatus SignMsg(void const* msg, size_t msg_len, void const* basename,
size_t basename_len, unsigned char const* signed_sig_rl,
size_t signed_sig_rl_size,
@@ -72,35 +60,6 @@ EpidStatus SignMsg(void const* msg, size_t msg_len, void const* basename,
break;
}
- if (signed_sig_rl) {
- // authenticate and determine space needed for SigRl
- sts = EpidParseSigRlFile(signed_sig_rl, signed_sig_rl_size, cacert, NULL,
- &sig_rl_size);
- if (kEpidSigInvalid == sts) {
- // authentication failure
- break;
- }
- if (kEpidNoErr != sts) {
- break;
- }
- sig_rl = AllocBuffer(sig_rl_size);
- if (!sig_rl) {
- sts = kEpidMemAllocErr;
- break;
- }
-
- // fill the SigRl
- sts = EpidParseSigRlFile(signed_sig_rl, signed_sig_rl_size, cacert,
- sig_rl, &sig_rl_size);
- if (kEpidSigInvalid == sts) {
- // authentication failure
- break;
- }
- if (kEpidNoErr != sts) {
- break;
- }
- } // if (signed_sig_rl)
-
// decompress private key
if (privkey_size == sizeof(PrivKey)) {
priv_key = *(PrivKey*)priv_key_ptr;
@@ -129,10 +88,12 @@ EpidStatus SignMsg(void const* msg, size_t msg_len, void const* basename,
break;
}
- // return member pre-computation blob if requested
- sts = EpidMemberWritePrecomp(member, member_precomp);
- if (kEpidNoErr != sts) {
- break;
+ if (!member_precomp_is_input && member_precomp) {
+ // return member pre-computation blob if requested
+ sts = EpidMemberWritePrecomp(member, member_precomp);
+ if (kEpidNoErr != sts) {
+ break;
+ }
}
// register any provided basename as allowed
@@ -143,6 +104,40 @@ EpidStatus SignMsg(void const* msg, size_t msg_len, void const* basename,
}
}
+ if (signed_sig_rl) {
+ // authenticate and determine space needed for SigRl
+ sts = EpidParseSigRlFile(signed_sig_rl, signed_sig_rl_size, cacert, NULL,
+ &sig_rl_size);
+ if (kEpidSigInvalid == sts) {
+ // authentication failure
+ break;
+ }
+ if (kEpidNoErr != sts) {
+ break;
+ }
+ sig_rl = calloc(1, sig_rl_size);
+ if (!sig_rl) {
+ sts = kEpidMemAllocErr;
+ break;
+ }
+
+ // fill the SigRl
+ sts = EpidParseSigRlFile(signed_sig_rl, signed_sig_rl_size, cacert,
+ sig_rl, &sig_rl_size);
+ if (kEpidSigInvalid == sts) {
+ // authentication failure
+ break;
+ }
+ if (kEpidNoErr != sts) {
+ break;
+ }
+
+ sts = EpidMemberSetSigRl(member, sig_rl, sig_rl_size);
+ if (kEpidNoErr != sts) {
+ break;
+ }
+ } // if (signed_sig_rl)
+
sts = EpidMemberSetHashAlg(member, hash_alg);
if (kEpidNoErr != sts) {
break;
@@ -152,15 +147,15 @@ EpidStatus SignMsg(void const* msg, size_t msg_len, void const* basename,
// Note: Signature size must be computed after sig_rl is loaded.
*sig_len = EpidGetSigSize(sig_rl);
- *sig = AllocBuffer(*sig_len);
+ *sig = calloc(1, *sig_len);
if (!*sig) {
sts = kEpidMemAllocErr;
break;
}
// sign message
- sts = EpidSign(member, msg, msg_len, basename, basename_len, sig_rl,
- sig_rl_size, *sig, *sig_len);
+ sts =
+ EpidSign(member, msg, msg_len, basename, basename_len, *sig, *sig_len);
if (kEpidNoErr != sts) {
break;
}
diff --git a/example/util/Makefile b/example/util/Makefile
index f581f41..0c32769 100644
--- a/example/util/Makefile
+++ b/example/util/Makefile
@@ -19,7 +19,7 @@ $(UTIL_OBJ): %.o: %.c
$(UTIL_LIB): $(UTIL_OBJ)
$(AR) rc $(UTIL_LIB) $(UTIL_OBJ)
- ranlib $(UTIL_LIB)
+ $(RANLIB) $(UTIL_LIB)
build: all
diff --git a/example/verifysig/src/main.c b/example/verifysig/src/main.c
index 951f923..8069506 100644
--- a/example/verifysig/src/main.c
+++ b/example/verifysig/src/main.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,17 +19,13 @@
* \brief Verifysig example implementation.
*/
-#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-
#include <dropt.h>
-#include "epid/common/errors.h"
-#include "epid/common/types.h"
+
#include "epid/common/file_parser.h"
#include "epid/verifier/api.h"
#include "epid/verifier/1.1/api.h"
-
#include "util/buffutil.h"
#include "util/convutil.h"
#include "util/envutil.h"
@@ -50,6 +46,15 @@
#define VPRECMPI_DEFAULT NULL
#define VPRECMPO_DEFAULT NULL
+bool IsCaCertAuthorizedByRootCa(void const* data, size_t size) {
+ // Implementation of this function is out of scope of the sample.
+ // In an actual implementation Issuing CA certificate must be validated
+ // with CA Root certificate before using it in parse functions.
+ (void)data;
+ (void)size;
+ return true;
+}
+
/// parses string to a hashalg type
static dropt_error HandleHashalg(dropt_context* context,
const char* option_argument,
@@ -85,10 +90,14 @@ int main(int argc, char* argv[]) {
// Message string parameter
static char* msg_str = NULL;
size_t msg_size = 0;
+ static char* msg_file = NULL;
+ char* msg_buf = NULL; // message loaded from msg_file
// Basename string parameter
static char* basename_str = NULL;
size_t basename_size = 0;
+ static char* basename_file = NULL;
+ char* basename_buf = NULL; // basename loaded from basename_file
// PrivRl file name parameter
static char* privrl_file = NULL;
@@ -148,12 +157,8 @@ int main(int argc, char* argv[]) {
// Verifier pre-computed settings
void* verifier_precmp = NULL;
- size_t verifier_precmp_size = 0;
size_t vprecmpi_file_size = 0;
- // Flag that Verifier pre-computed settings input is valid
- bool use_precmp_in;
-
// CA certificate
EpidCaCertificate cacert = {0};
// Hash algorithm
@@ -164,8 +169,12 @@ int main(int argc, char* argv[]) {
"FILE", dropt_handle_string, &sig_file},
{'\0', "msg", "MESSAGE that was signed (default: empty)", "MESSAGE",
dropt_handle_string, &msg_str},
+ {'\0', "msgfile", "FILE containing message that was signed", "FILE",
+ dropt_handle_string, &msg_file},
{'\0', "bsn", "BASENAME used in signature (default: random)", "BASENAME",
dropt_handle_string, &basename_str},
+ {'\0', "bsnfile", "FILE containing basename used in signature", "FILE",
+ dropt_handle_string, &basename_file},
{'\0', "privrl", "load private key revocation list from FILE", "FILE",
dropt_handle_string, &privrl_file},
{'\0', "sigrl", "load signature based revocation list from FILE", "FILE",
@@ -189,7 +198,7 @@ int main(int argc, char* argv[]) {
{'\0', "hashalg",
"use specified hash algorithm for 2.0 groups "
"(default: " HASHALG_DEFAULT ")",
- "{SHA-256 | SHA-384 | SHA-512}", HandleHashalg, &hashalg},
+ "{SHA-256 | SHA-384 | SHA-512 | SHA512/256}", HandleHashalg, &hashalg},
{'h', "help", "display this help and exit", NULL, dropt_handle_bool,
&show_help, dropt_attr_halt},
{'v', "verbose", "print status messages to stdout", NULL,
@@ -250,8 +259,41 @@ int main(int argc, char* argv[]) {
if (!grprl_file) grprl_file = GRPRL_DEFAULT;
if (!pubkey_file) pubkey_file = PUBKEYFILE_DEFAULT;
if (!cacert_file_name) cacert_file_name = CACERT_DEFAULT;
- if (msg_str) msg_size = strlen(msg_str);
- if (basename_str) basename_size = strlen(basename_str);
+
+ if (msg_str && msg_file) {
+ log_error("options --msg and --msgfile cannot be used together");
+ ret_value = EXIT_FAILURE;
+ break;
+ } else if (msg_str) {
+ msg_size = strlen(msg_str);
+ } else if (msg_file) {
+ msg_buf = NewBufferFromFile(msg_file, &msg_size);
+ if (!msg_buf) {
+ ret_value = EXIT_FAILURE;
+ break;
+ }
+ msg_str = msg_buf;
+ } else {
+ msg_size = 0;
+ }
+
+ if (basename_str && basename_file) {
+ log_error("options --bsn and --bsnfile cannot be used together");
+ ret_value = EXIT_FAILURE;
+ break;
+ } else if (basename_str) {
+ basename_size = strlen(basename_str);
+ } else if (basename_file) {
+ basename_buf = NewBufferFromFile(basename_file, &basename_size);
+ if (!basename_buf) {
+ log_error("Failed in reading basename from %s", basename_file);
+ ret_value = EXIT_FAILURE;
+ break;
+ }
+ basename_str = basename_buf;
+ } else {
+ basename_size = 0;
+ }
if (verbose) {
log_msg("\nOption values:");
@@ -361,35 +403,12 @@ int main(int argc, char* argv[]) {
}
// Load Verifier pre-computed settings
- if (kEpid1x == epid_version) {
- verifier_precmp_size = sizeof(Epid11VerifierPrecomp);
- } else if (kEpid2x == epid_version) {
- verifier_precmp_size = sizeof(VerifierPrecomp);
- } else {
- log_error("EPID version %s is not supported",
- EpidVersionToString(epid_version));
- ret_value = EXIT_FAILURE;
- break;
- }
- verifier_precmp = AllocBuffer(verifier_precmp_size);
- use_precmp_in = false;
+
if (vprecmpi_file) {
- vprecmpi_file_size = GetFileSize(vprecmpi_file);
- if (verifier_precmp_size != vprecmpi_file_size) {
- if (kEpid2x == epid_version &&
- vprecmpi_file_size == verifier_precmp_size - sizeof(GroupId)) {
- log_error(
- "incorrect input precomp size: precomp format may have changed, "
- "try regenerating it");
- } else {
- log_error("incorrect input precomp size");
- }
- ret_value = EXIT_FAILURE;
- break;
- }
- use_precmp_in = true;
+ vprecmpi_file_size = GetFileSize_S(vprecmpi_file, SIZE_MAX);
+ verifier_precmp = AllocBuffer(vprecmpi_file_size);
- if (0 != ReadLoud(vprecmpi_file, verifier_precmp, verifier_precmp_size)) {
+ if (0 != ReadLoud(vprecmpi_file, verifier_precmp, vprecmpi_file_size)) {
ret_value = EXIT_FAILURE;
break;
}
@@ -434,29 +453,45 @@ int main(int argc, char* argv[]) {
PrintBuffer(signed_pubkey, sizeof(signed_pubkey_size));
log_msg("");
log_msg(" [in] Hash Algorithm: %s", HashAlgToString(hashalg));
- if (use_precmp_in) {
+ if (vprecmpi_file) {
log_msg("");
log_msg(" [in] Verifier PreComp: ");
- PrintBuffer(verifier_precmp, verifier_precmp_size);
+ PrintBuffer(verifier_precmp, vprecmpi_file_size);
}
log_msg("==============================================");
}
// Verify
if (kEpid2x == epid_version) {
+ if (verifier_precmp && vprecmpi_file_size != sizeof(VerifierPrecomp)) {
+ if (vprecmpi_file_size == sizeof(VerifierPrecomp) - sizeof(GroupId)) {
+ log_error(
+ "incorrect input precomp size: precomp format may have changed, "
+ "try regenerating it");
+ } else {
+ log_error("incorrect input precomp size");
+ }
+ ret_value = EXIT_FAILURE;
+ break;
+ }
result =
Verify(sig, sig_size, msg_str, msg_size, basename_str, basename_size,
signed_priv_rl, signed_priv_rl_size, signed_sig_rl,
signed_sig_rl_size, signed_grp_rl, signed_grp_rl_size, ver_rl,
ver_rl_size, signed_pubkey, signed_pubkey_size, &cacert,
- hashalg, (VerifierPrecomp*)verifier_precmp, use_precmp_in);
+ hashalg, &verifier_precmp, &vprecmpi_file_size);
} else if (kEpid1x == epid_version) {
+ if (verifier_precmp &&
+ vprecmpi_file_size != sizeof(Epid11VerifierPrecomp)) {
+ log_error("incorrect input precomp size");
+ ret_value = EXIT_FAILURE;
+ break;
+ }
result = Verify11(sig, sig_size, msg_str, msg_size, basename_str,
basename_size, signed_priv_rl, signed_priv_rl_size,
signed_sig_rl, signed_sig_rl_size, signed_grp_rl,
signed_grp_rl_size, signed_pubkey, signed_pubkey_size,
- &cacert, (Epid11VerifierPrecomp*)verifier_precmp,
- use_precmp_in);
+ &cacert, &verifier_precmp, &vprecmpi_file_size);
} else {
log_error("EPID version %s is not supported",
EpidVersionToString(epid_version));
@@ -466,6 +501,12 @@ int main(int argc, char* argv[]) {
// Report Result
if (kEpidNoErr == result) {
log_msg("signature verified successfully");
+ } else if (kEpidErr == result) {
+ log_error(
+ "signature verification failed: "
+ "member did not prove it was not revoked");
+ ret_value = result;
+ break;
} else {
log_error("signature verification failed: %s",
EpidStatusToString(result));
@@ -475,8 +516,7 @@ int main(int argc, char* argv[]) {
// Store Verifier pre-computed settings
if (vprecmpo_file) {
- if (0 !=
- WriteLoud(verifier_precmp, verifier_precmp_size, vprecmpo_file)) {
+ if (0 != WriteLoud(verifier_precmp, vprecmpi_file_size, vprecmpo_file)) {
ret_value = EXIT_FAILURE;
break;
}
@@ -488,6 +528,8 @@ int main(int argc, char* argv[]) {
// Free allocated buffers
if (sig) free(sig);
+ if (msg_buf) free(msg_buf);
+ if (basename_buf) free(basename_buf);
if (signed_priv_rl) free(signed_priv_rl);
if (signed_sig_rl) free(signed_sig_rl);
if (signed_grp_rl) free(signed_grp_rl);
diff --git a/example/verifysig/src/verifysig.c b/example/verifysig/src/verifysig.c
index 722231d..e0d9d36 100644
--- a/example/verifysig/src/verifysig.c
+++ b/example/verifysig/src/verifysig.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -23,20 +23,9 @@
#include <stdlib.h>
-#include "util/buffutil.h"
-#include "util/envutil.h"
#include "epid/verifier/api.h"
#include "epid/common/file_parser.h"
-bool IsCaCertAuthorizedByRootCa(void const* data, size_t size) {
- // Implementation of this function is out of scope of the sample.
- // In an actual implementation Issuing CA certificate must be validated
- // with CA Root certificate before using it in parse functions.
- (void)data;
- (void)size;
- return true;
-}
-
EpidStatus Verify(EpidSignature const* sig, size_t sig_len, void const* msg,
size_t msg_len, void const* basename, size_t basename_len,
void const* signed_priv_rl, size_t signed_priv_rl_size,
@@ -45,8 +34,7 @@ EpidStatus Verify(EpidSignature const* sig, size_t sig_len, void const* msg,
VerifierRl const* ver_rl, size_t ver_rl_size,
void const* signed_pub_key, size_t signed_pub_key_size,
EpidCaCertificate const* cacert, HashAlg hash_alg,
- VerifierPrecomp* verifier_precomp,
- bool verifier_precomp_is_input) {
+ void** verifier_precomp, size_t* verifier_precomp_size) {
EpidStatus result = kEpidErr;
VerifierCtx* ctx = NULL;
PrivRl* priv_rl = NULL;
@@ -61,16 +49,25 @@ EpidStatus Verify(EpidSignature const* sig, size_t sig_len, void const* msg,
if (kEpidNoErr != result) {
break;
}
+ // ensure the pre-computation blob is not in a legacy format
+ if (*verifier_precomp &&
+ *verifier_precomp_size != sizeof(VerifierPrecomp)) {
+ result = kEpidBadArgErr;
+ break;
+ }
+ *verifier_precomp_size = sizeof(VerifierPrecomp);
// create verifier
- result = EpidVerifierCreate(
- &pub_key, verifier_precomp_is_input ? verifier_precomp : NULL, &ctx);
+ result = EpidVerifierCreate(&pub_key, *verifier_precomp, &ctx);
if (kEpidNoErr != result) {
break;
}
// serialize verifier pre-computation blob
- result = EpidVerifierWritePrecomp(ctx, verifier_precomp);
+ if (!*verifier_precomp) {
+ *verifier_precomp = calloc(1, *verifier_precomp_size);
+ }
+ result = EpidVerifierWritePrecomp(ctx, *verifier_precomp);
if (kEpidNoErr != result) {
break;
}
@@ -92,15 +89,11 @@ EpidStatus Verify(EpidSignature const* sig, size_t sig_len, void const* msg,
size_t priv_rl_size = 0;
result = EpidParsePrivRlFile(signed_priv_rl, signed_priv_rl_size, cacert,
NULL, &priv_rl_size);
- if (kEpidSigInvalid == result) {
- // authentication failure
- break;
- }
if (kEpidNoErr != result) {
break;
}
- priv_rl = AllocBuffer(priv_rl_size);
+ priv_rl = calloc(1, priv_rl_size);
if (!priv_rl) {
result = kEpidMemAllocErr;
break;
@@ -125,15 +118,11 @@ EpidStatus Verify(EpidSignature const* sig, size_t sig_len, void const* msg,
size_t sig_rl_size = 0;
result = EpidParseSigRlFile(signed_sig_rl, signed_sig_rl_size, cacert,
NULL, &sig_rl_size);
- if (kEpidSigInvalid == result) {
- // authentication failure
- break;
- }
if (kEpidNoErr != result) {
break;
}
- sig_rl = AllocBuffer(sig_rl_size);
+ sig_rl = calloc(1, sig_rl_size);
if (!sig_rl) {
result = kEpidMemAllocErr;
break;
@@ -158,15 +147,11 @@ EpidStatus Verify(EpidSignature const* sig, size_t sig_len, void const* msg,
size_t grp_rl_size = 0;
result = EpidParseGroupRlFile(signed_grp_rl, signed_grp_rl_size, cacert,
NULL, &grp_rl_size);
- if (kEpidSigInvalid == result) {
- // authentication failure
- break;
- }
if (kEpidNoErr != result) {
break;
}
- grp_rl = AllocBuffer(grp_rl_size);
+ grp_rl = calloc(1, grp_rl_size);
if (!grp_rl) {
result = kEpidMemAllocErr;
break;
diff --git a/example/verifysig/src/verifysig.h b/example/verifysig/src/verifysig.h
index f566e86..0239b28 100644
--- a/example/verifysig/src/verifysig.h
+++ b/example/verifysig/src/verifysig.h
@@ -21,8 +21,12 @@
#ifndef EXAMPLE_VERIFYSIG_SRC_VERIFYSIG_H_
#define EXAMPLE_VERIFYSIG_SRC_VERIFYSIG_H_
-#include "epid/verifier/api.h"
-#include "epid/common/file_parser.h"
+#include <stddef.h>
+#include "epid/common/stdtypes.h"
+#include "epid/common/errors.h"
+#include "epid/common/types.h"
+
+struct EpidCaCertificate;
/// Check if opaque data blob containing CA certificate is authorized
bool IsCaCertAuthorizedByRootCa(void const* data, size_t size);
@@ -35,8 +39,7 @@ EpidStatus Verify(EpidSignature const* sig, size_t sig_len, void const* msg,
void const* signed_grp_rl, size_t signed_grp_rl_size,
VerifierRl const* ver_rl, size_t ver_rl_size,
void const* signed_pub_key, size_t signed_pub_key_size,
- EpidCaCertificate const* cacert, HashAlg hash_alg,
- VerifierPrecomp* verifier_precomp,
- bool verifier_precomp_is_input);
+ struct EpidCaCertificate const* cacert, HashAlg hash_alg,
+ void** verifier_precomp, size_t* verifier_precomp_size);
#endif // EXAMPLE_VERIFYSIG_SRC_VERIFYSIG_H_
diff --git a/example/verifysig/src/verifysig11.c b/example/verifysig/src/verifysig11.c
index bf44000..d1b0c95 100644
--- a/example/verifysig/src/verifysig11.c
+++ b/example/verifysig/src/verifysig11.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -23,8 +23,6 @@
#include <stdlib.h>
-#include "util/buffutil.h"
-#include "util/envutil.h"
#include "epid/verifier/1.1/api.h"
#include "epid/common/1.1/file_parser.h"
@@ -34,9 +32,8 @@ EpidStatus Verify11(Epid11Signature const* sig, size_t sig_len, void const* msg,
void const* signed_sig_rl, size_t signed_sig_rl_size,
void const* signed_grp_rl, size_t signed_grp_rl_size,
void const* signed_pub_key, size_t signed_pub_key_size,
- EpidCaCertificate const* cacert,
- Epid11VerifierPrecomp* verifier_precomp,
- bool verifier_precomp_is_input) {
+ EpidCaCertificate const* cacert, void** verifier_precomp,
+ size_t* verifier_precomp_size) {
EpidStatus result = kEpidErr;
Epid11VerifierCtx* ctx = NULL;
Epid11PrivRl* priv_rl = NULL;
@@ -52,15 +49,24 @@ EpidStatus Verify11(Epid11Signature const* sig, size_t sig_len, void const* msg,
break;
}
+ if (*verifier_precomp &&
+ *verifier_precomp_size != sizeof(Epid11VerifierPrecomp)) {
+ result = kEpidBadArgErr;
+ break;
+ }
+ *verifier_precomp_size = sizeof(Epid11VerifierPrecomp);
+
// create verifier
- result = Epid11VerifierCreate(
- &pub_key, verifier_precomp_is_input ? verifier_precomp : NULL, &ctx);
+ result = Epid11VerifierCreate(&pub_key, *verifier_precomp, &ctx);
if (kEpidNoErr != result) {
break;
}
// serialize verifier pre-computation blob
- result = Epid11VerifierWritePrecomp(ctx, verifier_precomp);
+ if (!*verifier_precomp) {
+ *verifier_precomp = calloc(1, *verifier_precomp_size);
+ }
+ result = Epid11VerifierWritePrecomp(ctx, *verifier_precomp);
if (kEpidNoErr != result) {
break;
}
@@ -76,15 +82,11 @@ EpidStatus Verify11(Epid11Signature const* sig, size_t sig_len, void const* msg,
size_t priv_rl_size = 0;
result = Epid11ParsePrivRlFile(signed_priv_rl, signed_priv_rl_size,
cacert, NULL, &priv_rl_size);
- if (kEpidSigInvalid == result) {
- // authentication failure
- break;
- }
if (kEpidNoErr != result) {
break;
}
- priv_rl = AllocBuffer(priv_rl_size);
+ priv_rl = calloc(1, priv_rl_size);
if (!priv_rl) {
result = kEpidMemAllocErr;
break;
@@ -109,15 +111,11 @@ EpidStatus Verify11(Epid11Signature const* sig, size_t sig_len, void const* msg,
size_t sig_rl_size = 0;
result = Epid11ParseSigRlFile(signed_sig_rl, signed_sig_rl_size, cacert,
NULL, &sig_rl_size);
- if (kEpidSigInvalid == result) {
- // authentication failure
- break;
- }
if (kEpidNoErr != result) {
break;
}
- sig_rl = AllocBuffer(sig_rl_size);
+ sig_rl = calloc(1, sig_rl_size);
if (!sig_rl) {
result = kEpidMemAllocErr;
break;
@@ -142,15 +140,11 @@ EpidStatus Verify11(Epid11Signature const* sig, size_t sig_len, void const* msg,
size_t grp_rl_size = 0;
result = Epid11ParseGroupRlFile(signed_grp_rl, signed_grp_rl_size, cacert,
NULL, &grp_rl_size);
- if (kEpidSigInvalid == result) {
- // authentication failure
- break;
- }
if (kEpidNoErr != result) {
break;
}
- grp_rl = AllocBuffer(grp_rl_size);
+ grp_rl = calloc(1, grp_rl_size);
if (!grp_rl) {
result = kEpidMemAllocErr;
break;
diff --git a/example/verifysig/src/verifysig11.h b/example/verifysig/src/verifysig11.h
index a346388..a4032bd 100644
--- a/example/verifysig/src/verifysig11.h
+++ b/example/verifysig/src/verifysig11.h
@@ -21,8 +21,11 @@
#ifndef EXAMPLE_VERIFYSIG_SRC_VERIFYSIG11_H_
#define EXAMPLE_VERIFYSIG_SRC_VERIFYSIG11_H_
-#include "epid/verifier/1.1/api.h"
-#include "epid/common/1.1/file_parser.h"
+#include <stddef.h>
+#include "epid/common/errors.h"
+#include "epid/common/1.1/types.h"
+
+struct EpidCaCertificate;
/// verify EPID 1.x signature
EpidStatus Verify11(Epid11Signature const* sig, size_t sig_len, void const* msg,
@@ -31,8 +34,7 @@ EpidStatus Verify11(Epid11Signature const* sig, size_t sig_len, void const* msg,
void const* signed_sig_rl, size_t signed_sig_rl_size,
void const* signed_grp_rl, size_t signed_grp_rl_size,
void const* signed_pub_key, size_t signed_pub_key_size,
- EpidCaCertificate const* cacert,
- Epid11VerifierPrecomp* verifier_precomp,
- bool verifier_precomp_is_input);
+ struct EpidCaCertificate const* cacert,
+ void** verifier_precomp, size_t* verifier_precomp_size);
#endif // EXAMPLE_VERIFYSIG_SRC_VERIFYSIG11_H_
diff --git a/ext/dropt/Makefile b/ext/dropt/Makefile
index 2ec4a37..c7e43ed 100644
--- a/ext/dropt/Makefile
+++ b/ext/dropt/Makefile
@@ -11,7 +11,7 @@ $(DROPT_OBJ): %.o: %.c
$(DROPT_LIB): $(DROPT_OBJ)
$(AR) rc $@ $^
- ranlib $@
+ $(RANLIB) $@
build: all
diff --git a/ext/dropt/src/dropt_string.c b/ext/dropt/src/dropt_string.c
index 6505bd1..32e6575 100644
--- a/ext/dropt/src/dropt_string.c
+++ b/ext/dropt/src/dropt_string.c
@@ -25,7 +25,8 @@
*
* 3. This notice may not be removed or altered from any source distribution.
*/
-
+// This file has been altered to convert a call to the unsafe memcpy to a
+// local loop.
#ifdef _MSC_VER
#include <tchar.h>
#endif
@@ -193,6 +194,7 @@ dropt_strndup(const dropt_char* s, size_t n)
{
dropt_char* copy;
size_t len = 0;
+ size_t i = 0;
assert(s != NULL);
@@ -214,7 +216,9 @@ dropt_strndup(const dropt_char* s, size_t n)
copy = dropt_safe_malloc(len + 1 /* NUL */, sizeof *copy);
if (copy != NULL)
{
- memcpy(copy, s, len * sizeof *copy);
+ for(i = 0; i < len; i+=1){
+ copy[i] = s[i];
+ }
copy[len] = DROPT_TEXT_LITERAL('\0');
}
diff --git a/ext/gtest/Makefile b/ext/gtest/Makefile
index c0e9f15..0d4a4ca 100644
--- a/ext/gtest/Makefile
+++ b/ext/gtest/Makefile
@@ -6,14 +6,12 @@ GTEST_OBJ = $(GTEST_SRC:.cc=.o)
GTEST_LIB = libgtest.a
-CXXFLAGS += -DGTEST_HAS_PTHREAD=0
-
$(GTEST_OBJ): %.o: %.cc
- $(CXX) -o $@ -c $(CXXFLAGS) -I$(GTEST_INCLUDE_DIR) $<
+ $(CXX) -o $@ -c $(CXXFLAGS) $(GTEST_DEFINES) -I$(GTEST_INCLUDE_DIR) $<
$(GTEST_LIB): $(GTEST_OBJ)
$(AR) rc $@ $^
- ranlib $@
+ $(RANLIB) $@
build: all
diff --git a/ext/ipp/include/ippbase.h b/ext/ipp/include/ippbase.h
index 532f151..4030d46 100644
--- a/ext/ipp/include/ippbase.h
+++ b/ext/ipp/include/ippbase.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 1999-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
############################################################################*/
/*
-// Intel(R) Integrated Performance Primitives
+// Intel(R) Integrated Performance Primitives (Intel(R) IPP)
// Basic Types and Macro Definitions
//
//
diff --git a/ext/ipp/include/ippcp.h b/ext/ipp/include/ippcp.h
index a571c22..07356b7 100644
--- a/ext/ipp/include/ippcp.h
+++ b/ext/ipp/include/ippcp.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2002-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
############################################################################*/
/*
-// Intel(R) Integrated Performance Primitives
+// Intel(R) Integrated Performance Primitives (Intel(R) IPP)
// Cryptographic Primitives (ippCP)
//
//
@@ -72,7 +72,6 @@ extern "C" {
IPPAPI( const IppLibraryVersion*, ippcpGetLibVersion, (void) )
-
/*
// =========================================================
// Symmetric Ciphers
@@ -174,6 +173,16 @@ IPPAPI(IppStatus, ippsAESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len,
const IppsAESSpec* pCtx,
Ipp8u* pCtrValue, int ctrNumBitSize))
+IPPAPI(IppStatus, ippsAESEncryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo,
+ const Ipp8u* pTweakPT,
+ const Ipp8u* pKey, int keyBitsize,
+ int dataUnitBitsize))
+IPPAPI(IppStatus, ippsAESDecryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo,
+ const Ipp8u* pTweakPT,
+ const Ipp8u* pKey, int keyBitsize,
+ int dataUnitBitsize))
+
+
/* SMS4 */
IPPAPI(IppStatus, ippsSMS4GetSize,(int *pSize))
IPPAPI(IppStatus, ippsSMS4Init,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx, int ctxSize))
@@ -219,9 +228,7 @@ IPPAPI(IppStatus, ippsSMS4DecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len,
// =========================================================
*/
-/*
-// AES-CCM
-*/
+/* AES-CCM */
IPPAPI(IppStatus, ippsAES_CCMGetSize,(int* pSize))
IPPAPI(IppStatus, ippsAES_CCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_CCMState* pCtx, int ctxSize))
@@ -233,9 +240,7 @@ IPPAPI(IppStatus, ippsAES_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, I
IPPAPI(IppStatus, ippsAES_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pCtx))
IPPAPI(IppStatus, ippsAES_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsAES_CCMState* pCtx))
-/*
-// AES-GCM
-*/
+/* AES-GCM */
IPPAPI(IppStatus, ippsAES_GCMGetSize,(int * pSize))
IPPAPI(IppStatus, ippsAES_GCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_GCMState* pState, int ctxSize))
@@ -251,9 +256,35 @@ IPPAPI(IppStatus, ippsAES_GCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, I
IPPAPI(IppStatus, ippsAES_GCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState))
IPPAPI(IppStatus, ippsAES_GCMGetTag,(Ipp8u* pDstTag, int tagLen, const IppsAES_GCMState* pState))
-/*
-// AES-CMAC
-*/
+/* AES-XTS */
+IPPAPI(IppStatus, ippsAES_XTSGetSize,(int * pSize))
+IPPAPI(IppStatus, ippsAES_XTSInit,(const Ipp8u* pKey, int keyLen,
+ int duBitsize,
+ IppsAES_XTSSpec* pCtx,int ctxSize))
+IPPAPI(IppStatus, ippsAES_XTSEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen,
+ const IppsAES_XTSSpec* pCtx,
+ const Ipp8u* pTweak,
+ int startCipherBlkNo))
+IPPAPI(IppStatus, ippsAES_XTSDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen,
+ const IppsAES_XTSSpec* pCtx,
+ const Ipp8u* pTweak,
+ int startCipherBlkNo))
+
+/* AES-SIV (RFC 5297) */
+IPPAPI(IppStatus, ippsAES_S2V_CMAC,(const Ipp8u* pKey, int keyLen,
+ const Ipp8u* pAD[], const int pADlen[], int numAD,
+ Ipp8u* pV))
+IPPAPI(IppStatus, ippsAES_SIVEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len,
+ Ipp8u* pSIV,
+ const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen,
+ const Ipp8u* pAD[], const int pADlen[], int numAD))
+IPPAPI(IppStatus, ippsAES_SIVDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len,
+ int* pAuthPassed,
+ const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen,
+ const Ipp8u* pAD[], const int pADlen[], int numAD,
+ const Ipp8u* pSIV))
+
+/* AES-CMAC */
IPPAPI(IppStatus, ippsAES_CMACGetSize,(int* pSize))
IPPAPI(IppStatus, ippsAES_CMACInit,(const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pState, int ctxSize))
@@ -261,6 +292,7 @@ IPPAPI(IppStatus, ippsAES_CMACUpdate,(const Ipp8u* pSrc, int len, IppsAES_CMACSt
IPPAPI(IppStatus, ippsAES_CMACFinal,(Ipp8u* pMD, int mdLen, IppsAES_CMACState* pState))
IPPAPI(IppStatus, ippsAES_CMACGetTag,(Ipp8u* pMD, int mdLen, const IppsAES_CMACState* pState))
+
/*
// =========================================================
// RC4 Stream Ciphers
@@ -284,6 +316,7 @@ IPPAPI(IppStatus, ippsARCFourDecrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int lengt
// One-Way Hash Functions
// =========================================================
*/
+
/* SHA1 Hash Primitives */
IPPAPI(IppStatus, ippsSHA1GetSize,(int* pSize))
IPPAPI(IppStatus, ippsSHA1Init,(IppsSHA1State* pCtx))
@@ -388,8 +421,44 @@ IPPAPI(IppStatus, ippsHashGetTag,(Ipp8u* pMD, int tagLen, const IppsHashState* p
IPPAPI(IppStatus, ippsHashFinal,(Ipp8u* pMD, IppsHashState* pCtx))
IPPAPI(IppStatus, ippsHashMessage,(const Ipp8u* pMsg, int len, Ipp8u* pMD, IppHashAlgId hashAlg))
+/* methods are using below */
+IPPAPI( const IppsHashMethod*, ippsHashMethod_MD5, (void) )
+IPPAPI( const IppsHashMethod*, ippsHashMethod_SM3, (void) )
+
+IPPAPI( const IppsHashMethod*, ippsHashMethod_SHA1, (void) )
+IPPAPI( const IppsHashMethod*, ippsHashMethod_SHA1_NI, (void) )
+IPPAPI( const IppsHashMethod*, ippsHashMethod_SHA1_TT, (void) )
+
+IPPAPI( const IppsHashMethod*, ippsHashMethod_SHA256, (void) )
+IPPAPI( const IppsHashMethod*, ippsHashMethod_SHA256_NI, (void) )
+IPPAPI( const IppsHashMethod*, ippsHashMethod_SHA256_TT, (void) )
+
+IPPAPI( const IppsHashMethod*, ippsHashMethod_SHA224, (void) )
+IPPAPI( const IppsHashMethod*, ippsHashMethod_SHA224_NI, (void) )
+IPPAPI( const IppsHashMethod*, ippsHashMethod_SHA224_TT, (void) )
+
+IPPAPI( const IppsHashMethod*, ippsHashMethod_SHA512, (void) )
+IPPAPI( const IppsHashMethod*, ippsHashMethod_SHA384, (void) )
+IPPAPI( const IppsHashMethod*, ippsHashMethod_SHA512_256, (void) )
+IPPAPI( const IppsHashMethod*, ippsHashMethod_SHA512_224, (void) )
+
+/* generalized method based Hash Primitives */
+IPPAPI(IppStatus, ippsHashGetSize_rmf,(int* pSize))
+IPPAPI(IppStatus, ippsHashInit_rmf,(IppsHashState_rmf* pCtx, const IppsHashMethod* pMethod))
+
+IPPAPI(IppStatus, ippsHashPack_rmf,(const IppsHashState_rmf* pCtx, Ipp8u* pBuffer, int bufSize))
+IPPAPI(IppStatus, ippsHashUnpack_rmf,(const Ipp8u* pBuffer, IppsHashState_rmf* pCtx))
+IPPAPI(IppStatus, ippsHashDuplicate_rmf,(const IppsHashState_rmf* pSrcCtx, IppsHashState_rmf* pDstCtx))
+
+IPPAPI(IppStatus, ippsHashUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHashState_rmf* pCtx))
+IPPAPI(IppStatus, ippsHashGetTag_rmf,(Ipp8u* pMD, int tagLen, const IppsHashState_rmf* pCtx))
+IPPAPI(IppStatus, ippsHashFinal_rmf,(Ipp8u* pMD, IppsHashState_rmf* pCtx))
+IPPAPI(IppStatus, ippsHashMessage_rmf,(const Ipp8u* pMsg, int len, Ipp8u* pMD, const IppsHashMethod* pMethod))
+
/* general MGF Primitives*/
IPPAPI(IppStatus, ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, IppHashAlgId hashAlg))
+IPPAPI(IppStatus, ippsMGF1_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod))
+IPPAPI(IppStatus, ippsMGF2_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod))
/*
@@ -397,6 +466,8 @@ IPPAPI(IppStatus, ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int ma
// Keyed-Hash Message Authentication Codes
// =========================================================
*/
+
+/* generalized Keyed HMAC primitives */
IPPAPI(IppStatus, ippsHMAC_GetSize,(int* pSize))
IPPAPI(IppStatus, ippsHMAC_Init,(const Ipp8u* pKey, int keyLen, IppsHMACState* pCtx, IppHashAlgId hashAlg))
@@ -412,6 +483,24 @@ IPPAPI(IppStatus, ippsHMAC_Message,(const Ipp8u* pMsg, int msgLen,
Ipp8u* pMD, int mdLen,
IppHashAlgId hashAlg))
+/* method based generalized Keyed HMAC primitives */
+IPPAPI(IppStatus, ippsHMACGetSize_rmf,(int* pSize))
+IPPAPI(IppStatus, ippsHMACInit_rmf,(const Ipp8u* pKey, int keyLen,
+ IppsHMACState_rmf* pCtx,
+ const IppsHashMethod* pMethod))
+
+IPPAPI(IppStatus, ippsHMACPack_rmf,(const IppsHMACState_rmf* pCtx, Ipp8u* pBuffer, int bufSize))
+IPPAPI(IppStatus, ippsHMACUnpack_rmf,(const Ipp8u* pBuffer, IppsHMACState_rmf* pCtx))
+IPPAPI(IppStatus, ippsHMACDuplicate_rmf,(const IppsHMACState_rmf* pSrcCtx, IppsHMACState_rmf* pDstCtx))
+
+IPPAPI(IppStatus, ippsHMACUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHMACState_rmf* pCtx))
+IPPAPI(IppStatus, ippsHMACFinal_rmf,(Ipp8u* pMD, int mdLen, IppsHMACState_rmf* pCtx))
+IPPAPI(IppStatus, ippsHMACGetTag_rmf,(Ipp8u* pMD, int mdLen, const IppsHMACState_rmf* pCtx))
+IPPAPI(IppStatus, ippsHMACMessage_rmf,(const Ipp8u* pMsg, int msgLen,
+ const Ipp8u* pKey, int keyLen,
+ Ipp8u* pMD, int mdLen,
+ const IppsHashMethod* pMethod))
+
/*
// =========================================================
@@ -587,6 +676,21 @@ IPPAPI(IppStatus, ippsRSADecrypt_OAEP,(const Ipp8u* pSrc,
IppHashAlgId hashAlg,
Ipp8u* pBuffer))
+IPPAPI(IppStatus, ippsRSAEncrypt_OAEP_rmf,(const Ipp8u* pSrc, int srcLen,
+ const Ipp8u* pLabel, int labLen,
+ const Ipp8u* pSeed,
+ Ipp8u* pDst,
+ const IppsRSAPublicKeyState* pKey,
+ const IppsHashMethod* pMethod,
+ Ipp8u* pBuffer))
+
+IPPAPI(IppStatus, ippsRSADecrypt_OAEP_rmf,(const Ipp8u* pSrc,
+ const Ipp8u* pLab, int labLen,
+ Ipp8u* pDst, int* pDstLen,
+ const IppsRSAPrivateKeyState* pKey,
+ const IppsHashMethod* pMethod,
+ Ipp8u* pBuffer))
+
/* encryption scheme: RSAES-PKCS_v1_5 */
IPPAPI(IppStatus, ippsRSAEncrypt_PKCSv15,(const Ipp8u* pSrc, int srcLen,
const Ipp8u* pRndPS,
@@ -599,7 +703,6 @@ IPPAPI(IppStatus, ippsRSADecrypt_PKCSv15,(const Ipp8u* pSrc,
const IppsRSAPrivateKeyState* pKey,
Ipp8u* pBuffer))
-
/* signature scheme : RSA-SSA-PSS */
IPPAPI(IppStatus, ippsRSASign_PSS,(const Ipp8u* pMsg, int msgLen,
const Ipp8u* pSalt, int saltLen,
@@ -616,6 +719,21 @@ IPPAPI(IppStatus, ippsRSAVerify_PSS,(const Ipp8u* pMsg, int msgLen,
IppHashAlgId hashAlg,
Ipp8u* pBuffer))
+IPPAPI(IppStatus, ippsRSASign_PSS_rmf,(const Ipp8u* pMsg, int msgLen,
+ const Ipp8u* pSalt, int saltLen,
+ Ipp8u* pSign,
+ const IppsRSAPrivateKeyState* pPrvKey,
+ const IppsRSAPublicKeyState* pPubKey,
+ const IppsHashMethod* pMethod,
+ Ipp8u* pBuffer))
+
+IPPAPI(IppStatus, ippsRSAVerify_PSS_rmf,(const Ipp8u* pMsg, int msgLen,
+ const Ipp8u* pSign,
+ int* pIsValid,
+ const IppsRSAPublicKeyState* pKey,
+ const IppsHashMethod* pMethod,
+ Ipp8u* pBuffer))
+
/* signature scheme : RSA-SSA-PKCS1-v1_5 */
IPPAPI(IppStatus, ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen,
Ipp8u* pSign,
@@ -624,13 +742,26 @@ IPPAPI(IppStatus, ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen,
IppHashAlgId hashAlg,
Ipp8u* pBuffer))
-
IPPAPI(IppStatus, ippsRSAVerify_PKCS1v15,(const Ipp8u* pMsg, int msgLen,
const Ipp8u* pSign, int* pIsValid,
const IppsRSAPublicKeyState* pKey,
IppHashAlgId hashAlg,
Ipp8u* pBuffer))
+IPPAPI(IppStatus, ippsRSASign_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen,
+ Ipp8u* pSign,
+ const IppsRSAPrivateKeyState* pPrvKey,
+ const IppsRSAPublicKeyState* pPubKey,
+ const IppsHashMethod* pMethod,
+ Ipp8u* pBuffer))
+
+IPPAPI(IppStatus, ippsRSAVerify_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen,
+ const Ipp8u* pSign, int* pIsValid,
+ const IppsRSAPublicKeyState* pKey,
+ const IppsHashMethod* pMethod,
+ Ipp8u* pBuffer))
+
+
/*
// =========================================================
// DL Cryptography
@@ -718,15 +849,6 @@ IPPAPI( const char*, ippsECCGetResultString, (IppECResult code))
*/
/* general EC initialization */
IPPAPI(IppStatus, ippsECCPGetSize,(int feBitSize, int* pSize))
-IPPAPI(IppStatus, ippsECCPInit,(int feBitSize, IppsECCPState* pECC))
-
-IPPAPI(IppStatus, ippsECCPSet,(const IppsBigNumState* pPrime,
- const IppsBigNumState* pA, const IppsBigNumState* pB,
- const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder,
- int cofactor,
- IppsECCPState* pECC))
-
-/* standard EC initialization */
IPPAPI(IppStatus, ippsECCPGetSizeStd128r1,(int* pSize))
IPPAPI(IppStatus, ippsECCPGetSizeStd128r2,(int* pSize))
IPPAPI(IppStatus, ippsECCPGetSizeStd192r1,(int* pSize))
@@ -736,6 +858,7 @@ IPPAPI(IppStatus, ippsECCPGetSizeStd384r1,(int* pSize))
IPPAPI(IppStatus, ippsECCPGetSizeStd521r1,(int* pSize))
IPPAPI(IppStatus, ippsECCPGetSizeStdSM2,(int* pSize))
+IPPAPI(IppStatus, ippsECCPInit,(int feBitSize, IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPInitStd128r1,(IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPInitStd128r2,(IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPInitStd192r1,(IppsECCPState* pECC))
@@ -745,6 +868,12 @@ IPPAPI(IppStatus, ippsECCPInitStd384r1,(IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPInitStd521r1,(IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPInitStdSM2,(IppsECCPState* pECC))
+IPPAPI(IppStatus, ippsECCPSet,(const IppsBigNumState* pPrime,
+ const IppsBigNumState* pA, const IppsBigNumState* pB,
+ const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder,
+ int cofactor,
+ IppsECCPState* pECC))
+IPPAPI(IppStatus, ippsECCPSetStd,(IppECCType flag, IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPSetStd128r1,(IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPSetStd128r2,(IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPSetStd192r1,(IppsECCPState* pECC))
@@ -754,7 +883,12 @@ IPPAPI(IppStatus, ippsECCPSetStd384r1,(IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPSetStd521r1,(IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPSetStdSM2,(IppsECCPState* pECC))
-IPPAPI(IppStatus, ippsECCPSetStd,(IppECCType flag, IppsECCPState* pECC))
+IPPAPI(IppStatus, ippsECCPBindGxyTblStd192r1,(IppsECCPState* pECC))
+IPPAPI(IppStatus, ippsECCPBindGxyTblStd224r1,(IppsECCPState* pECC))
+IPPAPI(IppStatus, ippsECCPBindGxyTblStd256r1,(IppsECCPState* pECC))
+IPPAPI(IppStatus, ippsECCPBindGxyTblStd384r1,(IppsECCPState* pECC))
+IPPAPI(IppStatus, ippsECCPBindGxyTblStd521r1,(IppsECCPState* pECC))
+IPPAPI(IppStatus, ippsECCPBindGxyTblStdSM2, (IppsECCPState* pECC))
IPPAPI(IppStatus, ippsECCPGet,(IppsBigNumState* pPrime,
IppsBigNumState* pA, IppsBigNumState* pB,
@@ -846,6 +980,114 @@ IPPAPI(IppStatus, ippsECCPVerifySM2,(const IppsBigNumState* pMsgDigest,
IppECResult* pResult,
IppsECCPState* pECC))
+/*
+// GF over prime and its extension
+*/
+#define IPP_MIN_GF_CHAR (3) /* min characteristic of GF */
+
+#define IPP_MIN_GF_BITSIZE (2) /* min bitsize of GF element */
+#define IPP_MAX_GF_BITSIZE (1024) /* max bitsize of GF element */
+
+#define IPP_MIN_GF_EXTDEG (2) /* min GF extension degree */
+#define IPP_MAX_GF_EXTDEG (8) /* max GF extension degree */
+
+#define IPP_MAX_EXPONENT_NUM (6) /* min GF extension degree, equals to LOG_CACHE_LINE_SIZE */
+
+IPPAPI(IppStatus, ippsGFpGetSize, (int bitSize, int* pStateSizeInBytes))
+IPPAPI(IppStatus, ippsGFpInit, (const IppsBigNumState* pPrime, int primeBitSize, const IppsGFpMethod* method, IppsGFpState* pGF))
+IPPAPI( const IppsGFpMethod*, ippsGFpMethod_p192r1,(void) )
+IPPAPI( const IppsGFpMethod*, ippsGFpMethod_p224r1,(void) )
+IPPAPI( const IppsGFpMethod*, ippsGFpMethod_p256r1,(void) )
+IPPAPI( const IppsGFpMethod*, ippsGFpMethod_p384r1,(void) )
+IPPAPI( const IppsGFpMethod*, ippsGFpMethod_p521r1,(void) )
+IPPAPI( const IppsGFpMethod*, ippsGFpMethod_p256sm2,(void) )
+IPPAPI( const IppsGFpMethod*, ippsGFpMethod_p256, (void) )
+IPPAPI( const IppsGFpMethod*, ippsGFpMethod_pArb, (void) )
+
+IPPAPI(IppStatus, ippsGFpxGetSize,(const IppsGFpState* pGroundGF, int degree, int* pStateSizeInBytes))
+IPPAPI(IppStatus, ippsGFpxInit, (const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* const ppGroundElm[], int ne, const IppsGFpMethod* method, IppsGFpState* pGFpx))
+IPPAPI(IppStatus, ippsGFpxInitBinomial,(const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* pGroundElm, const IppsGFpMethod* method, IppsGFpState* pGFpx))
+IPPAPI( const IppsGFpMethod*, ippsGFpxMethod_binom2_epid2,(void) )
+IPPAPI( const IppsGFpMethod*, ippsGFpxMethod_binom3_epid2,(void) )
+IPPAPI( const IppsGFpMethod*, ippsGFpxMethod_binom2,(void) )
+IPPAPI( const IppsGFpMethod*, ippsGFpxMethod_binom3,(void) )
+IPPAPI( const IppsGFpMethod*, ippsGFpxMethod_binom,(void) )
+IPPAPI( const IppsGFpMethod*, ippsGFpxMethod_com, (void) )
+
+IPPAPI(IppStatus, ippsGFpScratchBufferSize,(int nExponents, int ExpBitSize, const IppsGFpState* pGF, int* pBufferSize))
+
+IPPAPI(IppStatus, ippsGFpElementGetSize,(const IppsGFpState* pGFp, int* pElementSize))
+IPPAPI(IppStatus, ippsGFpElementInit, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp))
+
+IPPAPI(IppStatus, ippsGFpSetElement, (const Ipp32u* pA, int nsA, IppsGFpElement* pR, IppsGFpState* pGFp))
+IPPAPI(IppStatus, ippsGFpSetElementOctString,(const Ipp8u* pStr, int strSize, IppsGFpElement* pR, IppsGFpState* pGFp))
+IPPAPI(IppStatus, ippsGFpSetElementRandom,(IppsGFpElement* pR, IppsGFpState* pGFp, IppBitSupplier rndFunc, void* pRndParam))
+IPPAPI(IppStatus, ippsGFpSetElementHash,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGF, IppHashAlgId hashID))
+IPPAPI(IppStatus, ippsGFpCpyElement,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp))
+IPPAPI(IppStatus, ippsGFpGetElement,(const IppsGFpElement* pA, Ipp32u* pDataA, int nsA, IppsGFpState* pGFp))
+IPPAPI(IppStatus, ippsGFpGetElementOctString,(const IppsGFpElement* pA, Ipp8u* pStr, int strSize, IppsGFpState* pGFp))
+
+IPPAPI(IppStatus, ippsGFpCmpElement,(const IppsGFpElement* pA, const IppsGFpElement* pB, int* pResult, const IppsGFpState* pGFp))
+IPPAPI(IppStatus, ippsGFpIsZeroElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp))
+IPPAPI(IppStatus, ippsGFpIsUnityElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp))
+
+IPPAPI(IppStatus, ippsGFpConj,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp))
+IPPAPI(IppStatus, ippsGFpNeg, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp))
+IPPAPI(IppStatus, ippsGFpInv, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp))
+IPPAPI(IppStatus, ippsGFpSqrt,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp))
+IPPAPI(IppStatus, ippsGFpSqr, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp))
+IPPAPI(IppStatus, ippsGFpAdd, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp))
+IPPAPI(IppStatus, ippsGFpSub, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp))
+IPPAPI(IppStatus, ippsGFpMul, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp))
+IPPAPI(IppStatus, ippsGFpExp, (const IppsGFpElement* pA, const IppsBigNumState* pE, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer))
+IPPAPI(IppStatus, ippsGFpMultiExp,(const IppsGFpElement* const ppElmA[], const IppsBigNumState* const ppE[], int nItems, IppsGFpElement* pElmR, IppsGFpState* pGF, Ipp8u* pScratchBuffer))
+
+IPPAPI(IppStatus, ippsGFpAdd_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp))
+IPPAPI(IppStatus, ippsGFpSub_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp))
+IPPAPI(IppStatus, ippsGFpMul_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp))
+
+/* ================== */
+IPPAPI(IppStatus, ippsGFpECGetSize,(const IppsGFpState* pGF, int* pCtxSizeInBytes))
+IPPAPI(IppStatus, ippsGFpECInit, (const IppsGFpState* pGF,
+ const IppsGFpElement* pA, const IppsGFpElement* pB,
+ IppsGFpECState* pEC))
+
+IPPAPI(IppStatus, ippsGFpECSet,(const IppsGFpElement* pA, const IppsGFpElement* pB,
+ IppsGFpECState* pEC))
+IPPAPI(IppStatus, ippsGFpECSetSubgroup,(const IppsGFpElement* pX, const IppsGFpElement* pY,
+ const IppsBigNumState* pOrder,
+ const IppsBigNumState* pCofactor,
+ IppsGFpECState* pEC))
+
+IPPAPI(IppStatus, ippsGFpECGet,(IppsGFpState** const ppGF,
+ IppsGFpElement* pA, IppsGFpElement* pB,
+ const IppsGFpECState* pEC))
+IPPAPI(IppStatus, ippsGFpECGetSubgroup,(IppsGFpState** const ppGF,
+ IppsGFpElement* pX, IppsGFpElement* pY,
+ IppsBigNumState* pOrder,IppsBigNumState* pCofactor,
+ const IppsGFpECState* pEC))
+
+IPPAPI(IppStatus, ippsGFpECScratchBufferSize,(int nScalars, const IppsGFpECState* pEC, int* pBufferSize))
+
+IPPAPI(IppStatus, ippsGFpECVerify,(IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer))
+
+IPPAPI(IppStatus, ippsGFpECPointGetSize,(const IppsGFpECState* pEC, int* pSizeInBytes))
+IPPAPI(IppStatus, ippsGFpECPointInit, (const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC))
+
+IPPAPI(IppStatus, ippsGFpECSetPointAtInfinity,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC))
+IPPAPI(IppStatus, ippsGFpECSetPoint,(const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC))
+IPPAPI(IppStatus, ippsGFpECSetPointRandom,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam, Ipp8u* pScratchBuffer))
+IPPAPI(IppStatus, ippsGFpECMakePoint,(const IppsGFpElement* pX, IppsGFpECPoint* pPoint, IppsGFpECState* pEC))
+IPPAPI(IppStatus, ippsGFpECSetPointHash,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer))
+IPPAPI(IppStatus, ippsGFpECGetPoint,(const IppsGFpECPoint* pPoint, IppsGFpElement* pX, IppsGFpElement* pY, IppsGFpECState* pEC))
+
+IPPAPI(IppStatus, ippsGFpECTstPoint,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC))
+IPPAPI(IppStatus, ippsGFpECTstPointInSubgroup,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer))
+IPPAPI(IppStatus, ippsGFpECCpyPoint,(const IppsGFpECPoint* pA, IppsGFpECPoint* pR, IppsGFpECState* pEC))
+IPPAPI(IppStatus, ippsGFpECCmpPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppECResult* pResult, IppsGFpECState* pEC))
+IPPAPI(IppStatus, ippsGFpECNegPoint,(const IppsGFpECPoint* pP, IppsGFpECPoint* pR, IppsGFpECState* pEC))
+IPPAPI(IppStatus, ippsGFpECAddPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECPoint* pR, IppsGFpECState* pEC))
+IPPAPI(IppStatus, ippsGFpECMulPoint,(const IppsGFpECPoint* pP, const IppsBigNumState* pN, IppsGFpECPoint* pR, IppsGFpECState* pEC, Ipp8u* pScratchBuffer))
#ifdef __cplusplus
}
diff --git a/ext/ipp/include/ippcpdefs.h b/ext/ipp/include/ippcpdefs.h
index aa30622..c48835f 100644
--- a/ext/ipp/include/ippcpdefs.h
+++ b/ext/ipp/include/ippcpdefs.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2012-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
############################################################################*/
/*
-// Intel(R) Integrated Performance Primitives
+// Intel(R) Integrated Performance Primitives (Intel(R) IPP)
// Cryptographic Primitives (ippCP) definitions.
//
//
@@ -66,10 +66,12 @@ typedef enum {
ippRijndaelKey256 = 256, IppsRijndaelKey256 = 256 /* 256-bit key */
} IppsRijndaelKeyLength;
-/* AES based authentication & confidence */
-typedef struct _cpRijndael128GCM IppsRijndael128GCMState;
+/* AES-CCM (authentication & confidence) */
typedef struct _cpAES_CCM IppsAES_CCMState;
-typedef struct _cpRijndael128GCM IppsAES_GCMState;
+/* AES-GCM (authentication & confidence) */
+typedef struct _cpAES_GCM IppsAES_GCMState;
+/* AES-XTS (confidence) */
+typedef struct _cpAES_XTS IppsAES_XTSSpec;
/*
// =========================================================
@@ -121,6 +123,9 @@ typedef struct _cpMD5 IppsMD5State;
typedef struct _cpSM3 IppsSM3State;
typedef struct _cpHashCtx IppsHashState;
+typedef struct _cpHashMethod_rmf IppsHashMethod;
+typedef struct _cpHashCtx_rmf IppsHashState_rmf;
+
/* MGF */
typedef IppStatus (__STDCALL *IppMGF)(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen);
@@ -149,6 +154,7 @@ typedef struct _cpHMAC IppsHMACSHA224State;
typedef struct _cpHMAC IppsHMACSHA384State;
typedef struct _cpHMAC IppsHMACSHA512State;
typedef struct _cpHMAC IppsHMACMD5State;
+typedef struct _cpHMAC_rmf IppsHMACState_rmf;
/*
// =========================================================
@@ -162,6 +168,8 @@ typedef struct _cpAES_CMAC IppsAES_CMACState;
// Big Number Integer Arithmetic
// =========================================================
*/
+#define BN_MAXBITSIZE (16*1024) /* bn max size (bits) */
+
typedef enum {
ippBigNumNEG = 0, IppsBigNumNEG = 0,
ippBigNumPOS = 1, IppsBigNumPOS = 1
@@ -208,6 +216,9 @@ typedef IppStatus (__STDCALL *IppBitSupplier)(Ipp32u* pRand, int nBits, void* pE
// RSA Cryptography
// =========================================================
*/
+#define MIN_RSA_SIZE (8)
+#define MAX_RSA_SIZE (8*1024)
+
typedef struct _cpRSA IppsRSAState;
/* key types */
@@ -231,14 +242,26 @@ typedef enum {
typedef struct _cpRSA_public_key IppsRSAPublicKeyState;
typedef struct _cpRSA_private_key IppsRSAPrivateKeyState;
-#define MIN_RSA_SIZE (8)
-#define MAX_RSA_SIZE (4096)
/*
// =========================================================
// DL Cryptography
// =========================================================
*/
+#define MIN_DLP_BITSIZE (512)
+#define MIN_DLP_BITSIZER (160)
+
+#define MIN_DLPDH_BITSIZE (512)
+#define MIN_DLPDH_BITSIZER (160)
+#define DEF_DLPDH_BITSIZER (160)
+
+#define MIN_DLPDSA_BITSIZE (512)
+#define MAX_DLPDSA_BITSIZE (1024)
+#define MIN_DLPDSA_BITSIZER (160)
+#define DEF_DLPDSA_BITSIZER (160)
+#define MAX_DLPDSA_BITSIZER (160)
+#define MIN_DLPDSA_SEEDSIZE (160)
+
typedef struct _cpDLP IppsDLPState;
/* domain parameter tags */
@@ -267,29 +290,12 @@ typedef enum {
ippDLInvalidSignature /* invalid signature */
} IppDLResult;
-#define MIN_DLP_BITSIZE (512)
-#define MIN_DLP_BITSIZER (160)
-
-#define MIN_DLPDH_BITSIZE (512)
-#define MIN_DLPDH_BITSIZER (160)
-#define DEF_DLPDH_BITSIZER (160)
-
-#define MIN_DLPDSA_BITSIZE (512)
-#define MAX_DLPDSA_BITSIZE (1024)
-#define MIN_DLPDSA_BITSIZER (160)
-#define DEF_DLPDSA_BITSIZER (160)
-#define MAX_DLPDSA_BITSIZER (160)
-#define MIN_DLPDSA_SEEDSIZE (160)
-
/*
// =========================================================
// EC Cryptography
// =========================================================
*/
-typedef struct _cpECCP IppsECCPState;
-typedef struct _cpECCB IppsECCBState;
-typedef struct _cpECCPPoint IppsECCPPointState;
-typedef struct _cpECCBPoint IppsECCBPointState;
+#define EC_GFP_MAXBITSIZE (1024)
/* operation result */
typedef enum {
@@ -362,6 +368,28 @@ typedef enum {
IppECCBStd571k1 = IppECCKStd+5 /* Koblitz 571 curve */
} IppsECType, IppECCType;
+/*
+// GF over prime and its extension
+*/
+typedef struct _cpGFpMethod IppsGFpMethod;
+
+typedef struct _cpGFp IppsGFpState;
+typedef struct _cpGFpElement IppsGFpElement;
+
+typedef struct _cpGFpEC IppsGFpECState;
+typedef struct _cpGFpECPoint IppsGFpECPoint;
+
+typedef struct _cpGFpEC IppsECCPState;
+typedef struct _cpGFpECPoint IppsECCPPointState;
+
+typedef struct {
+ const IppsGFpState* pBasicGF;
+ const IppsGFpState* pGroundGF;
+ int basicGFdegree;
+ int groundGFdegree;
+ int elementLen;
+} IppsGFpInfo;
+
#endif /* _OWN_BLDPCS */
#ifdef __cplusplus
diff --git a/ext/ipp/include/ippcpepid.h b/ext/ipp/include/ippcpepid.h
deleted file mode 100644
index d36661b..0000000
--- a/ext/ipp/include/ippcpepid.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-// Intel(R) Integrated Performance Primitives
-// ippCP Intel(R) EPID functionality
-//
-//
-*/
-
-
-#if !defined( __IPPCPEPID_H__ ) || defined( _OWN_BLDPCS )
-#define __IPPCPEPID_H__
-
-
-#if defined (_WIN32_WCE) && defined (_M_IX86) && defined (__stdcall)
- #define _IPP_STDCALL_CDECL
- #undef __stdcall
-#endif
-
-
-#ifndef __IPPDEFS_H__
- #include "ippdefs.h"
-#endif
-
-#ifndef __IPPCPDEFS_H__
- #include "ippcpdefs.h"
-#endif
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if !defined( _IPP_NO_DEFAULT_LIB )
- #if defined( _IPP_PARALLEL_DYNAMIC ) || defined( _IPP_SEQUENTIAL_DYNAMIC )
- #pragma comment( lib, "ippcpepid" )
- #pragma comment( lib, "ippcp" )
- #pragma comment( lib, "ippcore" )
- #elif defined( _IPP_PARALLEL_STATIC ) || defined( _IPP_SEQUENTIAL_STATIC )
- #pragma comment( lib, "ippcpepidmt" )
- #pragma comment( lib, "ippcpmt" )
- #pragma comment( lib, "ippcoremt" )
- #endif
-#endif
-
-
-/* /////////////////////////////////////////////////////////////////////////////
-// Name: ippcpepidGetLibVersion
-// Purpose: getting of the library version
-// Returns: the structure of information about version of ippCP EPID library
-// Parameters:
-//
-// Notes: not necessary to release the returned structure
-*/
-IPPAPI( const IppLibraryVersion*, ippcpepidGetLibVersion, (void) )
-
-
-/*
-// Finite Field Low Level Math
-*/
-#define IPP_MIN_GF_BITSIZE (2) /* min bitsize for GF element */
-#define IPP_MAX_GF_BITSIZE (4096) /* max bitsize for GF element */
-
-//#define IPP_IS_EQ IS_ZERO //(0)
-//#define IPP_IS_NE (1)
-//#define IPP_IS_GT GREATER_THAN_ZERO //(2)
-//#define IPP_IS_LT LESS_THAN_ZERO // (3)
-//#define IPP_IS_NA (4)
-
-#if !defined( _OWN_BLDPCS )
-typedef struct _cpGFp IppsGFpState;
-typedef struct _cpElementGFp IppsGFpElement;
-
-typedef struct {
- const IppsGFpState* pBasicGF;
- const IppsGFpState* pGroundGF;
- int basicGFdegree;
- int groundGFdegree;
- int elementLen;
-} IppsGFpInfo;
-#endif
-
-#if !defined( _OWN_BLDPCS )
-typedef enum {
- ippMD5 = 0x00,
- ippSHA1 = 0x01,
- ippSHA256 = 0x02, ippSHA224 = 0x12,
- ippSHA512 = 0x03, ippSHA384 = 0x13
-} IppHashID;
-#endif /* _OWN_BLDPCS */
-
-
-IPPAPI(IppStatus, ippsGFpGetSize, (int bitSize, int* pStateSizeInBytes))
-IPPAPI(IppStatus, ippsGFpInit, (const Ipp32u* pPime, int bitSize, IppsGFpState* pGFp))
-
-IPPAPI(IppStatus, ippsGFpxGetSize,(const IppsGFpState* pGroundGF, int degree, int* pStateSizeInBytes))
-IPPAPI(IppStatus, ippsGFpxInit, (const IppsGFpState* pGroundGF, const Ipp32u* pIrrPolynomial, int degree, IppsGFpState* pGFpx))
-IPPAPI(IppStatus, ippsGFpxInitBinomial,(const IppsGFpState* pGroundGF, const IppsGFpElement* pGroundElm, int degree, IppsGFpState* pGFpx))
-
-IPPAPI(IppStatus, ippsGFpGetInfo,(const IppsGFpState* pGFp, IppsGFpInfo* pInfo))
-IPPAPI(IppStatus, ippsGFpGetModulus,(const IppsGFpState* pGFp, Ipp32u* pModulus))
-
-IPPAPI(IppStatus, ippsGFpScratchBufferSize,(int nExponents, int ExpBitSize, const IppsGFpState* pGF, int* pBufferSize))
-
-//IPPAPI(IppStatus, ippsBasicGFpRef,(const IppsGFpState* pGFp, IppsGFpState** ppBasicGF))
-//IPPAPI(IppStatus, ippsGroundGFpRef,(const IppsGFpState* pGFp, IppsGFpState** ppGroundGF))
-//IPPAPI(IppStatus, ippsGFpGetDegree,(const IppsGFpState* pGFp, int* pDegree))
-//IPPAPI(IppStatus, ippsGFpGetElementLen,(const IppsGFpState* pGFp, int* pElmLen))
-//IPPAPI(IppStatus, ippsGFpCmp, (const IppsGFpState* pGFp1, const IppsGFpState* pGFp2, IppGFpResult* pCmpResult))
-
-IPPAPI(IppStatus, ippsGFpElementGetSize,(const IppsGFpState* pGFp, int* pElementSize))
-IPPAPI(IppStatus, ippsGFpElementInit, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp))
-
-IPPAPI(IppStatus, ippsGFpSetElement, (const Ipp32u* pA, int nsA, IppsGFpElement* pR, IppsGFpState* pGFp))
-IPPAPI(IppStatus, ippsGFpSetElementOctString,(const Ipp8u* pStr, int strSize, IppsGFpElement* pR, IppsGFpState* pGFp))
-IPPAPI(IppStatus, ippsGFpSetElementRandom,(IppBitSupplier rndFunc, void* pRndParam, IppsGFpElement* pR, IppsGFpState* pGFp))
-IPPAPI(IppStatus, ippsGFpSetElementHash,(const Ipp8u* pMsg, int msgLen, IppHashID hashID, IppsGFpElement* pElm, IppsGFpState* pGF))
-IPPAPI(IppStatus, ippsGFpCpyElement,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp))
-IPPAPI(IppStatus, ippsGFpGetElement,(const IppsGFpElement* pA, Ipp32u* pDataA, int nsA, IppsGFpState* pGFp))
-IPPAPI(IppStatus, ippsGFpGetElementOctString,(const IppsGFpElement* pA, Ipp8u* pStr, int strSize, IppsGFpState* pGFp))
-
-IPPAPI(IppStatus, ippsGFpCmpElement,(const IppsGFpElement* pA, const IppsGFpElement* pB, int* pResult, const IppsGFpState* pGFp))
-IPPAPI(IppStatus, ippsGFpIsZeroElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp))
-IPPAPI(IppStatus, ippsGFpIsUnityElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp))
-
-//IPPAPI(IppStatus, ippsGFpSetPolyTerm, (const Ipp32u* pTerm, int nsT, int termDegree, IppsGFpElement* pElm, IppsGFpState* pGF))
-//IPPAPI(IppStatus, ippsGFpGetPolyTerm, (const IppsGFpElement* pElm, int termDegree, Ipp32u* pTerm, int nsT, IppsGFpState* pGF))
-
-IPPAPI(IppStatus, ippsGFpConj,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp))
-IPPAPI(IppStatus, ippsGFpNeg, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp))
-IPPAPI(IppStatus, ippsGFpInv, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp))
-IPPAPI(IppStatus, ippsGFpSqrt,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp))
-IPPAPI(IppStatus, ippsGFpAdd, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp))
-IPPAPI(IppStatus, ippsGFpSub, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp))
-IPPAPI(IppStatus, ippsGFpMul, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp))
-IPPAPI(IppStatus, ippsGFpSqr, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp))
-IPPAPI(IppStatus, ippsGFpExp, (const IppsGFpElement* pA, const IppsBigNumState* pE, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer))
-IPPAPI(IppStatus, ippsGFpMultiExp,(const IppsGFpElement* const ppElmA[], const IppsBigNumState* const ppE[], int nItems, IppsGFpElement* pElmR, IppsGFpState* pGF, Ipp8u* pScratchBuffer))
-
-IPPAPI(IppStatus, ippsGFpAdd_GFpE,(const IppsGFpElement* pA, const IppsGFpElement* pGroundB, IppsGFpElement* pR, IppsGFpState* pGFp))
-IPPAPI(IppStatus, ippsGFpSub_GFpE,(const IppsGFpElement* pA, const IppsGFpElement* pGroundB, IppsGFpElement* pR, IppsGFpState* pGFp))
-IPPAPI(IppStatus, ippsGFpMul_GFpE,(const IppsGFpElement* pA, const IppsGFpElement* pGroundB, IppsGFpElement* pR, IppsGFpState* pGFp))
-
-
-#if !defined( _OWN_BLDPCS )
-typedef struct _cpGFpEC IppsGFpECState;
-typedef struct _cpGFpECPoint IppsGFpECPoint;
-#endif
-
-IPPAPI(IppStatus, ippsGFpECGetSize,(const IppsGFpState* pGF, int* pCtxSizeInBytes))
-IPPAPI(IppStatus, ippsGFpECInit, (const IppsGFpElement* pA, const IppsGFpElement* pB,
- const IppsGFpElement* pX, const IppsGFpElement* pY,
- const Ipp32u* pOrder, int orderLen,
- const Ipp32u* pCofactor, int cofactorLen,
- IppsGFpState* pGF, IppsGFpECState* pEC))
-
-IPPAPI(IppStatus, ippsGFpECScratchBufferSize,(int nScalars, const IppsGFpECState* pEC, int* pBufferSize))
-
-IPPAPI(IppStatus, ippsGFpECSet,(const IppsGFpElement* pA, const IppsGFpElement* pB,
- const IppsGFpElement* pX, const IppsGFpElement* pY,
- const Ipp32u* pOrder, int orderLen,
- const Ipp32u* pCofactor, int cofactorLen,
- IppsGFpECState* pEC))
-
-IPPAPI(IppStatus, ippsGFpECGet,(const IppsGFpECState* pEC,
- const IppsGFpState** ppGF,
- IppsGFpElement* pA, IppsGFpElement* pB,
- IppsGFpElement* pX, IppsGFpElement* pY,
- const Ipp32u** ppOrder, int* pOrderLen,
- const Ipp32u** ppCofactor, int* pCoFactorLen))
-
-IPPAPI(IppStatus, ippsGFpECVerify,(IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer))
-
-IPPAPI(IppStatus, ippsGFpECPointGetSize,(const IppsGFpECState* pEC, int* pSizeInBytes))
-IPPAPI(IppStatus, ippsGFpECPointInit, (const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC))
-
-IPPAPI(IppStatus, ippsGFpECSetPointAtInfinity,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC))
-IPPAPI(IppStatus, ippsGFpECSetPoint,(const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC))
-IPPAPI(IppStatus, ippsGFpECSetPointRandom,(IppBitSupplier rndFunc, void* pRndParam, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, Ipp8u* pScratchBuffer))
-IPPAPI(IppStatus, ippsGFpECMakePoint,(const IppsGFpElement* pX, IppsGFpECPoint* pPoint, IppsGFpECState* pEC))
-IPPAPI(IppStatus, ippsGFpECSetPointHash,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppHashID hashID, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, Ipp8u* pScratchBuffer))
-
-IPPAPI(IppStatus, ippsGFpECCpyPoint,(const IppsGFpECPoint* pA, IppsGFpECPoint* pR, IppsGFpECState* pEC))
-IPPAPI(IppStatus, ippsGFpECCmpPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppECResult* pResult, IppsGFpECState* pEC))
-
-IPPAPI(IppStatus, ippsGFpECTstPoint,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer))
-IPPAPI(IppStatus, ippsGFpECGetPoint,(const IppsGFpECPoint* pPoint, IppsGFpElement* pX, IppsGFpElement* pY, IppsGFpECState* pEC))
-
-IPPAPI(IppStatus, ippsGFpECNegPoint,(const IppsGFpECPoint* pP, IppsGFpECPoint* pR, IppsGFpECState* pEC))
-IPPAPI(IppStatus, ippsGFpECAddPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECPoint* pR, IppsGFpECState* pEC))
-IPPAPI(IppStatus, ippsGFpECMulPoint,(const IppsGFpECPoint* pP, const IppsBigNumState* pN, IppsGFpECPoint* pR, IppsGFpECState* pEC, Ipp8u* pScratchBuffer))
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#if defined (_IPP_STDCALL_CDECL)
- #undef _IPP_STDCALL_CDECL
- #define __stdcall __cdecl
-#endif
-
-
-#endif /* __IPPCPEPID_H__ */
diff --git a/ext/ipp/include/ippdefs.h b/ext/ipp/include/ippdefs.h
index f3b5248..22e5ff9 100644
--- a/ext/ipp/include/ippdefs.h
+++ b/ext/ipp/include/ippdefs.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 1999-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,11 +14,11 @@
# limitations under the License.
############################################################################*/
-/*
-// Intel(R) Integrated Performance Primitives
+/*
+// Intel(R) Integrated Performance Primitives (Intel(R) IPP)
// Common Types and Macro Definitions
-//
-//
+//
+//
*/
@@ -31,7 +31,7 @@ extern "C" {
#if defined( _IPP_PARALLEL_STATIC ) || defined( _IPP_PARALLEL_DYNAMIC )
- #pragma message("Threaded versions of IPP libraries are deprecated and will be removed in one of the future IPP releases. Use the following link for details: https://software.intel.com/sites/products/ipp-deprecated-features-feedback/")
+ #pragma message("Threaded versions of Intel(R) IPP libraries are deprecated and will be removed in one of the future Intel(R) IPP releases. Use the following link for details: https://software.intel.com/sites/products/ipp-deprecated-features-feedback/")
#endif
#if defined (_WIN64)
@@ -107,9 +107,6 @@ extern "C" {
#if !defined( _IPP_NO_DEFAULT_LIB )
#if defined( _IPP_PARALLEL_STATIC )
- #pragma comment( lib, "libircmt" )
- #pragma comment( lib, "libmmt" )
- #pragma comment( lib, "svml_dispmt" )
#pragma comment( lib, "libiomp5md" )
#endif
#endif
@@ -117,8 +114,6 @@ extern "C" {
#include "ippbase.h"
#include "ipptypes.h"
-extern const IppiRect ippRectInfinite;
-
#ifdef __cplusplus
}
#endif
diff --git a/ext/ipp/include/ipptypes.h b/ext/ipp/include/ipptypes.h
index 3f6961f..ef5e30d 100644
--- a/ext/ipp/include/ipptypes.h
+++ b/ext/ipp/include/ipptypes.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 1999-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
############################################################################*/
/*
-// Intel(R) Integrated Performance Primitives
+// Intel(R) Integrated Performance Primitives (Intel(R) IPP)
// Derivative Types and Macro Definitions
//
// The main purpose of this header file is
@@ -64,6 +64,8 @@ extern "C" {
#define ippCPUID_AVX512BW 0x01000000 /* AVX-512 Byte & Word instructions */
#define ippCPUID_AVX512DQ 0x02000000 /* AVX-512 DWord & QWord instructions */
#define ippCPUID_AVX512VL 0x04000000 /* AVX-512 Vector Length extensions */
+#define ippCPUID_AVX512VBMI 0x08000000 /* AVX-512 Vector Length extensions */
+#define ippCPUID_MPX 0x10000000 /* Intel MPX (Memory Protection Extensions) */
#define ippCPUID_KNC 0x80000000 /* Intel(R) Xeon Phi(TM) Coprocessor */
#if defined( _WIN32 ) || defined ( _WIN64 )
#define ippCPUID_NOCHECK 0x8000000000000000L /* Force ippSetCpuFeatures to set CPU features without check */
@@ -79,10 +81,15 @@ extern "C" {
#define IPP_COUNT_OF( obj ) (sizeof(obj)/sizeof(obj[0]))
+typedef struct {
+ int type;
+ int level;
+ int size;
+} IppCache;
+
/*****************************************************************************/
/* Below are ippSP domain specific definitions */
/*****************************************************************************/
-
typedef enum {
ippRndZero,
ippRndNear,
@@ -272,17 +279,23 @@ typedef enum {
} IppChannels;
typedef enum _IppiBorderType {
- ippBorderConst = 0,
- ippBorderRepl = 1,
- ippBorderWrap = 2,
- ippBorderMirror = 3, /* left border: 012... -> 21012... */
- ippBorderMirrorR = 4, /* left border: 012... -> 210012... */
- ippBorderInMem = 6,
- ippBorderTransp = 7,
+ ippBorderRepl = 1,
+ ippBorderWrap = 2,
+ ippBorderMirror = 3, /* left border: 012... -> 21012... */
+ ippBorderMirrorR = 4, /* left border: 012... -> 210012... */
+ ippBorderDefault = 5,
+ ippBorderConst = 6,
+ ippBorderTransp = 7,
+
+ /* Flags to use source image memory pixels from outside of the border in particular directions */
ippBorderInMemTop = 0x0010,
ippBorderInMemBottom = 0x0020,
ippBorderInMemLeft = 0x0040,
- ippBorderInMemRight = 0x0080
+ ippBorderInMemRight = 0x0080,
+ ippBorderInMem = ippBorderInMemLeft|ippBorderInMemTop|ippBorderInMemRight|ippBorderInMemBottom,
+
+ /* Flags to use source image memory pixels from outside of the border for first stage only in multi-stage filters */
+ ippBorderFirstStageInMem = 0x0F00
} IppiBorderType;
typedef enum {
@@ -411,13 +424,13 @@ typedef struct {
typedef enum {
ippWarpForward,
- ippWarpBackward,
+ ippWarpBackward
} IppiWarpDirection;
typedef enum {
ippWarpAffine,
ippWarpPerspective,
- ippWarpBilinear,
+ ippWarpBilinear
} IppiWarpTransformType;
@@ -511,7 +524,7 @@ typedef enum _IppiDifferentialKernel
ippFilterScharr,
ippFilterCentralDiffVert,
ippFilterCentralDiffHoriz,
- ippFilterCentralDiff,
+ ippFilterCentralDiff
}IppiDifferentialKernel;
#if !defined( _OWN_BLDPCS )
@@ -530,9 +543,13 @@ typedef enum _IppiNorm {
} IppiNorm;
typedef struct ipcvMorphState IppiMorphState;
+typedef struct ipcvMorphStateL IppiMorphStateL;
typedef struct ipcvMorphAdvState IppiMorphAdvState;
+typedef struct ipcvMorphAdvStateL IppiMorphAdvStateL;
typedef struct ipcvMorphGrayState_8u IppiMorphGrayState_8u;
+typedef struct ipcvMorphGrayState_8uL IppiMorphGrayState_8uL;
typedef struct ipcvMorphGrayState_32f IppiMorphGrayState_32f;
+typedef struct ipcvMorphGrayState_32fL IppiMorphGrayState_32fL;
typedef struct ipcvConvState IppiConvState;
@@ -780,7 +797,7 @@ typedef struct LZOState_8u IppLZOState_8u;
#endif /* _OWN_BLDPCS */
/* /////////////////////////////////////////////////////////////////////////////
-// The following enumerator defines a status of IPP operations
+// The following enumerator defines a status of Intel(R) IPP operations
// negative value means error
*/
typedef enum {
@@ -788,7 +805,27 @@ typedef enum {
ippStsNotSupportedModeErr = -9999,/* The requested mode is currently not supported. */
ippStsCpuNotSupportedErr = -9998,/* The target CPU is not supported. */
ippStsInplaceModeNotSupportedErr = -9997,/* The inplace operation is currently not supported. */
-
+#if (defined( _WIN32 ) || defined( _WIN64 ))&&(defined( _OWN_CHECK_X64_ABI ))
+ ippStsABIErrRBX = -8000, /* RBX is not saved by Intel(R) IPP function */
+ ippStsABIErrRDI = -8001, /* RDI is not saved by Intel(R) IPP function */
+ ippStsABIErrRSI = -8002, /* RSI is not saved by Intel(R) IPP function */
+ ippStsABIErrRBP = -8003, /* RBP is not saved by Intel(R) IPP function */
+ ippStsABIErrR12 = -8004, /* R12 is not saved by Intel(R) IPP function */
+ ippStsABIErrR13 = -8005, /* R13 is not saved by Intel(R) IPP function */
+ ippStsABIErrR14 = -8006, /* R14 is not saved by Intel(R) IPP function */
+ ippStsABIErrR15 = -8007, /* R15 is not saved by Intel(R) IPP function */
+ ippStsABIErrXMM6 = -8008, /* XMM6 is not saved by Intel(R) IPP function */
+ ippStsABIErrXMM7 = -8009, /* XMM7 is not saved by Intel(R) IPP function */
+ ippStsABIErrXMM8 = -8010, /* XMM8 is not saved by Intel(R) IPP function */
+ ippStsABIErrXMM9 = -8011, /* XMM9 is not saved by Intel(R) IPP function */
+ ippStsABIErrXMM10 = -8012, /* XMM10 is not saved by Intel(R) IPP function */
+ ippStsABIErrXMM11 = -8013, /* XMM11 is not saved by Intel(R) IPP function */
+ ippStsABIErrXMM12 = -8014, /* XMM12 is not saved by Intel(R) IPP function */
+ ippStsABIErrXMM13 = -8015, /* XMM13 is not saved by Intel(R) IPP function */
+ ippStsABIErrXMM14 = -8016, /* XMM14 is not saved by Intel(R) IPP function */
+ ippStsABIErrXMM15 = -8017, /* XMM15 is not saved by Intel(R) IPP function */
+#endif
+ ippStsIIRIIRLengthErr = -234, /* Vector length for IIRIIR function is less than 3*(IIR order) */
ippStsWarpTransformTypeErr = -233, /* The warp transform type is illegal */
ippStsExceededSizeErr = -232, /* Requested size exceeded the maximum supported ROI size */
ippStsWarpDirectionErr = -231, /* The warp transform direction is illegal */
@@ -1056,8 +1093,8 @@ typedef enum {
ippStsDomain = 19, /* Argument is out of the function domain. */
ippStsNonIntelCpu = 20, /* The target CPU is not Genuine Intel. */
ippStsCpuMismatch = 21, /* Cannot set the library for the given CPU. */
- ippStsNoIppFunctionFound = 22, /* Application does not contain Intel IPP function calls. */
- ippStsDllNotFoundBestUsed = 23, /* Dispatcher cannot find the newest version of the Intel IPP dll. */
+ ippStsNoIppFunctionFound = 22, /* Application does not contain Intel(R) IPP function calls. */
+ ippStsDllNotFoundBestUsed = 23, /* Dispatcher cannot find the newest version of the Intel(R) IPP dll. */
ippStsNoOperationInDll = 24, /* The function does nothing in the dynamic version of the library. */
ippStsInsufficientEntropy= 25, /* Generation of the prime/key failed due to insufficient entropy in the random seed and stimulus bit string. */
ippStsOvermuchStrings = 26, /* Number of destination strings is more than expected. */
@@ -1093,6 +1130,8 @@ typedef enum {
#endif
+#define ippRectInfinite ippiWarpGetRectInfinite()
+
#ifdef __cplusplus
}
#endif
diff --git a/ext/ipp/ippcommon.parts b/ext/ipp/ippcommon.parts
deleted file mode 100644
index 62b601c..0000000
--- a/ext/ipp/ippcommon.parts
+++ /dev/null
@@ -1,56 +0,0 @@
-############################################################################
-# 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.
-############################################################################
-Import('*')
-
-env.PartVersion("9.0.1")
-env.PartName("ippcommon")
-env.DependsOn([])
-
-#prebuild installs prebuild headers instead of src headers.
-#internal ipp includes src/primitives/ipp/
-env.Append(CPPPATH=[AbsDir('sources/include/')])
-
-# env.Append(CPPDEFINES = '_IPP_BE') #only for BE targets
-
-#includes to install
-install_headers = Pattern(src_dir='include/',
- includes=['ippdefs.h',
- 'ippversion.h',
- 'ippcore.h',
- 'ippbase.h',
- 'ipptypes.h'
- ],
- excludes=[],
- recursive=True)
-
-source_headers = Pattern(src_dir='sources/include/',
- includes=['*'],
- excludes=[],
- recursive=True)
-parts_file = Pattern(src_dir='.',
- includes=['ippcommon.parts'],
- excludes=[],
- recursive=True)
-
-env.ExportCPPPATH([AbsDir('sources/include/')])
-
-if 'install_package' in env['MODE']:
- # All files at /ext/ipp/include
- env.InstallTopLevel(install_headers, sub_dir='ext/ipp/include')
- env.InstallTopLevel(source_headers, sub_dir='ext/ipp/sources/include')
- env.InstallTopLevel(parts_file, sub_dir='ext/ipp/')
-#else
- env.SdkInclude(install_headers)
diff --git a/ext/ipp/ippcp.parts b/ext/ipp/ippcp.parts
index a559908..084620c 100644
--- a/ext/ipp/ippcp.parts
+++ b/ext/ipp/ippcp.parts
@@ -17,28 +17,28 @@ Import('*')
import os
-env.PartVersion("9.0.1")
+env.PartVersion("2017.0.2")
env.PartName("ippcp")
-env.DependsOn([Component('ippcommon')])
ipp_libname = '${PART_SHORT_NAME}'
-ipp_src_install_loc = 'epid/src/primitives/${IPP_DIR}/'
-
-env.ExportCPPPATH([AbsDir('sources/ippcp/src/')]) #ippcpepid needs this
-
#includes to install
install_headers = Pattern(src_dir='include/',
includes=[
'ippcp.h',
'ippcpdefs.h',
+ 'ippdefs.h',
+ 'ippbase.h',
+ 'ipptypes.h'
],
excludes=[],
recursive=True)
+source_headers = Pattern(src_dir='sources/include/',
+ includes=['*'],
+ excludes=[],
+ recursive=True)
# common headers, for SdkInclude
common_headers = Pattern(src_dir='include/',
includes=['ippdefs.h',
- 'ippversion.h',
- 'ippcore.h',
'ippbase.h',
'ipptypes.h'],
excludes=[],
@@ -52,6 +52,13 @@ ippcp_files = Pattern(src_dir='sources/ippcp/src/',
recursive=True)
ippdir = ''
+
+#prebuild installs prebuild headers instead of src headers.
+#internal ipp includes src/primitives/ipp/
+env.Append(CPPPATH=[AbsDir('sources/include/')])
+
+# env.Append(CPPDEFINES = '_IPP_BE') #only for BE targets
+
#internal ipp includes src/primitives/ipp/
env.Append(CPPPATH=[AbsDir('include/')])
env.Append(CPPPATH=[AbsDir('sources/ippcp/src/')])
@@ -60,6 +67,15 @@ env.Append(CPPDEFINES='_IPP_v50_') #required for all ippcp
env.Append(CPPDEFINES='_IPP_DEBUG') #enable function sanity checking
+env.Append(CPPDEFINES=['_DISABLE_ALG_MD5_',
+ '_DISABLE_ALG_SM3_']) #disable unused hash alg
+
+env.ExportCPPPATH([AbsDir('sources/include/')])
+
+#disable warning for misleading indentation from GCC 6
+if env['TARGET_PLATFORM']['OS'] == 'posix':
+ env.Append(CCFLAGS='-Wno-misleading-indentation')
+
if 'install_package' in env['MODE']:
# All files at /ext/ipp/source/include
env.InstallTopLevel(install_headers, sub_dir='ext/ipp/include')
@@ -78,14 +94,12 @@ if 'install_package' in env['MODE']:
excludes=[],
recursive=True)
env.InstallTopLevel(makefile, sub_dir='ext/ipp/sources/ippcp')
-
+ env.InstallTopLevel(source_headers, sub_dir='ext/ipp/sources/include')
else:
- all_c_files = ippcp_files.files()
- outputs = env.Library(ipp_libname, all_c_files)
-
env.SdkInclude(install_headers)
env.SdkInclude(common_headers)
if 'use_commercial_ipp' in env['MODE']:
+ env['CCOPY_LOGIC'] = 'copy'
try:
IPPROOT = os.environ['IPPROOT']
except KeyError, e:
@@ -109,7 +123,15 @@ else:
ipp_dir = IPPROOT + '/lib/' + archdir
env.SdkLib(ipp_dir + ippcp_libname)
env.SdkLib(ipp_dir + ippcore_libname)
+ env.SdkInclude(IPPROOT + '/include/ippcore.h')
else:
- env.SdkLib(outputs)
- if 'install_lib' in env['MODE']:
- env.InstallLib(outputs)
+ all_c_files = ippcp_files.files()
+ if 'build_ipp_shared' in env['MODE']:
+ env.Append(CPPDEFINES=['IPP_W32DLL'])
+ outputs = env.SharedLibrary(ipp_libname, all_c_files)
+ env.InstallTarget(outputs)
+ else:
+ outputs = env.Library(ipp_libname, all_c_files)
+ env.SdkLib(outputs)
+ if 'install_lib' in env['MODE']:
+ env.InstallLib(outputs)
diff --git a/ext/ipp/ippcpepid.parts b/ext/ipp/ippcpepid.parts
deleted file mode 100644
index 2913a55..0000000
--- a/ext/ipp/ippcpepid.parts
+++ /dev/null
@@ -1,105 +0,0 @@
-############################################################################
-# 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.
-############################################################################
-Import('*')
-
-env.PartVersion("9.0.1")
-env.PartName("ippcpepid")
-env.DependsOn([
- Component('ippcommon'),
- Component('ippcp'),
-])
-
-IPP_LIBNAME = '${PART_SHORT_NAME}'
-
-env.ExportCPPPATH([AbsDir('sources/ippcp/src/')]) #ippcpepid needs this
-
-#includes to install
-install_headers = Pattern(src_dir='include/',
- includes=[
- 'ippcpepid.h',
- ],
- excludes=[],
- recursive=True)
-# common headers, for SdkInclude
-common_headers = Pattern(src_dir='include/',
- includes=['ippdefs.h',
- 'ippversion.h',
- 'ippcore.h',
- 'ippbase.h',
- 'ipptypes.h'],
- excludes=[],
- recursive=True)
-#files
-ippcp_files = Pattern(src_dir='sources/ippcpepid/src/',
- includes=[
- 'pcp*.c',
- ],
- excludes=['pcpepidmain.c'],
- recursive=True)
-#Symbols defined in following files are used by ippcpepid library
-ippcp_intern_files = Pattern(src_dir='sources/ippcp/src/',
- includes=[
- 'pcpmontexpbinca.c',
- 'pcpmontred.c',
- 'pcpbnuarith.c',
- 'pcpbnu32misc.c',
- 'pcpbnu32arith.c',
- 'pcpbnumisc.c',
- ],
- recursive=True)
-
-ippdir = ''
-#internal ipp includes src/primitives/ipp/
-env.Append(CPPPATH=[AbsDir('include/')])
-env.Append(CPPPATH=[AbsDir('sources/ippcp/src/')])
-env.Append(CPPPATH=[AbsDir('sources/ippcpepid/src/')])
-#ipp defines
-env.Append(CPPDEFINES='_IPP_v50_') #required for all ippcp
-
-env.Append(CPPDEFINES='_IPP_DEBUG') #enable function sanity checking
-
-if 'install_package' in env['MODE']:
- # All files at /ext/ipp/source/include
- env.InstallTopLevel(install_headers, sub_dir='ext/ipp/include')
- src_files = Pattern(src_dir='sources/ippcpepid/src/',
- includes=['*'],
- excludes=['pcpepidmain.c'],
- recursive=True)
- env.InstallTopLevel(src_files, sub_dir='ext/ipp/sources/ippcpepid/src')
- this_file = Pattern(src_dir='.',
- includes=['ippcpepid.parts'],
- excludes=[],
- recursive=True)
- env.InstallTopLevel(this_file, sub_dir='ext/ipp/')
- makefile = Pattern(src_dir='./sources/ippcpepid',
- includes=['Makefile'],
- excludes=[],
- recursive=True)
- env.InstallTopLevel(makefile, sub_dir='ext/ipp/sources/ippcpepid')
-
-else:
-
- all_c_files = ippcp_files.files()
- if 'use_commercial_ipp' in env['MODE']:
- all_c_files = all_c_files + ippcp_intern_files.files()
-
- outputs = env.Library(IPP_LIBNAME, all_c_files)
-
- env.SdkLib(outputs)
- env.SdkInclude(install_headers)
- env.SdkInclude(common_headers)
- if 'install_lib' in env['MODE']:
- env.InstallLib(outputs)
diff --git a/ext/ipp/sources/include/owndefs.h b/ext/ipp/sources/include/owndefs.h
index 1cd2e95..af042b4 100644
--- a/ext/ipp/sources/include/owndefs.h
+++ b/ext/ipp/sources/include/owndefs.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 1999-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -50,15 +50,17 @@
#if defined( IPP_W32DLL )
#if defined( _MSC_VER ) || defined( __INTEL_COMPILER )
- #define IPPFUN(type,name,arg) __declspec(dllexport) type __STDCALL name arg
+ #define IPPDEF(type) __declspec(dllexport) type
+ #undef IPPAPI
+ #define IPPAPI( type,name,arg ) \
+ __declspec(dllexport) type __STDCALL name arg;
#else
- #define IPPFUN(type,name,arg) extern type __STDCALL name arg
+ #define IPPDEF(type) type
#endif
#else
- #define IPPFUN(type,name,arg) extern type __STDCALL name arg
+ #define IPPDEF(type) type
#endif
-
/* structure represeting 128 bit unsigned integer type */
typedef struct{
@@ -73,6 +75,7 @@ typedef struct{
#define _IPP_W7 8 /* Pentium 4 - SSE2 ia32 */
#define _IPP_T7 16 /* Pentium with x64 support (Nocona) - SSE3 ia32 */
#define _IPP_V8 32 /* Merom - SSSE3 ia32 */
+#define _IPP_S8 33 /* Atom - SSSE3 ia32 (Silverthorne)+MOVBE */
#define _IPP_P8 64 /* Penryn - SSE4.1 + tick for SSE4.2 ia32 */
#define _IPP_G9 128 /* SandyBridge (GSSE) - AVX ia32 */
#define _IPP_H9 256 /* Haswell (AVX2) ia32 */
@@ -94,26 +97,18 @@ typedef struct{
#define _IPP32E_PX _IPP_PX /* pure C-code x64 */
#define _IPP32E_M7 32 /* Pentium with x64 support (Nocona) - SSE3 x64 */
#define _IPP32E_U8 64 /* Merom - SSSE3 x64 */
+#define _IPP32E_N8 65 /* Atom - SSSE3 x64 (Silverthorne)+MOVBE */
#define _IPP32E_Y8 128 /* Penryn - SSE4.1 + tick for SSE4.2 x64 */
#define _IPP32E_E9 256 /* SandyBridge (GSSE) - AVX x64 */
#define _IPP32E_L9 512 /* Haswell (AVX2) x64 */
#define _IPP32E_N0 1024 /* KNL (AVX-512) x64 */
#define _IPP32E_K0 2048 /* SkyLake Xeon (AVX-512) x64 */
-#define _IPPLP32_PX _IPP_PX
-#define _IPPLP32_S8 1 /* old Atom (SSSE3+movbe) (Silverthorne) ia32 */
-
-#define _IPPLP64_PX _IPP_PX
-#define _IPPLP64_N8 1 /* old Atom (SSSE3+movbe) (Silverthorne) x64 */
#if defined(__INTEL_COMPILER) || (_MSC_VER >= 1300)
#define __ALIGN8 __declspec (align(8))
#define __ALIGN16 __declspec (align(16))
-#if !defined( OSX32 )
#define __ALIGN32 __declspec (align(32))
-#else
- #define __ALIGN32 __declspec (align(16))
-#endif
#define __ALIGN64 __declspec (align(64))
#else
#define __ALIGN8
@@ -126,152 +121,147 @@ typedef struct{
#define _IPP _IPP_M5
#define _IPP32E _IPP32E_PX
#define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_PX
+ #define OWNAPI(name) m5_##name
#elif defined ( _M6 ) /* Pentium MMX - MMX ia32 */
#define _IPP _IPP_M6
#define _IPP32E _IPP32E_PX
#define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_PX
+ #define OWNAPI(name) m6_##name
#elif defined( _A6 ) /* Pentium III - SSE ia32 */
#define _IPP _IPP_A6
#define _IPP32E _IPP32E_PX
#define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_PX
+ #define OWNAPI(name) a6_##name
#elif defined( _W7 ) /* Pentium 4 - SSE2 ia32 */
#define _IPP _IPP_W7
#define _IPP32E _IPP32E_PX
#define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_PX
+ #define OWNAPI(name) w7_##name
#elif defined( _T7 ) /* Pentium with x64 support (Nocona) - SSE3 ia32 */
#define _IPP _IPP_T7
#define _IPP32E _IPP32E_PX
#define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_PX
+ #define OWNAPI(name) t7_##name
#elif defined( _V8 ) /* Merom - SSSE3 ia32 */
#define _IPP _IPP_V8
#define _IPP32E _IPP32E_PX
#define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_PX
+ #define OWNAPI(name) v8_##name
+
+#elif defined( _S8 ) /* old Atom (SSSE3+movbe) (Silverthorne) ia32 */
+ #define _IPP _IPP_S8
+ #define _IPP32E _IPP32E_PX
+ #define _IPPLRB _IPPLRB_PX
+ #define OWNAPI(name) s8_##name
#elif defined( _P8 ) /* Penryn - SSE4.1 + tick for SSE4.2 ia32 */
#define _IPP _IPP_P8
#define _IPP32E _IPP32E_PX
#define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_PX
+ #define OWNAPI(name) p8_##name
#elif defined( _G9 ) /* SandyBridge (GSSE) - AVX ia32 */
#define _IPP _IPP_G9
#define _IPP32E _IPP32E_PX
#define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_PX
+ #define OWNAPI(name) g9_##name
#elif defined( _H9 ) /* Haswell (AVX2) ia32 */
#define _IPP _IPP_H9
#define _IPP32E _IPP32E_PX
#define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_PX
+ #define OWNAPI(name) h9_##name
#elif defined( _M7 ) /* Pentium with x64 support (Nocona) - SSE3 x64 */
#define _IPP _IPP_PX
#define _IPP32E _IPP32E_M7
#define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_PX
+ #define OWNAPI(name) m7_##name
#elif defined( _U8 ) /* Merom - SSSE3 x64 */
#define _IPP _IPP_PX
#define _IPP32E _IPP32E_U8
#define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_PX
+ #define OWNAPI(name) u8_##name
+
+#elif defined( _N8 ) /* old Atom (SSSE3+movbe) (Silverthorne) x64 */
+ #define _IPP _IPP_PX
+ #define _IPP32E _IPP32E_N8
+ #define _IPPLRB _IPPLRB_PX
+ #define OWNAPI(name) n8_##name
#elif defined( _Y8 ) /* Penryn - SSE4.1 + tick for SSE4.2 x64 */
#define _IPP _IPP_PX
#define _IPP32E _IPP32E_Y8
#define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_PX
+ #define OWNAPI(name) y8_##name
#elif defined( _E9 ) /* SandyBridge (GSSE) - AVX x64 */
#define _IPP _IPP_PX
#define _IPP32E _IPP32E_E9
#define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_PX
+ #define OWNAPI(name) e9_##name
#elif defined( _L9 ) /* Haswell (AVX2) x64 */
#define _IPP _IPP_PX
#define _IPP32E _IPP32E_L9
#define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_PX
+ #define OWNAPI(name) l9_##name
#elif defined( _N0 ) /* KNL (AVX-512) x64 */
#define _IPP _IPP_PX
#define _IPP32E _IPP32E_N0
#define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_PX
+ #define OWNAPI(name) n0_##name
#elif defined( _K0 ) /* SkyLake Xeon (AVX-512) x64 */
#define _IPP _IPP_PX
#define _IPP32E _IPP32E_K0
#define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_PX
+ #define OWNAPI(name) k0_##name
#elif defined( _B2 ) /* KNC (MIC) */
#define _IPP _IPP_PX
#define _IPP32E _IPP32E_PX
#define _IPPLRB _IPPLRB_B2
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_PX
-
-#elif defined( _S8 ) /* old Atom (SSSE3+movbe) (Silverthorne) ia32 */
- #define _IPP _IPP_V8
- #define _IPP32E _IPP32E_PX
- #define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_S8
- #define _IPPLP64 _IPPLP64_PX
-
-#elif defined( _N8 ) /* old Atom (SSSE3+movbe) (Silverthorne) x64 */
- #define _IPP _IPP_PX
- #define _IPP32E _IPP32E_U8
- #define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_N8
+ #define OWNAPI(name) b2_##name
#else
#define _IPP _IPP_PX
#define _IPP32E _IPP32E_PX
#define _IPPLRB _IPPLRB_PX
- #define _IPPLP32 _IPPLP32_PX
- #define _IPPLP64 _IPPLP64_PX
+ #if defined (_M_AMD64) || defined (__x86_64__) || defined ( _ARCH_EM64T )
+ #define OWNAPI(name) mx_##name
+ #else
+ #define OWNAPI(name) px_##name
+ #endif
+#endif
+#ifndef _OWN_MERGED_BLD
+ #undef OWNAPI
+ #define OWNAPI(name) name
#endif
+ #if defined( IPP_W32DLL )
+ #if defined( _MSC_VER ) || defined( __INTEL_COMPILER )
+ #define IPPFUN(type,name,arg) __declspec(dllexport) type __STDCALL name arg
+ #else
+ #define IPPFUN(type,name,arg) extern type __STDCALL name arg
+ #endif
+ #else
+ #define IPPFUN(type,name,arg) extern type __STDCALL name arg
+ #endif
#define _IPP_ARCH_IA32 1
#define _IPP_ARCH_IA64 2
#define _IPP_ARCH_EM64T 4
#define _IPP_ARCH_XSC 8
#define _IPP_ARCH_LRB 16
-#define _IPP_ARCH_LP32 32
-#define _IPP_ARCH_LP64 64
#define _IPP_ARCH_LRB2 128
#if defined ( _ARCH_IA32 )
@@ -283,12 +273,6 @@ typedef struct{
#elif defined( _ARCH_LRB2 )
#define _IPP_ARCH _IPP_ARCH_LRB2
-#elif defined( _ARCH_LP32 )
- #define _IPP_ARCH _IPP_ARCH_LP32
-
-#elif defined( _ARCH_LP64 )
- #define _IPP_ARCH _IPP_ARCH_LP64
-
#else
#if defined(_M_AMD64) || defined(__x86_64) || defined(__x86_64__)
#define _IPP_ARCH _IPP_ARCH_EM64T
@@ -299,7 +283,7 @@ typedef struct{
#endif
#endif
-#if ((_IPP_ARCH == _IPP_ARCH_IA32) || (_IPP_ARCH == _IPP_ARCH_LP32))
+#if ((_IPP_ARCH == _IPP_ARCH_IA32))
__INLINE
Ipp32s IPP_INT_PTR( const void* ptr ) {
union {
@@ -319,7 +303,7 @@ Ipp32u IPP_UINT_PTR( const void* ptr ) {
dd.Ptr = (void*)ptr;
return dd.Int;
}
-#elif ((_IPP_ARCH == _IPP_ARCH_EM64T) || (_IPP_ARCH == _IPP_ARCH_LRB2) || (_IPP_ARCH == _IPP_ARCH_LP64))
+#elif ((_IPP_ARCH == _IPP_ARCH_EM64T) || (_IPP_ARCH == _IPP_ARCH_LRB2))
__INLINE
Ipp64s IPP_INT_PTR( const void* ptr ) {
union {
@@ -606,16 +590,17 @@ typedef enum {
idCtxGFPXEC,
idCtxGFPXECPoint,
idCtxPairing,
- idCtxResize_32f,
+ idCtxResize,
idCtxResizeYUV420,
idCtxResizeYUV422,
- idCtxResize_64f,
+ idCtxResize_L,
idCtxFilterBilateralBorder,
idCtxThresholdAdaptiveGauss,
idCtxHOG,
idCtxFastN,
idCtxHash,
- idCtxSM3
+ idCtxSM3,
+ idCtxAESXTS
} IppCtxId;
@@ -719,10 +704,9 @@ typedef enum {
ippvc = 15,
ippvm = 16,
ippmsdk = 17,
- ippcpepid = 18,
- ippe = 19,
- ipprs = 20,
- ippsq = 21,
+ ippe = 18,
+ ipprs = 19,
+ ippsq = 20,
ippnomore
} IppDomain;
@@ -817,7 +801,7 @@ static char G[] = {73, 80, 80, 71, 101, 110, 117, 105, 110, 101, 243, 193, 210,
#include "emmintrin.h"
#define _mm_loadu _mm_loadu_si128
#endif
- #elif (_IPP == _IPP_V8) || (_IPP32E == _IPP32E_U8)
+ #elif ((_IPP == _IPP_V8) || (_IPP32E == _IPP32E_U8) || (_IPP == _IPP_S8) || (_IPP32E == _IPP32E_N8))
#if defined(__INTEL_COMPILER)
#include "tmmintrin.h"
#define _mm_loadu _mm_lddqu_si128
@@ -849,17 +833,6 @@ static char G[] = {73, 80, 80, 71, 101, 110, 117, 105, 110, 101, 243, 193, 210,
#endif
#endif
#endif
-#elif (_IPPLP32 >= _IPPLP32_S8) || (_IPPLP64 >= _IPPLP64_N8)
- #if defined(__INTEL_COMPILER)
- #include "tmmintrin.h"
- #define _mm_loadu _mm_lddqu_si128
- #elif (_MSC_FULL_VER >= 140050110)
- #include "intrin.h"
- #define _mm_loadu _mm_lddqu_si128
- #elif (_MSC_FULL_VER < 140050110)
- #include "emmintrin.h"
- #define _mm_loadu _mm_loadu_si128
- #endif
#elif (_IPPLRB >= _IPPLRB_B2)
#if defined(__INTEL_COMPILER) || defined(_REF_LIB)
#include "immintrin.h"
@@ -906,6 +879,13 @@ extern double __intel_castu64_f64(unsigned __int64 val);
#define _pi2ypi _mm256_castsi128_si256
#define _pd2ypd _mm256_castpd128_pd256
+#define _zpd2zpi _mm512_castpd_si512
+#define _zpi2zpd _mm512_castsi512_pd
+#define _zps2zpi _mm512_castps_si512
+#define _zpi2zps _mm512_castsi512_ps
+#define _zpd2zps _mm512_castpd_ps
+#define _zps2zpd _mm512_castps_pd
+
#if defined(__INTEL_COMPILER)
#define __IVDEP ivdep
diff --git a/ext/ipp/sources/ippcp/Makefile b/ext/ipp/sources/ippcp/Makefile
index ec8f1dd..70a2db3 100644
--- a/ext/ipp/sources/ippcp/Makefile
+++ b/ext/ipp/sources/ippcp/Makefile
@@ -5,17 +5,17 @@ SRC_INCLUDE_DIR = ../../sources/include
LIB_INSTALL_DIR = $(epidinstalldir)/lib/posix-$(ARCH)/
PCP_INCLUDE_DIR = ./src
-PCP_SRC = $(wildcard ./src/*.c)
+PCP_SRC = $(wildcard ./src/pcp*.c)
PCP_OBJ = $(PCP_SRC:.c=.o)
PCP_LIB = ./src/libippcp.a
$(PCP_OBJ): %.o: %.c
- $(CC) $(CFLAGS) -I$(API_INCLUDE_DIR) -I$(SRC_INCLUDE_DIR) -I$(PCP_INCLUDE_DIR) -c -o $@ $<
+ $(CC) $(CFLAGS) $(IPP_FLAGS) -I$(API_INCLUDE_DIR) -I$(SRC_INCLUDE_DIR) -I$(PCP_INCLUDE_DIR) -c -o $@ $<
$(PCP_LIB): $(PCP_OBJ)
$(AR) rc $@ $^
- ranlib $@
+ $(RANLIB) $@
build: all
diff --git a/ext/ipp/sources/ippcp/src/owncp.h b/ext/ipp/sources/ippcp/src/owncp.h
index 6bf81b2..428f549 100644
--- a/ext/ipp/sources/ippcp/src/owncp.h
+++ b/ext/ipp/sources/ippcp/src/owncp.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2002-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,11 +14,9 @@
# limitations under the License.
############################################################################*/
-/*
+/*
// Intel(R) Integrated Performance Primitives
// Cryptographic Primitives (ippcp)
-//
-//
*/
#ifndef __OWNCP_H__
@@ -32,14 +30,25 @@
#include "ippcp.h"
#endif
-#if defined(_TXT_ACM_)
- //#pragma message ("cogifuration: TXT ACM")
- #include "pcpvariant_txt_acm.h"
-#else
- //#pragma message ("cogifuration: STANDARD")
- #include "pcpvariant.h"
+/*
+// modes of the CPU feature
+*/
+#define _FEATURE_OFF_ (0) /* feature is OFF a priori */
+#define _FEATURE_ON_ (1) /* feature is ON a priori */
+#define _FEATURE_TICKTOCK_ (2) /* dectect is feature OFF/ON */
+
+//#define _ABL_
+#if defined(_ABL_)
+#include "pcpvariant_abl.h"
#endif
+//#define _XMM7560_
+#if defined(_XMM7560_)
+# include "pcpvariant_xmm7560.h"
+# pragma message ("standard configuration (pcpvariant.h) will be changed")
+#endif
+
+#include "pcpvariant.h"
#pragma warning( disable : 4996 4324 4206)
@@ -108,7 +117,7 @@ typedef int cpSize;
#define LSL32(x,nBits) ((x)<<(nBits))
/* Rorate (right and left) of WORD */
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && !defined( __ICL )
# include <stdlib.h>
# define ROR32(x, nBits) _lrotr((x),(nBits))
# define ROL32(x, nBits) _lrotl((x),(nBits))
@@ -126,7 +135,7 @@ typedef int cpSize;
#define ROL64(x, nBits) ROR64((x),(64-(nBits)))
/* change endian */
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && !defined( __ICL )
# define ENDIANNESS(x) _byteswap_ulong((x))
# define ENDIANNESS32(x) ENDIANNESS((x))
# define ENDIANNESS64(x) _byteswap_uint64((x))
@@ -139,13 +148,22 @@ typedef int cpSize;
#define IPP_MAKE_MULTIPLE_OF_8(x) ((x) = ((x)+7)&(~7))
#define IPP_MAKE_MULTIPLE_OF_16(x) ((x) = ((x)+15)&(~15))
-/* 64-bit constant */
+/* define 64-bit constant */
#if !defined(__GNUC__)
#define CONST_64(x) (x) /*(x##i64)*/
#else
#define CONST_64(x) (x##LL)
#endif
+/* define 64-bit constant or pair of 32-bit dependding on architecture */
+#if ((_IPP_ARCH == _IPP_ARCH_EM64T) || (_IPP_ARCH == _IPP_ARCH_LP64) || (_IPP_ARCH == _IPP_ARCH_LRB) || (_IPP_ARCH == _IPP_ARCH_LRB2))
+#define LL(lo,hi) ((Ipp64u)(((Ipp32u)(lo)) | ((Ipp64u)((Ipp32u)(hi))) << 32))
+#define L_(lo) ((Ipp64u)(lo))
+#else
+#define LL(lo,hi) (lo),(hi)
+#define L_(lo) (lo)
+#endif
+
/* crypto NI */
#define AES_NI_ENABLED (ippCPUID_AES)
diff --git a/ext/ipp/sources/ippcp/src/pcpbn.h b/ext/ipp/sources/ippcp/src/pcpbn.h
index 5912211..efc071a 100644
--- a/ext/ipp/sources/ippcp/src/pcpbn.h
+++ b/ext/ipp/sources/ippcp/src/pcpbn.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2002-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@ struct _cpBigNum
#define BN_BUFFER(pBN) ((pBN)->buffer)
#define BN_ROOM(pBN) ((pBN)->room)
#define BN_SIZE(pBN) ((pBN)->size)
-#define BN_SIZE32(pBN) ((pBN)->size*sizeof(BNU_CHUNK_T)/sizeof(Ipp32u))
+#define BN_SIZE32(pBN) ((pBN)->size*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)))
//#define BN_SIZE32(pBN) (BITS2WORD32_SIZE( BITSIZE_BNU(BN_NUMBER((pBN)),BN_SIZE((pBN)))))
#define BN_VALID_ID(pBN) (BN_ID((pBN))==idCtxBigNum)
@@ -64,7 +64,9 @@ struct _cpBigNum
/* pack-unpack context */
+#define cpPackBigNumCtx OWNAPI(cpPackBigNumCtx)
void cpPackBigNumCtx(const IppsBigNumState* pBN, Ipp8u* pBuffer);
+#define cpUnpackBigNumCtx OWNAPI(cpUnpackBigNumCtx)
void cpUnpackBigNumCtx(const Ipp8u* pBuffer, IppsBigNumState* pBN);
/* copy BN */
@@ -192,8 +194,11 @@ typedef struct _ippcpBigNumChunk {
} IppsBigNumStateChunk;
/* reference to BN(1) and BN(2) */
+#define cpBN_OneRef OWNAPI(cpBN_OneRef)
IppsBigNumState* cpBN_OneRef(void);
+#define cpBN_TwoRef OWNAPI(cpBN_TwoRef)
IppsBigNumState* cpBN_TwoRef(void);
+#define cpBN_ThreeRef OWNAPI(cpBN_ThreeRef)
IppsBigNumState* cpBN_ThreeRef(void);
#define BN_ONE_REF() cpBN_OneRef()
diff --git a/ext/ipp/sources/ippcp/src/pcpbnca.c b/ext/ipp/sources/ippcp/src/pcpbnca.c
index 1ccfd57..356b25e 100644
--- a/ext/ipp/sources/ippcp/src/pcpbnca.c
+++ b/ext/ipp/sources/ippcp/src/pcpbnca.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2002-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
#include "pcpbn.h"
#include "pcptool.h"
@@ -60,6 +60,8 @@ static IppsBigNumStateChunk cpChunk_BN1 = {
},
1,0
};
+
+#define cpBN_OneRef OWNAPI(cpBN_OneRef)
IppsBigNumState* cpBN_OneRef(void)
{ return &cpChunk_BN1.bn; };
@@ -73,6 +75,7 @@ static IppsBigNumStateChunk cpChunk_BN2 = {
},
2,0
};
+#define cpBN_TwoRef OWNAPI(cpBN_TwoRef)
IppsBigNumState* cpBN_TwoRef(void)
{ return &cpChunk_BN2.bn; };
@@ -86,6 +89,7 @@ static IppsBigNumStateChunk cpChunk_BN3 = {
},
3,0
};
+#define cpBN_ThreeRef OWNAPI(cpBN_ThreeRef)
IppsBigNumState* cpBN_ThreeRef(void)
{ return &cpChunk_BN3.bn; };
@@ -99,6 +103,7 @@ IppsBigNumState* cpBN_ThreeRef(void)
// Returns: Reason:
// ippStsNullPtrErr pCtxSize == NULL
// ippStsLengthErr len32 < 1
+// len32 > BITS2WORD32_SIZE(BN_MAXBITSIZE)
// ippStsNoErr no errors
//
// Parameters:
@@ -108,12 +113,14 @@ IppsBigNumState* cpBN_ThreeRef(void)
IPPFUN(IppStatus, ippsBigNumGetSize, (cpSize len32, cpSize *pCtxSize))
{
IPP_BAD_PTR1_RET(pCtxSize);
- IPP_BADARG_RET(len32<1, ippStsLengthErr);
+ IPP_BADARG_RET(len32<1 || len32>BITS2WORD32_SIZE(BN_MAXBITSIZE), ippStsLengthErr);
{
/* convert length to the number of BNU_CHUNK_T */
cpSize len = INTERNAL_BNU_LENGTH(len32);
- /* reserve one BNU_CHUNK_T above for cpDiv_BNU, multiplication, mont exponentiation */
+
+ /* reserve one BNU_CHUNK_T more for cpDiv_BNU,
+ mul, mont exp operations */
len++;
*pCtxSize = sizeof(IppsBigNumState)
@@ -134,6 +141,7 @@ IPPFUN(IppStatus, ippsBigNumGetSize, (cpSize len32, cpSize *pCtxSize))
// Returns: Reason:
// ippStsNullPtrErr pBN == NULL
// ippStsLengthErr len32<1
+// len32 > BITS2WORD32_SIZE(BN_MAXBITSIZE)
// ippStsNoErr no errors
//
// Parameters:
@@ -143,7 +151,7 @@ IPPFUN(IppStatus, ippsBigNumGetSize, (cpSize len32, cpSize *pCtxSize))
*F*/
IPPFUN(IppStatus, ippsBigNumInit, (cpSize len32, IppsBigNumState* pBN))
{
- IPP_BADARG_RET(len32<1, ippStsLengthErr);
+ IPP_BADARG_RET(len32<1 || len32>BITS2WORD32_SIZE(BN_MAXBITSIZE), ippStsLengthErr);
IPP_BAD_PTR1_RET(pBN);
pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(pBN, BN_ALIGNMENT) );
@@ -153,21 +161,24 @@ IPPFUN(IppStatus, ippsBigNumInit, (cpSize len32, IppsBigNumState* pBN))
/* convert length to the number of BNU_CHUNK_T */
cpSize len = INTERNAL_BNU_LENGTH(len32);
- BN_ID(pBN) = idCtxBigNum;
+ BN_ID(pBN) = idCtxUnknown;
BN_SIGN(pBN) = ippBigNumPOS;
BN_SIZE(pBN) = 1; /* initial valie is zero */
BN_ROOM(pBN) = len; /* close to what has been passed by user */
- /* reserve one BNU_CHUNK_T above for cpDiv_BNU, multiplication, mont exponentiation */
+ /* reserve one BNU_CHUNK_T more for cpDiv_BNU,
+ mul, mont exp operations */
len++;
/* allocate buffers */
BN_NUMBER(pBN) = (BNU_CHUNK_T*)(ptr += sizeof(IppsBigNumState));
BN_BUFFER(pBN) = (BNU_CHUNK_T*)(ptr += len*sizeof(BNU_CHUNK_T)); /* use expanded length here */
- /* set BN zero */
+ /* set BN value and buffer to zero */
ZEXPAND_BNU(BN_NUMBER(pBN), 0, len);
+ ZEXPAND_BNU(BN_BUFFER(pBN), 0, len);
+ BN_ID(pBN) = idCtxBigNum;
return ippStsNoErr;
}
}
@@ -446,12 +457,14 @@ IPPFUN(IppStatus, ippsExtGet_BN, (IppsBigNumSGN* pSgn, cpSize* pBitSize, Ipp32u*
{
cpSize bitSize = BITSIZE_BNU(BN_NUMBER(pBN), BN_SIZE(pBN));
+ if(0==bitSize)
+ bitSize = 1;
if(pData)
COPY_BNU(pData, (Ipp32u*)BN_NUMBER(pBN), BITS2WORD32_SIZE(bitSize));
if(pSgn)
*pSgn = BN_SIGN(pBN);
if(pBitSize)
- *pBitSize = bitSize? bitSize : 1;
+ *pBitSize = bitSize;
return ippStsNoErr;
}
@@ -785,7 +798,8 @@ IPPFUN(IppStatus, ippsMAC_BN_I, (IppsBigNumState* pA, IppsBigNumState* pB, IppsB
cpSize nsP = BITS_BNU_CHUNK(bitSizeA+bitSizeB);
/* test if multiplicant/multiplier is zero */
- if(!nsP) return ippStsNoErr;
+ //gres: mistaken condition: if(!nsP) return ippStsNoErr;
+ if(!bitSizeA || !bitSizeB) return ippStsNoErr;
/* test if product can't fit to the result */
IPP_BADARG_RET(BN_ROOM(pR)<nsP, ippStsOutOfRangeErr);
@@ -897,12 +911,12 @@ IPPFUN(IppStatus, ippsDiv_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBig
COPY_BNU(pDataR, pDataA, nsR);
BN_SIGN(pQ) = BN_SIGN(pA)==BN_SIGN(pB)? ippBigNumPOS : ippBigNumNEG;
- FIX_BNU(pDataQ, nsQ);
+ //gres: leading zeros are removed by cpDiv_BNU: FIX_BNU(pDataQ, nsQ);
BN_SIZE(pQ) = nsQ;
if(nsQ==1 && pDataQ[0]==0) BN_SIGN(pQ) = ippBigNumPOS;
BN_SIGN(pR) = BN_SIGN(pA);
- FIX_BNU(pDataR, nsR);
+ //gres: leading zeros are removed by cpDiv_BNU: FIX_BNU(pDataR, nsR);
BN_SIZE(pR) = nsR;
if(nsR==1 && pDataR[0]==0) BN_SIGN(pR) = ippBigNumPOS;
@@ -1083,8 +1097,10 @@ IPPFUN(IppStatus, ippsGcd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBig
FIX_BNU(yData, nsY);
/* init buffers */
- ZEXPAND_COPY_BNU(xBuffer, nsX, xData, nsXmax);
- ZEXPAND_COPY_BNU(yBuffer, nsY, yData, nsYmax);
+ //gres: seems length parameters mistaken exchaged: ZEXPAND_COPY_BNU(xBuffer, nsX, xData, nsXmax);
+ //gres: seems length parameters mistaken exchaged: ZEXPAND_COPY_BNU(yBuffer, nsY, yData, nsYmax);
+ ZEXPAND_COPY_BNU(xBuffer, nsXmax, xData, nsX);
+ ZEXPAND_COPY_BNU(yBuffer, nsYmax, yData, nsY);
T = gBuffer;
u = gData;
diff --git a/ext/ipp/sources/ippcp/src/pcpbnresourceca.c b/ext/ipp/sources/ippcp/src/pcpbnresourceca.c
deleted file mode 100644
index 8e47520..0000000
--- a/ext/ipp/sources/ippcp/src/pcpbnresourceca.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal ECC (prime) Resource List Function
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-#include "pcpbnresource.h"
-#include "pcpbn.h"
-
-/*
-// Size of BigNum List Buffer
-*/
-int cpBigNumListGetSize(int feBitSize, int nodes)
-{
- /* size of buffer per single big number */
- int bnSize;
- ippsBigNumGetSize(BITS2WORD32_SIZE(feBitSize), &bnSize);
-
- /* size of buffer for whole list */
- return (ALIGN_VAL-1) + (sizeof(BigNumNode) + bnSize) * nodes;
-}
-
-/*
-// Init list
-//
-// Note: buffer for BN list must have appropriate alignment
-*/
-void cpBigNumListInit(int feBitSize, int nodes, BigNumNode* pList)
-{
- int itemSize;
- /* length of Big Num */
- int bnLen = BITS2WORD32_SIZE(feBitSize);
- /* size of buffer per single big number */
- ippsBigNumGetSize(bnLen, &itemSize);
- /* size of list item */
- itemSize += sizeof(BigNumNode);
-
- {
- int n;
- /* init all nodes */
- BigNumNode* pNode = (BigNumNode*)( (Ipp8u*)pList + (nodes-1)*itemSize );
- BigNumNode* pNext = NULL;
- for(n=0; n<nodes; n++) {
- Ipp8u* tbnPtr = (Ipp8u*)pNode + sizeof(BigNumNode);
- pNode->pNext = pNext;
- pNode->pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(tbnPtr, ALIGN_VAL) );
- ippsBigNumInit(bnLen, pNode->pBN);
- pNext = pNode;
- pNode = (BigNumNode*)( (Ipp8u*)pNode - itemSize);
- }
- }
-}
-
-/*
-// Get BigNum reference
-*/
-IppsBigNumState* cpBigNumListGet(BigNumNode** ppList)
-{
- if(*ppList) {
- IppsBigNumState* ret = (*ppList)->pBN;
- *ppList = (*ppList)->pNext;
- return ret;
- }
- else
- return NULL;
-}
diff --git a/ext/ipp/sources/ippcp/src/pcpbnsetca.c b/ext/ipp/sources/ippcp/src/pcpbnsetca.c
index 0afc468..6ce1cd8 100644
--- a/ext/ipp/sources/ippcp/src/pcpbnsetca.c
+++ b/ext/ipp/sources/ippcp/src/pcpbnsetca.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2004-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/ext/ipp/sources/ippcp/src/pcpbnu32arith.c b/ext/ipp/sources/ippcp/src/pcpbnu32arith.c
index 1bf70f0..9ccbbab 100644
--- a/ext/ipp/sources/ippcp/src/pcpbnu32arith.c
+++ b/ext/ipp/sources/ippcp/src/pcpbnu32arith.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2002-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -135,7 +135,7 @@ Ipp32u cpAddMulDgt_BNU32(Ipp32u* pR, const Ipp32u* pA, cpSize nsA, Ipp32u val)
(_IPP32E==_IPP32E_U8) || \
(_IPP32E==_IPP32E_Y8) || \
(_IPP32E>=_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8))
+ (_IPP32E==_IPP32E_N8))
Ipp32u cpSubMulDgt_BNU32(Ipp32u* pR, const Ipp32u* pA, cpSize nsA, Ipp32u val)
{
Ipp32u carry = 0;
@@ -155,7 +155,7 @@ Ipp32u cpSubMulDgt_BNU32(Ipp32u* pR, const Ipp32u* pA, cpSize nsA, Ipp32u val)
(_IPP32E==_IPP32E_U8) || \
(_IPP32E==_IPP32E_Y8) || \
(_IPP32E>=_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8))
+ (_IPP32E==_IPP32E_N8))
int cpDiv_BNU32(Ipp32u* pQ, cpSize* sizeQ,
Ipp32u* pX, cpSize sizeX,
Ipp32u* pY, cpSize sizeY)
@@ -301,12 +301,12 @@ int cpDiv_BNU32(Ipp32u* pQ, cpSize* sizeQ,
(_IPP==_IPP_V8) || \
(_IPP==_IPP_P8) || \
(_IPP>=_IPP_G9) || \
- (_IPPLP32==_IPPLP32_S8) || \
+ (_IPP==_IPP_S8) || \
(_IPP32E==_IPP32E_M7) || \
(_IPP32E==_IPP32E_U8) || \
(_IPP32E==_IPP32E_Y8) || \
(_IPP32E>=_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8))
+ (_IPP32E==_IPP32E_N8))
void cpMul_BNU8(const Ipp32u* pA, const Ipp32u* pB, Ipp32u* pR)
{
FE_MUL(pR, pA, pB, 8)
@@ -319,7 +319,7 @@ void cpMul_BNU8(const Ipp32u* pA, const Ipp32u* pB, Ipp32u* pR)
(_IPP32E==_IPP32E_U8) || \
(_IPP32E==_IPP32E_Y8) || \
(_IPP32E>=_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8))
+ (_IPP32E==_IPP32E_N8))
void cpMul_BNU4(const Ipp32u* pA, const Ipp32u* pB, Ipp32u* pR)
{
FE_MUL(pR, pA, pB, 4)
@@ -333,12 +333,12 @@ void cpMul_BNU4(const Ipp32u* pA, const Ipp32u* pB, Ipp32u* pR)
(_IPP==_IPP_V8) || \
(_IPP==_IPP_P8) || \
(_IPP>=_IPP_G9) || \
- (_IPPLP32==_IPPLP32_S8) || \
+ (_IPP==_IPP_S8) || \
(_IPP32E==_IPP32E_M7) || \
(_IPP32E==_IPP32E_U8) || \
(_IPP32E==_IPP32E_Y8) || \
(_IPP32E>=_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8))
+ (_IPP32E==_IPP32E_N8))
void cpSqr_BNU8(const Ipp32u* pA, Ipp32u* pR)
{
FE_MUL(pR, pA, pA, 8)
@@ -352,12 +352,12 @@ void cpSqr_BNU8(const Ipp32u* pA, Ipp32u* pR)
(_IPP==_IPP_V8) || \
(_IPP==_IPP_P8) || \
(_IPP>=_IPP_G9) || \
- (_IPPLP32==_IPPLP32_S8) || \
+ (_IPP==_IPP_S8) || \
(_IPP32E==_IPP32E_M7) || \
(_IPP32E==_IPP32E_U8) || \
(_IPP32E==_IPP32E_Y8) || \
(_IPP32E>=_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8))
+ (_IPP32E==_IPP32E_N8))
void cpSqr_BNU4(const Ipp32u* pA, Ipp32u* pR)
{
FE_MUL(pR, pA, pA, 4)
diff --git a/ext/ipp/sources/ippcp/src/pcpbnu32arith.h b/ext/ipp/sources/ippcp/src/pcpbnu32arith.h
index 39ce622..124f425 100644
--- a/ext/ipp/sources/ippcp/src/pcpbnu32arith.h
+++ b/ext/ipp/sources/ippcp/src/pcpbnu32arith.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2012-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -25,26 +25,39 @@
#if !defined(_CP_BNU32_ARITH_H)
#define _CP_BNU32_ARITH_H
+#define cpAdd_BNU32 OWNAPI(cpAdd_BNU32)
Ipp32u cpAdd_BNU32(Ipp32u* pR, const Ipp32u* pA, const Ipp32u* pB, int ns);
+#define cpSub_BNU32 OWNAPI(cpSub_BNU32)
Ipp32u cpSub_BNU32(Ipp32u* pR, const Ipp32u* pA, const Ipp32u* pB, int ns);
+#define cpInc_BNU32 OWNAPI(cpInc_BNU32)
Ipp32u cpInc_BNU32(Ipp32u* pR, const Ipp32u* pA, cpSize ns, Ipp32u val);
+#define cpDec_BNU32 OWNAPI(cpDec_BNU32)
Ipp32u cpDec_BNU32(Ipp32u* pR, const Ipp32u* pA, cpSize ns, Ipp32u val);
+#define cpMulDgt_BNU32 OWNAPI(cpMulDgt_BNU32)
Ipp32u cpMulDgt_BNU32(Ipp32u* pR, const Ipp32u* pA, int ns, Ipp32u val);
+#define cpSubMulDgt_BNU32 OWNAPI(cpSubMulDgt_BNU32)
Ipp32u cpSubMulDgt_BNU32(Ipp32u* pR, const Ipp32u* pA, int nsA, Ipp32u val);
#if 0
Ipp32u cpAddMulDgt_BNU32(Ipp32u* pR, const Ipp32u* pA, int nsA, Ipp32u val);
#endif
+#define cpDiv_BNU32 OWNAPI(cpDiv_BNU32)
int cpDiv_BNU32(Ipp32u* pQ, int* nsQ, Ipp32u* pX, int nsX, Ipp32u* pY, int nsY);
#define cpMod_BNU32(pX,sizeX, pM,sizeM) cpDiv_BNU32(NULL,NULL, (pX),(sizeX), (pM),(sizeM))
+#define cpFromOS_BNU32 OWNAPI(cpFromOS_BNU32)
int cpFromOS_BNU32(Ipp32u* pBNU, const Ipp8u* pOctStr, int strLen);
+#define cpToOS_BNU32 OWNAPI(cpToOS_BNU32)
int cpToOS_BNU32(Ipp8u* pStr, int strLen, const Ipp32u* pBNU, int bnuSize);
+#define cpMul_BNU8 OWNAPI(cpMul_BNU8)
void cpMul_BNU8(const Ipp32u* pA, const Ipp32u* pB, Ipp32u* pR);
+#define cpMul_BNU4 OWNAPI(cpMul_BNU4)
void cpMul_BNU4(const Ipp32u* pA, const Ipp32u* pB, Ipp32u* pR);
+#define cpSqr_BNU8 OWNAPI(cpSqr_BNU8)
void cpSqr_BNU8(const Ipp32u* pA, Ipp32u* pR);
+#define cpSqr_BNU4 OWNAPI(cpSqr_BNU4)
void cpSqr_BNU4(const Ipp32u* pA, Ipp32u* pR);
#endif /* _CP_BNU32_ARITH_H */
diff --git a/ext/ipp/sources/ippcp/src/pcpbnu32misc.c b/ext/ipp/sources/ippcp/src/pcpbnu32misc.c
index 36e777f..8c243b2 100644
--- a/ext/ipp/sources/ippcp/src/pcpbnu32misc.c
+++ b/ext/ipp/sources/ippcp/src/pcpbnu32misc.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2002-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/ext/ipp/sources/ippcp/src/pcpbnu32misc.h b/ext/ipp/sources/ippcp/src/pcpbnu32misc.h
index 228b965..5706b78 100644
--- a/ext/ipp/sources/ippcp/src/pcpbnu32misc.h
+++ b/ext/ipp/sources/ippcp/src/pcpbnu32misc.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2002-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -30,6 +30,7 @@
#define BITSIZE_BNU32(p,ns) ((ns)*BNU_CHUNK_32BIT-cpNLZ_BNU32((p)[(ns)-1]))
/* number of leading/trailing zeros */
+#define cpNLZ_BNU32 OWNAPI(cpNLZ_BNU32)
cpSize cpNLZ_BNU32(Ipp32u x);
#if 0
cpSize cpNTZ_BNU32(Ipp32u x);
@@ -65,7 +66,9 @@ cpSize cpLSR_BNU32(Ipp32u* pR, const Ipp32u* pA, cpSize nsA, cpSize nBits);
#endif
/* to/from oct string conversion */
+#define cpToOctStr_BNU32 OWNAPI(cpToOctStr_BNU32)
cpSize cpToOctStr_BNU32(Ipp8u* pStr, cpSize strLen, const Ipp32u* pBNU, cpSize bnuSize);
+#define cpFromOctStr_BNU32 OWNAPI(cpFromOctStr_BNU32)
cpSize cpFromOctStr_BNU32(Ipp32u* pBNU, const Ipp8u* pOctStr, cpSize strLen);
#endif /* _CP_BNU32_MISC_H */
diff --git a/ext/ipp/sources/ippcp/src/pcpbnuarith.c b/ext/ipp/sources/ippcp/src/pcpbnuarith.c
index d224a56..209997a 100644
--- a/ext/ipp/sources/ippcp/src/pcpbnuarith.c
+++ b/ext/ipp/sources/ippcp/src/pcpbnuarith.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2002-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -48,19 +48,21 @@
#include "pcpbnumisc.h"
-/* Function cpAdd_BNU - addition of 2 BigNumbers */
+/* Function cpAdd_BNU - addition of 2 BNU */
+
#if !((_IPP==_IPP_W7) || \
(_IPP==_IPP_T7) || \
(_IPP==_IPP_V8) || \
(_IPP==_IPP_P8) || \
(_IPP>=_IPP_G9) || \
- (_IPPLP32==_IPPLP32_S8) || \
+ (_IPP==_IPP_S8) || \
(_IPP32E==_IPP32E_M7) || \
(_IPP32E==_IPP32E_U8) || \
(_IPP32E==_IPP32E_Y8) || \
(_IPP32E>=_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8) || \
- (_IPPLRB>=_IPPLRB_B1))
+ (_IPP32E==_IPP32E_N8) || \
+ (_IPPLRB>=_IPPLRB_B1)) || \
+ defined(_USE_C_cpAdd_BNU_)
BNU_CHUNK_T cpAdd_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, cpSize ns)
{
BNU_CHUNK_T carry = 0;
@@ -72,19 +74,21 @@ BNU_CHUNK_T cpAdd_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T*
}
#endif
-/* Function cpSub_BNU - subtraction of 2 BigNumbers */
+/* Function cpSub_BNU - subtraction of 2 BNU */
+
#if !((_IPP==_IPP_W7) || \
(_IPP==_IPP_T7) || \
(_IPP==_IPP_V8) || \
(_IPP==_IPP_P8) || \
(_IPP>=_IPP_G9) || \
- (_IPPLP32==_IPPLP32_S8) || \
+ (_IPP==_IPP_S8) || \
(_IPP32E==_IPP32E_M7) || \
(_IPP32E==_IPP32E_U8) || \
(_IPP32E==_IPP32E_Y8) || \
(_IPP32E>=_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8) || \
- (_IPPLRB>=_IPPLRB_B1))
+ (_IPP32E==_IPP32E_N8) || \
+ (_IPPLRB>=_IPPLRB_B1)) || \
+ defined(_USE_C_cpSub_BNU_)
BNU_CHUNK_T cpSub_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, cpSize ns)
{
BNU_CHUNK_T borrow = 0;
@@ -96,18 +100,20 @@ BNU_CHUNK_T cpSub_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T*
}
#endif
-/* Function cpInc_BNU - increment BigNumber */
+/* Function cpInc_BNU - increment BNU */
+
#if !((_IPP==_IPP_W7) || \
(_IPP==_IPP_T7) || \
(_IPP==_IPP_V8) || \
(_IPP==_IPP_P8) || \
(_IPP>=_IPP_G9) || \
- (_IPPLP32==_IPPLP32_S8) || \
+ (_IPP==_IPP_S8) || \
(_IPP32E==_IPP32E_M7) || \
(_IPP32E==_IPP32E_U8) || \
(_IPP32E==_IPP32E_Y8) || \
(_IPP32E>=_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8))
+ (_IPP32E==_IPP32E_N8)) || \
+ defined(_USE_C_cpInc_BNU_)
BNU_CHUNK_T cpInc_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize ns, BNU_CHUNK_T val)
{
cpSize i;
@@ -127,7 +133,7 @@ BNU_CHUNK_T cpInc_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize ns, BNU_CHU
(_IPP32E==_IPP32E_U8) || \
(_IPP32E==_IPP32E_Y8) || \
(_IPP32E>=_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8))
+ (_IPP32E==_IPP32E_N8))
BNU_CHUNK_T cpDec_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize ns, BNU_CHUNK_T val)
{
cpSize i;
@@ -150,12 +156,12 @@ BNU_CHUNK_T cpDec_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize ns, BNU_CHU
(_IPP==_IPP_V8) || \
(_IPP==_IPP_P8) || \
(_IPP>=_IPP_G9) || \
- (_IPPLP32==_IPPLP32_S8) || \
+ (_IPP==_IPP_S8) || \
(_IPP32E==_IPP32E_M7) || \
(_IPP32E==_IPP32E_U8) || \
(_IPP32E==_IPP32E_Y8) || \
(_IPP32E>=_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8))
+ (_IPP32E==_IPP32E_N8))
BNU_CHUNK_T cpAddAdd_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, const BNU_CHUNK_T* pC, cpSize ns)
{
BNU_CHUNK_T carry1 = 0;
@@ -178,12 +184,12 @@ BNU_CHUNK_T cpAddAdd_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK
(_IPP==_IPP_V8) || \
(_IPP==_IPP_P8) || \
(_IPP>=_IPP_G9) || \
- (_IPPLP32==_IPPLP32_S8) || \
+ (_IPP==_IPP_S8) || \
(_IPP32E==_IPP32E_M7) || \
(_IPP32E==_IPP32E_U8) || \
(_IPP32E==_IPP32E_Y8) || \
(_IPP32E>=_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8))
+ (_IPP32E==_IPP32E_N8))
BNU_CHUNK_T cpAddSub_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, const BNU_CHUNK_T* pC, cpSize ns)
{
BNU_CHUNK_T carry = 0;
@@ -199,46 +205,21 @@ BNU_CHUNK_T cpAddSub_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK
#endif
#endif
-#if 0
-#if !((_IPP==_IPP_W7) || \
- (_IPP==_IPP_T7) || \
- (_IPP==_IPP_V8) || \
- (_IPP==_IPP_P8) || \
- (_IPP>=_IPP_G9) || \
- (_IPPLP32==_IPPLP32_S8) || \
- (_IPP32E==_IPP32E_M7) || \
- (_IPP32E==_IPP32E_U8) || \
- (_IPP32E==_IPP32E_Y8) || \
- (_IPP32E>=_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8))
-BNU_CHUNK_T cpMulDgt_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize ns, BNU_CHUNK_T val)
-{
- BNU_CHUNK_T extension = 0;
- cpSize i;
- for(i=0; i<ns; i++) {
- BNU_CHUNK_T rH, rL;
- MUL_AB(rH, rL, pA[i], val);
- rL += extension;
- extension = (rL < extension) + rH;
- pR[i] = rL;
- }
- return extension;
-}
-#endif
-#endif
+/* Function cpAddMulDgt_BNU - multiply-and-add BNU */
#if !((_IPP==_IPP_W7) || \
(_IPP==_IPP_T7) || \
(_IPP==_IPP_V8) || \
(_IPP==_IPP_P8) || \
(_IPP>=_IPP_G9) || \
- (_IPPLP32==_IPPLP32_S8) || \
+ (_IPP==_IPP_S8) || \
(_IPP32E==_IPP32E_M7) || \
(_IPP32E==_IPP32E_U8) || \
(_IPP32E==_IPP32E_Y8) || \
(_IPP32E>=_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8))
+ (_IPP32E==_IPP32E_N8)) || \
+ defined(_USE_C_cpAddMulDgt_BNU_)
BNU_CHUNK_T cpAddMulDgt_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize ns, BNU_CHUNK_T val)
{
BNU_CHUNK_T extension = 0;
@@ -255,18 +236,21 @@ BNU_CHUNK_T cpAddMulDgt_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize ns, B
#endif
+/* Function cpSubMulDgt_BNU - multiply-and-sub BNU */
+
#if !((_IPP==_IPP_W7) || \
(_IPP==_IPP_T7) || \
(_IPP==_IPP_V8) || \
(_IPP==_IPP_P8) || \
(_IPP>=_IPP_G9) || \
- (_IPPLP32==_IPPLP32_S8) || \
+ (_IPP==_IPP_S8) || \
(_IPP32E==_IPP32E_M7) || \
(_IPP32E==_IPP32E_U8) || \
(_IPP32E==_IPP32E_Y8) || \
(_IPP32E>=_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8) || \
- (_IPPLRB >= _IPPLRB_B1))
+ (_IPP32E==_IPP32E_N8) || \
+ (_IPPLRB >= _IPPLRB_B1)) || \
+ defined(_USE_C_cpSubMulDgt_BNU_)
BNU_CHUNK_T cpSubMulDgt_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize ns, BNU_CHUNK_T val)
{
BNU_CHUNK_T extension = 0;
@@ -282,19 +266,19 @@ BNU_CHUNK_T cpSubMulDgt_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize ns, B
}
#endif
+
+/* Function cpMulAdc_BNU_school - multiply BNU */
+
#if !((_IPP==_IPP_V8) || \
(_IPP==_IPP_P8) || \
(_IPP>=_IPP_G9) || \
- (_IPPLP32==_IPPLP32_S8) || \
+ (_IPP==_IPP_S8) || \
(_IPP32E==_IPP32E_M7) || \
(_IPP32E==_IPP32E_U8) || \
(_IPP32E==_IPP32E_Y8) || \
(_IPP32E>=_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8) )
-// || (_IPPLRB >= _IPPLRB_B1)) //dlaptev: is it renaming?
-//BNU_CHUNK_T cpMul_BNU_school(BNU_CHUNK_T* pR,
-// const BNU_CHUNK_T* pA, cpSize nsA,
-// const BNU_CHUNK_T* pB, cpSize nsB)
+ (_IPP32E==_IPP32E_N8)) || \
+ defined(_USE_C_cpMulAdc_BNU_school_)
BNU_CHUNK_T cpMulAdc_BNU_school(BNU_CHUNK_T* pR,
const BNU_CHUNK_T* pA, cpSize nsA,
const BNU_CHUNK_T* pB, cpSize nsB)
@@ -325,19 +309,20 @@ BNU_CHUNK_T cpMulAdc_BNU_school(BNU_CHUNK_T* pR,
#endif
+/* Function cpSqrAdc_BNU_school - sqr BNU */
+
#if !((_IPP==_IPP_W7) || \
(_IPP==_IPP_T7) || \
(_IPP==_IPP_V8) || \
(_IPP==_IPP_P8) || \
(_IPP>=_IPP_G9) || \
- (_IPPLP32==_IPPLP32_S8) || \
+ (_IPP==_IPP_S8) || \
(_IPP32E==_IPP32E_M7) || \
(_IPP32E==_IPP32E_U8) || \
(_IPP32E==_IPP32E_Y8) || \
(_IPP32E>=_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8) )
-//|| (_IPPLRB >= _IPPLRB_B1)) //dlaptev: is it renaming?
-//BNU_CHUNK_T cpSqr_BNU_school(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize nsA)
+ (_IPP32E==_IPP32E_N8)) || \
+ defined(_USE_C_cpSqrAdc_BNU_school_)
BNU_CHUNK_T cpSqrAdc_BNU_school(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize nsA)
{
cpSize i;
diff --git a/ext/ipp/sources/ippcp/src/pcpbnuarith.h b/ext/ipp/sources/ippcp/src/pcpbnuarith.h
index 9481317..39d4fa2 100644
--- a/ext/ipp/sources/ippcp/src/pcpbnuarith.h
+++ b/ext/ipp/sources/ippcp/src/pcpbnuarith.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2012-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -29,16 +29,23 @@
#include "pcpbnu32arith.h"
#include "pcpmulbnukara.h"
+#define cpAdd_BNU OWNAPI(cpAdd_BNU)
BNU_CHUNK_T cpAdd_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, cpSize ns);
+#define cpSub_BNU OWNAPI(cpSub_BNU)
BNU_CHUNK_T cpSub_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, cpSize ns);
+#define cpInc_BNU OWNAPI(cpInc_BNU)
BNU_CHUNK_T cpInc_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize ns, BNU_CHUNK_T val);
+#define cpDec_BNU OWNAPI(cpDec_BNU)
BNU_CHUNK_T cpDec_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize ns, BNU_CHUNK_T val);
#if defined(_USE_KARATSUBA_)
+#define cpAddAdd_BNU OWNAPI(cpAddAdd_BNU)
BNU_CHUNK_T cpAddAdd_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, const BNU_CHUNK_T* pC, cpSize size);
+#define cpAddSub_BNU OWNAPI(cpAddSub_BNU)
BNU_CHUNK_T cpAddSub_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, const BNU_CHUNK_T* pC, cpSize size);
#endif
+#define cpAddMulDgt_BNU OWNAPI(cpAddMulDgt_BNU)
BNU_CHUNK_T cpAddMulDgt_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize ns, BNU_CHUNK_T val);
#if 0
BNU_CHUNK_T cpMulDgt_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize ns, BNU_CHUNK_T val);
@@ -46,9 +53,11 @@ BNU_CHUNK_T cpSubMulDgt_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize ns, B
#endif
+#define cpMulAdc_BNU_school OWNAPI(cpMulAdc_BNU_school)
BNU_CHUNK_T cpMulAdc_BNU_school(BNU_CHUNK_T* pR,
const BNU_CHUNK_T* pA, cpSize nsA,
const BNU_CHUNK_T* pB, cpSize nsB);
+#define cpMulAdx_BNU_school OWNAPI(cpMulAdx_BNU_school)
BNU_CHUNK_T cpMulAdx_BNU_school(BNU_CHUNK_T* pR,
const BNU_CHUNK_T* pA, cpSize nsA,
const BNU_CHUNK_T* pB, cpSize nsB);
@@ -67,7 +76,9 @@ __INLINE BNU_CHUNK_T cpMul_BNU_school(BNU_CHUNK_T* pR,
#endif
}
+#define cpSqrAdc_BNU_school OWNAPI(cpSqrAdc_BNU_school)
BNU_CHUNK_T cpSqrAdc_BNU_school(BNU_CHUNK_T * pR, const BNU_CHUNK_T * pA, cpSize nsA);
+#define cpSqrAdx_BNU_school OWNAPI(cpSqrAdx_BNU_school)
BNU_CHUNK_T cpSqrAdx_BNU_school(BNU_CHUNK_T * pR, const BNU_CHUNK_T * pA, cpSize nsA);
__INLINE BNU_CHUNK_T cpSqr_BNU_school(BNU_CHUNK_T * pR, const BNU_CHUNK_T * pA, cpSize nsA)
@@ -83,16 +94,24 @@ __INLINE BNU_CHUNK_T cpSqr_BNU_school(BNU_CHUNK_T * pR, const BNU_CHUNK_T * pA,
}
#if(_IPP_ARCH==_IPP_ARCH_EM64T)
+#define gf256_add OWNAPI(gf256_add)
BNU_CHUNK_T* gf256_add(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, const BNU_CHUNK_T* pModulus);
+#define gf256_sub OWNAPI(gf256_sub)
BNU_CHUNK_T* gf256_sub(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, const BNU_CHUNK_T* pModulus);
+#define gf256_neg OWNAPI(gf256_neg)
BNU_CHUNK_T* gf256_neg(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pModulus);
+#define gf256_mulm OWNAPI(gf256_mulm)
BNU_CHUNK_T* gf256_mulm(BNU_CHUNK_T* pR,const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, const BNU_CHUNK_T* pModulus, BNU_CHUNK_T m0);
+#define gf256_sqrm OWNAPI(gf256_sqrm)
BNU_CHUNK_T* gf256_sqrm(BNU_CHUNK_T* pR,const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pModulus, BNU_CHUNK_T m0);
+#define gf256_div2 OWNAPI(gf256_div2)
BNU_CHUNK_T* gf256_div2(BNU_CHUNK_T* pR,const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pModulus);
#endif
+#define cpGcd_BNU OWNAPI(cpGcd_BNU)
BNU_CHUNK_T cpGcd_BNU(BNU_CHUNK_T a, BNU_CHUNK_T b);
+#define cpModInv_BNU OWNAPI(cpModInv_BNU)
int cpModInv_BNU(BNU_CHUNK_T* pInv,
const BNU_CHUNK_T* pA, cpSize nsA,
const BNU_CHUNK_T* pM, cpSize nsM,
diff --git a/ext/ipp/sources/ippcp/src/pcpbnuimpl.h b/ext/ipp/sources/ippcp/src/pcpbnuimpl.h
index 61f0332..1855bee 100644
--- a/ext/ipp/sources/ippcp/src/pcpbnuimpl.h
+++ b/ext/ipp/sources/ippcp/src/pcpbnuimpl.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2012-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -49,9 +49,9 @@
#define BNU_CHUNK_MASK (~(BNU_CHUNK_T)(0))
#if (BNU_CHUNK_BITS == BNU_CHUNK_64BIT)
- #pragma message ("BNU_CHUNK_BITS = 64 bit")
+
#elif (BNU_CHUNK_BITS == BNU_CHUNK_32BIT)
- #pragma message ("BNU_CHUNK_BITS = 32 bit")
+
#else
#error BNU_CHUNK_BITS should be either 64 or 32 bit!
#endif
diff --git a/ext/ipp/sources/ippcp/src/pcpbnumisc.c b/ext/ipp/sources/ippcp/src/pcpbnumisc.c
index 47bfcff..b87f780 100644
--- a/ext/ipp/sources/ippcp/src/pcpbnumisc.c
+++ b/ext/ipp/sources/ippcp/src/pcpbnumisc.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2002-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/ext/ipp/sources/ippcp/src/pcpbnumisc.h b/ext/ipp/sources/ippcp/src/pcpbnumisc.h
index 313471d..554905f 100644
--- a/ext/ipp/sources/ippcp/src/pcpbnumisc.h
+++ b/ext/ipp/sources/ippcp/src/pcpbnumisc.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2002-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -31,9 +31,13 @@
/* bit operations */
#define BITSIZE_BNU(p,ns) ((ns)*BNU_CHUNK_BITS-cpNLZ_BNU((p)[(ns)-1]))
#define BIT_BNU(bnu, ns,nbit) ((((nbit)>>BNU_CHUNK_LOG2) < (ns))? ((((bnu))[(nbit)>>BNU_CHUNK_LOG2] >>((nbit)&(BNU_CHUNK_BITS))) &1) : 0)
-#define TST_BIT(bnu, nbit) ((((bnu))[(nbit)>>BNU_CHUNK_LOG2]) & ((BNU_CHUNK_T)1<<((nbit)&(BNU_CHUNK_BITS-1))))
-#define SET_BIT(bnu, nbit) ((((bnu))[(nbit)>>BNU_CHUNK_LOG2]) |= ((BNU_CHUNK_T)1<<((nbit)&(BNU_CHUNK_BITS-1))))
-#define CLR_BIT(bnu, nbit) ((((bnu))[(nbit)>>BNU_CHUNK_LOG2]) &=~((BNU_CHUNK_T)1<<((nbit)&(BNU_CHUNK_BITS-1))))
+//#define TST_BIT(bnu, nbit) ((((bnu))[(nbit)>>BNU_CHUNK_LOG2]) & ((BNU_CHUNK_T)1<<((nbit)&(BNU_CHUNK_BITS-1))))
+//#define SET_BIT(bnu, nbit) ((((bnu))[(nbit)>>BNU_CHUNK_LOG2]) |= ((BNU_CHUNK_T)1<<((nbit)&(BNU_CHUNK_BITS-1))))
+//#define CLR_BIT(bnu, nbit) ((((bnu))[(nbit)>>BNU_CHUNK_LOG2]) &=~((BNU_CHUNK_T)1<<((nbit)&(BNU_CHUNK_BITS-1))))
+/**/
+#define TST_BIT(bnu, nbit) (((Ipp8u*)(bnu))[(nbit)/8] & ((1<<((nbit)%8)) &0xFF))
+#define SET_BIT(bnu, nbit) (((Ipp8u*)(bnu))[(nbit)/8] |= ((1<<((nbit)%8)) &0xFF))
+#define CLR_BIT(bnu, nbit) (((Ipp8u*)(bnu))[(nbit)/8] &=~((1<<((nbit)%8)) &0xFF))
/* convert bitsize nbits into the number of BNU_CHUNK_T */
#define BITS_BNU_CHUNK(nbits) (((nbits)+BNU_CHUNK_BITS-1)/BNU_CHUNK_BITS)
@@ -138,10 +142,13 @@ __INLINE int cpTst_BNU(const BNU_CHUNK_T* pA, int nsA)
}
/* number of leading/trailing zeros */
+#define cpNLZ_BNU OWNAPI(cpNLZ_BNU)
cpSize cpNLZ_BNU(BNU_CHUNK_T x);
+#define cpNTZ_BNU OWNAPI(cpNTZ_BNU)
cpSize cpNTZ_BNU(BNU_CHUNK_T x);
/* logical shift left/right */
+#define cpLSR_BNU OWNAPI(cpLSR_BNU)
int cpLSR_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize nsA, cpSize nBits);
#if 0
int cpLSL_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize nsA, cpSize nBits);
@@ -151,10 +158,13 @@ int cpLSL_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize nsA, cpSize nBits);
#if 0
int cpLSBit_BNU(const BNU_CHUNK_T* pA, cpSize nsA);
#endif
+#define cpMSBit_BNU OWNAPI(cpMSBit_BNU)
int cpMSBit_BNU(const BNU_CHUNK_T* pA, cpSize nsA);
/* BNU <-> hex-string conversion */
+#define cpToOctStr_BNU OWNAPI(cpToOctStr_BNU)
int cpToOctStr_BNU(Ipp8u* pStr, cpSize strLen, const BNU_CHUNK_T* pA, cpSize nsA);
+#define cpFromOctStr_BNU OWNAPI(cpFromOctStr_BNU)
int cpFromOctStr_BNU(BNU_CHUNK_T* pA, const Ipp8u* pStr, cpSize strLen);
#endif /* _PCP_BNUMISC_H */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccp.h b/ext/ipp/sources/ippcp/src/pcpeccp.h
index ae7ac55..f8dc021 100644
--- a/ext/ipp/sources/ippcp/src/pcpeccp.h
+++ b/ext/ipp/sources/ippcp/src/pcpeccp.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2003-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -23,238 +23,178 @@
//
*/
-#if !defined(_PCP_ECCP_H)
-#define _PCP_ECCP_H
-
-#include "pcpbnresource.h"
-#include "pcppma.h"
-#include "pcpeccppoint.h"
-#include "pcpeccpsscm.h"
-
-
-typedef struct eccp_method_st ECCP_METHOD;
-
-/*
-// ECC over prime GF(p) Context
-*/
-struct _cpECCP {
- IppCtxId idCtx; /* prime EC identifier */
-
- IppsBigNumState* pPrime; /* specify finite field GF(p) */
- IppsBigNumState* pA; /* scecify A & B of EC equation: */
- IppsBigNumState* pB; /* y^2 = x^3 + A*x + B (mod)p */
-
- IppsBigNumState* pGX; /* Base Point (X coordinate) */
- IppsBigNumState* pGY; /* Base Point (Y coordinate) */
- IppsBigNumState* pR; /* order (r) of Base Point */
- /* fields above mainly for ippsECCPSet()/ippsECCPGet() */
-
- Ipp32u eccStandard;/* generic/standard ecc */
-
- ECCP_METHOD* pMethod;
-
- int gfeBitSize; /* size (bits) of field element */
- int ordBitSize; /* size (bits) of BP order */
-
- int a_3; /* ==1 if A==-3 or A==P-3 */
- IppsBigNumState* pAenc; /* internal formatted pA value */
- IppsBigNumState* pBenc; /* internal formatted pB value */
- IppsMontState* pMontP; /* montromery engine (modulo p) */
-
- IppsECCPPointState* pGenc; /* internal formatted Base Point */
- IppsBigNumState* pCofactor; /* cofactor = #E/base_point_order*/
- IppsMontState* pMontR; /* montromery engine (modulo r) */
-
- IppsBigNumState* pPrivate; /* private key */
- IppsECCPPointState* pPublic; /* public key (affine) */
- IppsBigNumState* pPrivateE; /* ephemeral private key */
- IppsECCPPointState* pPublicE; /* ephemeral public key (affine) */
-
- #if defined(_USE_NN_VERSION_)
- Ipp32u randMask; /* mask of high bits random */
- IppsBigNumState* pRandCnt; /* random engine content */
- IppsPRNGState* pRandGen; /* random generator engine */
- #endif
-
- IppsPrimeState* pPrimary; /* prime engine */
-
-#if defined (_USE_ECCP_SSCM_)
- Ipp8u* pSscmBuffer;/* pointer to sscm buffer */
-#endif
-
- BigNumNode* pBnList; /* list of big numbers */
- /*BigNumNode* pBnListExt;*//* list of big numbers */
-};
-
-/* some useful constants */
-#define BNLISTSIZE (32) /* list size (probably less) */
-
-/*
-// Contetx Access Macros
-*/
-#define ECP_ID(ctx) ((ctx)->idCtx)
-
-#define ECP_PRIME(ctx) ((ctx)->pPrime)
-#define ECP_A(ctx) ((ctx)->pA)
-#define ECP_B(ctx) ((ctx)->pB)
-
-#define ECP_GX(ctx) ((ctx)->pGX)
-#define ECP_GY(ctx) ((ctx)->pGY)
-#define ECP_ORDER(ctx) ((ctx)->pR)
-
-#define ECP_TYPE(ctx) ((ctx)->eccStandard)
-
-#define ECP_METHOD(ctx) ((ctx)->pMethod)
-
-#define ECP_GFEBITS(ctx) ((ctx)->gfeBitSize)
-#define ECP_ORDBITS(ctx) ((ctx)->ordBitSize)
-
-#define ECP_AMI3(ctx) ((ctx)->a_3)
-#define ECP_AENC(ctx) ((ctx)->pAenc)
-#define ECP_BENC(ctx) ((ctx)->pBenc)
-#define ECP_PMONT(ctx) ((ctx)->pMontP)
-
-#define ECP_GENC(ctx) ((ctx)->pGenc)
-#define ECP_COFACTOR(ctx) ((ctx)->pCofactor)
-#define ECP_RMONT(ctx) ((ctx)->pMontR)
-
-#define ECP_PRIVATE(ctx) ((ctx)->pPrivate)
-#define ECP_PUBLIC(ctx) ((ctx)->pPublic)
-#define ECP_PRIVATE_E(ctx) ((ctx)->pPrivateE)
-#define ECP_PUBLIC_E(ctx) ((ctx)->pPublicE)
-
-#if defined(_USE_NN_VERSION_)
-#define ECP_RANDMASK(ctx) ((ctx)->randMask)
-#define ECP_RANDCNT(ctx) ((ctx)->pRandCnt)
-#define ECP_RAND(ctx) ((ctx)->pRandGen)
-#endif
-
-#define ECP_PRIMARY(ctx) ((ctx)->pPrimary)
-#if defined (_USE_ECCP_SSCM_)
-# define ECP_SCCMBUFF(ctx) ((ctx)->pSscmBuffer)
-#endif
-#define ECP_BNCTX(ctx) ((ctx)->pBnList)
-
-#define ECP_VALID_ID(ctx) (ECP_ID((ctx))==idCtxECCP)
+#if !defined(_NEW_PCP_ECCP_H)
+#define _NEW_PCP_ECCP_H
+
+#include "pcpgfpecstuff.h"
+//#include "pcpbnresource.h"
+//#include "pcppma.h"
+//#include "pcpeccppoint.h"
+//#include "pcpeccpsscm.h"
+
+
+__INLINE IppsBigNumState* cpConstructBN(IppsBigNumState* pBN, cpSize len, BNU_CHUNK_T* pData, BNU_CHUNK_T* pBuffer)
+{
+ BN_ID(pBN) = idCtxBigNum;
+ BN_SIGN(pBN) = ippBigNumPOS;
+ BN_SIZE(pBN) = len;
+ BN_ROOM(pBN) = len;
+ BN_NUMBER(pBN) = pData;
+ BN_BUFFER(pBN) = pBuffer;
+ return pBN;
+}
+
+/* set EC parameters */
+IppStatus ECCPSetDP(const IppsGFpMethod* method,
+ int pLen, const BNU_CHUNK_T* pP,
+ int aLen, const BNU_CHUNK_T* pA,
+ int bLen, const BNU_CHUNK_T* pB,
+ int xLen, const BNU_CHUNK_T* pX,
+ int yLen, const BNU_CHUNK_T* pY,
+ int rLen, const BNU_CHUNK_T* pR,
+ BNU_CHUNK_T h,
+ IppsGFpECState* pEC);
/*
// Recommended (Standard) Domain Parameters
*/
-extern const Ipp32u secp112r1_p[]; // (2^128 -3)/76439
-extern const Ipp32u secp112r1_a[];
-extern const Ipp32u secp112r1_b[];
-extern const Ipp32u secp112r1_gx[];
-extern const Ipp32u secp112r1_gy[];
-extern const Ipp32u secp112r1_r[];
-extern Ipp32u secp112r1_h;
-
-extern const Ipp32u secp112r2_p[]; // (2^128 -3)/76439
-extern const Ipp32u secp112r2_a[];
-extern const Ipp32u secp112r2_b[];
-extern const Ipp32u secp112r2_gx[];
-extern const Ipp32u secp112r2_gy[];
-extern const Ipp32u secp112r2_r[];
-extern Ipp32u secp112r2_h;
-
-extern const Ipp32u secp128r1_p[]; // 2^128 -2^97 -1
-extern const Ipp32u secp128r1_a[];
-extern const Ipp32u secp128r1_b[];
-extern const Ipp32u secp128r1_gx[];
-extern const Ipp32u secp128r1_gy[];
-extern const Ipp32u secp128r1_r[];
-extern Ipp32u secp128r1_h;
-
-extern const Ipp32u* secp128_mx[];
-
-extern const Ipp32u secp128r2_p[]; // 2^128 -2^97 -1
-extern const Ipp32u secp128r2_a[];
-extern const Ipp32u secp128r2_b[];
-extern const Ipp32u secp128r2_gx[];
-extern const Ipp32u secp128r2_gy[];
-extern const Ipp32u secp128r2_r[];
-extern Ipp32u secp128r2_h;
-
-extern const Ipp32u secp160r1_p[]; // 2^160 -2^31 -1
-extern const Ipp32u secp160r1_a[];
-extern const Ipp32u secp160r1_b[];
-extern const Ipp32u secp160r1_gx[];
-extern const Ipp32u secp160r1_gy[];
-extern const Ipp32u secp160r1_r[];
-extern Ipp32u secp160r1_h;
-
-extern const Ipp32u secp160r2_p[]; // 2^160 -2^32 -2^14 -2^12 -2^9 -2^8 -2^7 -2^2 -1
-extern const Ipp32u secp160r2_a[];
-extern const Ipp32u secp160r2_b[];
-extern const Ipp32u secp160r2_gx[];
-extern const Ipp32u secp160r2_gy[];
-extern const Ipp32u secp160r2_r[];
-extern Ipp32u secp160r2_h;
-
-extern const Ipp32u secp192r1_p[]; // 2^192 -2^64 -1
-extern const Ipp32u secp192r1_a[];
-extern const Ipp32u secp192r1_b[];
-extern const Ipp32u secp192r1_gx[];
-extern const Ipp32u secp192r1_gy[];
-extern const Ipp32u secp192r1_r[];
-extern Ipp32u secp192r1_h;
-
-extern const Ipp32u secp224r1_p[]; // 2^224 -2^96 +1
-extern const Ipp32u secp224r1_a[];
-extern const Ipp32u secp224r1_b[];
-extern const Ipp32u secp224r1_gx[];
-extern const Ipp32u secp224r1_gy[];
-extern const Ipp32u secp224r1_r[];
-extern Ipp32u secp224r1_h;
-
-extern const Ipp32u secp256r1_p[]; // 2^256 -2^224 +2^192 +2^96 -1
-extern const Ipp32u secp256r1_a[];
-extern const Ipp32u secp256r1_b[];
-extern const Ipp32u secp256r1_gx[];
-extern const Ipp32u secp256r1_gy[];
-extern const Ipp32u secp256r1_r[];
-extern Ipp32u secp256r1_h;
-
-extern const Ipp32u secp384r1_p[]; // 2^384 -2^128 -2^96 +2^32 -1
-extern const Ipp32u secp384r1_a[];
-extern const Ipp32u secp384r1_b[];
-extern const Ipp32u secp384r1_gx[];
-extern const Ipp32u secp384r1_gy[];
-extern const Ipp32u secp384r1_r[];
-extern Ipp32u secp384r1_h;
-
-extern const Ipp32u secp521r1_p[]; // 2^521 -1
-extern const Ipp32u secp521r1_a[];
-extern const Ipp32u secp521r1_b[];
-extern const Ipp32u secp521r1_gx[];
-extern const Ipp32u secp521r1_gy[];
-extern const Ipp32u secp521r1_r[];
-extern Ipp32u secp521r1_h;
-
-extern const Ipp32u tpmBN_p256p_p[]; // TPM BN_P256
-extern const Ipp32u tpmBN_p256p_a[];
-extern const Ipp32u tpmBN_p256p_b[];
-extern const Ipp32u tpmBN_p256p_gx[];
-extern const Ipp32u tpmBN_p256p_gy[];
-extern const Ipp32u tpmBN_p256p_r[];
-extern Ipp32u tpmBN_p256p_h;
-
-extern const Ipp32u tpmSM2_p256_p[]; // TPM SM2_P256
-extern const Ipp32u tpmSM2_p256_a[];
-extern const Ipp32u tpmSM2_p256_b[];
-extern const Ipp32u tpmSM2_p256_gx[];
-extern const Ipp32u tpmSM2_p256_gy[];
-extern const Ipp32u tpmSM2_p256_r[];
-extern Ipp32u tpmSM2_p256_h;
-
-extern const Ipp32u* tpmSM2_p256_p_mx[];
+extern const BNU_CHUNK_T secp112r1_p[]; // (2^128 -3)/76439
+extern const BNU_CHUNK_T secp112r1_a[];
+extern const BNU_CHUNK_T secp112r1_b[];
+extern const BNU_CHUNK_T secp112r1_gx[];
+extern const BNU_CHUNK_T secp112r1_gy[];
+extern const BNU_CHUNK_T secp112r1_r[];
+extern BNU_CHUNK_T secp112r1_h;
+
+extern const BNU_CHUNK_T secp112r2_p[]; // (2^128 -3)/76439
+extern const BNU_CHUNK_T secp112r2_a[];
+extern const BNU_CHUNK_T secp112r2_b[];
+extern const BNU_CHUNK_T secp112r2_gx[];
+extern const BNU_CHUNK_T secp112r2_gy[];
+extern const BNU_CHUNK_T secp112r2_r[];
+extern BNU_CHUNK_T secp112r2_h;
+
+extern const BNU_CHUNK_T secp128r1_p[]; // 2^128 -2^97 -1
+extern const BNU_CHUNK_T secp128r1_a[];
+extern const BNU_CHUNK_T secp128r1_b[];
+extern const BNU_CHUNK_T secp128r1_gx[];
+extern const BNU_CHUNK_T secp128r1_gy[];
+extern const BNU_CHUNK_T secp128r1_r[];
+extern BNU_CHUNK_T secp128r1_h;
+
+extern const BNU_CHUNK_T* secp128_mx[];
+
+extern const BNU_CHUNK_T secp128r2_p[]; // 2^128 -2^97 -1
+extern const BNU_CHUNK_T secp128r2_a[];
+extern const BNU_CHUNK_T secp128r2_b[];
+extern const BNU_CHUNK_T secp128r2_gx[];
+extern const BNU_CHUNK_T secp128r2_gy[];
+extern const BNU_CHUNK_T secp128r2_r[];
+extern BNU_CHUNK_T secp128r2_h;
+
+extern const BNU_CHUNK_T secp160r1_p[]; // 2^160 -2^31 -1
+extern const BNU_CHUNK_T secp160r1_a[];
+extern const BNU_CHUNK_T secp160r1_b[];
+extern const BNU_CHUNK_T secp160r1_gx[];
+extern const BNU_CHUNK_T secp160r1_gy[];
+extern const BNU_CHUNK_T secp160r1_r[];
+extern BNU_CHUNK_T secp160r1_h;
+
+extern const BNU_CHUNK_T secp160r2_p[]; // 2^160 -2^32 -2^14 -2^12 -2^9 -2^8 -2^7 -2^2 -1
+extern const BNU_CHUNK_T secp160r2_a[];
+extern const BNU_CHUNK_T secp160r2_b[];
+extern const BNU_CHUNK_T secp160r2_gx[];
+extern const BNU_CHUNK_T secp160r2_gy[];
+extern const BNU_CHUNK_T secp160r2_r[];
+extern BNU_CHUNK_T secp160r2_h;
+
+extern const BNU_CHUNK_T secp192r1_p[]; // 2^192 -2^64 -1
+extern const BNU_CHUNK_T secp192r1_a[];
+extern const BNU_CHUNK_T secp192r1_b[];
+extern const BNU_CHUNK_T secp192r1_gx[];
+extern const BNU_CHUNK_T secp192r1_gy[];
+extern const BNU_CHUNK_T secp192r1_r[];
+extern BNU_CHUNK_T secp192r1_h;
+
+extern const BNU_CHUNK_T secp224r1_p[]; // 2^224 -2^96 +1
+extern const BNU_CHUNK_T secp224r1_a[];
+extern const BNU_CHUNK_T secp224r1_b[];
+extern const BNU_CHUNK_T secp224r1_gx[];
+extern const BNU_CHUNK_T secp224r1_gy[];
+extern const BNU_CHUNK_T secp224r1_r[];
+extern BNU_CHUNK_T secp224r1_h;
+
+extern const BNU_CHUNK_T secp256r1_p[]; // 2^256 -2^224 +2^192 +2^96 -1
+extern const BNU_CHUNK_T secp256r1_a[];
+extern const BNU_CHUNK_T secp256r1_b[];
+extern const BNU_CHUNK_T secp256r1_gx[];
+extern const BNU_CHUNK_T secp256r1_gy[];
+extern const BNU_CHUNK_T secp256r1_r[];
+extern BNU_CHUNK_T secp256r1_h;
+
+extern const BNU_CHUNK_T secp384r1_p[]; // 2^384 -2^128 -2^96 +2^32 -1
+extern const BNU_CHUNK_T secp384r1_a[];
+extern const BNU_CHUNK_T secp384r1_b[];
+extern const BNU_CHUNK_T secp384r1_gx[];
+extern const BNU_CHUNK_T secp384r1_gy[];
+extern const BNU_CHUNK_T secp384r1_r[];
+extern BNU_CHUNK_T secp384r1_h;
+
+extern const BNU_CHUNK_T secp521r1_p[]; // 2^521 -1
+extern const BNU_CHUNK_T secp521r1_a[];
+extern const BNU_CHUNK_T secp521r1_b[];
+extern const BNU_CHUNK_T secp521r1_gx[];
+extern const BNU_CHUNK_T secp521r1_gy[];
+extern const BNU_CHUNK_T secp521r1_r[];
+extern BNU_CHUNK_T secp521r1_h;
+
+extern const BNU_CHUNK_T tpmBN_p256p_p[]; // TPM BN_P256
+extern const BNU_CHUNK_T tpmBN_p256p_a[];
+extern const BNU_CHUNK_T tpmBN_p256p_b[];
+extern const BNU_CHUNK_T tpmBN_p256p_gx[];
+extern const BNU_CHUNK_T tpmBN_p256p_gy[];
+extern const BNU_CHUNK_T tpmBN_p256p_r[];
+extern BNU_CHUNK_T tpmBN_p256p_h;
+
+extern const BNU_CHUNK_T tpmSM2_p256_p[]; // TPM SM2_P256
+extern const BNU_CHUNK_T tpmSM2_p256_a[];
+extern const BNU_CHUNK_T tpmSM2_p256_b[];
+extern const BNU_CHUNK_T tpmSM2_p256_gx[];
+extern const BNU_CHUNK_T tpmSM2_p256_gy[];
+extern const BNU_CHUNK_T tpmSM2_p256_r[];
+extern BNU_CHUNK_T tpmSM2_p256_h;
+
+extern const BNU_CHUNK_T* tpmSM2_p256_p_mx[];
/* half of some std modulus */
-extern const Ipp32u h_secp128r1_p[];
-extern const Ipp32u h_secp192r1_p[];
-extern const Ipp32u h_secp224r1_p[];
-extern const Ipp32u h_secp256r1_p[];
-extern const Ipp32u h_secp384r1_p[];
-extern const Ipp32u h_secp521r1_p[];
-extern const Ipp32u h_tpmSM2_p256_p[];
-
-#endif /* _PCP_ECCP_H */
+extern const BNU_CHUNK_T h_secp128r1_p[];
+extern const BNU_CHUNK_T h_secp192r1_p[];
+extern const BNU_CHUNK_T h_secp224r1_p[];
+extern const BNU_CHUNK_T h_secp256r1_p[];
+extern const BNU_CHUNK_T h_secp384r1_p[];
+extern const BNU_CHUNK_T h_secp521r1_p[];
+extern const BNU_CHUNK_T h_tpmSM2_p256_p[];
+
+__INLINE BNU_CHUNK_T* cpModAdd_BNU(BNU_CHUNK_T* pR,
+ const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB,
+ const BNU_CHUNK_T* pM, int ns,
+ BNU_CHUNK_T* pBuffer)
+{
+ BNU_CHUNK_T e = cpAdd_BNU(pR, pA, pB, ns);
+ e -= cpSub_BNU(pBuffer, pR, pM, ns);
+ MASKED_COPY_BNU(pR, e, pR, pBuffer, ns);
+ return pR;
+}
+
+__INLINE BNU_CHUNK_T* cpModSub_BNU(BNU_CHUNK_T* pR,
+ const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB,
+ const BNU_CHUNK_T* pM, int ns,
+ BNU_CHUNK_T* pBuffer)
+{
+ BNU_CHUNK_T e = cpSub_BNU(pR, pA, pB, ns);
+ cpAdd_BNU(pBuffer, pR, pM, ns);
+ MASKED_COPY_BNU(pR, (0-e), pBuffer, pR, ns);
+ return pR;
+}
+
+#endif /* _NEW_PCP_ECCP_H */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccp256r1dpca.c b/ext/ipp/sources/ippcp/src/pcpeccp256r1dpca.c
new file mode 100644
index 0000000..1fcf18e
--- /dev/null
+++ b/ext/ipp/sources/ippcp/src/pcpeccp256r1dpca.c
@@ -0,0 +1,50 @@
+/*############################################################################
+ # Copyright 2016-2017 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.
+ ############################################################################*/
+
+/*
+//
+// Purpose:
+// Cryptography Primitive.
+// EC over Prime Finite Field (setup/retrieve domain parameters)
+//
+// Contents:
+// ippsECCPSetStd256r1()
+*/
+#include "owndefs.h"
+#include "owncp.h"
+#include "pcpeccp.h"
+
+
+/*
+// Set EC256r1 parameters
+*/
+IPPFUN(IppStatus, ippsECCPSetStd256r1, (IppsECCPState* pEC))
+{
+ /* test pEC */
+ IPP_BAD_PTR1_RET(pEC);
+ /* use aligned EC context */
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+ /* set domain parameters */
+ return ECCPSetDP(ippsGFpMethod_p256r1(),
+ BITS_BNU_CHUNK(256), secp256r1_p,
+ BITS_BNU_CHUNK(256), secp256r1_a,
+ BITS_BNU_CHUNK(256), secp256r1_b,
+ BITS_BNU_CHUNK(256), secp256r1_gx,
+ BITS_BNU_CHUNK(256), secp256r1_gy,
+ BITS_BNU_CHUNK(256), secp256r1_r,
+ secp256r1_h,
+ pEC);
+} \ No newline at end of file
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpdpca.c b/ext/ipp/sources/ippcp/src/pcpeccpdpca.c
index b3e09a9..21d8c84 100644
--- a/ext/ipp/sources/ippcp/src/pcpeccpdpca.c
+++ b/ext/ipp/sources/ippcp/src/pcpeccpdpca.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2003-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -38,36 +38,10 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
#include "pcpeccp.h"
-#include "pcpeccppoint.h"
-#include "pcpbnresource.h"
-#include "pcpeccpmethod.h"
-#include "pcpeccpmethodcom.h"
-#include "pcppma.h"
-
-#if (_ECP_128_==_ECP_IMPL_SPECIFIC_)
-# include "pcpeccpmethod128.h"
-#endif
-#if (_ECP_192_==_ECP_IMPL_SPECIFIC_) || (_ECP_192_==_ECP_IMPL_MFM_)
-# include "pcpeccpmethod192.h"
-#endif
-#if (_ECP_224_==_ECP_IMPL_SPECIFIC_) || (_ECP_224_==_ECP_IMPL_MFM_)
-# include "pcpeccpmethod224.h"
-#endif
-#if (_ECP_256_==_ECP_IMPL_SPECIFIC_) || (_ECP_256_==_ECP_IMPL_MFM_)
-# include "pcpeccpmethod256.h"
-#endif
-#if (_ECP_384_==_ECP_IMPL_SPECIFIC_) || (_ECP_384_==_ECP_IMPL_MFM_)
-# include "pcpeccpmethod384.h"
-#endif
-#if (_ECP_521_==_ECP_IMPL_SPECIFIC_) || (_ECP_521_==_ECP_IMPL_MFM_)
-# include "pcpeccpmethod521.h"
-#endif
-#if (_ECP_SM2_==_ECP_IMPL_SPECIFIC_) || (_ECP_SM2_==_ECP_IMPL_MFM_)
-# include "pcpeccpmethodsm2.h"
-#endif
+
/*F*
// Name: ippsECCPSet
@@ -111,107 +85,78 @@
// pECC pointer to the ECC context
//
*F*/
-static
-void ECCPSetDP(IppECCType flag,
- int primeSize, const Ipp32u* pPrime,
- int aSize, const Ipp32u* pA,
- int bSize, const Ipp32u* pB,
- int gxSize, const Ipp32u* pGx,
- int gySize, const Ipp32u* pGy,
- int orderSize, const Ipp32u* pOrder,
- Ipp32u cofactor,
- IppsECCPState* pECC)
+IppStatus ECCPSetDP(const IppsGFpMethod* method,
+ int pLen, const BNU_CHUNK_T* pP,
+ int aLen, const BNU_CHUNK_T* pA,
+ int bLen, const BNU_CHUNK_T* pB,
+ int xLen, const BNU_CHUNK_T* pX,
+ int yLen, const BNU_CHUNK_T* pY,
+ int rLen, const BNU_CHUNK_T* pR,
+ BNU_CHUNK_T h,
+ IppsGFpECState* pEC)
{
- ECP_TYPE(pECC) = flag;
-
- /* reset size (bits) of field element */
- ECP_GFEBITS(pECC) = cpMSBit_BNU32(pPrime, primeSize) +1;
- /* reset size (bits) of Base Point order */
- ECP_ORDBITS(pECC) = cpMSBit_BNU32(pOrder, orderSize) +1;
-
- /* set up prime */
- ippsSet_BN(ippBigNumPOS, primeSize, pPrime, ECP_PRIME(pECC));
- /* set up A */
- ippsSet_BN(ippBigNumPOS, aSize, pA, ECP_A(pECC));
- /* test A */
- BN_Word(ECP_B(pECC), 3);
- PMA_add(ECP_B(pECC), ECP_A(pECC), ECP_B(pECC), ECP_PRIME(pECC));
- ECP_AMI3(pECC) = IsZero_BN(ECP_B(pECC));
- /* set up B */
- ippsSet_BN(ippBigNumPOS, bSize, pB, ECP_B(pECC));
-
- /* set up affine coordinates of Base Point and order */
- ippsSet_BN(ippBigNumPOS, gxSize, pGx, ECP_GX(pECC));
- ippsSet_BN(ippBigNumPOS, gySize, pGy, ECP_GY(pECC));
- ippsSet_BN(ippBigNumPOS, orderSize, pOrder, ECP_ORDER(pECC));
-
- /* set up cofactor */
- //ippsSet_BN(ippBigNumPOS, 1, &((Ipp32u)cofactor), ECP_COFACTOR(pECC));
- ippsSet_BN(ippBigNumPOS, 1, &cofactor, ECP_COFACTOR(pECC));
-
- #if defined(_USE_NN_VERSION_)
- /* set up randomizer */
- //gres 05/14/05: ECP_RANDMASK(pECC) = 0xFFFFFFFF >> ((32 -(ECP_ORDBITS(pECC)&0x1F)) &0x1F);
- ECP_RANDMASK(pECC) = MAKEMASK32(ECP_ORDBITS(pECC));
- ECP_RANDMASK(pECC) &= ~pOrder[orderSize-1];
- /* reinit randomizer */
- ippsPRNGInit(ECP_ORDBITS(pECC), ECP_RAND(pECC));
- /* default randomizer settings */
+ IPP_BADARG_RET(!ECP_TEST_ID(pEC), ippStsContextMatchErr);
+
{
- Ipp32u seed[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
- ippsPRNGSetSeed(seed, ECP_RAND(pECC));
- ippsSet_BN(ippBigNumPOS, RAND_CONTENT_LEN, seed, ECP_RANDCNT(pECC));
- }
- #endif
-
- /* montgomery engine (prime) */
- if( ippStsNoErr == ippsMontSet((Ipp32u*)BN_NUMBER(ECP_PRIME(pECC)), BN_SIZE32(ECP_PRIME(pECC)), ECP_PMONT(pECC)) ) {
- /* modulo reduction and montgomery form of A and B */
- PMA_mod(ECP_AENC(pECC), ECP_A(pECC), ECP_PRIME(pECC));
- PMA_enc(ECP_AENC(pECC), ECP_AENC(pECC), ECP_PMONT(pECC));
- PMA_mod(ECP_BENC(pECC), ECP_B(pECC), ECP_PRIME(pECC));
- PMA_enc(ECP_BENC(pECC), ECP_BENC(pECC), ECP_PMONT(pECC));
- /* projective coordinates and montgomery form of of Base Point */
- if( ( IsZero_BN(ECP_BENC(pECC)) && ECCP_IsPointAtAffineInfinity1(ECP_GX(pECC), ECP_GY(pECC))) ||
- (!IsZero_BN(ECP_BENC(pECC)) && ECCP_IsPointAtAffineInfinity0(ECP_GX(pECC), ECP_GY(pECC))) )
- ECCP_SetPointToInfinity(ECP_GENC(pECC));
- else {
- ECP_METHOD(pECC)->SetPointProjective(ECP_GX(pECC), ECP_GY(pECC), BN_ONE_REF(), ECP_GENC(pECC), pECC);
+ IppsGFpState * pGF = ECP_GFP(pEC);
+
+ IppStatus sts;
+ IppsBigNumState P, H;
+ //int primeBitSize = GFP_FEBITLEN(pGF);
+ cpConstructBN(&P, pLen, (BNU_CHUNK_T*)pP, NULL);
+ sts = cpGFpSetGFp(&P, method, pGF);
+
+ if(ippStsNoErr==sts) {
+ do {
+ int elemLen = GFP_FELEN(pGF);
+ IppsGFpElement elmA, elmB;
+
+ /* convert A ans B coeffs into GF elements */
+ cpGFpElementConstruct(&elmA, cpGFpGetPool(1, pGF), elemLen);
+ cpGFpElementConstruct(&elmB, cpGFpGetPool(1, pGF), elemLen);
+ sts = ippsGFpSetElement((Ipp32u*)pA, BITS2WORD32_SIZE(BITSIZE_BNU(pA,aLen)), &elmA, pGF);
+ if(ippStsNoErr!=sts) break;
+ sts = ippsGFpSetElement((Ipp32u*)pB, BITS2WORD32_SIZE(BITSIZE_BNU(pB,bLen)), &elmB, pGF);
+ if(ippStsNoErr!=sts) break;
+ /* and set EC */
+ sts = ippsGFpECSet(&elmA, &elmB, pEC);
+ if(ippStsNoErr!=sts) break;
+
+ /* convert GX ans GY coeffs into GF elements */
+ cpConstructBN(&P, rLen, (BNU_CHUNK_T*)pR, NULL);
+ cpConstructBN(&H, 1, &h, NULL);
+ sts = ippsGFpSetElement((Ipp32u*)pX, BITS2WORD32_SIZE(BITSIZE_BNU(pX,xLen)), &elmA, pGF);
+ if(ippStsNoErr!=sts) break;
+ sts = ippsGFpSetElement((Ipp32u*)pY, BITS2WORD32_SIZE(BITSIZE_BNU(pY,yLen)), &elmB, pGF);
+ if(ippStsNoErr!=sts) break;
+ /* and init EC subgroup */
+ sts = ippsGFpECSetSubgroup(&elmA, &elmB, &P, &H, pEC);
+ } while(0);
+
+ cpGFpReleasePool(2, pGF);
}
- }
- /* montgomery engine (order) */
- if( ippStsNoErr == ippsMontSet((Ipp32u*)BN_NUMBER(ECP_ORDER(pECC)), BN_SIZE32(ECP_ORDER(pECC)), ECP_RMONT(pECC)) )
- PMA_enc(ECP_COFACTOR(pECC), ECP_COFACTOR(pECC), ECP_RMONT(pECC));
-
- /* set zero private keys */
- BN_Word(ECP_PRIVATE(pECC), 0);
- BN_Word(ECP_PRIVATE_E(pECC), 0);
-
- /* set infinity public keys */
- ECCP_SetPointToInfinity(ECP_PUBLIC(pECC));
- ECCP_SetPointToInfinity(ECP_PUBLIC_E(pECC));
+ return sts;
+ }
}
-
IPPFUN(IppStatus, ippsECCPSet, (const IppsBigNumState* pPrime,
const IppsBigNumState* pA, const IppsBigNumState* pB,
- const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder,
- int cofactor,
- IppsECCPState* pECC))
+ const IppsBigNumState* pGX,const IppsBigNumState* pGY,
+ const IppsBigNumState* pOrder, int cofactor,
+ IppsECCPState* pEC))
{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
+ /* test pEC */
+ IPP_BAD_PTR1_RET(pEC);
/* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+ IPP_BADARG_RET(!ECP_TEST_ID(pEC), ippStsContextMatchErr);
/* test pPrime */
IPP_BAD_PTR1_RET(pPrime);
- pPrime = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrime, ALIGN_VAL) );
+ pPrime = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrime, BN_ALIGNMENT) );
IPP_BADARG_RET(!BN_VALID_ID(pPrime), ippStsContextMatchErr);
- IPP_BADARG_RET((cpBN_bitsize(pPrime)>ECP_GFEBITS(pECC)), ippStsRangeErr);
+ IPP_BADARG_RET((cpBN_bitsize(pPrime)>GFP_FEBITLEN(ECP_GFP(pEC))), ippStsRangeErr);
/* test pA and pB */
IPP_BAD_PTR2_RET(pA,pB);
@@ -219,8 +164,10 @@ IPPFUN(IppStatus, ippsECCPSet, (const IppsBigNumState* pPrime,
pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, ALIGN_VAL) );
IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr);
IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr);
- IPP_BADARG_RET((cpBN_bitsize(pA)>ECP_GFEBITS(pECC)), ippStsRangeErr);
- IPP_BADARG_RET((cpBN_bitsize(pB)>ECP_GFEBITS(pECC)), ippStsRangeErr);
+ //IPP_BADARG_RET((cpBN_bitsize(pA)>GFP_FEBITLEN(ECP_GFP(pEC))), ippStsRangeErr);
+ //IPP_BADARG_RET((cpBN_bitsize(pB)>GFP_FEBITLEN(ECP_GFP(pEC))), ippStsRangeErr);
+ IPP_BADARG_RET(BN_NEGATIVE(pA) || 0<=cpBN_cmp(pA,pPrime), ippStsRangeErr);
+ IPP_BADARG_RET(BN_NEGATIVE(pB) || 0<=cpBN_cmp(pB,pPrime), ippStsRangeErr);
/* test pG and pGorder pointers */
IPP_BAD_PTR3_RET(pGX,pGY, pOrder);
@@ -230,442 +177,26 @@ IPPFUN(IppStatus, ippsECCPSet, (const IppsBigNumState* pPrime,
IPP_BADARG_RET(!BN_VALID_ID(pGX), ippStsContextMatchErr);
IPP_BADARG_RET(!BN_VALID_ID(pGY), ippStsContextMatchErr);
IPP_BADARG_RET(!BN_VALID_ID(pOrder), ippStsContextMatchErr);
- IPP_BADARG_RET((cpBN_bitsize(pGX)>ECP_GFEBITS(pECC)), ippStsRangeErr);
- IPP_BADARG_RET((cpBN_bitsize(pGY)>ECP_GFEBITS(pECC)), ippStsRangeErr);
- IPP_BADARG_RET((cpBN_bitsize(pOrder)>ECP_ORDBITS(pECC)), ippStsRangeErr);
+ //IPP_BADARG_RET((cpBN_bitsize(pGX)>GFP_FEBITLEN(ECP_GFP(pEC))), ippStsRangeErr);
+ //IPP_BADARG_RET((cpBN_bitsize(pGY)>GFP_FEBITLEN(ECP_GFP(pEC))), ippStsRangeErr);
+ IPP_BADARG_RET(BN_NEGATIVE(pGX) || 0<=cpBN_cmp(pGX,pPrime), ippStsRangeErr);
+ IPP_BADARG_RET(BN_NEGATIVE(pGY) || 0<=cpBN_cmp(pGY,pPrime), ippStsRangeErr);
+ IPP_BADARG_RET((cpBN_bitsize(pOrder)>ECP_ORDBITSIZE(pEC)), ippStsRangeErr);
/* test cofactor */
IPP_BADARG_RET(!(0<cofactor), ippStsRangeErr);
- /* set general methods */
- *(ECP_METHOD(pECC)) = *(ECCPcom_Methods());
-
- /* set domain parameters */
- ECCPSetDP(IppECCArbitrary,
- BN_SIZE32(pPrime), (Ipp32u*)BN_NUMBER(pPrime),
- BN_SIZE32(pA), (Ipp32u*)BN_NUMBER(pA),
- BN_SIZE32(pB), (Ipp32u*)BN_NUMBER(pB),
- BN_SIZE32(pGX), (Ipp32u*)BN_NUMBER(pGX),
- BN_SIZE32(pGY), (Ipp32u*)BN_NUMBER(pGY),
- BN_SIZE32(pOrder), (Ipp32u*)BN_NUMBER(pOrder),
- cofactor,
- pECC);
-
- return ippStsNoErr;
-}
-
-
-/*F*
-// Name: ippsECCPSetStd
-//
-// Purpose: Set Standard ECC Domain Parameter.
-//
-// Returns: Reason:
-// ippStsNullPtrErr NULL == pECC
-//
-// ippStsContextMatchErr illegal pECC->idCtx
-//
-// ippStsECCInvalidFlagErr invalid flag
-//
-// ippStsNoErr no errors
-//
-// Parameters:
-// flag specify standard ECC parameter(s) to be setup
-// pECC pointer to the ECC context
-//
-*F*/
-IPPFUN(IppStatus, ippsECCPSetStd, (IppECCType flag, IppsECCPState* pECC))
-{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
- /* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
-
- *(ECP_METHOD(pECC)) = *(ECCPcom_Methods());//ECCPcom;
-
- switch(flag) {
- case IppECCPStd112r1:
- ECCPSetDP(IppECCPStd112r1,
- BITS2WORD32_SIZE(112), secp112r1_p,
- BITS2WORD32_SIZE(112), secp112r1_a,
- BITS2WORD32_SIZE(112), secp112r1_b,
- BITS2WORD32_SIZE(112), secp112r1_gx,
- BITS2WORD32_SIZE(112), secp112r1_gy,
- BITS2WORD32_SIZE(112), secp112r1_r,
- secp112r1_h, pECC);
- break;
- case IppECCPStd112r2:
- ECCPSetDP(IppECCPStd112r2,
- BITS2WORD32_SIZE(112), secp112r2_p,
- BITS2WORD32_SIZE(112), secp112r2_a,
- BITS2WORD32_SIZE(112), secp112r2_b,
- BITS2WORD32_SIZE(112), secp112r2_gx,
- BITS2WORD32_SIZE(112), secp112r2_gy,
- BITS2WORD32_SIZE(112), secp112r2_r,
- secp112r2_h, pECC);
- break;
- case IppECCPStd128r1:
- #if (_ECP_128_==_ECP_IMPL_SPECIFIC_)
- *(ECP_METHOD(pECC)) = *(ECCP128_Methods());//ECCP128;
- #endif
- ECCPSetDP(IppECCPStd128r1,
- BITS2WORD32_SIZE(128), secp128r1_p,
- BITS2WORD32_SIZE(128), secp128r1_a,
- BITS2WORD32_SIZE(128), secp128r1_b,
- BITS2WORD32_SIZE(128), secp128r1_gx,
- BITS2WORD32_SIZE(128), secp128r1_gy,
- BITS2WORD32_SIZE(128), secp128r1_r,
- secp128r1_h, pECC);
- break;
- case IppECCPStd128r2:
- #if (_ECP_128_==_ECP_IMPL_SPECIFIC_)
- *(ECP_METHOD(pECC)) = *(ECCP128_Methods());//ECCP128;
- #endif
- ECCPSetDP(IppECCPStd128r2,
- BITS2WORD32_SIZE(128), secp128r2_p,
- BITS2WORD32_SIZE(128), secp128r2_a,
- BITS2WORD32_SIZE(128), secp128r2_b,
- BITS2WORD32_SIZE(128), secp128r2_gx,
- BITS2WORD32_SIZE(128), secp128r2_gy,
- BITS2WORD32_SIZE(128), secp128r2_r,
- secp128r2_h, pECC);
- break;
- case IppECCPStd160r1:
- ECCPSetDP(IppECCPStd160r1,
- BITS2WORD32_SIZE(160), secp160r1_p,
- BITS2WORD32_SIZE(160), secp160r1_a,
- BITS2WORD32_SIZE(160), secp160r1_b,
- BITS2WORD32_SIZE(160), secp160r1_gx,
- BITS2WORD32_SIZE(160), secp160r1_gy,
- BITS2WORD32_SIZE(161), secp160r1_r,
- secp160r1_h, pECC);
- break;
- case IppECCPStd160r2:
- ECCPSetDP(IppECCPStd160r2,
- BITS2WORD32_SIZE(160), secp160r2_p,
- BITS2WORD32_SIZE(160), secp160r2_a,
- BITS2WORD32_SIZE(160), secp160r2_b,
- BITS2WORD32_SIZE(160), secp160r2_gx,
- BITS2WORD32_SIZE(160), secp160r2_gy,
- BITS2WORD32_SIZE(161), secp160r2_r,
- secp160r2_h, pECC);
- break;
- case IppECCPStd192r1:
- #if (_ECP_192_==_ECP_IMPL_SPECIFIC_) || (_ECP_192_==_ECP_IMPL_MFM_)
- *(ECP_METHOD(pECC)) = *(ECCP192_Methods());//ECCP192;
- #endif
- ECCPSetDP(IppECCPStd192r1,
- BITS2WORD32_SIZE(192), secp192r1_p,
- BITS2WORD32_SIZE(192), secp192r1_a,
- BITS2WORD32_SIZE(192), secp192r1_b,
- BITS2WORD32_SIZE(192), secp192r1_gx,
- BITS2WORD32_SIZE(192), secp192r1_gy,
- BITS2WORD32_SIZE(192), secp192r1_r,
- secp192r1_h, pECC);
- break;
- case IppECCPStd224r1:
- #if (_ECP_224_==_ECP_IMPL_SPECIFIC_) || (_ECP_224_==_ECP_IMPL_MFM_)
- *(ECP_METHOD(pECC)) = *(ECCP224_Methods());//ECCP224;
- #endif
- ECCPSetDP(IppECCPStd224r1,
- BITS2WORD32_SIZE(224), secp224r1_p,
- BITS2WORD32_SIZE(224), secp224r1_a,
- BITS2WORD32_SIZE(224), secp224r1_b,
- BITS2WORD32_SIZE(224), secp224r1_gx,
- BITS2WORD32_SIZE(224), secp224r1_gy,
- BITS2WORD32_SIZE(224), secp224r1_r,
- secp224r1_h, pECC);
- break;
- case IppECCPStd256r1:
- #if (_ECP_256_==_ECP_IMPL_SPECIFIC_) || (_ECP_256_==_ECP_IMPL_MFM_)
- *(ECP_METHOD(pECC)) = *(ECCP256_Methods());//ECCP256;
- #endif
- ECCPSetDP(IppECCPStd256r1,
- BITS2WORD32_SIZE(256), secp256r1_p,
- BITS2WORD32_SIZE(256), secp256r1_a,
- BITS2WORD32_SIZE(256), secp256r1_b,
- BITS2WORD32_SIZE(256), secp256r1_gx,
- BITS2WORD32_SIZE(256), secp256r1_gy,
- BITS2WORD32_SIZE(256), secp256r1_r,
- secp256r1_h, pECC);
- break;
- case IppECCPStd384r1:
- #if (_ECP_384_==_ECP_IMPL_SPECIFIC_) || (_ECP_384_==_ECP_IMPL_MFM_)
- *(ECP_METHOD(pECC)) = *(ECCP384_Methods());//ECCP384;
- #endif
- ECCPSetDP(IppECCPStd384r1,
- BITS2WORD32_SIZE(384), secp384r1_p,
- BITS2WORD32_SIZE(384), secp384r1_a,
- BITS2WORD32_SIZE(384), secp384r1_b,
- BITS2WORD32_SIZE(384), secp384r1_gx,
- BITS2WORD32_SIZE(384), secp384r1_gy,
- BITS2WORD32_SIZE(384), secp384r1_r,
- secp384r1_h, pECC);
- break;
- case IppECCPStd521r1:
- #if (_ECP_521_==_ECP_IMPL_SPECIFIC_) || (_ECP_521_==_ECP_IMPL_MFM_)
- *(ECP_METHOD(pECC)) = *(ECCP521_Methods());//ECCP521;
- #endif
- ECCPSetDP(IppECCPStd521r1,
- BITS2WORD32_SIZE(521), secp521r1_p,
- BITS2WORD32_SIZE(521), secp521r1_a,
- BITS2WORD32_SIZE(521), secp521r1_b,
- BITS2WORD32_SIZE(521), secp521r1_gx,
- BITS2WORD32_SIZE(521), secp521r1_gy,
- BITS2WORD32_SIZE(521), secp521r1_r,
- secp521r1_h, pECC);
- break;
- case ippEC_TPM_BN_P256:
- ECCPSetDP(ippEC_TPM_BN_P256,
- BITS2WORD32_SIZE(256), tpmBN_p256p_p,
- BITS2WORD32_SIZE(32), tpmBN_p256p_a,
- BITS2WORD32_SIZE(32), tpmBN_p256p_b,
- BITS2WORD32_SIZE(32), tpmBN_p256p_gx,
- BITS2WORD32_SIZE(32), tpmBN_p256p_gy,
- BITS2WORD32_SIZE(256), tpmBN_p256p_r,
- tpmBN_p256p_h, pECC);
- break;
- case ippECPstdSM2:
- #if (_ECP_SM2_==_ECP_IMPL_SPECIFIC_) || (_ECP_SM2_==_ECP_IMPL_MFM_)
- *(ECP_METHOD(pECC)) = *(ECCP_SM2_Methods());
- #endif
- ECCPSetDP(ippEC_TPM_SM2_P256,
- BITS2WORD32_SIZE(256), tpmSM2_p256_p,
- BITS2WORD32_SIZE(256), tpmSM2_p256_a,
- BITS2WORD32_SIZE(256), tpmSM2_p256_b,
- BITS2WORD32_SIZE(256), tpmSM2_p256_gx,
- BITS2WORD32_SIZE(256), tpmSM2_p256_gy,
- BITS2WORD32_SIZE(256), tpmSM2_p256_r,
- tpmSM2_p256_h, pECC);
- break;
- default:
- return ippStsECCInvalidFlagErr;
- }
-
- return ippStsNoErr;
-}
-
-/*F*
-// Name: ippsECCPSetStd128r1
-// ippsECCPSetStd128r2
-// ippsECCPSetStd192r1
-// ippsECCPSetStd224r1
-// ippsECCPSetStd256r1
-// ippsECCPSetStd384r1
-// ippsECCPSetStd521r1
-// ippsECCPSetStdSM2
-*F*/
-IPPFUN(IppStatus, ippsECCPSetStd128r1, (IppsECCPState* pECC))
-{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
- /* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
-
- #if (_ECP_128_==_ECP_IMPL_SPECIFIC_)
- *(ECP_METHOD(pECC)) = *(ECCP128_Methods()); // ECCP128;
- #else
- *(ECP_METHOD(pECC)) = *(ECCPcom_Methods()); // ECCPcom;
- #endif
- ECCPSetDP(IppECCPStd128r1,
- BITS2WORD32_SIZE(128), secp128r1_p,
- BITS2WORD32_SIZE(128), secp128r1_a,
- BITS2WORD32_SIZE(128), secp128r1_b,
- BITS2WORD32_SIZE(128), secp128r1_gx,
- BITS2WORD32_SIZE(128), secp128r1_gy,
- BITS2WORD32_SIZE(128), secp128r1_r,
- secp128r1_h, pECC);
-
- return ippStsNoErr;
-}
-
-IPPFUN(IppStatus, ippsECCPSetStd128r2, (IppsECCPState* pECC))
-{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
- /* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
-
- #if (_ECP_128_==_ECP_IMPL_SPECIFIC_)
- *(ECP_METHOD(pECC)) = *(ECCP128_Methods()); // ECCP128;
- #else
- *(ECP_METHOD(pECC)) = *(ECCPcom_Methods()); // ECCPcom;
- #endif
- ECCPSetDP(IppECCPStd128r2,
- BITS2WORD32_SIZE(128), secp128r2_p,
- BITS2WORD32_SIZE(128), secp128r2_a,
- BITS2WORD32_SIZE(128), secp128r2_b,
- BITS2WORD32_SIZE(128), secp128r2_gx,
- BITS2WORD32_SIZE(128), secp128r2_gy,
- BITS2WORD32_SIZE(128), secp128r2_r,
- secp128r2_h, pECC);
-
- return ippStsNoErr;
-}
-
-IPPFUN(IppStatus, ippsECCPSetStd192r1, (IppsECCPState* pECC))
-{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
- /* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
-
- #if (_ECP_192_==_ECP_IMPL_SPECIFIC_) || (_ECP_192_==_ECP_IMPL_MFM_)
- *(ECP_METHOD(pECC)) = *(ECCP192_Methods()); // ECCP192;
- #else
- *(ECP_METHOD(pECC)) = *(ECCPcom_Methods()); // ECCPcom;
- #endif
- ECCPSetDP(IppECCPStd192r1,
- BITS2WORD32_SIZE(192), secp192r1_p,
- BITS2WORD32_SIZE(192), secp192r1_a,
- BITS2WORD32_SIZE(192), secp192r1_b,
- BITS2WORD32_SIZE(192), secp192r1_gx,
- BITS2WORD32_SIZE(192), secp192r1_gy,
- BITS2WORD32_SIZE(192), secp192r1_r,
- secp192r1_h, pECC);
-
- return ippStsNoErr;
-}
-
-IPPFUN(IppStatus, ippsECCPSetStd224r1, (IppsECCPState* pECC))
-{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
- /* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
-
- #if (_ECP_224_==_ECP_IMPL_SPECIFIC_) || (_ECP_224_==_ECP_IMPL_MFM_)
- *(ECP_METHOD(pECC)) = *(ECCP224_Methods()); // ECCP224;
- #else
- *(ECP_METHOD(pECC)) = *(ECCPcom_Methods()); // ECCPcom;
- #endif
- ECCPSetDP(IppECCPStd224r1,
- BITS2WORD32_SIZE(224), secp224r1_p,
- BITS2WORD32_SIZE(224), secp224r1_a,
- BITS2WORD32_SIZE(224), secp224r1_b,
- BITS2WORD32_SIZE(224), secp224r1_gx,
- BITS2WORD32_SIZE(224), secp224r1_gy,
- BITS2WORD32_SIZE(224), secp224r1_r,
- secp224r1_h, pECC);
-
- return ippStsNoErr;
+ return ECCPSetDP(ippsGFpMethod_pArb(),
+ BN_SIZE(pPrime), BN_NUMBER(pPrime),
+ BN_SIZE(pA), BN_NUMBER(pA),
+ BN_SIZE(pB), BN_NUMBER(pB),
+ BN_SIZE(pGX), BN_NUMBER(pGX),
+ BN_SIZE(pGY), BN_NUMBER(pGY),
+ BN_SIZE(pOrder), BN_NUMBER(pOrder),
+ (BNU_CHUNK_T)cofactor,
+ pEC);
}
-IPPFUN(IppStatus, ippsECCPSetStd256r1, (IppsECCPState* pECC))
-{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
- /* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
-
- #if (_ECP_256_==_ECP_IMPL_SPECIFIC_) || (_ECP_256_==_ECP_IMPL_MFM_)
- *(ECP_METHOD(pECC)) = *(ECCP256_Methods()); // ECCP256;
- #else
- *(ECP_METHOD(pECC)) = *(ECCPcom_Methods()); // ECCPcom;
- #endif
- ECCPSetDP(IppECCPStd256r1,
- BITS2WORD32_SIZE(256), secp256r1_p,
- BITS2WORD32_SIZE(256), secp256r1_a,
- BITS2WORD32_SIZE(256), secp256r1_b,
- BITS2WORD32_SIZE(256), secp256r1_gx,
- BITS2WORD32_SIZE(256), secp256r1_gy,
- BITS2WORD32_SIZE(256), secp256r1_r,
- secp256r1_h, pECC);
-
- return ippStsNoErr;
-}
-
-IPPFUN(IppStatus, ippsECCPSetStd384r1, (IppsECCPState* pECC))
-{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
- /* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
-
- #if (_ECP_384_==_ECP_IMPL_SPECIFIC_) || (_ECP_384_==_ECP_IMPL_MFM_)
- *(ECP_METHOD(pECC)) = *(ECCP384_Methods()); // ECCP384;
- #else
- *(ECP_METHOD(pECC)) = *(ECCPcom_Methods()); // ECCPcom;
- #endif
- ECCPSetDP(IppECCPStd384r1,
- BITS2WORD32_SIZE(384), secp384r1_p,
- BITS2WORD32_SIZE(384), secp384r1_a,
- BITS2WORD32_SIZE(384), secp384r1_b,
- BITS2WORD32_SIZE(384), secp384r1_gx,
- BITS2WORD32_SIZE(384), secp384r1_gy,
- BITS2WORD32_SIZE(384), secp384r1_r,
- secp384r1_h, pECC);
-
- return ippStsNoErr;
-}
-
-IPPFUN(IppStatus, ippsECCPSetStd521r1, (IppsECCPState* pECC))
-{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
- /* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
-
- #if (_ECP_521_==_ECP_IMPL_SPECIFIC_) || (_ECP_521_==_ECP_IMPL_MFM_)
- *(ECP_METHOD(pECC)) = *(ECCP521_Methods()); // ECCP521;
- #else
- *(ECP_METHOD(pECC)) = *(ECCPcom_Methods()); // ECCPcom;
- #endif
- ECCPSetDP(IppECCPStd521r1,
- BITS2WORD32_SIZE(521), secp521r1_p,
- BITS2WORD32_SIZE(521), secp521r1_a,
- BITS2WORD32_SIZE(521), secp521r1_b,
- BITS2WORD32_SIZE(521), secp521r1_gx,
- BITS2WORD32_SIZE(521), secp521r1_gy,
- BITS2WORD32_SIZE(521), secp521r1_r,
- secp521r1_h, pECC);
-
- return ippStsNoErr;
-}
-
-IPPFUN(IppStatus, ippsECCPSetStdSM2, (IppsECCPState* pECC))
-{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
- /* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
-
- #if (_ECP_SM2_==_ECP_IMPL_SPECIFIC_) || (_ECP_SM2_==_ECP_IMPL_MFM_)
- *(ECP_METHOD(pECC)) = *(ECCP_SM2_Methods()); // ECCSM2;
- #else
- *(ECP_METHOD(pECC)) = *(ECCPcom_Methods()); // ECCPcom;
- #endif
- ECCPSetDP(ippEC_TPM_SM2_P256,
- BITS2WORD32_SIZE(256), tpmSM2_p256_p,
- BITS2WORD32_SIZE(256), tpmSM2_p256_a,
- BITS2WORD32_SIZE(256), tpmSM2_p256_b,
- BITS2WORD32_SIZE(256), tpmSM2_p256_gx,
- BITS2WORD32_SIZE(256), tpmSM2_p256_gy,
- BITS2WORD32_SIZE(256), tpmSM2_p256_r,
- tpmSM2_p256_h, pECC);
-
- return ippStsNoErr;
-}
-
-
/*F*
// Name: ippsECCPGet
//
@@ -711,20 +242,19 @@ IPPFUN(IppStatus, ippsECCPGet, (IppsBigNumState* pPrime,
IppsBigNumState* pA, IppsBigNumState* pB,
IppsBigNumState* pGX,IppsBigNumState* pGY,IppsBigNumState* pOrder,
int* cofactor,
- IppsECCPState* pECC))
+ IppsECCPState* pEC))
{
/* test pECC */
- IPP_BAD_PTR1_RET(pECC);
+ IPP_BAD_PTR1_RET(pEC);
/* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+ IPP_BADARG_RET(!ECP_TEST_ID(pEC), ippStsContextMatchErr);
/* test pPrime */
IPP_BAD_PTR1_RET(pPrime);
pPrime = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrime, ALIGN_VAL) );
IPP_BADARG_RET(!BN_VALID_ID(pPrime), ippStsContextMatchErr);
- IPP_BADARG_RET((BN_ROOM(pPrime)*BITSIZE(BNU_CHUNK_T)<ECP_GFEBITS(pECC)), ippStsRangeErr);
+ IPP_BADARG_RET(BN_ROOM(pPrime)<GFP_FELEN(ECP_GFP(pEC)), ippStsRangeErr);
/* test pA and pB */
IPP_BAD_PTR2_RET(pA,pB);
@@ -732,8 +262,8 @@ IPPFUN(IppStatus, ippsECCPGet, (IppsBigNumState* pPrime,
pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, ALIGN_VAL) );
IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr);
IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr);
- IPP_BADARG_RET((BN_ROOM(pA)*BITSIZE(BNU_CHUNK_T)<ECP_GFEBITS(pECC)), ippStsRangeErr);
- IPP_BADARG_RET((BN_ROOM(pB)*BITSIZE(BNU_CHUNK_T)<ECP_GFEBITS(pECC)), ippStsRangeErr);
+ IPP_BADARG_RET(BN_ROOM(pA)<GFP_FELEN(ECP_GFP(pEC)), ippStsRangeErr);
+ IPP_BADARG_RET(BN_ROOM(pB)<GFP_FELEN(ECP_GFP(pEC)), ippStsRangeErr);
/* test pG and pGorder pointers */
IPP_BAD_PTR3_RET(pGX,pGY, pOrder);
@@ -743,25 +273,41 @@ IPPFUN(IppStatus, ippsECCPGet, (IppsBigNumState* pPrime,
IPP_BADARG_RET(!BN_VALID_ID(pGX), ippStsContextMatchErr);
IPP_BADARG_RET(!BN_VALID_ID(pGY), ippStsContextMatchErr);
IPP_BADARG_RET(!BN_VALID_ID(pOrder), ippStsContextMatchErr);
- IPP_BADARG_RET((BN_ROOM(pGX)*BITSIZE(BNU_CHUNK_T)<ECP_GFEBITS(pECC)), ippStsRangeErr);
- IPP_BADARG_RET((BN_ROOM(pGY)*BITSIZE(BNU_CHUNK_T)<ECP_GFEBITS(pECC)), ippStsRangeErr);
- IPP_BADARG_RET((BN_ROOM(pOrder)*BITSIZE(BNU_CHUNK_T)<ECP_ORDBITS(pECC)), ippStsRangeErr);
+ IPP_BADARG_RET(BN_ROOM(pGX)<GFP_FELEN(ECP_GFP(pEC)), ippStsRangeErr);
+ IPP_BADARG_RET(BN_ROOM(pGY)<GFP_FELEN(ECP_GFP(pEC)), ippStsRangeErr);
+ IPP_BADARG_RET((BN_ROOM(pOrder)*BITSIZE(BNU_CHUNK_T)<ECP_ORDBITSIZE(pEC)), ippStsRangeErr);
/* test cofactor */
IPP_BAD_PTR1_RET(cofactor);
- /* retrieve ECC parameter */
- PMA_dec(pOrder, ECP_COFACTOR(pECC), ECP_RMONT(pECC));
+ {
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ gfdecode decode = pGF->decode; /* gf decode method */
+ BNU_CHUNK_T* tmp = cpGFpGetPool(1, pGF);
+
+ /* retrieve EC parameter */
+ ippsSet_BN(ippBigNumPOS, GFP_FELEN32(pGF), (Ipp32u*)GFP_MODULUS(pGF), pPrime);
+
+ decode(tmp, ECP_A(pEC), pGF);
+ ippsSet_BN(ippBigNumPOS, GFP_FELEN32(pGF), (Ipp32u*)tmp, pA);
+ decode(tmp, ECP_B(pEC), pGF);
+ ippsSet_BN(ippBigNumPOS, GFP_FELEN32(pGF), (Ipp32u*)tmp, pB);
+
+ decode(tmp, ECP_G(pEC), pGF);
+ ippsSet_BN(ippBigNumPOS, GFP_FELEN32(pGF), (Ipp32u*)tmp, pGX);
+ decode(tmp, ECP_G(pEC)+GFP_FELEN(pGF), pGF);
+ ippsSet_BN(ippBigNumPOS, GFP_FELEN32(pGF), (Ipp32u*)tmp, pGY);
+
+ {
+ IppsMontState* pR = ECP_MONT_R(pEC);
+ ippsSet_BN(ippBigNumPOS, MNT_SIZE(pR)*sizeof(BNU_CHUNK_T)/sizeof(Ipp32u), (Ipp32u*)MNT_MODULUS(pR), pOrder);
+ }
- *cofactor = (int)BN_NUMBER(pOrder)[0];
- ippsSet_BN(BN_SIGN(ECP_PRIME(pECC)), BN_SIZE32(ECP_PRIME(pECC)), (Ipp32u*)BN_NUMBER(ECP_PRIME(pECC)), pPrime);
- ippsSet_BN(BN_SIGN(ECP_A(pECC)), BN_SIZE32(ECP_A(pECC)), (Ipp32u*)BN_NUMBER(ECP_A(pECC)), pA);
- ippsSet_BN(BN_SIGN(ECP_B(pECC)), BN_SIZE32(ECP_B(pECC)), (Ipp32u*)BN_NUMBER(ECP_B(pECC)), pB);
- ippsSet_BN(BN_SIGN(ECP_GX(pECC)), BN_SIZE32(ECP_GX(pECC)), (Ipp32u*)BN_NUMBER(ECP_GX(pECC)), pGX);
- ippsSet_BN(BN_SIGN(ECP_GY(pECC)), BN_SIZE32(ECP_GY(pECC)), (Ipp32u*)BN_NUMBER(ECP_GY(pECC)), pGY);
- ippsSet_BN(BN_SIGN(ECP_ORDER(pECC)), BN_SIZE32(ECP_ORDER(pECC)), (Ipp32u*)BN_NUMBER(ECP_ORDER(pECC)), pOrder);
+ *cofactor = (int)ECP_COFACTOR(pEC)[0];
- return ippStsNoErr;
+ cpGFpReleasePool(1, pGF);
+ return ippStsNoErr;
+ }
}
@@ -783,19 +329,17 @@ IPPFUN(IppStatus, ippsECCPGet, (IppsBigNumState* pPrime,
// pECC pointer to the ECC context
//
*F*/
-IPPFUN(IppStatus, ippsECCPGetOrderBitSize,(int* pBitSize, IppsECCPState* pECC))
+IPPFUN(IppStatus, ippsECCPGetOrderBitSize,(int* pBitSize, IppsECCPState* pEC))
{
/* test pECC */
- IPP_BAD_PTR1_RET(pECC);
- /* use 4-byte aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, 4) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
+ IPP_BAD_PTR1_RET(pEC);
+ /* use aligned EC context */
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+ IPP_BADARG_RET(!ECP_TEST_ID(pEC), ippStsContextMatchErr);
/* test pBitSize*/
IPP_BAD_PTR1_RET(pBitSize);
- *pBitSize = ECP_ORDBITS(pECC);
-
+ *pBitSize = ECP_ORDBITSIZE(pEC);
return ippStsNoErr;
}
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpgenkeyca.c b/ext/ipp/sources/ippcp/src/pcpeccpgenkeyca.c
index ec3d785..2d980d5 100644
--- a/ext/ipp/sources/ippcp/src/pcpeccpgenkeyca.c
+++ b/ext/ipp/sources/ippcp/src/pcpeccpgenkeyca.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2003-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -26,11 +26,9 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
-#include "pcpeccppoint.h"
-#include "pcpeccpmethod.h"
-#include "pcpeccpmethodcom.h"
+#include "pcpeccp.h"
/*F*
@@ -56,49 +54,47 @@
//
*F*/
IPPFUN(IppStatus, ippsECCPGenKeyPair, (IppsBigNumState* pPrivate, IppsECCPPointState* pPublic,
- IppsECCPState* pECC,
+ IppsECCPState* pEC,
IppBitSupplier rndFunc, void* pRndParam))
{
- IPP_BAD_PTR2_RET(pECC, rndFunc);
+ IPP_BAD_PTR2_RET(pEC, rndFunc);
/* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+ IPP_BADARG_RET(!ECP_TEST_ID(pEC), ippStsContextMatchErr);
/* test private/public keys */
IPP_BAD_PTR2_RET(pPrivate,pPublic);
pPrivate = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivate, ALIGN_VAL) );
- pPublic = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPublic, ALIGN_VAL) );
IPP_BADARG_RET(!BN_VALID_ID(pPrivate), ippStsContextMatchErr);
- IPP_BADARG_RET((BN_ROOM(pPrivate)*BITSIZE(BNU_CHUNK_T)<ECP_ORDBITS(pECC)), ippStsSizeErr);
- IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPublic), ippStsContextMatchErr);
+ IPP_BADARG_RET((BN_ROOM(pPrivate)*BITSIZE(BNU_CHUNK_T)<ECP_ORDBITSIZE(pEC)), ippStsSizeErr);
+
+ IPP_BADARG_RET( !ECP_POINT_TEST_ID(pPublic), ippStsContextMatchErr );
+ IPP_BADARG_RET(ECP_POINT_FELEN(pPublic)<GFP_FELEN(ECP_GFP(pEC)), ippStsRangeErr);
{
- /*
- // generate random private key X: 0 < X < R
- */
- int reqBitLen = ECP_ORDBITS(pECC);
+ /* generate random private key X: 0 < X < R */
+ BNU_CHUNK_T* pOrder = MNT_MODULUS(ECP_MONT_R(pEC));
+ int orderBitLen = ECP_ORDBITSIZE(pEC);
+ int orderLen = BITS_BNU_CHUNK(orderBitLen);
- IppsBigNumState* pOrder = ECP_ORDER(pECC);
+ BNU_CHUNK_T* pX = BN_NUMBER(pPrivate);
+ int nsX = BITS_BNU_CHUNK(orderBitLen);
+ BNU_CHUNK_T xMask = MASK_BNU_CHUNK(orderBitLen);
- int xSize;
- Ipp32u* pX = (Ipp32u*)BN_NUMBER(pPrivate);
- Ipp32u xMask = MAKEMASK32(reqBitLen);
+ do {
+ rndFunc((Ipp32u*)pX, orderBitLen, pRndParam);
+ pX[nsX-1] &= xMask;
+ } while( (1 == cpEqu_BNU_CHUNK(pX, nsX, 0)) ||
+ (0 <= cpCmp_BNU(pX, nsX, pOrder, orderLen)) );
+ /* set up private */
BN_SIGN(pPrivate) = ippBigNumPOS;
- do {
- xSize = BITS2WORD32_SIZE(reqBitLen);
- rndFunc(pX, reqBitLen, pRndParam);
- pX[xSize-1] &= xMask;
- FIX_BNU(pX, xSize);
- BN_SIZE(pPrivate) = INTERNAL_BNU_LENGTH(xSize);
- } while( (0 == cpBN_tst(pPrivate)) ||
- (0 <= cpBN_cmp(pPrivate, pOrder)) );
+ FIX_BNU(pX, nsX);
+ BN_SIZE(pPrivate) = nsX;
/* calculate public key */
- //ECP_METHOD(pECC)->MulPoint(ECP_GENC(pECC), pPrivate, pPublic, pECC, ECP_BNCTX(pECC));
- ECP_METHOD(pECC)->MulBasePoint(pPrivate, pPublic, pECC, ECP_BNCTX(pECC));
+ gfec_MulBasePoint(pPublic, pX, nsX, pEC, (Ipp8u*)ECP_SBUFFER(pEC));
return ippStsNoErr;
}
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpinitca.c b/ext/ipp/sources/ippcp/src/pcpeccpinitca.c
index bf16403..5e26b29 100644
--- a/ext/ipp/sources/ippcp/src/pcpeccpinitca.c
+++ b/ext/ipp/sources/ippcp/src/pcpeccpinitca.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2003-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -44,14 +44,9 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
#include "pcpeccp.h"
-#include "pcpeccppoint.h"
-#include "pcpbnresource.h"
-#include "pcpeccpmethod.h"
-#include "pcpeccpsscm.h"
-#include "pcptool.h"
/*F*
@@ -77,93 +72,27 @@ IPPFUN(IppStatus, ippsECCPGetSize, (int feBitSize, int *pSize))
IPP_BAD_PTR1_RET(pSize);
/* test size of field element */
- IPP_BADARG_RET((2>feBitSize), ippStsSizeErr);
+ IPP_BADARG_RET((2>feBitSize || feBitSize>EC_GFP_MAXBITSIZE), ippStsSizeErr);
{
- int bn1Size;
- int bn2Size;
- int pointSize;
- int mont1Size;
- int mont2Size;
- #if defined(_USE_NN_VERSION_)
- int randSize;
- int randCntSize;
- #endif
- int primeSize;
- int listSize;
-
- /* size of field element */
- int gfeSize = BITS2WORD32_SIZE(feBitSize);
- /* size of order */
- int ordSize = BITS2WORD32_SIZE(feBitSize+1);
-
- #if defined (_USE_ECCP_SSCM_)
- /* size of sscm buffer */
- int w = cpECCP_OptimalWinSize(feBitSize+1);
- int nPrecomputed = 1<<w;
- int sscmBuffSize = nPrecomputed*(BITS_BNU_CHUNK(feBitSize)*3*sizeof(BNU_CHUNK_T)) +(CACHE_LINE_SIZE-1);
- #endif
-
- /* size of BigNum over GF(p) */
- ippsBigNumGetSize(gfeSize, &bn1Size);
-
- /* size of BigNum over GF(r) */
- ippsBigNumGetSize(ordSize, &bn2Size);
-
- /* size of EC point over GF(p) */
- ippsECCPPointGetSize(feBitSize, &pointSize);
-
- /* size of montgomery engine over GF(p) */
- ippsMontGetSize(ippBinaryMethod, BITS2WORD32_SIZE(feBitSize), &mont1Size);
-
- /* size of montgomery engine over GF(r) */
- ippsMontGetSize(ippBinaryMethod, BITS2WORD32_SIZE(feBitSize+1), &mont2Size);
-
- /* size of prime engine */
- ippsPrimeGetSize(feBitSize+1, &primeSize);
-
- /* size of big num list (big num in the list preserve 32 bit word) */
- listSize = cpBigNumListGetSize(feBitSize+1, BNLISTSIZE);
-
- *pSize = sizeof(IppsECCPState)
- +sizeof(ECCP_METHOD) /* methods */
-
- +bn1Size /* prime */
- +bn1Size /* A */
- +bn1Size /* B */
-
- +bn1Size /* GX */
- +bn1Size /* GY */
- +bn2Size /* order */
-
- +bn1Size /* Aenc */
- +bn1Size /* Benc */
- +mont1Size /* montgomery(p) */
-
- +pointSize /* Genc */
- +bn2Size /* cofactor */
- +mont2Size /* montgomery(r) */
-
- +bn2Size /* private */
- +pointSize /* public */
-
- +bn2Size /* eph private */
- +pointSize /* eph public */
-
- #if defined(_USE_NN_VERSION_)
- +randSize /* randomizer eng*/
- +randCntSize /* randomizer bit*/
- #endif
-
- +primeSize /* prime engine */
- #if defined (_USE_ECCP_SSCM_)
- +sscmBuffSize /* sscm buffer */
- #endif
- +listSize /* temp big num */
- +(ALIGN_VAL-1);
+ /* size of GF context */
+ int gfCtxSize = cpGFpGetSize(feBitSize);
+ /* size of EC context */
+ int ecCtxSize = cpGFpECGetSize(1, feBitSize);
+
+ /* size of EC scratch buffer: 16 points of BITS_BNU_CHUNK(feBitSize)*3 length each */
+ int ecScratchBufferSize = 16*(BITS_BNU_CHUNK(feBitSize)*3)*sizeof(BNU_CHUNK_T);
+
+ *pSize = ecCtxSize /* EC context */
+ +ECGFP_ALIGNMENT
+ +gfCtxSize /* GF context */
+ +GFP_ALIGNMENT
+ +ecScratchBufferSize /* *scratch buffer */
+ +ecScratchBufferSize /* should be enough for 2 tables */
+ +CACHE_LINE_SIZE;
+
+ return ippStsNoErr;
}
-
- return ippStsNoErr;
}
/*F*
@@ -196,6 +125,7 @@ IPPFUN(IppStatus, ippsECCPGetSizeStd224r1, (int *pSize))
return ippsECCPGetSize(224, pSize);
}
+
IPPFUN(IppStatus, ippsECCPGetSizeStd256r1, (int *pSize))
{
return ippsECCPGetSize(256, pSize);
@@ -234,173 +164,38 @@ IPPFUN(IppStatus, ippsECCPGetSizeStdSM2, (int *pSize))
// pECC pointer to the ECC context
//
*F*/
-IPPFUN(IppStatus, ippsECCPInit, (int feBitSize, IppsECCPState* pECC))
+IPPFUN(IppStatus, ippsECCPInit, (int feBitSize, IppsECCPState* pEC))
{
- /* test pECC pointer */
- IPP_BAD_PTR1_RET(pECC);
+ /* test pEC pointer */
+ IPP_BAD_PTR1_RET(pEC);
/* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
+ pEC = (IppsECCPState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
/* test size of field element */
- IPP_BADARG_RET((2>feBitSize), ippStsSizeErr);
-
- /* clear context */
- PaddBlock(0, pECC, sizeof(IppsECCPState));
-
- /* context ID */
- ECP_ID(pECC) = idCtxECCP;
+ IPP_BADARG_RET((2>feBitSize || feBitSize>EC_GFP_MAXBITSIZE), ippStsSizeErr);
- /* generic EC */
- ECP_TYPE(pECC) = IppECCArbitrary;
-
- /* size of field element & BP order */
- ECP_GFEBITS(pECC) = feBitSize;
- ECP_ORDBITS(pECC) = feBitSize+1;
-
- /*
- // init other context fields
- */
{
- int bn1Size;
- int bn2Size;
- int pointSize;
- int mont1Size;
- int mont2Size;
- #if defined(_USE_NN_VERSION_)
- int randSize;
- int randCntSize;
- #endif
- int primeSize;
- //int listSize;
-
- /* size of field element */
- int gfeSize = BITS2WORD32_SIZE(feBitSize);
- /* size of order */
- int ordSize = BITS2WORD32_SIZE(feBitSize+1);
-
- #if defined (_USE_ECCP_SSCM_)
- /* size of sscm buffer */
- int w = cpECCP_OptimalWinSize(feBitSize+1);
- int nPrecomputed = 1<<w;
- int sscmBuffSize = nPrecomputed*(BITS_BNU_CHUNK(feBitSize)*3*sizeof(BNU_CHUNK_T)) +(CACHE_LINE_SIZE-1);
- #endif
-
- Ipp8u* ptr = (Ipp8u*)pECC;
-
- /* size of BigNum over GF(p) */
- ippsBigNumGetSize(gfeSize, &bn1Size);
-
- /* size of BigNum over GF(r) */
- ippsBigNumGetSize(ordSize, &bn2Size);
-
- /* size of EC point over GF(p) */
- ippsECCPPointGetSize(feBitSize, &pointSize);
-
- /* size of montgomery engine over GF(p) */
- ippsMontGetSize(ippBinaryMethod, BITS2WORD32_SIZE(feBitSize), &mont1Size);
-
- /* size of montgomery engine over GF(r) */
- ippsMontGetSize(ippBinaryMethod, BITS2WORD32_SIZE(feBitSize+1), &mont2Size);
-
- /* size of prime engine */
- ippsPrimeGetSize(feBitSize+1, &primeSize);
-
- /* size of big num list */
- //listSize = cpBigNumListGetSize(feBitSize+1+32, BNLISTSIZE);
-
- /* allocate buffers */
- ptr += sizeof(IppsECCPState);
-
- ECP_METHOD(pECC) = (ECCP_METHOD*) (ptr);
- ptr += sizeof(ECCP_METHOD);
-
- ECP_PRIME(pECC) = (IppsBigNumState*) ( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
- ptr += bn1Size;
- ECP_A(pECC) = (IppsBigNumState*) ( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
- ptr += bn1Size;
- ECP_B(pECC) = (IppsBigNumState*) ( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
-
- ptr += bn1Size;
- ECP_GX(pECC) = (IppsBigNumState*) ( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
- ptr += bn1Size;
- ECP_GY(pECC) = (IppsBigNumState*) ( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
- ptr += bn1Size;
- ECP_ORDER(pECC) = (IppsBigNumState*) ( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
-
- ptr += bn2Size;
- ECP_AENC(pECC) = (IppsBigNumState*) ( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
- ptr += bn1Size;
- ECP_BENC(pECC) = (IppsBigNumState*) ( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
- ptr += bn1Size;
- ECP_PMONT(pECC) = (IppsMontState*) ( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
-
- ptr += mont1Size;
- ECP_GENC(pECC) = (IppsECCPPointState*)( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
- ptr += pointSize;
- ECP_COFACTOR(pECC)= (IppsBigNumState*) ( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
- ptr += bn2Size;
- ECP_RMONT(pECC) = (IppsMontState*) ( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
-
- ptr += mont2Size;
- ECP_PRIVATE(pECC) = (IppsBigNumState*) ( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
- ptr += bn2Size;
- ECP_PUBLIC(pECC) = (IppsECCPPointState*)( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
-
- ptr += pointSize;
- ECP_PRIVATE_E(pECC) = (IppsBigNumState*) ( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
- ptr += bn2Size;
- ECP_PUBLIC_E(pECC) =(IppsECCPPointState*)( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
-
- ptr += pointSize;
- #if defined(_USE_NN_VERSION_)
- ECP_RAND(pECC) = (IppsPRNGState*) ( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
- ptr += randSize;
- ECP_RANDCNT(pECC) = (IppsBigNumState*) ( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
-
- ptr += randCntSize;
- #endif
- ECP_PRIMARY(pECC) = (IppsPrimeState*) ( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
- ptr += primeSize;
-
- #if defined (_USE_ECCP_SSCM_)
- ECP_SCCMBUFF(pECC) = (Ipp8u*) ( IPP_ALIGNED_PTR(ptr,CACHE_LINE_SIZE) );
- ptr += sscmBuffSize;
- #endif
-
- ECP_BNCTX(pECC) = (BigNumNode*) ( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
-
- /* init buffers */
- ippsBigNumInit(gfeSize, ECP_PRIME(pECC));
- ippsBigNumInit(gfeSize, ECP_A(pECC));
- ippsBigNumInit(gfeSize, ECP_B(pECC));
-
- ippsBigNumInit(gfeSize, ECP_GX(pECC));
- ippsBigNumInit(gfeSize, ECP_GY(pECC));
- ippsBigNumInit(ordSize, ECP_ORDER(pECC));
-
- ippsBigNumInit(gfeSize, ECP_AENC(pECC));
- ippsBigNumInit(gfeSize, ECP_BENC(pECC));
- ippsMontInit(ippBinaryMethod, BITS2WORD32_SIZE(feBitSize), ECP_PMONT(pECC));
-
- ippsECCPPointInit(feBitSize, ECP_GENC(pECC));
- ippsBigNumInit(ordSize, ECP_COFACTOR(pECC));
- ippsMontInit(ippBinaryMethod, BITS2WORD32_SIZE(feBitSize+1), ECP_RMONT(pECC));
-
- ippsBigNumInit(ordSize, ECP_PRIVATE(pECC));
- ippsECCPPointInit(feBitSize,ECP_PUBLIC(pECC));
-
- ippsBigNumInit(ordSize, ECP_PRIVATE_E(pECC));
- ippsECCPPointInit(feBitSize,ECP_PUBLIC_E(pECC));
-
- #if defined(_USE_NN_VERSION_)
- ippsPRNGInit(feBitSize+1, ECP_RAND(pECC));
- ippsBigNumInit(RAND_CONTENT_LEN, ECP_RANDCNT(pECC));
- #endif
-
- cpBigNumListInit(feBitSize+1, BNLISTSIZE, ECP_BNCTX(pECC));
+ /* size of GF context */
+ int gfCtxSize = cpGFpGetSize(feBitSize);
+ /* size of EC context */
+ int ecCtxSize = cpGFpECGetSize(1, feBitSize);
+
+ IppsGFpState* pGF = (IppsGFpState*)(IPP_ALIGNED_PTR((Ipp8u*)pEC+ecCtxSize, GFP_ALIGNMENT));
+ BNU_CHUNK_T* pScratchBuffer = (BNU_CHUNK_T*)IPP_ALIGNED_PTR((Ipp8u*)pGF+gfCtxSize, CACHE_LINE_SIZE);
+
+ /* set up contexts */
+ IppStatus sts;
+ do {
+ sts = cpGFpInitGFp(feBitSize, pGF);
+ if(ippStsNoErr!=sts) break;
+ sts = ippsGFpECInit(pGF, NULL, NULL, pEC);
+ } while (0);
+
+ /* save scratch buffer pointer */
+ ECP_SBUFFER(pEC) = pScratchBuffer;
+
+ return sts;
}
-
- return ippStsNoErr;
}
/*F*
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpmethod.h b/ext/ipp/sources/ippcp/src/pcpeccpmethod.h
deleted file mode 100644
index 5df317e..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpmethod.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal EC Function Prototypes
-//
-//
-*/
-
-
-/*
-// Point Operation Prototypes
-// May be varied for different kinf of GP(p)
-*/
-struct eccp_method_st {
- //void (*CopyPoint)(const IppsECCPPointState* pSrc, IppsECCPPointState* pDst);
-
- void (*SetPointProjective)(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- const IppsBigNumState* pZ,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC);
- void (*SetPointAffine)(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC);
-
- //void (*GetPointProjective)(IppsBigNumState* pX,
- // IppsBigNumState* pY,
- // IppsBigNumState* pZ,
- // const IppsECCPPointState* pPoint,
- // const IppsECCPState* pECC);
- void (*GetPointAffine)(IppsBigNumState* pX,
- IppsBigNumState* pY,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
- //void (*SetPointToInfinity)(IppsECCPPointState* pPoint);
- //void (*SetPointToAffineInfinity0)(IppsBigNumState* pX, IppsBigNumState* pY);
- //void (*SetPointToAffineInfinity1)(IppsBigNumState* pX, IppsBigNumState* pY);
-
- //int (*IsPointAtInfinity)(const IppsECCPPointState* pPoint);
- //int (*IsPointAtAffineInfinity0)(const IppsBigNumState* pX, const IppsBigNumState* pY);
- //int (*IsPointAtAffineInfinity1)(const IppsBigNumState* pX, const IppsBigNumState* pY);
- int (*IsPointOnCurve)(const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
- int (*ComparePoint)(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- const IppsECCPState* pECC,
- BigNumNode* pList);
- void (*NegPoint)(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC);
- void (*DblPoint)(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
- void (*AddPoint)(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
- void (*MulPoint)(const IppsECCPPointState* pP,
- const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
- void (*MulBasePoint)(const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
- void (*ProdPoint)(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-};
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpmethod128.h b/ext/ipp/sources/ippcp/src/pcpeccpmethod128.h
deleted file mode 100644
index a5fe5a0..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpmethod128.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Definitions of EC methods over GF(P128)
-//
-//
-*/
-
-#if !defined(_PCP_ECCPMETHOD128_H)
-#define _PCP_ECCPMETHOD128_H
-
-#include "pcpeccp.h"
-
-
-/*
-// Returns reference
-*/
-ECCP_METHOD* ECCP128_Methods(void);
-
-
-/*
-// Point Set. These operations implies
-// transformation of regular coordinates into internal format
-*/
-void ECCP128_SetPointProjective(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- const IppsBigNumState* pZ,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC);
-
-void ECCP128_SetPointAffine(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC);
-
-/*
-// Get Point. These operations implies
-// transformation of internal format coordinates into regular
-*/
-//void ECCP128_GetPointProjective(IppsBigNumState* pX,
-// IppsBigNumState* pY,
-// IppsBigNumState* pZ,
-// const IppsECCPPointState* pPoint,
-// const IppsECCPState* pECC);
-
-void ECCP128_GetPointAffine(IppsBigNumState* pX,
- IppsBigNumState* pY,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-/*
-// Test is On EC
-*/
-int ECCP128_IsPointOnCurve(const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-/*
-// Operations
-*/
-int ECCP128_ComparePoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP128_NegPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC);
-
-void ECCP128_DblPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP128_AddPoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP128_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP128_MulBasePoint(const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP128_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-#endif /* _PCP_ECCPMETHOD128_H */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpmethod128ca.c b/ext/ipp/sources/ippcp/src/pcpeccpmethod128ca.c
deleted file mode 100644
index 11feec7..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpmethod128ca.c
+++ /dev/null
@@ -1,879 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// EC methods over GF(P128)
-//
-// Contents:
-// ECCP128_SetPointProjective()
-// ECCP128_SetPointAffine()
-// ECCP128_GetPointAffine()
-//
-// ECCP128_IsPointOnCurve()
-//
-// ECCP128_ComparePoint()
-// ECCP128_NegPoint()
-// ECCP128_DblPoint()
-// ECCP128_AddPoint()
-// ECCP128_MulPoint()
-// ECCP128_ProdPoint()
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-
-#if (_ECP_128_==_ECP_IMPL_SPECIFIC_)
-#include "pcpeccppoint.h"
-#include "pcpeccpmethod.h"
-#include "pcpeccpmethodcom.h"
-#include "pcpeccpmethod128.h"
-#include "pcppma128.h"
-
-/*
- NOTE:
- ECCP128 methods are used representation of point coordinates
- in regular (usual residue) domain, because of special modular reduction
-*/
-static
-ECCP_METHOD ECCP128 = {
- ECCP128_SetPointProjective,
- ECCP128_SetPointAffine,
- ECCP128_GetPointAffine,
-
- ECCP128_IsPointOnCurve,
-
- ECCP128_ComparePoint,
- ECCP128_NegPoint,
- ECCP128_DblPoint,
- ECCP128_AddPoint,
- ECCP128_MulPoint,
- ECCP128_MulBasePoint,
- ECCP128_ProdPoint
-};
-
-
-/*
-// Returns reference
-*/
-ECCP_METHOD* ECCP128_Methods(void)
-{
- return &ECCP128;
-}
-
-/*
-// ECCP128_PoinSettProjective
-// Converts regular projective triplet (pX,pY,pZ) into pPoint
-// (see note above)
-*/
-void ECCP128_SetPointProjective(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- const IppsBigNumState* pZ,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
- cpBN_copy(ECP_POINT_X(pPoint), pX);
- cpBN_copy(ECP_POINT_Y(pPoint), pY);
- cpBN_copy(ECP_POINT_Z(pPoint), pZ);
- ECP_POINT_AFFINE(pPoint) = cpBN_cmp(pZ, BN_ONE_REF())==0;
-}
-
-/*
-// ECCP128_PointAffineSet
-// Converts regular affine pair (pX,pY) into pPoint
-*/
-void ECCP128_SetPointAffine(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- ECCP128_SetPointProjective(pX, pY, BN_ONE_REF(), pPoint, pECC);
-}
-
-/*
-// ECCP128_GetPointProjective
-// Converts pPoint into regular projective triplet (pX,pY,pZ)
-*/
-#if 0
-void ECCP128_GetPointProjective(IppsBigNumState* pX,
- IppsBigNumState* pY,
- IppsBigNumState* pZ,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
- cpBN_copy(pX, ECP_POINT_X(pPoint));
- cpBN_copy(pY, ECP_POINT_Y(pPoint));
- cpBN_copy(pZ, ECP_POINT_Z(pPoint));
-}
-#endif
-
-/*
-// ECCP128_GetPointAffine
-//
-// Converts pPoint into regular affine pair (pX,pY)
-//
-// Note:
-// pPoint is not point at Infinity
-// transform (X, Y, Z) into (x, y) = (X/Z^2, Y/Z^3)
-*/
-void ECCP128_GetPointAffine(IppsBigNumState* pX, IppsBigNumState* pY,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* case Z == 1 */
- if( ECP_POINT_AFFINE(pPoint) ) {
- if(pX) {
- cpBN_copy(pX, ECP_POINT_X(pPoint));
- }
- if(pY) {
- cpBN_copy(pY, ECP_POINT_Y(pPoint));
- }
- }
-
- /* case Z != 1 */
- else {
- //IppsMontState* pMont = ECP_PMONT(pECC);
- IppsBigNumState* pModulo = ECP_PRIME(pECC);
-
- IppsBigNumState* pT = cpBigNumListGet(&pList);
- IppsBigNumState* pU = cpBigNumListGet(&pList);
- //IppsBigNumState* pModulo = cpBigNumListGet(&pList);
- //BN_Set(MNT_MODULUS(pMont), MNT_SIZE(pMont), pModulo);
-
- /* U = 1/Z */
- PMA128_inv(pU, ECP_POINT_Z(pPoint), pModulo);
- /* T = 1/(Z^2) */
- PMA128_sqr(pT, pU);
-
- if(pX) {
- PMA128_mul(pX,pT, ECP_POINT_X(pPoint));
- cpBN_fix(pX);
- }
- if(pY) {
- /* U = 1/(Z^3) */
- PMA128_mul(pU, pU, pT);
- PMA128_mul(pY,pU, ECP_POINT_Y(pPoint));
- cpBN_fix(pY);
- }
- }
-}
-
-/*
-// ECCP128_IsPointOnCurve
-//
-// Test point is lie on curve
-//
-// Note
-// We deal with equation: y^2 = x^3 + A*x + B.
-// Or in projective coordinates: Y^2 = X^3 + a*X*Z^4 + b*Z^6.
-// The point under test is given by projective triplet (X,Y,Z),
-// which represents actually (x,y) = (X/Z^2,Y/Z^3).
-*/
-int ECCP128_IsPointOnCurve(const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* let think Infinity point is on the curve */
- if( ECCP_IsPointAtInfinity(pPoint) )
- return 1;
-
- else {
- IppsBigNumState* pR = cpBigNumListGet(&pList);
- IppsBigNumState* pT = cpBigNumListGet(&pList);
-
- PMA128_sqr(pR, ECP_POINT_X(pPoint)); // R = X^3
- PMA128_mul(pR, pR, ECP_POINT_X(pPoint));
-
- /* case Z != 1 */
- if( !ECP_POINT_AFFINE(pPoint) ) {
- IppsBigNumState* pZ4 = cpBigNumListGet(&pList);
- IppsBigNumState* pZ6 = cpBigNumListGet(&pList);
- PMA128_sqr(pT, ECP_POINT_Z(pPoint)); // Z^2
- PMA128_sqr(pZ4, pT); // Z^4
- PMA128_mul(pZ6, pZ4, pT); // Z^6
-
- PMA128_mul(pT, pZ4, ECP_POINT_X(pPoint)); // T = X*Z^4
- if( ECP_AMI3(pECC) ) {
- IppsBigNumState* pU = cpBigNumListGet(&pList);
- PMA128_add(pU, pT, pT); // R = X^3 +a*X*Z^4
- PMA128_add(pU, pU, pT);
- PMA128_sub(pR, pR, pU);
- }
- else {
- PMA128_mul(pT, pT, ECP_A(pECC)); // R = X^3 +a*X*Z^4
- PMA128_add(pR, pR, pT);
- }
- PMA128_mul(pT, pZ6, ECP_B(pECC)); // R = X^3 +a*X*Z^4 + b*Z^6
- PMA128_add(pR, pR, pT);
-
- }
- /* case Z == 1 */
- else {
- if( ECP_AMI3(pECC) ) {
- PMA128_add(pT, ECP_POINT_X(pPoint), ECP_POINT_X(pPoint)); // R = X^3 +a*X
- PMA128_add(pT, pT, ECP_POINT_X(pPoint));
- PMA128_sub(pR, pR, pT);
- }
- else {
- PMA128_mul(pT, ECP_POINT_X(pPoint), ECP_A(pECC)); // R = X^3 +a*X
- PMA128_add(pR, pR, pT);
- }
- PMA128_add(pR, pR, ECP_B(pECC)); // R = X^3 +a*X + b
- }
- PMA128_sqr(pT, ECP_POINT_Y(pPoint)); // T = Y^2
- return 0==cpBN_cmp(pR, pT);
- }
-}
-
-/*
-// ECCP128_ComparePoint
-//
-// Compare two points:
-// returns 0 => pP==pQ (maybe both pP and pQ are at Infinity)
-// returns 1 => pP!=pQ
-//
-// Note
-// In general we check:
-// P_X*Q_Z^2 ~ Q_X*P_Z^2
-// P_Y*Q_Z^3 ~ Q_Y*P_Z^3
-*/
-int ECCP128_ComparePoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- UNREFERENCED_PARAMETER(pECC);
-
- /* P or/and Q at Infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- return ECCP_IsPointAtInfinity(pQ)? 0:1;
- if( ECCP_IsPointAtInfinity(pQ) )
- return ECCP_IsPointAtInfinity(pP)? 0:1;
-
- /* (P_Z==1) && (Q_Z==1) */
- if( ECP_POINT_AFFINE(pP) && ECP_POINT_AFFINE(pQ) )
- return ((0==cpBN_cmp(ECP_POINT_X(pP),ECP_POINT_X(pQ))) && (0==cpBN_cmp(ECP_POINT_Y(pP),ECP_POINT_Y(pQ))))? 0:1;
-
- {
- IppsBigNumState* pPtmp = cpBigNumListGet(&pList);
- IppsBigNumState* pQtmp = cpBigNumListGet(&pList);
- IppsBigNumState* pPZ = cpBigNumListGet(&pList);
- IppsBigNumState* pQZ = cpBigNumListGet(&pList);
-
- /* P_X*Q_Z^2 ~ Q_X*P_Z^2 */
- if( !ECP_POINT_AFFINE(pQ) ) {
- PMA128_sqr(pQZ, ECP_POINT_Z(pQ)); /* Ptmp = P_X*Q_Z^2 */
- PMA128_mul(pPtmp, ECP_POINT_X(pP), pQZ);
- }
- else {
- PMA_set(pPtmp, ECP_POINT_X(pP));
- }
- if( !ECP_POINT_AFFINE(pP) ) {
- PMA128_sqr(pPZ, ECP_POINT_Z(pP)); /* Qtmp = Q_X*P_Z^2 */
- PMA128_mul(pQtmp, ECP_POINT_X(pQ), pPZ);
- }
- else {
- PMA_set(pQtmp, ECP_POINT_X(pQ));
- }
- if ( cpBN_cmp(pPtmp, pQtmp) )
- return 1; /* points are different: (P_X*Q_Z^2) != (Q_X*P_Z^2) */
-
- /* P_Y*Q_Z^3 ~ Q_Y*P_Z^3 */
- if( !ECP_POINT_AFFINE(pQ) ) {
- PMA128_mul(pQZ, pQZ, ECP_POINT_Z(pQ)); /* Ptmp = P_Y*Q_Z^3 */
- PMA128_mul(pPtmp, ECP_POINT_Y(pP), pQZ);
- }
- else {
- PMA_set(pPtmp, ECP_POINT_Y(pP));
- }
- if( !ECP_POINT_AFFINE(pP) ) {
- PMA128_mul(pPZ, pPZ, ECP_POINT_Z(pP)); /* Qtmp = Q_Y*P_Z^3 */
- PMA128_mul(pQtmp, ECP_POINT_Y(pQ), pPZ);
- }
- else {
- PMA_set(pQtmp, ECP_POINT_Y(pQ));
- }
- return cpBN_cmp(pPtmp, pQtmp)? 1:0;
- }
-}
-
-/*
-// ECCP128_NegPoint
-//
-// Negative point
-*/
-void ECCP128_NegPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
-
- /* test point at Infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- ECCP_SetPointToInfinity(pR);
-
- else {
- BNU_CHUNK_T* pRy = BN_NUMBER(ECP_POINT_Y(pR));
- BNU_CHUNK_T* pPy = BN_NUMBER(ECP_POINT_Y(pP));
- int size = LEN_P128;
-
- if( pP!=pR ) {
- PMA_set(ECP_POINT_X(pR), ECP_POINT_X(pP));
- PMA_set(ECP_POINT_Z(pR), ECP_POINT_Z(pP));
- ECP_POINT_AFFINE(pR) = ECP_POINT_AFFINE(pP);
- }
- cpSub_BNU(pRy, (BNU_CHUNK_T*)secp128r1_p, pPy, LEN_P128);
- FIX_BNU(pRy,size);
- BN_SIZE(ECP_POINT_Y(pR)) = size;
- BN_SIGN(ECP_POINT_Y(pR)) = ippBigNumPOS;
- }
-}
-
-/*
-// ECCP128_DblPoint
-//
-// Double point
-*/
-void ECCP128_DblPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* P at infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- ECCP_SetPointToInfinity(pR);
-
- else {
- IppsBigNumState* bnV = cpBigNumListGet(&pList);
- IppsBigNumState* bnU = cpBigNumListGet(&pList);
- IppsBigNumState* bnM = cpBigNumListGet(&pList);
- IppsBigNumState* bnS = cpBigNumListGet(&pList);
- IppsBigNumState* bnT = cpBigNumListGet(&pList);
-
- /* M = 3*X^2 + A*Z^4 */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA128_sqr(bnU, ECP_POINT_X(pP));
- PMA128_add(bnM, bnU, bnU);
- PMA128_add(bnM, bnM, bnU);
- PMA128_add(bnM, bnM, ECP_A(pECC));
- }
- else if( ECP_AMI3(pECC) ) {
- PMA128_sqr(bnU, ECP_POINT_Z(pP));
- PMA128_add(bnS, ECP_POINT_X(pP), bnU);
- PMA128_sub(bnT, ECP_POINT_X(pP), bnU);
- PMA128_mul(bnM, bnS, bnT);
- PMA128_add(bnU, bnM, bnM);
- PMA128_add(bnM, bnU, bnM);
- }
- else {
- PMA128_sqr(bnU, ECP_POINT_X(pP));
- PMA128_add(bnM, bnU, bnU);
- PMA128_add(bnM, bnM, bnU);
- PMA128_sqr(bnU, ECP_POINT_Z(pP));
- PMA128_sqr(bnU, bnU);
- PMA128_mul(bnU, bnU, ECP_A(pECC));
- PMA128_add(bnM, bnM, bnU);
- }
-
- PMA128_add(bnV, ECP_POINT_Y(pP), ECP_POINT_Y(pP));
-
- /* R_Z = 2*Y*Z */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(ECP_POINT_Z(pR), bnV);
- }
- else {
- PMA128_mul(ECP_POINT_Z(pR), bnV, ECP_POINT_Z(pP));
- }
-
- /* S = 4*X*Y^2 */
- PMA128_sqr(bnT, bnV);
- PMA128_mul(bnS, bnT, ECP_POINT_X(pP));
-
- /* R_X = M^2 - 2*S */
- PMA128_sqr(bnU, bnM);
- PMA128_sub(bnU, bnU, bnS);
- PMA128_sub(ECP_POINT_X(pR), bnU, bnS);
-
- /* T = 8*Y^4 */
- PMA128_mul(bnV, bnV, ECP_POINT_Y(pP));
- PMA128_mul(bnT, bnT, bnV);
-
- /* R_Y = M*(S - R_X) - T */
- PMA128_sub(bnS, bnS, ECP_POINT_X(pR));
- PMA128_mul(bnS, bnS, bnM);
- PMA128_sub(ECP_POINT_Y(pR), bnS, bnT);
-
- ECP_POINT_AFFINE(pR) = 0;
- }
-}
-
-/*
-// ECCP128_AddPoint
-//
-// Add points
-*/
-void ECCP128_AddPoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
-#if 0
- /* test stupid call */
- if( pP == pQ ) {
- ECCP128_DblPoint(pP, pR, pECC, pList);
- return;
- }
-#endif
-
- /* prevent operation with point at Infinity */
- if( ECCP_IsPointAtInfinity(pP) ) {
- ECCP_CopyPoint(pQ, pR);
- return;
- }
- if( ECCP_IsPointAtInfinity(pQ) ) {
- ECCP_CopyPoint(pP, pR);
- return;
- }
-
- /*
- // addition
- */
- {
- IppsBigNumState* bnU0 = cpBigNumListGet(&pList);
- IppsBigNumState* bnS0 = cpBigNumListGet(&pList);
- IppsBigNumState* bnU1 = cpBigNumListGet(&pList);
- IppsBigNumState* bnS1 = cpBigNumListGet(&pList);
- IppsBigNumState* bnW = cpBigNumListGet(&pList);
- IppsBigNumState* bnR = cpBigNumListGet(&pList);
- IppsBigNumState *bnT = bnU0;
- IppsBigNumState *bnM = bnS0;
-
- /* U0 = P_X * Q_Z^2 */
- /* S0 = P_Y * Q_Z^3 */
- if( ECP_POINT_AFFINE(pQ) ) {
- PMA_set(bnU0, ECP_POINT_X(pP));
- PMA_set(bnS0, ECP_POINT_Y(pP));
- }
- else {
- PMA128_sqr(bnW, ECP_POINT_Z(pQ));
- PMA128_mul(bnU0,ECP_POINT_X(pP), bnW);
- PMA128_mul(bnW, ECP_POINT_Z(pQ), bnW);
- PMA128_mul(bnS0,ECP_POINT_Y(pP), bnW);
- }
-
- /* U1 = Q_X * P_Z^2 */
- /* S1 = Q_Y * P_Z^3 */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(bnU1, ECP_POINT_X(pQ));
- PMA_set(bnS1, ECP_POINT_Y(pQ));
- }
- else {
- PMA128_sqr(bnW, ECP_POINT_Z(pP));
- PMA128_mul(bnU1,ECP_POINT_X(pQ), bnW);
- PMA128_mul(bnW, ECP_POINT_Z(pP), bnW);
- PMA128_mul(bnS1,ECP_POINT_Y(pQ), bnW);
- }
-
- /* W = U0-U1 */
- /* R = S0-S1 */
- PMA128_sub(bnW, bnU0, bnU1);
- PMA128_sub(bnR, bnS0, bnS1);
-
- //if( IsZero_BN(bnW) ) {
- //if( IsZero_BN(bnR) ) {
- if(cpEqu_BNU_CHUNK(BN_NUMBER(bnW), LEN_P128, 0)) {
- if(cpEqu_BNU_CHUNK(BN_NUMBER(bnR), LEN_P128, 0)) {
- ECCP128_DblPoint(pP, pR, pECC, pList);
- return;
- }
- else {
- ECCP_SetPointToInfinity(pR);
- return;
- }
- }
-
- /* T = U0+U1 */
- /* M = S0+S1 */
- PMA128_add(bnT, bnU0, bnU1);
- PMA128_add(bnM, bnS0, bnS1);
-
- /* R_Z = P_Z * Q_Z * W */
- if( ECP_POINT_AFFINE(pQ) && ECP_POINT_AFFINE(pP) ) {
- PMA_set(ECP_POINT_Z(pR), bnW);
- }
- else {
- if( ECP_POINT_AFFINE(pQ) ) {
- PMA_set(bnU1, ECP_POINT_Z(pP));
- }
- else if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(bnU1, ECP_POINT_Z(pQ));
- }
- else {
- PMA128_mul(bnU1, ECP_POINT_Z(pP), ECP_POINT_Z(pQ));
- }
- PMA128_mul(ECP_POINT_Z(pR), bnU1, bnW);
- }
-
- PMA128_sqr(bnU1, bnW); /* U1 = W^2 */
- PMA128_mul(bnS1, bnT, bnU1); /* S1 = T * W^2 */
-
- /* R_X = R^2 - T * W^2 */
- PMA128_sqr(ECP_POINT_X(pR), bnR);
- PMA128_sub(ECP_POINT_X(pR), ECP_POINT_X(pR), bnS1);
-
- /* V = T * W^2 - 2 * R_X (S1) */
- PMA128_sub(bnS1, bnS1, ECP_POINT_X(pR));
- PMA128_sub(bnS1, bnS1, ECP_POINT_X(pR));
-
- /* R_Y = (V * R - M * W^3) /2 */
- PMA128_mul(ECP_POINT_Y(pR), bnS1, bnR);
- PMA128_mul(bnU1, bnU1, bnW);
- PMA128_mul(bnU1, bnU1, bnM);
- PMA128_sub(bnU1, ECP_POINT_Y(pR), bnU1);
- PMA128_div2(ECP_POINT_Y(pR), bnU1);
-
- ECP_POINT_AFFINE(pR) = 0;
- }
-}
-
-/*
-// ECCP128_MulPoint
-//
-// Multiply point by scalar
-*/
-#if !defined (_USE_ECCP_SSCM_)
-void ECCP128_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnN,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalar or input point at Infinity */
- if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) {
- ECCP_SetPointToInfinity(pR);
- return;
- }
-
- /*
- // scalar multiplication
- */
- else {
- IppsECCPPointState T;
- IppsECCPPointState U;
- IppsBigNumState* bnKH = cpBigNumListGet(&pList);
- Ipp32u* pK;
- Ipp32u* pH;
- Ipp32u carry;
- int lenKH;
- int bitH;
-
- /* init result */
- ECCP_CopyPoint(pP, pR);
-
- /* if scalar is negative */
- if( ippBigNumNEG == BN_SIGN(bnN) ) {
- /* negative R */
- ECCP128_NegPoint(pR, pR, pECC);
- }
-
- /* copy K = N and compute H=3*K */
- lenKH = BN_SIZE(bnN)+1;
- pK = BN_NUMBER(bnKH);
- pH = BN_BUFFER(bnKH);
- Cpy_BNU(BN_NUMBER(bnN), pK, BN_SIZE(bnN));
- pK[lenKH-1] = 0;
- carry = cpAdd_BNU(pH, pK, pK, lenKH);
- carry = cpAdd_BNU(pH, pK, pH, lenKH);
-
- /* init temporary T = (X/Z^2, Y/Z^3, 1) */
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
- ECCP128_GetPointAffine(ECP_POINT_X(&T), ECP_POINT_Y(&T), pR, pECC, pList);
- ECCP128_SetPointAffine(ECP_POINT_X(&T), ECP_POINT_Y(&T), &T, pECC);
-
- /* temporary point U =-T */
- ECP_POINT_X(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&U) = cpBigNumListGet(&pList);
- ECCP128_NegPoint(&T, &U, pECC);
-
- for(bitH=MSB_BNU(pH, lenKH)-1; bitH>0; bitH--) {
- int hBit = TST_BIT(pH, bitH);
- int kBit = TST_BIT(pK, bitH);
- ECCP128_DblPoint(pR, pR, pECC, pList);
- if( hBit && !kBit )
- ECCP128_AddPoint(pR, &T, pR, pECC, pList);
- if(!hBit && kBit )
- ECCP128_AddPoint(pR, &U, pR, pECC, pList);
- }
- }
-}
-
-#else
-#pragma message ("ECCP128_MulPoint: SCCM version")
-
-void ECCP128_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnN,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalar or input point at Infinity */
- if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) {
- ECCP_SetPointToInfinity(pR);
- return;
- }
-
- /*
- // scalar multiplication
- */
- else {
- Ipp8u* pScratchAligned = ECP_SCCMBUFF(pECC);
-
- BNU_CHUNK_T* pN = BN_NUMBER(bnN);
- cpSize nsN = BN_SIZE(bnN);
- /* scalar bitsize */
- int scalarBitSize = BITSIZE_BNU(pN, nsN);
- /* optimal size of window */
- int w = cpECCP_OptimalWinSize(scalarBitSize);
- /* number of table entries */
- int nPrecomputed = 1<<w;
-
- /* allocate temporary scalar */
- IppsBigNumState* bnTN = cpBigNumListGet(&pList);
- BNU_CHUNK_T* pTN = BN_NUMBER(bnTN);
-
- int coordSize = BITS_BNU_CHUNK(ECP_GFEBITS(pECC));
- IppsECCPPointState T;
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
- ECCP_SetPointToInfinity(&T);
-
- /* init result */
- ECCP_CopyPoint(pP, pR);
- if( ippBigNumNEG == BN_SIGN(bnN) )
- ECCP128_NegPoint(pR, pR, pECC);
-
- /* pre-compute auxiliary table t[] = {(2^w)*P, 1*P, 2*P, ..., (2^(w-1))*P} */
- {
- int n;
- for(n=1; n<nPrecomputed; n++) {
- ECCP128_AddPoint(pR, &T, &T, pECC, pList);
- cpECCP_ScramblePut(pScratchAligned+n, nPrecomputed, &T, coordSize);
- }
- ECCP128_AddPoint(pR, &T, &T, pECC, pList);
- cpECCP_ScramblePut(pScratchAligned, nPrecomputed, &T, coordSize);
- }
-
- /* copy scalar */
- cpCpy_BNU(pTN, pN, nsN);
- /* and convert it presentaion to avoid usage of O point */
- scalarBitSize = cpECCP_ConvertRepresentation(pTN, scalarBitSize, w);
-
- /* prepare temporary scalar for processing */
- pTN[BITS_BNU_CHUNK(scalarBitSize)] = 0;
- scalarBitSize = ((scalarBitSize+w-1)/w)*w;
-
- /*
- // scalar multiplication
- */
- {
- Ipp32u dmask = nPrecomputed-1;
-
- /* position (bit number) of the leftmost window */
- int wPosition = scalarBitSize-w;
-
- /* extract leftmost window value */
- Ipp32u eChunk = *((Ipp32u*)((Ipp16u*)pTN + wPosition/BITSIZE(Ipp16u)));
- int shift = wPosition & 0xF;
- Ipp32u windowVal = (eChunk>>shift) & dmask;
-
- /* initialize result (ECP_FINITE_POINT|ECP_PROJECTIVE) */
- cpECCP_ScrambleGet(pR, coordSize, pScratchAligned+windowVal, nPrecomputed);
- ECP_POINT_AFFINE(pR) = 0;
-
- /* initialize temporary T (ECP_PROJECTIVE) */
- ECP_POINT_AFFINE(&T) = 0;
-
- for(wPosition-=w; wPosition>=0; wPosition-=w) {
- /* w times doubling */
- int k;
- for(k=0; k<w; k++)
- ECCP128_DblPoint(pR, pR, pECC, pList);
-
- /* extract next window value */
- eChunk = *((Ipp32u*)((Ipp16u*)pTN + wPosition/BITSIZE(Ipp16u)));
- shift = wPosition & 0xF;
- windowVal = (eChunk>>shift) & dmask;
-
- /* extract value from the pre-computed table */
- cpECCP_ScrambleGet(&T, coordSize, pScratchAligned+windowVal, nPrecomputed);
-
- /* and add it */
- ECCP128_AddPoint(pR, &T, pR, pECC, pList);
- }
- }
- }
-}
-#endif
-
-void ECCP128_MulBasePoint(const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- ECCP128_MulPoint(ECP_GENC(pECC), pK, pR, pECC, pList);
-}
-
-/*
-// ECCP128_ProdPoint
-//
-// Point product
-*/
-#if !defined (_USE_ECCP_SSCM_)
-void ECCP128_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalars */
- if( IsZero_BN(bnPscalar) ) {
- ECCP128_MulPoint(pQ, bnQscalar, pR, pECC, pList);
- return;
- }
- if( IsZero_BN(bnQscalar) ) {
- ECCP128_MulPoint(pP, bnPscalar, pR, pECC, pList);
- return;
- }
-
- /*
- // point product
- */
- else {
- int n;
- Ipp32u* pbnPscalar = BN_NUMBER(bnPscalar);
- int bnPscalarSize = BN_SIZE(bnPscalar);
- Ipp32u* pbnQscalar = BN_NUMBER(bnQscalar);
- int bnQscalarSize = BN_SIZE(bnQscalar);
-
- int size = bnPscalarSize>bnQscalarSize? bnPscalarSize : bnQscalarSize;
-
- IppsECCPPointState* pPointPQ[4] = {NULL, NULL, NULL, NULL};
-
- /* allocate temporary PQ point */
- IppsECCPPointState PQ;
- ECP_POINT_X(&PQ) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&PQ) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&PQ) = cpBigNumListGet(&pList);
-
- /* init temporary point array */
- if(ippBigNumPOS == BN_SIGN(bnPscalar))
- pPointPQ[1] = (IppsECCPPointState*)pP;
- else {
- IppsECCPPointState P;
- ECP_POINT_X(&P) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&P) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&P) = cpBigNumListGet(&pList);
- ECCP128_NegPoint(pP, &P, pECC);
- pPointPQ[1] = &P;
- }
- if(ippBigNumPOS == BN_SIGN(bnQscalar))
- pPointPQ[2] = (IppsECCPPointState*)pQ;
- else {
- IppsECCPPointState Q;
- ECP_POINT_X(&Q) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&Q) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&Q) = cpBigNumListGet(&pList);
- ECCP128_NegPoint(pQ, &Q, pECC);
- pPointPQ[2] = &Q;
- }
-
- ECCP128_AddPoint(pPointPQ[1], pPointPQ[2], &PQ, pECC, pList);
- ECCP128_GetPointAffine(ECP_POINT_X(pR), ECP_POINT_Y(pR), &PQ, pECC, pList);
- ECCP128_SetPointAffine(ECP_POINT_X(pR), ECP_POINT_Y(pR), &PQ, pECC);
- pPointPQ[3] = &PQ;
-
- /* pad scalars by zeros */
- ZEXPAND_BNU(pbnPscalar,bnPscalarSize, size);
- ZEXPAND_BNU(pbnQscalar,bnQscalarSize, size);
-
- /* init result */
- ECCP_SetPointToInfinity(pR);
-
- for(n=size; n>0; n--) {
- Ipp32u scalarPn = pbnPscalar[n-1];
- Ipp32u scalarQn = pbnQscalar[n-1];
-
- int nBit;
- for(nBit=31; nBit>=0; nBit--) {
- int
- PnQnBits = scalarPn&0x80000000? 1:0;
- PnQnBits+= scalarQn&0x80000000? 2:0;
-
- if( !ECCP_IsPointAtInfinity(pR) )
- ECCP128_DblPoint(pR, pR, pECC, pList);
- if( PnQnBits )
- ECCP128_AddPoint(pR, pPointPQ[PnQnBits], pR, pECC, pList);
-
- scalarPn <<= 1;
- scalarQn <<= 1;
- }
- }
- }
-}
-
-#else
-#pragma message ("ECCP128_ProdPoint: SCCM version")
-
-void ECCP128_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- IppsECCPPointState T;
- IppsECCPPointState U;
-
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
-
- ECP_POINT_X(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&U) = cpBigNumListGet(&pList);
-
- ECCP128_MulPoint(pP, bnPscalar, &T, (IppsECCPState*)pECC, pList);
- ECCP128_MulPoint(pQ, bnQscalar, &U, (IppsECCPState*)pECC, pList);
- ECCP128_AddPoint(&T, &U, pR, pECC, pList);
-}
-#endif
-
-#endif /* _ECP_128_==_ECP_IMPL_SPECIFIC_ */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpmethod192.h b/ext/ipp/sources/ippcp/src/pcpeccpmethod192.h
deleted file mode 100644
index 747173c..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpmethod192.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Definitions of EC methods over GF(P192)
-//
-//
-*/
-
-#if !defined(_PCP_ECCPMETHOD192_H)
-#define _PCP_ECCPMETHOD192_H
-
-#include "pcpeccp.h"
-
-/*
-// Returns reference
-*/
-ECCP_METHOD* ECCP192_Methods(void);
-
-
-/*
-// Point Set. These operations implies
-// transformation of regular coordinates into internal format
-*/
-void ECCP192_SetPointProjective(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- const IppsBigNumState* pZ,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC);
-
-void ECCP192_SetPointAffine(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC);
-
-/*
-// Get Point. These operations implies
-// transformation of internal format coordinates into regular
-*/
-//void ECCP192_GetPointProjective(IppsBigNumState* pX,
-// IppsBigNumState* pY,
-// IppsBigNumState* pZ,
-// const IppsECCPPointState* pPoint,
-// const IppsECCPState* pECC);
-
-void ECCP192_GetPointAffine(IppsBigNumState* pX,
- IppsBigNumState* pY,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-/*
-// Test is On EC
-*/
-int ECCP192_IsPointOnCurve(const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-/*
-// Operations
-*/
-int ECCP192_ComparePoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP192_NegPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC);
-
-void ECCP192_DblPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP192_AddPoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP192_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP192_MulBasePoint(const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP192_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-#endif /* _PCP_ECCPMETHOD192_H */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpmethod192ca.c b/ext/ipp/sources/ippcp/src/pcpeccpmethod192ca.c
deleted file mode 100644
index 39b1b63..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpmethod192ca.c
+++ /dev/null
@@ -1,880 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// EC methods over GF(P192)
-//
-// Contents:
-// ECCP192_SetPointProjective()
-// ECCP192_SetPointAffine()
-// ECCP192_GetPointAffine()
-//
-// ECCP192_IsPointOnCurve()
-//
-// ECCP192_ComparePoint()
-// ECCP192_NegPoint()
-// ECCP192_DblPoint()
-// ECCP192_AddPoint()
-// ECCP192_MulPoint()
-// ECCP192_ProdPoint()
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-
-#if (_ECP_192_==_ECP_IMPL_SPECIFIC_)
-#include "pcpeccppoint.h"
-#include "pcpeccpmethod.h"
-#include "pcpeccpmethodcom.h"
-#include "pcpeccpmethod192.h"
-#include "pcppma192.h"
-
-/*
- NOTE:
- ECCP192 methods are used representation of point coordinates
- in regular (usual residue) domain, because of special modular reduction
-*/
-static
-ECCP_METHOD ECCP192 = {
- ECCP192_SetPointProjective,
- ECCP192_SetPointAffine,
- ECCP192_GetPointAffine,
-
- ECCP192_IsPointOnCurve,
-
- ECCP192_ComparePoint,
- ECCP192_NegPoint,
- ECCP192_DblPoint,
- ECCP192_AddPoint,
- ECCP192_MulPoint,
- ECCP192_MulBasePoint,
- ECCP192_ProdPoint
-};
-
-
-/*
-// Returns reference
-*/
-ECCP_METHOD* ECCP192_Methods(void)
-{
- return &ECCP192;
-}
-
-/*
-// ECCP192_PoinSettProjective
-// Converts regular projective triplet (pX,pY,pZ) into pPoint
-// (see note above)
-*/
-void ECCP192_SetPointProjective(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- const IppsBigNumState* pZ,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
- cpBN_copy(ECP_POINT_X(pPoint), pX);
- cpBN_copy(ECP_POINT_Y(pPoint), pY);
- cpBN_copy(ECP_POINT_Z(pPoint), pZ);
- ECP_POINT_AFFINE(pPoint) = cpBN_cmp(pZ, BN_ONE_REF())==0;
-}
-
-/*
-// ECCP192_PointAffineSet
-// Converts regular affine pair (pX,pY) into pPoint
-*/
-void ECCP192_SetPointAffine(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- ECCP192_SetPointProjective(pX, pY, BN_ONE_REF(), pPoint, pECC);
-}
-
-/*
-// ECCP192_GetPointProjective
-// Converts pPoint into regular projective triplet (pX,pY,pZ)
-*/
-#if 0
-void ECCP192_GetPointProjective(IppsBigNumState* pX,
- IppsBigNumState* pY,
- IppsBigNumState* pZ,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
- cpBN_copy(pX, ECP_POINT_X(pPoint));
- cpBN_copy(pY, ECP_POINT_Y(pPoint));
- cpBN_copy(pZ, ECP_POINT_Z(pPoint));
-}
-#endif
-
-/*
-// ECCP192_GetPointAffine
-//
-// Converts pPoint into regular affine pair (pX,pY)
-//
-// Note:
-// pPoint is not point at Infinity
-// transform (X, Y, Z) into (x, y) = (X/Z^2, Y/Z^3)
-*/
-void ECCP192_GetPointAffine(IppsBigNumState* pX, IppsBigNumState* pY,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* case Z == 1 */
- if( ECP_POINT_AFFINE(pPoint) ) {
- if(pX) {
- cpBN_copy(pX, ECP_POINT_X(pPoint));
- }
- if(pY) {
- cpBN_copy(pY, ECP_POINT_Y(pPoint));
- }
- }
-
- /* case Z != 1 */
- else {
- //IppsMontState* pMont = ECP_PMONT(pECC);
- IppsBigNumState* pModulo = ECP_PRIME(pECC);
-
- IppsBigNumState* pT = cpBigNumListGet(&pList);
- IppsBigNumState* pU = cpBigNumListGet(&pList);
- //IppsBigNumState* pModulo = cpBigNumListGet(&pList);
- //BN_Set(MNT_MODULUS(pMont), MNT_SIZE(pMont), pModulo);
-
- /* U = 1/Z */
- PMA192_inv(pU, ECP_POINT_Z(pPoint), pModulo);
- /* T = 1/(Z^2) */
- PMA192_sqr(pT, pU);
-
- if(pX) {
- PMA192_mul(pX,pT, ECP_POINT_X(pPoint));
- cpBN_fix(pX);
- }
- if(pY) {
- /* U = 1/(Z^3) */
- PMA192_mul(pU, pU, pT);
- PMA192_mul(pY,pU, ECP_POINT_Y(pPoint));
- cpBN_fix(pY);
- }
- }
-}
-
-/*
-// ECCP192_IsPointOnCurve
-//
-// Test point is lie on curve
-//
-// Note
-// We deal with equation: y^2 = x^3 + A*x + B.
-// Or in projective coordinates: Y^2 = X^3 + a*X*Z^4 + b*Z^6.
-// The point under test is given by projective triplet (X,Y,Z),
-// which represents actually (x,y) = (X/Z^2,Y/Z^3).
-*/
-int ECCP192_IsPointOnCurve(const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* let think Infinity point is on the curve */
- if( ECCP_IsPointAtInfinity(pPoint) )
- return 1;
-
- else {
- IppsBigNumState* pR = cpBigNumListGet(&pList);
- IppsBigNumState* pT = cpBigNumListGet(&pList);
-
- PMA192_sqr(pR, ECP_POINT_X(pPoint)); // R = X^3
- PMA192_mul(pR, pR, ECP_POINT_X(pPoint));
-
- /* case Z != 1 */
- if( !ECP_POINT_AFFINE(pPoint) ) {
- IppsBigNumState* pZ4 = cpBigNumListGet(&pList);
- IppsBigNumState* pZ6 = cpBigNumListGet(&pList);
- PMA192_sqr(pT, ECP_POINT_Z(pPoint)); // Z^2
- PMA192_sqr(pZ4, pT); // Z^4
- PMA192_mul(pZ6, pZ4, pT); // Z^6
-
- PMA192_mul(pT, pZ4, ECP_POINT_X(pPoint)); // T = X*Z^4
- if( ECP_AMI3(pECC) ) {
- IppsBigNumState* pU = cpBigNumListGet(&pList);
- PMA192_add(pU, pT, pT); // R = X^3 +a*X*Z^4
- PMA192_add(pU, pU, pT);
- PMA192_sub(pR, pR, pU);
- }
- else {
- PMA192_mul(pT, pT, ECP_A(pECC)); // R = X^3 +a*X*Z^4
- PMA192_add(pR, pR, pT);
- }
- PMA192_mul(pT, pZ6, ECP_B(pECC)); // R = X^3 +a*X*Z^4 + b*Z^6
- PMA192_add(pR, pR, pT);
-
- }
- /* case Z == 1 */
- else {
- if( ECP_AMI3(pECC) ) {
- PMA192_add(pT, ECP_POINT_X(pPoint), ECP_POINT_X(pPoint)); // R = X^3 +a*X
- PMA192_add(pT, pT, ECP_POINT_X(pPoint));
- PMA192_sub(pR, pR, pT);
- }
- else {
- PMA192_mul(pT, ECP_POINT_X(pPoint), ECP_A(pECC)); // R = X^3 +a*X
- PMA192_add(pR, pR, pT);
- }
- PMA192_add(pR, pR, ECP_B(pECC)); // R = X^3 +a*X + b
- }
- PMA192_sqr(pT, ECP_POINT_Y(pPoint)); // T = Y^2
- return 0==cpBN_cmp(pR, pT);
- }
-}
-
-/*
-// ECCP192_ComparePoint
-//
-// Compare two points:
-// returns 0 => pP==pQ (maybe both pP and pQ are at Infinity)
-// returns 1 => pP!=pQ
-//
-// Note
-// In general we check:
-// P_X*Q_Z^2 ~ Q_X*P_Z^2
-// P_Y*Q_Z^3 ~ Q_Y*P_Z^3
-*/
-int ECCP192_ComparePoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- UNREFERENCED_PARAMETER(pECC);
-
- /* P or/and Q at Infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- return ECCP_IsPointAtInfinity(pQ)? 0:1;
- if( ECCP_IsPointAtInfinity(pQ) )
- return ECCP_IsPointAtInfinity(pP)? 0:1;
-
- /* (P_Z==1) && (Q_Z==1) */
- if( ECP_POINT_AFFINE(pP) && ECP_POINT_AFFINE(pQ) )
- return ((0==cpBN_cmp(ECP_POINT_X(pP),ECP_POINT_X(pQ))) && (0==cpBN_cmp(ECP_POINT_Y(pP),ECP_POINT_Y(pQ))))? 0:1;
-
- {
- IppsBigNumState* pPtmp = cpBigNumListGet(&pList);
- IppsBigNumState* pQtmp = cpBigNumListGet(&pList);
- IppsBigNumState* pPZ = cpBigNumListGet(&pList);
- IppsBigNumState* pQZ = cpBigNumListGet(&pList);
-
- /* P_X*Q_Z^2 ~ Q_X*P_Z^2 */
- if( !ECP_POINT_AFFINE(pQ) ) {
- PMA192_sqr(pQZ, ECP_POINT_Z(pQ)); /* Ptmp = P_X*Q_Z^2 */
- PMA192_mul(pPtmp, ECP_POINT_X(pP), pQZ);
- }
- else {
- PMA_set(pPtmp, ECP_POINT_X(pP));
- }
- if( !ECP_POINT_AFFINE(pP) ) {
- PMA192_sqr(pPZ, ECP_POINT_Z(pP)); /* Qtmp = Q_X*P_Z^2 */
- PMA192_mul(pQtmp, ECP_POINT_X(pQ), pPZ);
- }
- else {
- PMA_set(pQtmp, ECP_POINT_X(pQ));
- }
- if ( cpBN_cmp(pPtmp, pQtmp) )
- return 1; /* points are different: (P_X*Q_Z^2) != (Q_X*P_Z^2) */
-
- /* P_Y*Q_Z^3 ~ Q_Y*P_Z^3 */
- if( !ECP_POINT_AFFINE(pQ) ) {
- PMA192_mul(pQZ, pQZ, ECP_POINT_Z(pQ)); /* Ptmp = P_Y*Q_Z^3 */
- PMA192_mul(pPtmp, ECP_POINT_Y(pP), pQZ);
- }
- else {
- PMA_set(pPtmp, ECP_POINT_Y(pP));
- }
- if( !ECP_POINT_AFFINE(pP) ) {
- PMA192_mul(pPZ, pPZ, ECP_POINT_Z(pP)); /* Qtmp = Q_Y*P_Z^3 */
- PMA192_mul(pQtmp, ECP_POINT_Y(pQ), pPZ);
- }
- else {
- PMA_set(pQtmp, ECP_POINT_Y(pQ));
- }
- return cpBN_cmp(pPtmp, pQtmp)? 1:0;
- }
-}
-
-/*
-// ECCP192_NegPoint
-//
-// Negative point
-*/
-void ECCP192_NegPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
-
- /* test point at Infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- ECCP_SetPointToInfinity(pR);
-
- else {
- BNU_CHUNK_T* pRy = BN_NUMBER(ECP_POINT_Y(pR));
- BNU_CHUNK_T* pPy = BN_NUMBER(ECP_POINT_Y(pP));
- int size = LEN_P192;
-
- if( pP!=pR ) {
- PMA_set(ECP_POINT_X(pR), ECP_POINT_X(pP));
- PMA_set(ECP_POINT_Z(pR), ECP_POINT_Z(pP));
- ECP_POINT_AFFINE(pR) = ECP_POINT_AFFINE(pP);
- }
- cpSub_BNU(pRy, (BNU_CHUNK_T*)secp192r1_p, pPy, LEN_P192);
- FIX_BNU(pRy,size);
- BN_SIZE(ECP_POINT_Y(pR)) = size;
- BN_SIGN(ECP_POINT_Y(pR)) = ippBigNumPOS;
- }
-}
-
-/*
-// ECCP192_DblPoint
-//
-// Double point
-*/
-void ECCP192_DblPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* P at infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- ECCP_SetPointToInfinity(pR);
-
- else {
- IppsBigNumState* bnV = cpBigNumListGet(&pList);
- IppsBigNumState* bnU = cpBigNumListGet(&pList);
- IppsBigNumState* bnM = cpBigNumListGet(&pList);
- IppsBigNumState* bnS = cpBigNumListGet(&pList);
- IppsBigNumState* bnT = cpBigNumListGet(&pList);
-
- /* M = 3*X^2 + A*Z^4 */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA192_sqr(bnU, ECP_POINT_X(pP));
- PMA192_add(bnM, bnU, bnU);
- PMA192_add(bnM, bnM, bnU);
- PMA192_add(bnM, bnM, ECP_A(pECC));
- }
- else if( ECP_AMI3(pECC) ) {
- PMA192_sqr(bnU, ECP_POINT_Z(pP));
- PMA192_add(bnS, ECP_POINT_X(pP), bnU);
- PMA192_sub(bnT, ECP_POINT_X(pP), bnU);
- PMA192_mul(bnM, bnS, bnT);
- PMA192_add(bnU, bnM, bnM);
- PMA192_add(bnM, bnU, bnM);
- }
- else {
- PMA192_sqr(bnU, ECP_POINT_X(pP));
- PMA192_add(bnM, bnU, bnU);
- PMA192_add(bnM, bnM, bnU);
- PMA192_sqr(bnU, ECP_POINT_Z(pP));
- PMA192_sqr(bnU, bnU);
- PMA192_mul(bnU, bnU, ECP_A(pECC));
- PMA192_add(bnM, bnM, bnU);
- }
-
- PMA192_add(bnV, ECP_POINT_Y(pP), ECP_POINT_Y(pP));
-
- /* R_Z = 2*Y*Z */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(ECP_POINT_Z(pR), bnV);
- }
- else {
- PMA192_mul(ECP_POINT_Z(pR), bnV, ECP_POINT_Z(pP));
- }
-
- /* S = 4*X*Y^2 */
- PMA192_sqr(bnT, bnV);
- PMA192_mul(bnS, bnT, ECP_POINT_X(pP));
-
- /* R_X = M^2 - 2*S */
- PMA192_sqr(bnU, bnM);
- PMA192_sub(bnU, bnU, bnS);
- PMA192_sub(ECP_POINT_X(pR), bnU, bnS);
-
- /* T = 8*Y^4 */
- PMA192_mul(bnV, bnV, ECP_POINT_Y(pP));
- PMA192_mul(bnT, bnT, bnV);
-
- /* R_Y = M*(S - R_X) - T */
- PMA192_sub(bnS, bnS, ECP_POINT_X(pR));
- PMA192_mul(bnS, bnS, bnM);
- PMA192_sub(ECP_POINT_Y(pR), bnS, bnT);
-
- ECP_POINT_AFFINE(pR) = 0;
- }
-}
-
-/*
-// ECCP192_AddPoint
-//
-// Add points
-*/
-void ECCP192_AddPoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
-#if 0
- /* test stupid call */
- if( pP == pQ ) {
- ECCP192_DblPoint(pP, pR, pECC, pList);
- return;
- }
-#endif
-
- /* prevent operation with point at Infinity */
- if( ECCP_IsPointAtInfinity(pP) ) {
- ECCP_CopyPoint(pQ, pR);
- return;
- }
- if( ECCP_IsPointAtInfinity(pQ) ) {
- ECCP_CopyPoint(pP, pR);
- return;
- }
-
- /*
- // addition
- */
- {
- IppsBigNumState* bnU0 = cpBigNumListGet(&pList);
- IppsBigNumState* bnS0 = cpBigNumListGet(&pList);
- IppsBigNumState* bnU1 = cpBigNumListGet(&pList);
- IppsBigNumState* bnS1 = cpBigNumListGet(&pList);
- IppsBigNumState* bnW = cpBigNumListGet(&pList);
- IppsBigNumState* bnR = cpBigNumListGet(&pList);
- IppsBigNumState *bnT = bnU0;
- IppsBigNumState *bnM = bnS0;
-
- /* U0 = P_X * Q_Z^2 */
- /* S0 = P_Y * Q_Z^3 */
- if( ECP_POINT_AFFINE(pQ) ) {
- PMA_set(bnU0, ECP_POINT_X(pP));
- PMA_set(bnS0, ECP_POINT_Y(pP));
- }
- else {
- PMA192_sqr(bnW, ECP_POINT_Z(pQ));
- PMA192_mul(bnU0,ECP_POINT_X(pP), bnW);
- PMA192_mul(bnW, ECP_POINT_Z(pQ), bnW);
- PMA192_mul(bnS0,ECP_POINT_Y(pP), bnW);
- }
-
- /* U1 = Q_X * P_Z^2 */
- /* S1 = Q_Y * P_Z^3 */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(bnU1, ECP_POINT_X(pQ));
- PMA_set(bnS1, ECP_POINT_Y(pQ));
- }
- else {
- PMA192_sqr(bnW, ECP_POINT_Z(pP));
- PMA192_mul(bnU1,ECP_POINT_X(pQ), bnW);
- PMA192_mul(bnW, ECP_POINT_Z(pP), bnW);
- PMA192_mul(bnS1,ECP_POINT_Y(pQ), bnW);
- }
-
- /* W = U0-U1 */
- /* R = S0-S1 */
- PMA192_sub(bnW, bnU0, bnU1);
- PMA192_sub(bnR, bnS0, bnS1);
-
- //if( IsZero_BN(bnW) ) {
- //if( IsZero_BN(bnR) ) {
- if(cpEqu_BNU_CHUNK(BN_NUMBER(bnW), LEN_P192, 0)) {
- if(cpEqu_BNU_CHUNK(BN_NUMBER(bnR), LEN_P192, 0)) {
- ECCP192_DblPoint(pP, pR, pECC, pList);
- return;
- }
- else {
- ECCP_SetPointToInfinity(pR);
- return;
- }
- }
-
- /* T = U0+U1 */
- /* M = S0+S1 */
- PMA192_add(bnT, bnU0, bnU1);
- PMA192_add(bnM, bnS0, bnS1);
-
- /* R_Z = P_Z * Q_Z * W */
- if( ECP_POINT_AFFINE(pQ) && ECP_POINT_AFFINE(pP) ) {
- PMA_set(ECP_POINT_Z(pR), bnW);
- }
- else {
- if( ECP_POINT_AFFINE(pQ) ) {
- PMA_set(bnU1, ECP_POINT_Z(pP));
- }
- else if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(bnU1, ECP_POINT_Z(pQ));
- }
- else {
- PMA192_mul(bnU1, ECP_POINT_Z(pP), ECP_POINT_Z(pQ));
- }
- PMA192_mul(ECP_POINT_Z(pR), bnU1, bnW);
- }
-
- PMA192_sqr(bnU1, bnW); /* U1 = W^2 */
- PMA192_mul(bnS1, bnT, bnU1); /* S1 = T * W^2 */
-
- /* R_X = R^2 - T * W^2 */
- PMA192_sqr(ECP_POINT_X(pR), bnR);
- PMA192_sub(ECP_POINT_X(pR), ECP_POINT_X(pR), bnS1);
-
- /* V = T * W^2 - 2 * R_X (S1) */
- PMA192_sub(bnS1, bnS1, ECP_POINT_X(pR));
- PMA192_sub(bnS1, bnS1, ECP_POINT_X(pR));
-
- /* R_Y = (V * R - M * W^3) /2 */
- PMA192_mul(ECP_POINT_Y(pR), bnS1, bnR);
- PMA192_mul(bnU1, bnU1, bnW);
- PMA192_mul(bnU1, bnU1, bnM);
- PMA192_sub(bnU1, ECP_POINT_Y(pR), bnU1);
- PMA192_div2(ECP_POINT_Y(pR), bnU1);
-
- ECP_POINT_AFFINE(pR) = 0;
- }
-}
-
-/*
-// ECCP192_MulPoint
-//
-// Multiply point by scalar
-*/
-#if !defined (_USE_ECCP_SSCM_)
-void ECCP192_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnN,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalar or input point at Infinity */
- if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) {
- ECCP_SetPointToInfinity(pR);
- return;
- }
-
- /*
- // scalar multiplication
- */
- else {
- IppsECCPPointState T;
- IppsECCPPointState U;
- IppsBigNumState* bnKH = cpBigNumListGet(&pList);
- Ipp32u* pK;
- Ipp32u* pH;
- Ipp32u carry;
- int lenKH;
- int bitH;
-
- /* init result */
- ECCP_CopyPoint(pP, pR);
-
- /* if scalar is negative */
- if( ippBigNumNEG == BN_SIGN(bnN) ) {
- /* negative R */
- ECCP192_NegPoint(pR, pR, pECC);
- }
-
- /* copy K = N and compute H=3*K */
- lenKH = BN_SIZE(bnN)+1;
- pK = BN_NUMBER(bnKH);
- pH = BN_BUFFER(bnKH);
- Cpy_BNU(BN_NUMBER(bnN), pK, BN_SIZE(bnN));
- pK[lenKH-1] = 0;
- carry = cpAdd_BNU(pH, pK, pK, lenKH);
- carry = cpAdd_BNU(pH, pK, pH, lenKH);
-
- /* init temporary T = (X/Z^2, Y/Z^3, 1) */
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
- ECCP192_GetPointAffine(ECP_POINT_X(&T), ECP_POINT_Y(&T), pR, pECC, pList);
- ECCP192_SetPointAffine(ECP_POINT_X(&T), ECP_POINT_Y(&T), &T, pECC);
-
- /* temporary point U =-T */
- ECP_POINT_X(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&U) = cpBigNumListGet(&pList);
- //ECCP192_NegPoint(&T, &U, pECC);
- ECCP_NegPoint(&T, &U, pECC);
-
- for(bitH=MSB_BNU(pH, lenKH)-1; bitH>0; bitH--) {
- int hBit = TST_BIT(pH, bitH);
- int kBit = TST_BIT(pK, bitH);
- ECCP192_DblPoint(pR, pR, pECC, pList);
- if( hBit && !kBit )
- ECCP192_AddPoint(pR, &T, pR, pECC, pList);
- if(!hBit && kBit )
- ECCP192_AddPoint(pR, &U, pR, pECC, pList);
- }
- }
-}
-
-#else
-#pragma message ("ECCP192_MulPoint: SCCM version")
-
-void ECCP192_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnN,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalar or input point at Infinity */
- if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) {
- ECCP_SetPointToInfinity(pR);
- return;
- }
-
- /*
- // scalar multiplication
- */
- else {
- Ipp8u* pScratchAligned = ECP_SCCMBUFF(pECC);
-
- BNU_CHUNK_T* pN = BN_NUMBER(bnN);
- cpSize nsN = BN_SIZE(bnN);
- /* scalar bitsize */
- int scalarBitSize = BITSIZE_BNU(pN, nsN);
- /* optimal size of window */
- int w = cpECCP_OptimalWinSize(scalarBitSize);
- /* number of table entries */
- int nPrecomputed = 1<<w;
-
- /* allocate temporary scalar */
- IppsBigNumState* bnTN = cpBigNumListGet(&pList);
- BNU_CHUNK_T* pTN = BN_NUMBER(bnTN);
-
- int coordSize = BITS_BNU_CHUNK(ECP_GFEBITS(pECC));
- IppsECCPPointState T;
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
- ECCP_SetPointToInfinity(&T);
-
- /* init result */
- ECCP_CopyPoint(pP, pR);
- if( ippBigNumNEG == BN_SIGN(bnN) )
- ECCP192_NegPoint(pR, pR, pECC);
-
- /* pre-compute auxiliary table t[] = {(2^w)*P, 1*P, 2*P, ..., (2^(w-1))*P} */
- {
- int n;
- for(n=1; n<nPrecomputed; n++) {
- ECCP192_AddPoint(pR, &T, &T, pECC, pList);
- cpECCP_ScramblePut(pScratchAligned+n, nPrecomputed, &T, coordSize);
- }
- ECCP192_AddPoint(pR, &T, &T, pECC, pList);
- cpECCP_ScramblePut(pScratchAligned, nPrecomputed, &T, coordSize);
- }
-
- /* copy scalar */
- cpCpy_BNU(pTN, pN, nsN);
- /* and convert it presentaion to avoid usage of O point */
- scalarBitSize = cpECCP_ConvertRepresentation(pTN, scalarBitSize, w);
-
- /* prepare temporary scalar for processing */
- pTN[BITS_BNU_CHUNK(scalarBitSize)] = 0;
- scalarBitSize = ((scalarBitSize+w-1)/w)*w;
-
- /*
- // scalar multiplication
- */
- {
- Ipp32u dmask = nPrecomputed-1;
-
- /* position (bit number) of the leftmost window */
- int wPosition = scalarBitSize-w;
-
- /* extract leftmost window value */
- Ipp32u eChunk = *((Ipp32u*)((Ipp16u*)pTN + wPosition/BITSIZE(Ipp16u)));
- int shift = wPosition & 0xF;
- Ipp32u windowVal = (eChunk>>shift) & dmask;
-
- /* initialize result (ECP_FINITE_POINT|ECP_PROJECTIVE) */
- cpECCP_ScrambleGet(pR, coordSize, pScratchAligned+windowVal, nPrecomputed);
- ECP_POINT_AFFINE(pR) = 0;
-
- /* initialize temporary T (ECP_PROJECTIVE) */
- ECP_POINT_AFFINE(&T) = 0;
-
- for(wPosition-=w; wPosition>=0; wPosition-=w) {
- /* w times doubling */
- int k;
- for(k=0; k<w; k++)
- ECCP192_DblPoint(pR, pR, pECC, pList);
-
- /* extract next window value */
- eChunk = *((Ipp32u*)((Ipp16u*)pTN + wPosition/BITSIZE(Ipp16u)));
- shift = wPosition & 0xF;
- windowVal = (eChunk>>shift) & dmask;
-
- /* extract value from the pre-computed table */
- cpECCP_ScrambleGet(&T, coordSize, pScratchAligned+windowVal, nPrecomputed);
-
- /* and add it */
- ECCP192_AddPoint(pR, &T, pR, pECC, pList);
- }
- }
- }
-}
-#endif
-
-void ECCP192_MulBasePoint(const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- ECCP192_MulPoint(ECP_GENC(pECC), pK, pR, pECC, pList);
-}
-
-/*
-// ECCP192_ProdPoint
-//
-// Point product
-*/
-#if !defined (_USE_ECCP_SSCM_)
-void ECCP192_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalars */
- if( IsZero_BN(bnPscalar) ) {
- ECCP192_MulPoint(pQ, bnQscalar, pR, pECC, pList);
- return;
- }
- if( IsZero_BN(bnQscalar) ) {
- ECCP192_MulPoint(pP, bnPscalar, pR, pECC, pList);
- return;
- }
-
- /*
- // point product
- */
- else {
- int n;
- Ipp32u* pbnPscalar = BN_NUMBER(bnPscalar);
- int bnPscalarSize = BN_SIZE(bnPscalar);
- Ipp32u* pbnQscalar = BN_NUMBER(bnQscalar);
- int bnQscalarSize = BN_SIZE(bnQscalar);
-
- int size = bnPscalarSize>bnQscalarSize? bnPscalarSize : bnQscalarSize;
-
- IppsECCPPointState* pPointPQ[4] = {NULL, NULL, NULL, NULL};
-
- /* allocate temporary PQ point */
- IppsECCPPointState PQ;
- ECP_POINT_X(&PQ) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&PQ) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&PQ) = cpBigNumListGet(&pList);
-
- /* init temporary point array */
- if(ippBigNumPOS == BN_SIGN(bnPscalar))
- pPointPQ[1] = (IppsECCPPointState*)pP;
- else {
- IppsECCPPointState P;
- ECP_POINT_X(&P) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&P) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&P) = cpBigNumListGet(&pList);
- ECCP192_NegPoint(pP, &P, pECC);
- pPointPQ[1] = &P;
- }
- if(ippBigNumPOS == BN_SIGN(bnQscalar))
- pPointPQ[2] = (IppsECCPPointState*)pQ;
- else {
- IppsECCPPointState Q;
- ECP_POINT_X(&Q) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&Q) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&Q) = cpBigNumListGet(&pList);
- ECCP192_NegPoint(pQ, &Q, pECC);
- pPointPQ[2] = &Q;
- }
-
- ECCP192_AddPoint(pPointPQ[1], pPointPQ[2], &PQ, pECC, pList);
- ECCP192_GetPointAffine(ECP_POINT_X(pR), ECP_POINT_Y(pR), &PQ, pECC, pList);
- ECCP192_SetPointAffine(ECP_POINT_X(pR), ECP_POINT_Y(pR), &PQ, pECC);
- pPointPQ[3] = &PQ;
-
- /* pad scalars by zeros */
- ZEXPAND_BNU(pbnPscalar,bnPscalarSize, size);
- ZEXPAND_BNU(pbnQscalar,bnQscalarSize, size);
-
- /* init result */
- ECCP_SetPointToInfinity(pR);
-
- for(n=size; n>0; n--) {
- Ipp32u scalarPn = pbnPscalar[n-1];
- Ipp32u scalarQn = pbnQscalar[n-1];
-
- int nBit;
- for(nBit=31; nBit>=0; nBit--) {
- int
- PnQnBits = scalarPn&0x80000000? 1:0;
- PnQnBits+= scalarQn&0x80000000? 2:0;
-
- if( !ECCP_IsPointAtInfinity(pR) )
- ECCP192_DblPoint(pR, pR, pECC, pList);
- if( PnQnBits )
- ECCP192_AddPoint(pR, pPointPQ[PnQnBits], pR, pECC, pList);
-
- scalarPn <<= 1;
- scalarQn <<= 1;
- }
- }
- }
-}
-
-#else
-#pragma message ("ECCP192_ProdPoint: SCCM version")
-
-void ECCP192_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- IppsECCPPointState T;
- IppsECCPPointState U;
-
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
-
- ECP_POINT_X(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&U) = cpBigNumListGet(&pList);
-
- ECCP192_MulPoint(pP, bnPscalar, &T, (IppsECCPState*)pECC, pList);
- ECCP192_MulPoint(pQ, bnQscalar, &U, (IppsECCPState*)pECC, pList);
- ECCP192_AddPoint(&T, &U, pR, pECC, pList);
-}
-#endif
-
-#endif /* _ECP_192_==_ECP_IMPL_SPECIFIC_ */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpmethod224.h b/ext/ipp/sources/ippcp/src/pcpeccpmethod224.h
deleted file mode 100644
index 97d910c..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpmethod224.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Definitions of EC methods over GF(P224)
-//
-//
-*/
-
-#if !defined(_PCP_ECCPMETHOD224_H)
-#define _PCP_ECCPMETHOD224_H
-
-#include "pcpeccp.h"
-
-
-/*
-// Returns reference
-*/
-ECCP_METHOD* ECCP224_Methods(void);
-
-
-/*
-// Point Set. These operations implies
-// transformation of regular coordinates into internal format
-*/
-void ECCP224_SetPointProjective(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- const IppsBigNumState* pZ,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC);
-
-void ECCP224_SetPointAffine(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC);
-
-/*
-// Get Point. These operations implies
-// transformation of internal format coordinates into regular
-*/
-//void ECCP224_GetPointProjective(IppsBigNumState* pX,
-// IppsBigNumState* pY,
-// IppsBigNumState* pZ,
-// const IppsECCPPointState* pPoint,
-// const IppsECCPState* pECC);
-
-void ECCP224_GetPointAffine(IppsBigNumState* pX,
- IppsBigNumState* pY,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-/*
-// Test is On EC
-*/
-int ECCP224_IsPointOnCurve(const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-/*
-// Operations
-*/
-int ECCP224_ComparePoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP224_NegPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC);
-
-void ECCP224_DblPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP224_AddPoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP224_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP224_MulBasePoint(const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP224_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-#endif /* _PCP_ECCPMETHOD224_H */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpmethod224ca.c b/ext/ipp/sources/ippcp/src/pcpeccpmethod224ca.c
deleted file mode 100644
index dbd0462..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpmethod224ca.c
+++ /dev/null
@@ -1,877 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// EC methods over GF(P224)
-//
-// Contents:
-// ECCP224_SetPointProjective()
-// ECCP224_SetPointAffine()
-// ECCP224_GetPointAffine()
-//
-// ECCP224_IsPointOnCurve()
-//
-// ECCP224_ComparePoint()
-// ECCP224_NegPoint()
-// ECCP224_DblPoint()
-// ECCP224_AddPoint()
-// ECCP224_MulPoint()
-// ECCP224_ProdPoint()
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-
-#if (_ECP_224_==_ECP_IMPL_SPECIFIC_)
-#include "pcpeccppoint.h"
-#include "pcpeccpmethod.h"
-#include "pcpeccpmethodcom.h"
-#include "pcpeccpmethod224.h"
-#include "pcppma224.h"
-
-/*
- NOTE:
- ECCP224 methods are used representation of point coordinates
- in regular (usual residue) domain, because of special modular reduction
-*/
-static
-ECCP_METHOD ECCP224 = {
- ECCP224_SetPointProjective,
- ECCP224_SetPointAffine,
- ECCP224_GetPointAffine,
-
- ECCP224_IsPointOnCurve,
-
- ECCP224_ComparePoint,
- ECCP224_NegPoint,
- ECCP224_DblPoint,
- ECCP224_AddPoint,
- ECCP224_MulPoint,
- ECCP224_MulBasePoint,
- ECCP224_ProdPoint
-};
-
-
-/*
-// Returns reference
-*/
-ECCP_METHOD* ECCP224_Methods(void)
-{
- return &ECCP224;
-}
-
-/*
-// ECCP224_PoinSettProjective
-// Converts regular projective triplet (pX,pY,pZ) into pPoint
-// (see note above)
-*/
-void ECCP224_SetPointProjective(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- const IppsBigNumState* pZ,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
- cpBN_copy(ECP_POINT_X(pPoint), pX);
- cpBN_copy(ECP_POINT_Y(pPoint), pY);
- cpBN_copy(ECP_POINT_Z(pPoint), pZ);
- ECP_POINT_AFFINE(pPoint) = cpBN_cmp(pZ, BN_ONE_REF())==0;
-}
-
-/*
-// ECCP224_PointAffineSet
-// Converts regular affine pair (pX,pY) into pPoint
-*/
-void ECCP224_SetPointAffine(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- ECCP224_SetPointProjective(pX, pY, BN_ONE_REF(), pPoint, pECC);
-}
-
-/*
-// ECCP224_GetPointProjective
-// Converts pPoint into regular projective triplet (pX,pY,pZ)
-*/
-#if 0
-void ECCP224_GetPointProjective(IppsBigNumState* pX,
- IppsBigNumState* pY,
- IppsBigNumState* pZ,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
- cpBN_copy(pX, ECP_POINT_X(pPoint));
- cpBN_copy(pY, ECP_POINT_Y(pPoint));
- cpBN_copy(pZ, ECP_POINT_Z(pPoint));
-}
-#endif
-
-/*
-// ECCP224_GetPointAffine
-//
-// Converts pPoint into regular affine pair (pX,pY)
-//
-// Note:
-// pPoint is not point at Infinity
-// transform (X, Y, Z) into (x, y) = (X/Z^2, Y/Z^3)
-*/
-void ECCP224_GetPointAffine(IppsBigNumState* pX, IppsBigNumState* pY,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* case Z == 1 */
- if( ECP_POINT_AFFINE(pPoint) ) {
- if(pX) {
- cpBN_copy(pX, ECP_POINT_X(pPoint));
- }
- if(pY) {
- cpBN_copy(pY, ECP_POINT_Y(pPoint));
- }
- }
-
- /* case Z != 1 */
- else {
- //IppsMontState* pMont = ECP_PMONT(pECC);
- IppsBigNumState* pModulo = ECP_PRIME(pECC);
-
- IppsBigNumState* pT = cpBigNumListGet(&pList);
- IppsBigNumState* pU = cpBigNumListGet(&pList);
- //IppsBigNumState* pModulo = cpBigNumListGet(&pList);
- //BN_Set(MNT_MODULUS(pMont), MNT_SIZE(pMont), pModulo);
-
- /* U = 1/Z */
- PMA224_inv(pU, ECP_POINT_Z(pPoint), pModulo);
- /* T = 1/(Z^2) */
- PMA224_sqr(pT, pU);
-
- if(pX) {
- PMA224_mul(pX,pT, ECP_POINT_X(pPoint));
- }
- if(pY) {
- /* U = 1/(Z^3) */
- PMA224_mul(pU, pU, pT);
- PMA224_mul(pY,pU, ECP_POINT_Y(pPoint));
- }
- }
-}
-
-/*
-// ECCP224_IsPointOnCurve
-//
-// Test point is lie on curve
-//
-// Note
-// We deal with equation: y^2 = x^3 + A*x + B.
-// Or in projective coordinates: Y^2 = X^3 + a*X*Z^4 + b*Z^6.
-// The point under test is given by projective triplet (X,Y,Z),
-// which represents actually (x,y) = (X/Z^2,Y/Z^3).
-*/
-int ECCP224_IsPointOnCurve(const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* let think Infinity point is on the curve */
- if( ECCP_IsPointAtInfinity(pPoint) )
- return 1;
-
- else {
- IppsBigNumState* pR = cpBigNumListGet(&pList);
- IppsBigNumState* pT = cpBigNumListGet(&pList);
-
- PMA224_sqr(pR, ECP_POINT_X(pPoint)); // R = X^3
- PMA224_mul(pR, pR, ECP_POINT_X(pPoint));
-
- /* case Z != 1 */
- if( !ECP_POINT_AFFINE(pPoint) ) {
- IppsBigNumState* pZ4 = cpBigNumListGet(&pList);
- IppsBigNumState* pZ6 = cpBigNumListGet(&pList);
- PMA224_sqr(pT, ECP_POINT_Z(pPoint)); // Z^2
- PMA224_sqr(pZ4, pT); // Z^4
- PMA224_mul(pZ6, pZ4, pT); // Z^6
-
- PMA224_mul(pT, pZ4, ECP_POINT_X(pPoint)); // T = X*Z^4
- if( ECP_AMI3(pECC) ) {
- IppsBigNumState* pU = cpBigNumListGet(&pList);
- PMA224_add(pU, pT, pT); // R = X^3 +a*X*Z^4
- PMA224_add(pU, pU, pT);
- PMA224_sub(pR, pR, pU);
- }
- else {
- PMA224_mul(pT, pT, ECP_A(pECC)); // R = X^3 +a*X*Z^4
- PMA224_add(pR, pR, pT);
- }
- PMA224_mul(pT, pZ6, ECP_B(pECC)); // R = X^3 +a*X*Z^4 + b*Z^6
- PMA224_add(pR, pR, pT);
-
- }
- /* case Z == 1 */
- else {
- if( ECP_AMI3(pECC) ) {
- PMA224_add(pT, ECP_POINT_X(pPoint), ECP_POINT_X(pPoint)); // R = X^3 +a*X
- PMA224_add(pT, pT, ECP_POINT_X(pPoint));
- PMA224_sub(pR, pR, pT);
- }
- else {
- PMA224_mul(pT, ECP_POINT_X(pPoint), ECP_A(pECC)); // R = X^3 +a*X
- PMA224_add(pR, pR, pT);
- }
- PMA224_add(pR, pR, ECP_B(pECC)); // R = X^3 +a*X + b
- }
- PMA224_sqr(pT, ECP_POINT_Y(pPoint)); // T = Y^2
- return 0==cpBN_cmp(pR, pT);
- }
-}
-
-/*
-// ECCP224_ComparePoint
-//
-// Compare two points:
-// returns 0 => pP==pQ (maybe both pP and pQ are at Infinity)
-// returns 1 => pP!=pQ
-//
-// Note
-// In general we check:
-// P_X*Q_Z^2 ~ Q_X*P_Z^2
-// P_Y*Q_Z^3 ~ Q_Y*P_Z^3
-*/
-int ECCP224_ComparePoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- UNREFERENCED_PARAMETER(pECC);
-
- /* P or/and Q at Infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- return ECCP_IsPointAtInfinity(pQ)? 0:1;
- if( ECCP_IsPointAtInfinity(pQ) )
- return ECCP_IsPointAtInfinity(pP)? 0:1;
-
- /* (P_Z==1) && (Q_Z==1) */
- if( ECP_POINT_AFFINE(pP) && ECP_POINT_AFFINE(pQ) )
- return ((0==cpBN_cmp(ECP_POINT_X(pP),ECP_POINT_X(pQ))) && (0==cpBN_cmp(ECP_POINT_Y(pP),ECP_POINT_Y(pQ))))? 0:1;
-
- {
- IppsBigNumState* pPtmp = cpBigNumListGet(&pList);
- IppsBigNumState* pQtmp = cpBigNumListGet(&pList);
- IppsBigNumState* pPZ = cpBigNumListGet(&pList);
- IppsBigNumState* pQZ = cpBigNumListGet(&pList);
-
- /* P_X*Q_Z^2 ~ Q_X*P_Z^2 */
- if( !ECP_POINT_AFFINE(pQ) ) {
- PMA224_sqr(pQZ, ECP_POINT_Z(pQ)); /* Ptmp = P_X*Q_Z^2 */
- PMA224_mul(pPtmp, ECP_POINT_X(pP), pQZ);
- }
- else {
- PMA_set(pPtmp, ECP_POINT_X(pP));
- }
- if( !ECP_POINT_AFFINE(pP) ) {
- PMA224_sqr(pPZ, ECP_POINT_Z(pP)); /* Qtmp = Q_X*P_Z^2 */
- PMA224_mul(pQtmp, ECP_POINT_X(pQ), pPZ);
- }
- else {
- PMA_set(pQtmp, ECP_POINT_X(pQ));
- }
- if ( cpBN_cmp(pPtmp, pQtmp) )
- return 1; /* points are different: (P_X*Q_Z^2) != (Q_X*P_Z^2) */
-
- /* P_Y*Q_Z^3 ~ Q_Y*P_Z^3 */
- if( !ECP_POINT_AFFINE(pQ) ) {
- PMA224_mul(pQZ, pQZ, ECP_POINT_Z(pQ)); /* Ptmp = P_Y*Q_Z^3 */
- PMA224_mul(pPtmp, ECP_POINT_Y(pP), pQZ);
- }
- else {
- PMA_set(pPtmp, ECP_POINT_Y(pP));
- }
- if( !ECP_POINT_AFFINE(pP) ) {
- PMA224_mul(pPZ, pPZ, ECP_POINT_Z(pP)); /* Qtmp = Q_Y*P_Z^3 */
- PMA224_mul(pQtmp, ECP_POINT_Y(pQ), pPZ);
- }
- else {
- PMA_set(pQtmp, ECP_POINT_Y(pQ));
- }
- return cpBN_cmp(pPtmp, pQtmp)? 1:0;
- }
-}
-
-/*
-// ECCP224_NegPoint
-//
-// Negative point
-*/
-void ECCP224_NegPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
-
- /* test point at Infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- ECCP_SetPointToInfinity(pR);
-
- else {
- BNU_CHUNK_T* pRy = BN_NUMBER(ECP_POINT_Y(pR));
- BNU_CHUNK_T* pPy = BN_NUMBER(ECP_POINT_Y(pP));
- int size = LEN_P224;
-
- if( pP!=pR ) {
- PMA_set(ECP_POINT_X(pR), ECP_POINT_X(pP));
- PMA_set(ECP_POINT_Z(pR), ECP_POINT_Z(pP));
- ECP_POINT_AFFINE(pR) = ECP_POINT_AFFINE(pP);
- }
- cpSub_BNU(pRy, (BNU_CHUNK_T*)secp224r1_p, pPy, LEN_P224);
- FIX_BNU(pRy,size);
- BN_SIZE(ECP_POINT_Y(pR)) = size;
- BN_SIGN(ECP_POINT_Y(pR)) = ippBigNumPOS;
- }
-}
-
-/*
-// ECCP224_DblPoint
-//
-// Double point
-*/
-void ECCP224_DblPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* P at infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- ECCP_SetPointToInfinity(pR);
-
- else {
- IppsBigNumState* bnV = cpBigNumListGet(&pList);
- IppsBigNumState* bnU = cpBigNumListGet(&pList);
- IppsBigNumState* bnM = cpBigNumListGet(&pList);
- IppsBigNumState* bnS = cpBigNumListGet(&pList);
- IppsBigNumState* bnT = cpBigNumListGet(&pList);
-
- /* M = 3*X^2 + A*Z^4 */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA224_sqr(bnU, ECP_POINT_X(pP));
- PMA224_add(bnM, bnU, bnU);
- PMA224_add(bnM, bnM, bnU);
- PMA224_add(bnM, bnM, ECP_A(pECC));
- }
- else if( ECP_AMI3(pECC) ) {
- PMA224_sqr(bnU, ECP_POINT_Z(pP));
- PMA224_add(bnS, ECP_POINT_X(pP), bnU);
- PMA224_sub(bnT, ECP_POINT_X(pP), bnU);
- PMA224_mul(bnM, bnS, bnT);
- PMA224_add(bnU, bnM, bnM);
- PMA224_add(bnM, bnU, bnM);
- }
- else {
- PMA224_sqr(bnU, ECP_POINT_X(pP));
- PMA224_add(bnM, bnU, bnU);
- PMA224_add(bnM, bnM, bnU);
- PMA224_sqr(bnU, ECP_POINT_Z(pP));
- PMA224_sqr(bnU, bnU);
- PMA224_mul(bnU, bnU, ECP_A(pECC));
- PMA224_add(bnM, bnM, bnU);
- }
-
- PMA224_add(bnV, ECP_POINT_Y(pP), ECP_POINT_Y(pP));
-
- /* R_Z = 2*Y*Z */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(ECP_POINT_Z(pR), bnV);
- }
- else {
- PMA224_mul(ECP_POINT_Z(pR), bnV, ECP_POINT_Z(pP));
- }
-
- /* S = 4*X*Y^2 */
- PMA224_sqr(bnT, bnV);
- PMA224_mul(bnS, bnT, ECP_POINT_X(pP));
-
- /* R_X = M^2 - 2*S */
- PMA224_sqr(bnU, bnM);
- PMA224_sub(bnU, bnU, bnS);
- PMA224_sub(ECP_POINT_X(pR), bnU, bnS);
-
- /* T = 8*Y^4 */
- PMA224_mul(bnV, bnV, ECP_POINT_Y(pP));
- PMA224_mul(bnT, bnT, bnV);
-
- /* R_Y = M*(S - R_X) - T */
- PMA224_sub(bnS, bnS, ECP_POINT_X(pR));
- PMA224_mul(bnS, bnS, bnM);
- PMA224_sub(ECP_POINT_Y(pR), bnS, bnT);
-
- ECP_POINT_AFFINE(pR) = 0;
- }
-}
-
-/*
-// ECCP224_AddPoint
-//
-// Add points
-*/
-void ECCP224_AddPoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
-#if 0
- /* test stupid call */
- if( pP == pQ ) {
- ECCP224_DblPoint(pP, pR, pECC, pList);
- return;
- }
-#endif
-
- /* prevent operation with point at Infinity */
- if( ECCP_IsPointAtInfinity(pP) ) {
- ECCP_CopyPoint(pQ, pR);
- return;
- }
- if( ECCP_IsPointAtInfinity(pQ) ) {
- ECCP_CopyPoint(pP, pR);
- return;
- }
-
- /*
- // addition
- */
- {
- IppsBigNumState* bnU0 = cpBigNumListGet(&pList);
- IppsBigNumState* bnS0 = cpBigNumListGet(&pList);
- IppsBigNumState* bnU1 = cpBigNumListGet(&pList);
- IppsBigNumState* bnS1 = cpBigNumListGet(&pList);
- IppsBigNumState* bnW = cpBigNumListGet(&pList);
- IppsBigNumState* bnR = cpBigNumListGet(&pList);
- IppsBigNumState *bnT = bnU0;
- IppsBigNumState *bnM = bnS0;
-
- /* U0 = P_X * Q_Z^2 */
- /* S0 = P_Y * Q_Z^3 */
- if( ECP_POINT_AFFINE(pQ) ) {
- PMA_set(bnU0, ECP_POINT_X(pP));
- PMA_set(bnS0, ECP_POINT_Y(pP));
- }
- else {
- PMA224_sqr(bnW, ECP_POINT_Z(pQ));
- PMA224_mul(bnU0,ECP_POINT_X(pP), bnW);
- PMA224_mul(bnW, ECP_POINT_Z(pQ), bnW);
- PMA224_mul(bnS0,ECP_POINT_Y(pP), bnW);
- }
-
- /* U1 = Q_X * P_Z^2 */
- /* S1 = Q_Y * P_Z^3 */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(bnU1, ECP_POINT_X(pQ));
- PMA_set(bnS1, ECP_POINT_Y(pQ));
- }
- else {
- PMA224_sqr(bnW, ECP_POINT_Z(pP));
- PMA224_mul(bnU1,ECP_POINT_X(pQ), bnW);
- PMA224_mul(bnW, ECP_POINT_Z(pP), bnW);
- PMA224_mul(bnS1,ECP_POINT_Y(pQ), bnW);
- }
-
- /* W = U0-U1 */
- /* R = S0-S1 */
- PMA224_sub(bnW, bnU0, bnU1);
- PMA224_sub(bnR, bnS0, bnS1);
-
- //if( IsZero_BN(bnW) ) {
- //if( IsZero_BN(bnR) ) {
- if(cpEqu_BNU_CHUNK(BN_NUMBER(bnW), LEN_P224, 0)) {
- if(cpEqu_BNU_CHUNK(BN_NUMBER(bnR), LEN_P224, 0)) {
- ECCP224_DblPoint(pP, pR, pECC, pList);
- return;
- }
- else {
- ECCP_SetPointToInfinity(pR);
- return;
- }
- }
-
- /* T = U0+U1 */
- /* M = S0+S1 */
- PMA224_add(bnT, bnU0, bnU1);
- PMA224_add(bnM, bnS0, bnS1);
-
- /* R_Z = P_Z * Q_Z * W */
- if( ECP_POINT_AFFINE(pQ) && ECP_POINT_AFFINE(pP) ) {
- PMA_set(ECP_POINT_Z(pR), bnW);
- }
- else {
- if( ECP_POINT_AFFINE(pQ) ) {
- PMA_set(bnU1, ECP_POINT_Z(pP));
- }
- else if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(bnU1, ECP_POINT_Z(pQ));
- }
- else {
- PMA224_mul(bnU1, ECP_POINT_Z(pP), ECP_POINT_Z(pQ));
- }
- PMA224_mul(ECP_POINT_Z(pR), bnU1, bnW);
- }
-
- PMA224_sqr(bnU1, bnW); /* U1 = W^2 */
- PMA224_mul(bnS1, bnT, bnU1); /* S1 = T * W^2 */
-
- /* R_X = R^2 - T * W^2 */
- PMA224_sqr(ECP_POINT_X(pR), bnR);
- PMA224_sub(ECP_POINT_X(pR), ECP_POINT_X(pR), bnS1);
-
- /* V = T * W^2 - 2 * R_X (S1) */
- PMA224_sub(bnS1, bnS1, ECP_POINT_X(pR));
- PMA224_sub(bnS1, bnS1, ECP_POINT_X(pR));
-
- /* R_Y = (V * R - M * W^3) /2 */
- PMA224_mul(ECP_POINT_Y(pR), bnS1, bnR);
- PMA224_mul(bnU1, bnU1, bnW);
- PMA224_mul(bnU1, bnU1, bnM);
- PMA224_sub(bnU1, ECP_POINT_Y(pR), bnU1);
- PMA224_div2(ECP_POINT_Y(pR), bnU1);
-
- ECP_POINT_AFFINE(pR) = 0;
- }
-}
-
-/*
-// ECCP224_MulPoint
-//
-// Multiply point by scalar
-*/
-#if !defined (_USE_ECCP_SSCM_)
-void ECCP224_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnN,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalar or input point at Infinity */
- if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) {
- ECCP_SetPointToInfinity(pR);
- return;
- }
-
- /*
- // scalar multiplication
- */
- else {
- IppsECCPPointState T;
- IppsECCPPointState U;
- IppsBigNumState* bnKH = cpBigNumListGet(&pList);
- Ipp32u* pK;
- Ipp32u* pH;
- Ipp32u carry;
- int lenKH;
- int bitH;
-
- /* init result */
- ECCP_CopyPoint(pP, pR);
-
- /* if scalar is negative */
- if( ippBigNumNEG == BN_SIGN(bnN) ) {
- /* negative R */
- ECCP224_NegPoint(pR, pR, pECC);
- }
-
- /* copy K = N and compute H=3*K */
- lenKH = BN_SIZE(bnN)+1;
- pK = BN_NUMBER(bnKH);
- pH = BN_BUFFER(bnKH);
- Cpy_BNU(BN_NUMBER(bnN), pK, BN_SIZE(bnN));
- pK[lenKH-1] = 0;
- carry = cpAdd_BNU(pH, pK, pK, lenKH);
- carry = cpAdd_BNU(pH, pK, pH, lenKH);
-
- /* init temporary T = (X/Z^2, Y/Z^3, 1) */
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
- ECCP224_GetPointAffine(ECP_POINT_X(&T), ECP_POINT_Y(&T), pR, pECC, pList);
- ECCP224_SetPointAffine(ECP_POINT_X(&T), ECP_POINT_Y(&T), &T, pECC);
-
- /* temporary point U =-T */
- ECP_POINT_X(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&U) = cpBigNumListGet(&pList);
- ECCP224_NegPoint(&T, &U, pECC);
-
- for(bitH=MSB_BNU(pH, lenKH)-1; bitH>0; bitH--) {
- int hBit = TST_BIT(pH, bitH);
- int kBit = TST_BIT(pK, bitH);
- ECCP224_DblPoint(pR, pR, pECC, pList);
- if( hBit && !kBit )
- ECCP224_AddPoint(pR, &T, pR, pECC, pList);
- if(!hBit && kBit )
- ECCP224_AddPoint(pR, &U, pR, pECC, pList);
- }
- }
-}
-
-#else
-#pragma message ("ECCP224_MulPoint: SCCM version")
-
-void ECCP224_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnN,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalar or input point at Infinity */
- if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) {
- ECCP_SetPointToInfinity(pR);
- return;
- }
-
- /*
- // scalar multiplication
- */
- else {
- Ipp8u* pScratchAligned = ECP_SCCMBUFF(pECC);
-
- BNU_CHUNK_T* pN = BN_NUMBER(bnN);
- cpSize nsN = BN_SIZE(bnN);
- /* scalar bitsize */
- int scalarBitSize = BITSIZE_BNU(pN, nsN);
- /* optimal size of window */
- int w = cpECCP_OptimalWinSize(scalarBitSize);
- /* number of table entries */
- int nPrecomputed = 1<<w;
-
- /* allocate temporary scalar */
- IppsBigNumState* bnTN = cpBigNumListGet(&pList);
- BNU_CHUNK_T* pTN = BN_NUMBER(bnTN);
-
- int coordSize = BITS_BNU_CHUNK(ECP_GFEBITS(pECC));
- IppsECCPPointState T;
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
- ECCP_SetPointToInfinity(&T);
-
- /* init result */
- ECCP_CopyPoint(pP, pR);
- if( ippBigNumNEG == BN_SIGN(bnN) )
- ECCP224_NegPoint(pR, pR, pECC);
-
- /* pre-compute auxiliary table t[] = {(2^w)*P, 1*P, 2*P, ..., (2^(w-1))*P} */
- {
- int n;
- for(n=1; n<nPrecomputed; n++) {
- ECCP224_AddPoint(pR, &T, &T, pECC, pList);
- cpECCP_ScramblePut(pScratchAligned+n, nPrecomputed, &T, coordSize);
- }
- ECCP224_AddPoint(pR, &T, &T, pECC, pList);
- cpECCP_ScramblePut(pScratchAligned, nPrecomputed, &T, coordSize);
- }
-
- /* copy scalar */
- cpCpy_BNU(pTN, pN, nsN);
- /* and convert it presentaion to avoid usage of O point */
- scalarBitSize = cpECCP_ConvertRepresentation(pTN, scalarBitSize, w);
-
- /* prepare temporary scalar for processing */
- pTN[BITS_BNU_CHUNK(scalarBitSize)] = 0;
- scalarBitSize = ((scalarBitSize+w-1)/w)*w;
-
- /*
- // scalar multiplication
- */
- {
- Ipp32u dmask = nPrecomputed-1;
-
- /* position (bit number) of the leftmost window */
- int wPosition = scalarBitSize-w;
-
- /* extract leftmost window value */
- Ipp32u eChunk = *((Ipp32u*)((Ipp16u*)pTN + wPosition/BITSIZE(Ipp16u)));
- int shift = wPosition & 0xF;
- Ipp32u windowVal = (eChunk>>shift) & dmask;
-
- /* initialize result (ECP_FINITE_POINT|ECP_PROJECTIVE) */
- cpECCP_ScrambleGet(pR, coordSize, pScratchAligned+windowVal, nPrecomputed);
- ECP_POINT_AFFINE(pR) = 0;
-
- /* initialize temporary T (ECP_PROJECTIVE) */
- ECP_POINT_AFFINE(&T) = 0;
-
- for(wPosition-=w; wPosition>=0; wPosition-=w) {
- /* w times doubling */
- int k;
- for(k=0; k<w; k++)
- ECCP224_DblPoint(pR, pR, pECC, pList);
-
- /* extract next window value */
- eChunk = *((Ipp32u*)((Ipp16u*)pTN + wPosition/BITSIZE(Ipp16u)));
- shift = wPosition & 0xF;
- windowVal = (eChunk>>shift) & dmask;
-
- /* extract value from the pre-computed table */
- cpECCP_ScrambleGet(&T, coordSize, pScratchAligned+windowVal, nPrecomputed);
-
- /* and add it */
- ECCP224_AddPoint(pR, &T, pR, pECC, pList);
- }
- }
- }
-}
-#endif
-
-void ECCP224_MulBasePoint(const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- ECCP224_MulPoint(ECP_GENC(pECC), pK, pR, pECC, pList);
-}
-
-/*
-// ECCP224_ProdPoint
-//
-// Point product
-*/
-#if !defined (_USE_ECCP_SSCM_)
-void ECCP224_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalars */
- if( IsZero_BN(bnPscalar) ) {
- ECCP224_MulPoint(pQ, bnQscalar, pR, pECC, pList);
- return;
- }
- if( IsZero_BN(bnQscalar) ) {
- ECCP224_MulPoint(pP, bnPscalar, pR, pECC, pList);
- return;
- }
-
- /*
- // point product
- */
- else {
- int n;
- Ipp32u* pbnPscalar = BN_NUMBER(bnPscalar);
- int bnPscalarSize = BN_SIZE(bnPscalar);
- Ipp32u* pbnQscalar = BN_NUMBER(bnQscalar);
- int bnQscalarSize = BN_SIZE(bnQscalar);
-
- int size = bnPscalarSize>bnQscalarSize? bnPscalarSize : bnQscalarSize;
-
- IppsECCPPointState* pPointPQ[4] = {NULL, NULL, NULL, NULL};
-
- /* allocate temporary PQ point */
- IppsECCPPointState PQ;
- ECP_POINT_X(&PQ) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&PQ) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&PQ) = cpBigNumListGet(&pList);
-
- /* init temporary point array */
- if(ippBigNumPOS == BN_SIGN(bnPscalar))
- pPointPQ[1] = (IppsECCPPointState*)pP;
- else {
- IppsECCPPointState P;
- ECP_POINT_X(&P) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&P) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&P) = cpBigNumListGet(&pList);
- ECCP224_NegPoint(pP, &P, pECC);
- pPointPQ[1] = &P;
- }
- if(ippBigNumPOS == BN_SIGN(bnQscalar))
- pPointPQ[2] = (IppsECCPPointState*)pQ;
- else {
- IppsECCPPointState Q;
- ECP_POINT_X(&Q) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&Q) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&Q) = cpBigNumListGet(&pList);
- ECCP224_NegPoint(pQ, &Q, pECC);
- pPointPQ[2] = &Q;
- }
-
- ECCP224_AddPoint(pPointPQ[1], pPointPQ[2], &PQ, pECC, pList);
- ECCP224_GetPointAffine(ECP_POINT_X(pR), ECP_POINT_Y(pR), &PQ, pECC, pList);
- ECCP224_SetPointAffine(ECP_POINT_X(pR), ECP_POINT_Y(pR), &PQ, pECC);
- pPointPQ[3] = &PQ;
-
- /* pad scalars by zeros */
- ZEXPAND_BNU(pbnPscalar,bnPscalarSize, size);
- ZEXPAND_BNU(pbnQscalar,bnQscalarSize, size);
-
- /* init result */
- ECCP_SetPointToInfinity(pR);
-
- for(n=size; n>0; n--) {
- Ipp32u scalarPn = pbnPscalar[n-1];
- Ipp32u scalarQn = pbnQscalar[n-1];
-
- int nBit;
- for(nBit=31; nBit>=0; nBit--) {
- int
- PnQnBits = scalarPn&0x80000000? 1:0;
- PnQnBits+= scalarQn&0x80000000? 2:0;
-
- if( !ECCP_IsPointAtInfinity(pR) )
- ECCP224_DblPoint(pR, pR, pECC, pList);
- if( PnQnBits )
- ECCP224_AddPoint(pR, pPointPQ[PnQnBits], pR, pECC, pList);
-
- scalarPn <<= 1;
- scalarQn <<= 1;
- }
- }
- }
-}
-
-#else
-#pragma message ("ECCP224_ProdPoint: SCCM version")
-
-void ECCP224_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- IppsECCPPointState T;
- IppsECCPPointState U;
-
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
-
- ECP_POINT_X(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&U) = cpBigNumListGet(&pList);
-
- ECCP224_MulPoint(pP, bnPscalar, &T, (IppsECCPState*)pECC, pList);
- ECCP224_MulPoint(pQ, bnQscalar, &U, (IppsECCPState*)pECC, pList);
- ECCP224_AddPoint(&T, &U, pR, pECC, pList);
-}
-#endif
-
-#endif /* _ECP_224_==_ECP_IMPL_SPECIFIC_ */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpmethod256.h b/ext/ipp/sources/ippcp/src/pcpeccpmethod256.h
deleted file mode 100644
index 3d85a85..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpmethod256.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Definitions of EC methods over GF(P256)
-//
-//
-*/
-
-#if !defined(_PCP_ECCPMETHOD256_H)
-#define _PCP_ECCPMETHOD256_H
-
-#include "pcpeccp.h"
-
-
-/*
-// Returns reference
-*/
-ECCP_METHOD* ECCP256_Methods(void);
-
-
-/*
-// Point Set. These operations implies
-// transformation of regular coordinates into internal format
-*/
-void ECCP256_SetPointProjective(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- const IppsBigNumState* pZ,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC);
-
-void ECCP256_SetPointAffine(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC);
-
-/*
-// Get Point. These operations implies
-// transformation of internal format coordinates into regular
-*/
-//void ECCP256_GetPointProjective(IppsBigNumState* pX,
-// IppsBigNumState* pY,
-// IppsBigNumState* pZ,
-// const IppsECCPPointState* pPoint,
-// const IppsECCPState* pECC);
-
-void ECCP256_GetPointAffine(IppsBigNumState* pX,
- IppsBigNumState* pY,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-/*
-// Test is On EC
-*/
-int ECCP256_IsPointOnCurve(const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-/*
-// Operations
-*/
-int ECCP256_ComparePoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP256_NegPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC);
-
-void ECCP256_DblPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP256_AddPoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP256_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP256_MulBasePoint(const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP256_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-#endif /* _PCP_ECCPMETHOD256_H */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpmethod256ca.c b/ext/ipp/sources/ippcp/src/pcpeccpmethod256ca.c
deleted file mode 100644
index b1bb0d4..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpmethod256ca.c
+++ /dev/null
@@ -1,879 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// EC methods over GF(P256)
-//
-// Contents:
-// ECCP256_SetPointProjective()
-// ECCP256_SetPointAffine()
-// ECCP256_GetPointAffine()
-//
-// ECCP256_IsPointOnCurve()
-//
-// ECCP256_ComparePoint()
-// ECCP256_NegPoint()
-// ECCP256_DblPoint()
-// ECCP256_AddPoint()
-// ECCP256_MulPoint()
-// ECCP256_ProdPoint()
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-
-#if (_ECP_256_==_ECP_IMPL_SPECIFIC_)
-#include "pcpeccppoint.h"
-#include "pcpeccpmethod.h"
-#include "pcpeccpmethodcom.h"
-#include "pcpeccpmethod256.h"
-#include "pcppma256.h"
-
-/*
- NOTE:
- ECCP256 methods are used representation of point coordinates
- in regular (usual residue) domain, because of special modular reduction
-*/
-static
-ECCP_METHOD ECCP256 = {
- ECCP256_SetPointProjective,
- ECCP256_SetPointAffine,
- ECCP256_GetPointAffine,
-
- ECCP256_IsPointOnCurve,
-
- ECCP256_ComparePoint,
- ECCP256_NegPoint,
- ECCP256_DblPoint,
- ECCP256_AddPoint,
- ECCP256_MulPoint,
- ECCP256_MulBasePoint,
- ECCP256_ProdPoint
-};
-
-
-/*
-// Returns reference
-*/
-ECCP_METHOD* ECCP256_Methods(void)
-{
- return &ECCP256;
-}
-
-/*
-// ECCP256_PoinSettProjective
-// Converts regular projective triplet (pX,pY,pZ) into pPoint
-// (see note above)
-*/
-void ECCP256_SetPointProjective(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- const IppsBigNumState* pZ,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
- cpBN_copy(ECP_POINT_X(pPoint), pX);
- cpBN_copy(ECP_POINT_Y(pPoint), pY);
- cpBN_copy(ECP_POINT_Z(pPoint), pZ);
- ECP_POINT_AFFINE(pPoint) = cpBN_cmp(pZ, BN_ONE_REF())==0;
-}
-
-/*
-// ECCP256_PointAffineSet
-// Converts regular affine pair (pX,pY) into pPoint
-*/
-void ECCP256_SetPointAffine(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- ECCP256_SetPointProjective(pX, pY, BN_ONE_REF(), pPoint, pECC);
-}
-
-/*
-// ECCP256_GetPointProjective
-// Converts pPoint into regular projective triplet (pX,pY,pZ)
-*/
-#if 0
-void ECCP256_GetPointProjective(IppsBigNumState* pX,
- IppsBigNumState* pY,
- IppsBigNumState* pZ,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
- cpBN_copy(pX, ECP_POINT_X(pPoint));
- cpBN_copy(pY, ECP_POINT_Y(pPoint));
- cpBN_copy(pZ, ECP_POINT_Z(pPoint));
-}
-#endif
-
-/*
-// ECCP256_GetPointAffine
-//
-// Converts pPoint into regular affine pair (pX,pY)
-//
-// Note:
-// pPoint is not point at Infinity
-// transform (X, Y, Z) into (x, y) = (X/Z^2, Y/Z^3)
-*/
-void ECCP256_GetPointAffine(IppsBigNumState* pX, IppsBigNumState* pY,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* case Z == 1 */
- if( ECP_POINT_AFFINE(pPoint) ) {
- if(pX) {
- cpBN_copy(pX, ECP_POINT_X(pPoint));
- }
- if(pY) {
- cpBN_copy(pY, ECP_POINT_Y(pPoint));
- }
- }
-
- /* case Z != 1 */
- else {
- //IppsMontState* pMont = ECP_PMONT(pECC);
- IppsBigNumState* pModulo = ECP_PRIME(pECC);
-
- IppsBigNumState* pT = cpBigNumListGet(&pList);
- IppsBigNumState* pU = cpBigNumListGet(&pList);
- //IppsBigNumState* pModulo = cpBigNumListGet(&pList);
- //BN_Set(MNT_MODULUS(pMont), MNT_SIZE(pMont), pModulo);
-
- /* U = 1/Z */
- PMA256_inv(pU, ECP_POINT_Z(pPoint), pModulo);
- /* T = 1/(Z^2) */
- PMA256_sqr(pT, pU);
-
- if(pX) {
- PMA256_mul(pX,pT, ECP_POINT_X(pPoint));
- cpBN_fix(pX);
- }
- if(pY) {
- /* U = 1/(Z^3) */
- PMA256_mul(pU, pU, pT);
- PMA256_mul(pY,pU, ECP_POINT_Y(pPoint));
- cpBN_fix(pY);
- }
- }
-}
-
-/*
-// ECCP256_IsPointOnCurve
-//
-// Test point is lie on curve
-//
-// Note
-// We deal with equation: y^2 = x^3 + A*x + B.
-// Or in projective coordinates: Y^2 = X^3 + a*X*Z^4 + b*Z^6.
-// The point under test is given by projective triplet (X,Y,Z),
-// which represents actually (x,y) = (X/Z^2,Y/Z^3).
-*/
-int ECCP256_IsPointOnCurve(const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* let think Infinity point is on the curve */
- if( ECCP_IsPointAtInfinity(pPoint) )
- return 1;
-
- else {
- IppsBigNumState* pR = cpBigNumListGet(&pList);
- IppsBigNumState* pT = cpBigNumListGet(&pList);
-
- PMA256_sqr(pR, ECP_POINT_X(pPoint)); // R = X^3
- PMA256_mul(pR, pR, ECP_POINT_X(pPoint));
-
- /* case Z != 1 */
- if( !ECP_POINT_AFFINE(pPoint) ) {
- IppsBigNumState* pZ4 = cpBigNumListGet(&pList);
- IppsBigNumState* pZ6 = cpBigNumListGet(&pList);
- PMA256_sqr(pT, ECP_POINT_Z(pPoint)); // Z^2
- PMA256_sqr(pZ4, pT); // Z^4
- PMA256_mul(pZ6, pZ4, pT); // Z^6
-
- PMA256_mul(pT, pZ4, ECP_POINT_X(pPoint)); // T = X*Z^4
- if( ECP_AMI3(pECC) ) {
- IppsBigNumState* pU = cpBigNumListGet(&pList);
- PMA256_add(pU, pT, pT); // R = X^3 +a*X*Z^4
- PMA256_add(pU, pU, pT);
- PMA256_sub(pR, pR, pU);
- }
- else {
- PMA256_mul(pT, pT, ECP_A(pECC)); // R = X^3 +a*X*Z^4
- PMA256_add(pR, pR, pT);
- }
- PMA256_mul(pT, pZ6, ECP_B(pECC)); // R = X^3 +a*X*Z^4 + b*Z^6
- PMA256_add(pR, pR, pT);
-
- }
- /* case Z == 1 */
- else {
- if( ECP_AMI3(pECC) ) {
- PMA256_add(pT, ECP_POINT_X(pPoint), ECP_POINT_X(pPoint)); // R = X^3 +a*X
- PMA256_add(pT, pT, ECP_POINT_X(pPoint));
- PMA256_sub(pR, pR, pT);
- }
- else {
- PMA256_mul(pT, ECP_POINT_X(pPoint), ECP_A(pECC)); // R = X^3 +a*X
- PMA256_add(pR, pR, pT);
- }
- PMA256_add(pR, pR, ECP_B(pECC)); // R = X^3 +a*X + b
- }
- PMA256_sqr(pT, ECP_POINT_Y(pPoint)); // T = Y^2
- return 0==cpBN_cmp(pR, pT);
- }
-}
-
-/*
-// ECCP256_ComparePoint
-//
-// Compare two points:
-// returns 0 => pP==pQ (maybe both pP and pQ are at Infinity)
-// returns 1 => pP!=pQ
-//
-// Note
-// In general we check:
-// P_X*Q_Z^2 ~ Q_X*P_Z^2
-// P_Y*Q_Z^3 ~ Q_Y*P_Z^3
-*/
-int ECCP256_ComparePoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- UNREFERENCED_PARAMETER(pECC);
-
- /* P or/and Q at Infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- return ECCP_IsPointAtInfinity(pQ)? 0:1;
- if( ECCP_IsPointAtInfinity(pQ) )
- return ECCP_IsPointAtInfinity(pP)? 0:1;
-
- /* (P_Z==1) && (Q_Z==1) */
- if( ECP_POINT_AFFINE(pP) && ECP_POINT_AFFINE(pQ) )
- return ((0==cpBN_cmp(ECP_POINT_X(pP),ECP_POINT_X(pQ))) && (0==cpBN_cmp(ECP_POINT_Y(pP),ECP_POINT_Y(pQ))))? 0:1;
-
- {
- IppsBigNumState* pPtmp = cpBigNumListGet(&pList);
- IppsBigNumState* pQtmp = cpBigNumListGet(&pList);
- IppsBigNumState* pPZ = cpBigNumListGet(&pList);
- IppsBigNumState* pQZ = cpBigNumListGet(&pList);
-
- /* P_X*Q_Z^2 ~ Q_X*P_Z^2 */
- if( !ECP_POINT_AFFINE(pQ) ) {
- PMA256_sqr(pQZ, ECP_POINT_Z(pQ)); /* Ptmp = P_X*Q_Z^2 */
- PMA256_mul(pPtmp, ECP_POINT_X(pP), pQZ);
- }
- else {
- PMA_set(pPtmp, ECP_POINT_X(pP));
- }
- if( !ECP_POINT_AFFINE(pP) ) {
- PMA256_sqr(pPZ, ECP_POINT_Z(pP)); /* Qtmp = Q_X*P_Z^2 */
- PMA256_mul(pQtmp, ECP_POINT_X(pQ), pPZ);
- }
- else {
- PMA_set(pQtmp, ECP_POINT_X(pQ));
- }
- if ( cpBN_cmp(pPtmp, pQtmp) )
- return 1; /* points are different: (P_X*Q_Z^2) != (Q_X*P_Z^2) */
-
- /* P_Y*Q_Z^3 ~ Q_Y*P_Z^3 */
- if( !ECP_POINT_AFFINE(pQ) ) {
- PMA256_mul(pQZ, pQZ, ECP_POINT_Z(pQ)); /* Ptmp = P_Y*Q_Z^3 */
- PMA256_mul(pPtmp, ECP_POINT_Y(pP), pQZ);
- }
- else {
- PMA_set(pPtmp, ECP_POINT_Y(pP));
- }
- if( !ECP_POINT_AFFINE(pP) ) {
- PMA256_mul(pPZ, pPZ, ECP_POINT_Z(pP)); /* Qtmp = Q_Y*P_Z^3 */
- PMA256_mul(pQtmp, ECP_POINT_Y(pQ), pPZ);
- }
- else {
- PMA_set(pQtmp, ECP_POINT_Y(pQ));
- }
- return cpBN_cmp(pPtmp, pQtmp)? 1:0;
- }
-}
-
-/*
-// ECCP256_NegPoint
-//
-// Negative point
-*/
-void ECCP256_NegPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
-
- /* test point at Infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- ECCP_SetPointToInfinity(pR);
-
- else {
- BNU_CHUNK_T* pRy = BN_NUMBER(ECP_POINT_Y(pR));
- BNU_CHUNK_T* pPy = BN_NUMBER(ECP_POINT_Y(pP));
- int size = LEN_P256;
-
- if( pP!=pR ) {
- PMA_set(ECP_POINT_X(pR), ECP_POINT_X(pP));
- PMA_set(ECP_POINT_Z(pR), ECP_POINT_Z(pP));
- ECP_POINT_AFFINE(pR) = ECP_POINT_AFFINE(pP);
- }
- cpSub_BNU(pRy, (BNU_CHUNK_T*)secp256r1_p, pPy, LEN_P256);
- FIX_BNU(pRy,size);
- BN_SIZE(ECP_POINT_Y(pR)) = size;
- BN_SIGN(ECP_POINT_Y(pR)) = ippBigNumPOS;
- }
-}
-
-/*
-// ECCP256_DblPoint
-//
-// Double point
-*/
-void ECCP256_DblPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* P at infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- ECCP_SetPointToInfinity(pR);
-
- else {
- IppsBigNumState* bnV = cpBigNumListGet(&pList);
- IppsBigNumState* bnU = cpBigNumListGet(&pList);
- IppsBigNumState* bnM = cpBigNumListGet(&pList);
- IppsBigNumState* bnS = cpBigNumListGet(&pList);
- IppsBigNumState* bnT = cpBigNumListGet(&pList);
-
- /* M = 3*X^2 + A*Z^4 */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA256_sqr(bnU, ECP_POINT_X(pP));
- PMA256_add(bnM, bnU, bnU);
- PMA256_add(bnM, bnM, bnU);
- PMA256_add(bnM, bnM, ECP_A(pECC));
- }
- else if( ECP_AMI3(pECC) ) {
- PMA256_sqr(bnU, ECP_POINT_Z(pP));
- PMA256_add(bnS, ECP_POINT_X(pP), bnU);
- PMA256_sub(bnT, ECP_POINT_X(pP), bnU);
- PMA256_mul(bnM, bnS, bnT);
- PMA256_add(bnU, bnM, bnM);
- PMA256_add(bnM, bnU, bnM);
- }
- else {
- PMA256_sqr(bnU, ECP_POINT_X(pP));
- PMA256_add(bnM, bnU, bnU);
- PMA256_add(bnM, bnM, bnU);
- PMA256_sqr(bnU, ECP_POINT_Z(pP));
- PMA256_sqr(bnU, bnU);
- PMA256_mul(bnU, bnU, ECP_A(pECC));
- PMA256_add(bnM, bnM, bnU);
- }
-
- PMA256_add(bnV, ECP_POINT_Y(pP), ECP_POINT_Y(pP));
-
- /* R_Z = 2*Y*Z */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(ECP_POINT_Z(pR), bnV);
- }
- else {
- PMA256_mul(ECP_POINT_Z(pR), bnV, ECP_POINT_Z(pP));
- }
-
- /* S = 4*X*Y^2 */
- PMA256_sqr(bnT, bnV);
- PMA256_mul(bnS, bnT, ECP_POINT_X(pP));
-
- /* R_X = M^2 - 2*S */
- PMA256_sqr(bnU, bnM);
- PMA256_sub(bnU, bnU, bnS);
- PMA256_sub(ECP_POINT_X(pR), bnU, bnS);
-
- /* T = 8*Y^4 */
- PMA256_mul(bnV, bnV, ECP_POINT_Y(pP));
- PMA256_mul(bnT, bnT, bnV);
-
- /* R_Y = M*(S - R_X) - T */
- PMA256_sub(bnS, bnS, ECP_POINT_X(pR));
- PMA256_mul(bnS, bnS, bnM);
- PMA256_sub(ECP_POINT_Y(pR), bnS, bnT);
-
- ECP_POINT_AFFINE(pR) = 0;
- }
-}
-
-/*
-// ECCP256_AddPoint
-//
-// Add points
-*/
-void ECCP256_AddPoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
-#if 0
- /* test stupid call */
- if( pP == pQ ) {
- ECCP256_DblPoint(pP, pR, pECC, pList);
- return;
- }
-#endif
-
- /* prevent operation with point at Infinity */
- if( ECCP_IsPointAtInfinity(pP) ) {
- ECCP_CopyPoint(pQ, pR);
- return;
- }
- if( ECCP_IsPointAtInfinity(pQ) ) {
- ECCP_CopyPoint(pP, pR);
- return;
- }
-
- /*
- // addition
- */
- {
- IppsBigNumState* bnU0 = cpBigNumListGet(&pList);
- IppsBigNumState* bnS0 = cpBigNumListGet(&pList);
- IppsBigNumState* bnU1 = cpBigNumListGet(&pList);
- IppsBigNumState* bnS1 = cpBigNumListGet(&pList);
- IppsBigNumState* bnW = cpBigNumListGet(&pList);
- IppsBigNumState* bnR = cpBigNumListGet(&pList);
- IppsBigNumState *bnT = bnU0;
- IppsBigNumState *bnM = bnS0;
-
- /* U0 = P_X * Q_Z^2 */
- /* S0 = P_Y * Q_Z^3 */
- if( ECP_POINT_AFFINE(pQ) ) {
- PMA_set(bnU0, ECP_POINT_X(pP));
- PMA_set(bnS0, ECP_POINT_Y(pP));
- }
- else {
- PMA256_sqr(bnW, ECP_POINT_Z(pQ));
- PMA256_mul(bnU0,ECP_POINT_X(pP), bnW);
- PMA256_mul(bnW, ECP_POINT_Z(pQ), bnW);
- PMA256_mul(bnS0,ECP_POINT_Y(pP), bnW);
- }
-
- /* U1 = Q_X * P_Z^2 */
- /* S1 = Q_Y * P_Z^3 */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(bnU1, ECP_POINT_X(pQ));
- PMA_set(bnS1, ECP_POINT_Y(pQ));
- }
- else {
- PMA256_sqr(bnW, ECP_POINT_Z(pP));
- PMA256_mul(bnU1,ECP_POINT_X(pQ), bnW);
- PMA256_mul(bnW, ECP_POINT_Z(pP), bnW);
- PMA256_mul(bnS1,ECP_POINT_Y(pQ), bnW);
- }
-
- /* W = U0-U1 */
- /* R = S0-S1 */
- PMA256_sub(bnW, bnU0, bnU1);
- PMA256_sub(bnR, bnS0, bnS1);
-
- //if( IsZero_BN(bnW) ) {
- //if( IsZero_BN(bnR) ) {
- if(cpEqu_BNU_CHUNK(BN_NUMBER(bnW), LEN_P256, 0)) {
- if(cpEqu_BNU_CHUNK(BN_NUMBER(bnR), LEN_P256, 0)) {
- ECCP256_DblPoint(pP, pR, pECC, pList);
- return;
- }
- else {
- ECCP_SetPointToInfinity(pR);
- return;
- }
- }
-
- /* T = U0+U1 */
- /* M = S0+S1 */
- PMA256_add(bnT, bnU0, bnU1);
- PMA256_add(bnM, bnS0, bnS1);
-
- /* R_Z = P_Z * Q_Z * W */
- if( ECP_POINT_AFFINE(pQ) && ECP_POINT_AFFINE(pP) ) {
- PMA_set(ECP_POINT_Z(pR), bnW);
- }
- else {
- if( ECP_POINT_AFFINE(pQ) ) {
- PMA_set(bnU1, ECP_POINT_Z(pP));
- }
- else if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(bnU1, ECP_POINT_Z(pQ));
- }
- else {
- PMA256_mul(bnU1, ECP_POINT_Z(pP), ECP_POINT_Z(pQ));
- }
- PMA256_mul(ECP_POINT_Z(pR), bnU1, bnW);
- }
-
- PMA256_sqr(bnU1, bnW); /* U1 = W^2 */
- PMA256_mul(bnS1, bnT, bnU1); /* S1 = T * W^2 */
-
- /* R_X = R^2 - T * W^2 */
- PMA256_sqr(ECP_POINT_X(pR), bnR);
- PMA256_sub(ECP_POINT_X(pR), ECP_POINT_X(pR), bnS1);
-
- /* V = T * W^2 - 2 * R_X (S1) */
- PMA256_sub(bnS1, bnS1, ECP_POINT_X(pR));
- PMA256_sub(bnS1, bnS1, ECP_POINT_X(pR));
-
- /* R_Y = (V * R - M * W^3) /2 */
- PMA256_mul(ECP_POINT_Y(pR), bnS1, bnR);
- PMA256_mul(bnU1, bnU1, bnW);
- PMA256_mul(bnU1, bnU1, bnM);
- PMA256_sub(bnU1, ECP_POINT_Y(pR), bnU1);
- PMA256_div2(ECP_POINT_Y(pR), bnU1);
-
- ECP_POINT_AFFINE(pR) = 0;
- }
-}
-
-/*
-// ECCP256_MulPoint
-//
-// Multiply point by scalar
-*/
-#if !defined (_USE_ECCP_SSCM_)
-void ECCP256_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnN,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalar or input point at Infinity */
- if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) {
- ECCP_SetPointToInfinity(pR);
- return;
- }
-
- /*
- // scalar multiplication
- */
- else {
- IppsECCPPointState T;
- IppsECCPPointState U;
- IppsBigNumState* bnKH = cpBigNumListGet(&pList);
- Ipp32u* pK;
- Ipp32u* pH;
- Ipp32u carry;
- int lenKH;
- int bitH;
-
- /* init result */
- ECCP_CopyPoint(pP, pR);
-
- /* if scalar is negative */
- if( ippBigNumNEG == BN_SIGN(bnN) ) {
- /* negative R */
- ECCP256_NegPoint(pR, pR, pECC);
- }
-
- /* copy K = N and compute H=3*K */
- lenKH = BN_SIZE(bnN)+1;
- pK = BN_NUMBER(bnKH);
- pH = BN_BUFFER(bnKH);
- Cpy_BNU(BN_NUMBER(bnN), pK, BN_SIZE(bnN));
- pK[lenKH-1] = 0;
- carry = cpAdd_BNU(pH, pK, pK, lenKH);
- carry = cpAdd_BNU(pH, pK, pH, lenKH);
-
- /* init temporary T = (X/Z^2, Y/Z^3, 1) */
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
- ECCP256_GetPointAffine(ECP_POINT_X(&T), ECP_POINT_Y(&T), pR, pECC, pList);
- ECCP256_SetPointAffine(ECP_POINT_X(&T), ECP_POINT_Y(&T), &T, pECC);
-
- /* temporary point U =-T */
- ECP_POINT_X(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&U) = cpBigNumListGet(&pList);
- ECCP256_NegPoint(&T, &U, pECC);
-
- for(bitH=MSB_BNU(pH, lenKH)-1; bitH>0; bitH--) {
- int hBit = TST_BIT(pH, bitH);
- int kBit = TST_BIT(pK, bitH);
- ECCP256_DblPoint(pR, pR, pECC, pList);
- if( hBit && !kBit )
- ECCP256_AddPoint(pR, &T, pR, pECC, pList);
- if(!hBit && kBit )
- ECCP256_AddPoint(pR, &U, pR, pECC, pList);
- }
- }
-}
-
-#else
-#pragma message ("ECCP256_MulPoint: SCCM version")
-
-void ECCP256_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnN,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalar or input point at Infinity */
- if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) {
- ECCP_SetPointToInfinity(pR);
- return;
- }
-
- /*
- // scalar multiplication
- */
- else {
- Ipp8u* pScratchAligned = ECP_SCCMBUFF(pECC);
-
- BNU_CHUNK_T* pN = BN_NUMBER(bnN);
- cpSize nsN = BN_SIZE(bnN);
- /* scalar bitsize */
- int scalarBitSize = BITSIZE_BNU(pN, nsN);
- /* optimal size of window */
- int w = cpECCP_OptimalWinSize(scalarBitSize);
- /* number of table entries */
- int nPrecomputed = 1<<w;
-
- /* allocate temporary scalar */
- IppsBigNumState* bnTN = cpBigNumListGet(&pList);
- BNU_CHUNK_T* pTN = BN_NUMBER(bnTN);
-
- int coordSize = BITS_BNU_CHUNK(ECP_GFEBITS(pECC));
- IppsECCPPointState T;
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
- ECCP_SetPointToInfinity(&T);
-
- /* init result */
- ECCP_CopyPoint(pP, pR);
- if( ippBigNumNEG == BN_SIGN(bnN) )
- ECCP256_NegPoint(pR, pR, pECC);
-
- /* pre-compute auxiliary table t[] = {(2^w)*P, 1*P, 2*P, ..., (2^(w-1))*P} */
- {
- int n;
- for(n=1; n<nPrecomputed; n++) {
- ECCP256_AddPoint(pR, &T, &T, pECC, pList);
- cpECCP_ScramblePut(pScratchAligned+n, nPrecomputed, &T, coordSize);
- }
- ECCP256_AddPoint(pR, &T, &T, pECC, pList);
- cpECCP_ScramblePut(pScratchAligned, nPrecomputed, &T, coordSize);
- }
-
- /* copy scalar */
- cpCpy_BNU(pTN, pN, nsN);
- /* and convert it presentaion to avoid usage of O point */
- scalarBitSize = cpECCP_ConvertRepresentation(pTN, scalarBitSize, w);
-
- /* prepare temporary scalar for processing */
- pTN[BITS_BNU_CHUNK(scalarBitSize)] = 0;
- scalarBitSize = ((scalarBitSize+w-1)/w)*w;
-
- /*
- // scalar multiplication
- */
- {
- Ipp32u dmask = nPrecomputed-1;
-
- /* position (bit number) of the leftmost window */
- int wPosition = scalarBitSize-w;
-
- /* extract leftmost window value */
- Ipp32u eChunk = *((Ipp32u*)((Ipp16u*)pTN + wPosition/BITSIZE(Ipp16u)));
- int shift = wPosition & 0xF;
- Ipp32u windowVal = (eChunk>>shift) & dmask;
-
- /* initialize result (ECP_FINITE_POINT|ECP_PROJECTIVE) */
- cpECCP_ScrambleGet(pR, coordSize, pScratchAligned+windowVal, nPrecomputed);
- ECP_POINT_AFFINE(pR) = 0;
-
- /* initialize temporary T (ECP_PROJECTIVE) */
- ECP_POINT_AFFINE(&T) = 0;
-
- for(wPosition-=w; wPosition>=0; wPosition-=w) {
- /* w times doubling */
- int k;
- for(k=0; k<w; k++)
- ECCP256_DblPoint(pR, pR, pECC, pList);
-
- /* extract next window value */
- eChunk = *((Ipp32u*)((Ipp16u*)pTN + wPosition/BITSIZE(Ipp16u)));
- shift = wPosition & 0xF;
- windowVal = (eChunk>>shift) & dmask;
-
- /* extract value from the pre-computed table */
- cpECCP_ScrambleGet(&T, coordSize, pScratchAligned+windowVal, nPrecomputed);
-
- /* and add it */
- ECCP256_AddPoint(pR, &T, pR, pECC, pList);
- }
- }
- }
-}
-#endif
-
-void ECCP256_MulBasePoint(const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- ECCP256_MulPoint(ECP_GENC(pECC), pK, pR, pECC, pList);
-}
-
-/*
-// ECCP256_ProdPoint
-//
-// Point product
-*/
-#if !defined (_USE_ECCP_SSCM_)
-void ECCP256_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalars */
- if( IsZero_BN(bnPscalar) ) {
- ECCP256_MulPoint(pQ, bnQscalar, pR, pECC, pList);
- return;
- }
- if( IsZero_BN(bnQscalar) ) {
- ECCP256_MulPoint(pP, bnPscalar, pR, pECC, pList);
- return;
- }
-
- /*
- // point product
- */
- else {
- int n;
- Ipp32u* pbnPscalar = BN_NUMBER(bnPscalar);
- int bnPscalarSize = BN_SIZE(bnPscalar);
- Ipp32u* pbnQscalar = BN_NUMBER(bnQscalar);
- int bnQscalarSize = BN_SIZE(bnQscalar);
-
- int size = bnPscalarSize>bnQscalarSize? bnPscalarSize : bnQscalarSize;
-
- IppsECCPPointState* pPointPQ[4] = {NULL, NULL, NULL, NULL};
-
- /* allocate temporary PQ point */
- IppsECCPPointState PQ;
- ECP_POINT_X(&PQ) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&PQ) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&PQ) = cpBigNumListGet(&pList);
-
- /* init temporary point array */
- if(ippBigNumPOS == BN_SIGN(bnPscalar))
- pPointPQ[1] = (IppsECCPPointState*)pP;
- else {
- IppsECCPPointState P;
- ECP_POINT_X(&P) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&P) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&P) = cpBigNumListGet(&pList);
- ECCP256_NegPoint(pP, &P, pECC);
- pPointPQ[1] = &P;
- }
- if(ippBigNumPOS == BN_SIGN(bnQscalar))
- pPointPQ[2] = (IppsECCPPointState*)pQ;
- else {
- IppsECCPPointState Q;
- ECP_POINT_X(&Q) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&Q) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&Q) = cpBigNumListGet(&pList);
- ECCP256_NegPoint(pQ, &Q, pECC);
- pPointPQ[2] = &Q;
- }
-
- ECCP256_AddPoint(pPointPQ[1], pPointPQ[2], &PQ, pECC, pList);
- ECCP256_GetPointAffine(ECP_POINT_X(pR), ECP_POINT_Y(pR), &PQ, pECC, pList);
- ECCP256_SetPointAffine(ECP_POINT_X(pR), ECP_POINT_Y(pR), &PQ, pECC);
- pPointPQ[3] = &PQ;
-
- /* pad scalars by zeros */
- ZEXPAND_BNU(pbnPscalar,bnPscalarSize, size);
- ZEXPAND_BNU(pbnQscalar,bnQscalarSize, size);
-
- /* init result */
- ECCP_SetPointToInfinity(pR);
-
- for(n=size; n>0; n--) {
- Ipp32u scalarPn = pbnPscalar[n-1];
- Ipp32u scalarQn = pbnQscalar[n-1];
-
- int nBit;
- for(nBit=31; nBit>=0; nBit--) {
- int
- PnQnBits = scalarPn&0x80000000? 1:0;
- PnQnBits+= scalarQn&0x80000000? 2:0;
-
- if( !ECCP_IsPointAtInfinity(pR) )
- ECCP256_DblPoint(pR, pR, pECC, pList);
- if( PnQnBits )
- ECCP256_AddPoint(pR, pPointPQ[PnQnBits], pR, pECC, pList);
-
- scalarPn <<= 1;
- scalarQn <<= 1;
- }
- }
- }
-}
-
-#else
-#pragma message ("ECCP256_ProdPoint: SCCM version")
-
-void ECCP256_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- IppsECCPPointState T;
- IppsECCPPointState U;
-
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
-
- ECP_POINT_X(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&U) = cpBigNumListGet(&pList);
-
- ECCP256_MulPoint(pP, bnPscalar, &T, (IppsECCPState*)pECC, pList);
- ECCP256_MulPoint(pQ, bnQscalar, &U, (IppsECCPState*)pECC, pList);
- ECCP256_AddPoint(&T, &U, pR, pECC, pList);
-}
-#endif
-
-#endif /* _ECP_256_==_ECP_IMPL_SPECIFIC_ */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpmethod384.h b/ext/ipp/sources/ippcp/src/pcpeccpmethod384.h
deleted file mode 100644
index 6fab894..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpmethod384.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Definitions of EC methods over GF(P384)
-//
-//
-*/
-
-#if !defined(_PCP_ECCPMETHOD384_H)
-#define _PCP_ECCPMETHOD384_H
-
-#include "pcpeccp.h"
-
-
-/*
-// Returns reference
-*/
-ECCP_METHOD* ECCP384_Methods(void);
-
-
-/*
-// Point Set. These operations implies
-// transformation of regular coordinates into internal format
-*/
-void ECCP384_SetPointProjective(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- const IppsBigNumState* pZ,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC);
-
-void ECCP384_SetPointAffine(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC);
-
-/*
-// Get Point. These operations implies
-// transformation of internal format coordinates into regular
-*/
-//void ECCP384_GetPointProjective(IppsBigNumState* pX,
-// IppsBigNumState* pY,
-// IppsBigNumState* pZ,
-// const IppsECCPPointState* pPoint,
-// const IppsECCPState* pECC);
-
-void ECCP384_GetPointAffine(IppsBigNumState* pX,
- IppsBigNumState* pY,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-/*
-// Test is On EC
-*/
-int ECCP384_IsPointOnCurve(const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-/*
-// Operations
-*/
-int ECCP384_ComparePoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP384_NegPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC);
-
-void ECCP384_DblPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP384_AddPoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP384_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP384_MulBasePoint(const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP384_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-#endif /* _PCP_ECCPMETHOD384_H */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpmethod384ca.c b/ext/ipp/sources/ippcp/src/pcpeccpmethod384ca.c
deleted file mode 100644
index 72252e8..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpmethod384ca.c
+++ /dev/null
@@ -1,879 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// EC methods over GF(P384)
-//
-// Contents:
-// ECCP384_SetPointProjective()
-// ECCP384_SetPointAffine()
-// ECCP384_GetPointAffine()
-//
-// ECCP384_IsPointOnCurve()
-//
-// ECCP384_ComparePoint()
-// ECCP384_NegPoint()
-// ECCP384_DblPoint()
-// ECCP384_AddPoint()
-// ECCP384_MulPoint()
-// ECCP384_ProdPoint()
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-
-#if (_ECP_384_==_ECP_IMPL_SPECIFIC_)
-#include "pcpeccppoint.h"
-#include "pcpeccpmethod.h"
-#include "pcpeccpmethodcom.h"
-#include "pcpeccpmethod384.h"
-#include "pcppma384.h"
-
-/*
- NOTE:
- ECCP384 methods are used representation of point coordinates
- in regular (usual residue) domain, because of special modular reduction
-*/
-static
-ECCP_METHOD ECCP384 = {
- ECCP384_SetPointProjective,
- ECCP384_SetPointAffine,
- ECCP384_GetPointAffine,
-
- ECCP384_IsPointOnCurve,
-
- ECCP384_ComparePoint,
- ECCP384_NegPoint,
- ECCP384_DblPoint,
- ECCP384_AddPoint,
- ECCP384_MulPoint,
- ECCP384_MulBasePoint,
- ECCP384_ProdPoint
-};
-
-
-/*
-// Returns reference
-*/
-ECCP_METHOD* ECCP384_Methods(void)
-{
- return &ECCP384;
-}
-
-/*
-// ECCP384_PoinSettProjective
-// Converts regular projective triplet (pX,pY,pZ) into pPoint
-// (see note above)
-*/
-void ECCP384_SetPointProjective(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- const IppsBigNumState* pZ,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
- cpBN_copy(ECP_POINT_X(pPoint), pX);
- cpBN_copy(ECP_POINT_Y(pPoint), pY);
- cpBN_copy(ECP_POINT_Z(pPoint), pZ);
- ECP_POINT_AFFINE(pPoint) = cpBN_cmp(pZ, BN_ONE_REF())==0;
-}
-
-/*
-// ECCP384_PointAffineSet
-// Converts regular affine pair (pX,pY) into pPoint
-*/
-void ECCP384_SetPointAffine(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- ECCP384_SetPointProjective(pX, pY, BN_ONE_REF(), pPoint, pECC);
-}
-
-/*
-// ECCP384_GetPointProjective
-// Converts pPoint into regular projective triplet (pX,pY,pZ)
-*/
-#if 0
-void ECCP384_GetPointProjective(IppsBigNumState* pX,
- IppsBigNumState* pY,
- IppsBigNumState* pZ,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
- cpBN_copy(pX, ECP_POINT_X(pPoint));
- cpBN_copy(pY, ECP_POINT_Y(pPoint));
- cpBN_copy(pZ, ECP_POINT_Z(pPoint));
-}
-#endif
-
-/*
-// ECCP384_GetPointAffine
-//
-// Converts pPoint into regular affine pair (pX,pY)
-//
-// Note:
-// pPoint is not point at Infinity
-// transform (X, Y, Z) into (x, y) = (X/Z^2, Y/Z^3)
-*/
-void ECCP384_GetPointAffine(IppsBigNumState* pX, IppsBigNumState* pY,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* case Z == 1 */
- if( ECP_POINT_AFFINE(pPoint) ) {
- if(pX) {
- cpBN_copy(pX, ECP_POINT_X(pPoint));
- }
- if(pY) {
- cpBN_copy(pY, ECP_POINT_Y(pPoint));
- }
- }
-
- /* case Z != 1 */
- else {
- //IppsMontState* pMont = ECP_PMONT(pECC);
- IppsBigNumState* pModulo = ECP_PRIME(pECC);
-
- IppsBigNumState* pT = cpBigNumListGet(&pList);
- IppsBigNumState* pU = cpBigNumListGet(&pList);
- //IppsBigNumState* pModulo = cpBigNumListGet(&pList);
- //BN_Set(MNT_MODULUS(pMont), MNT_SIZE(pMont), pModulo);
-
- /* U = 1/Z */
- PMA384_inv(pU, ECP_POINT_Z(pPoint), pModulo);
- /* T = 1/(Z^2) */
- PMA384_sqr(pT, pU);
-
- if(pX) {
- PMA384_mul(pX,pT, ECP_POINT_X(pPoint));
- cpBN_fix(pX);
- }
- if(pY) {
- /* U = 1/(Z^3) */
- PMA384_mul(pU, pU, pT);
- PMA384_mul(pY,pU, ECP_POINT_Y(pPoint));
- cpBN_fix(pY);
- }
- }
-}
-
-/*
-// ECCP384_IsPointOnCurve
-//
-// Test point is lie on curve
-//
-// Note
-// We deal with equation: y^2 = x^3 + A*x + B.
-// Or in projective coordinates: Y^2 = X^3 + a*X*Z^4 + b*Z^6.
-// The point under test is given by projective triplet (X,Y,Z),
-// which represents actually (x,y) = (X/Z^2,Y/Z^3).
-*/
-int ECCP384_IsPointOnCurve(const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* let think Infinity point is on the curve */
- if( ECCP_IsPointAtInfinity(pPoint) )
- return 1;
-
- else {
- IppsBigNumState* pR = cpBigNumListGet(&pList);
- IppsBigNumState* pT = cpBigNumListGet(&pList);
-
- PMA384_sqr(pR, ECP_POINT_X(pPoint)); // R = X^3
- PMA384_mul(pR, pR, ECP_POINT_X(pPoint));
-
- /* case Z != 1 */
- if( !ECP_POINT_AFFINE(pPoint) ) {
- IppsBigNumState* pZ4 = cpBigNumListGet(&pList);
- IppsBigNumState* pZ6 = cpBigNumListGet(&pList);
- PMA384_sqr(pT, ECP_POINT_Z(pPoint)); // Z^2
- PMA384_sqr(pZ4, pT); // Z^4
- PMA384_mul(pZ6, pZ4, pT); // Z^6
-
- PMA384_mul(pT, pZ4, ECP_POINT_X(pPoint)); // T = X*Z^4
- if( ECP_AMI3(pECC) ) {
- IppsBigNumState* pU = cpBigNumListGet(&pList);
- PMA384_add(pU, pT, pT); // R = X^3 +a*X*Z^4
- PMA384_add(pU, pU, pT);
- PMA384_sub(pR, pR, pU);
- }
- else {
- PMA384_mul(pT, pT, ECP_A(pECC)); // R = X^3 +a*X*Z^4
- PMA384_add(pR, pR, pT);
- }
- PMA384_mul(pT, pZ6, ECP_B(pECC)); // R = X^3 +a*X*Z^4 + b*Z^6
- PMA384_add(pR, pR, pT);
-
- }
- /* case Z == 1 */
- else {
- if( ECP_AMI3(pECC) ) {
- PMA384_add(pT, ECP_POINT_X(pPoint), ECP_POINT_X(pPoint)); // R = X^3 +a*X
- PMA384_add(pT, pT, ECP_POINT_X(pPoint));
- PMA384_sub(pR, pR, pT);
- }
- else {
- PMA384_mul(pT, ECP_POINT_X(pPoint), ECP_A(pECC)); // R = X^3 +a*X
- PMA384_add(pR, pR, pT);
- }
- PMA384_add(pR, pR, ECP_B(pECC)); // R = X^3 +a*X + b
- }
- PMA384_sqr(pT, ECP_POINT_Y(pPoint)); // T = Y^2
- return 0==cpBN_cmp(pR, pT);
- }
-}
-
-/*
-// ECCP384_ComparePoint
-//
-// Compare two points:
-// returns 0 => pP==pQ (maybe both pP and pQ are at Infinity)
-// returns 1 => pP!=pQ
-//
-// Note
-// In general we check:
-// P_X*Q_Z^2 ~ Q_X*P_Z^2
-// P_Y*Q_Z^3 ~ Q_Y*P_Z^3
-*/
-int ECCP384_ComparePoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- UNREFERENCED_PARAMETER(pECC);
-
- /* P or/and Q at Infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- return ECCP_IsPointAtInfinity(pQ)? 0:1;
- if( ECCP_IsPointAtInfinity(pQ) )
- return ECCP_IsPointAtInfinity(pP)? 0:1;
-
- /* (P_Z==1) && (Q_Z==1) */
- if( ECP_POINT_AFFINE(pP) && ECP_POINT_AFFINE(pQ) )
- return ((0==cpBN_cmp(ECP_POINT_X(pP),ECP_POINT_X(pQ))) && (0==cpBN_cmp(ECP_POINT_Y(pP),ECP_POINT_Y(pQ))))? 0:1;
-
- {
- IppsBigNumState* pPtmp = cpBigNumListGet(&pList);
- IppsBigNumState* pQtmp = cpBigNumListGet(&pList);
- IppsBigNumState* pPZ = cpBigNumListGet(&pList);
- IppsBigNumState* pQZ = cpBigNumListGet(&pList);
-
- /* P_X*Q_Z^2 ~ Q_X*P_Z^2 */
- if( !ECP_POINT_AFFINE(pQ) ) {
- PMA384_sqr(pQZ, ECP_POINT_Z(pQ)); /* Ptmp = P_X*Q_Z^2 */
- PMA384_mul(pPtmp, ECP_POINT_X(pP), pQZ);
- }
- else {
- PMA_set(pPtmp, ECP_POINT_X(pP));
- }
- if( !ECP_POINT_AFFINE(pP) ) {
- PMA384_sqr(pPZ, ECP_POINT_Z(pP)); /* Qtmp = Q_X*P_Z^2 */
- PMA384_mul(pQtmp, ECP_POINT_X(pQ), pPZ);
- }
- else {
- PMA_set(pQtmp, ECP_POINT_X(pQ));
- }
- if ( cpBN_cmp(pPtmp, pQtmp) )
- return 1; /* points are different: (P_X*Q_Z^2) != (Q_X*P_Z^2) */
-
- /* P_Y*Q_Z^3 ~ Q_Y*P_Z^3 */
- if( !ECP_POINT_AFFINE(pQ) ) {
- PMA384_mul(pQZ, pQZ, ECP_POINT_Z(pQ)); /* Ptmp = P_Y*Q_Z^3 */
- PMA384_mul(pPtmp, ECP_POINT_Y(pP), pQZ);
- }
- else {
- PMA_set(pPtmp, ECP_POINT_Y(pP));
- }
- if( !ECP_POINT_AFFINE(pP) ) {
- PMA384_mul(pPZ, pPZ, ECP_POINT_Z(pP)); /* Qtmp = Q_Y*P_Z^3 */
- PMA384_mul(pQtmp, ECP_POINT_Y(pQ), pPZ);
- }
- else {
- PMA_set(pQtmp, ECP_POINT_Y(pQ));
- }
- return cpBN_cmp(pPtmp, pQtmp)? 1:0;
- }
-}
-
-/*
-// ECCP384_NegPoint
-//
-// Negative point
-*/
-void ECCP384_NegPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
-
- /* test point at Infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- ECCP_SetPointToInfinity(pR);
-
- else {
- BNU_CHUNK_T* pRy = BN_NUMBER(ECP_POINT_Y(pR));
- BNU_CHUNK_T* pPy = BN_NUMBER(ECP_POINT_Y(pP));
- int size = LEN_P384;
-
- if( pP!=pR ) {
- PMA_set(ECP_POINT_X(pR), ECP_POINT_X(pP));
- PMA_set(ECP_POINT_Z(pR), ECP_POINT_Z(pP));
- ECP_POINT_AFFINE(pR) = ECP_POINT_AFFINE(pP);
- }
- cpSub_BNU(pRy, (BNU_CHUNK_T*)secp384r1_p, pPy, LEN_P384);
- FIX_BNU(pRy,size);
- BN_SIZE(ECP_POINT_Y(pR)) = size;
- BN_SIGN(ECP_POINT_Y(pR)) = ippBigNumPOS;
- }
-}
-
-/*
-// ECCP384_DblPoint
-//
-// Double point
-*/
-void ECCP384_DblPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* P at infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- ECCP_SetPointToInfinity(pR);
-
- else {
- IppsBigNumState* bnV = cpBigNumListGet(&pList);
- IppsBigNumState* bnU = cpBigNumListGet(&pList);
- IppsBigNumState* bnM = cpBigNumListGet(&pList);
- IppsBigNumState* bnS = cpBigNumListGet(&pList);
- IppsBigNumState* bnT = cpBigNumListGet(&pList);
-
- /* M = 3*X^2 + A*Z^4 */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA384_sqr(bnU, ECP_POINT_X(pP));
- PMA384_add(bnM, bnU, bnU);
- PMA384_add(bnM, bnM, bnU);
- PMA384_add(bnM, bnM, ECP_A(pECC));
- }
- else if( ECP_AMI3(pECC) ) {
- PMA384_sqr(bnU, ECP_POINT_Z(pP));
- PMA384_add(bnS, ECP_POINT_X(pP), bnU);
- PMA384_sub(bnT, ECP_POINT_X(pP), bnU);
- PMA384_mul(bnM, bnS, bnT);
- PMA384_add(bnU, bnM, bnM);
- PMA384_add(bnM, bnU, bnM);
- }
- else {
- PMA384_sqr(bnU, ECP_POINT_X(pP));
- PMA384_add(bnM, bnU, bnU);
- PMA384_add(bnM, bnM, bnU);
- PMA384_sqr(bnU, ECP_POINT_Z(pP));
- PMA384_sqr(bnU, bnU);
- PMA384_mul(bnU, bnU, ECP_A(pECC));
- PMA384_add(bnM, bnM, bnU);
- }
-
- PMA384_add(bnV, ECP_POINT_Y(pP), ECP_POINT_Y(pP));
-
- /* R_Z = 2*Y*Z */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(ECP_POINT_Z(pR), bnV);
- }
- else {
- PMA384_mul(ECP_POINT_Z(pR), bnV, ECP_POINT_Z(pP));
- }
-
- /* S = 4*X*Y^2 */
- PMA384_sqr(bnT, bnV);
- PMA384_mul(bnS, bnT, ECP_POINT_X(pP));
-
- /* R_X = M^2 - 2*S */
- PMA384_sqr(bnU, bnM);
- PMA384_sub(bnU, bnU, bnS);
- PMA384_sub(ECP_POINT_X(pR), bnU, bnS);
-
- /* T = 8*Y^4 */
- PMA384_mul(bnV, bnV, ECP_POINT_Y(pP));
- PMA384_mul(bnT, bnT, bnV);
-
- /* R_Y = M*(S - R_X) - T */
- PMA384_sub(bnS, bnS, ECP_POINT_X(pR));
- PMA384_mul(bnS, bnS, bnM);
- PMA384_sub(ECP_POINT_Y(pR), bnS, bnT);
-
- ECP_POINT_AFFINE(pR) = 0;
- }
-}
-
-/*
-// ECCP384_AddPoint
-//
-// Add points
-*/
-void ECCP384_AddPoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
-#if 0
- /* test stupid call */
- if( pP == pQ ) {
- ECCP384_DblPoint(pP, pR, pECC, pList);
- return;
- }
-#endif
-
- /* prevent operation with point at Infinity */
- if( ECCP_IsPointAtInfinity(pP) ) {
- ECCP_CopyPoint(pQ, pR);
- return;
- }
- if( ECCP_IsPointAtInfinity(pQ) ) {
- ECCP_CopyPoint(pP, pR);
- return;
- }
-
- /*
- // addition
- */
- {
- IppsBigNumState* bnU0 = cpBigNumListGet(&pList);
- IppsBigNumState* bnS0 = cpBigNumListGet(&pList);
- IppsBigNumState* bnU1 = cpBigNumListGet(&pList);
- IppsBigNumState* bnS1 = cpBigNumListGet(&pList);
- IppsBigNumState* bnW = cpBigNumListGet(&pList);
- IppsBigNumState* bnR = cpBigNumListGet(&pList);
- IppsBigNumState *bnT = bnU0;
- IppsBigNumState *bnM = bnS0;
-
- /* U0 = P_X * Q_Z^2 */
- /* S0 = P_Y * Q_Z^3 */
- if( ECP_POINT_AFFINE(pQ) ) {
- PMA_set(bnU0, ECP_POINT_X(pP));
- PMA_set(bnS0, ECP_POINT_Y(pP));
- }
- else {
- PMA384_sqr(bnW, ECP_POINT_Z(pQ));
- PMA384_mul(bnU0,ECP_POINT_X(pP), bnW);
- PMA384_mul(bnW, ECP_POINT_Z(pQ), bnW);
- PMA384_mul(bnS0,ECP_POINT_Y(pP), bnW);
- }
-
- /* U1 = Q_X * P_Z^2 */
- /* S1 = Q_Y * P_Z^3 */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(bnU1, ECP_POINT_X(pQ));
- PMA_set(bnS1, ECP_POINT_Y(pQ));
- }
- else {
- PMA384_sqr(bnW, ECP_POINT_Z(pP));
- PMA384_mul(bnU1,ECP_POINT_X(pQ), bnW);
- PMA384_mul(bnW, ECP_POINT_Z(pP), bnW);
- PMA384_mul(bnS1,ECP_POINT_Y(pQ), bnW);
- }
-
- /* W = U0-U1 */
- /* R = S0-S1 */
- PMA384_sub(bnW, bnU0, bnU1);
- PMA384_sub(bnR, bnS0, bnS1);
-
- //if( IsZero_BN(bnW) ) {
- //if( IsZero_BN(bnR) ) {
- if(cpEqu_BNU_CHUNK(BN_NUMBER(bnW), LEN_P384, 0)) {
- if(cpEqu_BNU_CHUNK(BN_NUMBER(bnR), LEN_P384, 0)) {
- ECCP384_DblPoint(pP, pR, pECC, pList);
- return;
- }
- else {
- ECCP_SetPointToInfinity(pR);
- return;
- }
- }
-
- /* T = U0+U1 */
- /* M = S0+S1 */
- PMA384_add(bnT, bnU0, bnU1);
- PMA384_add(bnM, bnS0, bnS1);
-
- /* R_Z = P_Z * Q_Z * W */
- if( ECP_POINT_AFFINE(pQ) && ECP_POINT_AFFINE(pP) ) {
- PMA_set(ECP_POINT_Z(pR), bnW);
- }
- else {
- if( ECP_POINT_AFFINE(pQ) ) {
- PMA_set(bnU1, ECP_POINT_Z(pP));
- }
- else if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(bnU1, ECP_POINT_Z(pQ));
- }
- else {
- PMA384_mul(bnU1, ECP_POINT_Z(pP), ECP_POINT_Z(pQ));
- }
- PMA384_mul(ECP_POINT_Z(pR), bnU1, bnW);
- }
-
- PMA384_sqr(bnU1, bnW); /* U1 = W^2 */
- PMA384_mul(bnS1, bnT, bnU1); /* S1 = T * W^2 */
-
- /* R_X = R^2 - T * W^2 */
- PMA384_sqr(ECP_POINT_X(pR), bnR);
- PMA384_sub(ECP_POINT_X(pR), ECP_POINT_X(pR), bnS1);
-
- /* V = T * W^2 - 2 * R_X (S1) */
- PMA384_sub(bnS1, bnS1, ECP_POINT_X(pR));
- PMA384_sub(bnS1, bnS1, ECP_POINT_X(pR));
-
- /* R_Y = (V * R - M * W^3) /2 */
- PMA384_mul(ECP_POINT_Y(pR), bnS1, bnR);
- PMA384_mul(bnU1, bnU1, bnW);
- PMA384_mul(bnU1, bnU1, bnM);
- PMA384_sub(bnU1, ECP_POINT_Y(pR), bnU1);
- PMA384_div2(ECP_POINT_Y(pR), bnU1);
-
- ECP_POINT_AFFINE(pR) = 0;
- }
-}
-
-/*
-// ECCP384_MulPoint
-//
-// Multiply point by scalar
-*/
-#if !defined (_USE_ECCP_SSCM_)
-void ECCP384_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnN,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalar or input point at Infinity */
- if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) {
- ECCP_SetPointToInfinity(pR);
- return;
- }
-
- /*
- // scalar multiplication
- */
- else {
- IppsECCPPointState T;
- IppsECCPPointState U;
- IppsBigNumState* bnKH = cpBigNumListGet(&pList);
- Ipp32u* pK;
- Ipp32u* pH;
- Ipp32u carry;
- int lenKH;
- int bitH;
-
- /* init result */
- ECCP_CopyPoint(pP, pR);
-
- /* if scalar is negative */
- if( ippBigNumNEG == BN_SIGN(bnN) ) {
- /* negative R */
- ECCP384_NegPoint(pR, pR, pECC);
- }
-
- /* copy K = N and compute H=3*K */
- lenKH = BN_SIZE(bnN)+1;
- pK = BN_NUMBER(bnKH);
- pH = BN_BUFFER(bnKH);
- Cpy_BNU(BN_NUMBER(bnN), pK, BN_SIZE(bnN));
- pK[lenKH-1] = 0;
- carry = cpAdd_BNU(pH, pK, pK, lenKH);
- carry = cpAdd_BNU(pH, pK, pH, lenKH);
-
- /* init temporary T = (X/Z^2, Y/Z^3, 1) */
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
- ECCP384_GetPointAffine(ECP_POINT_X(&T), ECP_POINT_Y(&T), pR, pECC, pList);
- ECCP384_SetPointAffine(ECP_POINT_X(&T), ECP_POINT_Y(&T), &T, pECC);
-
- /* temporary point U =-T */
- ECP_POINT_X(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&U) = cpBigNumListGet(&pList);
- ECCP384_NegPoint(&T, &U, pECC);
-
- for(bitH=MSB_BNU(pH, lenKH)-1; bitH>0; bitH--) {
- int hBit = TST_BIT(pH, bitH);
- int kBit = TST_BIT(pK, bitH);
- ECCP384_DblPoint(pR, pR, pECC, pList);
- if( hBit && !kBit )
- ECCP384_AddPoint(pR, &T, pR, pECC, pList);
- if(!hBit && kBit )
- ECCP384_AddPoint(pR, &U, pR, pECC, pList);
- }
- }
-}
-
-#else
-#pragma message ("ECCP384_MulPoint: SCCM version")
-
-void ECCP384_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnN,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalar or input point at Infinity */
- if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) {
- ECCP_SetPointToInfinity(pR);
- return;
- }
-
- /*
- // scalar multiplication
- */
- else {
- Ipp8u* pScratchAligned = ECP_SCCMBUFF(pECC);
-
- BNU_CHUNK_T* pN = BN_NUMBER(bnN);
- cpSize nsN = BN_SIZE(bnN);
- /* scalar bitsize */
- int scalarBitSize = BITSIZE_BNU(pN, nsN);
- /* optimal size of window */
- int w = cpECCP_OptimalWinSize(scalarBitSize);
- /* number of table entries */
- int nPrecomputed = 1<<w;
-
- /* allocate temporary scalar */
- IppsBigNumState* bnTN = cpBigNumListGet(&pList);
- BNU_CHUNK_T* pTN = BN_NUMBER(bnTN);
-
- int coordSize = BITS_BNU_CHUNK(ECP_GFEBITS(pECC));
- IppsECCPPointState T;
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
- ECCP_SetPointToInfinity(&T);
-
- /* init result */
- ECCP_CopyPoint(pP, pR);
- if( ippBigNumNEG == BN_SIGN(bnN) )
- ECCP384_NegPoint(pR, pR, pECC);
-
- /* pre-compute auxiliary table t[] = {(2^w)*P, 1*P, 2*P, ..., (2^(w-1))*P} */
- {
- int n;
- for(n=1; n<nPrecomputed; n++) {
- ECCP384_AddPoint(pR, &T, &T, pECC, pList);
- cpECCP_ScramblePut(pScratchAligned+n, nPrecomputed, &T, coordSize);
- }
- ECCP384_AddPoint(pR, &T, &T, pECC, pList);
- cpECCP_ScramblePut(pScratchAligned, nPrecomputed, &T, coordSize);
- }
-
- /* copy scalar */
- cpCpy_BNU(pTN, pN, nsN);
- /* and convert it presentaion to avoid usage of O point */
- scalarBitSize = cpECCP_ConvertRepresentation(pTN, scalarBitSize, w);
-
- /* prepare temporary scalar for processing */
- pTN[BITS_BNU_CHUNK(scalarBitSize)] = 0;
- scalarBitSize = ((scalarBitSize+w-1)/w)*w;
-
- /*
- // scalar multiplication
- */
- {
- Ipp32u dmask = nPrecomputed-1;
-
- /* position (bit number) of the leftmost window */
- int wPosition = scalarBitSize-w;
-
- /* extract leftmost window value */
- Ipp32u eChunk = *((Ipp32u*)((Ipp16u*)pTN + wPosition/BITSIZE(Ipp16u)));
- int shift = wPosition & 0xF;
- Ipp32u windowVal = (eChunk>>shift) & dmask;
-
- /* initialize result (ECP_FINITE_POINT|ECP_PROJECTIVE) */
- cpECCP_ScrambleGet(pR, coordSize, pScratchAligned+windowVal, nPrecomputed);
- ECP_POINT_AFFINE(pR) = 0;
-
- /* initialize temporary T (ECP_PROJECTIVE) */
- ECP_POINT_AFFINE(&T) = 0;
-
- for(wPosition-=w; wPosition>=0; wPosition-=w) {
- /* w times doubling */
- int k;
- for(k=0; k<w; k++)
- ECCP384_DblPoint(pR, pR, pECC, pList);
-
- /* extract next window value */
- eChunk = *((Ipp32u*)((Ipp16u*)pTN + wPosition/BITSIZE(Ipp16u)));
- shift = wPosition & 0xF;
- windowVal = (eChunk>>shift) & dmask;
-
- /* extract value from the pre-computed table */
- cpECCP_ScrambleGet(&T, coordSize, pScratchAligned+windowVal, nPrecomputed);
-
- /* and add it */
- ECCP384_AddPoint(pR, &T, pR, pECC, pList);
- }
- }
- }
-}
-#endif
-
-void ECCP384_MulBasePoint(const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- ECCP384_MulPoint(ECP_GENC(pECC), pK, pR, pECC, pList);
-}
-
-/*
-// ECCP384_ProdPoint
-//
-// Point product
-*/
-#if !defined (_USE_ECCP_SSCM_)
-void ECCP384_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalars */
- if( IsZero_BN(bnPscalar) ) {
- ECCP384_MulPoint(pQ, bnQscalar, pR, pECC, pList);
- return;
- }
- if( IsZero_BN(bnQscalar) ) {
- ECCP384_MulPoint(pP, bnPscalar, pR, pECC, pList);
- return;
- }
-
- /*
- // point product
- */
- else {
- int n;
- Ipp32u* pbnPscalar = BN_NUMBER(bnPscalar);
- int bnPscalarSize = BN_SIZE(bnPscalar);
- Ipp32u* pbnQscalar = BN_NUMBER(bnQscalar);
- int bnQscalarSize = BN_SIZE(bnQscalar);
-
- int size = bnPscalarSize>bnQscalarSize? bnPscalarSize : bnQscalarSize;
-
- IppsECCPPointState* pPointPQ[4] = {NULL, NULL, NULL, NULL};
-
- /* allocate temporary PQ point */
- IppsECCPPointState PQ;
- ECP_POINT_X(&PQ) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&PQ) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&PQ) = cpBigNumListGet(&pList);
-
- /* init temporary point array */
- if(ippBigNumPOS == BN_SIGN(bnPscalar))
- pPointPQ[1] = (IppsECCPPointState*)pP;
- else {
- IppsECCPPointState P;
- ECP_POINT_X(&P) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&P) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&P) = cpBigNumListGet(&pList);
- ECCP384_NegPoint(pP, &P, pECC);
- pPointPQ[1] = &P;
- }
- if(ippBigNumPOS == BN_SIGN(bnQscalar))
- pPointPQ[2] = (IppsECCPPointState*)pQ;
- else {
- IppsECCPPointState Q;
- ECP_POINT_X(&Q) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&Q) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&Q) = cpBigNumListGet(&pList);
- ECCP384_NegPoint(pQ, &Q, pECC);
- pPointPQ[2] = &Q;
- }
-
- ECCP384_AddPoint(pPointPQ[1], pPointPQ[2], &PQ, pECC, pList);
- ECCP384_GetPointAffine(ECP_POINT_X(pR), ECP_POINT_Y(pR), &PQ, pECC, pList);
- ECCP384_SetPointAffine(ECP_POINT_X(pR), ECP_POINT_Y(pR), &PQ, pECC);
- pPointPQ[3] = &PQ;
-
- /* pad scalars by zeros */
- ZEXPAND_BNU(pbnPscalar,bnPscalarSize, size);
- ZEXPAND_BNU(pbnQscalar,bnQscalarSize, size);
-
- /* init result */
- ECCP_SetPointToInfinity(pR);
-
- for(n=size; n>0; n--) {
- Ipp32u scalarPn = pbnPscalar[n-1];
- Ipp32u scalarQn = pbnQscalar[n-1];
-
- int nBit;
- for(nBit=31; nBit>=0; nBit--) {
- int
- PnQnBits = scalarPn&0x80000000? 1:0;
- PnQnBits+= scalarQn&0x80000000? 2:0;
-
- if( !ECCP_IsPointAtInfinity(pR) )
- ECCP384_DblPoint(pR, pR, pECC, pList);
- if( PnQnBits )
- ECCP384_AddPoint(pR, pPointPQ[PnQnBits], pR, pECC, pList);
-
- scalarPn <<= 1;
- scalarQn <<= 1;
- }
- }
- }
-}
-
-#else
-#pragma message ("ECCP384_ProdPoint: SCCM version")
-
-void ECCP384_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- IppsECCPPointState T;
- IppsECCPPointState U;
-
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
-
- ECP_POINT_X(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&U) = cpBigNumListGet(&pList);
-
- ECCP384_MulPoint(pP, bnPscalar, &T, (IppsECCPState*)pECC, pList);
- ECCP384_MulPoint(pQ, bnQscalar, &U, (IppsECCPState*)pECC, pList);
- ECCP384_AddPoint(&T, &U, pR, pECC, pList);
-}
-#endif
-
-#endif /* _ECP_384_==_ECP_IMPL_SPECIFIC_ */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpmethod521.h b/ext/ipp/sources/ippcp/src/pcpeccpmethod521.h
deleted file mode 100644
index d931bc6..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpmethod521.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Definitions of EC methods over GF(P521)
-//
-//
-*/
-
-#if !defined(_PCP_ECCPMETHOD521_H)
-#define _PCP_ECCPMETHOD521_H
-
-#include "pcpeccp.h"
-
-
-/*
-// Returns reference
-*/
-ECCP_METHOD* ECCP521_Methods(void);
-
-
-/*
-// Point Set. These operations implies
-// transformation of regular coordinates into internal format
-*/
-void ECCP521_SetPointProjective(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- const IppsBigNumState* pZ,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC);
-
-void ECCP521_SetPointAffine(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC);
-
-/*
-// Get Point. These operations implies
-// transformation of internal format coordinates into regular
-*/
-//void ECCP521_GetPointProjective(IppsBigNumState* pX,
-// IppsBigNumState* pY,
-// IppsBigNumState* pZ,
-// const IppsECCPPointState* pPoint,
-// const IppsECCPState* pECC);
-
-void ECCP521_GetPointAffine(IppsBigNumState* pX,
- IppsBigNumState* pY,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-/*
-// Test is On EC
-*/
-int ECCP521_IsPointOnCurve(const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-/*
-// Operations
-*/
-int ECCP521_ComparePoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP521_NegPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC);
-
-void ECCP521_DblPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP521_AddPoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP521_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP521_MulBasePoint(const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP521_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-#endif /* _PCP_ECCPMETHOD521_H */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpmethod521ca.c b/ext/ipp/sources/ippcp/src/pcpeccpmethod521ca.c
deleted file mode 100644
index 0bc7c59..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpmethod521ca.c
+++ /dev/null
@@ -1,879 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// EC methods over GF(P521)
-//
-// Contents:
-// ECCP521_SetPointProjective()
-// ECCP521_SetPointAffine()
-// ECCP521_GetPointAffine()
-//
-// ECCP521_IsPointOnCurve()
-//
-// ECCP521_ComparePoint()
-// ECCP521_NegPoint()
-// ECCP521_DblPoint()
-// ECCP521_AddPoint()
-// ECCP521_MulPoint()
-// ECCP521_ProdPoint()
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-
-#if (_ECP_521_==_ECP_IMPL_SPECIFIC_)
-#include "pcpeccppoint.h"
-#include "pcpeccpmethod.h"
-#include "pcpeccpmethodcom.h"
-#include "pcpeccpmethod521.h"
-#include "pcppma521.h"
-
-/*
- NOTE:
- ECCP521 methods are used representation of point coordinates
- in regular (usual residue) domain, because of special modular reduction
-*/
-static
-ECCP_METHOD ECCP521 = {
- ECCP521_SetPointProjective,
- ECCP521_SetPointAffine,
- ECCP521_GetPointAffine,
-
- ECCP521_IsPointOnCurve,
-
- ECCP521_ComparePoint,
- ECCP521_NegPoint,
- ECCP521_DblPoint,
- ECCP521_AddPoint,
- ECCP521_MulPoint,
- ECCP521_MulBasePoint,
- ECCP521_ProdPoint
-};
-
-
-/*
-// Returns reference
-*/
-ECCP_METHOD* ECCP521_Methods(void)
-{
- return &ECCP521;
-}
-
-/*
-// ECCP521_PoinSettProjective
-// Converts regular projective triplet (pX,pY,pZ) into pPoint
-// (see note above)
-*/
-void ECCP521_SetPointProjective(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- const IppsBigNumState* pZ,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
- cpBN_copy(ECP_POINT_X(pPoint), pX);
- cpBN_copy(ECP_POINT_Y(pPoint), pY);
- cpBN_copy(ECP_POINT_Z(pPoint), pZ);
- ECP_POINT_AFFINE(pPoint) = cpBN_cmp(pZ, BN_ONE_REF())==0;
-}
-
-/*
-// ECCP521_PointAffineSet
-// Converts regular affine pair (pX,pY) into pPoint
-*/
-void ECCP521_SetPointAffine(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- ECCP521_SetPointProjective(pX, pY, BN_ONE_REF(), pPoint, pECC);
-}
-
-/*
-// ECCP521_GetPointProjective
-// Converts pPoint into regular projective triplet (pX,pY,pZ)
-*/
-#if 0
-void ECCP521_GetPointProjective(IppsBigNumState* pX,
- IppsBigNumState* pY,
- IppsBigNumState* pZ,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
- cpBN_copy(pX, ECP_POINT_X(pPoint));
- cpBN_copy(pY, ECP_POINT_Y(pPoint));
- cpBN_copy(pZ, ECP_POINT_Z(pPoint));
-}
-#endif
-
-/*
-// ECCP521_GetPointAffine
-//
-// Converts pPoint into regular affine pair (pX,pY)
-//
-// Note:
-// pPoint is not point at Infinity
-// transform (X, Y, Z) into (x, y) = (X/Z^2, Y/Z^3)
-*/
-void ECCP521_GetPointAffine(IppsBigNumState* pX, IppsBigNumState* pY,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* case Z == 1 */
- if( ECP_POINT_AFFINE(pPoint) ) {
- if(pX) {
- cpBN_copy(pX, ECP_POINT_X(pPoint));
- }
- if(pY) {
- cpBN_copy(pY, ECP_POINT_Y(pPoint));
- }
- }
-
- /* case Z != 1 */
- else {
- //IppsMontState* pMont = ECP_PMONT(pECC);
- IppsBigNumState* pModulo = ECP_PRIME(pECC);
-
- IppsBigNumState* pT = cpBigNumListGet(&pList);
- IppsBigNumState* pU = cpBigNumListGet(&pList);
- //IppsBigNumState* pModulo = cpBigNumListGet(&pList);
- //BN_Set(MNT_MODULUS(pMont), MNT_SIZE(pMont), pModulo);
-
- /* U = 1/Z */
- PMA521_inv(pU, ECP_POINT_Z(pPoint), pModulo);
- /* T = 1/(Z^2) */
- PMA521_sqr(pT, pU);
-
- if(pX) {
- PMA521_mul(pX,pT, ECP_POINT_X(pPoint));
- cpBN_fix(pX);
- }
- if(pY) {
- /* U = 1/(Z^3) */
- PMA521_mul(pU, pU, pT);
- PMA521_mul(pY,pU, ECP_POINT_Y(pPoint));
- cpBN_fix(pY);
- }
- }
-}
-
-/*
-// ECCP521_IsPointOnCurve
-//
-// Test point is lie on curve
-//
-// Note
-// We deal with equation: y^2 = x^3 + A*x + B.
-// Or in projective coordinates: Y^2 = X^3 + a*X*Z^4 + b*Z^6.
-// The point under test is given by projective triplet (X,Y,Z),
-// which represents actually (x,y) = (X/Z^2,Y/Z^3).
-*/
-int ECCP521_IsPointOnCurve(const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* let think Infinity point is on the curve */
- if( ECCP_IsPointAtInfinity(pPoint) )
- return 1;
-
- else {
- IppsBigNumState* pR = cpBigNumListGet(&pList);
- IppsBigNumState* pT = cpBigNumListGet(&pList);
-
- PMA521_sqr(pR, ECP_POINT_X(pPoint)); // R = X^3
- PMA521_mul(pR, pR, ECP_POINT_X(pPoint));
-
- /* case Z != 1 */
- if( !ECP_POINT_AFFINE(pPoint) ) {
- IppsBigNumState* pZ4 = cpBigNumListGet(&pList);
- IppsBigNumState* pZ6 = cpBigNumListGet(&pList);
- PMA521_sqr(pT, ECP_POINT_Z(pPoint)); // Z^2
- PMA521_sqr(pZ4, pT); // Z^4
- PMA521_mul(pZ6, pZ4, pT); // Z^6
-
- PMA521_mul(pT, pZ4, ECP_POINT_X(pPoint)); // T = X*Z^4
- if( ECP_AMI3(pECC) ) {
- IppsBigNumState* pU = cpBigNumListGet(&pList);
- PMA521_add(pU, pT, pT); // R = X^3 +a*X*Z^4
- PMA521_add(pU, pU, pT);
- PMA521_sub(pR, pR, pU);
- }
- else {
- PMA521_mul(pT, pT, ECP_A(pECC)); // R = X^3 +a*X*Z^4
- PMA521_add(pR, pR, pT);
- }
- PMA521_mul(pT, pZ6, ECP_B(pECC)); // R = X^3 +a*X*Z^4 + b*Z^6
- PMA521_add(pR, pR, pT);
-
- }
- /* case Z == 1 */
- else {
- if( ECP_AMI3(pECC) ) {
- PMA521_add(pT, ECP_POINT_X(pPoint), ECP_POINT_X(pPoint)); // R = X^3 +a*X
- PMA521_add(pT, pT, ECP_POINT_X(pPoint));
- PMA521_sub(pR, pR, pT);
- }
- else {
- PMA521_mul(pT, ECP_POINT_X(pPoint), ECP_A(pECC)); // R = X^3 +a*X
- PMA521_add(pR, pR, pT);
- }
- PMA521_add(pR, pR, ECP_B(pECC)); // R = X^3 +a*X + b
- }
- PMA521_sqr(pT, ECP_POINT_Y(pPoint)); // T = Y^2
- return 0==cpBN_cmp(pR, pT);
- }
-}
-
-/*
-// ECCP521_ComparePoint
-//
-// Compare two points:
-// returns 0 => pP==pQ (maybe both pP and pQ are at Infinity)
-// returns 1 => pP!=pQ
-//
-// Note
-// In general we check:
-// P_X*Q_Z^2 ~ Q_X*P_Z^2
-// P_Y*Q_Z^3 ~ Q_Y*P_Z^3
-*/
-int ECCP521_ComparePoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- UNREFERENCED_PARAMETER(pECC);
-
- /* P or/and Q at Infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- return ECCP_IsPointAtInfinity(pQ)? 0:1;
- if( ECCP_IsPointAtInfinity(pQ) )
- return ECCP_IsPointAtInfinity(pP)? 0:1;
-
- /* (P_Z==1) && (Q_Z==1) */
- if( ECP_POINT_AFFINE(pP) && ECP_POINT_AFFINE(pQ) )
- return ((0==cpBN_cmp(ECP_POINT_X(pP),ECP_POINT_X(pQ))) && (0==cpBN_cmp(ECP_POINT_Y(pP),ECP_POINT_Y(pQ))))? 0:1;
-
- {
- IppsBigNumState* pPtmp = cpBigNumListGet(&pList);
- IppsBigNumState* pQtmp = cpBigNumListGet(&pList);
- IppsBigNumState* pPZ = cpBigNumListGet(&pList);
- IppsBigNumState* pQZ = cpBigNumListGet(&pList);
-
- /* P_X*Q_Z^2 ~ Q_X*P_Z^2 */
- if( !ECP_POINT_AFFINE(pQ) ) {
- PMA521_sqr(pQZ, ECP_POINT_Z(pQ)); /* Ptmp = P_X*Q_Z^2 */
- PMA521_mul(pPtmp, ECP_POINT_X(pP), pQZ);
- }
- else {
- PMA_set(pPtmp, ECP_POINT_X(pP));
- }
- if( !ECP_POINT_AFFINE(pP) ) {
- PMA521_sqr(pPZ, ECP_POINT_Z(pP)); /* Qtmp = Q_X*P_Z^2 */
- PMA521_mul(pQtmp, ECP_POINT_X(pQ), pPZ);
- }
- else {
- PMA_set(pQtmp, ECP_POINT_X(pQ));
- }
- if ( cpBN_cmp(pPtmp, pQtmp) )
- return 1; /* points are different: (P_X*Q_Z^2) != (Q_X*P_Z^2) */
-
- /* P_Y*Q_Z^3 ~ Q_Y*P_Z^3 */
- if( !ECP_POINT_AFFINE(pQ) ) {
- PMA521_mul(pQZ, pQZ, ECP_POINT_Z(pQ)); /* Ptmp = P_Y*Q_Z^3 */
- PMA521_mul(pPtmp, ECP_POINT_Y(pP), pQZ);
- }
- else {
- PMA_set(pPtmp, ECP_POINT_Y(pP));
- }
- if( !ECP_POINT_AFFINE(pP) ) {
- PMA521_mul(pPZ, pPZ, ECP_POINT_Z(pP)); /* Qtmp = Q_Y*P_Z^3 */
- PMA521_mul(pQtmp, ECP_POINT_Y(pQ), pPZ);
- }
- else {
- PMA_set(pQtmp, ECP_POINT_Y(pQ));
- }
- return cpBN_cmp(pPtmp, pQtmp)? 1:0;
- }
-}
-
-/*
-// ECCP521_NegPoint
-//
-// Negative point
-*/
-void ECCP521_NegPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
-
- /* test point at Infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- ECCP_SetPointToInfinity(pR);
-
- else {
- BNU_CHUNK_T* pRy = BN_NUMBER(ECP_POINT_Y(pR));
- BNU_CHUNK_T* pPy = BN_NUMBER(ECP_POINT_Y(pP));
- int size = LEN_P521;
-
- if( pP!=pR ) {
- PMA_set(ECP_POINT_X(pR), ECP_POINT_X(pP));
- PMA_set(ECP_POINT_Z(pR), ECP_POINT_Z(pP));
- ECP_POINT_AFFINE(pR) = ECP_POINT_AFFINE(pP);
- }
- cpSub_BNU(pRy, (BNU_CHUNK_T*)secp521r1_p, pPy, LEN_P521);
- FIX_BNU(pRy,size);
- BN_SIZE(ECP_POINT_Y(pR)) = size;
- BN_SIGN(ECP_POINT_Y(pR)) = ippBigNumPOS;
- }
-}
-
-/*
-// ECCP521_DblPoint
-//
-// Double point
-*/
-void ECCP521_DblPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* P at infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- ECCP_SetPointToInfinity(pR);
-
- else {
- IppsBigNumState* bnV = cpBigNumListGet(&pList);
- IppsBigNumState* bnU = cpBigNumListGet(&pList);
- IppsBigNumState* bnM = cpBigNumListGet(&pList);
- IppsBigNumState* bnS = cpBigNumListGet(&pList);
- IppsBigNumState* bnT = cpBigNumListGet(&pList);
-
- /* M = 3*X^2 + A*Z^4 */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA521_sqr(bnU, ECP_POINT_X(pP));
- PMA521_add(bnM, bnU, bnU);
- PMA521_add(bnM, bnM, bnU);
- PMA521_add(bnM, bnM, ECP_A(pECC));
- }
- else if( ECP_AMI3(pECC) ) {
- PMA521_sqr(bnU, ECP_POINT_Z(pP));
- PMA521_add(bnS, ECP_POINT_X(pP), bnU);
- PMA521_sub(bnT, ECP_POINT_X(pP), bnU);
- PMA521_mul(bnM, bnS, bnT);
- PMA521_add(bnU, bnM, bnM);
- PMA521_add(bnM, bnU, bnM);
- }
- else {
- PMA521_sqr(bnU, ECP_POINT_X(pP));
- PMA521_add(bnM, bnU, bnU);
- PMA521_add(bnM, bnM, bnU);
- PMA521_sqr(bnU, ECP_POINT_Z(pP));
- PMA521_sqr(bnU, bnU);
- PMA521_mul(bnU, bnU, ECP_A(pECC));
- PMA521_add(bnM, bnM, bnU);
- }
-
- PMA521_add(bnV, ECP_POINT_Y(pP), ECP_POINT_Y(pP));
-
- /* R_Z = 2*Y*Z */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(ECP_POINT_Z(pR), bnV);
- }
- else {
- PMA521_mul(ECP_POINT_Z(pR), bnV, ECP_POINT_Z(pP));
- }
-
- /* S = 4*X*Y^2 */
- PMA521_sqr(bnT, bnV);
- PMA521_mul(bnS, bnT, ECP_POINT_X(pP));
-
- /* R_X = M^2 - 2*S */
- PMA521_sqr(bnU, bnM);
- PMA521_sub(bnU, bnU, bnS);
- PMA521_sub(ECP_POINT_X(pR), bnU, bnS);
-
- /* T = 8*Y^4 */
- PMA521_mul(bnV, bnV, ECP_POINT_Y(pP));
- PMA521_mul(bnT, bnT, bnV);
-
- /* R_Y = M*(S - R_X) - T */
- PMA521_sub(bnS, bnS, ECP_POINT_X(pR));
- PMA521_mul(bnS, bnS, bnM);
- PMA521_sub(ECP_POINT_Y(pR), bnS, bnT);
-
- ECP_POINT_AFFINE(pR) = 0;
- }
-}
-
-/*
-// ECCP521_AddPoint
-//
-// Add points
-*/
-void ECCP521_AddPoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
-#if 0
- /* test stupid call */
- if( pP == pQ ) {
- ECCP521_DblPoint(pP, pR, pECC, pList);
- return;
- }
-#endif
-
- /* prevent operation with point at Infinity */
- if( ECCP_IsPointAtInfinity(pP) ) {
- ECCP_CopyPoint(pQ, pR);
- return;
- }
- if( ECCP_IsPointAtInfinity(pQ) ) {
- ECCP_CopyPoint(pP, pR);
- return;
- }
-
- /*
- // addition
- */
- {
- IppsBigNumState* bnU0 = cpBigNumListGet(&pList);
- IppsBigNumState* bnS0 = cpBigNumListGet(&pList);
- IppsBigNumState* bnU1 = cpBigNumListGet(&pList);
- IppsBigNumState* bnS1 = cpBigNumListGet(&pList);
- IppsBigNumState* bnW = cpBigNumListGet(&pList);
- IppsBigNumState* bnR = cpBigNumListGet(&pList);
- IppsBigNumState *bnT = bnU0;
- IppsBigNumState *bnM = bnS0;
-
- /* U0 = P_X * Q_Z^2 */
- /* S0 = P_Y * Q_Z^3 */
- if( ECP_POINT_AFFINE(pQ) ) {
- PMA_set(bnU0, ECP_POINT_X(pP));
- PMA_set(bnS0, ECP_POINT_Y(pP));
- }
- else {
- PMA521_sqr(bnW, ECP_POINT_Z(pQ));
- PMA521_mul(bnU0,ECP_POINT_X(pP), bnW);
- PMA521_mul(bnW, ECP_POINT_Z(pQ), bnW);
- PMA521_mul(bnS0,ECP_POINT_Y(pP), bnW);
- }
-
- /* U1 = Q_X * P_Z^2 */
- /* S1 = Q_Y * P_Z^3 */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(bnU1, ECP_POINT_X(pQ));
- PMA_set(bnS1, ECP_POINT_Y(pQ));
- }
- else {
- PMA521_sqr(bnW, ECP_POINT_Z(pP));
- PMA521_mul(bnU1,ECP_POINT_X(pQ), bnW);
- PMA521_mul(bnW, ECP_POINT_Z(pP), bnW);
- PMA521_mul(bnS1,ECP_POINT_Y(pQ), bnW);
- }
-
- /* W = U0-U1 */
- /* R = S0-S1 */
- PMA521_sub(bnW, bnU0, bnU1);
- PMA521_sub(bnR, bnS0, bnS1);
-
- //if( IsZero_BN(bnW) ) {
- //if( IsZero_BN(bnR) ) {
- if(cpEqu_BNU_CHUNK(BN_NUMBER(bnW), LEN_P521, 0)) {
- if(cpEqu_BNU_CHUNK(BN_NUMBER(bnR), LEN_P521, 0)) {
- ECCP521_DblPoint(pP, pR, pECC, pList);
- return;
- }
- else {
- ECCP_SetPointToInfinity(pR);
- return;
- }
- }
-
- /* T = U0+U1 */
- /* M = S0+S1 */
- PMA521_add(bnT, bnU0, bnU1);
- PMA521_add(bnM, bnS0, bnS1);
-
- /* R_Z = P_Z * Q_Z * W */
- if( ECP_POINT_AFFINE(pQ) && ECP_POINT_AFFINE(pP) ) {
- PMA_set(ECP_POINT_Z(pR), bnW);
- }
- else {
- if( ECP_POINT_AFFINE(pQ) ) {
- PMA_set(bnU1, ECP_POINT_Z(pP));
- }
- else if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(bnU1, ECP_POINT_Z(pQ));
- }
- else {
- PMA521_mul(bnU1, ECP_POINT_Z(pP), ECP_POINT_Z(pQ));
- }
- PMA521_mul(ECP_POINT_Z(pR), bnU1, bnW);
- }
-
- PMA521_sqr(bnU1, bnW); /* U1 = W^2 */
- PMA521_mul(bnS1, bnT, bnU1); /* S1 = T * W^2 */
-
- /* R_X = R^2 - T * W^2 */
- PMA521_sqr(ECP_POINT_X(pR), bnR);
- PMA521_sub(ECP_POINT_X(pR), ECP_POINT_X(pR), bnS1);
-
- /* V = T * W^2 - 2 * R_X (S1) */
- PMA521_sub(bnS1, bnS1, ECP_POINT_X(pR));
- PMA521_sub(bnS1, bnS1, ECP_POINT_X(pR));
-
- /* R_Y = (V * R - M * W^3) /2 */
- PMA521_mul(ECP_POINT_Y(pR), bnS1, bnR);
- PMA521_mul(bnU1, bnU1, bnW);
- PMA521_mul(bnU1, bnU1, bnM);
- PMA521_sub(bnU1, ECP_POINT_Y(pR), bnU1);
- PMA521_div2(ECP_POINT_Y(pR), bnU1);
-
- ECP_POINT_AFFINE(pR) = 0;
- }
-}
-
-/*
-// ECCP521_MulPoint
-//
-// Multiply point by scalar
-*/
-#if !defined (_USE_ECCP_SSCM_)
-void ECCP521_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnN,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalar or input point at Infinity */
- if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) {
- ECCP_SetPointToInfinity(pR);
- return;
- }
-
- /*
- // scalar multiplication
- */
- else {
- IppsECCPPointState T;
- IppsECCPPointState U;
- IppsBigNumState* bnKH = cpBigNumListGet(&pList);
- Ipp32u* pK;
- Ipp32u* pH;
- Ipp32u carry;
- int lenKH;
- int bitH;
-
- /* init result */
- ECCP_CopyPoint(pP, pR);
-
- /* if scalar is negative */
- if( ippBigNumNEG == BN_SIGN(bnN) ) {
- /* negative R */
- ECCP521_NegPoint(pR, pR, pECC);
- }
-
- /* copy K = N and compute H=3*K */
- lenKH = BN_SIZE(bnN)+1;
- pK = BN_NUMBER(bnKH);
- pH = BN_BUFFER(bnKH);
- Cpy_BNU(BN_NUMBER(bnN), pK, BN_SIZE(bnN));
- pK[lenKH-1] = 0;
- carry = cpAdd_BNU(pH, pK, pK, lenKH);
- carry = cpAdd_BNU(pH, pK, pH, lenKH);
-
- /* init temporary T = (X/Z^2, Y/Z^3, 1) */
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
- ECCP521_GetPointAffine(ECP_POINT_X(&T), ECP_POINT_Y(&T), pR, pECC, pList);
- ECCP521_SetPointAffine(ECP_POINT_X(&T), ECP_POINT_Y(&T), &T, pECC);
-
- /* temporary point U =-T */
- ECP_POINT_X(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&U) = cpBigNumListGet(&pList);
- ECCP521_NegPoint(&T, &U, pECC);
-
- for(bitH=MSB_BNU(pH, lenKH)-1; bitH>0; bitH--) {
- int hBit = TST_BIT(pH, bitH);
- int kBit = TST_BIT(pK, bitH);
- ECCP521_DblPoint(pR, pR, pECC, pList);
- if( hBit && !kBit )
- ECCP521_AddPoint(pR, &T, pR, pECC, pList);
- if(!hBit && kBit )
- ECCP521_AddPoint(pR, &U, pR, pECC, pList);
- }
- }
-}
-
-#else
-#pragma message ("ECCP521_MulPoint: SCCM version")
-
-void ECCP521_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnN,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalar or input point at Infinity */
- if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) {
- ECCP_SetPointToInfinity(pR);
- return;
- }
-
- /*
- // scalar multiplication
- */
- else {
- Ipp8u* pScratchAligned = ECP_SCCMBUFF(pECC);
-
- BNU_CHUNK_T* pN = BN_NUMBER(bnN);
- cpSize nsN = BN_SIZE(bnN);
- /* scalar bitsize */
- int scalarBitSize = BITSIZE_BNU(pN, nsN);
- /* optimal size of window */
- int w = cpECCP_OptimalWinSize(scalarBitSize);
- /* number of table entries */
- int nPrecomputed = 1<<w;
-
- /* allocate temporary scalar */
- IppsBigNumState* bnTN = cpBigNumListGet(&pList);
- BNU_CHUNK_T* pTN = BN_NUMBER(bnTN);
-
- int coordSize = BITS_BNU_CHUNK(ECP_GFEBITS(pECC));
- IppsECCPPointState T;
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
- ECCP_SetPointToInfinity(&T);
-
- /* init result */
- ECCP_CopyPoint(pP, pR);
- if( ippBigNumNEG == BN_SIGN(bnN) )
- ECCP521_NegPoint(pR, pR, pECC);
-
- /* pre-compute auxiliary table t[] = {(2^w)*P, 1*P, 2*P, ..., (2^(w-1))*P} */
- {
- int n;
- for(n=1; n<nPrecomputed; n++) {
- ECCP521_AddPoint(pR, &T, &T, pECC, pList);
- cpECCP_ScramblePut(pScratchAligned+n, nPrecomputed, &T, coordSize);
- }
- ECCP521_AddPoint(pR, &T, &T, pECC, pList);
- cpECCP_ScramblePut(pScratchAligned, nPrecomputed, &T, coordSize);
- }
-
- /* copy scalar */
- cpCpy_BNU(pTN, pN, nsN);
- /* and convert it presentaion to avoid usage of O point */
- scalarBitSize = cpECCP_ConvertRepresentation(pTN, scalarBitSize, w);
-
- /* prepare temporary scalar for processing */
- pTN[BITS_BNU_CHUNK(scalarBitSize)] = 0;
- scalarBitSize = ((scalarBitSize+w-1)/w)*w;
-
- /*
- // scalar multiplication
- */
- {
- Ipp32u dmask = nPrecomputed-1;
-
- /* position (bit number) of the leftmost window */
- int wPosition = scalarBitSize-w;
-
- /* extract leftmost window value */
- Ipp32u eChunk = *((Ipp32u*)((Ipp16u*)pTN + wPosition/BITSIZE(Ipp16u)));
- int shift = wPosition & 0xF;
- Ipp32u windowVal = (eChunk>>shift) & dmask;
-
- /* initialize result (ECP_FINITE_POINT|ECP_PROJECTIVE) */
- cpECCP_ScrambleGet(pR, coordSize, pScratchAligned+windowVal, nPrecomputed);
- ECP_POINT_AFFINE(pR) = 0;
-
- /* initialize temporary T (ECP_PROJECTIVE) */
- ECP_POINT_AFFINE(&T) = 0;
-
- for(wPosition-=w; wPosition>=0; wPosition-=w) {
- /* w times doubling */
- int k;
- for(k=0; k<w; k++)
- ECCP521_DblPoint(pR, pR, pECC, pList);
-
- /* extract next window value */
- eChunk = *((Ipp32u*)((Ipp16u*)pTN + wPosition/BITSIZE(Ipp16u)));
- shift = wPosition & 0xF;
- windowVal = (eChunk>>shift) & dmask;
-
- /* extract value from the pre-computed table */
- cpECCP_ScrambleGet(&T, coordSize, pScratchAligned+windowVal, nPrecomputed);
-
- /* and add it */
- ECCP521_AddPoint(pR, &T, pR, pECC, pList);
- }
- }
- }
-}
-#endif
-
-void ECCP521_MulBasePoint(const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- ECCP521_MulPoint(ECP_GENC(pECC), pK, pR, pECC, pList);
-}
-
-/*
-// ECCP521_ProdPoint
-//
-// Point product
-*/
-#if !defined (_USE_ECCP_SSCM_)
-void ECCP521_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalars */
- if( IsZero_BN(bnPscalar) ) {
- ECCP521_MulPoint(pQ, bnQscalar, pR, pECC, pList);
- return;
- }
- if( IsZero_BN(bnQscalar) ) {
- ECCP521_MulPoint(pP, bnPscalar, pR, pECC, pList);
- return;
- }
-
- /*
- // point product
- */
- else {
- int n;
- Ipp32u* pbnPscalar = BN_NUMBER(bnPscalar);
- int bnPscalarSize = BN_SIZE(bnPscalar);
- Ipp32u* pbnQscalar = BN_NUMBER(bnQscalar);
- int bnQscalarSize = BN_SIZE(bnQscalar);
-
- int size = bnPscalarSize>bnQscalarSize? bnPscalarSize : bnQscalarSize;
-
- IppsECCPPointState* pPointPQ[4] = {NULL, NULL, NULL, NULL};
-
- /* allocate temporary PQ point */
- IppsECCPPointState PQ;
- ECP_POINT_X(&PQ) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&PQ) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&PQ) = cpBigNumListGet(&pList);
-
- /* init temporary point array */
- if(ippBigNumPOS == BN_SIGN(bnPscalar))
- pPointPQ[1] = (IppsECCPPointState*)pP;
- else {
- IppsECCPPointState P;
- ECP_POINT_X(&P) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&P) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&P) = cpBigNumListGet(&pList);
- ECCP521_NegPoint(pP, &P, pECC);
- pPointPQ[1] = &P;
- }
- if(ippBigNumPOS == BN_SIGN(bnQscalar))
- pPointPQ[2] = (IppsECCPPointState*)pQ;
- else {
- IppsECCPPointState Q;
- ECP_POINT_X(&Q) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&Q) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&Q) = cpBigNumListGet(&pList);
- ECCP521_NegPoint(pQ, &Q, pECC);
- pPointPQ[2] = &Q;
- }
-
- ECCP521_AddPoint(pPointPQ[1], pPointPQ[2], &PQ, pECC, pList);
- ECCP521_GetPointAffine(ECP_POINT_X(pR), ECP_POINT_Y(pR), &PQ, pECC, pList);
- ECCP521_SetPointAffine(ECP_POINT_X(pR), ECP_POINT_Y(pR), &PQ, pECC);
- pPointPQ[3] = &PQ;
-
- /* pad scalars by zeros */
- ZEXPAND_BNU(pbnPscalar,bnPscalarSize, size);
- ZEXPAND_BNU(pbnQscalar,bnQscalarSize, size);
-
- /* init result */
- ECCP_SetPointToInfinity(pR);
-
- for(n=size; n>0; n--) {
- Ipp32u scalarPn = pbnPscalar[n-1];
- Ipp32u scalarQn = pbnQscalar[n-1];
-
- int nBit;
- for(nBit=31; nBit>=0; nBit--) {
- int
- PnQnBits = scalarPn&0x80000000? 1:0;
- PnQnBits+= scalarQn&0x80000000? 2:0;
-
- if( !ECCP_IsPointAtInfinity(pR) )
- ECCP521_DblPoint(pR, pR, pECC, pList);
- if( PnQnBits )
- ECCP521_AddPoint(pR, pPointPQ[PnQnBits], pR, pECC, pList);
-
- scalarPn <<= 1;
- scalarQn <<= 1;
- }
- }
- }
-}
-
-#else
-#pragma message ("ECCP521_ProdPoint: SCCM version")
-
-void ECCP521_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- IppsECCPPointState T;
- IppsECCPPointState U;
-
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
-
- ECP_POINT_X(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&U) = cpBigNumListGet(&pList);
-
- ECCP521_MulPoint(pP, bnPscalar, &T, (IppsECCPState*)pECC, pList);
- ECCP521_MulPoint(pQ, bnQscalar, &U, (IppsECCPState*)pECC, pList);
- ECCP521_AddPoint(&T, &U, pR, pECC, pList);
-}
-#endif
-
-#endif /* _ECP_521_==_ECP_IMPL_SPECIFIC_ */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpmethodcom.h b/ext/ipp/sources/ippcp/src/pcpeccpmethodcom.h
deleted file mode 100644
index 57057f1..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpmethodcom.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Definitions of EC methods over common GF(p)
-//
-//
-*/
-
-#if !defined(_PCP_ECCPMETHODCOM_H)
-#define _PCP_ECCPMETHODCOM_H
-
-#include "pcpeccp.h"
-
-
-/*
-// Returns reference
-*/
-ECCP_METHOD* ECCPcom_Methods(void);
-
-/*
-// Copy
-*/
-void ECCP_CopyPoint(const IppsECCPPointState* pSrc, IppsECCPPointState* pDst);
-
-/*
-// Point Set. These operations implies
-// transformation of regular coordinates into internal format
-*/
-void ECCP_SetPointProjective(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- const IppsBigNumState* pZ,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC);
-
-void ECCP_SetPointAffine(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC);
-
-/*
-// Get Point. These operations implies
-// transformation of internal format coordinates into regular
-*/
-//void ECCP_GetPointProjective(IppsBigNumState* pX,
-// IppsBigNumState* pY,
-// IppsBigNumState* pZ,
-// const IppsECCPPointState* pPoint,
-// const IppsECCPState* pECC);
-
-void ECCP_GetPointAffine(IppsBigNumState* pX,
- IppsBigNumState* pY,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-/*
-// Set To Infinity
-*/
-void ECCP_SetPointToInfinity(IppsECCPPointState* pPoint);
-void ECCP_SetPointToAffineInfinity0(IppsBigNumState* pX, IppsBigNumState* pY);
-void ECCP_SetPointToAffineInfinity1(IppsBigNumState* pX, IppsBigNumState* pY);
-
-/*
-// Test Is At Infinity
-// Test is On EC
-*/
-int ECCP_IsPointAtInfinity(const IppsECCPPointState* pPoint);
-int ECCP_IsPointAtAffineInfinity0(const IppsBigNumState* pX, const IppsBigNumState* pY);
-int ECCP_IsPointAtAffineInfinity1(const IppsBigNumState* pX, const IppsBigNumState* pY);
-int ECCP_IsPointOnCurve(const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-/*
-// Operations
-*/
-int ECCP_ComparePoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP_NegPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC);
-
-void ECCP_DblPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP_AddPoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP_MulBasePoint(const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-#endif /* _PCP_ECCPMETHODCOM_H */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpmethodcomca.c b/ext/ipp/sources/ippcp/src/pcpeccpmethodcomca.c
deleted file mode 100644
index 396e01b..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpmethodcomca.c
+++ /dev/null
@@ -1,1025 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// EC methods over common GF(p)
-//
-// Contents:
-// ECCP_CopyPoint()
-// ECCP_SetPointProjective()
-// ECCP_SetPointAffine()
-//
-// ECCP_GetPointProjective()
-// ECCP_GetPointAffine()
-//
-// ECCP_SetPointToInfinity()
-// ECCP_SetPointToAffineInfinity0()
-// ECCP_SetPointToAffineInfinity1()
-//
-// ECCP_IsPointAtInfinity()
-// ECCP_IsPointAtAffineInfinity0()
-// ECCP_IsPointAtAffineInfinity1()
-//
-// ECCP_IsPointOnCurve()
-//
-// ECCP_ComparePoint()
-// ECCP_NegPoint()
-// ECCP_DblPoint()
-// ECCP_AddPoint()
-// ECCP_MulPoint()
-// ECCP_ProdPoint()
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-#include "pcpeccppoint.h"
-#include "pcpeccpmethod.h"
-#include "pcpeccpmethodcom.h"
-#include "pcppma.h"
-#include "pcpeccpsscm.h"
-
-
-/*
- NOTE:
- ECCPcom methods are used representation of point coordinates
- in Montgomery domain, because of Montgomery mul/sqr operations inside
-*/
-static
-ECCP_METHOD ECCPcom = {
- ECCP_SetPointProjective,
- ECCP_SetPointAffine,
- ECCP_GetPointAffine,
-
- ECCP_IsPointOnCurve,
-
- ECCP_ComparePoint,
- ECCP_NegPoint,
- ECCP_DblPoint,
- ECCP_AddPoint,
- ECCP_MulPoint,
- ECCP_MulBasePoint,
- ECCP_ProdPoint
-};
-
-
-/*
-// Returns reference
-*/
-ECCP_METHOD* ECCPcom_Methods(void)
-{
- return &ECCPcom;
-}
-
-
-/*
-// Copy Point
-*/
-void ECCP_CopyPoint(const IppsECCPPointState* pSrc, IppsECCPPointState* pDst)
-{
- cpBN_copy(ECP_POINT_X(pDst), ECP_POINT_X(pSrc));
- cpBN_copy(ECP_POINT_Y(pDst), ECP_POINT_Y(pSrc));
- cpBN_copy(ECP_POINT_Z(pDst), ECP_POINT_Z(pSrc));
- ECP_POINT_AFFINE(pDst) = ECP_POINT_AFFINE(pSrc);
-}
-
-/*
-// ECCP_PoinSettProjective
-// Converts regular projective triplet (pX,pY,pZ) into pPoint
-// (see note above)
-*/
-void ECCP_SetPointProjective(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- const IppsBigNumState* pZ,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- IppsMontState* pMont = ECP_PMONT(pECC);
-
- PMA_enc(ECP_POINT_X(pPoint), (IppsBigNumState*)pX, pMont);
- PMA_enc(ECP_POINT_Y(pPoint), (IppsBigNumState*)pY, pMont);
- PMA_enc(ECP_POINT_Z(pPoint), (IppsBigNumState*)pZ, pMont);
- ECP_POINT_AFFINE(pPoint) = cpBN_cmp(pZ, BN_ONE_REF())==0;
-}
-
-/*
-// ECCP_PointAffineSet
-// Converts regular affine pair (pX,pY) into pPoint
-*/
-void ECCP_SetPointAffine(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- IppsMontState* pMont = ECP_PMONT(pECC);
- PMA_enc(ECP_POINT_X(pPoint), (IppsBigNumState*)pX, pMont);
- PMA_enc(ECP_POINT_Y(pPoint), (IppsBigNumState*)pY, pMont);
- PMA_enc(ECP_POINT_Z(pPoint), (IppsBigNumState*)cpBN_OneRef(), pMont);
- ECP_POINT_AFFINE(pPoint) = 1;
-}
-
-/*
-// ECCP_GetPointProjective
-// Converts pPoint into regular projective triplet (pX,pY,pZ)
-*/
-#if 0
-void ECCP_GetPointProjective(IppsBigNumState* pX,
- IppsBigNumState* pY,
- IppsBigNumState* pZ,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- IppsMontState* pMont = ECP_PMONT(pECC);
-
- PMA_dec(pX, ECP_POINT_X(pPoint), pMont);
- PMA_dec(pY, ECP_POINT_Y(pPoint), pMont);
- PMA_dec(pZ, ECP_POINT_Z(pPoint), pMont);
-}
-#endif
-
-/*
-// ECCP_GetPointAffine
-//
-// Converts pPoint into regular affine pair (pX,pY)
-//
-// Note:
-// pPoint is not point at Infinity
-// transform (X, Y, Z) into (x, y) = (X/Z^2, Y/Z^3)
-*/
-void ECCP_GetPointAffine(IppsBigNumState* pX, IppsBigNumState* pY,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- IppsMontState* pMont = ECP_PMONT(pECC);
-
- /* case Z == 1 */
- if( ECP_POINT_AFFINE(pPoint) ) {
- if(pX) {
- PMA_dec(pX, ECP_POINT_X(pPoint), pMont);
- }
- if(pY) {
- PMA_dec(pY, ECP_POINT_Y(pPoint), pMont);
- }
- }
-
- /* case Z != 1 */
- else {
- IppsBigNumState* pT = cpBigNumListGet(&pList);
- IppsBigNumState* pU = cpBigNumListGet(&pList);
- IppsBigNumState* pModulo = ECP_PRIME(pECC);
-
- /* decode Z */
- PMA_dec(pU, ECP_POINT_Z(pPoint), pMont);
- /* regular T = Z^-1 */
- PMA_inv(pT, pU, pModulo);
- /* montgomery U = Z^-1 */
- PMA_enc(pU, pT, pMont);
- /* regular T = Z^-2 */
- PMA_mule(pT, pU, pT, pMont);
-
- if(pX) {
- PMA_mule(pX,pT, ECP_POINT_X(pPoint), pMont);
- }
- if(pY) {
- /* regular U = Z^-3 */
- PMA_mule(pU, pU, pT, pMont);
- PMA_mule(pY,pU, ECP_POINT_Y(pPoint), pMont);
- }
- }
-}
-
-/*
-// ECCP_SetPointToInfinity
-// ECCP_SetPointToAffineInfinity0
-// ECCP_SetPointToAffineInfinity1
-//
-// Set point to Infinity
-*/
-void ECCP_SetPointToInfinity(IppsECCPPointState* pPoint)
-{
- cpBN_zero(ECP_POINT_X(pPoint));
- cpBN_zero(ECP_POINT_Y(pPoint));
- cpBN_zero(ECP_POINT_Z(pPoint));
- ECP_POINT_AFFINE(pPoint) = 0;
-}
-
-void ECCP_SetPointToAffineInfinity0(IppsBigNumState* pX, IppsBigNumState* pY)
-{
- if(pX) cpBN_zero(pX);
- if(pY) cpBN_zero(pY);
-}
-
-void ECCP_SetPointToAffineInfinity1(IppsBigNumState* pX, IppsBigNumState* pY)
-{
- if(pX) cpBN_zero(pX);
- if(pY) BN_Word(pY,1);
-}
-
-/*
-// ECCP_IsPointAtInfinity
-// ECCP_IsPointAtAffineInfinity0
-// ECCP_IsPointAtAffineInfinity1
-//
-// Test point is at Infinity
-*/
-int ECCP_IsPointAtInfinity(const IppsECCPPointState* pPoint)
-{
- return IsZero_BN( ECP_POINT_Z(pPoint) );
-}
-
-int ECCP_IsPointAtAffineInfinity0(const IppsBigNumState* pX, const IppsBigNumState* pY)
-{
- return IsZero_BN(pX) && IsZero_BN(pY);
-}
-
-int ECCP_IsPointAtAffineInfinity1(const IppsBigNumState* pX, const IppsBigNumState* pY)
-{
- return IsZero_BN(pX) && !IsZero_BN(pY);
-}
-
-/*
-// ECCP_IsPointOnCurve
-//
-// Test point is lie on curve
-//
-// Note
-// We deal with equation: y^2 = x^3 + A*x + B.
-// Or in projective coordinates: Y^2 = X^3 + a*X*Z^4 + b*Z^6.
-// The point under test is given by projective triplet (X,Y,Z),
-// which represents actually (x,y) = (X/Z^2,Y/Z^3).
-*/
-int ECCP_IsPointOnCurve(const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* let think Infinity point is on the curve */
- if( ECCP_IsPointAtInfinity(pPoint) )
- return 1;
-
- else {
- IppsMontState* pMont = ECP_PMONT(pECC);
- IppsBigNumState* pR = cpBigNumListGet(&pList);
- IppsBigNumState* pT = cpBigNumListGet(&pList);
- IppsBigNumState* pModulo = ECP_PRIME(pECC);
-
- PMA_sqre(pR, ECP_POINT_X(pPoint), pMont); // R = X^3
- PMA_mule(pR, pR, ECP_POINT_X(pPoint), pMont);
-
- /* case Z != 1 */
- if( !ECP_POINT_AFFINE(pPoint) ) {
- IppsBigNumState* pZ4 = cpBigNumListGet(&pList);
- IppsBigNumState* pZ6 = cpBigNumListGet(&pList);
- PMA_sqre(pT, ECP_POINT_Z(pPoint), pMont); // Z^2
- PMA_sqre(pZ4, pT, pMont); // Z^4
- PMA_mule(pZ6, pZ4, pT, pMont); // Z^6
-
- PMA_mule(pT, pZ4, ECP_POINT_X(pPoint), pMont); // T = X*Z^4
- if( ECP_AMI3(pECC) ) {
- IppsBigNumState* pU = cpBigNumListGet(&pList);
- PMA_add(pU, pT, pT, pModulo); // R = X^3 +a*X*Z^4
- PMA_add(pU, pU, pT, pModulo);
- PMA_sub(pR, pR, pU, pModulo);
- }
- else {
- PMA_mule(pT, pT, ECP_AENC(pECC), pMont); // R = X^3 +a*X*Z^4
- PMA_add(pR, pR, pT, pModulo);
- }
- PMA_mule(pT, pZ6, ECP_BENC(pECC), pMont); // R = X^3 +a*X*Z^4 + b*Z^6
- PMA_add(pR, pR, pT, pModulo);
-
- }
- /* case Z == 1 */
- else {
- if( ECP_AMI3(pECC) ) {
- PMA_add(pT, ECP_POINT_X(pPoint), ECP_POINT_X(pPoint), pModulo); // R = X^3 +a*X
- PMA_add(pT, pT, ECP_POINT_X(pPoint), pModulo);
- PMA_sub(pR, pR, pT, pModulo);
- }
- else {
- PMA_mule(pT, ECP_POINT_X(pPoint), ECP_AENC(pECC), pMont); // R = X^3 +a*X
- PMA_add(pR, pR, pT, pModulo);
- }
- PMA_add(pR, pR, ECP_BENC(pECC), pModulo); // R = X^3 +a*X + b
- }
- PMA_sqre(pT, ECP_POINT_Y(pPoint), pMont); // T = Y^2
- return 0==cpBN_cmp(pR, pT);
- }
-}
-
-/*
-// ECCP_ComparePoint
-//
-// Compare two points:
-// returns 0 => pP==pQ (maybe both pP and pQ are at Infinity)
-// returns 1 => pP!=pQ
-//
-// Note
-// In general we check:
-// P_X*Q_Z^2 ~ Q_X*P_Z^2
-// P_Y*Q_Z^3 ~ Q_Y*P_Z^3
-*/
-int ECCP_ComparePoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* P or/and Q at Infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- return ECCP_IsPointAtInfinity(pQ)? 0:1;
- if( ECCP_IsPointAtInfinity(pQ) )
- return ECCP_IsPointAtInfinity(pP)? 0:1;
-
- /* (P_Z==1) && (Q_Z==1) */
- if( ECP_POINT_AFFINE(pP) && ECP_POINT_AFFINE(pQ) )
- return ((0==cpBN_cmp(ECP_POINT_X(pP),ECP_POINT_X(pQ))) && (0==cpBN_cmp(ECP_POINT_Y(pP),ECP_POINT_Y(pQ))))? 0:1;
-
- {
- IppsMontState* pMont = ECP_PMONT(pECC);
-
- IppsBigNumState* pPtmp = cpBigNumListGet(&pList);
- IppsBigNumState* pQtmp = cpBigNumListGet(&pList);
- IppsBigNumState* pPZ = cpBigNumListGet(&pList);
- IppsBigNumState* pQZ = cpBigNumListGet(&pList);
-
- /* P_X*Q_Z^2 ~ Q_X*P_Z^2 */
- if( !ECP_POINT_AFFINE(pQ) ) {
- PMA_sqre(pQZ, ECP_POINT_Z(pQ), pMont); /* Ptmp = P_X*Q_Z^2 */
- PMA_mule(pPtmp, ECP_POINT_X(pP), pQZ, pMont);
- }
- else {
- PMA_set(pPtmp, ECP_POINT_X(pP));
- }
- if( !ECP_POINT_AFFINE(pP) ) {
- PMA_sqre(pPZ, ECP_POINT_Z(pP), pMont); /* Qtmp = Q_X*P_Z^2 */
- PMA_mule(pQtmp, ECP_POINT_X(pQ), pPZ, pMont);
- }
- else {
- PMA_set(pQtmp, ECP_POINT_X(pQ));
- }
- if ( cpBN_cmp(pPtmp, pQtmp) )
- return 1; /* points are different: (P_X*Q_Z^2) != (Q_X*P_Z^2) */
-
- /* P_Y*Q_Z^3 ~ Q_Y*P_Z^3 */
- if( !ECP_POINT_AFFINE(pQ) ) {
- PMA_mule(pQZ, pQZ, ECP_POINT_Z(pQ), pMont); /* Ptmp = P_Y*Q_Z^3 */
- PMA_mule(pPtmp, ECP_POINT_Y(pP), pQZ, pMont);
- }
- else {
- PMA_set(pPtmp, ECP_POINT_Y(pP));
- }
- if( !ECP_POINT_AFFINE(pP) ) {
- PMA_mule(pPZ, pPZ, ECP_POINT_Z(pP), pMont); /* Qtmp = Q_Y*P_Z^3 */
- PMA_mule(pQtmp, ECP_POINT_Y(pQ), pPZ, pMont);
- }
- else {
- PMA_set(pQtmp, ECP_POINT_Y(pQ));
- }
- return cpBN_cmp(pPtmp, pQtmp)? 1:0;
- }
-}
-
-/*
-// ECCP_NegPoint
-//
-// Negative point
-*/
-void ECCP_NegPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC)
-{
- /* test point at Infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- ECCP_SetPointToInfinity(pR);
-
- else {
- IppsBigNumState* pModulo = ECP_PRIME(pECC);
-
- if( pP!=pR ) {
- PMA_set(ECP_POINT_X(pR), ECP_POINT_X(pP));
- PMA_set(ECP_POINT_Z(pR), ECP_POINT_Z(pP));
- }
- PMA_sub(ECP_POINT_Y(pR), pModulo, ECP_POINT_Y(pP), pModulo);
- ECP_POINT_AFFINE(pR) = ECP_POINT_AFFINE(pP);
- }
-}
-
-/*
-// ECCP_DblPoint
-//
-// Double point
-*/
-void ECCP_DblPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* P at infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- ECCP_SetPointToInfinity(pR);
-
- else {
- IppsMontState* pMont = ECP_PMONT(pECC);
-
- IppsBigNumState* bnV = cpBigNumListGet(&pList);
- IppsBigNumState* bnU = cpBigNumListGet(&pList);
- IppsBigNumState* bnM = cpBigNumListGet(&pList);
- IppsBigNumState* bnS = cpBigNumListGet(&pList);
- IppsBigNumState* bnT = cpBigNumListGet(&pList);
- IppsBigNumState* pModulo = ECP_PRIME(pECC);
-
- /* M = 3*X^2 + A*Z^4 */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA_sqre(bnU, ECP_POINT_X(pP), pMont);
- PMA_add(bnM, bnU, bnU, pModulo);
- PMA_add(bnM, bnM, bnU, pModulo);
- PMA_add(bnM, bnM, ECP_AENC(pECC), pModulo);
- }
- else if( ECP_AMI3(pECC) ) {
- PMA_sqre(bnU, ECP_POINT_Z(pP), pMont);
- PMA_add(bnS, ECP_POINT_X(pP), bnU, pModulo);
- PMA_sub(bnT, ECP_POINT_X(pP), bnU, pModulo);
- PMA_mule(bnM, bnS, bnT, pMont);
- PMA_add(bnU, bnM, bnM, pModulo);
- PMA_add(bnM, bnU, bnM, pModulo);
- }
- else {
- PMA_sqre(bnU, ECP_POINT_X(pP), pMont);
- PMA_add(bnM, bnU, bnU, pModulo);
- PMA_add(bnM, bnM, bnU, pModulo);
- PMA_sqre(bnU, ECP_POINT_Z(pP), pMont);
- PMA_sqre(bnU, bnU, pMont);
- PMA_mule(bnU, bnU, ECP_AENC(pECC), pMont);
- PMA_add(bnM, bnM, bnU, pModulo);
- }
-
- PMA_add(bnV, ECP_POINT_Y(pP), ECP_POINT_Y(pP), pModulo);
-
- /* R_Z = 2*Y*Z */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(ECP_POINT_Z(pR), bnV);
- }
- else {
- PMA_mule(ECP_POINT_Z(pR), bnV, ECP_POINT_Z(pP), pMont);
- }
-
- /* S = 4*X*Y^2 */
- PMA_sqre(bnT, bnV, pMont);
- PMA_mule(bnS, bnT, ECP_POINT_X(pP), pMont);
-
- /* R_X = M^2 - 2*S */
- PMA_sqre(bnU, bnM, pMont);
- PMA_sub(bnU, bnU, bnS, pModulo);
- PMA_sub(ECP_POINT_X(pR), bnU, bnS, pModulo);
-
- /* T = 8*Y^4 */
- PMA_mule(bnV, bnV, ECP_POINT_Y(pP), pMont);
- PMA_mule(bnT, bnT, bnV, pMont);
-
- /* R_Y = M*(S - R_X) - T */
- PMA_sub(bnS, bnS, ECP_POINT_X(pR), pModulo);
- PMA_mule(bnS, bnS, bnM, pMont);
- PMA_sub(ECP_POINT_Y(pR), bnS, bnT, pModulo);
-
- ECP_POINT_AFFINE(pR) = 0;
- }
-}
-
-/*
-// ECCP_AddPoint
-//
-// Add points
-*/
-void ECCP_AddPoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
-#if 0
- /* test stupid call */
- if( pP == pQ ) {
- ECCP_DblPoint(pP, pR, pECC, pList);
- return;
- }
-#endif
-
- /* prevent operation with point at Infinity */
- if( ECCP_IsPointAtInfinity(pP) ) {
- ECCP_CopyPoint(pQ, pR);
- return;
- }
- if( ECCP_IsPointAtInfinity(pQ) ) {
- ECCP_CopyPoint(pP, pR);
- return;
- }
-
- /*
- // addition
- */
- {
- IppsMontState* pMont = ECP_PMONT(pECC);
-
- IppsBigNumState* bnU0 = cpBigNumListGet(&pList);
- IppsBigNumState* bnS0 = cpBigNumListGet(&pList);
- IppsBigNumState* bnU1 = cpBigNumListGet(&pList);
- IppsBigNumState* bnS1 = cpBigNumListGet(&pList);
- IppsBigNumState* bnW = cpBigNumListGet(&pList);
- IppsBigNumState* bnR = cpBigNumListGet(&pList);
- IppsBigNumState *bnT = bnU0;
- IppsBigNumState *bnM = bnS0;
- IppsBigNumState* pModulo = ECP_PRIME(pECC);
-
- /* U0 = P_X * Q_Z^2 */
- /* S0 = P_Y * Q_Z^3 */
- if( ECP_POINT_AFFINE(pQ) ) {
- PMA_set(bnU0, ECP_POINT_X(pP));
- PMA_set(bnS0, ECP_POINT_Y(pP));
- }
- else {
- PMA_sqre(bnW, ECP_POINT_Z(pQ), pMont);
- PMA_mule(bnU0,ECP_POINT_X(pP), bnW, pMont);
- PMA_mule(bnW, ECP_POINT_Z(pQ), bnW, pMont);
- PMA_mule(bnS0,ECP_POINT_Y(pP), bnW, pMont);
- }
-
- /* U1 = Q_X * P_Z^2 */
- /* S1 = Q_Y * P_Z^3 */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(bnU1, ECP_POINT_X(pQ));
- PMA_set(bnS1, ECP_POINT_Y(pQ));
- }
- else {
- PMA_sqre(bnW, ECP_POINT_Z(pP), pMont);
- PMA_mule(bnU1,ECP_POINT_X(pQ), bnW, pMont);
- PMA_mule(bnW, ECP_POINT_Z(pP), bnW, pMont);
- PMA_mule(bnS1,ECP_POINT_Y(pQ), bnW, pMont);
- }
-
- /* W = U0-U1 */
- /* R = S0-S1 */
- PMA_sub(bnW, bnU0, bnU1, pModulo);
- PMA_sub(bnR, bnS0, bnS1, pModulo);
-
- if( IsZero_BN(bnW) ) {
- if( IsZero_BN(bnR) ) {
- ECCP_DblPoint(pP, pR, pECC, pList);
- return;
- }
- else {
- ECCP_SetPointToInfinity(pR);
- return;
- }
- }
-
- /* T = U0+U1 */
- /* M = S0+S1 */
- PMA_add(bnT, bnU0, bnU1, pModulo);
- PMA_add(bnM, bnS0, bnS1, pModulo);
-
- /* R_Z = P_Z * Q_Z * W */
- if( ECP_POINT_AFFINE(pQ) && ECP_POINT_AFFINE(pP) ) {
- PMA_set(ECP_POINT_Z(pR), bnW);
- }
- else {
- if( ECP_POINT_AFFINE(pQ) ) {
- PMA_set(bnU1, ECP_POINT_Z(pP));
- }
- else if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(bnU1, ECP_POINT_Z(pQ));
- }
- else {
- PMA_mule(bnU1, ECP_POINT_Z(pP), ECP_POINT_Z(pQ), pMont);
- }
- PMA_mule(ECP_POINT_Z(pR), bnU1, bnW, pMont);
- }
-
- PMA_sqre(bnU1, bnW, pMont); /* U1 = W^2 */
- PMA_mule(bnS1, bnT, bnU1, pMont); /* S1 = T * W^2 */
-
- /* R_X = R^2 - T * W^2 */
- PMA_sqre(ECP_POINT_X(pR), bnR, pMont);
- PMA_sub(ECP_POINT_X(pR), ECP_POINT_X(pR), bnS1, pModulo);
-
- /* V = T * W^2 - 2 * R_X (S1) */
- PMA_sub(bnS1, bnS1, ECP_POINT_X(pR), pModulo);
- PMA_sub(bnS1, bnS1, ECP_POINT_X(pR), pModulo);
-
- /* R_Y = (V * R - M * W^3) /2 */
- PMA_mule(ECP_POINT_Y(pR), bnS1, bnR, pMont);
- PMA_mule(bnU1, bnU1, bnW, pMont);
- PMA_mule(bnU1, bnU1, bnM, pMont);
- PMA_sub(bnU1, ECP_POINT_Y(pR), bnU1, pModulo);
- PMA_div2(ECP_POINT_Y(pR), bnU1, pModulo);
-
- ECP_POINT_AFFINE(pR) = 0;
- }
-}
-
-/*
-// ECCP_MulPoint
-//
-// Multiply point by scalar
-*/
-#if !defined (_USE_ECCP_SSCM_)
-void ECCP_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnN,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalar or input point at Infinity */
- if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) {
- ECCP_SetPointToInfinity(pR);
- return;
- }
-
- /*
- // scalar multiplication
- */
- else {
- IppsECCPPointState T;
- IppsECCPPointState U;
- IppsBigNumState* bnKH = cpBigNumListGet(&pList);
- Ipp32u* pK;
- Ipp32u* pH;
- Ipp32u carry;
- int lenKH;
- int bitH;
-
- /* init result */
- ECCP_CopyPoint(pP, pR);
-
- /* if scalar is negative */
- if( ippBigNumNEG == BN_SIGN(bnN) ) {
- /* negative R */
- ECCP_NegPoint(pR, pR, pECC);
- }
-
- /* copy K = N and compute H=3*K */
- lenKH = BN_SIZE(bnN)+1;
- pK = BN_NUMBER(bnKH);
- pH = BN_BUFFER(bnKH);
- Cpy_BNU(BN_NUMBER(bnN), pK, BN_SIZE(bnN));
- pK[lenKH-1] = 0;
- carry = cpAdd_BNU(pH, pK, pK, lenKH);
- carry = cpAdd_BNU(pH, pK, pH, lenKH);
-
- /* init temporary T = (X/Z^2, Y/Z^3, 1) */
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
- ECCP_GetPointAffine(ECP_POINT_X(&T), ECP_POINT_Y(&T), pR, pECC, pList);
- ECCP_SetPointAffine(ECP_POINT_X(&T), ECP_POINT_Y(&T), &T, pECC);
-
- /* temporary point U =-T */
- ECP_POINT_X(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&U) = cpBigNumListGet(&pList);
- ECCP_NegPoint(&T, &U, pECC);
-
- for(bitH=MSB_BNU(pH, lenKH)-1; bitH>0; bitH--) {
- int hBit = TST_BIT(pH, bitH);
- int kBit = TST_BIT(pK, bitH);
- ECCP_DblPoint(pR, pR, pECC, pList);
- if( hBit && !kBit )
- ECCP_AddPoint(pR, &T, pR, pECC, pList);
- if(!hBit && kBit )
- ECCP_AddPoint(pR, &U, pR, pECC, pList);
- }
- }
-}
-
-#else
-#pragma message ("ECCP_MulPoint: SCCM version")
-
-void ECCP_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnN,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalar or input point at Infinity */
- if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) {
- ECCP_SetPointToInfinity(pR);
- return;
- }
-
- /*
- // scalar multiplication
- */
- else {
- Ipp8u* pScratchAligned = ECP_SCCMBUFF(pECC);
-
- BNU_CHUNK_T* pN = BN_NUMBER(bnN);
- cpSize nsN = BN_SIZE(bnN);
- /* scalar bitsize */
- int scalarBitSize = BITSIZE_BNU(pN, nsN);
- /* optimal size of window */
- int w = cpECCP_OptimalWinSize(scalarBitSize);
- /* number of table entries */
- int nPrecomputed = 1<<w;
-
- /* allocate temporary scalar */
- IppsBigNumState* bnTN = cpBigNumListGet(&pList);
- BNU_CHUNK_T* pTN = BN_NUMBER(bnTN);
-
- int coordSize = BITS_BNU_CHUNK(ECP_GFEBITS(pECC));
- IppsECCPPointState T;
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
- ECCP_SetPointToInfinity(&T);
-
- /* init result */
- ECCP_CopyPoint(pP, pR);
- if( ippBigNumNEG == BN_SIGN(bnN) )
- ECCP_NegPoint(pR, pR, pECC);
-
- /* pre-compute auxiliary table t[] = {(2^w)*P, 1*P, 2*P, ..., (2^(w-1))*P} */
- {
- int n;
- for(n=1; n<nPrecomputed; n++) {
- ECCP_AddPoint(pR, &T, &T, pECC, pList);
- cpECCP_ScramblePut(pScratchAligned+n, nPrecomputed, &T, coordSize);
- }
- ECCP_AddPoint(pR, &T, &T, pECC, pList);
- cpECCP_ScramblePut(pScratchAligned, nPrecomputed, &T, coordSize);
- }
-
- /* copy scalar */
- cpCpy_BNU(pTN, pN, nsN);
- /* and convert it presentaion to avoid usage of O point */
- scalarBitSize = cpECCP_ConvertRepresentation(pTN, scalarBitSize, w);
-
- /* prepare temporary scalar for processing */
- pTN[BITS_BNU_CHUNK(scalarBitSize)] = 0;
- scalarBitSize = ((scalarBitSize+w-1)/w)*w;
-
- /*
- // scalar multiplication
- */
- {
- Ipp32u dmask = nPrecomputed-1;
-
- /* position (bit number) of the leftmost window */
- int wPosition = scalarBitSize-w;
-
- /* extract leftmost window value */
- Ipp32u eChunk = *((Ipp32u*)((Ipp16u*)pTN + wPosition/BITSIZE(Ipp16u)));
- int shift = wPosition & 0xF;
- Ipp32u windowVal = (eChunk>>shift) & dmask;
-
- /* initialize result (ECP_FINITE_POINT|ECP_PROJECTIVE) */
- cpECCP_ScrambleGet(pR, coordSize, pScratchAligned+windowVal, nPrecomputed);
- ECP_POINT_AFFINE(pR) = 0;
-
- /* initialize temporary T (ECP_PROJECTIVE) */
- ECP_POINT_AFFINE(&T) = 0;
-
- for(wPosition-=w; wPosition>=0; wPosition-=w) {
- /* w times doubling */
- int k;
- for(k=0; k<w; k++)
- ECCP_DblPoint(pR, pR, pECC, pList);
-
- /* extract next window value */
- eChunk = *((Ipp32u*)((Ipp16u*)pTN + wPosition/BITSIZE(Ipp16u)));
- shift = wPosition & 0xF;
- windowVal = (eChunk>>shift) & dmask;
-
- /* extract value from the pre-computed table */
- cpECCP_ScrambleGet(&T, coordSize, pScratchAligned+windowVal, nPrecomputed);
-
- /* and add it */
- ECCP_AddPoint(pR, &T, pR, pECC, pList);
- }
- }
- }
-}
-#endif
-
-#if 0
-void ECCP_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnN,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalar or input point at Infinity */
- if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) {
- ECCP_SetPointToInfinity(pR);
- return;
- }
-
- /*
- // scalar multiplication
- */
- else {
- int n;
-
- IppsECCPPointState tmpPoint[15];
- IppsBigNumState* pX = cpBigNumListGet(&pList);
- IppsBigNumState* pY = cpBigNumListGet(&pList);
-
- /* allocate temporary points */
- {
- for(n=0; n<15; n++) {
- ECP_POINT_X(&tmpPoint[n]) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&tmpPoint[n]) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&tmpPoint[n]) = cpBigNumListGet(&pList);
- }
- }
-
- /* precomputation */
- if( ippBigNumPOS == BN_SIGN(bnN) )
- ECCP_CopyPoint(pP, &tmpPoint[0]);
- else
- ECCP_NegPoint(pP, &tmpPoint[0], pECC);
-
- ECCP_GetPointAffine(pX, pY, &tmpPoint[0], pECC, pList);
- ECCP_SetPointAffine(pX, pY, &tmpPoint[0], pECC);
-
- for(n=1; n<15; n+=2) {
- ECCP_DblPoint(&tmpPoint[n/2], &tmpPoint[n], pECC, pList);
- ECCP_GetPointAffine(pX, pY, &tmpPoint[n], pECC, pList);
- ECCP_SetPointAffine(pX, pY, &tmpPoint[n], pECC);
-
- ECCP_AddPoint(&tmpPoint[n], &tmpPoint[0], &tmpPoint[n+1], pECC, pList);
- ECCP_GetPointAffine(pX, pY, &tmpPoint[n+1], pECC, pList);
- ECCP_SetPointAffine(pX, pY, &tmpPoint[n+1], pECC);
- }
-
- /* init result */
- ECCP_SetPointToInfinity(pR);
-
- for(n=BN_SIZE(bnN); n>0; n--) {
- Ipp32u scalar = BN_NUMBER(bnN)[n-1];
-
- int shift;
- for(shift=(32-4); shift>=0; shift-=4) {
- int m;
- int tblIdx = (scalar>>shift) & 0xF;
-
- if( !ECCP_IsPointAtInfinity(pR) ) {
- for(m=0; m<4; m++)
- ECCP_DblPoint(pR, pR, pECC, pList);
- }
- if( tblIdx )
- ECCP_AddPoint(pR, &tmpPoint[tblIdx-1], pR, pECC, pList);
- }
- }
- }
-}
-#endif
-
-void ECCP_MulBasePoint(const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- ECCP_MulPoint(ECP_GENC(pECC), pK, pR, pECC, pList);
-}
-
-/*
-// ECCP_ProdPoint
-//
-// Point product
-*/
-#if !defined (_USE_ECCP_SSCM_)
-void ECCP_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalars */
- if( IsZero_BN(bnPscalar) ) {
- ECCP_MulPoint(pQ, bnQscalar, pR, pECC, pList);
- return;
- }
- if( IsZero_BN(bnQscalar) ) {
- ECCP_MulPoint(pP, bnPscalar, pR, pECC, pList);
- return;
- }
-
- /*
- // point product
- */
- else {
- int n;
- Ipp32u* pbnPscalar = BN_NUMBER(bnPscalar);
- int bnPscalarSize = BN_SIZE(bnPscalar);
- Ipp32u* pbnQscalar = BN_NUMBER(bnQscalar);
- int bnQscalarSize = BN_SIZE(bnQscalar);
-
- int size = bnPscalarSize>bnQscalarSize? bnPscalarSize : bnQscalarSize;
-
- IppsECCPPointState* pPointPQ[4] = {NULL, NULL, NULL, NULL};
-
- /* allocate temporary PQ point */
- IppsECCPPointState PQ;
- ECP_POINT_X(&PQ) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&PQ) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&PQ) = cpBigNumListGet(&pList);
-
- /* init temporary point array */
- if(ippBigNumPOS == BN_SIGN(bnPscalar))
- pPointPQ[1] = (IppsECCPPointState*)pP;
- else {
- IppsECCPPointState P;
- ECP_POINT_X(&P) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&P) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&P) = cpBigNumListGet(&pList);
- ECCP_NegPoint(pP, &P, pECC);
- pPointPQ[1] = &P;
- }
- if(ippBigNumPOS == BN_SIGN(bnQscalar))
- pPointPQ[2] = (IppsECCPPointState*)pQ;
- else {
- IppsECCPPointState Q;
- ECP_POINT_X(&Q) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&Q) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&Q) = cpBigNumListGet(&pList);
- ECCP_NegPoint(pQ, &Q, pECC);
- pPointPQ[2] = &Q;
- }
-
- ECCP_AddPoint(pPointPQ[1], pPointPQ[2], &PQ, pECC, pList);
- ECCP_GetPointAffine(ECP_POINT_X(pR), ECP_POINT_Y(pR), &PQ, pECC, pList);
- ECCP_SetPointAffine(ECP_POINT_X(pR), ECP_POINT_Y(pR), &PQ, pECC);
- pPointPQ[3] = &PQ;
-
- /* pad scalars by zeros */
- ZEXPAND_BNU(pbnPscalar,bnPscalarSize, size);
- ZEXPAND_BNU(pbnQscalar,bnQscalarSize, size);
-
- /* init result */
- ECCP_SetPointToInfinity(pR);
-
- for(n=size; n>0; n--) {
- Ipp32u scalarPn = pbnPscalar[n-1];
- Ipp32u scalarQn = pbnQscalar[n-1];
-
- int nBit;
- for(nBit=31; nBit>=0; nBit--) {
- int
- PnQnBits = scalarPn&0x80000000? 1:0;
- PnQnBits+= scalarQn&0x80000000? 2:0;
-
- if( !ECCP_IsPointAtInfinity(pR) )
- ECCP_DblPoint(pR, pR, pECC, pList);
- if( PnQnBits )
- ECCP_AddPoint(pR, pPointPQ[PnQnBits], pR, pECC, pList);
-
- scalarPn <<= 1;
- scalarQn <<= 1;
- }
- }
- }
-}
-#else
-#pragma message ("ECCP_ProdPoint: SCCM version")
-void ECCP_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- IppsECCPPointState T;
- IppsECCPPointState U;
-
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
-
- ECP_POINT_X(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&U) = cpBigNumListGet(&pList);
-
- ECCP_MulPoint(pP, bnPscalar, &T, (IppsECCPState*)pECC, pList);
- ECCP_MulPoint(pQ, bnQscalar, &U, (IppsECCPState*)pECC, pList);
- ECCP_AddPoint(&T, &U, pR, pECC, pList);
-}
-#endif
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpmethodsm2.h b/ext/ipp/sources/ippcp/src/pcpeccpmethodsm2.h
deleted file mode 100644
index 12b59bc..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpmethodsm2.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Definitions of methods over SM2 curve
-//
-//
-*/
-
-#if !defined(_PCP_ECCP_SM2_METHOD_H)
-#define _PCP_ECCP_SM2_METHOD_H
-
-#include "pcpeccp.h"
-
-
-/*
-// Returns reference
-*/
-ECCP_METHOD* ECCP_SM2_Methods(void);
-
-
-/*
-// Point Set. These operations implies
-// transformation of regular coordinates into internal format
-*/
-void ECCP_SM2_SetPointProjective(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- const IppsBigNumState* pZ,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC);
-
-void ECCP_SM2_SetPointAffine(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC);
-
-/*
-// Get Point. These operations implies
-// transformation of internal format coordinates into regular
-*/
-//void ECCP256_GetPointProjective(IppsBigNumState* pX,
-// IppsBigNumState* pY,
-// IppsBigNumState* pZ,
-// const IppsECCPPointState* pPoint,
-// const IppsECCPState* pECC);
-
-void ECCP_SM2_GetPointAffine(IppsBigNumState* pX,
- IppsBigNumState* pY,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-/*
-// Test is On EC
-*/
-int ECCP_SM2_IsPointOnCurve(const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-/*
-// Operations
-*/
-int ECCP_SM2_ComparePoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP_SM2_NegPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC);
-
-void ECCP_SM2_DblPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP_SM2_AddPoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP_SM2_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP_SM2_MulBasePoint(const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-void ECCP_SM2_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList);
-
-
-
-#endif /* _PCP_ECCP_SM2_METHOD_H */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpmethodsm2ca.c b/ext/ipp/sources/ippcp/src/pcpeccpmethodsm2ca.c
deleted file mode 100644
index 04d17a5..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpmethodsm2ca.c
+++ /dev/null
@@ -1,879 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// EC methods over GF(P256) SM2
-//
-// Contents:
-// ECCP_SM2_SetPointProjective()
-// ECCP_SM2_SetPointAffine()
-// ECCP_SM2_GetPointAffine()
-//
-// ECCP_SM2_IsPointOnCurve()
-//
-// ECCP_SM2_ComparePoint()
-// ECCP_SM2_NegPoint()
-// ECCP_SM2_DblPoint()
-// ECCP_SM2_AddPoint()
-// ECCP_SM2_MulPoint()
-// ECCP_SM2_ProdPoint()
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-
-#if (_ECP_SM2_==_ECP_IMPL_SPECIFIC_)
-#include "pcpeccppoint.h"
-#include "pcpeccpmethod.h"
-#include "pcpeccpmethodcom.h"
-#include "pcpeccpmethodsm2.h"
-#include "pcppmasm2.h"
-
-/*
- NOTE:
- ECCP256 methods are used representation of point coordinates
- in regular (usual residue) domain, because of special modular reduction
-*/
-static
-ECCP_METHOD ECCP_SM2 = {
- ECCP_SM2_SetPointProjective,
- ECCP_SM2_SetPointAffine,
- ECCP_SM2_GetPointAffine,
-
- ECCP_SM2_IsPointOnCurve,
-
- ECCP_SM2_ComparePoint,
- ECCP_SM2_NegPoint,
- ECCP_SM2_DblPoint,
- ECCP_SM2_AddPoint,
- ECCP_SM2_MulPoint,
- ECCP_SM2_MulBasePoint,
- ECCP_SM2_ProdPoint
-};
-
-
-/*
-// Returns reference
-*/
-ECCP_METHOD* ECCP_SM2_Methods(void)
-{
- return &ECCP_SM2;
-}
-
-/*
-// ECCP_SM2_PoinSettProjective
-// Converts regular projective triplet (pX,pY,pZ) into pPoint
-// (see note above)
-*/
-void ECCP_SM2_SetPointProjective(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- const IppsBigNumState* pZ,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
- cpBN_copy(ECP_POINT_X(pPoint), pX);
- cpBN_copy(ECP_POINT_Y(pPoint), pY);
- cpBN_copy(ECP_POINT_Z(pPoint), pZ);
- ECP_POINT_AFFINE(pPoint) = cpBN_cmp(pZ, BN_ONE_REF())==0;
-}
-
-/*
-// ECCP_SM2_PointAffineSet
-// Converts regular affine pair (pX,pY) into pPoint
-*/
-void ECCP_SM2_SetPointAffine(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- ECCP_SM2_SetPointProjective(pX, pY, BN_ONE_REF(), pPoint, pECC);
-}
-
-/*
-// ECCP_SM2_GetPointProjective
-// Converts pPoint into regular projective triplet (pX,pY,pZ)
-*/
-#if 0
-void ECCP_SM2_GetPointProjective(IppsBigNumState* pX,
- IppsBigNumState* pY,
- IppsBigNumState* pZ,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
- cpBN_copy(pX, ECP_POINT_X(pPoint));
- cpBN_copy(pY, ECP_POINT_Y(pPoint));
- cpBN_copy(pZ, ECP_POINT_Z(pPoint));
-}
-#endif
-
-/*
-// ECCP_SM2_GetPointAffine
-//
-// Converts pPoint into regular affine pair (pX,pY)
-//
-// Note:
-// pPoint is not point at Infinity
-// transform (X, Y, Z) into (x, y) = (X/Z^2, Y/Z^3)
-*/
-void ECCP_SM2_GetPointAffine(IppsBigNumState* pX, IppsBigNumState* pY,
- const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* case Z == 1 */
- if( ECP_POINT_AFFINE(pPoint) ) {
- if(pX) {
- cpBN_copy(pX, ECP_POINT_X(pPoint));
- }
- if(pY) {
- cpBN_copy(pY, ECP_POINT_Y(pPoint));
- }
- }
-
- /* case Z != 1 */
- else {
- //IppsMontState* pMont = ECP_PMONT(pECC);
- IppsBigNumState* pModulo = ECP_PRIME(pECC);
-
- IppsBigNumState* pT = cpBigNumListGet(&pList);
- IppsBigNumState* pU = cpBigNumListGet(&pList);
- //IppsBigNumState* pModulo = cpBigNumListGet(&pList);
- //BN_Set(MNT_MODULUS(pMont), MNT_SIZE(pMont), pModulo);
-
- /* U = 1/Z */
- PMAsm2_inv(pU, ECP_POINT_Z(pPoint), pModulo);
- /* T = 1/(Z^2) */
- PMAsm2_sqr(pT, pU);
-
- if(pX) {
- PMAsm2_mul(pX,pT, ECP_POINT_X(pPoint));
- cpBN_fix(pX);
- }
- if(pY) {
- /* U = 1/(Z^3) */
- PMAsm2_mul(pU, pU, pT);
- PMAsm2_mul(pY,pU, ECP_POINT_Y(pPoint));
- cpBN_fix(pY);
- }
- }
-}
-
-/*
-// ECCP_SM2_IsPointOnCurve
-//
-// Test point is lie on curve
-//
-// Note
-// We deal with equation: y^2 = x^3 + A*x + B.
-// Or in projective coordinates: Y^2 = X^3 + a*X*Z^4 + b*Z^6.
-// The point under test is given by projective triplet (X,Y,Z),
-// which represents actually (x,y) = (X/Z^2,Y/Z^3).
-*/
-int ECCP_SM2_IsPointOnCurve(const IppsECCPPointState* pPoint,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* let think Infinity point is on the curve */
- if( ECCP_IsPointAtInfinity(pPoint) )
- return 1;
-
- else {
- IppsBigNumState* pR = cpBigNumListGet(&pList);
- IppsBigNumState* pT = cpBigNumListGet(&pList);
-
- PMAsm2_sqr(pR, ECP_POINT_X(pPoint)); // R = X^3
- PMAsm2_mul(pR, pR, ECP_POINT_X(pPoint));
-
- /* case Z != 1 */
- if( !ECP_POINT_AFFINE(pPoint) ) {
- IppsBigNumState* pZ4 = cpBigNumListGet(&pList);
- IppsBigNumState* pZ6 = cpBigNumListGet(&pList);
- PMAsm2_sqr(pT, ECP_POINT_Z(pPoint)); // Z^2
- PMAsm2_sqr(pZ4, pT); // Z^4
- PMAsm2_mul(pZ6, pZ4, pT); // Z^6
-
- PMAsm2_mul(pT, pZ4, ECP_POINT_X(pPoint)); // T = X*Z^4
- if( ECP_AMI3(pECC) ) {
- IppsBigNumState* pU = cpBigNumListGet(&pList);
- PMAsm2_add(pU, pT, pT); // R = X^3 +a*X*Z^4
- PMAsm2_add(pU, pU, pT);
- PMAsm2_sub(pR, pR, pU);
- }
- else {
- PMAsm2_mul(pT, pT, ECP_A(pECC)); // R = X^3 +a*X*Z^4
- PMAsm2_add(pR, pR, pT);
- }
- PMAsm2_mul(pT, pZ6, ECP_B(pECC)); // R = X^3 +a*X*Z^4 + b*Z^6
- PMAsm2_add(pR, pR, pT);
-
- }
- /* case Z == 1 */
- else {
- if( ECP_AMI3(pECC) ) {
- PMAsm2_add(pT, ECP_POINT_X(pPoint), ECP_POINT_X(pPoint)); // R = X^3 +a*X
- PMAsm2_add(pT, pT, ECP_POINT_X(pPoint));
- PMAsm2_sub(pR, pR, pT);
- }
- else {
- PMAsm2_mul(pT, ECP_POINT_X(pPoint), ECP_A(pECC)); // R = X^3 +a*X
- PMAsm2_add(pR, pR, pT);
- }
- PMAsm2_add(pR, pR, ECP_B(pECC)); // R = X^3 +a*X + b
- }
- PMAsm2_sqr(pT, ECP_POINT_Y(pPoint)); // T = Y^2
- return 0==cpBN_cmp(pR, pT);
- }
-}
-
-/*
-// ECCP_SM2_ComparePoint
-//
-// Compare two points:
-// returns 0 => pP==pQ (maybe both pP and pQ are at Infinity)
-// returns 1 => pP!=pQ
-//
-// Note
-// In general we check:
-// P_X*Q_Z^2 ~ Q_X*P_Z^2
-// P_Y*Q_Z^3 ~ Q_Y*P_Z^3
-*/
-int ECCP_SM2_ComparePoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- UNREFERENCED_PARAMETER(pECC);
-
- /* P or/and Q at Infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- return ECCP_IsPointAtInfinity(pQ)? 0:1;
- if( ECCP_IsPointAtInfinity(pQ) )
- return ECCP_IsPointAtInfinity(pP)? 0:1;
-
- /* (P_Z==1) && (Q_Z==1) */
- if( ECP_POINT_AFFINE(pP) && ECP_POINT_AFFINE(pQ) )
- return ((0==cpBN_cmp(ECP_POINT_X(pP),ECP_POINT_X(pQ))) && (0==cpBN_cmp(ECP_POINT_Y(pP),ECP_POINT_Y(pQ))))? 0:1;
-
- {
- IppsBigNumState* pPtmp = cpBigNumListGet(&pList);
- IppsBigNumState* pQtmp = cpBigNumListGet(&pList);
- IppsBigNumState* pPZ = cpBigNumListGet(&pList);
- IppsBigNumState* pQZ = cpBigNumListGet(&pList);
-
- /* P_X*Q_Z^2 ~ Q_X*P_Z^2 */
- if( !ECP_POINT_AFFINE(pQ) ) {
- PMAsm2_sqr(pQZ, ECP_POINT_Z(pQ)); /* Ptmp = P_X*Q_Z^2 */
- PMAsm2_mul(pPtmp, ECP_POINT_X(pP), pQZ);
- }
- else {
- PMA_set(pPtmp, ECP_POINT_X(pP));
- }
- if( !ECP_POINT_AFFINE(pP) ) {
- PMAsm2_sqr(pPZ, ECP_POINT_Z(pP)); /* Qtmp = Q_X*P_Z^2 */
- PMAsm2_mul(pQtmp, ECP_POINT_X(pQ), pPZ);
- }
- else {
- PMA_set(pQtmp, ECP_POINT_X(pQ));
- }
- if ( cpBN_cmp(pPtmp, pQtmp) )
- return 1; /* points are different: (P_X*Q_Z^2) != (Q_X*P_Z^2) */
-
- /* P_Y*Q_Z^3 ~ Q_Y*P_Z^3 */
- if( !ECP_POINT_AFFINE(pQ) ) {
- PMAsm2_mul(pQZ, pQZ, ECP_POINT_Z(pQ)); /* Ptmp = P_Y*Q_Z^3 */
- PMAsm2_mul(pPtmp, ECP_POINT_Y(pP), pQZ);
- }
- else {
- PMA_set(pPtmp, ECP_POINT_Y(pP));
- }
- if( !ECP_POINT_AFFINE(pP) ) {
- PMAsm2_mul(pPZ, pPZ, ECP_POINT_Z(pP)); /* Qtmp = Q_Y*P_Z^3 */
- PMAsm2_mul(pQtmp, ECP_POINT_Y(pQ), pPZ);
- }
- else {
- PMA_set(pQtmp, ECP_POINT_Y(pQ));
- }
- return cpBN_cmp(pPtmp, pQtmp)? 1:0;
- }
-}
-
-/*
-// ECCP_SM2_NegPoint
-//
-// Negative point
-*/
-void ECCP_SM2_NegPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC)
-{
- UNREFERENCED_PARAMETER(pECC);
-
- /* test point at Infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- ECCP_SetPointToInfinity(pR);
-
- else {
- BNU_CHUNK_T* pRy = BN_NUMBER(ECP_POINT_Y(pR));
- BNU_CHUNK_T* pPy = BN_NUMBER(ECP_POINT_Y(pP));
- int size = LEN_P256;
-
- if( pP!=pR ) {
- PMA_set(ECP_POINT_X(pR), ECP_POINT_X(pP));
- PMA_set(ECP_POINT_Z(pR), ECP_POINT_Z(pP));
- ECP_POINT_AFFINE(pR) = ECP_POINT_AFFINE(pP);
- }
- cpSub_BNU(pRy, (BNU_CHUNK_T*)tpmSM2_p256_p, pPy, LEN_P256);
- FIX_BNU(pRy,size);
- BN_SIZE(ECP_POINT_Y(pR)) = size;
- BN_SIGN(ECP_POINT_Y(pR)) = ippBigNumPOS;
- }
-}
-
-/*
-// ECCP_SM2_DblPoint
-//
-// Double point
-*/
-void ECCP_SM2_DblPoint(const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* P at infinity */
- if( ECCP_IsPointAtInfinity(pP) )
- ECCP_SetPointToInfinity(pR);
-
- else {
- IppsBigNumState* bnV = cpBigNumListGet(&pList);
- IppsBigNumState* bnU = cpBigNumListGet(&pList);
- IppsBigNumState* bnM = cpBigNumListGet(&pList);
- IppsBigNumState* bnS = cpBigNumListGet(&pList);
- IppsBigNumState* bnT = cpBigNumListGet(&pList);
-
- /* M = 3*X^2 + A*Z^4 */
- if( ECP_POINT_AFFINE(pP) ) {
- PMAsm2_sqr(bnU, ECP_POINT_X(pP));
- PMAsm2_add(bnM, bnU, bnU);
- PMAsm2_add(bnM, bnM, bnU);
- PMAsm2_add(bnM, bnM, ECP_A(pECC));
- }
- else if( ECP_AMI3(pECC) ) {
- PMAsm2_sqr(bnU, ECP_POINT_Z(pP));
- PMAsm2_add(bnS, ECP_POINT_X(pP), bnU);
- PMAsm2_sub(bnT, ECP_POINT_X(pP), bnU);
- PMAsm2_mul(bnM, bnS, bnT);
- PMAsm2_add(bnU, bnM, bnM);
- PMAsm2_add(bnM, bnU, bnM);
- }
- else {
- PMAsm2_sqr(bnU, ECP_POINT_X(pP));
- PMAsm2_add(bnM, bnU, bnU);
- PMAsm2_add(bnM, bnM, bnU);
- PMAsm2_sqr(bnU, ECP_POINT_Z(pP));
- PMAsm2_sqr(bnU, bnU);
- PMAsm2_mul(bnU, bnU, ECP_A(pECC));
- PMAsm2_add(bnM, bnM, bnU);
- }
-
- PMAsm2_add(bnV, ECP_POINT_Y(pP), ECP_POINT_Y(pP));
-
- /* R_Z = 2*Y*Z */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(ECP_POINT_Z(pR), bnV);
- }
- else {
- PMAsm2_mul(ECP_POINT_Z(pR), bnV, ECP_POINT_Z(pP));
- }
-
- /* S = 4*X*Y^2 */
- PMAsm2_sqr(bnT, bnV);
- PMAsm2_mul(bnS, bnT, ECP_POINT_X(pP));
-
- /* R_X = M^2 - 2*S */
- PMAsm2_sqr(bnU, bnM);
- PMAsm2_sub(bnU, bnU, bnS);
- PMAsm2_sub(ECP_POINT_X(pR), bnU, bnS);
-
- /* T = 8*Y^4 */
- PMAsm2_mul(bnV, bnV, ECP_POINT_Y(pP));
- PMAsm2_mul(bnT, bnT, bnV);
-
- /* R_Y = M*(S - R_X) - T */
- PMAsm2_sub(bnS, bnS, ECP_POINT_X(pR));
- PMAsm2_mul(bnS, bnS, bnM);
- PMAsm2_sub(ECP_POINT_Y(pR), bnS, bnT);
-
- ECP_POINT_AFFINE(pR) = 0;
- }
-}
-
-/*
-// ECCP_SM2_AddPoint
-//
-// Add points
-*/
-void ECCP_SM2_AddPoint(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
-#if 0
- /* test stupid call */
- if( pP == pQ ) {
- ECCP_SM2_DblPoint(pP, pR, pECC, pList);
- return;
- }
-#endif
-
- /* prevent operation with point at Infinity */
- if( ECCP_IsPointAtInfinity(pP) ) {
- ECCP_CopyPoint(pQ, pR);
- return;
- }
- if( ECCP_IsPointAtInfinity(pQ) ) {
- ECCP_CopyPoint(pP, pR);
- return;
- }
-
- /*
- // addition
- */
- {
- IppsBigNumState* bnU0 = cpBigNumListGet(&pList);
- IppsBigNumState* bnS0 = cpBigNumListGet(&pList);
- IppsBigNumState* bnU1 = cpBigNumListGet(&pList);
- IppsBigNumState* bnS1 = cpBigNumListGet(&pList);
- IppsBigNumState* bnW = cpBigNumListGet(&pList);
- IppsBigNumState* bnR = cpBigNumListGet(&pList);
- IppsBigNumState *bnT = bnU0;
- IppsBigNumState *bnM = bnS0;
-
- /* U0 = P_X * Q_Z^2 */
- /* S0 = P_Y * Q_Z^3 */
- if( ECP_POINT_AFFINE(pQ) ) {
- PMA_set(bnU0, ECP_POINT_X(pP));
- PMA_set(bnS0, ECP_POINT_Y(pP));
- }
- else {
- PMAsm2_sqr(bnW, ECP_POINT_Z(pQ));
- PMAsm2_mul(bnU0,ECP_POINT_X(pP), bnW);
- PMAsm2_mul(bnW, ECP_POINT_Z(pQ), bnW);
- PMAsm2_mul(bnS0,ECP_POINT_Y(pP), bnW);
- }
-
- /* U1 = Q_X * P_Z^2 */
- /* S1 = Q_Y * P_Z^3 */
- if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(bnU1, ECP_POINT_X(pQ));
- PMA_set(bnS1, ECP_POINT_Y(pQ));
- }
- else {
- PMAsm2_sqr(bnW, ECP_POINT_Z(pP));
- PMAsm2_mul(bnU1,ECP_POINT_X(pQ), bnW);
- PMAsm2_mul(bnW, ECP_POINT_Z(pP), bnW);
- PMAsm2_mul(bnS1,ECP_POINT_Y(pQ), bnW);
- }
-
- /* W = U0-U1 */
- /* R = S0-S1 */
- PMAsm2_sub(bnW, bnU0, bnU1);
- PMAsm2_sub(bnR, bnS0, bnS1);
-
- //if( IsZero_BN(bnW) ) {
- //if( IsZero_BN(bnR) ) {
- if(cpEqu_BNU_CHUNK(BN_NUMBER(bnW), LEN_P256, 0)) {
- if(cpEqu_BNU_CHUNK(BN_NUMBER(bnR), LEN_P256, 0)) {
- ECCP_SM2_DblPoint(pP, pR, pECC, pList);
- return;
- }
- else {
- ECCP_SetPointToInfinity(pR);
- return;
- }
- }
-
- /* T = U0+U1 */
- /* M = S0+S1 */
- PMAsm2_add(bnT, bnU0, bnU1);
- PMAsm2_add(bnM, bnS0, bnS1);
-
- /* R_Z = P_Z * Q_Z * W */
- if( ECP_POINT_AFFINE(pQ) && ECP_POINT_AFFINE(pP) ) {
- PMA_set(ECP_POINT_Z(pR), bnW);
- }
- else {
- if( ECP_POINT_AFFINE(pQ) ) {
- PMA_set(bnU1, ECP_POINT_Z(pP));
- }
- else if( ECP_POINT_AFFINE(pP) ) {
- PMA_set(bnU1, ECP_POINT_Z(pQ));
- }
- else {
- PMAsm2_mul(bnU1, ECP_POINT_Z(pP), ECP_POINT_Z(pQ));
- }
- PMAsm2_mul(ECP_POINT_Z(pR), bnU1, bnW);
- }
-
- PMAsm2_sqr(bnU1, bnW); /* U1 = W^2 */
- PMAsm2_mul(bnS1, bnT, bnU1); /* S1 = T * W^2 */
-
- /* R_X = R^2 - T * W^2 */
- PMAsm2_sqr(ECP_POINT_X(pR), bnR);
- PMAsm2_sub(ECP_POINT_X(pR), ECP_POINT_X(pR), bnS1);
-
- /* V = T * W^2 - 2 * R_X (S1) */
- PMAsm2_sub(bnS1, bnS1, ECP_POINT_X(pR));
- PMAsm2_sub(bnS1, bnS1, ECP_POINT_X(pR));
-
- /* R_Y = (V * R - M * W^3) /2 */
- PMAsm2_mul(ECP_POINT_Y(pR), bnS1, bnR);
- PMAsm2_mul(bnU1, bnU1, bnW);
- PMAsm2_mul(bnU1, bnU1, bnM);
- PMAsm2_sub(bnU1, ECP_POINT_Y(pR), bnU1);
- PMAsm2_div2(ECP_POINT_Y(pR), bnU1);
-
- ECP_POINT_AFFINE(pR) = 0;
- }
-}
-
-/*
-// ECCP_SM2_MulPoint
-//
-// Multiply point by scalar
-*/
-#if !defined (_USE_ECCP_SSCM_)
-void ECCP_SM2_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnN,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalar or input point at Infinity */
- if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) {
- ECCP_SetPointToInfinity(pR);
- return;
- }
-
- /*
- // scalar multiplication
- */
- else {
- IppsECCPPointState T;
- IppsECCPPointState U;
- IppsBigNumState* bnKH = cpBigNumListGet(&pList);
- Ipp32u* pK;
- Ipp32u* pH;
- Ipp32u carry;
- int lenKH;
- int bitH;
-
- /* init result */
- ECCP_CopyPoint(pP, pR);
-
- /* if scalar is negative */
- if( ippBigNumNEG == BN_SIGN(bnN) ) {
- /* negative R */
- ECCP_SM2_NegPoint(pR, pR, pECC);
- }
-
- /* copy K = N and compute H=3*K */
- lenKH = BN_SIZE(bnN)+1;
- pK = BN_NUMBER(bnKH);
- pH = BN_BUFFER(bnKH);
- Cpy_BNU(BN_NUMBER(bnN), pK, BN_SIZE(bnN));
- pK[lenKH-1] = 0;
- carry = cpAdd_BNU(pH, pK, pK, lenKH);
- carry = cpAdd_BNU(pH, pK, pH, lenKH);
-
- /* init temporary T = (X/Z^2, Y/Z^3, 1) */
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
- ECCP_SM2_GetPointAffine(ECP_POINT_X(&T), ECP_POINT_Y(&T), pR, pECC, pList);
- ECCP_SM2_SetPointAffine(ECP_POINT_X(&T), ECP_POINT_Y(&T), &T, pECC);
-
- /* temporary point U =-T */
- ECP_POINT_X(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&U) = cpBigNumListGet(&pList);
- ECCP_SM2_NegPoint(&T, &U, pECC);
-
- for(bitH=MSB_BNU(pH, lenKH)-1; bitH>0; bitH--) {
- int hBit = TST_BIT(pH, bitH);
- int kBit = TST_BIT(pK, bitH);
- ECCP_SM2_DblPoint(pR, pR, pECC, pList);
- if( hBit && !kBit )
- ECCP_SM2_AddPoint(pR, &T, pR, pECC, pList);
- if(!hBit && kBit )
- ECCP_SM2_AddPoint(pR, &U, pR, pECC, pList);
- }
- }
-}
-
-#else
-#pragma message ("ECCP_SM2_MulPoint: SCCM version")
-
-void ECCP_SM2_MulPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnN,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalar or input point at Infinity */
- if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) {
- ECCP_SetPointToInfinity(pR);
- return;
- }
-
- /*
- // scalar multiplication
- */
- else {
- Ipp8u* pScratchAligned = ECP_SCCMBUFF(pECC);
-
- BNU_CHUNK_T* pN = BN_NUMBER(bnN);
- cpSize nsN = BN_SIZE(bnN);
- /* scalar bitsize */
- int scalarBitSize = BITSIZE_BNU(pN, nsN);
- /* optimal size of window */
- int w = cpECCP_OptimalWinSize(scalarBitSize);
- /* number of table entries */
- int nPrecomputed = 1<<w;
-
- /* allocate temporary scalar */
- IppsBigNumState* bnTN = cpBigNumListGet(&pList);
- BNU_CHUNK_T* pTN = BN_NUMBER(bnTN);
-
- int coordSize = BITS_BNU_CHUNK(ECP_GFEBITS(pECC));
- IppsECCPPointState T;
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
- ECCP_SetPointToInfinity(&T);
-
- /* init result */
- ECCP_CopyPoint(pP, pR);
- if( ippBigNumNEG == BN_SIGN(bnN) )
- ECCP_SM2_NegPoint(pR, pR, pECC);
-
- /* pre-compute auxiliary table t[] = {(2^w)*P, 1*P, 2*P, ..., (2^(w-1))*P} */
- {
- int n;
- for(n=1; n<nPrecomputed; n++) {
- ECCP_SM2_AddPoint(pR, &T, &T, pECC, pList);
- cpECCP_ScramblePut(pScratchAligned+n, nPrecomputed, &T, coordSize);
- }
- ECCP_SM2_AddPoint(pR, &T, &T, pECC, pList);
- cpECCP_ScramblePut(pScratchAligned, nPrecomputed, &T, coordSize);
- }
-
- /* copy scalar */
- cpCpy_BNU(pTN, pN, nsN);
- /* and convert it presentaion to avoid usage of O point */
- scalarBitSize = cpECCP_ConvertRepresentation(pTN, scalarBitSize, w);
-
- /* prepare temporary scalar for processing */
- pTN[BITS_BNU_CHUNK(scalarBitSize)] = 0;
- scalarBitSize = ((scalarBitSize+w-1)/w)*w;
-
- /*
- // scalar multiplication
- */
- {
- Ipp32u dmask = nPrecomputed-1;
-
- /* position (bit number) of the leftmost window */
- int wPosition = scalarBitSize-w;
-
- /* extract leftmost window value */
- Ipp32u eChunk = *((Ipp32u*)((Ipp16u*)pTN + wPosition/BITSIZE(Ipp16u)));
- int shift = wPosition & 0xF;
- Ipp32u windowVal = (eChunk>>shift) & dmask;
-
- /* initialize result (ECP_FINITE_POINT|ECP_PROJECTIVE) */
- cpECCP_ScrambleGet(pR, coordSize, pScratchAligned+windowVal, nPrecomputed);
- ECP_POINT_AFFINE(pR) = 0;
-
- /* initialize temporary T (ECP_PROJECTIVE) */
- ECP_POINT_AFFINE(&T) = 0;
-
- for(wPosition-=w; wPosition>=0; wPosition-=w) {
- /* w times doubling */
- int k;
- for(k=0; k<w; k++)
- ECCP_SM2_DblPoint(pR, pR, pECC, pList);
-
- /* extract next window value */
- eChunk = *((Ipp32u*)((Ipp16u*)pTN + wPosition/BITSIZE(Ipp16u)));
- shift = wPosition & 0xF;
- windowVal = (eChunk>>shift) & dmask;
-
- /* extract value from the pre-computed table */
- cpECCP_ScrambleGet(&T, coordSize, pScratchAligned+windowVal, nPrecomputed);
-
- /* and add it */
- ECCP_SM2_AddPoint(pR, &T, pR, pECC, pList);
- }
- }
- }
-}
-#endif
-
-void ECCP_SM2_MulBasePoint(const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- ECCP_SM2_MulPoint(ECP_GENC(pECC), pK, pR, pECC, pList);
-}
-
-/*
-// ECCP_SM2_ProdPoint
-//
-// Point product
-*/
-#if !defined (_USE_ECCP_SSCM_)
-void ECCP_SM2_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- /* test zero scalars */
- if( IsZero_BN(bnPscalar) ) {
- ECCP_SM2_MulPoint(pQ, bnQscalar, pR, pECC, pList);
- return;
- }
- if( IsZero_BN(bnQscalar) ) {
- ECCP_SM2_MulPoint(pP, bnPscalar, pR, pECC, pList);
- return;
- }
-
- /*
- // point product
- */
- else {
- int n;
- Ipp32u* pbnPscalar = BN_NUMBER(bnPscalar);
- int bnPscalarSize = BN_SIZE(bnPscalar);
- Ipp32u* pbnQscalar = BN_NUMBER(bnQscalar);
- int bnQscalarSize = BN_SIZE(bnQscalar);
-
- int size = bnPscalarSize>bnQscalarSize? bnPscalarSize : bnQscalarSize;
-
- IppsECCPPointState* pPointPQ[4] = {NULL, NULL, NULL, NULL};
-
- /* allocate temporary PQ point */
- IppsECCPPointState PQ;
- ECP_POINT_X(&PQ) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&PQ) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&PQ) = cpBigNumListGet(&pList);
-
- /* init temporary point array */
- if(ippBigNumPOS == BN_SIGN(bnPscalar))
- pPointPQ[1] = (IppsECCPPointState*)pP;
- else {
- IppsECCPPointState P;
- ECP_POINT_X(&P) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&P) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&P) = cpBigNumListGet(&pList);
- ECCP_SM2_NegPoint(pP, &P, pECC);
- pPointPQ[1] = &P;
- }
- if(ippBigNumPOS == BN_SIGN(bnQscalar))
- pPointPQ[2] = (IppsECCPPointState*)pQ;
- else {
- IppsECCPPointState Q;
- ECP_POINT_X(&Q) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&Q) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&Q) = cpBigNumListGet(&pList);
- ECCP_SM2_NegPoint(pQ, &Q, pECC);
- pPointPQ[2] = &Q;
- }
-
- ECCP_SM2_AddPoint(pPointPQ[1], pPointPQ[2], &PQ, pECC, pList);
- ECCP_SM2_GetPointAffine(ECP_POINT_X(pR), ECP_POINT_Y(pR), &PQ, pECC, pList);
- ECCP_SM2_SetPointAffine(ECP_POINT_X(pR), ECP_POINT_Y(pR), &PQ, pECC);
- pPointPQ[3] = &PQ;
-
- /* pad scalars by zeros */
- ZEXPAND_BNU(pbnPscalar,bnPscalarSize, size);
- ZEXPAND_BNU(pbnQscalar,bnQscalarSize, size);
-
- /* init result */
- ECCP_SetPointToInfinity(pR);
-
- for(n=size; n>0; n--) {
- Ipp32u scalarPn = pbnPscalar[n-1];
- Ipp32u scalarQn = pbnQscalar[n-1];
-
- int nBit;
- for(nBit=31; nBit>=0; nBit--) {
- int
- PnQnBits = scalarPn&0x80000000? 1:0;
- PnQnBits+= scalarQn&0x80000000? 2:0;
-
- if( !ECCP_IsPointAtInfinity(pR) )
- ECCP_SM2_DblPoint(pR, pR, pECC, pList);
- if( PnQnBits )
- ECCP_SM2_AddPoint(pR, pPointPQ[PnQnBits], pR, pECC, pList);
-
- scalarPn <<= 1;
- scalarQn <<= 1;
- }
- }
- }
-}
-
-#else
-#pragma message ("ECCP_SM2_ProdPoint: SCCM version")
-
-void ECCP_SM2_ProdPoint(const IppsECCPPointState* pP,
- const IppsBigNumState* bnPscalar,
- const IppsECCPPointState* pQ,
- const IppsBigNumState* bnQscalar,
- IppsECCPPointState* pR,
- const IppsECCPState* pECC,
- BigNumNode* pList)
-{
- IppsECCPPointState T;
- IppsECCPPointState U;
-
- ECP_POINT_X(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&T) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&T) = cpBigNumListGet(&pList);
-
- ECP_POINT_X(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&U) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&U) = cpBigNumListGet(&pList);
-
- ECCP_SM2_MulPoint(pP, bnPscalar, &T, (IppsECCPState*)pECC, pList);
- ECCP_SM2_MulPoint(pQ, bnQscalar, &U, (IppsECCPState*)pECC, pList);
- ECCP_SM2_AddPoint(&T, &U, pR, pECC, pList);
-}
-#endif
-
-#endif /* _ECP_SM2_==_ECP_IMPL_SPECIFIC_ */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccppoint.h b/ext/ipp/sources/ippcp/src/pcpeccppoint.h
deleted file mode 100644
index bf13c8e..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccppoint.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal EC Point Definitions & Function Prototypes
-//
-//
-*/
-
-#if !defined(_PCP_ECCPPOINT_H)
-#define _PCP_ECCPPOINT_H
-
-#include "pcpeccp.h"
-
-
-/*
-// EC Point context
-*/
-struct _cpECCPPoint {
- IppCtxId idCtx; /* EC Point identifier */
-
- IppsBigNumState* pX; /* projective X */
- IppsBigNumState* pY; /* Y */
- IppsBigNumState* pZ; /* Z coordinates */
- int affine; /* impotrant case Z=1 */
-};
-
-/*
-// Contetx Access Macros
-*/
-#define ECP_POINT_ID(ctx) ((ctx)->idCtx)
-#define ECP_POINT_X(ctx) ((ctx)->pX)
-#define ECP_POINT_Y(ctx) ((ctx)->pY)
-#define ECP_POINT_Z(ctx) ((ctx)->pZ)
-#define ECP_POINT_AFFINE(ctx) ((ctx)->affine)
-#define ECP_POINT_VALID_ID(ctx) (ECP_POINT_ID((ctx))==idCtxECCPPoint)
-
-#endif /* _PCP_ECCPPOINT_H */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccppointca.c b/ext/ipp/sources/ippcp/src/pcpeccppointca.c
index 4df8d1e..627dee3 100644
--- a/ext/ipp/sources/ippcp/src/pcpeccppointca.c
+++ b/ext/ipp/sources/ippcp/src/pcpeccppointca.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2003-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -27,9 +27,9 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
-#include "pcpeccppoint.h"
+#include "pcpeccp.h"
/*F*
@@ -56,13 +56,11 @@ IPPFUN(IppStatus, ippsECCPPointGetSize, (int feBitSize, int* pSize))
IPP_BADARG_RET((2>feBitSize), ippStsSizeErr);
{
- int bnSize;
- ippsBigNumGetSize(BITS2WORD32_SIZE(feBitSize), &bnSize);
- *pSize = sizeof(IppsECCPPointState)
- + bnSize /* X coodinate */
- + bnSize /* Y coodinate */
- + bnSize /* Z coodinate */
- +(ALIGN_VAL-1);
+ int elemLen = BITS_BNU_CHUNK(feBitSize);
+ *pSize= sizeof(IppsGFpECPoint)
+ +elemLen*sizeof(BNU_CHUNK_T) /* X */
+ +elemLen*sizeof(BNU_CHUNK_T) /* Y */
+ +elemLen*sizeof(BNU_CHUNK_T);/* Z */
}
return ippStsNoErr;
}
@@ -88,39 +86,20 @@ IPPFUN(IppStatus, ippsECCPPointInit, (int feBitSize, IppsECCPPointState* pPoint)
/* test pEC pointer */
IPP_BAD_PTR1_RET(pPoint);
- /* use aligned context */
- pPoint = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPoint, ALIGN_VAL) );
-
/* test size of field element */
IPP_BADARG_RET((2>feBitSize), ippStsSizeErr);
- /* context ID */
- ECP_POINT_ID(pPoint) = idCtxECCPPoint;
-
- /* meaning: point was not set */
- ECP_POINT_AFFINE(pPoint) =-1;
-
- /*
- // init other context fields
- */
{
+ int elemLen = BITS_BNU_CHUNK(feBitSize);
Ipp8u* ptr = (Ipp8u*)pPoint;
- int bnLen = BITS2WORD32_SIZE(feBitSize);
- int bnSize;
- ippsBigNumGetSize(bnLen, &bnSize);
- /* allocate coordinate buffers */
- ptr += sizeof(IppsECCPPointState);
- ECP_POINT_X(pPoint) = (IppsBigNumState*)( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
- ptr += bnSize;
- ECP_POINT_Y(pPoint) = (IppsBigNumState*)( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
- ptr += bnSize;
- ECP_POINT_Z(pPoint) = (IppsBigNumState*)( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) );
+ ECP_POINT_ID(pPoint) = idCtxGFPPoint;
+ ECP_POINT_FLAGS(pPoint) = 0;
+ ECP_POINT_FELEN(pPoint) = elemLen;
+ ptr += sizeof(IppsGFpECPoint);
+ ECP_POINT_DATA(pPoint) = (BNU_CHUNK_T*)(ptr);
- /* init coordinate buffers */
- ippsBigNumInit(bnLen, ECP_POINT_X(pPoint));
- ippsBigNumInit(bnLen, ECP_POINT_Y(pPoint));
- ippsBigNumInit(bnLen, ECP_POINT_Z(pPoint));
+ gfec_SetPointAtInfinity(pPoint);
+ return ippStsNoErr;
}
- return ippStsNoErr;
}
diff --git a/ext/ipp/sources/ippcp/src/pcpeccppointopca.c b/ext/ipp/sources/ippcp/src/pcpeccppointopca.c
index 02188f9..3032027 100644
--- a/ext/ipp/sources/ippcp/src/pcpeccppointopca.c
+++ b/ext/ipp/sources/ippcp/src/pcpeccppointopca.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2003-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -35,11 +35,9 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
-#include "pcpeccppoint.h"
-#include "pcpeccpmethod.h"
-#include "pcpeccpmethodcom.h"
+#include "pcpeccp.h"
/*F*
@@ -77,16 +75,15 @@
//
*F*/
IPPFUN(IppStatus, ippsECCPSetPoint,(const IppsBigNumState* pX,
- const IppsBigNumState* pY,
- IppsECCPPointState* pPoint,
- IppsECCPState* pECC))
+ const IppsBigNumState* pY,
+ IppsECCPPointState* pPoint,
+ IppsECCPState* pEC))
{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
+ /* test pEC */
+ IPP_BAD_PTR1_RET(pEC);
/* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+ IPP_BADARG_RET(!ECP_TEST_ID(pEC), ippStsContextMatchErr);
/* test pX and pY */
IPP_BAD_PTR2_RET(pX,pY);
@@ -95,21 +92,30 @@ IPPFUN(IppStatus, ippsECCPSetPoint,(const IppsBigNumState* pX,
IPP_BADARG_RET(!BN_VALID_ID(pX), ippStsContextMatchErr);
IPP_BADARG_RET(!BN_VALID_ID(pY), ippStsContextMatchErr);
- /* test pPoint */
- IPP_BAD_PTR1_RET(pPoint);
- pPoint = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPoint, ALIGN_VAL) );
- IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPoint), ippStsContextMatchErr);
-
- /* set affine coordinates at Infinity */
- if( ( IsZero_BN(ECP_BENC(pECC)) && ECCP_IsPointAtAffineInfinity1(pX,pY)) ||
- (!IsZero_BN(ECP_BENC(pECC)) && ECCP_IsPointAtAffineInfinity0(pX,pY)) )
- ECCP_SetPointToInfinity(pPoint);
- /* set point */
- else {
- ECP_METHOD(pECC)->SetPointProjective(pX, pY, BN_ONE_REF(), pPoint, pECC);
+ {
+ IppStatus sts;
+
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ int elemLen = GFP_FELEN(pGF);
+ IppsGFpElement elmX, elmY;
+
+ cpGFpElementConstruct(&elmX, cpGFpGetPool(1, pGF), elemLen);
+ cpGFpElementConstruct(&elmY, cpGFpGetPool(1, pGF), elemLen);
+ do {
+ BNU_CHUNK_T* pData = BN_NUMBER(pX);
+ int ns = BN_SIZE(pX);
+ sts = ippsGFpSetElement((Ipp32u*)pData, BITS2WORD32_SIZE(BITSIZE_BNU(pData, ns)), &elmX, pGF);
+ if(ippStsNoErr!=sts) break;
+ pData = BN_NUMBER(pY);
+ ns = BN_SIZE(pY);
+ sts = ippsGFpSetElement((Ipp32u*)pData, BITS2WORD32_SIZE(BITSIZE_BNU(pData, ns)), &elmY, pGF);
+ if(ippStsNoErr!=sts) break;
+ sts = ippsGFpECSetPoint(&elmX, &elmY, pPoint, pEC);
+ } while(0);
+
+ cpGFpReleasePool(2, pGF);
+ return sts;
}
-
- return ippStsNoErr;
}
@@ -132,23 +138,9 @@ IPPFUN(IppStatus, ippsECCPSetPoint,(const IppsBigNumState* pX,
// pECC pointer to the ECCP context
//
*F*/
-IPPFUN(IppStatus, ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint,
- IppsECCPState* pECC))
+IPPFUN(IppStatus, ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint, IppsECCPState* pEC))
{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
- /* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
-
- /* test pPoint */
- IPP_BAD_PTR1_RET(pPoint);
- pPoint = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPoint, ALIGN_VAL) );
- IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPoint), ippStsContextMatchErr);
-
- ECCP_SetPointToInfinity(pPoint);
- return ippStsNoErr;
+ return ippsGFpECSetPointAtInfinity(pPoint, pEC);
}
@@ -177,22 +169,15 @@ IPPFUN(IppStatus, ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint,
// pECC pointer to the ECCP context
//
*F*/
-IPPFUN(IppStatus, ippsECCPGetPoint,(IppsBigNumState* pX,
- IppsBigNumState* pY,
- const IppsECCPPointState* pPoint,
- IppsECCPState* pECC))
+IPPFUN(IppStatus, ippsECCPGetPoint,(IppsBigNumState* pX, IppsBigNumState* pY,
+ const IppsECCPPointState* pPoint,
+ IppsECCPState* pEC))
{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
+ /* test pEC */
+ IPP_BAD_PTR1_RET(pEC);
/* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
-
- /* test source point */
- IPP_BAD_PTR1_RET(pPoint);
- pPoint = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPoint, ALIGN_VAL) );
- IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPoint), ippStsContextMatchErr);
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+ IPP_BADARG_RET(!ECP_TEST_ID(pEC), ippStsContextMatchErr);
/* test pX and pY */
if(pX) {
@@ -204,15 +189,35 @@ IPPFUN(IppStatus, ippsECCPGetPoint,(IppsBigNumState* pX,
IPP_BADARG_RET(!BN_VALID_ID(pY), ippStsContextMatchErr);
}
- if( ECCP_IsPointAtInfinity(pPoint) ) {
- if( IsZero_BN(ECP_BENC(pECC)) )
- ECCP_SetPointToAffineInfinity1(pX, pY);
- else
- ECCP_SetPointToAffineInfinity0(pX, pY);
+ {
+ IppStatus sts;
+
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ gfdecode decode = pGF->decode; /* gf decode method */
+ int elemLen = GFP_FELEN(pGF);
+ IppsGFpElement elmX, elmY;
+
+ cpGFpElementConstruct(&elmX, cpGFpGetPool(1, pGF), elemLen);
+ cpGFpElementConstruct(&elmY, cpGFpGetPool(1, pGF), elemLen);
+ do {
+ sts = ippsGFpECGetPoint(pPoint, pX? &elmX:NULL, pY? &elmY:NULL, pEC);
+ if(ippStsNoErr!=sts) break;
+
+ if(pX) {
+ decode(elmX.pData, elmX.pData, pGF);
+ sts = ippsSet_BN(ippBigNumPOS, GFP_FELEN32(pGF), (Ipp32u*)elmX.pData, pX);
+ if(ippStsNoErr!=sts) break;
+ }
+ if(pY) {
+ decode(elmY.pData, elmY.pData, pGF);
+ sts = ippsSet_BN(ippBigNumPOS, GFP_FELEN32(pGF), (Ipp32u*)elmY.pData, pY);
+ if(ippStsNoErr!=sts) break;
+ }
+ } while(0);
+
+ cpGFpReleasePool(2, pGF);
+ return sts;
}
- else
- ECP_METHOD(pECC)->GetPointAffine(pX, pY, pPoint, pECC, ECP_BNCTX(pECC));
- return ippStsNoErr;
}
@@ -243,32 +248,10 @@ IPPFUN(IppStatus, ippsECCPGetPoint,(IppsBigNumState* pX,
//
*F*/
IPPFUN(IppStatus, ippsECCPCheckPoint,(const IppsECCPPointState* pP,
- IppECResult* pResult,
- IppsECCPState* pECC))
+ IppECResult* pResult,
+ IppsECCPState* pEC))
{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
- /* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
-
- /* test point */
- IPP_BAD_PTR1_RET(pP);
- pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) );
- IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr);
-
- /* test pResult */
- IPP_BAD_PTR1_RET(pResult);
-
- if( ECCP_IsPointAtInfinity(pP) )
- *pResult = ippECPointIsAtInfinite;
- else if( ECP_METHOD(pECC)->IsPointOnCurve(pP, pECC, ECP_BNCTX(pECC)) )
- *pResult = ippECValid;
- else
- *pResult = ippECPointIsNotValid;
-
- return ippStsNoErr;
+ return ippsGFpECTstPoint(pP, pResult, pEC);
}
@@ -299,30 +282,11 @@ IPPFUN(IppStatus, ippsECCPCheckPoint,(const IppsECCPPointState* pP,
//
*F*/
IPPFUN(IppStatus, ippsECCPComparePoint,(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppECResult* pResult,
- IppsECCPState* pECC))
+ const IppsECCPPointState* pQ,
+ IppECResult* pResult,
+ IppsECCPState* pEC))
{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
- /* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
-
- /* test points */
- IPP_BAD_PTR2_RET(pP,pQ);
- pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) );
- pQ = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pQ, ALIGN_VAL) );
- IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr);
- IPP_BADARG_RET(!ECP_POINT_VALID_ID(pQ), ippStsContextMatchErr);
-
- /* test pResult */
- IPP_BAD_PTR1_RET(pResult);
-
- *pResult = ECP_METHOD(pECC)->ComparePoint(pP, pQ, pECC, ECP_BNCTX(pECC))? ippECPointIsNotEqual : ippECPointIsEqual;
-
- return ippStsNoErr;
+ return ippsGFpECCmpPoint(pP, pQ, pResult, pEC);
}
@@ -349,26 +313,10 @@ IPPFUN(IppStatus, ippsECCPComparePoint,(const IppsECCPPointState* pP,
//
*F*/
IPPFUN(IppStatus, ippsECCPNegativePoint, (const IppsECCPPointState* pP,
- IppsECCPPointState* pR,
- IppsECCPState* pECC))
+ IppsECCPPointState* pR,
+ IppsECCPState* pEC))
{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
- /* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
-
- /* test points */
- IPP_BAD_PTR2_RET(pP,pR);
- pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) );
- pR = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pR, ALIGN_VAL) );
- IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr);
- IPP_BADARG_RET(!ECP_POINT_VALID_ID(pR), ippStsContextMatchErr);
-
- ECP_METHOD(pECC)->NegPoint(pP, pR, pECC);
-
- return ippStsNoErr;
+ return ippsGFpECNegPoint(pP, pR, pEC);
}
@@ -398,32 +346,11 @@ IPPFUN(IppStatus, ippsECCPNegativePoint, (const IppsECCPPointState* pP,
//
*F*/
IPPFUN(IppStatus, ippsECCPAddPoint,(const IppsECCPPointState* pP,
- const IppsECCPPointState* pQ,
- IppsECCPPointState* pR,
- IppsECCPState* pECC))
+ const IppsECCPPointState* pQ,
+ IppsECCPPointState* pR,
+ IppsECCPState* pEC))
{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
- /* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
-
- /* test points */
- IPP_BAD_PTR3_RET(pP,pQ,pR);
- pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) );
- pQ = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pQ, ALIGN_VAL) );
- pR = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pR, ALIGN_VAL) );
- IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr);
- IPP_BADARG_RET(!ECP_POINT_VALID_ID(pQ), ippStsContextMatchErr);
- IPP_BADARG_RET(!ECP_POINT_VALID_ID(pR), ippStsContextMatchErr);
-
- if(pP==pQ)
- ECP_METHOD(pECC)->DblPoint(pP, pR, pECC, ECP_BNCTX(pECC));
- else
- ECP_METHOD(pECC)->AddPoint(pP, pQ, pR, pECC, ECP_BNCTX(pECC));
-
- return ippStsNoErr;
+ return ippsGFpECAddPoint(pP, pQ, pR, pEC);
}
@@ -453,30 +380,14 @@ IPPFUN(IppStatus, ippsECCPAddPoint,(const IppsECCPPointState* pP,
//
*F*/
IPPFUN(IppStatus, ippsECCPMulPointScalar,(const IppsECCPPointState* pP,
- const IppsBigNumState* pK,
- IppsECCPPointState* pR,
- IppsECCPState* pECC))
+ const IppsBigNumState* pK,
+ IppsECCPPointState* pR,
+ IppsECCPState* pEC))
{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
/* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
-
- /* test points */
- IPP_BAD_PTR2_RET(pP,pR);
- pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) );
- pR = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pR, ALIGN_VAL) );
- IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr);
- IPP_BADARG_RET(!ECP_POINT_VALID_ID(pR), ippStsContextMatchErr);
-
- /* test scalar */
- IPP_BAD_PTR1_RET(pK);
- pK = (IppsBigNumState*)( IPP_ALIGNED_PTR(pK, ALIGN_VAL) );
- IPP_BADARG_RET(!BN_VALID_ID(pK), ippStsContextMatchErr);
-
- ECP_METHOD(pECC)->MulPoint(pP, pK, pR, pECC, ECP_BNCTX(pECC));
+ IPP_BAD_PTR1_RET(pEC);
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+ IPP_BADARG_RET(!ECP_TEST_ID(pEC), ippStsContextMatchErr);
- return ippStsNoErr;
+ return ippsGFpECMulPoint(pP, pK, pR, pEC, (Ipp8u*)ECP_SBUFFER(pEC));
}
diff --git a/ext/ipp/sources/ippcp/src/pcpeccppublickeyca.c b/ext/ipp/sources/ippcp/src/pcpeccppublickeyca.c
deleted file mode 100644
index d2455d2..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccppublickeyca.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// EC over Prime Finite Field (EC Key Generation)
-//
-// Contents:
-// ippsECCPPublicKey()
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-#include "pcpeccppoint.h"
-#include "pcpeccpmethod.h"
-#include "pcpeccpmethodcom.h"
-
-
-/*F*
-// Name: ippsECCPPublicKey
-//
-// Purpose: Calculate Public Key
-//
-// Returns: Reason:
-// ippStsNullPtrErr NULL == pECC
-// NULL == pPrivate
-// NULL == pPublic
-//
-// ippStsContextMatchErr illegal pECC->idCtx
-// illegal pPrivate->idCtx
-// illegal pPublic->idCtx
-//
-// ippStsIvalidPrivateKey !(0 < pPrivate < order)
-//
-// ippStsNoErr no errors
-//
-// Parameters:
-// pPrivate pointer to the private key
-// pPublic pointer to the resultant public key
-// pECC pointer to the ECCP context
-//
-*F*/
-IPPFUN(IppStatus, ippsECCPPublicKey, (const IppsBigNumState* pPrivate,
- IppsECCPPointState* pPublic,
- IppsECCPState* pECC))
-{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
- /* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
-
- /* test public key */
- IPP_BAD_PTR1_RET(pPublic);
- pPublic = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPublic, ALIGN_VAL) );
- IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPublic), ippStsContextMatchErr);
-
- /* test private keys */
- IPP_BAD_PTR1_RET(pPrivate);
- pPrivate = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivate, ALIGN_VAL) );
- IPP_BADARG_RET(!BN_VALID_ID(pPrivate), ippStsContextMatchErr);
- IPP_BADARG_RET(!((0<cpBN_tst(pPrivate)) && (0>cpBN_cmp(pPrivate, ECP_ORDER(pECC))) ), ippStsIvalidPrivateKey);
-
- /* calculates public key */
- //ECP_METHOD(pECC)->MulPoint(ECP_GENC(pECC), pPrivate, pPublic, pECC, ECP_BNCTX(pECC));
- ECP_METHOD(pECC)->MulBasePoint(pPrivate, pPublic, pECC, ECP_BNCTX(pECC));
-
- return ippStsNoErr;
-}
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpsetkeyca.c b/ext/ipp/sources/ippcp/src/pcpeccpsetkeyca.c
index dabce4d..427e22a 100644
--- a/ext/ipp/sources/ippcp/src/pcpeccpsetkeyca.c
+++ b/ext/ipp/sources/ippcp/src/pcpeccpsetkeyca.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2003-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -26,12 +26,9 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
#include "pcpeccp.h"
-#include "pcpeccppoint.h"
-#include "pcpeccpmethod.h"
-#include "pcpeccpmethodcom.h"
/*F*
@@ -59,42 +56,47 @@
*F*/
IPPFUN(IppStatus, ippsECCPSetKeyPair, (const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic,
IppBool regular,
- IppsECCPState* pECC))
+ IppsECCPState* pEC))
{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
/* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- /* test ID */
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
+ IPP_BAD_PTR1_RET(pEC);
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+ IPP_BADARG_RET(!ECP_TEST_ID(pEC), ippStsContextMatchErr);
{
- IppsBigNumState* targetPrivate;
- IppsECCPPointState* targetPublic;
+ BNU_CHUNK_T* targetPrivate;
+ BNU_CHUNK_T* targetPublic;
- if( regular ) {
- targetPrivate = ECP_PRIVATE(pECC);
- targetPublic = ECP_PUBLIC(pECC);
+ if(regular) {
+ targetPrivate = ECP_PRIVAT(pEC);
+ targetPublic = ECP_PUBLIC(pEC);
}
else {
- targetPrivate = ECP_PRIVATE_E(pECC);
- targetPublic = ECP_PUBLIC_E(pECC);
+ targetPrivate = ECP_PRIVAT_E(pEC);
+ targetPublic = ECP_PUBLIC_E(pEC);
}
/* set up private key request */
if( pPrivate ) {
pPrivate = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivate, ALIGN_VAL) );
IPP_BADARG_RET(!BN_VALID_ID(pPrivate), ippStsContextMatchErr);
- ippsSet_BN(ippBigNumPOS, BN_SIZE32(pPrivate), (Ipp32u*)BN_NUMBER(pPrivate), targetPrivate);
+ {
+ int privateLen = BITS_BNU_CHUNK(ECP_ORDBITSIZE(pEC));
+ cpGFpElementCopyPadd(targetPrivate, privateLen, BN_NUMBER(pPrivate), BN_SIZE(pPrivate));
+ }
}
/* set up public key request */
if( pPublic ) {
- pPublic = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPublic, ALIGN_VAL) );
- IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPublic), ippStsContextMatchErr);
+ IPP_BADARG_RET( !ECP_POINT_TEST_ID(pPublic), ippStsContextMatchErr );
+ {
+ BNU_CHUNK_T* targetPublicX = targetPublic;
+ BNU_CHUNK_T* targetPublicY = targetPublic+ECP_POINT_FELEN(pPublic);
+ gfec_GetPoint(targetPublicX, targetPublicY, pPublic, pEC);
+ gfec_SetPoint(targetPublic, targetPublicX, targetPublicY, pEC);
- ECP_METHOD(pECC)->GetPointAffine(ECP_POINT_X(targetPublic), ECP_POINT_Y(targetPublic), pPublic, pECC, ECP_BNCTX(pECC));
- ECP_METHOD(pECC)->SetPointAffine(ECP_POINT_X(targetPublic), ECP_POINT_Y(targetPublic), targetPublic, pECC);
+ //cpGFpElementCopy(targetPublic, ECP_POINT_DATA(pPublic), publicLen);
+ }
}
return ippStsNoErr;
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpsigndsaca.c b/ext/ipp/sources/ippcp/src/pcpeccpsigndsaca.c
index 182d505..6fa769d 100644
--- a/ext/ipp/sources/ippcp/src/pcpeccpsigndsaca.c
+++ b/ext/ipp/sources/ippcp/src/pcpeccpsigndsaca.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2003-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -26,12 +26,9 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
#include "pcpeccp.h"
-#include "pcpeccppoint.h"
-#include "pcpeccpmethod.h"
-#include "pcpeccpmethodcom.h"
/*F*
@@ -78,69 +75,121 @@
IPPFUN(IppStatus, ippsECCPSignDSA,(const IppsBigNumState* pMsgDigest,
const IppsBigNumState* pPrivate,
IppsBigNumState* pSignX, IppsBigNumState* pSignY,
- IppsECCPState* pECC))
+ IppsECCPState* pEC))
{
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
/* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
+ IPP_BAD_PTR1_RET(pEC);
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+ IPP_BADARG_RET(!ECP_TEST_ID(pEC), ippStsContextMatchErr);
/* test private key*/
IPP_BAD_PTR1_RET(pPrivate);
- pPrivate = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivate, ALIGN_VAL) );
+ pPrivate = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivate, BN_ALIGNMENT) );
IPP_BADARG_RET(!BN_VALID_ID(pPrivate), ippStsContextMatchErr);
/* test message representative */
IPP_BAD_PTR1_RET(pMsgDigest);
- pMsgDigest = (IppsBigNumState*)( IPP_ALIGNED_PTR(pMsgDigest, ALIGN_VAL) );
+ pMsgDigest = (IppsBigNumState*)( IPP_ALIGNED_PTR(pMsgDigest, BN_ALIGNMENT) );
IPP_BADARG_RET(!BN_VALID_ID(pMsgDigest), ippStsContextMatchErr);
- IPP_BADARG_RET((0<=cpBN_cmp(pMsgDigest, ECP_ORDER(pECC))), ippStsMessageErr);
+ IPP_BADARG_RET(BN_NEGATIVE(pMsgDigest), ippStsMessageErr);
/* test signature */
IPP_BAD_PTR2_RET(pSignX,pSignY);
- pSignX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignX, ALIGN_VAL) );
- pSignY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignY, ALIGN_VAL) );
+ pSignX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignX, BN_ALIGNMENT) );
+ pSignY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignY, BN_ALIGNMENT) );
IPP_BADARG_RET(!BN_VALID_ID(pSignX), ippStsContextMatchErr);
IPP_BADARG_RET(!BN_VALID_ID(pSignY), ippStsContextMatchErr);
- IPP_BADARG_RET((BN_ROOM(pSignX)*BITSIZE(BNU_CHUNK_T)<ECP_ORDBITS(pECC)), ippStsRangeErr);
- IPP_BADARG_RET((BN_ROOM(pSignY)*BITSIZE(BNU_CHUNK_T)<ECP_ORDBITS(pECC)), ippStsRangeErr);
+ IPP_BADARG_RET((BN_ROOM(pSignX)*BITSIZE(BNU_CHUNK_T)<ECP_ORDBITSIZE(pEC)), ippStsRangeErr);
+ IPP_BADARG_RET((BN_ROOM(pSignY)*BITSIZE(BNU_CHUNK_T)<ECP_ORDBITSIZE(pEC)), ippStsRangeErr);
{
- IppsMontState* rMont = ECP_RMONT(pECC);
- IppsBigNumState* pOrder = ECP_ORDER(pECC);
-
- BigNumNode* pList = ECP_BNCTX(pECC);
- IppsBigNumState* pTmp = cpBigNumListGet(&pList);
-
- /* extract ephemeral public key (X component only) */
- ECP_METHOD(pECC)->GetPointAffine(pTmp, NULL, ECP_PUBLIC_E(pECC), pECC, pList);
-
- /*
- // compute
- // signX = eph_pub_x (mod order)
- */
- PMA_mod(pSignX, pTmp, pOrder);
- if( !IsZero_BN(pSignX) ) {
-
- IppsBigNumState* pEncMsg = cpBigNumListGet(&pList);
- IppsBigNumState* pEncSignX = cpBigNumListGet(&pList);
- PMA_enc(pEncMsg, (IppsBigNumState*)pMsgDigest, rMont);
- PMA_enc(pEncSignX, pSignX, rMont);
-
- /*
- // compute
- // signY = (1/eph_private)*(pMsgDigest + private*signX) (mod order)
- */
- PMA_inv(pSignY, ECP_PRIVATE_E(pECC), pOrder);
- PMA_enc(ECP_PRIVATE_E(pECC), pPrivate, rMont);
- PMA_mule(pTmp, ECP_PRIVATE_E(pECC), pEncSignX, rMont);
- PMA_add(pTmp, pTmp, pEncMsg, pOrder);
- PMA_mule(pSignY, pSignY, pTmp, rMont);
- if( !IsZero_BN(pSignY) )
- return ippStsNoErr;
+ IppsMontState* pMontR = ECP_MONT_R(pEC);
+ BNU_CHUNK_T* pOrder = MNT_MODULUS(pMontR);
+ int orderLen = MNT_SIZE(pMontR);
+
+ BNU_CHUNK_T* pMsgData = BN_NUMBER(pMsgDigest);
+ int msgLen = BN_SIZE(pMsgDigest);
+ IPP_BADARG_RET(0<=cpCmp_BNU(pMsgData, msgLen, pOrder, orderLen), ippStsMessageErr);
+
+ /* signY = ephPrivate^-1 mod Order*/
+ {
+ __ALIGN8 IppsBigNumState R;
+ BNU_CHUNK_T* buffer = ECP_SBUFFER(pEC);
+ /* BN(order) */
+ BN_Make(buffer, buffer+orderLen+1, orderLen, &R);
+ BN_Set(pOrder, orderLen, &R);
+
+ BN_Set(ECP_PRIVAT_E(pEC), orderLen, pSignX);
+ ippsModInv_BN(pSignX, &R, pSignY);
}
- return ippStsEphemeralKeyErr;
+ {
+ IppStatus sts = ippStsEphemeralKeyErr;
+
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ int elmLen = GFP_FELEN(pGF);
+ int pelmLen = GFP_PELEN(pGF);
+ BNU_CHUNK_T* pC = cpGFpGetPool(3, pGF);
+ BNU_CHUNK_T* pF = pC + pelmLen;
+ BNU_CHUNK_T* pS = pF + pelmLen;
+
+ /* ephemeral public */
+ IppsGFpECPoint ephPublic;
+ cpEcGFpInitPoint(&ephPublic, ECP_PUBLIC_E(pEC), ECP_FINITE_POINT|ECP_AFFINE_POINT, pEC);
+
+ /* ephPublic.x */
+ gfec_GetPoint(pC, NULL, &ephPublic, pEC);
+ pGF->decode(pC, pC, pGF);
+
+ /* signX = int(ephPublic.x) (mod order) */
+ elmLen = cpMod_BNU(pC, elmLen, pOrder, orderLen);
+ cpGFpElementPadd(pC+elmLen, orderLen-elmLen, 0);
+ if(!GFP_IS_ZERO(pC, orderLen)) {
+
+ /*
+ // signY = (1/ephPrivate)*(pMsgDigest + private*signX) (mod order)
+ */
+ /* S = mont(private) * mont(signX) */
+ cpMontEnc_BNU(pF, pC, orderLen, pMontR);
+ cpMontEnc_BNU(pS, BN_NUMBER(pPrivate), BN_SIZE(pPrivate), pMontR);
+ cpMontMul_BNU(pS, pS,orderLen, pF,orderLen,
+ pOrder,orderLen,
+ MNT_HELPER(pMontR), MNT_PRODUCT(pMontR), NULL);
+ /* S = (S+ mont(msg) mod order */
+ cpGFpElementCopyPadd(pF, orderLen, pMsgData, msgLen);
+ cpMontEnc_BNU(pF, pF, orderLen, pMontR);
+ cpModAdd_BNU(pS, pS, pF, pOrder, orderLen, pF);
+
+ /* S = S*(ephPrivate^-1) */
+ cpGFpElementCopyPadd(pF, orderLen, BN_NUMBER(pSignY), BN_SIZE(pSignY));
+ cpMontMul_BNU(pS, pS,orderLen, pF,orderLen,
+ pOrder,orderLen,
+ MNT_HELPER(pMontR), MNT_PRODUCT(pMontR), NULL);
+
+ if(!GFP_IS_ZERO(pS, orderLen)) {
+ BNU_CHUNK_T* pSignXdata = BN_NUMBER(pSignX);
+ BNU_CHUNK_T* pSignYdata = BN_NUMBER(pSignY);
+
+ /* signX */
+ elmLen = orderLen;
+ FIX_BNU(pC, elmLen);
+ BN_SIGN(pSignX) = ippBigNumPOS;
+ BN_SIZE(pSignX) = elmLen;
+ cpGFpElementCopy(pSignXdata, pC, elmLen);
+
+ /* signY */
+ elmLen = orderLen;
+ FIX_BNU(pS, elmLen);
+ BN_SIGN(pSignY) = ippBigNumPOS;
+ BN_SIZE(pSignY) = elmLen;
+ cpGFpElementCopy(pSignYdata, pS, elmLen);
+
+ sts = ippStsNoErr;
+ }
+ }
+
+ cpGFpReleasePool(3, pGF);
+ return sts;
+ }
}
}
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpsscm.c b/ext/ipp/sources/ippcp/src/pcpeccpsscm.c
deleted file mode 100644
index 6978a0a..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpsscm.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// ECCP SSCM stuff
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-#include "pcpbn.h"
-#include "pcpeccppoint.h"
-
-#if defined (_USE_ECCP_SSCM_)
-#pragma message ("ECCP SCCM version")
-
-//#define LOG2_CACHE_LINE_SIZE (6) /* LOG2(CACHE_LINE_SIZE) */
-#define LOG2_CACHE_LINE_SIZE (LOG_CACHE_LINE_SIZE)
-
-static int div_upper(int a, int d)
-{ return (a+d-1)/d; }
-
-static int getNumOperations(int bitsize, int w)
-{
- int n_overhead = (1<<w) -1;
- int n_ops = div_upper(bitsize, w) + n_overhead;
- return n_ops;
-}
-
-int cpECCP_OptimalWinSize(int bitsize)
-{
-#define LIMIT (LOG2_CACHE_LINE_SIZE)
- int w_opt = 1;
- int n_opt = getNumOperations(bitsize, w_opt);
- int w_trial;
- for(w_trial=w_opt+1; w_trial<=LIMIT; w_trial++) {
- int n_trial = getNumOperations(bitsize, w_trial);
- if(n_trial>=n_opt) break;
- w_opt = w_trial;
- n_opt = n_trial;
- }
- return w_opt;
-#undef LIMIT
-}
-
-int cpECCP_ConvertRepresentation(BNU_CHUNK_T* pInput, int inpBits, int w)
-{
- Ipp32u* pR = (Ipp32u*)pInput;
- Ipp16u* pR16 = (Ipp16u*)pInput;
-
- int outBits = 0;
- Ipp32u base = (BNU_CHUNK_T)1<<w;
- Ipp32u digitMask = base-1;
- int i;
-
- cpSize nsR = BITS2WORD32_SIZE(inpBits);
- pR[nsR] = 0; // expand 32-bit representation of input
- for(i=0; i<inpBits; i+=w) {
- cpSize chunkIdx = i/BITSIZE(Ipp16u);
- Ipp32u chunk = ((Ipp32u*)(pR16+chunkIdx))[0];
- int digitShift = i % BITSIZE(Ipp16u);
- Ipp32u digit = (chunk>>digitShift) &digitMask;
-
- Ipp32u delta = (base-digit) & ~digitMask;
- delta <<= digitShift;
- cpDec_BNU32((Ipp32u*)(pR16+chunkIdx), (Ipp32u*)(pR16+chunkIdx), (2*nsR-chunkIdx+1)/2, delta);
-
- inpBits = BITSIZE_BNU32(pR, nsR);
- outBits += w;
- }
-
- return outBits;
-}
-
-/*
-// cpsScramblePut/cpsScrambleGet
-// stores to/retrieves from pScrambleEntry position
-// pre-computed data if fixed window method is used
-*/
-void cpECCP_ScramblePut(Ipp8u* pScrambleEntry, int proposity,
- const IppsECCPPointState* pPoint, cpSize coordLen)
-{
- int i;
- Ipp8u* pCoord;
-
- BNU_CHUNK_T* pX = BN_NUMBER(ECP_POINT_X(pPoint));
- BNU_CHUNK_T* pY = BN_NUMBER(ECP_POINT_Y(pPoint));
- BNU_CHUNK_T* pZ = BN_NUMBER(ECP_POINT_Z(pPoint));
- int coordSize = coordLen*sizeof(BNU_CHUNK_T);
-
- ZEXPAND_BNU(pX, BN_SIZE(ECP_POINT_X(pPoint)), coordLen);
- ZEXPAND_BNU(pY, BN_SIZE(ECP_POINT_Y(pPoint)), coordLen);
- ZEXPAND_BNU(pZ, BN_SIZE(ECP_POINT_Z(pPoint)), coordLen);
-
- pCoord = (Ipp8u*)pX;
- for(i=0; i<coordSize; i++, pScrambleEntry+=proposity)
- *pScrambleEntry = pCoord[i];
-
- pCoord = (Ipp8u*)pY;
- for(i=0; i<coordSize; i++, pScrambleEntry+=proposity)
- *pScrambleEntry = pCoord[i];
-
- pCoord = (Ipp8u*)pZ;
- for(i=0; i<coordSize; i++, pScrambleEntry+=proposity)
- *pScrambleEntry = pCoord[i];
-}
-
-void cpECCP_ScrambleGet(IppsECCPPointState* pPoint, cpSize coordLen,
- const Ipp8u* pScrambleEntry, int proposity)
-{
- BNU_CHUNK_T* pX = BN_NUMBER(ECP_POINT_X(pPoint));
- BNU_CHUNK_T* pY = BN_NUMBER(ECP_POINT_Y(pPoint));
- BNU_CHUNK_T* pZ = BN_NUMBER(ECP_POINT_Z(pPoint));
-
- int coordSize = coordLen*sizeof(BNU_CHUNK_T);
- int i;
-
- Ipp8u* pCoord = (Ipp8u*)pX;
- for(i=0; i<coordSize; i++, pScrambleEntry+=proposity)
- pCoord[i] = *pScrambleEntry;
-
- pCoord = (Ipp8u*)pY;
- for(i=0; i<coordSize; i++, pScrambleEntry+=proposity)
- pCoord[i] = *pScrambleEntry;
-
- pCoord = (Ipp8u*)pZ;
- for(i=0; i<coordSize; i++, pScrambleEntry+=proposity)
- pCoord[i] = *pScrambleEntry;
-
- i = coordLen;
- FIX_BNU(pX, i);
- BN_SIZE(ECP_POINT_X(pPoint)) = i;
-
- i = coordLen;
- FIX_BNU(pY, i);
- BN_SIZE(ECP_POINT_Y(pPoint)) = i;
-
- i = coordLen;
- FIX_BNU(pZ, i);
- BN_SIZE(ECP_POINT_Z(pPoint)) = i;
-}
-
-#endif /* _USE_ECCP_SSCM_ */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpsscm.h b/ext/ipp/sources/ippcp/src/pcpeccpsscm.h
deleted file mode 100644
index 46a73f3..0000000
--- a/ext/ipp/sources/ippcp/src/pcpeccpsscm.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// ECCP SSCM stuff
-//
-//
-*/
-
-#if defined (_USE_ECCP_SSCM_)
-#if !defined(_PCP_ECCP_SSCM_H)
-#define _PCP_ECCP_SSCM_H
-
-#include "pcpeccppoint.h"
-
-int cpECCP_OptimalWinSize(int bitSize);
-
-int cpECCP_ConvertRepresentation(BNU_CHUNK_T* pR, int inpBits, int w);
-
-/*
-// cpsScramblePut/cpsScrambleGet
-// stores to/retrieves from pScrambleEntry position
-// pre-computed data if fixed window method is used
-*/
-void cpECCP_ScramblePut(Ipp8u* pScrambleEntry, int proposity, const IppsECCPPointState* pPoint, int coordLen);
-void cpECCP_ScrambleGet(IppsECCPPointState* pPoint, int coordLen, const Ipp8u* pScrambleEntry, int proposity);
-
-#endif /* _PCP_ECCP_SSCM_H */
-#endif /* _USE_ECCP_SSCM_ */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpstdca.c b/ext/ipp/sources/ippcp/src/pcpeccpstdca.c
index 47cabcc..9a203f7 100644
--- a/ext/ipp/sources/ippcp/src/pcpeccpstdca.c
+++ b/ext/ipp/sources/ippcp/src/pcpeccpstdca.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2003-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
#include "pcpeccp.h"
@@ -45,349 +45,336 @@
/*
// Recommended Parameters secp112r1
*/
-const Ipp32u secp112r1_p[] = { // (2^128 -3)/76439
- 0xBEAD208B, 0x5E668076, 0x2ABF62E3, 0xDB7C};
-const Ipp32u secp112r1_a[] = {
- 0xBEAD2088, 0x5E668076, 0x2ABF62E3, 0xDB7C};
-const Ipp32u secp112r1_b[] = {
- 0x11702B22, 0x16EEDE89, 0xF8BA0439, 0x659E};
-const Ipp32u secp112r1_gx[] = {
- 0xF9C2F098, 0x5EE76B55, 0x7239995A, 0x0948};
-const Ipp32u secp112r1_gy[] = {
- 0x0FF77500, 0xC0A23E0E, 0xE5AF8724, 0xA89C};
-const Ipp32u secp112r1_r[] = {
- 0xAC6561C5, 0x5E7628DF, 0x2ABF62E3, 0xDB7C};
-Ipp32u secp112r1_h = 1;
+const BNU_CHUNK_T secp112r1_p[] = { // (2^128 -3)/76439
+ LL(0xBEAD208B, 0x5E668076), LL(0x2ABF62E3, 0xDB7C)};
+const BNU_CHUNK_T secp112r1_a[] = {
+ LL(0xBEAD2088, 0x5E668076), LL(0x2ABF62E3, 0xDB7C)};
+const BNU_CHUNK_T secp112r1_b[] = {
+ LL(0x11702B22, 0x16EEDE89), LL(0xF8BA0439, 0x659E)};
+const BNU_CHUNK_T secp112r1_gx[] = {
+ LL(0xF9C2F098, 0x5EE76B55), LL(0x7239995A, 0x0948)};
+const BNU_CHUNK_T secp112r1_gy[] = {
+ LL(0x0FF77500, 0xC0A23E0E), LL(0xE5AF8724, 0xA89C)};
+const BNU_CHUNK_T secp112r1_r[] = {
+ LL(0xAC6561C5, 0x5E7628DF), LL(0x2ABF62E3, 0xDB7C)};
+BNU_CHUNK_T secp112r1_h = 1;
/*
// Recommended Parameters secp112r2
*/
-const Ipp32u secp112r2_p[] = { // (2^128 -3)/76439
- 0xBEAD208B, 0x5E668076, 0x2ABF62E3, 0xDB7C};
-const Ipp32u secp112r2_a[] = {
- 0x5C0EF02C, 0x8A0AAAF6, 0xC24C05F3, 0x6127};
-const Ipp32u secp112r2_b[] = {
- 0x4C85D709, 0xED74FCC3, 0xF1815DB5, 0x51DE};
-const Ipp32u secp112r2_gx[] = {
- 0xD0928643, 0xB4E1649D, 0x0AB5E892, 0x4BA3};
-const Ipp32u secp112r2_gy[] = {
- 0x6E956E97, 0x3747DEF3, 0x46F5882E, 0xADCD};
-const Ipp32u secp112r2_r[] = {
- 0x0520D04B, 0xD7597CA1, 0x0AAFD8B8, 0x36DF};
-Ipp32u secp112r2_h = 4;
+const BNU_CHUNK_T secp112r2_p[] = { // (2^128 -3)/76439
+ LL(0xBEAD208B, 0x5E668076), LL(0x2ABF62E3, 0xDB7C)};
+const BNU_CHUNK_T secp112r2_a[] = {
+ LL(0x5C0EF02C, 0x8A0AAAF6), LL(0xC24C05F3, 0x6127)};
+const BNU_CHUNK_T secp112r2_b[] = {
+ LL(0x4C85D709, 0xED74FCC3), LL(0xF1815DB5, 0x51DE)};
+const BNU_CHUNK_T secp112r2_gx[] = {
+ LL(0xD0928643, 0xB4E1649D), LL(0x0AB5E892, 0x4BA3)};
+const BNU_CHUNK_T secp112r2_gy[] = {
+ LL(0x6E956E97, 0x3747DEF3), LL(0x46F5882E, 0xADCD)};
+const BNU_CHUNK_T secp112r2_r[] = {
+ LL(0x0520D04B, 0xD7597CA1), LL(0x0AAFD8B8, 0x36DF)};
+BNU_CHUNK_T secp112r2_h = 4;
/*
// Recommended Parameters secp128r1
*/
-const Ipp32u h_secp128r1_p[] = { // halpf of secp128r1_p
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x7FFFFFFE};
+const BNU_CHUNK_T h_secp128r1_p[] = { // halpf of secp128r1_p
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0x7FFFFFFE)};
-const Ipp32u secp128r1_p[] = { // 2^128 -2^97 -1
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFD, 0x0, 0x0};
-const Ipp32u secp128r1_a[] = {
- 0xFFFFFFFC, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFD};
-const Ipp32u secp128r1_b[] = {
- 0x2CEE5ED3, 0xD824993C, 0x1079F43D, 0xE87579C1};
-const Ipp32u secp128r1_gx[] = {
- 0xA52C5B86, 0x0C28607C, 0x8B899B2D, 0x161FF752};
-const Ipp32u secp128r1_gy[] = {
- 0xDDED7A83, 0xC02DA292, 0x5BAFEB13, 0xCF5AC839};
-const Ipp32u secp128r1_r[] = {
- 0x9038A115, 0x75A30D1B, 0x00000000, 0xFFFFFFFE};
-Ipp32u secp128r1_h = 1;
+const BNU_CHUNK_T secp128r1_p[] = { // 2^128 -2^97 -1
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFD), LL(0, 0)};
+const BNU_CHUNK_T secp128r1_a[] = {
+ LL(0xFFFFFFFC, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFD)};
+const BNU_CHUNK_T secp128r1_b[] = {
+ LL(0x2CEE5ED3, 0xD824993C), LL(0x1079F43D, 0xE87579C1)};
+const BNU_CHUNK_T secp128r1_gx[] = {
+ LL(0xA52C5B86, 0x0C28607C), LL(0x8B899B2D, 0x161FF752)};
+const BNU_CHUNK_T secp128r1_gy[] = {
+ LL(0xDDED7A83, 0xC02DA292), LL(0x5BAFEB13, 0xCF5AC839)};
+const BNU_CHUNK_T secp128r1_r[] = {
+ LL(0x9038A115, 0x75A30D1B), LL(0x00000000, 0xFFFFFFFE)};
+BNU_CHUNK_T secp128r1_h = 1;
/*
// Recommended Parameters secp128r2
*/
-const Ipp32u secp128r2_p[] = { // 2^128 -2^97 -1
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFD, 0x0, 0x0};
-const Ipp32u secp128r2_a[] = {
- 0xBFF9AEE1, 0xBF59CC9B, 0xD1B3BBFE, 0xD6031998};
-const Ipp32u secp128r2_b[] = {
- 0xBB6D8A5D, 0xDC2C6558, 0x80D02919, 0x5EEEFCA3};
-const Ipp32u secp128r2_gx[] = {
- 0xCDEBC140, 0xE6FB32A7, 0x5E572983, 0x7B6AA5D8};
-const Ipp32u secp128r2_gy[] = {
- 0x5FC34B44, 0x7106FE80, 0x894D3AEE, 0x27B6916A};
-const Ipp32u secp128r2_r[] = {
- 0x0613B5A3, 0xBE002472, 0x7FFFFFFF, 0x3FFFFFFF};
-Ipp32u secp128r2_h = 4;
+const BNU_CHUNK_T secp128r2_p[] = { // 2^128 -2^97 -1
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFD), LL(0, 0)};
+const BNU_CHUNK_T secp128r2_a[] = {
+ LL(0xBFF9AEE1, 0xBF59CC9B), LL(0xD1B3BBFE, 0xD6031998)};
+const BNU_CHUNK_T secp128r2_b[] = {
+ LL(0xBB6D8A5D, 0xDC2C6558), LL(0x80D02919, 0x5EEEFCA3)};
+const BNU_CHUNK_T secp128r2_gx[] = {
+ LL(0xCDEBC140, 0xE6FB32A7), LL(0x5E572983, 0x7B6AA5D8)};
+const BNU_CHUNK_T secp128r2_gy[] = {
+ LL(0x5FC34B44, 0x7106FE80), LL(0x894D3AEE, 0x27B6916A)};
+const BNU_CHUNK_T secp128r2_r[] = {
+ LL(0x0613B5A3, 0xBE002472), LL(0x7FFFFFFF, 0x3FFFFFFF)};
+BNU_CHUNK_T secp128r2_h = 4;
/*
// Recommended Parameters secp160r1
*/
-const Ipp32u secp160r1_p[] = { // 2^160 -2^31 -1
- 0x7FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
-const Ipp32u secp160r1_a[] = {
- 0x7FFFFFFC, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
-const Ipp32u secp160r1_b[] = {
- 0xC565FA45, 0x81D4D4AD, 0x65ACF89F, 0x54BD7A8B, 0x1C97BEFC};
-const Ipp32u secp160r1_gx[] = {
- 0x13CBFC82, 0x68C38BB9, 0x46646989, 0x8EF57328, 0x4A96B568};
-const Ipp32u secp160r1_gy[] = {
- 0x7AC5FB32, 0x04235137, 0x59DCC912, 0x3168947D, 0x23A62855};
-const Ipp32u secp160r1_r[] = {
- 0xCA752257, 0xF927AED3, 0x0001F4C8, 0x00000000, 0x00000000, 0x1};
-Ipp32u secp160r1_h = 1;
+const BNU_CHUNK_T secp160r1_p[] = { // 2^160 -2^31 -1
+ LL(0x7FFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), L_(0xFFFFFFFF)};
+const BNU_CHUNK_T secp160r1_a[] = {
+ LL(0x7FFFFFFC, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), L_(0xFFFFFFFF)};
+const BNU_CHUNK_T secp160r1_b[] = {
+ LL(0xC565FA45, 0x81D4D4AD), LL(0x65ACF89F, 0x54BD7A8B), L_(0x1C97BEFC)};
+const BNU_CHUNK_T secp160r1_gx[] = {
+ LL(0x13CBFC82, 0x68C38BB9), LL(0x46646989, 0x8EF57328), L_(0x4A96B568)};
+const BNU_CHUNK_T secp160r1_gy[] = {
+ LL(0x7AC5FB32, 0x04235137), LL(0x59DCC912, 0x3168947D), L_(0x23A62855)};
+const BNU_CHUNK_T secp160r1_r[] = {
+ LL(0xCA752257, 0xF927AED3), LL(0x0001F4C8, 0x00000000), LL(0x00000000, 0x1)};
+BNU_CHUNK_T secp160r1_h = 1;
/*
// Recommended Parameters secp160r2
*/
-const Ipp32u secp160r2_p[] = { // 2^160 -2^32 -2^14 -2^12 -2^9 -2^8 -2^7 -2^2 -1
- 0xFFFFAC73, 0xFFFFFFFE, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
-const Ipp32u secp160r2_a[] = {
- 0xFFFFAC70, 0xFFFFFFFE, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
-const Ipp32u secp160r2_b[] = {
- 0xF50388BA, 0x04664D5A, 0xAB572749, 0xFB59EB8B, 0xB4E134D3};
-const Ipp32u secp160r2_gx[] = {
- 0x3144CE6D, 0x30F7199D, 0x1F4FF11B, 0x293A117E, 0x52DCB034};
-const Ipp32u secp160r2_gy[] = {
- 0xA7D43F2E, 0xF9982CFE, 0xE071FA0D, 0xE331F296, 0xFEAFFEF2};
-const Ipp32u secp160r2_r[] = {
- 0xF3A1A16B, 0xE786A818, 0x0000351E, 0x00000000, 0x00000000, 0x1};
-Ipp32u secp160r2_h = 1;
+const BNU_CHUNK_T secp160r2_p[] = { // 2^160 -2^32 -2^14 -2^12 -2^9 -2^8 -2^7 -2^2 -1
+ LL(0xFFFFAC73, 0xFFFFFFFE), LL(0xFFFFFFFF, 0xFFFFFFFF), L_(0xFFFFFFFF)};
+const BNU_CHUNK_T secp160r2_a[] = {
+ LL(0xFFFFAC70, 0xFFFFFFFE), LL(0xFFFFFFFF, 0xFFFFFFFF), L_(0xFFFFFFFF)};
+const BNU_CHUNK_T secp160r2_b[] = {
+ LL(0xF50388BA, 0x04664D5A), LL(0xAB572749, 0xFB59EB8B), L_(0xB4E134D3)};
+const BNU_CHUNK_T secp160r2_gx[] = {
+ LL(0x3144CE6D, 0x30F7199D), LL(0x1F4FF11B, 0x293A117E), L_(0x52DCB034)};
+const BNU_CHUNK_T secp160r2_gy[] = {
+ LL(0xA7D43F2E, 0xF9982CFE), LL(0xE071FA0D, 0xE331F296), L_(0xFEAFFEF2)};
+const BNU_CHUNK_T secp160r2_r[] = {
+ LL(0xF3A1A16B, 0xE786A818), LL(0x0000351E, 0x00000000), LL(0x00000000, 0x1)};
+BNU_CHUNK_T secp160r2_h = 1;
/*
// Recommended Parameters secp192r1
*/
-const Ipp32u h_secp192r1_p[] = { // half of secp192r1_p
- 0xFFFFFFFF, 0x7FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x7FFFFFFF};
+const BNU_CHUNK_T h_secp192r1_p[] = { // half of secp192r1_p
+ LL(0xFFFFFFFF, 0x7FFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0x7FFFFFFF)};
-const Ipp32u secp192r1_p[] = { // 2^192 -2^64 -1
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0, 0x0};
-const Ipp32u secp192r1_a[] = {
- 0xFFFFFFFC, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
-const Ipp32u secp192r1_b[] = {
- 0xC146B9B1, 0xFEB8DEEC, 0x72243049, 0x0FA7E9AB, 0xE59C80E7, 0x64210519};
-const Ipp32u secp192r1_gx[] = {
- 0x82FF1012, 0xF4FF0AFD, 0x43A18800, 0x7CBF20EB, 0xB03090F6, 0x188DA80E};
-const Ipp32u secp192r1_gy[] = {
- 0x1E794811, 0x73F977A1, 0x6B24CDD5, 0x631011ED, 0xFFC8DA78, 0x07192B95};
-const Ipp32u secp192r1_r[] = {
- 0xB4D22831, 0x146BC9B1, 0x99DEF836, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
-Ipp32u secp192r1_h = 1;
+const BNU_CHUNK_T secp192r1_p[] = { // 2^192 -2^64 -1
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFE, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0x0, 0x0)};
+const BNU_CHUNK_T secp192r1_a[] = {
+ LL(0xFFFFFFFC, 0xFFFFFFFF), LL(0xFFFFFFFE, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF)};
+const BNU_CHUNK_T secp192r1_b[] = {
+ LL(0xC146B9B1, 0xFEB8DEEC), LL(0x72243049, 0x0FA7E9AB), LL(0xE59C80E7, 0x64210519)};
+const BNU_CHUNK_T secp192r1_gx[] = {
+ LL(0x82FF1012, 0xF4FF0AFD), LL(0x43A18800, 0x7CBF20EB), LL(0xB03090F6, 0x188DA80E)};
+const BNU_CHUNK_T secp192r1_gy[] = {
+ LL(0x1E794811, 0x73F977A1), LL(0x6B24CDD5, 0x631011ED), LL(0xFFC8DA78, 0x07192B95)};
+const BNU_CHUNK_T secp192r1_r[] = {
+ LL(0xB4D22831, 0x146BC9B1), LL(0x99DEF836, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF)};
+BNU_CHUNK_T secp192r1_h = 1;
/*
// Recommended Parameters secp224r1
*/
-const Ipp32u h_secp224r1_p[] = { // half of secp224r1_p
- 0x00000000, 0x00000000, 0x80000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
- 0x7FFFFFFF, 0x0};
+const BNU_CHUNK_T h_secp224r1_p[] = { // half of secp224r1_p
+ LL(0x00000000, 0x00000000), LL(0x80000000, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF),
+ LL(0x7FFFFFFF, 0x0)};
-const Ipp32u secp224r1_p[] = { // 2^224 -2^96 +1
- 0x00000001, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
- 0xFFFFFFFF, 0x0};
-const Ipp32u secp224r1_a[] = {
- 0xFFFFFFFE, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0xFFFFFFFF,
- 0xFFFFFFFF};
-const Ipp32u secp224r1_b[] = {
- 0x2355FFB4, 0x270B3943, 0xD7BFD8BA, 0x5044B0B7, 0xF5413256, 0x0C04B3AB,
- 0xB4050A85};
-const Ipp32u secp224r1_gx[] = {
- 0x115C1D21, 0x343280D6, 0x56C21122, 0x4A03C1D3, 0x321390B9, 0x6BB4BF7F,
- 0xB70E0CBD};
-const Ipp32u secp224r1_gy[] = {
- 0x85007E34, 0x44D58199, 0x5A074764, 0xCD4375A0, 0x4C22DFE6, 0xB5F723FB,
- 0xBD376388};
-const Ipp32u secp224r1_r[] = {
- 0x5C5C2A3D, 0x13DD2945, 0xE0B8F03E, 0xFFFF16A2, 0xFFFFFFFF, 0xFFFFFFFF,
- 0xFFFFFFFF};
-Ipp32u secp224r1_h = 1;
+const BNU_CHUNK_T secp224r1_p[] = { // 2^224 -2^96 +1
+ LL(0x00000001, 0x00000000), LL(0x00000000, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF),
+ LL(0xFFFFFFFF, 0x0)};
+const BNU_CHUNK_T secp224r1_a[] = {
+ LL(0xFFFFFFFE, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFE), LL(0xFFFFFFFF, 0xFFFFFFFF),
+ L_(0xFFFFFFFF)};
+const BNU_CHUNK_T secp224r1_b[] = {
+ LL(0x2355FFB4, 0x270B3943), LL(0xD7BFD8BA, 0x5044B0B7), LL(0xF5413256, 0x0C04B3AB),
+ L_(0xB4050A85)};
+const BNU_CHUNK_T secp224r1_gx[] = {
+ LL(0x115C1D21, 0x343280D6), LL(0x56C21122, 0x4A03C1D3), LL(0x321390B9, 0x6BB4BF7F),
+ L_(0xB70E0CBD)};
+const BNU_CHUNK_T secp224r1_gy[] = {
+ LL(0x85007E34, 0x44D58199), LL(0x5A074764, 0xCD4375A0), LL(0x4C22DFE6, 0xB5F723FB),
+ L_(0xBD376388)};
+const BNU_CHUNK_T secp224r1_r[] = {
+ LL(0x5C5C2A3D, 0x13DD2945), LL(0xE0B8F03E, 0xFFFF16A2), LL(0xFFFFFFFF, 0xFFFFFFFF),
+ L_(0xFFFFFFFF)};
+BNU_CHUNK_T secp224r1_h = 1;
/*
// Recommended Parameters secp256r1
*/
-const Ipp32u h_secp256r1_p[] = { // half of secp256r1_p
- 0xFFFFFFFF, 0xFFFFFFFF, 0x7FFFFFFF, 0x00000000, 0x00000000, 0x80000000,
- 0x80000000, 0x7FFFFFFF};
+const BNU_CHUNK_T h_secp256r1_p[] = { // half of secp256r1_p
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0x7FFFFFFF, 0x00000000), LL(0x00000000, 0x80000000),
+ LL(0x80000000, 0x7FFFFFFF)};
-const Ipp32u secp256r1_p[] = { // 2^256 -2^224 +2^192 +2^96 -1
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000,
- 0x00000001, 0xFFFFFFFF, 0x0, 0x0};
-const Ipp32u secp256r1_a[] = {
- 0xFFFFFFFC, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000,
- 0x00000001, 0xFFFFFFFF};
-const Ipp32u secp256r1_b[] = {
- 0x27D2604B, 0x3BCE3C3E, 0xCC53B0F6, 0x651D06B0, 0x769886BC, 0xB3EBBD55,
- 0xAA3A93E7, 0x5AC635D8};
-const Ipp32u secp256r1_gx[] = {
- 0xD898C296, 0xF4A13945, 0x2DEB33A0, 0x77037D81, 0x63A440F2, 0xF8BCE6E5,
- 0xE12C4247, 0x6B17D1F2};
-const Ipp32u secp256r1_gy[] = {
- 0x37BF51F5, 0xCBB64068, 0x6B315ECE, 0x2BCE3357, 0x7C0F9E16, 0x8EE7EB4A,
- 0xFE1A7F9B, 0x4FE342E2};
-const Ipp32u secp256r1_r[] = {
- 0xFC632551, 0xF3B9CAC2, 0xA7179E84, 0xBCE6FAAD, 0xFFFFFFFF, 0xFFFFFFFF,
- 0x00000000, 0xFFFFFFFF};
-Ipp32u secp256r1_h = 1;
+const BNU_CHUNK_T secp256r1_p[] = { // 2^256 -2^224 +2^192 +2^96 -1
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0x00000000), LL(0x00000000, 0x00000000),
+ LL(0x00000001, 0xFFFFFFFF), LL(0x0, 0x0)};
+const BNU_CHUNK_T secp256r1_a[] = {
+ LL(0xFFFFFFFC, 0xFFFFFFFF), LL(0xFFFFFFFF, 0x00000000), LL(0x00000000, 0x00000000),
+ LL(0x00000001, 0xFFFFFFFF)};
+const BNU_CHUNK_T secp256r1_b[] = {
+ LL(0x27D2604B, 0x3BCE3C3E), LL(0xCC53B0F6, 0x651D06B0), LL(0x769886BC, 0xB3EBBD55),
+ LL(0xAA3A93E7, 0x5AC635D8)};
+const BNU_CHUNK_T secp256r1_gx[] = {
+ LL(0xD898C296, 0xF4A13945), LL(0x2DEB33A0, 0x77037D81), LL(0x63A440F2, 0xF8BCE6E5),
+ LL(0xE12C4247, 0x6B17D1F2)};
+const BNU_CHUNK_T secp256r1_gy[] = {
+ LL(0x37BF51F5, 0xCBB64068), LL(0x6B315ECE, 0x2BCE3357), LL(0x7C0F9E16, 0x8EE7EB4A),
+ LL(0xFE1A7F9B, 0x4FE342E2)};
+const BNU_CHUNK_T secp256r1_r[] = {
+ LL(0xFC632551, 0xF3B9CAC2), LL(0xA7179E84, 0xBCE6FAAD), LL(0xFFFFFFFF, 0xFFFFFFFF),
+ LL(0x00000000, 0xFFFFFFFF)};
+BNU_CHUNK_T secp256r1_h = 1;
/*
// Recommended Parameters secp384r1
*/
-const Ipp32u h_secp384r1_p[] = { // half of secp384r1_p
- 0x7FFFFFFF, 0x00000000, 0x80000000, 0x7FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x7FFFFFFF};
+const BNU_CHUNK_T h_secp384r1_p[] = { // half of secp384r1_p
+ LL(0x7FFFFFFF, 0x00000000), LL(0x80000000, 0x7FFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF),
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0x7FFFFFFF)};
-const Ipp32u secp384r1_p[] = { // 2^384 -2^128 -2^96 +2^32 -1
- 0xFFFFFFFF, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFF,
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
- 0x0, 0x0};
-const Ipp32u secp384r1_a[] = {
- 0xFFFFFFFC, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFF,
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
-const Ipp32u secp384r1_b[] = {
- 0xD3EC2AEF, 0x2A85C8ED, 0x8A2ED19D, 0xC656398D, 0x5013875A, 0x0314088F,
- 0xFE814112, 0x181D9C6E, 0xE3F82D19, 0x988E056B, 0xE23EE7E4, 0xB3312FA7};
-const Ipp32u secp384r1_gx[] = {
- 0x72760AB7, 0x3A545E38, 0xBF55296C, 0x5502F25D, 0x82542A38, 0x59F741E0,
- 0x8BA79B98, 0x6E1D3B62, 0xF320AD74, 0x8EB1C71E, 0xBE8B0537, 0xAA87CA22};
-const Ipp32u secp384r1_gy[] = {
- 0x90EA0E5F, 0x7A431D7C, 0x1D7E819D, 0x0A60B1CE, 0xB5F0B8C0, 0xE9DA3113,
- 0x289A147C, 0xF8F41DBD, 0x9292DC29, 0x5D9E98BF, 0x96262C6F, 0x3617DE4A};
-const Ipp32u secp384r1_r[] = {
- 0xCCC52973, 0xECEC196A, 0x48B0A77A, 0x581A0DB2, 0xF4372DDF, 0xC7634D81,
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
-Ipp32u secp384r1_h = 1;
+const BNU_CHUNK_T secp384r1_p[] = { // 2^384 -2^128 -2^96 +2^32 -1
+ LL(0xFFFFFFFF, 0x00000000), LL(0x00000000, 0xFFFFFFFF), LL(0xFFFFFFFE, 0xFFFFFFFF),
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF),
+ LL(0x0, 0x0)};
+const BNU_CHUNK_T secp384r1_a[] = {
+ LL(0xFFFFFFFC, 0x00000000), LL(0x00000000, 0xFFFFFFFF), LL(0xFFFFFFFE, 0xFFFFFFFF),
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF)};
+const BNU_CHUNK_T secp384r1_b[] = {
+ LL(0xD3EC2AEF, 0x2A85C8ED), LL(0x8A2ED19D, 0xC656398D), LL(0x5013875A, 0x0314088F),
+ LL(0xFE814112, 0x181D9C6E), LL(0xE3F82D19, 0x988E056B), LL(0xE23EE7E4, 0xB3312FA7)};
+const BNU_CHUNK_T secp384r1_gx[] = {
+ LL(0x72760AB7, 0x3A545E38), LL(0xBF55296C, 0x5502F25D), LL(0x82542A38, 0x59F741E0),
+ LL(0x8BA79B98, 0x6E1D3B62), LL(0xF320AD74, 0x8EB1C71E), LL(0xBE8B0537, 0xAA87CA22)};
+const BNU_CHUNK_T secp384r1_gy[] = {
+ LL(0x90EA0E5F, 0x7A431D7C), LL(0x1D7E819D, 0x0A60B1CE), LL(0xB5F0B8C0, 0xE9DA3113),
+ LL(0x289A147C, 0xF8F41DBD), LL(0x9292DC29, 0x5D9E98BF), LL(0x96262C6F, 0x3617DE4A)};
+const BNU_CHUNK_T secp384r1_r[] = {
+ LL(0xCCC52973, 0xECEC196A), LL(0x48B0A77A, 0x581A0DB2), LL(0xF4372DDF, 0xC7634D81),
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF)};
+BNU_CHUNK_T secp384r1_h = 1;
/*
// Recommended Parameters secp521r1
*/
-const Ipp32u h_secp521r1_p[] = { // half of secp521r1_p
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x000000FF, 0x0};
+const BNU_CHUNK_T h_secp521r1_p[] = { // half of secp521r1_p
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF),
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF),
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), L_(0x000000FF)};
-const Ipp32u secp521r1_p[] = { // 2^521 -1
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x000001FF, 0x0};
-const Ipp32u secp521r1_a[] = {
- 0xFFFFFFFC, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x000001FF};
-const Ipp32u secp521r1_b[] = {
- 0x6B503F00, 0xEF451FD4, 0x3D2C34F1, 0x3573DF88, 0x3BB1BF07, 0x1652C0BD,
- 0xEC7E937B, 0x56193951, 0x8EF109E1, 0xB8B48991, 0x99B315F3, 0xA2DA725B,
- 0xB68540EE, 0x929A21A0, 0x8E1C9A1F, 0x953EB961, 0x00000051};
-const Ipp32u secp521r1_gx[] = {
- 0xC2E5BD66, 0xF97E7E31, 0x856A429B, 0x3348B3C1, 0xA2FFA8DE, 0xFE1DC127,
- 0xEFE75928, 0xA14B5E77, 0x6B4D3DBA, 0xF828AF60, 0x053FB521, 0x9C648139,
- 0x2395B442, 0x9E3ECB66, 0x0404E9CD, 0x858E06B7, 0x000000C6};
-const Ipp32u secp521r1_gy[] = {
- 0x9FD16650, 0x88BE9476, 0xA272C240, 0x353C7086, 0x3FAD0761, 0xC550B901,
- 0x5EF42640, 0x97EE7299, 0x273E662C, 0x17AFBD17, 0x579B4468, 0x98F54449,
- 0x2C7D1BD9, 0x5C8A5FB4, 0x9A3BC004, 0x39296A78, 0x00000118};
-const Ipp32u secp521r1_r[] = {
- 0x91386409, 0xBB6FB71E, 0x899C47AE, 0x3BB5C9B8, 0xF709A5D0, 0x7FCC0148,
- 0xBF2F966B, 0x51868783, 0xFFFFFFFA, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x000001FF};
-Ipp32u secp521r1_h = 1;
+const BNU_CHUNK_T secp521r1_p[] = { // 2^521 -1
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF),
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF),
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), L_(0x000001FF)};
+const BNU_CHUNK_T secp521r1_a[] = {
+ LL(0xFFFFFFFC, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF),
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF),
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), L_(0x000001FF)};
+const BNU_CHUNK_T secp521r1_b[] = {
+ LL(0x6B503F00, 0xEF451FD4), LL(0x3D2C34F1, 0x3573DF88), LL(0x3BB1BF07, 0x1652C0BD),
+ LL(0xEC7E937B, 0x56193951), LL(0x8EF109E1, 0xB8B48991), LL(0x99B315F3, 0xA2DA725B),
+ LL(0xB68540EE, 0x929A21A0), LL(0x8E1C9A1F, 0x953EB961), L_(0x00000051)};
+const BNU_CHUNK_T secp521r1_gx[] = {
+ LL(0xC2E5BD66, 0xF97E7E31), LL(0x856A429B, 0x3348B3C1), LL(0xA2FFA8DE, 0xFE1DC127),
+ LL(0xEFE75928, 0xA14B5E77), LL(0x6B4D3DBA, 0xF828AF60), LL(0x053FB521, 0x9C648139),
+ LL(0x2395B442, 0x9E3ECB66), LL(0x0404E9CD, 0x858E06B7), L_(0x000000C6)};
+const BNU_CHUNK_T secp521r1_gy[] = {
+ LL(0x9FD16650, 0x88BE9476), LL(0xA272C240, 0x353C7086), LL(0x3FAD0761, 0xC550B901),
+ LL(0x5EF42640, 0x97EE7299), LL(0x273E662C, 0x17AFBD17), LL(0x579B4468, 0x98F54449),
+ LL(0x2C7D1BD9, 0x5C8A5FB4), LL(0x9A3BC004, 0x39296A78), L_(0x00000118)};
+const BNU_CHUNK_T secp521r1_r[] = {
+ LL(0x91386409, 0xBB6FB71E), LL(0x899C47AE, 0x3BB5C9B8), LL(0xF709A5D0, 0x7FCC0148),
+ LL(0xBF2F966B, 0x51868783), LL(0xFFFFFFFA, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF),
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), L_(0x000001FF)};
+BNU_CHUNK_T secp521r1_h = 1;
/*
// Recommended Parameters tpm_BN_p256 (Barreto-Naehrig)
*/
-const Ipp32u tpmBN_p256p_p[] = {
- 0xAED33013, 0xD3292DDB, 0x12980A82, 0x0CDC65FB, 0xEE71A49F, 0x46E5F25E,
- 0xFFFCF0CD, 0xFFFFFFFF};
-const Ipp32u tpmBN_p256p_a[] = {
- 0, 0};
-const Ipp32u tpmBN_p256p_b[] = {
- 3, 0};
-const Ipp32u tpmBN_p256p_gx[] = {
- 1, 0};
-const Ipp32u tpmBN_p256p_gy[] = {
- 2, 0};
-const Ipp32u tpmBN_p256p_r[] = {
- 0xD10B500D, 0xF62D536C, 0x1299921A, 0x0CDC65FB, 0xEE71A49E, 0x46E5F25E,
- 0xFFFCF0CD, 0xFFFFFFFF};
-Ipp32u tpmBN_p256p_h = 1;
+const BNU_CHUNK_T tpmBN_p256p_p[] = {
+ LL(0xAED33013, 0xD3292DDB), LL(0x12980A82, 0x0CDC65FB), LL(0xEE71A49F, 0x46E5F25E),
+ LL(0xFFFCF0CD, 0xFFFFFFFF)};
+const BNU_CHUNK_T tpmBN_p256p_a[] = {
+ LL(0, 0)};
+const BNU_CHUNK_T tpmBN_p256p_b[] = {
+ LL(3, 0)};
+const BNU_CHUNK_T tpmBN_p256p_gx[] = {
+ LL(1, 0)};
+const BNU_CHUNK_T tpmBN_p256p_gy[] = {
+ LL(2, 0)};
+const BNU_CHUNK_T tpmBN_p256p_r[] = {
+ LL(0xD10B500D, 0xF62D536C), LL(0x1299921A, 0x0CDC65FB), LL(0xEE71A49E, 0x46E5F25E),
+ LL(0xFFFCF0CD, 0xFFFFFFFF)};
+BNU_CHUNK_T tpmBN_p256p_h = 1;
/*
// Recommended Parameters tpm_SM2_p256
*/
#ifdef _SM2_SIGN_DEBUG_
-const Ipp32u tpmSM2_p256_p[] = {
- 0x08F1DFC3, 0x722EDB8B, 0x5C45517D, 0x45728391, 0xBF6FF7DE, 0xE8B92435,
- 0x4C044F18, 0x8542D69E, 0x0, 0x0};
-const Ipp32u tpmSM2_p256_a[] = {
- 0x3937E498, 0xEC65228B, 0x6831D7E0, 0x2F3C848B, 0x73BBFEFF, 0x2417842E,
- 0xFA32C3FD, 0x787968B4};
-const Ipp32u tpmSM2_p256_b[] = {
- 0x27C5249A, 0x6E12D1DA, 0xB16BA06E, 0xF61D59A5, 0x484BFE48, 0x9CF84241,
- 0xB23B0C84, 0x63E4C6D3};
-const Ipp32u tpmSM2_p256_gx[] = {
- 0x7FEDD43D, 0x4C4E6C14, 0xADD50BDC, 0x32220B3B, 0xC3CC315E, 0x746434EB,
- 0x1B62EAB6, 0x421DEBD6};
-const Ipp32u tpmSM2_p256_gy[] = {
- 0xE46E09A2, 0xA85841B9, 0xBFA36EA1, 0xE5D7FDFC, 0x153B70C4, 0xD47349D2,
- 0xCBB42C07, 0x0680512B};
-const Ipp32u tpmSM2_p256_r[] = {
- 0xC32E79B7, 0x5AE74EE7, 0x0485628D, 0x29772063, 0xBF6FF7DD, 0xE8B92435,
- 0x4C044F18, 0x8542D69E};
+const BNU_CHUNK_T tpmSM2_p256_p[] = {
+ LL(0x08F1DFC3, 0x722EDB8B), LL(0x5C45517D, 0x45728391), LL(0xBF6FF7DE, 0xE8B92435), LL(0x4C044F18, 0x8542D69E), LL(0x0, 0x0)};
+const BNU_CHUNK_T tpmSM2_p256_a[] = {
+ LL(0x3937E498, 0xEC65228B), LL(0x6831D7E0, 0x2F3C848B), LL(0x73BBFEFF, 0x2417842E), LL(0xFA32C3FD, 0x787968B4)};
+const BNU_CHUNK_T tpmSM2_p256_b[] = {
+ LL(0x27C5249A, 0x6E12D1DA), LL(0xB16BA06E, 0xF61D59A5), LL(0x484BFE48, 0x9CF84241), LL(0xB23B0C84, 0x63E4C6D3)};
+const BNU_CHUNK_T tpmSM2_p256_gx[] = {
+ LL(0x7FEDD43D, 0x4C4E6C14), LL(0xADD50BDC, 0x32220B3B), LL(0xC3CC315E, 0x746434EB), LL(0x1B62EAB6, 0x421DEBD6)};
+const BNU_CHUNK_T tpmSM2_p256_gy[] = {
+ LL(0xE46E09A2, 0xA85841B9), LL(0xBFA36EA1, 0xE5D7FDFC), LL(0x153B70C4, 0xD47349D2), LL(0xCBB42C07, 0x0680512B)};
+const BNU_CHUNK_T tpmSM2_p256_r[] = {
+ LL(0xC32E79B7, 0x5AE74EE7), LL(0x0485628D, 0x29772063), LL(0xBF6FF7DD, 0xE8B92435), LL(0x4C044F18, 0x8542D69E)};
#else
-const Ipp32u h_tpmSM2_p256_p[] = { // half of tpmSM2_p256_p
- 0xFFFFFFFF, 0x7FFFFFFF, 0x80000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
- 0x7FFFFFFF, 0x7FFFFFFF};
+const BNU_CHUNK_T h_tpmSM2_p256_p[] = { // half of tpmSM2_p256_p
+ LL(0xFFFFFFFF, 0x7FFFFFFF), LL(0x80000000, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0x7FFFFFFF, 0x7FFFFFFF)};
-const Ipp32u tpmSM2_p256_p[] = { // 2^256 -2^224 -2^96 +2^64 -1
- 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
- 0xFFFFFFFF, 0xFFFFFFFE, 0x0, 0x0};
-const Ipp32u tpmSM2_p256_a[] = {
- 0xFFFFFFFC, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
- 0xFFFFFFFF, 0xFFFFFFFE};
-const Ipp32u tpmSM2_p256_b[] = {
- 0x4D940E93, 0xDDBCBD41, 0x15AB8F92, 0xF39789F5, 0xCF6509A7, 0x4D5A9E4B,
- 0x9D9F5E34, 0x28E9FA9E};
-const Ipp32u tpmSM2_p256_gx[] = {
- 0x334C74C7, 0x715A4589, 0xF2660BE1, 0x8FE30BBF, 0x6A39C994, 0x5F990446,
- 0x1F198119, 0x32C4AE2C};
-const Ipp32u tpmSM2_p256_gy[] = {
- 0x2139F0A0, 0x02DF32E5, 0xC62A4740, 0xD0A9877C, 0x6B692153, 0x59BDCEE3,
- 0xF4F6779C, 0xBC3736A2};
-const Ipp32u tpmSM2_p256_r[] = {
- 0x39D54123, 0x53BBF409, 0x21C6052B, 0x7203DF6B, 0xFFFFFFFF, 0xFFFFFFFF,
- 0xFFFFFFFF, 0xFFFFFFFE};
+const BNU_CHUNK_T tpmSM2_p256_p[] = { // 2^256 -2^224 -2^96 +2^64 -1
+ LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0x00000000, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFE), LL(0x0, 0x0)};
+const BNU_CHUNK_T tpmSM2_p256_a[] = {
+ LL(0xFFFFFFFC, 0xFFFFFFFF), LL(0x00000000, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFE)};
+const BNU_CHUNK_T tpmSM2_p256_b[] = {
+ LL(0x4D940E93, 0xDDBCBD41), LL(0x15AB8F92, 0xF39789F5), LL(0xCF6509A7, 0x4D5A9E4B), LL(0x9D9F5E34, 0x28E9FA9E)};
+const BNU_CHUNK_T tpmSM2_p256_gx[] = {
+ LL(0x334C74C7, 0x715A4589), LL(0xF2660BE1, 0x8FE30BBF), LL(0x6A39C994, 0x5F990446), LL(0x1F198119, 0x32C4AE2C)};
+const BNU_CHUNK_T tpmSM2_p256_gy[] = {
+ LL(0x2139F0A0, 0x02DF32E5), LL(0xC62A4740, 0xD0A9877C), LL(0x6B692153, 0x59BDCEE3), LL(0xF4F6779C, 0xBC3736A2)};
+const BNU_CHUNK_T tpmSM2_p256_r[] = {
+ LL(0x39D54123, 0x53BBF409), LL(0x21C6052B, 0x7203DF6B), LL(0xFFFFFFFF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFE)};
#endif
-Ipp32u tpmSM2_p256_h = 1;
-
+BNU_CHUNK_T tpmSM2_p256_h = 1;
+#if 0
/*
// premultiplied secp128r{1|2}_p (for spesial implementation)
*/
-static const Ipp32u secp128_x2[] = {0xFFFFFFFE, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFB, 0x01, 0x0};
-static const Ipp32u secp128_x3[] = {0xFFFFFFFD, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFF9, 0x02, 0x0};
-static const Ipp32u secp128_x4[] = {0xFFFFFFFC, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFF7, 0x03, 0x0};
-static const Ipp32u secp128_x5[] = {0xFFFFFFFB, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFF5, 0x04, 0x0};
-static const Ipp32u secp128_x6[] = {0xFFFFFFFA, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFF3, 0x05, 0x0};
-static const Ipp32u secp128_x7[] = {0xFFFFFFF9, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFF1, 0x06, 0x0};
-static const Ipp32u secp128_x8[] = {0xFFFFFFF8, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFEF, 0x07, 0x0};
-static const Ipp32u secp128_x9[] = {0xFFFFFFF7, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFED, 0x08, 0x0};
-static const Ipp32u secp128_xA[] = {0xFFFFFFF6, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFEB, 0x09, 0x0};
-static const Ipp32u secp128_xB[] = {0xFFFFFFF5, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFE9, 0x0A, 0x0};
-static const Ipp32u secp128_xC[] = {0xFFFFFFF4, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFE7, 0x0B, 0x0};
-static const Ipp32u secp128_xD[] = {0xFFFFFFF3, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFE5, 0x0C, 0x0};
-static const Ipp32u secp128_xE[] = {0xFFFFFFF2, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFE3, 0x0D, 0x0};
-static const Ipp32u secp128_xF[] = {0xFFFFFFF1, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFE1, 0x0E, 0x0};
-static const Ipp32u secp128_x10[]= {0xFFFFFFF0, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFDF, 0x0F, 0x0};
-static const Ipp32u secp128_x11[]= {0xFFFFFFEF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFDD, 0x10, 0x0};
-static const Ipp32u secp128_x12[]= {0xFFFFFFEE, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFDB, 0x11, 0x0};
-static const Ipp32u secp128_x13[]= {0xFFFFFFED, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFD9, 0x12, 0x0};
-static const Ipp32u secp128_x14[]= {0xFFFFFFEC, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFD7, 0x13, 0x0};
-static const Ipp32u secp128_x15[]= {0xFFFFFFEB, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFD5, 0x14, 0x0};
-static const Ipp32u secp128_x16[]= {0xFFFFFFEA, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFD3, 0x15, 0x0};
-static const Ipp32u secp128_x17[]= {0xFFFFFFE9, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFD1, 0x16, 0x0};
-static const Ipp32u secp128_x18[]= {0xFFFFFFE8, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFCF, 0x17, 0x0};
-static const Ipp32u secp128_x19[]= {0xFFFFFFE7, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFCD, 0x18, 0x0};
-static const Ipp32u secp128_x1A[]= {0xFFFFFFE6, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFCB, 0x19, 0x0};
-static const Ipp32u secp128_x1B[]= {0xFFFFFFE5, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFC9, 0x1A, 0x0};
-static const Ipp32u secp128_x1C[]= {0xFFFFFFE4, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFC7, 0x1B, 0x0};
-static const Ipp32u secp128_x1D[]= {0xFFFFFFE3, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFC5, 0x1C, 0x0};
-static const Ipp32u secp128_x1E[]= {0xFFFFFFE2, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFC3, 0x1D, 0x0};
-static const Ipp32u secp128_x1F[]= {0xFFFFFFE1, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFC1, 0x1E, 0x0};
-static const Ipp32u secp128_x20[]= {0xFFFFFFE0, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFBF, 0x1F, 0x0};
+static const BNU_CHUNK_T secp128_x2[] = {LL(0xFFFFFFFE, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFFB), L_(0x01)};
+static const BNU_CHUNK_T secp128_x3[] = {LL(0xFFFFFFFD, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFF9), L_(0x02)};
+static const BNU_CHUNK_T secp128_x4[] = {LL(0xFFFFFFFC, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFF7), L_(0x03)};
+static const BNU_CHUNK_T secp128_x5[] = {LL(0xFFFFFFFB, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFF5), L_(0x04)};
+static const BNU_CHUNK_T secp128_x6[] = {LL(0xFFFFFFFA, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFF3), L_(0x05)};
+static const BNU_CHUNK_T secp128_x7[] = {LL(0xFFFFFFF9, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFF1), L_(0x06)};
+static const BNU_CHUNK_T secp128_x8[] = {LL(0xFFFFFFF8, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFEF), L_(0x07)};
+static const BNU_CHUNK_T secp128_x9[] = {LL(0xFFFFFFF7, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFED), L_(0x08)};
+static const BNU_CHUNK_T secp128_xA[] = {LL(0xFFFFFFF6, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFEB), L_(0x09)};
+static const BNU_CHUNK_T secp128_xB[] = {LL(0xFFFFFFF5, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFE9), L_(0x0A)};
+static const BNU_CHUNK_T secp128_xC[] = {LL(0xFFFFFFF4, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFE7), L_(0x0B)};
+static const BNU_CHUNK_T secp128_xD[] = {LL(0xFFFFFFF3, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFE5), L_(0x0C)};
+static const BNU_CHUNK_T secp128_xE[] = {LL(0xFFFFFFF2, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFE3), L_(0x0D)};
+static const BNU_CHUNK_T secp128_xF[] = {LL(0xFFFFFFF1, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFE1), L_(0x0E)};
+static const BNU_CHUNK_T secp128_x10[]= {LL(0xFFFFFFF0, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFDF), L_(0x0F)};
+static const BNU_CHUNK_T secp128_x11[]= {LL(0xFFFFFFEF, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFDD), L_(0x10)};
+static const BNU_CHUNK_T secp128_x12[]= {LL(0xFFFFFFEE, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFDB), L_(0x11)};
+static const BNU_CHUNK_T secp128_x13[]= {LL(0xFFFFFFED, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFD9), L_(0x12)};
+static const BNU_CHUNK_T secp128_x14[]= {LL(0xFFFFFFEC, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFD7), L_(0x13)};
+static const BNU_CHUNK_T secp128_x15[]= {LL(0xFFFFFFEB, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFD5), L_(0x14)};
+static const BNU_CHUNK_T secp128_x16[]= {LL(0xFFFFFFEA, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFD3), L_(0x15)};
+static const BNU_CHUNK_T secp128_x17[]= {LL(0xFFFFFFE9, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFD1), L_(0x16)};
+static const BNU_CHUNK_T secp128_x18[]= {LL(0xFFFFFFE8, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFCF), L_(0x17)};
+static const BNU_CHUNK_T secp128_x19[]= {LL(0xFFFFFFE7, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFCD), L_(0x18)};
+static const BNU_CHUNK_T secp128_x1A[]= {LL(0xFFFFFFE6, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFCB), L_(0x19)};
+static const BNU_CHUNK_T secp128_x1B[]= {LL(0xFFFFFFE5, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFC9), L_(0x1A)};
+static const BNU_CHUNK_T secp128_x1C[]= {LL(0xFFFFFFE4, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFC7), L_(0x1B)};
+static const BNU_CHUNK_T secp128_x1D[]= {LL(0xFFFFFFE3, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFC5), L_(0x1C)};
+static const BNU_CHUNK_T secp128_x1E[]= {LL(0xFFFFFFE2, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFC3), L_(0x1D)};
+static const BNU_CHUNK_T secp128_x1F[]= {LL(0xFFFFFFE1, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFC1), L_(0x1E)};
+static const BNU_CHUNK_T secp128_x20[]= {LL(0xFFFFFFE0, 0xFFFFFFFF), LL(0xFFFFFFFF, 0xFFFFFFBF), L_(0x1F)};
#define MAX_MUL (32)
-const Ipp32u* secp128_mx[MAX_MUL] = {
+const BNU_CHUNK_T* secp128_mx[MAX_MUL] = {
secp128r1_p, /* 1*secp128r1_p */
secp128_x2, /* 2*secp128r1_p */
secp128_x3, /* 3*secp128r1_p */
@@ -421,29 +408,31 @@ const Ipp32u* secp128_mx[MAX_MUL] = {
secp128_x1F, /* 31*secp128r1_p */
secp128_x20 /* 32*secp128r1_p */
};
+#endif
+#if 0
/*
// premultiplied SM2 modulus (for spesial implementation)
*/
-static const Ipp32u tpmSM2_p256_p_x1[] = {0xFFFFFFFF,0xFFFFFFFF,0x00000000,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFE,0x00000000,0};
-static const Ipp32u tpmSM2_p256_p_x2[] = {0xFFFFFFFE,0xFFFFFFFF,0x00000001,0xFFFFFFFE,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFD,0x00000001,0};
-static const Ipp32u tpmSM2_p256_p_x3[] = {0xFFFFFFFD,0xFFFFFFFF,0x00000002,0xFFFFFFFD,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFC,0x00000002,0};
-static const Ipp32u tpmSM2_p256_p_x4[] = {0xFFFFFFFC,0xFFFFFFFF,0x00000003,0xFFFFFFFC,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFB,0x00000003,0};
-static const Ipp32u tpmSM2_p256_p_x5[] = {0xFFFFFFFB,0xFFFFFFFF,0x00000004,0xFFFFFFFB,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFA,0x00000004,0};
-static const Ipp32u tpmSM2_p256_p_x6[] = {0xFFFFFFFA,0xFFFFFFFF,0x00000005,0xFFFFFFFA,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFF9,0x00000005,0};
-static const Ipp32u tpmSM2_p256_p_x7[] = {0xFFFFFFF9,0xFFFFFFFF,0x00000006,0xFFFFFFF9,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFF8,0x00000006,0};
-static const Ipp32u tpmSM2_p256_p_x8[] = {0xFFFFFFF8,0xFFFFFFFF,0x00000007,0xFFFFFFF8,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFF7,0x00000007,0};
-static const Ipp32u tpmSM2_p256_p_x9[] = {0xFFFFFFF7,0xFFFFFFFF,0x00000008,0xFFFFFFF7,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFF6,0x00000008,0};
-static const Ipp32u tpmSM2_p256_p_xA[] = {0xFFFFFFF6,0xFFFFFFFF,0x00000009,0xFFFFFFF6,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFF5,0x00000009,0};
-static const Ipp32u tpmSM2_p256_p_xB[] = {0xFFFFFFF5,0xFFFFFFFF,0x0000000A,0xFFFFFFF5,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFF4,0x0000000A,0};
-static const Ipp32u tpmSM2_p256_p_xC[] = {0xFFFFFFF4,0xFFFFFFFF,0x0000000B,0xFFFFFFF4,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFF3,0x0000000B,0};
-static const Ipp32u tpmSM2_p256_p_xD[] = {0xFFFFFFF3,0xFFFFFFFF,0x0000000C,0xFFFFFFF3,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFF2,0x0000000C,0};
-static const Ipp32u tpmSM2_p256_p_xE[] = {0xFFFFFFF2,0xFFFFFFFF,0x0000000D,0xFFFFFFF2,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFF1,0x0000000D,0};
-static const Ipp32u tpmSM2_p256_p_xF[] = {0xFFFFFFF1,0xFFFFFFFF,0x0000000E,0xFFFFFFF1,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFF0,0x0000000E,0};
-static const Ipp32u tpmSM2_p256_p_x10[]= {0xFFFFFFF0,0xFFFFFFFF,0x0000000F,0xFFFFFFF0,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFEF,0x0000000F,0};
+static const BNU_CHUNK_T tpmSM2_p256_p_x1[] = {LL(0xFFFFFFFF,0xFFFFFFFF),LL(0x00000000,0xFFFFFFFF),LL(0xFFFFFFFF,0xFFFFFFFF),LL(0xFFFFFFFF,0xFFFFFFFE),L_(0x00000000)};
+static const BNU_CHUNK_T tpmSM2_p256_p_x2[] = {LL(0xFFFFFFFE,0xFFFFFFFF),LL(0x00000001,0xFFFFFFFE),LL(0xFFFFFFFF,0xFFFFFFFF),LL(0xFFFFFFFF,0xFFFFFFFD),L_(0x00000001)};
+static const BNU_CHUNK_T tpmSM2_p256_p_x3[] = {LL(0xFFFFFFFD,0xFFFFFFFF),LL(0x00000002,0xFFFFFFFD),LL(0xFFFFFFFF,0xFFFFFFFF),LL(0xFFFFFFFF,0xFFFFFFFC),L_(0x00000002)};
+static const BNU_CHUNK_T tpmSM2_p256_p_x4[] = {LL(0xFFFFFFFC,0xFFFFFFFF),LL(0x00000003,0xFFFFFFFC),LL(0xFFFFFFFF,0xFFFFFFFF),LL(0xFFFFFFFF,0xFFFFFFFB),L_(0x00000003)};
+static const BNU_CHUNK_T tpmSM2_p256_p_x5[] = {LL(0xFFFFFFFB,0xFFFFFFFF),LL(0x00000004,0xFFFFFFFB),LL(0xFFFFFFFF,0xFFFFFFFF),LL(0xFFFFFFFF,0xFFFFFFFA),L_(0x00000004)};
+static const BNU_CHUNK_T tpmSM2_p256_p_x6[] = {LL(0xFFFFFFFA,0xFFFFFFFF),LL(0x00000005,0xFFFFFFFA),LL(0xFFFFFFFF,0xFFFFFFFF),LL(0xFFFFFFFF,0xFFFFFFF9),L_(0x00000005)};
+static const BNU_CHUNK_T tpmSM2_p256_p_x7[] = {LL(0xFFFFFFF9,0xFFFFFFFF),LL(0x00000006,0xFFFFFFF9),LL(0xFFFFFFFF,0xFFFFFFFF),LL(0xFFFFFFFF,0xFFFFFFF8),L_(0x00000006)};
+static const BNU_CHUNK_T tpmSM2_p256_p_x8[] = {LL(0xFFFFFFF8,0xFFFFFFFF),LL(0x00000007,0xFFFFFFF8),LL(0xFFFFFFFF,0xFFFFFFFF),LL(0xFFFFFFFF,0xFFFFFFF7),L_(0x00000007)};
+static const BNU_CHUNK_T tpmSM2_p256_p_x9[] = {LL(0xFFFFFFF7,0xFFFFFFFF),LL(0x00000008,0xFFFFFFF7),LL(0xFFFFFFFF,0xFFFFFFFF),LL(0xFFFFFFFF,0xFFFFFFF6),L_(0x00000008)};
+static const BNU_CHUNK_T tpmSM2_p256_p_xA[] = {LL(0xFFFFFFF6,0xFFFFFFFF),LL(0x00000009,0xFFFFFFF6),LL(0xFFFFFFFF,0xFFFFFFFF),LL(0xFFFFFFFF,0xFFFFFFF5),L_(0x00000009)};
+static const BNU_CHUNK_T tpmSM2_p256_p_xB[] = {LL(0xFFFFFFF5,0xFFFFFFFF),LL(0x0000000A,0xFFFFFFF5),LL(0xFFFFFFFF,0xFFFFFFFF),LL(0xFFFFFFFF,0xFFFFFFF4),L_(0x0000000A)};
+static const BNU_CHUNK_T tpmSM2_p256_p_xC[] = {LL(0xFFFFFFF4,0xFFFFFFFF),LL(0x0000000B,0xFFFFFFF4),LL(0xFFFFFFFF,0xFFFFFFFF),LL(0xFFFFFFFF,0xFFFFFFF3),L_(0x0000000B)};
+static const BNU_CHUNK_T tpmSM2_p256_p_xD[] = {LL(0xFFFFFFF3,0xFFFFFFFF),LL(0x0000000C,0xFFFFFFF3),LL(0xFFFFFFFF,0xFFFFFFFF),LL(0xFFFFFFFF,0xFFFFFFF2),L_(0x0000000C)};
+static const BNU_CHUNK_T tpmSM2_p256_p_xE[] = {LL(0xFFFFFFF2,0xFFFFFFFF),LL(0x0000000D,0xFFFFFFF2),LL(0xFFFFFFFF,0xFFFFFFFF),LL(0xFFFFFFFF,0xFFFFFFF1),L_(0x0000000D)};
+static const BNU_CHUNK_T tpmSM2_p256_p_xF[] = {LL(0xFFFFFFF1,0xFFFFFFFF),LL(0x0000000E,0xFFFFFFF1),LL(0xFFFFFFFF,0xFFFFFFFF),LL(0xFFFFFFFF,0xFFFFFFF0),L_(0x0000000E)};
+static const BNU_CHUNK_T tpmSM2_p256_p_x10[]= {LL(0xFFFFFFF0,0xFFFFFFFF),LL(0x0000000F,0xFFFFFFF0),LL(0xFFFFFFFF,0xFFFFFFFF),LL(0xFFFFFFFF,0xFFFFFFEF),L_(0x0000000F)};
#define SM2_MAX_MUL (16)
-const Ipp32u* tpmSM2_p256_p_mx[SM2_MAX_MUL] = {
+const BNU_CHUNK_T* tpmSM2_p256_p_mx[SM2_MAX_MUL] = {
tpmSM2_p256_p_x1, /* x1*tpmSM2_p256_p */
tpmSM2_p256_p_x2, /* x2*tpmSM2_p256_p */
tpmSM2_p256_p_x3, /* x3*tpmSM2_p256_p */
@@ -461,5 +450,6 @@ const Ipp32u* tpmSM2_p256_p_mx[SM2_MAX_MUL] = {
tpmSM2_p256_p_xF, /* xF*tpmSM2_p256_p */
tpmSM2_p256_p_x10 /*x10*tpmSM2_p256_p */
};
+#endif
#endif /* _IPP_DATA */
diff --git a/ext/ipp/sources/ippcp/src/pcpeccpverifydsaca.c b/ext/ipp/sources/ippcp/src/pcpeccpverifydsaca.c
index 9e17318..310820b 100644
--- a/ext/ipp/sources/ippcp/src/pcpeccpverifydsaca.c
+++ b/ext/ipp/sources/ippcp/src/pcpeccpverifydsaca.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2003-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,24 +14,19 @@
# limitations under the License.
############################################################################*/
-/*
-//
+/*
// Purpose:
// Cryptography Primitive.
// EC over Prime Finite Field (Verify Signature, DSA version)
-//
+//
// Contents:
// ippsECCPVerifyDSA()
-//
-//
+//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
#include "pcpeccp.h"
-#include "pcpeccppoint.h"
-#include "pcpeccpmethod.h"
-#include "pcpeccpmethodcom.h"
/*F*
@@ -69,105 +64,110 @@
IPPFUN(IppStatus, ippsECCPVerifyDSA,(const IppsBigNumState* pMsgDigest,
const IppsBigNumState* pSignX, const IppsBigNumState* pSignY,
IppECResult* pResult,
- IppsECCPState* pECC))
+ IppsECCPState* pEC))
{
- IppsMontState* rMont;
-
- /* test pECC */
- IPP_BAD_PTR1_RET(pECC);
/* use aligned EC context */
- pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) );
- IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr);
+ IPP_BAD_PTR1_RET(pEC);
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+ IPP_BADARG_RET(!ECP_TEST_ID(pEC), ippStsContextMatchErr);
/* test message representative */
IPP_BAD_PTR1_RET(pMsgDigest);
- pMsgDigest = (IppsBigNumState*)( IPP_ALIGNED_PTR(pMsgDigest, ALIGN_VAL) );
+ pMsgDigest = (IppsBigNumState*)( IPP_ALIGNED_PTR(pMsgDigest, BN_ALIGNMENT) );
IPP_BADARG_RET(!BN_VALID_ID(pMsgDigest), ippStsContextMatchErr);
- rMont = ECP_RMONT(pECC);
- IPP_BADARG_RET((0<=cpBN_cmp(pMsgDigest, ECP_ORDER(pECC))), ippStsMessageErr);
+ IPP_BADARG_RET(BN_NEGATIVE(pMsgDigest), ippStsMessageErr);
/* test result */
IPP_BAD_PTR1_RET(pResult);
/* test signature */
IPP_BAD_PTR2_RET(pSignX,pSignY);
- pSignX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignX, ALIGN_VAL) );
- pSignY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignY, ALIGN_VAL) );
+ pSignX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignX, BN_ALIGNMENT) );
+ pSignY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignY, BN_ALIGNMENT) );
IPP_BADARG_RET(!BN_VALID_ID(pSignX), ippStsContextMatchErr);
IPP_BADARG_RET(!BN_VALID_ID(pSignY), ippStsContextMatchErr);
+ IPP_BADARG_RET(BN_NEGATIVE(pSignX), ippStsRangeErr);
+ IPP_BADARG_RET(BN_NEGATIVE(pSignY), ippStsRangeErr);
- /* test signature value */
- if( (0>cpBN_tst(pSignX)) || (0>cpBN_tst(pSignY)) ||
- (0<=cpBN_cmp(pSignX, ECP_ORDER(pECC))) ||
- (0<=cpBN_cmp(pSignY, ECP_ORDER(pECC))) ) {
- *pResult = ippECInvalidSignature;
- return ippStsNoErr;
- }
+ {
+ IppECResult vResult = ippECInvalidSignature;
- /* validate signature */
- else {
- IppsECCPPointState P1;
-
- BigNumNode* pList = ECP_BNCTX(pECC);
- IppsBigNumState* pH1 = cpBigNumListGet(&pList);
- IppsBigNumState* pH2 = cpBigNumListGet(&pList);
- IppsBigNumState* pOrder = cpBigNumListGet(&pList);
- BN_Set(MNT_MODULUS(rMont), MNT_SIZE(rMont), pOrder);
-
- ECP_POINT_X(&P1) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&P1) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&P1) = cpBigNumListGet(&pList);
-
- PMA_inv(pH1, (IppsBigNumState*)pSignY, pOrder);/* h = 1/signY (mod order) */
- PMA_enc(pH1, pH1, rMont);
- PMA_mule(pH2, (IppsBigNumState*)pSignX, pH1, rMont); /* h2 = pSignX * h (mod order) */
- PMA_mule(pH1, (IppsBigNumState*)pMsgDigest, pH1, rMont); /* h1 = pMsgDigest * h (mod order) */
-#if 0
- /* compute h1*BasePoint + h2*publicKey */
- if(ippEC_TPM_SM2_P256 == ECP_TYPE(pECC)) {
- IppsECCPPointState P0;
- ECP_POINT_X(&P0) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&P0) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&P0) = cpBigNumListGet(&pList);
- ECP_METHOD(pECC)->MulBasePoint(pH1, &P0, pECC, pList);
- ECP_METHOD(pECC)->MulPoint(ECP_PUBLIC(pECC), pH2, &P1, pECC, pList);
- ECP_METHOD(pECC)->AddPoint(&P1, &P0, &P1, pECC, pList);
- }
- else
- ECP_METHOD(pECC)->ProdPoint(ECP_GENC(pECC), pH1,
- ECP_PUBLIC(pECC), pH2,
- &P1, pECC, pList);
-#endif
- /* compute h1*BasePoint + h2*publicKey */
- if((IppECCPStd128r1 == ECP_TYPE(pECC)) || (IppECCPStd128r2 == ECP_TYPE(pECC))
- ||(IppECCPStd192r1 == ECP_TYPE(pECC))
- ||(IppECCPStd224r1 == ECP_TYPE(pECC))
- ||(IppECCPStd256r1 == ECP_TYPE(pECC))
- ||(IppECCPStd384r1 == ECP_TYPE(pECC))
- ||(IppECCPStd521r1 == ECP_TYPE(pECC))
- ||(IppECCPStdSM2 == ECP_TYPE(pECC))) {
- IppsECCPPointState P0;
- ECP_POINT_X(&P0) = cpBigNumListGet(&pList);
- ECP_POINT_Y(&P0) = cpBigNumListGet(&pList);
- ECP_POINT_Z(&P0) = cpBigNumListGet(&pList);
- ECP_METHOD(pECC)->MulBasePoint(pH1, &P0, pECC, pList);
- ECP_METHOD(pECC)->MulPoint(ECP_PUBLIC(pECC), pH2, &P1, pECC, pList);
- ECP_METHOD(pECC)->AddPoint(&P1, &P0, &P1, pECC, pList);
- }
- else
- ECP_METHOD(pECC)->ProdPoint(ECP_GENC(pECC), pH1,
- ECP_PUBLIC(pECC), pH2,
- &P1, pECC, pList);
-
- if( ECCP_IsPointAtInfinity(&P1) ) {
- *pResult = ippECInvalidSignature;
- return ippStsNoErr;
+ IppsMontState* pMontR = ECP_MONT_R(pEC);
+ BNU_CHUNK_T* pOrder = MNT_MODULUS(pMontR);
+ int orderLen = MNT_SIZE(pMontR);
+
+ /* test input message value */
+ IPP_BADARG_RET(0<=cpCmp_BNU(BN_NUMBER(pMsgDigest), BN_SIZE(pMsgDigest), pOrder, orderLen), ippStsMessageErr);
+
+ /* test signature value */
+ if(!cpEqu_BNU_CHUNK(BN_NUMBER(pSignX), BN_SIZE(pSignX), 0) &&
+ !cpEqu_BNU_CHUNK(BN_NUMBER(pSignY), BN_SIZE(pSignY), 0) &&
+ 0>cpCmp_BNU(BN_NUMBER(pSignX), BN_SIZE(pSignX), pOrder, orderLen) &&
+ 0>cpCmp_BNU(BN_NUMBER(pSignY), BN_SIZE(pSignY), pOrder, orderLen)) {
+
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ int elmLen = GFP_FELEN(pGF);
+ int pelmLen = GFP_PELEN(pGF);
+ BNU_CHUNK_T* h1 = cpGFpGetPool(2, pGF);
+ BNU_CHUNK_T* h2 = h1+pelmLen;
+
+ IppsGFpECPoint P, G, Public;
+
+ /* Y = 1/signY mod order */
+ __ALIGN8 IppsBigNumState Y;
+ __ALIGN8 IppsBigNumState R;
+ BNU_CHUNK_T* buffer = ECP_SBUFFER(pEC);
+ BN_Make(buffer, buffer+orderLen+1, orderLen, &Y);
+ BN_Make(buffer+(orderLen+1)*2, buffer+(orderLen+1)*3, orderLen, &R);
+ /* BN(order) */
+ BN_Set(pOrder, orderLen, &R);
+ ippsModInv_BN((IppsBigNumState*)pSignY, &R, &Y);
+ /* h1 = 1/signY mod order */
+ cpGFpElementCopyPadd(h1, orderLen, BN_NUMBER(&Y), BN_SIZE(&Y));
+ cpMontEnc_BNU(h1, h1, orderLen, pMontR);
+
+ /* validate signature */
+ cpEcGFpInitPoint(&P, cpEcGFpGetPool(1, pEC),0, pEC);
+ cpEcGFpInitPoint(&G, ECP_G(pEC), ECP_AFFINE_POINT|ECP_FINITE_POINT, pEC);
+ cpEcGFpInitPoint(&Public, ECP_PUBLIC(pEC), ECP_FINITE_POINT, pEC);
+
+ /* h2 = pSignX * h1 (mod order) */
+ cpMontMul_BNU(h2,
+ h1,orderLen, BN_NUMBER(pSignX), BN_SIZE(pSignX),
+ pOrder,orderLen,
+ MNT_HELPER(pMontR), MNT_PRODUCT(pMontR), NULL);
+ /* h1 = pMsgDigest * h1 (mod order) */
+ cpMontMul_BNU(h1,
+ h1,orderLen, BN_NUMBER(pMsgDigest), BN_SIZE(pMsgDigest),
+ pOrder,orderLen,
+ MNT_HELPER(pMontR), MNT_PRODUCT(pMontR), NULL);
+
+ /* compute h1*BasePoint + h2*publicKey */
+ //gfec_PointProduct(&P,
+ // &G, h1, orderLen, &Public, h2, orderLen,
+ // pEC, (Ipp8u*)ECP_SBUFFER(pEC));
+ gfec_BasePointProduct(&P,
+ h1, orderLen, &Public, h2, orderLen,
+ pEC, (Ipp8u*)ECP_SBUFFER(pEC));
+
+ /* get P.X */
+ if(gfec_GetPoint(h1, NULL, &P, pEC)) {
+ /* C' = int(P.x) mod order */
+ pGF->decode(h1, h1, pGF);
+ elmLen = cpMod_BNU(h1, elmLen, pOrder, orderLen);
+ cpGFpElementPadd(h1+elmLen, orderLen-elmLen, 0);
+
+ /* and make sure signX==P.X */
+ cpGFpElementCopyPadd(h2, orderLen, BN_NUMBER(pSignX), BN_SIZE(pSignX));
+ if(GFP_EQ(h1, h2, orderLen))
+ vResult = ippECValid;
+ }
+
+ cpEcGFpReleasePool(1, pEC);
+ cpGFpReleasePool(2, pGF);
}
- /* extract X component */
- ECP_METHOD(pECC)->GetPointAffine(pH1, NULL, &P1, pECC, pList);
- /* compare with signX */
- PMA_mod(pH1, pH1, pOrder);
- *pResult = (0==cpBN_cmp(pH1, pSignX))? ippECValid : ippECInvalidSignature;
+
+ *pResult = vResult;
return ippStsNoErr;
}
}
diff --git a/ext/ipp/sources/ippcpepid/src/pcpgfp.c b/ext/ipp/sources/ippcp/src/pcpgfp.c
index d764dae..5a42076 100644
--- a/ext/ipp/sources/ippcpepid/src/pcpgfp.c
+++ b/ext/ipp/sources/ippcp/src/pcpgfp.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2010-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -57,14 +57,37 @@
//
//
*/
-
-#include "owncpepid.h"
+#include "owndefs.h"
+#include "owncp.h"
#include "pcpgfpstuff.h"
#include "pcpgfpxstuff.h"
-#include "pcpgfphashstuff.h"
+#include "pcphash.h"
+
+
+int cpGFpGetSize(int bitSize)
+{
+ int ctxSize = 0;
+ int elemLen = BITS_BNU_CHUNK(bitSize);
+ int poolelemLen = elemLen + 1;
+ int montgomeryCtxSize;
+ int elemLen32 = BITS2WORD32_SIZE(bitSize);
+ ippsMontGetSize(ippBinaryMethod, elemLen32, &montgomeryCtxSize);
+ montgomeryCtxSize -= MONT_ALIGNMENT-1;
+
+ ctxSize = sizeof(IppsGFpState) /* sizeof(IppsGFPState)*/
+ +elemLen*sizeof(BNU_CHUNK_T) /* modulus */
+ +elemLen*sizeof(BNU_CHUNK_T) /* half of modulus */
+ +elemLen*sizeof(BNU_CHUNK_T) /* quadratic non-residue */
+ +montgomeryCtxSize /* montgomery engine */
+ +CACHE_LINE_SIZE /* pool padding */
+ +poolelemLen*sizeof(BNU_CHUNK_T)*GF_POOL_SIZE; /* pool */
+ return ctxSize;
+}
+
+#if 0
IPPFUN(IppStatus, ippsGFpGetSize,(int bitSize, int* pSizeInBytes))
{
IPP_BAD_PTR1_RET(pSizeInBytes);
@@ -83,14 +106,25 @@ IPPFUN(IppStatus, ippsGFpGetSize,(int bitSize, int* pSizeInBytes))
+elemLen*sizeof(BNU_CHUNK_T) /* half of modulus */
+elemLen*sizeof(BNU_CHUNK_T) /* quadratic non-residue */
+montgomeryCtxSize /* montgomery engine */
+ +CACHE_LINE_SIZE-1 /* pool padding */
+poolelemLen*sizeof(BNU_CHUNK_T)*GF_POOL_SIZE /* pool */
- +CACHE_LINE_SIZE
- +GFP_ALIGNMENT-1;
+ +GFP_ALIGNMENT-1; /* context padding */
return ippStsNoErr;
}
}
+#endif
+IPPFUN(IppStatus, ippsGFpGetSize,(int bitSize, int* pSizeInBytes))
+{
+ IPP_BAD_PTR1_RET(pSizeInBytes);
+ IPP_BADARG_RET((bitSize < 2) || (bitSize > GF_MAX_BITSIZE), ippStsSizeErr);
+ *pSizeInBytes = cpGFpGetSize(bitSize)
+ +GFP_ALIGNMENT;
+ return ippStsNoErr;
+}
+
+#if 0
static void gfpInitSqrt(IppsGFpState* pGF)
{
int elemLen = GFP_FELEN(pGF);
@@ -114,10 +148,17 @@ static void gfpInitSqrt(IppsGFpState* pGF)
cpGFpReleasePool(3, pGF);
}
-IPPFUN(IppStatus, ippsGFpInit,(const Ipp32u* pPrime, int primeBitSize, IppsGFpState* pGF))
+IPPFUN(IppStatus, ippsGFpInit,(const IppsBigNumState* pPrime, int primeBitSize, const IppsGFpMethod* method, IppsGFpState* pGF))
{
- IPP_BAD_PTR2_RET(pPrime, pGF);
- IPP_BADARG_RET((primeBitSize< 2 ) || (primeBitSize> GF_MAX_BITSIZE), ippStsSizeErr);
+ IPP_BAD_PTR3_RET(pPrime, method, pGF);
+ IPP_BADARG_RET((primeBitSize< IPP_MIN_GF_BITSIZE) || (primeBitSize> IPP_MAX_GF_BITSIZE), ippStsSizeErr);
+
+ pPrime = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrime, BN_ALIGNMENT) );
+ IPP_BADARG_RET(!BN_VALID_ID(pPrime), ippStsContextMatchErr);
+ IPP_BADARG_RET(BN_SIGN(pPrime)!= IppsBigNumPOS, ippStsBadArgErr);
+ IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pPrime),BN_SIZE(pPrime)) != primeBitSize, ippStsBadArgErr);
+ IPP_BADARG_RET((BN_SIZE(pPrime)==1) && (BN_NUMBER(pPrime)[0]<IPP_MIN_GF_CHAR), ippStsBadArgErr);
+
pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
{
@@ -131,38 +172,24 @@ IPPFUN(IppStatus, ippsGFpInit,(const Ipp32u* pPrime, int primeBitSize, IppsGFpSt
GFP_ID(pGF) = idCtxGFP;
GFP_DEGREE(pGF) = 1;
+ GFP_FEBITLEN(pGF)= primeBitSize;
GFP_FELEN(pGF) = elemLen;
GFP_FELEN32(pGF) = elemLen32;
GFP_PELEN(pGF) = poolelemLen;
FIELD_POLY_TYPE(pGF) = ARBITRARY;
-
- #if(_IPP_ARCH==_IPP_ARCH_EM64T)
- /* 192 < primeBitSize <= 256 is considered as Intel(R) EPID param */
- EPID_PARAMS(pGF) = elemLen==4;
- #else
- EPID_PARAMS(pGF) = 0;
- #endif
-
GFP_GROUNDGF(pGF)= pGF;
- /* methods */
- pGF->add = cpGFpAdd;
- pGF->sub = cpGFpSub;
- pGF->neg = cpGFpNeg;
- pGF->mul = cpGFpMul;
- pGF->sqr = cpGFpSqr;
- pGF->div2= cpGFpHalve;
-
- #if(_IPP32E >= _IPP32E_M7)
- if(EPID_PARAMS(pGF)) {
- pGF->add = cp256pAdd;
- pGF->sub = cp256pSub;
- pGF->neg = cp256pNeg;
- pGF->mul = cp256pMul;
- pGF->sqr = cp256pSqr;
- pGF->div2= cp256pHalve;
- }
- #endif
+ /* set up methods */
+ pGF->add = method->add;
+ pGF->sub = method->sub;
+ pGF->neg = method->neg;
+ pGF->div2= method->div2;
+ pGF->mul2= method->mul2;
+ pGF->mul3= method->mul3;
+ pGF->mul = method->mul;
+ pGF->sqr = method->sqr;
+ pGF->encode = method->encode;
+ pGF->decode = method->decode;
ptr += sizeof(IppsGFpState);
GFP_MODULUS(pGF) = (BNU_CHUNK_T*)(ptr); ptr += elemLen*sizeof(BNU_CHUNK_T);
@@ -172,11 +199,11 @@ IPPFUN(IppStatus, ippsGFpInit,(const Ipp32u* pPrime, int primeBitSize, IppsGFpSt
GFP_POOL(pGF) = (BNU_CHUNK_T*)(IPP_ALIGNED_PTR(ptr, (int)sizeof(BNU_CHUNK_T)));
ippsMontInit(ippBinaryMethod, elemLen32, GFP_MONT(pGF));
- ippsMontSet(pPrime, elemLen32, GFP_MONT(pGF));
+ ippsMontSet((Ipp32u*)BN_NUMBER(pPrime), elemLen32, GFP_MONT(pGF));
/* modulus */
cpGFpElementPadd(GFP_MODULUS(pGF), elemLen, 0);
- COPY_BNU((Ipp32u*)GFP_MODULUS(pGF), pPrime, elemLen32);
+ COPY_BNU((Ipp32u*)GFP_MODULUS(pGF), (Ipp32u*)BN_NUMBER(pPrime), elemLen32);
/* half of modulus */
cpGFpElementPadd(GFP_HMODULUS(pGF), elemLen, 0);
cpLSR_BNU(GFP_HMODULUS(pGF), GFP_MODULUS(pGF), elemLen, 1);
@@ -188,122 +215,151 @@ IPPFUN(IppStatus, ippsGFpInit,(const Ipp32u* pPrime, int primeBitSize, IppsGFpSt
return ippStsNoErr;
}
}
-
-
-IPPFUN(IppStatus, ippsGFpScratchBufferSize,(int nExponents, int ExpBitSize, const IppsGFpState* pGF, int* pBufferSize))
+#endif
+//#if 0
+IppStatus cpGFpInitGFp(int primeBitSize, IppsGFpState* pGF)
{
- IPP_BAD_PTR2_RET(pGF, pBufferSize);
+ IPP_BADARG_RET((primeBitSize< IPP_MIN_GF_BITSIZE) || (primeBitSize> IPP_MAX_GF_BITSIZE), ippStsSizeErr);
+ IPP_BAD_PTR1_RET(pGF);
pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
- IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
-
- IPP_BADARG_RET( (0>=nExponents)||(nExponents>LOG2_CACHE_LINE_SIZE), ippStsBadArgErr);
{
- int elmDataSize = GFP_FELEN(pGF)*sizeof(BNU_CHUNK_T);
+ Ipp8u* ptr = (Ipp8u*)pGF;
- /* get window_size */
- int w = (nExponents==1)? cpGFpGetOptimalWinSize(ExpBitSize) : /* use optimal window size, if single-scalar operation */
- nExponents; /* or pseudo-oprimal if multi-scalar operation */
+ int elemLen32 = BITS2WORD32_SIZE(primeBitSize);
+ int elemLen = BITS_BNU_CHUNK(primeBitSize);
+ int poolelemLen = elemLen + 1;
+ int montgomeryCtxSize;
+ ippsMontGetSize(ippBinaryMethod, elemLen32, &montgomeryCtxSize);
- /* number of table entries */
- int nPrecomputed = 1<<w;
+ GFP_ID(pGF) = idCtxGFP;
+ GFP_FEBITLEN(pGF)= primeBitSize;
+ GFP_FELEN(pGF) = elemLen;
+ GFP_FELEN32(pGF) = elemLen32;
+ GFP_PELEN(pGF) = poolelemLen;
+ GFP_DEGREE(pGF) = 1;
+ FIELD_POLY_TYPE(pGF) = ARBITRARY;
+ GFP_GROUNDGF(pGF)= pGF;
- *pBufferSize = elmDataSize*nPrecomputed + (CACHE_LINE_SIZE-1);
+ ptr += sizeof(IppsGFpState);
+ GFP_MODULUS(pGF) = (BNU_CHUNK_T*)(ptr); ptr += elemLen*sizeof(BNU_CHUNK_T);
+ GFP_HMODULUS(pGF) = (BNU_CHUNK_T*)(ptr); ptr += elemLen*sizeof(BNU_CHUNK_T);
+ GFP_QNR(pGF) = (BNU_CHUNK_T*)(ptr); ptr += elemLen*sizeof(BNU_CHUNK_T);
+ GFP_MONT(pGF) = (IppsMontState*)( IPP_ALIGNED_PTR((ptr), (MONT_ALIGNMENT)) ); ptr += montgomeryCtxSize;
+ GFP_POOL(pGF) = (BNU_CHUNK_T*)(IPP_ALIGNED_PTR(ptr, (int)sizeof(BNU_CHUNK_T)));
+
+ cpGFpElementPadd(GFP_MODULUS(pGF), elemLen, 0);
+ cpGFpElementPadd(GFP_HMODULUS(pGF), elemLen, 0);
+ cpGFpElementPadd(GFP_QNR(pGF), elemLen, 0);
+
+ ippsMontInit(ippBinaryMethod, elemLen32, GFP_MONT(pGF));
return ippStsNoErr;
}
}
-#if 0
-IPPFUN(IppStatus, ippsBasicGFpRef,(const IppsGFpState* pGF, IppsGFpState** ppBasicGF))
+IppStatus cpGFpSetGFp(const IppsBigNumState* pPrime, const IppsGFpMethod* method, IppsGFpState* pGF)
{
- IPP_BAD_PTR2_RET(pGF, ppBasicGF);
+ IPP_BAD_PTR3_RET(pPrime, method, pGF);
pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
- IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
- *ppBasicGF = cpGFpBasic(pGF);
- return ippStsNoErr;
-}
-#endif
+ pPrime = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrime, BN_ALIGNMENT) );
+ IPP_BADARG_RET(!BN_VALID_ID(pPrime), ippStsContextMatchErr);
+ IPP_BADARG_RET(BN_SIGN(pPrime)!= IppsBigNumPOS, ippStsBadArgErr);
+ IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pPrime),BN_SIZE(pPrime)) != GFP_FEBITLEN(pGF), ippStsBadArgErr);
+ IPP_BADARG_RET((BN_SIZE(pPrime)==1) && (BN_NUMBER(pPrime)[0]<IPP_MIN_GF_CHAR), ippStsBadArgErr);
-#if 0
-IPPFUN(IppStatus, ippsGroundGFpRef,(const IppsGFpState* pGF, IppsGFpState** ppGroundGF))
-{
- IPP_BAD_PTR2_RET(pGF, ppGroundGF);
- pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
- IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
+ {
+ int elemLen = GFP_FELEN(pGF);
+ int elemLen32 = GFP_FELEN32(pGF);
- *ppGroundGF = GFP_GROUNDGF(pGF);
- return ippStsNoErr;
+ /* set up methods */
+ pGF->add = method->add;
+ pGF->sub = method->sub;
+ pGF->neg = method->neg;
+ pGF->div2= method->div2;
+ pGF->mul2= method->mul2;
+ pGF->mul3= method->mul3;
+ pGF->mul = method->mul;
+ pGF->sqr = method->sqr;
+ pGF->encode = method->encode;
+ pGF->decode = method->decode;
+
+ /* modulus */
+ COPY_BNU((Ipp32u*)GFP_MODULUS(pGF), (Ipp32u*)BN_NUMBER(pPrime), elemLen32);
+ /* half of modulus */
+ cpLSR_BNU(GFP_HMODULUS(pGF), GFP_MODULUS(pGF), elemLen, 1);
+
+ /* set up mont engine */
+ ippsMontSet((Ipp32u*)BN_NUMBER(pPrime), elemLen32, GFP_MONT(pGF));
+
+ return ippStsNoErr;
+ }
}
-#endif
-#if 0
-IPPFUN(IppStatus, ippsGFpGetDegree,(const IppsGFpState* pGF, int* pDegree))
+static void gfpInitSqrt(IppsGFpState* pGF)
{
- IPP_BAD_PTR2_RET(pGF, pDegree);
- pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
- IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
+ int elemLen = GFP_FELEN(pGF);
+ BNU_CHUNK_T* e = cpGFpGetPool(1, pGF);
+ BNU_CHUNK_T* t = cpGFpGetPool(1, pGF);
+ BNU_CHUNK_T* pMont1 = cpGFpGetPool(1, pGF);
- *pDegree = GFP_DEGREE(pGF);
- return ippStsNoErr;
+ cpGFpElementCopyPadd(pMont1, elemLen, MNT_1(GFP_MONT(pGF)), elemLen);
+
+ /* (modulus-1)/2 */
+ cpLSR_BNU(e, GFP_MODULUS(pGF), elemLen, 1);
+
+ /* find a non-square g, where g^{(modulus-1)/2} = -1 */
+ cpGFpElementCopy(GFP_QNR(pGF), pMont1, elemLen);
+ do {
+ cpGFpAdd(GFP_QNR(pGF), pMont1, GFP_QNR(pGF), pGF);
+ cpGFpExp(t, GFP_QNR(pGF), e, elemLen, pGF);
+ cpGFpNeg(t, t, pGF);
+ } while( !GFP_EQ(pMont1, t, elemLen) );
+
+ cpGFpReleasePool(3, pGF);
}
-#endif
-#if 0
-IPPFUN(IppStatus, ippsGFpGetElementLen,(const IppsGFpState* pGF, int* pElmLen))
+IPPFUN(IppStatus, ippsGFpInit,(const IppsBigNumState* pPrime, int primeBitSize, const IppsGFpMethod* method, IppsGFpState* pGF))
{
- IPP_BAD_PTR2_RET(pGF, pElmLen);
- pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
- IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
-
- *pElmLen = GFP_FELEN32(pGF);
- return ippStsNoErr;
+ IppStatus sts;
+ do {
+ sts = cpGFpInitGFp(primeBitSize, pGF);
+ if(ippStsNoErr!=sts) break;
+ sts = cpGFpSetGFp(pPrime, method, pGF);
+ if(ippStsNoErr!=sts) break;
+ /* do some additional initialization to make sqrt operation faster */
+ gfpInitSqrt(pGF);
+ } while(0);
+ return sts;
}
-#endif
+//#endif
-IPPFUN(IppStatus, ippsGFpGetModulus,(const IppsGFpState* pGF, Ipp32u* pModulus))
+IPPFUN(IppStatus, ippsGFpScratchBufferSize,(int nExponents, int ExpBitSize, const IppsGFpState* pGF, int* pBufferSize))
{
- IPP_BAD_PTR2_RET(pGF, pModulus);
+ IPP_BAD_PTR2_RET(pGF, pBufferSize);
pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
- if( GFP_IS_BASIC(pGF) ) {
- cpGFpxCopyFromChunk(pModulus, GFP_MODULUS(pGF), pGF);
- }
- else {
- int elemLen32 = GFP_FELEN32(pGF);
- int elemLen = GFP_FELEN(pGF);
- BNU_CHUNK_T* pTmp = cpGFpGetPool(1, (IppsGFpState*)pGF);
+ IPP_BADARG_RET( 0>=nExponents ||nExponents>IPP_MAX_EXPONENT_NUM, ippStsBadArgErr);
+ IPP_BADARG_RET( 0>=ExpBitSize, ippStsBadArgErr);
- cpGFpxGet(pTmp, elemLen, GFP_MODULUS(pGF), (IppsGFpState*)pGF, USE_MONT_SPACE_REPRESENTATION);
- cpGFpxCopyFromChunk(pModulus, pTmp, pGF);
- pModulus[elemLen32] = 1;
+ {
+ int elmDataSize = GFP_FELEN(pGF)*sizeof(BNU_CHUNK_T);
- cpGFpReleasePool(1, (IppsGFpState*)pGF);
- }
- return ippStsNoErr;
-}
+ /* get window_size */
+ int w = (nExponents==1)? cpGFpGetOptimalWinSize(ExpBitSize) : /* use optimal window size, if single-scalar operation */
+ nExponents; /* or pseudo-oprimal if multi-scalar operation */
-#if 0
-IPPFUN(IppStatus, ippsGFpCmp, (const IppsGFpState* pGFp1, const IppsGFpState* pGFp2, IppGFpResult* pCmpResult))
-{
- IPP_BAD_PTR3_RET(pGFp1, pGFp2, pCmpResult);
- pGFp1 = (IppsGFpState*)( IPP_ALIGNED_PTR(pGFp1, GFP_ALIGNMENT) );
- pGFp2 = (IppsGFpState*)( IPP_ALIGNED_PTR(pGFp2, GFP_ALIGNMENT) );
- IPP_BADARG_RET( !GFP_TEST_ID(pGFp1), ippStsContextMatchErr);
- IPP_BADARG_RET( !GFP_TEST_ID(pGFp2), ippStsContextMatchErr);
+ /* number of table entries */
+ int nPrecomputed = 1<<w;
- if(pGFp1 != pGFp2) {
- int flag = cpGFpxCompare(pGFp1, pGFp2);
- *pCmpResult = 0==flag? ippGFpEQ : 1==flag? ippGFpNE : ippGFpNA;
+ *pBufferSize = elmDataSize*nPrecomputed + (CACHE_LINE_SIZE-1);
+
+ return ippStsNoErr;
}
- else
- *pCmpResult = ippGFpEQ;
- return ippStsNoErr;
}
-#endif
IPPFUN(IppStatus, ippsGFpElementGetSize,(const IppsGFpState* pGF, int* pElementSize))
{
@@ -316,6 +372,7 @@ IPPFUN(IppStatus, ippsGFpElementGetSize,(const IppsGFpState* pGF, int* pElementS
return ippStsNoErr;
}
+
IPPFUN(IppStatus, ippsGFpElementInit,(const Ipp32u* pA, int nsA, IppsGFpElement* pR, IppsGFpState* pGF))
{
IPP_BAD_PTR2_RET(pR, pGF);
@@ -328,12 +385,8 @@ IPPFUN(IppStatus, ippsGFpElementInit,(const Ipp32u* pA, int nsA, IppsGFpElement*
int elemLen = GFP_FELEN(pGF);
Ipp8u* ptr = (Ipp8u*)pR;
-
- GFPE_ID(pR) = idCtxGFPE;
- GFPE_ROOM(pR) = elemLen;
ptr += sizeof(IppsGFpElement);
- GFPE_DATA(pR) = (BNU_CHUNK_T*)ptr;
-
+ cpGFpElementConstruct(pR, (BNU_CHUNK_T*)ptr, elemLen);
return ippsGFpSetElement(pA, nsA, pR, pGF);
}
}
@@ -345,23 +398,27 @@ IPPFUN(IppStatus, ippsGFpSetElement,(const Ipp32u* pDataA, int nsA, IppsGFpEleme
IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElm), ippStsContextMatchErr );
- IPP_BADARG_RET( (pDataA && (nsA<0)), ippStsSizeErr );
+ IPP_BADARG_RET( !pDataA && (0<nsA), ippStsNullPtrErr);
+ IPP_BADARG_RET( pDataA && !(0<=nsA && nsA<=GFP_FELEN32(pGF)), ippStsSizeErr );
+///IPP_BADARG_RET( pDataA && !(0<nsA && BITS2WORD32_SIZE(BITSIZE_BNU32(pDataA,nsA))<=GFP_FEBITLEN(pGF)), ippStsSizeErr );
+
+ IPP_BADARG_RET( GFPE_ROOM(pElm)!=GFP_FELEN(pGF), ippStsOutOfRangeErr);
{
IppStatus sts = ippStsNoErr;
- int elemLen32 = GFP_FELEN32(pGF);
- if(pDataA) FIX_BNU(pDataA, nsA);
- if(pDataA && (nsA>elemLen32)) IPP_ERROR_RET(ippStsOutOfRangeErr);
+ ///int elemLen32 = GFP_FELEN32(pGF);
+ ///if(pDataA) FIX_BNU(pDataA, nsA);
+ ///if(pDataA && (nsA>elemLen32)) IPP_ERROR_RET(ippStsOutOfRangeErr);
{
BNU_CHUNK_T* pTmp = cpGFpGetPool(1, pGF);
int elemLen = GFP_FELEN(pGF);
ZEXPAND_BNU(pTmp, 0, elemLen);
- if(pDataA)
+ if(pDataA && nsA)
cpGFpxCopyToChunk(pTmp, pDataA, nsA, pGF);
- if(!cpGFpxSet(GFPE_DATA(pElm), pTmp, elemLen, pGF, USE_MONT_SPACE_REPRESENTATION))
+ if(!cpGFpxSet(GFPE_DATA(pElm), pTmp, elemLen, pGF))
sts = ippStsOutOfRangeErr;
cpGFpReleasePool(1, pGF);
@@ -373,11 +430,16 @@ IPPFUN(IppStatus, ippsGFpSetElement,(const Ipp32u* pDataA, int nsA, IppsGFpEleme
IPPFUN(IppStatus, ippsGFpSetElementOctString,(const Ipp8u* pStr, int strSize, IppsGFpElement* pElm, IppsGFpState* pGF))
{
- IPP_BAD_PTR3_RET(pStr, pElm, pGF);
+ IPP_BAD_PTR2_RET(pElm, pGF);
pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElm), ippStsContextMatchErr );
+ IPP_BADARG_RET( (!pStr && 0<strSize), ippStsNullPtrErr);
+ IPP_BADARG_RET( (pStr && !(0<strSize && strSize<=(int)(GFP_FELEN32(pGF)*sizeof(Ipp32u)))), ippStsSizeErr );
+
+ IPP_BADARG_RET( GFPE_ROOM(pElm)!=GFP_FELEN(pGF), ippStsOutOfRangeErr);
+
{
IppsGFpState* pBasicGF = cpGFpBasic(pGF);
int basicDeg = cpGFpBasicDegreeExtension(pGF);
@@ -393,7 +455,7 @@ IPPFUN(IppStatus, ippsGFpSetElementOctString,(const Ipp8u* pStr, int strSize, Ip
/* convert oct string to element (from low to high) */
for(deg=0, error=0; deg<basicDeg && !error; deg++) {
int size = IPP_MIN(strSize, basicSize);
- error = NULL == cpGFpSetOctString(pDataElm, pStr, size, pBasicGF, USE_MONT_SPACE_REPRESENTATION);
+ error = NULL == cpGFpSetOctString(pDataElm, pStr, size, pBasicGF);
pDataElm += basicElemLen;
strSize -= size;
@@ -405,42 +467,18 @@ IPPFUN(IppStatus, ippsGFpSetElementOctString,(const Ipp8u* pStr, int strSize, Ip
}
-#if 0
-IPPFUN(IppStatus, ippsGFPSetElementPower2,(Ipp32u power, IppsGFPElement* pR, IppsGFPState* pGFp))
-{
- IPP_BAD_PTR2_RET(pR, pGFp);
- IPP_BADARG_RET( !GFP_TEST_ID(pGFp), ippStsContextMatchErr );
- IPP_BADARG_RET( !GFPE_TEST_ID(pR), ippStsContextMatchErr );
- IPP_BADARG_RET( (power+1) > GF_POOL_SIZE*GFP_PESIZE(pGFp)*BITSIZE(ipp32u), ippStsBadArgErr);
-
- {
- Ipp32u moduloBitSize = GFP_FESIZE32(pGFp)*BITSIZE(ipp32u) - NLZ32u(GFP_MODULUS(pGFp)[GFP_FESIZE32(pGFp)-1]);
- if(moduloBitSize>power) {
- gfpFFelementPadd(0, GFPE_DATA(pR), GFP_FELEN(pGFp));
- SET_BIT(GFPE_DATA(pR), power);
- }
- else {
- Ipp32u dataLen = BITS2WORD32_SIZE(power+1);
- Ipp32u* pData = GFP_POOL(pGFp);
- gfpFFelementPadd(0, pData, dataLen);
- SET_BIT(pData, power);
- gfpReduce(pData, dataLen, GFPE_DATA(pR), pGFp);
- }
- return ippStsNoErr;
- }
-}
-#endif
-
-
-IPPFUN(IppStatus, ippsGFpSetElementRandom,(IppBitSupplier rndFunc, void* pRndParam,
- IppsGFpElement* pElm, IppsGFpState* pGF))
+IPPFUN(IppStatus, ippsGFpSetElementRandom,(IppsGFpElement* pElm, IppsGFpState* pGF,
+ IppBitSupplier rndFunc, void* pRndParam))
{
+ IPP_BAD_PTR2_RET(rndFunc, pRndParam);
IPP_BAD_PTR2_RET(pElm, pGF);
pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElm), ippStsContextMatchErr );
- cpGFpxRand(GFPE_DATA(pElm), pGF, rndFunc, pRndParam, USE_MONT_SPACE_REPRESENTATION);
+ IPP_BADARG_RET( GFPE_ROOM(pElm)!=GFP_FELEN(pGF), ippStsOutOfRangeErr);
+
+ cpGFpxRand(GFPE_DATA(pElm), pGF, rndFunc, pRndParam);
return ippStsNoErr;
}
@@ -452,6 +490,9 @@ IPPFUN(IppStatus, ippsGFpCpyElement, (const IppsGFpElement* pElmA, IppsGFpElemen
IPP_BADARG_RET( !GFPE_TEST_ID(pElmA), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElmR), ippStsContextMatchErr );
+ IPP_BADARG_RET( (GFPE_ROOM(pElmA)!=GFP_FELEN(pGF)) || (GFPE_ROOM(pElmR)!=GFP_FELEN(pGF)), ippStsOutOfRangeErr);
+
+
cpGFpElementCopy(GFPE_DATA(pElmR), GFPE_DATA(pElmA), GFP_FELEN(pGF));
return ippStsNoErr;
}
@@ -462,13 +503,15 @@ IPPFUN(IppStatus, ippsGFpGetElement, (const IppsGFpElement* pElm, Ipp32u* pDataA
pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElm), ippStsContextMatchErr );
- IPP_BADARG_RET( 0>nsA, ippStsSizeErr );
+
+ IPP_BADARG_RET( GFPE_ROOM(pElm)!=GFP_FELEN(pGF), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( !(0<nsA && nsA>=GFP_FELEN32(pGF)), ippStsSizeErr );
{
int elemLen = GFP_FELEN(pGF);
BNU_CHUNK_T* pTmp = cpGFpGetPool(1, pGF);
- cpGFpxGet(pTmp, elemLen, GFPE_DATA(pElm), pGF, USE_MONT_SPACE_REPRESENTATION);
+ cpGFpxGet(pTmp, elemLen, GFPE_DATA(pElm), pGF);
cpGFpxCopyFromChunk(pDataA, pTmp, pGF);
cpGFpReleasePool(1, pGF);
@@ -483,6 +526,9 @@ IPPFUN(IppStatus, ippsGFpGetElementOctString,(const IppsGFpElement* pElm, Ipp8u*
IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElm), ippStsContextMatchErr );
+ IPP_BADARG_RET( GFPE_ROOM(pElm)!=GFP_FELEN(pGF), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( 0>=strSize, ippStsSizeErr );
+
{
IppsGFpState* pBasicGF = cpGFpBasic(pGF);
int basicDeg = cpGFpBasicDegreeExtension(pGF);
@@ -494,7 +540,7 @@ IPPFUN(IppStatus, ippsGFpGetElementOctString,(const IppsGFpElement* pElm, Ipp8u*
int deg;
for(deg=0; deg<basicDeg; deg++) {
int size = IPP_MIN(strSize, basicSize);
- cpGFpGetOctString(pStr, size, pDataElm, pBasicGF, USE_MONT_SPACE_REPRESENTATION);
+ cpGFpGetOctString(pStr, size, pDataElm, pBasicGF);
pDataElm += basicElemLen;
pStr += size;
@@ -515,6 +561,8 @@ IPPFUN(IppStatus, ippsGFpCmpElement,(const IppsGFpElement* pElmA, const IppsGFpE
IPP_BADARG_RET( !GFPE_TEST_ID(pElmA), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElmB), ippStsContextMatchErr );
+ IPP_BADARG_RET( (GFPE_ROOM(pElmA)!=GFP_FELEN(pGF)) || (GFPE_ROOM(pElmB)!=GFP_FELEN(pGF)), ippStsOutOfRangeErr);
+
{
int flag = cpGFpElementCmp(GFPE_DATA(pElmA), GFPE_DATA(pElmB), GFP_FELEN(pGF));
if( GFP_IS_BASIC(pGF) )
@@ -534,6 +582,8 @@ IPPFUN(IppStatus, ippsGFpIsZeroElement,(const IppsGFpElement* pElmA,
IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElmA), ippStsContextMatchErr );
+ IPP_BADARG_RET( GFPE_ROOM(pElmA)!=GFP_FELEN(pGF), ippStsOutOfRangeErr);
+
{
int flag = GFP_IS_ZERO(GFPE_DATA(pElmA), GFP_FELEN(pGF));
*pResult = (1==flag)? IPP_IS_EQ : IPP_IS_NE;
@@ -550,6 +600,8 @@ IPPFUN(IppStatus, ippsGFpIsUnityElement,(const IppsGFpElement* pElmA,
IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElmA), ippStsContextMatchErr );
+ IPP_BADARG_RET( GFPE_ROOM(pElmA)!=GFP_FELEN(pGF), ippStsOutOfRangeErr);
+
{
IppsGFpState* pBasicGF = cpGFpBasic(pGF);
int basicElmLen = GFP_FELEN(pBasicGF);
@@ -567,47 +619,18 @@ IPPFUN(IppStatus, ippsGFpIsUnityElement,(const IppsGFpElement* pElmA,
}
}
-#if 0
-IPPFUN(IppStatus, ippsGFpSetPolyTerm,(const Ipp32u* pTerm, int nsT, IppsGFpElement* pElm, int termDegree, IppsGFpState* pGF))
-{
- IPP_BAD_PTR3_RET(pTerm, pElm, pGF);
- pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
- IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
- IPP_BADARG_RET( !GFPE_TEST_ID(pElm), ippStsContextMatchErr );
- IPP_BADARG_RET( 0>nsT, ippStsSizeErr );
-
- if(termDegree>=0 && termDegree * GFP_FELEN(pGF) < GFPE_ROOM(pElm) )
- cpGFpxSetPolyTerm(GFPE_DATA(pElm), termDegree, pTerm, nsT, pGF, USE_MONT_SPACE_REPRESENTATION);
- return ippStsNoErr;
-}
-#endif
-
-#if 0
-IPPFUN(IppStatus, ippsGFpGetPolyTerm, (const IppsGFpElement* pElm, int termDegree, Ipp32u* pTerm, int nsT, IppsGFpState* pGF))
-{
- IPP_BAD_PTR3_RET(pElm, pTerm, pGF);
- pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
- IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
- IPP_BADARG_RET( !GFPE_TEST_ID(pElm), ippStsContextMatchErr );
- IPP_BADARG_RET( 0>nsT, ippStsSizeErr );
-
- cpGFpElementPadd(pTerm, nsT, 0);
- if(termDegree>=0 && termDegree * GFP_FELEN(pGF) < GFPE_ROOM(pElm) )
- cpGFpxGetPolyTerm(pTerm, nsT, GFPE_DATA(pElm), termDegree, pGF, USE_MONT_SPACE_REPRESENTATION);
- return ippStsNoErr;
-}
-#endif
-
IPPFUN(IppStatus, ippsGFpConj,(const IppsGFpElement* pElmA,
IppsGFpElement* pElmR, IppsGFpState* pGF))
{
IPP_BAD_PTR3_RET(pElmA, pElmR, pGF);
pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
- IPP_BADARG_RET( 2!=GFP_DEGREE(pGF), ippStsBadArgErr )
IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElmA), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElmR), ippStsContextMatchErr );
+ IPP_BADARG_RET( (GFPE_ROOM(pElmA)!=GFP_FELEN(pGF)) || (GFPE_ROOM(pElmR)!=GFP_FELEN(pGF)), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( 2!=GFP_DEGREE(pGF), ippStsBadArgErr )
+
cpGFpxConj(GFPE_DATA(pElmR), GFPE_DATA(pElmA), pGF);
return ippStsNoErr;
}
@@ -621,6 +644,8 @@ IPPFUN(IppStatus, ippsGFpNeg,(const IppsGFpElement* pElmA,
IPP_BADARG_RET( !GFPE_TEST_ID(pElmA), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElmR), ippStsContextMatchErr );
+ IPP_BADARG_RET( (GFPE_ROOM(pElmA)!=GFP_FELEN(pGF)) || (GFPE_ROOM(pElmR)!=GFP_FELEN(pGF)), ippStsOutOfRangeErr);
+
pGF->neg(GFPE_DATA(pElmR), GFPE_DATA(pElmA), pGF);
return ippStsNoErr;
}
@@ -634,6 +659,8 @@ IPPFUN(IppStatus, ippsGFpInv,(const IppsGFpElement* pElmA,
IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElmA), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElmR), ippStsContextMatchErr );
+
+ IPP_BADARG_RET( (GFPE_ROOM(pElmA)!=GFP_FELEN(pGF)) || (GFPE_ROOM(pElmR)!=GFP_FELEN(pGF)), ippStsOutOfRangeErr);
IPP_BADARG_RET( GFP_IS_ZERO(GFPE_DATA(pElmA),GFP_FELEN(pGF)), ippStsDivByZeroErr );
return NULL != cpGFpxInv(GFPE_DATA(pElmR), GFPE_DATA(pElmA), pGF)? ippStsNoErr : ippStsBadArgErr;
@@ -650,6 +677,8 @@ IPPFUN(IppStatus, ippsGFpSqrt,(const IppsGFpElement* pElmA,
IPP_BADARG_RET( !GFPE_TEST_ID(pElmA), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElmR), ippStsContextMatchErr );
+ IPP_BADARG_RET( (GFPE_ROOM(pElmA)!=GFP_FELEN(pGF)) || (GFPE_ROOM(pElmR)!=GFP_FELEN(pGF)), ippStsOutOfRangeErr);
+
return cpGFpSqrt(GFPE_DATA(pElmR), GFPE_DATA(pElmA), pGF)? ippStsNoErr : ippStsQuadraticNonResidueErr;
}
@@ -664,6 +693,8 @@ IPPFUN(IppStatus, ippsGFpAdd,(const IppsGFpElement* pElmA, const IppsGFpElement*
IPP_BADARG_RET( !GFPE_TEST_ID(pElmB), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElmR), ippStsContextMatchErr );
+ IPP_BADARG_RET( (GFPE_ROOM(pElmA)!=GFP_FELEN(pGF)) || (GFPE_ROOM(pElmB)!=GFP_FELEN(pGF)) || (GFPE_ROOM(pElmR)!=GFP_FELEN(pGF)), ippStsOutOfRangeErr);
+
pGF->add(GFPE_DATA(pElmR), GFPE_DATA(pElmA), GFPE_DATA(pElmB), pGF);
return ippStsNoErr;
}
@@ -679,6 +710,8 @@ IPPFUN(IppStatus, ippsGFpSub,(const IppsGFpElement* pElmA, const IppsGFpElement*
IPP_BADARG_RET( !GFPE_TEST_ID(pElmB), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElmR), ippStsContextMatchErr );
+ IPP_BADARG_RET( (GFPE_ROOM(pElmA)!=GFP_FELEN(pGF)) || (GFPE_ROOM(pElmB)!=GFP_FELEN(pGF)) || (GFPE_ROOM(pElmR)!=GFP_FELEN(pGF)), ippStsOutOfRangeErr);
+
pGF->sub(GFPE_DATA(pElmR), GFPE_DATA(pElmA), GFPE_DATA(pElmB), pGF);
return ippStsNoErr;
}
@@ -693,6 +726,8 @@ IPPFUN(IppStatus, ippsGFpMul,(const IppsGFpElement* pElmA, const IppsGFpElement*
IPP_BADARG_RET( !GFPE_TEST_ID(pElmB), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElmR), ippStsContextMatchErr );
+ IPP_BADARG_RET( (GFPE_ROOM(pElmA)!=GFP_FELEN(pGF)) || (GFPE_ROOM(pElmB)!=GFP_FELEN(pGF)) || (GFPE_ROOM(pElmR)!=GFP_FELEN(pGF)), ippStsOutOfRangeErr);
+
pGF->mul(GFPE_DATA(pElmR), GFPE_DATA(pElmA), GFPE_DATA(pElmB), pGF);
return ippStsNoErr;
}
@@ -706,52 +741,66 @@ IPPFUN(IppStatus, ippsGFpSqr,(const IppsGFpElement* pElmA,
IPP_BADARG_RET( !GFPE_TEST_ID(pElmA), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElmR), ippStsContextMatchErr );
+ IPP_BADARG_RET( (GFPE_ROOM(pElmA)!=GFP_FELEN(pGF)) || (GFPE_ROOM(pElmR)!=GFP_FELEN(pGF)), ippStsOutOfRangeErr);
+
pGF->sqr(GFPE_DATA(pElmR), GFPE_DATA(pElmA), pGF);
return ippStsNoErr;
}
-IPPFUN(IppStatus, ippsGFpAdd_GFpE,(const IppsGFpElement* pElmA, const IppsGFpElement* pGroundElmB,
- IppsGFpElement* pElmR, IppsGFpState* pGF))
+IPPFUN(IppStatus, ippsGFpAdd_PE,(const IppsGFpElement* pElmA, const IppsGFpElement* pParentElmB,
+ IppsGFpElement* pElmR, IppsGFpState* pGF))
{
- IPP_BAD_PTR4_RET(pElmA, pGroundElmB, pElmR, pGF);
+ IPP_BAD_PTR4_RET(pElmA, pParentElmB, pElmR, pGF);
pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
- IPP_BADARG_RET( GFP_IS_BASIC(pGF), ippStsBadArgErr )
IPP_BADARG_RET( !GFPE_TEST_ID(pElmA), ippStsContextMatchErr );
- IPP_BADARG_RET( !GFPE_TEST_ID(pGroundElmB), ippStsContextMatchErr );
+ IPP_BADARG_RET( !GFPE_TEST_ID(pParentElmB), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElmR), ippStsContextMatchErr );
- cpGFpxAdd_GFE(GFPE_DATA(pElmR), GFPE_DATA(pElmA), GFPE_DATA(pGroundElmB), pGF);
+ IPP_BADARG_RET( GFP_IS_BASIC(pGF), ippStsBadArgErr )
+
+ IPP_BADARG_RET( (GFPE_ROOM(pElmA)!=GFP_FELEN(pGF)) || (GFPE_ROOM(pElmR)!=GFP_FELEN(pGF)), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( (GFPE_ROOM(pParentElmB)!=GFP_FELEN(GFP_GROUNDGF(pGF))), ippStsOutOfRangeErr);
+
+ cpGFpxAdd_GFE(GFPE_DATA(pElmR), GFPE_DATA(pElmA), GFPE_DATA(pParentElmB), pGF);
return ippStsNoErr;
}
-IPPFUN(IppStatus, ippsGFpSub_GFpE,(const IppsGFpElement* pElmA, const IppsGFpElement* pGroundElmB,
- IppsGFpElement* pElmR, IppsGFpState* pGF))
+IPPFUN(IppStatus, ippsGFpSub_PE,(const IppsGFpElement* pElmA, const IppsGFpElement* pParentElmB,
+ IppsGFpElement* pElmR, IppsGFpState* pGF))
{
- IPP_BAD_PTR4_RET(pElmA, pGroundElmB, pElmR, pGF);
+ IPP_BAD_PTR4_RET(pElmA, pParentElmB, pElmR, pGF);
pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
- IPP_BADARG_RET( GFP_IS_BASIC(pGF), ippStsBadArgErr )
IPP_BADARG_RET( !GFPE_TEST_ID(pElmA), ippStsContextMatchErr );
- IPP_BADARG_RET( !GFPE_TEST_ID(pGroundElmB), ippStsContextMatchErr );
+ IPP_BADARG_RET( !GFPE_TEST_ID(pParentElmB), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElmR), ippStsContextMatchErr );
- cpGFpxSub_GFE(GFPE_DATA(pElmR), GFPE_DATA(pElmA), GFPE_DATA(pGroundElmB), pGF);
+ IPP_BADARG_RET( GFP_IS_BASIC(pGF), ippStsBadArgErr )
+
+ IPP_BADARG_RET( (GFPE_ROOM(pElmA)!=GFP_FELEN(pGF)) || (GFPE_ROOM(pElmR)!=GFP_FELEN(pGF)), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( (GFPE_ROOM(pParentElmB)!=GFP_FELEN(GFP_GROUNDGF(pGF))), ippStsOutOfRangeErr);
+
+ cpGFpxSub_GFE(GFPE_DATA(pElmR), GFPE_DATA(pElmA), GFPE_DATA(pParentElmB), pGF);
return ippStsNoErr;
}
-IPPFUN(IppStatus, ippsGFpMul_GFpE,(const IppsGFpElement* pElmA, const IppsGFpElement* pGroundElmB,
- IppsGFpElement* pElmR, IppsGFpState* pGF))
+IPPFUN(IppStatus, ippsGFpMul_PE,(const IppsGFpElement* pElmA, const IppsGFpElement* pParentElmB,
+ IppsGFpElement* pElmR, IppsGFpState* pGF))
{
- IPP_BAD_PTR4_RET(pElmA, pGroundElmB, pElmR, pGF);
+ IPP_BAD_PTR4_RET(pElmA, pParentElmB, pElmR, pGF);
pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
- IPP_BADARG_RET( GFP_IS_BASIC(pGF), ippStsBadArgErr )
IPP_BADARG_RET( !GFPE_TEST_ID(pElmA), ippStsContextMatchErr );
- IPP_BADARG_RET( !GFPE_TEST_ID(pGroundElmB), ippStsContextMatchErr );
+ IPP_BADARG_RET( !GFPE_TEST_ID(pParentElmB), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElmR), ippStsContextMatchErr );
- cpGFpxMul_GFE(GFPE_DATA(pElmR), GFPE_DATA(pElmA), GFPE_DATA(pGroundElmB), pGF);
+ IPP_BADARG_RET( GFP_IS_BASIC(pGF), ippStsBadArgErr )
+
+ IPP_BADARG_RET( (GFPE_ROOM(pElmA)!=GFP_FELEN(pGF)) || (GFPE_ROOM(pElmR)!=GFP_FELEN(pGF)), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( (GFPE_ROOM(pParentElmB)!=GFP_FELEN(GFP_GROUNDGF(pGF))), ippStsOutOfRangeErr);
+
+ cpGFpxMul_GFE(GFPE_DATA(pElmR), GFPE_DATA(pElmA), GFPE_DATA(pParentElmB), pGF);
return ippStsNoErr;
}
@@ -765,8 +814,11 @@ IPPFUN(IppStatus, ippsGFpExp,(const IppsGFpElement* pElmA, const IppsBigNumState
IPP_BADARG_RET( !GFPE_TEST_ID(pElmA), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pElmR), ippStsContextMatchErr );
+ pE = (IppsBigNumState*)( IPP_ALIGNED_PTR(pE, BN_ALIGNMENT) );
IPP_BADARG_RET( !BN_VALID_ID(pE), ippStsContextMatchErr );
- IPP_BADARG_RET( BN_SIZE(pE) > GFP_FELEN(pGF), ippStsRangeErr );
+ //IPP_BADARG_RET( BN_SIZE(pE) > GFP_FELEN(pGF), ippStsRangeErr );
+
+ IPP_BADARG_RET( (GFPE_ROOM(pElmA)!=GFP_FELEN(pGF)) || (GFPE_ROOM(pElmR)!=GFP_FELEN(pGF)), ippStsOutOfRangeErr);
cpGFpxExp(GFPE_DATA(pElmR), GFPE_DATA(pElmA), BN_NUMBER(pE), BN_SIZE(pE), pGF, pScratchBuffer);
@@ -777,11 +829,6 @@ IPPFUN(IppStatus, ippsGFpMultiExp,(const IppsGFpElement* const ppElmA[], const I
IppsGFpElement* pElmR, IppsGFpState* pGF,
Ipp8u* pScratchBuffer))
{
- IPP_BAD_PTR2_RET(pElmR, pGF);
- pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
- IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
- IPP_BADARG_RET( !GFPE_TEST_ID(pElmR), ippStsContextMatchErr );
-
IPP_BAD_PTR2_RET(ppElmA, ppE);
if(nItems==1)
@@ -789,12 +836,30 @@ IPPFUN(IppStatus, ippsGFpMultiExp,(const IppsGFpElement* const ppElmA[], const I
else {
int n;
+
+ /* test number of exponents */
+ IPP_BADARG_RET(1>nItems || nItems>IPP_MAX_EXPONENT_NUM, ippStsBadArgErr);
+
+ IPP_BAD_PTR2_RET(pElmR, pGF);
+
+ pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
+ IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
+ IPP_BADARG_RET( !GFPE_TEST_ID(pElmR), ippStsContextMatchErr );
+
+ IPP_BADARG_RET( GFPE_ROOM(pElmR)!=GFP_FELEN(pGF), ippStsOutOfRangeErr);
+
+ /* test all ppElmA[] and ppE[] pairs */
for(n=0; n<nItems; n++) {
const IppsGFpElement* pElmA = ppElmA[n];
const IppsBigNumState* pE = ppE[n];
+ IPP_BAD_PTR2_RET(pElmA, pE);
+
IPP_BADARG_RET( !GFPE_TEST_ID(pElmA), ippStsContextMatchErr );
+ pE = (IppsBigNumState*)( IPP_ALIGNED_PTR(pE, BN_ALIGNMENT) );
IPP_BADARG_RET( !BN_VALID_ID(pE), ippStsContextMatchErr );
- IPP_BADARG_RET( BN_SIZE(pE) > GFP_FELEN(pGF), ippStsRangeErr );
+ //IPP_BADARG_RET( BN_SIZE(pE) > GFP_FELEN(pGF), ippStsRangeErr );
+
+ IPP_BADARG_RET( (GFPE_ROOM(pElmA)!=GFP_FELEN(pGF)) || (GFPE_ROOM(pElmR)!=GFP_FELEN(pGF)), ippStsOutOfRangeErr);
}
if(NULL==pScratchBuffer) {
@@ -802,14 +867,15 @@ IPPFUN(IppStatus, ippsGFpMultiExp,(const IppsGFpElement* const ppElmA[], const I
cpGFpxExp(GFPE_DATA(pElmR), GFPE_DATA(ppElmA[0]), BN_NUMBER(ppE[0]), BN_SIZE(ppE[0]), pGF, 0);
for(n=1; n<nItems; n++) {
cpGFpxExp(pTmpR, GFPE_DATA(ppElmA[n]), BN_NUMBER(ppE[n]), BN_SIZE(ppE[n]), pGF, 0);
- cpGFpxMul(GFPE_DATA(pElmR), GFPE_DATA(pElmR), pTmpR, pGF);
+ pGF->mul(GFPE_DATA(pElmR), GFPE_DATA(pElmR), pTmpR, pGF);
}
cpGFpReleasePool(1, pGF);
}
+
else {
- const BNU_CHUNK_T* ppAdata[LOG2_CACHE_LINE_SIZE];
- const BNU_CHUNK_T* ppEdata[LOG2_CACHE_LINE_SIZE];
- int nsEdataLen[LOG2_CACHE_LINE_SIZE];
+ const BNU_CHUNK_T* ppAdata[IPP_MAX_EXPONENT_NUM];
+ const BNU_CHUNK_T* ppEdata[IPP_MAX_EXPONENT_NUM];
+ int nsEdataLen[IPP_MAX_EXPONENT_NUM];
for(n=0; n<nItems; n++) {
ppAdata[n] = GFPE_DATA(ppElmA[n]);
ppEdata[n] = BN_NUMBER(ppE[n]);
@@ -821,25 +887,35 @@ IPPFUN(IppStatus, ippsGFpMultiExp,(const IppsGFpElement* const ppElmA[], const I
}
}
-IPPFUN(IppStatus, ippsGFpSetElementHash,(const Ipp8u* pMsg, int msgLen, IppHashID hashID, IppsGFpElement* pElm, IppsGFpState* pGF))
+IPPFUN(IppStatus, ippsGFpSetElementHash,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGF, IppHashAlgId hashID))
{
+ /* get algorithm id */
+ hashID = cpValidHashAlg(hashID);
+ IPP_BADARG_RET(ippHashAlg_Unknown==hashID, ippStsNotSupportedModeErr);
+
+ /* test message length and pointer */
+ IPP_BADARG_RET((msgLen<0), ippStsLengthErr);
+ IPP_BADARG_RET((msgLen && !pMsg), ippStsNullPtrErr);
+
IPP_BAD_PTR2_RET(pElm, pGF);
pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr);
- IPP_BADARG_RET( !GFP_IS_BASIC(pGF), ippStsBadArgErr);
IPP_BADARG_RET( !GFPE_TEST_ID(pElm), ippStsContextMatchErr);
- IPP_BADARG_RET( !cpTestHashID(hashID), ippStsBadArgErr);
+ IPP_BADARG_RET( !GFP_IS_BASIC(pGF), ippStsBadArgErr);
+
+ IPP_BADARG_RET( GFPE_ROOM(pElm)!=GFP_FELEN(pGF), ippStsOutOfRangeErr);
{
Ipp8u md[IPP_SHA512_DIGEST_BITSIZE/BYTESIZE];
BNU_CHUNK_T hashVal[IPP_SHA512_DIGEST_BITSIZE/BITSIZE(BNU_CHUNK_T)+1]; /* +1 to meet cpMod_BNU() implementtaion specific */
- IppStatus sts = cpHashMessage(pMsg, msgLen, md, hashID);
+ IppStatus sts = ippsHashMessage(pMsg, msgLen, md, hashID);
if(ippStsNoErr==sts) {
- int hashValLen = cpFromOctStr_BNU(hashVal, md, cpHashLength(hashID));
int elemLen = GFP_FELEN(pGF);
+ int hashLen = cpHashAlgAttr[hashID].hashSize;
+ int hashValLen = cpFromOctStr_BNU(hashVal, md, hashLen);
hashValLen = cpMod_BNU(hashVal, hashValLen, GFP_MODULUS(pGF), elemLen);
- cpGFpSet(GFPE_DATA(pElm), hashVal, hashValLen, pGF, USE_MONT_SPACE_REPRESENTATION);
+ cpGFpSet(GFPE_DATA(pElm), hashVal, hashValLen, pGF);
}
return sts;
}
diff --git a/ext/ipp/sources/ippcp/src/pcpgfpec.c b/ext/ipp/sources/ippcp/src/pcpgfpec.c
new file mode 100644
index 0000000..52cef4b
--- /dev/null
+++ b/ext/ipp/sources/ippcp/src/pcpgfpec.c
@@ -0,0 +1,456 @@
+/*############################################################################
+ # Copyright 2010-2017 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.
+ ############################################################################*/
+
+/*
+// Intel(R) Performance Primitives. Cryptography Primitives.
+// EC over GF(p^m) definitinons
+//
+// Context:
+// ippsGFpECGetSize()
+// ippsGFpECInit()
+//
+// ippsGFpECSet()
+// ippsGFpECSetSubgroup()
+//
+// ippsGFpECGet()
+// ippsGFpECGetSubgroup()
+//
+// ippsGFpECScratchBufferSize()
+// ippsGFpECVerify()
+//
+//
+*/
+#include "owndefs.h"
+#include "owncp.h"
+
+#include "pcpgfpecstuff.h"
+
+int cpGFpECGetSize(int basicDeg, int basicElmBitSize)
+{
+ int ctxSize = 0;
+ int elemLen = basicDeg*BITS_BNU_CHUNK(basicElmBitSize);
+
+ int maxOrderBits = 1+ basicDeg*basicElmBitSize;
+ int maxOrderLen32 = BITS2WORD32_SIZE(maxOrderBits);
+ #if defined(_LEGACY_ECCP_SUPPORT_)
+ int maxOrderLen = BITS_BNU_CHUNK(maxOrderBits);
+ #endif
+
+ int montgomeryCtxSize;
+ if(ippStsNoErr==ippsMontGetSize(ippBinaryMethod, maxOrderLen32, &montgomeryCtxSize)) {
+ montgomeryCtxSize -= MONT_ALIGNMENT-1;
+
+ ctxSize = sizeof(IppsGFpECState)
+ +elemLen*sizeof(BNU_CHUNK_T) /* EC coeff A */
+ +elemLen*sizeof(BNU_CHUNK_T) /* EC coeff B */
+ +elemLen*sizeof(BNU_CHUNK_T) /* generator G.x */
+ +elemLen*sizeof(BNU_CHUNK_T) /* generator G.y */
+ +elemLen*sizeof(BNU_CHUNK_T) /* generator G.z */
+ +montgomeryCtxSize /* mont engine (R) */
+ +elemLen*sizeof(BNU_CHUNK_T) /* cofactor */
+ #if defined(_LEGACY_ECCP_SUPPORT_)
+ +2*elemLen*3*sizeof(BNU_CHUNK_T) /* regular and ephemeral public keys */
+ +2*maxOrderLen*sizeof(BNU_CHUNK_T) /* regular and ephemeral private keys */
+ #endif
+ +elemLen*sizeof(BNU_CHUNK_T)*3*EC_POOL_SIZE;
+ }
+ return ctxSize;
+}
+
+IPPFUN(IppStatus, ippsGFpECGetSize,(const IppsGFpState* pGF, int* pCtxSizeInBytes))
+{
+ IPP_BAD_PTR2_RET(pGF, pCtxSizeInBytes);
+ pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
+ IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
+
+ *pCtxSizeInBytes = cpGFpECGetSize(cpGFpBasicDegreeExtension(pGF), GFP_FEBITLEN(cpGFpBasic(pGF)))
+ +ECGFP_ALIGNMENT;
+ return ippStsNoErr;
+}
+
+
+IPPFUN(IppStatus, ippsGFpECInit,(const IppsGFpState* pGF,
+ const IppsGFpElement* pA, const IppsGFpElement* pB,
+ IppsGFpECState* pEC))
+{
+ IPP_BAD_PTR2_RET(pGF, pEC);
+
+ pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
+ IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
+
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+
+ {
+ Ipp8u* ptr = (Ipp8u*)pEC;
+
+ int elemLen = GFP_FELEN(pGF);
+
+ int maxOrderBits = 1+ cpGFpBasicDegreeExtension(pGF) * GFP_FEBITLEN(cpGFpBasic(pGF));
+ int maxOrderLen32 = BITS2WORD32_SIZE(maxOrderBits);
+ #if defined(_LEGACY_ECCP_SUPPORT_)
+ int maxOrdLen = BITS_BNU_CHUNK(maxOrderBits);
+ #endif
+
+ int montgomeryCtxSize;
+ ippsMontGetSize(ippBinaryMethod, maxOrderLen32, &montgomeryCtxSize);
+ montgomeryCtxSize -= MONT_ALIGNMENT-1;
+
+ ECP_ID(pEC) = idCtxGFPEC;
+ ECP_GFP(pEC) = (IppsGFpState*)(IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT));
+ ECP_POINTLEN(pEC) = elemLen*3;
+ ECP_ORDBITSIZE(pEC) = maxOrderBits;
+ ECP_SPECIFIC(pEC) = ECP_ARB;
+
+ ptr += sizeof(IppsGFpECState);
+ ECP_A(pEC) = (BNU_CHUNK_T*)(ptr); ptr += elemLen*sizeof(BNU_CHUNK_T);
+ ECP_B(pEC) = (BNU_CHUNK_T*)(ptr); ptr += elemLen*sizeof(BNU_CHUNK_T);
+ ECP_G(pEC) = (BNU_CHUNK_T*)(ptr); ptr += ECP_POINTLEN(pEC)*sizeof(BNU_CHUNK_T);
+ ECP_PREMULBP(pEC) = (cpPrecompAP*)NULL;
+ ECP_MONT_R(pEC) = (IppsMontState*)( IPP_ALIGNED_PTR((ptr), (MONT_ALIGNMENT)) ); ptr += montgomeryCtxSize;
+ ECP_COFACTOR(pEC) = (BNU_CHUNK_T*)(ptr); ptr += elemLen*sizeof(BNU_CHUNK_T);
+ #if defined(_LEGACY_ECCP_SUPPORT_)
+ ECP_PUBLIC(pEC) = (BNU_CHUNK_T*)(ptr); ptr += 3*elemLen*sizeof(BNU_CHUNK_T);
+ ECP_PUBLIC_E(pEC) = (BNU_CHUNK_T*)(ptr); ptr += 3*elemLen*sizeof(BNU_CHUNK_T);
+ ECP_PRIVAT(pEC) = (BNU_CHUNK_T*)(ptr); ptr += maxOrdLen*sizeof(BNU_CHUNK_T);
+ ECP_PRIVAT_E(pEC) = (BNU_CHUNK_T*)(ptr); ptr += maxOrdLen*sizeof(BNU_CHUNK_T);
+ ECP_SBUFFER(pEC) = (BNU_CHUNK_T*)0;
+ #endif
+ ECP_POOL(pEC) = (BNU_CHUNK_T*)(ptr); //ptr += ECP_POINTLEN(pEC)*sizeof(BNU_CHUNK_T)*EC_POOL_SIZE;
+
+ cpGFpElementPadd(ECP_A(pEC), elemLen, 0);
+ cpGFpElementPadd(ECP_B(pEC), elemLen, 0);
+ cpGFpElementPadd(ECP_G(pEC), elemLen*3, 0);
+ ippsMontInit(ippBinaryMethod, maxOrderLen32, ECP_MONT_R(pEC));
+ cpGFpElementPadd(ECP_COFACTOR(pEC), elemLen, 0);
+
+ cpGFpElementPadd(ECP_POOL(pEC), elemLen*3*EC_POOL_SIZE, 0);
+
+ /* set up EC if possible */
+ if(pA && pB)
+ return ippsGFpECSet(pA,pB, pEC);
+ else
+ return ippStsNoErr;
+ }
+}
+
+IPPFUN(IppStatus, ippsGFpECSet,(const IppsGFpElement* pA,
+ const IppsGFpElement* pB,
+ IppsGFpECState* pEC))
+{
+ IPP_BAD_PTR1_RET(pEC);
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+ IPP_BADARG_RET( !ECP_TEST_ID(pEC), ippStsContextMatchErr );
+
+ IPP_BAD_PTR2_RET(pA, pB);
+ IPP_BADARG_RET( !GFPE_TEST_ID(pA), ippStsContextMatchErr );
+ IPP_BADARG_RET( !GFPE_TEST_ID(pB), ippStsContextMatchErr );
+
+ IPP_BADARG_RET( GFPE_ROOM(pA)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( GFPE_ROOM(pB)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+
+ {
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ int elemLen = GFP_FELEN(pGF);
+
+ /* copy A */
+ cpGFpElementPadd(ECP_A(pEC), elemLen, 0);
+ cpGFpElementCopy(ECP_A(pEC), GFPE_DATA(pA), elemLen);
+ /* and set up A-specific (a==0 or a==-3) if is */
+ if(GFP_IS_ZERO(ECP_A(pEC), elemLen))
+ ECP_SPECIFIC(pEC) = ECP_EPID2;
+
+ cpGFpElementSetChunk(ECP_B(pEC), elemLen, 3);
+ pGF->encode(ECP_B(pEC), ECP_B(pEC), pGF);
+ pGF->add(ECP_B(pEC), ECP_A(pEC), ECP_B(pEC), pGF);
+ if(GFP_IS_ZERO(ECP_B(pEC), elemLen))
+ ECP_SPECIFIC(pEC) = ECP_STD;
+
+ /* copy B */
+ cpGFpElementPadd(ECP_B(pEC), elemLen, 0);
+ cpGFpElementCopy(ECP_B(pEC), GFPE_DATA(pB), elemLen);
+ /* and set type of affine infinity representation:
+ // (0,1) if B==0
+ // (0,0) if B!=0 */
+ ECP_INFINITY(pEC) = GFP_IS_ZERO(ECP_B(pEC), elemLen);
+
+ return ippStsNoErr;
+ }
+}
+
+IPPFUN(IppStatus, ippsGFpECSetSubgroup,(const IppsGFpElement* pX, const IppsGFpElement* pY,
+ const IppsBigNumState* pOrder,
+ const IppsBigNumState* pCofactor,
+ IppsGFpECState* pEC))
+{
+ IPP_BAD_PTR1_RET(pEC);
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+ IPP_BADARG_RET( !ECP_TEST_ID(pEC), ippStsContextMatchErr );
+
+ IPP_BAD_PTR2_RET(pX, pY);
+ IPP_BADARG_RET( !GFPE_TEST_ID(pX), ippStsContextMatchErr );
+ IPP_BADARG_RET( !GFPE_TEST_ID(pY), ippStsContextMatchErr );
+ IPP_BADARG_RET( GFPE_ROOM(pX)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( GFPE_ROOM(pY)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+
+ IPP_BAD_PTR2_RET(pOrder, pCofactor);
+ pOrder = (IppsBigNumState*)( IPP_ALIGNED_PTR(pOrder, BN_ALIGNMENT) );
+ IPP_BADARG_RET(!BN_VALID_ID(pOrder), ippStsContextMatchErr);
+ IPP_BADARG_RET(BN_SIGN(pOrder)!= IppsBigNumPOS, ippStsBadArgErr);
+
+ pCofactor = (IppsBigNumState*)( IPP_ALIGNED_PTR(pCofactor, BN_ALIGNMENT) );
+ IPP_BADARG_RET(!BN_VALID_ID(pCofactor), ippStsContextMatchErr);
+ IPP_BADARG_RET(BN_SIGN(pCofactor)!= IppsBigNumPOS, ippStsBadArgErr);
+
+ {
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ int elemLen = GFP_FELEN(pGF);
+
+#if 0
+ /* set base point at infinity */
+ cpGFpElementPadd(ECP_G(pEC), elemLen*3, 0);
+ if(!GFP_IS_ZERO(GFPE_DATA(pX), elemLen) || !GFP_IS_ZERO(GFPE_DATA(pY), elemLen)) {
+ /* reset base point as infine */
+ cpGFpElementCopy(ECP_G(pEC), GFPE_DATA(pX), elemLen);
+ cpGFpElementCopy(ECP_G(pEC)+elemLen, GFPE_DATA(pY), elemLen);
+ cpGFpElementCopyPadd(ECP_G(pEC)+elemLen*2, elemLen, MNT_1(GFP_MONT(cpGFpBasic(pGF))), GFP_FELEN(cpGFpBasic(pGF)));
+ }
+#endif
+ gfec_SetPoint(ECP_G(pEC), GFPE_DATA(pX), GFPE_DATA(pY), pEC);
+
+ {
+ ///int maxOrderBits = 1+ cpGFpBasicDegreeExtension(pGF) * GFP_FEBITSIZE(cpGFpBasic(pGF));
+ int maxOrderBits = 1+ cpGFpBasicDegreeExtension(pGF) * GFP_FEBITLEN(cpGFpBasic(pGF));
+ BNU_CHUNK_T* pOrderData = BN_NUMBER(pOrder);
+ int orderLen= BN_SIZE(pOrder);
+ int orderBitSize = BITSIZE_BNU(pOrderData, orderLen);
+ IPP_BADARG_RET(orderBitSize>maxOrderBits, ippStsRangeErr)
+ ECP_ORDBITSIZE(pEC) = orderBitSize;
+ ippsMontSet((Ipp32u*)pOrderData, BITS2WORD32_SIZE(orderBitSize), ECP_MONT_R(pEC));
+ }
+
+ {
+ BNU_CHUNK_T* pCofactorData = BN_NUMBER(pCofactor);
+ int cofactorLen= BN_SIZE(pCofactor);
+ int cofactorBitSize = BITSIZE_BNU(pCofactorData, cofactorLen);
+ IPP_BADARG_RET(cofactorBitSize>elemLen*BITSIZE(BNU_CHUNK_T), ippStsRangeErr)
+ COPY_BNU(ECP_COFACTOR(pEC), pCofactorData, cofactorLen);
+ }
+
+ return ippStsNoErr;
+ }
+}
+
+IPPFUN(IppStatus, ippsGFpECGet,(IppsGFpState** const ppGF,
+ IppsGFpElement* pA, IppsGFpElement* pB,
+ const IppsGFpECState* pEC))
+{
+ IPP_BAD_PTR1_RET(pEC);
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+ IPP_BADARG_RET( !ECP_TEST_ID(pEC), ippStsContextMatchErr );
+
+ {
+ const IppsGFpState* pGF = ECP_GFP(pEC);
+ Ipp32u elementSize = GFP_FELEN(pGF);
+
+ if(ppGF) {
+ *ppGF = (IppsGFpState*)pGF;
+ }
+
+ if(pA) {
+ IPP_BADARG_RET( !GFPE_TEST_ID(pA), ippStsContextMatchErr );
+ IPP_BADARG_RET( GFPE_ROOM(pA)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+ cpGFpElementCopy(GFPE_DATA(pA), ECP_A(pEC), elementSize);
+ }
+ if(pB) {
+ IPP_BADARG_RET( !GFPE_TEST_ID(pB), ippStsContextMatchErr );
+ IPP_BADARG_RET( GFPE_ROOM(pB)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+ cpGFpElementCopy(GFPE_DATA(pB), ECP_B(pEC), elementSize);
+ }
+
+ return ippStsNoErr;
+ }
+}
+
+IPPFUN(IppStatus, ippsGFpECGetSubgroup,(IppsGFpState** const ppGF,
+ IppsGFpElement* pX, IppsGFpElement* pY,
+ IppsBigNumState* pOrder,
+ IppsBigNumState* pCofactor,
+ const IppsGFpECState* pEC))
+{
+ IPP_BAD_PTR1_RET(pEC);
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+ IPP_BADARG_RET( !ECP_TEST_ID(pEC), ippStsContextMatchErr );
+
+ {
+ const IppsGFpState* pGF = ECP_GFP(pEC);
+ Ipp32u elementSize = GFP_FELEN(pGF);
+
+ if(ppGF) {
+ *ppGF = (IppsGFpState*)pGF;
+ }
+
+ if(pX) {
+ IPP_BADARG_RET( !GFPE_TEST_ID(pX), ippStsContextMatchErr );
+ IPP_BADARG_RET( GFPE_ROOM(pX)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+ cpGFpElementCopy(GFPE_DATA(pX), ECP_G(pEC), elementSize);
+ }
+ if(pY) {
+ IPP_BADARG_RET( !GFPE_TEST_ID(pY), ippStsContextMatchErr );
+ IPP_BADARG_RET( GFPE_ROOM(pY)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+ cpGFpElementCopy(GFPE_DATA(pY), ECP_G(pEC)+elementSize, elementSize);
+ }
+
+ if(pOrder) {
+ BNU_CHUNK_T* pOrderData = MNT_MODULUS(ECP_MONT_R(pEC));
+ int orderBitSize = ECP_ORDBITSIZE(pEC);
+ int orderLen = BITS_BNU_CHUNK(orderBitSize);
+ FIX_BNU(pOrderData, orderLen);
+
+ pOrder = (IppsBigNumState*)( IPP_ALIGNED_PTR(pOrder, BN_ALIGNMENT) );
+ IPP_BADARG_RET(!BN_VALID_ID(pOrder), ippStsContextMatchErr);
+ IPP_BADARG_RET(BN_ROOM(pOrder) < orderLen, ippStsLengthErr);
+
+ ZEXPAND_COPY_BNU(BN_NUMBER(pOrder), BN_ROOM(pOrder), pOrderData, orderLen);
+ BN_SIZE(pOrder) = orderLen;
+ BN_SIGN(pOrder) = ippBigNumPOS;
+ }
+
+ if(pCofactor) {
+ BNU_CHUNK_T* pCofactorData = ECP_COFACTOR(pEC);
+ int cofactorLen = elementSize;
+ FIX_BNU(pCofactorData, cofactorLen);
+
+ pCofactor = (IppsBigNumState*)( IPP_ALIGNED_PTR(pCofactor, BN_ALIGNMENT) );
+ IPP_BADARG_RET(!BN_VALID_ID(pCofactor), ippStsContextMatchErr);
+ IPP_BADARG_RET(BN_ROOM(pCofactor) < cofactorLen, ippStsLengthErr);
+
+ ZEXPAND_COPY_BNU(BN_NUMBER(pCofactor), BN_ROOM(pCofactor), pCofactorData, cofactorLen);
+ BN_SIZE(pCofactor) = cofactorLen;
+ BN_SIGN(pCofactor) = ippBigNumPOS;
+ }
+
+ return ippStsNoErr;
+ }
+}
+
+IPPFUN(IppStatus, ippsGFpECScratchBufferSize,(int nScalars, const IppsGFpECState* pEC, int* pBufferSize))
+{
+ IPP_BAD_PTR2_RET(pEC, pBufferSize);
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+ IPP_BADARG_RET( !ECP_TEST_ID(pEC), ippStsContextMatchErr );
+
+ IPP_BADARG_RET( (0>=nScalars)||(nScalars>IPP_MAX_EXPONENT_NUM), ippStsBadArgErr);
+
+ {
+ /* select constant size of window */
+ const int w = 5;
+ /* number of table entries */
+ const int nPrecomputed = 1<<(w-1); /* because of signed digit representation of scalar is uses */
+
+ int pointDataSize = ECP_POINTLEN(pEC)*sizeof(BNU_CHUNK_T);
+
+ *pBufferSize = nScalars * pointDataSize*nPrecomputed + CACHE_LINE_SIZE;
+
+ return ippStsNoErr;
+ }
+}
+
+IPPFUN(IppStatus, ippsGFpECVerify,(IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer))
+{
+ IPP_BAD_PTR3_RET(pEC, pResult, pScratchBuffer);
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+ IPP_BADARG_RET( !ECP_TEST_ID(pEC), ippStsContextMatchErr );
+
+ *pResult = ippECValid;
+
+ {
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ int elemLen = GFP_FELEN(pGF);
+
+ /*
+ // check discriminant ( 4*A^3 + 27*B^2 != 0 mod P)
+ */
+ if(ippECValid == *pResult) {
+ BNU_CHUNK_T* pT = cpGFpGetPool(1, pGF);
+ BNU_CHUNK_T* pU = cpGFpGetPool(1, pGF);
+
+ if(ECP_SPECIFIC(pEC)==ECP_EPID2)
+ cpGFpElementPadd(pT, elemLen, 0); /* T = 4*A^3 = 0 */
+ else {
+ pGF->add(pT, ECP_A(pEC), ECP_A(pEC), pGF); /* T = 4*A^3 */
+ pGF->sqr(pT, pT, pGF);
+ pGF->mul(pT, ECP_A(pEC), pT, pGF);
+ }
+
+ pGF->add(pU, ECP_B(pEC), ECP_B(pEC), pGF); /* U = 9*B^2 */
+ pGF->add(pU, pU, ECP_B(pEC), pGF);
+ pGF->sqr(pU, pU, pGF);
+
+ pGF->add(pT, pU, pT, pGF); /* T += 3*U */
+ pGF->add(pT, pU, pT, pGF);
+ pGF->add(pT, pU, pT, pGF);
+
+ *pResult = GFP_IS_ZERO(pT, elemLen)? ippECIsZeroDiscriminant: ippECValid;
+
+ cpGFpReleasePool(2, pGF);
+ }
+
+ /*
+ // check base point and it order
+ */
+ if(ippECValid == *pResult) {
+ IppsGFpECPoint G;
+ cpEcGFpInitPoint(&G, ECP_G(pEC), ECP_AFFINE_POINT|ECP_FINITE_POINT, pEC);
+
+ /* check G != infinity */
+ *pResult = gfec_IsPointAtInfinity(&G)? ippECPointIsAtInfinite : ippECValid;
+
+ /* check G lies on EC */
+ if(ippECValid == *pResult)
+ *pResult = gfec_IsPointOnCurve(&G, pEC)? ippECValid : ippECPointIsNotValid;
+
+ /* check Gorder*G = infinity */
+ if(ippECValid == *pResult) {
+ IppsGFpECPoint T;
+ cpEcGFpInitPoint(&T, cpEcGFpGetPool(1, pEC),0, pEC);
+
+ //gfec_MulPoint(&T, &G, MNT_MODULUS(ECP_MONT_R(pEC)), BITS_BNU_CHUNK(ECP_ORDBITSIZE(pEC)), pEC, pScratchBuffer);
+ gfec_MulBasePoint(&T, MNT_MODULUS(ECP_MONT_R(pEC)), BITS_BNU_CHUNK(ECP_ORDBITSIZE(pEC)), pEC, pScratchBuffer);
+
+ *pResult = gfec_IsPointAtInfinity(&T)? ippECValid : ippECInvalidOrder;
+
+ cpEcGFpReleasePool(1, pEC);
+ }
+ }
+
+ /*
+ // check order==P
+ */
+ if(ippECValid == *pResult) {
+ IppsGFpState* pGF_local = ECP_GFP(pEC);
+ BNU_CHUNK_T* pPrime = GFP_MODULUS(pGF_local);
+ int primeLen = GFP_FELEN(pGF_local);
+
+ IppsMontState* pR = ECP_MONT_R(pEC);
+ BNU_CHUNK_T* pOrder = MNT_MODULUS(pR);
+ int orderLen = MNT_SIZE(pR);
+
+ *pResult = (primeLen==orderLen && GFP_EQ(pPrime, pOrder, primeLen))? ippECIsWeakSSSA : ippECValid;
+ }
+
+ return ippStsNoErr;
+ }
+}
diff --git a/ext/ipp/sources/ippcpepid/src/pcpgfpecpoint.c b/ext/ipp/sources/ippcp/src/pcpgfpecpoint.c
index d1901b3..7ffec7e 100644
--- a/ext/ipp/sources/ippcpepid/src/pcpgfpecpoint.c
+++ b/ext/ipp/sources/ippcp/src/pcpgfpecpoint.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2010-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -40,11 +40,11 @@
//
//
*/
-
-#include "owncpepid.h"
+#include "owndefs.h"
+#include "owncp.h"
#include "pcpgfpecstuff.h"
-#include "pcpgfphashstuff.h"
+#include "pcphash.h"
IPPFUN(IppStatus, ippsGFpECPointGetSize,(const IppsGFpECState* pEC, int* pSizeInBytes))
@@ -84,7 +84,7 @@ IPPFUN(IppStatus, ippsGFpECPointInit,(const IppsGFpElement* pX, const IppsGFpEle
if(pX && pY)
return ippsGFpECSetPoint(pX, pY, pPoint, pEC);
else {
- cpEcGFpSetProjectivePointAtInfinity(pPoint, elemLen);
+ gfec_SetPointAtInfinity(pPoint);
return ippStsNoErr;
}
}
@@ -98,11 +98,12 @@ IPPFUN(IppStatus, ippsGFpECSetPointAtInfinity,(IppsGFpECPoint* pPoint, IppsGFpEC
IPP_BADARG_RET( !ECP_TEST_ID(pEC), ippStsContextMatchErr );
IPP_BADARG_RET( !ECP_POINT_TEST_ID(pPoint), ippStsContextMatchErr );
- cpEcGFpSetProjectivePointAtInfinity(pPoint, GFP_FELEN(ECP_GFP(pEC)));
+ IPP_BADARG_RET( ECP_POINT_FELEN(pPoint)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+
+ gfec_SetPointAtInfinity(pPoint);
return ippStsNoErr;
}
-
IPPFUN(IppStatus, ippsGFpECSetPoint,(const IppsGFpElement* pX, const IppsGFpElement* pY,
IppsGFpECPoint* pPoint,
IppsGFpECState* pEC))
@@ -116,7 +117,36 @@ IPPFUN(IppStatus, ippsGFpECSetPoint,(const IppsGFpElement* pX, const IppsGFpElem
IPP_BADARG_RET( !GFPE_TEST_ID(pX), ippStsContextMatchErr );
IPP_BADARG_RET( !GFPE_TEST_ID(pY), ippStsContextMatchErr );
- cpEcGFpSetAffinePoint(pPoint, GFPE_DATA(pX), GFPE_DATA(pY), pEC);
+ IPP_BADARG_RET( GFPE_ROOM(pX)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( GFPE_ROOM(pY)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( ECP_POINT_FELEN(pPoint)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+
+ if(gfec_SetPoint(ECP_POINT_DATA(pPoint), GFPE_DATA(pX), GFPE_DATA(pY), pEC))
+ ECP_POINT_FLAGS(pPoint) = ECP_AFFINE_POINT | ECP_FINITE_POINT;
+ else
+ ECP_POINT_FLAGS(pPoint) = 0;
+ return ippStsNoErr;
+}
+
+IPPFUN(IppStatus, ippsGFpECGetPoint,(const IppsGFpECPoint* pPoint,
+ IppsGFpElement* pX, IppsGFpElement* pY,
+ IppsGFpECState* pEC))
+{
+ IPP_BAD_PTR2_RET(pPoint, pEC);
+ pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
+ IPP_BADARG_RET( !ECP_TEST_ID(pEC), ippStsContextMatchErr );
+ IPP_BADARG_RET( !ECP_POINT_TEST_ID(pPoint), ippStsContextMatchErr );
+
+ ///IPP_BADARG_RET( !IS_ECP_FINITE_POINT(pPoint), ippStsPointAtInfinity);
+
+ IPP_BADARG_RET( pX && !GFPE_TEST_ID(pX), ippStsContextMatchErr );
+ IPP_BADARG_RET( pY && !GFPE_TEST_ID(pY), ippStsContextMatchErr );
+
+ IPP_BADARG_RET( pX && GFPE_ROOM(pX)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( pY && GFPE_ROOM(pY)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( ECP_POINT_FELEN(pPoint)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+
+ gfec_GetPoint((pX)? GFPE_DATA(pX):NULL, (pY)? GFPE_DATA(pY):NULL, pPoint, pEC);
return ippStsNoErr;
}
@@ -130,20 +160,25 @@ IPPFUN(IppStatus, ippsGFpECMakePoint,(const IppsGFpElement* pX, IppsGFpECPoint*
IPP_BADARG_RET( !GFPE_TEST_ID(pX), ippStsContextMatchErr );
IPP_BADARG_RET( !ECP_POINT_TEST_ID(pPoint), ippStsContextMatchErr );
- return cpEcGFpMakePoint(pPoint, GFPE_DATA(pX), pEC)? ippStsNoErr : ippStsQuadraticNonResidueErr;
+ IPP_BADARG_RET( GFPE_ROOM(pX)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( ECP_POINT_FELEN(pPoint)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+
+ return gfec_MakePoint(pPoint, GFPE_DATA(pX), pEC)? ippStsNoErr : ippStsQuadraticNonResidueErr;
}
-IPPFUN(IppStatus, ippsGFpECSetPointRandom,(IppBitSupplier rndFunc, void* pRndParam,
- IppsGFpECPoint* pPoint, IppsGFpECState* pEC,
+IPPFUN(IppStatus, ippsGFpECSetPointRandom,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC,
+ IppBitSupplier rndFunc, void* pRndParam,
Ipp8u* pScratchBuffer))
{
- IPP_BAD_PTR2_RET(pPoint, pEC);
+ IPP_BAD_PTR3_RET(pPoint, pEC, pScratchBuffer);
pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
IPP_BADARG_RET( !ECP_TEST_ID(pEC), ippStsContextMatchErr );
IPP_BADARG_RET( !ECP_POINT_TEST_ID(pPoint), ippStsContextMatchErr );
- IPP_BAD_PTR1_RET(rndFunc);
+ IPP_BADARG_RET( ECP_POINT_FELEN(pPoint)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+
+ IPP_BAD_PTR2_RET(rndFunc, pRndParam);
{
IppsGFpState* pGF = ECP_GFP(pEC);
@@ -151,28 +186,26 @@ IPPFUN(IppStatus, ippsGFpECSetPointRandom,(IppBitSupplier rndFunc, void* pRndPar
if( GFP_IS_BASIC(pGF) ) {
BNU_CHUNK_T* pElm = cpGFpGetPool(1, pGF);
- do {
- /* get random X */
- cpGFpRand(pElm, pGF, rndFunc, pRndParam, USE_MONT_SPACE_REPRESENTATION);
- } while( !cpEcGFpMakePoint(pPoint, pElm, pEC) );
+ do { /* get random X */
+ cpGFpRand(pElm, pGF, rndFunc, pRndParam);
+ } while( !gfec_MakePoint(pPoint, pElm, pEC) );
cpGFpReleasePool(1, pGF);
- /* R = cofactor*R */
- cpEcGFpMulPoint(pPoint, pPoint, ECP_COFACTOR(pEC), GFP_FELEN(pGF), pEC, pScratchBuffer);
+ /* R = [cofactor]R */
+ gfec_MulPoint(pPoint, pPoint, ECP_COFACTOR(pEC), GFP_FELEN(pGF), pEC, pScratchBuffer);
return ippStsNoErr;
}
else {
- /* number of bits and dwords being begerated */
+ /* number of bits and dwords being generated */
int generatedBits = ECP_ORDBITSIZE(pEC) + GF_RAND_ADD_BITS;
int generatedLen = BITS_BNU_CHUNK(generatedBits);
/* allocate random exponent */
int poolElements = (generatedLen + GFP_PELEN(pGF) -1) / GFP_PELEN(pGF);
BNU_CHUNK_T* pExp = cpGFpGetPool(poolElements, pGF);
-
int nsE;
/* setup copy of the base point */
@@ -182,10 +215,11 @@ IPPFUN(IppStatus, ippsGFpECSetPointRandom,(IppBitSupplier rndFunc, void* pRndPar
/* get random bits */
rndFunc((Ipp32u*)pExp, generatedBits, pRndParam);
/* reduce with respect to order value */
- nsE = cpMod_BNU(pExp, generatedLen, ECP_R(pEC), BITS_BNU_CHUNK(ECP_ORDBITSIZE(pEC)));
+ //nsE = cpMod_BNU(pExp, generatedLen, ECP_R(pEC), BITS_BNU_CHUNK(ECP_ORDBITSIZE(pEC)));
+ nsE = cpMod_BNU(pExp, generatedLen, MNT_MODULUS(ECP_MONT_R(pEC)), BITS_BNU_CHUNK(ECP_ORDBITSIZE(pEC)));
/* compute random point */
- cpEcGFpMulPoint(pPoint, &G, pExp, nsE, pEC, pScratchBuffer);
+ gfec_MulPoint(pPoint, &G, pExp, nsE, pEC, pScratchBuffer);
cpGFpReleasePool(poolElements, pGF);
@@ -195,24 +229,6 @@ IPPFUN(IppStatus, ippsGFpECSetPointRandom,(IppBitSupplier rndFunc, void* pRndPar
}
-IPPFUN(IppStatus, ippsGFpECGetPoint,(const IppsGFpECPoint* pPoint,
- IppsGFpElement* pX, IppsGFpElement* pY,
- IppsGFpECState* pEC))
-{
- IPP_BAD_PTR2_RET(pPoint, pEC);
- pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
- IPP_BADARG_RET( !ECP_TEST_ID(pEC), ippStsContextMatchErr );
- IPP_BADARG_RET( !ECP_POINT_TEST_ID(pPoint), ippStsContextMatchErr );
-
- IPP_BADARG_RET( !IS_ECP_FINITE_POINT(pPoint), ippStsPointAtInfinity);
-
- IPP_BADARG_RET( pX && !GFPE_TEST_ID(pX), ippStsContextMatchErr );
- IPP_BADARG_RET( pY && !GFPE_TEST_ID(pY), ippStsContextMatchErr );
-
- cpEcGFpGetAffinePoint((pX)? GFPE_DATA(pX):0, (pY)?GFPE_DATA(pY):0, pPoint, pEC);
- return ippStsNoErr;
-}
-
IPPFUN(IppStatus, ippsGFpECCpyPoint,(const IppsGFpECPoint* pA,
IppsGFpECPoint* pR,
@@ -224,7 +240,10 @@ IPPFUN(IppStatus, ippsGFpECCpyPoint,(const IppsGFpECPoint* pA,
IPP_BADARG_RET( !ECP_POINT_TEST_ID(pA), ippStsContextMatchErr );
IPP_BADARG_RET( !ECP_POINT_TEST_ID(pR), ippStsContextMatchErr );
- cpEcGFpCopyPoint(pR, pA, GFP_FELEN(ECP_GFP(pEC)));
+ IPP_BADARG_RET( ECP_POINT_FELEN(pA)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( ECP_POINT_FELEN(pR)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+
+ gfec_CopyPoint(pR, pA, GFP_FELEN(ECP_GFP(pEC)));
return ippStsNoErr;
}
@@ -239,75 +258,60 @@ IPPFUN(IppStatus, ippsGFpECCmpPoint,(const IppsGFpECPoint* pP, const IppsGFpECPo
IPP_BADARG_RET( !ECP_POINT_TEST_ID(pP), ippStsContextMatchErr );
IPP_BADARG_RET( !ECP_POINT_TEST_ID(pQ), ippStsContextMatchErr );
- *pResult = cpEcGFpIsPointEquial(pP, pQ, pEC)? ippECPointIsEqual : ippECPointIsNotEqual;
+ IPP_BADARG_RET( ECP_POINT_FELEN(pP)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( ECP_POINT_FELEN(pQ)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+
+ *pResult = gfec_ComparePoint(pP, pQ, pEC)? ippECPointIsEqual : ippECPointIsNotEqual;
return ippStsNoErr;
}
-#if 0
IPPFUN(IppStatus, ippsGFpECTstPoint,(const IppsGFpECPoint* pP,
IppECResult* pResult,
- IppsGFpECState* pEC,
- Ipp8u* pScratchBuffer))
+ IppsGFpECState* pEC))
{
IPP_BAD_PTR3_RET(pP, pResult, pEC);
pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
IPP_BADARG_RET( !ECP_TEST_ID(pEC), ippStsContextMatchErr );
IPP_BADARG_RET( !ECP_POINT_TEST_ID(pP), ippStsContextMatchErr );
- {
- Ipp32u elemLen = GFP_FELEN(ECP_GFP(pEC));
+ IPP_BADARG_RET( ECP_POINT_FELEN(pP)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
- if( cpEcGFpIsProjectivePointAtInfinity(pP, elemLen) )
- *pResult = ippECPointIsAtInfinite;
- else if( !cpEcGFpIsPointOnCurve(pP, pEC) )
- *pResult = ippECPointIsNotValid;
- else {
- IppsGFpECPoint T;
- cpEcGFpInitPoint(&T, cpEcGFpGetPool(1, pEC),0, pEC);
- cpEcGFpMulPoint(&T, pP, ECP_R(pEC), BITS_BNU_CHUNK(ECP_ORDBITSIZE(pEC)), pEC, pScratchBuffer);
- *pResult = cpEcGFpIsProjectivePointAtInfinity(&T, elemLen)? ippECValid : ippECPointOutOfGroup;
- cpEcGFpReleasePool(1, pEC);
- }
+ if( gfec_IsPointAtInfinity(pP) )
+ *pResult = ippECPointIsAtInfinite;
+ else if( !gfec_IsPointOnCurve(pP, pEC) )
+ *pResult = ippECPointIsNotValid;
+ else
+ *pResult = ippECValid;
- return ippStsNoErr;
- }
+ return ippStsNoErr;
}
-#endif
-/*
-// Version below is based on observation has been done by Zhao Hui Du.
-// See "Opportunity to improve Intel(R) EPID 2.0 performance" Gentry Mark e-mail 1/23/20015.
-//
-// Shortly: In case of Intel(R) EPID 2.0 EC parameters all EC points belongs to G1.
-*/
-IPPFUN(IppStatus, ippsGFpECTstPoint,(const IppsGFpECPoint* pP,
- IppECResult* pResult,
- IppsGFpECState* pEC,
- Ipp8u* pScratchBuffer))
+IPPFUN(IppStatus, ippsGFpECTstPointInSubgroup,(const IppsGFpECPoint* pP,
+ IppECResult* pResult,
+ IppsGFpECState* pEC,
+ Ipp8u* pScratchBuffer))
{
- IPP_BAD_PTR3_RET(pP, pResult, pEC);
+ IPP_BAD_PTR4_RET(pP, pResult, pEC, pScratchBuffer);
pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
IPP_BADARG_RET( !ECP_TEST_ID(pEC), ippStsContextMatchErr );
IPP_BADARG_RET( !ECP_POINT_TEST_ID(pP), ippStsContextMatchErr );
+ IPP_BADARG_RET( ECP_POINT_FELEN(pP)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+
{
- Ipp32u elemLen = GFP_FELEN(ECP_GFP(pEC));
+ IppECResult tstResult;
+ ippsGFpECTstPoint(pP, &tstResult, pEC);
- if( cpEcGFpIsProjectivePointAtInfinity(pP, elemLen) )
- *pResult = ippECPointIsAtInfinite;
- else if( !cpEcGFpIsPointOnCurve(pP, pEC) )
- *pResult = ippECPointIsNotValid;
- else {
- if(EPID_PARAMS(pEC)&&GFP_IS_BASIC(ECP_GFP(pEC)))
- *pResult = ippECValid;
- else {
- IppsGFpECPoint T;
- cpEcGFpInitPoint(&T, cpEcGFpGetPool(1, pEC),0, pEC);
- cpEcGFpMulPoint(&T, pP, ECP_R(pEC), BITS_BNU_CHUNK(ECP_ORDBITSIZE(pEC)), pEC, pScratchBuffer);
- *pResult = cpEcGFpIsProjectivePointAtInfinity(&T, elemLen)? ippECValid : ippECPointOutOfGroup;
- cpEcGFpReleasePool(1, pEC);
- }
+ if(ippECValid==tstResult) {
+ IppsGFpECPoint T;
+ cpEcGFpInitPoint(&T, cpEcGFpGetPool(1, pEC),0, pEC);
+
+ gfec_MulPoint(&T, pP, MNT_MODULUS(ECP_MONT_R(pEC)), BITS_BNU_CHUNK(ECP_ORDBITSIZE(pEC)), pEC, pScratchBuffer);
+ tstResult = gfec_IsPointAtInfinity(&T)? ippECValid : ippECPointOutOfGroup;
+
+ cpEcGFpReleasePool(1, pEC);
}
+ *pResult = tstResult;
return ippStsNoErr;
}
@@ -324,7 +328,10 @@ IPPFUN(IppStatus, ippsGFpECNegPoint,(const IppsGFpECPoint* pP,
IPP_BADARG_RET( !ECP_POINT_TEST_ID(pP), ippStsContextMatchErr );
IPP_BADARG_RET( !ECP_POINT_TEST_ID(pR), ippStsContextMatchErr );
- cpEcGFpNegPoint(pR, pP, pEC);
+ IPP_BADARG_RET( ECP_POINT_FELEN(pP)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( ECP_POINT_FELEN(pR)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+
+ gfec_NegPoint(pR, pP, pEC);
return ippStsNoErr;
}
@@ -339,7 +346,14 @@ IPPFUN(IppStatus, ippsGFpECAddPoint,(const IppsGFpECPoint* pP, const IppsGFpECPo
IPP_BADARG_RET( !ECP_POINT_TEST_ID(pQ), ippStsContextMatchErr );
IPP_BADARG_RET( !ECP_POINT_TEST_ID(pR), ippStsContextMatchErr );
- cpEcGFpAddPoint(pR, pP, pQ, pEC);
+ IPP_BADARG_RET( ECP_POINT_FELEN(pP)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( ECP_POINT_FELEN(pQ)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( ECP_POINT_FELEN(pR)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+
+ if(pP==pQ)
+ gfec_DblPoint(pR, pP, pEC);
+ else
+ gfec_AddPoint(pR, pP, pQ, pEC);
return ippStsNoErr;
}
@@ -349,7 +363,7 @@ IPPFUN(IppStatus, ippsGFpECMulPoint,(const IppsGFpECPoint* pP,
IppsGFpECState* pEC,
Ipp8u* pScratchBuffer))
{
- IPP_BAD_PTR3_RET(pP, pR, pEC);
+ IPP_BAD_PTR4_RET(pP, pR, pEC, pScratchBuffer);
pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
IPP_BADARG_RET( !ECP_TEST_ID(pEC), ippStsContextMatchErr );
IPP_BADARG_RET( !ECP_POINT_TEST_ID(pP), ippStsContextMatchErr );
@@ -357,23 +371,37 @@ IPPFUN(IppStatus, ippsGFpECMulPoint,(const IppsGFpECPoint* pP,
IPP_BAD_PTR1_RET(pN);
pN = (IppsBigNumState*)( IPP_ALIGNED_PTR(pN, BN_ALIGNMENT) );
- /* test if N >= order */
- IPP_BADARG_RET(0<=cpCmp_BNU(BN_NUMBER(pN), BN_SIZE(pN), ECP_R(pEC), BITS_BNU_CHUNK(ECP_ORDBITSIZE(pEC))), ippStsOutOfRangeErr);
+ IPP_BADARG_RET(!BN_VALID_ID(pN), ippStsContextMatchErr );
+ IPP_BADARG_RET( BN_NEGATIVE(pN), ippStsBadArgErr );
+ IPP_BADARG_RET(BN_SIZE(pN)>2*GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+
+ IPP_BADARG_RET( ECP_POINT_FELEN(pP)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
+ IPP_BADARG_RET( ECP_POINT_FELEN(pR)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
- cpEcGFpMulPoint(pR, pP, BN_NUMBER(pN), BN_SIZE(pN), pEC, pScratchBuffer);
+ gfec_MulPoint(pR, pP, BN_NUMBER(pN), BN_SIZE(pN), pEC, pScratchBuffer);
return ippStsNoErr;
}
-IPPFUN(IppStatus, ippsGFpECSetPointHash,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppHashID hashID, IppsGFpECPoint* pPoint,
- IppsGFpECState* pEC,
+IPPFUN(IppStatus, ippsGFpECSetPointHash,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint,
+ IppsGFpECState* pEC, IppHashAlgId hashID,
Ipp8u* pScratchBuffer))
{
- IPP_BAD_PTR2_RET(pPoint, pEC);
+ /* get algorithm id */
+ hashID = cpValidHashAlg(hashID);
+ IPP_BADARG_RET(ippHashAlg_Unknown==hashID, ippStsNotSupportedModeErr);
+
+ /* test message length */
+ IPP_BADARG_RET((msgLen<0), ippStsLengthErr);
+ /* test message pointer */
+ IPP_BADARG_RET((msgLen && !pMsg), ippStsNullPtrErr);
+
+ IPP_BAD_PTR3_RET(pPoint, pEC, pScratchBuffer);
pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
IPP_BADARG_RET( !ECP_TEST_ID(pEC), ippStsContextMatchErr );
IPP_BADARG_RET( !GFP_IS_BASIC(ECP_GFP(pEC)), ippStsBadArgErr );
IPP_BADARG_RET( !ECP_POINT_TEST_ID(pPoint), ippStsContextMatchErr );
- IPP_BADARG_RET( !cpTestHashID(hashID), ippStsBadArgErr);
+
+ IPP_BADARG_RET( ECP_POINT_FELEN(pPoint)!=GFP_FELEN(ECP_GFP(pEC)), ippStsOutOfRangeErr);
{
IppsGFpState* pGF = ECP_GFP(pEC);
@@ -381,12 +409,12 @@ IPPFUN(IppStatus, ippsGFpECSetPointHash,(Ipp32u hdr, const Ipp8u* pMsg, int msgL
BNU_CHUNK_T* pModulus = GFP_MODULUS(pGF);
Ipp8u md[IPP_SHA512_DIGEST_BITSIZE/BYTESIZE];
- int hashLen = cpHashLength(hashID);
+ int hashLen = cpHashAlgAttr[hashID].hashSize;
BNU_CHUNK_T hashVal[BITS_BNU_CHUNK(IPP_SHA512_DIGEST_BITSIZE)+1];
int hashValLen;
- Ipp8u hashCtx[sizeof(IppsSHA512State)+SHA512_ALIGNMENT-1];
- cpHashInit(hashCtx, hashID);
+ IppsHashState hashCtx;
+ ippsHashInit(&hashCtx, hashID);
{
BNU_CHUNK_T* pPoolElm = cpGFpGetPool(1, pGF);
@@ -397,23 +425,23 @@ IPPFUN(IppStatus, ippsGFpECSetPointHash,(Ipp32u hdr, const Ipp8u* pMsg, int msgL
cpToOctStr_BNU(hdrOctStr, sizeof(hdrOctStr), &locHdr, 1);
/* compute md = hash(hrd||msg) */
- cpHashUpdate(hdrOctStr, sizeof(hdrOctStr), hashCtx, hashID);
- cpHashUpdate(pMsg, msgLen, hashCtx, hashID);
- cpHashFinal(md, hashCtx, hashID);
+ ippsHashUpdate(hdrOctStr, sizeof(hdrOctStr), &hashCtx);
+ ippsHashUpdate(pMsg, msgLen, &hashCtx);
+ ippsHashFinal(md, &hashCtx);
/* convert hash into the integer */
hashValLen = cpFromOctStr_BNU(hashVal, md, hashLen);
hashValLen = cpMod_BNU(hashVal, hashValLen, pModulus, elemLen);
- cpGFpSet(pPoolElm, hashVal, hashValLen, pGF, USE_MONT_SPACE_REPRESENTATION);
+ cpGFpSet(pPoolElm, hashVal, hashValLen, pGF);
- if( cpEcGFpMakePoint(pPoint, pPoolElm, pEC)) {
+ if( gfec_MakePoint(pPoint, pPoolElm, pEC)) {
/* set y-coordinate of the point (positive or negative) */
BNU_CHUNK_T* pY = ECP_POINT_Y(pPoint);
if(pY[0] & 1)
cpGFpNeg(pY, pY, pGF);
/* update point if cofactor>1 */
- cpEcGFpMulPoint(pPoint, pPoint, ECP_COFACTOR(pEC), GFP_FELEN(pGF), pEC, pScratchBuffer);
+ gfec_MulPoint(pPoint, pPoint, ECP_COFACTOR(pEC), GFP_FELEN(pGF), pEC, pScratchBuffer);
cpGFpReleasePool(1, pGF);
return ippStsNoErr;
diff --git a/ext/ipp/sources/ippcp/src/pcpgfpecpointstuff.c b/ext/ipp/sources/ippcp/src/pcpgfpecpointstuff.c
new file mode 100644
index 0000000..1aca04a
--- /dev/null
+++ b/ext/ipp/sources/ippcp/src/pcpgfpecpointstuff.c
@@ -0,0 +1,1149 @@
+/*############################################################################
+ # Copyright 2010-2017 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.
+ ############################################################################*/
+
+/*
+//
+// Purpose:
+// Intel(R) Performance Primitives. Cryptography Primitives.
+// Internal EC over GF(p^m) basic Definitions & Function Prototypes
+//
+// Context:
+// gfec_MakePoint()
+// gfec_SetPoint
+// gfec_GetPoint
+//
+// gfec_ComparePoint()
+// gfec_IsPointOnCurve()
+//
+// gfec_NegPoint()
+// cpEcGFpDblPoint()
+// gfec_AddPoint()
+// gfec_MulPoint()
+//
+//
+//
+*/
+
+#include "owndefs.h"
+#include "owncp.h"
+
+#include "pcpgfpecstuff.h"
+
+
+int gfec_MakePoint(IppsGFpECPoint* pPoint, const BNU_CHUNK_T* pElm, IppsGFpECState* pEC)
+{
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ int elemLen = GFP_FELEN(pGF);
+
+ BNU_CHUNK_T* pX = ECP_POINT_X(pPoint);
+ BNU_CHUNK_T* pY = ECP_POINT_Y(pPoint);
+ BNU_CHUNK_T* pZ = ECP_POINT_Z(pPoint);
+
+ /* set x-coordinate */
+ cpGFpElementCopy(pX, pElm, elemLen);
+
+ /* T = X^3 + A*X + B */
+ pGF->sqr(pY, pX, pGF);
+ pGF->mul(pY, pY, pX, pGF);
+ if(ECP_SPECIFIC(pEC)!=ECP_EPID2) {
+ pGF->mul(pZ, ECP_A(pEC), pX, pGF);
+ pGF->add(pY, pY, pZ, pGF);
+ }
+ pGF->add(pY, pY, ECP_B(pEC), pGF);
+
+ /* set z-coordinate =1 */
+ cpGFpElementCopyPadd(pZ, elemLen, MNT_1(GFP_MONT(pGF)), GFP_FELEN(pGF));
+
+ /* Y = sqrt(Y) */
+ if( cpGFpSqrt(pY, pY, pGF) ) {
+ ECP_POINT_FLAGS(pPoint) = ECP_AFFINE_POINT | ECP_FINITE_POINT;
+ return 1;
+ }
+ else {
+ gfec_SetPointAtInfinity(pPoint);
+ return 0;
+ }
+}
+
+int gfec_IsAffinePointAtInfinity(int ecInfinity,
+ const BNU_CHUNK_T* pX, const BNU_CHUNK_T* pY,
+ const IppsGFpState* pGF)
+{
+ BNU_CHUNK_T* tmpY = GFP_POOL(pGF);
+ int elmLen = GFP_FELEN(pGF);
+
+ /* set tmpY either:
+ // 0, if ec.b !=0
+ // mont(1) if ec.b ==0
+ */
+ cpGFpElementPadd(tmpY, elmLen, 0);
+ if(ecInfinity) {
+ IppsGFpState* pBasicGF = cpGFpBasic(pGF);
+ int basicElmLen = GFP_FELEN(pBasicGF);
+ BNU_CHUNK_T* mont1 = MNT_1(GFP_MONT(pBasicGF));
+ cpGFpElementCopyPadd(tmpY, elmLen, mont1, basicElmLen);
+ }
+
+ /* check if (x,y) represents point at infinity */
+ return GFP_IS_ZERO(pX,elmLen) && GFP_EQ(pY, tmpY, elmLen);
+}
+
+/* returns: 1/0 if set up finite/infinite point */
+int gfec_SetPoint(BNU_CHUNK_T* pPointData,
+ const BNU_CHUNK_T* pX, const BNU_CHUNK_T* pY,
+ IppsGFpECState* pEC)
+{
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ int elmLen = GFP_FELEN(pGF);
+
+ int finite_point= !gfec_IsAffinePointAtInfinity(ECP_INFINITY(pEC), pX, pY, pGF);
+ if(finite_point) {
+ IppsGFpState* pBasicGF = cpGFpBasic(pGF);
+ cpGFpElementCopy(pPointData, pX, elmLen);
+ cpGFpElementCopy(pPointData+elmLen, pY, elmLen);
+ cpGFpElementCopyPadd(pPointData+elmLen*2, elmLen, MNT_1(GFP_MONT(pBasicGF)), GFP_FELEN(pBasicGF));
+ }
+ else
+ cpGFpElementPadd(pPointData, 3*elmLen, 0);
+
+ return finite_point;
+}
+
+
+#if ( ECP_PROJECTIVE_COORD == JACOBIAN )
+/* returns 1/0 if point is finite/infinite */
+int gfec_GetPoint(BNU_CHUNK_T* pX, BNU_CHUNK_T* pY, const IppsGFpECPoint* pPoint, IppsGFpECState* pEC)
+{
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ int elemLen = GFP_FELEN(pGF);
+
+ if( !IS_ECP_FINITE_POINT(pPoint) ) {
+ if(pX) cpGFpElementPadd(pX, elemLen, 0);
+ if(pY) cpGFpElementPadd(pY, elemLen, 0);
+ return 0;
+ }
+
+ /* affine point (1==Z) */
+ if( IS_ECP_AFFINE_POINT(pPoint) ) {
+ if(pX)
+ cpGFpElementCopy(pX, ECP_POINT_X(pPoint), elemLen);
+ if(pY)
+ cpGFpElementCopy(pY, ECP_POINT_Y(pPoint), elemLen);
+ return 1;
+ }
+
+ /* projective point (1!=Z) */
+ {
+ /* T = (1/Z)*(1/Z) */
+ BNU_CHUNK_T* pT = cpGFpGetPool(1, pGF);
+ BNU_CHUNK_T* pZinv = cpGFpGetPool(1, pGF);
+ BNU_CHUNK_T* pU = cpGFpGetPool(1, pGF);
+ cpGFpxInv(pZinv, ECP_POINT_Z(pPoint), pGF);
+ pGF->sqr(pT, pZinv, pGF);
+
+ if(pX) {
+ pGF->mul(pU, ECP_POINT_X(pPoint), pT, pGF);
+ cpGFpElementCopy(pX, pU, elemLen);
+ }
+ if(pY) {
+ pGF->mul(pT, pZinv, pT, pGF);
+ pGF->mul(pU, ECP_POINT_Y(pPoint), pT, pGF);
+ cpGFpElementCopy(pY, pU, elemLen);
+ }
+
+ cpGFpReleasePool(3, pGF);
+ return 1;
+ }
+}
+#endif
+
+
+#if ( ECP_PROJECTIVE_COORD == JACOBIAN )
+int gfec_ComparePoint(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECState* pEC)
+{
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ int elemLen = GFP_FELEN(pGF);
+
+ /* P or/and Q at Infinity */
+ if( !IS_ECP_FINITE_POINT(pP) )
+ return !IS_ECP_FINITE_POINT(pQ)? 1:0;
+ if( !IS_ECP_FINITE_POINT(pQ) )
+ return !IS_ECP_FINITE_POINT(pP)? 1:0;
+
+ /* Px==Qx && Py==Qy && Pz==Qz */
+ if( GFP_EQ(ECP_POINT_Z(pP), ECP_POINT_Z(pQ), elemLen)
+ &&GFP_EQ(ECP_POINT_X(pP), ECP_POINT_X(pQ), elemLen)
+ &&GFP_EQ(ECP_POINT_Y(pP), ECP_POINT_Y(pQ), elemLen))
+ return 1;
+
+ else {
+ int isEqu = 1;
+
+ BNU_CHUNK_T* pPtmp = cpGFpGetPool(1, pGF);
+ BNU_CHUNK_T* pQtmp = cpGFpGetPool(1, pGF);
+ BNU_CHUNK_T* pPz = cpGFpGetPool(1, pGF);
+ BNU_CHUNK_T* pQz = cpGFpGetPool(1, pGF);
+
+ if(isEqu) {
+ /* Px*Qz^2 ~ Qx*Pz^2 */
+ if( IS_ECP_AFFINE_POINT(pQ) ) /* Ptmp = Px * Qz^2 */
+ cpGFpElementCopy(pPtmp, ECP_POINT_X(pP), elemLen);
+ else {
+ pGF->sqr(pQz, ECP_POINT_Z(pQ), pGF);
+ pGF->mul(pPtmp, ECP_POINT_X(pP), pQz, pGF);
+ }
+ if( IS_ECP_AFFINE_POINT(pP) ) /* Qtmp = Qx * Pz^2 */
+ cpGFpElementCopy(pQtmp, ECP_POINT_X(pQ), elemLen);
+ else {
+ pGF->sqr(pPz, ECP_POINT_Z(pP), pGF);
+ pGF->mul(pQtmp, ECP_POINT_X(pQ), pPz, pGF);
+ }
+ isEqu = GFP_EQ(pPtmp, pQtmp, elemLen);
+ }
+
+ if(isEqu) {
+ /* Py*Qz^3 ~ Qy*Pz^3 */
+ if( IS_ECP_AFFINE_POINT(pQ) ) /* Ptmp = Py * Qz^3 */
+ cpGFpElementCopy(pPtmp, ECP_POINT_Y(pP), elemLen);
+ else {
+ pGF->mul(pQz, ECP_POINT_Z(pQ), pQz, pGF);
+ pGF->mul(pPtmp, pQz, ECP_POINT_Y(pP), pGF);
+ }
+ if( IS_ECP_AFFINE_POINT(pP) ) /* Qtmp = Qy * Pz^3 */
+ cpGFpElementCopy(pQtmp, ECP_POINT_Y(pQ), elemLen);
+ else {
+ pGF->mul(pPz, ECP_POINT_Z(pP), pPz, pGF);
+ pGF->mul(pQtmp, pPz, ECP_POINT_Y(pQ), pGF);
+ }
+ isEqu = GFP_EQ(pPtmp, pQtmp, elemLen);
+ }
+
+ cpGFpReleasePool(4, pGF);
+ return isEqu;
+ }
+}
+#endif
+
+
+#if ( ECP_PROJECTIVE_COORD == JACOBIAN )
+int gfec_IsPointOnCurve(const IppsGFpECPoint* pPoint, IppsGFpECState* pEC)
+{
+ /* point at infinity does not belong curve */
+ if( !IS_ECP_FINITE_POINT(pPoint) )
+ //return 1;
+ return 0;
+
+ /* test that 0 == R = (Y^2) - (X^3 + A*X*(Z^4) + B*(Z^6)) */
+ else {
+ int isOnCurve = 0;
+
+ IppsGFpState* pGF = ECP_GFP(pEC);
+
+ BNU_CHUNK_T* pX = ECP_POINT_X(pPoint);
+ BNU_CHUNK_T* pY = ECP_POINT_Y(pPoint);
+ BNU_CHUNK_T* pZ = ECP_POINT_Z(pPoint);
+
+ BNU_CHUNK_T* pR = cpGFpGetPool(1, pGF);
+ BNU_CHUNK_T* pT = cpGFpGetPool(1, pGF);
+
+ pGF->sqr(pR, pY, pGF); /* R = Y^2 */
+ pGF->sqr(pT, pX, pGF); /* T = X^3 */
+ pGF->mul(pT, pX, pT, pGF);
+ pGF->sub(pR, pR, pT, pGF); /* R -= T */
+
+ if( IS_ECP_AFFINE_POINT(pPoint) ) {
+ pGF->mul(pT, pX, ECP_A(pEC), pGF); /* T = A*X */
+ pGF->sub(pR, pR, pT, pGF); /* R -= T */
+ pGF->sub(pR, pR, ECP_B(pEC), pGF); /* R -= B */
+ }
+ else {
+ BNU_CHUNK_T* pZ4 = cpGFpGetPool(1, pGF);
+ BNU_CHUNK_T* pZ6 = cpGFpGetPool(1, pGF);
+
+ pGF->sqr(pZ6, pZ, pGF); /* Z^2 */
+ pGF->sqr(pZ4, pZ6, pGF); /* Z^4 */
+ pGF->mul(pZ6, pZ6, pZ4, pGF); /* Z^6 */
+
+ pGF->mul(pZ4, pZ4, pX, pGF); /* X*(Z^4) */
+ pGF->mul(pZ4, pZ4, ECP_A(pEC), pGF); /* A*X*(Z^4) */
+ pGF->mul(pZ6, pZ6, ECP_B(pEC), pGF); /* B*(Z^4) */
+
+ pGF->sub(pR, pR, pZ4, pGF); /* R -= A*X*(Z^4) */
+ pGF->sub(pR, pR, pZ6, pGF); /* R -= B*(Z^6) */
+
+ cpGFpReleasePool(2, pGF);
+ }
+
+ isOnCurve = GFP_IS_ZERO(pR, GFP_FELEN(pGF));
+ cpGFpReleasePool(2, pGF);
+ return isOnCurve;
+ }
+}
+#endif
+
+IppsGFpECPoint* gfec_NegPoint(IppsGFpECPoint* pR,
+ const IppsGFpECPoint* pP, IppsGFpECState* pEC)
+{
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ int elmLen = GFP_FELEN(pGF);
+ if(pR!=pP)
+ gfec_CopyPoint(pR, pP, elmLen);
+ pGF->neg(ECP_POINT_Y(pR), ECP_POINT_Y(pP), pGF);
+ return pR;
+}
+
+
+#if ( ECP_PROJECTIVE_COORD == JACOBIAN )
+/*
+// A = 4*x*y^2
+// B = 3*x^2 + a*z^4
+//
+// x3 = -2*A + B^2
+// y3 = -8y^4 +B*(A-x3)
+// z3 = 2*y*z
+//
+// complexity: = 4s+4m (NIST's, SM2 curves)
+// = (EPID2 curve)
+// = 6s+4m (arbitrary curves)
+*/
+static void gfec_point_double(BNU_CHUNK_T* pRdata, const BNU_CHUNK_T* pPdata, IppsGFpECState* pEC)
+{
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ int elemLen = GFP_FELEN(pGF);
+
+ gfadd add = pGF->add; /* gf add */
+ gfsub sub = pGF->sub; /* gf sub */
+ gfdiv2 div2= pGF->div2; /* gf div2 */
+ gfmul2 mul2= pGF->mul2; /* gf mul2 */
+ gfmul3 mul3= pGF->mul3; /* gf mul3 */
+ gfmul mul = pGF->mul; /* gf mul */
+ gfsqr sqr = pGF->sqr; /* gf sqr */
+
+ const BNU_CHUNK_T* pX = pPdata;
+ const BNU_CHUNK_T* pY = pPdata+elemLen;
+ const BNU_CHUNK_T* pZ = pPdata+2*+elemLen;
+
+ BNU_CHUNK_T* rX = pRdata;
+ BNU_CHUNK_T* rY = pRdata+elemLen;
+ BNU_CHUNK_T* rZ = pRdata+2*elemLen;
+
+ /* get temporary from top of EC point pool */
+ BNU_CHUNK_T* U = pEC->pPool;
+ BNU_CHUNK_T* M = U+elemLen;
+ BNU_CHUNK_T* S = M+elemLen;
+
+ mul2(S, pY, pGF); /* S = 2*Y */
+ sqr(U, pZ, pGF); /* U = Z^2 */
+
+ sqr(M, S, pGF); /* M = 4*Y^2 */
+ mul(rZ, S, pZ, pGF); /* Zres = 2*Y*Z */
+
+ sqr(rY, M, pGF); /* Yres = 16*Y^4 */
+
+ mul(S, M, pX, pGF); /* S = 4*X*Y^2 */
+ div2(rY, rY, pGF); /* Yres = 8*Y^4 */
+
+ if(ECP_STD==ECP_SPECIFIC(pEC)) {
+ add(M, pX, U, pGF); /* M = 3*(X^2-Z^4) */
+ sub(U, pX, U, pGF);
+ mul(M, M, U, pGF);
+ mul3(M, M, pGF);
+ }
+ else {
+ sqr(M, pX, pGF); /* M = 3*X^2 */
+ mul3(M, M, pGF);
+ if(ECP_EPID2!=ECP_SPECIFIC(pEC)) {
+ sqr(U, U, pGF); /* M = 3*X^2+a*Z4 */
+ mul(U, U, ECP_A(pEC), pGF);
+ add(M, M, U, pGF);
+ }
+ }
+
+ mul2(U, S, pGF); /* U = 8*X*Y^2 */
+ sqr(rX, M, pGF); /* Xres = M^2 */
+ sub(rX, rX, U, pGF); /* Xres = M^2-U */
+
+ sub(S, S, rX, pGF); /* S = 4*X*Y^2-Xres */
+ mul(S, S, M, pGF); /* S = M*(4*X*Y^2-Xres) */
+ sub(rY, S, rY, pGF); /* Yres = M*(4*X*Y^2-Xres) -8*Y^4 */
+}
+#endif
+
+IppsGFpECPoint* gfec_DblPoint(IppsGFpECPoint* pR,
+ const IppsGFpECPoint* pP, IppsGFpECState* pEC)
+{
+ gfec_point_double(ECP_POINT_X(pR), ECP_POINT_X(pP), pEC);
+ ECP_POINT_FLAGS(pR) = gfec_IsPointAtInfinity(pR)? 0 : ECP_FINITE_POINT;
+ return pR;
+}
+
+
+#if ( ECP_PROJECTIVE_COORD == JACOBIAN )
+/*
+// S1 = y1*z2^3
+// S2 = y2*z1^3
+//
+// U1 = x1*z2^2
+// U2 = x2*z1^2
+
+// R = S2-S1
+// H = U2-U1
+//
+// x3 = -H^3 -2*U1*H^2 +R2
+// y3 = -S1*H^3 +R*(U1*H^2 -x3)
+// z3 = z1*z2*H
+//
+// complexity = 4s+12m
+*/
+static void gfec_point_add(BNU_CHUNK_T* pRdata, const BNU_CHUNK_T* pPdata, const BNU_CHUNK_T* pQdata, IppsGFpECState* pEC)
+{
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ int elemLen = GFP_FELEN(pGF);
+
+ gfsub sub = pGF->sub; /* gf sub */
+ gfmul2 mul2= pGF->mul2; /* gf mul2 */
+ gfmul mul = pGF->mul; /* gf mul */
+ gfsqr sqr = pGF->sqr; /* gf sqr */
+
+ /* coordinates of P */
+ const BNU_CHUNK_T* px1 = pPdata;
+ const BNU_CHUNK_T* py1 = pPdata+elemLen;
+ const BNU_CHUNK_T* pz1 = pPdata+2*elemLen;
+
+ /* coordinates of Q */
+ const BNU_CHUNK_T* px2 = pQdata;
+ const BNU_CHUNK_T* py2 = pQdata+elemLen;
+ const BNU_CHUNK_T* pz2 = pQdata+2*elemLen;
+
+ int inftyP = GFP_IS_ZERO(pz1, elemLen);
+ int inftyQ = GFP_IS_ZERO(pz2, elemLen);
+
+ /* get temporary from top of EC point pool */
+ BNU_CHUNK_T* U1 = pEC->pPool;
+ BNU_CHUNK_T* U2 = U1 + elemLen;
+ BNU_CHUNK_T* S1 = U2 + elemLen;
+ BNU_CHUNK_T* S2 = S1 + elemLen;
+ BNU_CHUNK_T* H = S2 + elemLen;
+ BNU_CHUNK_T* R = H + elemLen;
+
+ BNU_CHUNK_T* pRx = R + elemLen; /* temporary result */
+ BNU_CHUNK_T* pRy = pRx+ elemLen;
+ BNU_CHUNK_T* pRz = pRy+ elemLen;
+
+ mul(S1, py1, pz2, pGF); // S1 = Y1*Z2
+ sqr(U1, pz2, pGF); // U1 = Z2^2
+
+ mul(S2, py2, pz1, pGF); // S2 = Y2*Z1
+ sqr(U2, pz1, pGF); // U2 = Z1^2
+
+ mul(S1, S1, U1, pGF); // S1 = Y1*Z2^3
+ mul(S2, S2, U2, pGF); // S2 = Y2*Z1^3
+
+ mul(U1, px1, U1, pGF); // U1 = X1*Z2^2
+ mul(U2, px2, U2, pGF); // U2 = X2*Z1^2
+
+ sub(R, S2, S1, pGF); // R = S2-S1
+ sub(H, U2, U1, pGF); // H = U2-U1
+
+ if( GFP_IS_ZERO(H, elemLen) && !inftyP && !inftyQ ) {
+ if( GFP_IS_ZERO(R, elemLen) )
+ gfec_point_double(pRdata, pPdata, pEC);
+ else
+ cpGFpElementPadd(pRdata, 3*elemLen, 0);
+ return;
+ }
+
+ mul(pRz, pz1, pz2, pGF); // Z3 = Z1*Z2
+ sqr(U2, H, pGF); // U2 = H^2
+ mul(pRz, pRz, H, pGF); // Z3 = (Z1*Z2)*H
+ sqr(S2, R, pGF); // S2 = R^2
+ mul(H, H, U2, pGF); // H = H^3
+
+ mul(U1, U1, U2, pGF); // U1 = U1*H^2
+ sub(pRx, S2, H, pGF); // X3 = R^2 - H^3
+ mul2(U2, U1, pGF); // U2 = 2*U1*H^2
+ mul(S1, S1, H, pGF); // S1 = S1*H^3
+ sub(pRx, pRx, U2, pGF); // X3 = (R^2 - H^3) -2*U1*H^2
+
+ sub(pRy, U1, pRx, pGF); // Y3 = R*(U1*H^2 - X3) -S1*H^3
+ mul(pRy, pRy, R, pGF);
+ sub(pRy, pRy, S1, pGF);
+
+ cpMaskMove(pRx, px2, elemLen*3, inftyP);
+ cpMaskMove(pRx, px1, elemLen*3, inftyQ);
+
+ cpGFpElementCopy(pRdata, pRx, 3*elemLen);
+}
+
+/*
+// complexity = 3s+8m
+*/
+static void gfec_affine_point_add(BNU_CHUNK_T* pRdata, const BNU_CHUNK_T* pPdata, const BNU_CHUNK_T* pAdata, IppsGFpECState* pEC)
+{
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ int elemLen = GFP_FELEN(pGF);
+ BNU_CHUNK_T* mont1 = MNT_1(GFP_MONT(pGF));
+
+ gfsub sub = pGF->sub; /* gf sub */
+ gfmul2 mul2= pGF->mul2; /* gf mul2 */
+ gfmul mul = pGF->mul; /* gf mul */
+ gfsqr sqr = pGF->sqr; /* gf sqr */
+
+ /* coordinates of projective P point */
+ const BNU_CHUNK_T* px = pPdata; /* x1 */
+ const BNU_CHUNK_T* py = pPdata+elemLen; /* y1 */
+ const BNU_CHUNK_T* pz = pPdata+2*elemLen; /* z1 */
+
+ /* coordinates of affine A point, az==mont(1) */
+ const BNU_CHUNK_T* ax = pAdata; /* x2 */
+ const BNU_CHUNK_T* ay = pAdata+elemLen; /* y2 */
+
+ int inftyP = GFP_IS_ZERO(px, elemLen) && GFP_IS_ZERO(py, elemLen);
+ int inftyA = GFP_IS_ZERO(ax, elemLen) && GFP_IS_ZERO(ay, elemLen);
+
+ /* get temporary from top of EC point pool */
+ BNU_CHUNK_T* U2 = pEC->pPool;
+ BNU_CHUNK_T* S2 = U2 + elemLen;
+ BNU_CHUNK_T* H = S2 + elemLen;
+ BNU_CHUNK_T* R = H + elemLen;
+
+ BNU_CHUNK_T* pRx = R + elemLen; /* temporary result */
+ BNU_CHUNK_T* pRy = pRx+ elemLen;
+ BNU_CHUNK_T* pRz = pRy+ elemLen;
+
+ sqr(R, pz, pGF); // R = Z1^2
+ mul(S2, ay, pz, pGF); // S2 = Y2*Z1
+ mul(U2, ax, R, pGF); // U2 = X2*Z1^2
+ mul(S2, S2, R, pGF); // S2 = Y2*Z1^3
+
+ sub(H, U2, px, pGF); // H = U2-X1
+ sub(R, S2, py, pGF); // R = S2-Y1
+
+ mul(pRz, H, pz, pGF); // Z3 = H*Z1
+
+ sqr(U2, H, pGF); // U2 = H^2
+ sqr(S2, R, pGF); // S2 = R^2
+ mul(H, H, U2, pGF); // H = H^3
+
+ mul(U2, U2, px, pGF); // U2 = X1*H^2
+
+ mul(pRy, H, py, pGF); // T = Y1*H^3
+
+ mul2(pRx, U2, pGF); // X3 = 2*X1*H^2
+ sub(pRx, S2, pRx, pGF); // X3 = R^2 - 2*X1*H^2
+ sub(pRx, pRx, H, pGF); // X3 = R^2 - 2*X1*H^2 -H^3
+
+ sub(U2, U2, pRx, pGF); // U2 = X1*H^2 - X3
+ mul(U2, U2, R, pGF); // U2 = R*(X1*H^2 - X3)
+ sub(pRy, U2, pRy, pGF); // Y3 = -Y1*H^3 + R*(X1*H^2 - X3)
+
+ cpMaskMove(pRx, ax, elemLen, inftyP);
+ cpMaskMove(pRy, ay, elemLen, inftyP);
+ cpMaskMove(pRz, mont1, elemLen, inftyP);
+ cpMaskMove(pRz, ax, elemLen, inftyP&inftyA);
+
+ cpMaskMove(pRx, px, elemLen*3, inftyA);
+
+ cpGFpElementCopy(pRdata, pRx, 3*elemLen);
+}
+#endif
+
+IppsGFpECPoint* gfec_AddPoint(IppsGFpECPoint* pR,
+ const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ,
+ IppsGFpECState* pEC)
+{
+ gfec_point_add(ECP_POINT_X(pR), ECP_POINT_X(pP), ECP_POINT_X(pQ), pEC);
+ ECP_POINT_FLAGS(pR) = gfec_IsPointAtInfinity(pR)? 0 : ECP_FINITE_POINT;
+ return pR;
+}
+
+
+/* sscm version */
+static void setupTable(BNU_CHUNK_T* pTbl,
+ const BNU_CHUNK_T* pPdata,
+ IppsGFpECState* pEC)
+{
+ int pointLen = ECP_POINTLEN(pEC);
+ int pointLen32 = pointLen*sizeof(BNU_CHUNK_T)/sizeof(ipp32u);
+
+ const int npoints = 3;
+ BNU_CHUNK_T* A = cpEcGFpGetPool(npoints, pEC);
+ BNU_CHUNK_T* B = A+pointLen;
+ BNU_CHUNK_T* C = B+pointLen;
+
+ // Table[0]
+ // Table[0] is implicitly (0,0,0) {point at infinity}, therefore no need to store it
+ // All other values are actually stored with an offset of -1
+
+ // Table[1] ( =[1]p )
+ cpScatter32((Ipp32u*)pTbl, 16, 0, (Ipp32u*)pPdata, pointLen32);
+
+ // Table[2] ( =[2]p )
+ gfec_point_double(A, pPdata, pEC);
+ cpScatter32((Ipp32u*)pTbl, 16, 1, (Ipp32u*)A, pointLen32);
+
+ // Table[3] ( =[3]p )
+ gfec_point_add(B, A, pPdata, pEC);
+ cpScatter32((Ipp32u*)pTbl, 16, 2, (Ipp32u*)B, pointLen32);
+
+ // Table[4] ( =[4]p )
+ gfec_point_double(A, A, pEC);
+ cpScatter32((Ipp32u*)pTbl, 16, 3, (Ipp32u*)A, pointLen32);
+
+ // Table[5] ( =[5]p )
+ gfec_point_add(C, A, pPdata, pEC);
+ cpScatter32((Ipp32u*)pTbl, 16, 4, (Ipp32u*)C, pointLen32);
+
+ // Table[10] ( =[10]p )
+ gfec_point_double(C, C, pEC);
+ cpScatter32((Ipp32u*)pTbl, 16, 9, (Ipp32u*)C, pointLen32);
+
+ // Table[11] ( =[11]p )
+ gfec_point_add(C, C, pPdata, pEC);
+ cpScatter32((Ipp32u*)pTbl, 16, 10, (Ipp32u*)C, pointLen32);
+
+ // Table[6] ( =[6]p )
+ gfec_point_double(B, B, pEC);
+ cpScatter32((Ipp32u*)pTbl, 16, 5, (Ipp32u*)B, pointLen32);
+
+ // Table[7] ( =[7]p )
+ gfec_point_add(C, B, pPdata, pEC);
+ cpScatter32((Ipp32u*)pTbl, 16, 6, (Ipp32u*)C, pointLen32);
+
+ // Table[14] ( =[14]p )
+ gfec_point_double(C, C, pEC);
+ cpScatter32((Ipp32u*)pTbl, 16, 13, (Ipp32u*)C, pointLen32);
+
+ // Table[15] ( =[15]p )
+ gfec_point_add(C, C, pPdata, pEC);
+ cpScatter32((Ipp32u*)pTbl, 16, 14, (Ipp32u*)C, pointLen32);
+
+ // Table[12] ( =[12]p )
+ gfec_point_double(B, B, pEC);
+ cpScatter32((Ipp32u*)pTbl, 16, 11, (Ipp32u*)B, pointLen32);
+
+ // Table[13] ( =[13]p )
+ gfec_point_add(B, B, pPdata, pEC);
+ cpScatter32((Ipp32u*)pTbl, 16, 12, (Ipp32u*)B, pointLen32);
+
+ // Table[8] ( =[8]p )
+ gfec_point_double(A, A, pEC);
+ cpScatter32((Ipp32u*)pTbl, 16, 7, (Ipp32u*)A, pointLen32);
+
+ // Table[9] ( =[9]p )
+ gfec_point_add(B, A, pPdata, pEC);
+ cpScatter32((Ipp32u*)pTbl, 16, 8, (Ipp32u*)B, pointLen32);
+
+ // Table[16] ( =[16]p )
+ gfec_point_double(A, A, pEC);
+ cpScatter32((Ipp32u*)pTbl, 16, 15, (Ipp32u*)A, pointLen32);
+
+ cpEcGFpReleasePool(npoints, pEC);
+}
+
+
+static void gfec_point_mul(BNU_CHUNK_T* pRdata,
+ const BNU_CHUNK_T* pPdata,
+ const Ipp8u* pScalar8, int scalarBitSize,
+ IppsGFpECState* pEC, Ipp8u* pScratchBuffer)
+{
+ int pointLen = ECP_POINTLEN(pEC);
+ int pointLen32 = pointLen*sizeof(BNU_CHUNK_T)/sizeof(Ipp32u);
+
+ /* optimal size of window */
+ const int window_size = (NULL==pScratchBuffer)? 1 : 5;
+ /* number of table entries */
+ const int tableLen = 1<<(window_size-1);
+
+ /* aligned pre-computed table */
+ BNU_CHUNK_T* pTable = (BNU_CHUNK_T*)IPP_ALIGNED_PTR(pScratchBuffer, CACHE_LINE_SIZE);
+ setupTable(pTable, pPdata, pEC);
+
+ {
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ int elemLen = GFP_FELEN(pGF);
+ BNU_CHUNK_T* pHy = cpGFpGetPool(1, pGF);
+
+ BNU_CHUNK_T* pTdata = cpEcGFpGetPool(1, pEC); /* points from the pool */
+ BNU_CHUNK_T* pHdata = cpEcGFpGetPool(1, pEC);
+
+ Ipp8u digit, sign;
+ int mask = (1<<(window_size+1)) -1;
+ int bit = scalarBitSize-(scalarBitSize%window_size);
+
+ /* first window */
+ int wvalue = *((Ipp16u*)&pScalar8[(bit-1)/8]);
+ wvalue = (wvalue>> ((bit-1)%8)) & mask;
+ booth_recode(&sign, &digit, (Ipp8u)wvalue, window_size);
+ cpGather32((Ipp32u*)pTdata, pointLen32, (Ipp32u*)pTable, tableLen, digit);
+
+ for(bit-=window_size; bit>=window_size; bit-=window_size) {
+ gfec_point_double(pTdata, pTdata, pEC); //it's better to have separate calls
+ gfec_point_double(pTdata, pTdata, pEC); // instead of gfec_point_double_k()
+ gfec_point_double(pTdata, pTdata, pEC);
+ gfec_point_double(pTdata, pTdata, pEC);
+ gfec_point_double(pTdata, pTdata, pEC);
+
+ wvalue = *((Ipp16u*)&pScalar8[(bit-1)/8]);
+ wvalue = (wvalue>> ((bit-1)%8)) & mask;
+ booth_recode(&sign, &digit, (Ipp8u)wvalue, window_size);
+ cpGather32((Ipp32u*)pHdata, pointLen32, (Ipp32u*)pTable, tableLen, digit);
+
+ pGF->neg(pHy, pHdata+elemLen, pGF);
+ cpMaskMove(pHdata+elemLen, pHy, elemLen, sign);
+ gfec_point_add(pTdata, pTdata, pHdata, pEC);
+ }
+
+ /* last window */
+ gfec_point_double(pTdata, pTdata, pEC);
+ gfec_point_double(pTdata, pTdata, pEC);
+ gfec_point_double(pTdata, pTdata, pEC);
+ gfec_point_double(pTdata, pTdata, pEC);
+ gfec_point_double(pTdata, pTdata, pEC);
+
+ wvalue = *((Ipp16u*)&pScalar8[0]);
+ wvalue = (wvalue << 1) & mask;
+ booth_recode(&sign, &digit, (Ipp8u)wvalue, window_size);
+ cpGather32((Ipp32u*)pHdata, pointLen32, (Ipp32u*)pTable, tableLen, digit);
+
+ pGF->neg(pHy, pHdata+elemLen, pGF);
+ cpMaskMove(pHdata+elemLen, pHy, elemLen, sign);
+ gfec_point_add(pTdata, pTdata, pHdata, pEC);
+
+ cpGFpElementCopy(pRdata, pTdata, pointLen);
+
+ cpEcGFpReleasePool(2, pEC);
+ cpGFpReleasePool(1, pGF);
+ }
+}
+
+static void gfec_base_point_mul(BNU_CHUNK_T* pRdata, const Ipp8u* pScalar8, int scalarBitSize, IppsGFpECState* pEC)
+{
+ /* size of window, get function and pre-computed table */
+ int window_size = ECP_PREMULBP(pEC)->w;
+ selectAP select_affine_point = ECP_PREMULBP(pEC)->select_affine_point;
+ const BNU_CHUNK_T* pTbl = ECP_PREMULBP(pEC)->pTbl;
+
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ int elmLen = GFP_FELEN(pGF);
+ BNU_CHUNK_T* mont1 = MNT_1(GFP_MONT(pGF));
+
+ /* number of points per table slot */
+ int tslot_point = 1<<(window_size-1);
+ int tslot_size = tslot_point * (elmLen*2);
+
+ BNU_CHUNK_T* negtmp = cpGFpGetPool(1, pGF); /* temporary element */
+ BNU_CHUNK_T* pointT = cpEcGFpGetPool(1, pEC); /* temporary point */
+
+ Ipp8u digit, sign;
+ int mask = (1<<(window_size+1)) -1;
+ int bit = 0;
+
+ /* processing of window[0] */
+ int wvalue = *((Ipp16u*)&pScalar8[0]);
+ wvalue = (wvalue << 1) & mask;
+
+ booth_recode(&sign, &digit, (Ipp8u)wvalue, window_size);
+ select_affine_point(pRdata, pTbl, digit);
+
+ pGF->neg(negtmp, pRdata+elmLen, pGF);
+ cpMaskMove(pRdata+elmLen, negtmp, elmLen, sign);
+ cpGFpElementCopy(pRdata+elmLen*2, mont1, elmLen);
+ cpGFpElementCopy(pointT+elmLen*2, mont1, elmLen);
+
+ /* processing of other windows.. [1],[2],... */
+ for(bit+=window_size, pTbl+=tslot_size; bit<=scalarBitSize; bit+=window_size, pTbl+=tslot_size) {
+ wvalue = *((Ipp16u*)&pScalar8[(bit-1)/8]);
+ wvalue = (wvalue>> ((bit-1)%8)) & mask;
+
+ booth_recode(&sign, &digit, (Ipp8u)wvalue, window_size);
+ select_affine_point(pointT, pTbl, digit);
+
+ pGF->neg(negtmp, pointT+elmLen, pGF);
+ cpMaskMove(pointT+elmLen, negtmp, elmLen, sign);
+
+ gfec_affine_point_add(pRdata, pRdata, pointT, pEC);
+ }
+
+ cpEcGFpReleasePool(1, pEC);
+ cpGFpReleasePool(1, pGF);
+}
+
+static void gfec_point_prod(BNU_CHUNK_T* pointR,
+ const BNU_CHUNK_T* pointA, const Ipp8u* scalarA,
+ const BNU_CHUNK_T* pointB, const Ipp8u* scalarB,
+ int scalarBitSize,
+ IppsGFpECState* pEC, Ipp8u* pScratchBuffer)
+{
+ int pointLen = ECP_POINTLEN(pEC);
+ int pointLen32 = pointLen*sizeof(BNU_CHUNK_T)/sizeof(Ipp32u);
+
+ /* optimal size of window */
+ const int window_size = (NULL==pScratchBuffer)? 1 : 5;
+ /* number of table entries */
+ const int tableLen = 1<<(window_size-1);
+
+ /* aligned pre-computed tables */
+ BNU_CHUNK_T* pTableA = (BNU_CHUNK_T*)IPP_ALIGNED_PTR(pScratchBuffer, CACHE_LINE_SIZE);
+ BNU_CHUNK_T* pTableB = pTableA+pointLen*tableLen;
+
+ setupTable(pTableA, pointA, pEC);
+ setupTable(pTableB, pointB, pEC);
+
+ {
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ int elemLen = GFP_FELEN(pGF);
+ BNU_CHUNK_T* pHy = cpGFpGetPool(1, pGF);
+
+ BNU_CHUNK_T* pTdata = cpEcGFpGetPool(1, pEC); /* points from the pool */
+ BNU_CHUNK_T* pHdata = cpEcGFpGetPool(1, pEC);
+
+ Ipp8u digit, sign;
+ int mask = (1<<(window_size+1)) -1;
+ int bit = scalarBitSize-(scalarBitSize%window_size);
+
+ /* first window */
+ int wvalue = *((Ipp16u*)&scalarA[(bit-1)/8]);
+ wvalue = (wvalue>> ((bit-1)%8)) & mask;
+ booth_recode(&sign, &digit, (Ipp8u)wvalue, window_size);
+ cpGather32((Ipp32u*)pTdata, pointLen32, (Ipp32u*)pTableA, tableLen, digit);
+
+ wvalue = *((Ipp16u*)&scalarB[(bit-1)/8]);
+ wvalue = (wvalue>> ((bit-1)%8)) & mask;
+ booth_recode(&sign, &digit, (Ipp8u)wvalue, window_size);
+ cpGather32((Ipp32u*)pHdata, pointLen32, (Ipp32u*)pTableB, tableLen, digit);
+
+ pGF->neg(pHy, pHdata+elemLen, pGF);
+ cpMaskMove(pHdata+elemLen, pHy, elemLen, sign);
+ gfec_point_add(pTdata, pTdata, pHdata, pEC);
+
+ for(bit-=window_size; bit>=window_size; bit-=window_size) {
+ gfec_point_double(pTdata, pTdata, pEC);
+ gfec_point_double(pTdata, pTdata, pEC);
+ gfec_point_double(pTdata, pTdata, pEC);
+ gfec_point_double(pTdata, pTdata, pEC);
+ gfec_point_double(pTdata, pTdata, pEC);
+
+ wvalue = *((Ipp16u*)&scalarA[(bit-1)/8]);
+ wvalue = (wvalue>> ((bit-1)%8)) & mask;
+ booth_recode(&sign, &digit, (Ipp8u)wvalue, window_size);
+ cpGather32((Ipp32u*)pHdata, pointLen32, (Ipp32u*)pTableA, tableLen, digit);
+
+ pGF->neg(pHy, pHdata+elemLen, pGF);
+ cpMaskMove(pHdata+elemLen, pHy, elemLen, sign);
+ gfec_point_add(pTdata, pTdata, pHdata, pEC);
+
+ wvalue = *((Ipp16u*)&scalarB[(bit-1)/8]);
+ wvalue = (wvalue>> ((bit-1)%8)) & mask;
+ booth_recode(&sign, &digit, (Ipp8u)wvalue, window_size);
+ cpGather32((Ipp32u*)pHdata, pointLen32, (Ipp32u*)pTableB, tableLen, digit);
+
+ pGF->neg(pHy, pHdata+elemLen, pGF);
+ cpMaskMove(pHdata+elemLen, pHy, elemLen, sign);
+ gfec_point_add(pTdata, pTdata, pHdata, pEC);
+ }
+ /* last window */
+ gfec_point_double(pTdata, pTdata, pEC);
+ gfec_point_double(pTdata, pTdata, pEC);
+ gfec_point_double(pTdata, pTdata, pEC);
+ gfec_point_double(pTdata, pTdata, pEC);
+ gfec_point_double(pTdata, pTdata, pEC);
+
+ wvalue = *((Ipp16u*)&scalarA[0]);
+ wvalue = (wvalue << 1) & mask;
+ booth_recode(&sign, &digit, (Ipp8u)wvalue, window_size);
+ cpGather32((Ipp32u*)pHdata, pointLen32, (Ipp32u*)pTableA, tableLen, digit);
+
+ pGF->neg(pHy, pHdata+elemLen, pGF);
+ cpMaskMove(pHdata+elemLen, pHy, elemLen, sign);
+ gfec_point_add(pTdata, pTdata, pHdata, pEC);
+
+ wvalue = *((Ipp16u*)&scalarB[0]);
+ wvalue = (wvalue << 1) & mask;
+ booth_recode(&sign, &digit, (Ipp8u)wvalue, window_size);
+ cpGather32((Ipp32u*)pHdata, pointLen32, (Ipp32u*)pTableB, tableLen, digit);
+
+ pGF->neg(pHy, pHdata+elemLen, pGF);
+ cpMaskMove(pHdata+elemLen, pHy, elemLen, sign);
+ gfec_point_add(pTdata, pTdata, pHdata, pEC);
+
+ cpGFpElementCopy(pointR, pTdata, pointLen);
+
+ cpEcGFpReleasePool(2, pEC);
+ cpGFpReleasePool(1, pGF);
+ }
+}
+
+/*
+// select affine point
+*/
+#if (_IPP32E < _IPP32E_M7)
+void p192r1_select_ap_w7(BNU_CHUNK_T* pVal, const BNU_CHUNK_T* pTbl, int idx)
+{
+ #define OPERAND_BITSIZE (192)
+ #define LEN_P192 (BITS_BNU_CHUNK(OPERAND_BITSIZE))
+ #define LEN_P192_APOINT (2*LEN_P192)
+
+ const int tblLen = 64;
+ int i;
+ unsigned int n;
+
+ /* clear output affine point */
+ for(n=0; n<LEN_P192_APOINT; n++)
+ pVal[n] = 0;
+
+ /* select poiint */
+ for(i=1; i<=tblLen; i++) {
+ BNU_CHUNK_T mask = 0 - isZero(i-idx);
+ for(n=0; n<LEN_P192_APOINT; n++)
+ pVal[n] |= (pTbl[n] & mask);
+ pTbl += LEN_P192_APOINT;
+ }
+
+ #undef OPERAND_BITSIZE
+ #undef LEN_P192
+ #undef LEN_P192_APOINT
+}
+
+void p224r1_select_ap_w7(BNU_CHUNK_T* pVal, const BNU_CHUNK_T* pTbl, int idx)
+{
+ #define OPERAND_BITSIZE (224)
+ #define LEN_P224 (BITS_BNU_CHUNK(OPERAND_BITSIZE))
+ #define LEN_P224_APOINT (2*LEN_P224)
+
+ const int tblLen = 64;
+ int i;
+ unsigned int n;
+
+ /* clear output affine point */
+ for(n=0; n<LEN_P224_APOINT; n++)
+ pVal[n] = 0;
+
+ /* select poiint */
+ for(i=1; i<=tblLen; i++) {
+ BNU_CHUNK_T mask = 0 - isZero(i-idx);
+ for(n=0; n<LEN_P224_APOINT; n++)
+ pVal[n] |= (pTbl[n] & mask);
+ pTbl += LEN_P224_APOINT;
+ }
+
+ #undef OPERAND_BITSIZE
+ #undef LEN_P224
+ #undef LEN_P224_APOINT
+}
+
+void p256r1_select_ap_w7(BNU_CHUNK_T* pVal, const BNU_CHUNK_T* pTbl, int idx)
+{
+ #define OPERAND_BITSIZE (256)
+ #define LEN_P256 (BITS_BNU_CHUNK(OPERAND_BITSIZE))
+ #define LEN_P256_APOINT (2*LEN_P256)
+
+ const int tblLen = 64;
+ int i;
+ unsigned int n;
+
+ /* clear output affine point */
+ for(n=0; n<LEN_P256_APOINT; n++)
+ pVal[n] = 0;
+
+ /* select poiint */
+ for(i=1; i<=tblLen; i++) {
+ BNU_CHUNK_T mask = 0 - isZero(i-idx);
+ for(n=0; n<LEN_P256_APOINT; n++)
+ pVal[n] |= (pTbl[n] & mask);
+ pTbl += LEN_P256_APOINT;
+ }
+
+ #undef OPERAND_BITSIZE
+ #undef LEN_P256
+ #undef LEN_P256_APOINT
+}
+
+void p384r1_select_ap_w5(BNU_CHUNK_T* pVal, const BNU_CHUNK_T* pTbl, int idx)
+{
+ #define OPERAND_BITSIZE (384)
+ #define LEN_P384 (BITS_BNU_CHUNK(OPERAND_BITSIZE))
+ #define LEN_P384_APOINT (2*LEN_P384)
+
+ const int tblLen = 16;
+ int i;
+ unsigned int n;
+
+ /* clear output affine point */
+ for(n=0; n<LEN_P384_APOINT; n++)
+ pVal[n] = 0;
+
+ /* select poiint */
+ for(i=1; i<=tblLen; i++) {
+ BNU_CHUNK_T mask = 0 - isZero(i-idx);
+ for(n=0; n<LEN_P384_APOINT; n++)
+ pVal[n] |= (pTbl[n] & mask);
+ pTbl += LEN_P384_APOINT;
+ }
+
+ #undef OPERAND_BITSIZE
+ #undef LEN_P384
+ #undef LEN_P384_APOINT
+}
+
+void p521r1_select_ap_w5(BNU_CHUNK_T* pVal, const BNU_CHUNK_T* pTbl, int idx)
+{
+ #define OPERAND_BITSIZE (521)
+ #define LEN_P521 (BITS_BNU_CHUNK(OPERAND_BITSIZE))
+ #define LEN_P521_APOINT (2*LEN_P521)
+
+ const int tblLen = 16;
+ int i;
+ unsigned int n;
+
+ /* clear output affine point */
+ for(n=0; n<LEN_P521_APOINT; n++)
+ pVal[n] = 0;
+
+ /* select point */
+ for(i=1; i<=tblLen; i++) {
+ BNU_CHUNK_T mask = 0 - isZero(i-idx);
+ for(n=0; n<LEN_P521_APOINT; n++)
+ pVal[n] |= (pTbl[n] & mask);
+ pTbl += LEN_P521_APOINT;
+ }
+
+ #undef OPERAND_BITSIZE
+ #undef LEN_P521
+ #undef P521_POINT_AFFINE
+}
+#endif
+
+IppsGFpECPoint* gfec_MulPoint(IppsGFpECPoint* pR,
+ const IppsGFpECPoint* pP,
+ const BNU_CHUNK_T* pScalar, int scalarLen,
+ IppsGFpECState* pEC, Ipp8u* pScratchBuffer)
+{
+ FIX_BNU(pScalar, scalarLen);
+ {
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ BNU_CHUNK_T* pTmpScalar = cpGFpGetPool(1, pGF); /* length of scalar does not exceed length of order */
+ cpGFpElementCopyPadd(pTmpScalar,scalarLen+1, pScalar,scalarLen);
+
+ gfec_point_mul(ECP_POINT_X(pR), ECP_POINT_X(pP),
+ (Ipp8u*)pTmpScalar, BITSIZE_BNU(pTmpScalar, scalarLen),
+ pEC, pScratchBuffer);
+ cpGFpReleasePool(1, pGF);
+
+ ECP_POINT_FLAGS(pR) = gfec_IsPointAtInfinity(pR)? 0 : ECP_FINITE_POINT;
+ return pR;
+ }
+}
+
+IppsGFpECPoint* gfec_MulBasePoint(IppsGFpECPoint* pR,
+ const BNU_CHUNK_T* pScalar, int scalarLen,
+ IppsGFpECState* pEC, Ipp8u* pScratchBuffer)
+{
+ FIX_BNU(pScalar, scalarLen);
+ {
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ BNU_CHUNK_T* pTmpScalar = cpGFpGetPool(1, pGF); /* length of scalar does not exceed length of order */
+ cpGFpElementCopyPadd(pTmpScalar,scalarLen+1, pScalar,scalarLen);
+
+ if(ECP_PREMULBP(pEC))
+ gfec_base_point_mul(ECP_POINT_X(pR),
+ (Ipp8u*)pTmpScalar, BITSIZE_BNU(pTmpScalar, scalarLen),
+ pEC);
+ else
+ gfec_point_mul(ECP_POINT_X(pR), ECP_G(pEC),
+ (Ipp8u*)pTmpScalar, BITSIZE_BNU(pTmpScalar, scalarLen),
+ pEC, pScratchBuffer);
+ cpGFpReleasePool(1, pGF);
+
+ ECP_POINT_FLAGS(pR) = gfec_IsPointAtInfinity(pR)? 0 : ECP_FINITE_POINT;
+ return pR;
+ }
+}
+
+IppsGFpECPoint* gfec_PointProduct(IppsGFpECPoint* pR,
+ const IppsGFpECPoint* pP, const BNU_CHUNK_T* pScalarP, int scalarPlen,
+ const IppsGFpECPoint* pQ, const BNU_CHUNK_T* pScalarQ, int scalarQlen,
+ IppsGFpECState* pEC, Ipp8u* pScratchBuffer)
+{
+ FIX_BNU(pScalarP, scalarPlen);
+ FIX_BNU(pScalarQ, scalarQlen);
+ {
+ int scalarLen = IPP_MAX(scalarPlen, scalarQlen);
+ int scalarBitLen = IPP_MAX(BITSIZE_BNU(pScalarP, scalarPlen), BITSIZE_BNU(pScalarQ, scalarQlen));
+
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ BNU_CHUNK_T* tmpScalarP = cpGFpGetPool(2, pGF);
+ BNU_CHUNK_T* tmpScalarQ = tmpScalarP+scalarLen+1;
+ cpGFpElementCopyPadd(tmpScalarP, scalarLen+1, pScalarP,scalarPlen);
+ cpGFpElementCopyPadd(tmpScalarQ, scalarLen+1, pScalarQ,scalarQlen);
+
+ gfec_point_prod(ECP_POINT_X(pR),
+ ECP_POINT_X(pP), (Ipp8u*)tmpScalarP,
+ ECP_POINT_X(pQ), (Ipp8u*)tmpScalarQ,
+ scalarBitLen,
+ pEC, pScratchBuffer);
+ cpGFpReleasePool(2, pGF);
+
+ ECP_POINT_FLAGS(pR) = gfec_IsPointAtInfinity(pR)? 0 : ECP_FINITE_POINT;
+ return pR;
+ }
+}
+
+IppsGFpECPoint* gfec_BasePointProduct(IppsGFpECPoint* pR,
+ const BNU_CHUNK_T* pScalarG, int scalarGlen,
+ const IppsGFpECPoint* pP, const BNU_CHUNK_T* pScalarP, int scalarPlen,
+ IppsGFpECState* pEC, Ipp8u* pScratchBuffer)
+{
+ FIX_BNU(pScalarG, scalarGlen);
+ FIX_BNU(pScalarP, scalarPlen);
+
+ {
+ int scalarLen = IPP_MAX(scalarGlen, scalarPlen);
+
+ IppsGFpState* pGF = ECP_GFP(pEC);
+ BNU_CHUNK_T* tmpScalarG = cpGFpGetPool(2, pGF);
+ BNU_CHUNK_T* tmpScalarP = tmpScalarG+scalarLen+1;
+
+ cpGFpElementCopyPadd(tmpScalarG, scalarLen+1, pScalarG,scalarGlen);
+ cpGFpElementCopyPadd(tmpScalarP, scalarLen+1, pScalarP,scalarPlen);
+
+ if(ECP_PREMULBP(pEC)) {
+ BNU_CHUNK_T* productG = cpEcGFpGetPool(2, pEC);
+ BNU_CHUNK_T* productP = productG+ECP_POINTLEN(pEC);
+
+ gfec_base_point_mul(productG, (Ipp8u*)tmpScalarG, BITSIZE_BNU(tmpScalarG, scalarGlen), pEC);
+ gfec_point_mul(productP, ECP_POINT_X(pP), (Ipp8u*)tmpScalarP, BITSIZE_BNU(tmpScalarP, scalarPlen), pEC, pScratchBuffer);
+ gfec_point_add(ECP_POINT_X(pR), productG, productP, pEC);
+
+ cpEcGFpReleasePool(2, pEC);
+ }
+
+ else {
+ int scalarBitLen = IPP_MAX(BITSIZE_BNU(pScalarG, scalarGlen), BITSIZE_BNU(pScalarP, scalarPlen));
+
+ gfec_point_prod(ECP_POINT_X(pR),
+ ECP_G(pEC), (Ipp8u*)tmpScalarG,
+ ECP_POINT_X(pP), (Ipp8u*)tmpScalarP,
+ scalarBitLen,
+ pEC, pScratchBuffer);
+ }
+
+ cpGFpReleasePool(2, pGF);
+ }
+
+ ECP_POINT_FLAGS(pR) = gfec_IsPointAtInfinity(pR)? 0 : ECP_FINITE_POINT;
+ return pR;
+}
diff --git a/ext/ipp/sources/ippcpepid/src/pcpgfpecstuff.h b/ext/ipp/sources/ippcp/src/pcpgfpecstuff.h
index f312e53..8692a16 100644
--- a/ext/ipp/sources/ippcpepid/src/pcpgfpecstuff.h
+++ b/ext/ipp/sources/ippcp/src/pcpgfpecstuff.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2010-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@
#include "pcpgfpstuff.h"
#include "pcpgfpxstuff.h"
+#define _LEGACY_ECCP_SUPPORT_
/*
// EC over GF(p) Point context
@@ -37,7 +38,7 @@ typedef struct _cpGFpECPoint {
IppCtxId idCtx; /* EC Point identifier */
int flags; /* flags: affine */
int elementSize; /* size of each coordinate */
- BNU_CHUNK_T* pData; /* coordinatex X, Y, Z */
+ BNU_CHUNK_T* pData; /* coordinatex X, Y, Z */
} cpGFPECPoint;
/*
@@ -73,18 +74,24 @@ typedef struct _cpGFpECPoint {
//#define ECP_PROJECTIVE_COORD HOMOGENEOUS
#if (ECP_PROJECTIVE_COORD== JACOBIAN)
- #pragma message ("ECP_PROJECTIVE_COORD = JACOBIAN")
+
#elif (ECP_PROJECTIVE_COORD== HOMOGENEOUS)
- #pragma message ("ECP_PROJECTIVE_COORD = HOMOGENEOUS")
+
#else
#error ECP_PROJECTIVE_COORD should be either JACOBIAN or HOMOGENEOUS type
#endif
-#define _EPID20_EC_PARAM_SPECIFIC_
-#if defined(_EPID20_EC_PARAM_SPECIFIC_)
-#pragma message ("_EPID20_EC_PARAM_SPECIFIC_")
-#endif
+/*
+// pre-computed Base Point descriptor
+*/
+typedef void (*selectAP) (BNU_CHUNK_T* pAP, const BNU_CHUNK_T* pAPtbl, int index);
+
+typedef struct _cpPrecompAP {
+ int w; /* scalar's window bitsize */
+ selectAP select_affine_point; /* get affine point function */
+ const BNU_CHUNK_T* pTbl; /* pre-computed table */
+} cpPrecompAP;
/* EC over GF(p) context */
@@ -93,37 +100,71 @@ typedef struct _cpGFpEC {
IppsGFpState* pGF; /* arbitrary GF(p^d)*/
- int elementSize; /* size of point's coordinate */
- int orderBitSize; /* base_point order bitsize */
-// int cofactor; /* cofactor = #E/base_point order */
- int epidParams; /* Intel(R) EPID 2.0 specific parameters */
+ int elementSize; /* length of EC point */
+ int orderBitSize; /* base_point order bitsize */
BNU_CHUNK_T* pA; /* EC parameter A */
BNU_CHUNK_T* pB; /* B */
BNU_CHUNK_T* pG; /* base_point */
- BNU_CHUNK_T* pR; /* base_point order */
BNU_CHUNK_T* cofactor; /* cofactor = #E/base_point order */
+ int parmAspc; /* NIST's, EPIDv2.0 A-parameter specific */
+ int infinity; /* 0/1 if B !=0/==0 */
+ const cpPrecompAP* pBaseTbl; /* address of pre-computed [n]G tabble */
+ IppsMontState* pMontR; /* EC order montgomery engine */
BNU_CHUNK_T* pPool; /* pool of points */
+ #if defined(_LEGACY_ECCP_SUPPORT_)
+ BNU_CHUNK_T* pPublic; /* regular public key */
+ BNU_CHUNK_T* pPublicE; /* ephemeral public key */
+ BNU_CHUNK_T* pPrivat; /* regular private key */
+ BNU_CHUNK_T* pPrivatE; /* ephemeral private key */
+ BNU_CHUNK_T* pBuffer; /* pointer to scaratch buffer (for lagacy ECCP only) */
+ #endif
} cpGFPEC;
#define ECGFP_ALIGNMENT ((int)(sizeof(void*)))
/* Local definitions */
-#define EC_POOL_SIZE (8) /* num of points into the pool */
+#define EC_POOL_SIZE (10) /* num of points into the pool */
#define ECP_ID(pCtx) ((pCtx)->idCtx)
#define ECP_GFP(pCtx) ((pCtx)->pGF)
-#define ECP_FELEN(pCtx) ((pCtx)->elementSize)
+#define ECP_POINTLEN(pCtx) ((pCtx)->elementSize)
#define ECP_ORDBITSIZE(pCtx) ((pCtx)->orderBitSize)
#define ECP_COFACTOR(pCtx) ((pCtx)->cofactor)
-#define EPID_PARAMS(pCtx) ((pCtx)->epidParams)
+#define ECP_SPECIFIC(pCtx) ((pCtx)->parmAspc)
+#define ECP_INFINITY(pCtx) ((pCtx)->infinity)
#define ECP_A(pCtx) ((pCtx)->pA)
#define ECP_B(pCtx) ((pCtx)->pB)
#define ECP_G(pCtx) ((pCtx)->pG)
-#define ECP_R(pCtx) ((pCtx)->pR)
+#define ECP_PREMULBP(pCtx) ((pCtx)->pBaseTbl)
+#define ECP_MONT_R(pCtx) ((pCtx)->pMontR)
#define ECP_POOL(pCtx) ((pCtx)->pPool)
+#if defined(_LEGACY_ECCP_SUPPORT_)
+ #define ECP_PUBLIC(pCtx) ((pCtx)->pPublic)
+ #define ECP_PUBLIC_E(pCtx) ((pCtx)->pPublicE)
+ #define ECP_PRIVAT(pCtx) ((pCtx)->pPrivat)
+ #define ECP_PRIVAT_E(pCtx) ((pCtx)->pPrivatE)
+ #define ECP_SBUFFER(pCtx) ((pCtx)->pBuffer)
+#endif
#define ECP_TEST_ID(pCtx) (ECP_ID((pCtx))==idCtxGFPEC)
+/* EC curve specific (a-parameter) */
+#define ECP_Acom (0) /* commont case */
+#define ECP_Ami3 (1) /* a=-3 NIST's and SM2 curve */
+#define ECP_Aeq0 (2) /* a=0 EPIDv2.0 curve */
+
+#define ECP_ARB ECP_Acom
+#define ECP_STD ECP_Ami3
+#define ECP_EPID2 ECP_Aeq0
+
+/* std ec pre-computed tables */
+const cpPrecompAP* gfpec_precom_nistP192r1_fun(void);
+const cpPrecompAP* gfpec_precom_nistP224r1_fun(void);
+const cpPrecompAP* gfpec_precom_nistP256r1_fun(void);
+const cpPrecompAP* gfpec_precom_nistP384r1_fun(void);
+const cpPrecompAP* gfpec_precom_nistP521r1_fun(void);
+const cpPrecompAP* gfpec_precom_sm2_fun(void);
+
/*
// get/release n points from/to the pool
*/
@@ -147,98 +188,34 @@ __INLINE IppsGFpECPoint* cpEcGFpInitPoint(IppsGFpECPoint* pPoint, BNU_CHUNK_T* p
return pPoint;
}
-/*
-// copy one point into another
-*/
-__INLINE IppsGFpECPoint* cpEcGFpCopyPoint(IppsGFpECPoint* pPointR, const IppsGFpECPoint* pPointA, int elemLen)
+/* copy one point into another */
+__INLINE IppsGFpECPoint* gfec_CopyPoint(IppsGFpECPoint* pPointR, const IppsGFpECPoint* pPointA, int elemLen)
{
cpGFpElementCopy(ECP_POINT_DATA(pPointR), ECP_POINT_DATA(pPointA), 3*elemLen);
ECP_POINT_FLAGS(pPointR) = ECP_POINT_FLAGS(pPointA);
return pPointR;
}
-/*
-// set point (convert into inside representation)
-// SetProjectivePoint
-// SetProjectivePointAtInfinity
-// SetAffinePoint
-*/
-__INLINE IppsGFpECPoint* cpEcGFpSetProjectivePoint(IppsGFpECPoint* pPoint,
- const BNU_CHUNK_T* pX, const BNU_CHUNK_T* pY, const BNU_CHUNK_T* pZ,
- IppsGFpECState* pEC)
-{
- IppsGFpState* pGF = ECP_GFP(pEC);
- int elemLen = GFP_FELEN(pGF);
- int pointFlag = 0;
-
- cpGFpxSet(ECP_POINT_X(pPoint), pX, elemLen, pGF, USE_MONT_SPACE_REPRESENTATION);
- cpGFpxSet(ECP_POINT_Y(pPoint), pY, elemLen, pGF, USE_MONT_SPACE_REPRESENTATION);
- cpGFpxSet(ECP_POINT_Z(pPoint), pZ, elemLen, pGF, USE_MONT_SPACE_REPRESENTATION);
- if(!GFP_IS_ZERO(pZ, elemLen)) pointFlag |= ECP_FINITE_POINT;
- if(GFP_IS_ONE(pZ, elemLen)) pointFlag |= ECP_AFFINE_POINT;
- ECP_POINT_FLAGS(pPoint) = pointFlag;
- return pPoint;
-}
-__INLINE IppsGFpECPoint* cpEcGFpSetProjectivePointAtInfinity(IppsGFpECPoint* pPoint, int elemLen)
+__INLINE IppsGFpECPoint* gfec_SetPointAtInfinity(IppsGFpECPoint* pPoint)
{
+ int elemLen = ECP_POINT_FELEN(pPoint);
cpGFpElementPadd(ECP_POINT_X(pPoint), elemLen, 0);
cpGFpElementPadd(ECP_POINT_Y(pPoint), elemLen, 0);
cpGFpElementPadd(ECP_POINT_Z(pPoint), elemLen, 0);
ECP_POINT_FLAGS(pPoint) = 0;
return pPoint;
}
-__INLINE IppsGFpECPoint* cpEcGFpSetAffinePoint(IppsGFpECPoint* pPoint,
- const BNU_CHUNK_T* pX, const BNU_CHUNK_T* pY,
- IppsGFpECState* pEC)
-{
- IppsGFpState* pGF = ECP_GFP(pEC);
- IppsGFpState* pBasicGF = cpGFpBasic(pGF);
-
- cpGFpElementCopy(ECP_POINT_X(pPoint), pX, GFP_FELEN(pGF));
- cpGFpElementCopy(ECP_POINT_Y(pPoint), pY, GFP_FELEN(pGF));
- cpGFpElementCopyPadd(ECP_POINT_Z(pPoint), GFP_FELEN(pGF), MNT_1(GFP_MONT(pBasicGF)), GFP_FELEN(pBasicGF));
- ECP_POINT_FLAGS(pPoint) = ECP_AFFINE_POINT | ECP_FINITE_POINT;
- return pPoint;
-}
/*
// test infinity:
// IsProjectivePointAtInfinity
*/
-__INLINE int cpEcGFpIsProjectivePointAtInfinity(const IppsGFpECPoint* pPoint, Ipp32u elemLen)
+__INLINE int gfec_IsPointAtInfinity(const IppsGFpECPoint* pPoint)
{
- return GFP_IS_ZERO( ECP_POINT_Z(pPoint), elemLen );
+ return GFP_IS_ZERO( ECP_POINT_Z(pPoint), ECP_POINT_FELEN(pPoint));
}
-/*
-// get point (convert from inside representation)
-// GetProjectivePoint
-// GetAffinePointAtInfinity0 (B==0)
-// GetAffinePointAtInfinity1 (B!=0)
-// GetAffinePoint
-*/
-__INLINE void cpEcGFpGetProjectivePoint(BNU_CHUNK_T* pX, BNU_CHUNK_T* pY, BNU_CHUNK_T* pZ,
- const IppsGFpECPoint* pPoint,
- IppsGFpECState* pEC)
-{
- IppsGFpState* pGF = ECP_GFP(pEC);
- cpGFpxGet(pX, GFP_FELEN(pGF), ECP_POINT_X(pPoint), pGF, USE_MONT_SPACE_REPRESENTATION);
- cpGFpxGet(pY, GFP_FELEN(pGF), ECP_POINT_Y(pPoint), pGF, USE_MONT_SPACE_REPRESENTATION);
- cpGFpxGet(pZ, GFP_FELEN(pGF), ECP_POINT_Z(pPoint), pGF, USE_MONT_SPACE_REPRESENTATION);
-}
-#if 0
-__INLINE void cpEcGFpGetAffinePointAtInfinity0(BNU_CHUNK_T* pX, BNU_CHUNK_T* pY, int elemLen)
-{
- GFP_ZERO(pX, elemLen);
- GFP_ONE(pY, elemLen);
-}
-__INLINE void cpEcGFpGetAffinePointAtInfinity1(BNU_CHUNK_T* pX, BNU_CHUNK_T* pY, int elemLen)
-{
- GFP_ZERO(pX, elemLen);
- GFP_ZERO(pY, elemLen);
-}
-#endif
/* signed encode */
@@ -252,6 +229,22 @@ __INLINE void booth_recode(Ipp8u* sign, Ipp8u* digit, Ipp8u in, int w)
*digit = (Ipp8u)d;
}
+/* returns 1/0 if x==0/!=0 */
+__INLINE BNU_CHUNK_T isZero(BNU_CHUNK_T x)
+{
+ #if (BNU_CHUNK_BITS == BNU_CHUNK_64BIT)
+ x |= x<<32;
+ #endif
+ x |= x<<16;
+ x |= x<<8;
+ x |= x<<4;
+ x |= x<<2;
+ x |= x<<1;
+ x = ~x;
+ x>>=BNU_CHUNK_BITS-1;
+ return x;
+}
+
/* mask of the argument:
if x==0 returns 0
if x!=0 returns BNU_CHUNK_T(-1)
@@ -279,6 +272,7 @@ __INLINE void cpMaskMove(BNU_CHUNK_T* dst, const BNU_CHUNK_T* src, int len, int
dst[n] = (src[n] & mask1) ^ (dst[n] & mask2);
}
+
__INLINE void cpScatter32(Ipp32u* pTbl, int scale, int idx, const Ipp32u* pData, int len)
{
int i;
@@ -296,25 +290,44 @@ __INLINE void cpGather32(Ipp32u* pData, int len, const Ipp32u* pTbl, int scale,
for(i=0; i<len; i++, pTbl+=scale, pData++) pData[0] = pTbl[0] & mask;
}
-/*
-// other point operations
-*/
-int cpEcGFpGetAffinePoint(BNU_CHUNK_T* pX, BNU_CHUNK_T* pY, const IppsGFpECPoint* pPoint, IppsGFpECState* pEC);
-
-int cpEcGFpMakePoint(IppsGFpECPoint* pPoint, const BNU_CHUNK_T* pElm, IppsGFpECState* pEC);
-
-int cpEcGFpIsPointEquial(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECState* pEC);
-int cpEcGFpIsPointOnCurve(const IppsGFpECPoint* pP, IppsGFpECState* pEC);
-int cpEcGFpIsPointInGroup(const IppsGFpECPoint* pP, IppsGFpECState* pEC);
-
-IppsGFpECPoint* cpEcGFpNegPoint(IppsGFpECPoint* pR, const IppsGFpECPoint* pP, IppsGFpECState* pEC);
-IppsGFpECPoint* cpEcGFpDblPoint(IppsGFpECPoint* pR, const IppsGFpECPoint* pP, IppsGFpECState* pEC);
-IppsGFpECPoint* cpEcGFpAddPoint(IppsGFpECPoint* pR, const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECState* pEC);
-
-int cpEcGFpGetOptimalWinSize(int scalarBitsize);
-
-IppsGFpECPoint* cpEcGFpMulPoint(IppsGFpECPoint* pR,
- const IppsGFpECPoint* pP, const BNU_CHUNK_T* pN, int nsN,
- IppsGFpECState* pEC, Ipp8u* pScratchBuffer);
+/* size of context */
+int cpGFpECGetSize(int deg, int basicElmBitSize);
+
+/* point operations */
+int gfec_GetPoint(BNU_CHUNK_T* pX, BNU_CHUNK_T* pY, const IppsGFpECPoint* pPoint, IppsGFpECState* pEC);
+
+int gfec_SetPoint(BNU_CHUNK_T* pP, const BNU_CHUNK_T* pX, const BNU_CHUNK_T* pY, IppsGFpECState* pEC);
+
+int gfec_MakePoint(IppsGFpECPoint* pPoint, const BNU_CHUNK_T* pElm, IppsGFpECState* pEC);
+
+int gfec_ComparePoint(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECState* pEC);
+int gfec_IsPointOnCurve(const IppsGFpECPoint* pP, IppsGFpECState* pEC);
+
+IppsGFpECPoint* gfec_NegPoint(IppsGFpECPoint* pR,
+ const IppsGFpECPoint* pP, IppsGFpECState* pEC);
+IppsGFpECPoint* gfec_DblPoint(IppsGFpECPoint* pR,
+ const IppsGFpECPoint* pP, IppsGFpECState* pEC);
+IppsGFpECPoint* gfec_AddPoint(IppsGFpECPoint* pR,
+ const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECState* pEC);
+IppsGFpECPoint* gfec_MulPoint(IppsGFpECPoint* pR,
+ const IppsGFpECPoint* pP, const BNU_CHUNK_T* pScalar, int scalarLen,
+ IppsGFpECState* pEC, Ipp8u* pScratchBuffer);
+IppsGFpECPoint* gfec_MulBasePoint(IppsGFpECPoint* pR,
+ const BNU_CHUNK_T* pScalar, int scalarLen,
+ IppsGFpECState* pEC, Ipp8u* pScratchBuffer);
+IppsGFpECPoint* gfec_PointProduct(IppsGFpECPoint* pR,
+ const IppsGFpECPoint* pP, const BNU_CHUNK_T* pScalarP, int scalarPlen,
+ const IppsGFpECPoint* pQ, const BNU_CHUNK_T* pScalarQ, int scalarQlen,
+ IppsGFpECState* pEC, Ipp8u* pScratchBuffer);
+IppsGFpECPoint* gfec_BasePointProduct(IppsGFpECPoint* pR,
+ const BNU_CHUNK_T* pScalarG, int scalarGlen,
+ const IppsGFpECPoint* pP, const BNU_CHUNK_T* pScalarP, int scalarPlen,
+ IppsGFpECState* pEC, Ipp8u* pScratchBuffer);
+
+void p192r1_select_ap_w7(BNU_CHUNK_T* pAffinePoint, const BNU_CHUNK_T* pTable, int index);
+void p224r1_select_ap_w7(BNU_CHUNK_T* pAffinePoint, const BNU_CHUNK_T* pTable, int index);
+void p256r1_select_ap_w7(BNU_CHUNK_T* pAffinePoint, const BNU_CHUNK_T* pTable, int index);
+void p384r1_select_ap_w5(BNU_CHUNK_T* pAffinePoint, const BNU_CHUNK_T* pTable, int index);
+void p521r1_select_ap_w5(BNU_CHUNK_T* pAffinePoint, const BNU_CHUNK_T* pTable, int index);
#endif /* _CP_ECGFP_H_ */
diff --git a/ext/ipp/sources/ippcp/src/pcpgfpmethod.h b/ext/ipp/sources/ippcp/src/pcpgfpmethod.h
new file mode 100644
index 0000000..4273946
--- /dev/null
+++ b/ext/ipp/sources/ippcp/src/pcpgfpmethod.h
@@ -0,0 +1,57 @@
+/*############################################################################
+ # Copyright 2016-2017 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.
+ ############################################################################*/
+
+/*
+// Purpose:
+// Intel(R) Integrated Performance Primitives
+// Cryptographic Primitives
+// Internal GF(p) basic Definitions & Function Prototypes
+//
+*/
+#if !defined(_CP_GFP_METHOD_H)
+#define _CP_GFP_METHOD_H
+
+#include "owndefs.h"
+#include "owncp.h"
+
+#include "pcpbnuimpl.h"
+
+/* GF methods */
+typedef BNU_CHUNK_T* (*gfadd) (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF);
+typedef BNU_CHUNK_T* (*gfsub) (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF);
+typedef BNU_CHUNK_T* (*gfneg) (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
+typedef BNU_CHUNK_T* (*gfdiv2)(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
+typedef BNU_CHUNK_T* (*gfmul2)(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
+typedef BNU_CHUNK_T* (*gfmul3)(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
+typedef BNU_CHUNK_T* (*gfmul) (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF);
+typedef BNU_CHUNK_T* (*gfsqr) (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
+typedef BNU_CHUNK_T* (*gfencode)(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
+typedef BNU_CHUNK_T* (*gfdecode)(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
+
+typedef struct _cpGFpMethod {
+ gfadd add;
+ gfsub sub;
+ gfneg neg;
+ gfdiv2 div2;
+ gfmul2 mul2;
+ gfmul3 mul3;
+ gfmul mul;
+ gfsqr sqr;
+ gfencode encode;
+ gfdecode decode;
+} cpGFpMethod;
+
+#endif /* _CP_GFP_METHOD_H */
diff --git a/ext/ipp/sources/ippcp/src/pcpgfpmethod_256r1.c b/ext/ipp/sources/ippcp/src/pcpgfpmethod_256r1.c
new file mode 100644
index 0000000..07d2b50
--- /dev/null
+++ b/ext/ipp/sources/ippcp/src/pcpgfpmethod_256r1.c
@@ -0,0 +1,153 @@
+/*############################################################################
+ # Copyright 2016-2017 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.
+ ############################################################################*/
+
+/*
+// Intel(R) Performance Primitives. Cryptography Primitives.
+// GF(p) methods
+//
+*/
+#include "owndefs.h"
+#include "owncp.h"
+
+#include "pcpgfpmethod.h"
+#include "pcpgfpstuff.h"
+
+#if(_IPP >= _IPP_P8) || (_IPP32E >= _IPP32E_M7)
+
+/* arithmetic over P-256r1 NIST modulus */
+BNU_CHUNK_T* p256r1_add(BNU_CHUNK_T* res, const BNU_CHUNK_T* a, const BNU_CHUNK_T* b, IppsGFpState* pGF);
+BNU_CHUNK_T* p256r1_sub(BNU_CHUNK_T* res, const BNU_CHUNK_T* a, const BNU_CHUNK_T* b, IppsGFpState* pGF);
+BNU_CHUNK_T* p256r1_neg(BNU_CHUNK_T* res, const BNU_CHUNK_T* a, IppsGFpState* pGF);
+BNU_CHUNK_T* p256r1_div_by_2 (BNU_CHUNK_T* res, const BNU_CHUNK_T* a, IppsGFpState* pGF);
+BNU_CHUNK_T* p256r1_mul_by_2 (BNU_CHUNK_T* res, const BNU_CHUNK_T* a, IppsGFpState* pGF);
+BNU_CHUNK_T* p256r1_mul_by_3 (BNU_CHUNK_T* res, const BNU_CHUNK_T* a, IppsGFpState* pGF);
+#if(_IPP_ARCH ==_IPP_ARCH_EM64T)
+BNU_CHUNK_T* p256r1_mul_montl(BNU_CHUNK_T* res, const BNU_CHUNK_T* a, const BNU_CHUNK_T* b, IppsGFpState* pGF);
+BNU_CHUNK_T* p256r1_mul_montx(BNU_CHUNK_T* res, const BNU_CHUNK_T* a, const BNU_CHUNK_T* b, IppsGFpState* pGF);
+BNU_CHUNK_T* p256r1_sqr_montl(BNU_CHUNK_T* res, const BNU_CHUNK_T* a, IppsGFpState* pGF);
+BNU_CHUNK_T* p256r1_sqr_montx(BNU_CHUNK_T* res, const BNU_CHUNK_T* a, IppsGFpState* pGF);
+BNU_CHUNK_T* p256r1_to_mont (BNU_CHUNK_T* res, const BNU_CHUNK_T* a, IppsGFpState* pGF);
+BNU_CHUNK_T* p256r1_mont_back(BNU_CHUNK_T* res, const BNU_CHUNK_T* a, IppsGFpState* pGF);
+#endif
+#if(_IPP_ARCH ==_IPP_ARCH_IA32)
+BNU_CHUNK_T* p256r1_mul_mont_slm(BNU_CHUNK_T* res, const BNU_CHUNK_T* a, const BNU_CHUNK_T* b, IppsGFpState* pGF);
+BNU_CHUNK_T* p256r1_sqr_mont_slm(BNU_CHUNK_T* res, const BNU_CHUNK_T* a, IppsGFpState* pGF);
+BNU_CHUNK_T* p256r1_mred(BNU_CHUNK_T* res, BNU_CHUNK_T* product);
+#endif
+
+#define OPERAND_BITSIZE (256)
+#define LEN_P256 (BITS_BNU_CHUNK(OPERAND_BITSIZE))
+
+
+/*
+// ia32 multiplicative methods
+*/
+#if (_IPP_ARCH ==_IPP_ARCH_IA32 )
+static BNU_CHUNK_T* p256r1_mul_montl(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF)
+{
+ BNU_CHUNK_T* product = GFP_POOL(pGF);
+ cpMulAdc_BNU_school(product, pA,LEN_P256, pB,LEN_P256);
+ p256r1_mred(pR, product);
+ return pR;
+}
+
+static BNU_CHUNK_T* p256r1_sqr_montl(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
+{
+ BNU_CHUNK_T* product = GFP_POOL(pGF);
+ cpSqrAdc_BNU_school(product, pA,LEN_P256);
+ p256r1_mred(pR, product);
+ return pR;
+}
+
+
+/*
+// Montgomery domain conversion constants
+*/
+static BNU_CHUNK_T RR[] = {
+ 0x00000003,0x00000000, 0xffffffff,0xfffffffb,
+ 0xfffffffe,0xffffffff, 0xfffffffd,0x00000004};
+
+static BNU_CHUNK_T one[] = {
+ 1,0,0,0,0,0,0,0};
+
+static BNU_CHUNK_T* p256r1_to_mont(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
+{
+ return p256r1_mul_montl(pR, pA, (BNU_CHUNK_T*)RR, pGF);
+}
+
+static BNU_CHUNK_T* p256r1_mont_back(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
+{
+ return p256r1_mul_montl(pR, pA, (BNU_CHUNK_T*)one, pGF);
+}
+
+static BNU_CHUNK_T* p256r1_to_mont_slm(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
+{
+ return p256r1_mul_mont_slm(pR, pA, (BNU_CHUNK_T*)RR, pGF);
+}
+
+static BNU_CHUNK_T* p256r1_mont_back_slm(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
+{
+ return p256r1_mul_mont_slm(pR, pA, (BNU_CHUNK_T*)one, pGF);
+}
+#endif
+
+/*
+// returns methods
+*/
+IPPFUN( const IppsGFpMethod*, ippsGFpMethod_p256r1, (void) )
+{
+ static IppsGFpMethod method = {
+ p256r1_add,
+ p256r1_sub,
+ p256r1_neg,
+ p256r1_div_by_2,
+ p256r1_mul_by_2,
+ p256r1_mul_by_3,
+ p256r1_mul_montl,
+ p256r1_sqr_montl,
+ p256r1_to_mont,
+ p256r1_mont_back
+ };
+
+ #if(_IPP_ARCH==_IPP_ARCH_EM64T) && ((_ADCOX_NI_ENABLING_==_FEATURE_ON_) || (_ADCOX_NI_ENABLING_==_FEATURE_TICKTOCK_))
+ if(IsFeatureEnabled(ADCOX_ENABLED)) {
+ method.mul = p256r1_mul_montx;
+ method.sqr = p256r1_sqr_montx;
+ }
+ #endif
+
+ #if(_IPP_ARCH==_IPP_ARCH_IA32)
+ if(IsFeatureEnabled(ippCPUID_SSSE3|ippCPUID_MOVBE) && !IsFeatureEnabled(ippCPUID_AVX)) {
+ method.mul = p256r1_mul_mont_slm;
+ method.sqr = p256r1_sqr_mont_slm;
+ method.encode = p256r1_to_mont_slm;
+ method.decode = p256r1_mont_back_slm;
+ }
+ #endif
+
+ return &method;
+}
+
+#undef LEN_P256
+#undef OPERAND_BITSIZE
+
+
+#else
+IPPFUN( const IppsGFpMethod*, ippsGFpMethod_p256r1, (void) )
+{
+ return ippsGFpMethod_pArb();
+}
+#endif
diff --git a/ext/ipp/sources/ippcp/src/pcpgfpmethod_com.c b/ext/ipp/sources/ippcp/src/pcpgfpmethod_com.c
new file mode 100644
index 0000000..883fe7b
--- /dev/null
+++ b/ext/ipp/sources/ippcp/src/pcpgfpmethod_com.c
@@ -0,0 +1,164 @@
+/*############################################################################
+ # Copyright 2016-2017 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.
+ ############################################################################*/
+
+/*
+// Intel(R) Performance Primitives. Cryptography Primitives.
+// GF(p) methods
+//
+*/
+#include "owndefs.h"
+#include "owncp.h"
+
+#include "pcpgfpmethod.h"
+#include "pcpgfpstuff.h"
+
+
+
+static BNU_CHUNK_T* arbp_add(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF)
+{
+ /* get temporary from top of GF pool */
+ BNU_CHUNK_T* pTmpR = GFP_POOL(pGF);
+
+ BNU_CHUNK_T* pModulus = GFP_MODULUS(pGF);
+ cpSize elemLen = GFP_FELEN(pGF);
+
+ BNU_CHUNK_T e = cpAdd_BNU(pR, pA, pB, elemLen);
+ e -= cpSub_BNU(pTmpR, pR, pModulus, elemLen);
+ MASKED_COPY_BNU(pR, e, pR, pTmpR, elemLen);
+ return pR;
+}
+
+static BNU_CHUNK_T* arbp_sub(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF)
+{
+ /* get temporary from top of GF pool */
+ BNU_CHUNK_T* pTmpR = GFP_POOL(pGF);
+
+ BNU_CHUNK_T* pModulus = GFP_MODULUS(pGF);
+ cpSize elemLen = GFP_FELEN(pGF);
+
+ BNU_CHUNK_T e = cpSub_BNU(pR, pA, pB, elemLen);
+ cpAdd_BNU(pTmpR, pR, pModulus, elemLen);
+ MASKED_COPY_BNU(pR, (0-e), pTmpR, pR, elemLen);
+ return pR;
+}
+
+static BNU_CHUNK_T* arbp_neg(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
+{
+ /* get temporary from top of GF pool */
+ BNU_CHUNK_T* pTmpR = GFP_POOL(pGF);
+
+ BNU_CHUNK_T* pModulus = GFP_MODULUS(pGF);
+ cpSize elemLen = GFP_FELEN(pGF);
+
+ BNU_CHUNK_T e = cpSub_BNU(pR, pModulus, pA, elemLen);
+ e -= cpSub_BNU(pTmpR, pR, pModulus, elemLen);
+ MASKED_COPY_BNU(pR, e, pR, pTmpR, elemLen);
+ return pR;
+}
+
+static BNU_CHUNK_T* arbp_div_by_2(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
+{
+ BNU_CHUNK_T* pModulus = GFP_MODULUS(pGF);
+ cpSize elemLen = GFP_FELEN(pGF);
+
+ /* t = if(isOdd(A))? modulus : 0 */
+ BNU_CHUNK_T mask = 0 - (pA[0]&1);
+ /* get temporary from top of GF pool */
+ BNU_CHUNK_T* t = GFP_POOL(pGF);
+ cpSize i;
+ for(i=0; i<elemLen; i++) t[i] = pModulus[i] & mask;
+
+ t[elemLen] = cpAdd_BNU(t, t, pA, elemLen);
+ cpLSR_BNU(t, t, elemLen+1, 1);
+ cpGFpElementCopy(pR, t, elemLen);
+ return pR;
+}
+
+static BNU_CHUNK_T* arbp_mul_by_2(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
+{
+ return arbp_add(pR, pA, pA, pGF);
+}
+
+static BNU_CHUNK_T* arbp_mul_by_3(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
+{
+ BNU_CHUNK_T* pTmpR = cpGFpGetPool(1, pGF);
+
+ arbp_add(pTmpR, pA, pA, pGF);
+ arbp_add(pR, pTmpR, pA, pGF);
+
+ cpGFpReleasePool(1, pGF);
+ return pR;
+}
+
+static BNU_CHUNK_T* arbp_mul_montl(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF)
+{
+ BNU_CHUNK_T* pModulus = GFP_MODULUS(pGF);
+ cpSize elemLen = GFP_FELEN(pGF);
+
+ IppsMontState* pMont = GFP_MONT(pGF);
+ BNU_CHUNK_T m0 = MNT_HELPER(pMont);
+
+ /* get temporary from top of GF pool */
+ BNU_CHUNK_T* pBuffer = GFP_POOL(pGF);
+ cpMontMul_BNU(pR, pA,elemLen, pB,elemLen, pModulus,elemLen, m0, pBuffer, NULL);
+ return pR;
+}
+
+static BNU_CHUNK_T* arbp_sqr_montl(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
+{
+ BNU_CHUNK_T* pModulus = GFP_MODULUS(pGF);
+ cpSize elemLen = GFP_FELEN(pGF);
+
+ IppsMontState* pMont = GFP_MONT(pGF);
+ BNU_CHUNK_T m0 = MNT_HELPER(pMont);
+
+ /* get temporary from top of GF pool */
+ BNU_CHUNK_T* pBuffer = GFP_POOL(pGF);
+ cpMontSqr_BNU(pR, pA,elemLen, pModulus,elemLen, m0, pBuffer, NULL);
+ return pR;
+}
+
+static BNU_CHUNK_T* arbp_to_mont(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
+{
+ cpMontEnc_BNU(pR, pA, GFP_FELEN(pGF), GFP_MONT(pGF));
+ return pR;
+}
+
+static BNU_CHUNK_T* arbp_mont_back(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
+{
+ cpMontDec_BNU(pR, pA, GFP_FELEN(pGF), GFP_MONT(pGF));
+ return pR;
+}
+
+/*
+// returns methods
+*/
+IPPFUN( const IppsGFpMethod*, ippsGFpMethod_pArb, (void) )
+{
+ static IppsGFpMethod method = {
+ arbp_add,
+ arbp_sub,
+ arbp_neg,
+ arbp_div_by_2,
+ arbp_mul_by_2,
+ arbp_mul_by_3,
+ arbp_mul_montl,
+ arbp_sqr_montl,
+ arbp_to_mont,
+ arbp_mont_back
+ };
+ return &method;
+}
diff --git a/ext/ipp/sources/ippcp/src/pcpgfpstuff.c b/ext/ipp/sources/ippcp/src/pcpgfpstuff.c
new file mode 100644
index 0000000..423acfe
--- /dev/null
+++ b/ext/ipp/sources/ippcp/src/pcpgfpstuff.c
@@ -0,0 +1,311 @@
+/*############################################################################
+ # Copyright 2010-2017 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.
+ ############################################################################*/
+
+/*
+// Intel(R) Performance Primitives. Cryptography Primitives.
+// Internal operations over GF(p).
+//
+// Context:
+// cpGFpCmpare
+//
+// cpGFpRand
+// cpGFpSet
+// cpGFpGet
+//
+// cpGFpNeg
+// cpGFpInv
+// cpGFpHalve
+// cpGFpAdd
+// cpGFpSub
+// cpGFpMul
+// cpGFpExp, cpGFpExp2
+// cpGFpSqrt
+//
+*/
+#include "owndefs.h"
+#include "owncp.h"
+
+#include "pcpgfpstuff.h"
+#include "pcpgfpmethod.h"
+
+
+BNU_CHUNK_T* cpGFpSet(BNU_CHUNK_T* pElm, const BNU_CHUNK_T* pDataA, int nsA, IppsGFpState* pGFp)
+{
+ const BNU_CHUNK_T* pModulus = GFP_MODULUS(pGFp);
+ int elemLen = GFP_FELEN(pGFp);
+
+ if(0 <= cpCmp_BNU(pDataA, nsA, pModulus, elemLen))
+ return NULL;
+ else {
+ BNU_CHUNK_T* pTmp = cpGFpGetPool(1, pGFp);
+ ZEXPAND_COPY_BNU(pTmp, elemLen, pDataA, nsA);
+ pGFp->encode(pElm, pTmp, pGFp);
+ cpGFpReleasePool(1, pGFp);
+ return pElm;
+ }
+}
+
+BNU_CHUNK_T* cpGFpGet(BNU_CHUNK_T* pDataA, int nsA, const BNU_CHUNK_T* pElm, IppsGFpState* pGFp)
+{
+ int elemLen = GFP_FELEN(pGFp);
+ BNU_CHUNK_T* pTmp = cpGFpGetPool(1, pGFp);
+
+ pGFp->decode(pTmp, pElm, pGFp);
+ ZEXPAND_COPY_BNU(pDataA, nsA, pTmp, elemLen);
+ cpGFpReleasePool(1, pGFp);
+ return pDataA;
+}
+
+BNU_CHUNK_T* cpGFpSetOctString(BNU_CHUNK_T* pElm, const Ipp8u* pStr, int strSize, IppsGFpState* pGFp)
+{
+ int elemLen = GFP_FELEN(pGFp);
+
+ if((int)(elemLen*sizeof(BNU_CHUNK_T)) < strSize)
+ return NULL;
+
+ else {
+ BNU_CHUNK_T* pTmp = cpGFpGetPool(1, pGFp);
+
+ int len = cpFromOctStr_BNU(pTmp, pStr, strSize);
+ ZEXPAND_BNU(pTmp+len, elemLen-len, 0);
+ //pElm = pGFp->encode(pElm, pTmp, pGFp);
+ pGFp->encode(pElm, pTmp, pGFp);
+
+ cpGFpReleasePool(1, pGFp);
+ return pElm;
+ }
+}
+
+Ipp8u* cpGFpGetOctString(Ipp8u* pStr, int strSize, const BNU_CHUNK_T* pElm, IppsGFpState* pGFp)
+{
+ BNU_CHUNK_T* pTmp = cpGFpGetPool(1, pGFp);
+ int elemLen = GFP_FELEN(pGFp);
+
+ pGFp->decode(pTmp, pElm, pGFp);
+ cpToOctStr_BNU(pStr, strSize, pTmp, elemLen);
+
+ cpGFpReleasePool(1, pGFp);
+ return pStr;
+}
+
+BNU_CHUNK_T* cpGFpAdd(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFp)
+{
+ return pGFp->add(pR, pA, pB, pGFp);
+}
+
+
+BNU_CHUNK_T* cpGFpSub(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFp)
+{
+ return pGFp->sub(pR, pA, pB, pGFp);
+}
+
+BNU_CHUNK_T* cpGFpNeg(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFp)
+{
+ return pGFp->neg(pR, pA, pGFp);
+}
+
+BNU_CHUNK_T* cpGFpMul(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFp)
+{
+ return pGFp->mul(pR, pA, pB, pGFp);
+}
+
+BNU_CHUNK_T* cpGFpSqr(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFp)
+{
+ return pGFp->sqr(pR, pA, pGFp);
+}
+
+BNU_CHUNK_T* cpGFpHalve(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFp)
+{
+ return pGFp->div2(pR, pA, pGFp);
+}
+
+
+BNU_CHUNK_T* cpGFpInv(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFp)
+{
+ BNU_CHUNK_T* pModulus = GFP_MODULUS(pGFp);
+ int elemLen = GFP_FELEN(pGFp);
+ int poolelementLen= GFP_PELEN(pGFp);
+
+ BNU_CHUNK_T* tmpM = cpGFpGetPool(4, pGFp);
+ BNU_CHUNK_T* tmpX1= tmpM +poolelementLen;
+ BNU_CHUNK_T* tmpX2= tmpX1+poolelementLen;
+ BNU_CHUNK_T* tmpX3= tmpX2+poolelementLen;
+ int nsR;
+
+ cpGFpElementCopy(tmpM, pModulus, elemLen);
+ nsR = cpModInv_BNU(pR, pA,elemLen, tmpM, elemLen, tmpX1,tmpX2,tmpX3);
+ cpGFpReleasePool(4, pGFp);
+
+ cpGFpElementPadd(pR+nsR, elemLen-nsR, 0);
+ return pGFp->mul(pR, pR, MNT_CUBE_R(GFP_MONT(pGFp)), pGFp);
+}
+
+BNU_CHUNK_T* cpGFpExp(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pE, int nsE, IppsGFpState* pGFp)
+{
+ IppsBigNumState A;
+ IppsBigNumState E;
+ IppsBigNumState R;
+
+ BNU_CHUNK_T* pPool = cpGFpGetPool(3, pGFp);
+ int poolElemLen = GFP_PELEN(pGFp);
+ int elemLen = GFP_FELEN(pGFp);
+
+ cpGFpSetBigNum(&A, elemLen, pA, pPool+0*poolElemLen);
+ cpGFpSetBigNum(&E, nsE, pE, pPool+1*poolElemLen);
+ cpGFpInitBigNum(&R,elemLen, pR, pPool+2*poolElemLen);
+
+ cpMontExpBin_BN(&R, &A, &E, GFP_MONT(pGFp));
+
+ cpGFpReleasePool(3, pGFp);
+ return pR;
+}
+
+static int factor2(BNU_CHUNK_T* pA, int nsA)
+{
+ int factor = 0;
+ int bits;
+
+ int i;
+ for(i=0; i<nsA; i++) {
+ int ntz = cpNTZ_BNU(pA[i]);
+ factor += ntz;
+ if(ntz<BITSIZE(BNU_CHUNK_T))
+ break;
+ }
+
+ bits = factor;
+ if(bits >= BITSIZE(BNU_CHUNK_T)) {
+ int nchunk = bits/BITSIZE(BNU_CHUNK_T);
+ cpGFpElementCopyPadd(pA, nsA, pA+nchunk, nsA-nchunk);
+ bits %= BITSIZE(BNU_CHUNK_T);
+ }
+ if(bits)
+ cpLSR_BNU(pA, pA, nsA, bits);
+
+ return factor;
+}
+
+static BNU_CHUNK_T* cpGFpExp2(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, int e, IppsGFpState* pGFp)
+{
+ cpGFpElementCopy(pR, pA, GFP_FELEN(pGFp));
+ while(e--) {
+ pGFp->sqr(pR, pR, pGFp);
+ }
+ return pR;
+}
+
+/* returns:
+ 0, if a - qnr
+ 1, if sqrt is found
+*/
+int cpGFpSqrt(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFp)
+{
+ int elemLen = GFP_FELEN(pGFp);
+ int poolelementLen = GFP_PELEN(pGFp);
+ int resultFlag = 1;
+
+ /* case A==0 */
+ if( GFP_IS_ZERO(pA, elemLen) )
+ cpGFpElementPadd(pR, elemLen, 0);
+
+ /* general case */
+ else {
+ BNU_CHUNK_T* q = cpGFpGetPool(4, pGFp);
+ BNU_CHUNK_T* x = q + poolelementLen;
+ BNU_CHUNK_T* y = x + poolelementLen;
+ BNU_CHUNK_T* z = y + poolelementLen;
+
+ int s;
+
+ /* z=1 */
+ GFP_ONE(z, elemLen);
+
+ /* (modulus-1) = 2^s*q */
+ cpSub_BNU(q, GFP_MODULUS(pGFp), z, elemLen);
+ s = factor2(q, elemLen);
+
+ /*
+ // initialization
+ */
+
+ /* y = qnr^q */
+ cpGFpExp(y, GFP_QNR(pGFp), q,elemLen, pGFp);
+ /* x = a^((q-1)/2) */
+ cpSub_BNU(q, q, z, elemLen);
+ cpLSR_BNU(q, q, elemLen, 1);
+ cpGFpExp(x, pA, q, elemLen, pGFp);
+ /* z = a*x^2 */
+ pGFp->mul(z, x, x, pGFp);
+ pGFp->mul(z, pA, z, pGFp);
+ /* R = a*x */
+ pGFp->mul(pR, pA, x, pGFp);
+
+ while( !GFP_EQ(z, MNT_1(GFP_MONT(pGFp)), elemLen) ) {
+ int m = 0;
+ cpGFpElementCopy(q, z, elemLen);
+
+ for(m=1; m<s; m++) {
+ pGFp->mul(q, q, q, pGFp);
+ if( GFP_EQ(q, MNT_1(GFP_MONT(pGFp)), elemLen) )
+ break;
+ }
+
+ if(m==s) {
+ /* A is quadratic non-residue */
+ resultFlag = 0;
+ break;
+ }
+ else {
+ /* exponent reduction */
+ cpGFpExp2(q, y, (s-m-1), pGFp); /* q = y^(2^(s-m-1)) */
+ pGFp->mul(y, q, q, pGFp); /* y = q^2 */
+ pGFp->mul(pR, q, pR, pGFp); /* R = q*R */
+ pGFp->mul(z, y, z, pGFp); /* z = z*y */
+ s = m;
+ }
+ }
+
+ /* choose smallest between R and (modulus-R) */
+ pGFp->decode(q, pR, pGFp);
+ if(GFP_GT(q, GFP_HMODULUS(pGFp), elemLen))
+ pGFp->neg(pR, pR, pGFp);
+
+ cpGFpReleasePool(4, pGFp);
+ }
+
+ return resultFlag;
+}
+
+
+BNU_CHUNK_T* cpGFpRand(BNU_CHUNK_T* pR, IppsGFpState* pGFp, IppBitSupplier rndFunc, void* pRndParam)
+{
+ int elemLen = GFP_FELEN(pGFp);
+///int reqBitSize = GFP_FEBITSIZE(pGFp)+GF_RAND_ADD_BITS;
+ int reqBitSize = GFP_FEBITLEN(pGFp)+GF_RAND_ADD_BITS;
+ int nsR = (reqBitSize +BITSIZE(BNU_CHUNK_T)-1)/BITSIZE(BNU_CHUNK_T);
+
+ BNU_CHUNK_T* pPool = cpGFpGetPool(2, pGFp);
+ cpGFpElementPadd(pPool, nsR, 0);
+ rndFunc((Ipp32u*)pPool, reqBitSize, pRndParam);
+
+ nsR = cpMod_BNU(pPool, nsR, GFP_MODULUS(pGFp), elemLen);
+ cpGFpElementPadd(pPool+nsR, elemLen-nsR, 0);
+
+ pGFp->encode(pR, pPool, pGFp);
+
+ cpGFpReleasePool(2, pGFp);
+ return pR;
+}
diff --git a/ext/ipp/sources/ippcpepid/src/pcpgfpstuff.h b/ext/ipp/sources/ippcp/src/pcpgfpstuff.h
index d9b9d8b..996930c 100644
--- a/ext/ipp/sources/ippcpepid/src/pcpgfpstuff.h
+++ b/ext/ipp/sources/ippcp/src/pcpgfpstuff.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2010-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,27 +14,27 @@
# limitations under the License.
############################################################################*/
-/*
+/*
// Purpose:
// Intel(R) Integrated Performance Primitives
// Cryptographic Primitives
// Internal GF(p) basic Definitions & Function Prototypes
-//
-//
+//
*/
#if !defined(_PCP_GFP_H_)
#define _PCP_GFP_H_
#include "pcpbn.h"
+#include "pcpgfpmethod.h"
#include "pcpmontgomery.h"
/* GF element */
-typedef struct _cpElementGFp {
+typedef struct _cpGFpElement {
IppCtxId idCtx; /* GF() element ident */
int length; /* length of element (in BNU_CHUNK_T) */
BNU_CHUNK_T* pData;
-} cpElementGFp;
+} cpGFpElement;
#define GFPE_ID(pCtx) ((pCtx)->idCtx)
#define GFPE_ROOM(pCtx) ((pCtx)->length)
@@ -42,33 +42,31 @@ typedef struct _cpElementGFp {
#define GFPE_TEST_ID(pCtx) (GFPE_ID((pCtx))==idCtxGFPE)
-/* basic GF arithmetic */
-typedef BNU_CHUNK_T* (*addm) (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF);
-typedef BNU_CHUNK_T* (*subm) (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF);
-typedef BNU_CHUNK_T* (*negm) (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
-typedef BNU_CHUNK_T* (*mulm) (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF);
-typedef BNU_CHUNK_T* (*sqrm) (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
-typedef BNU_CHUNK_T* (*div2m)(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
/* GF(p) context */
typedef struct _cpGFp cpGF_T;
typedef struct _cpGFp {
IppCtxId idCtx; /* GFp spec ident */
- int gfdegree; /* degree of extension (==1 means basic GF(p)) */
+ int elemBitLen; /* size of field element (in bits) */
int elemLen; /* size of field element (in BNU_CHUNK_T) */
int elemLen32; /* sizeof of field element (in Ipp32u) */
int pelemLen; /* sizeof pool element (in BNU_CHUNK_T) */
+ int gfdegree; /* degree of extension (==1 means basic GF(p)) */
int modulusTypeSpc;/* modulus type specific */
- int epidParams; /* Intel(R) EPID 2.0 specific parameters */
+ int epidParams; /* EPID 2.0 specific parameters */
cpGF_T* pGroundGF; /* ground GF (refference on itself if basic GF(p)) */
/* = methods: = */
- addm add; /* - gf add */
- subm sub; /* - gf sub */
- negm neg; /* - gf neg */
- mulm mul; /* - gf mul */
- sqrm sqr; /* - gf sqr */
- div2m div2; /* - gf div by 2 */
+ gfadd add; /* - gf add */
+ gfsub sub; /* - gf sub */
+ gfneg neg; /* - gf neg */
+ gfdiv2 div2; /* - gf div by 2 */
+ gfmul2 mul2; /* - gf mul by 2 */
+ gfmul3 mul3; /* - gf mul by 3 */
+ gfmul mul; /* - gf mul */
+ gfsqr sqr; /* - gf sqr */
+ gfencode encode; /* - to internal representation */
+ gfencode decode; /* - from internal representation */
/* ============ */
BNU_CHUNK_T* pModulus; /* modulus or irreducible polypomial (without hight order term ==1) */
BNU_CHUNK_T* pHalfModulus; /* modulus/2 if basic, NULL if extension */
@@ -80,17 +78,17 @@ typedef struct _cpGFp {
#define GFP_ALIGNMENT ((int)(sizeof(void*)))
/* Local definitions */
-#define GF_MAX_BITSIZE (4096) /* max bitsize for GF element */
-#define GF_POOL_SIZE (8)//(10) /* num of elements into the pool */
-#define GF_RAND_ADD_BITS (128) /* parameter of random element generation */
+#define GF_MAX_BITSIZE (IPP_MAX_GF_BITSIZE) /* max bitsize for GF element */
+#define GF_POOL_SIZE (IPP_MAX_EXPONENT_NUM+3) /* num of elements into the pool */
+#define GF_RAND_ADD_BITS (128) /* parameter of random element generation ?? == febits/2 */
#define GFP_ID(pCtx) ((pCtx)->idCtx)
-#define GFP_DEGREE(pCtx) ((pCtx)->gfdegree)
+#define GFP_FEBITLEN(pCtx) ((pCtx)->elemBitLen)
#define GFP_FELEN(pCtx) ((pCtx)->elemLen)
#define GFP_FELEN32(pCtx) ((pCtx)->elemLen32) /////????!!!!
#define GFP_PELEN(pCtx) ((pCtx)->pelemLen)
+#define GFP_DEGREE(pCtx) ((pCtx)->gfdegree)
#define FIELD_POLY_TYPE(pCtx) ((pCtx)->modulusTypeSpc)
-#define EPID_PARAMS(pCtx) ((pCtx)->epidParams)
#define GFP_GROUNDGF(pCtx) ((pCtx)->pGroundGF)
#define GFP_MODULUS(pCtx) ((pCtx)->pModulus)
#define GFP_HMODULUS(pCtx) ((pCtx)->pHalfModulus) /* for Sqrt() function only */
@@ -102,12 +100,10 @@ typedef struct _cpGFp {
#define ARBITRARY (0) /* arbitrary */
#define BINOMIAL (1) /* binomial */
-#define GFP_FEBITSIZE(pCtx) (BITSIZE_BNU(GFP_MODULUS((pCtx)),GFP_FELEN((pCtx))))
+//#define GFP_FEBITSIZE(pCtx) (BITSIZE_BNU(GFP_MODULUS((pCtx)),GFP_FELEN((pCtx))))
#define GFP_IS_BASIC(pCtx) (GFP_GROUNDGF((pCtx))==(pCtx))
#define GFP_TEST_ID(pCtx) (GFP_ID((pCtx))==idCtxGFP)
-#define USE_MONT_SPACE_REPRESENTATION (1)
-
/*
// get/release n element from/to the pool
*/
@@ -178,35 +174,87 @@ __INLINE BNU_CHUNK_T* cpGFpElementSetChunk(BNU_CHUNK_T* pR, int nsR, BNU_CHUNK_T
#define GFP_IS_EVEN(a) (0==((a)[0]&1))
#define GFP_IS_ODD(a) (1==((a)[0]&1))
+__INLINE IppsBigNumState* cpGFpInitBigNum(IppsBigNumState* pBN, int len, BNU_CHUNK_T* pNumBuffer, BNU_CHUNK_T* pTmpBuffer)
+{
+ BN_ID(pBN) = idCtxBigNum;
+ BN_SIGN(pBN) = ippBigNumPOS;
+ BN_NUMBER(pBN) = pNumBuffer;
+ BN_BUFFER(pBN) = pTmpBuffer;
+ BN_ROOM(pBN) = len;
+ BN_SIZE(pBN) = 0;
+ return pBN;
+}
+
+__INLINE IppsBigNumState* cpGFpSetBigNum(IppsBigNumState* pBN, int len, const BNU_CHUNK_T* pBNU, BNU_CHUNK_T* pTmpBuffer)
+{
+ cpGFpInitBigNum(pBN, len, (BNU_CHUNK_T*)pBNU, pTmpBuffer);
+ FIX_BNU(pBNU, len);
+ BN_SIZE(pBN) = len;
+ return pBN;
+}
+
+/* construct GF element */
+__INLINE IppsGFpElement* cpGFpElementConstruct(IppsGFpElement* pR, BNU_CHUNK_T* pDataBufer, int ns)
+{
+ GFPE_ID(pR) = idCtxGFPE;
+ GFPE_ROOM(pR) = ns;
+ GFPE_DATA(pR) = pDataBufer;
+ return pR;
+}
+
-int cpGFpCompare(const IppsGFpState* pGFp1, const IppsGFpState* pGFp2);
+/* size of GFp context, init and setup */
+int cpGFpGetSize(int bitSize);
+IppStatus cpGFpInitGFp(int primeBitSize, IppsGFpState* pGF);
+IppStatus cpGFpSetGFp(const IppsBigNumState* pPrime, const IppsGFpMethod* method, IppsGFpState* pGF);
-BNU_CHUNK_T* cpGFpRand(BNU_CHUNK_T* pR, IppsGFpState* pGF, IppBitSupplier rndFunc, void* pRndParam, int montSpace);
-BNU_CHUNK_T* cpGFpSet (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pDataA, int nsA, IppsGFpState* pGF, int montSpace);
-BNU_CHUNK_T* cpGFpGet (BNU_CHUNK_T* pDataA, int nsA, const BNU_CHUNK_T* pR, IppsGFpState* pGF, int montSpace);
-BNU_CHUNK_T* cpGFpSetOctString(BNU_CHUNK_T* pR, const Ipp8u* pStr, int strSize, IppsGFpState* pGF, int montSpace);
-Ipp8u* cpGFpGetOctString(Ipp8u* pStr, int strSize, const BNU_CHUNK_T* pA, IppsGFpState* pGF, int montSpace);
+/* operations */
+BNU_CHUNK_T* cpGFpRand(BNU_CHUNK_T* pR, IppsGFpState* pGF, IppBitSupplier rndFunc, void* pRndParam);
+#define cpGFpSet OWNAPI(cpGFpSet)
+BNU_CHUNK_T* cpGFpSet (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pDataA, int nsA, IppsGFpState* pGF);
+#define cpGFpGet OWNAPI(cpGFpGet)
+BNU_CHUNK_T* cpGFpGet (BNU_CHUNK_T* pDataA, int nsA, const BNU_CHUNK_T* pR, IppsGFpState* pGF);
+#define cpGFpSetOctString OWNAPI(cpGFpSetOctString)
+BNU_CHUNK_T* cpGFpSetOctString(BNU_CHUNK_T* pR, const Ipp8u* pStr, int strSize, IppsGFpState* pGF);
+#define cpGFpGetOctString OWNAPI(cpGFpGetOctString)
+Ipp8u* cpGFpGetOctString(Ipp8u* pStr, int strSize, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
+#define cpGFpNeg OWNAPI(cpGFpNeg)
BNU_CHUNK_T* cpGFpNeg (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
+#define cpGFpInv OWNAPI(cpGFpInv)
BNU_CHUNK_T* cpGFpInv (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
+#define cpGFpHalve OWNAPI(cpGFpHalve)
BNU_CHUNK_T* cpGFpHalve(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
+#define cpGFpAdd OWNAPI(cpGFpAdd)
BNU_CHUNK_T* cpGFpAdd (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF);
+#define cpGFpSub OWNAPI(cpGFpSub)
BNU_CHUNK_T* cpGFpSub (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF);
+#define cpGFpMul OWNAPI(cpGFpMul)
BNU_CHUNK_T* cpGFpMul (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF);
+#define cpGFpSqr OWNAPI(cpGFpSqr)
BNU_CHUNK_T* cpGFpSqr (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
+#define cpGFpExp OWNAPI(cpGFpExp)
BNU_CHUNK_T* cpGFpExp (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pE, int nsE, IppsGFpState* pGF);
int cpGFpSqrt(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
#if(_IPP32E >= _IPP32E_M7)
+#define cp256pAdd OWNAPI(cp256pAdd)
BNU_CHUNK_T* cp256pAdd(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF);
+#define cp256pSub OWNAPI(cp256pSub)
BNU_CHUNK_T* cp256pSub(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF);
+#define cp256pNeg OWNAPI(cp256pNeg)
BNU_CHUNK_T* cp256pNeg(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
+#define cp256pMul OWNAPI(cp256pMul)
BNU_CHUNK_T* cp256pMul(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF);
+#define cp256pSqr OWNAPI(cp256pSqr)
BNU_CHUNK_T* cp256pSqr(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
+#define cp256pHalve OWNAPI(cp256pHalve)
BNU_CHUNK_T* cp256pHalve(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF);
#endif
+#define cpGFpInitBigNum OWNAPI(cpGFpInitBigNum)
IppsBigNumState* cpGFpInitBigNum(IppsBigNumState* pBN, int len, BNU_CHUNK_T* pNumBuffer, BNU_CHUNK_T* pTmpBuffer);
+#define cpGFpSetBigNum OWNAPI(cpGFpSetBigNum)
IppsBigNumState* cpGFpSetBigNum(IppsBigNumState* pBN, int len, const BNU_CHUNK_T* pBNU, BNU_CHUNK_T* pTmpBuffer);
#endif /* _PCP_GFP_H_ */
diff --git a/ext/ipp/sources/ippcpepid/src/pcpgfpx.c b/ext/ipp/sources/ippcp/src/pcpgfpx.c
index be978bc..bc1df4a 100644
--- a/ext/ipp/sources/ippcpepid/src/pcpgfpx.c
+++ b/ext/ipp/sources/ippcp/src/pcpgfpx.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2010-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -25,7 +25,8 @@
//
*/
-#include "owncpepid.h"
+#include "owndefs.h"
+#include "owncp.h"
#include "pcpgfpstuff.h"
#include "pcpgfpxstuff.h"
@@ -34,7 +35,7 @@
IPPFUN(IppStatus, ippsGFpxGetSize, (const IppsGFpState* pGroundGF, int deg, int* pSizeInBytes))
{
IPP_BAD_PTR2_RET(pGroundGF, pSizeInBytes);
- IPP_BADARG_RET( deg<2, ippStsBadArgErr);
+ IPP_BADARG_RET( deg<IPP_MIN_GF_EXTDEG || deg >IPP_MAX_GF_EXTDEG, ippStsBadArgErr);
pGroundGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGroundGF, GFP_ALIGNMENT) );
IPP_BADARG_RET( !GFP_TEST_ID(pGroundGF), ippStsContextMatchErr );
@@ -49,30 +50,35 @@ IPPFUN(IppStatus, ippsGFpxGetSize, (const IppsGFpState* pGroundGF, int deg, int*
}
}
-static void InitGFpxCtx(const IppsGFpState* pGroundGF, int deg, IppsGFpState* pGFpx)
+static void InitGFpxCtx(const IppsGFpState* pGroundGF, int extDeg, const IppsGFpMethod* method, IppsGFpState* pGFpx)
{
- int elemLen = deg * GFP_FELEN(pGroundGF);
- int elemLen32 = deg* GFP_FELEN32(pGroundGF);
+ //int elemBitLen = extDeg * GFP_FEBITLEN(pGroundGF);
+ int elemLen = extDeg * GFP_FELEN(pGroundGF);
+ int elemLen32 = extDeg * GFP_FELEN32(pGroundGF);
Ipp8u* ptr = (Ipp8u*)pGFpx + sizeof(IppsGFpState);
/* context identifier */
GFP_ID(pGFpx) = idCtxGFP;
/* extension degree */
- GFP_DEGREE(pGFpx) = deg;
+ GFP_DEGREE(pGFpx) = extDeg;
/* length of element */
+ GFP_FEBITLEN(pGFpx)= 0;//elemBitLen;
GFP_FELEN(pGFpx)= elemLen;
GFP_FELEN32(pGFpx) = elemLen32;
GFP_PELEN(pGFpx) = elemLen;
FIELD_POLY_TYPE(pGFpx) = ARBITRARY;
- EPID_PARAMS(pGFpx) = 0;
- pGFpx->add = cpGFpxAdd;
- pGFpx->sub = cpGFpxSub;
- pGFpx->neg = cpGFpxNeg;
- pGFpx->mul = cpGFpxMul;
- pGFpx->sqr = cpGFpxSqr;
- pGFpx->div2= cpGFpxHalve;
+ pGFpx->add = method->add;
+ pGFpx->sub = method->sub;
+ pGFpx->neg = method->neg;
+ pGFpx->div2= method->div2;
+ pGFpx->mul2= method->mul2;
+ pGFpx->mul3= method->mul3;
+ pGFpx->mul = method->mul;
+ pGFpx->sqr = method->sqr;
+ pGFpx->encode = method->encode;
+ pGFpx->decode = method->decode;
/* save ground GF() context address */
GFP_GROUNDGF(pGFpx) = (IppsGFpState*)pGroundGF;
@@ -92,99 +98,65 @@ static void InitGFpxCtx(const IppsGFpState* pGroundGF, int deg, IppsGFpState* pG
/* Init context by arbitrary irreducible polynomial */
-IPPFUN(IppStatus, ippsGFpxInit, (const IppsGFpState* pGroundGF,
- const Ipp32u* pIrrPolynomial, int deg,
- IppsGFpState* pGFpx))
+IPPFUN(IppStatus, ippsGFpxInit,(const IppsGFpState* pGroundGF, int extDeg,
+ const IppsGFpElement* const ppGroundElm[], int nElm,
+ const IppsGFpMethod* method, IppsGFpState* pGFpx))
{
- IPP_BAD_PTR3_RET(pGFpx, pGroundGF, pIrrPolynomial);
+ IPP_BAD_PTR4_RET(pGFpx, pGroundGF, ppGroundElm, method);
pGroundGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGroundGF, GFP_ALIGNMENT) );
- pGFpx = (IppsGFpState*)( IPP_ALIGNED_PTR(pGFpx, GFP_ALIGNMENT) );
- pGroundGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGroundGF, GFP_ALIGNMENT) );
-
- /* init context */
- InitGFpxCtx(pGroundGF, deg, pGFpx);
+ IPP_BADARG_RET( !GFP_TEST_ID(pGroundGF), ippStsContextMatchErr );
- {
- BNU_CHUNK_T* pTmp = cpGFpGetPool(1, pGFpx);
+ IPP_BADARG_RET( extDeg<IPP_MIN_GF_EXTDEG || extDeg>IPP_MAX_GF_EXTDEG, ippStsBadArgErr);
+ IPP_BADARG_RET( 1>nElm || nElm>IPP_MAX_GF_EXTDEG, ippStsSizeErr);
+ IPP_BADARG_RET( nElm>extDeg, ippStsBadArgErr);
- /* copy coefficients of irresucible (except high-order 1) */
- COPY_BNU((Ipp32u*)pTmp, pIrrPolynomial, GFP_FELEN32(pGFpx));
- /* convert coefficients of irresucible into internal representation and store */
- cpGFpxSet(GFP_MODULUS(pGFpx), pTmp, GFP_FELEN(pGFpx), pGFpx, USE_MONT_SPACE_REPRESENTATION);
+ pGFpx = (IppsGFpState*)( IPP_ALIGNED_PTR(pGFpx, GFP_ALIGNMENT) );
+ InitGFpxCtx(pGroundGF, extDeg, method, pGFpx);
- cpGFpReleasePool(1, pGFpx);
- return ippStsNoErr;
+ {
+ BNU_CHUNK_T* pPoly = GFP_MODULUS(pGFpx);
+ int polyTermlen = GFP_FELEN(pGroundGF);
+ int n;
+ for(n=0; n<nElm; n++, pPoly+=polyTermlen) {
+ const IppsGFpElement* pGroundElm = ppGroundElm[n];
+
+ /* test element */
+ IPP_BAD_PTR1_RET(pGroundElm);
+ IPP_BADARG_RET(!GFPE_TEST_ID(pGroundElm), ippStsContextMatchErr);
+ IPP_BADARG_RET(GFPE_ROOM(pGroundElm)!=polyTermlen, ippStsOutOfRangeErr);
+
+ /* copy element */
+ cpGFpElementCopy(pPoly, GFPE_DATA(pGroundElm), polyTermlen);
+ }
}
+
+ return ippStsNoErr;
}
/* Init context by arbitrary irreducible binimial */
-IPPFUN(IppStatus, ippsGFpxInitBinomial,(const IppsGFpState* pGroundGF,
- const IppsGFpElement* pGroundElm, int deg,
+IPPFUN(IppStatus, ippsGFpxInitBinomial,(const IppsGFpState* pGroundGF, int extDeg,
+ const IppsGFpElement* pGroundElm,
+ const IppsGFpMethod* method,
IppsGFpState* pGFpx))
{
- IPP_BAD_PTR3_RET(pGFpx, pGroundGF, pGroundElm);
+ IPP_BAD_PTR4_RET(pGFpx, pGroundGF, pGroundElm, method);
pGroundGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGroundGF, GFP_ALIGNMENT) );
pGFpx = (IppsGFpState*)( IPP_ALIGNED_PTR(pGFpx, GFP_ALIGNMENT) );
- pGroundGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGroundGF, GFP_ALIGNMENT) );
+ IPP_BADARG_RET( !GFP_TEST_ID(pGroundGF), ippStsContextMatchErr );
+
+ IPP_BADARG_RET( extDeg<IPP_MIN_GF_EXTDEG || extDeg>IPP_MAX_GF_EXTDEG, ippStsBadArgErr);
/* init context */
- InitGFpxCtx(pGroundGF, deg, pGFpx);
+ InitGFpxCtx(pGroundGF, extDeg, method, pGFpx);
/* store low-order coefficient of irresucible into the context */
cpGFpElementCopy(GFP_MODULUS(pGFpx), GFPE_DATA(pGroundElm), GFP_FELEN(pGroundGF));
FIELD_POLY_TYPE(pGFpx) = BINOMIAL;
- /* test if field polynomial is match to Intel(R) EPID specific */
- {
- int isEpidParam = 0;
-
- BNU_CHUNK_T* g0 = cpGFpGetPool(1, (IppsGFpState*)pGroundGF);
- int elmLen = GFP_FELEN(pGroundGF);
-
- int basicExt = cpGFpBasicDegreeExtension(pGFpx);
- int basicTermLen = GFP_FELEN(cpGFpBasic(pGroundGF));
-
- /* convert g0 into regular representation */
- cpGFpxGet(g0, elmLen, GFPE_DATA(pGroundElm), (IppsGFpState*)pGroundGF, USE_MONT_SPACE_REPRESENTATION);
-
- switch(basicExt) {
- case 2:
- /* expected polynomial is g() = t^2 + (-beta),
- beta =q-1 */
- isEpidParam = cpGFpElementIsEquChunk(g0,basicTermLen, 1);
- break;
- case 6:
- /* expected polynomial is g() = t^3 + (-xi),
- xi = 2+1*t, coeffs belongs to Fq */
- cpGFpxNeg(g0, g0, (IppsGFpState*)pGroundGF);
- isEpidParam = EPID_PARAMS(pGroundGF)
- && cpGFpElementIsEquChunk(g0,basicTermLen, 2)
- && cpGFpElementIsEquChunk(g0+basicTermLen,basicTermLen, 1);
- break;
- case 12:
- /* expected polynomial is g() = t^2 + (-vi),
- vi = (0+0*t) + (1*t^2+0*t^3) + (0*t^4+0*t^5), coeffs belongs to Fq */
- cpGFpxNeg(g0, g0, (IppsGFpState*)pGroundGF);
- isEpidParam = EPID_PARAMS(pGroundGF)
- && cpGFpElementIsEquChunk(g0,basicTermLen, 0)
- && cpGFpElementIsEquChunk(g0+basicTermLen, basicTermLen, 0)
- && cpGFpElementIsEquChunk(g0+basicTermLen*2,basicTermLen, 1)
- && cpGFpElementIsEquChunk(g0+basicTermLen*3,basicTermLen, 0)
- && cpGFpElementIsEquChunk(g0+basicTermLen*4,basicTermLen, 0)
- && cpGFpElementIsEquChunk(g0+basicTermLen*5,basicTermLen, 0);
- break;
- default:
- isEpidParam = 0;
- break;
- }
- EPID_PARAMS(pGFpx) = isEpidParam;
-
- cpGFpReleasePool(1, (IppsGFpState*)pGroundGF);
- }
-
return ippStsNoErr;
}
+#if 0
/* get general info */
IPPFUN(IppStatus, ippsGFpGetInfo,(const IppsGFpState* pGFpx, IppsGFpInfo* pInfo))
{
@@ -200,3 +172,4 @@ IPPFUN(IppStatus, ippsGFpGetInfo,(const IppsGFpState* pGFpx, IppsGFpInfo* pInfo)
return ippStsNoErr;
}
+#endif
diff --git a/ext/ipp/sources/ippcp/src/pcpgfpxmethod_binom.c b/ext/ipp/sources/ippcp/src/pcpgfpxmethod_binom.c
new file mode 100644
index 0000000..e53c475
--- /dev/null
+++ b/ext/ipp/sources/ippcp/src/pcpgfpxmethod_binom.c
@@ -0,0 +1,359 @@
+/*############################################################################
+ # Copyright 2016-2017 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.
+ ############################################################################*/
+
+/*
+// Intel(R) Performance Primitives. Cryptography Primitives.
+// GF(p^d) methods, if binomial generator
+//
+*/
+#include "owndefs.h"
+#include "owncp.h"
+
+#include "pcpgfpxstuff.h"
+#include "pcpgfpxmethod_com.h"
+
+static BNU_CHUNK_T* cpGFpxMul_G0(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ BNU_CHUNK_T* pGFpolynomial = GFP_MODULUS(pGFpx); /* g(x) = t^d + g0 */
+#if defined GS_DBG
+ BNU_CHUNK_T* arg0 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* arg1 = cpGFpGetPool(1, pGroundGF);
+ int groundElemLen = GFP_FELEN(pGroundGF);
+#endif
+ //return pGroundGF->mul(pR, pA, pGFpolynomial, GFP_GROUNDGF(pGFpx));
+#if defined GS_DBG
+ cpGFpxGet(arg0, groundElemLen, pA, pGroundGF);
+ cpGFpxGet(arg1, groundElemLen, pGFpolynomial, pGroundGF);
+#endif
+ pGroundGF->mul(pR, pA, pGFpolynomial, GFP_GROUNDGF(pGFpx));
+#if defined GS_DBG
+ cpGFpReleasePool(2, pGroundGF);
+#endif
+ return pR;
+}
+
+/*
+// Multiplication in GF(p^2), if field polynomial: g(x) = t^2 + beta => binominal
+*/
+BNU_CHUNK_T* cpGFpxMul_p2_binom(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ int groundElemLen = GFP_FELEN(pGroundGF);
+
+ const BNU_CHUNK_T* pA0 = pA;
+ const BNU_CHUNK_T* pA1 = pA+groundElemLen;
+
+ const BNU_CHUNK_T* pB0 = pB;
+ const BNU_CHUNK_T* pB1 = pB+groundElemLen;
+
+ BNU_CHUNK_T* pR0 = pR;
+ BNU_CHUNK_T* pR1 = pR+groundElemLen;
+
+ BNU_CHUNK_T* t0 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* t1 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* t2 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* t3 = cpGFpGetPool(1, pGroundGF);
+#if defined GS_DBG
+ BNU_CHUNK_T* arg0 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* arg1 = cpGFpGetPool(1, pGroundGF);
+#endif
+
+#if defined GS_DBG
+ cpGFpxGet(arg0, groundElemLen, pA0, pGroundGF);
+ cpGFpxGet(arg1, groundElemLen, pB0, pGroundGF);
+#endif
+ pGroundGF->mul(t0, pA0, pB0, pGroundGF); /* t0 = a[0]*b[0] */
+#if defined GS_DBG
+ cpGFpxGet(arg0, groundElemLen, pA1, pGroundGF);
+ cpGFpxGet(arg1, groundElemLen, pB1, pGroundGF);
+#endif
+ pGroundGF->mul(t1, pA1, pB1, pGroundGF); /* t1 = a[1]*b[1] */
+ pGroundGF->add(t2, pA0, pA1, pGroundGF); /* t2 = a[0]+a[1] */
+ pGroundGF->add(t3, pB0, pB1, pGroundGF); /* t3 = b[0]+b[1] */
+
+#if defined GS_DBG
+ cpGFpxGet(arg0, groundElemLen, t2, pGroundGF);
+ cpGFpxGet(arg1, groundElemLen, t3, pGroundGF);
+#endif
+ pGroundGF->mul(pR1, t2, t3, pGroundGF); /* r[1] = (a[0]+a[1]) * (b[0]+b[1]) */
+ pGroundGF->sub(pR1, pR1, t0, pGroundGF); /* r[1] -= a[0]*b[0]) + a[1]*b[1] */
+ pGroundGF->sub(pR1, pR1, t1, pGroundGF);
+
+ cpGFpxMul_G0(t1, t1, pGFpx);
+ pGroundGF->sub(pR0, t0, t1, pGroundGF);
+
+#if defined GS_DBG
+ cpGFpReleasePool(2, pGroundGF);
+#endif
+ cpGFpReleasePool(4, pGroundGF);
+ return pR;
+}
+
+/*
+// Squaring in GF(p^2), if field polynomial: g(x) = t^2 + beta => binominal
+*/
+BNU_CHUNK_T* cpGFpxSqr_p2_binom(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ int groundElemLen = GFP_FELEN(pGroundGF);
+
+ const BNU_CHUNK_T* pA0 = pA;
+ const BNU_CHUNK_T* pA1 = pA+groundElemLen;
+
+ BNU_CHUNK_T* pR0 = pR;
+ BNU_CHUNK_T* pR1 = pR+groundElemLen;
+
+ BNU_CHUNK_T* t0 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* t1 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* u0 = cpGFpGetPool(1, pGroundGF);
+#if defined GS_DBG
+ BNU_CHUNK_T* arg0 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* arg1 = cpGFpGetPool(1, pGroundGF);
+#endif
+
+#if defined GS_DBG
+ cpGFpxGet(arg0, groundElemLen, pA0, pGroundGF);
+ cpGFpxGet(arg1, groundElemLen, pA1, pGroundGF);
+#endif
+ pGroundGF->mul(u0, pA0, pA1, pGroundGF); /* u0 = a[0]*a[1] */
+ pGroundGF->sqr(t0, pA0, pGroundGF); /* t0 = a[0]*a[0] */
+ pGroundGF->sqr(t1, pA1, pGroundGF); /* t1 = a[1]*a[1] */
+ cpGFpxMul_G0(t1, t1, pGFpx);
+ pGroundGF->sub(pR0, t0, t1, pGroundGF);
+ pGroundGF->add(pR1, u0, u0, pGroundGF); /* r[1] = 2*a[0]*a[1] */
+
+#if defined GS_DBG
+ cpGFpReleasePool(2, pGroundGF);
+#endif
+ cpGFpReleasePool(3, pGroundGF);
+ return pR;
+}
+
+/*
+// returns methods
+*/
+IPPFUN( const IppsGFpMethod*, ippsGFpxMethod_binom2, (void) )
+{
+ static IppsGFpMethod method = {
+ cpGFpxAdd_com,
+ cpGFpxSub_com,
+ cpGFpxNeg_com,
+ cpGFpxDiv2_com,
+ cpGFpxMul2_com,
+ cpGFpxMul3_com,
+ cpGFpxMul_p2_binom,
+ cpGFpxSqr_p2_binom,
+ cpGFpxEncode_com,
+ cpGFpxDecode_com
+ };
+ return &method;
+}
+
+
+/*
+// Multiplication in GF(p^3), if field polynomial: g(x) = t^2 + beta => binominal
+*/
+BNU_CHUNK_T* cpGFpxMul_p3_binom(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ int groundElemLen = GFP_FELEN(pGroundGF);
+
+ const BNU_CHUNK_T* pA0 = pA;
+ const BNU_CHUNK_T* pA1 = pA+groundElemLen;
+ const BNU_CHUNK_T* pA2 = pA+groundElemLen*2;
+
+ const BNU_CHUNK_T* pB0 = pB;
+ const BNU_CHUNK_T* pB1 = pB+groundElemLen;
+ const BNU_CHUNK_T* pB2 = pB+groundElemLen*2;
+
+ BNU_CHUNK_T* pR0 = pR;
+ BNU_CHUNK_T* pR1 = pR+groundElemLen;
+ BNU_CHUNK_T* pR2 = pR+groundElemLen*2;
+
+ BNU_CHUNK_T* t0 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* t1 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* t2 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* u0 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* u1 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* u2 = cpGFpGetPool(1, pGroundGF);
+
+ pGroundGF->add(u0 ,pA0, pA1, pGroundGF); /* u0 = a[0]+a[1] */
+ pGroundGF->add(t0 ,pB0, pB1, pGroundGF); /* t0 = b[0]+b[1] */
+ pGroundGF->mul(u0, u0, t0, pGroundGF); /* u0 = (a[0]+a[1])*(b[0]+b[1]) */
+ pGroundGF->mul(t0, pA0, pB0, pGroundGF); /* t0 = a[0]*b[0] */
+
+ pGroundGF->add(u1 ,pA1, pA2, pGroundGF); /* u1 = a[1]+a[2] */
+ pGroundGF->add(t1 ,pB1, pB2, pGroundGF); /* t1 = b[1]+b[2] */
+ pGroundGF->mul(u1, u1, t1, pGroundGF); /* u1 = (a[1]+a[2])*(b[1]+b[2]) */
+ pGroundGF->mul(t1, pA1, pB1, pGroundGF); /* t1 = a[1]*b[1] */
+
+ pGroundGF->add(u2 ,pA2, pA0, pGroundGF); /* u2 = a[2]+a[0] */
+ pGroundGF->add(t2 ,pB2, pB0, pGroundGF); /* t2 = b[2]+b[0] */
+ pGroundGF->mul(u2, u2, t2, pGroundGF); /* u2 = (a[2]+a[0])*(b[2]+b[0]) */
+ pGroundGF->mul(t2, pA2, pB2, pGroundGF); /* t2 = a[2]*b[2] */
+
+ pGroundGF->sub(u0, u0, t0, pGroundGF); /* u0 = a[0]*b[1]+a[1]*b[0] */
+ pGroundGF->sub(u0, u0, t1, pGroundGF);
+ pGroundGF->sub(u1, u1, t1, pGroundGF); /* u1 = a[1]*b[2]+a[2]*b[1] */
+ pGroundGF->sub(u1, u1, t2, pGroundGF);
+ pGroundGF->sub(u2, u2, t2, pGroundGF); /* u2 = a[2]*b[0]+a[0]*b[2] */
+ pGroundGF->sub(u2, u2, t0, pGroundGF);
+
+ cpGFpxMul_G0(u1, u1, pGFpx); /* u1 = (a[1]*b[2]+a[2]*b[1]) * beta */
+ cpGFpxMul_G0(t2, t2, pGFpx); /* t2 = a[2]*b[2] * beta */
+
+ pGroundGF->sub(pR0, t0, u1, pGroundGF); /* r[0] = a[0]*b[0] - (a[2]*b[1]+a[1]*b[2])*beta */
+ pGroundGF->sub(pR1, u0, t2, pGroundGF); /* r[1] = a[1]*b[0] + a[0]*b[1] - a[2]*b[2]*beta */
+
+ pGroundGF->add(pR2, u2, t1, pGroundGF); /* r[2] = a[2]*b[0] + a[1]*b[1] + a[0]*b[2] */
+
+ cpGFpReleasePool(6, pGroundGF);
+ return pR;
+}
+
+/*
+// Squaring in GF(p^3), if field polynomial: g(x) = t^2 + beta => binominal
+*/
+BNU_CHUNK_T* cpGFpxSqr_p3_binom(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ int groundElemLen = GFP_FELEN(pGroundGF);
+
+ const BNU_CHUNK_T* pA0 = pA;
+ const BNU_CHUNK_T* pA1 = pA+groundElemLen;
+ const BNU_CHUNK_T* pA2 = pA+groundElemLen*2;
+
+ BNU_CHUNK_T* pR0 = pR;
+ BNU_CHUNK_T* pR1 = pR+groundElemLen;
+ BNU_CHUNK_T* pR2 = pR+groundElemLen*2;
+
+ BNU_CHUNK_T* s0 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* s1 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* s2 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* s3 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* s4 = cpGFpGetPool(1, pGroundGF);
+
+ pGroundGF->add(s2, pA0, pA2, pGroundGF);
+ pGroundGF->sub(s2, s2, pA1, pGroundGF);
+ pGroundGF->sqr(s2, s2, pGroundGF);
+ pGroundGF->sqr(s0, pA0, pGroundGF);
+ pGroundGF->sqr(s4, pA2, pGroundGF);
+ pGroundGF->mul(s1, pA0, pA1, pGroundGF);
+ pGroundGF->mul(s3, pA1, pA2, pGroundGF);
+ pGroundGF->add(s1, s1, s1, pGroundGF);
+ pGroundGF->add(s3, s3, s3, pGroundGF);
+
+ pGroundGF->add(pR2, s1, s2, pGroundGF);
+ pGroundGF->add(pR2, pR2, s3, pGroundGF);
+ pGroundGF->sub(pR2, pR2, s0, pGroundGF);
+ pGroundGF->sub(pR2, pR2, s4, pGroundGF);
+
+ cpGFpxMul_G0(s4, s4, pGFpx);
+ pGroundGF->sub(pR1, s1, s4, pGroundGF);
+
+ cpGFpxMul_G0(s3, s3, pGFpx);
+ pGroundGF->sub(pR0, s0, s3, pGroundGF);
+
+ cpGFpReleasePool(5, pGroundGF);
+ return pR;
+}
+
+
+/*
+// returns methods
+*/
+IPPFUN( const IppsGFpMethod*, ippsGFpxMethod_binom3, (void) )
+{
+ static IppsGFpMethod method = {
+ cpGFpxAdd_com,
+ cpGFpxSub_com,
+ cpGFpxNeg_com,
+ cpGFpxDiv2_com,
+ cpGFpxMul2_com,
+ cpGFpxMul3_com,
+ cpGFpxMul_p3_binom,
+ cpGFpxSqr_p3_binom,
+ cpGFpxEncode_com,
+ cpGFpxDecode_com
+ };
+ return &method;
+}
+
+
+/*
+// Multiplication in GF(p^d), if field polynomial: g(x) = t^d + beta => binominal
+*/
+BNU_CHUNK_T* cpGFpxMul_pd_binom(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx)
+{
+ BNU_CHUNK_T* pGFpolynomial = GFP_MODULUS(pGFpx);
+ int deg = GFP_DEGREE(pGFpx);
+ int elemLen= GFP_FELEN(pGFpx);
+ int groundElemLen = GFP_FELEN(GFP_GROUNDGF(pGFpx));
+ int d;
+
+ BNU_CHUNK_T* R = cpGFpGetPool(1, pGFpx);
+ BNU_CHUNK_T* X = cpGFpGetPool(1, pGFpx);
+ BNU_CHUNK_T* T = cpGFpGetPool(2, pGFpx);
+ BNU_CHUNK_T* T0= T;
+ BNU_CHUNK_T* T1= T+elemLen;
+
+ /* T0 = A * beta */
+ cpGFpxMul_GFE(T0, pA, pGFpolynomial, pGFpx);
+ /* T1 = A */
+ cpGFpElementCopy(T1, pA, elemLen);
+
+ /* R = A * B[0] */
+ cpGFpxMul_GFE(R, pA, pB, pGFpx);
+
+ /* R += (A*B[d]) mod g() */
+ for(d=1; d<deg; d++) {
+ cpGFpxMul_GFE(X, GFPX_IDX_ELEMENT(T0, deg-d, groundElemLen), GFPX_IDX_ELEMENT(pB, d, groundElemLen), pGFpx);
+ pGFpx->add(R, R, X, pGFpx);
+ }
+ cpGFpElementCopy(pR, R, elemLen);
+
+ cpGFpReleasePool(4, pGFpx);
+ return pR;
+}
+
+/*
+// Squaring in GF(p^d), if field polynomial: g(x) = t^d + beta => binominal
+*/
+BNU_CHUNK_T* cpGFpxSqr_pd_binom(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ return cpGFpxMul_pd_binom(pR, pA, pA, pGFpx);
+}
+
+/*
+// returns methods
+*/
+IPPFUN( const IppsGFpMethod*, ippsGFpxMethod_binom, (void) )
+{
+ static IppsGFpMethod method = {
+ cpGFpxAdd_com,
+ cpGFpxSub_com,
+ cpGFpxNeg_com,
+ cpGFpxDiv2_com,
+ cpGFpxMul2_com,
+ cpGFpxMul3_com,
+ cpGFpxMul_pd_binom,
+ cpGFpxSqr_pd_binom,
+ cpGFpxEncode_com,
+ cpGFpxDecode_com
+ };
+ return &method;
+}
diff --git a/ext/ipp/sources/ippcp/src/pcpgfpxmethod_binom_epid2.c b/ext/ipp/sources/ippcp/src/pcpgfpxmethod_binom_epid2.c
new file mode 100644
index 0000000..51aa412
--- /dev/null
+++ b/ext/ipp/sources/ippcp/src/pcpgfpxmethod_binom_epid2.c
@@ -0,0 +1,379 @@
+/*############################################################################
+ # Copyright 2016-2017 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.
+ ############################################################################*/
+
+/*
+// Intel(R) Performance Primitives. Cryptography Primitives.
+// GF(p^d) methods, if binomial generator
+//
+*/
+#include "owndefs.h"
+#include "owncp.h"
+
+#include "pcpgfpxstuff.h"
+#include "pcpgfpxmethod_com.h"
+
+/*
+// multiplication like GF(()^d).mul(a, g0),
+// where:
+// a, g0 belongs to ground GF()
+// and g0 is low-order term of GF(()^d) generationg binominal g(t) = t^d + g0
+// is very important for EPID 2.0.
+//
+// Thus, this kind of multiplication is using
+// 1) in iplementation of GF(p^2) multiplication
+// 2) in iplementation of GF((p^6)^2) multiplication too
+*/
+
+__INLINE BNU_CHUNK_T* cpFq2Mul_xi(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ BNU_CHUNK_T* t0 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* t1 = cpGFpGetPool(1, pGroundGF);
+
+ int termLen = GFP_FELEN(pGroundGF);
+
+ const BNU_CHUNK_T* pA0 = pA;
+ const BNU_CHUNK_T* pA1 = pA+termLen;
+ BNU_CHUNK_T* pR0 = pR;
+ BNU_CHUNK_T* pR1 = pR+termLen;
+ pGroundGF->add(t0, pA0, pA0, pGroundGF);
+ pGroundGF->add(t1, pA0, pA1, pGroundGF);
+ pGroundGF->sub(pR0, t0, pA1, pGroundGF);
+ pGroundGF->add(pR1, t1, pA1, pGroundGF);
+
+ cpGFpReleasePool(2, pGroundGF);
+ return pR;
+}
+
+__INLINE BNU_CHUNK_T* cpFq6Mul_vi(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ int termLen = GFP_FELEN(pGroundGF);
+
+ const BNU_CHUNK_T* pA0 = pA;
+ const BNU_CHUNK_T* pA1 = pA+termLen;
+ const BNU_CHUNK_T* pA2 = pA+termLen*2;
+ BNU_CHUNK_T* pR0 = pR;
+ BNU_CHUNK_T* pR1 = pR+termLen;
+ BNU_CHUNK_T* pR2 = pR+termLen*2;
+
+ BNU_CHUNK_T* t = cpGFpGetPool(1, pGroundGF);
+
+ cpFq2Mul_xi(t, pA2, pGroundGF);
+ cpGFpElementCopy(pR2, pA1, termLen);
+ cpGFpElementCopy(pR1, pA0, termLen);
+ cpGFpElementCopy(pR0, t, termLen);
+
+ cpGFpReleasePool(1, pGroundGF);
+
+ return pR;
+}
+
+static BNU_CHUNK_T* cpGFpxMul_G0(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ BNU_CHUNK_T* pGFpolynomial = GFP_MODULUS(pGFpx); /* g(x) = t^d + g0 */
+ return pGroundGF->mul(pR, pA, pGFpolynomial, GFP_GROUNDGF(pGFpx));
+}
+
+/*
+// Multiplication in GF(p^2), if field polynomial: g(x) = t^2 + beta => binominal
+*/
+BNU_CHUNK_T* cpGFpxMul_p2_binom_epid2(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ int groundElemLen = GFP_FELEN(pGroundGF);
+
+ const BNU_CHUNK_T* pA0 = pA;
+ const BNU_CHUNK_T* pA1 = pA+groundElemLen;
+
+ const BNU_CHUNK_T* pB0 = pB;
+ const BNU_CHUNK_T* pB1 = pB+groundElemLen;
+
+ BNU_CHUNK_T* pR0 = pR;
+ BNU_CHUNK_T* pR1 = pR+groundElemLen;
+
+ BNU_CHUNK_T* t0 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* t1 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* t2 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* t3 = cpGFpGetPool(1, pGroundGF);
+
+ pGroundGF->mul(t0, pA0, pB0, pGroundGF); /* t0 = a[0]*b[0] */
+ pGroundGF->mul(t1, pA1, pB1, pGroundGF); /* t1 = a[1]*b[1] */
+ pGroundGF->add(t2, pA0, pA1,pGroundGF); /* t2 = a[0]+a[1] */
+ pGroundGF->add(t3, pB0, pB1,pGroundGF); /* t3 = b[0]+b[1] */
+
+ pGroundGF->mul(pR1, t2, t3, pGroundGF); /* r[1] = (a[0]+a[1]) * (b[0]+b[1]) */
+ pGroundGF->sub(pR1, pR1, t0, pGroundGF); /* r[1] -= a[0]*b[0]) + a[1]*b[1] */
+ pGroundGF->sub(pR1, pR1, t1, pGroundGF);
+
+ /* EPID2 specific */
+ {
+ int basicExtDegree = cpGFpBasicDegreeExtension(pGFpx);
+
+ /* deal with GF(p^2) */
+ if(basicExtDegree==2) {
+ pGroundGF->sub(pR0, t0, t1, pGroundGF);
+ }
+ /* deal with GF(p^6^2) */
+ else if(basicExtDegree==12) {
+ cpFq6Mul_vi(t1, t1, pGroundGF);
+ pGroundGF->add(pR0, t0, t1, pGroundGF);
+ }
+ /* deal with GF(p^x^2) - it's not EPID2 case, just a case */
+ else {
+ cpGFpxMul_G0(t1, t1, pGFpx);
+ pGroundGF->sub(pR0, t0, t1, pGroundGF);
+ }
+ }
+
+ cpGFpReleasePool(4, pGroundGF);
+ return pR;
+}
+
+/*
+// Squaring in GF(p^2), if field polynomial: g(x) = t^2 + beta => binominal
+*/
+BNU_CHUNK_T* cpGFpxSqr_p2_binom_epid2(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ int groundElemLen = GFP_FELEN(pGroundGF);
+
+ const BNU_CHUNK_T* pA0 = pA;
+ const BNU_CHUNK_T* pA1 = pA+groundElemLen;
+
+ BNU_CHUNK_T* pR0 = pR;
+ BNU_CHUNK_T* pR1 = pR+groundElemLen;
+
+ BNU_CHUNK_T* t0 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* t1 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* u0 = cpGFpGetPool(1, pGroundGF);
+
+ pGroundGF->mul(u0, pA0, pA1, pGroundGF); /* u0 = a[0]*a[1] */
+
+ /* EPID2 specific */
+ {
+ int basicExtDegree = cpGFpBasicDegreeExtension(pGFpx);
+
+ /* deal with GF(p^2) */
+ if(basicExtDegree==2) {
+ pGroundGF->add(t0, pA0, pA1, pGroundGF);
+ pGroundGF->sub(t1, pA0, pA1, pGroundGF);
+ pGroundGF->mul(pR0, t0, t1, pGroundGF);
+ pGroundGF->add(pR1, u0, u0, pGroundGF); /* r[1] = 2*a[0]*a[1] */
+ }
+ /* deal with GF(p^6^2) */
+ else if(basicExtDegree==12) {
+ pGroundGF->sub(t0, pA0, pA1, pGroundGF);
+ cpFq6Mul_vi(t1, pA1, pGroundGF);
+ pGroundGF->sub(t1, pA0, t1, pGroundGF);
+ pGroundGF->mul(t0, t0, t1, pGroundGF);
+ pGroundGF->add(t0, t0, u0, pGroundGF);
+ cpFq6Mul_vi(t1, u0, pGroundGF);
+ pGroundGF->add(pR0, t0, t1, pGroundGF);
+ pGroundGF->add(pR1, u0, u0, pGroundGF);
+ }
+ /* just a case */
+ else {
+ pGroundGF->sqr(t0, pA0, pGroundGF); /* t0 = a[0]*a[0] */
+ pGroundGF->sqr(t1, pA1, pGroundGF); /* t1 = a[1]*a[1] */
+ cpGFpxMul_G0(t1, t1, pGFpx);
+ pGroundGF->sub(pR0, t0, t1, pGroundGF);
+ pGroundGF->add(pR1, u0, u0, pGroundGF); /* r[1] = 2*a[0]*a[1] */
+ }
+ }
+
+ cpGFpReleasePool(3, pGroundGF);
+ return pR;
+}
+
+/*
+// returns methods
+*/
+IPPFUN( const IppsGFpMethod*, ippsGFpxMethod_binom2_epid2, (void) )
+{
+ static IppsGFpMethod method = {
+ cpGFpxAdd_com,
+ cpGFpxSub_com,
+ cpGFpxNeg_com,
+ cpGFpxDiv2_com,
+ cpGFpxMul2_com,
+ cpGFpxMul3_com,
+ cpGFpxMul_p2_binom_epid2,
+ cpGFpxSqr_p2_binom_epid2,
+ cpGFpxEncode_com,
+ cpGFpxDecode_com
+ };
+ return &method;
+}
+
+
+/*
+// Multiplication in GF(p^3), if field polynomial: g(x) = t^2 + beta => binominal
+*/
+BNU_CHUNK_T* cpGFpxMul_p3_binom_epid2(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ int groundElemLen = GFP_FELEN(pGroundGF);
+
+ const BNU_CHUNK_T* pA0 = pA;
+ const BNU_CHUNK_T* pA1 = pA+groundElemLen;
+ const BNU_CHUNK_T* pA2 = pA+groundElemLen*2;
+
+ const BNU_CHUNK_T* pB0 = pB;
+ const BNU_CHUNK_T* pB1 = pB+groundElemLen;
+ const BNU_CHUNK_T* pB2 = pB+groundElemLen*2;
+
+ BNU_CHUNK_T* pR0 = pR;
+ BNU_CHUNK_T* pR1 = pR+groundElemLen;
+ BNU_CHUNK_T* pR2 = pR+groundElemLen*2;
+
+ BNU_CHUNK_T* t0 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* t1 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* t2 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* u0 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* u1 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* u2 = cpGFpGetPool(1, pGroundGF);
+
+ pGroundGF->add(u0 ,pA0, pA1, pGroundGF); /* u0 = a[0]+a[1] */
+ pGroundGF->add(t0 ,pB0, pB1, pGroundGF); /* t0 = b[0]+b[1] */
+ pGroundGF->mul(u0, u0, t0, pGroundGF); /* u0 = (a[0]+a[1])*(b[0]+b[1]) */
+ pGroundGF->mul(t0, pA0, pB0, pGroundGF); /* t0 = a[0]*b[0] */
+
+ pGroundGF->add(u1 ,pA1, pA2, pGroundGF); /* u1 = a[1]+a[2] */
+ pGroundGF->add(t1 ,pB1, pB2, pGroundGF); /* t1 = b[1]+b[2] */
+ pGroundGF->mul(u1, u1, t1, pGroundGF); /* u1 = (a[1]+a[2])*(b[1]+b[2]) */
+ pGroundGF->mul(t1, pA1, pB1, pGroundGF); /* t1 = a[1]*b[1] */
+
+ pGroundGF->add(u2 ,pA2, pA0, pGroundGF); /* u2 = a[2]+a[0] */
+ pGroundGF->add(t2 ,pB2, pB0, pGroundGF); /* t2 = b[2]+b[0] */
+ pGroundGF->mul(u2, u2, t2, pGroundGF); /* u2 = (a[2]+a[0])*(b[2]+b[0]) */
+ pGroundGF->mul(t2, pA2, pB2, pGroundGF); /* t2 = a[2]*b[2] */
+
+ pGroundGF->sub(u0, u0, t0, pGroundGF); /* u0 = a[0]*b[1]+a[1]*b[0] */
+ pGroundGF->sub(u0, u0, t1, pGroundGF);
+ pGroundGF->sub(u1, u1, t1, pGroundGF); /* u1 = a[1]*b[2]+a[2]*b[1] */
+ pGroundGF->sub(u1, u1, t2, pGroundGF);
+ pGroundGF->sub(u2, u2, t2, pGroundGF); /* u2 = a[2]*b[0]+a[0]*b[2] */
+ pGroundGF->sub(u2, u2, t0, pGroundGF);
+
+ /* EPID2 specific */
+ {
+ int basicExtDegree = cpGFpBasicDegreeExtension(pGFpx);
+
+ /* deal with GF(p^2^3) */
+ if(basicExtDegree==6) {
+ cpFq2Mul_xi(u1, u1, pGroundGF);
+ cpFq2Mul_xi(t2, t2, pGroundGF);
+ pGroundGF->add(pR0, t0, u1, pGroundGF); /* r[0] = a[0]*b[0] - (a[2]*b[1]+a[1]*b[2])*beta */
+ pGroundGF->add(pR1, u0, t2, pGroundGF); /* r[1] = a[1]*b[0] + a[0]*b[1] - a[2]*b[2]*beta */
+ }
+ /* just a case */
+ else {
+ cpGFpxMul_G0(u1, u1, pGFpx); /* u1 = (a[1]*b[2]+a[2]*b[1]) * beta */
+ cpGFpxMul_G0(t2, t2, pGFpx); /* t2 = a[2]*b[2] * beta */
+ pGroundGF->sub(pR0, t0, u1, pGroundGF); /* r[0] = a[0]*b[0] - (a[2]*b[1]+a[1]*b[2])*beta */
+ pGroundGF->sub(pR1, u0, t2, pGroundGF); /* r[1] = a[1]*b[0] + a[0]*b[1] - a[2]*b[2]*beta */
+ }
+ }
+
+ pGroundGF->add(pR2, u2, t1, pGroundGF); /* r[2] = a[2]*b[0] + a[1]*b[1] + a[0]*b[2] */
+
+ cpGFpReleasePool(6, pGroundGF);
+ return pR;
+}
+
+/*
+// Squaring in GF(p^3), if field polynomial: g(x) = t^2 + beta => binominal
+*/
+BNU_CHUNK_T* cpGFpxSqr_p3_binom_epid2(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ int groundElemLen = GFP_FELEN(pGroundGF);
+
+ const BNU_CHUNK_T* pA0 = pA;
+ const BNU_CHUNK_T* pA1 = pA+groundElemLen;
+ const BNU_CHUNK_T* pA2 = pA+groundElemLen*2;
+
+ BNU_CHUNK_T* pR0 = pR;
+ BNU_CHUNK_T* pR1 = pR+groundElemLen;
+ BNU_CHUNK_T* pR2 = pR+groundElemLen*2;
+
+ BNU_CHUNK_T* s0 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* s1 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* s2 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* s3 = cpGFpGetPool(1, pGroundGF);
+ BNU_CHUNK_T* s4 = cpGFpGetPool(1, pGroundGF);
+
+ pGroundGF->add(s2, pA0, pA2, pGroundGF);
+ pGroundGF->sub(s2, s2, pA1, pGroundGF);
+ pGroundGF->sqr(s2, s2, pGroundGF);
+ pGroundGF->sqr(s0, pA0, pGroundGF);
+ pGroundGF->sqr(s4, pA2, pGroundGF);
+ pGroundGF->mul(s1, pA0, pA1, pGroundGF);
+ pGroundGF->mul(s3, pA1, pA2, pGroundGF);
+ pGroundGF->add(s1, s1, s1, pGroundGF);
+ pGroundGF->add(s3, s3, s3, pGroundGF);
+
+ pGroundGF->add(pR2, s1, s2, pGroundGF);
+ pGroundGF->add(pR2, pR2, s3, pGroundGF);
+ pGroundGF->sub(pR2, pR2, s0, pGroundGF);
+ pGroundGF->sub(pR2, pR2, s4, pGroundGF);
+
+ /* EPID2 specific */
+ {
+ int basicExtDegree = cpGFpBasicDegreeExtension(pGFpx);
+
+ /* deal with GF(p^2^3) */
+ if(basicExtDegree==6) {
+ cpFq2Mul_xi(s4, s4, pGroundGF);
+ cpFq2Mul_xi(s3, s3, pGroundGF);
+ pGroundGF->add(pR1, s1, s4, pGroundGF);
+ pGroundGF->add(pR0, s0, s3, pGroundGF);
+ }
+ /* just a case */
+ else {
+ cpGFpxMul_G0(s4, s4, pGFpx);
+ cpGFpxMul_G0(s3, s3, pGFpx);
+ pGroundGF->sub(pR1, s1, s4, pGroundGF);
+ pGroundGF->sub(pR0, s0, s3, pGroundGF);
+ }
+ }
+
+ cpGFpReleasePool(5, pGroundGF);
+ return pR;
+}
+
+
+/*
+// returns methods
+*/
+IPPFUN( const IppsGFpMethod*, ippsGFpxMethod_binom3_epid2, (void) )
+{
+ static IppsGFpMethod method = {
+ cpGFpxAdd_com,
+ cpGFpxSub_com,
+ cpGFpxNeg_com,
+ cpGFpxDiv2_com,
+ cpGFpxMul2_com,
+ cpGFpxMul3_com,
+ cpGFpxMul_p3_binom_epid2,
+ cpGFpxSqr_p3_binom_epid2,
+ cpGFpxEncode_com,
+ cpGFpxDecode_com
+ };
+ return &method;
+}
diff --git a/ext/ipp/sources/ippcp/src/pcpgfpxmethod_com.c b/ext/ipp/sources/ippcp/src/pcpgfpxmethod_com.c
new file mode 100644
index 0000000..ac93204
--- /dev/null
+++ b/ext/ipp/sources/ippcp/src/pcpgfpxmethod_com.c
@@ -0,0 +1,284 @@
+/*############################################################################
+ # Copyright 2016-2017 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.
+ ############################################################################*/
+
+/*
+// Intel(R) Performance Primitives. Cryptography Primitives.
+// GF(p^d) methods
+//
+*/
+#include "owndefs.h"
+#include "owncp.h"
+
+#include "pcpgfpxstuff.h"
+
+BNU_CHUNK_T* cpGFpxAdd_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
+ int basicElemLen = GFP_FELEN(pBasicGF);
+ int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
+
+ BNU_CHUNK_T* pTmp = pR;
+ int deg;
+ for(deg=0; deg<basicDeg; deg++) {
+ pBasicGF->add(pTmp, pA, pB, pBasicGF);
+ pTmp += basicElemLen;
+ pA += basicElemLen;
+ pB += basicElemLen;
+ }
+ return pR;
+}
+
+BNU_CHUNK_T* cpGFpxSub_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
+ int basicElemLen = GFP_FELEN(pBasicGF);
+ int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
+
+ BNU_CHUNK_T* pTmp = pR;
+ int deg;
+ for(deg=0; deg<basicDeg; deg++) {
+ pBasicGF->sub(pTmp, pA, pB, pBasicGF);
+ pTmp += basicElemLen;
+ pA += basicElemLen;
+ pB += basicElemLen;
+ }
+ return pR;
+}
+
+BNU_CHUNK_T* cpGFpxNeg_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
+ int basicElemLen = GFP_FELEN(pBasicGF);
+ int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
+
+ BNU_CHUNK_T* pTmp = pR;
+ int deg;
+ for(deg=0; deg<basicDeg; deg++) {
+ pBasicGF->neg(pTmp, pA, pBasicGF);
+ pTmp += basicElemLen;
+ pA += basicElemLen;
+ }
+ return pR;
+}
+
+BNU_CHUNK_T* cpGFpxMul_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx)
+{
+ int extDegree = GFP_DEGREE(pGFpx);
+
+ BNU_CHUNK_T* pGFpolynomial = GFP_MODULUS(pGFpx);
+ int degR = extDegree-1;
+ int elemLen= GFP_FELEN(pGFpx);
+
+ int degB = degR;
+ BNU_CHUNK_T* pTmpProduct = cpGFpGetPool(2, pGFpx);
+ BNU_CHUNK_T* pTmpResult = pTmpProduct + GFP_PELEN(pGFpx);
+
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ BNU_CHUNK_T* r = cpGFpGetPool(1, pGroundGF);
+ int groundElemLen = GFP_FELEN(pGroundGF);
+
+ const BNU_CHUNK_T* pTmpB = GFPX_IDX_ELEMENT(pB, degB, groundElemLen);
+
+ /* clear temporary */
+ cpGFpElementPadd(pTmpProduct, elemLen, 0);
+
+ /* R = A * B[degB-1] */
+ cpGFpxMul_GFE(pTmpResult, pA, pTmpB, pGFpx);
+
+ for(degB-=1; degB>=0; degB--) {
+ /* save R[degR-1] */
+ cpGFpElementCopy(r, GFPX_IDX_ELEMENT(pTmpResult, degR, groundElemLen), groundElemLen);
+
+ { /* R = R * x */
+ int j;
+ for (j=degR; j>=1; j--)
+ cpGFpElementCopy(GFPX_IDX_ELEMENT(pTmpResult, j, groundElemLen), GFPX_IDX_ELEMENT(pTmpResult, j-1, groundElemLen), groundElemLen);
+ cpGFpElementPadd(pTmpResult, groundElemLen, 0);
+ }
+
+ cpGFpxMul_GFE(pTmpProduct, pGFpolynomial, r, pGFpx);
+ pGFpx->sub(pTmpResult, pTmpResult, pTmpProduct, pGFpx);
+
+ /* B[degB-i] */
+ pTmpB -= groundElemLen;
+ cpGFpxMul_GFE(pTmpProduct, pA, pTmpB, pGFpx);
+ pGFpx->add(pTmpResult, pTmpResult, pTmpProduct, pGFpx);
+ }
+
+ /* copy result */
+ cpGFpElementCopy(pR, pTmpResult, elemLen);
+
+ /* release pools */
+ cpGFpReleasePool(1, pGroundGF);
+ cpGFpReleasePool(2, pGFpx);
+
+ return pR;
+}
+
+BNU_CHUNK_T* cpGFpxSqr_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ int extDegree = GFP_DEGREE(pGFpx);
+
+ BNU_CHUNK_T* pGFpolynomial = GFP_MODULUS(pGFpx);
+ int degR = extDegree-1;
+ int elemLen= GFP_FELEN(pGFpx);
+
+ int degA = degR;
+ BNU_CHUNK_T* pTmpProduct = cpGFpGetPool(2, pGFpx);
+ BNU_CHUNK_T* pTmpResult = pTmpProduct + GFP_PELEN(pGFpx);
+
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ BNU_CHUNK_T* r = cpGFpGetPool(1, pGroundGF);
+ int groundElemLen = GFP_FELEN(pGroundGF);
+
+ const BNU_CHUNK_T* pTmpA = GFPX_IDX_ELEMENT(pA, degA, groundElemLen);
+
+ /* clear temporary */
+ cpGFpElementPadd(pTmpProduct, elemLen, 0);
+
+ /* R = A * A[degA-1] */
+ cpGFpxMul_GFE(pTmpResult, pA, pTmpA, pGFpx);
+
+ for(degA-=1; degA>=0; degA--) {
+ /* save R[degR-1] */
+ cpGFpElementCopy(r, GFPX_IDX_ELEMENT(pTmpResult, degR, groundElemLen), groundElemLen);
+
+ { /* R = R * x */
+ int j;
+ for (j=degR; j>=1; j--)
+ cpGFpElementCopy(GFPX_IDX_ELEMENT(pTmpResult, j, groundElemLen), GFPX_IDX_ELEMENT(pTmpResult, j-1, groundElemLen), groundElemLen);
+ cpGFpElementPadd(pTmpResult, groundElemLen, 0);
+ }
+
+ cpGFpxMul_GFE(pTmpProduct, pGFpolynomial, r, pGFpx);
+ pGFpx->sub(pTmpResult, pTmpResult, pTmpProduct, pGFpx);
+
+ /* A[degA-i] */
+ pTmpA -= groundElemLen;
+ cpGFpxMul_GFE(pTmpProduct, pA, pTmpA, pGFpx);
+ pGFpx->add(pTmpResult, pTmpResult, pTmpProduct, pGFpx);
+ }
+
+ /* copy result */
+ cpGFpElementCopy(pR, pTmpResult, elemLen);
+
+ /* release pools */
+ cpGFpReleasePool(1, pGroundGF);
+ cpGFpReleasePool(2, pGFpx);
+
+ return pR;
+}
+
+BNU_CHUNK_T* cpGFpxDiv2_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
+ int basicElemLen = GFP_FELEN(pBasicGF);
+ int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
+
+ BNU_CHUNK_T* pTmp = pR;
+ int deg;
+ for(deg=0; deg<basicDeg; deg++) {
+ pBasicGF->div2(pTmp, pA, pBasicGF);
+ pTmp += basicElemLen;
+ pA += basicElemLen;
+ }
+ return pR;
+}
+
+BNU_CHUNK_T* cpGFpxMul2_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
+ int basicElemLen = GFP_FELEN(pBasicGF);
+ int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
+
+ BNU_CHUNK_T* pTmp = pR;
+ int deg;
+ for(deg=0; deg<basicDeg; deg++) {
+ pBasicGF->mul2(pTmp, pA, pBasicGF);
+ pTmp += basicElemLen;
+ pA += basicElemLen;
+ }
+ return pR;
+}
+
+BNU_CHUNK_T* cpGFpxMul3_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
+ int basicElemLen = GFP_FELEN(pBasicGF);
+ int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
+
+ BNU_CHUNK_T* pTmp = pR;
+ int deg;
+ for(deg=0; deg<basicDeg; deg++) {
+ pBasicGF->mul3(pTmp, pA, pBasicGF);
+ pTmp += basicElemLen;
+ pA += basicElemLen;
+ }
+ return pR;
+}
+
+BNU_CHUNK_T* cpGFpxEncode_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
+ int basicElemLen = GFP_FELEN(pBasicGF);
+ int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
+
+ BNU_CHUNK_T* pTmp = pR;
+ int deg;
+ for(deg=0; deg<basicDeg; deg++) {
+ pBasicGF->encode(pTmp, pA, pBasicGF);
+ pTmp += basicElemLen;
+ pA += basicElemLen;
+ }
+ return pR;
+}
+
+BNU_CHUNK_T* cpGFpxDecode_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
+ int basicElemLen = GFP_FELEN(pBasicGF);
+ int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
+
+ BNU_CHUNK_T* pTmp = pR;
+ int deg;
+ for(deg=0; deg<basicDeg; deg++) {
+ pBasicGF->decode(pTmp, pA, pBasicGF);
+ pTmp += basicElemLen;
+ pA += basicElemLen;
+ }
+ return pR;
+}
+
+/*
+// returns methods
+*/
+IPPFUN( const IppsGFpMethod*, ippsGFpxMethod_com, (void) )
+{
+ static IppsGFpMethod method = {
+ cpGFpxAdd_com,
+ cpGFpxSub_com,
+ cpGFpxNeg_com,
+ cpGFpxDiv2_com,
+ cpGFpxMul2_com,
+ cpGFpxMul3_com,
+ cpGFpxMul_com,
+ cpGFpxSqr_com,
+ cpGFpxEncode_com,
+ cpGFpxDecode_com
+ };
+ return &method;
+}
+
diff --git a/ext/ipp/sources/ippcp/src/pcpgfpxmethod_com.h b/ext/ipp/sources/ippcp/src/pcpgfpxmethod_com.h
new file mode 100644
index 0000000..732e024
--- /dev/null
+++ b/ext/ipp/sources/ippcp/src/pcpgfpxmethod_com.h
@@ -0,0 +1,42 @@
+/*############################################################################
+ # Copyright 2016-2017 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.
+ ############################################################################*/
+
+/*
+// Intel(R) Performance Primitives. Cryptography Primitives.
+// GF(p^d) methods
+//
+*/
+#include "owndefs.h"
+#include "owncp.h"
+
+#include "pcpgfpstuff.h"
+
+#define cpGFpxAdd_com OWNAPI(cpGFpxAdd_com)
+BNU_CHUNK_T* cpGFpxAdd_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx);
+#define cpGFpxSub_com OWNAPI(cpGFpxSub_com)
+BNU_CHUNK_T* cpGFpxSub_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx);
+#define cpGFpxNeg_com OWNAPI(cpGFpxNeg_com)
+BNU_CHUNK_T* cpGFpxNeg_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx);
+#define cpGFpxMul_com OWNAPI(cpGFpxMul_com)
+BNU_CHUNK_T* cpGFpxMul_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx);
+#define cpGFpxSqr_com OWNAPI(cpGFpxSqr_com)
+BNU_CHUNK_T* cpGFpxSqr_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx);
+#define cpGFpxDiv2_com OWNAPI(cpGFpxDiv2_com)
+BNU_CHUNK_T* cpGFpxDiv2_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx);
+BNU_CHUNK_T* cpGFpxMul2_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx);
+BNU_CHUNK_T* cpGFpxMul3_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx);
+BNU_CHUNK_T* cpGFpxEncode_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx);
+BNU_CHUNK_T* cpGFpxDecode_com(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx);
diff --git a/ext/ipp/sources/ippcp/src/pcpgfpxstuff.c b/ext/ipp/sources/ippcp/src/pcpgfpxstuff.c
new file mode 100644
index 0000000..a5ed5c6
--- /dev/null
+++ b/ext/ipp/sources/ippcp/src/pcpgfpxstuff.c
@@ -0,0 +1,687 @@
+/*############################################################################
+ # Copyright 2010-2017 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.
+ ############################################################################*/
+
+/*
+// Intel(R) Performance Primitives. Cryptography Primitives.
+// Internal operations over GF(p) extension.
+//
+// Context:
+// cpGFpxCmpare
+// cpGFpxSet
+// cpGFpxRand
+// cpGFpxGet
+//
+// cpGFpxHalve
+// cpGFpxAdd, cpGFpxAdd_GFE
+// cpGFpxSub, cpGFpxSub_GFE
+// cpGFpxMul, cpGFpxMul_GFE
+// cpGFp2biMul, cpGFp3biMul, cpGFpxMul_G0
+// cpGFpxSqr
+// cpGFp2biSqr, cpGFp3biSqr
+// cpGFpxNeg
+// cpGFpxInv
+// cpGFpxExp
+// cpGFpxMultiExp
+// cpGFpxConj
+//
+//
+*/
+#include "owndefs.h"
+#include "owncp.h"
+
+
+#include "pcpgfpxstuff.h"
+
+
+
+BNU_CHUNK_T* cpGFpxRand(BNU_CHUNK_T* pR, IppsGFpState* pGFpx, IppBitSupplier rndFunc, void* pRndParam)
+{
+ if( GFP_IS_BASIC(pGFpx) )
+ return cpGFpRand(pR, pGFpx, rndFunc, pRndParam);
+
+ else {
+ IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
+ int basicElemLen = GFP_FELEN(pBasicGF);
+ int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
+
+ BNU_CHUNK_T* pTmp = pR;
+ int deg;
+ for(deg=0; deg<basicDeg; deg++) {
+ cpGFpRand(pTmp, pBasicGF, rndFunc, pRndParam);
+ pTmp += basicElemLen;
+ }
+ return pR;
+ }
+}
+
+BNU_CHUNK_T* cpGFpxSet(BNU_CHUNK_T* pE, const BNU_CHUNK_T* pDataA, int nsA, IppsGFpState* pGFpx)
+{
+ if( GFP_IS_BASIC(pGFpx) )
+ return cpGFpSet(pE, pDataA, nsA, pGFpx);
+
+ else {
+ IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
+ int basicElemLen = GFP_FELEN(pBasicGF);
+
+ BNU_CHUNK_T* pTmpE = pE;
+ int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
+
+ int deg, error;
+ for(deg=0, error=0; deg<basicDeg && !error; deg++) {
+ int pieceA = IPP_MIN(nsA, basicElemLen);
+
+ error = NULL == cpGFpSet(pTmpE, pDataA, pieceA, pBasicGF);
+ pTmpE += basicElemLen;
+ pDataA += pieceA;
+ nsA -= pieceA;
+ }
+
+ return (deg<basicDeg)? NULL : pE;
+ }
+}
+
+BNU_CHUNK_T* cpGFpxSetPolyTerm(BNU_CHUNK_T* pE, int deg, const BNU_CHUNK_T* pDataA, int nsA, IppsGFpState* pGFpx)
+{
+ pE += deg * GFP_FELEN(pGFpx);
+ return cpGFpxSet(pE, pDataA, nsA, pGFpx);
+}
+
+BNU_CHUNK_T* cpGFpxGet(BNU_CHUNK_T* pDataA, int nsA, const BNU_CHUNK_T* pE, IppsGFpState* pGFpx)
+{
+ cpGFpElementPadd(pDataA, nsA, 0);
+
+ if( GFP_IS_BASIC(pGFpx) )
+ return cpGFpGet(pDataA, nsA, pE, pGFpx);
+
+ else {
+ IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
+ int basicElemLen = GFP_FELEN(pBasicGF);
+
+ BNU_CHUNK_T* pTmp = pDataA;
+ int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
+
+ int deg;
+ for(deg=0; deg<basicDeg && nsA>0; deg++) {
+ int pieceA = IPP_MIN(nsA, basicElemLen);
+
+ cpGFpGet(pTmp, pieceA, pE, pBasicGF);
+ pE += basicElemLen;
+ pTmp += pieceA;
+ nsA -= pieceA;
+ }
+
+ return pDataA;
+ }
+}
+
+BNU_CHUNK_T* cpGFpxGetPolyTerm(BNU_CHUNK_T* pDataA, int nsA, const BNU_CHUNK_T* pE, int deg, IppsGFpState* pGFpx)
+{
+ pE += deg * GFP_FELEN(pGFpx);
+ return cpGFpxGet(pDataA, nsA, pE, pGFpx);
+}
+
+BNU_CHUNK_T* cpGFpxConj(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ int groundElemLen = GFP_FELEN(pGroundGF);
+
+ if(pR != pA)
+ cpGFpElementCopy(pR, pA, groundElemLen);
+ //cpGFpxNeg(pR+groundElemLen, pA+groundElemLen, pGroundGF);
+ pGroundGF->neg(pR+groundElemLen, pA+groundElemLen, pGroundGF);
+
+ return pR;
+}
+
+
+BNU_CHUNK_T* cpGFpxAdd_GFE(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pGroundB, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+
+ if(pR != pA) {
+ int groundElemLen = GFP_FELEN(pGroundGF);
+ int deg = GFP_DEGREE(pGFpx);
+ cpGFpElementCopy(pR+groundElemLen, pA+groundElemLen, groundElemLen*(deg-1));
+ }
+ return pGroundGF->add(pR, pA, pGroundB, pGroundGF);
+}
+
+BNU_CHUNK_T* cpGFpxSub_GFE(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pGroundB, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+
+ if(pR != pA) {
+ int groundElemLen = GFP_FELEN(pGroundGF);
+ int deg = GFP_DEGREE(pGFpx);
+ cpGFpElementCopy(pR+groundElemLen, pA+groundElemLen, groundElemLen*(deg-1));
+ }
+ return pGroundGF->sub(pR, pA, pGroundB, pGroundGF);
+}
+
+BNU_CHUNK_T* cpGFpxMul_GFE(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pGroundB, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ int grounfElemLen = GFP_FELEN(pGroundGF);
+
+ BNU_CHUNK_T* pTmp = pR;
+
+ int deg;
+ for(deg=0; deg<GFP_DEGREE(pGFpx); deg++) {
+ pGroundGF->mul(pTmp, pA, pGroundB, pGroundGF);
+ pTmp += grounfElemLen;
+ pA += grounfElemLen;
+ }
+ return pR;
+}
+
+BNU_CHUNK_T* cpGFpxNeg(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
+ int basicElemLen = GFP_FELEN(pBasicGF);
+ int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
+
+ BNU_CHUNK_T* pTmp = pR;
+ int deg;
+ for(deg=0; deg<basicDeg; deg++) {
+ pBasicGF->neg(pTmp, pA, pBasicGF);
+ pTmp += basicElemLen;
+ pA += basicElemLen;
+ }
+ return pR;
+}
+
+static BNU_CHUNK_T* gfpxPolyDiv(BNU_CHUNK_T* pQ, BNU_CHUNK_T* pR,
+ const BNU_CHUNK_T* pA,
+ const BNU_CHUNK_T* pB,
+ IppsGFpState* pGFpx)
+{
+ if( GFP_IS_BASIC(pGFpx) )
+ return NULL;
+
+ else {
+ int elemLen = GFP_FELEN(pGFpx);
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ int termLen = GFP_FELEN(pGroundGF);
+
+ int degA = degree(pA, pGFpx);
+ int degB = degree(pB, pGFpx);
+
+ if(degB==0) {
+ if( GFP_IS_ZERO(pB, termLen) )
+ return NULL;
+ else {
+ IppsGFpState* pBasicGF = cpGFpBasic(pGroundGF);
+
+ cpGFpInv(pR, pB, pBasicGF);
+ cpGFpElementPadd(pR+GFP_FELEN(pGroundGF), termLen-GFP_FELEN(pGroundGF), 0);
+ cpGFpxMul_GFE(pQ, pA, pR, pGFpx);
+ cpGFpElementPadd(pR, elemLen, 0);
+ return pR;
+ }
+ }
+
+ if(degA < degB) {
+ cpGFpElementPadd(pQ, elemLen, 0);
+ cpGFpElementCopyPadd(pR, elemLen, pA, (degA+1)*termLen);
+ return pR;
+ }
+
+ else {
+ int i, j;
+ BNU_CHUNK_T* pProduct = cpGFpGetPool(2, pGroundGF);
+ BNU_CHUNK_T* pInvB = pProduct + GFP_PELEN(pGroundGF);
+
+ cpGFpElementCopyPadd(pR, elemLen, pA, (degA+1)*termLen);
+ cpGFpElementPadd(pQ, elemLen, 0);
+
+ cpGFpxInv(pInvB, GFPX_IDX_ELEMENT(pB, degB, termLen), pGroundGF);
+
+ for(i=0; i<=degA-degB && !GFP_IS_ZERO(GFPX_IDX_ELEMENT(pR, degA-i, termLen), termLen); i++) {
+ /* compute q term */
+ pGroundGF->mul(GFPX_IDX_ELEMENT(pQ, degA-degB-i, termLen),
+ GFPX_IDX_ELEMENT(pR, degA-i, termLen),
+ pInvB,
+ pGroundGF);
+
+ /* R -= B * q */
+ cpGFpElementPadd(GFPX_IDX_ELEMENT(pR, degA-i, termLen), termLen, 0);
+ for(j=0; j<degB; j++) {
+ pGroundGF->mul(pProduct,
+ GFPX_IDX_ELEMENT(pB, j ,termLen),
+ GFPX_IDX_ELEMENT(pQ, degA-degB-i, termLen),
+ pGroundGF);
+ pGroundGF->sub(GFPX_IDX_ELEMENT(pR, degA-degB-i+j, termLen),
+ GFPX_IDX_ELEMENT(pR, degA-degB-i+j, termLen),
+ pProduct,
+ pGroundGF);
+ }
+ }
+
+ cpGFpReleasePool(2, pGroundGF);
+ return pR;
+ }
+ }
+}
+
+static BNU_CHUNK_T* gfpxGeneratorDiv(BNU_CHUNK_T* pQ, BNU_CHUNK_T* pR, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx)
+{
+ if( GFP_IS_BASIC(pGFpx) )
+ return NULL;
+
+ else {
+ int elemLen = GFP_FELEN(pGFpx);
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ int termLen = GFP_FELEN(pGroundGF);
+
+ BNU_CHUNK_T* pInvB = cpGFpGetPool(2, pGroundGF);
+ BNU_CHUNK_T* pTmp = pInvB + GFP_PELEN(pGroundGF);
+
+ int degB = degree(pB, pGFpx);
+ int i;
+
+ cpGFpElementCopy(pR, GFP_MODULUS(pGFpx), elemLen);
+ cpGFpElementPadd(pQ, elemLen, 0);
+
+ cpGFpxInv(pInvB, GFPX_IDX_ELEMENT(pB, degB, termLen), pGroundGF);
+
+ for(i=0; i<degB; i++) {
+ BNU_CHUNK_T* ptr;
+ pGroundGF->mul(pTmp, pInvB, GFPX_IDX_ELEMENT(pB, i, termLen), pGroundGF);
+ ptr = GFPX_IDX_ELEMENT(pR, GFP_DEGREE(pGFpx)-degB+i, termLen);
+ pGroundGF->sub(ptr, ptr, pTmp, pGroundGF);
+ }
+
+ gfpxPolyDiv(pQ, pR, pR, pB, pGFpx);
+
+ cpGFpElementCopy(GFPX_IDX_ELEMENT(pQ, GFP_DEGREE(pGFpx)-degB, termLen), pInvB, termLen);
+
+ cpGFpReleasePool(2, pGroundGF);
+ return pR;
+ }
+}
+
+BNU_CHUNK_T* cpGFpxInv(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
+{
+ if( GFP_IS_BASIC(pGFpx) )
+ return cpGFpInv(pR, pA, pGFpx);
+
+ if(0==degree(pA, pGFpx)) {
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ BNU_CHUNK_T* tmpR = cpGFpGetPool(1, pGroundGF);
+
+ cpGFpxInv(tmpR, pA, pGroundGF);
+
+ cpGFpElementCopyPadd(pR, GFP_FELEN(pGFpx), tmpR, GFP_FELEN(pGroundGF));
+ cpGFpReleasePool(1, pGroundGF);
+ return pR;
+ }
+
+ else {
+ int elemLen = GFP_FELEN(pGFpx);
+ IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
+ IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
+
+ int pxVars = 6;
+ int pelemLen = GFP_PELEN(pGFpx);
+ BNU_CHUNK_T* lastrem = cpGFpGetPool(pxVars, pGFpx);
+ BNU_CHUNK_T* rem = lastrem + pelemLen;
+ BNU_CHUNK_T* quo = rem + pelemLen;
+ BNU_CHUNK_T* lastaux = quo + pelemLen;
+ BNU_CHUNK_T* aux = lastaux + pelemLen;
+ BNU_CHUNK_T* temp = aux + pelemLen;
+
+ cpGFpElementCopy(lastrem, pA, elemLen);
+ cpGFpElementCopyPadd(lastaux, elemLen, MNT_1(GFP_MONT(pBasicGF)), GFP_FELEN(pBasicGF));
+
+ gfpxGeneratorDiv(quo, rem, pA, pGFpx);
+ cpGFpxNeg(aux, quo, pGFpx);
+
+ while(degree(rem, pGFpx) > 0) {
+ gfpxPolyDiv(quo, temp, lastrem, rem, pGFpx);
+ SWAP_PTR(BNU_CHUNK_T, rem, lastrem); //
+ SWAP_PTR(BNU_CHUNK_T, temp, rem);
+
+ pGFpx->neg(quo, quo, pGFpx);
+ pGFpx->mul(temp, quo, aux, pGFpx);
+ pGFpx->add(temp, lastaux, temp, pGFpx);
+ SWAP_PTR(BNU_CHUNK_T, aux, lastaux);
+ SWAP_PTR(BNU_CHUNK_T, temp, aux);
+ }
+ if (GFP_IS_ZERO(rem, elemLen)) { /* gcd != 1 */
+ cpGFpReleasePool(pxVars, pGFpx);
+ return NULL;
+ }
+
+ {
+ BNU_CHUNK_T* invRem = cpGFpGetPool(1, pGroundGF);
+
+ cpGFpxInv(invRem, rem, pGroundGF);
+ cpGFpxMul_GFE(pR, aux, invRem, pGFpx);
+
+ cpGFpReleasePool(1, pGroundGF);
+ }
+
+ cpGFpReleasePool(pxVars, pGFpx);
+
+ return pR;
+ }
+}
+
+
+static int div_upper(int a, int d)
+{ return (a+d-1)/d; }
+
+static int getNumOperations(int bitsize, int w)
+{
+ int n_overhead = (1<<w) -1;
+ int n_ops = div_upper(bitsize, w) + n_overhead;
+ return n_ops;
+}
+int cpGFpGetOptimalWinSize(int bitsize)
+{
+ int w_opt = 1;
+ int n_opt = getNumOperations(bitsize, w_opt);
+ int w_trial;
+ for(w_trial=w_opt+1; w_trial<=IPP_MAX_EXPONENT_NUM; w_trial++) {
+ int n_trial = getNumOperations(bitsize, w_trial);
+ if(n_trial>=n_opt) break;
+ w_opt = w_trial;
+ n_opt = n_trial;
+ }
+ return w_opt;
+}
+
+
+//#define _GRES_DBG_
+#if defined(_GRES_DBG_)
+#include <stdio.h>
+static void printBNU(const char* note, Ipp64u* pData, int len, int nt)
+{
+ int n, k;
+
+ if(note)
+ printf("%s", note);
+
+ for(n=0, k=0; n<len; n++) {
+ Ipp64u x = pData[n];
+ printf("%016I64x ", x);
+ k++;
+ if(k==nt) {
+ printf("\n");
+ k = 0;
+ }
+ }
+ printf("\n");
+}
+#endif
+
+/* sscm version */
+BNU_CHUNK_T* cpGFpxExp(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pE, int nsE,
+ IppsGFpState* pGFpx, Ipp8u* pScratchBuffer)
+{
+ IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
+
+ /* remove leding zeros */
+ FIX_BNU(pE, nsE);
+
+ {
+ Ipp8u* pScratchAligned; /* aligned scratch buffer */
+ int nAllocation = 0; /* points from the pool */
+
+ /* size of element (bytes) */
+ int elmDataSize = GFP_FELEN(pGFpx)*sizeof(BNU_CHUNK_T);
+
+ /* exponent bitsize */
+ int expBitSize = BITSIZE_BNU(pE, nsE);
+ /* optimal size of window */
+ int w = (NULL==pScratchBuffer)? 1 : cpGFpGetOptimalWinSize(expBitSize);
+ /* number of table entries */
+ int nPrecomputed = 1<<w;
+
+ BNU_CHUNK_T* pExpandedE = cpGFpGetPool(1, pGFpx);
+ BNU_CHUNK_T* pTmp = cpGFpGetPool(1, pGFpx);
+ int poolElmLen = GFP_PELEN(pGFpx);
+
+ if(NULL==pScratchBuffer) {
+ nAllocation = 2 + div_upper(CACHE_LINE_SIZE, poolElmLen*sizeof(BNU_CHUNK_T));
+ pScratchBuffer = (Ipp8u*)cpGFpGetPool(nAllocation, pGFpx);
+ }
+ pScratchAligned = (Ipp8u*)( IPP_ALIGNED_PTR(pScratchBuffer, CACHE_LINE_SIZE) );
+
+ #if defined(_GRES_DBG_)
+ printf("precom tbl:\n");
+ #endif
+ /* pre-compute auxiliary table t[] = {1, A, A^2, ..., A^(2^w-1)} */
+ cpGFpElementCopyPadd(pTmp, GFP_FELEN(pGFpx), MNT_1(GFP_MONT(pBasicGF)), GFP_FELEN(pBasicGF));
+ cpScramblePut(pScratchAligned+0, nPrecomputed, (Ipp8u*)pTmp, elmDataSize);
+ #if defined(_GRES_DBG_)
+ printBNU("precom tbl:\n", pTmp, 48, 6);
+ #endif
+ {
+ int n;
+ for(n=1; n<nPrecomputed; n++) {
+ pGFpx->mul(pTmp, pTmp, pA, pGFpx);
+ cpScramblePut(pScratchAligned+n, nPrecomputed, (Ipp8u*)pTmp, elmDataSize);
+ #if defined(_GRES_DBG_)
+ printBNU("precom tbl:\n", pTmp, 48, 6);
+ #endif
+ }
+ }
+
+ {
+ /* copy exponent value */
+ cpGFpElementCopy(pExpandedE, pE, nsE);
+
+ /* expand exponent value */
+ ((Ipp32u*)pExpandedE)[BITS2WORD32_SIZE(expBitSize)] = 0;
+ expBitSize = ((expBitSize+w-1)/w)*w;
+
+ #if defined(_GRES_DBG_)
+ printf("\nexponentiation:\n");
+ #endif
+ /*
+ // exponentiation
+ */
+ {
+ /* digit mask */
+ BNU_CHUNK_T dmask = nPrecomputed-1;
+
+ /* position (bit number) of the leftmost window */
+ int wPosition = expBitSize-w;
+
+ /* extract leftmost window value */
+ Ipp32u eChunk = *((Ipp32u*)((Ipp16u*)pExpandedE+ wPosition/BITSIZE(Ipp16u)));
+ int shift = wPosition & 0xF;
+ Ipp32u windowVal = (eChunk>>shift) & dmask;
+
+ /* initialize result */
+ cpScrambleGet((Ipp8u*)pR, elmDataSize, pScratchAligned+windowVal, nPrecomputed);
+ #if defined(_GRES_DBG_)
+ printBNU("init result:\n", pR, 48, 6);
+ #endif
+
+ for(wPosition-=w; wPosition>=0; wPosition-=w) {
+ int k;
+ #if defined(_GRES_DBG_)
+ printf("\nwPosition=%d\n", wPosition);
+ #endif
+ /* w times squaring */
+ for(k=0; k<w; k++) {
+ pGFpx->sqr(pR, pR, pGFpx);
+ #if defined(_GRES_DBG_)
+ printBNU("sqr:\n", pR, 48, 6);
+ #endif
+ }
+
+ /* extract next window value */
+ eChunk = *((Ipp32u*)((Ipp16u*)pExpandedE+ wPosition/BITSIZE(Ipp16u)));
+ shift = wPosition & 0xF;
+ windowVal = (eChunk>>shift) & dmask;
+
+ /* extract value from the pre-computed table */
+ cpScrambleGet((Ipp8u*)pTmp, elmDataSize, pScratchAligned+windowVal, nPrecomputed);
+
+ /* and multiply */
+ pGFpx->mul(pR, pR, pTmp, pGFpx);
+ #if defined(_GRES_DBG_)
+ printBNU("mul:\n", pR, 48, 6);
+ #endif
+ }
+ }
+
+ }
+
+ cpGFpReleasePool(nAllocation+2, pGFpx);
+
+ return pR;
+ }
+}
+
+
+static void cpPrecomputeMultiExp(Ipp8u* pTable, const BNU_CHUNK_T* ppA[], int nItems, IppsGFpState* pGFpx)
+{
+ IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
+
+ int nPrecomputed = 1<<nItems;
+
+ /* length of element (BNU_CHUNK_T) */
+ int elmLen = GFP_FELEN(pGFpx);
+ /* size of element (bytes) */
+ int elmDataSize = GFP_FELEN(pGFpx)*sizeof(BNU_CHUNK_T);
+
+ /* get resource */
+ BNU_CHUNK_T* pT = cpGFpGetPool(1, pGFpx);
+
+ /* pTable[0] = 1 */
+ cpGFpElementCopyPadd(pT, elmLen, MNT_1(GFP_MONT(pBasicGF)), GFP_FELEN(pBasicGF));
+ cpScramblePut(pTable+0, nPrecomputed, (Ipp8u*)pT, elmDataSize);
+ /* pTable[1] = A[0] */
+ cpScramblePut(pTable+1, nPrecomputed, (Ipp8u*)(ppA[0]), elmDataSize);
+
+ {
+ int i, baseIdx;
+ for(i=1, baseIdx=2; i<nItems; i++, baseIdx*=2) {
+ /* pTable[baseIdx] = A[i] */
+ cpScramblePut(pTable+baseIdx, nPrecomputed, (Ipp8u*)(ppA[i]), elmDataSize);
+
+ {
+ int nPasses = 1;
+ int step = baseIdx/2;
+
+ int k;
+ for(k=i-1; k>=0; k--) {
+ int tblIdx = baseIdx;
+
+ int n;
+ for(n=0; n<nPasses; n++, tblIdx+=2*step) {
+ /* use pre-computed value */
+ cpScrambleGet((Ipp8u*)pT, elmDataSize, pTable+tblIdx, nPrecomputed);
+ pGFpx->mul(pT, pT, ppA[k], pGFpx);
+ cpScramblePut(pTable+tblIdx+step, nPrecomputed, (Ipp8u*)pT, elmDataSize);
+ }
+
+ nPasses *= 2;
+ step /= 2;
+ }
+ }
+ }
+ }
+
+ /* release resourse */
+ cpGFpReleasePool(1, pGFpx);
+}
+
+static int cpGetMaxBitsizeExponent(const BNU_CHUNK_T* ppE[], int nsE[], int nItems)
+{
+ int n;
+ /* find out the longest exponent */
+ int expBitSize = BITSIZE_BNU(ppE[0], nsE[0]);
+ for(n=1; n<nItems; n++) {
+ expBitSize = IPP_MAX(expBitSize, BITSIZE_BNU(ppE[n], nsE[n]));
+ }
+ return expBitSize;
+}
+
+static int GetIndex(const BNU_CHUNK_T* ppE[], int nItems, int nBit)
+{
+ int shift = nBit%BYTESIZE;
+ int offset= nBit/BYTESIZE;
+ int index = 0;
+
+ int n;
+ for(n=nItems; n>0; n--) {
+ const Ipp8u* pE = ((Ipp8u*)ppE[n-1]) + offset;
+ Ipp8u e = pE[0];
+ index <<= 1;
+ index += (e>>shift) &1;
+ }
+ return index;
+}
+
+/* sscm version */
+BNU_CHUNK_T* cpGFpxMultiExp(BNU_CHUNK_T* pR, const BNU_CHUNK_T* ppA[], const BNU_CHUNK_T* ppE[], int nsE[], int nItems,
+ IppsGFpState* pGFpx, Ipp8u* pScratchBuffer)
+{
+ /* align scratch buffer */
+ pScratchBuffer = (Ipp8u*)( IPP_ALIGNED_PTR(pScratchBuffer, CACHE_LINE_SIZE) );
+ /* pre-compute table */
+ cpPrecomputeMultiExp(pScratchBuffer, ppA, nItems, pGFpx);
+
+ {
+ /* find out the longest exponent */
+ int expBitSize = cpGetMaxBitsizeExponent(ppE, nsE, nItems);
+
+ /* allocate resource and copy expanded exponents into */
+ const BNU_CHUNK_T* ppExponent[IPP_MAX_EXPONENT_NUM];
+ {
+ int n;
+ for(n=0; n<nItems; n++) {
+ BNU_CHUNK_T* pData = cpGFpGetPool(1, pGFpx);
+ cpGFpElementCopyPadd(pData, GFP_FELEN(pGFpx), ppE[n], nsE[n]);
+ ppExponent[n] = pData;
+ }
+ }
+
+ /* multiexponentiation */
+ {
+ int nPrecomputed = 1<<nItems;
+ int elmDataSize = GFP_FELEN(pGFpx)*sizeof(BNU_CHUNK_T);
+
+ /* get temporary */
+ BNU_CHUNK_T* pT = cpGFpGetPool(1, pGFpx);
+
+ /* init result */
+ int tblIdx = GetIndex(ppExponent, nItems, --expBitSize);
+ cpScrambleGet((Ipp8u*)pR, elmDataSize, pScratchBuffer+tblIdx, nPrecomputed);
+
+ /* compute the rest: square and multiply */
+ for(--expBitSize; expBitSize>=0; expBitSize--) {
+ pGFpx->sqr(pR, pR, pGFpx);
+ tblIdx = GetIndex(ppExponent, nItems, expBitSize);
+ cpScrambleGet((Ipp8u*)pT, elmDataSize, pScratchBuffer+tblIdx, nPrecomputed);
+ pGFpx->mul(pR, pR, pT, pGFpx);
+ }
+
+ /* release resourse */
+ cpGFpReleasePool(1, pGFpx);
+ }
+
+ /* release resourse */
+ cpGFpReleasePool(nItems, pGFpx);
+
+ return pR;
+ }
+}
diff --git a/ext/ipp/sources/ippcpepid/src/pcpgfpxstuff.h b/ext/ipp/sources/ippcp/src/pcpgfpxstuff.h
index e887034..45b060e 100644
--- a/ext/ipp/sources/ippcpepid/src/pcpgfpxstuff.h
+++ b/ext/ipp/sources/ippcp/src/pcpgfpxstuff.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2010-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -27,11 +27,11 @@
#include "pcpgfpstuff.h"
-#define _EXTENSION_2_BINOMIAL_SUPPORT_
-#define _EXTENSION_3_BINOMIAL_SUPPORT_
+//#define _EXTENSION_2_BINOMIAL_SUPPORT_ // move to cmd-line
+//#define _EXTENSION_3_BINOMIAL_SUPPORT_ // move to cmd-line
#if defined(_EXTENSION_2_BINOMIAL_SUPPORT_) && defined(_EXTENSION_3_BINOMIAL_SUPPORT_)
- /* Intel(R) EPID specific:
+ /* EPID specific:
(Fq2) GF(q^2) generating polynomial is g(t) = t^2 + beta, beta = 1
*/
@@ -45,19 +45,6 @@
/* address of ground field element inside expanded field element */
#define GFPX_IDX_ELEMENT(pxe, idx, eleSize) ((pxe)+(eleSize)*(idx))
-#if 0
-/* internal function prototypes */
-__INLINE BNU_CHUNK_T* cpGFpxGetPool(int n, IppsGFpState* pGFpx)
-{
- BNU_CHUNK_T* pPool = GFP_POOL(pGFpx);
- GFP_POOL(pGFpx) += n*GFPX_PESIZE(pGFpx);
- return pPool;
-}
-__INLINE void cpGFpxReleasePool(int n, IppsGFpState* pGFpx)
-{
- GFP_POOL(pGFpx) -= n * GFPX_PESIZE(pGFpx);
-}
-#endif
__INLINE int degree(const BNU_CHUNK_T* pE, const IppsGFpState* pGFpx)
{
@@ -143,32 +130,50 @@ __INLINE void cpScrambleGet(Ipp8u* pData, int dataSize, const Ipp8u* pScrambleEn
pData[i] = pScrambleEntry[i*scale];
}
+#define cpGFpxCompare OWNAPI(cpGFpxCompare)
int cpGFpxCompare(const IppsGFpState* pGFpx1, const IppsGFpState* pGFpx2);
-BNU_CHUNK_T* cpGFpxRand(BNU_CHUNK_T* pR, IppsGFpState* pGFpx, IppBitSupplier rndFunc, void* pRndParam, int montSpace);
-BNU_CHUNK_T* cpGFpxSet (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pDataA, int nsA, IppsGFpState* pGFpx, int montSpace);
-BNU_CHUNK_T* cpGFpxGet (BNU_CHUNK_T* pDataA, int nsA, const BNU_CHUNK_T* pR, IppsGFpState* pGFpx, int montSpace);
+#define cpGFpxRand OWNAPI(cpGFpxRand)
+BNU_CHUNK_T* cpGFpxRand(BNU_CHUNK_T* pR, IppsGFpState* pGFpx, IppBitSupplier rndFunc, void* pRndParam);
+#define cpGFpxSet OWNAPI(cpGFpxSet)
+BNU_CHUNK_T* cpGFpxSet (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pDataA, int nsA, IppsGFpState* pGFpx);
+#define cpGFpxGet OWNAPI(cpGFpxGet)
+BNU_CHUNK_T* cpGFpxGet (BNU_CHUNK_T* pDataA, int nsA, const BNU_CHUNK_T* pR, IppsGFpState* pGFpx);
-BNU_CHUNK_T* cpGFpxSetPolyTerm (BNU_CHUNK_T* pR, int deg, const BNU_CHUNK_T* pDataA, int nsA, IppsGFpState* pGFpx, int montSpace);
-BNU_CHUNK_T* cpGFpxGetPolyTerm (BNU_CHUNK_T* pDataA, int nsA, const BNU_CHUNK_T* pR, int deg, IppsGFpState* pGFpx, int montSpace);
+#define cpGFpxSetPolyTerm OWNAPI(cpGFpxSetPolyTerm)
+BNU_CHUNK_T* cpGFpxSetPolyTerm (BNU_CHUNK_T* pR, int deg, const BNU_CHUNK_T* pDataA, int nsA, IppsGFpState* pGFpx);
+#define cpGFpxGetPolyTerm OWNAPI(cpGFpxGetPolyTerm)
+BNU_CHUNK_T* cpGFpxGetPolyTerm (BNU_CHUNK_T* pDataA, int nsA, const BNU_CHUNK_T* pR, int deg, IppsGFpState* pGFpx);
+#define cpGFpxAdd OWNAPI(cpGFpxAdd)
BNU_CHUNK_T* cpGFpxAdd (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx);
+#define cpGFpxSub OWNAPI(cpGFpxSub)
BNU_CHUNK_T* cpGFpxSub (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx);
+#define cpGFpxMul OWNAPI(cpGFpxMul)
BNU_CHUNK_T* cpGFpxMul (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx);
+#define cpGFpxSqr OWNAPI(cpGFpxSqr)
BNU_CHUNK_T* cpGFpxSqr (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx);
+#define cpGFpxAdd_GFE OWNAPI(cpGFpxAdd_GFE)
BNU_CHUNK_T* cpGFpxAdd_GFE (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pGroundB, IppsGFpState* pGFpx);
+#define cpGFpxSub_GFE OWNAPI(cpGFpxSub_GFE)
BNU_CHUNK_T* cpGFpxSub_GFE (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pGroundB, IppsGFpState* pGFpx);
+#define cpGFpxMul_GFE OWNAPI(cpGFpxMul_GFE)
BNU_CHUNK_T* cpGFpxMul_GFE (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pGroundB, IppsGFpState* pGFpx);
+#define cpGFpGetOptimalWinSize OWNAPI(cpGFpGetOptimalWinSize)
int cpGFpGetOptimalWinSize(int bitsize);
+#define cpGFpxExp OWNAPI(cpGFpxExp)
BNU_CHUNK_T* cpGFpxExp (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pE, int nsE, IppsGFpState* pGFpx, Ipp8u* pScratchBuffer);
+#define cpGFpxMultiExp OWNAPI(cpGFpxMultiExp)
BNU_CHUNK_T* cpGFpxMultiExp(BNU_CHUNK_T* pR, const BNU_CHUNK_T* ppA[], const BNU_CHUNK_T* ppE[], int nsE[], int nItems,
IppsGFpState* pGFpx, Ipp8u* pScratchBuffer);
+#define cpGFpxConj OWNAPI(cpGFpxConj)
BNU_CHUNK_T* cpGFpxConj(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx);
+#define cpGFpxNeg OWNAPI(cpGFpxNeg)
BNU_CHUNK_T* cpGFpxNeg (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx);
+#define cpGFpxInv OWNAPI(cpGFpxInv)
BNU_CHUNK_T* cpGFpxInv (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx);
+#define cpGFpxHalve OWNAPI(cpGFpxHalve)
BNU_CHUNK_T* cpGFpxHalve (BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx);
-//BNU_CHUNK_T* gfpolyDiv(BNU_CHUNK_T* pQ, BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx);
-
#endif /* _PCP_GFPEXT_H_ */
diff --git a/ext/ipp/sources/ippcp/src/pcphash.h b/ext/ipp/sources/ippcp/src/pcphash.h
index 6ffd67a..dc669d5 100644
--- a/ext/ipp/sources/ippcp/src/pcphash.h
+++ b/ext/ipp/sources/ippcp/src/pcphash.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2014-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -40,6 +40,15 @@
#define MAX_HASH_SIZE (IPP_SHA512_DIGEST_BITSIZE/8) /* hash of the max len (bytes) */
+/* size of processed message length representation (bytes) */
+#define MLR_SHA1 (sizeof(Ipp64u))
+#define MLR_SHA256 (sizeof(Ipp64u))
+#define MLR_SHA224 (sizeof(Ipp64u))
+#define MLR_SHA512 (sizeof(Ipp64u)*2)
+#define MLR_SHA384 (sizeof(Ipp64u)*2)
+#define MLR_MD5 (sizeof(Ipp64u))
+#define MLR_SM3 (sizeof(Ipp64u))
+
/* hold some old definition for a purpose */
typedef Ipp32u DigestSHA1[5]; /* SHA1 digest */
typedef Ipp32u DigestSHA224[7]; /* SHA224 digest */
@@ -49,95 +58,56 @@ typedef Ipp64u DigestSHA512[8]; /* SHA512 digest */
typedef Ipp32u DigestMD5[4]; /* MD5 digest */
typedef Ipp32u DigestSM3[8]; /* SM3 digest */
-#define SHA1_ALIGNMENT ((int)(sizeof(Ipp32u)))
-#define SHA224_ALIGNMENT ((int)(sizeof(Ipp32u)))
-#define SHA256_ALIGNMENT ((int)(sizeof(Ipp32u)))
-#define SHA384_ALIGNMENT ((int)(sizeof(Ipp32u)))
-#define SHA512_ALIGNMENT ((int)(sizeof(Ipp32u)))
-#define MD5_ALIGNMENT ((int)(sizeof(Ipp32u)))
-#define SM3_ALIGNMENT ((int)(sizeof(Ipp32u)))
+#define HASH_ALIGNMENT ((int)(sizeof(void*)))
+#define SHA1_ALIGNMENT HASH_ALIGNMENT
+#define SHA224_ALIGNMENT HASH_ALIGNMENT
+#define SHA256_ALIGNMENT HASH_ALIGNMENT
+#define SHA384_ALIGNMENT HASH_ALIGNMENT
+#define SHA512_ALIGNMENT HASH_ALIGNMENT
+#define MD5_ALIGNMENT HASH_ALIGNMENT
+#define SM3_ALIGNMENT HASH_ALIGNMENT
-#if defined(_ENABLE_ALG_SHA1_)
struct _cpSHA1 {
- IppCtxId idCtx; /* SHA1 identifier */
- int index; /* internal buffer entry (free) */
- Ipp64u msgLenLo; /* message length (bytes) */
- Ipp8u msgBuffer[MBS_SHA1]; /* buffer */
- DigestSHA1 msgHash; /* intermediate digest */
+ IppCtxId idCtx; /* SHA1 identifier */
+ int msgBuffIdx; /* buffer entry */
+ Ipp64u msgLenLo; /* message length (bytes) */
+ Ipp8u msgBuffer[MBS_SHA1]; /* buffer */
+ DigestSHA1 msgHash; /* intermediate hash */
};
-#endif
-#if defined(_ENABLE_ALG_SHA256_) || defined(_ENABLE_ALG_SHA224_)
struct _cpSHA256 {
- IppCtxId idCtx; /* SHA224 identifier */
- int index; /* internal buffer entry (free) */
- Ipp64u msgLenLo; /* message length (bytes) */
- Ipp8u msgBuffer[MBS_SHA256]; /* buffer */
- DigestSHA256 msgHash; /* intermediate digest */
+ IppCtxId idCtx; /* SHA224 identifier */
+ int msgBuffIdx; /* buffer entry */
+ Ipp64u msgLenLo; /* message length */
+ Ipp8u msgBuffer[MBS_SHA256]; /* buffer */
+ DigestSHA256 msgHash; /* intermediate hash */
};
-#endif
-#if defined(_ENABLE_ALG_SHA512_) || defined(_ENABLE_ALG_SHA384_) || defined(_ENABLE_ALG_SHA512_224_) || defined(_ENABLE_ALG_SHA512_256_)
struct _cpSHA512 {
- IppCtxId idCtx; /* SHA384 identifier */
- int index; /* internal buffer entry (free) */
- Ipp64u msgLenLo; /* message length (bytes) */
- Ipp64u msgLenHi; /* message length (bytes) */
- Ipp8u msgBuffer[MBS_SHA512]; /* buffer */
- DigestSHA512 msgHash; /* intermediate digest */
+ IppCtxId idCtx; /* SHA384 identifier */
+ int msgBuffIdx; /* buffer entry */
+ Ipp64u msgLenLo; /* message length */
+ Ipp64u msgLenHi; /* message length */
+ Ipp8u msgBuffer[MBS_SHA512]; /* buffer */
+ DigestSHA512 msgHash; /* intermediate hash */
};
-#endif
-#if defined(_ENABLE_ALG_MD5_)
struct _cpMD5 {
- IppCtxId idCtx; /* MD5 identifier */
- int index; /* internal buffer entry (free) */
- Ipp64u msgLenLo; /* message length (bytes) */
- Ipp8u msgBuffer[MBS_MD5]; /* buffer */
- DigestMD5 msgHash; /* intermediate digest */
+ IppCtxId idCtx; /* MD5 identifier */
+ int msgBuffIdx; /* buffer entry */
+ Ipp64u msgLenLo; /* message length */
+ Ipp8u msgBuffer[MBS_MD5]; /* buffer */
+ DigestMD5 msgHash; /* intermediate hash */
};
-#endif
-#if defined(_ENABLE_ALG_SM3_)
struct _cpSM3 {
- IppCtxId idCtx; /* SM3 identifier */
- int index; /* internal buffer entry (free) */
- Ipp64u msgLenLo; /* message length (bits) */
- Ipp8u msgBuffer[MBS_SM3]; /* buffer */
- DigestSM3 msgHash; /* intermediate digest */
+ IppCtxId idCtx; /* SM3 identifier */
+ int msgBuffIdx; /* buffer entry */
+ Ipp64u msgLenLo; /* message length */
+ Ipp8u msgBuffer[MBS_SM3]; /* buffer */
+ DigestSM3 msgHash; /* intermediate hash */
};
-#endif
-
-/*
-// Useful macros
-*/
-#define SHS_ID(stt) ((stt)->idCtx)
-#define SHS_INDX(stt) ((stt)->index)
-#define SHS_LENL(stt) ((stt)->msgLenLo)
-#define SHS_LENH(stt) ((stt)->msgLenHi)
-#define SHS_BUFF(stt) ((stt)->msgBuffer)
-#define SHS_HASH(stt) ((stt)->msgHash)
-
-/* initial hash values */
-extern const Ipp32u SHA1_IV[];
-extern const Ipp32u SHA256_IV[];
-extern const Ipp32u SHA224_IV[];
-extern const Ipp64u SHA512_IV[];
-extern const Ipp64u SHA384_IV[];
-extern const Ipp32u MD5_IV[];
-extern const Ipp32u SM3_IV[];
-extern const Ipp64u SHA512_224_IV[];
-extern const Ipp64u SHA512_256_IV[];
-
-/* hash alg additive constants */
-extern __ALIGN16 const Ipp32u SHA1_cnt[];
-extern __ALIGN16 const Ipp32u SHA256_cnt[];
-extern __ALIGN16 const Ipp64u SHA512_cnt[];
-extern __ALIGN16 const Ipp32u MD5_cnt[];
-extern __ALIGN16 const Ipp32u SM3_cnt[];
-
-/* */
/* hash alg attributes */
@@ -149,26 +119,23 @@ typedef struct _cpHashAttr {
Ipp64u msgLenMax[2]; /* attr: max message length (bytes) (low high) */
} cpHashAttr;
-
/* hash value */
typedef Ipp64u cpHash[IPP_SHA512_DIGEST_BITSIZE/BITSIZE(Ipp64u)]; /* hash value */
/* hash update function */
typedef void (*cpHashProc)(void* pHash, const Ipp8u* pMsg, int msgLen, const void* pParam);
-
-
-/* hash context */
+/* generalized hash context */
struct _cpHashCtx {
IppCtxId idCtx; /* hash identifier */
IppHashAlgId algID; /* hash algorithm ID */
- Ipp64u msgLenLo; /* length (bytes) of processed message: */
- Ipp64u msgLenHi; /* low and high parts */
- cpHashProc hashProc; /* hash update function */
- const void* pParam; /* optional hashProc's parameter */
- cpHash hashVal; /* intermadiate has value */
- int buffOffset; /* current buffer position */
- Ipp8u msgBuffer[MBS_HASH_MAX]; /* buffer */
+ Ipp64u msgLenLo; /* processed message:*/
+ Ipp64u msgLenHi; /* length */
+ cpHashProc hashProc; /* hash update func */
+ const void* pParam; /* hashProc's params */
+ cpHash msgHash; /* intermadiate hash */
+ int msgBuffIdx; /* buffer entry */
+ Ipp8u msgBuffer[MBS_HASH_MAX]; /* buffer */
};
/* accessors */
@@ -178,13 +145,29 @@ struct _cpHashCtx {
#define HASH_LENHI(stt) ((stt)->msgLenHi)
#define HASH_FUNC(stt) ((stt)->hashProc)
#define HASH_FUNC_PAR(stt) ((stt)->pParam)
-#define HASH_VALUE(stt) ((stt)->hashVal)
-#define HAHS_BUFFIDX(stt) ((stt)->buffOffset)
+#define HASH_VALUE(stt) ((stt)->msgHash)
+#define HAHS_BUFFIDX(stt) ((stt)->msgBuffIdx)
#define HASH_BUFF(stt) ((stt)->msgBuffer)
#define HASH_VALID_ID(pCtx) (HASH_CTX_ID((pCtx))==idCtxHash)
-/* old some old accessors */
-//#define SHS_DGST(stt) HASH_VALUE((stt))
-//#define SHS_BUFF(stt) HASH_BUFF((stt))
+
+
+/* initial hash values */
+extern const Ipp32u SHA1_IV[];
+extern const Ipp32u SHA256_IV[];
+extern const Ipp32u SHA224_IV[];
+extern const Ipp64u SHA512_IV[];
+extern const Ipp64u SHA384_IV[];
+extern const Ipp32u MD5_IV[];
+extern const Ipp32u SM3_IV[];
+extern const Ipp64u SHA512_224_IV[];
+extern const Ipp64u SHA512_256_IV[];
+
+/* hash alg additive constants */
+extern __ALIGN16 const Ipp32u SHA1_cnt[];
+extern __ALIGN16 const Ipp32u SHA256_cnt[];
+extern __ALIGN16 const Ipp64u SHA512_cnt[];
+extern __ALIGN16 const Ipp32u MD5_cnt[];
+extern __ALIGN16 const Ipp32u SM3_cnt[];
/* hash alg opt argument */
@@ -221,19 +204,26 @@ __INLINE IppHashAlgId cpValidHashAlg(IppHashAlgId algID)
/* processing functions */
+#define UpdateSHA1 OWNAPI(UpdateSHA1)
void UpdateSHA1 (void* pHash, const Ipp8u* mblk, int mlen, const void* pParam);
+#define UpdateSHA256 OWNAPI(UpdateSHA256)
void UpdateSHA256(void* pHash, const Ipp8u* mblk, int mlen, const void* pParam);
+#define UpdateSHA512 OWNAPI(UpdateSHA512)
void UpdateSHA512(void* pHash, const Ipp8u* mblk, int mlen, const void* pParam);
+#define UpdateMD5 OWNAPI(UpdateMD5)
void UpdateMD5 (void* pHash, const Ipp8u* mblk, int mlen, const void* pParam);
+#define UpdateSM3 OWNAPI(UpdateSM3)
void UpdateSM3 (void* pHash, const Ipp8u* mblk, int mlen, const void* pParam);
-#if (_IPP>=_IPP_P8) || (_IPP32E>=_IPP32E_Y8)
+#if (_SHA_NI_ENABLING_ == _FEATURE_TICKTOCK_) || (_SHA_NI_ENABLING_ == _FEATURE_ON_)
+#define UpdateSHA1ni OWNAPI(UpdateSHA1ni)
void UpdateSHA1ni (void* pHash, const Ipp8u* mblk, int mlen, const void* pParam);
+#define UpdateSHA256ni OWNAPI(UpdateSHA256ni)
void UpdateSHA256ni(void* pHash, const Ipp8u* mblk, int mlen, const void* pParam);
#endif
/* general methods */
-//void cpHashUpdate(const Ipp8u* pSrc, int len, IppsHashState* pCtx, cpHashProc hashFunc, const void* pParam, int mbs);
+#define cpReInitHash OWNAPI(cpReInitHash)
int cpReInitHash(IppsHashState* pCtx, IppHashAlgId algID);
#endif /* _PCP_HASH_H */
diff --git a/ext/ipp/sources/ippcp/src/pcphash_rmf.h b/ext/ipp/sources/ippcp/src/pcphash_rmf.h
new file mode 100644
index 0000000..0c00567
--- /dev/null
+++ b/ext/ipp/sources/ippcp/src/pcphash_rmf.h
@@ -0,0 +1,51 @@
+/*############################################################################
+ # Copyright 2016-2017 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.
+ ############################################################################*/
+
+/*
+// Purpose:
+// Cryptography Primitive.
+// Security Hash Standard
+// Internal Definitions and Internal Functions Prototypes
+//
+*/
+
+#if !defined(_PCP_HASH_RMF_H)
+#define __PCP_HASH_RMF_H
+
+#include "pcphash.h"
+#include "pcphashmethod_rmf.h"
+
+
+struct _cpHashCtx_rmf {
+ IppCtxId idCtx; /* hash identifier */
+ const cpHashMethod_rmf* pMethod; /* hash methods */
+ int msgBuffIdx; /* buffer index */
+ Ipp8u msgBuffer[MBS_HASH_MAX]; /* buffer */
+ Ipp64u msgLenLo; /* processed message */
+ Ipp64u msgLenHi; /* length (bytes) */
+ cpHash msgHash; /* hash value */
+};
+
+/* accessors */
+#define HASH_CTX_ID(stt) ((stt)->idCtx)
+#define HASH_METHOD(stt) ((stt)->pMethod)
+#define HAHS_BUFFIDX(stt) ((stt)->msgBuffIdx)
+#define HASH_BUFF(stt) ((stt)->msgBuffer)
+#define HASH_LENLO(stt) ((stt)->msgLenLo)
+#define HASH_LENHI(stt) ((stt)->msgLenHi)
+#define HASH_VALUE(stt) ((stt)->msgHash)
+
+#endif /* __PCP_HASH_RMF_H */
diff --git a/ext/ipp/sources/ippcp/src/pcphashca.c b/ext/ipp/sources/ippcp/src/pcphashca.c
new file mode 100644
index 0000000..4fa69d6
--- /dev/null
+++ b/ext/ipp/sources/ippcp/src/pcphashca.c
@@ -0,0 +1,744 @@
+/*############################################################################
+ # Copyright 2014-2017 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.
+ ############################################################################*/
+
+/*
+//
+// Purpose:
+// Cryptography Primitive.
+// Security Hash Standard
+// General Functionality
+//
+// Contents:
+// ippsHashGetSize()
+// ippsHashInit()
+// ippsHashPack()
+// ippsHashUnpack()
+// ippsHashDuplicate()
+// ippsHashUpdate()
+// ippsHashGetTag()
+// ippsHashFinal()
+// ippsHashMessage()
+//
+//
+*/
+
+#include "owndefs.h"
+#include "owncp.h"
+#include "pcphash.h"
+#include "pcptool.h"
+
+
+/*F*
+// Name: ippsHashGetSize
+//
+// Purpose: Returns size (bytes) of IppsHashState state.
+//
+// Returns: Reason:
+// ippStsNullPtrErr pSize == NULL
+// ippStsNoErr no errors
+//
+// Parameters:
+// pSize pointer to state size
+//
+*F*/
+IPPFUN(IppStatus, ippsHashGetSize,(int* pSize))
+{
+ /* test pointers */
+ IPP_BAD_PTR1_RET(pSize);
+
+ *pSize = sizeof(IppsHashState);
+ return ippStsNoErr;
+}
+
+
+/*F*
+// Name: ippsHashInit
+//
+// Purpose: Init Hash state.
+//
+// Returns: Reason:
+// ippStsNullPtrErr pState == NULL
+// ippStsNotSupportedModeErr if algID is not match to supported hash alg
+// ippStsNoErr no errors
+//
+// Parameters:
+// pCtx pointer to the Hash state
+// algID hash alg ID
+//
+*F*/
+int cpReInitHash(IppsHashState* pCtx, IppHashAlgId algID)
+{
+ int hashIvSize = cpHashIvSize(algID);
+ const Ipp8u* iv = cpHashIV[algID];
+
+ HASH_LENLO(pCtx) = CONST_64(0);
+ HASH_LENHI(pCtx) = CONST_64(0);
+ HAHS_BUFFIDX(pCtx) = 0;
+ CopyBlock(iv, HASH_VALUE(pCtx), hashIvSize);
+
+ return hashIvSize;
+}
+
+/*
+// hash alg default processing functions and opt argument
+*/
+static cpHashProc cpHashProcFunc[] = {
+ (cpHashProc)NULL,
+
+ #if defined(_ENABLE_ALG_SHA1_)
+ #if(_SHA_NI_ENABLING_==_FEATURE_ON_)
+ UpdateSHA1ni,
+ #else
+ UpdateSHA1,
+ #endif
+ #else
+ NULL,
+ #endif
+
+ #if defined(_ENABLE_ALG_SHA256_)
+ #if(_SHA_NI_ENABLING_==_FEATURE_ON_)
+ UpdateSHA256ni,
+ #else
+ UpdateSHA256,
+ #endif
+ #else
+ NULL,
+ #endif
+
+ #if defined(_ENABLE_ALG_SHA224_)
+ #if(_SHA_NI_ENABLING_==_FEATURE_ON_)
+ UpdateSHA256ni,
+ #else
+ UpdateSHA256,
+ #endif
+ #else
+ NULL,
+ #endif
+
+ #if defined(_ENABLE_ALG_SHA512_)
+ UpdateSHA512,
+ #else
+ NULL,
+ #endif
+
+ #if defined(_ENABLE_ALG_SHA384_)
+ UpdateSHA512,
+ #else
+ NULL,
+ #endif
+
+ #if defined(_ENABLE_ALG_MD5_)
+ UpdateMD5,
+ #else
+ NULL,
+ #endif
+
+ #if defined(_ENABLE_ALG_SM3_)
+ UpdateSM3,
+ #else
+ NULL,
+ #endif
+
+ #if defined(_ENABLE_ALG_SHA512_224_)
+ UpdateSHA512,
+ #else
+ NULL,
+ #endif
+
+ #if defined(_ENABLE_ALG_SHA512_256_)
+ UpdateSHA512,
+ #else
+ NULL,
+ #endif
+};
+
+#define cpInitHash OWNAPI(cpInitHash)
+int cpInitHash(IppsHashState* pCtx, IppHashAlgId algID)
+{
+ /* setup default processing function */
+ HASH_FUNC(pCtx) = cpHashProcFunc[algID];
+
+ /* update default processing function if SHA-NI enabled */
+ #if (_IPP>=_IPP_P8) || (_IPP32E>=_IPP32E_Y8)
+ if( IsFeatureEnabled(SHA_NI_ENABLED) ) {
+
+ #if defined(_ENABLE_ALG_SHA1_)
+ if(ippHashAlg_SHA1==algID)
+ HASH_FUNC(pCtx) = UpdateSHA1ni;
+ #endif
+
+ #if defined(_ENABLE_ALG_SHA256_) || defined(_ENABLE_ALG_SHA224_)
+ if(ippHashAlg_SHA256==algID || ippHashAlg_SHA224==algID)
+ HASH_FUNC(pCtx) = UpdateSHA256ni;
+ #endif
+ }
+ #endif
+
+ /* setup optional agr of processing function */
+ HASH_FUNC_PAR(pCtx) = cpHashProcFuncOpt[algID];
+
+ return cpReInitHash(pCtx, algID);
+}
+
+IPPFUN(IppStatus, ippsHashInit,(IppsHashState* pCtx, IppHashAlgId algID))
+{
+ /* get algorithm id */
+ algID = cpValidHashAlg(algID);
+ /* test hash alg */
+ IPP_BADARG_RET(ippHashAlg_Unknown==algID, ippStsNotSupportedModeErr);
+
+ /* test ctx pointer */
+ IPP_BAD_PTR1_RET(pCtx);
+ /* test hash alg */
+
+ /* set ctx ID */
+ HASH_CTX_ID(pCtx) = idCtxHash;
+ HASH_ALG_ID(pCtx) = algID;
+
+ /* init context */
+ cpInitHash(pCtx, algID);
+ return ippStsNoErr;
+}
+
+
+/*F*
+// Name: ippsHashPack
+//
+// Purpose: Copy initialized context to the buffer.
+//
+// Returns: Reason:
+// ippStsNullPtrErr pSize == NULL
+// pBuffer == NULL
+// ippStsContextMatchErr pCtx->idCtx != idCtxHash
+// ippStsNoMemErr bufSize < sizeof(IppsHashState)
+// ippStsNoErr no errors
+//
+// Parameters:
+// pCtx pointer hash state
+// pBuffer pointer to the destination buffer
+// bufSize size of the destination buffer
+//
+*F*/
+IPPFUN(IppStatus, ippsHashPack,(const IppsHashState* pCtx, Ipp8u* pBuffer, int bufSize))
+{
+ /* test pointers */
+ IPP_BAD_PTR2_RET(pCtx, pBuffer);
+ /* test the context */
+ IPP_BADARG_RET(!HASH_VALID_ID(pCtx), ippStsContextMatchErr);
+ /* test buffer length */
+ IPP_BADARG_RET((int)(sizeof(IppsHashState))>bufSize, ippStsNoMemErr);
+
+ CopyBlock(pCtx, pBuffer, sizeof(IppsHashState));
+ return ippStsNoErr;
+}
+
+
+/*F*
+// Name: ippsHashUnpack
+//
+// Purpose: Unpack buffer content into the initialized context.
+//
+// Returns: Reason:
+// ippStsNullPtrErr pSize == NULL
+// pBuffer == NULL
+// ippStsNoErr no errors
+//
+// Parameters:
+// pBuffer pointer to the source buffer
+// pCtx pointer hash state
+//
+*F*/
+IPPFUN(IppStatus, ippsHashUnpack,(const Ipp8u* pBuffer, IppsHashState* pCtx))
+{
+ /* test pointers */
+ IPP_BAD_PTR2_RET(pCtx, pBuffer);
+
+ CopyBlock(pBuffer, pCtx, sizeof(IppsHashState));
+ return ippStsNoErr;
+}
+
+
+/*F*
+// Name: ippsHashDuplicate
+//
+// Purpose: Clone Hash context.
+//
+// Returns: Reason:
+// ippStsNullPtrErr pSrcCtx == NULL
+// pDstCtx == NULL
+// ippStsContextMatchErr pSrcCtx->idCtx != idCtxHash
+// pDstCtx->idCtx != idCtxHash
+// ippStsNoErr no errors
+//
+// Parameters:
+// pSrcCtx pointer to the source Hash context
+// pDstCtx pointer to the target Hash context
+//
+// Note:
+// pDstCtx may to be uninitialized by ippsHashInit()
+//
+*F*/
+IPPFUN(IppStatus, ippsHashDuplicate,(const IppsHashState* pSrcCtx, IppsHashState* pDstCtx))
+{
+ /* test state pointers */
+ IPP_BAD_PTR2_RET(pSrcCtx, pDstCtx);
+ /* test states ID */
+ IPP_BADARG_RET(!HASH_VALID_ID(pSrcCtx), ippStsContextMatchErr);
+
+ /* copy state */
+ CopyBlock(pSrcCtx, pDstCtx, sizeof(IppsHashState));
+ return ippStsNoErr;
+}
+
+
+/*F*
+// Name: ippsHashUpdate
+//
+// Purpose: Updates intermediate hash value based on input stream.
+//
+// Returns: Reason:
+// ippStsNullPtrErr pCtx == NULL
+// ippStsNullPtrErr pSrc==0 but len!=0
+// ippStsContextMatchErr pCtx->idCtx != idCtxHash
+// ippStsLengthErr len <0
+// ippStsNoErr no errors
+//
+// Parameters:
+// pSrc pointer to the input stream
+// len input stream length
+// pCtx pointer to the Hash context
+//
+*F*/
+__INLINE int IsExceedMsgLen(Ipp64u maxLo, Ipp64u maxHi, Ipp64u lenLo, Ipp64u lenHi)
+{
+ int isExceed = lenLo > maxLo;
+ isExceed = (lenHi+isExceed) > maxHi;
+ return isExceed;
+}
+
+IPPFUN(IppStatus, ippsHashUpdate,(const Ipp8u* pSrc, int len, IppsHashState* pCtx))
+{
+ /* test state pointer and ID */
+ IPP_BAD_PTR1_RET(pCtx);
+ /* test the context */
+ IPP_BADARG_RET(!HASH_VALID_ID(pCtx), ippStsContextMatchErr);
+ /* test input length */
+ IPP_BADARG_RET((len<0 && pSrc), ippStsLengthErr);
+ /* test source pointer */
+ IPP_BADARG_RET((len && !pSrc), ippStsNullPtrErr);
+
+ /* handle non empty input */
+ if(len) {
+ const cpHashAttr* pAttr = &cpHashAlgAttr[HASH_ALG_ID(pCtx)];
+
+ /* test if size of message is being processed not exceeded yet */
+ Ipp64u lenLo = HASH_LENLO(pCtx);
+ Ipp64u lenHi = HASH_LENHI(pCtx);
+ lenLo += len;
+ if(lenLo < HASH_LENLO(pCtx)) lenHi++;
+ if(IsExceedMsgLen(pAttr->msgLenMax[0],pAttr->msgLenMax[1], lenLo,lenHi))
+ IPP_ERROR_RET(ippStsLengthErr);
+
+ else {
+ cpHashProc hashFunc = HASH_FUNC(pCtx); /* processing function */
+ const void* pParam = HASH_FUNC_PAR(pCtx); /* and it's addition params */
+ int mbs = pAttr->msgBlkSize; /* data block size */
+
+ /*
+ // processing
+ */
+ {
+ int procLen;
+
+ /* test if internal buffer is not empty */
+ int n = HAHS_BUFFIDX(pCtx);
+ if(n) {
+ procLen = IPP_MIN(len, (mbs-n));
+ CopyBlock(pSrc, HASH_BUFF(pCtx)+n, procLen);
+ HAHS_BUFFIDX(pCtx) = n += procLen;
+
+ /* block processing */
+ if(mbs==n) {
+ hashFunc(HASH_VALUE(pCtx), HASH_BUFF(pCtx), mbs, pParam);
+ HAHS_BUFFIDX(pCtx) = 0;
+ }
+
+ /* update message pointer and length */
+ pSrc += procLen;
+ len -= procLen;
+ }
+
+ /* main processing part */
+ procLen = len & ~(mbs-1);
+ if(procLen) {
+ hashFunc(HASH_VALUE(pCtx), pSrc, procLen, pParam);
+ pSrc += procLen;
+ len -= procLen;
+ }
+
+ /* rest of input message */
+ if(len) {
+ CopyBlock(pSrc, HASH_BUFF(pCtx), len);
+ HAHS_BUFFIDX(pCtx) += len;
+ }
+ }
+
+ /* update length of processed message */
+ HASH_LENLO(pCtx) = lenLo;
+ HASH_LENHI(pCtx) = lenHi;
+
+ return ippStsNoErr;
+ }
+ }
+
+ return ippStsNoErr;
+}
+
+#if 0
+/*
+// Hash computation complition
+*/
+static void cpHash32_cvt(Ipp8u* pMD, int hashSize, const void* uniDigest)
+{
+ const Ipp32u* aDigest = (const Ipp32u*)uniDigest;
+ int i;
+ for(i=0; i<hashSize; i++)
+ pMD[i] = (Ipp8u)( aDigest[i>>2] >> (24 - 8*(i&3)) );
+}
+static void cpMD5_cvt(Ipp8u* pMD, Ipp32u* aDigest)
+{
+ #if (IPP_ENDIAN == IPP_BIG_ENDIAN)
+ aDigest[0] = ENDIANNESS(aDigest[0]);
+ aDigest[1] = ENDIANNESS(aDigest[1]);
+ aDigest[2] = ENDIANNESS(aDigest[2]);
+ aDigest[3] = ENDIANNESS(aDigest[3]);
+ #endif
+ CopyBlock((Ipp8u*)aDigest, pMD, IPP_MD5_DIGEST_BITSIZE/8);
+}
+static void cpHash64_cvt(Ipp8u* pMD, int hashSize, const void* uniDigest)
+{
+ const Ipp64u* aDigest = (const Ipp64u*)uniDigest;
+ int i;
+ for(i=0; i<hashSize; i++)
+ pMD[i] = (Ipp8u)( aDigest[i>>3] >> (56 - 8*(i&7)) );
+}
+#endif
+
+static void cpComputeDigest(Ipp8u* pHashTag, int hashTagLen, const IppsHashState* pCtx)
+{
+ /* hash alg and parameters */
+ cpHashProc hashFunc = HASH_FUNC(pCtx); /* processing function */
+ const void* pParam = HASH_FUNC_PAR(pCtx); /* and it's addition params */
+
+ /* attributes */
+ const cpHashAttr* pAttr = &cpHashAlgAttr[HASH_ALG_ID(pCtx)];
+ int mbs = pAttr->msgBlkSize; /* data block size */
+ int ivSize = pAttr->ivSize; /* size of hash's IV */
+ int msgLenRepSize = pAttr->msgLenRepSize; /* length of the message representation */
+
+ /* number of bytes in context buffer */
+ int n = HAHS_BUFFIDX(pCtx);
+ /* buffer and it actual length */
+ Ipp8u buffer[MBS_HASH_MAX*2];
+ int bufferLen = n < (mbs-msgLenRepSize)? mbs : mbs*2;
+
+ /* copy current hash value */
+ cpHash hash;
+ CopyBlock(HASH_VALUE(pCtx), hash, ivSize);
+
+ /* copy of state's buffer */
+ CopyBlock(HASH_BUFF(pCtx), buffer, n);
+ /* end of message bit */
+ buffer[n++] = 0x80;
+ /* padd buffer */
+ PaddBlock(0, buffer+n, bufferLen-n-msgLenRepSize);
+
+ /* message length representation in bits (remember about big endian) */
+ {
+ /* convert processed message length bytes ->bits */
+ Ipp64u lo = HASH_LENLO(pCtx);
+ Ipp64u hi = HASH_LENHI(pCtx);
+ hi = LSL64(hi,3) | LSR64(lo,63-3);
+ lo = LSL64(lo,3);
+
+ if(msgLenRepSize>(int)(sizeof(Ipp64u))) {
+ #if (IPP_ENDIAN == IPP_BIG_ENDIAN)
+ ((Ipp64u*)(buffer+bufferLen))[-2] = hi;
+ #else
+ ((Ipp64u*)(buffer+bufferLen))[-2] = ENDIANNESS64(hi);
+ #endif
+ }
+
+ /* recall about MD5 specific */
+ if(ippHashAlg_MD5!=HASH_ALG_ID(pCtx)) {
+ #if (IPP_ENDIAN == IPP_BIG_ENDIAN)
+ ((Ipp64u*)(buffer+bufferLen))[-1] = lo;
+ #else
+ ((Ipp64u*)(buffer+bufferLen))[-1] = ENDIANNESS64(lo);
+ #endif
+ }
+ else {
+ #if (IPP_ENDIAN == IPP_BIG_ENDIAN)
+ ((Ipp64u*)(buffer+bufferLen))[-1] = ENDIANNESS64(lo);
+ #else
+ ((Ipp64u*)(buffer+bufferLen))[-1] = lo;
+ #endif
+ }
+ }
+
+ /* copmplete hash computation */
+ hashFunc(hash, buffer, bufferLen, pParam);
+
+ /* store digest into the user buffer (remember digest in big endian) */
+ if(msgLenRepSize>(int)(sizeof(Ipp64u))) {
+ /* ippHashAlg_SHA384, ippHashAlg_SHA512, ippHashAlg_SHA512_224 and ippHashAlg_SHA512_256 */
+ hash[0] = ENDIANNESS64(hash[0]);
+ hash[1] = ENDIANNESS64(hash[1]);
+ hash[2] = ENDIANNESS64(hash[2]);
+ hash[3] = ENDIANNESS64(hash[3]);
+ hash[4] = ENDIANNESS64(hash[4]);
+ hash[5] = ENDIANNESS64(hash[5]);
+ hash[6] = ENDIANNESS64(hash[6]);
+ hash[7] = ENDIANNESS64(hash[7]);
+ }
+ else if(ippHashAlg_MD5!=HASH_ALG_ID(pCtx)) {
+ ((Ipp32u*)hash)[0] = ENDIANNESS32(((Ipp32u*)hash)[0]);
+ ((Ipp32u*)hash)[1] = ENDIANNESS32(((Ipp32u*)hash)[1]);
+ ((Ipp32u*)hash)[2] = ENDIANNESS32(((Ipp32u*)hash)[2]);
+ ((Ipp32u*)hash)[3] = ENDIANNESS32(((Ipp32u*)hash)[3]);
+ ((Ipp32u*)hash)[4] = ENDIANNESS32(((Ipp32u*)hash)[4]);
+ if(ippHashAlg_SHA1!=HASH_ALG_ID(pCtx)) {
+ ((Ipp32u*)hash)[5] = ENDIANNESS32(((Ipp32u*)hash)[5]);
+ ((Ipp32u*)hash)[6] = ENDIANNESS32(((Ipp32u*)hash)[6]);
+ ((Ipp32u*)hash)[7] = ENDIANNESS32(((Ipp32u*)hash)[7]);
+ }
+ }
+ CopyBlock(hash, pHashTag, hashTagLen);
+}
+
+
+/*F*
+// Name: ippsHashGetTag
+//
+// Purpose: Compute digest based on current state.
+// Note, that futher digest update is possible
+//
+// Returns: Reason:
+// ippStsNullPtrErr pTag == NULL
+// pCtx == NULL
+// ippStsContextMatchErr pCtx->idCtx != idCtxHash
+// ippStsLengthErr hashSize < tagLen <1
+// ippStsNoErr no errors
+//
+// Parameters:
+// pTag address of the output digest
+// tagLen length of digest
+// pCtx pointer to the SHS state
+//
+*F*/
+IPPFUN(IppStatus, ippsHashGetTag,(Ipp8u* pTag, int tagLen, const IppsHashState* pCtx))
+{
+ /* test state pointer and ID */
+ IPP_BAD_PTR2_RET(pTag, pCtx);
+ /* test the context */
+ IPP_BADARG_RET(!HASH_VALID_ID(pCtx), ippStsContextMatchErr);
+
+ {
+ /* size of hash */
+ int hashSize = cpHashAlgAttr[HASH_ALG_ID(pCtx)].hashSize;
+ if(tagLen<1||hashSize<tagLen) IPP_ERROR_RET(ippStsLengthErr);
+
+ cpComputeDigest(pTag, tagLen, pCtx);
+ return ippStsNoErr;
+ }
+}
+
+/*F*
+// Name: ippsHashFinal
+//
+// Purpose: Complete message digesting and return digest.
+//
+// Returns: Reason:
+// ippStsNullPtrErr pMD == NULL
+// pCtx == NULL
+// ippStsContextMatchErr pCtx->idCtx != idCtxHash
+// ippStsNoErr no errors
+//
+// Parameters:
+// pMD address of the output digest
+// pCtx pointer to the SHS state
+//
+*F*/
+IPPFUN(IppStatus, ippsHashFinal,(Ipp8u* pMD, IppsHashState* pCtx))
+{
+ /* test state pointer and ID */
+ IPP_BAD_PTR2_RET(pMD, pCtx);
+ /* test the context */
+ IPP_BADARG_RET(!HASH_VALID_ID(pCtx), ippStsContextMatchErr);
+
+ {
+ IppHashAlgId algID = HASH_ALG_ID(pCtx);
+ int hashSize = cpHashAlgAttr[algID].hashSize;
+
+ cpComputeDigest(pMD, hashSize, pCtx);
+ cpReInitHash(pCtx, algID);
+
+ return ippStsNoErr;
+ }
+}
+
+
+/*F*
+// Name: ippsHashMessage
+//
+// Purpose: Hash of the whole message.
+//
+// Returns: Reason:
+// ippStsNullPtrErr pMD == NULL
+// pMsg == NULL but msgLen!=0
+// ippStsLengthErr msgLen <0
+// ippStsNotSupportedModeErr if algID is not match to supported hash alg
+// ippStsNoErr no errors
+//
+// Parameters:
+// pMsg pointer to the input message
+// msgLen input message length
+// pMD address of the output digest
+// algID hash alg ID
+//
+*F*/
+#if 0
+IPPFUN(IppStatus, ippsHashMessage,(const Ipp8u* pMsg, int msgLen, Ipp8u* pMD, IppHashAlgId algID))
+{
+ /* get algorithm id */
+ algID = cpValidHashAlg(algID);
+ /* test hash alg */
+ IPP_BADARG_RET(ippHashAlg_Unknown==algID, ippStsNotSupportedModeErr);
+
+ /* test digest pointer */
+ IPP_BAD_PTR1_RET(pMD);
+ /* test message length */
+ IPP_BADARG_RET((msgLen<0), ippStsLengthErr);
+ /* test message pointer */
+ IPP_BADARG_RET((msgLen && !pMsg), ippStsNullPtrErr);
+
+ {
+ IppsHashState ctx;
+
+ IppStatus sts = ippsHashInit(&ctx, algID);
+ if(ippStsNoErr!=sts) goto exit;
+
+ sts = ippsHashUpdate(pMsg, msgLen, &ctx);
+ if(ippStsNoErr!=sts) goto exit;
+
+ sts = ippsHashFinal(pMD, &ctx);
+
+ exit:
+ return sts;
+ }
+}
+#endif
+IPPFUN(IppStatus, ippsHashMessage,(const Ipp8u* pMsg, int msgLen, Ipp8u* pMD, IppHashAlgId algID))
+{
+ /* get algorithm id */
+ algID = cpValidHashAlg(algID);
+ /* test hash alg */
+ IPP_BADARG_RET(ippHashAlg_Unknown==algID, ippStsNotSupportedModeErr);
+
+ /* test digest pointer */
+ IPP_BAD_PTR1_RET(pMD);
+ /* test message length */
+ IPP_BADARG_RET((msgLen<0), ippStsLengthErr);
+ /* test message pointer */
+ IPP_BADARG_RET((msgLen && !pMsg), ippStsNullPtrErr);
+
+ {
+ /* processing function and parameter */
+ cpHashProc hashFunc = cpHashProcFunc[algID];
+ const void* pParam = cpHashProcFuncOpt[algID];
+
+ /* attributes */
+ const cpHashAttr* pAttr = &cpHashAlgAttr[algID];
+ int mbs = pAttr->msgBlkSize; /* data block size */
+ int ivSize = pAttr->ivSize; /* size of hash's IV */
+ int hashSize = pAttr->hashSize; /* hash size */
+ int msgLenRepSize = pAttr->msgLenRepSize; /* length of the message representation */
+
+ /* message bitlength representation */
+ Ipp64u msgLenBits = (Ipp64u)msgLen*8;
+ /* length of main message part */
+ int msgLenBlks = msgLen & (-mbs);
+ /* rest of message length */
+ int msgLenRest = msgLen - msgLenBlks;
+
+ /* end of message buffer */
+ Ipp8u buffer[MBS_HASH_MAX*2];
+ int bufferLen = (msgLenRest < (mbs-msgLenRepSize))? mbs : mbs*2;
+
+ /* init hash */
+ cpHash hash;
+ const Ipp8u* iv = cpHashIV[algID];
+ CopyBlock(iv, hash, ivSize);
+
+ /*construct last messge block(s) */
+ #define MSG_LEN_REP (sizeof(Ipp64u))
+
+ /* copy end of message */
+ CopyBlock(pMsg+msgLen-msgLenRest, buffer, msgLenRest);
+ /* end of message bit */
+ buffer[msgLenRest++] = 0x80;
+ /* padd buffer */
+ PaddBlock(0, buffer+msgLenRest, bufferLen-msgLenRest-MSG_LEN_REP);
+ /* copy message bitlength representation */
+ if(ippHashAlg_MD5!=algID)
+ msgLenBits = ENDIANNESS64(msgLenBits);
+ ((Ipp64u*)(buffer+bufferLen))[-1] = msgLenBits;
+
+ #undef MSG_LEN_REP
+
+ /* message processing */
+ if(msgLenBlks)
+ hashFunc(hash, pMsg, msgLenBlks, pParam);
+ hashFunc(hash, buffer, bufferLen, pParam);
+
+ /* store digest into the user buffer (remember digest in big endian) */
+ if(msgLenRepSize > (int)(sizeof(Ipp64u))) {
+ /* ippHashAlg_SHA384, ippHashAlg_SHA512, ippHashAlg_SHA512_224 and ippHashAlg_SHA512_256 */
+ hash[0] = ENDIANNESS64(hash[0]);
+ hash[1] = ENDIANNESS64(hash[1]);
+ hash[2] = ENDIANNESS64(hash[2]);
+ hash[3] = ENDIANNESS64(hash[3]);
+ hash[4] = ENDIANNESS64(hash[4]);
+ hash[5] = ENDIANNESS64(hash[5]);
+ hash[6] = ENDIANNESS64(hash[6]);
+ hash[7] = ENDIANNESS64(hash[7]);
+ }
+ else if(ippHashAlg_MD5!=algID) {
+ /* ippHashAlg_SHA1, ippHashAlg_SHA224, ippHashAlg_SHA256 and ippHashAlg_SM3 */
+ ((Ipp32u*)hash)[0] = ENDIANNESS32(((Ipp32u*)hash)[0]);
+ ((Ipp32u*)hash)[1] = ENDIANNESS32(((Ipp32u*)hash)[1]);
+ ((Ipp32u*)hash)[2] = ENDIANNESS32(((Ipp32u*)hash)[2]);
+ ((Ipp32u*)hash)[3] = ENDIANNESS32(((Ipp32u*)hash)[3]);
+ ((Ipp32u*)hash)[4] = ENDIANNESS32(((Ipp32u*)hash)[4]);
+ ((Ipp32u*)hash)[5] = ENDIANNESS32(((Ipp32u*)hash)[5]);
+ ((Ipp32u*)hash)[6] = ENDIANNESS32(((Ipp32u*)hash)[6]);
+ ((Ipp32u*)hash)[7] = ENDIANNESS32(((Ipp32u*)hash)[7]);
+ }
+ CopyBlock(hash, pMD, hashSize);
+
+ return ippStsNoErr;
+ }
+}
diff --git a/ext/ipp/sources/ippcp/src/pcphashcnt.c b/ext/ipp/sources/ippcp/src/pcphashcnt.c
index 1202f37..6081f05 100644
--- a/ext/ipp/sources/ippcp/src/pcphashcnt.c
+++ b/ext/ipp/sources/ippcp/src/pcphashcnt.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2014-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
#include "pcphash.h"
diff --git a/ext/ipp/sources/ippcp/src/pcphashmd5px.c b/ext/ipp/sources/ippcp/src/pcphashmd5px.c
deleted file mode 100644
index 6eea795..0000000
--- a/ext/ipp/sources/ippcp/src/pcphashmd5px.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Message block processing according to MD5
-//
-// Contents:
-// UpdateMD5()
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-#include "pcphash.h"
-#include "pcptool.h"
-
-#if !defined(_ENABLE_ALG_MD5_)
-#pragma message("IPP_ALG_HASH_MD5 disabled")
-
-#else
-#pragma message("IPP_ALG_HASH_MD5 enabled")
-
-#if !((_IPPXSC==_IPPXSC_S1) || (_IPPXSC==_IPPXSC_S2) || (_IPPXSC==_IPPXSC_C2) || \
- (_IPP==_IPP_M5) || \
- (_IPP==_IPP_W7) || (_IPP==_IPP_T7) || \
- (_IPP==_IPP_V8) || (_IPP==_IPP_P8) || \
- (_IPPLP32==_IPPLP32_S8) || (_IPP>=_IPP_G9) || \
- (_IPP32E==_IPP32E_M7) || \
- (_IPP32E==_IPP32E_U8) || (_IPP32E==_IPP32E_Y8) || \
- (_IPPLP64==_IPPLP64_N8) || (_IPP32E>=_IPP32E_E9) || \
- (_IPP64==_IPP64_I7) )
-
-
-/*
-// Magic functions defined in RFC 1321
-//
-*/
-#define F(X,Y,Z) ((Z) ^ ((X) & ((Y) ^ (Z)))) /* sightly optimized form of (((X) & (Y)) | ((~(X) & (Z)))*/
-#define G(X,Y,Z) F((Z),(X),(Y)) /* replace the original (((X) & (Z)) | ((Y) & ~(Z))) */
-#define H(X,Y,Z) ((X) ^ (Y) ^ (Z))
-#define I(X,Y,Z) ((Y) ^ ((X) | ~(Z)))
-
-/*
-// MD5 step
-*/
-#define MD5_STEP(MAGIC, A,B,C,D, data, constant, nrot) \
- (A = B +ROL32((A +MAGIC(B,C,D) +data +constant), nrot))
-
-/*
-// MD5 left rotations (number of bits)
-// depends on round type
-*/
-#define F1 7
-#define F2 12
-#define F3 17
-#define F4 22
-
-#define G1 5
-#define G2 9
-#define G3 14
-#define G4 20
-
-#define H1 4
-#define H2 11
-#define H3 16
-#define H4 23
-
-#define I1 6
-#define I2 10
-#define I3 15
-#define I4 21
-
-/*F*
-// Name: UpdateMD5
-//
-// Purpose: Update internal hash according to input message stream.
-//
-// Parameters:
-// uniHash pointer to in/out hash
-// mblk pointer to message stream
-// mlen message stream length (multiple by message block size)
-// uniParam pointer to the optional parameter
-//
-*F*/
-void UpdateMD5(void* uinHash, const Ipp8u* mblk, int mlen, const void* uniParam)
-{
- Ipp32u* digest = (Ipp32u*)uinHash;
- Ipp32u* MD5_cnt_loc = (Ipp32u*)uniParam;
-
- for(; mlen>=MBS_MD5; mblk += MBS_MD5, mlen -= MBS_MD5) {
-
- /* allocate data */
- #if (IPP_ENDIAN == IPP_BIG_ENDIAN)
- Ipp32u data[MBS_MD5/sizeof(Ipp32u)];
- #else
- /* or just word alias */
- Ipp32u* data = (Ipp32u*)mblk;
- #endif
-
- /* init variables */
- Ipp32u a = digest[0];
- Ipp32u b = digest[1];
- Ipp32u c = digest[2];
- Ipp32u d = digest[3];
-
- #if (IPP_ENDIAN == IPP_BIG_ENDIAN)
- int t;
- for(t=0; t<16; t++) {
- data[t] = ENDIANNESS(((Ipp32u*)mblk)[t]);
- }
- #endif
-
- /* rounds type F */
- MD5_STEP(F, a,b,c,d, data[ 0], MD5_cnt_loc[ 0], F1);
- MD5_STEP(F, d,a,b,c, data[ 1], MD5_cnt_loc[ 1], F2);
- MD5_STEP(F, c,d,a,b, data[ 2], MD5_cnt_loc[ 2], F3);
- MD5_STEP(F, b,c,d,a, data[ 3], MD5_cnt_loc[ 3], F4);
- MD5_STEP(F, a,b,c,d, data[ 4], MD5_cnt_loc[ 4], F1);
- MD5_STEP(F, d,a,b,c, data[ 5], MD5_cnt_loc[ 5], F2);
- MD5_STEP(F, c,d,a,b, data[ 6], MD5_cnt_loc[ 6], F3);
- MD5_STEP(F, b,c,d,a, data[ 7], MD5_cnt_loc[ 7], F4);
- MD5_STEP(F, a,b,c,d, data[ 8], MD5_cnt_loc[ 8], F1);
- MD5_STEP(F, d,a,b,c, data[ 9], MD5_cnt_loc[ 9], F2);
- MD5_STEP(F, c,d,a,b, data[10], MD5_cnt_loc[10], F3);
- MD5_STEP(F, b,c,d,a, data[11], MD5_cnt_loc[11], F4);
- MD5_STEP(F, a,b,c,d, data[12], MD5_cnt_loc[12], F1);
- MD5_STEP(F, d,a,b,c, data[13], MD5_cnt_loc[13], F2);
- MD5_STEP(F, c,d,a,b, data[14], MD5_cnt_loc[14], F3);
- MD5_STEP(F, b,c,d,a, data[15], MD5_cnt_loc[15], F4);
-
- /* rounds type G */
- MD5_STEP(G, a,b,c,d, data[ 1], MD5_cnt_loc[16], G1);
- MD5_STEP(G, d,a,b,c, data[ 6], MD5_cnt_loc[17], G2);
- MD5_STEP(G, c,d,a,b, data[11], MD5_cnt_loc[18], G3);
- MD5_STEP(G, b,c,d,a, data[ 0], MD5_cnt_loc[19], G4);
- MD5_STEP(G, a,b,c,d, data[ 5], MD5_cnt_loc[20], G1);
- MD5_STEP(G, d,a,b,c, data[10], MD5_cnt_loc[21], G2);
- MD5_STEP(G, c,d,a,b, data[15], MD5_cnt_loc[22], G3);
- MD5_STEP(G, b,c,d,a, data[ 4], MD5_cnt_loc[23], G4);
- MD5_STEP(G, a,b,c,d, data[ 9], MD5_cnt_loc[24], G1);
- MD5_STEP(G, d,a,b,c, data[14], MD5_cnt_loc[25], G2);
- MD5_STEP(G, c,d,a,b, data[ 3], MD5_cnt_loc[26], G3);
- MD5_STEP(G, b,c,d,a, data[ 8], MD5_cnt_loc[27], G4);
- MD5_STEP(G, a,b,c,d, data[13], MD5_cnt_loc[28], G1);
- MD5_STEP(G, d,a,b,c, data[ 2], MD5_cnt_loc[29], G2);
- MD5_STEP(G, c,d,a,b, data[ 7], MD5_cnt_loc[30], G3);
- MD5_STEP(G, b,c,d,a, data[12], MD5_cnt_loc[31], G4);
-
- /* rounds type H */
- MD5_STEP(H, a,b,c,d, data[ 5], MD5_cnt_loc[32], H1);
- MD5_STEP(H, d,a,b,c, data[ 8], MD5_cnt_loc[33], H2);
- MD5_STEP(H, c,d,a,b, data[11], MD5_cnt_loc[34], H3);
- MD5_STEP(H, b,c,d,a, data[14], MD5_cnt_loc[35], H4);
- MD5_STEP(H, a,b,c,d, data[ 1], MD5_cnt_loc[36], H1);
- MD5_STEP(H, d,a,b,c, data[ 4], MD5_cnt_loc[37], H2);
- MD5_STEP(H, c,d,a,b, data[ 7], MD5_cnt_loc[38], H3);
- MD5_STEP(H, b,c,d,a, data[10], MD5_cnt_loc[39], H4);
- MD5_STEP(H, a,b,c,d, data[13], MD5_cnt_loc[40], H1);
- MD5_STEP(H, d,a,b,c, data[ 0], MD5_cnt_loc[41], H2);
- MD5_STEP(H, c,d,a,b, data[ 3], MD5_cnt_loc[42], H3);
- MD5_STEP(H, b,c,d,a, data[ 6], MD5_cnt_loc[43], H4);
- MD5_STEP(H, a,b,c,d, data[ 9], MD5_cnt_loc[44], H1);
- MD5_STEP(H, d,a,b,c, data[12], MD5_cnt_loc[45], H2);
- MD5_STEP(H, c,d,a,b, data[15], MD5_cnt_loc[46], H3);
- MD5_STEP(H, b,c,d,a, data[ 2], MD5_cnt_loc[47], H4);
-
- /* rounds type I */
- MD5_STEP(I, a,b,c,d, data[ 0], MD5_cnt_loc[48], I1);
- MD5_STEP(I, d,a,b,c, data[ 7], MD5_cnt_loc[49], I2);
- MD5_STEP(I, c,d,a,b, data[14], MD5_cnt_loc[50], I3);
- MD5_STEP(I, b,c,d,a, data[ 5], MD5_cnt_loc[51], I4);
- MD5_STEP(I, a,b,c,d, data[12], MD5_cnt_loc[52], I1);
- MD5_STEP(I, d,a,b,c, data[ 3], MD5_cnt_loc[53], I2);
- MD5_STEP(I, c,d,a,b, data[10], MD5_cnt_loc[54], I3);
- MD5_STEP(I, b,c,d,a, data[ 1], MD5_cnt_loc[55], I4);
- MD5_STEP(I, a,b,c,d, data[ 8], MD5_cnt_loc[56], I1);
- MD5_STEP(I, d,a,b,c, data[15], MD5_cnt_loc[57], I2);
- MD5_STEP(I, c,d,a,b, data[ 6], MD5_cnt_loc[58], I3);
- MD5_STEP(I, b,c,d,a, data[13], MD5_cnt_loc[59], I4);
- MD5_STEP(I, a,b,c,d, data[ 4], MD5_cnt_loc[60], I1);
- MD5_STEP(I, d,a,b,c, data[11], MD5_cnt_loc[61], I2);
- MD5_STEP(I, c,d,a,b, data[ 2], MD5_cnt_loc[62], I3);
- MD5_STEP(I, b,c,d,a, data[ 9], MD5_cnt_loc[63], I4);
-
- /* update digest */
- digest[0] += a;
- digest[1] += b;
- digest[2] += c;
- digest[3] += d;
- }
-}
-
-#endif
-#endif /* IPP_ALG_HASH_MD5 */
diff --git a/ext/ipp/sources/ippcp/src/pcphashmethod_rmf.h b/ext/ipp/sources/ippcp/src/pcphashmethod_rmf.h
new file mode 100644
index 0000000..1652209
--- /dev/null
+++ b/ext/ipp/sources/ippcp/src/pcphashmethod_rmf.h
@@ -0,0 +1,44 @@
+/*############################################################################
+ # Copyright 2016-2017 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.
+ ############################################################################*/
+
+/*
+// Purpose:
+// Cryptography Primitive.
+// Security Hash Standard
+// Internal Definitions and Internal Functions Prototypes
+//
+*/
+#if !defined(_PCP_HASH_METHOD_RMF_H)
+#define _PCP_HASH_METHOD_RMF_H
+
+/* hash alg methods */
+typedef void (*hashInitF)(void* pHash);
+typedef void (*hashUpdateF)(void* pHash, const Ipp8u* pMsg, int msgLen);
+typedef void (*hashOctStrF)(Ipp8u* pDst, void* pHash);
+typedef void (*msgLenRepF)(Ipp8u* pDst, Ipp64u lenLo, Ipp64u lenHi);
+
+typedef struct _cpHashMethod_rmf {
+ IppHashAlgId hashAlgId; /* algorithm ID */
+ int hashLen; /* hash length in bytes */
+ int msgBlkSize; /* message blkock size in bytes */
+ int msgLenRepSize; /* length of processed msg length representation in bytes */
+ hashInitF hashInit; /* set initial hash value */
+ hashUpdateF hashUpdate; /* hash compressor */
+ hashOctStrF hashOctStr; /* convert hash into oct string */
+ msgLenRepF msgLenRep; /* processed mgs length representation */
+} cpHashMethod_rmf;
+
+#endif /* _PCP_HASH_METHOD_RMF_H */
diff --git a/ext/ipp/sources/ippcp/src/pcphashsha1px.c b/ext/ipp/sources/ippcp/src/pcphashsha1px.c
index ab0d68f..a3d0b30 100644
--- a/ext/ipp/sources/ippcp/src/pcphashsha1px.c
+++ b/ext/ipp/sources/ippcp/src/pcphashsha1px.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2014-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
#include "pcphash.h"
#include "pcptool.h"
@@ -37,14 +37,13 @@
//#else
//#pragma message("IPP_ALG_HASH_SHA1 enabled")
-#if !((_IPPXSC==_IPPXSC_S1) || (_IPPXSC==_IPPXSC_S2) || (_IPPXSC==_IPPXSC_C2) || \
- (_IPP==_IPP_M5) || \
+#if !((_IPP==_IPP_M5) || \
(_IPP==_IPP_W7) || (_IPP==_IPP_T7) || \
(_IPP==_IPP_V8) || (_IPP==_IPP_P8) || \
- (_IPPLP32==_IPPLP32_S8) || (_IPP>=_IPP_G9) || \
+ (_IPP==_IPP_S8) || (_IPP>=_IPP_G9) || \
(_IPP32E==_IPP32E_M7) || \
(_IPP32E==_IPP32E_U8) || (_IPP32E==_IPP32E_Y8) || \
- (_IPPLP64==_IPPLP64_N8) || (_IPP32E>=_IPP32E_E9) || \
+ (_IPP32E==_IPP32E_N8) || (_IPP32E>=_IPP32E_E9) || \
(_IPP64==_IPP64_I7) )
/*
@@ -93,9 +92,6 @@ __INLINE Ipp32u MagicFun(int s, Ipp32u b, Ipp32u c, Ipp32u d)
// uniParam pointer to the optional parameter
//
*F*/
-#if defined(_ALG_SHA1_COMPACT_)
-#pragma message("SHA1 compact")
-#endif
void UpdateSHA1(void* uinHash, const Ipp8u* mblk, int mlen, const void *uniParam)
{
diff --git a/ext/ipp/sources/ippcp/src/pcphashsha256px.c b/ext/ipp/sources/ippcp/src/pcphashsha256px.c
index e355de3..a3feb71 100644
--- a/ext/ipp/sources/ippcp/src/pcphashsha256px.c
+++ b/ext/ipp/sources/ippcp/src/pcphashsha256px.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2014-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -26,25 +26,22 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
#include "pcphash.h"
#include "pcptool.h"
#if !defined(_ENABLE_ALG_SHA256_) && !defined(_ENABLE_ALG_SHA224_)
-#pragma message("IPP_ALG_HASH_SHA256 disabled")
#else
-#pragma message("IPP_ALG_HASH_SHA256 enabled")
-#if !((_IPPXSC==_IPPXSC_S1) || (_IPPXSC==_IPPXSC_S2) || (_IPPXSC==_IPPXSC_C2) || \
- (_IPP==_IPP_M5) || \
+#if !((_IPP==_IPP_M5) || \
(_IPP==_IPP_W7) || (_IPP==_IPP_T7) || \
(_IPP==_IPP_V8) || (_IPP==_IPP_P8) || \
- (_IPPLP32==_IPPLP32_S8) || (_IPP>=_IPP_G9) || \
+ (_IPP==_IPP_S8) || (_IPP>=_IPP_G9) || \
(_IPP32E==_IPP32E_M7) || \
(_IPP32E==_IPP32E_U8) || (_IPP32E==_IPP32E_Y8) || \
- (_IPPLP64==_IPPLP64_N8) || (_IPP32E>=_IPP32E_E9) || \
+ (_IPP32E==_IPP32E_N8) || (_IPP32E>=_IPP32E_E9) || \
(_IPP64==_IPP64_I7) )
/*
@@ -96,7 +93,6 @@
//
*F*/
#if defined(_ALG_SHA256_COMPACT_)
-#pragma message("SHA256 compact")
void UpdateSHA256(void* uniHash, const Ipp8u* mblk, int mlen, const void* uniParam)
{
diff --git a/ext/ipp/sources/ippcp/src/pcphashsha512px.c b/ext/ipp/sources/ippcp/src/pcphashsha512px.c
index 9e6d5fc..d5e853b 100644
--- a/ext/ipp/sources/ippcp/src/pcphashsha512px.c
+++ b/ext/ipp/sources/ippcp/src/pcphashsha512px.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2014-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -26,24 +26,21 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
#include "pcphash.h"
#include "pcptool.h"
#if !defined(_ENABLE_ALG_SHA512_) && !defined(_ENABLE_ALG_SHA_SHA384_) && !defined(_ENABLE_ALG_SHA512_224_) && !defined(_ENABLE_ALG_SHA512_256_)
-#pragma message("IPP_ALG_HASH_SHA512 disabled")
#else
-#pragma message("IPP_ALG_HASH_SHA512 enabled")
-#if !((_IPPXSC==_IPPXSC_S1) || (_IPPXSC==_IPPXSC_S2) || (_IPPXSC==_IPPXSC_C2) || \
- (_IPP==_IPP_W7) || (_IPP==_IPP_T7) || \
+#if !((_IPP==_IPP_W7) || (_IPP==_IPP_T7) || \
(_IPP==_IPP_V8) || (_IPP==_IPP_P8) || \
- (_IPPLP32==_IPPLP32_S8) || (_IPP>=_IPP_G9) || \
+ (_IPP==_IPP_S8) || (_IPP>=_IPP_G9) || \
(_IPP32E==_IPP32E_M7) || \
(_IPP32E==_IPP32E_U8) || (_IPP32E==_IPP32E_Y8) || \
- (_IPPLP64==_IPPLP64_N8) || (_IPP32E>=_IPP32E_E9) || \
+ (_IPP32E==_IPP32E_N8) || (_IPP32E>=_IPP32E_E9) || \
(_IPP64==_IPP64_I7) )
/*
@@ -97,7 +94,6 @@
//
*F*/
#if defined(_ALG_SHA512_COMPACT_)
-#pragma message("SHA512 compact")
void UpdateSHA512(void* uniHash, const Ipp8u* mblk, int mlen, const void* uniPraram)
{
diff --git a/ext/ipp/sources/ippcp/src/pcpmd5ca.c b/ext/ipp/sources/ippcp/src/pcpmd5ca.c
deleted file mode 100644
index 91c44e8..0000000
--- a/ext/ipp/sources/ippcp/src/pcpmd5ca.c
+++ /dev/null
@@ -1,485 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Digesting message according to MD5
-// (derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm)
-//
-// Equivalent code is available from RFC 1321.
-//
-// Contents:
-// ippsMD5GetSize()
-// ippsMD5Init()
-// ippsMD5Pack()
-// ippsMD5Unpack()
-// ippsMD5Duplicate()
-// ippsMD5Update()
-// ippsMD5GetTag()
-// ippsMD5Final()
-// ippsMD5MessageDigest()
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-#include "pcphash.h"
-#include "pcptool.h"
-
-
-#if !defined (_ENABLE_ALG_MD5_)
-#pragma message("IPP_ALG_HASH_MD5 disabled")
-#else
-#pragma message("IPP_ALG_HASH_MD5 enabled")
-
-/*
-// Init MD5 digest
-*/
-IppStatus InitMD5(IppsMD5State* pState)
-{
- /* test state pointer */
- IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
- pState = (IppsMD5State*)( IPP_ALIGNED_PTR(pState, MD5_ALIGNMENT) );
-
- /* set state ID */
- SHS_ID(pState) = idCtxMD5;
-
- /* zeros message length */
- SHS_LENL(pState) = 0;
-
- /* message buffer is free */
- SHS_INDX(pState) = 0;
-
- /* setup initial digest */
- SHS_HASH(pState)[0] = MD5_IV[0];
- SHS_HASH(pState)[1] = MD5_IV[1];
- SHS_HASH(pState)[2] = MD5_IV[2];
- SHS_HASH(pState)[3] = MD5_IV[3];
-
- return ippStsNoErr;
-}
-
-
-/*F*
-// Name: ippsMD5GetSize
-//
-// Purpose: Returns size (bytes) of IppsMD5State state.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pSize == NULL
-// ippStsNoErr no errors
-//
-// Parameters:
-// pSize pointer to size
-//
-*F*/
-IPPFUN(IppStatus, ippsMD5GetSize,(int* pSize))
-{
- /* test pointer */
- IPP_BAD_PTR1_RET(pSize);
-
- *pSize = sizeof(IppsMD5State) +(MD5_ALIGNMENT-1);
-
- return ippStsNoErr;
-}
-
-
-/*F*
-// Name: ippsMD5Init
-//
-// Purpose: Init MD5 state.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pState == NULL
-// ippStsNoErr no errors
-//
-// Parameters:
-// pState pointer to the MD5 state
-//
-*F*/
-IPPFUN(IppStatus, ippsMD5Init,(IppsMD5State* pState))
-{
- return InitMD5(pState);
-}
-
-
-/*F*
-// Name: ippsMD5Pack
-//
-// Purpose: Copy initialized context to the buffer.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pSize == NULL
-// pCtx == NULL
-// ippStsNoErr no errors
-//
-// Parameters:
-// pCtx pointer hash state
-// pSize pointer to the packed spec size
-//
-*F*/
-IPPFUN(IppStatus, ippsMD5Pack,(const IppsMD5State* pCtx, Ipp8u* pBuffer))
-{
- /* test pointers */
- IPP_BAD_PTR2_RET(pCtx, pBuffer);
- /* use aligned context */
- pCtx = (IppsMD5State*)( IPP_ALIGNED_PTR(pCtx, MD5_ALIGNMENT) );
- /* test the context */
- IPP_BADARG_RET(idCtxMD5 !=SHS_ID(pCtx), ippStsContextMatchErr);
-
- CopyBlock(pCtx, pBuffer, sizeof(IppsMD5State));
- return ippStsNoErr;
-}
-
-
-/*F*
-// Name: ippsMD5Unpack
-//
-// Purpose: Unpack buffer content into the initialized context.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pSize == NULL
-// pCtx == NULL
-// ippStsNoErr no errors
-//
-// Parameters:
-// pCtx pointer hash state
-// pSize pointer to the packed spec size
-//
-*F*/
-IPPFUN(IppStatus, ippsMD5Unpack,(const Ipp8u* pBuffer, IppsMD5State* pCtx))
-{
- /* test pointers */
- IPP_BAD_PTR2_RET(pCtx, pBuffer);
- /* use aligned context */
- pCtx = (IppsMD5State*)( IPP_ALIGNED_PTR(pCtx, MD5_ALIGNMENT) );
-
- CopyBlock(pBuffer, pCtx, sizeof(IppsMD5State));
- return ippStsNoErr;
-}
-
-
-/*F*
-// Name: ippsMD5Duplicate
-//
-// Purpose: Clone MD5 state.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pSrcState == NULL
-// pDstState == NULL
-// ippStsContextMatchErr pSrcState->idCtx != idCtxMD5
-// pDstState->idCtx != idCtxMD5
-// ippStsNoErr no errors
-//
-// Parameters:
-// pSrcState pointer to the source MD5 state
-// pDstState pointer to the target MD5 state
-//
-// Note:
-// pDstState may to be uninitialized by ippsMD5Init()
-//
-*F*/
-IPPFUN(IppStatus, ippsMD5Duplicate,(const IppsMD5State* pSrcState, IppsMD5State* pDstState))
-{
- /* test state pointers */
- IPP_BAD_PTR2_RET(pSrcState, pDstState);
- /* use aligned context */
- pSrcState = (IppsMD5State*)( IPP_ALIGNED_PTR(pSrcState, MD5_ALIGNMENT) );
- pDstState = (IppsMD5State*)( IPP_ALIGNED_PTR(pDstState, MD5_ALIGNMENT) );
- /* test states ID */
- IPP_BADARG_RET(idCtxMD5 !=SHS_ID(pSrcState), ippStsContextMatchErr);
-
- /* copy state */
- CopyBlock(pSrcState, pDstState, sizeof(IppsMD5State));
-
- return ippStsNoErr;
-}
-
-
-/*F*
-// Name: ippsMD5Update
-//
-// Purpose: Updates intermadiate digest based on input stream.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pSrc == NULL
-// pState == NULL
-// ippStsContextMatchErr pState->idCtx != idCtxMD5
-// ippStsLengthErr len <0
-// ippStsNoErr no errors
-//
-// Parameters:
-// pSrc pointer to the input stream
-// len input stream length
-// pState pointer to the MD5 state
-//
-*F*/
-IPPFUN(IppStatus, ippsMD5Update,(const Ipp8u* pSrc, int len, IppsMD5State* pState))
-{
- /* test state pointer and ID */
- IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
- pState = (IppsMD5State*)( IPP_ALIGNED_PTR(pState, MD5_ALIGNMENT) );
- /* test state ID */
- IPP_BADARG_RET(idCtxMD5 !=SHS_ID(pState), ippStsContextMatchErr);
-
- /* test input length */
- IPP_BADARG_RET((len<0), ippStsLengthErr);
- /* test source pointer */
- IPP_BADARG_RET((len && !pSrc), ippStsNullPtrErr);
-
- /*
- // handle non empty message
- */
- if(len) {
- int processingLen;
-
- int n = SHS_INDX(pState);
- Ipp8u* pBuffer = SHS_BUFF(pState);
- Ipp8u* pHash = (Ipp8u*)SHS_HASH(pState);
-
- Ipp64u lenLo = SHS_LENL(pState);
- lenLo += len;
-
- /* if non empty internal buffer filling */
- if(n) {
- /* copy from input stream to the internal buffer as match as possible */
- processingLen = IPP_MIN(len, (MBS_MD5 - SHS_INDX(pState)));
- CopyBlock(pSrc, pBuffer+n, processingLen);
-
- pSrc += processingLen;
- len -= processingLen;
- SHS_INDX(pState) = n += processingLen;
-
- /* update digest if buffer full */
- if( MBS_MD5 == n) {
- UpdateMD5(pHash, pBuffer, MBS_MD5, MD5_cnt);
- SHS_INDX(pState) = 0;
- }
- }
-
- /* main message part processing */
- processingLen = len & ~(MBS_MD5-1);
- if(processingLen) {
- UpdateMD5(pHash, pSrc, processingLen, MD5_cnt);
- pSrc += processingLen;
- len -= processingLen;
- }
-
- /* store rest of message into the internal buffer */
- if(len) {
- CopyBlock(pSrc, pBuffer, len);
- SHS_INDX(pState) += len;
- }
-
- SHS_LENL(pState) = lenLo;
- }
-
- return ippStsNoErr;
-}
-
-
-/*
-// Compute digest
-*/
-void ComputeDigestMD5(Ipp32u* pHash, const IppsMD5State* pState)
-{
- const Ipp8u* stateBuff = SHS_BUFF(pState);
- int stateBuffLen = SHS_INDX(pState);
-
- /* local buffer and it length */
- Ipp8u buffer[MBS_MD5*2];
- int bufferLen = stateBuffLen < (MBS_MD5-(int)sizeof(Ipp64u))? MBS_MD5 : MBS_MD5*2;
-
- /* copy rest of message into internal buffer */
- CopyBlock(stateBuff, buffer, stateBuffLen);
-
- /* padd message */
- buffer[stateBuffLen++] = 0x80;
- PaddBlock(0, buffer+stateBuffLen, bufferLen-stateBuffLen-sizeof(Ipp64u));
-
- /* message length representation */
- {
- Ipp64u lo = SHS_LENL(pState); /* message length in bytes */
- lo = LSL64(lo,3); /* message length in bits */
- ((Ipp64u*)(buffer+bufferLen))[-1] = lo;
- }
-
- /* copmplete hash computation */
- UpdateMD5(pHash, buffer, bufferLen, MD5_cnt);
-
- /* convert hash into big endian */
- /* is not necessary if little endian */
-}
-
-
-/*F*
-// Name: ippsMD5GetTag
-//
-// Purpose: Compute digest based on current state.
-// Note, that futher digest update is possible
-//
-// Returns: Reason:
-// ippStsNullPtrErr pTag == NULL
-// pState == NULL
-// ippStsContextMatchErr pState->idCtx != idCtxMD5
-// ippStsLengthErr max_MD5_digestLen < tagLen <1
-// ippStsNoErr no errors
-//
-// Parameters:
-// pTag address of the output digest
-// tagLen length of digest
-// pState pointer to the MD5 state
-//
-*F*/
-IPPFUN(IppStatus, ippsMD5GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsMD5State* pState))
-{
- /* test state pointer and ID */
- IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
- pState = (IppsMD5State*)( IPP_ALIGNED_PTR(pState, MD5_ALIGNMENT) );
- /* test state ID */
- IPP_BADARG_RET(idCtxMD5 !=SHS_ID(pState), ippStsContextMatchErr);
-
- /* test digest pointer */
- IPP_BAD_PTR1_RET(pTag);
- IPP_BADARG_RET((tagLen<1)||(sizeof(DigestMD5)<tagLen), ippStsLengthErr);
-
- {
- DigestMD5 digest;
-
- CopyBlock(SHS_HASH(pState), digest, sizeof(DigestMD5));
- ComputeDigestMD5(digest, pState);
- CopyBlock(digest, pTag, tagLen);
-
- return ippStsNoErr;
- }
-}
-
-
-/*F*
-// Name: ippsMD5Final
-//
-// Purpose: Stop message digesting and return digest.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pMD == NULL
-// pState == NULL
-// ippStsContextMatchErr pState->idCtx != idCtxMD5
-// ippStsNoErr no errors
-//
-// Parameters:
-// pMD address of the output digest
-// pState pointer to the MD5 state
-//
-*F*/
-IPPFUN(IppStatus, ippsMD5Final,(Ipp8u* pMD, IppsMD5State* pState))
-{
- /* test state pointer and ID */
- IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
- pState = (IppsMD5State*)( IPP_ALIGNED_PTR(pState, MD5_ALIGNMENT) );
- /* test state ID */
- IPP_BADARG_RET(idCtxMD5 !=SHS_ID(pState), ippStsContextMatchErr);
-
- /* test digest pointer */
- IPP_BAD_PTR1_RET(pMD);
-
- ComputeDigestMD5(SHS_HASH(pState), pState);
- CopyBlock(SHS_HASH(pState), pMD, sizeof(DigestMD5));
- InitMD5(pState);
-
- return ippStsNoErr;
-}
-
-
-/*F*
-// Name: ippsMD5MessageDigest
-//
-// Purpose: Ddigest of the whole message.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pMsg == NULL
-// pDigest == NULL
-// ippStsLengthErr len <0
-// ippStsNoErr no errors
-//
-// Parameters:
-// pMsg pointer to the input message
-// len input message length
-// pMD address of the output digest
-//
-*F*/
-IPPFUN(IppStatus, ippsMD5MessageDigest,(const Ipp8u* pMsg, int msgLen, Ipp8u* pMD))
-{
- /* test digest pointer */
- IPP_BAD_PTR1_RET(pMD);
- /* test message length */
- IPP_BADARG_RET((msgLen<0), ippStsLengthErr);
- /* test message pointer */
- IPP_BADARG_RET((msgLen && !pMsg), ippStsNullPtrErr);
-
- {
- /* message length in the multiple MBS and the rest */
- int msgLenBlks = msgLen & (-MBS_MD5);
- int msgLenRest = msgLen - msgLenBlks;
-
- /* init hash value */
- DigestMD5 hash = {0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476};
-
- /* process main part of the message */
- if(msgLenBlks)
- UpdateMD5(hash, pMsg, msgLenBlks, MD5_cnt);
-
- /* process message padding */
- {
- #define MREP_SIZE_MD5 (sizeof(Ipp64u))
- Ipp8u buffer[MBS_MD5*2];
- int bufferLen = msgLenRest < (int)(MBS_MD5-MREP_SIZE_MD5)? (int)MBS_MD5 : (int)(MBS_MD5*2);
-
- /* message bitlength representation */
- Ipp64u msgLenBits = (Ipp64u)msgLen*8;
-
- /* copy end of message */
- CopyBlock(pMsg+msgLen-msgLenRest, buffer, msgLenRest);
-
- /* end of message bit */
- buffer[msgLenRest++] = 0x80;
-
- /* padd buffer */
- PaddBlock(0, buffer+msgLenRest, bufferLen-msgLenRest-MREP_SIZE_MD5);
- /* copy message bitlength representation */
- ((Ipp64u*)(buffer+bufferLen))[-1] = msgLenBits;
-
- UpdateMD5(hash, buffer, bufferLen, MD5_cnt);
- #undef MREP_SIZE_MD5
- }
-
- /* copy hash bytes */
- ((Ipp32u*)pMD)[0] = hash[0];
- ((Ipp32u*)pMD)[1] = hash[1];
- ((Ipp32u*)pMD)[2] = hash[2];
- ((Ipp32u*)pMD)[3] = hash[3];
-
- return ippStsNoErr;
- }
-}
-
-#endif /* _ENABLE_ALG_MD5_ */
diff --git a/ext/ipp/sources/ippcp/src/pcpmontexpbinca.c b/ext/ipp/sources/ippcp/src/pcpmontexpbinca.c
index 37a7352..ad0e22d 100644
--- a/ext/ipp/sources/ippcp/src/pcpmontexpbinca.c
+++ b/ext/ipp/sources/ippcp/src/pcpmontexpbinca.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2003-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
#include "pcpbn.h"
#include "pcpmontgomery.h"
diff --git a/ext/ipp/sources/ippcp/src/pcpmontgomery.h b/ext/ipp/sources/ippcp/src/pcpmontgomery.h
index a9734db..68a6216 100644
--- a/ext/ipp/sources/ippcp/src/pcpmontgomery.h
+++ b/ext/ipp/sources/ippcp/src/pcpmontgomery.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2002-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -70,7 +70,9 @@ struct _cpMontgomery
/*
// Pacp/unpack Montgomery context
*/
+#define cpPackMontCtx OWNAPI(cpPackMontCtx)
void cpPackMontCtx(const IppsMontState* pCtx, Ipp8u* pBuffer);
+#define cpUnpackMontCtx OWNAPI(cpUnpackMontCtx)
void cpUnpackMontCtx(const Ipp8u* pBuffer, IppsMontState* pCtx);
@@ -80,9 +82,11 @@ void cpUnpackMontCtx(const Ipp8u* pBuffer, IppsMontState* pCtx);
//void cpMontRed_BNU(BNU_CHUNK_T* pR,
// BNU_CHUNK_T* pProduct,
// const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0);
+#define cpMontRedAdc_BNU OWNAPI(cpMontRedAdc_BNU)
void cpMontRedAdc_BNU(BNU_CHUNK_T* pR,
BNU_CHUNK_T* pProduct,
const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0);
+#define cpMontRedAdx_BNU OWNAPI(cpMontRedAdx_BNU)
void cpMontRedAdx_BNU(BNU_CHUNK_T* pR,
BNU_CHUNK_T* pProduct,
const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0);
@@ -101,11 +105,13 @@ __INLINE void cpMontRed_BNU(BNU_CHUNK_T* pR,
#endif
#if(_ADCOX_NI_ENABLING_==_FEATURE_ON_)
+#define cpMontRedAdx_BNU OWNAPI(cpMontRedAdx_BNU)
cpMontRedAdx_BNU(pR, pProduct, pModulus, nsM, m0);
#elif(_ADCOX_NI_ENABLING_==_FEATURE_TICKTOCK_)
IsFeatureEnabled(ADCOX_ENABLED)? cpMontRedAdx_BNU(pR, pProduct, pModulus, nsM, m0)
: cpMontRedAdc_BNU(pR, pProduct, pModulus, nsM, m0);
#else
+#define cpMontRedAdc_BNU OWNAPI(cpMontRedAdc_BNU)
cpMontRedAdc_BNU(pR, pProduct, pModulus, nsM, m0);
#endif
}
@@ -205,11 +211,13 @@ cpSize cpMontExpScratchBufferSize(cpSize modulusBitSize,
/*
// Montgomery exponentiation (binary) "fast" and "safe" versions
*/
+#define cpMontExpBin_BNU_sscm OWNAPI(cpMontExpBin_BNU_sscm)
cpSize cpMontExpBin_BNU_sscm(BNU_CHUNK_T* pY,
const BNU_CHUNK_T* pX, cpSize nsX,
const BNU_CHUNK_T* pE, cpSize nsE,
IppsMontState* pMont);
+#define cpMontExpBin_BNU OWNAPI(cpMontExpBin_BNU)
cpSize cpMontExpBin_BNU(BNU_CHUNK_T* pY,
const BNU_CHUNK_T* pX, cpSize nsX,
const BNU_CHUNK_T* pE, cpSize nsE,
@@ -251,14 +259,17 @@ __INLINE void cpMontExpBin_BN(IppsBigNumState* pYbn,
/*
// Montgomery exponentiation (fixed window)
*/
+#define cpMontExp_WinSize OWNAPI(cpMontExp_WinSize)
cpSize cpMontExp_WinSize(int bitsize);
#if defined(_USE_WINDOW_EXP_)
+#define cpMontExpWin_BN_sscm OWNAPI(cpMontExpWin_BN_sscm)
void cpMontExpWin_BN_sscm(IppsBigNumState* pY,
const IppsBigNumState* pX, const IppsBigNumState* pE,
IppsMontState* pMont,
BNU_CHUNK_T* pPrecompResource);
+#define cpMontExpWin_BN OWNAPI(cpMontExpWin_BN)
void cpMontExpWin_BN(IppsBigNumState* pY,
const IppsBigNumState* pX, const IppsBigNumState* pE,
IppsMontState* pMont,
@@ -269,11 +280,13 @@ void cpMontExpWin_BN(IppsBigNumState* pY,
// Montgomery multi-exponentiation
*/
/* precompute table for multi-exponentiation */
+#define cpMontMultiExpInitArray OWNAPI(cpMontMultiExpInitArray)
void cpMontMultiExpInitArray(BNU_CHUNK_T* pPrecomTbl,
const BNU_CHUNK_T** ppX, cpSize xItemBitSize, cpSize numItems,
IppsMontState* pMont);
/* multi-exponentiation */
+#define cpFastMontMultiExp OWNAPI(cpFastMontMultiExp)
void cpFastMontMultiExp(BNU_CHUNK_T* pY,
const BNU_CHUNK_T* pPrecomTbl,
const Ipp8u** ppE, cpSize eItemBitSize, cpSize numItems,
diff --git a/ext/ipp/sources/ippcp/src/pcpmontgomeryca.c b/ext/ipp/sources/ippcp/src/pcpmontgomeryca.c
index afa5e97..d56ba06 100644
--- a/ext/ipp/sources/ippcp/src/pcpmontgomeryca.c
+++ b/ext/ipp/sources/ippcp/src/pcpmontgomeryca.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2002-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
#include "pcpbn.h"
#include "pcpmontgomery.h"
@@ -37,6 +37,7 @@
// Returns: Reason:
// ippStsNullPtrErr pCtxSize==NULL
// ippStsLengthErr maxLen32 < 1
+// maxLen32 > BITS2WORD32_SIZE(BN_MAXBITSIZE)
// ippStsNoErr no errors
//
// Parameters:
@@ -50,7 +51,7 @@
IPPFUN(IppStatus, ippsMontGetSize, (IppsExpMethod method, cpSize maxLen32, cpSize* pCtxSize))
{
IPP_BAD_PTR1_RET(pCtxSize);
- IPP_BADARG_RET(maxLen32< 1, ippStsLengthErr);
+ IPP_BADARG_RET(maxLen32<1 || maxLen32>BITS2WORD32_SIZE(BN_MAXBITSIZE), ippStsLengthErr);
UNREFERENCED_PARAMETER(method);
@@ -94,6 +95,7 @@ IPPFUN(IppStatus, ippsMontGetSize, (IppsExpMethod method, cpSize maxLen32, cpSiz
// Returns: Reason:
// ippStsNullPtrErr pMont==NULL
// ippStsLengthErr maxLen32 < 1
+// maxLen32 > BITS2WORD32_SIZE(BN_MAXBITSIZE)
// ippStsNoErr no errors
//
// Parameters:
@@ -103,14 +105,14 @@ IPPFUN(IppStatus, ippsMontGetSize, (IppsExpMethod method, cpSize maxLen32, cpSiz
*F*/
IPPFUN(IppStatus, ippsMontInit,(IppsExpMethod method, int maxLen32, IppsMontState* pMont))
{
- IPP_BADARG_RET(maxLen32<1, ippStsLengthErr);
+ IPP_BADARG_RET(maxLen32<1 || maxLen32>BITS2WORD32_SIZE(BN_MAXBITSIZE), ippStsLengthErr);
IPP_BAD_PTR1_RET(pMont);
pMont = (IppsMontState*)( IPP_ALIGNED_PTR(pMont, MONT_ALIGNMENT) );
UNREFERENCED_PARAMETER(method);
- MNT_ID(pMont) = idCtxMontgomery;
+ MNT_ID(pMont) = idCtxUnknown;
MNT_ROOM(pMont) = INTERNAL_BNU_LENGTH(maxLen32);
MNT_SIZE(pMont) = 0;
MNT_HELPER(pMont) = 0;
@@ -150,6 +152,7 @@ IPPFUN(IppStatus, ippsMontInit,(IppsExpMethod method, int maxLen32, IppsMontStat
ZEXPAND_BNU(MNT_SQUARE_R(pMont), 0, modSize);
ZEXPAND_BNU(MNT_CUBE_R(pMont), 0, modSize);
+ MNT_ID(pMont) = idCtxMontgomery;
return ippStsNoErr;
}
}
diff --git a/ext/ipp/sources/ippcp/src/pcpmontred.c b/ext/ipp/sources/ippcp/src/pcpmontred.c
index cd5fca4..cb3dc0d 100644
--- a/ext/ipp/sources/ippcp/src/pcpmontred.c
+++ b/ext/ipp/sources/ippcp/src/pcpmontred.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2014-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -29,20 +29,14 @@
(_IPP==_IPP_V8) || \
(_IPP==_IPP_P8) || \
(_IPP>=_IPP_G9) || \
- (_IPPLP32==_IPPLP32_S8) || \
+ (_IPP==_IPP_S8) || \
(_IPP32E==_IPP32E_M7) || \
(_IPP32E==_IPP32E_U8) || \
(_IPP32E==_IPP32E_Y8) || \
(_IPP32E>=_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8))
-
-#if 0
-#define MASKED_COPY_BNU(dst, mask, src1, src2, len) { \
- cpSize i; \
- for(i=0; i<(len); i++) (dst)[i] = ((mask) & (src1)[i]) | (~(mask) & (src2)[i]); \
-}
-#endif
-
+ (_IPP32E==_IPP32E_N8)) || \
+ defined(_USE_C_cpMontRedAdc_BNU_)
+#define cpMontRedAdc_BNU OWNAPI(cpMontRedAdc_BNU)
void cpMontRedAdc_BNU(BNU_CHUNK_T* pR,
BNU_CHUNK_T* pProduct,
const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0)
diff --git a/ext/ipp/sources/ippcp/src/pcpmulbnukara.h b/ext/ipp/sources/ippcp/src/pcpmulbnukara.h
index 79b64b0..9ad4009 100644
--- a/ext/ipp/sources/ippcp/src/pcpmulbnukara.h
+++ b/ext/ipp/sources/ippcp/src/pcpmulbnukara.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2005-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@
#elif ((_IPP==_IPP_V8) || \
(_IPP==_IPP_P8) || \
(_IPP==_IPP_G9) || \
- (_IPPLP32==_IPPLP32_S8))
+ (_IPP==_IPP_S8))
#define CP_KARATSUBA_MUL_THRESHOLD 32
#define CP_KARATSUBA_SQR_THRESHOLD 32
#elif ((_IPP>=_IPP_H9))
@@ -53,7 +53,7 @@
(_IPP32E==_IPP32E_U8) || \
(_IPP32E==_IPP32E_Y8) || \
(_IPP32E==_IPP32E_E9) || \
- (_IPPLP64==_IPPLP64_N8))
+ (_IPP32E==_IPP32E_N8))
#define CP_KARATSUBA_MUL_THRESHOLD 16
#define CP_KARATSUBA_SQR_THRESHOLD 40
#elif ((_IPP32E>=_IPP32E_L9))
@@ -66,11 +66,14 @@
#endif
+#define cpKaratsubaBufferSize OWNAPI(cpKaratsubaBufferSize)
cpSize cpKaratsubaBufferSize(cpSize len);
+#define cpMul_BNU_karatsuba OWNAPI(cpMul_BNU_karatsuba)
BNU_CHUNK_T cpMul_BNU_karatsuba(BNU_CHUNK_T* pR,
const BNU_CHUNK_T* pX, const BNU_CHUNK_T* pY, cpSize ns,
BNU_CHUNK_T* pBuffer);
+#define cpSqr_BNU_karatsuba OWNAPI(cpSqr_BNU_karatsuba)
BNU_CHUNK_T cpSqr_BNU_karatsuba(BNU_CHUNK_T* pR,
const BNU_CHUNK_T* pX, cpSize ns,
BNU_CHUNK_T* pBuffer);
diff --git a/ext/ipp/sources/ippcp/src/pcppma.h b/ext/ipp/sources/ippcp/src/pcppma.h
deleted file mode 100644
index 2a0c65f..0000000
--- a/ext/ipp/sources/ippcp/src/pcppma.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal Definitions and
-// Internal Prime Modulo Arithmetic Function Prototypes
-//
-//
-*/
-
-#if !defined(_PCP_PMA_H)
-#define _PCP_PMA_H
-
-
-#include "pcpbn.h"
-#include "pcpmontgomery.h"
-
-
-/*
-// unsigned BN set/get
-*/
-#define SET_BN(pBN,bnu,len) \
- BN_SIGN((pBN)) = ippBigNumPOS; \
- BN_SIZE((pBN)) = ((len)); \
- Cpy_BNU((bnu), BN_NUMBER((pBN)), (len))
-
-#define GET_BN(pBN,bnu,len) \
- Set_BNU(0, (bnu), (len)); \
- Cpy_BNU(BN_NUMBER((pBN)), (bnu), BN_SIZE((pBN)))
-
-
-/*
-// Prime Modulo Arithmetic
-*/
-#define PMA_set(r,a) \
- BN_SIGN((r)) = BN_SIGN((a)); \
- BN_SIZE((r)) = BN_SIZE((a)); \
- ZEXPAND_COPY_BNU(BN_NUMBER((r)),BN_ROOM((r)), BN_NUMBER((a)),BN_SIZE((a))) \
-
-#define PMA_mod(r,a,modulo) \
- ippsMod_BN((a),(modulo),(r))
-
-#define PMA_inv(r,a,modulo) \
- ippsModInv_BN((a),(modulo),(r))
-
-#define PMA_neg(r,a,modulo) \
- ippsSub_BN((modulo),(a),(r))
-
-#define PMA_lsr(r,a,modulo) \
- BN_SIZE((r)) = cpLSR_BNU(BN_NUMBER((a)), BN_NUMBER((r)), (int)BN_SIZE((a)), 1)
-
-#define PMA_div2(r,a,modulo) { \
- if( IsOdd_BN((a)) ) { \
- ippsAdd_BN((a), (modulo), (a)); \
- } \
- BN_SIZE((r)) = cpLSR_BNU(BN_NUMBER((r)), BN_NUMBER((a)), (int)BN_SIZE((a)), 1); \
- cpBN_fix((r)); \
-}
-
-#define PMA_sqr(r,a,modulo) \
- PMA_mul(r,a,a,modulo)
-
-#define PMA_add(r,a,b,modulo) \
- ippsAdd_BN((a),(b),(r)); \
- if( cpCmp_BNU(BN_NUMBER((r)),BN_SIZE((r)),BN_NUMBER((modulo)),BN_SIZE(modulo)) >= 0 ) \
- ippsSub_BN((r),(modulo),(r))
-
-#define PMA_sub(r,a,b,modulo) \
- ippsSub_BN((a),(b),(r)); \
- if( BN_NEGATIVE((r)) ) \
- ippsAdd_BN((r),(modulo),(r))
-
-#define PMA_mul(r,a,b,modulo) \
- ippsMul_BN((a),(b),(r)); \
- if( cpCmp_BNU(BN_NUMBER((r)),BN_SIZE((r)),BN_NUMBER((modulo)),BN_SIZE(modulo)) >= 0 ) \
- ippsMod_BN((r),(modulo),(r))
-
-#define PMA_enc(r,a,mont) \
- cpMontEnc_BN((r), (a), (mont))
-
-#define PMA_dec(r,a,mont) \
- cpMontDec_BN((r), (a), (mont))
-
-#define PMA_sqre(r,a,mont) \
- ippsMontMul((a),(a), (mont),(r))
-
-#define PMA_mule(r,a,b,mont) \
- ippsMontMul((a),(b), (mont),(r))
-
-#endif /* _PCP_PMA_H */
diff --git a/ext/ipp/sources/ippcp/src/pcppma128.c b/ext/ipp/sources/ippcp/src/pcppma128.c
deleted file mode 100644
index 80061d5..0000000
--- a/ext/ipp/sources/ippcp/src/pcppma128.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal Prime Modulo Arithmetic Function
-//
-// Contents:
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-
-#if (_ECP_128_==_ECP_IMPL_SPECIFIC_)
-#include "pcpeccp.h"
-#include "pcppma128.h"
-
-
-/*
-// Specific Modulo Arithmetic
-// P128 = 2^128 -2^97 -1
-// (reference secp128r1_p)
-*/
-
-/*
-// Reduce modulo:
-//
-// x = c7|c6|c5|c4|c3|c2|c1|c0
-//
-// s1 = c3| c2| c1| c0
-// s2 = 2c4| 00| 00| c4
-// s3 = 4c5| 00| c5|2c5
-// s4 = 8c6| c6|2c6|4c6
-// s5 =17c7|2c7|4c7|8c7
-//
-// r = (s1+s2+s3+s4+s5) (mod P)
-*/
-#if !((_IPPXSC==_IPPXSC_S1) || (_IPPXSC==_IPPXSC_S2) || (_IPPXSC==_IPPXSC_C2) || \
- (_IPP==_IPP_W7) || (_IPP==_IPP_T7) || \
- (_IPP==_IPP_V8) || (_IPP==_IPP_P8) || \
- (_IPPLP32==_IPPLP32_S8) || (_IPP>=_IPP_G9) || \
- (_IPP32E==_IPP32E_M7) || \
- (_IPP32E==_IPP32E_U8) || (_IPP32E==_IPP32E_Y8) || \
- (_IPPLP64==_IPPLP64_N8) || (_IPP32E>=_IPP32E_E9) || \
- (_IPP64==_IPP64_I7) )
-void Reduce_P128r1(BNU_CHUNK_T* pProduct)
-{
- Ipp32u* pR = (Ipp32u*)pProduct;
-
- Ipp64u c7x2 = (Ipp64u)pR[7] + (Ipp64u)pR[7];
- Ipp64u c7x4 = c7x2 + c7x2;
- Ipp64u c7x8 = c7x4 + c7x4;
-
- Ipp64u c6x2 = (Ipp64u)pR[6] + (Ipp64u)pR[6];
- Ipp64u c6x4 = c6x2 + c6x2;
- Ipp64u c6x8 = c6x4 + c6x4;
-
- Ipp64u c5x2 = (Ipp64u)pR[5] + (Ipp64u)pR[5];
- Ipp64u c5x4 = c5x2 + c5x2;
-
- Ipp64u c4x2 = (Ipp64u)pR[4] + (Ipp64u)pR[4];
-
- Ipp64u
- sum = (Ipp64u)pR[0] + (Ipp64u)pR[4] + c5x2 + c6x4 + c7x8;
- pR[0] = LODWORD(sum);
- sum = HIDWORD(sum);
-
- sum += (Ipp64u)pR[1] + (Ipp64u)pR[5] + c6x2 + c7x4;
- pR[1] = LODWORD(sum);
- sum = HIDWORD(sum);
-
- sum += (Ipp64u)pR[2] + (Ipp64u)pR[6] + c7x2;
- pR[2] = LODWORD(sum);
- sum = HIDWORD(sum);
-
- sum += (Ipp64u)pR[3] + c4x2 + c5x4 + c6x8 + c7x8+c7x8+(Ipp64u)pR[7];
- pR[3] = LODWORD(sum);
- pProduct[LEN_P128] = (BNU_CHUNK_T)(HIDWORD(sum));
-
- if(pProduct[LEN_P128])
- cpSub_BNU(pProduct, pProduct, ((BNU_CHUNK_T**)secp128_mx)[pProduct[LEN_P128]], LEN_P128+1);
-
- while((BNS_CHUNK_T)pProduct[LEN_P128] <0)
- cpAdd_BNU(pProduct, pProduct, (BNU_CHUNK_T*)secp128r1_p, LEN_P128+1);
-
- while(0 <= cpCmp_BNU(pProduct, LEN_P128+1, (BNU_CHUNK_T*)secp128r1_p, LEN_P128+1))
- cpSub_BNU(pProduct, pProduct, (BNU_CHUNK_T*)secp128r1_p, LEN_P128+1);
-}
-#endif
-
-void cpAdde_128r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- BNU_CHUNK_T carry = cpAdd_BNU(rPtr, aPtr, bPtr, LEN_P128);
- if(carry || (0<=cpCmp_BNU(rPtr, LEN_P128, (BNU_CHUNK_T*)secp128r1_p, LEN_P128)))
- cpSub_BNU(rPtr, rPtr, (BNU_CHUNK_T*)secp128r1_p, LEN_P128);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P128;
-}
-
-void cpSube_128r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- BNU_CHUNK_T borrow = cpSub_BNU(rPtr, aPtr, bPtr, LEN_P128);
- if(borrow)
- cpAdd_BNU(rPtr, rPtr, (BNU_CHUNK_T*)secp128r1_p, LEN_P128);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P128;
-}
-
-void cpSqre_128r1(IppsBigNumState* pA, IppsBigNumState* pR)
-{
- BNU_CHUNK_T tmpR[2*LEN_P128];
-
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- cpSqr_BNU_school(tmpR, aPtr, LEN_P128);
-
- Reduce_P128r1(tmpR);
- COPY_BNU(rPtr, tmpR, LEN_P128);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P128;
-}
-
-void cpMule_128r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T tmpR[2*LEN_P128];
-
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- cpMul_BNU_school(tmpR, aPtr, LEN_P128, bPtr, LEN_P128);
-
- Reduce_P128r1(tmpR);
- COPY_BNU(rPtr, tmpR, LEN_P128);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P128;
-}
-
-#endif /* _ECP_128_==_ECP_IMPL_SPECIFIC_ */
diff --git a/ext/ipp/sources/ippcp/src/pcppma128.h b/ext/ipp/sources/ippcp/src/pcppma128.h
deleted file mode 100644
index 54b71f4..0000000
--- a/ext/ipp/sources/ippcp/src/pcppma128.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal Definitions and
-// Internal Prime Modulo Arithmetic Function Prototypes
-//
-//
-*/
-
-#if !defined(_PCP_PMA128_H)
-#define _PCP_PMA128_H
-
-#include "pcpbn.h"
-
-
-/* length of operand in bits and BNU32_CHUNK_T */
-#define OPERAND_BITSIZE (128)
-#define LEN_P128 (BITS_BNU_CHUNK(OPERAND_BITSIZE))
-
-/*
-// Modular Arithmetic for secp128r1 ECC
-*/
-void Reduce_P128r1(BNU_CHUNK_T* pR);
-void cpAdde_128r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-void cpSube_128r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-void cpSqre_128r1(IppsBigNumState* pA, IppsBigNumState* pR);
-void cpMule_128r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-
-#define PMA128_add(r,a,b) \
- cpAdde_128r1((a),(b), (r))
-
-#define PMA128_sub(r,a,b) \
- cpSube_128r1((a),(b), (r))
-
-#define PMA128_sqr(r,a) \
- cpSqre_128r1((a),(r))
-
-#define PMA128_mul(r,a,b) \
- cpMule_128r1((a),(b), (r))
-
-#define PMA128_div2(r,a) \
-{ \
- if( IsOdd_BN((a)) ) { \
- cpInc_BNU(BN_NUMBER((r)), BN_NUMBER((a)), LEN_P128, 1); \
- cpLSR_BNU(BN_NUMBER((r)), BN_NUMBER((r)), LEN_P128, 1); \
- cpAdd_BNU(BN_NUMBER((r)), BN_NUMBER((r)), (BNU_CHUNK_T*)h_secp128r1_p, LEN_P128); \
- } \
- else \
- cpLSR_BNU(BN_NUMBER((r)), BN_NUMBER((a)), LEN_P128, 1); \
- BN_SIGN((r)) = ippBigNumPOS; \
- BN_SIZE((r)) = LEN_P128; \
-}
-
-#define PMA128_inv(r,a,modulo) \
-{ \
- ippsModInv_BN((a),(modulo),(r)); \
- ZEXPAND_BNU(BN_NUMBER((r)),BN_SIZE((r)), LEN_P128); \
- BN_SIGN((r)) = ippBigNumPOS; \
- BN_SIZE((r)) = LEN_P128; \
-}
-
-#endif /* _PCP_PMA128_H */
diff --git a/ext/ipp/sources/ippcp/src/pcppma192.c b/ext/ipp/sources/ippcp/src/pcppma192.c
deleted file mode 100644
index 4cc1a69..0000000
--- a/ext/ipp/sources/ippcp/src/pcppma192.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal Prime Modulo Arithmetic Function
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-
-#if (_ECP_192_==_ECP_IMPL_SPECIFIC_)
-#include "pcpeccp.h"
-#include "pcppma192.h"
-
-/*
-// Specific Modulo Arithmetic
-// P192 = 2^192 -2^64 -1
-// (reference secp192r1_p)
-*/
-
-/*
-// Reduce modulo:
-//
-// x = c11|c10|c9|c8|c7|c6|c5|c4|c3|c2|c1|c0
-//
-// s1 = c05|c04|c03|c02|c01|c00
-// s2 = 000|000|c07|c06|c07|c06
-// s3 = c09|c08|c09|c08|000|000
-//
-// r = (s1+s2+s3+s4) (mod P)
-*/
-#if !((_IPPXSC==_IPPXSC_S1) || (_IPPXSC==_IPPXSC_S2) || (_IPPXSC==_IPPXSC_C2) || \
- (_IPP==_IPP_W7) || (_IPP==_IPP_T7) || \
- (_IPP==_IPP_V8) || (_IPP==_IPP_P8) || \
- (_IPPLP32==_IPPLP32_S8) || (_IPP>=_IPP_G9) || \
- (_IPP32E==_IPP32E_M7) || \
- (_IPP32E==_IPP32E_U8) || (_IPP32E==_IPP32E_Y8) || \
- (_IPPLP64==_IPPLP64_N8) || (_IPP32E>=_IPP32E_E9) || \
- (_IPP64==_IPP64_I7) )
-void Reduce_P192r1(BNU_CHUNK_T* pProduct)
-{
- Ipp32u* pR = (Ipp32u*)pProduct;
-
- Ipp64u
- sum = (Ipp64u)pR[0*2+0]+(Ipp64u)pR[3*2+0]+(Ipp64u)pR[5*2+0];
- pR[0] = LODWORD(sum);
- sum = HIDWORD(sum);
-
- sum += (Ipp64u)pR[0*2+1]+(Ipp64u)pR[3*2+1]+(Ipp64u)pR[5*2+1];
- pR[1] = LODWORD(sum);
- sum = HIDWORD(sum);
-
- sum += (Ipp64u)pR[1*2+0]+(Ipp64u)pR[3*2+0]+(Ipp64u)pR[4*2+0]+(Ipp64u)pR[5*2+0];
- pR[2] = LODWORD(sum);
- sum = HIDWORD(sum);
-
- sum += (Ipp64u)pR[1*2+1]+(Ipp64u)pR[3*2+1]+(Ipp64u)pR[4*2+1]+(Ipp64u)pR[5*2+1];
- pR[3] = LODWORD(sum);
- sum = HIDWORD(sum);
-
- sum += (Ipp64u)pR[2*2+0]+(Ipp64u)pR[4*2+0]+(Ipp64u)pR[5*2+0];
- pR[4] = LODWORD(sum);
- sum = HIDWORD(sum);
-
- sum += (Ipp64u)pR[2*2+1]+(Ipp64u)pR[4*2+1]+(Ipp64u)pR[5*2+1];
- pR[5] = LODWORD(sum);
- pProduct[LEN_P192] = (BNU_CHUNK_T)(HIDWORD(sum));
-
- while(0<=cpCmp_BNU(pProduct, LEN_P192+1, (BNU_CHUNK_T*)secp192r1_p, LEN_P192+1))
- cpSub_BNU(pProduct, pProduct, (BNU_CHUNK_T*)secp192r1_p, LEN_P192+1);
-}
-#endif
-
-void cpAdde_192r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- BNU_CHUNK_T carry = cpAdd_BNU(rPtr, aPtr, bPtr, LEN_P192);
- if(carry || (0<=cpCmp_BNU(rPtr, LEN_P192, (BNU_CHUNK_T*)secp192r1_p, LEN_P192)))
- cpSub_BNU(rPtr, rPtr, (BNU_CHUNK_T*)secp192r1_p, LEN_P192);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P192;
-}
-
-void cpSube_192r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- BNU_CHUNK_T borrow = cpSub_BNU(rPtr, aPtr, bPtr, LEN_P192);
- if(borrow)
- cpAdd_BNU(rPtr, rPtr, (BNU_CHUNK_T*)secp192r1_p, LEN_P192);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P192;
-}
-
-void cpSqre_192r1(IppsBigNumState* pA, IppsBigNumState* pR)
-{
- BNU_CHUNK_T tmpR[2*LEN_P192];
-
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- cpSqr_BNU_school(tmpR, aPtr, LEN_P192);
-
- Reduce_P192r1(tmpR);
- COPY_BNU(rPtr, tmpR, LEN_P192);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P192;
-}
-
-void cpMule_192r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T tmpR[2*LEN_P192];
-
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- cpMul_BNU_school(tmpR, aPtr, LEN_P192, bPtr, LEN_P192);
-
- Reduce_P192r1(tmpR);
- COPY_BNU(rPtr, tmpR, LEN_P192);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P192;
-}
-
-#endif /* _ECP_192_==_ECP_IMPL_SPECIFIC_ */
diff --git a/ext/ipp/sources/ippcp/src/pcppma192.h b/ext/ipp/sources/ippcp/src/pcppma192.h
deleted file mode 100644
index c2da25a..0000000
--- a/ext/ipp/sources/ippcp/src/pcppma192.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal Definitions and
-// Internal Prime Modulo Arithmetic Function Prototypes
-//
-//
-*/
-
-#if (_ECP_192_==_ECP_IMPL_SPECIFIC_)
-
-#if !defined(_PCP_PMA192_H)
-#define _PCP_PMA192_H
-
-
-#include "pcpbn.h"
-//#include "pcppmafix.h"
-
-
-/* length of operand in bits and BNU32_CHUNK_T */
-#define OPERAND_BITSIZE (192)
-#define LEN_P192 (BITS_BNU_CHUNK(OPERAND_BITSIZE))
-
-/*
-// Modular Arithmetic for secp192r1 ECC
-*/
-void Reduce_P192r1(BNU_CHUNK_T* pR);
-void cpAdde_192r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-void cpSube_192r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-void cpSqre_192r1(IppsBigNumState* pA, IppsBigNumState* pR);
-void cpMule_192r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-
-#define PMA192_add(r,a,b) \
- cpAdde_192r1((a),(b), (r))
-
-#define PMA192_sub(r,a,b) \
- cpSube_192r1((a),(b), (r))
-
-#define PMA192_sqr(r,a) \
- cpSqre_192r1((a),(r))
-
-#define PMA192_mul(r,a,b) \
- cpMule_192r1((a),(b), (r))
-
-#define PMA192_div2(r,a) \
-{ \
- if( IsOdd_BN((a)) ) { \
- cpInc_BNU(BN_NUMBER((r)), BN_NUMBER((a)), LEN_P192, 1); \
- cpLSR_BNU(BN_NUMBER((r)), BN_NUMBER((r)), LEN_P192, 1); \
- cpAdd_BNU(BN_NUMBER((r)), BN_NUMBER((r)), (BNU_CHUNK_T*)h_secp192r1_p, LEN_P192); \
- } \
- else \
- cpLSR_BNU(BN_NUMBER((r)), BN_NUMBER((a)), LEN_P192, 1); \
- BN_SIGN((r)) = ippBigNumPOS; \
- BN_SIZE((r)) = LEN_P192; \
-}
-
-#define PMA192_inv(r,a,modulo) \
-{ \
- ippsModInv_BN((a),(modulo),(r)); \
- ZEXPAND_BNU(BN_NUMBER((r)),BN_SIZE((r)), LEN_P192); \
- BN_SIGN((r)) = ippBigNumPOS; \
- BN_SIZE((r)) = LEN_P192; \
-}
-
-#endif /* _PCP_PMA192_H */
-#endif /* _ECP_192_==_ECP_IMPL_SPECIFIC_ */
diff --git a/ext/ipp/sources/ippcp/src/pcppma224.c b/ext/ipp/sources/ippcp/src/pcppma224.c
deleted file mode 100644
index 404a9d7..0000000
--- a/ext/ipp/sources/ippcp/src/pcppma224.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal Prime Modulo Arithmetic Function
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-
-#if (_ECP_224_==_ECP_IMPL_SPECIFIC_)
-#include "pcpeccp.h"
-#include "pcppma224.h"
-
-
-/*
-// Specific Modulo Arithmetic
-// P224 = 2^224 -2^96 +1
-// (reference secp224r1_p)
-*/
-
-/*
-// Reduce modulo:
-//
-// x = c13|c12|c11|c10|c09|c08|c07|c06|c05|c04|c03|c02|c01|c00 - 32-bits values
-//
-// s1 = c06|c05|c04|c03|c02|c01|c00
-// s2 = c10|c09|c08|c07|000|000|000
-// s3 = 000|c13|c12|c11|000|000|000
-//
-// s4 = c13|c12|c11|c10|c09|c08|c07
-// s5 = 000|000|000|000|c13|c12|c11
-//
-// r = (s1+s2+s3-s4-s5) (mod P)
-*/
-#if !((_IPPXSC==_IPPXSC_S1) || (_IPPXSC==_IPPXSC_S2) || (_IPPXSC==_IPPXSC_C2) || \
- (_IPP==_IPP_W7) || (_IPP==_IPP_T7) || \
- (_IPP==_IPP_V8) || (_IPP==_IPP_P8) || \
- (_IPPLP32==_IPPLP32_S8) || (_IPP>=_IPP_G9) || \
- (_IPP32E==_IPP32E_M7) || \
- (_IPP32E==_IPP32E_U8) || (_IPP32E==_IPP32E_Y8) || \
- (_IPPLP64==_IPPLP64_N8) || (_IPP32E>=_IPP32E_E9) || \
- (_IPP64==_IPP64_I7) )
-void Reduce_P224r1(BNU_CHUNK_T* pProduct)
-{
- Ipp32u* pR = (Ipp32u*)pProduct;
-
- Ipp64u c7c11 = (Ipp64u)pR[ 7] + (Ipp64u)pR[11];
- Ipp64u c8c12 = (Ipp64u)pR[ 8] + (Ipp64u)pR[12];
- Ipp64u c9c13 = (Ipp64u)pR[ 9] + (Ipp64u)pR[13];
-
- Ipp64s
- sum = (Ipp64u)pR[ 0] - c7c11;
- pR[0] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 1] - c8c12;
- pR[1] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 2] - c9c13;
- pR[2] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 3] + c7c11 - (Ipp64u)pR[10];
- pR[3] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 4] + c8c12 - (Ipp64u)pR[11];
- pR[4] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 5] + c9c13 - (Ipp64u)pR[12];
- pR[5] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 6] + (Ipp64u)pR[10] - (Ipp64u)pR[13];
- pR[6] = LODWORD(sum);
- pR[7] = (Ipp32u)(sum>>32);
-
- while(((BNS_CHUNK_T)pProduct[BITS_BNU_CHUNK(OPERAND_BITSIZE+1)-1]) <0) {
- cpAdd_BNU(pProduct, pProduct, (BNU_CHUNK_T*)secp224r1_p, BITS_BNU_CHUNK(OPERAND_BITSIZE+1));
- }
- while(0 <= cpCmp_BNU(pProduct, BITS_BNU_CHUNK(OPERAND_BITSIZE+1), (BNU_CHUNK_T*)secp224r1_p, BITS_BNU_CHUNK(OPERAND_BITSIZE+1))) {
- cpSub_BNU(pProduct, pProduct, (BNU_CHUNK_T*)secp224r1_p, BITS_BNU_CHUNK(OPERAND_BITSIZE+1));
- }
-}
-#endif
-
-void cpAdde_224r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- BNU_CHUNK_T carry = cpAdd_BNU(rPtr, aPtr, bPtr, LEN_P224);
- if(carry || (0<=cpCmp_BNU(rPtr, LEN_P224, (BNU_CHUNK_T*)secp224r1_p, LEN_P224)))
- cpSub_BNU(rPtr, rPtr, (BNU_CHUNK_T*)secp224r1_p, LEN_P224);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P224;
-}
-
-void cpSube_224r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- BNU_CHUNK_T borrow = cpSub_BNU(rPtr, aPtr, bPtr, LEN_P224);
- if(borrow)
- cpAdd_BNU(rPtr, rPtr, (BNU_CHUNK_T*)secp224r1_p, LEN_P224);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P224;
-}
-
-void cpSqre_224r1(IppsBigNumState* pA, IppsBigNumState* pR)
-{
- BNU_CHUNK_T tmpR[2*LEN_P224];
-
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- cpSqr_BNU_school(tmpR, aPtr, LEN_P224);
-
- Reduce_P224r1(tmpR);
- COPY_BNU(rPtr, tmpR, LEN_P224);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P224;
-}
-
-void cpMule_224r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T tmpR[2*LEN_P224];
-
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- cpMul_BNU_school(tmpR, aPtr, LEN_P224, bPtr, LEN_P224);
-
- Reduce_P224r1(tmpR);
- COPY_BNU(rPtr, tmpR, LEN_P224);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P224;
-}
-
-#endif /* _ECP_224_==_ECP_IMPL_SPECIFIC_ */
diff --git a/ext/ipp/sources/ippcp/src/pcppma224.h b/ext/ipp/sources/ippcp/src/pcppma224.h
deleted file mode 100644
index 3ddab56..0000000
--- a/ext/ipp/sources/ippcp/src/pcppma224.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal Definitions and
-// Internal Prime Modulo Arithmetic Function Prototypes
-//
-//
-*/
-
-#if !defined(_PCP_PMA224_H)
-#define _PCP_PMA224_H
-
-
-#include "pcpbn.h"
-//#include "pcppmafix.h"
-
-
-/* length of operand in bits and BNU32_CHUNK_T */
-#define OPERAND_BITSIZE (224)
-#define LEN_P224 (BITS_BNU_CHUNK(OPERAND_BITSIZE))
-
-/*
-// Modular Arithmetic for secp224r1 ECC
-*/
-void Reduce_P224r1(BNU_CHUNK_T* pR);
-void cpAdde_224r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-void cpSube_224r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-void cpSqre_224r1(IppsBigNumState* pA, IppsBigNumState* pR);
-void cpMule_224r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-
-#define PMA224_add(r,a,b) \
- cpAdde_224r1((a),(b), (r))
-
-#define PMA224_sub(r,a,b) \
- cpSube_224r1((a),(b), (r))
-
-#define PMA224_sqr(r,a) \
- cpSqre_224r1((a),(r))
-
-#define PMA224_mul(r,a,b) \
- cpMule_224r1((a),(b), (r))
-
-#define PMA224_div2(r,a) \
-{ \
- if( IsOdd_BN((a)) ) { \
- cpInc_BNU(BN_NUMBER((r)), BN_NUMBER((a)), LEN_P224, 1); \
- cpLSR_BNU(BN_NUMBER((r)), BN_NUMBER((r)), LEN_P224, 1); \
- cpAdd_BNU(BN_NUMBER((r)), BN_NUMBER((r)), (BNU_CHUNK_T*)h_secp224r1_p, LEN_P224); \
- } \
- else \
- cpLSR_BNU(BN_NUMBER((r)), BN_NUMBER((a)), LEN_P224, 1); \
- BN_SIGN((r)) = ippBigNumPOS; \
- BN_SIZE((r)) = LEN_P224; \
-}
-
-#define PMA224_inv(r,a,modulo) \
-{ \
- ippsModInv_BN((a),(modulo),(r)); \
- ZEXPAND_BNU(BN_NUMBER((r)),BN_SIZE((r)), LEN_P224); \
- BN_SIGN((r)) = ippBigNumPOS; \
- BN_SIZE((r)) = LEN_P224; \
-}
-
-#endif /* _PCP_PMA224_H */
diff --git a/ext/ipp/sources/ippcp/src/pcppma256.c b/ext/ipp/sources/ippcp/src/pcppma256.c
deleted file mode 100644
index cc6a515..0000000
--- a/ext/ipp/sources/ippcp/src/pcppma256.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal Prime Modulo Arithmetic Function
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-
-#if (_ECP_256_==_ECP_IMPL_SPECIFIC_)
-#include "pcpeccp.h"
-#include "pcppma256.h"
-
-
-/*
-// Specific Modulo Arithmetic
-// P256 = 2^256 -2^224 +2^192 +2^96 -1
-// (reference secp256r1_p)
-*/
-
-/*
-// Reduce modulo:
-//
-// x = c15|c14|c13|c12|c11|c10|c09|c08|c07|c06|c05|c04|c03|c02|c01|c00 - 32-bits values
-//
-// s1 = c07|c06|c05|c04|c03|c02|c01|c00
-// s2 = c15|c14|c13|c12|c11|000|000|000
-// s3 = 000|c15|c14|c13|c12|000|000|000
-// s4 = c15|c14|000|000|000|c10|c09|c08
-// s5 = c08|c13|c15|c14|c13|c11|c10|c09
-//
-// s6 = c10|c08|000|000|000|c13|c12|c11
-// s7 = c11|c09|000|000|c15|c14|c13|c12
-// s8 = c12|000|c10|c09|c08|c15|c14|c13
-// s9 = c13|000|c11|c10|c09|000|c15|c14
-//
-// r = (s1+2*s2+2*s3+s4+s5-s6-s7-s8-s9) (mod P)
-*/
-#if !((_IPPXSC==_IPPXSC_S1) || (_IPPXSC==_IPPXSC_S2) || (_IPPXSC==_IPPXSC_C2) || \
- (_IPP==_IPP_W7) || (_IPP==_IPP_T7) || \
- (_IPP==_IPP_V8) || (_IPP==_IPP_P8) || \
- (_IPPLP32==_IPPLP32_S8) || (_IPP>=_IPP_G9) || \
- (_IPP32E==_IPP32E_M7) || \
- (_IPP32E==_IPP32E_U8) || (_IPP32E==_IPP32E_Y8) || \
- (_IPPLP64==_IPPLP64_N8) || (_IPP32E>=_IPP32E_E9) || \
- (_IPP64==_IPP64_I7) )
-void Reduce_P256r1(BNU_CHUNK_T* pProduct)
-{
- Ipp32u* pR = (Ipp32u*)pProduct;
-
- Ipp64u c8c9 = (Ipp64u)pR[ 8] + (Ipp64u)pR[ 9];
- Ipp64u c9c10= (Ipp64u)pR[ 9] + (Ipp64u)pR[10];
- Ipp64u c10c11= (Ipp64u)pR[10] + (Ipp64u)pR[11];
- Ipp64u c11c12= (Ipp64u)pR[11] + (Ipp64u)pR[12];
- Ipp64u c12c13= (Ipp64u)pR[12] + (Ipp64u)pR[13];
- Ipp64u c13c14= (Ipp64u)pR[13] + (Ipp64u)pR[14];
- Ipp64u c14c15= (Ipp64u)pR[14] + (Ipp64u)pR[15];
-
- Ipp64s
- sum = (Ipp64u)pR[ 0] + c8c9 - c11c12 - c13c14;
- pR[0] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 1] + c9c10 - c12c13 - c14c15;
- pR[1] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 2] + c10c11- c13c14 - (Ipp64u)pR[15];
- pR[2] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 3] + c11c12 + c11c12 + c13c14 - c14c15 - c8c9;
- pR[3] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 4] + c12c13 + c12c13 + (Ipp64u)pR[14] - c9c10;
- pR[4] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 5] + c13c14 + c13c14 + (Ipp64u)pR[15] - c10c11;
- pR[5] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 6] + c14c15 +c14c15 +c13c14 - c8c9;
- pR[6] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 7] + (Ipp64u)pR[ 8] + (Ipp64u)pR[15] + (Ipp64u)pR[15] + (Ipp64u)pR[15] - c10c11 -c12c13;
- pR[7] = LODWORD(sum);
- sum >>= 32;
- pProduct[LEN_P256] = (BNU_CHUNK_T)(sum);
-
- while(((BNS_CHUNK_T)pProduct[LEN_P256]) <0)
- cpAdd_BNU(pProduct, pProduct, (BNU_CHUNK_T*)secp256r1_p, LEN_P256+1);
-
- while(0 <= cpCmp_BNU(pProduct, LEN_P256+1, (BNU_CHUNK_T*)secp256r1_p, LEN_P256+1))
- cpSub_BNU(pProduct, pProduct, (BNU_CHUNK_T*)secp256r1_p, LEN_P256+1);
-}
-#endif
-
-void cpAdde_256r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- BNU_CHUNK_T carry = cpAdd_BNU(rPtr, aPtr, bPtr, LEN_P256);
- if(carry || (0<=cpCmp_BNU(rPtr, LEN_P256, (BNU_CHUNK_T*)secp256r1_p, LEN_P256)))
- cpSub_BNU(rPtr, rPtr, (BNU_CHUNK_T*)secp256r1_p, LEN_P256);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P256;
-}
-
-void cpSube_256r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- BNU_CHUNK_T borrow = cpSub_BNU(rPtr, aPtr, bPtr, LEN_P256);
- if(borrow)
- cpAdd_BNU(rPtr, rPtr, (BNU_CHUNK_T*)secp256r1_p, LEN_P256);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P256;
-}
-
-void cpSqre_256r1(IppsBigNumState* pA, IppsBigNumState* pR)
-{
- BNU_CHUNK_T tmpR[2*LEN_P256];
-
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- cpSqr_BNU_school(tmpR, aPtr, LEN_P256);
-
- Reduce_P256r1(tmpR);
- COPY_BNU(rPtr, tmpR, LEN_P256);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P256;
-}
-
-void cpMule_256r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T tmpR[2*LEN_P256];
-
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- cpMul_BNU_school(tmpR, aPtr, LEN_P256, bPtr, LEN_P256);
-
- Reduce_P256r1(tmpR);
- COPY_BNU(rPtr, tmpR, LEN_P256);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P256;
-}
-
-#endif
diff --git a/ext/ipp/sources/ippcp/src/pcppma256.h b/ext/ipp/sources/ippcp/src/pcppma256.h
deleted file mode 100644
index 5137c04..0000000
--- a/ext/ipp/sources/ippcp/src/pcppma256.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal Definitions and
-// Internal Prime Modulo Arithmetic Function Prototypes
-//
-//
-*/
-
-#if !defined(_PCP_PMA256_H)
-#define _PCP_PMA256_H
-
-
-#include "pcpbn.h"
-//#include "pcppmafix.h"
-
-
-/* length of operand in bits and BNU32_CHUNK_T */
-#define OPERAND_BITSIZE (256)
-#define LEN_P256 (BITS_BNU_CHUNK(OPERAND_BITSIZE))
-
-
-/*
-// Modular Arithmetic for secp256r1 ECC
-*/
-void Reduce_P256r1(BNU_CHUNK_T* pR);
-void cpAdde_256r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-void cpSube_256r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-void cpSqre_256r1(IppsBigNumState* pA, IppsBigNumState* pR);
-void cpMule_256r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-
-#define PMA256_add(r,a,b) \
- cpAdde_256r1((a),(b), (r))
-
-#define PMA256_sub(r,a,b) \
- cpSube_256r1((a),(b), (r))
-
-#define PMA256_sqr(r,a) \
- cpSqre_256r1((a),(r))
-
-#define PMA256_mul(r,a,b) \
- cpMule_256r1((a),(b), (r))
-
-#define PMA256_div2(r,a) \
-{ \
- if( IsOdd_BN((a)) ) { \
- cpInc_BNU(BN_NUMBER((r)), BN_NUMBER((a)), LEN_P256, 1); \
- cpLSR_BNU(BN_NUMBER((r)), BN_NUMBER((r)), LEN_P256, 1); \
- cpAdd_BNU(BN_NUMBER((r)), BN_NUMBER((r)), (BNU_CHUNK_T*)h_secp256r1_p, LEN_P256); \
- } \
- else \
- cpLSR_BNU(BN_NUMBER((r)), BN_NUMBER((a)), LEN_P256, 1); \
- BN_SIGN((r)) = ippBigNumPOS; \
- BN_SIZE((r)) = LEN_P256; \
-}
-
-#define PMA256_inv(r,a,modulo) \
-{ \
- ippsModInv_BN((a),(modulo),(r)); \
- ZEXPAND_BNU(BN_NUMBER((r)),BN_SIZE((r)), LEN_P256); \
- BN_SIGN((r)) = ippBigNumPOS; \
- BN_SIZE((r)) = LEN_P256; \
-}
-
-#endif /* _PCP_PMA256_H */
diff --git a/ext/ipp/sources/ippcp/src/pcppma384.c b/ext/ipp/sources/ippcp/src/pcppma384.c
deleted file mode 100644
index f2042f6..0000000
--- a/ext/ipp/sources/ippcp/src/pcppma384.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal Prime Modulo Arithmetic Function
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-
-#if (_ECP_384_==_ECP_IMPL_SPECIFIC_) || (_ECP_384_==_ECP_IMPL_MFM_)
-#include "pcpeccp.h"
-#include "pcppma384.h"
-
-
-/*
-// Specific Modulo Arithmetic
-// P384 = 2^384 -2^128 -2^96 +2^32 -1
-// (reference secp384r1_p)
-*/
-
-/*
-// Reduce modulo:
-//
-// x = c23|c22|c21|c20|c19|c18|c17|c16|c15|c14|c13|c12|c11|c10|c09|c08|c07|c06|c05|c04|c03|c02|c01|c00 - 32-bits values
-//
-// s1 = c11|c10|c09|c08|c07|c06|c05|c04|c03|c02|c01|c00
-// s2 = 000|000|000|000|000|c23|c22|c21|000|000|000|000
-// s3 = c23|c22|c21|c20|c19|c18|c17|c16|c15|c14|c13|c12
-// s4 = c20|c19|c18|c17|c16|c15|c14|c13|c12|c23|c22|c21
-// s5 = c19|c18|c17|c16|c15|c14|c13|c12|c20|000|c23|000
-// s6 = 000|000|000|000|c23|c22|c21|c20|000|000|000|000
-// s7 = 000|000|000|000|000|000|c23|c22|c21|000|000|c20
-//
-// s8 = c22|c21|c20|c19|c18|c17|c16|c15|c14|c13|c12|c23
-// s9 = 000|000|000|000|000|000|000|c23|c22|c21|c20|000
-// s10= 000|000|000|000|000|000|000|c23|c23|000|000|000
-//
-// r = (s1+2*s2+s3+s4+s5+s6+s7-s8-s9-10) (mod P)
-*/
-
-//static
-void Reduce_P384r1(BNU_CHUNK_T* pProduct)
-{
- #define CHUNK_LEN_P384 (BITS_BNU_CHUNK(OPERAND_BITSIZE))
-
- Ipp32u* pR = (Ipp32u*)pProduct;
-
- Ipp64u c12c21 = (Ipp64u)pR[12] + (Ipp64u)pR[21];
- Ipp64u c13c22 = (Ipp64u)pR[13] + (Ipp64u)pR[22];
- Ipp64u c14c23 = (Ipp64u)pR[14] + (Ipp64u)pR[23];
-
- Ipp64s
- sum = (Ipp64u)pR[ 0] + c12c21 + (Ipp64u)pR[20] - (Ipp64u)pR[23];
- pR[ 0]= LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 1] + c13c22 + (Ipp64u)pR[23] - (Ipp64u)pR[12] - (Ipp64u)pR[20];
- pR[ 1]= LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 2] + c14c23 - (Ipp64u)pR[13] - (Ipp64u)pR[21];
- pR[ 2]= LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 3] + c12c21 + (Ipp64u)pR[15] + (Ipp64u)pR[20] - c14c23 - (Ipp64u)pR[22];
- pR[ 3]= LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 4] + (Ipp64u)pR[21] + c12c21 + c13c22 + (Ipp64u)pR[16] + (Ipp64u)pR[20] - (Ipp64u)pR[15] - (Ipp64u)pR[23] - (Ipp64u)pR[23];
- pR[ 4]= LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 5] + (Ipp64u)pR[22] + c13c22 + c14c23 + (Ipp64u)pR[17] + (Ipp64u)pR[21] - (Ipp64u)pR[16];
- pR[ 5]= LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 6] + (Ipp64u)pR[23] + c14c23 + (Ipp64u)pR[15] + (Ipp64u)pR[18] + (Ipp64u)pR[22] - (Ipp64u)pR[17];
- pR[ 6]= LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 7] + (Ipp64u)pR[15] + (Ipp64u)pR[16] + (Ipp64u)pR[19] + (Ipp64u)pR[23] - (Ipp64u)pR[18];
- pR[ 7]= LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 8] + (Ipp64u)pR[16] + (Ipp64u)pR[17] + (Ipp64u)pR[20] - (Ipp64u)pR[19];
- pR[ 8]= LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 9] + (Ipp64u)pR[17] + (Ipp64u)pR[18] + (Ipp64u)pR[21] - (Ipp64u)pR[20];
- pR[ 9]= LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[10] + (Ipp64u)pR[18] + (Ipp64u)pR[19] + (Ipp64u)pR[22] - (Ipp64u)pR[21];
- pR[10]= LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[11] + (Ipp64u)pR[19] + (Ipp64u)pR[20] + (Ipp64u)pR[23] - (Ipp64u)pR[22];
- pR[11]= LODWORD(sum);
- sum >>= 32;
- pProduct[LEN_P384] = (BNU_CHUNK_T)sum;
-
- while(((BNS_CHUNK_T)pProduct[LEN_P384]) <0)
- cpAdd_BNU(pProduct, pProduct, (BNU_CHUNK_T*)secp384r1_p, LEN_P384+1);
-
- while(0 <= cpCmp_BNU(pProduct, LEN_P384+1, (BNU_CHUNK_T*)secp384r1_p, LEN_P384+1))
- cpSub_BNU(pProduct, pProduct, (BNU_CHUNK_T*)secp384r1_p, LEN_P384+1);
-}
-
-
-void cpSqre_384r1(IppsBigNumState* pA, IppsBigNumState* pR)
-{
- BNU_CHUNK_T tmpR[2*LEN_P384];
-
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- cpSqr_BNU_school(tmpR, aPtr, LEN_P384);
-
- Reduce_P384r1(tmpR);
- COPY_BNU(rPtr, tmpR, LEN_P384);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P384;
-}
-
-void cpMule_384r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T tmpR[2*LEN_P384];
-
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- cpMul_BNU_school(tmpR, aPtr, LEN_P384, bPtr, LEN_P384);
-
- Reduce_P384r1(tmpR);
- COPY_BNU(rPtr, tmpR, LEN_P384);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P384;
-}
-#endif /* (_ECP_384_==_ECP_IMPL_SPECIFIC_) || (_ECP_384_==_ECP_IMPL_MFM_) */
-
-#if (_ECP_384_==_ECP_IMPL_SPECIFIC_)
-void cpAdde_384r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- BNU_CHUNK_T carry = cpAdd_BNU(rPtr, aPtr, bPtr, LEN_P384);
- if(carry || (0<=cpCmp_BNU(rPtr, LEN_P384, (BNU_CHUNK_T*)secp384r1_p, LEN_P384)))
- cpSub_BNU(rPtr, rPtr, (BNU_CHUNK_T*)secp384r1_p, LEN_P384);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P384;
-}
-
-void cpSube_384r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- BNU_CHUNK_T borrow = cpSub_BNU(rPtr, aPtr, bPtr, LEN_P384);
- if(borrow)
- cpAdd_BNU(rPtr, rPtr, (BNU_CHUNK_T*)secp384r1_p, LEN_P384);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P384;
-}
-#endif /* _ECP_384_==_ECP_IMPL_SPECIFIC_ */
diff --git a/ext/ipp/sources/ippcp/src/pcppma384.h b/ext/ipp/sources/ippcp/src/pcppma384.h
deleted file mode 100644
index 688e49f..0000000
--- a/ext/ipp/sources/ippcp/src/pcppma384.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal Definitions and
-// Internal Prime Modulo Arithmetic Function Prototypes
-//
-//
-*/
-
-#if !defined(_PCP_PMA384_H)
-#define _PCP_PMA384_H
-
-
-#include "pcpbn.h"
-//#include "pcppmafix.h"
-
-
-/* length of operand in bits and BNU32_CHUNK_T */
-#define OPERAND_BITSIZE (384)
-#define LEN_P384 (BITS_BNU_CHUNK(OPERAND_BITSIZE))
-
-/*
-// Modular Arithmetic for secp384r1 ECC
-*/
-void Reduce_P384r1(BNU_CHUNK_T* pProduct);
-
-void cpAdde_384r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-void cpSube_384r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-void cpSqre_384r1(IppsBigNumState* pA, IppsBigNumState* pR);
-void cpMule_384r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-
-#define PMA384_add(r,a,b) \
- cpAdde_384r1((a),(b), (r))
-
-#define PMA384_sub(r,a,b) \
- cpSube_384r1((a),(b), (r))
-
-#define PMA384_sqr(r,a) \
- cpSqre_384r1((a),(r))
-
-#define PMA384_mul(r,a,b) \
- cpMule_384r1((a),(b), (r))
-
-#define PMA384_div2(r,a) \
-{ \
- if( IsOdd_BN((a)) ) { \
- cpInc_BNU(BN_NUMBER((r)), BN_NUMBER((a)), LEN_P384, 1); \
- cpLSR_BNU(BN_NUMBER((r)), BN_NUMBER((r)), LEN_P384, 1); \
- cpAdd_BNU(BN_NUMBER((r)), BN_NUMBER((r)), (BNU_CHUNK_T*)h_secp384r1_p, LEN_P384); \
- } \
- else \
- cpLSR_BNU(BN_NUMBER((r)), BN_NUMBER((a)), LEN_P384, 1); \
- BN_SIGN((r)) = ippBigNumPOS; \
- BN_SIZE((r)) = LEN_P384; \
-}
-
-#define PMA384_inv(r,a,modulo) \
-{ \
- ippsModInv_BN((a),(modulo),(r)); \
- ZEXPAND_BNU(BN_NUMBER((r)),BN_SIZE((r)), LEN_P384); \
- BN_SIGN((r)) = ippBigNumPOS; \
- BN_SIZE((r)) = LEN_P384; \
-}
-
-#endif /* _PCP_PMA384_H */
diff --git a/ext/ipp/sources/ippcp/src/pcppma521.c b/ext/ipp/sources/ippcp/src/pcppma521.c
deleted file mode 100644
index 6366285..0000000
--- a/ext/ipp/sources/ippcp/src/pcppma521.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal Prime Modulo Arithmetic Function
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-#include "pcpeccp.h"
-#include "pcppma521.h"
-
-#if (_ECP_521_==_ECP_IMPL_SPECIFIC_) || (_ECP_521_==_ECP_IMPL_MFM_)
-
-
-/*
-// Specific Modulo Arithmetic
-// P521 = 2^521 -1
-// (reference secp521r1_p)
-*/
-
-/*
-// Reduce modulo:
-//
-// x = a1*2^521 + a0 - 521-bits values
-//
-// r = (s1+a0) (mod P)
-*/
-static
-void Reduce_P521r1(BNU_CHUNK_T* pProduct)
-{
- BNU_CHUNK_T TT[LEN_P521];
- BNU_CHUNK_T* pR = pProduct;
-
- cpLSR_BNU(TT, pR+LEN_P521-1, LEN_P521, OPERAND_BITSIZE%BITSIZE(BNU_CHUNK_T));
- pR[LEN_P521-1] &= MASK_BNU_CHUNK(OPERAND_BITSIZE % BITSIZE(BNU_CHUNK_T));
- TT[LEN_P521-1] &= MASK_BNU_CHUNK(OPERAND_BITSIZE % BITSIZE(BNU_CHUNK_T));
- cpAdd_BNU(pR, pR, TT, LEN_P521);
-
- while(0 <= cpCmp_BNU(pR, LEN_P521, (BNU_CHUNK_T*)secp521r1_p, LEN_P521))
- cpSub_BNU(pR, pR, (BNU_CHUNK_T*)secp521r1_p, LEN_P521);
-}
-
-void cpSqre_521r1(IppsBigNumState* pA, IppsBigNumState* pR)
-{
- BNU_CHUNK_T tmpR[2*LEN_P521];
-
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- cpSqr_BNU_school(tmpR, aPtr, LEN_P521);
-
- Reduce_P521r1(tmpR);
- COPY_BNU(rPtr, tmpR, LEN_P521);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P521;
-}
-
-void cpMule_521r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T tmpR[2*LEN_P521];
-
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- cpMul_BNU_school(tmpR, aPtr, LEN_P521, bPtr, LEN_P521);
-
- Reduce_P521r1(tmpR);
- COPY_BNU(rPtr, tmpR, LEN_P521);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P521;
-}
-#endif /* (_ECP_521_==_ECP_IMPL_SPECIFIC_) || (_ECP_521_==_ECP_IMPL_MFM_) */
-
-#if (_ECP_521_==_ECP_IMPL_SPECIFIC_)
-void cpAdde_521r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- BNU_CHUNK_T carry = cpAdd_BNU(rPtr, aPtr, bPtr, LEN_P521);
- if(carry || (0<=cpCmp_BNU(rPtr, LEN_P521, (BNU_CHUNK_T*)secp521r1_p, LEN_P521)))
- cpSub_BNU(rPtr, rPtr, (BNU_CHUNK_T*)secp521r1_p, LEN_P521);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P521;
-}
-
-void cpSube_521r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- BNU_CHUNK_T borrow = cpSub_BNU(rPtr, aPtr, bPtr, LEN_P521);
- if(borrow)
- cpAdd_BNU(rPtr, rPtr, (BNU_CHUNK_T*)secp521r1_p, LEN_P521);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P521;
-}
-#endif /* _ECP_521_==_ECP_IMPL_SPECIFIC_ */
diff --git a/ext/ipp/sources/ippcp/src/pcppma521.h b/ext/ipp/sources/ippcp/src/pcppma521.h
deleted file mode 100644
index 8dacdcf..0000000
--- a/ext/ipp/sources/ippcp/src/pcppma521.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal Definitions and
-// Internal Prime Modulo Arithmetic Function Prototypes
-//
-//
-*/
-
-#if !defined(_PCP_PMA521_H)
-#define _PCP_PMA521_H
-
-
-#include "pcpbn.h"
-//#include "pcppmafix.h"
-
-
-/* length of operand in bits and BNU32_CHUNK_T */
-#define OPERAND_BITSIZE (521)
-#define LEN_P521 (BITS_BNU_CHUNK(OPERAND_BITSIZE))
-
-/*
-// Modular Arithmetic for secp521r1 ECC
-*/
-void cpAdde_521r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-void cpSube_521r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-void cpSqre_521r1(IppsBigNumState* pA, IppsBigNumState* pR);
-void cpMule_521r1(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-
-#define PMA521_add(r,a,b) \
- cpAdde_521r1((a),(b), (r))
-
-#define PMA521_sub(r,a,b) \
- cpSube_521r1((a),(b), (r))
-
-#define PMA521_sqr(r,a) \
- cpSqre_521r1((a),(r))
-
-#define PMA521_mul(r,a,b) \
- cpMule_521r1((a),(b), (r))
-
-#define PMA521_div2(r,a) \
-{ \
- if( IsOdd_BN((a)) ) { \
- cpInc_BNU(BN_NUMBER((r)), BN_NUMBER((a)), LEN_P521, 1); \
- cpLSR_BNU(BN_NUMBER((r)), BN_NUMBER((r)), LEN_P521, 1); \
- cpAdd_BNU(BN_NUMBER((r)), BN_NUMBER((r)), (BNU_CHUNK_T*)h_secp521r1_p, LEN_P521); \
- } \
- else \
- cpLSR_BNU(BN_NUMBER((r)), BN_NUMBER((a)), LEN_P521, 1); \
- BN_SIGN((r)) = ippBigNumPOS; \
- BN_SIZE((r)) = LEN_P521; \
-}
-
-#define PMA521_inv(r,a,modulo) \
-{ \
- ippsModInv_BN((a),(modulo),(r)); \
- ZEXPAND_BNU(BN_NUMBER((r)),BN_SIZE((r)), LEN_P521); \
- BN_SIGN((r)) = ippBigNumPOS; \
- BN_SIZE((r)) = LEN_P521; \
-}
-
-#endif /* _PCP_PMA521_H */
diff --git a/ext/ipp/sources/ippcp/src/pcppmasm2.c b/ext/ipp/sources/ippcp/src/pcppmasm2.c
deleted file mode 100644
index 28ebf80..0000000
--- a/ext/ipp/sources/ippcp/src/pcppmasm2.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal Prime Modulo Arithmetic Function
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-
-#if (_ECP_SM2_==_ECP_IMPL_SPECIFIC_)
-#include "pcpeccp.h"
-#include "pcppmasm2.h"
-
-
-/*
-// Specific Modulo Arithmetic
-// P256 = 2^256 -2^224 -2^96 +2^64 -1
-// (reference tpmSM2_p256_p)
-*/
-
-/*
-// Reduce modulo:
-//
-// x = c15|c14|c13|c12|c11|c10|c09|c08|c07|c06|c05|c04|c03|c02|c01|c00 - 32-bits values
-//
-// r7 r6 r5 r4 r3 r2 r1 r0
-// c08 deposit: | c08 | 000 | 000 | 000 | c08 |-c08 | 000 | c08 |
-// c09 deposit: | c09 | 000 | 000 | c09 | 000 |-c09 | c09 | c09 |
-// c10 deposit: | c10 | 000 | c10 | 000 | 000 | 000 | c10 | c10 |
-// c11 deposit: | c11 | c11 | 000 | 000 | c11 | 000 | c11 | c11 |
-// c12 deposit: |2*c12| 000 | 000 | c12 | c12 | 000 | c12 | c12 |
-// c13 deposit: |2*c13| 000 | c13 | c13 |2*c13|-c13 | c13 |2*c13|
-// c14 deposit: |2*c14| c14 | c14 |2*c14| c14 |-c14 |2*c14|2*c14|
-// c15 deposit: |3*c15| c15 |2*c15| c15 | c15 | 000 |2*c15|2*c15|
-//
-*/
-//#if !((_IPP==_IPP_W7) || (_IPP==_IPP_T7) || \
-// (_IPP==_IPP_V8) || (_IPP==_IPP_P8) || \
-// (_IPPLP32==_IPPLP32_S8) || (_IPP>=_IPP_G9) )
-#if (_IPP < _IPP_W7)
-void Reduce_SM2(BNU_CHUNK_T* pProduct)
-{
- Ipp32u* pR = (Ipp32u*)pProduct;
-
- Ipp64u t0 = (Ipp64u)pR[ 8] + pR[ 9] + pR[10] + pR[11] + pR[12];
- Ipp64u w0 = (Ipp64u)pR[13] +pR[14] + pR[15];
- Ipp64u u0 = w0<<1;
-
- Ipp64s
- sum = (Ipp64u)pR[ 0] +t0 + u0;
- pR[0] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 1] +(t0-pR[8]) +(u0-pR[13]);
- pR[1] = LODWORD(sum);
- sum >>= 32;
-
- //sum += (Ipp64u)pR[ 2] - (pR[8]+pR[9]) - (w0-pR[15]);
- sum += (Ipp64u)pR[ 2] - pR[8] -pR[9] - (w0-pR[15]);
- pR[2] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 3] +pR[ 8] +pR[11] +pR[12] +(w0+pR[13]);
- pR[3] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 4] +pR[ 9] + pR[12] + (w0+pR[14]);
- pR[4] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 5] +pR[10] +(w0+pR[15]);
- pR[5] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 6] +pR[11] + (w0-pR[13]);
- pR[6] = LODWORD(sum);
- sum >>= 32;
-
- sum += (Ipp64u)pR[ 7] + (t0+pR[12]) + (u0+pR[15]);
- pR[7] = LODWORD(sum);
- sum >>= 32;
- pProduct[LEN_P256] = (BNU_CHUNK_T)(sum);
-
- while(((BNS_CHUNK_T)pProduct[LEN_P256]) <0)
- cpAdd_BNU(pProduct, pProduct, (BNU_CHUNK_T*)tpmSM2_p256_p, LEN_P256+1);
-
- while(0 <= cpCmp_BNU(pProduct, LEN_P256+1, (BNU_CHUNK_T*)tpmSM2_p256_p, LEN_P256+1))
- cpSub_BNU(pProduct, pProduct, (BNU_CHUNK_T*)tpmSM2_p256_p, LEN_P256+1);
-}
-
-#else
-#if 0
-void Reduce_SM2(BNU_CHUNK_T* pProduct)
-{
- Ipp32u* pR = (Ipp32u*)pProduct;
-
- __m64 s8 = _mm_cvtsi32_si64((Ipp32s)pR[8]);
- __m64 s9 = _mm_cvtsi32_si64((Ipp32s)pR[9]);
- __m64 s10 = _mm_cvtsi32_si64((Ipp32s)pR[10]);
- __m64 s11 = _mm_cvtsi32_si64((Ipp32s)pR[11]);
- __m64 s12 = _mm_cvtsi32_si64((Ipp32s)pR[12]);
- __m64 s13 = _mm_cvtsi32_si64((Ipp32s)pR[13]);
- __m64 s14 = _mm_cvtsi32_si64((Ipp32s)pR[14]);
- __m64 s15 = _mm_cvtsi32_si64((Ipp32s)pR[15]);
-
- __m64 w0 = _mm_add_si64(s13,
- _mm_add_si64(s14, s15));
- __m64 t0 = _mm_add_si64(s8,
- _mm_add_si64(s9,
- _mm_add_si64(s10,
- _mm_add_si64(s11,
- _mm_add_si64(s12,
- _mm_add_si64(w0, w0))))));
-
- __m64
- // sum = pR[ 0] +t0 + u0
- sum = _mm_add_si64(_mm_cvtsi32_si64((Ipp32s)pR[0]), t0);
- pR[0] = (Ipp32u)( _mm_cvtsi64_si32(sum) );
- sum = _mm_shuffle_pi16(sum, 0xfe);
-
- // sum += pR[ 1] +(t0-pR[8]) +(u0-pR[13])
- sum = _mm_sub_si64(
- _mm_add_si64(_mm_cvtsi32_si64((Ipp32s)pR[1]),
- _mm_add_si64(sum, t0)),
- _mm_add_si64(s8, s13));
- pR[1] = (Ipp32u)( _mm_cvtsi64_si32(sum) );
- sum = _mm_shuffle_pi16(sum, 0xfe);
-
- // sum += pR[ 2] - pR[8] -pR[9] - (w0-pR[15])
- sum = _mm_sub_si64(
- _mm_add_si64(_mm_cvtsi32_si64((Ipp32s)pR[2]),
- _mm_add_si64(sum, s15)),
- _mm_add_si64(s8,
- _mm_add_si64(s9, w0)));
- pR[2] = (Ipp32u)( _mm_cvtsi64_si32(sum) );
- sum = _mm_shuffle_pi16(sum, 0xfe);
-
- // sum += pR[ 3] +pR[ 8] +pR[11] +pR[12] +(w0+pR[13]);
- sum = _mm_add_si64(_mm_cvtsi32_si64((Ipp32s)pR[3]),
- _mm_add_si64(sum,
- _mm_add_si64(s8,
- _mm_add_si64(s11,
- _mm_add_si64(s12,
- _mm_add_si64(w0, s13))))));
- pR[3] = (Ipp32u)( _mm_cvtsi64_si32(sum) );
- sum = _mm_shuffle_pi16(sum, 0xfe);
-
- // sum += pR[ 4] +pR[ 9] + pR[12] + (w0+pR[14]);
- sum = _mm_add_si64(_mm_cvtsi32_si64((Ipp32s)pR[4]),
- _mm_add_si64(sum,
- _mm_add_si64(s9,
- _mm_add_si64(s12,
- _mm_add_si64(w0, s14)))));
- pR[4] = (Ipp32u)( _mm_cvtsi64_si32(sum) );
- sum = _mm_shuffle_pi16(sum, 0xfe);
-
- // sum += pR[ 5] +pR[10] +(w0+pR[15]);
- sum = _mm_add_si64(_mm_cvtsi32_si64((Ipp32s)pR[5]),
- _mm_add_si64(sum,
- _mm_add_si64(s10,
- _mm_add_si64(w0, s15))));
- pR[5] = (Ipp32u)( _mm_cvtsi64_si32(sum) );
- sum = _mm_shuffle_pi16(sum, 0xfe);
-
- // sum += pR[ 6] +pR[11] + (w0-pR[13]);
- sum = _mm_sub_si64(
- _mm_add_si64(_mm_cvtsi32_si64((Ipp32s)pR[6]),
- _mm_add_si64(sum,
- _mm_add_si64(s11, w0))),
- s13);
- pR[6] = (Ipp32u)( _mm_cvtsi64_si32(sum) );
- sum = _mm_shuffle_pi16(sum, 0xfe);
-
- // sum += pR[ 7] + (t0+pR[12]) + (u0+pR[15]);
- sum = _mm_add_si64(_mm_cvtsi32_si64((Ipp32s)pR[7]),
- _mm_add_si64(sum,
- _mm_add_si64(t0,
- _mm_add_si64(s12, s15))));
- pR[7] = (Ipp32u)( _mm_cvtsi64_si32(sum) );
- sum = _mm_shuffle_pi16(sum, 0xfe);
- pProduct[LEN_P256] = (BNS_CHUNK_T)( _mm_cvtsi64_si32(sum) );
-
- {
- int n;
- const Ipp32u* pMx;
-
- // reduce multiple modulus
- if( pProduct[LEN_P256] ) {
- pMx = tpmSM2_p256_p_mx[ pProduct[LEN_P256] ];
- sum = _mm_setzero_si64();
- for(n=0; n<LEN_P256+1; n++) {
- sum = _mm_add_si64(sum,
- _mm_sub_si64(_mm_cvtsi32_si64((Ipp32s)pProduct[n]),
- _mm_cvtsi32_si64((Ipp32s)pMx[n])));
- pProduct[n] = (Ipp32u)( _mm_cvtsi64_si32(sum) );
- sum = _mm_shuffle_pi16(sum, 0xfe);
- }
- }
-
- // increase temporary result
- while(((BNS_CHUNK_T)pProduct[LEN_P256]) <0) {
- sum = _mm_setzero_si64();
- for(n=0; n<LEN_P256+1; n++) {
- sum = _mm_add_si64(sum,
- _mm_add_si64(_mm_cvtsi32_si64((Ipp32s)pProduct[n]),
- _mm_cvtsi32_si64((Ipp32s)tpmSM2_p256_p[n])));
- pProduct[n] = (Ipp32u)( _mm_cvtsi64_si32(sum) );
- sum = _mm_shuffle_pi16(sum, 0xfe);
- }
- }
-
- // reduce temporary result
- if(0 <= cpCmp_BNU(pProduct, LEN_P256+1, (BNU_CHUNK_T*)tpmSM2_p256_p, LEN_P256+1)) {
- sum = _mm_setzero_si64();
- for(n=0; n<LEN_P256+1; n++) {
- sum = _mm_add_si64(sum,
- _mm_sub_si64(_mm_cvtsi32_si64((Ipp32s)pProduct[n]),
- _mm_cvtsi32_si64((Ipp32s)tpmSM2_p256_p[n])));
- pProduct[n] = (Ipp32u)( _mm_cvtsi64_si32(sum) );
- sum = _mm_shuffle_pi16(sum, 0xfe);
- }
- }
- }
-
- _mm_empty();
-}
-#endif
-#endif
-
-
-void cpAdde_SM2(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- BNU_CHUNK_T carry = cpAdd_BNU(rPtr, aPtr, bPtr, LEN_P256);
- if(carry || (0<=cpCmp_BNU(rPtr, LEN_P256, (BNU_CHUNK_T*)tpmSM2_p256_p, LEN_P256)))
- cpSub_BNU(rPtr, rPtr, (BNU_CHUNK_T*)tpmSM2_p256_p, LEN_P256);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P256;
-}
-
-void cpSube_SM2(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- BNU_CHUNK_T borrow = cpSub_BNU(rPtr, aPtr, bPtr, LEN_P256);
- if(borrow)
- cpAdd_BNU(rPtr, rPtr, (BNU_CHUNK_T*)tpmSM2_p256_p, LEN_P256);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P256;
-}
-
-void cpSqre_SM2(IppsBigNumState* pA, IppsBigNumState* pR)
-{
- BNU_CHUNK_T tmpR[2*LEN_P256];
-
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- cpSqr_BNU_school(tmpR, aPtr, LEN_P256);
-
- Reduce_SM2(tmpR);
- COPY_BNU(rPtr, tmpR, LEN_P256);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P256;
-}
-
-void cpMule_SM2(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)
-{
- BNU_CHUNK_T tmpR[2*LEN_P256];
-
- BNU_CHUNK_T* aPtr = BN_NUMBER(pA);
- BNU_CHUNK_T* bPtr = BN_NUMBER(pB);
- BNU_CHUNK_T* rPtr = BN_NUMBER(pR);
-
- cpMul_BNU_school(tmpR, aPtr, LEN_P256, bPtr, LEN_P256);
-
- Reduce_SM2(tmpR);
- COPY_BNU(rPtr, tmpR, LEN_P256);
-
- BN_SIGN(pR) = ippBigNumPOS;
- BN_SIZE(pR) = LEN_P256;
-}
-
-#endif
diff --git a/ext/ipp/sources/ippcp/src/pcppmasm2.h b/ext/ipp/sources/ippcp/src/pcppmasm2.h
deleted file mode 100644
index 3526724..0000000
--- a/ext/ipp/sources/ippcp/src/pcppmasm2.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Internal Definitions and
-// Internal Prime Modulo Arithmetic Function Prototypes
-//
-//
-*/
-
-#if !defined(_PCP_PMASM2_H)
-#define _PCP_PMASM2_H
-
-
-#include "pcpbn.h"
-//#include "pcppmafix.h"
-
-
-/* length of operand in bits and BNU32_CHUNK_T */
-#define OPERAND_BITSIZE (256)
-#define LEN_P256 (BITS_BNU_CHUNK(OPERAND_BITSIZE))
-
-
-/*
-// Modular Arithmetic for secp256r1 ECC
-*/
-void Reduce_SM2(BNU_CHUNK_T* pR);
-void cpAdde_SM2(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-void cpSube_SM2(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-void cpSqre_SM2(IppsBigNumState* pA, IppsBigNumState* pR);
-void cpMule_SM2(IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR);
-
-#define PMAsm2_add(r,a,b) \
- cpAdde_SM2((a),(b), (r))
-
-#define PMAsm2_sub(r,a,b) \
- cpSube_SM2((a),(b), (r))
-
-#define PMAsm2_sqr(r,a) \
- cpSqre_SM2((a),(r))
-
-#define PMAsm2_mul(r,a,b) \
- cpMule_SM2((a),(b), (r))
-
-__INLINE void maskMov(BNU_CHUNK_T dst[LEN_P256+1], const BNU_CHUNK_T src[LEN_P256+1], BNU_CHUNK_T moveFlag)
-{
- BNU_CHUNK_T maskSrc = 0-moveFlag;
- BNU_CHUNK_T maskDst = ~maskSrc;
-
- dst[0] = (src[0] & maskSrc) ^ (dst[0] & maskDst);
- dst[1] = (src[1] & maskSrc) ^ (dst[1] & maskDst);
- dst[2] = (src[2] & maskSrc) ^ (dst[2] & maskDst);
- dst[3] = (src[3] & maskSrc) ^ (dst[3] & maskDst);
- dst[4] = (src[4] & maskSrc) ^ (dst[4] & maskDst);
- #if (_IPP_ARCH ==_ARCH_IA32)
- dst[5] = (src[5] & maskSrc) ^ (dst[5] & maskDst);
- dst[6] = (src[6] & maskSrc) ^ (dst[6] & maskDst);
- dst[7] = (src[7] & maskSrc) ^ (dst[7] & maskDst);
- dst[8] = (src[8] & maskSrc) ^ (dst[8] & maskDst);
- #endif
-}
-
-#if 0
-__INLINE void PMAsm2_div2(IppsBigNumState* r, IppsBigNumState* a)
-{
- BNU_CHUNK_T t[LEN_P256+1];
-
- BNU_CHUNK_T* aData = BN_NUMBER(a);
- BNU_CHUNK_T aIsEeven = 1 - aData[0]&1;
-
- /* expand a value */
- ZEXPAND_BNU(aData, BN_SIZE(a), LEN_P256+1);
- /* add modulus */
- cpAdd_BNU(t, aData, (BNU_CHUNK_T*)tpmSM2_p256_p, LEN_P256+1);
- /* if a value is even then assign t to a */
- maskMov(t, aData, aIsEeven);
-
- /* div by 2 */
- cpLSR_BNU(BN_NUMBER((r)), t, LEN_P256+1, 1);
- BN_SIGN((r)) = ippBigNumPOS;
- BN_SIZE((r)) = LEN_P256;
-}
-#endif
-#define PMAsm2_div2(r,a) \
-{ \
- if( IsOdd_BN((a)) ) { \
- cpInc_BNU(BN_NUMBER((r)), BN_NUMBER((a)), LEN_P256, 1); \
- cpLSR_BNU(BN_NUMBER((r)), BN_NUMBER((r)), LEN_P256, 1); \
- cpAdd_BNU(BN_NUMBER((r)), BN_NUMBER((r)), (BNU_CHUNK_T*)h_tpmSM2_p256_p, LEN_P256); \
- } \
- else \
- cpLSR_BNU(BN_NUMBER((r)), BN_NUMBER((a)), LEN_P256, 1); \
- BN_SIGN((r)) = ippBigNumPOS; \
- BN_SIZE((r)) = LEN_P256; \
-}
-
-#define PMAsm2_inv(r,a,modulo) \
-{ \
- ippsModInv_BN((a),(modulo),(r)); \
- ZEXPAND_BNU(BN_NUMBER((r)),BN_SIZE((r)), LEN_P256); \
- BN_SIGN((r)) = ippBigNumPOS; \
- BN_SIZE((r)) = LEN_P256; \
-}
-
-#endif /* _PCP_PMASM2_H */
diff --git a/ext/ipp/sources/ippcp/src/pcpprimeg.h b/ext/ipp/sources/ippcp/src/pcpprimeg.h
deleted file mode 100644
index f5583ca..0000000
--- a/ext/ipp/sources/ippcp/src/pcpprimeg.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-// Intel(R) Integrated Performance Primitives
-// Cryptographic Primitives (ippcp)
-// Prime Number Primitives.
-//
-//
-*/
-
-
-#if !defined(_CP_PRIME_H)
-#define _CP_PRIME_H
-
-#include "pcpbn.h"
-#include "pcpmontgomery.h"
-
-
-/*
-// Prime context
-*/
-struct _cpPrime {
- IppCtxId idCtx; /* Prime context identifier */
- cpSize maxBitSize; /* max bit length */
- BNU_CHUNK_T* pPrime; /* prime value */
- BNU_CHUNK_T* pT1; /* temporary BNU */
- BNU_CHUNK_T* pT2; /* temporary BNU */
- BNU_CHUNK_T* pT3; /* temporary BNU */
- IppsMontState* pMont; /* montgomery engine */
-};
-
-/* alignment */
-#define PRIME_ALIGNMENT ((int)sizeof(void*))
-
-/* Prime accessory macros */
-#define PRIME_ID(ctx) ((ctx)->idCtx)
-#define PRIME_MAXBITSIZE(ctx) ((ctx)->maxBitSize)
-#define PRIME_NUMBER(ctx) ((ctx)->pPrime)
-#define PRIME_TEMP1(ctx) ((ctx)->pT1)
-#define PRIME_TEMP2(ctx) ((ctx)->pT2)
-#define PRIME_TEMP3(ctx) ((ctx)->pT3)
-#define PRIME_MONT(ctx) ((ctx)->pMont)
-
-#define PRIME_VALID_ID(ctx) (PRIME_ID((ctx))==idCtxPrimeNumber)
-
-/* easy prime test */
-int cpMimimalPrimeTest(const Ipp32u* pPrime, cpSize ns);
-
-/* prime test */
-int cpPrimeTest(const BNU_CHUNK_T* pPrime, cpSize primeLen,
- cpSize nTrials,
- IppsPrimeState* pCtx,
- IppBitSupplier rndFunc, void* pRndParam);
-
-void cpPackPrimeCtx(const IppsPrimeState* pCtx, Ipp8u* pBuffer);
-void cpUnpackPrimeCtx(const Ipp8u* pBuffer, IppsPrimeState* pCtx);
-
-#endif /* _CP_PRIME_H */
diff --git a/ext/ipp/sources/ippcp/src/pcpprimeginitca.c b/ext/ipp/sources/ippcp/src/pcpprimeginitca.c
deleted file mode 100644
index 9689d83..0000000
--- a/ext/ipp/sources/ippcp/src/pcpprimeginitca.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-// Purpose:
-// Intel(R) Integrated Performance Primitives. Cryptographic Primitives (ippcp)
-// Prime Number Primitives.
-//
-// Contents:
-// ippsPrimeGetSize()
-// ippsPrimeInit()
-//
-//
-*/
-
-#include "owncp.h"
-#include "pcpprimeg.h"
-#include "pcptool.h"
-
-
-/*F*
-// Name: ippsPrimeGetSize
-//
-// Purpose: Returns size of Prime Number Generator context (bytes).
-//
-// Returns: Reason:
-// ippStsNullPtrErr NULL == pSize
-// ippStsLengthErr 1 > maxBits
-// ippStsNoErr no error
-//
-// Parameters:
-// maxBits max length of a prime number
-// pSize pointer to the size of internal context
-*F*/
-IPPFUN(IppStatus, ippsPrimeGetSize, (cpSize maxBits, cpSize* pSize))
-{
- IPP_BAD_PTR1_RET(pSize);
- IPP_BADARG_RET(maxBits<1, ippStsLengthErr);
-
- {
- cpSize len = BITS_BNU_CHUNK(maxBits);
- cpSize len32 = BITS2WORD32_SIZE(maxBits);
- cpSize montSize;
- ippsMontGetSize(ippBinaryMethod, len32, &montSize);
-
- *pSize = sizeof(IppsPrimeState)
- +len*sizeof(BNU_CHUNK_T)
- +len*sizeof(BNU_CHUNK_T)
- +len*sizeof(BNU_CHUNK_T)
- +len*sizeof(BNU_CHUNK_T)
- +montSize
- +PRIME_ALIGNMENT-1;
-
- return ippStsNoErr;
- }
-}
-
-
-/*F*
-// Name: ippsPrimeInit
-//
-// Purpose: Initializes Prime Number Generator context
-//
-// Returns: Reason:
-// ippStsNullPtrErr NULL == pCtx
-// ippStsLengthErr 1 > maxBits
-// ippStsNoErr no error
-//
-// Parameters:
-// maxBits max length of a prime number
-// pCtx pointer to the context to be initialized
-*F*/
-IPPFUN(IppStatus, ippsPrimeInit, (cpSize maxBits, IppsPrimeState* pCtx))
-{
- IPP_BAD_PTR1_RET(pCtx);
- IPP_BADARG_RET(maxBits<1, ippStsLengthErr);
-
- /* use aligned PRNG context */
- pCtx = (IppsPrimeState*)( IPP_ALIGNED_PTR(pCtx, PRIME_ALIGNMENT) );
-
- {
- Ipp8u* ptr = (Ipp8u*)pCtx;
-
- cpSize len = BITS_BNU_CHUNK(maxBits);
- cpSize len32 = BITS2WORD32_SIZE(maxBits);
-
- PRIME_ID(pCtx) = idCtxPrimeNumber;
- PRIME_MAXBITSIZE(pCtx) = maxBits;
-
- ptr += sizeof(IppsPrimeState);
- PRIME_NUMBER(pCtx) = (BNU_CHUNK_T*)ptr;
-
- ptr += len*sizeof(BNU_CHUNK_T);
- PRIME_TEMP1(pCtx) = (BNU_CHUNK_T*)ptr;
-
- ptr += len*sizeof(BNU_CHUNK_T);
- PRIME_TEMP2(pCtx) = (BNU_CHUNK_T*)ptr;
-
- ptr += len*sizeof(BNU_CHUNK_T);
- PRIME_TEMP3(pCtx) = (BNU_CHUNK_T*)ptr;
-
- ptr += len*sizeof(BNU_CHUNK_T);
- PRIME_MONT(pCtx) = (IppsMontState*)( IPP_ALIGNED_PTR((ptr), MONT_ALIGNMENT) );
- ippsMontInit(ippBinaryMethod, len32, PRIME_MONT(pCtx));
-
- return ippStsNoErr;
- }
-}
-
-
-void cpPackPrimeCtx(const IppsPrimeState* pCtx, Ipp8u* pBuffer)
-{
- IppsPrimeState* pAlignedBuffer = (IppsPrimeState*)( IPP_ALIGNED_PTR(pBuffer, PRIME_ALIGNMENT) );
-
- /* max length of prime */
- cpSize nsPrime = BITS_BNU_CHUNK(PRIME_MAXBITSIZE(pCtx));
-
- CopyBlock(pCtx, pAlignedBuffer, sizeof(IppsPrimeState));
- PRIME_NUMBER(pAlignedBuffer)= (BNU_CHUNK_T*)((Ipp8u*)NULL + IPP_UINT_PTR(PRIME_NUMBER(pCtx))-IPP_UINT_PTR(pCtx));
- PRIME_TEMP1(pAlignedBuffer) = (BNU_CHUNK_T*)((Ipp8u*)NULL + IPP_UINT_PTR(PRIME_TEMP1(pCtx))-IPP_UINT_PTR(pCtx));
- PRIME_TEMP2(pAlignedBuffer) = (BNU_CHUNK_T*)((Ipp8u*)NULL + IPP_UINT_PTR(PRIME_TEMP2(pCtx))-IPP_UINT_PTR(pCtx));
- PRIME_TEMP3(pAlignedBuffer) = (BNU_CHUNK_T*)((Ipp8u*)NULL + IPP_UINT_PTR(PRIME_TEMP3(pCtx))-IPP_UINT_PTR(pCtx));
- PRIME_MONT(pAlignedBuffer) =(IppsMontState*)((Ipp8u*)NULL + IPP_UINT_PTR(PRIME_MONT(pCtx))-IPP_UINT_PTR(pCtx));
-
- CopyBlock(PRIME_NUMBER(pCtx), (Ipp8u*)pAlignedBuffer+IPP_UINT_PTR(PRIME_NUMBER(pAlignedBuffer)), nsPrime*sizeof(BNU_CHUNK_T));
- cpPackMontCtx(PRIME_MONT(pCtx), (Ipp8u*)pAlignedBuffer+IPP_UINT_PTR(PRIME_MONT(pAlignedBuffer)));
-}
-
-void cpUnpackPrimeCtx(const Ipp8u* pBuffer, IppsPrimeState* pCtx)
-{
- IppsPrimeState* pAlignedBuffer = (IppsPrimeState*)( IPP_ALIGNED_PTR(pBuffer, PRIME_ALIGNMENT) );
-
- /* max length of prime */
- cpSize nsPrime = BITS_BNU_CHUNK(PRIME_MAXBITSIZE(pAlignedBuffer));
-
- CopyBlock(pAlignedBuffer, pCtx, sizeof(IppsPrimeState));
- PRIME_NUMBER(pCtx)= (BNU_CHUNK_T*)((Ipp8u*)pCtx+ IPP_UINT_PTR(PRIME_NUMBER(pAlignedBuffer)));
- PRIME_TEMP1(pCtx) = (BNU_CHUNK_T*)((Ipp8u*)pCtx+ IPP_UINT_PTR(PRIME_TEMP1(pAlignedBuffer)));
- PRIME_TEMP2(pCtx) = (BNU_CHUNK_T*)((Ipp8u*)pCtx+ IPP_UINT_PTR(PRIME_TEMP2(pAlignedBuffer)));
- PRIME_TEMP3(pCtx) = (BNU_CHUNK_T*)((Ipp8u*)pCtx+ IPP_UINT_PTR(PRIME_TEMP3(pAlignedBuffer)));
- PRIME_MONT(pCtx) = (IppsMontState*)((Ipp8u*)pCtx+ IPP_UINT_PTR(PRIME_MONT(pAlignedBuffer)));
-
- CopyBlock((Ipp8u*)pAlignedBuffer+IPP_UINT_PTR(PRIME_NUMBER(pAlignedBuffer)), PRIME_NUMBER(pCtx), nsPrime*sizeof(BNU_CHUNK_T));
- cpUnpackMontCtx((Ipp8u*)pAlignedBuffer+IPP_UINT_PTR(PRIME_MONT(pAlignedBuffer)), PRIME_MONT(pCtx));
-}
diff --git a/ext/ipp/sources/ippcp/src/pcpprng.h b/ext/ipp/sources/ippcp/src/pcpprng.h
index 4d236ae..80b2bc9 100644
--- a/ext/ipp/sources/ippcp/src/pcpprng.h
+++ b/ext/ipp/sources/ippcp/src/pcpprng.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2002-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -54,6 +54,7 @@ struct _cpPRNG {
#define RAND_VALID_ID(ctx) (RAND_ID((ctx))==idCtxPRNG)
+#define cpPRNGen OWNAPI(cpPRNGen)
int cpPRNGen(Ipp32u* pBuffer, cpSize bitLen, IppsPRNGState* pCtx);
#endif /* _CP_PRNG_H */
diff --git a/ext/ipp/sources/ippcp/src/pcpprngenca.c b/ext/ipp/sources/ippcp/src/pcpprngenca.c
index e3204f7..2f2377d 100644
--- a/ext/ipp/sources/ippcp/src/pcpprngenca.c
+++ b/ext/ipp/sources/ippcp/src/pcpprngenca.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2004-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
#include "pcpbn.h"
@@ -51,23 +51,13 @@ static
void SHA1_G(Ipp32u* xBNU, const Ipp32u* T, Ipp8u* pHexStr, int hexStrLen)
{
/* select processing function */
-#if 0
- cpHashProc updateFunc = UpdateSHA1;
- #if (_IPP>=_IPP_P8) || (_IPP32E>=_IPP32E_Y8)
- if( IsFeatureEnabled(SHA_NI_ENABLED) )
- updateFunc = UpdateSHA1ni;
- #endif
-#endif
cpHashProc updateFunc;
#if (_SHA_NI_ENABLING_==_FEATURE_ON_)
updateFunc = UpdateSHA1ni;
+ #elif (_SHA_NI_ENABLING_==_FEATURE_TICKTOCK_)
+ updateFunc = IsFeatureEnabled(SHA_NI_ENABLED)? UpdateSHA1ni : UpdateSHA1;
#else
- #if (_SHA_NI_ENABLING_==_FEATURE_TICKTOCK_)
- if( IsFeatureEnabled(SHA_NI_ENABLED) )
- updateFunc = UpdateSHA1ni;
- else
- #endif
- updateFunc = UpdateSHA1;
+ updateFunc = UpdateSHA1;
#endif
/* pad HexString zeros */
diff --git a/ext/ipp/sources/ippcp/src/pcpprnginitca.c b/ext/ipp/sources/ippcp/src/pcpprnginitca.c
index cf52eb0..da4d8a0 100644
--- a/ext/ipp/sources/ippcp/src/pcpprnginitca.c
+++ b/ext/ipp/sources/ippcp/src/pcpprnginitca.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2004-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
#include "pcpbn.h"
diff --git a/ext/ipp/sources/ippcp/src/pcpprngsetca.c b/ext/ipp/sources/ippcp/src/pcpprngsetca.c
index f57c2e2..6f2b8c7 100644
--- a/ext/ipp/sources/ippcp/src/pcpprngsetca.c
+++ b/ext/ipp/sources/ippcp/src/pcpprngsetca.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2004-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
#include "pcpbn.h"
diff --git a/ext/ipp/sources/ippcp/src/pcpsha1ca.c b/ext/ipp/sources/ippcp/src/pcpsha1ca.c
deleted file mode 100644
index 81d28a1..0000000
--- a/ext/ipp/sources/ippcp/src/pcpsha1ca.c
+++ /dev/null
@@ -1,551 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// Digesting message according to SHA1
-//
-// Contents:
-// - ippsSHA1GetSize()
-// - ippsSHA1Init()
-// - ippsSHA1Pack()
-// - ippsSHA1Unpack()
-// - ippsSHA1Duplicate()
-// - ippsSHA1Update()
-// - ippsSHA1GetTag()
-// - ippsSHA1Final()
-// ippsSHA1MessageDigest()
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-#include "pcphash.h"
-#include "pcptool.h"
-
-
-#if !defined (_ENABLE_ALG_SHA1_)
-#pragma message("IPP_ALG_HASH_SHA1 disabled")
-#else
-#pragma message("IPP_ALG_HASH_SHA1 enabled")
-
-/*
-// Init SHA1 digest
-*/
-IppStatus InitSHA1(IppsSHA1State* pState)
-{
- /* test state pointer */
- IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
- pState = (IppsSHA1State*)( IPP_ALIGNED_PTR(pState, SHA1_ALIGNMENT) );
-
- /* set state ID */
- SHS_ID(pState) = idCtxSHA1;
-
- /* zeros message length */
- SHS_LENL(pState) = 0;
-
- /* message buffer is free */
- SHS_INDX(pState) = 0;
-
- /* setup initial digest */
- SHS_HASH(pState)[0] = SHA1_IV[0];
- SHS_HASH(pState)[1] = SHA1_IV[1];
- SHS_HASH(pState)[2] = SHA1_IV[2];
- SHS_HASH(pState)[3] = SHA1_IV[3];
- SHS_HASH(pState)[4] = SHA1_IV[4];
-
- return ippStsNoErr;
-}
-
-
-/*F*
-// Name: ippsSHA1GetSize
-//
-// Purpose: Returns size (bytes) of IppsSHA1State state.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pSize == NULL
-// ippStsNoErr no errors
-//
-// Parameters:
-// pSize pointer to state size
-//
-*F*/
-IPPFUN(IppStatus, ippsSHA1GetSize,(int* pSize))
-{
- /* test pointer */
- IPP_BAD_PTR1_RET(pSize);
-
- *pSize = sizeof(IppsSHA1State) +(SHA1_ALIGNMENT-1);
-
- return ippStsNoErr;
-}
-
-
-/*F*
-// Name: ippsSHA1Init
-//
-// Purpose: Init SHA1 state.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pState == NULL
-// ippStsNoErr no errors
-//
-// Parameters:
-// pState pointer to the SHA1 state
-//
-*F*/
-IPPFUN(IppStatus, ippsSHA1Init,(IppsSHA1State* pState))
-{
- return InitSHA1(pState);
-}
-
-
-/*F*
-// Name: ippsSHA1Pack
-//
-// Purpose: Copy initialized context to the buffer.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pSize == NULL
-// pCtx == NULL
-// ippStsNoErr no errors
-//
-// Parameters:
-// pCtx pointer hach state
-// pSize pointer to the packed spec size
-//
-*F*/
-IPPFUN(IppStatus, ippsSHA1Pack,(const IppsSHA1State* pCtx, Ipp8u* pBuffer))
-{
- /* test pointers */
- IPP_BAD_PTR2_RET(pCtx, pBuffer);
- /* use aligned context */
- pCtx = (IppsSHA1State*)( IPP_ALIGNED_PTR(pCtx, SHA1_ALIGNMENT) );
- /* test the context */
- IPP_BADARG_RET(idCtxSHA1 !=SHS_ID(pCtx), ippStsContextMatchErr);
-
- CopyBlock(pCtx, pBuffer, sizeof(IppsSHA1State));
- return ippStsNoErr;
-}
-
-
-/*F*
-// Name: ippsSHA1Unpack
-//
-// Purpose: Unpack buffer content into the initialized context.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pSize == NULL
-// pCtx == NULL
-// ippStsNoErr no errors
-//
-// Parameters:
-// pCtx pointer hash state
-// pSize pointer to the packed spec size
-//
-*F*/
-IPPFUN(IppStatus, ippsSHA1Unpack,(const Ipp8u* pBuffer, IppsSHA1State* pCtx))
-{
- /* test pointers */
- IPP_BAD_PTR2_RET(pCtx, pBuffer);
- /* use aligned context */
- pCtx = (IppsSHA1State*)( IPP_ALIGNED_PTR(pCtx, SHA1_ALIGNMENT) );
-
- CopyBlock(pBuffer, pCtx, sizeof(IppsSHA1State));
- return ippStsNoErr;
-}
-
-
-/*F*
-// Name: ippsSHA1Duplicate
-//
-// Purpose: Clone SHA1 state.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pSrcState == NULL
-// pDstState == NULL
-// ippStsContextMatchErr pSrcState->idCtx != idCtxSHA1
-// pDstState->idCtx != idCtxSHA1
-// ippStsNoErr no errors
-//
-// Parameters:
-// pSrcState pointer to the source SHA1 state
-// pDstState pointer to the target SHA1 state
-//
-// Note:
-// pDstState may to be uninitialized by ippsSHA1Init()
-//
-*F*/
-IPPFUN(IppStatus, ippsSHA1Duplicate,(const IppsSHA1State* pSrcState, IppsSHA1State* pDstState))
-{
- /* test state pointers */
- IPP_BAD_PTR2_RET(pSrcState, pDstState);
- /* use aligned context */
- pSrcState = (IppsSHA1State*)( IPP_ALIGNED_PTR(pSrcState, SHA1_ALIGNMENT) );
- pDstState = (IppsSHA1State*)( IPP_ALIGNED_PTR(pDstState, SHA1_ALIGNMENT) );
- /* test states ID */
- IPP_BADARG_RET(idCtxSHA1 !=SHS_ID(pSrcState), ippStsContextMatchErr);
- //IPP_BADARG_RET(idCtxSHA1 !=SHS_ID(pDstState), ippStsContextMatchErr);
-
- /* copy state */
- CopyBlock(pSrcState, pDstState, sizeof(IppsSHA1State));
-
- return ippStsNoErr;
-}
-
-
-/*F*
-// Name: ippsSHA1Update
-//
-// Purpose: Updates intermadiate digest based on input stream.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pSrc == NULL
-// pState == NULL
-// ippStsContextMatchErr pState->idCtx != idCtxSHA1
-// ippStsLengthErr len <0
-// ippStsNoErr no errors
-//
-// Parameters:
-// pSrc pointer to the input stream
-// len input stream length
-// pState pointer to the SHA1 state
-//
-*F*/
-IPPFUN(IppStatus, ippsSHA1Update,(const Ipp8u* pSrc, int len, IppsSHA1State* pState))
-{
- /* test state pointer and ID */
- IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
- pState = (IppsSHA1State*)( IPP_ALIGNED_PTR(pState, SHA1_ALIGNMENT) );
- /* test state ID */
- IPP_BADARG_RET(idCtxSHA1 !=SHS_ID(pState), ippStsContextMatchErr);
-
- /* test input length */
- IPP_BADARG_RET((len<0), ippStsLengthErr);
- /* test source pointer */
- IPP_BADARG_RET((len && !pSrc), ippStsNullPtrErr);
-
- /*
- // handle non empty message
- */
- if(len) {
- int processingLen;
-
- int n = SHS_INDX(pState);
- Ipp8u* pBuffer = SHS_BUFF(pState);
- Ipp8u* pHash = (Ipp8u*)SHS_HASH(pState);
-
- Ipp64u lenLo = SHS_LENL(pState);
-
- /* select processing function */
-#if 0
- cpHashProc updateFunc = UpdateSHA1;
- #if (_IPP>=_IPP_P8) || (_IPP32E>=_IPP32E_Y8)
- if( IsFeatureEnabled(SHA_NI_ENABLED) )
- updateFunc = UpdateSHA1ni;
- #endif
-#endif
- cpHashProc updateFunc;
- #if (_SHA_NI_ENABLING_==_FEATURE_ON_)
- updateFunc = UpdateSHA1ni;
- #else
- #if (_SHA_NI_ENABLING_==_FEATURE_TICKTOCK_)
- if( IsFeatureEnabled(SHA_NI_ENABLED) )
- updateFunc = UpdateSHA1ni;
- else
- #endif
- updateFunc = UpdateSHA1;
- #endif
-
- lenLo += len;
-
- /* if non empty internal buffer filling */
- if(n) {
- /* copy from input stream to the internal buffer as match as possible */
- processingLen = IPP_MIN(len, (MBS_SHA1-n));
- CopyBlock(pSrc, pBuffer+n, processingLen);
-
- pSrc += processingLen;
- len -= processingLen;
- SHS_INDX(pState) = n += processingLen;
-
- /* update digest if buffer full */
- if( MBS_SHA1 == n) {
- updateFunc(pHash, pBuffer, MBS_SHA1, SHA1_cnt);
- SHS_INDX(pState) = 0;
- }
- }
-
- /* main message part processing */
- processingLen = len & ~(MBS_SHA1-1);
- if(processingLen) {
- updateFunc(pHash, pSrc, processingLen, SHA1_cnt);
- pSrc += processingLen;
- len -= processingLen;
- }
-
- /* store rest of message into the internal buffer */
- if(len) {
- CopyBlock(pSrc, pBuffer, len);
- SHS_INDX(pState) += len;
- }
-
- SHS_LENL(pState) = lenLo;
- }
-
- return ippStsNoErr;
-}
-
-
-/*
-// Compute digest
-*/
-void ComputeDigestSHA1(Ipp32u* pHash, const IppsSHA1State* pState)
-{
- const Ipp8u* stateBuff = SHS_BUFF(pState);
- int stateBuffLen = SHS_INDX(pState);
-
- /* local buffer and it length */
- Ipp8u buffer[MBS_SHA1*2];
- int bufferLen = stateBuffLen < (MBS_SHA1-(int)sizeof(Ipp64u))? MBS_SHA1 : MBS_SHA1*2;
-
- /* select processing function */
-#if 0
- cpHashProc updateFunc = UpdateSHA1;
- #if (_IPP>=_IPP_P8) || (_IPP32E>=_IPP32E_Y8)
- if( IsFeatureEnabled(SHA_NI_ENABLED) )
- updateFunc = UpdateSHA1ni;
- #endif
-#endif
- cpHashProc updateFunc;
- #if (_SHA_NI_ENABLING_==_FEATURE_ON_)
- updateFunc = UpdateSHA1ni;
- #else
- #if (_SHA_NI_ENABLING_==_FEATURE_TICKTOCK_)
- if( IsFeatureEnabled(SHA_NI_ENABLED) )
- updateFunc = UpdateSHA1ni;
- else
- #endif
- updateFunc = UpdateSHA1;
- #endif
-
- /* copy rest of message into internal buffer */
- CopyBlock(stateBuff, buffer, stateBuffLen);
-
- /* padd message */
- buffer[stateBuffLen++] = 0x80;
- PaddBlock(0, buffer+stateBuffLen, bufferLen-stateBuffLen-sizeof(Ipp64u));
-
- /* message length representation */
- {
- Ipp64u lo = SHS_LENL(pState); /* message length in bytes */
- lo = LSL64(lo,3); /* message length in bits */
- ((Ipp64u*)(buffer+bufferLen))[-1] = ENDIANNESS64(lo);
- }
-
- /* copmplete hash computation */
- updateFunc(pHash, buffer, bufferLen, SHA1_cnt);
-
- /* convert hash into big endian */
- pHash[0] = ENDIANNESS32(pHash[0]);
- pHash[1] = ENDIANNESS32(pHash[1]);
- pHash[2] = ENDIANNESS32(pHash[2]);
- pHash[3] = ENDIANNESS32(pHash[3]);
- pHash[4] = ENDIANNESS32(pHash[4]);
-}
-
-
-/*F*
-// Name: ippsSHA1GetTag
-//
-// Purpose: Compute digest based on current state.
-// Note, that futher digest update is possible
-//
-// Returns: Reason:
-// ippStsNullPtrErr pTag == NULL
-// pState == NULL
-// ippStsContextMatchErr pState->idCtx != idCtxSHA1
-// ippStsLengthErr max_SHA_digestLen < tagLen <1
-// ippStsNoErr no errors
-//
-// Parameters:
-// pTag address of the output digest
-// tagLen length of digest
-// pState pointer to the SHS state
-//
-*F*/
-IPPFUN(IppStatus, ippsSHA1GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA1State* pState))
-{
- /* test state pointer and ID */
- IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
- pState = (IppsSHA1State*)( IPP_ALIGNED_PTR(pState, SHA1_ALIGNMENT) );
- /* test state ID */
- IPP_BADARG_RET(idCtxSHA1 !=SHS_ID(pState), ippStsContextMatchErr);
-
- /* test digest pointer */
- IPP_BAD_PTR1_RET(pTag);
- IPP_BADARG_RET((tagLen<1)||(sizeof(DigestSHA1)<tagLen), ippStsLengthErr);
-
- {
- DigestSHA1 digest;
-
- CopyBlock(SHS_HASH(pState), digest, sizeof(DigestSHA1));
- ComputeDigestSHA1(digest, pState);
- CopyBlock(digest, pTag, tagLen);
-
- return ippStsNoErr;
- }
-}
-
-
-/*F*
-// Name: ippsSHA1Final
-//
-// Purpose: Stop message digesting and return digest.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pMD == NULL
-// pState == NULL
-// ippStsContextMatchErr pState->idCtx != idCtxSHA1
-// ippStsNoErr no errors
-//
-// Parameters:
-// pMD address of the output digest
-// pState pointer to the SHS state
-//
-*F*/
-IPPFUN(IppStatus, ippsSHA1Final,(Ipp8u* pMD, IppsSHA1State* pState))
-{
- /* test state pointer and ID */
- IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
- pState = (IppsSHA1State*)( IPP_ALIGNED_PTR(pState, SHA1_ALIGNMENT) );
- /* test state ID */
- IPP_BADARG_RET(idCtxSHA1 !=SHS_ID(pState), ippStsContextMatchErr);
-
- /* test digest pointer */
- IPP_BAD_PTR1_RET(pMD);
-
- ComputeDigestSHA1(SHS_HASH(pState), pState);
- CopyBlock(SHS_HASH(pState), pMD, sizeof(DigestSHA1));
- InitSHA1(pState);
-
- return ippStsNoErr;
-}
-
-
-/*F*
-// Name: ippsSHA1MessageDigest
-//
-// Purpose: Digest of the whole message.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pMsg == NULL
-// pMD == NULL
-// ippStsLengthErr len <0
-// ippStsNoErr no errors
-//
-// Parameters:
-// pMsg pointer to the input message
-// len input message length
-// pMD address of the output digest
-//
-*F*/
-IPPFUN(IppStatus, ippsSHA1MessageDigest,(const Ipp8u* pMsg, int msgLen, Ipp8u* pMD))
-{
- /* test digest pointer */
- IPP_BAD_PTR1_RET(pMD);
- /* test message length */
- IPP_BADARG_RET((msgLen<0), ippStsLengthErr);
- /* test message pointer */
- IPP_BADARG_RET((msgLen && !pMsg), ippStsNullPtrErr);
-
- {
- /* message length in the multiple MBS and the rest */
- int msgLenBlks = msgLen & (-MBS_SHA1);
- int msgLenRest = msgLen - msgLenBlks;
-
- /* init hash value */
- DigestSHA1 hash = {0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0};
-
- /* select processing function */
-#if 0
- cpHashProc updateFunc = UpdateSHA1;
- #if (_IPP>=_IPP_P8) || (_IPP32E>=_IPP32E_Y8)
- if( IsFeatureEnabled(SHA_NI_ENABLED) )
- updateFunc = UpdateSHA1ni;
- #endif
-#endif
- cpHashProc updateFunc;
- #if (_SHA_NI_ENABLING_==_FEATURE_ON_)
- updateFunc = UpdateSHA1ni;
- #else
- #if (_SHA_NI_ENABLING_==_FEATURE_TICKTOCK_)
- if( IsFeatureEnabled(SHA_NI_ENABLED) )
- updateFunc = UpdateSHA1ni;
- else
- #endif
- updateFunc = UpdateSHA1;
- #endif
-
- /* process main part of the message */
- if(msgLenBlks)
- updateFunc(hash, pMsg, msgLenBlks, SHA1_cnt);
-
- /* process message padding */
- {
- #define MREP_SIZE_SHA1 (sizeof(Ipp64u))
- Ipp8u buffer[MBS_SHA1*2];
- int bufferLen = msgLenRest < (int)(MBS_SHA1-MREP_SIZE_SHA1)? MBS_SHA1 : MBS_SHA1*2;
-
- /* message bitlength representation */
- Ipp64u msgLenBits = (Ipp64u)msgLen*8;
- msgLenBits = ENDIANNESS64(msgLenBits);
-
- /* copy end of message */
- CopyBlock(pMsg+msgLen-msgLenRest, buffer, msgLenRest);
-
- /* end of message bit */
- buffer[msgLenRest++] = 0x80;
-
- /* padd buffer */
- PaddBlock(0, buffer+msgLenRest, bufferLen-msgLenRest-MREP_SIZE_SHA1);
- /* copy message bitlength representation */
- ((Ipp64u*)(buffer+bufferLen))[-1] = msgLenBits;
-
- updateFunc(hash, buffer, bufferLen, SHA1_cnt);
- #undef MREP_SIZE_SHA1
- }
-
- /* swap hash bytes */
- ((Ipp32u*)pMD)[0] = ENDIANNESS32(hash[0]);
- ((Ipp32u*)pMD)[1] = ENDIANNESS32(hash[1]);
- ((Ipp32u*)pMD)[2] = ENDIANNESS32(hash[2]);
- ((Ipp32u*)pMD)[3] = ENDIANNESS32(hash[3]);
- ((Ipp32u*)pMD)[4] = ENDIANNESS32(hash[4]);
-
- return ippStsNoErr;
- }
-}
-
-#endif /* _ENABLE_ALG_SHA1_ */
diff --git a/ext/ipp/sources/ippcp/src/pcpsha256ca.c b/ext/ipp/sources/ippcp/src/pcpsha256ca.c
index ae20f91..414e1b6 100644
--- a/ext/ipp/sources/ippcp/src/pcpsha256ca.c
+++ b/ext/ipp/sources/ippcp/src/pcpsha256ca.c
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2002-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -34,68 +34,137 @@
//
*/
-#include "precomp.h"
+#include "owndefs.h"
#include "owncp.h"
#include "pcphash.h"
+#include "pcphash_rmf.h"
#include "pcptool.h"
+/* SHA-256, SHA-224 constants */
+static const Ipp32u sha256_iv[] = {
+ 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A,
+ 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19};
+static const Ipp32u sha224_iv[] = {
+ 0xC1059ED8, 0x367CD507, 0x3070DD17, 0xF70E5939,
+ 0xFFC00B31, 0x68581511, 0x64F98FA7, 0xBEFA4FA4};
+
+static __ALIGN16 const Ipp32u sha256_cnt[] = {
+ 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
+ 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
+ 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
+ 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
+ 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
+ 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
+ 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
+ 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
+ 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
+ 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
+ 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
+ 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
+ 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
+ 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
+ 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
+ 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
+};
+
+
+/* setup init hash value */
+__INLINE void hashInit(Ipp32u* pHash, const Ipp32u* iv)
+{
+ pHash[0] = iv[0];
+ pHash[1] = iv[1];
+ pHash[2] = iv[2];
+ pHash[3] = iv[3];
+ pHash[4] = iv[4];
+ pHash[5] = iv[5];
+ pHash[6] = iv[6];
+ pHash[7] = iv[7];
+}
+void sha256_hashInit(void* pHash)
+{
+ hashInit((Ipp32u*)pHash, sha256_iv);
+}
+void sha224_hashInit(void* pHash)
+{
+ hashInit((Ipp32u*)pHash, sha224_iv);
+}
-#if !defined(_ENABLE_ALG_SHA256_)
-#pragma message("IPP_ALG_HASH_SHA256 disabled")
-#else
-#pragma message("IPP_ALG_HASH_SHA256 enabled")
+void sha256_hashUpdate(void* pHash, const Ipp8u* pMsg, int msgLen)
+{
+ UpdateSHA256(pHash, pMsg, msgLen, sha256_cnt);
+}
+#if (_SHA_NI_ENABLING_==_FEATURE_TICKTOCK_ || _SHA_NI_ENABLING_==_FEATURE_ON_)
+void sha256_ni_hashUpdate(void* pHash, const Ipp8u* pMsg, int msgLen)
+{
+ UpdateSHA256ni(pHash, pMsg, msgLen, sha256_cnt);
+}
#endif
-#if !defined(_ENABLE_ALG_SHA224_)
-#pragma message("IPP_ALG_HASH_SHA224 disabled")
-#else
-#pragma message("IPP_ALG_HASH_SHA224 enabled")
-#endif
+/* convert hash into big endian */
+void sha256_hashOctString(Ipp8u* pMD, void* pHashVal)
+{
+ /* convert hash into big endian */
+ ((Ipp32u*)pMD)[0] = ENDIANNESS32(((Ipp32u*)pHashVal)[0]);
+ ((Ipp32u*)pMD)[1] = ENDIANNESS32(((Ipp32u*)pHashVal)[1]);
+ ((Ipp32u*)pMD)[2] = ENDIANNESS32(((Ipp32u*)pHashVal)[2]);
+ ((Ipp32u*)pMD)[3] = ENDIANNESS32(((Ipp32u*)pHashVal)[3]);
+ ((Ipp32u*)pMD)[4] = ENDIANNESS32(((Ipp32u*)pHashVal)[4]);
+ ((Ipp32u*)pMD)[5] = ENDIANNESS32(((Ipp32u*)pHashVal)[5]);
+ ((Ipp32u*)pMD)[6] = ENDIANNESS32(((Ipp32u*)pHashVal)[6]);
+ ((Ipp32u*)pMD)[7] = ENDIANNESS32(((Ipp32u*)pHashVal)[7]);
+}
+void sha224_hashOctString(Ipp8u* pMD, void* pHashVal)
+{
+ /* convert hash into big endian */
+ ((Ipp32u*)pMD)[0] = ENDIANNESS32(((Ipp32u*)pHashVal)[0]);
+ ((Ipp32u*)pMD)[1] = ENDIANNESS32(((Ipp32u*)pHashVal)[1]);
+ ((Ipp32u*)pMD)[2] = ENDIANNESS32(((Ipp32u*)pHashVal)[2]);
+ ((Ipp32u*)pMD)[3] = ENDIANNESS32(((Ipp32u*)pHashVal)[3]);
+ ((Ipp32u*)pMD)[4] = ENDIANNESS32(((Ipp32u*)pHashVal)[4]);
+ ((Ipp32u*)pMD)[5] = ENDIANNESS32(((Ipp32u*)pHashVal)[5]);
+ ((Ipp32u*)pMD)[6] = ENDIANNESS32(((Ipp32u*)pHashVal)[6]);
+}
+
+void sha256_msgRep(Ipp8u* pDst, Ipp64u lenLo, Ipp64u lenHi)
+{
+ UNREFERENCED_PARAMETER(lenHi);
+ lenLo = ENDIANNESS64(lenLo<<3);
+ ((Ipp64u*)(pDst))[0] = lenLo;
+}
/*
// SHA256 init context
*/
-#if defined (_ENABLE_ALG_SHA256_) || defined (_ENABLE_ALG_SHA224_)
-IppStatus GetSizeSHA256(int* pSize)
+static IppStatus GetSizeSHA256(int* pSize)
{
- /* test pointer */
IPP_BAD_PTR1_RET(pSize);
-
*pSize = sizeof(IppsSHA256State) +(SHA256_ALIGNMENT-1);
-
return ippStsNoErr;
}
-IppStatus InitSHA256(const DigestSHA256 IV, IppsSHA256State* pState)
+static IppStatus InitSHA256(IppsSHA256State* pState, const DigestSHA256 IV)
{
/* test state pointer */
IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
pState = (IppsSHA256State*)( IPP_ALIGNED_PTR(pState, SHA256_ALIGNMENT) );
- /* set state ID */
- SHS_ID(pState) = idCtxSHA256;
-
- /* zeros message length */
- SHS_LENL(pState) = 0;
-
- /* message buffer is free */
- SHS_INDX(pState) = 0;
+ HASH_CTX_ID(pState) = idCtxSHA256;
+ HASH_LENLO(pState) = 0;
+ HAHS_BUFFIDX(pState) = 0;
/* setup initial digest */
- SHS_HASH(pState)[0] = IV[0];
- SHS_HASH(pState)[1] = IV[1];
- SHS_HASH(pState)[2] = IV[2];
- SHS_HASH(pState)[3] = IV[3];
- SHS_HASH(pState)[4] = IV[4];
- SHS_HASH(pState)[5] = IV[5];
- SHS_HASH(pState)[6] = IV[6];
- SHS_HASH(pState)[7] = IV[7];
+ HASH_VALUE(pState)[0] = IV[0];
+ HASH_VALUE(pState)[1] = IV[1];
+ HASH_VALUE(pState)[2] = IV[2];
+ HASH_VALUE(pState)[3] = IV[3];
+ HASH_VALUE(pState)[4] = IV[4];
+ HASH_VALUE(pState)[5] = IV[5];
+ HASH_VALUE(pState)[6] = IV[6];
+ HASH_VALUE(pState)[7] = IV[7];
return ippStsNoErr;
}
-#endif
/*F*
// Name: ippsSHA256GetSize
@@ -111,19 +180,14 @@ IppStatus InitSHA256(const DigestSHA256 IV, IppsSHA256State* pState)
// pSize pointer to state size
//
*F*/
-#if defined (_ENABLE_ALG_SHA256_)
IPPFUN(IppStatus, ippsSHA256GetSize,(int* pSize))
{
return GetSizeSHA256(pSize);
}
-#endif
-
-#if defined (_ENABLE_ALG_SHA224_)
IPPFUN(IppStatus, ippsSHA224GetSize,(int* pSize))
{
return GetSizeSHA256(pSize);
}
-#endif
/*F*
@@ -140,19 +204,14 @@ IPPFUN(IppStatus, ippsSHA224GetSize,(int* pSize))
// pState pointer to the SHA512 state
//
*F*/
-#if defined (_ENABLE_ALG_SHA256_)
IPPFUN(IppStatus, ippsSHA256Init,(IppsSHA256State* pState))
{
- return InitSHA256(SHA256_IV, pState);
+ return InitSHA256(pState, sha256_iv);
}
-#endif
-
-#if defined (_ENABLE_ALG_SHA224_)
IPPFUN(IppStatus, ippsSHA224Init,(IppsSHA224State* pState))
{
- return InitSHA256(SHA224_IV, pState);
+ return InitSHA256(pState, sha224_iv);
}
-#endif
/*F*
@@ -163,35 +222,30 @@ IPPFUN(IppStatus, ippsSHA224Init,(IppsSHA224State* pState))
//
// Returns: Reason:
// ippStsNullPtrErr pSize == NULL
-// pCtx == NULL
+// pBuffer == NULL
// ippStsNoErr no errors
//
// Parameters:
-// pCtx pointer hash state
-// pSize pointer to the packed spec size
+// pCtx pointer to the hash state
+// pBuffer pointer to the destination buffer
//
*F*/
-#if defined (_ENABLE_ALG_SHA256_) || defined (_ENABLE_ALG_SHA224_)
IPPFUN(IppStatus, ippsSHA256Pack,(const IppsSHA256State* pCtx, Ipp8u* pBuffer))
{
/* test pointers */
IPP_BAD_PTR2_RET(pCtx, pBuffer);
- /* use aligned context */
pCtx = (IppsSHA256State*)( IPP_ALIGNED_PTR(pCtx, SHA256_ALIGNMENT) );
- /* test the context */
- IPP_BADARG_RET(idCtxSHA256 !=SHS_ID(pCtx), ippStsContextMatchErr);
+ IPP_BADARG_RET(idCtxSHA256 !=HASH_CTX_ID(pCtx), ippStsContextMatchErr);
CopyBlock(pCtx, pBuffer, sizeof(IppsSHA256State));
return ippStsNoErr;
}
-#endif
-#if defined (_ENABLE_ALG_SHA224_)
IPPFUN(IppStatus, ippsSHA224Pack,(const IppsSHA224State* pCtx, Ipp8u* pBuffer))
{
return ippsSHA256Pack(pCtx, pBuffer);
}
-#endif
+
/*F*
// Name: ippsSHA256Unpack
@@ -201,33 +255,28 @@ IPPFUN(IppStatus, ippsSHA224Pack,(const IppsSHA224State* pCtx, Ipp8u* pBuffer))
//
// Returns: Reason:
// ippStsNullPtrErr pSize == NULL
-// pCtx == NULL
+// pBuffer == NULL
// ippStsNoErr no errors
//
// Parameters:
+// pBuffer pointer to the input buffer
// pCtx pointer hash state
-// pSize pointer to the packed spec size
//
*F*/
-#if defined (_ENABLE_ALG_SHA256_) || defined (_ENABLE_ALG_SHA224_)
IPPFUN(IppStatus, ippsSHA256Unpack,(const Ipp8u* pBuffer, IppsSHA256State* pCtx))
{
/* test pointers */
IPP_BAD_PTR2_RET(pCtx, pBuffer);
- /* use aligned context */
pCtx = (IppsSHA256State*)( IPP_ALIGNED_PTR(pCtx, SHA256_ALIGNMENT) );
CopyBlock(pBuffer, pCtx, sizeof(IppsSHA256State));
return ippStsNoErr;
}
-#endif
-#if defined (_ENABLE_ALG_SHA224_)
IPPFUN(IppStatus, ippsSHA224Unpack,(const Ipp8u* pBuffer, IppsSHA224State* pCtx))
{
return ippsSHA256Unpack(pBuffer, pCtx);
}
-#endif
/*F*
@@ -251,31 +300,25 @@ IPPFUN(IppStatus, ippsSHA224Unpack,(const Ipp8u* pBuffer, IppsSHA224State* pCtx)
// pDstState may to be uninitialized by ippsSHA256Init()
//
*F*/
-#if defined (_ENABLE_ALG_SHA256_) || defined (_ENABLE_ALG_SHA224_)
IPPFUN(IppStatus, ippsSHA256Duplicate,(const IppsSHA256State* pSrcState, IppsSHA256State* pDstState))
{
/* test state pointers */
IPP_BAD_PTR2_RET(pSrcState, pDstState);
- /* use aligned context */
pSrcState = (IppsSHA256State*)( IPP_ALIGNED_PTR(pSrcState, SHA256_ALIGNMENT) );
pDstState = (IppsSHA256State*)( IPP_ALIGNED_PTR(pDstState, SHA256_ALIGNMENT) );
/* test states ID */
- IPP_BADARG_RET(idCtxSHA256 !=SHS_ID(pSrcState), ippStsContextMatchErr);
- //IPP_BADARG_RET(idCtxSHA256 !=SHS_ID(pDstState), ippStsContextMatchErr);
+ IPP_BADARG_RET(idCtxSHA256 !=HASH_CTX_ID(pSrcState), ippStsContextMatchErr);
/* copy state */
CopyBlock(pSrcState, pDstState, sizeof(IppsSHA256State));
return ippStsNoErr;
}
-#endif
-#if defined (_ENABLE_ALG_SHA224_)
IPPFUN(IppStatus, ippsSHA224Duplicate,(const IppsSHA224State* pSrcState, IppsSHA224State* pDstState))
{
return ippsSHA256Duplicate(pSrcState, pDstState);
}
-#endif
/*F*
@@ -297,15 +340,12 @@ IPPFUN(IppStatus, ippsSHA224Duplicate,(const IppsSHA224State* pSrcState, IppsSHA
// pState pointer to the SHA256 state
//
*F*/
-#if defined (_ENABLE_ALG_SHA256_) || defined (_ENABLE_ALG_SHA224_)
IPPFUN(IppStatus, ippsSHA256Update,(const Ipp8u* pSrc, int len, IppsSHA256State* pState))
{
/* test state pointer and ID */
IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
pState = (IppsSHA256State*)( IPP_ALIGNED_PTR(pState, SHA256_ALIGNMENT) );
- /* test state ID */
- IPP_BADARG_RET(idCtxSHA256 !=SHS_ID(pState), ippStsContextMatchErr);
+ IPP_BADARG_RET(idCtxSHA256 !=HASH_CTX_ID(pState), ippStsContextMatchErr);
/* test input length */
IPP_BADARG_RET((len<0), ippStsLengthErr);
@@ -316,280 +356,252 @@ IPPFUN(IppStatus, ippsSHA256Update,(const Ipp8u* pSrc, int len, IppsSHA256State*
// handle non empty message
*/
if(len) {
- int processingLen;
-
- int n = SHS_INDX(pState);
- Ipp8u* pBuffer = SHS_BUFF(pState);
- Ipp8u* pHash = (Ipp8u*)SHS_HASH(pState);
-
- Ipp64u lenLo = SHS_LENL(pState);
-
/* select processing function */
-#if 0
- cpHashProc updateFunc = UpdateSHA256;
- #if (_IPP>=_IPP_P8) || (_IPP32E>=_IPP32E_Y8)
- if( IsFeatureEnabled(SHA_NI_ENABLED) )
- updateFunc = UpdateSHA256ni;
- #endif
-#endif
- cpHashProc updateFunc;
#if (_SHA_NI_ENABLING_==_FEATURE_ON_)
- updateFunc = UpdateSHA256ni;
+ cpHashProc updateFunc = UpdateSHA256ni;
+ #elif (_SHA_NI_ENABLING_==_FEATURE_TICKTOCK_)
+ cpHashProc updateFunc = IsFeatureEnabled(SHA_NI_ENABLED)? UpdateSHA256ni : UpdateSHA256;
#else
- #if (_SHA_NI_ENABLING_==_FEATURE_TICKTOCK_)
- if( IsFeatureEnabled(SHA_NI_ENABLED) )
- updateFunc = UpdateSHA256ni;
- else
- #endif
- updateFunc = UpdateSHA256;
+ cpHashProc updateFunc = UpdateSHA256;
#endif
- lenLo += len;
+ int procLen;
+
+ int idx = HAHS_BUFFIDX(pState);
+ Ipp8u* pBuffer = HASH_BUFF(pState);
+ Ipp64u lenLo = HASH_LENLO(pState) +len;
/* if non empty internal buffer filling */
- if(n) {
+ if(idx) {
/* copy from input stream to the internal buffer as match as possible */
- processingLen = IPP_MIN(len, (MBS_SHA256 - SHS_INDX(pState)));
- CopyBlock(pSrc, pBuffer+n, processingLen);
-
- pSrc += processingLen;
- len -= processingLen;
- SHS_INDX(pState) = n += processingLen;
+ procLen = IPP_MIN(len, (MBS_SHA256-idx));
+ CopyBlock(pSrc, pBuffer+idx, procLen);
+
+ /* update message pointer and length */
+ pSrc += procLen;
+ len -= procLen;
+ idx += procLen;
/* update digest if buffer full */
- if( MBS_SHA256 == n) {
- updateFunc(pHash, pBuffer, MBS_SHA256, SHA256_cnt);
- SHS_INDX(pState) = 0;
+ if( MBS_SHA256 == idx) {
+ updateFunc(HASH_VALUE(pState), pBuffer, MBS_SHA256, SHA256_cnt);
+ idx = 0;
}
}
/* main message part processing */
- processingLen = len & ~(MBS_SHA256-1);
- if(processingLen) {
- updateFunc(pHash, pSrc, processingLen, SHA256_cnt);
- pSrc += processingLen;
- len -= processingLen;
+ procLen = len & ~(MBS_SHA256-1);
+ if(procLen) {
+ updateFunc(HASH_VALUE(pState), pSrc, procLen, sha256_cnt);
+ pSrc += procLen;
+ len -= procLen;
}
/* store rest of message into the internal buffer */
if(len) {
CopyBlock(pSrc, pBuffer, len);
- SHS_INDX(pState) += len;
+ idx += len;
}
- SHS_LENL(pState) = lenLo;
+ /* update length of processed message */
+ HASH_LENLO(pState) = lenLo;
+ HAHS_BUFFIDX(pState) = idx;
}
return ippStsNoErr;
}
-#endif
-#if defined (_ENABLE_ALG_SHA224_)
IPPFUN(IppStatus, ippsSHA224Update,(const Ipp8u* pSrc, int len, IppsSHA224State* pState))
{
return ippsSHA256Update(pSrc, len, pState);
}
-#endif
-/*
-// Compute digest
-*/
-#if defined (_ENABLE_ALG_SHA256_) || defined (_ENABLE_ALG_SHA224_)
-void ComputeDigestSHA256(Ipp32u* pHash, const IppsSHA256State* pState)
+static void cpFinalizeSHA256(DigestSHA256 pHash, const Ipp8u* inpBuffer, int inpLen, Ipp64u processedMsgLen)
{
- const Ipp8u* stateBuff = SHS_BUFF(pState);
- int stateBuffLen = SHS_INDX(pState);
-
- /* local buffer and it length */
- Ipp8u buffer[MBS_SHA256*2];
- int bufferLen = stateBuffLen < (MBS_SHA1-(int)sizeof(Ipp64u))? MBS_SHA256 : MBS_SHA256*2;
-
/* select processing function */
-#if 0
- cpHashProc updateFunc = UpdateSHA256;
- #if (_IPP>=_IPP_P8) || (_IPP32E>=_IPP32E_Y8)
- if( IsFeatureEnabled(SHA_NI_ENABLED) )
- updateFunc = UpdateSHA256ni;
- #endif
-#endif
- cpHashProc updateFunc;
#if (_SHA_NI_ENABLING_==_FEATURE_ON_)
- updateFunc = UpdateSHA256ni;
+ cpHashProc updateFunc = UpdateSHA256ni;
+ #elif (_SHA_NI_ENABLING_==_FEATURE_TICKTOCK_)
+ cpHashProc updateFunc = IsFeatureEnabled(SHA_NI_ENABLED)? UpdateSHA256ni : UpdateSHA256;
#else
- #if (_SHA_NI_ENABLING_==_FEATURE_TICKTOCK_)
- if( IsFeatureEnabled(SHA_NI_ENABLED) )
- updateFunc = UpdateSHA256ni;
- else
- #endif
- updateFunc = UpdateSHA256;
+ cpHashProc updateFunc = UpdateSHA256;
#endif
+ /* local buffer and it length */
+ Ipp8u buffer[MBS_SHA256*2];
+ int bufferLen = inpLen < (MBS_SHA256-(int)MLR_SHA256)? MBS_SHA256 : MBS_SHA256*2;
+
/* copy rest of message into internal buffer */
- CopyBlock(stateBuff, buffer, stateBuffLen);
+ CopyBlock(inpBuffer, buffer, inpLen);
/* padd message */
- buffer[stateBuffLen++] = 0x80;
- PaddBlock(0, buffer+stateBuffLen, bufferLen-stateBuffLen-sizeof(Ipp64u));
+ buffer[inpLen++] = 0x80;
+ PaddBlock(0, buffer+inpLen, bufferLen-inpLen-MLR_SHA256);
- /* message length representation */
- {
- Ipp64u lo = SHS_LENL(pState); /* message length in bytes */
- lo = LSL64(lo,3); /* message length in bits */
- ((Ipp64u*)(buffer+bufferLen))[-1] = ENDIANNESS64(lo);
- }
+ /* put processed message length in bits */
+ processedMsgLen = ENDIANNESS64(processedMsgLen<<3);
+ ((Ipp64u*)(buffer+bufferLen))[-1] = processedMsgLen;
/* copmplete hash computation */
- updateFunc(pHash, buffer, bufferLen, SHA256_cnt);
-
- /* convert hash into big endian */
- pHash[0] = ENDIANNESS32(pHash[0]);
- pHash[1] = ENDIANNESS32(pHash[1]);
- pHash[2] = ENDIANNESS32(pHash[2]);
- pHash[3] = ENDIANNESS32(pHash[3]);
- pHash[4] = ENDIANNESS32(pHash[4]);
- pHash[5] = ENDIANNESS32(pHash[5]);
- pHash[6] = ENDIANNESS32(pHash[6]);
- pHash[7] = ENDIANNESS32(pHash[7]);
+ updateFunc(pHash, buffer, bufferLen, sha256_cnt);
}
-#endif
-
/*F*
-// Name: ippsSHA256GetTag
-// ippsSHA224GetTag
+// Name: ippsSHA256Final
+// ippsSHA224Final
//
-// Purpose: Compute digest based on current state.
-// Note, that futher digest update is possible
+// Purpose: Stop message digesting and return digest.
//
// Returns: Reason:
-// ippStsNullPtrErr pTag == NULL
+// ippStsNullPtrErr pDigest == NULL
// pState == NULL
// ippStsContextMatchErr pState->idCtx != idCtxSHA256
-// ippStsLengthErr max_SHA_digestLen < tagLen <1
// ippStsNoErr no errors
//
// Parameters:
-// pTag address of the output digest
-// tagLen length of digest
-// pState pointer to the SHS state
+// pMD address of the output digest
+// pState pointer to the SHA256 state
//
*F*/
-#if defined (_ENABLE_ALG_SHA256_)
-IPPFUN(IppStatus, ippsSHA256GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA256State* pState))
+IPPFUN(IppStatus, ippsSHA256Final,(Ipp8u* pMD, IppsSHA256State* pState))
{
/* test state pointer and ID */
IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
pState = (IppsSHA256State*)( IPP_ALIGNED_PTR(pState, SHA256_ALIGNMENT) );
- /* test state ID */
- IPP_BADARG_RET(idCtxSHA256 !=SHS_ID(pState), ippStsContextMatchErr);
+ IPP_BADARG_RET(idCtxSHA256 !=HASH_CTX_ID(pState), ippStsContextMatchErr);
/* test digest pointer */
- IPP_BAD_PTR1_RET(pTag);
- IPP_BADARG_RET((tagLen<1)||(sizeof(DigestSHA256)<tagLen), ippStsLengthErr);
-
- {
- DigestSHA256 digest;
+ IPP_BAD_PTR1_RET(pMD);
- CopyBlock(SHS_HASH(pState), digest, sizeof(DigestSHA256));
- ComputeDigestSHA256(digest, pState);
- CopyBlock(digest, pTag, tagLen);
+ cpFinalizeSHA256(HASH_VALUE(pState), HASH_BUFF(pState), HAHS_BUFFIDX(pState), HASH_LENLO(pState));
+ /* convert hash into big endian */
+ ((Ipp32u*)pMD)[0] = ENDIANNESS32(HASH_VALUE(pState)[0]);
+ ((Ipp32u*)pMD)[1] = ENDIANNESS32(HASH_VALUE(pState)[1]);
+ ((Ipp32u*)pMD)[2] = ENDIANNESS32(HASH_VALUE(pState)[2]);
+ ((Ipp32u*)pMD)[3] = ENDIANNESS32(HASH_VALUE(pState)[3]);
+ ((Ipp32u*)pMD)[4] = ENDIANNESS32(HASH_VALUE(pState)[4]);
+ ((Ipp32u*)pMD)[5] = ENDIANNESS32(HASH_VALUE(pState)[5]);
+ ((Ipp32u*)pMD)[6] = ENDIANNESS32(HASH_VALUE(pState)[6]);
+ ((Ipp32u*)pMD)[7] = ENDIANNESS32(HASH_VALUE(pState)[7]);
+
+ /* re-init hash value */
+ HAHS_BUFFIDX(pState) = 0;
+ HASH_LENLO(pState) = 0;
+ sha256_hashInit(HASH_VALUE(pState));
- return ippStsNoErr;
- }
+ return ippStsNoErr;
}
-#endif
-#if defined (_ENABLE_ALG_SHA224_)
-IPPFUN(IppStatus, ippsSHA224GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA224State* pState))
+IPPFUN(IppStatus, ippsSHA224Final,(Ipp8u* pMD, IppsSHA224State* pState))
{
/* test state pointer and ID */
IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
- pState = (IppsSHA224State*)( IPP_ALIGNED_PTR(pState, SHA256_ALIGNMENT) );
- /* test state ID */
- IPP_BADARG_RET(idCtxSHA256 !=SHS_ID(pState), ippStsContextMatchErr);
+ pState = (IppsSHA256State*)( IPP_ALIGNED_PTR(pState, SHA256_ALIGNMENT) );
+ IPP_BADARG_RET(idCtxSHA256 !=HASH_CTX_ID(pState), ippStsContextMatchErr);
/* test digest pointer */
- IPP_BAD_PTR1_RET(pTag);
- IPP_BADARG_RET((tagLen<1)||(sizeof(DigestSHA224)<tagLen), ippStsLengthErr);
-
- {
- DigestSHA256 digest;
+ IPP_BAD_PTR1_RET(pMD);
- CopyBlock(SHS_HASH(pState), digest, sizeof(DigestSHA256));
- ComputeDigestSHA256(digest, pState);
- CopyBlock(digest, pTag, tagLen);
+ cpFinalizeSHA256(HASH_VALUE(pState), HASH_BUFF(pState), HAHS_BUFFIDX(pState), HASH_LENLO(pState));
+ /* convert hash into big endian */
+ ((Ipp32u*)pMD)[0] = ENDIANNESS32(HASH_VALUE(pState)[0]);
+ ((Ipp32u*)pMD)[1] = ENDIANNESS32(HASH_VALUE(pState)[1]);
+ ((Ipp32u*)pMD)[2] = ENDIANNESS32(HASH_VALUE(pState)[2]);
+ ((Ipp32u*)pMD)[3] = ENDIANNESS32(HASH_VALUE(pState)[3]);
+ ((Ipp32u*)pMD)[4] = ENDIANNESS32(HASH_VALUE(pState)[4]);
+ ((Ipp32u*)pMD)[5] = ENDIANNESS32(HASH_VALUE(pState)[5]);
+ ((Ipp32u*)pMD)[6] = ENDIANNESS32(HASH_VALUE(pState)[6]);
+
+ /* re-init hash value */
+ HAHS_BUFFIDX(pState) = 0;
+ HASH_LENLO(pState) = 0;
+ sha224_hashInit(HASH_VALUE(pState));
- return ippStsNoErr;
- }
+ return ippStsNoErr;
}
-#endif
/*F*
-// Name: ippsSHA256Final
-// ippsSHA224Final
+// Name: ippsSHA256GetTag
+// ippsSHA224GetTag
//
-// Purpose: Stop message digesting and return digest.
+// Purpose: Compute digest based on current state.
+// Note, that futher digest update is possible
//
// Returns: Reason:
-// ippStsNullPtrErr pDigest == NULL
+// ippStsNullPtrErr pTag == NULL
// pState == NULL
// ippStsContextMatchErr pState->idCtx != idCtxSHA256
+// ippStsLengthErr max_SHA_digestLen < tagLen <1
// ippStsNoErr no errors
//
// Parameters:
-// pMD address of the output digest
-// pState pointer to the SHA256 state
+// pTag address of the output digest
+// tagLen length of digest
+// pState pointer to the SHS state
//
*F*/
-#if defined (_ENABLE_ALG_SHA256_)
-IPPFUN(IppStatus, ippsSHA256Final,(Ipp8u* pMD, IppsSHA256State* pState))
+IPPFUN(IppStatus, ippsSHA256GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA256State* pState))
{
/* test state pointer and ID */
IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
pState = (IppsSHA256State*)( IPP_ALIGNED_PTR(pState, SHA256_ALIGNMENT) );
- /* test state ID */
- IPP_BADARG_RET(idCtxSHA256 !=SHS_ID(pState), ippStsContextMatchErr);
+ IPP_BADARG_RET(idCtxSHA256 !=HASH_CTX_ID(pState), ippStsContextMatchErr);
/* test digest pointer */
- IPP_BAD_PTR1_RET(pMD);
+ IPP_BAD_PTR1_RET(pTag);
+ IPP_BADARG_RET((tagLen<1)||(sizeof(DigestSHA256)<tagLen), ippStsLengthErr);
- ComputeDigestSHA256(SHS_HASH(pState), pState);
- CopyBlock(SHS_HASH(pState), pMD, sizeof(DigestSHA256));
- InitSHA256(SHA256_IV, pState);
+ {
+ DigestSHA256 digest;
+ CopyBlock(HASH_VALUE(pState), digest, sizeof(DigestSHA256));
+ cpFinalizeSHA256(digest, HASH_BUFF(pState), HAHS_BUFFIDX(pState), HASH_LENLO(pState));
+ digest[0] = ENDIANNESS32(digest[0]);
+ digest[1] = ENDIANNESS32(digest[1]);
+ digest[2] = ENDIANNESS32(digest[2]);
+ digest[3] = ENDIANNESS32(digest[3]);
+ digest[4] = ENDIANNESS32(digest[4]);
+ digest[5] = ENDIANNESS32(digest[5]);
+ digest[6] = ENDIANNESS32(digest[6]);
+ digest[7] = ENDIANNESS32(digest[7]);
+ CopyBlock(digest, pTag, tagLen);
- return ippStsNoErr;
+ return ippStsNoErr;
+ }
}
-#endif
-#if defined (_ENABLE_ALG_SHA224_)
-IPPFUN(IppStatus, ippsSHA224Final,(Ipp8u* pMD, IppsSHA224State* pState))
+IPPFUN(IppStatus, ippsSHA224GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA224State* pState))
{
/* test state pointer and ID */
IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
- pState = (IppsSHA224State*)( IPP_ALIGNED_PTR(pState, SHA256_ALIGNMENT) );
- /* test state ID */
- IPP_BADARG_RET(idCtxSHA256 !=SHS_ID(pState), ippStsContextMatchErr);
+ pState = (IppsSHA256State*)( IPP_ALIGNED_PTR(pState, SHA256_ALIGNMENT) );
+ IPP_BADARG_RET(idCtxSHA256 !=HASH_CTX_ID(pState), ippStsContextMatchErr);
/* test digest pointer */
- IPP_BAD_PTR1_RET(pMD);
+ IPP_BAD_PTR1_RET(pTag);
+ IPP_BADARG_RET((tagLen<1)||(sizeof(DigestSHA224)<tagLen), ippStsLengthErr);
- ComputeDigestSHA256(SHS_HASH(pState), pState);
- CopyBlock(SHS_HASH(pState), pMD, sizeof(DigestSHA224));
- InitSHA256(SHA224_IV, pState);
+ {
+ DigestSHA256 digest;
+ CopyBlock(HASH_VALUE(pState), digest, sizeof(DigestSHA256));
+ cpFinalizeSHA256(digest, HASH_BUFF(pState), HAHS_BUFFIDX(pState), HASH_LENLO(pState));
+ digest[0] = ENDIANNESS32(digest[0]);
+ digest[1] = ENDIANNESS32(digest[1]);
+ digest[2] = ENDIANNESS32(digest[2]);
+ digest[3] = ENDIANNESS32(digest[3]);
+ digest[4] = ENDIANNESS32(digest[4]);
+ digest[5] = ENDIANNESS32(digest[5]);
+ digest[6] = ENDIANNESS32(digest[6]);
+ digest[7] = ENDIANNESS32(digest[7]);
+ CopyBlock(digest, pTag, tagLen);
- return ippStsNoErr;
+ return ippStsNoErr;
+ }
}
-#endif
-#if defined (_ENABLE_ALG_SHA256_) || defined (_ENABLE_ALG_SHA224_)
-IppStatus cpSHA256MessageDigest(DigestSHA256 hash, const Ipp8u* pMsg, int msgLen, const DigestSHA256 IV)
+static IppStatus cpSHA256MessageDigest(DigestSHA256 hash, const Ipp8u* pMsg, int msgLen, const DigestSHA256 IV)
{
/* test digest pointer */
IPP_BAD_PTR1_RET(hash);
@@ -599,31 +611,20 @@ IppStatus cpSHA256MessageDigest(DigestSHA256 hash, const Ipp8u* pMsg, int msgLen
IPP_BADARG_RET((msgLen && !pMsg), ippStsNullPtrErr);
{
- /* message length in the multiple MBS and the rest */
- int msgLenBlks = msgLen & (-MBS_SHA256);
- int msgLenRest = msgLen - msgLenBlks;
-
/* select processing function */
-#if 0
- cpHashProc updateFunc = UpdateSHA256;
- #if (_IPP>=_IPP_P8) || (_IPP32E>=_IPP32E_Y8)
- if( IsFeatureEnabled(SHA_NI_ENABLED) )
- updateFunc = UpdateSHA256ni;
- #endif
-#endif
- cpHashProc updateFunc;
#if (_SHA_NI_ENABLING_==_FEATURE_ON_)
- updateFunc = UpdateSHA256ni;
+ cpHashProc updateFunc = UpdateSHA256ni;
+ #elif (_SHA_NI_ENABLING_==_FEATURE_TICKTOCK_)
+ cpHashProc updateFunc = IsFeatureEnabled(SHA_NI_ENABLED)? UpdateSHA256ni : UpdateSHA256;
#else
- #if (_SHA_NI_ENABLING_==_FEATURE_TICKTOCK_)
- if( IsFeatureEnabled(SHA_NI_ENABLED) )
- updateFunc = UpdateSHA256ni;
- else
- #endif
- updateFunc = UpdateSHA256;
+ cpHashProc updateFunc = UpdateSHA256;
#endif
- /* setup initial digest */
+ /* message length in the multiple MBS and the rest */
+ int msgLenBlks = msgLen & (-MBS_SHA256);
+ int msgLenRest = msgLen - msgLenBlks;
+
+ /* init hash */
hash[0] = IV[0];
hash[1] = IV[1];
hash[2] = IV[2];
@@ -634,35 +635,12 @@ IppStatus cpSHA256MessageDigest(DigestSHA256 hash, const Ipp8u* pMsg, int msgLen
hash[7] = IV[7];
/* process main part of the message */
- if(msgLenBlks)
- updateFunc(hash, pMsg, msgLenBlks, SHA256_cnt);
-
- /* process message padding */
- {
- #define MREP_SIZE_SHA256 (sizeof(Ipp64u))
- Ipp8u buffer[MBS_SHA256*2];
- int bufferLen = msgLenRest < (int)(MBS_SHA256-MREP_SIZE_SHA256)? MBS_SHA256 : MBS_SHA256*2;
-
- /* message bitlength representation */
- Ipp64u msgLenBits = (Ipp64u)msgLen*8;
- msgLenBits = ENDIANNESS64(msgLenBits);
-
- /* copy end of message */
- CopyBlock(pMsg+msgLen-msgLenRest, buffer, msgLenRest);
-
- /* end of message bit */
- buffer[msgLenRest++] = 0x80;
-
- /* padd buffer */
- PaddBlock(0, buffer+msgLenRest, bufferLen-msgLenRest-MREP_SIZE_SHA256);
- /* copy message bitlength representation */
- ((Ipp64u*)(buffer+bufferLen))[-1] = msgLenBits;
-
- updateFunc(hash, buffer, bufferLen, SHA256_cnt);
- #undef MREP_SIZE_SHA256
+ if(msgLenBlks) {
+ updateFunc(hash, pMsg, msgLenBlks, sha256_cnt);
+ pMsg += msgLenBlks;
}
- /* swap hash bytes */
+ cpFinalizeSHA256(hash, pMsg, msgLenRest, msgLen);
hash[0] = ENDIANNESS32(hash[0]);
hash[1] = ENDIANNESS32(hash[1]);
hash[2] = ENDIANNESS32(hash[2]);
@@ -675,7 +653,6 @@ IppStatus cpSHA256MessageDigest(DigestSHA256 hash, const Ipp8u* pMsg, int msgLen
return ippStsNoErr;
}
}
-#endif
/*F*
// Name: ippsSHA256MessageDigest,
@@ -695,7 +672,6 @@ IppStatus cpSHA256MessageDigest(DigestSHA256 hash, const Ipp8u* pMsg, int msgLen
// pMD address of the output digest
//
*F*/
-#if defined (_ENABLE_ALG_SHA256_)
IPPFUN(IppStatus, ippsSHA256MessageDigest,(const Ipp8u* pMsg, int msgLen, Ipp8u* pMD))
{
/* test digest pointer */
@@ -703,15 +679,13 @@ IPPFUN(IppStatus, ippsSHA256MessageDigest,(const Ipp8u* pMsg, int msgLen, Ipp8u*
{
DigestSHA256 hash;
- IppStatus sts = cpSHA256MessageDigest(hash, pMsg, msgLen, SHA256_IV);
+ IppStatus sts = cpSHA256MessageDigest(hash, pMsg, msgLen, sha256_iv);
if(ippStsNoErr==sts)
CopyBlock(hash, pMD, IPP_SHA256_DIGEST_BITSIZE/BYTESIZE);
return sts;
}
}
-#endif
-#if defined (_ENABLE_ALG_SHA224_)
IPPFUN(IppStatus, ippsSHA224MessageDigest,(const Ipp8u* pMsg, int msgLen, Ipp8u* pMD))
{
/* test digest pointer */
@@ -719,10 +693,122 @@ IPPFUN(IppStatus, ippsSHA224MessageDigest,(const Ipp8u* pMsg, int msgLen, Ipp8u*
{
DigestSHA256 hash;
- IppStatus sts = cpSHA256MessageDigest(hash, pMsg, msgLen, SHA224_IV);
+ IppStatus sts = cpSHA256MessageDigest(hash, pMsg, msgLen, sha224_iv);
if(ippStsNoErr==sts)
CopyBlock(hash, pMD, IPP_SHA224_DIGEST_BITSIZE/BYTESIZE);
return sts;
}
}
-#endif
+
+
+/*
+// available SHA256 methods
+*/
+IPPFUN( const IppsHashMethod*, ippsHashMethod_SHA256, (void) )
+{
+ static IppsHashMethod method = {
+ ippHashAlg_SHA256,
+ IPP_SHA256_DIGEST_BITSIZE/8,
+ MBS_SHA256,
+ MLR_SHA256,
+ sha256_hashInit,
+ sha256_hashUpdate,
+ sha256_hashOctString,
+ sha256_msgRep
+ };
+ return &method;
+}
+
+IPPFUN( const IppsHashMethod*, ippsHashMethod_SHA256_NI, (void) )
+{
+ #if (_SHA_NI_ENABLING_==_FEATURE_TICKTOCK_ || _SHA_NI_ENABLING_==_FEATURE_ON_)
+ static IppsHashMethod method = {
+ ippHashAlg_SHA256,
+ IPP_SHA256_DIGEST_BITSIZE/8,
+ MBS_SHA256,
+ MLR_SHA256,
+ sha256_hashInit,
+ sha256_ni_hashUpdate,
+ sha256_hashOctString,
+ sha256_msgRep
+ };
+ return &method;
+ #else
+ return NULL;
+ #endif
+}
+
+IPPFUN( const IppsHashMethod*, ippsHashMethod_SHA256_TT, (void) )
+{
+ static IppsHashMethod method = {
+ ippHashAlg_SHA256,
+ IPP_SHA256_DIGEST_BITSIZE/8,
+ MBS_SHA256,
+ MLR_SHA256,
+ sha256_hashInit,
+ sha256_hashUpdate,
+ sha256_hashOctString,
+ sha256_msgRep
+ };
+ #if (_SHA_NI_ENABLING_==_FEATURE_TICKTOCK_ || _SHA_NI_ENABLING_==_FEATURE_ON_)
+ if(IsFeatureEnabled(SHA_NI_ENABLED))
+ method.hashUpdate = sha256_ni_hashUpdate;
+ #endif
+ return &method;
+}
+
+/*
+// available SHA224 methods
+*/
+IPPFUN( const IppsHashMethod*, ippsHashMethod_SHA224, (void) )
+{
+ static IppsHashMethod method = {
+ ippHashAlg_SHA224,
+ IPP_SHA224_DIGEST_BITSIZE/8,
+ MBS_SHA256,
+ MLR_SHA256,
+ sha224_hashInit,
+ sha256_hashUpdate,
+ sha224_hashOctString,
+ sha256_msgRep
+ };
+ return &method;
+}
+
+IPPFUN( const IppsHashMethod*, ippsHashMethod_SHA224_NI, (void) )
+{
+ #if (_SHA_NI_ENABLING_==_FEATURE_TICKTOCK_ || _SHA_NI_ENABLING_==_FEATURE_ON_)
+ static IppsHashMethod method = {
+ ippHashAlg_SHA224,
+ IPP_SHA224_DIGEST_BITSIZE/8,
+ MBS_SHA256,
+ MLR_SHA256,
+ sha224_hashInit,
+ sha256_ni_hashUpdate,
+ sha224_hashOctString,
+ sha256_msgRep
+ };
+ return &method;
+ #else
+ return NULL;
+ #endif
+}
+
+IPPFUN( const IppsHashMethod*, ippsHashMethod_SHA224_TT, (void) )
+{
+ static IppsHashMethod method = {
+ ippHashAlg_SHA224,
+ IPP_SHA256_DIGEST_BITSIZE/8,
+ MBS_SHA256,
+ MLR_SHA256,
+ sha256_hashInit,
+ sha256_hashUpdate,
+ sha256_hashOctString,
+ sha256_msgRep
+ };
+ #if (_SHA_NI_ENABLING_==_FEATURE_TICKTOCK_ || _SHA_NI_ENABLING_==_FEATURE_ON_)
+ if(IsFeatureEnabled(SHA_NI_ENABLED))
+ method.hashUpdate = sha256_ni_hashUpdate;
+ #endif
+ return &method;
+}
diff --git a/ext/ipp/sources/ippcp/src/pcpsha512ca.c b/ext/ipp/sources/ippcp/src/pcpsha512ca.c
deleted file mode 100644
index 8dcaab9..0000000
--- a/ext/ipp/sources/ippcp/src/pcpsha512ca.c
+++ /dev/null
@@ -1,674 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Cryptography Primitive.
-// SHA512 message digest
-//
-// Contents:
-// ippsSHA512GetSize()
-// ippsSHA512Init()
-// ippsSHA512Pack()
-// ippsSHA512Unpack()
-// ippsSHA512Duplicate()
-// ippsSHA512Update()
-// ippsSHA512GetTag()
-// ippsSHA512Final()
-// ippsSHA512MessageDigest()
-//
-//
-*/
-
-#include "precomp.h"
-#include "owncp.h"
-#include "pcphash.h"
-#include "pcptool.h"
-
-
-#if !defined(_ENABLE_ALG_SHA512_)
-#pragma message("IPP_ALG_HASH_SHA512 disabled")
-#else
-#pragma message("IPP_ALG_HASH_SHA512 enabled")
-#endif
-
-#if !defined(_ENABLE_ALG_SHA384_)
-#pragma message("IPP_ALG_HASH_SHA384 disabled")
-#else
-#pragma message("IPP_ALG_HASH_SHA384 enabled")
-#endif
-
-
-/*
-// SHA512 init context
-*/
-#if defined (_ENABLE_ALG_SHA512_) || defined (_ENABLE_ALG_SHA384_)
-IppStatus GetSizeSHA512(int* pSize)
-{
- /* test pointer */
- IPP_BAD_PTR1_RET(pSize);
-
- *pSize = sizeof(IppsSHA512State) +(SHA512_ALIGNMENT-1);
-
- return ippStsNoErr;
-}
-
-IppStatus InitSHA512(const DigestSHA512 IV, IppsSHA512State* pState)
-{
- /* test state pointer */
- IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
- pState = (IppsSHA512State*)( IPP_ALIGNED_PTR(pState, SHA512_ALIGNMENT) );
-
- /* set state ID */
- SHS_ID(pState) = idCtxSHA512;
-
- /* zeros message length */
- SHS_LENL(pState) = 0;
- SHS_LENH(pState) = 0;
-
- /* message buffer is free */
- SHS_INDX(pState) = 0;
-
- /* setup initial digest */
- SHS_HASH(pState)[0] = IV[0];
- SHS_HASH(pState)[1] = IV[1];
- SHS_HASH(pState)[2] = IV[2];
- SHS_HASH(pState)[3] = IV[3];
- SHS_HASH(pState)[4] = IV[4];
- SHS_HASH(pState)[5] = IV[5];
- SHS_HASH(pState)[6] = IV[6];
- SHS_HASH(pState)[7] = IV[7];
-
- return ippStsNoErr;
-}
-#endif
-
-/*F*
-// Name: ippsSHA512GetSize
-// ippsSHA384GetSize
-//
-// Purpose: Returns size (bytes) of IppsSHA512State state.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pSize == NULL
-// ippStsNoErr no errors
-//
-// Parameters:
-// pSize pointer to state size
-//
-*F*/
-#if defined (_ENABLE_ALG_SHA512_)
-IPPFUN(IppStatus, ippsSHA512GetSize,(int* pSize))
-{
- return GetSizeSHA512(pSize);
-}
-#endif
-
-#if defined (_ENABLE_ALG_SHA384_)
-IPPFUN(IppStatus, ippsSHA384GetSize,(int* pSize))
-{
- return GetSizeSHA512(pSize);
-}
-#endif
-
-
-/*F*
-// Name: ippsSHA512Init
-// ippsSHA384Init
-//
-// Purpose: Init SHA512
-//
-// Returns: Reason:
-// ippStsNullPtrErr pState == NULL
-// ippStsNoErr no errors
-//
-// Parameters:
-// pState pointer to the SHA512 state
-//
-*F*/
-#if defined (_ENABLE_ALG_SHA512_)
-IPPFUN(IppStatus, ippsSHA512Init,(IppsSHA512State* pState))
-{
- return InitSHA512(SHA512_IV, pState);
-}
-#endif
-
-#if defined (_ENABLE_ALG_SHA384_)
-IPPFUN(IppStatus, ippsSHA384Init,(IppsSHA384State* pState))
-{
- return InitSHA512(SHA384_IV, pState);
-}
-#endif
-
-
-/*F*
-// Name: ippsSHA512Pack
-// ippsSHA384Pack
-//
-// Purpose: Copy initialized context to the buffer.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pSize == NULL
-// pCtx == NULL
-// ippStsNoErr no errors
-//
-// Parameters:
-// pCtx pointer hash state
-// pSize pointer to the packed spec size
-//
-*F*/
-#if defined (_ENABLE_ALG_SHA512_) || defined (_ENABLE_ALG_SHA384_)
-IPPFUN(IppStatus, ippsSHA512Pack,(const IppsSHA512State* pCtx, Ipp8u* pBuffer))
-{
- /* test pointers */
- IPP_BAD_PTR2_RET(pCtx, pBuffer);
- /* use aligned context */
- pCtx = (IppsSHA512State*)( IPP_ALIGNED_PTR(pCtx, SHA512_ALIGNMENT) );
- /* test the context */
- IPP_BADARG_RET(idCtxSHA512 !=SHS_ID(pCtx), ippStsContextMatchErr);
-
- CopyBlock(pCtx, pBuffer, sizeof(IppsSHA512State));
- return ippStsNoErr;
-}
-#endif
-
-#if defined (_ENABLE_ALG_SHA384_)
-IPPFUN(IppStatus, ippsSHA384Pack,(const IppsSHA384State* pCtx, Ipp8u* pBuffer))
-{
- return ippsSHA512Pack(pCtx, pBuffer);
-}
-#endif
-
-
-/*F*
-// Name: ippsSHA512Unpack
-// ippsSHA384Unpack
-//
-// Purpose: Unpack buffer content into the initialized context.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pSize == NULL
-// pCtx == NULL
-// ippStsNoErr no errors
-//
-// Parameters:
-// pCtx pointer hash state
-// pSize pointer to the packed spec size
-//
-*F*/
-#if defined (_ENABLE_ALG_SHA512_) || defined (_ENABLE_ALG_SHA384_)
-IPPFUN(IppStatus, ippsSHA512Unpack,(const Ipp8u* pBuffer, IppsSHA512State* pCtx))
-{
- /* test pointers */
- IPP_BAD_PTR2_RET(pCtx, pBuffer);
- /* use aligned context */
- pCtx = (IppsSHA512State*)( IPP_ALIGNED_PTR(pCtx, SHA512_ALIGNMENT) );
-
- CopyBlock(pBuffer, pCtx, sizeof(IppsSHA512State));
- return ippStsNoErr;
-}
-#endif
-
-#if defined (_ENABLE_ALG_SHA384_)
-IPPFUN(IppStatus, ippsSHA384Unpack,(const Ipp8u* pBuffer, IppsSHA384State* pCtx))
-{
- return ippsSHA512Unpack(pBuffer, pCtx);
-}
-#endif
-
-
-/*F*
-// Name: ippsSHA512Duplicate
-// ippsSHA384Duplicate
-//
-// Purpose: Clone SHA512 state.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pSrcState == NULL
-// pDstState == NULL
-// ippStsContextMatchErr pSrcState->idCtx != idCtxSHA512
-// pDstState->idCtx != idCtxSHA512
-// ippStsNoErr no errors
-//
-// Parameters:
-// pSrcState pointer to the source SHA512 state
-// pDstState pointer to the target SHA512 state
-// Note:
-// pDstState may to be uninitialized by ippsSHA512Init()
-//
-*F*/
-#if defined (_ENABLE_ALG_SHA512_) || defined (_ENABLE_ALG_SHA384_)
-IPPFUN(IppStatus, ippsSHA512Duplicate,(const IppsSHA512State* pSrcState, IppsSHA512State* pDstState))
-{
- /* test state pointers */
- IPP_BAD_PTR2_RET(pSrcState, pDstState);
- /* use aligned context */
- pSrcState = (IppsSHA512State*)( IPP_ALIGNED_PTR(pSrcState, SHA512_ALIGNMENT) );
- pDstState = (IppsSHA512State*)( IPP_ALIGNED_PTR(pDstState, SHA512_ALIGNMENT) );
- /* test states ID */
- IPP_BADARG_RET(idCtxSHA512 !=SHS_ID(pSrcState), ippStsContextMatchErr);
- //IPP_BADARG_RET(idCtxSHA512 !=SHS_ID(pDstState), ippStsContextMatchErr);
-
- /* copy state */
- CopyBlock(pSrcState, pDstState, sizeof(IppsSHA512State));
-
- return ippStsNoErr;
-}
-#endif
-
-#if defined (_ENABLE_ALG_SHA384_)
-IPPFUN(IppStatus, ippsSHA384Duplicate,(const IppsSHA384State* pSrcState, IppsSHA384State* pDstState))
-{
- return ippsSHA512Duplicate(pSrcState, pDstState);
-}
-#endif
-
-
-/*F*
-// Name: ippsSHA512Update
-// ippsSHA384Update
-//
-// Purpose: Updates intermadiate digest based on input stream.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pSrc == NULL
-// pState == NULL
-// ippStsContextMatchErr pState->idCtx != idCtxSHA512
-// ippStsLengthErr len <0
-// ippStsNoErr no errors
-//
-// Parameters:
-// pSrc pointer to the input stream
-// len input stream length
-// pState pointer to the SHA512 state
-//
-*F*/
-#if defined (_ENABLE_ALG_SHA512_) || defined (_ENABLE_ALG_SHA384_)
-IPPFUN(IppStatus, ippsSHA512Update,(const Ipp8u* pSrc, int len, IppsSHA512State* pState))
-{
- /* test state pointer and ID */
- IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
- pState = (IppsSHA512State*)( IPP_ALIGNED_PTR(pState, SHA512_ALIGNMENT) );
-
- /* test state ID */
- IPP_BADARG_RET(idCtxSHA512 !=SHS_ID(pState), ippStsContextMatchErr);
- /* test input length */
- IPP_BADARG_RET((len<0), ippStsLengthErr);
- /* test source pointer */
- IPP_BADARG_RET((len && !pSrc), ippStsNullPtrErr);
-
- /*
- // handle non empty message
- */
- if(len) {
- int processingLen;
-
- int n = SHS_INDX(pState);
- Ipp8u* pBuffer = SHS_BUFF(pState);
- Ipp8u* pHash = (Ipp8u*)SHS_HASH(pState);
-
- Ipp64u lenLo = SHS_LENL(pState);
- Ipp64u lenHi = SHS_LENH(pState);
- lenLo += len;
- if(lenLo < SHS_LENL(pState)) lenHi++;
-
- /* if non empty internal buffer filling */
- if(n) {
- /* copy from input stream to the internal buffer as match as possible */
- processingLen = IPP_MIN(len, (MBS_SHA512-n));
- CopyBlock(pSrc, pBuffer+n, processingLen);
-
- pSrc += processingLen;
- len -= processingLen;
- SHS_INDX(pState) = n += processingLen;
-
- /* update digest if buffer full */
- if(MBS_SHA512 == n) {
- UpdateSHA512(pHash, pBuffer, MBS_SHA512, SHA512_cnt);
- SHS_INDX(pState) = 0;
- }
- }
-
- /* main message part processing */
- processingLen = len & ~(MBS_SHA512-1);
- if(processingLen) {
- UpdateSHA512(pHash, pSrc, processingLen, SHA512_cnt);
- pSrc += processingLen;
- len -= processingLen;
- }
-
- /* store rest of message into the internal buffer */
- if(len) {
- CopyBlock(pSrc, pBuffer, len);
- SHS_INDX(pState) += len;
- }
-
- SHS_LENL(pState) = lenLo;
- SHS_LENH(pState) = lenHi;
- }
-
- return ippStsNoErr;
-}
-#endif
-
-#if defined (_ENABLE_ALG_SHA384_)
-IPPFUN(IppStatus, ippsSHA384Update,(const Ipp8u* pSrc, int len, IppsSHA384State* pState))
-{
- return ippsSHA512Update(pSrc, len, pState);
-}
-#endif
-
-
-/*
-// Compute digest
-*/
-#if defined (_ENABLE_ALG_SHA512_) || defined (_ENABLE_ALG_SHA384_)
-void ComputeDigestSHA512(Ipp64u* pHash, const IppsSHA512State* pState)
-{
- const Ipp8u* stateBuff = SHS_BUFF(pState);
- int stateBuffLen = SHS_INDX(pState);
-
- /* local buffer and it length */
- Ipp8u buffer[MBS_SHA512*2];
- int bufferLen = stateBuffLen < (MBS_SHA512-(int)sizeof(Ipp64u)*2)? MBS_SHA512 : MBS_SHA512*2;
-
- /* copy rest of message into internal buffer */
- CopyBlock(stateBuff, buffer, stateBuffLen);
-
- /* padd message */
- buffer[stateBuffLen++] = 0x80;
- PaddBlock(0, buffer+stateBuffLen, bufferLen-stateBuffLen-sizeof(Ipp64u)*2);
-
- /* message length representation */
- {
- Ipp64u lo = SHS_LENL(pState); /* message length in bytes */
- Ipp64u hi = SHS_LENH(pState);
- hi = LSL64(hi,3) | LSR64(lo,63-3); /* message length in bits */
- lo = LSL64(lo,3);
- ((Ipp64u*)(buffer+bufferLen))[-2] = ENDIANNESS64(hi);
- ((Ipp64u*)(buffer+bufferLen))[-1] = ENDIANNESS64(lo);
- }
-
- /* copmplete hash computation */
- UpdateSHA512(pHash, buffer, bufferLen, SHA512_cnt);
-
- /* convert hash into big endian */
- pHash[0] = ENDIANNESS64(pHash[0]);
- pHash[1] = ENDIANNESS64(pHash[1]);
- pHash[2] = ENDIANNESS64(pHash[2]);
- pHash[3] = ENDIANNESS64(pHash[3]);
- pHash[4] = ENDIANNESS64(pHash[4]);
- pHash[5] = ENDIANNESS64(pHash[5]);
- pHash[6] = ENDIANNESS64(pHash[6]);
- pHash[7] = ENDIANNESS64(pHash[7]);
-}
-#endif
-
-
-/*F*
-// Name: ippsSHA512GetTag
-// ippsSHA384GetTag
-//
-// Purpose: Compute digest based on current state.
-// Note, that futher digest update is possible
-//
-// Returns: Reason:
-// ippStsNullPtrErr pTag == NULL
-// pState == NULL
-// ippStsContextMatchErr pState->idCtx != idCtxSHA512
-// ippStsLengthErr max_SHA_digestLen < tagLen <1
-// ippStsNoErr no errors
-//
-// Parameters:
-// pTag address of the output digest
-// tagLen length of digest
-// pState pointer to the SHS state
-//
-*F*/
-#if defined (_ENABLE_ALG_SHA512_)
-IPPFUN(IppStatus, ippsSHA512GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA512State* pState))
-{
- /* test state pointer and ID */
- IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
- pState = (IppsSHA512State*)( IPP_ALIGNED_PTR(pState, SHA512_ALIGNMENT) );
- /* test state ID */
- IPP_BADARG_RET(idCtxSHA512 !=SHS_ID(pState), ippStsContextMatchErr);
-
- /* test digest pointer */
- IPP_BAD_PTR1_RET(pTag);
- IPP_BADARG_RET((tagLen<1)||(sizeof(DigestSHA512)<tagLen), ippStsLengthErr);
-
- {
- DigestSHA512 digest;
-
- CopyBlock(SHS_HASH(pState), digest, sizeof(DigestSHA512));
- ComputeDigestSHA512(digest, pState);
- CopyBlock(digest, pTag, tagLen);
-
- return ippStsNoErr;
- }
-}
-#endif
-
-#if defined (_ENABLE_ALG_SHA384_)
-IPPFUN(IppStatus, ippsSHA384GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA384State* pState))
-{
- /* test state pointer and ID */
- IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
- pState = (IppsSHA384State*)( IPP_ALIGNED_PTR(pState, SHA512_ALIGNMENT) );
- /* test state ID */
- IPP_BADARG_RET(idCtxSHA512 !=SHS_ID(pState), ippStsContextMatchErr);
-
- /* test digest pointer */
- IPP_BAD_PTR1_RET(pTag);
- IPP_BADARG_RET((tagLen<1)||(sizeof(DigestSHA384)<tagLen), ippStsLengthErr);
-
- {
- DigestSHA512 digest;
-
- CopyBlock(SHS_HASH(pState), digest, sizeof(DigestSHA512));
- ComputeDigestSHA512(digest, pState);
- CopyBlock(digest, pTag, tagLen);
-
- return ippStsNoErr;
- }
-}
-#endif
-
-
-/*F*
-// Name: ippsSHA512Final
-// ippsSHA384Final
-//
-// Purpose: Stop message digesting and return digest.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pDigest == NULL
-// pState == NULL
-// ippStsContextMatchErr pState->idCtx != idCtxSHA512
-// ippStsNoErr no errors
-//
-// Parameters:
-// pMD address of the output digest
-// pState pointer to the SHA512 state
-//
-*F*/
-#if defined (_ENABLE_ALG_SHA512_)
-IPPFUN(IppStatus, ippsSHA512Final,(Ipp8u* pMD, IppsSHA512State* pState))
-{
- /* test state pointer and ID */
- IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
- pState = (IppsSHA512State*)( IPP_ALIGNED_PTR(pState, SHA512_ALIGNMENT) );
- /* test state ID */
- IPP_BADARG_RET(idCtxSHA512 !=SHS_ID(pState), ippStsContextMatchErr);
-
- /* test digest pointer */
- IPP_BAD_PTR1_RET(pMD);
-
- ComputeDigestSHA512(SHS_HASH(pState), pState);
- CopyBlock(SHS_HASH(pState), pMD, sizeof(DigestSHA512));
- InitSHA512(SHA512_IV, pState);
-
- return ippStsNoErr;
-}
-#endif
-
-#if defined (_ENABLE_ALG_SHA384_)
-IPPFUN(IppStatus, ippsSHA384Final,(Ipp8u* pMD, IppsSHA384State* pState))
-{
- /* test state pointer and ID */
- IPP_BAD_PTR1_RET(pState);
- /* use aligned context */
- pState = (IppsSHA384State*)( IPP_ALIGNED_PTR(pState, SHA512_ALIGNMENT) );
- /* test state ID */
- IPP_BADARG_RET(idCtxSHA512 !=SHS_ID(pState), ippStsContextMatchErr);
-
- /* test digest pointer */
- IPP_BAD_PTR1_RET(pMD);
-
- ComputeDigestSHA512(SHS_HASH(pState), pState);
- CopyBlock(SHS_HASH(pState), pMD, sizeof(DigestSHA384));
- InitSHA512(SHA384_IV, pState);
-
- return ippStsNoErr;
-}
-#endif
-
-
-#if defined (_ENABLE_ALG_SHA512_) || defined (_ENABLE_ALG_SHA384_)
-IppStatus cpSHA512MessageDigest(DigestSHA512 hash, const Ipp8u* pMsg, int msgLen, const DigestSHA512 IV)
-{
- /* test digest pointer */
- IPP_BAD_PTR1_RET(hash);
- /* test message length */
- IPP_BADARG_RET((msgLen<0), ippStsLengthErr);
- /* test message pointer */
- IPP_BADARG_RET((msgLen && !pMsg), ippStsNullPtrErr);
-
- {
- /* message length in the multiple MBS and the rest */
- int msgLenBlks = msgLen & (-MBS_SHA512);
- int msgLenRest = msgLen - msgLenBlks;
-
- /* setup initial digest */
- hash[0] = IV[0];
- hash[1] = IV[1];
- hash[2] = IV[2];
- hash[3] = IV[3];
- hash[4] = IV[4];
- hash[5] = IV[5];
- hash[6] = IV[6];
- hash[7] = IV[7];
-
- /* process main part of the message */
- if(msgLenBlks)
- UpdateSHA512(hash, pMsg, msgLenBlks, SHA512_cnt);
-
- /* process message padding */
- {
- #define MREP_SIZE_SHA512 (2*sizeof(Ipp64u))
- Ipp8u buffer[MBS_SHA512*2];
- int bufferLen = msgLenRest < (int)(MBS_SHA512-MREP_SIZE_SHA512)? MBS_SHA512 : MBS_SHA512*2;
-
- /* message bitlength representation */
- Ipp64u msgLenBits = (Ipp64u)msgLen*8;
- msgLenBits = ENDIANNESS64(msgLenBits);
-
- /* copy end of message */
- CopyBlock(pMsg+msgLen-msgLenRest, buffer, msgLenRest);
-
- /* end of message bit */
- buffer[msgLenRest++] = 0x80;
-
- /* padd buffer */
- PaddBlock(0, buffer+msgLenRest, bufferLen-msgLenRest-MREP_SIZE_SHA512+sizeof(Ipp64u));
- /* copy message bitlength representation */
- ((Ipp64u*)(buffer+bufferLen))[-1] = msgLenBits;
-
- UpdateSHA512(hash, buffer, bufferLen, SHA512_cnt);
- #undef MREP_SIZE_SHA512
- }
-
- /* swap hash bytes */
- hash[0] = ENDIANNESS64(hash[0]);
- hash[1] = ENDIANNESS64(hash[1]);
- hash[2] = ENDIANNESS64(hash[2]);
- hash[3] = ENDIANNESS64(hash[3]);
- hash[4] = ENDIANNESS64(hash[4]);
- hash[5] = ENDIANNESS64(hash[5]);
- hash[6] = ENDIANNESS64(hash[6]);
- hash[7] = ENDIANNESS64(hash[7]);
-
- return ippStsNoErr;
- }
-}
-#endif
-
-/*F*
-// Name: ippsSHA512MessageDigest
-// ippsSHA384MessageDigest
-//
-// Purpose: Digest of the whole message.
-//
-// Returns: Reason:
-// ippStsNullPtrErr pMsg == NULL
-// pDigest == NULL
-// ippStsLengthErr len <0
-// ippStsNoErr no errors
-//
-// Parameters:
-// pMsg pointer to the input message
-// len input message length
-// pMD address of the output digest
-//
-*F*/
-#if defined (_ENABLE_ALG_SHA512_)
-IPPFUN(IppStatus, ippsSHA512MessageDigest,(const Ipp8u* pMsg, int msgLen, Ipp8u* pMD))
-{
- /* test digest pointer */
- IPP_BAD_PTR1_RET(pMD);
-
- {
- DigestSHA512 hash;
- IppStatus sts = cpSHA512MessageDigest(hash, pMsg, msgLen, SHA512_IV);
- if(ippStsNoErr==sts)
- CopyBlock(hash, pMD, IPP_SHA512_DIGEST_BITSIZE/BYTESIZE);
- return sts;
- }
-}
-#endif
-
-#if defined (_ENABLE_ALG_SHA384_)
-IPPFUN(IppStatus, ippsSHA384MessageDigest,(const Ipp8u* pMsg, int msgLen, Ipp8u* pMD))
-{
- /* test digest pointer */
- IPP_BAD_PTR1_RET(pMD);
-
- {
- DigestSHA512 hash;
- IppStatus sts = cpSHA512MessageDigest(hash, pMsg, msgLen, SHA384_IV);
- if(ippStsNoErr==sts)
- CopyBlock(hash, pMD, IPP_SHA384_DIGEST_BITSIZE/BYTESIZE);
- return sts;
- }
-}
-#endif
diff --git a/ext/ipp/sources/ippcp/src/pcptool.h b/ext/ipp/sources/ippcp/src/pcptool.h
index df8c798..0d9eeb7 100644
--- a/ext/ipp/sources/ippcp/src/pcptool.h
+++ b/ext/ipp/sources/ippcp/src/pcptool.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2002-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -26,6 +26,9 @@
#if !defined(_PC_TOOL_H)
#define _CP_TOOL_H
+#define _NEW_COPY16_
+#define _NEW_XOR16_
+
/* copy data block */
__INLINE void CopyBlock(const void* pSrc, void* pDst, cpSize numBytes)
{
@@ -41,12 +44,29 @@ __INLINE void CopyBlock8(const void* pSrc, void* pDst)
for(k=0; k<8; k++ )
((Ipp8u*)pDst)[k] = ((Ipp8u*)pSrc)[k];
}
+
+#if defined(_NEW_COPY16_)
+__INLINE void CopyBlock16(const void* pSrc, void* pDst)
+{
+#if (_IPP_ARCH ==_IPP_ARCH_EM64T)
+ ((Ipp64u*)pDst)[0] = ((Ipp64u*)pSrc)[0];
+ ((Ipp64u*)pDst)[1] = ((Ipp64u*)pSrc)[1];
+#else
+ ((Ipp32u*)pDst)[0] = ((Ipp32u*)pSrc)[0];
+ ((Ipp32u*)pDst)[1] = ((Ipp32u*)pSrc)[1];
+ ((Ipp32u*)pDst)[2] = ((Ipp32u*)pSrc)[2];
+ ((Ipp32u*)pDst)[3] = ((Ipp32u*)pSrc)[3];
+#endif
+}
+#else
__INLINE void CopyBlock16(const void* pSrc, void* pDst)
{
int k;
for(k=0; k<16; k++ )
((Ipp8u*)pDst)[k] = ((Ipp8u*)pSrc)[k];
}
+#endif
+
__INLINE void CopyBlock24(const void* pSrc, void* pDst)
{
int k;
@@ -78,6 +98,7 @@ __INLINE void PurgeBlock(void* pDst, int len)
for(n=0; n<len; n++) ((Ipp8u*)pDst)[n] = 0;
}
#else
+#define PurgeBlock OWNAPI(PurgeBlock)
void PurgeBlock(void* pDst, int len);
#endif
@@ -115,6 +136,21 @@ __INLINE void XorBlock8(const void* pSrc1, const void* pSrc2, void* pDst)
for(k=0; k<8; k++ )
d[k] = (Ipp8u)(p1[k] ^p2[k]);
}
+
+#if defined(_NEW_XOR16_)
+__INLINE void XorBlock16(const void* pSrc1, const void* pSrc2, void* pDst)
+{
+#if (_IPP_ARCH ==_IPP_ARCH_EM64T)
+ ((Ipp64u*)pDst)[0] = ((Ipp64u*)pSrc1)[0] ^ ((Ipp64u*)pSrc2)[0];
+ ((Ipp64u*)pDst)[1] = ((Ipp64u*)pSrc1)[1] ^ ((Ipp64u*)pSrc2)[1];
+#else
+ ((Ipp32u*)pDst)[0] = ((Ipp32u*)pSrc1)[0] ^ ((Ipp32u*)pSrc2)[0];
+ ((Ipp32u*)pDst)[1] = ((Ipp32u*)pSrc1)[1] ^ ((Ipp32u*)pSrc2)[1];
+ ((Ipp32u*)pDst)[2] = ((Ipp32u*)pSrc1)[2] ^ ((Ipp32u*)pSrc2)[2];
+ ((Ipp32u*)pDst)[3] = ((Ipp32u*)pSrc1)[3] ^ ((Ipp32u*)pSrc2)[3];
+#endif
+}
+#else
__INLINE void XorBlock16(const void* pSrc1, const void* pSrc2, void* pDst)
{
const Ipp8u* p1 = (const Ipp8u*)pSrc1;
@@ -124,6 +160,8 @@ __INLINE void XorBlock16(const void* pSrc1, const void* pSrc2, void* pDst)
for(k=0; k<16; k++ )
d[k] = (Ipp8u)(p1[k] ^p2[k]);
}
+#endif
+
__INLINE void XorBlock24(const void* pSrc1, const void* pSrc2, void* pDst)
{
const Ipp8u* p1 = (const Ipp8u*)pSrc1;
diff --git a/ext/ipp/sources/ippcp/src/pcpvariant.h b/ext/ipp/sources/ippcp/src/pcpvariant.h
index aeda9c4..e7fc98c 100644
--- a/ext/ipp/sources/ippcp/src/pcpvariant.h
+++ b/ext/ipp/sources/ippcp/src/pcpvariant.h
@@ -1,5 +1,5 @@
/*############################################################################
- # Copyright 2016 Intel Corporation
+ # Copyright 2005-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -28,13 +28,6 @@
#define _CP_VARIANT_H
/*
-// modes of the CPU feature
-*/
-#define _FEATURE_OFF_ (0) /* feature is OFF a priori */
-#define _FEATURE_ON_ (1) /* feature is ON a priori */
-#define _FEATURE_TICKTOCK_ (2) /* dectect is feature OFF/ON */
-
-/*
// set _AES_NI_ENABLING_
*/
#if defined _IPP_AES_NI_
@@ -71,44 +64,29 @@
/*
-// set _SHA_NI_ENABLING_
+// set/reset _SHA_NI_ENABLING_
*/
-#if defined _IPP_SHA_NI_
- #if (_IPP_SHA_NI_ == 0)
- #define _SHA_NI_ENABLING_ _FEATURE_OFF_
- #elif (_IPP_SHA_NI_ == 1)
- #define _SHA_NI_ENABLING_ _FEATURE_ON_
- #else
- #error Define _IPP_SHA_NI_=0 or 1 or omit _IPP_SHA_NI_ at all
- #endif
-#else
- #if (_IPP>=_IPP_P8) || (_IPP32E>=_IPP32E_Y8)
+#if (_IPP>=_IPP_P8) || (_IPP32E>=_IPP32E_Y8)
+ #if !defined(_SHA_NI_ENABLING_)
#define _SHA_NI_ENABLING_ _FEATURE_TICKTOCK_
- #else
- #define _SHA_NI_ENABLING_ _FEATURE_OFF_
#endif
+#else
+ #undef _SHA_NI_ENABLING_
+ #define _SHA_NI_ENABLING_ _FEATURE_OFF_
#endif
/*
-// set _ADCOX_NI_ENABLING_
+// set/reset _ADCOX_NI_ENABLING_
*/
-#if defined _IPP_ADCX_NI_
- #if (_IPP_ADCX_NI_ == 0)
- #define _ADCOX_NI_ENABLING_ _FEATURE_OFF_
- #elif (_IPP_ADCX_NI_ == 1)
- #define _ADCOX_NI_ENABLING_ _FEATURE_ON_
- #else
- #error Define _IPP_ADCX_NI_=0 or 1 or omit _IPP_ADCX_NI_ at all
- #endif
-#else
- #if (_IPP32E>=_IPP32E_L9)
+#if (_IPP32E>=_IPP32E_L9)
+ #if !defined(_ADCOX_NI_ENABLING_)
#define _ADCOX_NI_ENABLING_ _FEATURE_TICKTOCK_
- #else
- #define _ADCOX_NI_ENABLING_ _FEATURE_OFF_
#endif
+#else
+ #undef _ADCOX_NI_ENABLING_
+ #define _ADCOX_NI_ENABLING_ _FEATURE_OFF_
#endif
-
/*
// IPP supports several hash algorithms by default:
// SHA-1
@@ -184,9 +162,9 @@
// and therefore prime number generator are based on SHA1.
// So, do no exclude SHA1 from the active list of hash algorithms
*/
-//#if !defined(_ENABLE_ALG_SHA1_)
-//#define _ENABLE_ALG_SHA1_
-//#endif
+#if defined(_DISABLE_ALG_SHA1_)
+#undef _DISABLE_ALG_SHA1_
+#endif
/*
// Because of performane reason hash algorithms are implemented in form
@@ -229,7 +207,9 @@
*/
#define _USE_SQR_ /* use implementaton of sqr */
#define xUSE_KARATSUBA_ /* not use Karatsuba method for multiplication */
-#define _USE_WINDOW_EXP_ /* use fixed window exponentiation */
+#if !defined(_DISABLE_WINDOW_EXP_)
+ #define _USE_WINDOW_EXP_ /* use fixed window exponentiation */
+#endif
/*
// RSA:
@@ -241,6 +221,15 @@
#define _USE_GRES_CBA_MITIGATION_ /* use (Gres) mitigation of CBA */
#define xUSE_FOLD_MONT512_ /* use foding technique in RSA-1024 case */
+#if (_IPP>=_IPP_W7)
+#define _RSA_SSE2
+#define _RSA_SSE2_PUBLIC_
+#endif
+
+#if (_IPP32E>=_IPP32E_L9)
+#define _RSA_AVX2
+#endif
+
/*
// IPP supports different implementation of NIST's (standard) EC over GF(0):
// P-128 (IppECCPStd128r1, IppECCPStd128r2)
@@ -267,34 +256,168 @@
// _ECP_IMPL_MFM_ means that implementation uses "Montgomary Friendly Modulus" (primes);
// p256 and sm2 are using such kind of optimization
*/
-#define _ECP_IMPL_ARBIRTRARY_ 0
-#define _ECP_IMPL_SPECIFIC_ 1
-#define _ECP_IMPL_MFM_ 2
-
-#define _ECP_128_ _ECP_IMPL_SPECIFIC_
-#define _ECP_192_ _ECP_IMPL_SPECIFIC_
-#define _ECP_224_ _ECP_IMPL_SPECIFIC_
-#define _ECP_256_ _ECP_IMPL_SPECIFIC_
-#define _ECP_384_ _ECP_IMPL_SPECIFIC_
-#define _ECP_521_ _ECP_IMPL_SPECIFIC_
-#define _ECP_SM2_ _ECP_IMPL_SPECIFIC_
-//#define _ECP_SM2_ _ECP_IMPL_ARBIRTRARY_
-
-#if (_IPP32E >= _IPP32E_M7)
-#undef _ECP_192_
-#undef _ECP_224_
-#undef _ECP_256_
-#undef _ECP_384_
-#undef _ECP_521_
-#undef _ECP_SM2_
-
-#define _ECP_192_ _ECP_IMPL_MFM_
-#define _ECP_224_ _ECP_IMPL_MFM_
-#define _ECP_256_ _ECP_IMPL_MFM_
-#define _ECP_384_ _ECP_IMPL_MFM_
-#define _ECP_521_ _ECP_IMPL_MFM_
-#define _ECP_SM2_ _ECP_IMPL_MFM_
+#define _ECP_IMPL_NONE_ 0
+#define _ECP_IMPL_ARBIRTRARY_ 1
+#define _ECP_IMPL_SPECIFIC_ 2
+#define _ECP_IMPL_MFM_ 3
+
+#if !defined(_ECP_112R1_)
+#if !defined(_DISABLE_ECP_112R1_)
+# define _ECP_112R1_ _ECP_IMPL_ARBIRTRARY_
+#else
+# define _ECP_112R1_ _ECP_IMPL_NONE_
+#endif
+#endif
+
+#if !defined(_ECP_112R2_)
+#if !defined(_DISABLE_ECP_112R2_)
+# define _ECP_112R2_ _ECP_IMPL_ARBIRTRARY_
+#else
+# define _ECP_112R2_ _ECP_IMPL_NONE_
+#endif
+#endif
+
+#if !defined(_ECP_160R1_)
+#if !defined(_DISABLE_ECP_160R1_)
+# define _ECP_160R1_ _ECP_IMPL_ARBIRTRARY_
+#else
+# define _ECP_160R1_ _ECP_IMPL_NONE_
+#endif
+#endif
+
+#if !defined(_ECP_160R2_)
+#if !defined(_DISABLE_ECP_160R2_)
+# define _ECP_160R2_ _ECP_IMPL_ARBIRTRARY_
+#else
+# define _ECP_160R2_ _ECP_IMPL_NONE_
+#endif
+#endif
+
+#if !defined(_ECP_128R1_)
+#if !defined(_DISABLE_ECP_128R1_)
+# define _ECP_128R1_ _ECP_IMPL_SPECIFIC_
+#else
+# define _ECP_128R1_ _ECP_IMPL_NONE_
#endif
+#endif
+
+#if !defined(_ECP_128R2_)
+#if !defined(_DISABLE_ECP_128R2_)
+# define _ECP_128R2_ _ECP_IMPL_SPECIFIC_
+#else
+# define _ECP_128R2_ _ECP_IMPL_NONE_
+#endif
+#endif
+
+#if !defined(_ECP_192_)
+#if !defined(_DISABLE_ECP_192_)
+# if (_IPP32E >= _IPP32E_M7) || (_IPP >= _IPP_P8)
+# define _ECP_192_ _ECP_IMPL_MFM_
+# else
+# define _ECP_192_ _ECP_IMPL_SPECIFIC_
+# endif
+#else
+# define _ECP_192_ _ECP_IMPL_NONE_
+#endif
+#endif
+
+#if !defined(_ECP_224_)
+#if !defined(_DISABLE_ECP_224_)
+# if (_IPP32E >= _IPP32E_M7) || (_IPP >= _IPP_P8)
+# define _ECP_224_ _ECP_IMPL_MFM_
+# else
+# define _ECP_224_ _ECP_IMPL_SPECIFIC_
+# endif
+#else
+# define _ECP_224_ _ECP_IMPL_NONE_
+#endif
+#endif
+
+#if !defined(_ECP_256_)
+#if !defined(_DISABLE_ECP_256_)
+# if (_IPP32E >= _IPP32E_M7) || (_IPP >= _IPP_P8)
+# define _ECP_256_ _ECP_IMPL_MFM_
+# else
+# define _ECP_256_ _ECP_IMPL_SPECIFIC_
+# endif
+#else
+# define _ECP_256_ _ECP_IMPL_NONE_
+#endif
+#endif
+
+#if !defined(_ECP_384_)
+#if !defined(_DISABLE_ECP_384_)
+# if (_IPP32E >= _IPP32E_M7) || (_IPP >= _IPP_P8)
+# define _ECP_384_ _ECP_IMPL_MFM_
+# else
+# define _ECP_384_ _ECP_IMPL_SPECIFIC_
+# endif
+#else
+# define _ECP_384_ _ECP_IMPL_NONE_
+#endif
+#endif
+
+#if !defined(_ECP_521_)
+#if !defined(_DISABLE_ECP_521_)
+# if (_IPP32E >= _IPP32E_M7) || (_IPP >= _IPP_P8)
+# define _ECP_521_ _ECP_IMPL_MFM_
+# else
+# define _ECP_521_ _ECP_IMPL_SPECIFIC_
+# endif
+#else
+# define _ECP_521_ _ECP_IMPL_NONE_
+#endif
+#endif
+
+#if !defined(_ECP_SM2_)
+#if !defined(_DISABLE_ECP_SM2_)
+# if (_IPP32E >= _IPP32E_M7) || (_IPP >= _IPP_P8)
+# define _ECP_SM2_ _ECP_IMPL_MFM_
+# else
+# define _ECP_SM2_ _ECP_IMPL_SPECIFIC_
+# endif
+#else
+# define _ECP_SM2_ _ECP_IMPL_NONE_
+#endif
+#endif
+
+#if !defined(_ECP_BN_)
+#if !defined(_DISABLE_ECP_BN_)
+# define _ECP_BN_ _ECP_IMPL_ARBIRTRARY_
+#else
+# define _ECP_BN_ _ECP_IMPL_NONE_
+#endif
+#endif
+
+#if !defined(_DISABLE_ECP_GENERAL_)
+# define _ECP_GENERAL_ _ECP_IMPL_ARBIRTRARY_
+#else
+# define _ECP_GENERAL_ _ECP_IMPL_NONE_
+#endif
+
+//#define _ECP_128_ _ECP_IMPL_SPECIFIC_
+//#define _ECP_192_ _ECP_IMPL_SPECIFIC_
+//#define _ECP_224_ _ECP_IMPL_SPECIFIC_
+//#define _ECP_256_ _ECP_IMPL_SPECIFIC_
+//#define _ECP_384_ _ECP_IMPL_SPECIFIC_
+//#define _ECP_521_ _ECP_IMPL_SPECIFIC_
+//#define _ECP_SM2_ _ECP_IMPL_SPECIFIC_
+
+//#if (_IPP32E >= _IPP32E_M7)
+//#undef _ECP_192_
+//#undef _ECP_224_
+//#undef _ECP_256_
+//#undef _ECP_384_
+//#undef _ECP_521_
+//#undef _ECP_SM2_
+
+//#define _ECP_192_ _ECP_IMPL_MFM_
+//#define _ECP_224_ _ECP_IMPL_MFM_
+//#define _ECP_256_ _ECP_IMPL_MFM_
+//#define _ECP_384_ _ECP_IMPL_MFM_
+//#define _ECP_521_ _ECP_IMPL_MFM_
+//#define _ECP_SM2_ _ECP_IMPL_MFM_
+//#endif
/*
diff --git a/ext/ipp/sources/ippcpepid/Makefile b/ext/ipp/sources/ippcpepid/Makefile
deleted file mode 100644
index 632e97a..0000000
--- a/ext/ipp/sources/ippcpepid/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/make -f
-
-API_INCLUDE_DIR = ../../include
-SRC_INCLUDE_DIR = ../../sources/include
-LIB_INSTALL_DIR = $(epidinstalldir)/lib/posix-$(ARCH)/
-
-PCP_INCLUDE_DIR = ../ippcp/src
-PCPEPID_INCLUDE_DIR = ./src
-PCPEPID_SRC = $(wildcard ./src/*.c)
-PCPEPID_OBJ = $(PCPEPID_SRC:.c=.o)
-PCPEPID_LIB = ./src/libippcpepid.a
-
-
-$(PCPEPID_OBJ): %.o: %.c
- $(CC) $(CFLAGS) -I$(API_INCLUDE_DIR) -I$(SRC_INCLUDE_DIR) -I$(PCP_INCLUDE_DIR) -I$(PCPEPID_INCLUDE_DIR) -c -o $@ $<
-
-$(PCPEPID_LIB): $(PCPEPID_OBJ)
- $(AR) rc $@ $^
- ranlib $@
-
-build: all
-
-all: $(PCPEPID_LIB)
-
-install:
- mkdir -p '$(LIB_INSTALL_DIR)'
- cp $(PCPEPID_LIB) '$(LIB_INSTALL_DIR)'
-
-clean:
- rm -f $(PCPEPID_OBJ) $(PCPEPID_LIB)
-
-
diff --git a/ext/ipp/sources/ippcpepid/src/owncpepid.h b/ext/ipp/sources/ippcpepid/src/owncpepid.h
deleted file mode 100644
index bb0a5e7..0000000
--- a/ext/ipp/sources/ippcpepid/src/owncpepid.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-// Intel(R) Integrated Performance Primitives
-// Internal Cryptographic Primitives (Intel(R) EPID v2.0)
-//
-//
-*/
-
-#ifndef __OWNCP_EPID_H__
-#define __OWNCP_EPID_H__
-
-#ifndef __OWNDEFS_H__
- #include "owndefs.h"
-#endif
-
-#ifndef __OWNCP_H__
- #include "owncp.h"
-#endif
-
-#ifndef __IPPCP_EPID_H__
- #include "ippcpepid.h"
-#endif
-
-#define LOG2_CACHE_LINE_SIZE (6) /* LOG2(CACHE_LINE_SIZE) */
-
-/* convert bitsize nbits into the number of BNU_CHUNK_T */
-#define BITS_CHUNKSIZE(nbits) (((nbits)+BITSIZE(BNU_CHUNK_T)-1)/BITSIZE(BNU_CHUNK_T))
-
-/*
-// dst = (src1 & mask) | (src2 & ~mask)
-*/
-#define MASKED_COPY(dst, mask, src1, src2, len) { \
- /*cpSize*/ int i; \
- for(i=0; i<(len); i++) (dst)[i] = ((mask) & (src1)[i]) | (~(mask) & (src2)[i]); \
-}
-
-#endif /* __OWNCP_EPID_H__ */
diff --git a/ext/ipp/sources/ippcpepid/src/pcpgfpec.c b/ext/ipp/sources/ippcpepid/src/pcpgfpec.c
deleted file mode 100644
index 48c3f99..0000000
--- a/ext/ipp/sources/ippcpepid/src/pcpgfpec.c
+++ /dev/null
@@ -1,322 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-// Intel(R) Performance Primitives. Cryptography Primitives.
-// EC over GF(p^m) definitinons
-//
-// Context:
-// ippsGFpECGetSize()
-// ippsGFpECInit()
-//
-// ippsGFpECSet()
-// ippsGFpECGet()
-// ippsGFpECVerify()
-//
-//
-*/
-
-#include "owncpepid.h"
-
-#include "pcpgfpecstuff.h"
-
-
-IPPFUN(IppStatus, ippsGFpECGetSize,(const IppsGFpState* pGF, int* pCtxSizeInBytes))
-{
- IPP_BAD_PTR2_RET(pGF, pCtxSizeInBytes);
- pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
- IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
-
- {
- int elemLen = GFP_FELEN(pGF);
- int maxOrderBits = 1+ cpGFpBasicDegreeExtension(pGF) * GFP_FEBITSIZE(cpGFpBasic(pGF));
- int maxOrdLen = BITS_BNU_CHUNK(maxOrderBits);
-
- *pCtxSizeInBytes = sizeof(IppsGFpECState)
- +elemLen*sizeof(BNU_CHUNK_T) /* EC coeff A */
- +elemLen*sizeof(BNU_CHUNK_T) /* EC coeff B */
- +elemLen*sizeof(BNU_CHUNK_T) /* generator G.x */
- +elemLen*sizeof(BNU_CHUNK_T) /* generator G.y */
- +elemLen*sizeof(BNU_CHUNK_T) /* generator G.z */
- +maxOrdLen*sizeof(BNU_CHUNK_T) /* base_point order */
- +elemLen*sizeof(BNU_CHUNK_T) /* cofactor */
- +elemLen*sizeof(BNU_CHUNK_T)*3*EC_POOL_SIZE
- +ECGFP_ALIGNMENT
- +CACHE_LINE_SIZE;
-
- return ippStsNoErr;
- }
-}
-
-
-IPPFUN(IppStatus, ippsGFpECInit,(const IppsGFpElement* pA, const IppsGFpElement* pB,
- const IppsGFpElement* pX, const IppsGFpElement* pY,
- const Ipp32u* pOrder, int ordLen,
- const Ipp32u* pCofactor, int cofactorLen,
- IppsGFpState* pGF, IppsGFpECState* pEC))
-{
- IPP_BAD_PTR2_RET(pGF, pEC);
- pGF = (IppsGFpState*)( IPP_ALIGNED_PTR(pGF, GFP_ALIGNMENT) );
- IPP_BADARG_RET( !GFP_TEST_ID(pGF), ippStsContextMatchErr );
-
- pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
-
- {
- Ipp8u* ptr = (Ipp8u*)pEC;
-
- int elemLen = GFP_FELEN(pGF);
- int maxOrderBits = 1+ cpGFpBasicDegreeExtension(pGF) * GFP_FEBITSIZE(cpGFpBasic(pGF));
- int maxOrdLen = BITS_BNU_CHUNK(maxOrderBits);
-
- ECP_ID(pEC) = idCtxGFPEC;
- ECP_FELEN(pEC) = elemLen*3;
- ECP_GFP(pEC) = pGF;
- ECP_ORDBITSIZE(pEC) = maxOrderBits;
-
- ptr += sizeof(IppsGFpECState);
- ECP_A(pEC) = (BNU_CHUNK_T*)(ptr); ptr += elemLen*sizeof(BNU_CHUNK_T);
- ECP_B(pEC) = (BNU_CHUNK_T*)(ptr); ptr += elemLen*sizeof(BNU_CHUNK_T);
- ECP_G(pEC) = (BNU_CHUNK_T*)(ptr); ptr += elemLen*sizeof(BNU_CHUNK_T)*3;
- ECP_R(pEC) = (BNU_CHUNK_T*)(ptr); ptr += maxOrdLen*sizeof(BNU_CHUNK_T);
- ECP_COFACTOR(pEC) = (BNU_CHUNK_T*)(ptr); ptr += elemLen*sizeof(BNU_CHUNK_T);
- ECP_POOL(pEC) = (BNU_CHUNK_T*)(ptr); //ptr += elemLen*sizeof(Ipp32u)*EC_POOL_SIZE;
-
- cpGFpElementPadd(ECP_A(pEC), elemLen, 0);
- cpGFpElementPadd(ECP_B(pEC), elemLen, 0);
- cpGFpElementPadd(ECP_G(pEC), elemLen*3, 0);
- cpGFpElementPadd(ECP_R(pEC), maxOrdLen, 0);
- cpGFpElementPadd(ECP_COFACTOR(pEC), elemLen, 0);
- EPID_PARAMS(pEC) = 0;
- #if defined (_EPID20_EC_PARAM_SPECIFIC_)
- EPID_PARAMS(pEC) = 1;
- #endif
- ECP_COFACTOR(pEC)[0] = 1;
-
- return ippsGFpECSet(pA,pB, pX,pY, pOrder,ordLen, pCofactor, cofactorLen, pEC);
- }
-}
-
-IPPFUN(IppStatus, ippsGFpECScratchBufferSize,(int nScalars, const IppsGFpECState* pEC, int* pBufferSize))
-{
- IPP_BAD_PTR2_RET(pEC, pBufferSize);
- pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
- IPP_BADARG_RET( !ECP_TEST_ID(pEC), ippStsContextMatchErr );
-
- IPP_BADARG_RET( (0>=nScalars)||(nScalars>LOG2_CACHE_LINE_SIZE), ippStsBadArgErr);
-
- {
- int pointDataSize = ECP_FELEN(pEC)*sizeof(BNU_CHUNK_T);
-
- /* get window_size */
- #if 0
- int w = (nScalars==1)? cpEcGFpGetOptimalWinSize(orderBitSize) : /* use optimal window size, if single-scalar operation */
- nScalars; /* or pseudo-oprimal if multi-scalar operation */
- #endif
- int w = (nScalars==1)? 5 : nScalars;
-
- /* number of table entries */
- int nPrecomputed = 1<<w;
-
- *pBufferSize = pointDataSize*nPrecomputed + (CACHE_LINE_SIZE-1);
-
- return ippStsNoErr;
- }
-}
-
-IPPFUN(IppStatus, ippsGFpECSet,(const IppsGFpElement* pA, const IppsGFpElement* pB,
- const IppsGFpElement* pX, const IppsGFpElement* pY,
- const Ipp32u* pOrder, int ordLen,
- const Ipp32u* pCofactor, int cofactorLen,
- IppsGFpECState* pEC))
-{
- IPP_BAD_PTR1_RET(pEC);
- pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
- IPP_BADARG_RET( !ECP_TEST_ID(pEC), ippStsContextMatchErr );
-
- {
- IppsGFpState* pGF = ECP_GFP(pEC);
- int elemLen = GFP_FELEN(pGF);
-
- if(pA) {
- IPP_BADARG_RET( !GFPE_TEST_ID(pA), ippStsContextMatchErr );
- cpGFpElementCopy(ECP_A(pEC), GFPE_DATA(pA), elemLen);
- #if defined(_EPID20_EC_PARAM_SPECIFIC_)
- EPID_PARAMS(pEC) = GFP_IS_ZERO(GFPE_DATA(pA), elemLen);
- #endif
- }
-
- if(pB) {
- IPP_BADARG_RET( !GFPE_TEST_ID(pB), ippStsContextMatchErr );
- cpGFpElementCopy(ECP_B(pEC), GFPE_DATA(pB), elemLen);
- }
-
- if(pX && pY) {
- IPP_BADARG_RET( !GFPE_TEST_ID(pX), ippStsContextMatchErr );
- IPP_BADARG_RET( !GFPE_TEST_ID(pY), ippStsContextMatchErr );
- cpGFpElementCopy(ECP_G(pEC), GFPE_DATA(pX), elemLen);
- cpGFpElementCopy(ECP_G(pEC)+elemLen, GFPE_DATA(pY), elemLen);
- cpGFpElementCopyPadd(ECP_G(pEC)+elemLen*2, elemLen, MNT_1(GFP_MONT(cpGFpBasic(pGF))), GFP_FELEN(cpGFpBasic(pGF)));
- }
-
- if(pOrder && ordLen) {
- int inOrderBitSize;
- FIX_BNU(pOrder, ordLen);
- inOrderBitSize = BITSIZE_BNU32(pOrder, ordLen);
- IPP_BADARG_RET(inOrderBitSize>ECP_ORDBITSIZE(pEC), ippStsRangeErr)
-
- ECP_ORDBITSIZE(pEC) = inOrderBitSize;
- ZEXPAND_COPY_BNU((Ipp32u*)ECP_R(pEC), BITS_BNU_CHUNK(inOrderBitSize)*(int)(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)), pOrder,ordLen);
- }
-
- if(pCofactor) {
- int cofactorOrderBitSize;
- FIX_BNU(pCofactor, cofactorLen);
- cofactorOrderBitSize = BITSIZE_BNU32(pCofactor, cofactorLen);
- IPP_BADARG_RET(cofactorOrderBitSize>elemLen*BITSIZE(BNU_CHUNK_T), ippStsRangeErr)
- cofactorLen = BITS2WORD32_SIZE(cofactorOrderBitSize);
- ZEXPAND_COPY_BNU((Ipp32u*)ECP_COFACTOR(pEC), BITS_BNU_CHUNK(cofactorOrderBitSize)*(int)(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)), pCofactor,cofactorLen);
- }
-
- return ippStsNoErr;
- }
-}
-
-IPPFUN(IppStatus, ippsGFpECGet,(const IppsGFpECState* pEC,
- const IppsGFpState** ppGF,
- IppsGFpElement* pA, IppsGFpElement* pB,
- IppsGFpElement* pX, IppsGFpElement* pY,
- const Ipp32u** ppOrder, int* pOrderLen,
- const Ipp32u** ppCofactor, int* pCofactorLen))
-{
- IPP_BAD_PTR1_RET(pEC);
- pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
- IPP_BADARG_RET( !ECP_TEST_ID(pEC), ippStsContextMatchErr );
-
- {
- const IppsGFpState* pGF = ECP_GFP(pEC);
- Ipp32u elementSize = GFP_FELEN(pGF);
-
- if(ppGF) {
- *ppGF = pGF;
- }
-
- if(pA) {
- IPP_BADARG_RET( !GFPE_TEST_ID(pA), ippStsContextMatchErr );
- cpGFpElementCopy(GFPE_DATA(pA), ECP_A(pEC), elementSize);
- }
- if(pB) {
- IPP_BADARG_RET( !GFPE_TEST_ID(pB), ippStsContextMatchErr );
- cpGFpElementCopy(GFPE_DATA(pB), ECP_B(pEC), elementSize);
- }
-
- if(pX) {
- IPP_BADARG_RET( !GFPE_TEST_ID(pX), ippStsContextMatchErr );
- cpGFpElementCopy(GFPE_DATA(pX), ECP_G(pEC), elementSize);
- }
- if(pY) {
- IPP_BADARG_RET( !GFPE_TEST_ID(pY), ippStsContextMatchErr );
- cpGFpElementCopy(GFPE_DATA(pY), ECP_G(pEC)+elementSize, elementSize);
- }
-
- if(ppOrder) {
- *ppOrder = (Ipp32u*)ECP_R(pEC);
- }
- if(pOrderLen) {
- *pOrderLen = BITS2WORD32_SIZE(ECP_ORDBITSIZE(pEC));
- }
-
- if(ppCofactor) {
- *ppCofactor = (Ipp32u*)ECP_COFACTOR(pEC);
- }
- if(pCofactorLen) {
- int cofactorLen = GFP_FELEN32(pGF);
- FIX_BNU((Ipp32u*)ECP_COFACTOR(pEC), cofactorLen);
- *pCofactorLen = cofactorLen;
- }
-
- return ippStsNoErr;
- }
-}
-
-IPPFUN(IppStatus, ippsGFpECVerify,(IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer))
-{
- IPP_BAD_PTR2_RET(pEC, pResult);
- pEC = (IppsGFpECState*)( IPP_ALIGNED_PTR(pEC, ECGFP_ALIGNMENT) );
- IPP_BADARG_RET( !ECP_TEST_ID(pEC), ippStsContextMatchErr );
-
- *pResult = ippECValid;
-
- {
- IppsGFpState* pGF = ECP_GFP(pEC);
- int elemLen = GFP_FELEN(pGF);
-
- /*
- // check discriminant ( 4*A^3 + 27*B^2 != 0 mod P)
- */
- if(ippECValid == *pResult) {
- BNU_CHUNK_T* pT = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pU = cpGFpGetPool(1, pGF);
-
- if(EPID_PARAMS(pEC))
- cpGFpElementPadd(pT, elemLen, 0); /* T = 4*A^3 = 0 */
- else {
- pGF->add(pT, ECP_A(pEC), ECP_A(pEC), pGF); /* T = 4*A^3 */
- pGF->sqr(pT, pT, pGF);
- pGF->mul(pT, ECP_A(pEC), pT, pGF);
- }
-
- pGF->add(pU, ECP_B(pEC), ECP_B(pEC), pGF); /* U = 9*B^2 */
- pGF->add(pU, pU, ECP_B(pEC), pGF);
- pGF->sqr(pU, pU, pGF);
-
- pGF->add(pT, pU, pT, pGF); /* T += 3*U */
- pGF->add(pT, pU, pT, pGF);
- pGF->add(pT, pU, pT, pGF);
-
- *pResult = GFP_IS_ZERO(pT, elemLen)? ippECIsZeroDiscriminant: ippECValid;
-
- cpGFpReleasePool(2, pGF);
- }
-
- /*
- // check base point and it order
- */
- if(ippECValid == *pResult) {
- IppsGFpECPoint G;
- cpEcGFpInitPoint(&G, ECP_G(pEC), ECP_AFFINE_POINT|ECP_FINITE_POINT, pEC);
-
- /* check G != infinity */
- *pResult = cpEcGFpIsProjectivePointAtInfinity(&G, elemLen)? ippECPointIsAtInfinite : ippECValid;
-
- /* check G lies on EC */
- if(ippECValid == *pResult)
- *pResult = cpEcGFpIsPointOnCurve(&G, pEC)? ippECValid : ippECPointIsNotValid;
-
- /* check Gorder*G = infinity */
- if(ippECValid == *pResult) {
- IppsGFpECPoint T;
- cpEcGFpInitPoint(&T, cpEcGFpGetPool(1, pEC),0, pEC);
-
- cpEcGFpMulPoint(&T, &G, ECP_R(pEC), BITS_BNU_CHUNK(ECP_ORDBITSIZE(pEC)), pEC, pScratchBuffer);
- *pResult = cpEcGFpIsProjectivePointAtInfinity(&T, elemLen)? ippECValid : ippECInvalidOrder;
-
- cpEcGFpReleasePool(1, pEC);
- }
- }
-
- return ippStsNoErr;
- }
-}
diff --git a/ext/ipp/sources/ippcpepid/src/pcpgfpecpointstuff.c b/ext/ipp/sources/ippcpepid/src/pcpgfpecpointstuff.c
deleted file mode 100644
index 978da1b..0000000
--- a/ext/ipp/sources/ippcpepid/src/pcpgfpecpointstuff.c
+++ /dev/null
@@ -1,1227 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Intel(R) Performance Primitives. Cryptography Primitives.
-// Internal EC over GF(p^m) basic Definitions & Function Prototypes
-//
-// Context:
-// cpEcGFpMakePoint()
-// cpEcGFpGetAffinePoint
-//
-// cpEcGFpIsPointEquial()
-// cpEcGFpIsPointOnCurve()
-//
-// cpEcGFpNegPoint()
-// cpEcGFpDblPoint()
-// cpEcGFpAddPoint()
-// cpEcGFpMulPoint()
-//
-//
-//
-*/
-
-#include "owncpepid.h"
-
-#include "pcpgfpecstuff.h"
-//#include "pcptool.h"
-
-
-int cpEcGFpMakePoint(IppsGFpECPoint* pPoint, const BNU_CHUNK_T* pElm, IppsGFpECState* pEC)
-{
- IppsGFpState* pGF = ECP_GFP(pEC);
- int elemLen = GFP_FELEN(pGF);
-
- BNU_CHUNK_T* pX = ECP_POINT_X(pPoint);
- BNU_CHUNK_T* pY = ECP_POINT_Y(pPoint);
- BNU_CHUNK_T* pZ = ECP_POINT_Z(pPoint);
-
- /* set x-coordinate */
- cpGFpElementCopy(pX, pElm, elemLen);
-
- /* T = X^3 + A*X + B */
- cpGFpxSqr(pY, pX, pGF);
- pGF->mul(pY, pY, pX, pGF);
- if(!EPID_PARAMS(pEC)) {
- pGF->mul(pZ, ECP_A(pEC), pX, pGF);
- pGF->add(pY, pY, pZ, pGF);
- }
- pGF->add(pY, pY, ECP_B(pEC), pGF);
-
- /* set z-coordinate =1 */
- cpGFpElementCopyPadd(pZ, elemLen, MNT_1(GFP_MONT(pGF)), GFP_FELEN(pGF));
-
- /* Y = sqrt(Y) */
- if( cpGFpSqrt(pY, pY, pGF) ) {
- ECP_POINT_FLAGS(pPoint) = ECP_AFFINE_POINT | ECP_FINITE_POINT;
- return 1;
- }
- else {
- cpEcGFpSetProjectivePointAtInfinity(pPoint, elemLen);
- //ECP_POINT_FLAGS(pPoint) = 0;
- return 0;
- }
-}
-
-#if ( ECP_PROJECTIVE_COORD == JACOBIAN )
-int cpEcGFpGetAffinePoint(BNU_CHUNK_T* pX, BNU_CHUNK_T* pY, const IppsGFpECPoint* pPoint, IppsGFpECState* pEC)
-{
- IppsGFpState* pGF = ECP_GFP(pEC);
- int elemLen = GFP_FELEN(pGF);
-
- if( !IS_ECP_FINITE_POINT(pPoint) ) {
- //GFP_ZERO(pX, elemLen);
- //if( GFP_IS_ZERO(ECP_B(pEC), elemLen) )
- // GFP_ONE(pY, elemLen);
- //else
- // GFP_ZERO(pY, elemLen);
- //return;
- return 0;
- }
-
- /* case Z == 1 */
- if( IS_ECP_AFFINE_POINT(pPoint) ) {
- if(pX)
- cpGFpElementCopy(pX, ECP_POINT_X(pPoint), elemLen);
- if(pY)
- cpGFpElementCopy(pY, ECP_POINT_Y(pPoint), elemLen);
- }
-
- /* case Z != 1 */
- else {
- /* T = (1/Z)*(1/Z) */
- BNU_CHUNK_T* pT = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pZinv = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pU = cpGFpGetPool(1, pGF);
- cpGFpxInv(pZinv, ECP_POINT_Z(pPoint), pGF);
- pGF->sqr(pT, pZinv, pGF);
-
- if(pX) {
- pGF->mul(pU, ECP_POINT_X(pPoint), pT, pGF);
- cpGFpElementCopy(pX, pU, elemLen);
- }
- if(pY) {
- pGF->mul(pT, pZinv, pT, pGF);
- pGF->mul(pU, ECP_POINT_Y(pPoint), pT, pGF);
- cpGFpElementCopy(pY, pU, elemLen);
- }
-
- cpGFpReleasePool(3, pGF);
- }
-
- return 1;
-}
-#endif
-
-#if ( ECP_PROJECTIVE_COORD == HOMOGENEOUS )
-int cpEcGFpGetAffinePoint(BNU_CHUNK_T* pX, BNU_CHUNK_T* pY, const IppsGFpECPoint* pPoint, IppsGFpECState* pEC)
-{
- IppsGFpState* pGF = ECP_GFP(pEC);
- int elemLen = GFP_FELEN(pGF);
-
- if( !IS_ECP_FINITE_POINT(pPoint) ) {
- return 0;
- }
-
- /* case Z == 1 */
- if( IS_ECP_AFFINE_POINT(pPoint) ) {
- if(pX)
- cpGFpElementCopy(pX, ECP_POINT_X(pPoint), elemLen);
- if(pY)
- cpGFpElementCopy(pY, ECP_POINT_Y(pPoint), elemLen);
- }
-
- /* case Z != 1 */
- else {
- /* T = (1/Z) */
- BNU_CHUNK_T* pZinv = cpGFpGetPool(1, pGF);
- cpGFpxInv(pZinv, ECP_POINT_Z(pPoint), pGF);
-
- if(pX) {
- pGF->mul(pX, ECP_POINT_X(pPoint), pZinv, pGF);
- }
- if(pY) {
- pGF->mul(pY, ECP_POINT_Y(pPoint), pZinv, pGF);
- }
-
- cpGFpReleasePool(1, pGF);
- }
-
- return 1;
-}
-#endif
-
-#if ( ECP_PROJECTIVE_COORD == JACOBIAN )
-int cpEcGFpIsPointEquial(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECState* pEC)
-{
- IppsGFpState* pGF = ECP_GFP(pEC);
- int elemLen = GFP_FELEN(pGF);
-
- /* P or/and Q at Infinity */
- if( !IS_ECP_FINITE_POINT(pP) )
- return !IS_ECP_FINITE_POINT(pQ)? 1:0;
- if( !IS_ECP_FINITE_POINT(pQ) )
- return !IS_ECP_FINITE_POINT(pP)? 1:0;
-
- /* Px==Qx && Py==Qy && Pz==Qz */
- if( GFP_EQ(ECP_POINT_Z(pP), ECP_POINT_Z(pQ), elemLen)
- &&GFP_EQ(ECP_POINT_X(pP), ECP_POINT_X(pQ), elemLen)
- &&GFP_EQ(ECP_POINT_Y(pP), ECP_POINT_Y(pQ), elemLen))
- return 1;
-
- else {
- int isEqu = 1;
-
- BNU_CHUNK_T* pPtmp = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pQtmp = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pPz = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pQz = cpGFpGetPool(1, pGF);
-
- if(isEqu) {
- /* Px*Qz^2 ~ Qx*Pz^2 */
- if( IS_ECP_AFFINE_POINT(pQ) ) /* Ptmp = Px * Qz^2 */
- cpGFpElementCopy(pPtmp, ECP_POINT_X(pP), elemLen);
- else {
- pGF->sqr(pQz, ECP_POINT_Z(pQ), pGF);
- pGF->mul(pPtmp, ECP_POINT_X(pP), pQz, pGF);
- }
- if( IS_ECP_AFFINE_POINT(pP) ) /* Qtmp = Qx * Pz^2 */
- cpGFpElementCopy(pQtmp, ECP_POINT_X(pQ), elemLen);
- else {
- pGF->sqr(pPz, ECP_POINT_Z(pP), pGF);
- pGF->mul(pQtmp, ECP_POINT_X(pQ), pPz, pGF);
- }
- isEqu = GFP_EQ(pPtmp, pQtmp, elemLen);
- }
-
- if(isEqu) {
- /* Py*Qz^3 ~ Qy*Pz^3 */
- if( IS_ECP_AFFINE_POINT(pQ) ) /* Ptmp = Py * Qz^3 */
- cpGFpElementCopy(pPtmp, ECP_POINT_Y(pP), elemLen);
- else {
- pGF->mul(pQz, ECP_POINT_Z(pQ), pQz, pGF);
- pGF->mul(pPtmp, pQz, ECP_POINT_Y(pP), pGF);
- }
- if( IS_ECP_AFFINE_POINT(pP) ) /* Qtmp = Qy * Pz^3 */
- cpGFpElementCopy(pQtmp, ECP_POINT_Y(pQ), elemLen);
- else {
- pGF->mul(pPz, ECP_POINT_Z(pP), pPz, pGF);
- pGF->mul(pQtmp, pPz, ECP_POINT_Y(pQ), pGF);
- }
- isEqu = GFP_EQ(pPtmp, pQtmp, elemLen);
- }
-
- cpGFpReleasePool(4, pGF);
- return isEqu;
- }
-}
-#endif
-
-#if ( ECP_PROJECTIVE_COORD == HOMOGENEOUS )
-int cpEcGFpIsPointEquial(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECState* pEC)
-{
- IppsGFpState* pGF = ECP_GFP(pEC);
- int elemLen = GFP_FELEN(pGF);
-
- /* P or/and Q at Infinity */
- if( !IS_ECP_FINITE_POINT(pP) )
- return !IS_ECP_FINITE_POINT(pQ)? 1:0;
- if( !IS_ECP_FINITE_POINT(pQ) )
- return !IS_ECP_FINITE_POINT(pP)? 1:0;
-
- /* Px==Qx && Py==Qy && Pz==Qz */
- if( GFP_EQ(ECP_POINT_Z(pP), ECP_POINT_Z(pQ), elemLen)
- &&GFP_EQ(ECP_POINT_X(pP), ECP_POINT_X(pQ), elemLen)
- &&GFP_EQ(ECP_POINT_Y(pP), ECP_POINT_Y(pQ), elemLen))
- return 1;
-
- else {
- int isEqu = 1;
-
- BNU_CHUNK_T* pPtmp = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pQtmp = cpGFpGetPool(1, pGF);
-
- if(isEqu) {
- /* Px*Qz ~ Qx*Pz */
- if( IS_ECP_AFFINE_POINT(pQ) ) /* Ptmp = Px * Qz */
- cpGFpElementCopy(pPtmp, ECP_POINT_X(pP), elemLen);
- else {
- pGF->mul(pPtmp, ECP_POINT_X(pP), ECP_POINT_Z(pQ), pGF);
- }
- if( IS_ECP_AFFINE_POINT(pP) ) /* Qtmp = Qx * Pz */
- cpGFpElementCopy(pQtmp, ECP_POINT_X(pQ), elemLen);
- else {
- pGF->mul(pQtmp, ECP_POINT_X(pQ), ECP_POINT_Z(pP), pGF);
- }
- isEqu = GFP_EQ(pPtmp, pQtmp, elemLen);
- }
-
- if(isEqu) {
- /* Py*Qz ~ Qy*Pz */
- if( IS_ECP_AFFINE_POINT(pQ) ) /* Ptmp = Py * Qz */
- cpGFpElementCopy(pPtmp, ECP_POINT_Y(pP), elemLen);
- else {
- pGF->mul(pPtmp, ECP_POINT_Y(pP), ECP_POINT_Z(pQ), pGF);
- }
- if( IS_ECP_AFFINE_POINT(pP) ) /* Qtmp = Qy * Pz */
- cpGFpElementCopy(pQtmp, ECP_POINT_Y(pQ), elemLen);
- else {
- pGF->mul(pQtmp, ECP_POINT_Y(pQ), ECP_POINT_Z(pP), pGF);
- }
- isEqu = GFP_EQ(pPtmp, pQtmp, elemLen);
- }
-
- cpGFpReleasePool(2, pGF);
- return isEqu;
- }
-}
-#endif
-
-#if ( ECP_PROJECTIVE_COORD == JACOBIAN )
-int cpEcGFpIsPointOnCurve(const IppsGFpECPoint* pPoint, IppsGFpECState* pEC)
-{
- /* point at infinity belongs curve */
- if( !IS_ECP_FINITE_POINT(pPoint) )
- return 1;
-
- /* test that 0 == R = (Y^2) - (X^3 + A*X*(Z^4) + B*(Z^6)) */
- else {
- int isOnCurve = 0;
-
- IppsGFpState* pGF = ECP_GFP(pEC);
-
- BNU_CHUNK_T* pX = ECP_POINT_X(pPoint);
- BNU_CHUNK_T* pY = ECP_POINT_Y(pPoint);
- BNU_CHUNK_T* pZ = ECP_POINT_Z(pPoint);
-
- BNU_CHUNK_T* pR = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pT = cpGFpGetPool(1, pGF);
-
- pGF->sqr(pR, pY, pGF); /* R = Y^2 */
- pGF->sqr(pT, pX, pGF); /* T = X^3 */
- pGF->mul(pT, pX, pT, pGF);
- pGF->sub(pR, pR, pT, pGF); /* R -= T */
-
- if( IS_ECP_AFFINE_POINT(pPoint) ) {
- pGF->mul(pT, pX, ECP_A(pEC), pGF); /* T = A*X */
- pGF->sub(pR, pR, pT, pGF); /* R -= T */
- pGF->sub(pR, pR, ECP_B(pEC), pGF); /* R -= B */
- }
- else {
- BNU_CHUNK_T* pZ4 = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pZ6 = cpGFpGetPool(1, pGF);
-
- pGF->sqr(pZ6, pZ, pGF); /* Z^2 */
- pGF->sqr(pZ4, pZ6, pGF); /* Z^4 */
- pGF->mul(pZ6, pZ6, pZ4, pGF); /* Z^6 */
-
- pGF->mul(pZ4, pZ4, pX, pGF); /* X*(Z^4) */
- pGF->mul(pZ4, pZ4, ECP_A(pEC), pGF); /* A*X*(Z^4) */
- pGF->mul(pZ6, pZ6, ECP_B(pEC), pGF); /* B*(Z^4) */
-
- pGF->sub(pR, pR, pZ4, pGF); /* R -= A*X*(Z^4) */
- pGF->sub(pR, pR, pZ6, pGF); /* R -= B*(Z^6) */
-
- cpGFpReleasePool(2, pGF);
- }
-
- isOnCurve = GFP_IS_ZERO(pR, GFP_FELEN(pGF));
- cpGFpReleasePool(2, pGF);
- return isOnCurve;
- }
-}
-#endif
-
-#if ( ECP_PROJECTIVE_COORD == HOMOGENEOUS )
-int cpEcGFpIsPointOnCurve(const IppsGFpECPoint* pPoint, IppsGFpECState* pEC)
-{
- /* point at infinity belongs curve */
- if( !IS_ECP_FINITE_POINT(pPoint) )
- return 1;
-
- /* test that 0 == R = ((Y^2)*Z) - (X^3 + A*X*(Z^2) + B*(Z^3)) */
- else {
- int isOnCurve = 0;
-
- IppsGFpState* pGF = ECP_GFP(pEC);
-
- BNU_CHUNK_T* pX = ECP_POINT_X(pPoint);
- BNU_CHUNK_T* pY = ECP_POINT_Y(pPoint);
- BNU_CHUNK_T* pZ = ECP_POINT_Z(pPoint);
-
- BNU_CHUNK_T* pR = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pT = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pU = cpGFpGetPool(1, pGF);
-
- /* Right = X^3 + A*X*(Z^2) + B*(Z^3) = x^3 +(A*X + B*Z)*Z^2 */
- pGF->sqr(pR, pZ, pGF); /* R = Z^2 */
- pGF->mul(pT, pZ, ECP_B(pEC), pGF); /* T = Z*B */
- if(!EPID_PARAMS(pEC)) {
- pGF->mul(pU, pX, ECP_A(pEC), pGF); /* U = X*A */
- pGF->add(pT, pT, pU, pGF); /* T = (A*X + B*Z) * Z^2 */
- }
- pGF->mul(pT, pT, pR, pGF);
-
- pGF->sqr(pR, pX, pGF); /* R = X^3 */
- pGF->mul(pR, pR, pX, pGF);
-
- pGF->add(pR, pR, pT, pGF); /* R = X^3 + (A*X + B*Z) * Z^2 */
-
- /* Left = (Y^2)*Z */
- pGF->sqr(pT, pY, pGF);
- pGF->mul(pT, pT, pZ, pGF);
-
- pGF->sub(pR, pR, pT, pGF); /* Left - Right */
-
- isOnCurve = GFP_IS_ZERO(pR, GFP_FELEN(pGF));
-
- cpGFpReleasePool(3, pGF);
- return isOnCurve;
- }
-}
-#endif
-
-IppsGFpECPoint* cpEcGFpNegPoint (IppsGFpECPoint* pR, const IppsGFpECPoint* pP, IppsGFpECState* pEC)
-{
- int elemLen = GFP_FELEN(ECP_GFP(pEC));
- IppsGFpState* pGF = ECP_GFP(pEC);
-
- if(pP!=pR)
- cpEcGFpCopyPoint(pR, pP, elemLen);
-
- if( IS_ECP_FINITE_POINT(pR) )
- pGF->neg(ECP_POINT_Y(pR), ECP_POINT_Y(pR), pGF);
- return pR;
-}
-
-#if ( ECP_PROJECTIVE_COORD == JACOBIAN )
-/* general complexity = 6s+4m
- epid complexity = 4s+3m
-*/
-IppsGFpECPoint* cpEcGFpDblPoint (IppsGFpECPoint* pR, const IppsGFpECPoint* pP, IppsGFpECState* pEC)
-{
- IppsGFpState* pGF = ECP_GFP(pEC);
- int elemLen = GFP_FELEN(pGF);
-
- BNU_CHUNK_T* pX = ECP_POINT_X(pP);
- BNU_CHUNK_T* pY = ECP_POINT_Y(pP);
- BNU_CHUNK_T* pZ = ECP_POINT_Z(pP);
-
- BNU_CHUNK_T* pU = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pM = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pS = cpGFpGetPool(1, pGF);
-
- /* M = 3*X^2 + A*Z^4 */
- pGF->sqr(pU, pX, pGF); /* s */
- pGF->add(pM, pU, pU, pGF);
- pGF->add(pM, pU, pM, pGF);
- if(!EPID_PARAMS(pEC)) {
- if( IS_ECP_AFFINE_POINT(pP) )
- pGF->add(pM, ECP_A(pEC), pM, pGF);
- else {
- pGF->sqr(pU, pZ, pGF); /* s */
- pGF->sqr(pU, pU, pGF); /* s */
- pGF->mul(pU, ECP_A(pEC), pU, pGF); /* m */
- pGF->add(pM, pM, pU, pGF);
- }
- }
-
- /* U = 2*Y */
- pGF->add(pU, pY, pY, pGF);
-
- /* Rz = 2*Y*Z */
- if( IS_ECP_AFFINE_POINT(pP) )
- cpGFpElementCopy(ECP_POINT_Z(pR), pU, elemLen);
- else
- pGF->mul(ECP_POINT_Z(pR), pU, pZ, pGF); /* m */
-
- /* S = X*(U^2) = 4*X*Y^2 */
- pGF->sqr(pU, pU, pGF); /* s */
- pGF->mul(pS, pX, pU, pGF); /* m */
-
- /* Rx = M^2 - 2*S */
- pGF->sqr(ECP_POINT_X(pR),pM, pGF); /* s */
- pGF->sub(ECP_POINT_X(pR), ECP_POINT_X(pR), pS, pGF);
- pGF->sub(ECP_POINT_X(pR), ECP_POINT_X(pR), pS, pGF);
-
- /* U = (U^2)/2 = (16*Y^4)/2 = 8*Y^4 */
- pGF->sqr(pU, pU, pGF); /* s */
- //cpGFpxHalve(pU, pU, pGF);
- pGF->div2(pU, pU, pGF);
-
- /* Ry = M*(S - Rx) - U */
- pGF->sub(pS, pS, ECP_POINT_X(pR), pGF);
- pGF->mul(pS, pM, pS, pGF); /* m */
- pGF->sub(ECP_POINT_Y(pR), pS, pU, pGF);
-
- //ECP_POINT_FLAGS(pR) = ECP_FINITE_POINT;
- ECP_POINT_FLAGS(pR) = cpEcGFpIsProjectivePointAtInfinity(pR, elemLen)? 0 : ECP_FINITE_POINT;
-
-
- cpGFpReleasePool(3, pGF);
-
- return pR;
-}
-#endif
-
-#if ( ECP_PROJECTIVE_COORD == HOMOGENEOUS )
-/*
-// A = 3*X^2 + A*Z^2
-// B = Y*Z
-// C = X*Y*B
-// D = A^2 - 8*C
-// new X = 2*B*D
-// new Y = A*(4*C - D) - 8*(Y*B)^2
-// new Z = 8*B^3
-//
-// general complexity = 5s+8m
-// epid complexity = 4s+7m
-*/
-IppsGFpECPoint* cpEcGFpDblPoint (IppsGFpECPoint* pR, const IppsGFpECPoint* pP, IppsGFpECState* pEC)
-{
- IppsGFpState* pGF = ECP_GFP(pEC);
- int elemLen = GFP_FELEN(pGF);
-
- /* P at infinity => R at infinity */
- if( !IS_ECP_FINITE_POINT(pP) )
- cpEcGFpSetProjectivePointAtInfinity(pR, elemLen);
-
- else {
- BNU_CHUNK_T* pA = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pB = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pC = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pD = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pT = cpGFpGetPool(1, pGF);
-
- BNU_CHUNK_T* pX = ECP_POINT_X(pR);
- BNU_CHUNK_T* pY = ECP_POINT_Y(pR);
- BNU_CHUNK_T* pZ = ECP_POINT_Z(pR);
- if(pR!=pP) {
- cpGFpElementCopy(pX, ECP_POINT_X(pP), elemLen);
- cpGFpElementCopy(pY, ECP_POINT_Y(pP), elemLen);
- cpGFpElementCopy(pZ, ECP_POINT_Z(pP), elemLen);
- }
-
- /* A = 3*X^2 + A*Z^2 */
- pGF->sqr(pC, pX, pGF); /* s */
- pGF->add(pA, pC, pC, pGF);
- pGF->add(pA, pA, pC, pGF);
- if(!EPID_PARAMS(pEC)) {
- pGF->sqr(pB, pZ, pGF); /* s */
- pGF->mul(pB, pB, ECP_A(pEC), pGF); /* m */
- pGF->add(pA, pA, pB, pGF);
- }
-
- /* B = Y*Z */
- pGF->mul(pB, pY, pZ, pGF); /* m */
-
- /* C = X*Y*B */
- pGF->mul(pC, pX, pY, pGF); /* m */
- pGF->mul(pC, pC, pB, pGF); /* m */
-
- /* D = A^2 - 8*C */
- pGF->sqr(pT, pA, pGF); /* s */
- pGF->add(pD, pC, pC, pGF);
- pGF->add(pD, pD, pD, pGF);
- pGF->add(pD, pD, pD, pGF);
- pGF->sub(pD, pT, pD, pGF);
-
- /* X = 2*B*D */
- pGF->mul(pX, pB, pD, pGF); /* m */
- pGF->add(pX, pX, pX, pGF);
-
- pGF->add(pB, pB, pB, pGF); /* B = 2*B */
-
- /* Y = A*(4*C-D)-8(Y*B)^2 */
- pGF->mul(pT, pY, pB, pGF); /* m */
- pGF->sqr(pT, pT, pGF); /* s */ /* T = 4*(Y*B)^2 */
- pGF->add(pY, pC, pC, pGF);
- pGF->add(pY, pY, pY, pGF);
- pGF->sub(pY, pY, pD, pGF);
- pGF->mul(pY, pY, pA, pGF); /* m */
- pGF->sub(pY, pY, pT, pGF);
- pGF->sub(pY, pY, pT, pGF);
-
- /* Z = 8*B^3 = (2*B)^3 */
- pGF->sqr(pZ, pB, pGF); /* s */
- pGF->mul(pZ, pZ, pB, pGF); /* m */
-
- ECP_POINT_FLAGS(pR) = ECP_FINITE_POINT;
-
- cpGFpReleasePool(5, pGF);
- }
-
- return pR;
-}
-#endif
-
-#if 0
-#if ( ECP_PROJECTIVE_COORD == JACOBIAN )
-/*
-// initial k-Doubling routine:
-//
-// for(i=0; i<k; i++) { // complexity = 6s+4m
-// W[i] = a*Z[i]^4
-// M[i] = 3*X[i]^2 + W[i]
-// S[i] = 4*X[i]*Y[i]^2
-// T[i] = 8*Y[i]^4
-// X[i+1] = M[i]^2 -2*S[i]
-// Y[i+1] = M[i]*(S[i]-X[i+1]) -T[i]
-// Z[i+1] = 2Y[i]*Z[i]
-// }
-//
-// could be improved by considering:
-// W[i] = a*Z[i]^4
-// Z[i+1] = 2*Y[i]*Z[i]
-// T[i] = 8*Y[i]^4
-// therefore
-// W[i+1] = a*Z[i+1]^4
-// = a*(2*Y[i]*Z[i])^4
-// = a*16*Y[i]^4*Z[i]^4 = (a*Z[i]^4) *2 * (8*Y[i]^4)
-// = 2*W[i]*T[i] - which eliminates 2 squarings
-//
-// improved k-Doubling routine:
-// W[0] = a*Z[0]^4
-// M[0] = 3*X[0]^2 + W[0]
-// S[0] = 4*X[0]*Y[0]^2
-// T[0] = 8*Y[0]^4
-// X[1] = M[0]^2 -2*S[0]
-// Y[1] = M[0]*(S[0]-X[1]) -T[0]
-// Z[1] = 2Y[0]*Z[0]
-// for(i=1; i<k; i++) { // complexity = 4s+4m per pass
-// W[i] = 2*T[i-1]*W[i-1]
-// M[i] = 3*X[i]^2 + W[i]
-// S[i] = 4*X[i]*Y[i]^2
-// T[i] = 8*Y[i]^4
-// X[i+1] = M[i]^2 -2*S[i]
-// Y[i+1] = M[i]*(S[i]-X[i+1]) -T[i]
-// Z[i+1] = 2Y[i]*Z[i]
-// }
-//
-// general complexity = (6s+4m) + (k-1)*(4s+4m)
-// epidl complexity = (4s+3m) + (k-1)*(4s+3m)
-*/
-IppsGFpECPoint* cpEcGFpDblPoint_k(IppsGFpECPoint* pR, const IppsGFpECPoint* pP,int k, IppsGFpECState* pEC)
-{
- IppsGFpState* pGF = ECP_GFP(pEC);
- int elemLen = GFP_FELEN(pGF);
-
- /* P at infinity => R at infinity */
- if( !IS_ECP_FINITE_POINT(pP) )
- return cpEcGFpSetProjectivePointAtInfinity(pR, elemLen);
-
- else {
- BNU_CHUNK_T* pW = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pM = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pS = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pT = cpGFpGetPool(1, pGF);
-
- BNU_CHUNK_T* pX = ECP_POINT_X(pR);
- BNU_CHUNK_T* pY = ECP_POINT_Y(pR);
- BNU_CHUNK_T* pZ = ECP_POINT_Z(pR);
- if(pR!=pP) {
- cpGFpElementCopy(pX, ECP_POINT_X(pP), elemLen);
- cpGFpElementCopy(pY, ECP_POINT_Y(pP), elemLen);
- cpGFpElementCopy(pZ, ECP_POINT_Z(pP), elemLen);
- }
-
- /* M = 3*X^2 + A*Z^4 */
- pGF->sqr(pS, pX, pGF); /* s */
- pGF->add(pM, pS, pS, pGF);
- pGF->add(pM, pM, pS, pGF);
- if(!EPID_PARAMS(pEC)) { /* W = A*Z^4 */
- pGF->sqr(pW, pZ, pGF); /* s */
- pGF->sqr(pW, pW, pGF); /* s */
- pGF->mul(pW, pW, ECP_A(pEC), pGF); /* m */
-
- pGF->add(pM, pM, pW, pGF);
- }
-
- /* T = 2*Y */
- pGF->add(pT, pY, pY, pGF);
-
- /* new Z = 2*Y*Z */
- pGF->mul(pZ, pT, pZ, pGF); /* m */
-
- /* S = X*(T^2) = 4*X*Y^2 */
- pGF->sqr(pT, pT, pGF); /* s */
- pGF->mul(pS, pX, pT, pGF); /* m */
-
- /* T = (T^2)/2 = (16*Y^4)/2 = 8*Y^4 */
- pGF->sqr(pT, pT, pGF); /* s */
- //cpGFpxHalve(pT, pT, pGF);
- cpGF->div2(pT, pT, pGF);
-
- /* new X = M^2 - 2*S */
- pGF->sqr(pX, pM, pGF); /* s */
- pGF->sub(pX, pX, pS, pGF);
- pGF->sub(pX, pX, pS, pGF);
-
- /* new Y = M*(S - new X) - T */
- pGF->sub(pY, pS, pX, pGF);
- pGF->mul(pY, pY, pM, pGF); /* m */
- pGF->sub(pY, pY, pT, pGF);
-
- for(k--; k>0; k--) {
- /* new W = 2*T*W */
- if(!EPID_PARAMS(pEC)) {
- pGF->mul(pW, pW, pT, pGF); /* m */
- pGF->add(pW, pW, pW, pGF);
- }
-
- /* M = 3*X^2 + new W */
- pGF->sqr(pS, pX, pGF); /* s */
- pGF->add(pM, pS, pS, pGF);
- pGF->add(pM, pM, pS, pGF);
- if(!EPID_PARAMS(pEC)) {
- pGF->add(pM, pM, pW, pGF);
- }
-
- /* T = 2*Y */
- pGF->add(pT, pY, pY, pGF);
-
- /* new Z = 2*Y*Z */
- pGF->mul(pZ, pT, pZ, pGF); /* m */
-
- /* S = X*(T^2) = 4*X*Y^2 */
- pGF->sqr(pT, pT, pGF); /* s */
- pGF->mul(pS, pX, pT, pGF); /* m */
-
- /* T = (T^2)/2 = (16*Y^4)/2 = 8*Y^4 */
- pGF->sqr(pT, pT, pGF); /* s */
- //cpGFpxHalve(pT, pT, pGF);
- cpGF->div2(pT, pT, pGF);
-
- /* new X = M^2 - 2*S */
- pGF->sqr(pX, pM, pGF); /* s */
- pGF->sub(pX, pX, pS, pGF);
- pGF->sub(pX, pX, pS, pGF);
-
- /* new Y = M*(S - new X) - T */
- pGF->sub(pY, pS, pX, pGF);
- pGF->mul(pY, pY, pM, pGF); /* m */
- pGF->sub(pY, pY, pT, pGF);
- }
-
- ECP_POINT_FLAGS(pR) = ECP_FINITE_POINT;
-
- cpGFpReleasePool(4, pGF);
- return pR;
- }
-}
-#endif
-#endif
-
-
-IppsGFpECPoint* cpEcGFpDblPoint_k(IppsGFpECPoint* pR, const IppsGFpECPoint* pP,int k, IppsGFpECState* pEC)
-{
- cpEcGFpDblPoint(pR, pP, pEC);
- k--;
- for(; k>0; k--)
- cpEcGFpDblPoint(pR, pR, pEC);
-
- return pR;
-}
-
-
-#if ( ECP_PROJECTIVE_COORD == JACOBIAN )
-/* complexity = 4s+12m */
-IppsGFpECPoint* cpEcGFpAddPoint (IppsGFpECPoint* pPointR, const IppsGFpECPoint* pPointP, const IppsGFpECPoint* pPointQ, IppsGFpECState* pEC)
-{
- IppsGFpState* pGF = ECP_GFP(pEC);
- int elemLen = GFP_FELEN(pGF);
-
- int inftyP = cpEcGFpIsProjectivePointAtInfinity(pPointP, elemLen);
- int inftyQ = cpEcGFpIsProjectivePointAtInfinity(pPointQ, elemLen);
-
- /*
- // addition
- */
- BNU_CHUNK_T* pA = cpEcGFpGetPool(3, pEC);
- BNU_CHUNK_T* pB = pA + elemLen;
- BNU_CHUNK_T* pC = pB + elemLen;
- BNU_CHUNK_T* pD = pC + elemLen;
- BNU_CHUNK_T* pW = pD + elemLen;
- BNU_CHUNK_T* pV = pW + elemLen;
-
- BNU_CHUNK_T* pRx = pV + elemLen; /* temporary result */
- BNU_CHUNK_T* pRy = pRx+ elemLen;
- BNU_CHUNK_T* pRz = pRy+ elemLen;
-
- /* coordinates of P */
- BNU_CHUNK_T* px1 = ECP_POINT_X(pPointP);
- BNU_CHUNK_T* py1 = ECP_POINT_Y(pPointP);
- BNU_CHUNK_T* pz1 = ECP_POINT_Z(pPointP);
-
- /* coordinates of Q */
- BNU_CHUNK_T* px2 = ECP_POINT_X(pPointQ);
- BNU_CHUNK_T* py2 = ECP_POINT_Y(pPointQ);
- BNU_CHUNK_T* pz2 = ECP_POINT_Z(pPointQ);
-
- /* coordinates of R */
- //BNU_CHUNK_T* px3 = ECP_POINT_X(pPointR);
- //BNU_CHUNK_T* py3 = ECP_POINT_Y(pPointR);
- //BNU_CHUNK_T* pz3 = ECP_POINT_Z(pPointR);
-
- /* A = X1 * Z2^2 */
- /* C = Y1 * Z2^3 */
- if( IS_ECP_AFFINE_POINT(pPointQ) ) {
- cpGFpElementCopy(pA, px1, elemLen);
- cpGFpElementCopy(pC, py1, elemLen);
- }
- else {
- pGF->sqr(pA, pz2, pGF); /* s */
- pGF->mul(pC, pz2, pA, pGF); /* m */
- pGF->mul(pA, pA, px1, pGF); /* m */
- pGF->mul(pC, pC, py1, pGF); /* m */
- }
-
- /* B = X2 * Z1^2 */
- /* D = Y2 * Z1^3 */
- if( IS_ECP_AFFINE_POINT(pPointP) ) {
- cpGFpElementCopy(pB, px2, elemLen);
- cpGFpElementCopy(pD, py2, elemLen);
- }
- else {
- pGF->sqr(pB, pz1, pGF); /* s */
- pGF->mul(pD, pz1, pB, pGF); /* m */
- pGF->mul(pB, pB, px2, pGF); /* m */
- pGF->mul(pD, pD, py2, pGF); /* m */
- }
-
- /* W = B-A */
- /* V = D-C */
- pGF->sub(pW, pB, pA, pGF);
- pGF->sub(pV, pD, pC, pGF);
-
- if( GFP_IS_ZERO(pW, elemLen) && !inftyP && !inftyQ ) {
- cpEcGFpReleasePool(3, pEC);
- if( GFP_IS_ZERO(pV, elemLen) )
- return cpEcGFpDblPoint(pPointR, pPointP, pEC);
- else
- return cpEcGFpSetProjectivePointAtInfinity(pPointR, elemLen);
- }
-
- /* Z3 = Z1*Z2*W */
- if( IS_ECP_AFFINE_POINT(pPointP) && IS_ECP_AFFINE_POINT(pPointQ) )
- cpGFpElementCopy(pRz, pW, elemLen);
- else {
- if( IS_ECP_AFFINE_POINT(pPointQ) )
- cpGFpElementCopy(pB, pz1, elemLen);
- else if ( IS_ECP_AFFINE_POINT(pPointP) )
- cpGFpElementCopy(pB, pz2, elemLen);
- else
- pGF->mul(pB, pz1, pz2, pGF); /* m */
- pGF->mul(pRz, pB, pW, pGF); /* m */
- }
-
- /* B = W^2 */
- pGF->sqr(pB, pW, pGF); /* s */
- /* A = A*W^2 */
- pGF->mul(pA, pB, pA, pGF); /* m */
- /* W = W^3 */
- pGF->mul(pW, pB, pW, pGF); /* m */
-
- /* X3 = V^2 - W^3 -2*A*W^2 */
- pGF->sqr(pRx, pV, pGF); /* s */
- pGF->sub(pRx, pRx, pW, pGF);
- pGF->sub(pRx, pRx, pA, pGF);
- pGF->sub(pRx, pRx, pA, pGF);
-
- /* Y3 = V*(A*W^2 - X3) -C*W^3 */
- pGF->sub(pRy, pA, pRx, pGF);
- pGF->mul(pC, pC, pW, pGF); /* m */
- pGF->mul(pRy, pRy, pV, pGF); /* m */
- pGF->sub(pRy, pRy, pC, pGF);
-
- cpMaskMove(pRx, px2, elemLen, inftyP);
- cpMaskMove(pRy, py2, elemLen, inftyP);
- cpMaskMove(pRz, pz2, elemLen, inftyP);
-
- cpMaskMove(pRx, px1, elemLen, inftyQ);
- cpMaskMove(pRy, py1, elemLen, inftyQ);
- cpMaskMove(pRz, pz1, elemLen, inftyQ);
-
- cpGFpElementCopy(ECP_POINT_DATA(pPointR), pRx, 3*elemLen);
- ECP_POINT_FLAGS(pPointR) = cpEcGFpIsProjectivePointAtInfinity(pPointR, elemLen)? 0 : ECP_FINITE_POINT;
-
- cpEcGFpReleasePool(3, pEC);
- return pPointR;
-}
-#endif
-
-#if ( ECP_PROJECTIVE_COORD == HOMOGENEOUS )
-/*
-// A = Y2 * Z1 - Y1 * Z2
-// B = X2 * Z1 - X1 * Z2
-// C = A^2*Z1*Z2 -B^3 -2*B^2*X1*Z2 = A^2*Z1*Z2 -B^2*(B+2*X1*Z2) = A^2*Z1*Z2 -B^2*(X2*Z1+X1*Z2)
-// new X = B*C
-// new Y = A*(B^2*X1*Z2 -C) -B^3*Y1*Z2
-// new Z = B^3*Z1*Z2
-//
-// note: Y1*Z2, X2*Z1, X1*Z2, Z1*Z2 are using several times
-// (T1), (T2), (T3) (T4)
-//
-// complexity = 2s+13m
-*/
-IppsGFpECPoint* cpEcGFpAddPoint (IppsGFpECPoint* pPointR, const IppsGFpECPoint* pP1, const IppsGFpECPoint* pP2, IppsGFpECState* pEC)
-{
- IppsGFpState* pGF = ECP_GFP(pEC);
- int elemLen = GFP_FELEN(pGF);
-
- /* test stupid call */
- if( pP1 == pP2)
- return cpEcGFpDblPoint(pPointR, pP1, pEC);
-
- /* prevent operation with point at Infinity */
- if( !IS_ECP_FINITE_POINT(pP1) )
- return cpEcGFpCopyPoint(pPointR, pP2, elemLen);
- if( !IS_ECP_FINITE_POINT(pP2) )
- return cpEcGFpCopyPoint(pPointR, pP1, elemLen);
-
- /*
- // addition
- */
- {
- BNU_CHUNK_T* pT1 = cpEcGFpGetPool(3, pEC);
- BNU_CHUNK_T* pT2 = pT1 + elemLen;
- BNU_CHUNK_T* pT3 = pT2 + elemLen;
- BNU_CHUNK_T* pT4 = pT3 + elemLen;
- BNU_CHUNK_T* pA = pT4 + elemLen;
- BNU_CHUNK_T* pB = pA + elemLen;
- BNU_CHUNK_T* pC = pB + elemLen;
- BNU_CHUNK_T* pB2 = pC + elemLen;
- BNU_CHUNK_T* pB3 = pB2 + elemLen;
-
- /* coordinates of P1 */
- BNU_CHUNK_T* pX1 = ECP_POINT_X(pP1);
- BNU_CHUNK_T* pY1 = ECP_POINT_Y(pP1);
- BNU_CHUNK_T* pZ1 = ECP_POINT_Z(pP1);
-
- /* coordinates of P2 */
- BNU_CHUNK_T* pX2 = ECP_POINT_X(pP2);
- BNU_CHUNK_T* pY2 = ECP_POINT_Y(pP2);
- BNU_CHUNK_T* pZ2 = ECP_POINT_Z(pP2);
-
- /* A = Y2 * Z1 - Y1 * Z2 */
- pGF->mul(pA, pY2, pZ1, pGF); /* m */
- pGF->mul(pT1,pY1, pZ2, pGF); /* m */
- pGF->sub(pA, pA, pT1, pGF);
-
- /* B = X2 * Z1 - X1 * Z2 */
- pGF->mul(pT2,pX2, pZ1, pGF); /* m */
- pGF->mul(pT3,pX1, pZ2, pGF); /* m */
- pGF->sub(pB, pT2, pT3, pGF);
-
- if( GFP_IS_ZERO(pB, elemLen) ) {
- cpEcGFpReleasePool(3, pEC);
- if( GFP_IS_ZERO(pA, elemLen) )
- return cpEcGFpDblPoint(pPointR, pP1, pEC);
- else
- return cpEcGFpSetProjectivePointAtInfinity(pPointR, elemLen);
- }
-
- /* C = A^2*Z1*Z2 -B^2*(X2*Z1+X1*Z2) */
- pGF->sqr(pB2, pB, pGF); /* s */
- pGF->add(pT2,pT2, pT3, pGF);
- pGF->mul(pT2,pT2, pB2, pGF); /* m */
- pGF->mul(pT4,pZ1, pZ2, pGF); /* m */
- pGF->sqr(pC, pA, pGF); /* s */
- pGF->mul(pC, pC, pT4, pGF); /* m */
- pGF->sub(pC, pC, pT2, pGF);
-
- /* new X = B*C */
- pGF->mul(ECP_POINT_X(pPointR), pB, pC, pGF); /* m */
-
- /* new Y = A*(B^2*X1*Z2 -C) -B^3*Y1*Z2 */
- pGF->mul(pT3, pT3, pB2, pGF); /* m */ /* T3 = (X1*Z2)*B^2 */
- pGF->sub(pT3, pT3, pC, pGF);
- pGF->mul(pT3, pT3, pA, pGF); /* m */ /* T3 = A*(B^2*X1*Z2 -C) */
- pGF->mul(pB3, pB2, pB, pGF); /* m */ /* B3 = B^3 */
- pGF->mul(pT1, pT1, pB3, pGF); /* m */ /* T1 = B^3*Y1*Z2 */
- pGF->sub(ECP_POINT_Y(pPointR), pT3, pT1, pGF);
-
- /* new Z = B^3*Z1*Z2 */
- pGF->mul(ECP_POINT_Z(pPointR), pB3, pT4, pGF); /* m */
-
- ECP_POINT_FLAGS(pPointR) = ECP_FINITE_POINT;
-
- cpEcGFpReleasePool(3, pEC);
- return pPointR;
- }
-}
-#endif
-
-#if 0
-/* non-sscm version */
-IppsGFpECPoint* cpEcGFpMulPoint(IppsGFpECPoint* pPointR, const IppsGFpECPoint* pPointP, const BNU_CHUNK_T* pN, int nsN, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)
-{
- IppsGFpState* pGF = ECP_GFP(pEC);
- int elemLen = GFP_FELEN(pGF);
-
- UNREFERENCED_PARAMETER(pScratchBuffer);
-
- /* test scalar and input point */
- if( GFP_IS_ZERO(pN, nsN) || !IS_ECP_FINITE_POINT(pPointP) )
- return cpEcGFpSetProjectivePointAtInfinity(pPointR, elemLen);
-
- /* remove leding zeros */
- FIX_BNU(pN, nsN);
-
- /* case N==1 => R = P */
- if( GFP_IS_ONE(pN, nsN) ) {
- cpEcGFpCopyPoint(pPointR, pPointP, elemLen);
- return pPointR;
- }
-
- /*
- // scalar multiplication
- */
- else {
- int i;
-
- BNU_CHUNK_T* pH = cpGFpGetPool(1, pGF);
- BNU_CHUNK_T* pK = cpGFpGetPool(1, pGF);
-
- IppsGFpECPoint T, U;
- cpEcGFpInitPoint(&T, cpEcGFpGetPool(1, pEC),0, pEC);
- cpEcGFpInitPoint(&U, cpEcGFpGetPool(1, pEC),0, pEC);
-
- /* H = 3*N */
- cpGFpElementCopy(pK, pN, nsN);
- pK[nsN] = 0;
- i = cpAdd_BNU(pH, pK, pK, nsN+1);
- i = cpAdd_BNU(pH, pK, pH, nsN+1);
-
- /* T = affine(P) */
- if( IS_ECP_AFFINE_POINT(pPointP) )
- cpEcGFpCopyPoint(&T, pPointP, elemLen);
- else {
- cpEcGFpGetAffinePoint(ECP_POINT_X(&T), ECP_POINT_Y(&T), pPointP, pEC);
- cpEcGFpSetAffinePoint(&T, ECP_POINT_X(&T), ECP_POINT_Y(&T), pEC);
- }
- /* U = affine(-P) */
- cpEcGFpNegPoint(&U, &T, pEC);
-
- /* R = T = affine(P) */
- cpEcGFpCopyPoint(pPointR, &T, elemLen);
-
- /*
- // point multiplication
- */
- for(i=MSB_BNU(pH, nsN+1)-1; i>0; i--) {
- Ipp32u hBit = TST_BIT(pH, i);
- Ipp32u kBit = TST_BIT(pK, i);
- cpEcGFpDblPoint(pPointR, pPointR, pEC);
- if( hBit && !kBit )
- cpEcGFpAddPoint(pPointR, &T, pPointR, pEC);
- if(!hBit && kBit )
- cpEcGFpAddPoint(pPointR, &U, pPointR, pEC);
- }
-
- cpEcGFpReleasePool(2, pEC);
- cpGFpReleasePool(2, pGF);
-
- return pPointR;
- }
-}
-#endif
-
-static int div_upper(int a, int d)
-{ return (a+d-1)/d; }
-
-#if 0
-static int getNumOperations(int bitsize, int w)
-{
- int n_overhead = (1<<w) -1;
- int n_ops = div_upper(bitsize, w) + n_overhead;
- return n_ops;
-}
-int cpEcGFpGetOptimalWinSize(int bitsize)
-{
-#define LIMIT (LOG2_CACHE_LINE_SIZE)
- int w_opt = 1;
- int n_opt = getNumOperations(bitsize, w_opt);
- int w_trial;
- for(w_trial=w_opt+1; w_trial<=LIMIT; w_trial++) {
- int n_trial = getNumOperations(bitsize, w_trial);
- if(n_trial>=n_opt) break;
- w_opt = w_trial;
- n_opt = n_trial;
- }
- return w_opt;
-#undef LIMIT
-}
-
-static int cpEcGFpConverRepresentation(BNU_CHUNK_T* pInput, int inpBits, int w)
-{
- Ipp32u* pR = (Ipp32u*)pInput;
- Ipp16u* pR16 = (Ipp16u*)pInput;
-
- int outBits = 0;
- Ipp32u base = (BNU_CHUNK_T)1<<w;
- Ipp32u digitMask = base-1;
- int i;
-
- int nsR = BITS2WORD32_SIZE(inpBits);
- pR[nsR] = 0; // expand input
- for(i=0; i<inpBits; i+=w) {
- cpSize chunkIdx = i/BITSIZE(Ipp16u);
- Ipp32u chunk = ((Ipp32u*)(pR16+chunkIdx))[0];
- int digitShift = i % BITSIZE(Ipp16u);
- Ipp32u digit = (chunk>>digitShift) &digitMask;
-
- Ipp32u delta = (base-digit) & ~digitMask;
- delta <<= digitShift;
- cpDec_BNU32((Ipp32u*)(pR16+chunkIdx), (Ipp32u*)(pR16+chunkIdx), (2*nsR-chunkIdx+1)/2, delta);
-
- inpBits = BITSIZE_BNU32(pR, nsR);
- outBits += w;
- }
-
- return outBits;
-}
-#endif
-
-/* sscm version */
-IppsGFpECPoint* cpEcGFpMulPoint(IppsGFpECPoint* pPointR, const IppsGFpECPoint* pPointP, const BNU_CHUNK_T* pN, int nsN, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)
-{
- IppsGFpState* pGF = ECP_GFP(pEC);
- int elemLen = GFP_FELEN(pGF);
-
- /* test scalar and input point */
- if( GFP_IS_ZERO(pN, nsN) || !IS_ECP_FINITE_POINT(pPointP) )
- return cpEcGFpSetProjectivePointAtInfinity(pPointR, elemLen);
-
- /* remove leding zeros */
- FIX_BNU(pN, nsN);
-
- /* case N==1 => R = P */
- if( GFP_IS_ONE(pN, nsN) ) {
- cpEcGFpCopyPoint(pPointR, pPointP, elemLen);
- return pPointR;
- }
-
- {
- Ipp8u* pScratchAligned; /* aligned scratch buffer */
- int nAllocation = 0; /* points from the pool */
-
- /* size of point (dwords) */
- int pointDataSize = ECP_FELEN(pEC)*sizeof(BNU_CHUNK_T);
- int pointDataSize32 = ECP_FELEN(pEC)*sizeof(BNU_CHUNK_T)/sizeof(Ipp32u);
-
- /* scalar bitsize */
- int scalarBitSize = BITSIZE_BNU(pN, nsN);
- /* optimal size of window */
- int window_size = (NULL==pScratchBuffer)? 1 : 5;
- /* number of table entries */
- int nPrecomputed = 1<<(window_size-1);
-
- IppsGFpECPoint T;
- cpEcGFpInitPoint(&T, cpEcGFpGetPool(1, pEC),0, pEC);
- cpEcGFpCopyPoint(&T, pPointP, elemLen);
-
- if(NULL==pScratchBuffer) {
- nAllocation = 1 + div_upper(CACHE_LINE_SIZE, pointDataSize);
- pScratchBuffer = (Ipp8u*)cpEcGFpGetPool(nAllocation, pEC);
- }
- pScratchAligned = IPP_ALIGNED_PTR(pScratchBuffer, CACHE_LINE_SIZE);
-
- /* pre-compute auxiliary table t[] = {1*P, 2*P, ..., nPrecomputed*P} */
- {
- int n;
- cpScatter32((Ipp32u*)pScratchAligned, nPrecomputed, 0, (Ipp32u*)ECP_POINT_DATA(&T), pointDataSize32);
- for(n=1; n<nPrecomputed; n++) {
- cpEcGFpAddPoint(&T, &T, pPointP, pEC);
- cpScatter32((Ipp32u*)pScratchAligned, nPrecomputed, n, (Ipp32u*)ECP_POINT_DATA(&T), pointDataSize32);
- }
- }
-
- {
- BNU_CHUNK_T* pNegY = cpGFpGetPool(1, pGF);
-
- BNU_CHUNK_T* pScalar = cpGFpGetPool(2, pGF);
- Ipp8u* pScalar8 = (Ipp8u*)pScalar;
- /* copy scalar value */
- cpGFpElementCopy(pScalar, pN, nsN);
-
- /* zero expanded scalar value */
- pScalar[BITS_BNU_CHUNK(scalarBitSize)] = 0;
-
- /*
- // scalar multiplication
- */
- {
- Ipp8u digit, sign;
-
- BNU_CHUNK_T dmask = (1<<(window_size+1)) -1;
-
- /* position (bit number) of the leftmost window */
- //int bit = scalarBitSize-window_size;
- int bit = scalarBitSize - (scalarBitSize % window_size);
-
- /* first window */
- int wvalue = *((Ipp16u*)&pScalar8[(bit-1)/8]);
- wvalue = (wvalue>> ((bit-1)%8)) & dmask;
- booth_recode(&sign, &digit, (Ipp8u)wvalue, window_size);
-
- cpGather32((Ipp32u*)ECP_POINT_DATA(pPointR), pointDataSize32, (Ipp32u*)pScratchAligned, nPrecomputed, digit);
- ECP_POINT_FLAGS(pPointR) = 0;
-
- for(bit-=window_size; bit>=window_size; bit-=window_size) {
- /* window_size times doubling */
- cpEcGFpDblPoint_k(pPointR, pPointR, window_size, pEC);
-
- /* extract next window value */
- wvalue = *((Ipp16u*)&pScalar8[(bit-1)/8]);
- wvalue = (wvalue>> ((bit-1)%8)) & dmask;
- booth_recode(&sign, &digit, (Ipp8u)wvalue, window_size);
-
- /* extract value from the pre-computed table */
- cpGather32((Ipp32u*)ECP_POINT_DATA(&T), pointDataSize32, (Ipp32u*)pScratchAligned, nPrecomputed, digit);
-
- pGF->neg(pNegY, ECP_POINT_Y(&T), pGF);
- cpMaskMove(ECP_POINT_Y(&T), pNegY, elemLen, sign);
-
- /* and add it */
- cpEcGFpAddPoint(pPointR, pPointR, &T, pEC);
- }
-
- /* last window */
- cpEcGFpDblPoint_k(pPointR, pPointR, window_size, pEC);
-
- wvalue = *((Ipp16u*)&pScalar8[0]);
- wvalue = (wvalue <<1) & dmask;
- booth_recode(&sign, &digit, (Ipp8u)wvalue, window_size);
-
- cpGather32((Ipp32u*)ECP_POINT_DATA(&T), pointDataSize32, (Ipp32u*)pScratchAligned, nPrecomputed, digit);
-
- pGF->neg(pNegY, ECP_POINT_Y(&T), pGF);
- cpMaskMove(ECP_POINT_Y(&T), pNegY, elemLen, sign);
-
- cpEcGFpAddPoint(pPointR, pPointR, &T, pEC);
- }
-
- cpGFpReleasePool(2+1, pGF);
- }
-
- cpEcGFpReleasePool(nAllocation+1, pEC);
-
- return pPointR;
- }
-}
diff --git a/ext/ipp/sources/ippcpepid/src/pcpgfphashstuff.h b/ext/ipp/sources/ippcpepid/src/pcpgfphashstuff.h
deleted file mode 100644
index a17cb01..0000000
--- a/ext/ipp/sources/ippcpepid/src/pcpgfphashstuff.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-//
-// Purpose:
-// Intel(R) Performance Primitives. Cryptography Primitives.
-// Internal hash wrappers
-//
-//
-*/
-
-#if !defined(_CP_GFP_HASH_H_)
-#define _CP_GFP_HASH_H_
-
-#include "owncpepid.h"
-
-#include "pcphash.h"
-
-/* init context */
-__INLINE int cpTestHashID(IppHashID id)
-{
- switch (id) {
- case ippMD5:
- case ippSHA1:
- case ippSHA256:
- case ippSHA224:
- case ippSHA512:
- case ippSHA384:return 1;
- default: return 0;
- }
-}
-
-/* init context */
-__INLINE IppStatus cpHashInit(void* pCtx, IppHashID id)
-{
- switch (id) {
- case ippMD5: return ippsMD5Init((IppsMD5State*)pCtx);
- case ippSHA1: return ippsSHA1Init((IppsSHA1State*)pCtx);
- case ippSHA256:return ippsSHA256Init((IppsSHA256State*)pCtx);
- case ippSHA224:return ippsSHA224Init((IppsSHA224State*)pCtx);
- case ippSHA512:return ippsSHA512Init((IppsSHA512State*)pCtx);
- case ippSHA384:return ippsSHA384Init((IppsSHA384State*)pCtx);
- default: return ippStsBadArgErr;
- }
-}
-
-/* update hash */
-__INLINE IppStatus cpHashUpdate(const Ipp8u* pMsg, int msgLen, void* pCtx, IppHashID id)
-{
- switch (id) {
- case ippMD5: return ippsMD5Update(pMsg, msgLen, (IppsMD5State*)pCtx);
- case ippSHA1: return ippsSHA1Update(pMsg, msgLen, (IppsSHA1State*)pCtx);
- case ippSHA256:return ippsSHA256Update(pMsg, msgLen, (IppsSHA256State*)pCtx);
- case ippSHA224:return ippsSHA224Update(pMsg, msgLen, (IppsSHA224State*)pCtx);
- case ippSHA512:return ippsSHA512Update(pMsg, msgLen, (IppsSHA512State*)pCtx);
- case ippSHA384:return ippsSHA384Update(pMsg, msgLen, (IppsSHA384State*)pCtx);
- default: return ippStsBadArgErr;
- }
-}
-
-/* hash length */
-__INLINE int cpHashLength(IppHashID id)
-{
- switch (id) {
- case ippMD5: return IPP_MD5_DIGEST_BITSIZE/BYTESIZE;
- case ippSHA1: return IPP_SHA1_DIGEST_BITSIZE/BYTESIZE;
- case ippSHA256:return IPP_SHA256_DIGEST_BITSIZE/BYTESIZE;
- case ippSHA224:return IPP_SHA224_DIGEST_BITSIZE/BYTESIZE;
- case ippSHA512:return IPP_SHA512_DIGEST_BITSIZE/BYTESIZE;
- case ippSHA384:return IPP_SHA384_DIGEST_BITSIZE/BYTESIZE;
- default: return 0;
- }
-}
-
-/* final hash */
-__INLINE IppStatus cpHashFinal(Ipp8u* pMd, void* pCtx, IppHashID id)
-{
- switch (id) {
- case ippMD5: return ippsMD5Final(pMd, (IppsMD5State*)pCtx);
- case ippSHA1: return ippsSHA1Final(pMd, (IppsSHA1State*)pCtx);
- case ippSHA256:return ippsSHA256Final(pMd, (IppsSHA256State*)pCtx);
- case ippSHA224:return ippsSHA224Final(pMd, (IppsSHA224State*)pCtx);
- case ippSHA512:return ippsSHA512Final(pMd, (IppsSHA512State*)pCtx);
- case ippSHA384:return ippsSHA384Final(pMd, (IppsSHA384State*)pCtx);
- default: return ippStsBadArgErr;
- }
-}
-
-/* whole message hash */
-__INLINE IppStatus cpHashMessage(const Ipp8u* pMsg, int msgLen, Ipp8u* pMd, IppHashID id)
-{
- switch (id) {
- case ippMD5: return ippsMD5MessageDigest(pMsg, msgLen, pMd);
- case ippSHA1: return ippsSHA1MessageDigest(pMsg, msgLen, pMd);
- case ippSHA256:return ippsSHA256MessageDigest(pMsg, msgLen, pMd);
- case ippSHA224:return ippsSHA224MessageDigest(pMsg, msgLen, pMd);
- case ippSHA512:return ippsSHA512MessageDigest(pMsg, msgLen, pMd);
- case ippSHA384:return ippsSHA384MessageDigest(pMsg, msgLen, pMd);
- default: return ippStsBadArgErr;
- }
-}
-
-#endif /* _CP_GFP_HASH_H_ */
diff --git a/ext/ipp/sources/ippcpepid/src/pcpgfpstuff.c b/ext/ipp/sources/ippcpepid/src/pcpgfpstuff.c
deleted file mode 100644
index 3edace9..0000000
--- a/ext/ipp/sources/ippcpepid/src/pcpgfpstuff.c
+++ /dev/null
@@ -1,486 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-// Intel(R) Performance Primitives. Cryptography Primitives.
-// Internal operations over GF(p).
-//
-// Context:
-// cpGFpCmpare
-//
-// cpGFpRand
-// cpGFpSet
-// cpGFpGet
-//
-// cpGFpNeg
-// cpGFpInv
-// cpGFpHalve
-// cpGFpAdd
-// cpGFpSub
-// cpGFpMul
-// cpGFpExp, cpGFpExp2
-// cpGFpSqrt
-//
-//
-*/
-
-#include "owncpepid.h"
-
-#include "pcpgfpstuff.h"
-
-IppsBigNumState* cpGFpInitBigNum(IppsBigNumState* pBN, int len, BNU_CHUNK_T* pNumBuffer, BNU_CHUNK_T* pTmpBuffer)
-{
- BN_ID(pBN) = idCtxBigNum;
- BN_SIGN(pBN) = ippBigNumPOS;
- BN_NUMBER(pBN) = pNumBuffer;
- BN_BUFFER(pBN) = pTmpBuffer;
- BN_ROOM(pBN) = len;
- BN_SIZE(pBN) = 0;
- return pBN;
-}
-
-IppsBigNumState* cpGFpSetBigNum(IppsBigNumState* pBN, int len, const BNU_CHUNK_T* pBNU, BNU_CHUNK_T* pTmpBuffer)
-{
- cpGFpInitBigNum(pBN, len, (BNU_CHUNK_T*)pBNU, pTmpBuffer);
- FIX_BNU(pBNU, len);
- BN_SIZE(pBN) = len;
- return pBN;
-}
-
-static void cpGFpMontEncode(BNU_CHUNK_T* pR, BNU_CHUNK_T* pA, int elemLen, IppsMontState* pMont)
-{
- cpMontEnc_BNU(pR, pA, elemLen, pMont);
-}
-
-static void cpGFpMontDecode(BNU_CHUNK_T* pR, BNU_CHUNK_T* pA, int elemLen, IppsMontState* pMont)
-{
- cpMontDec_BNU(pR, pA, elemLen, pMont);
-}
-
-/*
-// compare GF.
-// returns:
-// 0 - are equial
-// 1 - are different
-// 2 - different structure
-*/
-int cpGFpCompare(const IppsGFpState* pGFp1, const IppsGFpState* pGFp2)
-{
- if( GFP_DEGREE(pGFp1) != GFP_DEGREE(pGFp2) )
- return 2;
- if( GFP_FELEN(pGFp1) != GFP_FELEN(pGFp2) )
- return 1;
- if(0 != cpGFpElementCmp(GFP_MODULUS(pGFp1), GFP_MODULUS(pGFp1), GFP_FELEN(pGFp1)) )
- return 1;
- return 0;
-}
-
-BNU_CHUNK_T* cpGFpSet(BNU_CHUNK_T* pElm, const BNU_CHUNK_T* pDataA, int nsA, IppsGFpState* pGF, int montSpace)
-{
- const BNU_CHUNK_T* pModulus = GFP_MODULUS(pGF);
- int elemLen = GFP_FELEN(pGF);
-
- if(0 <= cpCmp_BNU(pDataA, nsA, pModulus, elemLen))
- return NULL;
-
- else {
- ZEXPAND_COPY_BNU(pElm, elemLen, pDataA, nsA);
-
- if(montSpace)
- cpGFpMontEncode(pElm, pElm, elemLen, GFP_MONT(pGF));
-
- return pElm;
- }
-}
-
-BNU_CHUNK_T* cpGFpSetOctString(BNU_CHUNK_T* pElm, const Ipp8u* pStr, int strSize, IppsGFpState* pGF, int montSpace)
-{
- int elemLen = GFP_FELEN(pGF);
-
- if((int)(elemLen*sizeof(BNU_CHUNK_T)) < strSize)
- return NULL;
-
- else {
- BNU_CHUNK_T* pTmp = cpGFpGetPool(1, pGF);
-
- int len = cpFromOctStr_BNU(pTmp, pStr, strSize);
- pElm = cpGFpSet(pElm, pTmp, len, pGF, montSpace);
-
- cpGFpReleasePool(1, pGF);
- return pElm;
- }
-}
-
-BNU_CHUNK_T* cpGFpGet(BNU_CHUNK_T* pDataA, int nsA, const BNU_CHUNK_T* pElm, IppsGFpState* pGFp, int montSpace)
-{
- int elemLen = GFP_FELEN(pGFp);
- BNU_CHUNK_T* pTmp = GFP_POOL(pGFp);
-
- cpGFpElementCopy(pTmp, pElm, elemLen);
-
- if(montSpace)
- cpGFpMontDecode(pTmp, pTmp, elemLen, GFP_MONT(pGFp));
-
- ZEXPAND_COPY_BNU(pDataA, nsA, pTmp, elemLen);
- return pDataA;
-}
-
-Ipp8u* cpGFpGetOctString(Ipp8u* pStr, int strSize, const BNU_CHUNK_T* pA, IppsGFpState* pGF, int montSpace)
-{
- BNU_CHUNK_T* pTmp = cpGFpGetPool(1, pGF);
- int elemLen = GFP_FELEN(pGF);
-
- if(montSpace)
- cpGFpMontDecode(pTmp, (BNU_CHUNK_T*)pA, elemLen, GFP_MONT(pGF));
- else
- cpGFpElementCopy(pTmp, pA, elemLen);
-
- cpToOctStr_BNU(pStr, strSize, pTmp, elemLen);
-
- cpGFpReleasePool(1, pGF);
-
- return pStr;
-}
-
-/* sscm version */
-BNU_CHUNK_T* cpGFpNeg(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
-{
- BNU_CHUNK_T* pTmpR = cpGFpGetPool(1, pGF);
-
- BNU_CHUNK_T* pModulus = GFP_MODULUS(pGF);
- int elemLen = GFP_FELEN(pGF);
-
- BNU_CHUNK_T e = cpSub_BNU(pR, pModulus, pA, elemLen);
- e -= cpSub_BNU(pTmpR, pR, pModulus, elemLen);
- MASKED_COPY(pR, e, pR, pTmpR, elemLen);
-
- cpGFpReleasePool(1, pGF);
-
- return pR;
-}
-
-#if(_IPP32E >= _IPP32E_M7)
-BNU_CHUNK_T* cp256pNeg(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
-{
- return gf256_neg(pR, pA, GFP_MODULUS(pGF));
-}
-#endif
-
-
-BNU_CHUNK_T* cpGFpInv(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
-{
- BNU_CHUNK_T* pModulus = GFP_MODULUS(pGF);
- int elemLen = GFP_FELEN(pGF);
- int poolelementLen= GFP_PELEN(pGF);
-
- BNU_CHUNK_T* tmpM = cpGFpGetPool(4, pGF);
- BNU_CHUNK_T* tmpX1= tmpM +poolelementLen;
- BNU_CHUNK_T* tmpX2= tmpX1+poolelementLen;
- BNU_CHUNK_T* tmpX3= tmpX2+poolelementLen;
- int nsR;
-
- cpGFpElementCopy(tmpM, pModulus, elemLen);
- nsR = cpModInv_BNU(pR, pA,elemLen, tmpM, elemLen, tmpX1,tmpX2,tmpX3);
- cpGFpReleasePool(4, pGF);
-
- cpGFpElementPadd(pR+nsR, elemLen-nsR, 0);
- return cpGFpMul(pR, pR, MNT_CUBE_R(GFP_MONT(pGF)), pGF);
-}
-
-
-/* sscm version */
-BNU_CHUNK_T* cpGFpHalve(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
-{
- BNU_CHUNK_T* pModulus = GFP_MODULUS(pGF);
- int elemLen = GFP_FELEN(pGF);
-
- BNU_CHUNK_T mask = 0 - (pA[0]&1); /* set mask iif A is odd */
- /* t = if(isOdd(A))? modulus : 0 */
- int i;
- BNU_CHUNK_T* t = cpGFpGetPool(1, pGF);
- for(i=0; i<elemLen; i++) t[i] = pModulus[i] & mask;
-
- t[elemLen] = cpAdd_BNU(t, t, pA, elemLen);
- cpLSR_BNU(t, t, elemLen+1, 1);
- cpGFpElementCopy(pR, t, elemLen);
-
- cpGFpReleasePool(1, pGF);
-
- return pR;
-}
-
-#if(_IPP32E >= _IPP32E_M7)
-BNU_CHUNK_T* cp256pHalve(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
-{
- return gf256_div2(pR, pA, GFP_MODULUS(pGF));
-}
-#endif
-
-
-/* sscm version */
-BNU_CHUNK_T* cpGFpAdd(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF)
-{
- BNU_CHUNK_T* pTmpR = cpGFpGetPool(1, pGF);
-
- BNU_CHUNK_T* pModulus = GFP_MODULUS(pGF);
- int elemLen = GFP_FELEN(pGF);
-
- BNU_CHUNK_T e = cpAdd_BNU(pR, pA, pB, elemLen);
- e -= cpSub_BNU(pTmpR, pR, pModulus, elemLen);
- MASKED_COPY(pR, e, pR, pTmpR, elemLen);
-
- cpGFpReleasePool(1, pGF);
-
- return pR;
-}
-
-#if(_IPP32E >= _IPP32E_M7)
-BNU_CHUNK_T* cp256pAdd(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF)
-{
- return gf256_add(pR, pA, pB, GFP_MODULUS(pGF));
-}
-#endif
-
-
-/* sscm version */
-BNU_CHUNK_T* cpGFpSub(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF)
-{
- BNU_CHUNK_T* pTmpR = cpGFpGetPool(1, pGF);
-
- BNU_CHUNK_T* pModulus = GFP_MODULUS(pGF);
- int elemLen = GFP_FELEN(pGF);
-
- BNU_CHUNK_T e = cpSub_BNU(pR, pA, pB, elemLen);
- cpAdd_BNU(pTmpR, pR, pModulus, elemLen);
- MASKED_COPY(pR, (0-e), pTmpR, pR, elemLen);
-
- cpGFpReleasePool(1, pGF);
-
- return pR;
-}
-
-#if(_IPP32E >= _IPP32E_M7)
-BNU_CHUNK_T* cp256pSub(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF)
-{
- return gf256_sub(pR, pA, pB, GFP_MODULUS(pGF));
-}
-#endif
-
-
-BNU_CHUNK_T* cpGFpMul(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF)
-{
- BNU_CHUNK_T* pModulus = GFP_MODULUS(pGF);
- int elemLen = GFP_FELEN(pGF);
-
- IppsMontState* pMont = GFP_MONT(pGF);
- BNU_CHUNK_T* pBuffer = MNT_PRODUCT(pMont);
- BNU_CHUNK_T m0 = MNT_HELPER(pMont);
-
- cpMontMul_BNU(pR, pA,elemLen, pB,elemLen, pModulus,elemLen, m0, pBuffer, NULL);
- return pR;
-}
-
-#if(_IPP32E >= _IPP32E_M7)
-BNU_CHUNK_T* cp256pMul(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGF)
-{
- BNU_CHUNK_T* pModulus = GFP_MODULUS(pGF);
- IppsMontState* pMont = GFP_MONT(pGF);
- BNU_CHUNK_T m0 = MNT_HELPER(pMont);
- return gf256_mulm(pR, pA, pB, pModulus, m0);
-}
-#endif
-
-BNU_CHUNK_T* cpGFpSqr(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
-{
- BNU_CHUNK_T* pModulus = GFP_MODULUS(pGF);
- int elemLen = GFP_FELEN(pGF);
-
- IppsMontState* pMont = GFP_MONT(pGF);
- BNU_CHUNK_T* pBuffer = MNT_PRODUCT(pMont);
- BNU_CHUNK_T m0 = MNT_HELPER(pMont);
-
- cpMontSqr_BNU(pR, pA,elemLen, pModulus,elemLen, m0, pBuffer, NULL);
- return pR;
-}
-
-#if(_IPP32E >= _IPP32E_M7)
-BNU_CHUNK_T* cp256pSqr(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
-{
- BNU_CHUNK_T* pModulus = GFP_MODULUS(pGF);
- IppsMontState* pMont = GFP_MONT(pGF);
- BNU_CHUNK_T m0 = MNT_HELPER(pMont);
- return gf256_sqrm(pR, pA, pModulus, m0);
-}
-#endif
-
-
-BNU_CHUNK_T* cpGFpExp(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pE, int nsE, IppsGFpState* pGF)
-{
- IppsBigNumState A;
- IppsBigNumState E;
- IppsBigNumState R;
-
- BNU_CHUNK_T* pPool = cpGFpGetPool(3, pGF);
- int poolElemLen = GFP_PELEN(pGF);
- int elemLen = GFP_FELEN(pGF);
-
- cpGFpSetBigNum(&A, elemLen, pA, pPool+0*poolElemLen);
- cpGFpSetBigNum(&E, nsE, pE, pPool+1*poolElemLen);
- cpGFpInitBigNum(&R,elemLen, pR, pPool+2*poolElemLen);
-
- cpMontExpBin_BN(&R, &A, &E, GFP_MONT(pGF));
-
- cpGFpReleasePool(3, pGF);
- return pR;
-}
-
-
-static int factor2(BNU_CHUNK_T* pA, int nsA)
-{
- int factor = 0;
- int bits;
-
- int i;
- for(i=0; i<nsA; i++) {
- int ntz = cpNTZ_BNU(pA[i]);
- factor += ntz;
- if(ntz<BITSIZE(BNU_CHUNK_T))
- break;
- }
-
- bits = factor;
- if(bits >= BITSIZE(BNU_CHUNK_T)) {
- int nchunk = bits/BITSIZE(BNU_CHUNK_T);
- cpGFpElementCopyPadd(pA, nsA, pA+nchunk, nsA-nchunk);
- bits %= BITSIZE(BNU_CHUNK_T);
- }
- if(bits)
- cpLSR_BNU(pA, pA, nsA, bits);
-
- return factor;
-}
-static BNU_CHUNK_T* cpGFpExp2(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, int e, IppsGFpState* pGF)
-{
- cpGFpElementCopy(pR, pA, GFP_FELEN(pGF));
- while(e--) {
- pGF->sqr(pR, pR, pGF);
- }
- return pR;
-}
-
-/* returns:
- 0, if a - qnr
- 1, if sqrt is found
-*/
-int cpGFpSqrt(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGF)
-{
- int elemLen = GFP_FELEN(pGF);
- int poolelementLen = GFP_PELEN(pGF);
- int resultFlag = 1;
-
- /* case A==0 */
- if( GFP_IS_ZERO(pA, elemLen) )
- cpGFpElementPadd(pR, elemLen, 0);
-
- /* general case */
- else {
- BNU_CHUNK_T* q = cpGFpGetPool(4, pGF);
- BNU_CHUNK_T* x = q + poolelementLen;
- BNU_CHUNK_T* y = x + poolelementLen;
- BNU_CHUNK_T* z = y + poolelementLen;
-
- int s;
-
- /* z=1 */
- GFP_ONE(z, elemLen);
-
- /* (modulus-1) = 2^s*q */
- cpSub_BNU(q, GFP_MODULUS(pGF), z, elemLen);
- s = factor2(q, elemLen);
-
- /*
- // initialization
- */
-
- /* y = qnr^q */
- cpGFpExp(y, GFP_QNR(pGF), q,elemLen, pGF);
- /* x = a^((q-1)/2) */
- cpSub_BNU(q, q, z, elemLen);
- cpLSR_BNU(q, q, elemLen, 1);
- cpGFpExp(x, pA, q, elemLen, pGF);
- /* z = a*x^2 */
- pGF->mul(z, x, x, pGF);
- pGF->mul(z, pA, z, pGF);
- /* R = a*x */
- pGF->mul(pR, pA, x, pGF);
-
- while( !GFP_EQ(z, MNT_1(GFP_MONT(pGF)), elemLen) ) {
- int m = 0;
- cpGFpElementCopy(q, z, elemLen);
-
- for(m=1; m<s; m++) {
- pGF->mul(q, q, q, pGF);
- if( GFP_EQ(q, MNT_1(GFP_MONT(pGF)), elemLen) )
- break;
- }
-
- if(m==s) {
- /* A is quadratic non-residue */
- resultFlag = 0;
- break;
- }
- else {
- /* exponent reduction */
- cpGFpExp2(q, y, (s-m-1), pGF); /* q = y^(2^(s-m-1)) */
- pGF->mul(y, q, q, pGF); /* y = q^2 */
- pGF->mul(pR, q, pR, pGF); /* R = q*R */
- pGF->mul(z, y, z, pGF); /* z = z*y */
- s = m;
- }
- }
-
- /* choose smallest between R and (modulus-R) */
- cpGFpMontDecode(q, pR, elemLen, GFP_MONT(pGF));
- if(GFP_GT(q, GFP_HMODULUS(pGF), elemLen))
- pGF->neg(pR, pR, pGF);
-
- cpGFpReleasePool(4, pGF);
- }
-
- return resultFlag;
-}
-
-
-BNU_CHUNK_T* cpGFpRand(BNU_CHUNK_T* pR, IppsGFpState* pGF, IppBitSupplier rndFunc, void* pRndParam, int montSpace)
-{
- int elemLen = GFP_FELEN(pGF);
- int reqBitSize = GFP_FEBITSIZE(pGF)+GF_RAND_ADD_BITS;
- int nsR = (reqBitSize +BITSIZE(BNU_CHUNK_T)-1)/BITSIZE(BNU_CHUNK_T);
-
- BNU_CHUNK_T* pPool = cpGFpGetPool(2, pGF);
- cpGFpElementPadd(pPool, nsR, 0);
- rndFunc((Ipp32u*)pPool, reqBitSize, pRndParam);
-
- nsR = cpMod_BNU(pPool, nsR, GFP_MODULUS(pGF), elemLen);
- cpGFpElementPadd(pPool+nsR, elemLen-nsR, 0);
- if(montSpace)
- cpGFpMontEncode(pR, pPool, elemLen, GFP_MONT(pGF));
- else
- cpGFpElementCopy(pR, pPool, elemLen);
-
- cpGFpReleasePool(2, pGF);
- return pR;
-}
diff --git a/ext/ipp/sources/ippcpepid/src/pcpgfpxstuff.c b/ext/ipp/sources/ippcpepid/src/pcpgfpxstuff.c
deleted file mode 100644
index ae9a1f4..0000000
--- a/ext/ipp/sources/ippcpepid/src/pcpgfpxstuff.c
+++ /dev/null
@@ -1,1307 +0,0 @@
-/*############################################################################
- # 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.
- ############################################################################*/
-
-/*
-// Intel(R) Performance Primitives. Cryptography Primitives.
-// Internal operations over GF(p) extension.
-//
-// Context:
-// cpGFpxCmpare
-// cpGFpxSet
-// cpGFpxRand
-// cpGFpxGet
-//
-// cpGFpxHalve
-// cpGFpxAdd, cpGFpxAdd_GFE
-// cpGFpxSub, cpGFpxSub_GFE
-// cpGFpxMul, cpGFpxMul_GFE
-// cpGFp2biMul, cpGFp3biMul, cpGFpxMul_G0
-// cpGFpxSqr
-// cpGFp2biSqr, cpGFp3biSqr
-// cpGFpxNeg
-// cpGFpxInv
-// cpGFpxExp
-// cpGFpxMultiExp
-// cpGFpxConj
-//
-//
-*/
-
-#include "owncpepid.h"
-
-#include "pcpgfpxstuff.h"
-//#include "pcptool.h"
-
-
-/*
-// compare GF.
-// returns:
-// 0 - are equial
-// 1 - are different
-// 2 - different structure
-*/
-int cpGFpxCompare(const IppsGFpState* pGFpx1, const IppsGFpState* pGFpx2)
-{
- while( !GFP_IS_BASIC(pGFpx1) && !GFP_IS_BASIC(pGFpx2) ) {
- if( GFP_DEGREE(pGFpx1) != GFP_DEGREE(pGFpx2) )
- return 2;
- if( GFP_FELEN(pGFpx1) != GFP_FELEN(pGFpx2) )
- return 1;
- if(0 != cpGFpElementCmp(GFP_MODULUS(pGFpx1), GFP_MODULUS(pGFpx1), GFP_FELEN(pGFpx1)) )
- return 1;
- pGFpx1 = GFP_GROUNDGF(pGFpx1);
- pGFpx2 = GFP_GROUNDGF(pGFpx2);
- }
-
- return (GFP_IS_BASIC(pGFpx1) && GFP_IS_BASIC(pGFpx2))? cpGFpCompare(pGFpx1, pGFpx2) : 2;
-}
-
-BNU_CHUNK_T* cpGFpxRand(BNU_CHUNK_T* pR, IppsGFpState* pGFpx, IppBitSupplier rndFunc, void* pRndParam, int montSpace)
-{
- if( GFP_IS_BASIC(pGFpx) )
- return cpGFpRand(pR, pGFpx, rndFunc, pRndParam, montSpace);
-
- else {
- IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
- int basicElemLen = GFP_FELEN(pBasicGF);
- int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
-
- BNU_CHUNK_T* pTmp = pR;
- int deg;
- for(deg=0; deg<basicDeg; deg++) {
- cpGFpRand(pTmp, pBasicGF, rndFunc, pRndParam, montSpace);
- pTmp += basicElemLen;
- }
- return pR;
- }
-}
-
-BNU_CHUNK_T* cpGFpxSet(BNU_CHUNK_T* pE, const BNU_CHUNK_T* pDataA, int nsA, IppsGFpState* pGFpx, int montSpace)
-{
- if( GFP_IS_BASIC(pGFpx) )
- return cpGFpSet(pE, pDataA, nsA, pGFpx, montSpace);
-
- else {
- IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
- int basicElemLen = GFP_FELEN(pBasicGF);
-
- BNU_CHUNK_T* pTmpE = pE;
- int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
-
- int deg, error;
- for(deg=0, error=0; deg<basicDeg && !error; deg++) {
- int pieceA = IPP_MIN(nsA, basicElemLen);
-
- error = NULL == cpGFpSet(pTmpE, pDataA, pieceA, pBasicGF, montSpace);
- pTmpE += basicElemLen;
- pDataA += pieceA;
- nsA -= pieceA;
- }
-
- return (deg<basicDeg)? NULL : pE;
- }
-}
-
-BNU_CHUNK_T* cpGFpxSetPolyTerm(BNU_CHUNK_T* pE, int deg, const BNU_CHUNK_T* pDataA, int nsA, IppsGFpState* pGFpx, int montSpace)
-{
- pE += deg * GFP_FELEN(pGFpx);
- return cpGFpxSet(pE, pDataA, nsA, pGFpx, montSpace);
-}
-
-BNU_CHUNK_T* cpGFpxGet(BNU_CHUNK_T* pDataA, int nsA, const BNU_CHUNK_T* pE, IppsGFpState* pGFpx, int montSpace)
-{
- cpGFpElementPadd(pDataA, nsA, 0);
-
- if( GFP_IS_BASIC(pGFpx) )
- return cpGFpGet(pDataA, nsA, pE, pGFpx, montSpace);
-
- else {
- IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
- int basicElemLen = GFP_FELEN(pBasicGF);
-
- BNU_CHUNK_T* pTmp = pDataA;
- int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
-
- int deg;
- for(deg=0; deg<basicDeg && nsA>0; deg++) {
- int pieceA = IPP_MIN(nsA, basicElemLen);
-
- cpGFpGet(pTmp, pieceA, pE, pBasicGF, montSpace);
- pE += basicElemLen;
- pTmp += pieceA;
- nsA -= pieceA;
- }
-
- return pDataA;
- }
-}
-
-BNU_CHUNK_T* cpGFpxGetPolyTerm(BNU_CHUNK_T* pDataA, int nsA, const BNU_CHUNK_T* pE, int deg, IppsGFpState* pGFpx, int montSpace)
-{
- pE += deg * GFP_FELEN(pGFpx);
- return cpGFpxGet(pDataA, nsA, pE, pGFpx, montSpace);
-}
-
-BNU_CHUNK_T* cpGFpxHalve(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
-{
- IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
- int basicElemLen = GFP_FELEN(pBasicGF);
- int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
-
- BNU_CHUNK_T* pTmp = pR;
- int deg;
- for(deg=0; deg<basicDeg; deg++) {
- pBasicGF->div2(pTmp, pA, pBasicGF);
- pTmp += basicElemLen;
- pA += basicElemLen;
- }
- return pR;
-}
-
-BNU_CHUNK_T* cpGFpxAdd(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx)
-{
- IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
- int basicElemLen = GFP_FELEN(pBasicGF);
- int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
-
- BNU_CHUNK_T* pTmp = pR;
- int deg;
- for(deg=0; deg<basicDeg; deg++) {
- pBasicGF->add(pTmp, pA, pB, pBasicGF);
- pTmp += basicElemLen;
- pA += basicElemLen;
- pB += basicElemLen;
- }
- return pR;
-}
-
-BNU_CHUNK_T* cpGFpxSub(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx)
-{
- IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
- int basicElemLen = GFP_FELEN(pBasicGF);
- int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
-
- BNU_CHUNK_T* pTmp = pR;
- int deg;
- for(deg=0; deg<basicDeg; deg++) {
- pBasicGF->sub(pTmp, pA, pB, pBasicGF);
- pTmp += basicElemLen;
- pA += basicElemLen;
- pB += basicElemLen;
- }
- return pR;
-}
-
-BNU_CHUNK_T* cpGFpxConj(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
-{
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
- int groundElemLen = GFP_FELEN(pGroundGF);
-
- if(pR != pA)
- cpGFpElementCopy(pR, pA, groundElemLen);
- //cpGFpxNeg(pR+groundElemLen, pA+groundElemLen, pGroundGF);
- pGroundGF->neg(pR+groundElemLen, pA+groundElemLen, pGroundGF);
-
- return pR;
-}
-
-
-/*
-// multiplication like GF(()^d).mul(a, g0),
-// where:
-// a, g0 belongs to ground GF()
-// and g0 is low-order term of GF(()^d) generationg binominal g(t) = t^d + g0
-// is very important for Intel(R) EPID 2.0.
-//
-// Thus, this kind of multiplication is using
-// 1) in iplementation of GF(p^2) multiplication
-// 2) in iplementation of GF((p^6)^2) multiplication too
-*/
-#if defined(_EPID20_GF_PARAM_SPECIFIC_)
-#pragma message ("_EPID20_GF_PARAM_SPECIFIC_")
-
-__INLINE BNU_CHUNK_T* cpFqMul_beta(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
-{
- if(pR != pA)
- cpGFpElementCopy(pR, pA, GFP_FELEN(pGFpx));
- return pR;
-}
-
-__INLINE BNU_CHUNK_T* cpFq2Mul_xi(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
-{
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
- BNU_CHUNK_T* t0 = cpGFpGetPool(1, pGroundGF);
- BNU_CHUNK_T* t1 = cpGFpGetPool(1, pGroundGF);
-
- int termLen = GFP_FELEN(pGroundGF);
-
- const BNU_CHUNK_T* pA0 = pA;
- const BNU_CHUNK_T* pA1 = pA+termLen;
- BNU_CHUNK_T* pR0 = pR;
- BNU_CHUNK_T* pR1 = pR+termLen;
- pGroundGF->add(t0, pA0, pA0, pGroundGF);
- pGroundGF->add(t1, pA0, pA1, pGroundGF);
- pGroundGF->sub(pR0, t0, pA1, pGroundGF);
- pGroundGF->add(pR1, t1, pA1, pGroundGF);
-
- cpGFpReleasePool(2, pGroundGF);
- return pR;
-}
-
-__INLINE BNU_CHUNK_T* cpFq6Mul_vi(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
-{
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
- int termLen = GFP_FELEN(pGroundGF);
-
- const BNU_CHUNK_T* pA0 = pA;
- const BNU_CHUNK_T* pA1 = pA+termLen;
- const BNU_CHUNK_T* pA2 = pA+termLen*2;
- BNU_CHUNK_T* pR0 = pR;
- BNU_CHUNK_T* pR1 = pR+termLen;
- BNU_CHUNK_T* pR2 = pR+termLen*2;
-
- BNU_CHUNK_T* t = cpGFpGetPool(1, pGroundGF);
-
- cpFq2Mul_xi(t, pA2, pGroundGF);
- cpGFpElementCopy(pR2, pA1, termLen);
- cpGFpElementCopy(pR1, pA0, termLen);
- cpGFpElementCopy(pR0, t, termLen);
-
- cpGFpReleasePool(1, pGroundGF);
-
- return pR;
-}
-#endif
-
-#if defined(_EXTENSION_2_BINOMIAL_SUPPORT_) || defined(_EXTENSION_3_BINOMIAL_SUPPORT_)
-static BNU_CHUNK_T* cpGFpxMul_G0(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
-{
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
- BNU_CHUNK_T* pGFpolynomial = GFP_MODULUS(pGFpx); /* g(x) = t^d + g0 */
- return pGroundGF->mul(pR, pA, pGFpolynomial, GFP_GROUNDGF(pGFpx));
-}
-#endif
-
-/*
-// field polynomial: g(x) = t^2 + beta - binominal
-// extension degree: 2
-*/
-#if defined(_EXTENSION_2_BINOMIAL_SUPPORT_)
-static BNU_CHUNK_T* cpGFp2biMul(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx)
-{
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
- int groundElemLen = GFP_FELEN(pGroundGF);
-
- const BNU_CHUNK_T* pA0 = pA;
- const BNU_CHUNK_T* pA1 = pA+groundElemLen;
-
- const BNU_CHUNK_T* pB0 = pB;
- const BNU_CHUNK_T* pB1 = pB+groundElemLen;
-
- BNU_CHUNK_T* pR0 = pR;
- BNU_CHUNK_T* pR1 = pR+groundElemLen;
-
- BNU_CHUNK_T* t0 = cpGFpGetPool(1, pGroundGF);
- BNU_CHUNK_T* t1 = cpGFpGetPool(1, pGroundGF);
- BNU_CHUNK_T* t2 = cpGFpGetPool(1, pGroundGF);
- BNU_CHUNK_T* t3 = cpGFpGetPool(1, pGroundGF);
-
- pGroundGF->mul(t0, pA0, pB0, pGroundGF); /* t0 = a[0]*b[0] */
- pGroundGF->mul(t1, pA1, pB1, pGroundGF); /* t1 = a[1]*b[1] */
- pGroundGF->add(t2, pA0, pA1,pGroundGF); /* t2 = a[0]+a[1] */
- pGroundGF->add(t3, pB0, pB1,pGroundGF); /* t3 = b[0]+b[1] */
-
- pGroundGF->mul(pR1, t2, t3, pGroundGF); /* r[1] = (a[0]+a[1]) * (b[0]+b[1]) */
- pGroundGF->sub(pR1, pR1, t0, pGroundGF); /* r[1] -= a[0]*b[0]) + a[1]*b[1] */
- pGroundGF->sub(pR1, pR1, t1, pGroundGF);
-
- #if defined(_EPID20_GF_PARAM_SPECIFIC_) /* r[0] = t0 - t1*beta */
- {
- int basicExtDegree = cpGFpBasicDegreeExtension(pGFpx);
- if(basicExtDegree==2 && EPID_PARAMS(pGFpx)) {
- //cpFqMul_beta(t1, t1, pGroundGF);
- pGroundGF->sub(pR0, t0, t1, pGroundGF);
- }
- else if(basicExtDegree==12 && EPID_PARAMS(pGFpx)) {
- cpFq6Mul_vi(t1, t1, pGroundGF);
- pGroundGF->add(pR0, t0, t1, pGroundGF);
- }
- else {
- cpGFpxMul_G0(t1, t1, pGFpx);
- pGroundGF->sub(pR0, t0, t1, pGroundGF);
- }
- }
- #else
- cpGFpxMul_G0(t1, t1, pGFpx);
- pGroundGF->sub(pR0, t0, t1, pGroundGF);
- #endif
-
- cpGFpReleasePool(4, pGroundGF);
- return pR;
-}
-#endif
-
-/*
-// field polynomial: g(x) = t^3 + beta - binominal
-// extension degree: 3
-*/
-#if defined(_EXTENSION_3_BINOMIAL_SUPPORT_)
-static BNU_CHUNK_T* cpGFp3biMul(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx)
-{
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
- int groundElemLen = GFP_FELEN(pGroundGF);
-
- const BNU_CHUNK_T* pA0 = pA;
- const BNU_CHUNK_T* pA1 = pA+groundElemLen;
- const BNU_CHUNK_T* pA2 = pA+groundElemLen*2;
-
- const BNU_CHUNK_T* pB0 = pB;
- const BNU_CHUNK_T* pB1 = pB+groundElemLen;
- const BNU_CHUNK_T* pB2 = pB+groundElemLen*2;
-
- BNU_CHUNK_T* pR0 = pR;
- BNU_CHUNK_T* pR1 = pR+groundElemLen;
- BNU_CHUNK_T* pR2 = pR+groundElemLen*2;
-
- BNU_CHUNK_T* t0 = cpGFpGetPool(1, pGroundGF);
- BNU_CHUNK_T* t1 = cpGFpGetPool(1, pGroundGF);
- BNU_CHUNK_T* t2 = cpGFpGetPool(1, pGroundGF);
- BNU_CHUNK_T* u0 = cpGFpGetPool(1, pGroundGF);
- BNU_CHUNK_T* u1 = cpGFpGetPool(1, pGroundGF);
- BNU_CHUNK_T* u2 = cpGFpGetPool(1, pGroundGF);
-
- pGroundGF->add(u0 ,pA0, pA1, pGroundGF); /* u0 = a[0]+a[1] */
- pGroundGF->add(t0 ,pB0, pB1, pGroundGF); /* t0 = b[0]+b[1] */
- pGroundGF->mul(u0, u0, t0, pGroundGF); /* u0 = (a[0]+a[1])*(b[0]+b[1]) */
- pGroundGF->mul(t0, pA0, pB0, pGroundGF); /* t0 = a[0]*b[0] */
-
- pGroundGF->add(u1 ,pA1, pA2, pGroundGF); /* u1 = a[1]+a[2] */
- pGroundGF->add(t1 ,pB1, pB2, pGroundGF); /* t1 = b[1]+b[2] */
- pGroundGF->mul(u1, u1, t1, pGroundGF); /* u1 = (a[1]+a[2])*(b[1]+b[2]) */
- pGroundGF->mul(t1, pA1, pB1, pGroundGF); /* t1 = a[1]*b[1] */
-
- pGroundGF->add(u2 ,pA2, pA0, pGroundGF); /* u2 = a[2]+a[0] */
- pGroundGF->add(t2 ,pB2, pB0, pGroundGF); /* t2 = b[2]+b[0] */
- pGroundGF->mul(u2, u2, t2, pGroundGF); /* u2 = (a[2]+a[0])*(b[2]+b[0]) */
- pGroundGF->mul(t2, pA2, pB2, pGroundGF); /* t2 = a[2]*b[2] */
-
- pGroundGF->sub(u0, u0, t0, pGroundGF); /* u0 = a[0]*b[1]+a[1]*b[0] */
- pGroundGF->sub(u0, u0, t1, pGroundGF);
- pGroundGF->sub(u1, u1, t1, pGroundGF); /* u1 = a[1]*b[2]+a[2]*b[1] */
- pGroundGF->sub(u1, u1, t2, pGroundGF);
- pGroundGF->sub(u2, u2, t2, pGroundGF); /* u2 = a[2]*b[0]+a[0]*b[2] */
- pGroundGF->sub(u2, u2, t0, pGroundGF);
-
- #if defined(_EPID20_GF_PARAM_SPECIFIC_)
- {
- int basicExtDegree = cpGFpBasicDegreeExtension(pGFpx);
- if(basicExtDegree==6 && EPID_PARAMS(pGFpx)) {
- cpFq2Mul_xi(u1, u1, pGroundGF);
- cpFq2Mul_xi(t2, t2, pGroundGF);
- pGroundGF->add(pR0, t0, u1, pGroundGF); /* r[0] = a[0]*b[0] - (a[2]*b[1]+a[1]*b[2])*beta */
- pGroundGF->add(pR1, u0, t2, pGroundGF); /* r[1] = a[1]*b[0] + a[0]*b[1] - a[2]*b[2]*beta */
- }
- else {
- cpGFpxMul_G0(u1, u1, pGFpx); /* u1 = (a[1]*b[2]+a[2]*b[1]) * beta */
- cpGFpxMul_G0(t2, t2, pGFpx); /* t2 = a[2]*b[2] * beta */
- pGroundGF->sub(pR0, t0, u1, pGroundGF); /* r[0] = a[0]*b[0] - (a[2]*b[1]+a[1]*b[2])*beta */
- pGroundGF->sub(pR1, u0, t2, pGroundGF); /* r[1] = a[1]*b[0] + a[0]*b[1] - a[2]*b[2]*beta */
- }
- }
- #else
- cpGFpxMul_G0(u1, u1, pGFpx); /* u1 = (a[1]*b[2]+a[2]*b[1]) * beta */
- cpGFpxMul_G0(t2, t2, pGFpx); /* t2 = a[2]*b[2] * beta */
-
- pGroundGF->sub(pR0, t0, u1, pGroundGF); /* r[0] = a[0]*b[0] - (a[2]*b[1]+a[1]*b[2])*beta */
- pGroundGF->sub(pR1, u0, t2, pGroundGF); /* r[1] = a[1]*b[0] + a[0]*b[1] - a[2]*b[2]*beta */
- #endif
-
- pGroundGF->add(pR2, u2, t1, pGroundGF); /* r[2] = a[2]*b[0] + a[1]*b[1] + a[0]*b[2] */
-
- cpGFpReleasePool(6, pGroundGF);
- return pR;
-}
-#endif
-
-BNU_CHUNK_T* cpGFpxMul(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx)
-{
- int extDegree = GFP_DEGREE(pGFpx);
-
- #if defined(_EXTENSION_2_BINOMIAL_SUPPORT_)
- #pragma message ("_EXTENSION_2_BINOMIAL_SUPPORT_")
- if(BINOMIAL==FIELD_POLY_TYPE(pGFpx) && extDegree==2)
- return cpGFp2biMul(pR, pA, pB, pGFpx);
- #endif
-
- #if defined(_EXTENSION_3_BINOMIAL_SUPPORT_)
- #pragma message ("_EXTENSION_3_BINOMIAL_SUPPORT_")
- if(BINOMIAL==FIELD_POLY_TYPE(pGFpx) && extDegree==3)
- return cpGFp3biMul(pR, pA, pB, pGFpx);
- #endif
-
- {
- BNU_CHUNK_T* pGFpolynomial = GFP_MODULUS(pGFpx);
- int degR = extDegree-1;
- int elemLen= GFP_FELEN(pGFpx);
-
- int degB = degR;
- BNU_CHUNK_T* pTmpProduct = cpGFpGetPool(2, pGFpx);
- BNU_CHUNK_T* pTmpResult = pTmpProduct + GFP_PELEN(pGFpx);
-
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
- BNU_CHUNK_T* r = cpGFpGetPool(1, pGroundGF);
- int groundElemLen = GFP_FELEN(pGroundGF);
-
- const BNU_CHUNK_T* pTmpB = GFPX_IDX_ELEMENT(pB, degB, groundElemLen);
-
- /* clear temporary */
- cpGFpElementPadd(pTmpProduct, elemLen, 0);
-
- /* R = A * B[degB-1] */
- cpGFpxMul_GFE(pTmpResult, pA, pTmpB, pGFpx);
-
- for(degB-=1; degB>=0; degB--) {
- /* save R[degR-1] */
- cpGFpElementCopy(r, GFPX_IDX_ELEMENT(pTmpResult, degR, groundElemLen), groundElemLen);
-
- { /* R = R * x */
- int j;
- for (j=degR; j>=1; j--)
- cpGFpElementCopy(GFPX_IDX_ELEMENT(pTmpResult, j, groundElemLen), GFPX_IDX_ELEMENT(pTmpResult, j-1, groundElemLen), groundElemLen);
- cpGFpElementPadd(pTmpResult, groundElemLen, 0);
- }
-
- cpGFpxMul_GFE(pTmpProduct, pGFpolynomial, r, pGFpx);
- pGFpx->sub(pTmpResult, pTmpResult, pTmpProduct, pGFpx);
-
- /* B[degB-i] */
- pTmpB -= groundElemLen;
- cpGFpxMul_GFE(pTmpProduct, pA, pTmpB, pGFpx);
- pGFpx->add(pTmpResult, pTmpResult, pTmpProduct, pGFpx);
- }
-
- /* copy result */
- cpGFpElementCopy(pR, pTmpResult, elemLen);
-
- /* release pools */
- cpGFpReleasePool(1, pGroundGF);
- cpGFpReleasePool(2, pGFpx);
-
- return pR;
- }
-}
-
-/*
-// field polynomial: binominal
-// extension degree: 2
-*/
-#if defined(_EXTENSION_2_BINOMIAL_SUPPORT_)
-static BNU_CHUNK_T* cpGFp2biSqr(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
-{
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
- int groundElemLen = GFP_FELEN(pGroundGF);
-
- const BNU_CHUNK_T* pA0 = pA;
- const BNU_CHUNK_T* pA1 = pA+groundElemLen;
-
- BNU_CHUNK_T* pR0 = pR;
- BNU_CHUNK_T* pR1 = pR+groundElemLen;
-
- BNU_CHUNK_T* t0 = cpGFpGetPool(1, pGroundGF);
- BNU_CHUNK_T* t1 = cpGFpGetPool(1, pGroundGF);
- BNU_CHUNK_T* u0 = cpGFpGetPool(1, pGroundGF);
-
- pGroundGF->mul(u0, pA0, pA1, pGroundGF); /* u0 = a[0]*a[1] */
-
- #if defined(_EPID20_GF_PARAM_SPECIFIC_) /* r[0] = t0 - t1*beta */
- {
- int basicExtDegree = cpGFpBasicDegreeExtension(pGFpx);
- if(basicExtDegree==2 && EPID_PARAMS(pGFpx)) {
- pGroundGF->add(t0, pA0, pA1, pGroundGF);
- pGroundGF->sub(t1, pA0, pA1, pGroundGF);
- pGroundGF->mul(pR0, t0, t1, pGroundGF);
- pGroundGF->add(pR1, u0, u0, pGroundGF); /* r[1] = 2*a[0]*a[1] */
- }
- else if(basicExtDegree==12 && EPID_PARAMS(pGFpx)) {
- pGroundGF->sub(t0, pA0, pA1, pGroundGF);
- cpFq6Mul_vi(t1, pA1, pGroundGF);
- pGroundGF->sub(t1, pA0, t1, pGroundGF);
- pGroundGF->mul(t0, t0, t1, pGroundGF);
- pGroundGF->add(t0, t0, u0, pGroundGF);
- cpFq6Mul_vi(t1, u0, pGroundGF);
- pGroundGF->add(pR0, t0, t1, pGroundGF);
- pGroundGF->add(pR1, u0, u0, pGroundGF);
- }
- else {
- pGroundGF->sqr(t0, pA0, pGroundGF); /* t0 = a[0]*a[0] */
- pGroundGF->sqr(t1, pA1, pGroundGF); /* t1 = a[1]*a[1] */
- cpGFpxMul_G0(t1, t1, pGFpx);
- pGroundGF->sub(pR0, t0, t1, pGroundGF);
- pGroundGF->add(pR1, u0, u0, pGroundGF); /* r[1] = 2*a[0]*a[1] */
- }
- }
- #else
- pGroundGF->sqr(t0, pA0, pGroundGF); /* t0 = a[0]*a[0] */
- pGroundGF->sqr(t1, pA1, pGroundGF); /* t1 = a[1]*a[1] */
- cpGFpxMul_G0(t1, t1, pGFpx);
- pGroundGF->sub(pR0, t0, t1, pGroundGF);
- pGroundGF->add(pR1, u0, u0, pGroundGF); /* r[1] = 2*a[0]*a[1] */
- #endif
-
- cpGFpReleasePool(3, pGroundGF);
- return pR;
-}
-#endif
-
-/*
-// field polynomial: binominal
-// extension degree: 3
-*/
-#if defined(_EXTENSION_3_BINOMIAL_SUPPORT_)
-static BNU_CHUNK_T* cpGFp3biSqr(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
-{
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
- int groundElemLen = GFP_FELEN(pGroundGF);
-
- const BNU_CHUNK_T* pA0 = pA;
- const BNU_CHUNK_T* pA1 = pA+groundElemLen;
- const BNU_CHUNK_T* pA2 = pA+groundElemLen*2;
-
- BNU_CHUNK_T* pR0 = pR;
- BNU_CHUNK_T* pR1 = pR+groundElemLen;
- BNU_CHUNK_T* pR2 = pR+groundElemLen*2;
-
- BNU_CHUNK_T* s0 = cpGFpGetPool(1, pGroundGF);
- BNU_CHUNK_T* s1 = cpGFpGetPool(1, pGroundGF);
- BNU_CHUNK_T* s2 = cpGFpGetPool(1, pGroundGF);
- BNU_CHUNK_T* s3 = cpGFpGetPool(1, pGroundGF);
- BNU_CHUNK_T* s4 = cpGFpGetPool(1, pGroundGF);
-
- pGroundGF->add(s2, pA0, pA2, pGroundGF);
- pGroundGF->sub(s2, s2, pA1, pGroundGF);
- pGroundGF->sqr(s2, s2, pGroundGF);
- pGroundGF->sqr(s0, pA0, pGroundGF);
- pGroundGF->sqr(s4, pA2, pGroundGF);
- pGroundGF->mul(s1, pA0, pA1, pGroundGF);
- pGroundGF->mul(s3, pA1, pA2, pGroundGF);
- pGroundGF->add(s1, s1, s1, pGroundGF);
- pGroundGF->add(s3, s3, s3, pGroundGF);
-
- pGroundGF->add(pR2, s1, s2, pGroundGF);
- pGroundGF->add(pR2, pR2, s3, pGroundGF);
- pGroundGF->sub(pR2, pR2, s0, pGroundGF);
- pGroundGF->sub(pR2, pR2, s4, pGroundGF);
-
- #if defined(_EPID20_GF_PARAM_SPECIFIC_)
- {
- int basicExtDegree = cpGFpBasicDegreeExtension(pGFpx);
- if(basicExtDegree==6 && EPID_PARAMS(pGFpx)) {
- cpFq2Mul_xi(s4, s4, pGroundGF);
- cpFq2Mul_xi(s3, s3, pGroundGF);
- pGroundGF->add(pR1, s1, s4, pGroundGF);
- pGroundGF->add(pR0, s0, s3, pGroundGF);
- }
- else {
- cpGFpxMul_G0(s4, s4, pGFpx);
- cpGFpxMul_G0(s3, s3, pGFpx);
- pGroundGF->sub(pR1, s1, s4, pGroundGF);
- pGroundGF->sub(pR0, s0, s3, pGroundGF);
- }
- }
-
- #else
- cpGFpxMul_G0(s4, s4, pGFpx);
- pGroundGF->sub(pR1, s1, s4, pGroundGF);
-
- cpGFpxMul_G0(s3, s3, pGFpx);
- pGroundGF->sub(pR0, s0, s3, pGroundGF);
- #endif
-
- cpGFpReleasePool(5, pGroundGF);
- return pR;
-}
-#endif
-
-BNU_CHUNK_T* cpGFpxSqr(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
-{
- int extDegree = GFP_DEGREE(pGFpx);
-
- #if defined(_EXTENSION_2_BINOMIAL_SUPPORT_)
- #pragma message ("_EXTENSION_2_BINOMIAL_SUPPORT_")
- if(BINOMIAL==FIELD_POLY_TYPE(pGFpx) && extDegree==2)
- return cpGFp2biSqr(pR, pA, pGFpx);
- #endif
-
- #if defined(_EXTENSION_3_BINOMIAL_SUPPORT_)
- #pragma message ("_EXTENSION_3_BINOMIAL_SUPPORT_")
- if(BINOMIAL==FIELD_POLY_TYPE(pGFpx) && extDegree==3)
- return cpGFp3biSqr(pR, pA, pGFpx);
- #endif
-
- {
- BNU_CHUNK_T* pGFpolynomial = GFP_MODULUS(pGFpx);
- int degR = extDegree-1;
- int elemLen= GFP_FELEN(pGFpx);
-
- int degA = degR;
- BNU_CHUNK_T* pTmpProduct = cpGFpGetPool(2, pGFpx);
- BNU_CHUNK_T* pTmpResult = pTmpProduct + GFP_PELEN(pGFpx);
-
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
- BNU_CHUNK_T* r = cpGFpGetPool(1, pGroundGF);
- int groundElemLen = GFP_FELEN(pGroundGF);
-
- const BNU_CHUNK_T* pTmpA = GFPX_IDX_ELEMENT(pA, degA, groundElemLen);
-
- /* clear temporary */
- cpGFpElementPadd(pTmpProduct, elemLen, 0);
-
- /* R = A * A[degA-1] */
- cpGFpxMul_GFE(pTmpResult, pA, pTmpA, pGFpx);
-
- for(degA-=1; degA>=0; degA--) {
- /* save R[degR-1] */
- cpGFpElementCopy(r, GFPX_IDX_ELEMENT(pTmpResult, degR, groundElemLen), groundElemLen);
-
- { /* R = R * x */
- int j;
- for (j=degR; j>=1; j--)
- cpGFpElementCopy(GFPX_IDX_ELEMENT(pTmpResult, j, groundElemLen), GFPX_IDX_ELEMENT(pTmpResult, j-1, groundElemLen), groundElemLen);
- cpGFpElementPadd(pTmpResult, groundElemLen, 0);
- }
-
- cpGFpxMul_GFE(pTmpProduct, pGFpolynomial, r, pGFpx);
- pGFpx->sub(pTmpResult, pTmpResult, pTmpProduct, pGFpx);
-
- /* A[degA-i] */
- pTmpA -= groundElemLen;
- cpGFpxMul_GFE(pTmpProduct, pA, pTmpA, pGFpx);
- pGFpx->add(pTmpResult, pTmpResult, pTmpProduct, pGFpx);
- }
-
- /* copy result */
- cpGFpElementCopy(pR, pTmpResult, elemLen);
-
- /* release pools */
- cpGFpReleasePool(1, pGroundGF);
- cpGFpReleasePool(2, pGFpx);
-
- return pR;
- }
-}
-
-BNU_CHUNK_T* cpGFpxAdd_GFE(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pGroundB, IppsGFpState* pGFpx)
-{
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
-
- if(pR != pA) {
- int groundElemLen = GFP_FELEN(pGroundGF);
- int deg = GFP_DEGREE(pGFpx);
- cpGFpElementCopy(pR+groundElemLen, pA+groundElemLen, groundElemLen*(deg-1));
- }
- return pGroundGF->add(pR, pA, pGroundB, pGroundGF);
-}
-
-BNU_CHUNK_T* cpGFpxSub_GFE(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pGroundB, IppsGFpState* pGFpx)
-{
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
-
- if(pR != pA) {
- int groundElemLen = GFP_FELEN(pGroundGF);
- int deg = GFP_DEGREE(pGFpx);
- cpGFpElementCopy(pR+groundElemLen, pA+groundElemLen, groundElemLen*(deg-1));
- }
- return pGroundGF->sub(pR, pA, pGroundB, pGroundGF);
-}
-
-BNU_CHUNK_T* cpGFpxMul_GFE(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pGroundB, IppsGFpState* pGFpx)
-{
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
- int grounfElemLen = GFP_FELEN(pGroundGF);
-
- BNU_CHUNK_T* pTmp = pR;
-
- int deg;
- for(deg=0; deg<GFP_DEGREE(pGFpx); deg++) {
- pGroundGF->mul(pTmp, pA, pGroundB, pGroundGF);
- pTmp += grounfElemLen;
- pA += grounfElemLen;
- }
- return pR;
-}
-
-BNU_CHUNK_T* cpGFpxNeg(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
-{
- IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
- int basicElemLen = GFP_FELEN(pBasicGF);
- int basicDeg = cpGFpBasicDegreeExtension(pGFpx);
-
- BNU_CHUNK_T* pTmp = pR;
- int deg;
- for(deg=0; deg<basicDeg; deg++) {
- pBasicGF->neg(pTmp, pA, pBasicGF);
- pTmp += basicElemLen;
- pA += basicElemLen;
- }
- return pR;
-}
-
-//////////////////////////////////////////////////////////////////
-BNU_CHUNK_T* gfpolyDiv_v0(BNU_CHUNK_T* pQ, BNU_CHUNK_T* pR,
- const BNU_CHUNK_T* pA,
- const BNU_CHUNK_T* pB,
- IppsGFpState* pGFpx)
-{
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
-
- if( GFP_IS_BASIC(pGroundGF) ) {
- int elemLen = GFP_FELEN(pGFpx);
- int termLen = GFP_FELEN(pGroundGF);
-
- int degA = degree(pA, pGFpx);
- int degB = degree(pB, pGFpx);
-
- if(degB==0) {
- if( GFP_IS_ZERO(pB, termLen) )
- return NULL;
- else {
- cpGFpInv(pR, pB, pGroundGF);
- cpGFpElementPadd(pQ, elemLen, 0);
- cpGFpxMul_GFE(pQ, pA, pR, pGFpx);
- cpGFpElementPadd(pR, elemLen, 0);
- return pR;
- }
- }
-
- if(degA < degB) {
- cpGFpElementPadd(pQ, elemLen, 0);
- cpGFpElementCopyPadd(pR, elemLen, pA, (degA+1)*termLen);
- return pR;
- }
-
- else {
- int i, j;
- BNU_CHUNK_T* pProduct = cpGFpGetPool(2, pGroundGF);
- BNU_CHUNK_T* pInvB = pProduct + GFP_PELEN(pGroundGF);
-
- cpGFpElementCopyPadd(pR, elemLen, pA, (degA+1)*termLen);
- cpGFpElementPadd(pQ, elemLen, 0);
-
- cpGFpInv(pInvB, GFPX_IDX_ELEMENT(pB, degB, termLen), pGroundGF);
-
- for(i=0; i<=degA-degB && !GFP_IS_ZERO(GFPX_IDX_ELEMENT(pR, degA-i, termLen), termLen); i++) {
- /* compute q term */
- cpGFpMul(GFPX_IDX_ELEMENT(pQ, degA-degB-i, termLen),
- GFPX_IDX_ELEMENT(pR, degA-i, termLen),
- pInvB,
- pGroundGF);
-
- /* R -= B * q */
- cpGFpElementPadd(GFPX_IDX_ELEMENT(pR, degA-i, termLen), termLen, 0);
- for(j=0; j<degB; j++) {
- cpGFpMul(pProduct,
- GFPX_IDX_ELEMENT(pB, j ,termLen),
- GFPX_IDX_ELEMENT(pQ, degA-degB-i, termLen),
- pGroundGF);
- cpGFpSub(GFPX_IDX_ELEMENT(pR, degA-degB-i+j, termLen),
- GFPX_IDX_ELEMENT(pR, degA-degB-i+j, termLen),
- pProduct,
- pGroundGF);
- }
- }
-
- cpGFpReleasePool(2, pGroundGF);
- return pR;
- }
- }
- return NULL;
-}
-
-static BNU_CHUNK_T* gfpgeneratorDiv_v0(BNU_CHUNK_T* pQ, BNU_CHUNK_T* pR, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx)
-{
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
-
- if( GFP_IS_BASIC(pGroundGF) ) {
- int elemLen = GFP_FELEN(pGFpx);
- int termLen = GFP_FELEN(pGroundGF);
-
- BNU_CHUNK_T* pInvB = cpGFpGetPool(2, pGroundGF);
- BNU_CHUNK_T* pTmp = pInvB + GFP_PELEN(pGroundGF);
-
- int degB = degree(pB, pGFpx);
- int i;
-
- cpGFpElementCopy(pR, GFP_MODULUS(pGFpx), elemLen);
- cpGFpElementPadd(pQ, elemLen, 0);
-
- cpGFpInv(pInvB, GFPX_IDX_ELEMENT(pB, degB, termLen), pGroundGF);
-
- for(i=0; i<degB; i++) {
- BNU_CHUNK_T* ptr;
- cpGFpMul(pTmp, pInvB, GFPX_IDX_ELEMENT(pB, i, termLen), pGroundGF);
- ptr = GFPX_IDX_ELEMENT(pR, GFP_DEGREE(pGFpx)-degB+i, termLen);
- cpGFpSub(ptr, ptr, pTmp, pGroundGF);
- }
-
- gfpolyDiv_v0(pQ, pR, pR, pB, pGFpx);
-
- cpGFpElementCopy(GFPX_IDX_ELEMENT(pQ, GFP_DEGREE(pGFpx)-degB, termLen), pInvB, termLen);
-
- cpGFpReleasePool(2, pGroundGF);
- return pR;
- }
-
- return NULL;
-}
-
-
-///////////////////////////////////////////////////////////////////////////////
-static BNU_CHUNK_T* gfpxPolyDiv(BNU_CHUNK_T* pQ, BNU_CHUNK_T* pR,
- const BNU_CHUNK_T* pA,
- const BNU_CHUNK_T* pB,
- IppsGFpState* pGFpx)
-{
- if( GFP_IS_BASIC(pGFpx) )
- return NULL;
-
- else {
- int elemLen = GFP_FELEN(pGFpx);
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
- int termLen = GFP_FELEN(pGroundGF);
-
- int degA = degree(pA, pGFpx);
- int degB = degree(pB, pGFpx);
-
- if(degB==0) {
- if( GFP_IS_ZERO(pB, termLen) )
- return NULL;
- else {
- IppsGFpState* pBasicGF = cpGFpBasic(pGroundGF);
-
- cpGFpInv(pR, pB, pBasicGF);
- cpGFpElementPadd(pR+GFP_FELEN(pGroundGF), termLen-GFP_FELEN(pGroundGF), 0);
- cpGFpxMul_GFE(pQ, pA, pR, pGFpx);
- cpGFpElementPadd(pR, elemLen, 0);
- return pR;
- }
- }
-
- if(degA < degB) {
- cpGFpElementPadd(pQ, elemLen, 0);
- cpGFpElementCopyPadd(pR, elemLen, pA, (degA+1)*termLen);
- return pR;
- }
-
- else {
- int i, j;
- BNU_CHUNK_T* pProduct = cpGFpGetPool(2, pGroundGF);
- BNU_CHUNK_T* pInvB = pProduct + GFP_PELEN(pGroundGF);
-
- cpGFpElementCopyPadd(pR, elemLen, pA, (degA+1)*termLen);
- cpGFpElementPadd(pQ, elemLen, 0);
-
- cpGFpxInv(pInvB, GFPX_IDX_ELEMENT(pB, degB, termLen), pGroundGF);
-
- for(i=0; i<=degA-degB && !GFP_IS_ZERO(GFPX_IDX_ELEMENT(pR, degA-i, termLen), termLen); i++) {
- /* compute q term */
- cpGFpxMul(GFPX_IDX_ELEMENT(pQ, degA-degB-i, termLen),
- GFPX_IDX_ELEMENT(pR, degA-i, termLen),
- pInvB,
- pGroundGF);
-
- /* R -= B * q */
- cpGFpElementPadd(GFPX_IDX_ELEMENT(pR, degA-i, termLen), termLen, 0);
- for(j=0; j<degB; j++) {
- cpGFpxMul(pProduct,
- GFPX_IDX_ELEMENT(pB, j ,termLen),
- GFPX_IDX_ELEMENT(pQ, degA-degB-i, termLen),
- pGroundGF);
- cpGFpxSub(GFPX_IDX_ELEMENT(pR, degA-degB-i+j, termLen),
- GFPX_IDX_ELEMENT(pR, degA-degB-i+j, termLen),
- pProduct,
- pGroundGF);
- }
- }
-
- cpGFpReleasePool(2, pGroundGF);
- return pR;
- }
- }
-}
-
-static BNU_CHUNK_T* gfpxGeneratorDiv(BNU_CHUNK_T* pQ, BNU_CHUNK_T* pR, const BNU_CHUNK_T* pB, IppsGFpState* pGFpx)
-{
- if( GFP_IS_BASIC(pGFpx) )
- return NULL;
-
- else {
- int elemLen = GFP_FELEN(pGFpx);
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
- int termLen = GFP_FELEN(pGroundGF);
-
- BNU_CHUNK_T* pInvB = cpGFpGetPool(2, pGroundGF);
- BNU_CHUNK_T* pTmp = pInvB + GFP_PELEN(pGroundGF);
-
- int degB = degree(pB, pGFpx);
- int i;
-
- cpGFpElementCopy(pR, GFP_MODULUS(pGFpx), elemLen);
- cpGFpElementPadd(pQ, elemLen, 0);
-
- cpGFpxInv(pInvB, GFPX_IDX_ELEMENT(pB, degB, termLen), pGroundGF);
-
- for(i=0; i<degB; i++) {
- BNU_CHUNK_T* ptr;
- cpGFpxMul(pTmp, pInvB, GFPX_IDX_ELEMENT(pB, i, termLen), pGroundGF);
- ptr = GFPX_IDX_ELEMENT(pR, GFP_DEGREE(pGFpx)-degB+i, termLen);
- cpGFpxSub(ptr, ptr, pTmp, pGroundGF);
- }
-
- gfpxPolyDiv(pQ, pR, pR, pB, pGFpx);
-
- cpGFpElementCopy(GFPX_IDX_ELEMENT(pQ, GFP_DEGREE(pGFpx)-degB, termLen), pInvB, termLen);
-
- cpGFpReleasePool(2, pGroundGF);
- return pR;
- }
-}
-
-BNU_CHUNK_T* cpGFpxInv(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, IppsGFpState* pGFpx)
-{
- if( GFP_IS_BASIC(pGFpx) )
- return cpGFpInv(pR, pA, pGFpx);
-
- if(0==degree(pA, pGFpx)) {
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
- BNU_CHUNK_T* tmpR = cpGFpGetPool(1, pGroundGF);
-
- cpGFpxInv(tmpR, pA, pGroundGF);
-
- cpGFpElementCopyPadd(pR, GFP_FELEN(pGFpx), tmpR, GFP_FELEN(pGroundGF));
- cpGFpReleasePool(1, pGroundGF);
- return pR;
- }
-
- else {
- int elemLen = GFP_FELEN(pGFpx);
- IppsGFpState* pGroundGF = GFP_GROUNDGF(pGFpx);
- IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
-
- int pxVars = 6;
- int pelemLen = GFP_PELEN(pGFpx);
- BNU_CHUNK_T* lastrem = cpGFpGetPool(pxVars, pGFpx);
- BNU_CHUNK_T* rem = lastrem + pelemLen;
- BNU_CHUNK_T* quo = rem + pelemLen;
- BNU_CHUNK_T* lastaux = quo + pelemLen;
- BNU_CHUNK_T* aux = lastaux + pelemLen;
- BNU_CHUNK_T* temp = aux + pelemLen;
-
- cpGFpElementCopy(lastrem, pA, elemLen);
- cpGFpElementCopyPadd(lastaux, elemLen, MNT_1(GFP_MONT(pBasicGF)), GFP_FELEN(pBasicGF));
-
- gfpxGeneratorDiv(quo, rem, pA, pGFpx);
- cpGFpxNeg(aux, quo, pGFpx);
-
- while(degree(rem, pGFpx) > 0) {
- gfpxPolyDiv(quo, temp, lastrem, rem, pGFpx);
- SWAP_PTR(BNU_CHUNK_T, rem, lastrem); //
- SWAP_PTR(BNU_CHUNK_T, temp, rem);
-
- cpGFpxNeg(quo, quo, pGFpx);
- cpGFpxMul(temp, quo, aux, pGFpx);
- cpGFpxAdd(temp, lastaux, temp, pGFpx);
- SWAP_PTR(BNU_CHUNK_T, aux, lastaux);
- SWAP_PTR(BNU_CHUNK_T, temp, aux);
- }
- if (GFP_IS_ZERO(rem, elemLen)) { /* gcd != 1 */
- cpGFpReleasePool(pxVars, pGFpx);
- return NULL;
- }
-
- {
- BNU_CHUNK_T* invRem = cpGFpGetPool(1, pGroundGF);
-
- cpGFpxInv(invRem, rem, pGroundGF);
- cpGFpxMul_GFE(pR, aux, invRem, pGFpx);
-
- cpGFpReleasePool(1, pGroundGF);
- }
-
- cpGFpReleasePool(pxVars, pGFpx);
-
- return pR;
- }
-}
-
-
-static int div_upper(int a, int d)
-{ return (a+d-1)/d; }
-
-static int getNumOperations(int bitsize, int w)
-{
- int n_overhead = (1<<w) -1;
- int n_ops = div_upper(bitsize, w) + n_overhead;
- return n_ops;
-}
-int cpGFpGetOptimalWinSize(int bitsize)
-{
-#define LIMIT (LOG2_CACHE_LINE_SIZE)
- int w_opt = 1;
- int n_opt = getNumOperations(bitsize, w_opt);
- int w_trial;
- for(w_trial=w_opt+1; w_trial<=LIMIT; w_trial++) {
- int n_trial = getNumOperations(bitsize, w_trial);
- if(n_trial>=n_opt) break;
- w_opt = w_trial;
- n_opt = n_trial;
- }
- return w_opt;
-#undef LIMIT
-}
-
-
-/* sscm version */
-BNU_CHUNK_T* cpGFpxExp(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pE, int nsE,
- IppsGFpState* pGFpx, Ipp8u* pScratchBuffer)
-{
- IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
-
- /* remove leding zeros */
- FIX_BNU(pE, nsE);
-
- {
- Ipp8u* pScratchAligned; /* aligned scratch buffer */
- int nAllocation = 0; /* points from the pool */
-
- /* size of element (bytes) */
- int elmDataSize = GFP_FELEN(pGFpx)*sizeof(BNU_CHUNK_T);
-
- /* exponent bitsize */
- int expBitSize = BITSIZE_BNU(pE, nsE);
- /* optimal size of window */
- int w = (NULL==pScratchBuffer)? 1 : cpGFpGetOptimalWinSize(expBitSize);
- /* number of table entries */
- int nPrecomputed = 1<<w;
-
- BNU_CHUNK_T* pExpandedE = cpGFpGetPool(1, pGFpx);
- BNU_CHUNK_T* pTmp = cpGFpGetPool(1, pGFpx);
- int poolElmLen = GFP_PELEN(pGFpx);
-
- if(NULL==pScratchBuffer) {
- nAllocation = 2 + div_upper(CACHE_LINE_SIZE, poolElmLen*sizeof(BNU_CHUNK_T));
- pScratchBuffer = (Ipp8u*)cpGFpGetPool(nAllocation, pGFpx);
- }
- pScratchAligned = IPP_ALIGNED_PTR(pScratchBuffer, CACHE_LINE_SIZE);
-
- /* pre-compute auxiliary table t[] = {1, A, A^2, ..., A^(2^w-1)} */
- cpGFpElementCopyPadd(pTmp, GFP_FELEN(pGFpx), MNT_1(GFP_MONT(pBasicGF)), GFP_FELEN(pBasicGF));
- cpScramblePut(pScratchAligned+0, nPrecomputed, (Ipp8u*)pTmp, elmDataSize);
- {
- int n;
- for(n=1; n<nPrecomputed; n++) {
- pGFpx->mul(pTmp, pTmp, pA, pGFpx);
- cpScramblePut(pScratchAligned+n, nPrecomputed, (Ipp8u*)pTmp, elmDataSize);
- }
- }
-
- {
- /* copy exponent value */
- cpGFpElementCopy(pExpandedE, pE, nsE);
-
- /* expand exponent value */
- ((Ipp32u*)pExpandedE)[BITS2WORD32_SIZE(expBitSize)] = 0;
- expBitSize = ((expBitSize+w-1)/w)*w;
-
- /*
- // exponentiation
- */
- {
- /* digit mask */
- BNU_CHUNK_T dmask = nPrecomputed-1;
-
- /* position (bit number) of the leftmost window */
- int wPosition = expBitSize-w;
-
- /* extract leftmost window value */
- Ipp32u eChunk = *((Ipp32u*)((Ipp16u*)pExpandedE+ wPosition/BITSIZE(Ipp16u)));
- int shift = wPosition & 0xF;
- Ipp32u windowVal = (eChunk>>shift) & dmask;
-
- /* initialize result */
- cpScrambleGet((Ipp8u*)pR, elmDataSize, pScratchAligned+windowVal, nPrecomputed);
-
- for(wPosition-=w; wPosition>=0; wPosition-=w) {
- int k;
- /* w times squaring */
- for(k=0; k<w; k++)
- pGFpx->sqr(pR, pR, pGFpx);
-
- /* extract next window value */
- eChunk = *((Ipp32u*)((Ipp16u*)pExpandedE+ wPosition/BITSIZE(Ipp16u)));
- shift = wPosition & 0xF;
- windowVal = (eChunk>>shift) & dmask;
-
- /* extract value from the pre-computed table */
- cpScrambleGet((Ipp8u*)pTmp, elmDataSize, pScratchAligned+windowVal, nPrecomputed);
-
- /* and multiply */
- pGFpx->mul(pR, pR, pTmp, pGFpx);
- }
- }
-
- }
-
- cpGFpReleasePool(nAllocation+2, pGFpx);
-
- return pR;
- }
-}
-
-
-static void cpPrecomputeMultiExp(Ipp8u* pTable, const BNU_CHUNK_T* ppA[], int nItems, IppsGFpState* pGFpx)
-{
- IppsGFpState* pBasicGF = cpGFpBasic(pGFpx);
-
- int nPrecomputed = 1<<nItems;
-
- /* length of element (BNU_CHUNK_T) */
- int elmLen = GFP_FELEN(pGFpx);
- /* size of element (bytes) */
- int elmDataSize = GFP_FELEN(pGFpx)*sizeof(BNU_CHUNK_T);
-
- /* get resource */
- BNU_CHUNK_T* pT = cpGFpGetPool(1, pGFpx);
-
- /* pTable[0] = 1 */
- cpGFpElementCopyPadd(pT, elmLen, MNT_1(GFP_MONT(pBasicGF)), GFP_FELEN(pBasicGF));
- cpScramblePut(pTable+0, nPrecomputed, (Ipp8u*)pT, elmDataSize);
- /* pTable[1] = A[0] */
- cpScramblePut(pTable+1, nPrecomputed, (Ipp8u*)(ppA[0]), elmDataSize);
-
- {
- int i, baseIdx;
- for(i=1, baseIdx=2; i<nItems; i++, baseIdx*=2) {
- /* pTable[baseIdx] = A[i] */
- cpScramblePut(pTable+baseIdx, nPrecomputed, (Ipp8u*)(ppA[i]), elmDataSize);
-
- {
- int nPasses = 1;
- int step = baseIdx/2;
-
- int k;
- for(k=i-1; k>=0; k--) {
- int tblIdx = baseIdx;
-
- int n;
- for(n=0; n<nPasses; n++, tblIdx+=2*step) {
- /* use pre-computed value */
- cpScrambleGet((Ipp8u*)pT, elmDataSize, pTable+tblIdx, nPrecomputed);
- pGFpx->mul(pT, pT, ppA[k], pGFpx);
- cpScramblePut(pTable+tblIdx+step, nPrecomputed, (Ipp8u*)pT, elmDataSize);
- }
-
- nPasses *= 2;
- step /= 2;
- }
- }
- }
- }
-
- /* release resourse */
- cpGFpReleasePool(1, pGFpx);
-}
-
-static int cpGetMaxBitsizeExponent(const BNU_CHUNK_T* ppE[], int nsE[], int nItems)
-{
- int n;
- /* find out the longest exponent */
- int expBitSize = BITSIZE_BNU(ppE[0], nsE[0]);
- for(n=1; n<nItems; n++) {
- expBitSize = IPP_MAX(expBitSize, BITSIZE_BNU(ppE[n], nsE[n]));
- }
- return expBitSize;
-}
-
-static int GetIndex(const BNU_CHUNK_T* ppE[], int nItems, int nBit)
-{
- int shift = nBit%BYTESIZE;
- int offset= nBit/BYTESIZE;
- int index = 0;
-
- int n;
- for(n=nItems; n>0; n--) {
- const Ipp8u* pE = ((Ipp8u*)ppE[n-1]) + offset;
- Ipp8u e = pE[0];
- index <<= 1;
- index += (e>>shift) &1;
- }
- return index;
-}
-
-/* sscm version */
-BNU_CHUNK_T* cpGFpxMultiExp(BNU_CHUNK_T* pR, const BNU_CHUNK_T* ppA[], const BNU_CHUNK_T* ppE[], int nsE[], int nItems,
- IppsGFpState* pGFpx, Ipp8u* pScratchBuffer)
-{
- /* align scratch buffer */
- Ipp8u* pScratchAligned = IPP_ALIGNED_PTR(pScratchBuffer, CACHE_LINE_SIZE);
- /* pre-compute table */
- cpPrecomputeMultiExp(pScratchAligned, ppA, nItems, pGFpx);
-
- {
- /* find out the longest exponent */
- int expBitSize = cpGetMaxBitsizeExponent(ppE, nsE, nItems);
-
- /* allocate resource and copy expanded exponents into */
- const BNU_CHUNK_T* ppExponent[LOG2_CACHE_LINE_SIZE];
- {
- int n;
- for(n=0; n<nItems; n++) {
- BNU_CHUNK_T* pData = cpGFpGetPool(1, pGFpx);
- cpGFpElementCopyPadd(pData, GFP_FELEN(pGFpx), ppE[n], nsE[n]);
- ppExponent[n] = pData;
- }
- }
-
- /* multiexponentiation */
- {
- int nPrecomputed = 1<<nItems;
- int elmDataSize = GFP_FELEN(pGFpx)*sizeof(BNU_CHUNK_T);
-
- /* get temporary */
- BNU_CHUNK_T* pT = cpGFpGetPool(1, pGFpx);
-
- /* init result */
- int tblIdx = GetIndex(ppExponent, nItems, --expBitSize);
- cpScrambleGet((Ipp8u*)pR, elmDataSize, pScratchAligned+tblIdx, nPrecomputed);
-
- /* compute the rest: square and multiply */
- for(--expBitSize; expBitSize>=0; expBitSize--) {
- pGFpx->sqr(pR, pR, pGFpx);
- tblIdx = GetIndex(ppExponent, nItems, expBitSize);
- cpScrambleGet((Ipp8u*)pT, elmDataSize, pScratchAligned+tblIdx, nPrecomputed);
- pGFpx->mul(pR, pR, pT, pGFpx);
- }
-
- /* release resourse */
- cpGFpReleasePool(1, pGFpx);
- }
-
- /* release resourse */
- cpGFpReleasePool(nItems, pGFpx);
-
- return pR;
- }
-}
diff --git a/parts-site/configurations/debug/g++.py b/parts-site/configurations/debug/g++.py
index 0f11799..207098a 100644
--- a/parts-site/configurations/debug/g++.py
+++ b/parts-site/configurations/debug/g++.py
@@ -39,7 +39,7 @@ config.VersionRange("3-*",
'-Wextra',
# pedantic warnings
# '-Wpedantic',
- ],
+ '-fPIC'],
CXXFLAGS=[
# modern C++ features support
'-std=c++0x',
diff --git a/parts-site/configurations/debug/gcc.py b/parts-site/configurations/debug/gcc.py
index ebf4162..c617f4e 100644
--- a/parts-site/configurations/debug/gcc.py
+++ b/parts-site/configurations/debug/gcc.py
@@ -48,5 +48,5 @@ config.VersionRange("3-*",
'-Wno-unused-but-set-variable',
# do not warn about multiline comments
'-Wno-comment',
- ],
+ '-fPIC'],
))
diff --git a/parts-site/configurations/debug/intelc_posix-any.py b/parts-site/configurations/debug/intelc_posix-any.py
index 8b3d845..0817b51 100644
--- a/parts-site/configurations/debug/intelc_posix-any.py
+++ b/parts-site/configurations/debug/intelc_posix-any.py
@@ -39,7 +39,7 @@ config.VersionRange("7-*",
'-Wextra',
# pedantic warnings
# '-Wpedantic',
- ],
+ '-fPIC'],
CXXFLAGS=['',
# modern C++ features support
'-std=c++0x',
diff --git a/parts-site/configurations/instr_release/__init__.py b/parts-site/configurations/instr_release/__init__.py
new file mode 100644
index 0000000..cc18909
--- /dev/null
+++ b/parts-site/configurations/instr_release/__init__.py
@@ -0,0 +1,20 @@
+############################################################################
+# Copyright 2017 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.
+############################################################################
+# pylint: disable=locally-disabled, missing-docstring
+
+from parts.config import DefineConfiguration
+
+DefineConfiguration("instr_release", dependsOn='release')
diff --git a/parts-site/configurations/instr_release/g++.py b/parts-site/configurations/instr_release/g++.py
new file mode 100644
index 0000000..d208bd6
--- /dev/null
+++ b/parts-site/configurations/instr_release/g++.py
@@ -0,0 +1,31 @@
+############################################################################
+# Copyright 2017 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, missing-docstring
+
+"""g++ compiler configuration for release
+"""
+from parts.config import ConfigValues, configuration
+
+def map_default_version(env):
+ return env['GCC_VERSION']
+
+config = configuration(map_default_version)
+
+config.VersionRange("3-*",
+ append=ConfigValues(
+ CCFLAGS=['-finstrument-functions'],
+ )
+ )
diff --git a/parts-site/configurations/instr_release/gcc.py b/parts-site/configurations/instr_release/gcc.py
new file mode 100644
index 0000000..3fc9ed6
--- /dev/null
+++ b/parts-site/configurations/instr_release/gcc.py
@@ -0,0 +1,31 @@
+############################################################################
+# Copyright 2017 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, missing-docstring
+
+"""gcc compiler configuration for release
+"""
+from parts.config import ConfigValues, configuration
+
+def map_default_version(env):
+ return env['GCC_VERSION']
+
+config = configuration(map_default_version)
+
+config.VersionRange("3-*",
+ append=ConfigValues(
+ CCFLAGS=['-finstrument-functions'],
+ )
+ )
diff --git a/parts-site/configurations/instr_release/intelc_posix-any.py b/parts-site/configurations/instr_release/intelc_posix-any.py
new file mode 100644
index 0000000..ed8b94a
--- /dev/null
+++ b/parts-site/configurations/instr_release/intelc_posix-any.py
@@ -0,0 +1,33 @@
+############################################################################
+# Copyright 2017 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, missing-docstring
+
+"""Intel posix compiler configuration for release
+"""
+
+from parts.config import ConfigValues, configuration
+
+def map_default_version(env):
+ return env['INTELC_VERSION']
+
+
+config = configuration(map_default_version)
+
+config.VersionRange("7-*",
+ append=ConfigValues(
+ CCFLAGS=['-finstrument-functions'],
+ )
+ )
diff --git a/parts-site/configurations/instr_release/intelc_win32-any.py b/parts-site/configurations/instr_release/intelc_win32-any.py
new file mode 100644
index 0000000..a8fde45
--- /dev/null
+++ b/parts-site/configurations/instr_release/intelc_win32-any.py
@@ -0,0 +1,35 @@
+############################################################################
+# Copyright 2017 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, missing-docstring
+
+"""Intel win32 compiler configuration for release
+"""
+from parts.config import ConfigValues, configuration
+
+def map_default_version(env):
+ return env['INTELC_VERSION']
+
+config = configuration(map_default_version)
+
+config.VersionRange("7-*",
+ filter=ConfigValues(
+ CCFLAGS=['/MT', '/MD', '/MDd']
+ ),
+ append=ConfigValues(
+ CCFLAGS=['/Gh',
+ '/MTd']
+ )
+ )
diff --git a/parts-site/configurations/instr_release/msvc_win32-any.py b/parts-site/configurations/instr_release/msvc_win32-any.py
new file mode 100644
index 0000000..70e4da5
--- /dev/null
+++ b/parts-site/configurations/instr_release/msvc_win32-any.py
@@ -0,0 +1,35 @@
+############################################################################
+# Copyright 2017 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, missing-docstring
+
+"""Intel win32 compiler configurations release
+"""
+from parts.config import ConfigValues, configuration
+
+def map_default_version(env):
+ return env['MSVC_VERSION']
+
+config = configuration(map_default_version)
+
+config.VersionRange("7-*",
+ filter=ConfigValues(
+ CCFLAGS=['/MT', '/MD', '/MDd']
+ ),
+ append=ConfigValues(
+ CCFLAGS=['/Gh',
+ '/MTd']
+ )
+ )
diff --git a/parts-site/configurations/instr_size_optimized_release/__init__.py b/parts-site/configurations/instr_size_optimized_release/__init__.py
new file mode 100644
index 0000000..414313f
--- /dev/null
+++ b/parts-site/configurations/instr_size_optimized_release/__init__.py
@@ -0,0 +1,20 @@
+############################################################################
+# Copyright 2017 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.
+############################################################################
+# pylint: disable=locally-disabled, missing-docstring
+
+from parts.config import DefineConfiguration
+
+DefineConfiguration("instr_size_optimized_release", dependsOn='size_optimized_release')
diff --git a/parts-site/configurations/instr_size_optimized_release/g++.py b/parts-site/configurations/instr_size_optimized_release/g++.py
new file mode 100644
index 0000000..d208bd6
--- /dev/null
+++ b/parts-site/configurations/instr_size_optimized_release/g++.py
@@ -0,0 +1,31 @@
+############################################################################
+# Copyright 2017 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, missing-docstring
+
+"""g++ compiler configuration for release
+"""
+from parts.config import ConfigValues, configuration
+
+def map_default_version(env):
+ return env['GCC_VERSION']
+
+config = configuration(map_default_version)
+
+config.VersionRange("3-*",
+ append=ConfigValues(
+ CCFLAGS=['-finstrument-functions'],
+ )
+ )
diff --git a/parts-site/configurations/instr_size_optimized_release/gcc.py b/parts-site/configurations/instr_size_optimized_release/gcc.py
new file mode 100644
index 0000000..3fc9ed6
--- /dev/null
+++ b/parts-site/configurations/instr_size_optimized_release/gcc.py
@@ -0,0 +1,31 @@
+############################################################################
+# Copyright 2017 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, missing-docstring
+
+"""gcc compiler configuration for release
+"""
+from parts.config import ConfigValues, configuration
+
+def map_default_version(env):
+ return env['GCC_VERSION']
+
+config = configuration(map_default_version)
+
+config.VersionRange("3-*",
+ append=ConfigValues(
+ CCFLAGS=['-finstrument-functions'],
+ )
+ )
diff --git a/parts-site/configurations/instr_size_optimized_release/intelc_posix-any.py b/parts-site/configurations/instr_size_optimized_release/intelc_posix-any.py
new file mode 100644
index 0000000..ed8b94a
--- /dev/null
+++ b/parts-site/configurations/instr_size_optimized_release/intelc_posix-any.py
@@ -0,0 +1,33 @@
+############################################################################
+# Copyright 2017 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, missing-docstring
+
+"""Intel posix compiler configuration for release
+"""
+
+from parts.config import ConfigValues, configuration
+
+def map_default_version(env):
+ return env['INTELC_VERSION']
+
+
+config = configuration(map_default_version)
+
+config.VersionRange("7-*",
+ append=ConfigValues(
+ CCFLAGS=['-finstrument-functions'],
+ )
+ )
diff --git a/parts-site/configurations/instr_size_optimized_release/intelc_win32-any.py b/parts-site/configurations/instr_size_optimized_release/intelc_win32-any.py
new file mode 100644
index 0000000..a8fde45
--- /dev/null
+++ b/parts-site/configurations/instr_size_optimized_release/intelc_win32-any.py
@@ -0,0 +1,35 @@
+############################################################################
+# Copyright 2017 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, missing-docstring
+
+"""Intel win32 compiler configuration for release
+"""
+from parts.config import ConfigValues, configuration
+
+def map_default_version(env):
+ return env['INTELC_VERSION']
+
+config = configuration(map_default_version)
+
+config.VersionRange("7-*",
+ filter=ConfigValues(
+ CCFLAGS=['/MT', '/MD', '/MDd']
+ ),
+ append=ConfigValues(
+ CCFLAGS=['/Gh',
+ '/MTd']
+ )
+ )
diff --git a/parts-site/configurations/instr_size_optimized_release/msvc_win32-any.py b/parts-site/configurations/instr_size_optimized_release/msvc_win32-any.py
new file mode 100644
index 0000000..70e4da5
--- /dev/null
+++ b/parts-site/configurations/instr_size_optimized_release/msvc_win32-any.py
@@ -0,0 +1,35 @@
+############################################################################
+# Copyright 2017 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, missing-docstring
+
+"""Intel win32 compiler configurations release
+"""
+from parts.config import ConfigValues, configuration
+
+def map_default_version(env):
+ return env['MSVC_VERSION']
+
+config = configuration(map_default_version)
+
+config.VersionRange("7-*",
+ filter=ConfigValues(
+ CCFLAGS=['/MT', '/MD', '/MDd']
+ ),
+ append=ConfigValues(
+ CCFLAGS=['/Gh',
+ '/MTd']
+ )
+ )
diff --git a/parts-site/configurations/release/g++.py b/parts-site/configurations/release/g++.py
index 21ba88d..609dd36 100644
--- a/parts-site/configurations/release/g++.py
+++ b/parts-site/configurations/release/g++.py
@@ -37,11 +37,19 @@ config.VersionRange("3-*",
'-Wextra',
# pedantic warnings
# '-Wpedantic',
- ],
+ '-Wformat',
+ '-Wformat-security',
+ '-fstack-protector',
+ '-fPIC'],
CXXFLAGS=['',
# modern C++ features support
- '-std=c++0x',
- ],
- CPPDEFINES=['NDEBUG']
+ '-std=c++0x'],
+ CPPDEFINES=['NDEBUG',
+ '_FORTIFY_SOURCE=2'],
+ LINKFLAGS=['-fstack-protector',
+ '-znoexecstack',
+ '-zrelro',
+ '-znow',
+ '-pie'],
)
)
diff --git a/parts-site/configurations/release/gcc.py b/parts-site/configurations/release/gcc.py
index 55e3201..f7273c8 100644
--- a/parts-site/configurations/release/gcc.py
+++ b/parts-site/configurations/release/gcc.py
@@ -48,7 +48,16 @@ config.VersionRange("3-*",
'-Wno-unused-but-set-variable',
# do not warn about multiline comments
'-Wno-comment',
- ],
- CPPDEFINES=['NDEBUG'],
+ '-Wformat',
+ '-Wformat-security',
+ '-fstack-protector',
+ '-fPIC'],
+ CPPDEFINES=['NDEBUG',
+ '_FORTIFY_SOURCE=2'],
+ LINKFLAGS=['-fstack-protector',
+ '-znoexecstack',
+ '-zrelro',
+ '-znow',
+ '-pie'],
)
)
diff --git a/parts-site/configurations/release/intelc_posix-any.py b/parts-site/configurations/release/intelc_posix-any.py
index a1b587a..2e58042 100644
--- a/parts-site/configurations/release/intelc_posix-any.py
+++ b/parts-site/configurations/release/intelc_posix-any.py
@@ -39,11 +39,19 @@ config.VersionRange("7-*",
'-Wextra',
# pedantic warnings
# '-Wpedantic',
- ],
+ '-Wformat',
+ '-Wformat-security',
+ '-fstack-protector',
+ '-fPIC'],
CXXFLAGS=['',
# modern C++ features support
- '-std=c++0x',
- ],
- CPPDEFINES=['NDEBUG']
+ '-std=c++0x'],
+ CPPDEFINES=['NDEBUG',
+ '_FORTIFY_SOURCE=2'],
+ LINKFLAGS=['-fstack-protector',
+ '-znoexecstack',
+ '-zrelro',
+ '-znow',
+ '-pie'],
)
)
diff --git a/parts-site/configurations/release/msvc_win32-any_win32-x86.py b/parts-site/configurations/release/msvc_win32-any_win32-x86.py
index 6d7a5d5..9f00330 100644
--- a/parts-site/configurations/release/msvc_win32-any_win32-x86.py
+++ b/parts-site/configurations/release/msvc_win32-any_win32-x86.py
@@ -44,6 +44,7 @@ config.VersionRange("7-*",
'/Gd',
'/Oi',
'/MT',
+ '/sdl',
'/nologo'],
CXXFLAGS=['/EHsc',
'/GR'],
diff --git a/parts-site/configurations/release/msvc_win32-any_win32-x86_64.py b/parts-site/configurations/release/msvc_win32-any_win32-x86_64.py
index 3a14b84..8ef46ef 100644
--- a/parts-site/configurations/release/msvc_win32-any_win32-x86_64.py
+++ b/parts-site/configurations/release/msvc_win32-any_win32-x86_64.py
@@ -43,6 +43,7 @@ config.VersionRange("7-*",
'/Zc:forScope',
'/Oi',
'/MT',
+ '/sdl',
'/nologo'],
CXXFLAGS=['/EHsc',
'/GR'],
diff --git a/parts-site/configurations/size_optimized_release/__init__.py b/parts-site/configurations/size_optimized_release/__init__.py
new file mode 100644
index 0000000..7864657
--- /dev/null
+++ b/parts-site/configurations/size_optimized_release/__init__.py
@@ -0,0 +1,20 @@
+############################################################################
+# 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.
+############################################################################
+# pylint: disable=locally-disabled, missing-docstring
+
+from parts.config import DefineConfiguration
+
+DefineConfiguration("size_optimized_release", dependsOn='default')
diff --git a/parts-site/configurations/size_optimized_release/g++.py b/parts-site/configurations/size_optimized_release/g++.py
new file mode 100644
index 0000000..7a4e144
--- /dev/null
+++ b/parts-site/configurations/size_optimized_release/g++.py
@@ -0,0 +1,57 @@
+############################################################################
+# 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, missing-docstring
+
+"""g++ compiler configuration for size
+"""
+from parts.config import ConfigValues, configuration
+
+def map_default_version(env):
+ return env['GCC_VERSION']
+
+config = configuration(map_default_version)
+
+config.VersionRange("3-*",
+ append=ConfigValues(
+ CCFLAGS=['',
+ # size optimization
+ '-Os',
+ '-fdata-sections',
+ '-ffunction-sections',
+ # treat warnings as errors
+ '-Werror',
+ # enable all warnings
+ '-Wall',
+ # extra warnings
+ '-Wextra',
+ '-Wformat',
+ '-Wformat-security',
+ '-fstack-protector',
+ '-fPIC'],
+ CXXFLAGS=['',
+ # modern C++ features support
+ '-std=c++0x'],
+ CPPDEFINES=['NDEBUG',
+ '_FORTIFY_SOURCE=2'],
+ LINKFLAGS=['-fstack-protector',
+ '-znoexecstack',
+ '-zrelro',
+ '-znow',
+ '-pie',
+ # link only what is used
+ '-Xlinker', '--gc-sections'],
+ )
+ )
diff --git a/parts-site/configurations/size_optimized_release/gcc.py b/parts-site/configurations/size_optimized_release/gcc.py
new file mode 100644
index 0000000..3aa9567
--- /dev/null
+++ b/parts-site/configurations/size_optimized_release/gcc.py
@@ -0,0 +1,65 @@
+############################################################################
+# 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, missing-docstring
+
+"""gcc compiler configuration for size
+"""
+from parts.config import ConfigValues, configuration
+
+def map_default_version(env):
+ return env['GCC_VERSION']
+
+config = configuration(map_default_version)
+
+config.VersionRange("3-*",
+ append=ConfigValues(
+ CCFLAGS=['',
+ # size optimization
+ '-Os',
+ '-fdata-sections',
+ '-ffunction-sections',
+ # treat warnings as errors
+ '-Werror',
+ # enable all warnings
+ '-Wall',
+ # extra warnings
+ '-Wextra',
+ # disable warnings due to gcc 4.8.5 issues
+ '-Wno-missing-braces',
+ '-Wno-missing-field-initializers',
+ '-Wno-unknown-pragmas',
+ '-Wno-unused-function',
+ # do not assume strict aliasing
+ '-fno-strict-aliasing',
+ # do not warn about unused but set variables
+ '-Wno-unused-but-set-variable',
+ # do not warn about multiline comments
+ '-Wno-comment',
+ '-Wformat',
+ '-Wformat-security',
+ '-fstack-protector',
+ '-fPIC'],
+ CPPDEFINES=['NDEBUG',
+ '_FORTIFY_SOURCE=2'],
+ LINKFLAGS=['-fstack-protector',
+ '-znoexecstack',
+ '-zrelro',
+ '-znow',
+ '-pie',
+ # link only what is used
+ '-Xlinker', '--gc-sections'],
+ )
+ )
diff --git a/parts-site/configurations/size_optimized_release/intelc_posix-any_posix-x86.py b/parts-site/configurations/size_optimized_release/intelc_posix-any_posix-x86.py
new file mode 100644
index 0000000..9a4234b
--- /dev/null
+++ b/parts-site/configurations/size_optimized_release/intelc_posix-any_posix-x86.py
@@ -0,0 +1,58 @@
+############################################################################
+# 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, missing-docstring
+
+"""Intel posix compiler configuration for size
+"""
+
+from parts.config import ConfigValues, configuration
+
+def map_default_version(env):
+ return env['INTELC_VERSION']
+
+
+config = configuration(map_default_version)
+
+config.VersionRange("7-*",
+ append=ConfigValues(
+ CCFLAGS=['',
+ '-O2',
+ '-fdata-sections',
+ '-ffunction-sections',
+ # treat warnings as errors
+ '-Werror',
+ # enable all warnings
+ '-Wall',
+ # extra warnings
+ '-Wextra',
+ '-Wformat',
+ '-Wformat-security',
+ '-fstack-protector',
+ '-fPIC'],
+ CXXFLAGS=['',
+ # modern C++ features support
+ '-std=c++0x'],
+ CPPDEFINES=['NDEBUG',
+ '_FORTIFY_SOURCE=2'],
+ LINKFLAGS=['-fstack-protector',
+ '-znoexecstack',
+ '-zrelro',
+ '-znow',
+ '-pie',
+ # link only what is used
+ '-Xlinker', '--gc-sections'],
+ )
+ )
diff --git a/parts-site/configurations/size_optimized_release/intelc_posix-any_posix-x86_64.py b/parts-site/configurations/size_optimized_release/intelc_posix-any_posix-x86_64.py
new file mode 100644
index 0000000..e2a2b3b
--- /dev/null
+++ b/parts-site/configurations/size_optimized_release/intelc_posix-any_posix-x86_64.py
@@ -0,0 +1,59 @@
+############################################################################
+# 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, missing-docstring
+
+"""Intel posix compiler configuration for size
+"""
+
+from parts.config import ConfigValues, configuration
+
+def map_default_version(env):
+ return env['INTELC_VERSION']
+
+
+config = configuration(map_default_version)
+
+config.VersionRange("7-*",
+ append=ConfigValues(
+ CCFLAGS=['',
+ # size optimization
+ '-Os',
+ '-fdata-sections',
+ '-ffunction-sections',
+ # treat warnings as errors
+ '-Werror',
+ # enable all warnings
+ '-Wall',
+ # extra warnings
+ '-Wextra',
+ '-Wformat',
+ '-Wformat-security',
+ '-fstack-protector',
+ '-fPIC'],
+ CXXFLAGS=['',
+ # modern C++ features support
+ '-std=c++0x'],
+ CPPDEFINES=['NDEBUG',
+ '_FORTIFY_SOURCE=2'],
+ LINKFLAGS=['-fstack-protector',
+ '-znoexecstack',
+ '-zrelro',
+ '-znow',
+ '-pie',
+ # link only what is used
+ '-Xlinker', '--gc-sections'],
+ )
+ )
diff --git a/parts-site/configurations/size_optimized_release/intelc_win32-any_win32-x86.py b/parts-site/configurations/size_optimized_release/intelc_win32-any_win32-x86.py
new file mode 100644
index 0000000..e653441
--- /dev/null
+++ b/parts-site/configurations/size_optimized_release/intelc_win32-any_win32-x86.py
@@ -0,0 +1,59 @@
+############################################################################
+# Copyright 2017 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, missing-docstring
+
+"""Intel win32 compiler configuration for size
+"""
+from parts.config import ConfigValues, configuration
+
+def map_default_version(env):
+ return env['INTELC_VERSION']
+
+config = configuration(map_default_version)
+
+config.VersionRange("7-*",
+ append=ConfigValues(
+ CCFLAGS=['',
+ # size optimization
+ '/O2',
+ '/Os',
+ '/Gy',
+ '/Oi',
+ '/MP',
+ '/GS',
+ '/W4',
+ '/Gy',
+ '/Zc:wchar_t',
+ '/Z7',
+ '/fp:precise',
+ '/WX',
+ '/Zc:forScope',
+ '/Gd',
+ '/MT',
+ '/nologo'],
+ CXXFLAGS=['/EHsc',
+ '/GR'],
+ LINKFLAGS=['/LTCG',
+ '/WX',
+ '/SAFESEH',
+ '/NXCOMPAT',
+ '/DYNAMICBASE',
+ '/nologo',
+ # link only what is used
+ '/OPT:REF'],
+ CPPDEFINES=['NDEBUG']
+ )
+ )
diff --git a/parts-site/configurations/size_optimized_release/intelc_win32-any_win32-x86_64.py b/parts-site/configurations/size_optimized_release/intelc_win32-any_win32-x86_64.py
new file mode 100644
index 0000000..4bad016
--- /dev/null
+++ b/parts-site/configurations/size_optimized_release/intelc_win32-any_win32-x86_64.py
@@ -0,0 +1,58 @@
+############################################################################
+# Copyright 2017 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, missing-docstring
+
+"""Intel win32 compiler configurations size
+"""
+from parts.config import ConfigValues, configuration
+
+def map_default_version(env):
+ return env['INTELC_VERSION']
+
+config = configuration(map_default_version)
+
+config.VersionRange("7-*",
+ append=ConfigValues(
+ CCFLAGS=['',
+ # size optimization
+ '/O2',
+ '/Os',
+ '/Gy',
+ '/Oi',
+ '/MP',
+ '/GS',
+ '/W4',
+ '/Gy',
+ '/Zc:wchar_t',
+ '/Z7',
+ '/fp:precise',
+ '/WX',
+ '/Zc:forScope',
+ '/MT',
+ '/nologo'],
+ CXXFLAGS=['/EHsc',
+ '/GR'],
+ LINKFLAGS=['/LTCG',
+ '/WX',
+ '/NXCOMPAT',
+ '/DYNAMICBASE',
+ '/MACHINE:X64',
+ '/nologo',
+ # link only what is used
+ '/OPT:REF'],
+ CPPDEFINES=['NDEBUG']
+ )
+ )
diff --git a/parts-site/configurations/size_optimized_release/msvc_win32-any_win32-x86.py b/parts-site/configurations/size_optimized_release/msvc_win32-any_win32-x86.py
new file mode 100644
index 0000000..ddcf1ae
--- /dev/null
+++ b/parts-site/configurations/size_optimized_release/msvc_win32-any_win32-x86.py
@@ -0,0 +1,65 @@
+############################################################################
+# Copyright 2017 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, missing-docstring
+
+"""Intel win32 compiler configurations size
+"""
+from parts.config import ConfigValues, configuration
+
+def map_default_version(env):
+ return env['MSVC_VERSION']
+
+config = configuration(map_default_version)
+
+config.VersionRange("7-*",
+ append=ConfigValues(
+ CCFLAGS=['',
+ # size optimization
+ '/O2',
+ '/Os',
+ '/Gy',
+ '/Oi',
+ '/MP',
+ '/GS',
+ '/W4',
+ '/wd4127', # allow while (0)
+ '/wd4592', # VS2015U1 limitation
+ #'/wd4366', # ok unaligned &
+ #'/wd4204', # allow x= {a,b}
+ #'/wd4221', # allow x = {&y}
+ '/Gy',
+ '/Zc:wchar_t',
+ '/Z7',
+ '/fp:precise',
+ '/WX',
+ '/Zc:forScope',
+ '/Gd',
+ '/MT',
+ '/sdl',
+ '/nologo'],
+ CXXFLAGS=['/EHsc',
+ '/GR'],
+ LINKFLAGS=['/LTCG',
+ '/WX',
+ '/SAFESEH',
+ '/NXCOMPAT',
+ '/DYNAMICBASE',
+ '/nologo',
+ # link only what is used
+ '/OPT:REF'],
+ CPPDEFINES=['NDEBUG']
+ )
+ )
diff --git a/parts-site/configurations/size_optimized_release/msvc_win32-any_win32-x86_64.py b/parts-site/configurations/size_optimized_release/msvc_win32-any_win32-x86_64.py
new file mode 100644
index 0000000..a404a06
--- /dev/null
+++ b/parts-site/configurations/size_optimized_release/msvc_win32-any_win32-x86_64.py
@@ -0,0 +1,64 @@
+############################################################################
+# Copyright 2017 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, missing-docstring
+
+"""Intel win32 compiler configurations size
+"""
+from parts.config import ConfigValues, configuration
+
+def map_default_version(env):
+ return env['MSVC_VERSION']
+
+config = configuration(map_default_version)
+
+config.VersionRange("7-*",
+ append=ConfigValues(
+ CCFLAGS=['',
+ # size optimization
+ '/O2',
+ '/Os',
+ '/Gy',
+ '/Oi',
+ '/MP',
+ '/GS',
+ '/W4',
+ '/wd4127', # allow while (0)
+ '/wd4592', # VS2015U1 limitation
+ #'/wd4366', # ok unaligned &
+ #'/wd4204', # allow x= {a,b}
+ #'/wd4221', # allow x = {&y}
+ '/Gy',
+ '/Zc:wchar_t',
+ '/Z7',
+ '/fp:precise',
+ '/WX',
+ '/Zc:forScope',
+ '/MT',
+ '/sdl',
+ '/nologo'],
+ CXXFLAGS=['/EHsc',
+ '/GR'],
+ LINKFLAGS=['/LTCG',
+ '/WX',
+ '/NXCOMPAT',
+ '/DYNAMICBASE',
+ '/MACHINE:X64',
+ '/nologo',
+ # link only what is used
+ '/OPT:REF'],
+ CPPDEFINES=['NDEBUG']
+ )
+ )
diff --git a/parts-site/pieces/arm_support.py b/parts-site/pieces/arm_support.py
new file mode 100644
index 0000000..a32f63a
--- /dev/null
+++ b/parts-site/pieces/arm_support.py
@@ -0,0 +1,23 @@
+############################################################################
+# 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.
+############################################################################
+"""
+Adds ARM targets support to Parts
+"""
+
+import parts.api.platforms
+
+parts.api.platforms.AddArchitecture('arm_hf')
+parts.api.platforms.AddArchitecture('aarch64')
diff --git a/parts-site/tools/g++.py b/parts-site/tools/g++.py
new file mode 100644
index 0000000..0fd7d84
--- /dev/null
+++ b/parts-site/tools/g++.py
@@ -0,0 +1,74 @@
+############################################################################
+# 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name
+"""
+Configure g++ ARM toolchain
+"""
+
+import importlib
+from parts.platform_info import SystemPlatform
+from parts.tools.Common.Finders import PathFinder
+import parts.tools.GnuCommon.common
+
+parts.tools.GnuCommon.common.gxx.Register(
+ # compilation for Linux armel architecture system can be done from any Linux x86_64 system
+ hosts=[SystemPlatform('posix', 'x86_64')],
+ targets=[SystemPlatform('posix', 'arm')],
+ info=[
+ parts.tools.GnuCommon.common.GnuInfo(
+ # default binary location for arm-linux-gnueabi-g++ compiler
+ install_scanner=[PathFinder(['/usr/bin'])],
+ opt_dirs=['/opt/'],
+ script=None,
+ subst_vars={},
+ shell_vars={'PATH': '${GCC.INSTALL_ROOT}'},
+ test_file='arm-linux-gnueabi-g++')
+ ]
+)
+
+parts.tools.GnuCommon.common.gxx.Register(
+ # compilation for Linux armhf architecture system can be done from any Linux x86_64 system
+ hosts=[SystemPlatform('posix', 'x86_64')],
+ targets=[SystemPlatform('posix', 'arm_hf')],
+ info=[
+ parts.tools.GnuCommon.common.GnuInfo(
+ # default binary location for arm-linux-gnueabihf-g++ compiler
+ install_scanner=[PathFinder(['/usr/bin'])],
+ opt_dirs=['/opt/'],
+ script=None,
+ subst_vars={},
+ shell_vars={'PATH': '${GCC.INSTALL_ROOT}'},
+ test_file='arm-linux-gnueabihf-g++')
+ ]
+)
+
+parts.tools.GnuCommon.common.gxx.Register(
+ # compilation for Linux arm 64bit can be done from any Linux x86_64 system
+ hosts=[SystemPlatform('posix', 'x86_64')],
+ targets=[SystemPlatform('posix', 'aarch64')],
+ info=[
+ parts.tools.GnuCommon.common.GnuInfo(
+ # default binary for aarch64-linux-gnu-g++ compiler
+ install_scanner=[PathFinder(['/usr/bin'])],
+ opt_dirs=['/opt/'],
+ script=None,
+ subst_vars={},
+ shell_vars={'PATH': '${GCC.INSTALL_ROOT}'},
+ test_file='aarch64-linux-gnu-g++')
+ ]
+)
+# import g++ tool from parts ( we only need to add configurations to be loaded)
+globals().update(importlib.import_module('parts.tools.g++').__dict__)
diff --git a/parts-site/tools/gcc.py b/parts-site/tools/gcc.py
new file mode 100644
index 0000000..2e82fe8
--- /dev/null
+++ b/parts-site/tools/gcc.py
@@ -0,0 +1,73 @@
+############################################################################
+# 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.
+############################################################################
+# pylint: disable=locally-disabled, invalid-name, wildcard-import, unused-wildcard-import
+"""
+Configure gcc ARM toolchain
+"""
+
+from parts.platform_info import SystemPlatform
+from parts.tools.Common.Finders import PathFinder
+import parts.tools.GnuCommon.common
+# import gcc tool from parts ( we only need to add configurations to be loaded)
+from parts.tools.gcc import *
+
+parts.tools.GnuCommon.common.gcc.Register(
+ # compilation for Linux armel architecture system can be done from any Linux x86_64 system
+ hosts=[SystemPlatform('posix', 'x86_64')],
+ targets=[SystemPlatform('posix', 'arm')],
+ info=[
+ parts.tools.GnuCommon.common.GnuInfo(
+ # default binary location for arm-linux-gnueabi-gcc compiler
+ install_scanner=[PathFinder(['/usr/bin'])],
+ opt_dirs=['/opt/'],
+ script=None,
+ subst_vars={},
+ shell_vars={'PATH': '${GCC.INSTALL_ROOT}'},
+ test_file='arm-linux-gnueabi-gcc')
+ ]
+)
+
+parts.tools.GnuCommon.common.gcc.Register(
+ # compilation for Linux armhf architecture system can be done from any Linux x86_64 system
+ hosts=[SystemPlatform('posix', 'x86_64')],
+ targets=[SystemPlatform('posix', 'arm_hf')],
+ info=[
+ parts.tools.GnuCommon.common.GnuInfo(
+ # default binary location for arm-linux-gnueabihf-gcc compiler
+ install_scanner=[PathFinder(['/usr/bin'])],
+ opt_dirs=['/opt/'],
+ script=None,
+ subst_vars={},
+ shell_vars={'PATH': '${GCC.INSTALL_ROOT}'},
+ test_file='arm-linux-gnueabihf-gcc')
+ ]
+)
+
+parts.tools.GnuCommon.common.gcc.Register(
+ # compilation for Linux arm 64bit can be done from any Linux x86_64 system
+ hosts=[SystemPlatform('posix', 'x86_64')],
+ targets=[SystemPlatform('posix', 'aarch64')],
+ info=[
+ parts.tools.GnuCommon.common.GnuInfo(
+ # default binary location for aarch64-linux-gnu-gcc compiler
+ install_scanner=[PathFinder(['/usr/bin'])],
+ opt_dirs=['/opt/'],
+ script=None,
+ subst_vars={},
+ shell_vars={'PATH': '${GCC.INSTALL_ROOT}'},
+ test_file='aarch64-linux-gnu-gcc')
+ ]
+)
diff --git a/tools/Makefile b/tools/Makefile
index 03c8c88..a668622 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -33,7 +33,6 @@ EXAMPLE_DIR = $(EPID_SDK_ROOT_DIR)/example
LIB_DROPT_DIR = $(EPID_SDK_ROOT_DIR)/ext/dropt/src
LIB_UTIL_DIR = $(EPID_SDK_ROOT_DIR)/example/util/src
LIB_IPPCP_DIR = $(EPID_SDK_ROOT_DIR)/ext/ipp/sources/ippcp/src
-LIB_IPPCPEPID_DIR = $(EPID_SDK_ROOT_DIR)/ext/ipp/sources/ippcpepid/src
LIB_MEMBER_DIR = $(EPID_SDK_ROOT_DIR)/epid/member
LIB_COMMON_DIR = $(EPID_SDK_ROOT_DIR)/epid/common
@@ -42,12 +41,11 @@ LDFLAGS += -L$(LIB_UTIL_DIR) \
-L$(LIB_DROPT_DIR) \
-L$(LIB_IPPCP_DIR) \
-L$(LIB_COMMON_DIR) \
- -L$(LIB_IPPCPEPID_DIR) \
- -lcommon -lippcpepid \
+ -lcommon \
-lippcp -lutil -ldropt
$(EXTRACTGRPS_EXE): $(EXTRACTGRPS_OBJ)
- $(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
+ $(CC) -o $@ $^ $(LDFLAGS)
$(EXTRACTGRPS_OBJ): %.o: %.c
$(CC) -o $@ $(CFLAGS) -I$(EPID_SDK_ROOT_DIR) \
@@ -56,7 +54,7 @@ $(EXTRACTGRPS_OBJ): %.o: %.c
-c $^
$(EXTRACTKEYS_EXE): $(EXTRACTKEYS_OBJ)
- $(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
+ $(CC) -o $@ $^ $(LDFLAGS)
$(EXTRACTKEYS_OBJ): %.o: %.c
$(CC) -o $@ $(CFLAGS) -I$(EPID_SDK_ROOT_DIR) \
@@ -65,7 +63,7 @@ $(EXTRACTKEYS_OBJ): %.o: %.c
-c $^
$(REVOKEGRP_EXE): $(REVOKEGRP_OBJ)
- $(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
+ $(CC) -o $@ $^ $(LDFLAGS)
$(REVOKEGRP_OBJ): %.o: %.c
$(CC) -o $@ $(CFLAGS) -I$(EPID_SDK_ROOT_DIR) \
@@ -74,7 +72,7 @@ $(REVOKEGRP_OBJ): %.o: %.c
-c $^
$(REVOKEKEY_EXE): $(REVOKEKEY_OBJ)
- $(CC) -o $@ $^ $(CFLAGS) -L$(LIB_MEMBER_DIR) -lmember $(LDFLAGS)
+ $(CC) -o $@ $^ -L$(LIB_MEMBER_DIR) -lmember $(LDFLAGS)
$(REVOKEKEY_OBJ): %.o: %.c
$(CC) -o $@ $(CFLAGS) -I$(EPID_SDK_ROOT_DIR) \
@@ -84,7 +82,7 @@ $(REVOKEKEY_OBJ): %.o: %.c
-c $^
$(REVOKESIG_EXE): $(REVOKESIG_OBJ)
- $(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
+ $(CC) -o $@ $^ $(LDFLAGS)
$(REVOKESIG_OBJ): %.o: %.c
$(CC) -o $@ $(CFLAGS) -I$(EPID_SDK_ROOT_DIR) \
diff --git a/tools/revokekey/src/main.c b/tools/revokekey/src/main.c
index 9ce068f..6df7abe 100644
--- a/tools/revokekey/src/main.c
+++ b/tools/revokekey/src/main.c
@@ -117,7 +117,7 @@ int OpenKey(char const* privkey_file, char const* gpubkey_file,
return retval;
}
-int MakeRequest(PrivKey priv_key, char const* req_file, bool verbose) {
+int MakeRequest(PrivKey const* priv_key, char const* req_file, bool verbose) {
// Request buffer
uint8_t* req_buf = NULL;
size_t req_size = 0;
@@ -144,11 +144,11 @@ int MakeRequest(PrivKey priv_key, char const* req_file, bool verbose) {
log_msg("Input settings:");
log_msg("");
log_msg(" [in] Group ID: ");
- PrintBuffer(&(priv_key.gid), sizeof(priv_key.gid));
+ PrintBuffer(&(priv_key->gid), sizeof(priv_key->gid));
log_msg("");
log_msg(" [in] Private Key Len: %d", sizeof(PrivKey));
log_msg(" [in] Private Key: ");
- PrintBuffer(&(priv_key), sizeof(PrivKey));
+ PrintBuffer(priv_key, sizeof(PrivKey));
log_msg("");
log_msg("==============================================");
}
@@ -189,7 +189,7 @@ int MakeRequest(PrivKey priv_key, char const* req_file, bool verbose) {
for (i = 0; i < req_file_size / entry_size; i++) {
if (0 == memcmp(req_buf + entry_size * i + sizeof(EpidFileHeader),
- &(priv_key), sizeof(PrivKey))) {
+ priv_key, sizeof(PrivKey))) {
duplicate = true;
break;
}
@@ -205,7 +205,7 @@ int MakeRequest(PrivKey priv_key, char const* req_file, bool verbose) {
req_top = (PrivRlRequestTop*)(req_buf + req_file_size);
req_top->header.epid_version = kEpidFileVersion;
req_top->header.file_type = kEpidFileTypeCode[kPrivRlRequestFile];
- req_top->privkey = priv_key;
+ req_top->privkey = *priv_key;
// Report Settings
if (verbose) {
@@ -347,7 +347,7 @@ int main(int argc, char* argv[]) {
if (EXIT_SUCCESS != retval) {
break;
}
- retval = MakeRequest(priv_key, req_file, verbose);
+ retval = MakeRequest(&priv_key, req_file, verbose);
} while (0);
dropt_free_context(dropt_ctx);