Showing preview only (5,040K chars total). Download the full file or copy to clipboard to get everything.
Repository: JHUISI/charm
Branch: dev
Commit: fdc3294d16fb
Files: 556
Total size: 4.7 MB
Directory structure:
gitextract_ibe0b64b/
├── .bandit
├── .github/
│ └── workflows/
│ ├── build.yml
│ └── ci.yml
├── .gitignore
├── .travis.yml
├── CHANGELOG
├── Dockerfile
├── Dockerfile.install-test
├── Dockerfile.install-test-arch
├── Dockerfile.install-test-fedora
├── Dockerfile.test
├── INSTALL
├── LICENSE.txt
├── MANIFEST.in
├── Makefile
├── README.md
├── VERSION
├── charm/
│ ├── __init__.py
│ ├── adapters/
│ │ ├── __init__.py
│ │ ├── abenc_adapt_hybrid.py
│ │ ├── dabenc_adapt_hybrid.py
│ │ ├── ibenc_adapt_hybrid.py
│ │ ├── ibenc_adapt_identityhash.py
│ │ ├── kpabenc_adapt_hybrid.py
│ │ ├── pkenc_adapt_bchk05.py
│ │ ├── pkenc_adapt_chk04.py
│ │ ├── pkenc_adapt_hybrid.py
│ │ └── pksig_adapt_naor01.py
│ ├── core/
│ │ ├── __init__.py
│ │ ├── benchmark/
│ │ │ ├── benchmark_util.c
│ │ │ ├── benchmark_util.h
│ │ │ ├── benchmarkmodule.c
│ │ │ └── benchmarkmodule.h
│ │ ├── crypto/
│ │ │ ├── AES/
│ │ │ │ └── AES.c
│ │ │ ├── COMPILED_EXTENSION_MODULES_HERE
│ │ │ ├── DES/
│ │ │ │ └── DES.c
│ │ │ ├── DES3/
│ │ │ │ └── DES3.c
│ │ │ ├── __init__.py
│ │ │ └── cryptobase/
│ │ │ ├── XOR.c
│ │ │ ├── _counter.c
│ │ │ ├── _counter.h
│ │ │ ├── block_template.c
│ │ │ ├── block_template.h
│ │ │ ├── cryptobasemodule.c
│ │ │ ├── libtom/
│ │ │ │ ├── tomcrypt.h
│ │ │ │ ├── tomcrypt_argchk.h
│ │ │ │ ├── tomcrypt_cfg.h
│ │ │ │ ├── tomcrypt_cipher.h
│ │ │ │ ├── tomcrypt_custom.h
│ │ │ │ ├── tomcrypt_des.c
│ │ │ │ ├── tomcrypt_hash.h
│ │ │ │ ├── tomcrypt_mac.h
│ │ │ │ ├── tomcrypt_macros.h
│ │ │ │ ├── tomcrypt_math.h
│ │ │ │ ├── tomcrypt_misc.h
│ │ │ │ ├── tomcrypt_pk.h
│ │ │ │ ├── tomcrypt_pkcs.h
│ │ │ │ └── tomcrypt_prng.h
│ │ │ ├── stream_template.c
│ │ │ └── strxor.c
│ │ ├── engine/
│ │ │ ├── __init__.py
│ │ │ ├── protocol.py
│ │ │ └── util.py
│ │ ├── math/
│ │ │ ├── COMPILED_EXTENSION_MODULES_HERE
│ │ │ ├── __init__.py
│ │ │ ├── elliptic_curve/
│ │ │ │ ├── ecmodule.c
│ │ │ │ └── ecmodule.h
│ │ │ ├── elliptic_curve.pyi
│ │ │ ├── integer/
│ │ │ │ ├── integermodule.c
│ │ │ │ └── integermodule.h
│ │ │ ├── integer.pyi
│ │ │ ├── pairing/
│ │ │ │ ├── miracl/
│ │ │ │ │ ├── bn_pair.patch
│ │ │ │ │ ├── compile_miracl.sh
│ │ │ │ │ ├── miracl_config.h
│ │ │ │ │ ├── miracl_interface.cc
│ │ │ │ │ ├── miracl_interface.h
│ │ │ │ │ ├── miracl_interface2.cc
│ │ │ │ │ ├── miracl_interface2.h
│ │ │ │ │ ├── mnt_pair.patch
│ │ │ │ │ ├── pairing1.patch
│ │ │ │ │ ├── pairingmodule2.c
│ │ │ │ │ ├── pairingmodule2.h
│ │ │ │ │ └── ssp_pair.patch
│ │ │ │ ├── pairingmodule.c
│ │ │ │ ├── pairingmodule.h
│ │ │ │ └── relic/
│ │ │ │ ├── buildRELIC.sh
│ │ │ │ ├── pairingmodule3.c
│ │ │ │ ├── pairingmodule3.h
│ │ │ │ ├── relic_interface.c
│ │ │ │ ├── relic_interface.h
│ │ │ │ └── test_relic.c
│ │ │ └── pairing.pyi
│ │ └── utilities/
│ │ ├── base64.c
│ │ └── base64.h
│ ├── schemes/
│ │ ├── __init__.py
│ │ ├── abenc/
│ │ │ ├── __init__.py
│ │ │ ├── abenc_accountability_jyjxgd20.py
│ │ │ ├── abenc_bsw07.py
│ │ │ ├── abenc_ca_cpabe_ar17.py
│ │ │ ├── abenc_dacmacs_yj14.py
│ │ │ ├── abenc_lsw08.py
│ │ │ ├── abenc_maabe_rw15.py
│ │ │ ├── abenc_maabe_yj14.py
│ │ │ ├── abenc_tbpre_lww14.py
│ │ │ ├── abenc_unmcpabe_yahk14.py
│ │ │ ├── abenc_waters09.py
│ │ │ ├── abenc_yct14.py
│ │ │ ├── abenc_yllc15.py
│ │ │ ├── ac17.py
│ │ │ ├── bsw07.py
│ │ │ ├── cgw15.py
│ │ │ ├── dabe_aw11.py
│ │ │ ├── dfa_fe12.py
│ │ │ ├── pk_hve08.py
│ │ │ └── waters11.py
│ │ ├── aggrsign_MuSig.py
│ │ ├── aggrsign_bls.py
│ │ ├── blindsig_ps16.py
│ │ ├── chamhash_adm05.py
│ │ ├── chamhash_rsa_hw09.py
│ │ ├── commit/
│ │ │ ├── __init__.py
│ │ │ ├── commit_gs08.py
│ │ │ └── commit_pedersen92.py
│ │ ├── encap_bchk05.py
│ │ ├── grpsig/
│ │ │ ├── __init__.py
│ │ │ ├── groupsig_bgls04.py
│ │ │ └── groupsig_bgls04_var.py
│ │ ├── hibenc/
│ │ │ ├── __init__.py
│ │ │ ├── hibenc_bb04.py
│ │ │ └── hibenc_lew11.py
│ │ ├── ibenc/
│ │ │ ├── __init__.py
│ │ │ ├── clpkc_rp03.py
│ │ │ ├── ibenc_CW13_z.py
│ │ │ ├── ibenc_bb03.py
│ │ │ ├── ibenc_bf01.py
│ │ │ ├── ibenc_ckrs09.py
│ │ │ ├── ibenc_cllww12_z.py
│ │ │ ├── ibenc_lsw08.py
│ │ │ ├── ibenc_sw05.py
│ │ │ ├── ibenc_waters05.py
│ │ │ ├── ibenc_waters05_z.py
│ │ │ ├── ibenc_waters09.py
│ │ │ └── ibenc_waters09_z.py
│ │ ├── joye_scheme.py
│ │ ├── lem_scheme.py
│ │ ├── pk_fre_ccv11.py
│ │ ├── pk_vrf.py
│ │ ├── pkenc/
│ │ │ ├── __init__.py
│ │ │ ├── pkenc_cs98.py
│ │ │ ├── pkenc_elgamal85.py
│ │ │ ├── pkenc_gm82.py
│ │ │ ├── pkenc_paillier99.py
│ │ │ ├── pkenc_rabin.py
│ │ │ └── pkenc_rsa.py
│ │ ├── pksig/
│ │ │ ├── __init__.py
│ │ │ ├── pksig_CW13_z.py
│ │ │ ├── pksig_bls04.py
│ │ │ ├── pksig_boyen.py
│ │ │ ├── pksig_chch.py
│ │ │ ├── pksig_chp.py
│ │ │ ├── pksig_cl03.py
│ │ │ ├── pksig_cl04.py
│ │ │ ├── pksig_cllww12_z.py
│ │ │ ├── pksig_cyh.py
│ │ │ ├── pksig_dsa.py
│ │ │ ├── pksig_ecdsa.py
│ │ │ ├── pksig_hess.py
│ │ │ ├── pksig_hw.py
│ │ │ ├── pksig_lamport.py
│ │ │ ├── pksig_ps01.py
│ │ │ ├── pksig_ps02.py
│ │ │ ├── pksig_ps03.py
│ │ │ ├── pksig_rsa_hw09.py
│ │ │ ├── pksig_schnorr91.py
│ │ │ ├── pksig_waters.py
│ │ │ ├── pksig_waters05.py
│ │ │ └── pksig_waters09.py
│ │ ├── pre_mg07.py
│ │ ├── prenc/
│ │ │ ├── pre_afgh06.py
│ │ │ ├── pre_bbs98.py
│ │ │ └── pre_nal16.py
│ │ ├── protocol_a01.py
│ │ ├── protocol_ao00.py
│ │ ├── protocol_cns07.py
│ │ ├── protocol_schnorr91.py
│ │ ├── sigma1.py
│ │ ├── sigma2.py
│ │ ├── sigma3.py
│ │ └── threshold/
│ │ ├── __init__.py
│ │ ├── cggmp21_dkg.py
│ │ ├── cggmp21_presign.py
│ │ ├── cggmp21_proofs.py
│ │ ├── cggmp21_sign.py
│ │ ├── dkls23_dkg.py
│ │ ├── dkls23_presign.py
│ │ ├── dkls23_sign.py
│ │ ├── gg18_dkg.py
│ │ ├── gg18_sign.py
│ │ └── xrpl_wallet.py
│ ├── test/
│ │ ├── __init__.py
│ │ ├── adapters/
│ │ │ ├── __init__.py
│ │ │ ├── abenc_adapt_hybrid_test.py
│ │ │ ├── dabenc_adapt_hybrid_test.py
│ │ │ ├── ibenc_adapt_hybrid_test.py
│ │ │ ├── ibenc_adapt_identityhash_test.py
│ │ │ └── kpabenc_adapt_hybrid_test.py
│ │ ├── benchmark/
│ │ │ ├── abenc_yllc15_bench.py
│ │ │ └── benchmark_test.py
│ │ ├── benchmark_threshold.py
│ │ ├── conftest.py
│ │ ├── fuzz/
│ │ │ ├── README.md
│ │ │ ├── __init__.py
│ │ │ ├── conftest.py
│ │ │ ├── fuzz_policy_parser.py
│ │ │ └── fuzz_serialization.py
│ │ ├── schemes/
│ │ │ ├── __init__.py
│ │ │ ├── abenc/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── abenc_bsw07_test.py
│ │ │ │ ├── abenc_dacmacs_yj14_test.py
│ │ │ │ ├── abenc_lsw08_test.py
│ │ │ │ ├── abenc_maabe_yj14_test.py
│ │ │ │ ├── abenc_tbpre_lww14_test.py
│ │ │ │ ├── abenc_waters09_test.py
│ │ │ │ └── abenc_yllc15_test.py
│ │ │ ├── chamhash_adm05_test.py
│ │ │ ├── chamhash_rsa_hw09_test.py
│ │ │ ├── commit/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── commit_gs08_test.py
│ │ │ │ └── commit_pedersen92_test.py
│ │ │ ├── dabe_aw11_test.py
│ │ │ ├── encap_bchk05_test.py
│ │ │ ├── grpsig/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── groupsig_bgls04_test.py
│ │ │ │ └── groupsig_bgls04_var_test.py
│ │ │ ├── hibenc/
│ │ │ │ ├── __init__.py
│ │ │ │ └── hibenc_bb04_test.py
│ │ │ ├── ibenc/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── ibenc_bb03_test.py
│ │ │ │ ├── ibenc_bf01_test.py
│ │ │ │ ├── ibenc_ckrs09_test.py
│ │ │ │ ├── ibenc_lsw08_test.py
│ │ │ │ ├── ibenc_sw05_test.py
│ │ │ │ ├── ibenc_waters05_test.py
│ │ │ │ └── ibenc_waters09_test.py
│ │ │ ├── pk_vrf_test.py
│ │ │ ├── pkenc/
│ │ │ │ └── __init__.py
│ │ │ ├── pkenc_test.py
│ │ │ ├── pksig/
│ │ │ │ └── __init__.py
│ │ │ ├── pksig_test.py
│ │ │ ├── rsa_alg_test.py
│ │ │ └── threshold_test.py
│ │ ├── serialize/
│ │ │ ├── __init__.py
│ │ │ └── serialize_test.py
│ │ ├── toolbox/
│ │ │ ├── __init__.py
│ │ │ ├── conversion_test.py
│ │ │ ├── ecgroup_test.py
│ │ │ ├── integer_arithmetic_test.py
│ │ │ ├── paddingschemes_test.py
│ │ │ ├── policy_parser_stress_test.py
│ │ │ ├── secretshare_test.py
│ │ │ ├── symcrypto_test.py
│ │ │ └── test_policy_expression.py
│ │ ├── vectors/
│ │ │ ├── __init__.py
│ │ │ ├── test_bls_vectors.py
│ │ │ ├── test_pedersen_vectors.py
│ │ │ └── test_schnorr_vectors.py
│ │ └── zkp_compiler/
│ │ ├── __init__.py
│ │ ├── benchmark_zkp.py
│ │ ├── test_and_proof.py
│ │ ├── test_batch_verify.py
│ │ ├── test_dleq_proof.py
│ │ ├── test_or_proof.py
│ │ ├── test_proof_serialization.py
│ │ ├── test_range_proof.py
│ │ ├── test_representation_proof.py
│ │ ├── test_schnorr_proof.py
│ │ ├── test_thread_safety.py
│ │ └── test_zkp_parser.py
│ ├── toolbox/
│ │ ├── ABEnc.py
│ │ ├── ABEncMultiAuth.py
│ │ ├── ABEnumeric.py
│ │ ├── Commit.py
│ │ ├── DFA.py
│ │ ├── FSA.py
│ │ ├── Hash.py
│ │ ├── IBEnc.py
│ │ ├── IBSig.py
│ │ ├── PKEnc.py
│ │ ├── PKSig.py
│ │ ├── PREnc.py
│ │ ├── ZKProof.py
│ │ ├── __init__.py
│ │ ├── bitstring.py
│ │ ├── broadcast.py
│ │ ├── conversion.py
│ │ ├── eccurve.py
│ │ ├── ecgroup.py
│ │ ├── enum.py
│ │ ├── hash_module.py
│ │ ├── integergroup.py
│ │ ├── iterate.py
│ │ ├── matrixops.py
│ │ ├── mpc_utils.py
│ │ ├── msp.py
│ │ ├── mta.py
│ │ ├── node.py
│ │ ├── ot/
│ │ │ ├── __init__.py
│ │ │ ├── base_ot.py
│ │ │ ├── dpf.py
│ │ │ ├── mpfss.py
│ │ │ ├── ot_extension.py
│ │ │ └── silent_ot.py
│ │ ├── paddingschemes.py
│ │ ├── paddingschemes_test.py
│ │ ├── paillier_mta.py
│ │ ├── paillier_zkproofs.py
│ │ ├── pairingcurves.py
│ │ ├── pairinggroup.py
│ │ ├── policy_expression_spec.py
│ │ ├── policytree.py
│ │ ├── reCompiler.py
│ │ ├── redundancyschemes.py
│ │ ├── schemebase.py
│ │ ├── secretshare.py
│ │ ├── secretutil.py
│ │ ├── securerandom.py
│ │ ├── sigmaprotocol.py
│ │ ├── specialprimes.py
│ │ ├── symcrypto.py
│ │ ├── threshold_sharing.py
│ │ ├── xmlserialize.py
│ │ └── zknode.py
│ └── zkp_compiler/
│ ├── __init__.py
│ ├── and_proof.py
│ ├── batch_verify.py
│ ├── dleq_proof.py
│ ├── or_proof.py
│ ├── range_proof.py
│ ├── representation_proof.py
│ ├── schnorr_proof.py
│ ├── thread_safe.py
│ ├── zk_demo.py
│ ├── zkp_factory.py
│ ├── zkp_generator.py
│ └── zkparser.py
├── config.dist.py
├── configure.sh
├── conftest.py
├── deps/
│ ├── Makefile
│ ├── pbc/
│ │ ├── Makefile
│ │ └── download_libpbc.sh
│ └── relic/
│ ├── .gitignore
│ ├── Makefile
│ ├── build_configs.py
│ ├── get_relic_source.sh
│ └── run_install_clean.sh
├── doc/
│ ├── Makefile
│ ├── autoschemes.py
│ ├── config.py
│ ├── source/
│ │ ├── adapters.rst
│ │ ├── charm/
│ │ │ ├── adapters/
│ │ │ │ ├── abenc_adapt_hybrid.rst
│ │ │ │ ├── dabenc_adapt_hybrid.rst
│ │ │ │ ├── ibenc_adapt_hybrid.rst
│ │ │ │ ├── ibenc_adapt_identityhash.rst
│ │ │ │ ├── kpabenc_adapt_hybrid.rst
│ │ │ │ ├── pkenc_adapt_bchk05.rst
│ │ │ │ ├── pkenc_adapt_chk04.rst
│ │ │ │ ├── pkenc_adapt_hybrid.rst
│ │ │ │ └── pksig_adapt_naor01.rst
│ │ │ └── schemes/
│ │ │ ├── abenc/
│ │ │ │ ├── abenc_accountability_jyjxgd20.rst
│ │ │ │ ├── abenc_bsw07.rst
│ │ │ │ ├── abenc_ca_cpabe_ar17.rst
│ │ │ │ ├── abenc_dacmacs_yj14.rst
│ │ │ │ ├── abenc_lsw08.rst
│ │ │ │ ├── abenc_maabe_rw15.rst
│ │ │ │ ├── abenc_maabe_yj14.rst
│ │ │ │ ├── abenc_tbpre_lww14.rst
│ │ │ │ ├── abenc_unmcpabe_yahk14.rst
│ │ │ │ ├── abenc_waters09.rst
│ │ │ │ ├── abenc_yct14.rst
│ │ │ │ ├── abenc_yllc15.rst
│ │ │ │ ├── ac17.rst
│ │ │ │ ├── bsw07.rst
│ │ │ │ ├── cgw15.rst
│ │ │ │ ├── dabe_aw11.rst
│ │ │ │ ├── dfa_fe12.rst
│ │ │ │ ├── pk_hve08.rst
│ │ │ │ └── waters11.rst
│ │ │ ├── aggrsign_MuSig.rst
│ │ │ ├── aggrsign_bls.rst
│ │ │ ├── blindsig_ps16.rst
│ │ │ ├── chamhash_adm05.rst
│ │ │ ├── chamhash_rsa_hw09.rst
│ │ │ ├── encap_bchk05.rst
│ │ │ ├── joye_scheme.rst
│ │ │ ├── lem_scheme.rst
│ │ │ ├── pk_vrf.rst
│ │ │ ├── pkenc/
│ │ │ │ ├── pkenc_cs98.rst
│ │ │ │ ├── pkenc_elgamal85.rst
│ │ │ │ ├── pkenc_gm82.rst
│ │ │ │ ├── pkenc_paillier99.rst
│ │ │ │ ├── pkenc_rabin.rst
│ │ │ │ └── pkenc_rsa.rst
│ │ │ ├── pksig/
│ │ │ │ ├── pksig_CW13_z.rst
│ │ │ │ ├── pksig_bls04.rst
│ │ │ │ ├── pksig_boyen.rst
│ │ │ │ ├── pksig_chch.rst
│ │ │ │ ├── pksig_chp.rst
│ │ │ │ ├── pksig_cl03.rst
│ │ │ │ ├── pksig_cl04.rst
│ │ │ │ ├── pksig_cllww12_z.rst
│ │ │ │ ├── pksig_cyh.rst
│ │ │ │ ├── pksig_dsa.rst
│ │ │ │ ├── pksig_ecdsa.rst
│ │ │ │ ├── pksig_hess.rst
│ │ │ │ ├── pksig_hw.rst
│ │ │ │ ├── pksig_lamport.rst
│ │ │ │ ├── pksig_ps01.rst
│ │ │ │ ├── pksig_ps02.rst
│ │ │ │ ├── pksig_ps03.rst
│ │ │ │ ├── pksig_rsa_hw09.rst
│ │ │ │ ├── pksig_schnorr91.rst
│ │ │ │ ├── pksig_waters.rst
│ │ │ │ ├── pksig_waters05.rst
│ │ │ │ └── pksig_waters09.rst
│ │ │ ├── pre_mg07.rst
│ │ │ ├── protocol_a01.rst
│ │ │ ├── protocol_ao00.rst
│ │ │ ├── protocol_cns07.rst
│ │ │ ├── protocol_schnorr91.rst
│ │ │ ├── sigma1.rst
│ │ │ ├── sigma2.rst
│ │ │ └── sigma3.rst
│ │ ├── conf.py
│ │ ├── cryptographers.rst
│ │ ├── developers.rst
│ │ ├── index.rst
│ │ ├── install_source.rst
│ │ ├── miracl.rst
│ │ ├── mobile.rst
│ │ ├── release_notes.rst
│ │ ├── relic.rst
│ │ ├── schemes.rst
│ │ ├── test/
│ │ │ ├── chamhash_adm05_test.rst
│ │ │ ├── chamhash_rsa_hw09_test.rst
│ │ │ ├── conversion_test.rst
│ │ │ ├── dabe_aw11_test.rst
│ │ │ ├── ecgroup_test.rst
│ │ │ ├── encap_bchk05_test.rst
│ │ │ ├── integer_arithmetic_test.rst
│ │ │ ├── paddingschemes_test.rst
│ │ │ ├── pk_vrf_test.rst
│ │ │ ├── pkenc_test.rst
│ │ │ ├── pksig_test.rst
│ │ │ ├── policy_parser_stress_test.rst
│ │ │ ├── rsa_alg_test.rst
│ │ │ ├── secretshare_test.rst
│ │ │ ├── symcrypto_test.rst
│ │ │ ├── test_policy_expression.rst
│ │ │ └── threshold_test.rst
│ │ ├── test_schemes.rst
│ │ ├── test_toolbox.rst
│ │ ├── test_vectors.rst
│ │ ├── threshold.rst
│ │ ├── toolbox/
│ │ │ ├── ABEnc.rst
│ │ │ ├── ABEncMultiAuth.rst
│ │ │ ├── ABEnumeric.rst
│ │ │ ├── Commit.rst
│ │ │ ├── DFA.rst
│ │ │ ├── FSA.rst
│ │ │ ├── Hash.rst
│ │ │ ├── IBEnc.rst
│ │ │ ├── IBSig.rst
│ │ │ ├── PKEnc.rst
│ │ │ ├── PKSig.rst
│ │ │ ├── PREnc.rst
│ │ │ ├── ZKProof.rst
│ │ │ ├── bitstring.rst
│ │ │ ├── broadcast.rst
│ │ │ ├── conversion.rst
│ │ │ ├── eccurve.rst
│ │ │ ├── ecgroup.rst
│ │ │ ├── enum.rst
│ │ │ ├── hash_module.rst
│ │ │ ├── integergroup.rst
│ │ │ ├── iterate.rst
│ │ │ ├── matrixops.rst
│ │ │ ├── mpc_utils.rst
│ │ │ ├── msp.rst
│ │ │ ├── mta.rst
│ │ │ ├── node.rst
│ │ │ ├── paddingschemes.rst
│ │ │ ├── paillier_mta.rst
│ │ │ ├── paillier_zkproofs.rst
│ │ │ ├── pairingcurves.rst
│ │ │ ├── pairinggroup.rst
│ │ │ ├── policy_expression_spec.rst
│ │ │ ├── policytree.rst
│ │ │ ├── reCompiler.rst
│ │ │ ├── redundancyschemes.rst
│ │ │ ├── schemebase.rst
│ │ │ ├── secretshare.rst
│ │ │ ├── secretutil.rst
│ │ │ ├── securerandom.rst
│ │ │ ├── sigmaprotocol.rst
│ │ │ ├── specialprimes.rst
│ │ │ ├── symcrypto.rst
│ │ │ ├── xmlserialize.rst
│ │ │ └── zknode.rst
│ │ ├── toolbox.rst
│ │ ├── tutorial.rst
│ │ ├── updates.rst
│ │ ├── updates_050.rst
│ │ ├── updates_060.rst
│ │ ├── updates_061.rst
│ │ ├── updates_062.rst
│ │ └── zkp_compiler.rst
│ └── zkp_proof_types_design.md
├── docker/
│ ├── README.md
│ ├── build.sh
│ ├── debug-test.sh
│ └── test.sh
├── docker-compose.test.yml
├── embed/
│ ├── Makefile
│ ├── README.md
│ ├── charm_embed_api.c
│ ├── charm_embed_api.h
│ ├── charm_embed_api.o
│ ├── test
│ ├── test.c
│ └── test.o
├── examples/
│ └── xrpl_memo_demo.py
├── install.sh
├── installers/
│ ├── deb.installer/
│ │ └── create_deb.py
│ ├── osx.installer/
│ │ ├── Charm Crypto.pkgproj
│ │ ├── build-charm-dmg.sh
│ │ ├── build-osx-installer.sh
│ │ └── packages-src/
│ │ ├── Introduction.rtf
│ │ ├── License.rtf
│ │ ├── README-OSX.rtf
│ │ ├── README.rtf
│ │ ├── RunAtStartup.sh
│ │ ├── charm-crypto-dmg-background-working.xcf
│ │ ├── charm-usr-folders-working.xcf
│ │ └── charm.pth
│ └── win.installer/
│ ├── EnvVarUpdate.nsh
│ ├── charm-exe-script.nsi
│ ├── charm.pth
│ ├── lgpl.txt
│ └── update-nsis-charm-version.py
├── pyproject.toml
├── pytest.ini
├── requirements.txt
├── setup.cfg
├── setup.py
└── tox.ini
================================================
FILE CONTENTS
================================================
================================================
FILE: .bandit
================================================
# Bandit configuration for Charm-Crypto library
# Targets production code, excludes test files
# Exclude test directories
exclude_dirs:
- charm/test
- tests
- doc
# Skip informational issues (B101 assert usage is fine in crypto libs)
skips:
- B101
================================================
FILE: .github/workflows/build.yml
================================================
name: Build and Test
on:
push:
branches: [main, dev, pip-package]
pull_request:
branches: [main, dev]
workflow_dispatch:
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Python 3.12+ re-enabled with per-test timeout to identify hanging tests
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
sudo apt-get update
# Install OpenSSL 3.x explicitly (libssl-dev on Ubuntu 22.04+ is OpenSSL 3.x)
sudo apt-get install -y libgmp-dev libssl-dev flex bison libfl-dev
# Verify OpenSSL version
openssl version
- name: Build and install PBC library
run: |
wget https://crypto.stanford.edu/pbc/files/pbc-1.0.0.tar.gz
tar -xzf pbc-1.0.0.tar.gz
cd pbc-1.0.0
./configure
make -j$(nproc)
sudo make install
sudo ldconfig
- name: Configure charm-crypto
run: ./configure.sh
- name: Build C extensions
run: |
pip install --upgrade pip setuptools wheel
python setup.py build_ext --inplace
- name: Install Python dependencies
run: pip install pyparsing pytest pytest-timeout hypothesis
- name: Run tests
timeout-minutes: 15
run: |
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
# Skip benchmark tests which have platform-specific issues
# Use --timeout to identify hanging tests (30s per test)
# Use --junit-xml to capture test results before potential segfault during cleanup
pytest -v charm/test/ --ignore=charm/test/benchmark/ --timeout=30 --timeout-method=thread --tb=long --junit-xml=test-results.xml || {
# Check if tests passed but segfault occurred during cleanup
if grep -q 'failures="0"' test-results.xml 2>/dev/null && grep -q 'errors="0"' test-results.xml 2>/dev/null; then
echo "Tests passed but segfault occurred during Python cleanup (known issue with C extensions)"
else
# Show the test results file for debugging
echo "=== Test Results XML ==="
cat test-results.xml || true
exit 1
fi
}
python -m unittest discover -p "*_test.py" charm/test/toolbox/
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-linux-${{ matrix.python-version }}
path: test-results.xml
build-macos:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
# Python 3.12+ re-enabled with per-test timeout to identify hanging tests
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
brew install gmp openssl@3 flex bison
- name: Build and install PBC library
run: |
wget https://crypto.stanford.edu/pbc/files/pbc-1.0.0.tar.gz
tar -xzf pbc-1.0.0.tar.gz
cd pbc-1.0.0
./configure LDFLAGS="-L$(brew --prefix gmp)/lib" CPPFLAGS="-I$(brew --prefix gmp)/include"
make -j$(sysctl -n hw.ncpu)
sudo make install
- name: Configure charm-crypto
run: |
export CPPFLAGS="-I$(brew --prefix gmp)/include -I$(brew --prefix openssl@3)/include"
export LDFLAGS="-L$(brew --prefix gmp)/lib -L$(brew --prefix openssl@3)/lib"
./configure.sh --enable-darwin
- name: Build C extensions
run: |
pip install --upgrade pip setuptools wheel
python setup.py build_ext --inplace
- name: Install Python dependencies
run: pip install pyparsing pytest pytest-timeout hypothesis
- name: Run tests
timeout-minutes: 15
run: |
# Skip benchmark tests which have platform-specific issues
# Use --timeout to identify hanging tests (30s per test)
# Use --junit-xml to capture test results before potential segfault during cleanup
pytest -v charm/test/ --ignore=charm/test/benchmark/ --timeout=30 --timeout-method=thread --tb=long --junit-xml=test-results.xml || {
# Check if tests passed but segfault occurred during cleanup
if grep -q 'failures="0"' test-results.xml 2>/dev/null && grep -q 'errors="0"' test-results.xml 2>/dev/null; then
echo "Tests passed but segfault occurred during Python cleanup (known issue with C extensions)"
else
# Show the test results file for debugging
echo "=== Test Results XML ==="
cat test-results.xml || true
exit 1
fi
}
python -m unittest discover -p "*_test.py" charm/test/toolbox/
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-macos-${{ matrix.python-version }}
path: test-results.xml
build-windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-gmp
mingw-w64-x86_64-openssl
make
flex
bison
wget
- name: Build PBC library
shell: msys2 {0}
run: |
wget https://crypto.stanford.edu/pbc/files/pbc-1.0.0.tar.gz
tar -xzf pbc-1.0.0.tar.gz
cd pbc-1.0.0
# Use --disable-static --enable-shared to avoid gmp.h conflict on Windows
# Add /usr/lib to LDFLAGS so configure can find libfl (flex library) from MSYS
# Add --disable-dependency-tracking to fix autotools issue on Windows
./configure --prefix=/mingw64 --disable-static --enable-shared --disable-dependency-tracking LDFLAGS="-L/usr/lib"
make -j$(nproc)
make install
- name: Install Python dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install pyparsing pytest hypothesis
- name: Build and test (limited)
run: |
# Windows build is experimental - run basic import tests
python -c "import charm; print('Charm package structure OK')"
continue-on-error: true
asan-test:
runs-on: ubuntu-latest
name: Memory Safety (ASan)
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install system dependencies
run: |
sudo apt-get update
# Install OpenSSL 3.x explicitly (libssl-dev on Ubuntu 22.04+ is OpenSSL 3.x)
sudo apt-get install -y flex bison libfl-dev libgmp-dev libssl-dev
# Verify OpenSSL version
openssl version
- name: Build and install PBC
run: |
wget https://crypto.stanford.edu/pbc/files/pbc-1.0.0.tar.gz
tar -xzf pbc-1.0.0.tar.gz
cd pbc-1.0.0
./configure LDFLAGS="-lgmp"
make
sudo make install
sudo ldconfig
- name: Install Python build dependencies
run: |
python -m pip install --upgrade pip
# Install setuptools before building (required for Python 3.12+)
pip install setuptools wheel
- name: Build Charm with ASan
env:
CFLAGS: "-fsanitize=address -fno-omit-frame-pointer -g"
LDFLAGS: "-fsanitize=address"
ASAN_OPTIONS: "detect_leaks=1:strict_string_checks=1:detect_stack_use_after_return=1"
run: |
./configure.sh
make
- name: Install Python test dependencies
run: |
pip install pytest pyparsing hypothesis
- name: Run tests under ASan
env:
LD_LIBRARY_PATH: /usr/local/lib:$LD_LIBRARY_PATH
ASAN_OPTIONS: "detect_leaks=1:strict_string_checks=1:detect_stack_use_after_return=1:halt_on_error=0"
run: |
pytest -x --tb=short 2>&1 | head -200
valgrind-test:
runs-on: ubuntu-latest
name: Memory Safety (Valgrind)
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install system dependencies
run: |
sudo apt-get update
# Install OpenSSL 3.x explicitly (libssl-dev on Ubuntu 22.04+ is OpenSSL 3.x)
sudo apt-get install -y flex bison libfl-dev libgmp-dev libssl-dev valgrind
# Verify OpenSSL version
openssl version
- name: Build and install PBC
run: |
wget https://crypto.stanford.edu/pbc/files/pbc-1.0.0.tar.gz
tar -xzf pbc-1.0.0.tar.gz
cd pbc-1.0.0
./configure LDFLAGS="-lgmp"
make
sudo make install
sudo ldconfig
- name: Install Python build dependencies
run: |
python -m pip install --upgrade pip
# Install setuptools before building (required for Python 3.12+)
pip install setuptools wheel
- name: Build Charm with debug symbols
env:
CFLAGS: "-g -O0"
run: |
./configure.sh
make
- name: Install Python test dependencies
run: |
pip install pytest pyparsing hypothesis
- name: Run tests under Valgrind
env:
LD_LIBRARY_PATH: /usr/local/lib:$LD_LIBRARY_PATH
run: |
valgrind --leak-check=full --show-leak-kinds=definite --error-exitcode=1 \
python -m pytest charm/test/schemes/pksig_test.py -v --tb=short 2>&1 | head -100
# Optional: Build wheels using cibuildwheel
build-wheels:
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
# Install OpenSSL 3.x explicitly (libssl-dev on Ubuntu 22.04+ is OpenSSL 3.x)
sudo apt-get install -y libgmp-dev libssl-dev flex bison libfl-dev
# Verify OpenSSL version
openssl version
wget https://crypto.stanford.edu/pbc/files/pbc-1.0.0.tar.gz
tar -xzf pbc-1.0.0.tar.gz
cd pbc-1.0.0 && ./configure && make -j$(nproc) && sudo make install && sudo ldconfig
- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install gmp openssl@3 flex bison
wget https://crypto.stanford.edu/pbc/files/pbc-1.0.0.tar.gz
tar -xzf pbc-1.0.0.tar.gz
cd pbc-1.0.0
./configure LDFLAGS="-L$(brew --prefix gmp)/lib" CPPFLAGS="-I$(brew --prefix gmp)/include"
make -j$(sysctl -n hw.ncpu) && sudo make install
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*
CIBW_SKIP: "*-musllinux_* *-win32 *-manylinux_i686"
CIBW_BEFORE_BUILD_LINUX: "./configure.sh"
CIBW_BEFORE_BUILD_MACOS: "export CPPFLAGS=\"-I$(brew --prefix gmp)/include -I$(brew --prefix openssl@3)/include\" && export LDFLAGS=\"-L$(brew --prefix gmp)/lib -L$(brew --prefix openssl@3)/lib\" && ./configure.sh --enable-darwin"
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
================================================
FILE: .github/workflows/ci.yml
================================================
name: CI
on:
push:
branches:
- dev
pull_request:
branches:
- dev
schedule:
# Run fuzzing weekly on Sundays at 2am UTC
- cron: '0 2 * * 0'
workflow_dispatch:
# Allow manual triggering for fuzzing
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Python 3.12+ re-enabled with per-test timeout to identify hanging tests
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update
# Install OpenSSL 3.x explicitly (libssl-dev on Ubuntu 22.04+ is OpenSSL 3.x)
sudo apt-get install -y flex bison libfl-dev libgmp-dev libssl-dev
# Verify OpenSSL version
openssl version
wget https://crypto.stanford.edu/pbc/files/pbc-1.0.0.tar.gz
tar -xzf pbc-1.0.0.tar.gz
cd pbc-1.0.0
./configure LDFLAGS="-lgmp"
make
sudo make install
sudo ldconfig
- name: Install Python build dependencies
run: |
python -m pip install --upgrade pip
# Install setuptools before building (required for Python 3.12+)
pip install setuptools wheel
- name: Build Charm
run: |
./configure.sh
make
- name: Install Python test dependencies
run: |
pip install pytest pytest-timeout pyparsing hypothesis
- name: Run tests
timeout-minutes: 15
run: |
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
# Use --timeout to identify hanging tests (30s per test)
pytest --timeout=30 --timeout-method=thread
security:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install bandit
run: pip install bandit
- name: Run bandit security scan
run: |
bandit -r charm/ -c .bandit -f json -o bandit-results.json || true
bandit -r charm/ -c .bandit -ll -ii
- name: Upload bandit results
uses: actions/upload-artifact@v4
if: always()
with:
name: bandit-security-report
path: bandit-results.json
fuzzing:
runs-on: ubuntu-latest
name: Fuzzing (Atheris)
# Optional job - only runs on schedule or manual trigger
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install system dependencies
run: |
sudo apt-get update
# Install OpenSSL 3.x explicitly (libssl-dev on Ubuntu 22.04+ is OpenSSL 3.x)
sudo apt-get install -y flex bison libfl-dev libgmp-dev libssl-dev
# Verify OpenSSL version
openssl version
- name: Build and install PBC
run: |
wget https://crypto.stanford.edu/pbc/files/pbc-1.0.0.tar.gz
tar -xzf pbc-1.0.0.tar.gz
cd pbc-1.0.0
./configure LDFLAGS="-lgmp"
make
sudo make install
sudo ldconfig
- name: Install Python build dependencies
run: |
python -m pip install --upgrade pip
# Install setuptools before building (required for Python 3.12+)
pip install setuptools wheel
- name: Build Charm
run: |
./configure.sh
make
- name: Install Python test dependencies
run: |
pip install pytest pyparsing hypothesis atheris
- name: Run policy parser fuzzer
env:
LD_LIBRARY_PATH: /usr/local/lib:$LD_LIBRARY_PATH
run: |
timeout 360 python charm/test/fuzz/fuzz_policy_parser.py -max_total_time=300 || true
echo "Policy parser fuzzing completed"
- name: Run serialization fuzzer
env:
LD_LIBRARY_PATH: /usr/local/lib:$LD_LIBRARY_PATH
run: |
timeout 360 python charm/test/fuzz/fuzz_serialization.py -max_total_time=300 || true
echo "Serialization fuzzing completed"
- name: Upload crash artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: fuzzing-crashes
path: |
crash-*
oom-*
timeout-*
if-no-files-found: ignore
================================================
FILE: .gitignore
================================================
config.log
config.mk
MANIFEST
Dockerfile.readme-test
log.txt
dist/
build/
doc/build/*
charm/config.py
.cache/
.eggs/
*.pyc
**.pyc
*.swp
**.swp
**.cproject
**.tar.*
**__pycache__
.project
.pydevproject
.DS_Store
*.py[cod]
# C extensions
*.so
**.so
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
nosetests.xml
**test-reports/
#Translations
*.mo
#Mr Developer
.mr.developer.cfg
# PyCharm
.idea
.hypothesis
# Dependencies (downloaded/built locally)
deps/pbc/pbc-*/
deps/relic/relic-toolkit-*/
# Project management
BACKLOG.md
# Local pip config
pip.conf
================================================
FILE: .travis.yml
================================================
language: python
python:
- "3.4"
- "3.6"
- "3.7"
#- "3.8"
before_install:
- sudo apt-get -qq update
# Make sure python development tools are installed
- sudo apt-get install -y python3-dev python3-setuptools
# Install GMP
- sudo apt-get install -y libgmp10 libgmp-dev
# Install PBC
#- wget http://voltar.org/pbcfiles/libpbc0_0.5.12_amd64.deb
#- wget http://voltar.org/pbcfiles/libpbc-dev_0.5.12_amd64.deb
#- sudo dpkg -i libpbc0_0.5.12_amd64.deb
#- sudo dpkg -i libpbc-dev_0.5.12_amd64.deb
# Install OpenSSL
- sudo apt-get install -y openssl
install:
- pip install -r requirements.txt
- ./configure.sh
- cd ./deps/pbc && make && sudo ldconfig && cd -
- make
- make install && sudo ldconfig
script:
- make test
================================================
FILE: CHANGELOG
================================================
v0.61.1 release (PyPI installation fix)
---------------------------------------
- Fixed PyPI installation failure (AttributeError: 'NoneType' object has no attribute 'split')
- Added platform-aware default configuration for PyPI installation when config.mk doesn't exist
- Added pkg-config support for dynamic library detection on Linux/macOS
- Merges pkg-config results with fallback paths to handle libraries without .pc files (e.g., PBC)
- Added read_version_file() to read version from VERSION file during PyPI installation
- Fixed opt.get() calls to use default empty strings for LDFLAGS/CPPFLAGS
- Improved cross-platform support:
- macOS: Detects Homebrew paths (Apple Silicon /opt/homebrew and Intel /usr/local)
- Linux: Uses standard paths (/usr/local/lib, /usr/lib, /usr/local/include, /usr/include)
v0.61 release (Python 3.13 and 3.14 support)
--------------------------------------------
- Full Python 3.13 compatibility with fixes for removed private APIs:
- Replaced _Py_IsFinalizing() with public Py_IsFinalizing() API
- Replaced _PyLong_Format() with PyObject_Str() for integer-to-string conversion
- Fixed PyUnicode_DATA() usage to use PyUnicode_AsUTF8() for null-terminated strings
- Added Python 3.14 support to CI/CD pipelines (Linux, macOS, Windows)
- Fixed Python 3.12+ integer conversion bug in integermodule.c:
- Updated macros to handle new PyLongObject internal structure (lv_tag)
- Fixed negative number handling in mpzToLongObj() using mpz_abs()
- Fixed hanging tests on Python 3.12+:
- RSAGroup.paramgen() with safety limits on Blum-Williams prime generation
- chamhash_rsa_hw09 with deterministic coprime search
- Rabin signature test skipped on Python 3.12+ due to randomPrime() issues
- Replaced deprecated OpenSSL functions:
- BN_generate_prime -> BN_generate_prime_ex
- Added comprehensive integer arithmetic test suite
- Added Docker-based testing environment for Python 3.12+ debugging
- Updated cibuildwheel configuration to build wheels for Python 3.13 and 3.14
v0.60 release (Python 3.8+ and OpenSSL 3.x compatibility)
---------------------------------------------------------
- Updated to require Python 3.8+ (dropped Python 2.x support)
- Full OpenSSL 3.x compatibility across all C extension modules
- Added PY_SSIZE_T_CLEAN macro to all C modules for Python 3.10+ compatibility
- Fixed PyLongObject internal structure changes for Python 3.12+
- Modernized CTR counter module (_counter.c) to use Python 3 Bytes API
- Updated MIRACL pairing module to use EVP API instead of deprecated OpenSSL functions
- Modern Python packaging with pyproject.toml (PEP 517/518)
- Added GitHub Actions CI/CD workflow for automated testing
- Added type stubs (.pyi files) for C extension modules
- Upgraded to PBC library 1.0.0
- Fixed segmentation faults in EC and pairing modules
- Added new cryptographic scheme implementations and documentation
- Removed deprecated platform.linux_distribution() usage
- Removed obsolete distribute_setup.py
- Updated configure.sh to detect Python 3.8-3.12
- Various bug fixes and improvements
v0.50 beta release (major release with many changes)
-------------------------------------------
- error handling updates to base modules
- CL03: length of e is now verified, verifyCommit() and header added
- SHA1(m_i) for doctest (verifyCommit) added
- added implementation of private aggregate of time series data by Marc Joye et al.
- added Abe's blind signature scheme [AO00, A01]
- updated to install file for windows and nsis script.
- fixed typo in protocol_a00.py and protocol_ao00.py
- added hibenc_lew11.py
- added Goldwasser-Micali pkenc scheme
- added Leontiadis-Elkhyiaoui-Molva scheme
- added four more ABE schemes
- re-added Time-based proxy re-encryption scheme implementation for py3
- added non-monotonic CP-ABE scheme by Yamada, Attrapadung, Hanaoka, Kunihiro
- update libtomcrypt headers to v1.17
- fix configure.sh: detect python better. thanks to Neal H. Walfield
- fix decrypt error when plaintext=0 for Paillier scheme. Closes #97
- added BBS98 proxy re-encryption scheme
- added omplementation of AFGH06 scheme
- interface for Proxy Re-Encryption schemes (charm.toolbox.PREnc)
- adapted BBS98 to PREnc interface
- added first NAL16 scheme
- added NAL16b (CCA_21 version of NAL16a)
- added scheme from Rouselakis and Waters (maabe_rw12.py)
- added hash support to wrapped pbc ecc elements (pairingmodule.c)
- added support for uncompressed curves elements (de)serialization.
- improved arguments management in (de)serialize methods of the c pairingmodule.
- improved error management in deserialize c pairingmodule
- improved error management in pairing product routine of pairinggroup.c
- improved error handling for initialize and initPP, new preproc attribute.
- changed hash function from sha1 to sha256 everywhere appropriate
- simplified encode/decode of messages in ECGroups. Squashed some bugs related to BN_bin2bn/BN_bn2bin
- updated configure.sh to support ARM (android, raspberry pi, include armv7l support)
- renamed sha1 to sha2 and update version to v0.5
- added py2.7 compatibility for pairing group serialize/deserialize
- added Dockerfile to document installation process
- fixed compilation errors with OpenSSL 1.1.0 caused by API change
- ciphertext-policy ABE schemes implemented under asymmetric pairing groups. Any policy represented as a monotone span program can be handled.
- added support for Mac OS X 10.11+
- added documentation
- scheme contributions, bug fixes and/or various improvements from @adelapie, @leontiad, @nikosft, @0xwille, @artjomb, @cygnusv, @lferr, @denniss17, @locksmithone, @leafac, @ElectroSuccess, @sagrawal87. Thanks to all!
v0.43 beta release (infrastructure changes)
-------------------------------------------
- simplified benchmarking interface -- breaks compatibility and see docs
- added new schemes (some external contributions from Nikos Fotiou, Fan Zhang, Hoeteck Wee)
- added pre-computation optimization for group exponentiation in pairing-based modules -- see docs
- fixed several memory leaks and segmentation faults
- switched from SHA1 to SHA2 for hashing operations
- improved serialization -- now using JSON instead of Pickle (security vulnerability)
- significant improvements to all base modules -- several fixes to integer and ecmodule functions
- more robust Android build for Charm
- significant fixes to 2.7 version of Charm
v0.42 beta release (infrastructure changes)
-------------------------------------------
- Several bug fixes to base modules (mem leaks, interface issues): pairing (PBC & Miracl), ecc, and integer
- Added new base module for RELIC and fixed bugs for MIRACL (Note: unified abstract interface for base modules coming in v0.43)
- Refactored charm package structure. This affects schemes, toolbox, adapters, etc.
- setup.py now creates Python egg
- Integrated pytest to replace unit testing framework
- Added doctests to all Charm schemes
- Updated documentation
v0.4 beta release
-----------------
- Several bug fixes to base modules: pairing (PBC & Miracl), ecc, and integer
- Major changes to base module API. Recommend using the group abstraction wrappers: PairingGroup, ECGroup, and IntegerGroup
- Removed pairing curve params in favor of a unified 'toolbox/pairingcurve.py' with curve identifiers (e.g., SS512, MNT224, etc)
- Deleted the 'params' dir (See previous bullet)
- Added high-level serialization API to simplify managing ciphertexts and keys in applications
- Added PKCS #7 padding to toolbox
- Added public key encryption schemes: 2 new IBE schemes (ibenc_ckrs09, ibenc_lsw08)
- Added signature schemes: CL04 (anony. creds)
- Added verifiable random function (VRF) scheme
- Updates to KPABE scheme with new adapter
- Improved protocol engine: automatically store data transmitted between parties and more flexibility in state transition map
- Updated CNS07 scheme
- Name updates to authenticated crypto abstraction
- Updated documentation for generating group parameters and using our serialization interface
================================================
FILE: Dockerfile
================================================
FROM ubuntu:18.04
MAINTAINER support@charm-crypto.com
RUN apt update && apt install --yes build-essential flex bison wget subversion m4 python3 python3-dev python3-setuptools libgmp-dev libssl-dev
RUN wget https://crypto.stanford.edu/pbc/files/pbc-1.0.0.tar.gz && tar xvf pbc-1.0.0.tar.gz && cd /pbc-1.0.0 && ./configure LDFLAGS="-lgmp" && make && make install && ldconfig
COPY . /charm
RUN cd /charm && ./configure.sh && make && make install && ldconfig
================================================
FILE: Dockerfile.install-test
================================================
# Dockerfile for testing the install.sh script
# Tests the minimal installation script on Ubuntu 22.04
#
# Usage:
# docker build -f Dockerfile.install-test -t charm-install-test .
# docker run --rm charm-install-test
FROM ubuntu:22.04
# Prevent interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
# Install only minimal prerequisites (curl, bash)
# The install.sh should handle everything else
RUN apt-get update && apt-get install -y \
curl \
bash \
&& rm -rf /var/lib/apt/lists/*
# Copy the installation script
COPY install.sh /tmp/install.sh
RUN chmod +x /tmp/install.sh
# Run the installation script with --no-sudo (running as root in container)
# Using --from-pypi (default mode)
RUN /tmp/install.sh --no-sudo
# Set library path
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
# Run verification tests
CMD ["python3", "-c", "from charm.toolbox.pairinggroup import PairingGroup; g = PairingGroup('SS512'); print('SUCCESS: PairingGroup works!')"]
================================================
FILE: Dockerfile.install-test-arch
================================================
# Dockerfile for testing Charm-Crypto install script on Arch Linux
#
# Usage:
# docker build --platform linux/amd64 -f Dockerfile.install-test-arch -t charm-install-test-arch .
# docker run --platform linux/amd64 --rm charm-install-test-arch
FROM --platform=linux/amd64 archlinux:latest
# Update package database and install only curl and bash
RUN pacman -Syu --noconfirm && pacman -S --noconfirm curl bash
# Copy the install script
COPY install.sh /tmp/install.sh
RUN chmod +x /tmp/install.sh
# Run the install script without sudo (we're root in the container)
RUN /tmp/install.sh --no-sudo
# Set up library path
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
# Verify the installation
CMD ["python3", "-c", "from charm.toolbox.pairinggroup import PairingGroup; g = PairingGroup('SS512'); print('SUCCESS: PairingGroup works!')"]
================================================
FILE: Dockerfile.install-test-fedora
================================================
# Dockerfile for testing Charm-Crypto install script on Fedora
#
# Usage:
# docker build -f Dockerfile.install-test-fedora -t charm-install-test-fedora .
# docker run --rm charm-install-test-fedora
FROM fedora:39
# Install only curl and bash - let the install script handle the rest
RUN dnf install -y curl bash && dnf clean all
# Copy the install script
COPY install.sh /tmp/install.sh
RUN chmod +x /tmp/install.sh
# Run the install script without sudo (we're root in the container)
RUN /tmp/install.sh --no-sudo
# Set up library path
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
# Verify the installation
CMD ["python3", "-c", "from charm.toolbox.pairinggroup import PairingGroup; g = PairingGroup('SS512'); print('SUCCESS: PairingGroup works!')"]
================================================
FILE: Dockerfile.test
================================================
# Dockerfile for testing Charm-Crypto with Python 3.12+
# This mirrors the GitHub Actions CI environment for local debugging
#
# Usage:
# docker build -f Dockerfile.test --build-arg PYTHON_VERSION=3.13 -t charm-test:3.13 .
# docker run -it --rm -v $(pwd):/workspace charm-test:3.13
ARG PYTHON_VERSION=3.13
FROM ubuntu:22.04
# Prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
# Install system dependencies (mirrors CI environment)
RUN apt-get update && apt-get install -y \
# Build tools
build-essential \
gcc \
g++ \
make \
flex \
bison \
libfl-dev \
wget \
git \
# Libraries
libgmp-dev \
libssl-dev \
# Python build dependencies
software-properties-common \
# Debugging tools
gdb \
strace \
valgrind \
vim \
less \
# Cleanup
&& rm -rf /var/lib/apt/lists/*
# Install Python from deadsnakes PPA (for 3.12+)
ARG PYTHON_VERSION
RUN add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && \
apt-get install -y \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-dev \
python${PYTHON_VERSION}-venv \
curl \
&& rm -rf /var/lib/apt/lists/*
# Set Python version as default and create python3-config symlink
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1 && \
update-alternatives --install /usr/bin/python python /usr/bin/python${PYTHON_VERSION} 1 && \
ln -sf /usr/bin/python${PYTHON_VERSION}-config /usr/bin/python3-config
# Install pip using get-pip.py (Python 3.12+ doesn't include distutils)
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3
# Upgrade pip
RUN python3 -m pip install --upgrade pip setuptools wheel
# Build and install PBC library (mirrors CI)
WORKDIR /tmp
RUN wget https://crypto.stanford.edu/pbc/files/pbc-1.0.0.tar.gz && \
tar -xzf pbc-1.0.0.tar.gz && \
cd pbc-1.0.0 && \
./configure LDFLAGS="-lgmp" && \
make && \
make install && \
ldconfig && \
cd .. && \
rm -rf pbc-1.0.0 pbc-1.0.0.tar.gz
# Verify OpenSSL version (should be 3.x on Ubuntu 22.04)
RUN openssl version
# Set working directory
WORKDIR /workspace
# Install Python dependencies (will be overridden by volume mount)
# This layer is cached for faster rebuilds
RUN pip install pytest pytest-timeout hypothesis pyparsing
# Set environment variables
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
ENV PYTHONPATH=/workspace:$PYTHONPATH
# Default command: run bash for interactive debugging
CMD ["/bin/bash"]
================================================
FILE: INSTALL
================================================
Charm-Crypto: Installation Documentation
-------------------------------------------------------------------------------------------
Charm has automated the installation process such that the end-user
does not have to directly handle dependencies, linking, compiler flag setting, and the
like. However, there is always the corner case in which an end-user is using a currently
unsupported platform, and thus may need to build and install using a very manual process.
We would like to support you in this case, and have written this documentation to get
you started on your path using Charm. This installation file will contain some
installation blocks highlighting each respective implementation.
Before we begin, please note the current dependencies:
- Python 3.8 or later (Python 2 is no longer supported)
- Pyparsing http://pyparsing.wikispaces.com/
- GMP 5.x http://gmplib.org/
- PBC 0.5.14 http://crypto.stanford.edu/pbc/news.html
- OPENSSL http://www.openssl.org/
See ./configure.sh --help for other options.
BUILDING IN LINUX
------------------------
Note that the entire compilation process is supported by the Charm configure/make scripts.
The steps for building in linux this way are:
1. In a terminal, run configure.sh
2. sudo make
3. sudo make install
[Ubuntu 20.04/22.04/24.04 LTS]
1. Before installing Charm, there are a few prerequisites that need to be installed on your system:
1. Git
sudo apt-get install git
2. Python 3 and header files
sudo apt-get install python3 python3-dev python3-pip
3. Build tools
sudo apt-get install build-essential m4 flex bison
4. Required libraries
sudo apt-get install libgmp-dev libssl-dev
2. Now we need to obtain a copy of Charm:
git clone https://github.com/JHUISI/charm.git
3. Next, we will install Charm. Navigate to the Charm directory.
1. We must first run the configuration script:
./configure.sh
2. Now we will build and install Charm:
make
sudo make install
3. And finally we must rebuild the searchpath for libraries
sudo ldconfig
[Fedora]
1. Before installing Charm, there are a few prerequisites that need to be installed on your system. These are:
1. m4
su -c "yum install m4"
2. Python 3
su -c "yum install python3"
3. Header files/static library
su -c "yum install python3-devel"
4. openssl-devel
su -c "yum install openssl-devel"
2. Red Hat/Fedora has decided not to support ECC in OpenSSL due to patent concerns, so we now need to remove their restriction, manually import the required files, and build new shared libraries.
1. Remove the ECC restriction
1. Navigate to /usr/include/openssl
cd /usr/include/openssl
2. Open the OpenSSL configuration file for editing using your editor of choice
su -c "vi opensslconf-i386.h"
3. Remove the flags that restrict the use of ECC
Delete (at the beginning of file)
#ifndef OPENSSL_NO_EC
# define OPENSSL_NO_EC
#endif
#ifndef OPENSSL_NO_ECDH
# define OPENSSL_NO_ECDH
#endif
#ifndef OPENSSL_NO_ECDSA
# define OPENSSL_NO_ECDSA
#endif
Delete (later on the file)
# if defined(OPENSSL_NO_EC) && !defined(NO_EC)
# define NO_EC
# endif
# if defined(OPENSSL_NO_ECDH) && !defined(NO_ECDH)
# define NO_ECDH
# endif
# if defined(OPENSSL_NO_ECDSA) && !defined(NO_ECDSA)
# define NO_ECDSA
# endif
4. Save the file and close it
2. Add the ECC files
1. Navigate to http://www.openssl.org/source/ and download the latest version of openssl source
2. Untar it
3. Navigate to /path/to/openssl-[version]/include/openssl (ie inside the untarred file)
cd /path/to/openssl-[version]/include/openssl
4. Add the new files to the current OpenSSL installation
su -c "yes n | cp * /usr/include/openssl"
3. Build the new shared libraries
1. Navigate to your downloaded version of OpenSSL
cd /path/to/openssl-[version]/
2. Configure OpenSSL to make the shared libraries
./config shared
3. Make the new OpenSSL library
make
4. Move the new shared libraries with their links
su -c "cp --no-dereference libcrypto.so /usr/local/lib/libcrypto.so.10"
su -c "cp libcrypto.so.1.0.0 /usr/local/lib"
su -c "cp --no-dereference libssl.so /usr/local/lib/libssl.so.10"
su -c "cp libssl.so.1.0.0 /usr/local/lib"
su -c "cp libcrypto.a /usr/local/lib"
su -c "cp libssl.a /usr/local/lib"
5. And now we need to set the library search path to look for the libraries we just added first.
cd /etc/ld.so.conf.d/
su -c "vi charm.conf"
put "/usr/local/lib" (without quotes) into the file, save, and close
su -c ldconfig
6. Set the library search path to look for the new libraries first (either type this into your terminal or put it in your .bashrc file and source it)
export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
3. Now we need to obtain a copy of Charm:
git clone -b master https://github.com/JHUISI/charm.git
4. Next, we will install Charm. Navigate to the Charm directory.
1. We must first run the configuration script:
su -c ./configure.sh
If the output of the configure script says that libgmp is already installed (and this is your first time installing Charm), chances are you have an outdated version of GMP. We need to check which version of libgmp you have installed.
su -c updatedb
locate libgmp
If you don't see libgmp.so.10 OR libgmp.so.10.0.2 in the resulting list, then you will need to build the GMP libraries from source.
1. Download the latest version of the GMP source from ftp://ftp.gnu.org/gnu/gmp/gmp-5.0.2.tar.gz
2. Untar it
3. Navigate to /path/to/gmpsource (ie inside the untarred file)
cd /path/to/gmpsource
4. Build and install the libraries
./configure
make
su -c "cp gmp.h /usr/local/include"
su -c "make install"
5. You now have two options (remove or keep the old libraries):
1. Remove the old libraries
cd /usr/lib
su -c "rm libgmp.*"
2. Keep the old libraries, rename the new one
1. Determine the version of the old library
su -c updatedb
locate libgmp
2. Look for /usr/lib/libgmp.so.X in the resulting list where X is a number (NOT /usr/lib/libgmp.X.Y.Z)
3. Rename the new link
cd /usr/local/lib
su -c "mv libgmp.so.10 libgmp.so.X"
6. Rebuild the searchpath for libraries
su -c ldconfig
2. Now we will build and install Charm:
su -c "make"
su -c "make install"
3. And finally we must rebuild the searchpath for libraries
su -c ldconfig
[Fedora x86_64]
[Mint x86_64]
1. Before installing Charm, there are a few prerequisites that need to be installed on your system. These are:
1. Git
sudo apt-get install git
2. m4
sudo apt-get install m4
3. Python 3
sudo apt-get install python3
4. Header files/static library
sudo apt-get install python3-dev
5. libssl-dev (only necessary if you did not install Python 3)
sudo apt-get install libssl-dev
6. This distro doesn't seem to come with binutils or gcc, install those.
2. Now we need to obtain a copy of Charm:
git clone git://github.com/JHUISI/charm.git
3. Next, we will install Charm. Navigate to the Charm directory.
1. We must first run the configuration script:
sudo bash ./configure.sh * Bash to avoid unexpected operator error.
2. Now we will build and install Charm:
sudo make
sudo make install
3. And finally we must rebuild the searchpath for libraries
sudo ldconfig
[Creating a .deb]
If you want to create a .deb binary from the charm source, there are a
couple more steps. The following was tested in Ubuntu 16.04 (x86_64).
1. Before installing Charm, there are a few prerequisites that need to be installed on your system. These are:
1. Git
sudo apt-get install git
2. m4
sudo apt-get install m4
3. Python 3
sudo apt-get install python3
4. Header files/static library
sudo apt-get install python3-dev
5. libssl-dev (only necessary if you did not install Python 3)
sudo apt-get install libssl-dev
6. Additional packages related to packaging for .deb
sudo apt-get install python3-all-dev debhelper python3-pip
7. The stdeb python package, installed via pip
pip3 install stdeb
8. Verify that *all* of the dependencies at the top of the
document are satisfied. Not doing this may result in strange
bugs while compiling the .deb from source.
2. Now we need to obtain a copy of Charm:
git clone git://github.com/JHUISI/charm.git
3. Next, we will install Charm. Navigate to the Charm directory.
1. We must first run the configuration script:
sudo bash ./configure.sh * Bash to avoid unexpected operator error.
2. Now we will build and install Charm:
sudo make
sudo make install
3. And finally we must rebuild the searchpath for libraries
sudo ldconfig
4. Finally, we will build the installer. Navigate to the installers/deb.installer directory, and at a shell prompt run
sudo python3 create_deb.py * use python instead of python3 to make a 2.7 binary
5. Install the created .deb file.
BUILDING IN WINDOWS
------------------------
Note that the entire compilation process is now supported by the Charm configure/make scripts.
The steps for building in mingw32 this way are:
1. Download the latest source version of openssl.
2. Run MinGW Shell.
3. Extract openssl, configure and install as shown below.
4. Extract Charm, and navigate to the top directory.
5. Run configure.sh as shown below.
6. The process will fail out at wget, and open Internet Explorer to the wget download
page.
7. Install wget, and set it's bin directory on your PATH. To do this, right-click My
Computer, Select Properties, Select Advanced System Settings, Select Advanced, Select
Environment Variables, and than PATH. Scroll to the end, and enter a ; followed by
the absolute path to the bin directory (e.g., C:\Program Files\etc).
8. With wget installed, run the configure.sh script again, and it should set up your
Make dependencies for you.
9. Make build.
10. Make install.
*. Another way to install dependencies is to follow the Windows blocks below.
[MinGW32 and Cygwin]
Let's first build our dependencies with the following scripts:
#GMP
./configure --prefix=/mingw --disable-static --enable-shared
make
make install
#OPENSSL
./config --openssldir=/mingw --shared # This gets us around installing perl.
make
make install
# ** NOTE ** openssl-1.0.0e ./test compilation problems.
# You will run into a compilation error that looks similar to:
# mdtest.c:1:10 error: expected ...
#
# To mitigate, do the following:
# grep "./test/dummytest.c" *
# edit each file from "dummytest.c" to "#include "dummytest.c"
#PBC
./configure --prefix=/mingw --disable-static --enable-shared
make
make install
#Building Charm
./configure --prefix=/mingw --python=/c/Python32/python.exe
# ** NOTE ** The latest mingw installer comes coupled with gcc-4.6.x
# which no longer supports the flag -mno-cygwin. This, unfortunately,
# is called during python setup.py build as it is a part of a class
# in distutils for python. A fix is coming for python to evaluate
# the gcc compiler version, and remove the flag -mno-cygwin if it
# 4.6+, but that has yet to be implemented.
[Building Executable]
If you are building to make an executable with NSIS, than be sure to
compile the dependencies first and pass the appropriate header and
library files to --python-build-ext (calls build_ext option for setup).
./configure.sh --python=/c/Python32/python.exe --python-build-ext="-L/path/to/lib -I/path/to/header"
Need help building the dependencies? Follow the below:
#GMP
./configure --prefix=/c/charm-crypto --disable-static --enable-shared
make
make install
#PBC
./configure --prefix=/c/charm-crypto --disable-static --enable-shared LDFLAGS="-L/c/charm-crypto/lib" CPPFLAGS="-I/c/charm-crypto/include"
make
make install
#OPENSSL
./config --openssldir=/c/charm-crypto --shared # This gets us around installing perl.
make
make install
BUILDING IN OS X
------------------------
Note that the entire compilation process is supported by the Charm configure/make scripts.
[macOS (Monterey, Ventura, Sonoma)]
1. Install Homebrew if not already installed:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2. Install dependencies via Homebrew:
brew install gmp openssl@3 flex bison wget
3. Build and install PBC library:
wget https://crypto.stanford.edu/pbc/files/pbc-1.0.0.tar.gz
tar -xzf pbc-1.0.0.tar.gz
cd pbc-1.0.0
./configure LDFLAGS="-L$(brew --prefix gmp)/lib" CPPFLAGS="-I$(brew --prefix gmp)/include"
make
sudo make install
4. Configure and build Charm:
./configure.sh --enable-darwin
make
sudo make install
================================================
FILE: LICENSE.txt
================================================
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
================================================
FILE: MANIFEST.in
================================================
include VERSION README.md INSTALL configure.sh Makefile CHANGELOG setup.cfg
include LICENSE.txt pyproject.toml config.dist.py pytest.ini
graft doc
graft doc/source
recursive-include charm *.h *.c *.py
prune build
prune deps/pbc
prune deps/relic
prune *.egg-info
global-exclude __pycache__
global-exclude *.py[cod]
global-exclude *.so
================================================
FILE: Makefile
================================================
CONFIG=config.mk
include ./${CONFIG}
export CONFIG_FILE=${CURDIR}/${CONFIG}
# user config options
setup1=$(shell mkdir -p /tmp/build-charm)
dest_build=/tmp/build-charm
help:
@echo "Build targets:"
@echo " make deps - Build dependency libs locally."
@echo " make source - Create source package."
@echo " make install - Install on local system."
@echo " make clean - Get rid of scratch and byte files."
@echo " make doc - Compile documentation"
@echo ""
@echo "Test targets:"
@echo " make test - Run all tests via pytest (same as test-all)"
@echo " make test-unit - Run unit tests only (toolbox, serialize, vectors)"
@echo " make test-schemes - Run cryptographic scheme tests only"
@echo " make test-toolbox - Run toolbox tests only"
@echo " make test-zkp - Run ZKP compiler tests only"
@echo " make test-adapters - Run adapter tests only"
@echo " make test-all - Run all test categories sequentially"
@echo " make test-embed - Build and run C/C++ embedding API tests"
@echo " make xmltest - Run tests and produce XML results"
.PHONY: setup
setup:
@echo "Setup build/staging directories"
set -x
${setup1}
set +x
.PHONY: all
all: setup
@echo "Building the Charm Framework"
${PYTHON} setup.py build ${PYTHONFLAGS} ${PYTHONBUILDEXT}
@echo "Complete"
.PHONY: deps
deps:
@echo "Building the dependency libs"
make -C deps
.PHONY: source
source:
$(PYTHON) setup.py sdist --formats=gztar,zip # --manifest-only
.PHONY: install
install:
$(PYTHON) setup.py install
.PHONY: uninstall
uninstall:
$(PYTHON) setup.py uninstall
.PHONY: test
test:
$(PYTHON) setup.py test
# Test category targets
.PHONY: test-unit
test-unit:
@echo "========================================"
@echo "Running Unit Tests (toolbox, serialize, vectors)"
@echo "========================================"
$(PYTHON) -m pytest charm/test/toolbox/ charm/test/serialize/ charm/test/vectors/ -v
@find . -name '*.pyc' -delete
@echo "Unit tests complete."
.PHONY: test-schemes
test-schemes:
@echo "========================================"
@echo "Running Scheme Tests"
@echo "========================================"
$(PYTHON) -m pytest charm/test/schemes/ -v
@find . -name '*.pyc' -delete
@echo "Scheme tests complete."
.PHONY: test-toolbox
test-toolbox:
@echo "========================================"
@echo "Running Toolbox Tests"
@echo "========================================"
$(PYTHON) -m pytest charm/test/toolbox/ -v
@find . -name '*.pyc' -delete
@echo "Toolbox tests complete."
.PHONY: test-zkp
test-zkp:
@echo "========================================"
@echo "Running ZKP Compiler Tests"
@echo "========================================"
$(PYTHON) -m pytest charm/test/zkp_compiler/ -v
@find . -name '*.pyc' -delete
@echo "ZKP compiler tests complete."
.PHONY: test-adapters
test-adapters:
@echo "========================================"
@echo "Running Adapter Tests"
@echo "========================================"
$(PYTHON) -m pytest charm/test/adapters/ -v
@find . -name '*.pyc' -delete
@echo "Adapter tests complete."
.PHONY: test-integration
test-integration:
@echo "========================================"
@echo "Running Integration Tests"
@echo "========================================"
@echo "Note: Integration tests run benchmark and cross-module tests"
$(PYTHON) -m pytest charm/test/benchmark/ -v --ignore=charm/test/fuzz/
@find . -name '*.pyc' -delete
@echo "Integration tests complete."
.PHONY: test-all
test-all:
@echo "========================================"
@echo "Running All Test Categories"
@echo "========================================"
@echo ""
@echo ">>> [1/6] Unit Tests (toolbox, serialize, vectors)"
$(PYTHON) -m pytest charm/test/toolbox/ charm/test/serialize/ charm/test/vectors/ -v
@echo ""
@echo ">>> [2/6] Scheme Tests"
$(PYTHON) -m pytest charm/test/schemes/ -v
@echo ""
@echo ">>> [3/6] ZKP Compiler Tests"
$(PYTHON) -m pytest charm/test/zkp_compiler/ -v
@echo ""
@echo ">>> [4/6] Adapter Tests"
$(PYTHON) -m pytest charm/test/adapters/ -v
@echo ""
@echo ">>> [5/6] Benchmark Tests"
$(PYTHON) -m pytest charm/test/benchmark/ -v
@echo ""
@echo ">>> [6/6] Doctest Tests"
$(PYTHON) -m pytest --doctest-modules charm/zkp_compiler/ --ignore=charm/zkp_compiler/zkp_generator.py --ignore=charm/zkp_compiler/zk_demo.py -v
@find . -name '*.pyc' -delete
@echo ""
@echo "========================================"
@echo "All test categories complete!"
@echo "========================================"
.PHONY: test-embed
test-embed:
@echo "========================================"
@echo "Running C/C++ Embed API Tests"
@echo "========================================"
@echo "Building embed test..."
@cd embed && $(MAKE) clean
@cd embed && $(MAKE)
@echo ""
@echo "Running embed test..."
ifeq ($(OS),Windows_NT)
@cd embed && PYTHONPATH=.. ./test.exe
else
@cd embed && PYTHONPATH=.. ./test
endif
@echo ""
@echo "Embed API tests complete."
# Legacy target alias
.PHONY: test-charm
test-charm: test-toolbox
.PHONY: xmltest
xmltest:
$(PYTHON) tests/all_tests_with_xml_test_result.py
find . -name '*.pyc' -delete
.PHONY: doc
doc:
if test "${BUILD_DOCS}" = "yes" ; then \
${MAKE} -C doc html; \
fi
# .PHONY: buildrpm
# buildrpm:
# $(PYTHON) setup.py bdist_rpm # --post-install=rpm/postinstall --pre-uninstall=rpm/preuninstall
.PHONY: builddeb
builddeb:
# build the source package in the parent directory
# then rename it to project_version.orig.tar.gz
$(PYTHON) setup.py sdist --dist-dir=../ --prune
#rename -f 's/$(PROJECT)-(.*)\.tar\.gz/$(PROJECT)_$$1\.orig\.tar\.gz/' ../*
# build the package
#dpkg-buildpackage -i -I -rfakeroot
.PHONY: clean
clean:
$(PYTHON) setup.py clean
# cd doc; $(MAKE) clean
# $(MAKE) -f $(CURDIR)/debian/rules clean
rm -rf build/ dist/ ${dest_build} MANIFEST
rm ${CONFIG}
find . -name '*.pyc' -delete
find . -name '*.so' -delete
find . -name '*.o' -delete
find . -name '*.dll' -delete
================================================
FILE: README.md
================================================
Charm-Crypto
============
| Branch | Status |
| ----------- | --------------------------------------------------------------------------------------------------------------- |
| `dev` |  |
Charm is a framework for rapidly prototyping advanced cryptosystems. Based on the Python language, it was designed from the ground up to minimize development time and code complexity while promoting the reuse of components.
Charm uses a hybrid design: performance-intensive mathematical operations are implemented in native C modules, while cryptosystems themselves are written in a readable, high-level language. Charm additionally provides a number of new components to facilitate the rapid development of new schemes and protocols.
## Features
### Advanced Cryptographic Schemes
* **Attribute-Based Encryption (ABE)**: Fine-grained access control encryption
- Ciphertext-Policy ABE (CP-ABE): BSW07, Waters09, FAME
- Key-Policy ABE (KP-ABE): LSW08, GPSW06
- Multi-Authority ABE, Decentralized ABE
* **Identity-Based Encryption (IBE)**: Encryption using identities as public keys
- Waters05, Boneh-Boyen (BB04), Boneh-Franklin
* **Pairing-Based Cryptography**: BN254, BLS12-381 curve support (~128-bit security)
- Bilinear pairings for advanced protocols
- Efficient implementation via PBC library
* **Digital Signatures**: Comprehensive signature scheme library
- Pairing-based: BLS (Ethereum 2.0), Waters, CL04, Boyen
- Elliptic curve: ECDSA, Schnorr, EdDSA
- Standard: RSA, DSA, Lamport
- Aggregate/Multi-signatures: BLS aggregation, MuSig
* **Public-Key Encryption**: Standard and advanced PKE schemes
- ElGamal, RSA, Paillier (homomorphic), Cramer-Shoup
* **Commitments & Secret Sharing**: Pedersen commitments, Feldman/Pedersen VSS
### Threshold Cryptography / MPC
* **Threshold ECDSA**: Production-ready t-of-n distributed signing
- GG18 (Gennaro-Goldfeder 2018) — Classic Paillier-based threshold ECDSA
- CGGMP21 (Canetti et al. 2021) — UC-secure with identifiable aborts
- DKLS23 (Doerner et al. 2023) — Non-interactive presigning with OT-based MtA
- Supports secp256k1 (Bitcoin, XRPL) and other curves
### Zero-Knowledge Proofs
* **ZKP Compiler**: Production-ready compiler for interactive and non-interactive proofs
- Schnorr proofs, Discrete Log Equality (DLEQ)
- Knowledge of Representation proofs
- AND/OR composition for complex statements
- Range proofs via bit decomposition
- Batch verification for improved performance
### Infrastructure & Tools
* **Mathematical Settings**: Integer rings/fields, bilinear and non-bilinear EC groups
* **Base Crypto Library**: Symmetric encryption (AES), hash functions, PRNGs
* **Protocol Engine**: Simplifies multi-party protocol implementation
* **C/C++ Embed API**: Native applications can embed Charm via the Python C API
* **Integrated Benchmarking**: Built-in performance measurement
## Requirements
| Component | Supported Versions |
|-----------|-------------------|
| **Python** | 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, 3.14 |
| **Operating Systems** | Linux, macOS, Windows |
| **OpenSSL** | 3.0+ |
## Installation
### One-Line Install (Recommended)
The easiest way to install Charm is using the automated install script, which handles all system dependencies:
```bash
curl -sSL https://raw.githubusercontent.com/JHUISI/charm/dev/install.sh | bash
```
**Supported platforms:**
- Ubuntu/Debian (and derivatives: Linux Mint, Pop!_OS)
- Fedora/RHEL/CentOS (and derivatives: Rocky, Alma, Oracle Linux)
- Arch Linux (and derivatives: Manjaro, EndeavourOS)
- macOS (Intel and Apple Silicon)
**Install options:**
```bash
# Default: install from PyPI (recommended)
curl -sSL ... | bash
# Install from source (for development)
curl -sSL ... | bash -s -- --from-source
# Only install system dependencies (for manual pip install)
curl -sSL ... | bash -s -- --deps-only
# See all options
./install.sh --help
```
### Quick Install (pip)
If you prefer to install dependencies manually:
```bash
pip install charm-crypto-framework
```
> **Note:** System libraries (GMP, PBC, OpenSSL) must be installed first. See [Prerequisites](#prerequisites) below.
### Prerequisites
Charm requires the following system libraries:
| Library | Version | Purpose |
|---------|---------|---------|
| [GMP](http://gmplib.org/) | 5.0+ | Arbitrary precision arithmetic |
| [PBC](http://crypto.stanford.edu/pbc/download.html) | 1.0.0 | Pairing-based cryptography |
| [OpenSSL](http://www.openssl.org/source/) | 3.0+ | Cryptographic primitives |
**Ubuntu/Debian:**
```bash
sudo apt-get install libgmp-dev libssl-dev libpbc-dev flex bison
```
**macOS (Homebrew):**
```bash
brew install gmp openssl@3 pbc
```
**PBC from Source** (if not available via package manager):
```bash
wget https://crypto.stanford.edu/pbc/files/pbc-1.0.0.tar.gz
tar xzf pbc-1.0.0.tar.gz
cd pbc-1.0.0
./configure && make && sudo make install
```
### From Source (Development)
```bash
git clone https://github.com/JHUISI/charm.git
cd charm
./configure.sh # add --enable-darwin on macOS
pip install -e ".[dev]"
```
### Verify Installation
```bash
python -c "from charm.toolbox.pairinggroup import PairingGroup; print('Charm installed successfully\!')"
```
## Testing
Charm includes comprehensive test suites:
```bash
# Run all tests
make test-all
# Run specific test categories
make test-unit # Unit tests (toolbox, serialize, vectors)
make test-schemes # Cryptographic scheme tests
make test-zkp # ZKP compiler tests
make test-adapters # Adapter tests
make test-embed # C/C++ embed API tests
# Threshold ECDSA tests (GG18, CGGMP21, DKLS23)
pytest charm/test/schemes/threshold_test.py -v -k "GG18 or CGGMP21 or DKLS23"
# Run with coverage
pytest --cov=charm charm/test/ -v
```
## Documentation
* [Installation Guide](https://jhuisi.github.io/charm/install_source.html)
* [Scheme Examples](https://jhuisi.github.io/charm/schemes.html)
* [API Reference](https://jhuisi.github.io/charm/)
* [C/C++ Embed API](embed/README.md)
## Quick Examples
### BLS Signatures (Pairing-Based)
BLS signatures (Boneh-Lynn-Shacham) — standardized in [IETF RFC 9380](https://datatracker.ietf.org/doc/rfc9380/) and used in Ethereum 2.0:
```python
from charm.toolbox.pairinggroup import PairingGroup
from charm.schemes.pksig.pksig_bls04 import BLS01
# Initialize pairing group (BN254 curve, ~128-bit security)
group = PairingGroup('BN254')
bls = BLS01(group)
# Ethereum 2.0 validator attestation
attestation = {'slot': 1234, 'epoch': 38, 'beacon_block_root': '0xabc...'}
(pk, sk) = bls.keygen()
signature = bls.sign(sk['x'], attestation)
assert bls.verify(pk, signature, attestation)
```
### ECDSA with secp256k1 (Bitcoin)
ECDSA on secp256k1 — the curve used by Bitcoin ([SEC 2](https://www.secg.org/sec2-v2.pdf), [BIP-340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki)):
```python
import hashlib
import json
from charm.toolbox.ecgroup import ECGroup
from charm.toolbox.eccurve import secp256k1
from charm.schemes.pksig.pksig_ecdsa import ECDSA
group = ECGroup(secp256k1)
ecdsa = ECDSA(group)
# Bitcoin transaction (simplified)
tx = {
'inputs': [{'txid': 'a1b2c3...', 'vout': 0, 'address': '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa'}],
'outputs': [{'address': '3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy', 'satoshis': 50000}],
'fee': 1000
}
# Serialize and double SHA-256 (SHA-256d) per Bitcoin protocol
tx_bytes = json.dumps(tx, sort_keys=True).encode('utf-8')
tx_hash = hashlib.sha256(hashlib.sha256(tx_bytes).digest()).hexdigest()
(pk, sk) = ecdsa.keygen(0)
signature = ecdsa.sign(pk, sk, tx_hash)
assert ecdsa.verify(pk, signature, tx_hash)
```
> **Note:** Production Bitcoin implementations should use proper transaction serialization
> per [Bitcoin Developer Documentation](https://developer.bitcoin.org/reference/transactions.html).
### ECDSA with secp256k1 (XRPL)
ECDSA on secp256k1 — also used by XRP Ledger ([SEC 2](https://www.secg.org/sec2-v2.pdf)):
```python
import hashlib
import json
from charm.toolbox.ecgroup import ECGroup
from charm.toolbox.eccurve import secp256k1
from charm.schemes.pksig.pksig_ecdsa import ECDSA
group = ECGroup(secp256k1)
ecdsa = ECDSA(group)
# XRPL Payment transaction
tx = {
'TransactionType': 'Payment',
'Account': 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh',
'Destination': 'rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe',
'Amount': '1000000', # drops of XRP
'Sequence': 1
}
# Serialize and hash (XRPL uses canonical binary + SHA-512Half)
tx_bytes = json.dumps(tx, sort_keys=True).encode('utf-8')
tx_hash = hashlib.sha512(tx_bytes).hexdigest()[:64] # SHA-512Half
(pk, sk) = ecdsa.keygen(0)
signature = ecdsa.sign(pk, sk, tx_hash)
assert ecdsa.verify(pk, signature, tx_hash)
```
> **Note:** Production XRPL implementations should use canonical binary serialization
> per [XRPL documentation](https://xrpl.org/serialization.html).
### Threshold ECDSA
Charm provides three production-ready threshold ECDSA implementations for MPC-based signing.
All support secp256k1 (Bitcoin, XRPL) and other elliptic curves.
**GG18 (2-of-3 threshold signing):**
```python
from charm.toolbox.ecgroup import ECGroup
from charm.toolbox.eccurve import secp256k1
from charm.schemes.threshold import GG18
group = ECGroup(secp256k1)
gg18 = GG18(group, threshold=2, num_parties=3)
# Distributed key generation
key_shares, public_key = gg18.keygen()
# Sign with 2 of 3 parties (interactive, 4 rounds)
message = b"Bitcoin transaction hash"
signature = gg18.sign(key_shares[:2], message)
assert gg18.verify(public_key, message, signature)
```
**CGGMP21 with presigning (UC-secure, identifiable aborts):**
```python
from charm.schemes.threshold import CGGMP21
cggmp = CGGMP21(group, threshold=2, num_parties=3)
key_shares, public_key = cggmp.keygen()
# Optional presigning (can be done offline)
presignatures = cggmp.presign(key_shares[:2])
# Fast online signing with presignature
message = b"XRPL payment"
signature = cggmp.sign(key_shares[:2], message, presignatures)
assert cggmp.verify(public_key, message, signature)
```
**DKLS23 with XRPL testnet:**
```python
from charm.schemes.threshold import DKLS23
from charm.schemes.threshold.xrpl_wallet import XRPLThresholdWallet, XRPLClient
dkls = DKLS23(group, threshold=2, num_parties=3)
key_shares, public_key = dkls.keygen()
wallet = XRPLThresholdWallet(group, public_key)
client = XRPLClient(is_testnet=True)
```
See `examples/xrpl_memo_demo.py` for a complete XRPL testnet flow.
**Comparison of Threshold ECDSA Schemes:**
| Feature | GG18 | CGGMP21 | DKLS23 |
|---------|------|---------|--------|
| **Security Model** | ROM | UC (composable) | ROM |
| **DKG Rounds** | 3 | 3 | 3 |
| **Signing Rounds** | 4 (interactive) | 3 presign + 1 sign | 3 presign + 1 sign |
| **Presigning** | ❌ No | ✅ Yes | ✅ Yes |
| **Identifiable Aborts** | ❌ No | ✅ Yes | ❌ No |
| **MtA Protocol** | Paillier | Paillier | OT-based |
| **Best For** | Simple deployments | High security needs | Low-latency signing |
**References:**
- GG18: [Gennaro & Goldfeder 2018](https://eprint.iacr.org/2019/114.pdf)
- CGGMP21: [Canetti et al. 2021](https://eprint.iacr.org/2021/060)
- DKLS23: [Doerner et al. 2023](https://eprint.iacr.org/2023/765)
## Schemes
Charm includes implementations of many cryptographic schemes:
| Category | Examples |
|----------|----------|
| **ABE** | CP-ABE (BSW07), KP-ABE, FAME |
| **IBE** | Waters05, BB04 |
| **Signatures** | BLS, Waters, CL04, ECDSA, Schnorr |
| **Threshold Signatures** | GG18, CGGMP21, DKLS23 (threshold ECDSA) |
| **Commitments** | Pedersen, Feldman VSS |
| **Group Signatures** | BBS+, PS16 |
See the [schemes directory](charm/schemes/) for all available implementations.
## Contributing
We welcome contributions\! Please note:
* All schemes must include doctests for inclusion in `make test`
* Follow the existing code style
* Add tests for new functionality
* Update documentation as needed
## Security
Charm uses the BN254 curve which provides approximately **128-bit security**. For production use:
* Keep dependencies updated
* Use the production-ready ZKP compiler (not the legacy `exec()`-based version)
* Review scheme implementations for your specific security requirements
## Support
* **Issues**: [GitHub Issues](https://github.com/JHUISI/charm/issues)
* **Email**: jakinye3@jhu.edu
## License
Charm is released under the **LGPL version 3** license. See [LICENSE.txt](LICENSE.txt) for details.
## Citation
If you use Charm in academic work, please cite:
```bibtex
@article{charm,
author = {Akinyele, Joseph A. and Garman, Christina and Miers, Ian and Pagano, Matthew W. and Rushanan, Michael and Green, Matthew and Rubin, Aviel D.},
title = {Charm: A Framework for Rapidly Prototyping Cryptosystems},
journal = {Journal of Cryptographic Engineering},
year = {2013}
}
```
================================================
FILE: VERSION
================================================
0.62
================================================
FILE: charm/__init__.py
================================================
# This fixes an issue where certain python interpeters/operating systems
# fail to properly load shared modules that c extensions depend on.
# In this case, the benchmark module is not handeled properly on osx
# as such we import it preimptively to force its symbols to be loaded.
import charm.core.benchmark
================================================
FILE: charm/adapters/__init__.py
================================================
================================================
FILE: charm/adapters/abenc_adapt_hybrid.py
================================================
'''
**Hybrid Encryption Adapter for CP-ABE (CP-ABE Hybrid)**
*Description:* Converts a Ciphertext-Policy Attribute-Based Encryption scheme into a hybrid
encryption scheme capable of encrypting arbitrary-length messages.
| **Notes:** Uses symmetric encryption (AES) with a randomly generated session key.
| The session key is encrypted using the underlying CP-ABE scheme.
.. rubric:: Adapter Properties
* **Type:** hybrid encryption adapter
* **Underlying Scheme:** any Ciphertext-Policy ABE scheme
* **Purpose:** enables CP-ABE schemes to encrypt arbitrary-length byte messages
.. rubric:: Implementation
:Authors: J. Ayo Akinyele
:Date: 2011
'''
from charm.toolbox.ABEnc import ABEnc
from charm.schemes.abenc.abenc_bsw07 import CPabe_BSW07
from charm.toolbox.pairinggroup import PairingGroup,GT
from charm.toolbox.symcrypto import AuthenticatedCryptoAbstraction
from charm.core.math.pairing import hashPair as sha2
from math import ceil
debug = False
class HybridABEnc(ABEnc):
"""
>>> group = PairingGroup("SS512")
>>> cpabe = CPabe_BSW07(group)
>>> hyb_abe = HybridABEnc(cpabe, group)
>>> access_policy = '((four or three) and (two or one))'
>>> msg = b"hello world this is an important message."
>>> (master_public_key, master_key) = hyb_abe.setup()
>>> secret_key = hyb_abe.keygen(master_public_key, master_key, ['ONE', 'TWO', 'THREE'])
>>> cipher_text = hyb_abe.encrypt(master_public_key, msg, access_policy)
>>> hyb_abe.decrypt(master_public_key, secret_key, cipher_text)
b'hello world this is an important message.'
"""
def __init__(self, scheme, groupObj):
ABEnc.__init__(self)
# check properties (TODO)
self.abenc = scheme
self.group = groupObj
def setup(self):
return self.abenc.setup()
def keygen(self, pk, mk, object):
return self.abenc.keygen(pk, mk, object)
def encrypt(self, pk, M, object):
key = self.group.random(GT)
c1 = self.abenc.encrypt(pk, key, object)
# instantiate a symmetric enc scheme from this key
cipher = AuthenticatedCryptoAbstraction(sha2(key))
c2 = cipher.encrypt(M)
return { 'c1':c1, 'c2':c2 }
def decrypt(self, pk, sk, ct):
c1, c2 = ct['c1'], ct['c2']
key = self.abenc.decrypt(pk, sk, c1)
if key is False:
raise Exception("failed to decrypt!")
cipher = AuthenticatedCryptoAbstraction(sha2(key))
return cipher.decrypt(c2)
def main():
groupObj = PairingGroup('SS512')
cpabe = CPabe_BSW07(groupObj)
hyb_abe = HybridABEnc(cpabe, groupObj)
access_policy = '((four or three) and (two or one))'
message = b"hello world this is an important message."
(pk, mk) = hyb_abe.setup()
if debug: print("pk => ", pk)
if debug: print("mk => ", mk)
sk = hyb_abe.keygen(pk, mk, ['ONE', 'TWO', 'THREE'])
if debug: print("sk => ", sk)
ct = hyb_abe.encrypt(pk, message, access_policy)
mdec = hyb_abe.decrypt(pk, sk, ct)
assert mdec == message, "Failed Decryption!!!"
if debug: print("Successful Decryption!!!")
if __name__ == "__main__":
debug = True
main()
================================================
FILE: charm/adapters/dabenc_adapt_hybrid.py
================================================
'''
**Hybrid Encryption Adapter for Multi-Authority ABE (MA-ABE Hybrid)**
*Description:* Converts a Decentralized/Multi-Authority Attribute-Based Encryption scheme
into a hybrid encryption scheme capable of encrypting arbitrary-length messages.
| **Notes:** Uses symmetric encryption (AES) with a randomly generated session key.
| The session key is encrypted using the underlying Multi-Authority ABE scheme.
.. rubric:: Adapter Properties
* **Type:** hybrid encryption adapter
* **Underlying Scheme:** any Decentralized/Multi-Authority ABE scheme
* **Purpose:** enables Multi-Authority ABE schemes to encrypt arbitrary-length byte messages
.. rubric:: Implementation
:Authors: J. Ayo Akinyele
:Date: 2011
'''
from charm.core.math.pairing import hashPair as sha2
from charm.schemes.abenc.dabe_aw11 import Dabe
from charm.toolbox.ABEncMultiAuth import ABEncMultiAuth
from charm.toolbox.pairinggroup import PairingGroup,GT
from charm.toolbox.symcrypto import AuthenticatedCryptoAbstraction
debug = False
class HybridABEncMA(ABEncMultiAuth):
"""
>>> from charm.toolbox.pairinggroup import PairingGroup,GT
>>> group = PairingGroup('SS512')
>>> dabe = Dabe(group)
Setup master authority.
>>> hyb_abema = HybridABEncMA(dabe, group)
>>> global_parameters = hyb_abema.setup()
Generate attributes for two different sub-authorities:
Johns Hopkins University, and Johns Hopkins Medical Institutions.
>>> jhu_attributes = ['jhu.professor', 'jhu.staff', 'jhu.student']
>>> jhmi_attributes = ['jhmi.doctor', 'jhmi.nurse', 'jhmi.staff', 'jhmi.researcher']
Johns Hopkins sub-authorities master key.
>>> (jhu_secret_key, jhu_public_key) = hyb_abema.authsetup(global_parameters, jhu_attributes)
JHMI sub-authorities master key
>>> (jhmi_secret_key, jhmi_public_key) = hyb_abema.authsetup(global_parameters, jhmi_attributes)
To encrypt messages we need all of the authorities' public keys.
>>> allAuth_public_key = {};
>>> allAuth_public_key.update(jhu_public_key);
>>> allAuth_public_key.update(jhmi_public_key)
An example user, Bob, who is both a professor at JHU and a researcher at JHMI.
>>> ID = "20110615 bob@gmail.com cryptokey"
>>> secrets_keys = {}
>>> hyb_abema.keygen(global_parameters, jhu_secret_key,'jhu.professor', ID, secrets_keys)
>>> hyb_abema.keygen(global_parameters, jhmi_secret_key,'jhmi.researcher', ID, secrets_keys)
Encrypt a message to anyone who is both a profesor at JHU and a researcher at JHMI.
>>> msg = b'Hello World, I am a sensitive record!'
>>> policy_str = "(jhmi.doctor or (jhmi.researcher and jhu.professor))"
>>> cipher_text = hyb_abema.encrypt(global_parameters, allAuth_public_key, msg, policy_str)
>>> hyb_abema.decrypt(global_parameters, secrets_keys, cipher_text)
b'Hello World, I am a sensitive record!'
"""
def __init__(self, scheme, groupObj):
global abencma, group
# check properties (TODO)
abencma = scheme
group = groupObj
def setup(self):
return abencma.setup()
def authsetup(self, gp, attributes):
return abencma.authsetup(gp, attributes)
def keygen(self, gp, sk, i, gid, pkey):
return abencma.keygen(gp, sk, i, gid, pkey)
def encrypt(self, gp, pk, M, policy_str):
if type(M) != bytes and type(policy_str) != str:
raise Exception("message and policy not right type!")
key = group.random(GT)
c1 = abencma.encrypt(gp, pk, key, policy_str)
# instantiate a symmetric enc scheme from this key
cipher = AuthenticatedCryptoAbstraction(sha2(key))
c2 = cipher.encrypt(M)
return { 'c1':c1, 'c2':c2 }
def decrypt(self, gp, sk, ct):
c1, c2 = ct['c1'], ct['c2']
key = abencma.decrypt(gp, sk, c1)
if key is False:
raise Exception("failed to decrypt!")
cipher = AuthenticatedCryptoAbstraction(sha2(key))
return cipher.decrypt(c2)
def main():
groupObj = PairingGroup('SS512')
dabe = Dabe(groupObj)
hyb_abema = HybridABEncMA(dabe, groupObj)
#Setup global parameters for all new authorities
gp = hyb_abema.setup()
#Instantiate a few authorities
#Attribute names must be globally unique. HybridABEncMA
#Two authorities may not issue keys for the same attribute.
#Otherwise, the decryption algorithm will not know which private key to use
jhu_attributes = ['jhu.professor', 'jhu.staff', 'jhu.student']
jhmi_attributes = ['jhmi.doctor', 'jhmi.nurse', 'jhmi.staff', 'jhmi.researcher']
(jhuSK, jhuPK) = hyb_abema.authsetup(gp, jhu_attributes)
(jhmiSK, jhmiPK) = hyb_abema.authsetup(gp, jhmi_attributes)
allAuthPK = {}; allAuthPK.update(jhuPK); allAuthPK.update(jhmiPK)
#Setup a user with a few keys
bobs_gid = "20110615 bob@gmail.com cryptokey"
K = {}
hyb_abema.keygen(gp, jhuSK,'jhu.professor', bobs_gid, K)
hyb_abema.keygen(gp, jhmiSK,'jhmi.researcher', bobs_gid, K)
msg = b'Hello World, I am a sensitive record!'
size = len(msg)
policy_str = "(jhmi.doctor OR (jhmi.researcher AND jhu.professor))"
ct = hyb_abema.encrypt(allAuthPK, gp, msg, policy_str)
if debug:
print("Ciphertext")
print("c1 =>", ct['c1'])
print("c2 =>", ct['c2'])
orig_msg = hyb_abema.decrypt(gp, K, ct)
if debug: print("Result =>", orig_msg)
assert orig_msg == msg, "Failed Decryption!!!"
if debug: print("Successful Decryption!!!")
if __name__ == "__main__":
debug = True
main()
================================================
FILE: charm/adapters/ibenc_adapt_hybrid.py
================================================
'''
**Hybrid Encryption Adapter for IBE (IBE Hybrid)**
*Description:* Converts an Identity-Based Encryption scheme into a hybrid encryption
scheme capable of encrypting arbitrary-length messages.
| **Notes:** Uses symmetric encryption (AES) with a randomly generated session key.
| The session key is encrypted using the underlying IBE scheme.
.. rubric:: Adapter Properties
* **Type:** hybrid encryption adapter
* **Underlying Scheme:** any Identity-Based Encryption scheme
* **Purpose:** enables IBE schemes to encrypt arbitrary-length byte messages
.. rubric:: Implementation
:Authors: J. Ayo Akinyele
:Date: 2011
'''
from charm.toolbox.symcrypto import AuthenticatedCryptoAbstraction
from charm.toolbox.pairinggroup import PairingGroup,ZR,G1,G2,GT,pair
from charm.core.math.pairing import hashPair as sha2
from charm.adapters.ibenc_adapt_identityhash import HashIDAdapter
from charm.toolbox.IBEnc import IBEnc
from charm.core.crypto.cryptobase import *
debug = False
class HybridIBEnc(IBEnc):
"""
>>> from charm.schemes.ibenc.ibenc_bb03 import IBE_BB04
>>> group = PairingGroup('SS512')
>>> ibe = IBE_BB04(group)
>>> hashID = HashIDAdapter(ibe, group)
>>> hyb_ibe = HybridIBEnc(hashID, group)
>>> (master_public_key, master_key) = hyb_ibe.setup()
>>> ID = 'john.doe@example.com'
>>> secret_key = hyb_ibe.extract(master_key, ID)
>>> msg = b"Hello World!"
>>> cipher_text = hyb_ibe.encrypt(master_public_key, ID, msg)
>>> decrypted_msg = hyb_ibe.decrypt(master_public_key, secret_key, cipher_text)
>>> decrypted_msg == msg
True
"""
def __init__(self, scheme, groupObj):
global ibenc, group
ibenc = scheme
group = groupObj
def setup(self):
return ibenc.setup()
def extract(self, mk, ID):
return ibenc.extract(mk, ID)
def encrypt(self, pk, ID, M):
if type(M) != bytes: raise "message not right type!"
key = group.random(GT)
c1 = ibenc.encrypt(pk, ID, key)
# instantiate a symmetric enc scheme from this key
cipher = AuthenticatedCryptoAbstraction(sha2(key))
c2 = cipher.encrypt(M)
return { 'c1':c1, 'c2':c2 }
def decrypt(self, pk, ID, ct):
c1, c2 = ct['c1'], ct['c2']
key = ibenc.decrypt(pk, ID, c1)
cipher = AuthenticatedCryptoAbstraction(sha2(key))
return cipher.decrypt(c2)
================================================
FILE: charm/adapters/ibenc_adapt_identityhash.py
================================================
'''
**Identity Hashing Adapter for IBE (HashID Adapter)**
*Description:* Converts an Identity-Based Encryption scheme that requires ZR (integer)
identities into one that accepts arbitrary string identities via cryptographic hashing.
| **Notes:** Hashes string identities to ZR elements using the pairing group's hash function.
| Transforms security from selective-ID (IND-sID-CPA) to full-ID (IND-ID-CPA) under ROM.
.. rubric:: Adapter Properties
* **Type:** identity transform adapter
* **Underlying Scheme:** any IBE scheme with ZR identity space
* **Purpose:** enables use of human-readable string identities (e.g., email addresses)
.. rubric:: Implementation
:Authors: J. Ayo Akinyele
:Date: 2011
'''
from charm.toolbox.pairinggroup import PairingGroup,ZR,G1,G2,GT,pair
from charm.toolbox.IBEnc import *
debug = False
class HashIDAdapter(IBEnc):
"""
>>> from charm.schemes.ibenc.ibenc_bb03 import IBE_BB04
>>> group = PairingGroup('SS512')
>>> ibe = IBE_BB04(group)
>>> hashID = HashIDAdapter(ibe, group)
>>> (master_public_key, master_key) = hashID.setup()
>>> ID = 'john.doe@example.com'
>>> secret_key = hashID.extract(master_key, ID)
>>> msg = group.random(GT)
>>> cipher_text = hashID.encrypt(master_public_key, ID, msg)
>>> decrypted_msg = hashID.decrypt(master_public_key, secret_key, cipher_text)
>>> msg == decrypted_msg
True
"""
def __init__(self, scheme, group):
global ibe
IBEnc.__init__(self)
self.group = group
ibe = None
# validate that we have the appropriate object
criteria = [('secDef', IND_sID_CPA), ('scheme', 'IBEnc'), ('secModel', SM), ('id',ZR)]
if IBEnc.checkProperty(self, scheme, criteria):
# change our property as well
IBEnc.updateProperty(self, scheme, secDef=IND_ID_CPA, id=str, secModel=ROM)
ibe = scheme
#IBEnc.printProperties(self)
else:
assert False, "Input scheme does not satisfy adapter properties: %s" % criteria
def setup(self):
assert ibe != None, "IBEnc alg not set"
return ibe.setup()
def extract(self, mk, ID):
assert ibe != None, "IBEnc alg not set"
if type(ID) in [str, bytes]:
ID2 = self.group.hash(ID)
sk = ibe.extract(mk, ID2); sk['IDstr'] = ID
return sk
else:
assert False, "invalid type on ID."
def encrypt(self, pk, ID, msg):
assert ibe != None, "IBEnc alg not set"
if type(ID) in [str, bytes]:
ID2 = self.group.hash(ID)
return ibe.encrypt(pk, ID2, msg)
else:
assert False, "invalid type on ID."
def decrypt(self, pk, sk, ct):
assert ibe != None, "IBEnc alg not set"
return ibe.decrypt(pk, sk, ct)
================================================
FILE: charm/adapters/kpabenc_adapt_hybrid.py
================================================
'''
**Hybrid Encryption Adapter for KP-ABE (KP-ABE Hybrid)**
*Description:* Converts a Key-Policy Attribute-Based Encryption scheme into a hybrid
encryption scheme capable of encrypting arbitrary-length messages.
| **Notes:** Uses symmetric encryption (AES) with a randomly generated session key.
| The session key is encrypted using the underlying KP-ABE scheme.
.. rubric:: Adapter Properties
* **Type:** hybrid encryption adapter
* **Underlying Scheme:** any Key-Policy ABE scheme
* **Purpose:** enables KP-ABE schemes to encrypt arbitrary-length byte messages
.. rubric:: Implementation
:Authors: J. Ayo Akinyele
:Date: 2011
'''
from charm.toolbox.pairinggroup import PairingGroup,GT,extract_key
from charm.toolbox.symcrypto import AuthenticatedCryptoAbstraction
from charm.toolbox.ABEnc import ABEnc
from charm.schemes.abenc.abenc_lsw08 import KPabe
debug = False
class HybridABEnc(ABEnc):
"""
>>> from charm.schemes.abenc.abenc_lsw08 import KPabe
>>> group = PairingGroup('SS512')
>>> kpabe = KPabe(group)
>>> hyb_abe = HybridABEnc(kpabe, group)
>>> access_policy = ['ONE', 'TWO', 'THREE']
>>> access_key = '((FOUR or THREE) and (TWO or ONE))'
>>> msg = b"hello world this is an important message."
>>> (master_public_key, master_key) = hyb_abe.setup()
>>> secret_key = hyb_abe.keygen(master_public_key, master_key, access_key)
>>> cipher_text = hyb_abe.encrypt(master_public_key, msg, access_policy)
>>> hyb_abe.decrypt(cipher_text, secret_key)
b'hello world this is an important message.'
"""
def __init__(self, scheme, groupObj):
ABEnc.__init__(self)
global abenc
# check properties (TODO)
abenc = scheme
self.group = groupObj
def setup(self):
return abenc.setup()
def keygen(self, pk, mk, object):
return abenc.keygen(pk, mk, object)
def encrypt(self, pk, M, object):
key = self.group.random(GT)
c1 = abenc.encrypt(pk, key, object)
# instantiate a symmetric enc scheme from this key
cipher = AuthenticatedCryptoAbstraction(extract_key(key))
c2 = cipher.encrypt(M)
return { 'c1':c1, 'c2':c2 }
def decrypt(self, ct, sk):
c1, c2 = ct['c1'], ct['c2']
key = abenc.decrypt(c1, sk)
cipher = AuthenticatedCryptoAbstraction(extract_key(key))
return cipher.decrypt(c2)
def main():
groupObj = PairingGroup('SS512')
kpabe = KPabe(groupObj)
hyb_abe = HybridABEnc(kpabe, groupObj)
access_key = '((ONE or TWO) and THREE)'
access_policy = ['ONE', 'TWO', 'THREE']
message = b"hello world this is an important message."
(pk, mk) = hyb_abe.setup()
if debug: print("pk => ", pk)
if debug: print("mk => ", mk)
sk = hyb_abe.keygen(pk, mk, access_key)
if debug: print("sk => ", sk)
ct = hyb_abe.encrypt(pk, message, access_policy)
mdec = hyb_abe.decrypt(ct, sk)
assert mdec == message, "Failed Decryption!!!"
if debug: print("Successful Decryption!!!")
if __name__ == "__main__":
debug = True
main()
================================================
FILE: charm/adapters/pkenc_adapt_bchk05.py
================================================
'''
**Boneh-Canetti-Halevi-Katz IBE-to-PKE Transform (BCHK05)**
*Description:* Transforms an Identity-Based Encryption scheme into a CCA-secure
Public Key Encryption scheme using the BCHK construction.
| **Based on:** Improved Efficiency for CCA-Secure Cryptosystems Built Using Identity-Based Encryption
| **Published in:** Topics in Cryptology, CT-RSA 2005
| **Available from:** https://eprint.iacr.org/2004/261.pdf
| **Notes:** Section 4 of the paper; more efficient than CHK04 transform
.. rubric:: Adapter Properties
* **Type:** IBE-to-PKE transform
* **Underlying Scheme:** any selective-ID secure IBE scheme
* **Purpose:** constructs CCA-secure public key encryption from IBE
.. rubric:: Implementation
:Authors: Christina Garman
:Date: 12/2011
'''
from charm.core.engine.util import pickleObject, serializeObject
import hmac, hashlib, math
from charm.schemes.ibenc.ibenc_bb03 import IBEnc, ZR, GT, sha2
debug = False
class BCHKIBEnc(IBEnc):
"""
>>> from charm.schemes.encap_bchk05 import EncapBCHK
>>> from charm.schemes.ibenc.ibenc_bb03 import PairingGroup, IBE_BB04
>>> group = PairingGroup('SS512')
>>> ibe = IBE_BB04(group)
>>> encap = EncapBCHK()
>>> hyb_ibe = BCHKIBEnc(ibe, group, encap)
>>> (public_key, secret_key) = hyb_ibe.keygen()
>>> msg = b"Hello World!"
>>> cipher_text = hyb_ibe.encrypt(public_key, msg)
>>> decrypted_msg = hyb_ibe.decrypt(public_key, secret_key, cipher_text)
>>> decrypted_msg == msg
True
"""
def str_XOR(self, m, k):
output = ""
for character in m:
for letter in k:
if(not type(character) == int):
character = ord(character)
if(not type(letter) == int):
letter = ord(letter)
character = chr(character ^ letter)
output += character
return output
def elmtToString(self, g, length):
hash_len = 20
b = math.ceil(length / hash_len)
gStr = b''
for i in range(1, b+1):
gStr += sha2(g, i)
return gStr[:length]
def __init__(self, scheme, groupObj, encscheme):
global ibenc, group, encap
ibenc = scheme
group = groupObj
encap = encscheme
def keygen(self):
(PK, msk) = ibenc.setup()
pub = encap.setup()
pk = { 'PK':PK, 'pub':pub }
sk = { 'msk': msk }
return (pk, sk)
def encrypt(self, pk, m):
(k, ID, x) = encap.S(pk['pub'])
if type(m) != bytes:
m = bytes(m, 'utf8')
if type(x) != bytes:
x = bytes(x, 'utf8')
ID2 = group.hash(ID, ZR)
m2 = m + b':' + x
kprime = group.random(GT)
kprimeStr = self.elmtToString(kprime, len(m2))
C1 = ibenc.encrypt(pk['PK'], ID2, kprime)
C2 = self.str_XOR(m2, kprimeStr)
C2 = C2.encode('utf8')
C1prime = pickleObject(serializeObject(C1, group))
tag = hmac.new(k, C1prime+C2, hashlib.sha256).digest()
cipher = { 'ID':ID, 'C1':C1, 'C2':C2, 'tag':tag }
return cipher
def decrypt(self, pk, sk, c):
ID2 = group.hash(c['ID'], ZR)
SK = ibenc.extract(sk['msk'], ID2)
kprime = ibenc.decrypt(pk, SK, c['C1'])
kprimeStr = self.elmtToString(kprime, len(c['C2']))
m2 = self.str_XOR(c['C2'], kprimeStr)
x = m2.split(':')[1]
k = encap.R(pk['pub'], c['ID'], x)
C1prime = pickleObject(serializeObject(c['C1'], group))
if hmac.compare_digest(c['tag'], hmac.new(k, C1prime+c['C2'], hashlib.sha256).digest()):
return bytes(m2.split(':')[0], 'utf8')
else:
return b'FALSE'
================================================
FILE: charm/adapters/pkenc_adapt_chk04.py
================================================
'''
**Canetti-Halevi-Katz IBE-to-PKE Transform (CHK04)**
*Description:* Transforms an Identity-Based Encryption scheme into a CCA-secure
Public Key Encryption scheme using generic composition of IBE + one-time signature.
| **Based on:** Chosen-Ciphertext Security from Identity-Based Encryption
| **Published in:** CRYPTO 2004
| **Available from:** https://eprint.iacr.org/2003/182
| **Notes:** Requires a selective-ID secure IBE scheme and an EU-CMA one-time signature scheme
.. rubric:: Adapter Properties
* **Type:** IBE-to-PKE transform
* **Underlying Scheme:** selective-ID secure IBE + EU-CMA one-time signature
* **Purpose:** constructs CCA-secure public key encryption from IBE and signatures
.. rubric:: Implementation
:Authors: J. Ayo Akinyele
:Date: 1/2011
'''
from charm.toolbox.PKEnc import *
from charm.toolbox.IBSig import *
from charm.toolbox.pairinggroup import PairingGroup,ZR,G1,G2,GT,pair
debug = False
class CHK04(PKEnc):
"""
>>> from charm.adapters.ibenc_adapt_identityhash import HashIDAdapter
>>> from charm.schemes.ibenc.ibenc_bb03 import IBE_BB04
>>> from charm.schemes.pksig.pksig_bls04 import BLS01
>>> group = PairingGroup('SS512')
>>> ibe = IBE_BB04(group)
>>> hash_ibe = HashIDAdapter(ibe, group)
>>> ots = BLS01(group)
>>> pkenc = CHK04(hash_ibe, ots, group)
>>> (public_key, secret_key) = pkenc.keygen(0)
>>> msg = group.random(GT)
>>> cipher_text = pkenc.encrypt(public_key, msg)
>>> decrypted_msg = pkenc.decrypt(public_key, secret_key, cipher_text)
>>> decrypted_msg == msg
True
"""
def __init__(self, ibe_scheme, ots_scheme, groupObj):
PKEnc.__init__(self)
global ibe, ots, group
criteria1 = [('secDef', 'IND_ID_CPA'), ('scheme', 'IBEnc'), ('id', str)]
criteria2 = [('secDef', 'EU_CMA'), ('scheme', 'IBSig')]
if PKEnc.checkProperty(self, ibe_scheme, criteria1): # and PKEnc.checkProperty(self, ots_scheme, criteria2):
PKEnc.updateProperty(self, ibe_scheme, secDef=IND_CCA, secModel=SM)
ibe = ibe_scheme
ots = ots_scheme
#PKEnc.printProperties(self)
else:
assert False, "Input scheme does not satisfy adapter properties: %s" % criteria
group = groupObj
def keygen(self, secparam):
# Run the IBE Setup routine to generate (mpk, msk)
(mpk, msk) = ibe.setup()
pk = { 'mpk' : mpk, 'secparam':secparam }
return (pk, msk)
def encrypt(self, pk, message):
# Generate a random keypair for the OTS
(svk, ssk) = ots.keygen(pk['secparam'])
# print("pub identity enc =>", _id)
# Encrypt message with the IBE scheme under 'identity' vk
C = ibe.encrypt(pk['mpk'],svk['identity'] , message)
# Sign the resulting ciphertext with sk
sigma = ots.sign(ssk['x'], C)
return { 'vk' : svk, 'C' : C, 'sigma' : sigma }
# NOTE: need to transform c['vk'] into a string to use as key
def decrypt(self, pk, sk, c):
# Given a ciphertext (vk, C, sigma), verify that sigma is a signature on C under public key vk
if not ots.verify(c['vk'], c['sigma'], c['C']):
return False
identity = c['vk']['identity']
# print("identity in dec =>", identity)
# Otherwise, extract an IBE key for identity 'vk' under the master secret params
dk = ibe.extract(sk, identity)
# Return the decryption of the ciphertext element "C" under key dk
return ibe.decrypt(pk, dk, c['C'])
================================================
FILE: charm/adapters/pkenc_adapt_hybrid.py
================================================
'''
**Hybrid Encryption Adapter for PKE (PKE Hybrid)**
*Description:* Converts a Public Key Encryption scheme into a hybrid encryption
scheme capable of encrypting arbitrary-length messages.
| **Notes:** Uses symmetric encryption (AES) with a randomly generated session key.
| The session key is encrypted using the underlying PKE scheme.
| Works with ElGamal and CS98 schemes.
.. rubric:: Adapter Properties
* **Type:** hybrid encryption adapter
* **Underlying Scheme:** any public key encryption scheme (e.g., ElGamal, CS98)
* **Purpose:** enables PKE schemes to encrypt arbitrary-length byte messages
.. rubric:: Implementation
:Authors: J. Ayo Akinyele
:Date: 2011
'''
# Works for ElGamal and CS98 schemes
from charm.toolbox.PKEnc import PKEnc
from charm.toolbox.securerandom import OpenSSLRand
from charm.toolbox.symcrypto import AuthenticatedCryptoAbstraction
from charm.toolbox.ecgroup import ECGroup
from charm.toolbox.eccurve import prime192v1
from charm.schemes.pkenc.pkenc_cs98 import CS98
from charm.core.crypto.cryptobase import AES
debug = False
# Adapter class for Hybrid Encryption Schemes
class HybridEnc(PKEnc):
"""
>>> groupObj = ECGroup(prime192v1)
>>> pkenc = CS98(groupObj)
>>> hyenc = HybridEnc(pkenc, msg_len=groupObj.bitsize())
>>> (public_key, secret_key) = hyenc.keygen()
>>> msg = b'this is a new message'
>>> cipher_text = hyenc.encrypt(public_key, msg)
>>> decrypted_msg = hyenc.decrypt(public_key, secret_key, cipher_text)
>>> decrypted_msg == msg
True
"""
def __init__(self, pkenc, msg_len=16, key_len=16, mode=AES):
PKEnc.__init__(self)
# check that pkenc satisfies properties of a pkenc scheme
if hasattr(pkenc, 'keygen') and hasattr(pkenc, 'encrypt') and hasattr(pkenc, 'decrypt'):
self.pkenc = pkenc
self.key_len = key_len # 128-bit session key by default
self.msg_len = msg_len
self.alg = mode
if debug: print("PKEnc satisfied.")
def keygen(self, secparam=None):
if secparam == None:
# ec module group
return self.pkenc.keygen()
# integer group
return self.pkenc.keygen(secparam)
def encrypt(self, pk, M):
# generate a short session key, K and encrypt using pkenc
key = OpenSSLRand().getRandomBytes(self.msg_len)
# encrypt session key using PKEnc
c1 = self.pkenc.encrypt(pk, key)
# use symmetric key encryption to enc actual message
c2 = AuthenticatedCryptoAbstraction(key).encrypt(M)
if debug: print("Ciphertext...")
if debug: print(c2)
return { 'c1':c1, 'c2':c2 }
def decrypt(self, pk, sk, ct):
c1, c2 = ct['c1'], ct['c2']
key = self.pkenc.decrypt(pk, sk, c1)[:self.key_len]
if debug: print("Rec key =>", key, ", len =", len(key))
msg = AuthenticatedCryptoAbstraction(key).decrypt(c2)
if debug: print("Rec msg =>", msg)
return msg
def main():
groupObj = ECGroup(prime192v1)
pkenc = CS98(groupObj)
hyenc = HybridEnc(pkenc)
(pk, sk) = hyenc.keygen()
m = b'this is a new message'
cipher = hyenc.encrypt(pk, m)
orig_m = hyenc.decrypt(pk, sk, cipher)
assert m == orig_m, "Failed Decryption"
if debug: print("Successful Decryption!!")
if __name__ == "__main__":
debug = True
main()
================================================
FILE: charm/adapters/pksig_adapt_naor01.py
================================================
'''
**Naor's IBE-to-Signature Transform (Naor01)**
*Description:* Transforms a fully-secure Identity-Based Encryption scheme into a
digital signature scheme using Naor's construction.
| **Based on:** Identity-Based Encryption from the Weil Pairing
| **Published in:** CRYPTO 2001
| **Available from:** https://eprint.iacr.org/2001/090.pdf
| **Notes:** First described by Boneh and Franklin, credited to Moni Naor.
| Uses IBE key extraction as signing; verification via encrypt-then-decrypt.
| **Warning:** Not secure for selectively-secure IBE schemes!
.. rubric:: Adapter Properties
* **Type:** IBE-to-signature transform
* **Underlying Scheme:** any fully-secure IBE scheme
* **Purpose:** constructs digital signatures from Identity-Based Encryption
.. rubric:: Implementation
:Authors: J. Ayo Akinyele
:Date: 05/2011
'''
from charm.toolbox.pairinggroup import PairingGroup,ZR,G1,G2,GT,pair
from charm.toolbox.IBEnc import *
from charm.toolbox.PKSig import *
debug = False
class Sig_Generic_ibetosig_Naor01(PKSig):
"""
>>> from charm.toolbox.pairinggroup import PairingGroup,ZR
>>> from charm.schemes.ibenc.ibenc_bb03 import IBE_BB04
>>> from charm.adapters.ibenc_adapt_identityhash import HashIDAdapter
>>> group = PairingGroup('MNT224')
>>> ibe = IBE_BB04(group)
>>> hashID = HashIDAdapter(ibe, group)
>>> ibsig = Sig_Generic_ibetosig_Naor01(hashID, group)
>>> (master_public_key, master_secret_key) = ibsig.keygen()
>>> msg = b"hello world!!!"
>>> signature = ibsig.sign(master_secret_key, msg)
>>> ibsig.verify(master_public_key, msg, signature)
True
"""
def __init__(self, ibe_scheme, groupObj):
PKSig.__init__(self)
global ibe, group
# validate that we have the appropriate object
criteria = [('secDef', IND_ID_CPA), ('scheme', 'IBEnc'), ('messageSpace', GT)]
if PKSig.checkProperty(self, ibe_scheme, criteria):
# change our property as well
PKSig.updateProperty(self, ibe_scheme, secDef=EU_CMA, id=str, secModel=ROM)
ibe = ibe_scheme
#PKSig.printProperties(self)
else:
assert False, "Input scheme does not satisfy adapter properties: %s" % criteria
group = groupObj
def keygen(self):
(mpk, msk) = ibe.setup()
if debug: print("Keygen...")
group.debug(mpk)
group.debug(msk)
return (mpk, msk)
def sign(self, sk, m):
assert type(m) in [str, bytes], "invalid message type!"
return ibe.extract(sk, m)
def verify(self, pk, m, sig):
# Some IBE scheme support a native method for validating IBE keys. Use this if it exists.
if hasattr(ibe, 'verify'):
result = ibe.verify(pk, m, sig)
if result == False: return False
assert m == sig['IDstr'], "message not thesame as ID in signature"
# Encrypt a random message in the IBE's message space and try to decrypt it
new_m = group.random(GT)
if debug: print("\nRandom message =>", new_m)
C = ibe.encrypt(pk, sig['IDstr'], new_m)
if (ibe.decrypt(pk, sig, C) == new_m):
return True
else:
return False
================================================
FILE: charm/core/__init__.py
================================================
================================================
FILE: charm/core/benchmark/benchmark_util.c
================================================
#if defined(__APPLE__)
// benchmark new
PyObject *Benchmark_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
Benchmark *self;
self = (Benchmark *)type->tp_alloc(type, 0);
if(self != NULL) {
self->bench_initialized = FALSE;
self->bench_inprogress = FALSE; // false until we StartBenchmark( ... )
self->op_add = self->op_sub = self->op_mult = 0;
self->op_div = self->op_exp = self->op_pair = 0;
self->cpu_time_ms = self->real_time_ms = 0.0;
self->cpu_option = self->real_option = FALSE;
debug("Creating new benchmark object.\n");
}
return (PyObject *) self;
}
// benchmark init
int Benchmark_init(Benchmark *self, PyObject *args, PyObject *kwds)
{
return 0;
}
// benchmark dealloc
void Benchmark_dealloc(Benchmark *self) {
debug("Releasing benchmark object.\n");
Py_TYPE(self)->tp_free((PyObject*)self);
}
PyTypeObject BenchmarkType = {
PyVarObject_HEAD_INIT(NULL, 0)
"profile.Benchmark", /*tp_name*/
sizeof(Benchmark), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)Benchmark_dealloc, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_reserved*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash */
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
"Benchmark objects", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)Benchmark_init, /* tp_init */
0, /* tp_alloc */
Benchmark_new, /* tp_new */
};
#endif
void Operations_dealloc(Operations *self)
{
debug("Releasing operations object.\n");
Py_TYPE(self)->tp_free((PyObject *) self);
}
PyObject *Operations_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
Operations *self = (Operations *) type->tp_alloc(type, 0);
if(self != NULL) {
/* initialize */
self->op_init = FALSE;
}
return (PyObject *) self;
}
int Operations_init(Operations *self, PyObject *args, PyObject *kwds)
{
self->op_init = TRUE;
return 0;
}
/* for python 3.x */
PyTypeObject OperationsType = {
PyVarObject_HEAD_INIT(NULL, 0)
"profile.Operations", /*tp_name*/
sizeof(Operations), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)Operations_dealloc, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_reserved*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash */
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
"Granular benchmark objects", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)Operations_init, /* tp_init */
0, /* tp_alloc */
Operations_new, /* tp_new */
};
PyObject *InitBenchmark(PyObject *self, PyObject *args) {
Benchmark *benchObj = NULL;
GROUP_OBJECT *group = NULL;
if(!PyArg_ParseTuple(args, "O", &group)) {
PyErr_SetString(BENCH_ERROR, "InitBenchmark - invalid argument.");
return NULL;
}
VERIFY_GROUP(group);
if(group->dBench == NULL) {
benchObj = PyObject_New(Benchmark, &BenchmarkType);
if (benchObj == NULL) {
PyErr_SetString(BENCH_ERROR, "out of memory.");
return NULL;
}
/* setup granular options */
if(group->gBench == NULL) {
group->gBench = PyObject_New(Operations, &OperationsType);
CLEAR_ALLDBENCH(group->gBench);
}
benchObj->num_options = 0;
benchObj->op_add = benchObj->op_sub = benchObj->op_mult = 0;
benchObj->op_div = benchObj->op_exp = benchObj->op_pair = 0;
benchObj->cpu_time_ms = 0.0;
benchObj->real_time_ms = 0.0;
benchObj->bench_initialized = TRUE;
benchObj->bench_inprogress = FALSE;
benchObj->identifier = BenchmarkIdentifier;
debug("%s: bench id set: '%i'\n", __FUNCTION__, benchObj->identifier);
debug("Initialized benchmark object.\n");
// set benchmark field in group object
group->dBench = benchObj;
RAND_pseudo_bytes(group->bench_id, ID_LEN);
Py_RETURN_TRUE;
}
else if(group->dBench->bench_inprogress == FALSE && group->dBench->bench_initialized == TRUE) {
// if we have initialized the benchmark object and ended a benchmark execution:
// action: reset the fields
debug("Reset benchmark state.\n");
if(group->gBench != NULL) {
CLEAR_ALLDBENCH(group->gBench);
}
PyClearBenchmark(group->dBench);
group->dBench->bench_initialized = TRUE;
group->dBench->bench_inprogress = FALSE;
group->dBench->identifier = BenchmarkIdentifier;
Py_RETURN_TRUE;
}
else if(group->dBench->bench_inprogress == TRUE) {
debug("Benchmark in progress.\n");
}
debug("Benchmark already initialized.\n");
Py_RETURN_FALSE;
}
PyObject *StartBenchmark(PyObject *self, PyObject *args)
{
PyObject *list = NULL;
GROUP_OBJECT *group = NULL;
if(!PyArg_ParseTuple(args, "OO", &group, &list)) {
PyErr_SetString(BENCH_ERROR, "StartBenchmark - invalid argument.");
return NULL;
}
VERIFY_GROUP(group);
if(group->dBench == NULL) {
PyErr_SetString(BENCH_ERROR, "uninitialized benchmark object.");
return NULL;
}
else if(PyList_Check(list) && group->dBench->bench_initialized == TRUE && group->dBench->bench_inprogress == FALSE
&& group->dBench->identifier == BenchmarkIdentifier)
{
debug("%s: bench id: '%i'\n", __FUNCTION__, group->dBench->identifier);
size_t size = PyList_Size(list);
PyStartBenchmark(group->dBench, list, size);
debug("list size => %zd\n", size);
debug("benchmark enabled and initialized!\n");
Py_RETURN_TRUE;
}
Py_RETURN_FALSE;
}
PyObject *EndBenchmark(PyObject *self, PyObject *args)
{
GROUP_OBJECT *group = NULL;
if(!PyArg_ParseTuple(args, "O", &group)) {
PyErr_SetString(BENCH_ERROR, "EndBenchmark - invalid argument.");
return NULL;
}
VERIFY_GROUP(group);
if(group->dBench == NULL) {
PyErr_SetString(BENCH_ERROR, "uninitialized benchmark object.");
return NULL;
}
else if(group->dBench->bench_initialized == TRUE && group->dBench->bench_inprogress == TRUE && group->dBench->identifier == BenchmarkIdentifier) {
PyEndBenchmark(group->dBench);
debug("%s: bench id: '%i'\n", __FUNCTION__, group->dBench->identifier);
Py_RETURN_TRUE;
}
Py_RETURN_FALSE;
}
PyObject *GetAllBenchmarks(PyObject *self, PyObject *args)
{
GROUP_OBJECT *group = NULL;
if(!PyArg_ParseTuple(args, "O", &group)) {
PyErr_SetString(BENCH_ERROR, "GetGeneralBenchmarks - invalid argument.");
return NULL;
}
VERIFY_GROUP(group);
if(group->dBench == NULL) {
PyErr_SetString(BENCH_ERROR, "uninitialized benchmark object.");
return NULL;
}
else if(group->dBench->bench_inprogress == FALSE && group->dBench->identifier == BenchmarkIdentifier) {
debug("%s: bench id: '%i'\n", __FUNCTION__, group->dBench->identifier);
// return GetResultsWithPair(group->dBench);
return GET_RESULTS_FUNC(group->dBench);
}
else if(group->dBench->bench_inprogress == TRUE) {
printf("Benchmark in progress.\n");
}
else {
debug("Invalid benchmark identifier.\n");
}
Py_RETURN_FALSE;
}
PyObject *GetBenchmark(PyObject *self, PyObject *args) {
char *opt = NULL;
GROUP_OBJECT *group = NULL;
if(!PyArg_ParseTuple(args, "Os", &group, &opt))
{
PyErr_SetString(BENCH_ERROR, "GetBenchmark - invalid argument.");
return NULL;
}
VERIFY_GROUP(group);
if(group->dBench == NULL) {
PyErr_SetString(BENCH_ERROR, "uninitialized benchmark object.");
return NULL;
}
else if(group->dBench->bench_inprogress == FALSE && group->dBench->identifier == BenchmarkIdentifier) {
return Retrieve_result(group->dBench, opt);
}
else if(group->dBench->bench_inprogress == TRUE) {
printf("Benchmark in progress.\n");
}
Py_RETURN_FALSE;
}
static PyObject *GranularBenchmark(PyObject *self, PyObject *args)
{
PyObject *dict = NULL;
GROUP_OBJECT *group = NULL;
if(!PyArg_ParseTuple(args, "O", &group)) {
PyErr_SetString(BENCH_ERROR, "GetGranularBenchmark - invalid argument.");
return NULL;
}
if(group->gBench == NULL || group->dBench == NULL) {
PyErr_SetString(BENCH_ERROR, "uninitialized benchmark object.");
return NULL;
}
else if(group->dBench->bench_inprogress == FALSE && BenchmarkIdentifier == group->dBench->identifier) {
if(group->dBench->granular_option == FALSE) {
PyErr_SetString(BENCH_ERROR, "granular option was not set.");
return NULL;
}
dict = PyDict_New();
if(dict == NULL) return NULL;
if(group->dBench->op_mult > 0) {
PyObject *MulList = PyCreateList(group->gBench, MULTIPLICATION);
//PrintPyRef('MulList Before =>', MulList);
PyDict_SetItemString(dict, "Mul", MulList);
Py_DECREF(MulList);
}
if(group->dBench->op_div > 0) {
PyObject *DivList = PyCreateList(group->gBench, DIVISION);
PyDict_SetItemString(dict, "Div", DivList);
Py_DECREF(DivList);
}
if(group->dBench->op_add > 0) {
PyObject *AddList = PyCreateList(group->gBench, ADDITION);
PyDict_SetItemString(dict, "Add", AddList);
Py_DECREF(AddList);
}
if(group->dBench->op_sub > 0) {
PyObject *SubList = PyCreateList(group->gBench, SUBTRACTION);
PyDict_SetItemString(dict, "Sub", SubList);
Py_DECREF(SubList);
}
if(group->dBench->op_exp > 0) {
PyObject *ExpList = PyCreateList(group->gBench, EXPONENTIATION);
PyDict_SetItemString(dict, "Exp", ExpList);
Py_DECREF(ExpList);
}
//PrintPyRef('MulList After =>', MulList);
}
else if(group->dBench->bench_inprogress == TRUE) {
printf("Benchmark in progress.\n");
}
else {
PyErr_SetString(BENCH_ERROR, "uninitialized benchmark object.");
}
return dict;
}
================================================
FILE: charm/core/benchmark/benchmark_util.h
================================================
#ifndef BENCHMARK_UTIL_H
#define BENCHMARK_UTIL_H
// for multiplicative notation
#define Op_MUL(op_var_type, op_group_type, group, bench_obj) \
if(op_var_type == MULTIPLICATION && op_group_type == group) \
((Operations *) bench_obj)->mul_ ##group += 1;
#define Op_DIV(op_var_type, op_group_type, group, bench_obj) \
if(op_var_type == DIVISION && op_group_type == group) \
((Operations *) bench_obj)->div_ ##group += 1;
// for additive notation
#define Op_ADD(op_var_type, op_group_type, group, bench_obj) \
if(op_var_type == ADDITION && op_group_type == group) \
((Operations *) bench_obj)->add_ ##group += 1;
#define Op_SUB(op_var_type, op_group_type, group, bench_obj) \
if(op_var_type == SUBTRACTION && op_group_type == group) \
((Operations *) bench_obj)->sub_ ##group += 1;
// exponentiation
#define Op_EXP(op_var_type, op_group_type, group, bench_obj) \
if(op_var_type == EXPONENTIATION && op_group_type == group) \
((Operations *) bench_obj)->exp_ ##group += 1;
#define UPDATE_BENCH(op_type, elem_type, gobj) \
if(gobj->dBench != NULL && gobj->dBench->granular_option == TRUE && elem_type != NONE_G) { \
Update_Op(MUL, op_type, elem_type, gobj->gBench) \
Update_Op(DIV, op_type, elem_type, gobj->gBench) \
Update_Op(ADD, op_type, elem_type, gobj->gBench) \
Update_Op(SUB, op_type, elem_type, gobj->gBench) \
Update_Op(EXP, op_type, elem_type, gobj->gBench) \
} \
UPDATE_BENCHMARK(op_type, gobj->dBench);
#define CLEAR_DBENCH(bench_obj, group) \
((Operations *) bench_obj)->mul_ ##group = 0; \
((Operations *) bench_obj)->exp_ ##group = 0; \
((Operations *) bench_obj)->div_ ##group = 0; \
((Operations *) bench_obj)->add_ ##group = 0; \
((Operations *) bench_obj)->sub_ ##group = 0; \
#define GetField(count, type, group, bench_obj) \
if(type == MULTIPLICATION) count = (((Operations *) bench_obj)->mul_ ##group ); \
else if(type == DIVISION) count = (((Operations *) bench_obj)->div_ ##group ); \
else if(type == ADDITION) count = (((Operations *) bench_obj)->add_ ##group ); \
else if(type == SUBTRACTION) count = (((Operations *) bench_obj)->sub_ ##group ); \
else if(type == EXPONENTIATION) count = (((Operations *) bench_obj)->exp_ ##group );
#define ClearBenchmark(data) \
data->op_add = data->op_sub = data->op_mult = 0; \
data->op_div = data->op_exp = data->op_pair = 0; \
data->cpu_time_ms = 0.0; \
data->real_time_ms = 0.0; \
data->cpu_option = FALSE; \
data->real_option = FALSE; \
data->granular_option = FALSE;
#endif
================================================
FILE: charm/core/benchmark/benchmarkmodule.c
================================================
#define BENCHMARK_MODULE
#include "benchmarkmodule.h"
#ifndef BENCHMARK_MODULE
// define new benchmark type for benchmark module
PyTypeObject BenchmarkType;
// define new benchmark error type (will be used for notifying errors)
PyObject *BenchmarkError;
#endif
double CalcUsecs(struct timeval *start, struct timeval *stop) {
double usec_per_second = 1000000;
double result = usec_per_second * (stop->tv_sec - start->tv_sec);
if(stop->tv_usec >= start->tv_usec) {
result += (stop->tv_usec - start->tv_usec);
}
else {
result -= (start->tv_usec - stop->tv_usec);
}
// if(result < 0) {
// debug("start secs => '%ld' and usecs => '%d'\n", start->tv_sec, start->tv_usec);
// debug("stop secs => '%ld' and usecs => '%d'\n", stop->tv_sec, stop->tv_usec);
// }
return result / usec_per_second;
}
int check_option(MeasureType o, Benchmark *d) {
int i;
if(d != NULL && d->bench_initialized) {
for(i = 0; i < d->num_options; i++) {
MeasureType tmp = d->options_selected[i];
if(tmp == o) { return TRUE; }
}
}
return FALSE;
}
// benchmark new
PyObject *Benchmark_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
Benchmark *self;
self = (Benchmark *)type->tp_alloc(type, 0);
if(self != NULL) {
self->bench_initialized = FALSE;
self->bench_inprogress = FALSE; // false until we StartBenchmark( ... )
self->op_add = self->op_sub = self->op_mult = 0;
self->op_div = self->op_exp = self->op_pair = 0;
self->cpu_time_ms = self->real_time_ms = 0.0;
self->cpu_option = self->real_option = FALSE;
debug("Creating new benchmark object.\n");
}
return (PyObject *) self;
}
// benchmark init
int Benchmark_init(Benchmark *self, PyObject *args, PyObject *kwds)
{
return 0;
}
// benchmark dealloc
void Benchmark_dealloc(Benchmark *self) {
debug("Releasing benchmark object.\n");
Py_TYPE(self)->tp_free((PyObject*)self);
}
static int PyStartBenchmark(Benchmark *data, PyObject *opList, int opListSize)
{
int i;
if(!PyList_Check(opList)) {
PyErr_SetString(BenchmarkError, "did not provide a list.");
return FALSE;
}
PyObject *tmpObj;
char *s;
if(data != NULL) {
int cnt = 0;
/* initialize */
data->cpu_option = data->real_option = data->granular_option = FALSE;
for(i = 0; i < opListSize; i++) {
PyObject *item = PyList_GetItem(opList, i);
if(PyBytes_CharmCheck(item)) {
s = NULL;
tmpObj = NULL;
PyBytes_ToString2(s, item, tmpObj);
if(strcmp(s, _CPUTIME_OPT) == 0) {
debug("enabled cputime option!\n");
data->options_selected[cnt] = CPU_TIME;
data->cpu_option = TRUE;
}
else if(strcmp(s, _REALTIME_OPT) == 0) {
debug("enabled realtime option!\n");
data->options_selected[cnt] = REAL_TIME;
data->real_option = TRUE;
}
else if(strcmp(s, _ADD_OPT) == 0) {
debug("enabled add option!\n");
data->options_selected[cnt] = ADDITION;
data->op_add = 0;
}
else if(strcmp(s, _SUB_OPT) == 0) {
debug("enabled sub option!\n");
data->options_selected[cnt] = SUBTRACTION;
data->op_sub = 0;
}
else if(strcmp(s, _MUL_OPT) == 0) {
debug("enabled mul option!\n");
data->options_selected[cnt] = MULTIPLICATION;
data->op_mult = 0;
}
else if(strcmp(s, _DIV_OPT) == 0) {
debug("enabled div option!\n");
data->options_selected[cnt] = DIVISION;
data->op_div = 0;
}
else if(strcmp(s, _EXP_OPT) == 0) {
debug("enabled exp option!\n");
data->options_selected[cnt] = EXPONENTIATION;
data->op_exp = 0;
}
else if(strcmp(s, _PAIR_OPT) == 0) {
debug("enabled pair option!\n");
data->options_selected[cnt] = PAIRINGS;
data->op_pair = 0;
}
else if(strcmp(s, _GRAN_OPT) == 0) {
debug("enabled granular option!\n");
data->options_selected[cnt] = GRANULAR;
data->granular_option = TRUE;
}
else {
debug("not a valid option.\n");
}
cnt++;
if (tmpObj!=NULL)
Py_DECREF(tmpObj);
}
}
// set size of list
data->num_options = cnt;
debug("num_options set: %d\n", data->num_options);
data->bench_initialized = TRUE;
data->bench_inprogress = TRUE;
//set timers for time-based measures (reduces the overhead of timer)
if(data->cpu_option) { data->start_clock = clock(); }
if(data->real_option) { gettimeofday(&data->start_time, NULL); }
return TRUE;
}
return FALSE;
}
static int PyEndBenchmark(Benchmark *data)
{
gettimeofday(&data->stop_time, NULL); // stop real time clock
data->stop_clock = clock(); // stop cpu time clock
int i;
if(data != NULL && data->bench_initialized) {
debug("Results....\n");
for(i = 0; i < data->num_options; i++) {
MeasureType option = data->options_selected[i];
debug("option => %d\n", option);
switch(option) {
case CPU_TIME: // compute processor time or clocks per sec
data->cpu_time_ms = ((double)(data->stop_clock - data->start_clock))/CLOCKS_PER_SEC;
debug("CPU Time:\t%f\n", data->cpu_time_ms);
break;
case REAL_TIME: debug("realtime option was set!\n");
data->real_time_ms = CalcUsecs(&data->start_time, &data->stop_time);
debug("Real Time:\t%f\n", data->real_time_ms);
break;
case ADDITION: debug("add operations:\t\t%d\n", data->op_add); break;
case SUBTRACTION: debug("sub operations:\t\t%d\n", data->op_sub); break;
case MULTIPLICATION: debug("mult operations:\t\t%d\n", data->op_mult); break;
case DIVISION: debug("div operations:\t\t%d\n", data->op_div); break;
case EXPONENTIATION: debug("exp operations:\t\t%d\n", data->op_exp); break;
case PAIRINGS: debug("pairing operations:\t\t%d\n", data->op_pair); break;
case GRANULAR: debug("granular option was set!\n"); break;
default: debug("not a valid option.\n"); break;
}
}
data->bench_inprogress = FALSE;
return TRUE;
}
return FALSE;
}
static int PyUpdateBenchmark(MeasureType option, Benchmark *data) {
int i, errcode = FALSE, foundOption = FALSE;
// make sure option is set in benchmark
if(data != NULL && data->bench_initialized) {
for(i = 0; i < data->num_options; i++) {
MeasureType tmp = data->options_selected[i];
if(tmp == option) { foundOption = TRUE; break; }
}
}
// if so, just increment the corresponding operation option counter
if(foundOption) {
switch(option) {
case ADDITION: data->op_add++; break;
case SUBTRACTION: data->op_sub++; break;
case MULTIPLICATION: data->op_mult++; break;
case DIVISION: data->op_div++; break;
case EXPONENTIATION: data->op_exp++; break;
case PAIRINGS: data->op_pair++; break;
default: debug("not a valid option.\n");
break;
}
errcode = TRUE;
}
return errcode;
}
static int PyClearBenchmark(Benchmark *data) {
if(data == NULL) { return FALSE; }
data->bench_initialized = FALSE;
data->identifier = -1;
data->op_add = data->op_sub = data->op_mult = 0;
data->op_div = data->op_exp = data->op_pair = 0;
data->cpu_time_ms = 0.0;
data->real_time_ms = 0.0;
data->cpu_option = FALSE;
data->real_option = FALSE;
data->granular_option = FALSE;
memset(data->options_selected, 0, MAX_MEASURE);
debug("Initialized benchmark object.\n");
return TRUE;
}
PyObject *Benchmark_print(Benchmark *self) {
if(self != NULL) {
PyObject *cpu = PyFloat_FromDouble(self->cpu_time_ms);
PyObject *real = PyFloat_FromDouble(self->real_time_ms);
PyObject *results = _PyUnicode_FromFormat("<--- Results --->\nCPU Time: %Sms\nReal Time: %Ss\nAdd:\t%i\nSub:\t%i\nMul:\t%i\nDiv:\t%i\nExp:\t%i\nPair:\t%i\n",
cpu, real, self->op_add, self->op_sub, self->op_mult, self->op_div, self->op_exp, self->op_pair);
PyClearBenchmark(self);
return results;
}
return _PyUnicode_FromString("Benchmark object has not been initialized properly.");
}
PyObject *GetResults(Benchmark *self) {
if(self != NULL) {
return Py_BuildValue("{sfsfsisisisisi}",
"CpuTime", self->cpu_time_ms, "RealTime", self->real_time_ms,
"Add", self->op_add, "Sub", self->op_sub, "Mul", self->op_mult,
"Div", self->op_div, "Exp", self->op_exp);
}
return _PyUnicode_FromString("Benchmark object has not been initialized properly.");
}
PyObject *GetResultsWithPair(Benchmark *self) {
if(self != NULL) {
return Py_BuildValue("{sfsfsisisisisisi}",
"CpuTime", self->cpu_time_ms, "RealTime", self->real_time_ms,
"Add", self->op_add, "Sub", self->op_sub, "Mul", self->op_mult,
"Div", self->op_div, "Exp", self->op_exp, "Pair", self->op_pair);
}
return _PyUnicode_FromString("Benchmark object has not been initialized properly.");
}
PyObject *Retrieve_result(Benchmark *self, char *option) {
PyObject *result = NULL;
if(self != NULL) {
if(strcmp(option, _CPUTIME_OPT) == 0) {
result = PyFloat_FromDouble(self->cpu_time_ms);
}
else if(strcmp(option, _REALTIME_OPT) == 0) {
result = PyFloat_FromDouble(self->real_time_ms);
}
else if(strcmp(option, _ADD_OPT) == 0) {
result = PyToLongObj(self->op_add);
}
else if(strcmp(option, _SUB_OPT) == 0) {
result = PyToLongObj(self->op_sub);
}
else if(strcmp(option, _MUL_OPT) == 0) {
result = PyToLongObj(self->op_mult);
}
else if(strcmp(option, _DIV_OPT) == 0) {
result = PyToLongObj(self->op_div);
}
else if(strcmp(option, _EXP_OPT) == 0) {
result = PyToLongObj(self->op_exp);
}
else if(strcmp(option, _PAIR_OPT) == 0) {
result = PyToLongObj(self->op_pair);
}
else {
debug("not a valid option.\n");
}
}
return result;
}
#if PY_MAJOR_VERSION >= 3
PyTypeObject BenchmarkType = {
PyVarObject_HEAD_INIT(NULL, 0)
"profile.Benchmark", /*tp_name*/
sizeof(Benchmark), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)Benchmark_dealloc, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_reserved*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash */
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
"Benchmark objects", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)Benchmark_init, /* tp_init */
0, /* tp_alloc */
Benchmark_new, /* tp_new */
};
#else
PyTypeObject BenchmarkType = {
PyVarObject_HEAD_INIT(NULL, 0)
"profile.Benchmark", /*tp_name*/
sizeof(Benchmark), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)Benchmark_dealloc, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_reserved*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash */
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
"Benchmark objects", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)Benchmark_init, /* tp_init */
0, /* tp_alloc */
Benchmark_new, /* tp_new */
};
#endif
struct module_state {
PyObject *error;
};
#if PY_MAJOR_VERSION >= 3
#define GETSTATE(m) ((struct module_state *) PyModule_GetState(m))
#else
#define GETSTATE(m) (&_state)
static struct module_state _state;
#endif
// benchmark type methods (module scope)
static PyMethodDef module_methods[] = {
{NULL}
};
#if PY_MAJOR_VERSION >= 3
static int bm_traverse(PyObject *m, visitproc visit, void *arg) {
Py_VISIT(GETSTATE(m)->error);
return 0;
}
static int bm_clear(PyObject *m) {
Py_CLEAR(GETSTATE(m)->error);
return 0;
}
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"benchmark",
NULL,
sizeof(struct module_state),
module_methods,
NULL,
bm_traverse,
bm_clear,
NULL
};
#define INITERROR return NULL
PyMODINIT_FUNC
PyInit_benchmark(void) {
#else
#define INITERROR return
void initbenchmark(void) {
#endif
PyObject *module;
static void *PyBenchmark_API[PyBenchmark_API_pointers];
PyObject *api_object;
if(PyType_Ready(&BenchmarkType) < 0) INITERROR;
#if PY_MAJOR_VERSION >= 3
module = PyModule_Create(&moduledef);
#else
module = Py_InitModule("benchmark", module_methods);
#endif
if(module == NULL) INITERROR;
struct module_state *st = GETSTATE(module);
st->error = PyErr_NewException("benchmark.Error", NULL, NULL);
if(st->error == NULL) {
Py_DECREF(module);
INITERROR;
}
BenchmarkError = st->error;
/* initialize the c api pointer array - this is what other modules call */
PyBenchmark_API[PyBenchmark_Start] = (void *)PyStartBenchmark;
PyBenchmark_API[PyBenchmark_End] = (void *)PyEndBenchmark;
PyBenchmark_API[PyBenchmark_Update] = (void *)PyUpdateBenchmark;
PyBenchmark_API[PyBenchmark_Clear] = (void *)PyClearBenchmark;
api_object = (PyObject *) PyCapsule_New((void *) PyBenchmark_API,BENCHMARK_MOD_NAME, NULL);
if(api_object != NULL) {
PyModule_AddObject(module, "_C_API", api_object);
}
Py_INCREF(&BenchmarkType);
PyModule_AddObject(module, "Benchmark", (PyObject *) &BenchmarkType);
// add exception handler
#if PY_MAJOR_VERSION >= 3
return module;
#endif
}
================================================
FILE: charm/core/benchmark/benchmarkmodule.h
================================================
/*
* benchmarkmodule.h
*/
#ifndef Py_BENCHMARKMODULE_H_
#define Py_BENCHMARKMODULE_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif
#include <Python.h>
#include <structmember.h>
#include <sys/time.h>
// set default if not passed in by compiler
//#ifndef BENCHMARK_ENABLED
//#define BENCHMARK_ENABLED 1vi bad
//#endif
//#define DEBUG 1
#define TRUE 1
#define FALSE 0
#ifdef DEBUG
#define debug(...) printf("DEBUG: "__VA_ARGS__)
#else
#define debug(...)
#endif
/* Python 3.x definitions */
#define _PyLong_Check(o1) PyLong_Check(o1)
#define ConvertToInt(o) PyLong_AsLong(o)
#define PyToLongObj(o) PyLong_FromLong(o)
/* check for both unicode and bytes objects */
#define PyBytes_CharmCheck(obj) PyUnicode_Check(obj) || PyBytes_Check(obj)
/* if unicode then add extra conversion step. two possibilities: unicode or bytes */
#define PyBytes_ToString2(a, obj, tmp_obj) \
if(PyBytes_Check(obj)) { a = PyBytes_AsString(obj); } \
else if(PyUnicode_Check(obj)) { tmp_obj = PyUnicode_AsUTF8String(obj); a = PyBytes_AsString(tmp_obj); } \
else { tmp_obj = PyObject_Str(obj); a = PyBytes_AsString(tmp_obj); }
#define _PyUnicode_FromFormat PyUnicode_FromFormat
#define _PyUnicode_FromString PyUnicode_FromString
#define BENCHMARK_MOD_NAME "charm.core.benchmark._C_API"
#ifndef BENCHMARK_MODULE
// define new benchmark type for benchmark module
extern PyTypeObject BenchmarkType;
// define new benchmark error type (will be used for notifying errors)
extern PyObject *BenchmarkError;
#else
// define new benchmark type for benchmark module
PyTypeObject BenchmarkType;
// define new benchmark error type (will be used for notifying errors)
PyObject *BenchmarkError;
#endif
// define a macro to help determine whether an object is of benchmark type
#define PyBenchmark_Check(obj) PyObject_TypeCheck(obj, &BenchmarkType)
/* header file for benchmark module */
#define MAX_MEASURE 10
enum Measure {CPU_TIME = 0, REAL_TIME, NATIVE_TIME, ADDITION, SUBTRACTION, MULTIPLICATION, DIVISION, EXPONENTIATION, PAIRINGS, GRANULAR, NONE};
typedef enum Measure MeasureType;
#define _CPUTIME_OPT "CpuTime"
#define _REALTIME_OPT "RealTime"
#define _ADD_OPT "Add"
#define _SUB_OPT "Sub"
#define _MUL_OPT "Mul"
#define _DIV_OPT "Div"
#define _EXP_OPT "Exp"
#define _PAIR_OPT "Pair"
#define _GRAN_OPT "Granular"
typedef struct {
PyObject_HEAD
struct timeval start_time, stop_time, native_time; // track real time
clock_t start_clock, stop_clock; // track cpu time
int op_add, op_sub, op_mult, op_div;
int op_exp, op_pair;
double cpu_time_ms, real_time_ms;
int num_options; // track num options for a particular benchmark
MeasureType options_selected[MAX_MEASURE+1]; // measurement options selected
int cpu_option, real_option, granular_option;
int identifier;
int bench_initialized, bench_inprogress;
} Benchmark;
// PyMethodDef Benchmark_methods[];
PyObject *Benchmark_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
void Benchmark_dealloc(Benchmark *self);
int Benchmark_init(Benchmark *self, PyObject *args, PyObject *kwds);
PyObject *Benchmark_print(Benchmark *self);
PyObject *GetResults(Benchmark *self);
PyObject *GetResultsWithPair(Benchmark *self);
PyObject *Retrieve_result(Benchmark *self, char *option);
/* c api functions */
#define PyBenchmark_Start 0
#define PyBenchmark_End 1
#define PyBenchmark_Update 2
#define PyBenchmark_Clear 3
/* total number of C api pointers? */
#define PyBenchmark_API_pointers 4
#ifdef BENCHMARK_ENABLED
#define UPDATE_BENCHMARK(option, bench) \
if(bench != NULL && bench->bench_initialized == TRUE) { \
PyUpdateBenchmark(option, bench); }
#else
#define UPDATE_BENCHMARK(option, bench) /* ... */
#endif
#ifdef BENCHMARK_MODULE
/* This section is used when compiling benchmarkmodule.c */
static int PyStartBenchmark(Benchmark *data, PyObject *opList, int opListSize);
static int PyEndBenchmark(Benchmark *data);
static int PyUpdateBenchmark(MeasureType option, Benchmark *data);
static int PyClearBenchmark(Benchmark *data);
#else
/* This section is used in modules that use benchmarkmodule's API
* e.g. pairingmath, integermath, etc.
*/
static void **PyBenchmark_API;
#define PyStartBenchmark (*(int (*)(Benchmark *data, PyObject *opList, int opListSize)) PyBenchmark_API[PyBenchmark_Start])
#define PyEndBenchmark (*(int (*)(Benchmark *data)) PyBenchmark_API[PyBenchmark_End])
#define PyUpdateBenchmark (*(int (*)(MeasureType option, Benchmark *data)) PyBenchmark_API[PyBenchmark_Update])
#define PyClearBenchmark (*(int (*)(Benchmark *data)) PyBenchmark_API[PyBenchmark_Clear])
#define ADD_BENCHMARK_OPTIONS(m) \
PyModule_AddStringConstant(m, "CpuTime", "CpuTime"); \
PyModule_AddStringConstant(m, "RealTime", "RealTime"); \
PyModule_AddStringConstant(m, "Add", "Add"); \
PyModule_AddStringConstant(m, "Sub", "Sub"); \
PyModule_AddStringConstant(m, "Mul", "Mul"); \
PyModule_AddStringConstant(m, "Div", "Div"); \
PyModule_AddStringConstant(m, "Exp", "Exp");
/* end - api helper functions */
static int import_benchmark(void)
{
// PyBenchmark_API = (void **) PyCapsule_Import(BENCHMARK_MOD_NAME, 1);
PyBenchmark_API = (void **) PyCapsule_Import(BENCHMARK_MOD_NAME, 0); // 0 = enable tracing
return (PyBenchmark_API != NULL) ? 0 : -1;
}
#endif
#ifdef __cplusplus
}
#endif
#endif /* PY_BENCHMARK_H_ */
================================================
FILE: charm/core/crypto/AES/AES.c
================================================
/**
* rijndael-alg-fst.c
*
* @version 3.0 (December 2000)
*
* Optimised ANSI C code for the Rijndael cipher (now AES)
*
* @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be>
* @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>
* @author Paulo Barreto <paulo.barreto@terra.com.br>
*
* This code is hereby placed in the public domain.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 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.
*/
#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif
#include <assert.h>
#include <stdlib.h>
#include <Python.h>
//#include "base64.h"
#define MODULE_NAME AES
#define BLOCK_SIZE 16
#define KEY_SIZE 0
#define MAXKC (256/32)
#define MAXKB (256/8)
#define MAXNR 14
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
typedef struct {
u32 ek[ 4*(MAXNR+1) ];
u32 dk[ 4*(MAXNR+1) ];
int rounds;
} block_state;
static void rijndaelEncrypt(u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 ct[16]);
static void rijndaelDecrypt(u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16], u8 pt[16]);
#ifdef INTERMEDIATE_VALUE_KAT
static void rijndaelEncryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], int rounds);
static void rijndaelDecryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], int rounds);
#endif /* INTERMEDIATE_VALUE_KAT */
/*
Te0[x] = S [x].[02, 01, 01, 03];
Te1[x] = S [x].[03, 02, 01, 01];
Te2[x] = S [x].[01, 03, 02, 01];
Te3[x] = S [x].[01, 01, 03, 02];
Te4[x] = S [x].[01, 01, 01, 01];
Td0[x] = Si[x].[0e, 09, 0d, 0b];
Td1[x] = Si[x].[0b, 0e, 09, 0d];
Td2[x] = Si[x].[0d, 0b, 0e, 09];
Td3[x] = Si[x].[09, 0d, 0b, 0e];
Td4[x] = Si[x].[01, 01, 01, 01];
*/
static const u32 Te0[256] = {
0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU,
0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U,
0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU,
0xe7fefe19U, 0xb5d7d762U, 0x4dababe6U, 0xec76769aU,
0x8fcaca45U, 0x1f82829dU, 0x89c9c940U, 0xfa7d7d87U,
0xeffafa15U, 0xb25959ebU, 0x8e4747c9U, 0xfbf0f00bU,
0x41adadecU, 0xb3d4d467U, 0x5fa2a2fdU, 0x45afafeaU,
0x239c9cbfU, 0x53a4a4f7U, 0xe4727296U, 0x9bc0c05bU,
0x75b7b7c2U, 0xe1fdfd1cU, 0x3d9393aeU, 0x4c26266aU,
0x6c36365aU, 0x7e3f3f41U, 0xf5f7f702U, 0x83cccc4fU,
0x6834345cU, 0x51a5a5f4U, 0xd1e5e534U, 0xf9f1f108U,
0xe2717193U, 0xabd8d873U, 0x62313153U, 0x2a15153fU,
0x0804040cU, 0x95c7c752U, 0x46232365U, 0x9dc3c35eU,
0x30181828U, 0x379696a1U, 0x0a05050fU, 0x2f9a9ab5U,
0x0e070709U, 0x24121236U, 0x1b80809bU, 0xdfe2e23dU,
0xcdebeb26U, 0x4e272769U, 0x7fb2b2cdU, 0xea75759fU,
0x1209091bU, 0x1d83839eU, 0x582c2c74U, 0x341a1a2eU,
0x361b1b2dU, 0xdc6e6eb2U, 0xb45a5aeeU, 0x5ba0a0fbU,
0xa45252f6U, 0x763b3b4dU, 0xb7d6d661U, 0x7db3b3ceU,
0x5229297bU, 0xdde3e33eU, 0x5e2f2f71U, 0x13848497U,
0xa65353f5U, 0xb9d1d168U, 0x00000000U, 0xc1eded2cU,
0x40202060U, 0xe3fcfc1fU, 0x79b1b1c8U, 0xb65b5bedU,
0xd46a6abeU, 0x8dcbcb46U, 0x67bebed9U, 0x7239394bU,
0x944a4adeU, 0x984c4cd4U, 0xb05858e8U, 0x85cfcf4aU,
0xbbd0d06bU, 0xc5efef2aU, 0x4faaaae5U, 0xedfbfb16U,
0x864343c5U, 0x9a4d4dd7U, 0x66333355U, 0x11858594U,
0x8a4545cfU, 0xe9f9f910U, 0x04020206U, 0xfe7f7f81U,
0xa05050f0U, 0x783c3c44U, 0x259f9fbaU, 0x4ba8a8e3U,
0xa25151f3U, 0x5da3a3feU, 0x804040c0U, 0x058f8f8aU,
0x3f9292adU, 0x219d9dbcU, 0x70383848U, 0xf1f5f504U,
0x63bcbcdfU, 0x77b6b6c1U, 0xafdada75U, 0x42212163U,
0x20101030U, 0xe5ffff1aU, 0xfdf3f30eU, 0xbfd2d26dU,
0x81cdcd4cU, 0x180c0c14U, 0x26131335U, 0xc3ecec2fU,
0xbe5f5fe1U, 0x359797a2U, 0x884444ccU, 0x2e171739U,
0x93c4c457U, 0x55a7a7f2U, 0xfc7e7e82U, 0x7a3d3d47U,
0xc86464acU, 0xba5d5de7U, 0x3219192bU, 0xe6737395U,
0xc06060a0U, 0x19818198U, 0x9e4f4fd1U, 0xa3dcdc7fU,
0x44222266U, 0x542a2a7eU, 0x3b9090abU, 0x0b888883U,
0x8c4646caU, 0xc7eeee29U, 0x6bb8b8d3U, 0x2814143cU,
0xa7dede79U, 0xbc5e5ee2U, 0x160b0b1dU, 0xaddbdb76U,
0xdbe0e03bU, 0x64323256U, 0x743a3a4eU, 0x140a0a1eU,
0x924949dbU, 0x0c06060aU, 0x4824246cU, 0xb85c5ce4U,
0x9fc2c25dU, 0xbdd3d36eU, 0x43acacefU, 0xc46262a6U,
0x399191a8U, 0x319595a4U, 0xd3e4e437U, 0xf279798bU,
0xd5e7e732U, 0x8bc8c843U, 0x6e373759U, 0xda6d6db7U,
0x018d8d8cU, 0xb1d5d564U, 0x9c4e4ed2U, 0x49a9a9e0U,
0xd86c6cb4U, 0xac5656faU, 0xf3f4f407U, 0xcfeaea25U,
0xca6565afU, 0xf47a7a8eU, 0x47aeaee9U, 0x10080818U,
0x6fbabad5U, 0xf0787888U, 0x4a25256fU, 0x5c2e2e72U,
0x381c1c24U, 0x57a6a6f1U, 0x73b4b4c7U, 0x97c6c651U,
0xcbe8e823U, 0xa1dddd7cU, 0xe874749cU, 0x3e1f1f21U,
0x964b4bddU, 0x61bdbddcU, 0x0d8b8b86U, 0x0f8a8a85U,
0xe0707090U, 0x7c3e3e42U, 0x71b5b5c4U, 0xcc6666aaU,
0x904848d8U, 0x06030305U, 0xf7f6f601U, 0x1c0e0e12U,
0xc26161a3U, 0x6a35355fU, 0xae5757f9U, 0x69b9b9d0U,
0x17868691U, 0x99c1c158U, 0x3a1d1d27U, 0x279e9eb9U,
0xd9e1e138U, 0xebf8f813U, 0x2b9898b3U, 0x22111133U,
0xd26969bbU, 0xa9d9d970U, 0x078e8e89U, 0x339494a7U,
0x2d9b9bb6U, 0x3c1e1e22U, 0x15878792U, 0xc9e9e920U,
0x87cece49U, 0xaa5555ffU, 0x50282878U, 0xa5dfdf7aU,
0x038c8c8fU, 0x59a1a1f8U, 0x09898980U, 0x1a0d0d17U,
0x65bfbfdaU, 0xd7e6e631U, 0x844242c6U, 0xd06868b8U,
0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U,
0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU,
};
static const u32 Te1[256] = {
0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU,
0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U,
0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU,
0x19e7fefeU, 0x62b5d7d7U, 0xe64dababU, 0x9aec7676U,
0x458fcacaU, 0x9d1f8282U, 0x4089c9c9U, 0x87fa7d7dU,
0x15effafaU, 0xebb25959U, 0xc98e4747U, 0x0bfbf0f0U,
0xec41adadU, 0x67b3d4d4U, 0xfd5fa2a2U, 0xea45afafU,
0xbf239c9cU, 0xf753a4a4U, 0x96e47272U, 0x5b9bc0c0U,
0xc275b7b7U, 0x1ce1fdfdU, 0xae3d9393U, 0x6a4c2626U,
0x5a6c3636U, 0x417e3f3fU, 0x02f5f7f7U, 0x4f83ccccU,
0x5c683434U, 0xf451a5a5U, 0x34d1e5e5U, 0x08f9f1f1U,
0x93e27171U, 0x73abd8d8U, 0x53623131U, 0x3f2a1515U,
0x0c080404U, 0x5295c7c7U, 0x65462323U, 0x5e9dc3c3U,
0x28301818U, 0xa1379696U, 0x0f0a0505U, 0xb52f9a9aU,
0x090e0707U, 0x36241212U, 0x9b1b8080U, 0x3ddfe2e2U,
0x26cdebebU, 0x694e2727U, 0xcd7fb2b2U, 0x9fea7575U,
0x1b120909U, 0x9e1d8383U, 0x74582c2cU, 0x2e341a1aU,
0x2d361b1bU, 0xb2dc6e6eU, 0xeeb45a5aU, 0xfb5ba0a0U,
0xf6a45252U, 0x4d763b3bU, 0x61b7d6d6U, 0xce7db3b3U,
0x7b522929U, 0x3edde3e3U, 0x715e2f2fU, 0x97138484U,
0xf5a65353U, 0x68b9d1d1U, 0x00000000U, 0x2cc1ededU,
0x60402020U, 0x1fe3fcfcU, 0xc879b1b1U, 0xedb65b5bU,
0xbed46a6aU, 0x468dcbcbU, 0xd967bebeU, 0x4b723939U,
0xde944a4aU, 0xd4984c4cU, 0xe8b05858U, 0x4a85cfcfU,
0x6bbbd0d0U, 0x2ac5efefU, 0xe54faaaaU, 0x16edfbfbU,
0xc5864343U, 0xd79a4d4dU, 0x55663333U, 0x94118585U,
0xcf8a4545U, 0x10e9f9f9U, 0x06040202U, 0x81fe7f7fU,
0xf0a05050U, 0x44783c3cU, 0xba259f9fU, 0xe34ba8a8U,
0xf3a25151U, 0xfe5da3a3U, 0xc0804040U, 0x8a058f8fU,
0xad3f9292U, 0xbc219d9dU, 0x48703838U, 0x04f1f5f5U,
0xdf63bcbcU, 0xc177b6b6U, 0x75afdadaU, 0x63422121U,
0x30201010U, 0x1ae5ffffU, 0x0efdf3f3U, 0x6dbfd2d2U,
0x4c81cdcdU, 0x14180c0cU, 0x35261313U, 0x2fc3ececU,
0xe1be5f5fU, 0xa2359797U, 0xcc884444U, 0x392e1717U,
0x5793c4c4U, 0xf255a7a7U, 0x82fc7e7eU, 0x477a3d3dU,
0xacc86464U, 0xe7ba5d5dU, 0x2b321919U, 0x95e67373U,
0xa0c06060U, 0x98198181U, 0xd19e4f4fU, 0x7fa3dcdcU,
0x66442222U, 0x7e542a2aU, 0xab3b9090U, 0x830b8888U,
0xca8c4646U, 0x29c7eeeeU, 0xd36bb8b8U, 0x3c281414U,
0x79a7dedeU, 0xe2bc5e5eU, 0x1d160b0bU, 0x76addbdbU,
0x3bdbe0e0U, 0x56643232U, 0x4e743a3aU, 0x1e140a0aU,
0xdb924949U, 0x0a0c0606U, 0x6c482424U, 0xe4b85c5cU,
0x5d9fc2c2U, 0x6ebdd3d3U, 0xef43acacU, 0xa6c46262U,
0xa8399191U, 0xa4319595U, 0x37d3e4e4U, 0x8bf27979U,
0x32d5e7e7U, 0x438bc8c8U, 0x596e3737U, 0xb7da6d6dU,
0x8c018d8dU, 0x64b1d5d5U, 0xd29c4e4eU, 0xe049a9a9U,
0xb4d86c6cU, 0xfaac5656U, 0x07f3f4f4U, 0x25cfeaeaU,
0xafca6565U, 0x8ef47a7aU, 0xe947aeaeU, 0x18100808U,
0xd56fbabaU, 0x88f07878U, 0x6f4a2525U, 0x725c2e2eU,
0x24381c1cU, 0xf157a6a6U, 0xc773b4b4U, 0x5197c6c6U,
0x23cbe8e8U, 0x7ca1ddddU, 0x9ce87474U, 0x213e1f1fU,
0xdd964b4bU, 0xdc61bdbdU, 0x860d8b8bU, 0x850f8a8aU,
0x90e07070U, 0x427c3e3eU, 0xc471b5b5U, 0xaacc6666U,
0xd8904848U, 0x05060303U, 0x01f7f6f6U, 0x121c0e0eU,
0xa3c26161U, 0x5f6a3535U, 0xf9ae5757U, 0xd069b9b9U,
0x91178686U, 0x5899c1c1U, 0x273a1d1dU, 0xb9279e9eU,
0x38d9e1e1U, 0x13ebf8f8U, 0xb32b9898U, 0x33221111U,
0xbbd26969U, 0x70a9d9d9U, 0x89078e8eU, 0xa7339494U,
0xb62d9b9bU, 0x223c1e1eU, 0x92158787U, 0x20c9e9e9U,
0x4987ceceU, 0xffaa5555U, 0x78502828U, 0x7aa5dfdfU,
0x8f038c8cU, 0xf859a1a1U, 0x80098989U, 0x171a0d0dU,
0xda65bfbfU, 0x31d7e6e6U, 0xc6844242U, 0xb8d06868U,
0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU,
0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U,
};
static const u32 Te2[256] = {
0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU,
0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U,
0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU,
0xfe19e7feU, 0xd762b5d7U, 0xabe64dabU, 0x769aec76U,
0xca458fcaU, 0x829d1f82U, 0xc94089c9U, 0x7d87fa7dU,
0xfa15effaU, 0x59ebb259U, 0x47c98e47U, 0xf00bfbf0U,
0xadec41adU, 0xd467b3d4U, 0xa2fd5fa2U, 0xafea45afU,
0x9cbf239cU, 0xa4f753a4U, 0x7296e472U, 0xc05b9bc0U,
0xb7c275b7U, 0xfd1ce1fdU, 0x93ae3d93U, 0x266a4c26U,
0x365a6c36U, 0x3f417e3fU, 0xf702f5f7U, 0xcc4f83ccU,
0x345c6834U, 0xa5f451a5U, 0xe534d1e5U, 0xf108f9f1U,
0x7193e271U, 0xd873abd8U, 0x31536231U, 0x153f2a15U,
0x040c0804U, 0xc75295c7U, 0x23654623U, 0xc35e9dc3U,
0x18283018U, 0x96a13796U, 0x050f0a05U, 0x9ab52f9aU,
0x07090e07U, 0x12362412U, 0x809b1b80U, 0xe23ddfe2U,
0xeb26cdebU, 0x27694e27U, 0xb2cd7fb2U, 0x759fea75U,
0x091b1209U, 0x839e1d83U, 0x2c74582cU, 0x1a2e341aU,
0x1b2d361bU, 0x6eb2dc6eU, 0x5aeeb45aU, 0xa0fb5ba0U,
0x52f6a452U, 0x3b4d763bU, 0xd661b7d6U, 0xb3ce7db3U,
0x297b5229U, 0xe33edde3U, 0x2f715e2fU, 0x84971384U,
0x53f5a653U, 0xd168b9d1U, 0x00000000U, 0xed2cc1edU,
0x20604020U, 0xfc1fe3fcU, 0xb1c879b1U, 0x5bedb65bU,
0x6abed46aU, 0xcb468dcbU, 0xbed967beU, 0x394b7239U,
0x4ade944aU, 0x4cd4984cU, 0x58e8b058U, 0xcf4a85cfU,
0xd06bbbd0U, 0xef2ac5efU, 0xaae54faaU, 0xfb16edfbU,
0x43c58643U, 0x4dd79a4dU, 0x33556633U, 0x85941185U,
0x45cf8a45U, 0xf910e9f9U, 0x02060402U, 0x7f81fe7fU,
0x50f0a050U, 0x3c44783cU, 0x9fba259fU, 0xa8e34ba8U,
0x51f3a251U, 0xa3fe5da3U, 0x40c08040U, 0x8f8a058fU,
0x92ad3f92U, 0x9dbc219dU, 0x38487038U, 0xf504f1f5U,
0xbcdf63bcU, 0xb6c177b6U, 0xda75afdaU, 0x21634221U,
0x10302010U, 0xff1ae5ffU, 0xf30efdf3U, 0xd26dbfd2U,
0xcd4c81cdU, 0x0c14180cU, 0x13352613U, 0xec2fc3ecU,
0x5fe1be5fU, 0x97a23597U, 0x44cc8844U, 0x17392e17U,
0xc45793c4U, 0xa7f255a7U, 0x7e82fc7eU, 0x3d477a3dU,
0x64acc864U, 0x5de7ba5dU, 0x192b3219U, 0x7395e673U,
0x60a0c060U, 0x81981981U, 0x4fd19e4fU, 0xdc7fa3dcU,
0x22664422U, 0x2a7e542aU, 0x90ab3b90U, 0x88830b88U,
0x46ca8c46U, 0xee29c7eeU, 0xb8d36bb8U, 0x143c2814U,
0xde79a7deU, 0x5ee2bc5eU, 0x0b1d160bU, 0xdb76addbU,
0xe03bdbe0U, 0x32566432U, 0x3a4e743aU, 0x0a1e140aU,
0x49db9249U, 0x060a0c06U, 0x246c4824U, 0x5ce4b85cU,
0xc25d9fc2U, 0xd36ebdd3U, 0xacef43acU, 0x62a6c462U,
0x91a83991U, 0x95a43195U, 0xe437d3e4U, 0x798bf279U,
0xe732d5e7U, 0xc8438bc8U, 0x37596e37U, 0x6db7da6dU,
0x8d8c018dU, 0xd564b1d5U, 0x4ed29c4eU, 0xa9e049a9U,
0x6cb4d86cU, 0x56faac56U, 0xf407f3f4U, 0xea25cfeaU,
0x65afca65U, 0x7a8ef47aU, 0xaee947aeU, 0x08181008U,
0xbad56fbaU, 0x7888f078U, 0x256f4a25U, 0x2e725c2eU,
0x1c24381cU, 0xa6f157a6U, 0xb4c773b4U, 0xc65197c6U,
0xe823cbe8U, 0xdd7ca1ddU, 0x749ce874U, 0x1f213e1fU,
0x4bdd964bU, 0xbddc61bdU, 0x8b860d8bU, 0x8a850f8aU,
0x7090e070U, 0x3e427c3eU, 0xb5c471b5U, 0x66aacc66U,
0x48d89048U, 0x03050603U, 0xf601f7f6U, 0x0e121c0eU,
0x61a3c261U, 0x355f6a35U, 0x57f9ae57U, 0xb9d069b9U,
0x86911786U, 0xc15899c1U, 0x1d273a1dU, 0x9eb9279eU,
0xe138d9e1U, 0xf813ebf8U, 0x98b32b98U, 0x11332211U,
0x69bbd269U, 0xd970a9d9U, 0x8e89078eU, 0x94a73394U,
0x9bb62d9bU, 0x1e223c1eU, 0x87921587U, 0xe920c9e9U,
0xce4987ceU, 0x55ffaa55U, 0x28785028U, 0xdf7aa5dfU,
0x8c8f038cU, 0xa1f859a1U, 0x89800989U, 0x0d171a0dU,
0xbfda65bfU, 0xe631d7e6U, 0x42c68442U, 0x68b8d068U,
0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU,
0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U,
};
static const u32 Te3[256] = {
0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U,
0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U,
0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U,
0xfefe19e7U, 0xd7d762b5U, 0xababe64dU, 0x76769aecU,
0xcaca458fU, 0x82829d1fU, 0xc9c94089U, 0x7d7d87faU,
0xfafa15efU, 0x5959ebb2U, 0x4747c98eU, 0xf0f00bfbU,
0xadadec41U, 0xd4d467b3U, 0xa2a2fd5fU, 0xafafea45U,
0x9c9cbf23U, 0xa4a4f753U, 0x727296e4U, 0xc0c05b9bU,
0xb7b7c275U, 0xfdfd1ce1U, 0x9393ae3dU, 0x26266a4cU,
0x36365a6cU, 0x3f3f417eU, 0xf7f702f5U, 0xcccc4f83U,
0x34345c68U, 0xa5a5f451U, 0xe5e534d1U, 0xf1f108f9U,
0x717193e2U, 0xd8d873abU, 0x31315362U, 0x15153f2aU,
0x04040c08U, 0xc7c75295U, 0x23236546U, 0xc3c35e9dU,
0x18182830U, 0x9696a137U, 0x05050f0aU, 0x9a9ab52fU,
0x0707090eU, 0x12123624U, 0x80809b1bU, 0xe2e23ddfU,
0xebeb26cdU, 0x2727694eU, 0xb2b2cd7fU, 0x75759feaU,
0x09091b12U, 0x83839e1dU, 0x2c2c7458U, 0x1a1a2e34U,
0x1b1b2d36U, 0x6e6eb2dcU, 0x5a5aeeb4U, 0xa0a0fb5bU,
0x5252f6a4U, 0x3b3b4d76U, 0xd6d661b7U, 0xb3b3ce7dU,
0x29297b52U, 0xe3e33eddU, 0x2f2f715eU, 0x84849713U,
0x5353f5a6U, 0xd1d168b9U, 0x00000000U, 0xeded2cc1U,
0x20206040U, 0xfcfc1fe3U, 0xb1b1c879U, 0x5b5bedb6U,
0x6a6abed4U, 0xcbcb468dU, 0xbebed967U, 0x39394b72U,
0x4a4ade94U, 0x4c4cd498U, 0x5858e8b0U, 0xcfcf4a85U,
0xd0d06bbbU, 0xefef2ac5U, 0xaaaae54fU, 0xfbfb16edU,
0x4343c586U, 0x4d4dd79aU, 0x33335566U, 0x85859411U,
0x4545cf8aU, 0xf9f910e9U, 0x02020604U, 0x7f7f81feU,
0x5050f0a0U, 0x3c3c4478U, 0x9f9fba25U, 0xa8a8e34bU,
0x5151f3a2U, 0xa3a3fe5dU, 0x4040c080U, 0x8f8f8a05U,
0x9292ad3fU, 0x9d9dbc21U, 0x38384870U, 0xf5f504f1U,
0xbcbcdf63U, 0xb6b6c177U, 0xdada75afU, 0x21216342U,
0x10103020U, 0xffff1ae5U, 0xf3f30efdU, 0xd2d26dbfU,
0xcdcd4c81U, 0x0c0c1418U, 0x13133526U, 0xecec2fc3U,
0x5f5fe1beU, 0x9797a235U, 0x4444cc88U, 0x1717392eU,
0xc4c45793U, 0xa7a7f255U, 0x7e7e82fcU, 0x3d3d477aU,
0x6464acc8U, 0x5d5de7baU, 0x19192b32U, 0x737395e6U,
0x6060a0c0U, 0x81819819U, 0x4f4fd19eU, 0xdcdc7fa3U,
0x22226644U, 0x2a2a7e54U, 0x9090ab3bU, 0x8888830bU,
0x4646ca8cU, 0xeeee29c7U, 0xb8b8d36bU, 0x14143c28U,
0xdede79a7U, 0x5e5ee2bcU, 0x0b0b1d16U, 0xdbdb76adU,
0xe0e03bdbU, 0x32325664U, 0x3a3a4e74U, 0x0a0a1e14U,
0x4949db92U, 0x06060a0cU, 0x24246c48U, 0x5c5ce4b8U,
0xc2c25d9fU, 0xd3d36ebdU, 0xacacef43U, 0x6262a6c4U,
0x9191a839U, 0x9595a431U, 0xe4e437d3U, 0x79798bf2U,
0xe7e732d5U, 0xc8c8438bU, 0x3737596eU, 0x6d6db7daU,
0x8d8d8c01U, 0xd5d564b1U, 0x4e4ed29cU, 0xa9a9e049U,
0x6c6cb4d8U, 0x5656faacU, 0xf4f407f3U, 0xeaea25cfU,
0x6565afcaU, 0x7a7a8ef4U, 0xaeaee947U, 0x08081810U,
0xbabad56fU, 0x787888f0U, 0x25256f4aU, 0x2e2e725cU,
0x1c1c2438U, 0xa6a6f157U, 0xb4b4c773U, 0xc6c65197U,
0xe8e823cbU, 0xdddd7ca1U, 0x74749ce8U, 0x1f1f213eU,
0x4b4bdd96U, 0xbdbddc61U, 0x8b8b860dU, 0x8a8a850fU,
0x707090e0U, 0x3e3e427cU, 0xb5b5c471U, 0x6666aaccU,
0x4848d890U, 0x03030506U, 0xf6f601f7U, 0x0e0e121cU,
0x6161a3c2U, 0x35355f6aU, 0x5757f9aeU, 0xb9b9d069U,
0x86869117U, 0xc1c15899U, 0x1d1d273aU, 0x9e9eb927U,
0xe1e138d9U, 0xf8f813ebU, 0x9898b32bU, 0x11113322U,
0x6969bbd2U, 0xd9d970a9U, 0x8e8e8907U, 0x9494a733U,
0x9b9bb62dU, 0x1e1e223cU, 0x87879215U, 0xe9e920c9U,
0xcece4987U, 0x5555ffaaU, 0x28287850U, 0xdfdf7aa5U,
0x8c8c8f03U, 0xa1a1f859U, 0x89898009U, 0x0d0d171aU,
0xbfbfda65U, 0xe6e631d7U, 0x4242c684U, 0x6868b8d0U,
0x4141c382U, 0x9999b029U, 0x2d2d775aU, 0x0f0f111eU,
0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU,
};
static const u32 Te4[256] = {
0x63636363U, 0x7c7c7c7cU, 0x77777777U, 0x7b7b7b7bU,
0xf2f2f2f2U, 0x6b6b6b6bU, 0x6f6f6f6fU, 0xc5c5c5c5U,
0x30303030U, 0x01010101U, 0x67676767U, 0x2b2b2b2bU,
0xfefefefeU, 0xd7d7d7d7U, 0xababababU, 0x76767676U,
0xcacacacaU, 0x82828282U, 0xc9c9c9c9U, 0x7d7d7d7dU,
0xfafafafaU, 0x59595959U, 0x47474747U, 0xf0f0f0f0U,
0xadadadadU, 0xd4d4d4d4U, 0xa2a2a2a2U, 0xafafafafU,
0x9c9c9c9cU, 0xa4a4a4a4U, 0x72727272U, 0xc0c0c0c0U,
0xb7b7b7b7U, 0xfdfdfdfdU, 0x93939393U, 0x26262626U,
0x36363636U, 0x3f3f3f3fU, 0xf7f7f7f7U, 0xccccccccU,
0x34343434U, 0xa5a5a5a5U, 0xe5e5e5e5U, 0xf1f1f1f1U,
0x71717171U, 0xd8d8d8d8U, 0x31313131U, 0x15151515U,
0x04040404U, 0xc7c7c7c7U, 0x23232323U, 0xc3c3c3c3U,
0x18181818U, 0x96969696U, 0x05050505U, 0x9a9a9a9aU,
0x07070707U, 0x12121212U, 0x80808080U, 0xe2e2e2e2U,
0xebebebebU, 0x27272727U, 0xb2b2b2b2U, 0x75757575U,
0x09090909U, 0x83838383U, 0x2c2c2c2cU, 0x1a1a1a1aU,
0x1b1b1b1bU, 0x6e6e6e6eU, 0x5a5a5a5aU, 0xa0a0a0a0U,
0x52525252U, 0x3b3b3b3bU, 0xd6d6d6d6U, 0xb3b3b3b3U,
0x29292929U, 0xe3e3e3e3U, 0x2f2f2f2fU, 0x84848484U,
0x53535353U, 0xd1d1d1d1U, 0x00000000U, 0xededededU,
0x20202020U, 0xfcfcfcfcU, 0xb1b1b1b1U, 0x5b5b5b5bU,
0x6a6a6a6aU, 0xcbcbcbcbU, 0xbebebebeU, 0x39393939U,
0x4a4a4a4aU, 0x4c4c4c4cU, 0x58585858U, 0xcfcfcfcfU,
0xd0d0d0d0U, 0xefefefefU, 0xaaaaaaaaU, 0xfbfbfbfbU,
0x43434343U, 0x4d4d4d4dU, 0x33333333U, 0x85858585U,
0x45454545U, 0xf9f9f9f9U, 0x02020202U, 0x7f7f7f7fU,
0x50505050U, 0x3c3c3c3cU, 0x9f9f9f9fU, 0xa8a8a8a8U,
0x51515151U, 0xa3a3a3a3U, 0x40404040U, 0x8f8f8f8fU,
0x92929292U, 0x9d9d9d9dU, 0x38383838U, 0xf5f5f5f5U,
0xbcbcbcbcU, 0xb6b6b6b6U, 0xdadadadaU, 0x21212121U,
0x10101010U, 0xffffffffU, 0xf3f3f3f3U, 0xd2d2d2d2U,
0xcdcdcdcdU, 0x0c0c0c0cU, 0x13131313U, 0xececececU,
0x5f5f5f5fU, 0x97979797U, 0x44444444U, 0x17171717U,
0xc4c4c4c4U, 0xa7a7a7a7U, 0x7e7e7e7eU, 0x3d3d3d3dU,
0x64646464U, 0x5d5d5d5dU, 0x19191919U, 0x73737373U,
0x60606060U, 0x81818181U, 0x4f4f4f4fU, 0xdcdcdcdcU,
0x22222222U, 0x2a2a2a2aU, 0x90909090U, 0x88888888U,
0x46464646U, 0xeeeeeeeeU, 0xb8b8b8b8U, 0x14141414U,
0xdedededeU, 0x5e5e5e5eU, 0x0b0b0b0bU, 0xdbdbdbdbU,
0xe0e0e0e0U, 0x32323232U, 0x3a3a3a3aU, 0x0a0a0a0aU,
0x49494949U, 0x06060606U, 0x24242424U, 0x5c5c5c5cU,
0xc2c2c2c2U, 0xd3d3d3d3U, 0xacacacacU, 0x62626262U,
0x91919191U, 0x95959595U, 0xe4e4e4e4U, 0x79797979U,
0xe7e7e7e7U, 0xc8c8c8c8U, 0x37373737U, 0x6d6d6d6dU,
0x8d8d8d8dU, 0xd5d5d5d5U, 0x4e4e4e4eU, 0xa9a9a9a9U,
0x6c6c6c6cU, 0x56565656U, 0xf4f4f4f4U, 0xeaeaeaeaU,
0x65656565U, 0x7a7a7a7aU, 0xaeaeaeaeU, 0x08080808U,
0xbabababaU, 0x78787878U, 0x25252525U, 0x2e2e2e2eU,
0x1c1c1c1cU, 0xa6a6a6a6U, 0xb4b4b4b4U, 0xc6c6c6c6U,
0xe8e8e8e8U, 0xddddddddU, 0x74747474U, 0x1f1f1f1fU,
0x4b4b4b4bU, 0xbdbdbdbdU, 0x8b8b8b8bU, 0x8a8a8a8aU,
0x70707070U, 0x3e3e3e3eU, 0xb5b5b5b5U, 0x66666666U,
0x48484848U, 0x03030303U, 0xf6f6f6f6U, 0x0e0e0e0eU,
0x61616161U, 0x35353535U, 0x57575757U, 0xb9b9b9b9U,
0x86868686U, 0xc1c1c1c1U, 0x1d1d1d1dU, 0x9e9e9e9eU,
0xe1e1e1e1U, 0xf8f8f8f8U, 0x98989898U, 0x11111111U,
0x69696969U, 0xd9d9d9d9U, 0x8e8e8e8eU, 0x94949494U,
0x9b9b9b9bU, 0x1e1e1e1eU, 0x87878787U, 0xe9e9e9e9U,
0xcecececeU, 0x55555555U, 0x28282828U, 0xdfdfdfdfU,
0x8c8c8c8cU, 0xa1a1a1a1U, 0x89898989U, 0x0d0d0d0dU,
0xbfbfbfbfU, 0xe6e6e6e6U, 0x42424242U, 0x68686868U,
0x41414141U, 0x99999999U, 0x2d2d2d2dU, 0x0f0f0f0fU,
0xb0b0b0b0U, 0x54545454U, 0xbbbbbbbbU, 0x16161616U,
};
static const u32 Td0[256] = {
0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U,
0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U,
0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U,
0x4fe5d7fcU, 0xc52acbd7U, 0x26354480U, 0xb562a38fU,
0xdeb15a49U, 0x25ba1b67U, 0x45ea0e98U, 0x5dfec0e1U,
0xc32f7502U, 0x814cf012U, 0x8d4697a3U, 0x6bd3f9c6U,
0x038f5fe7U, 0x15929c95U, 0xbf6d7aebU, 0x955259daU,
0xd4be832dU, 0x587421d3U, 0x49e06929U, 0x8ec9c844U,
0x75c2896aU, 0xf48e7978U, 0x99583e6bU, 0x27b971ddU,
0xbee14fb6U, 0xf088ad17U, 0xc920ac66U, 0x7dce3ab4U,
0x63df4a18U, 0xe51a3182U, 0x97513360U, 0x62537f45U,
0xb16477e0U, 0xbb6bae84U, 0xfe81a01cU, 0xf9082b94U,
0x70486858U, 0x8f45fd19U, 0x94de6c87U, 0x527bf8b7U,
0xab73d323U, 0x724b02e2U, 0xe31f8f57U, 0x6655ab2aU,
0xb2eb2807U, 0x2fb5c203U, 0x86c57b9aU, 0xd33708a5U,
0x302887f2U, 0x23bfa5b2U, 0x02036abaU, 0xed16825cU,
0x8acf1c2bU, 0xa779b492U, 0xf307f2f0U, 0x4e69e2a1U,
0x65daf4cdU, 0x0605bed5U, 0xd134621fU, 0xc4a6fe8aU,
0x342e539dU, 0xa2f355a0U, 0x058ae132U, 0xa4f6eb75U,
0x0b83ec39U, 0x4060efaaU, 0x5e719f06U, 0xbd6e1051U,
0x3e218af9U, 0x96dd063dU, 0xdd3e05aeU, 0x4de6bd46U,
0x91548db5U, 0x71c45d05U, 0x0406d46fU, 0x605015ffU,
0x1998fb24U, 0xd6bde997U, 0x894043ccU, 0x67d99e77U,
0xb0e842bdU, 0x07898b88U, 0xe7195b38U, 0x79c8eedbU,
0xa17c0a47U, 0x7c420fe9U, 0xf8841ec9U, 0x00000000U,
0x09808683U, 0x322bed48U, 0x1e1170acU, 0x6c5a724eU,
0xfd0efffbU, 0x0f853856U, 0x3daed51eU, 0x362d3927U,
0x0a0fd964U, 0x685ca621U, 0x9b5b54d1U, 0x24362e3aU,
0x0c0a67b1U, 0x9357e70fU, 0xb4ee96d2U, 0x1b9b919eU,
0x80c0c54fU, 0x61dc20a2U, 0x5a774b69U, 0x1c121a16U,
0xe293ba0aU, 0xc0a02ae5U, 0x3c22e043U, 0x121b171dU,
0x0e090d0bU, 0xf28bc7adU, 0x2db6a8b9U, 0x141ea9c8U,
0x57f11985U, 0xaf75074cU, 0xee99ddbbU, 0xa37f60fdU,
0xf701269fU, 0x5c72f5bcU, 0x44663bc5U, 0x5bfb7e34U,
0x8b432976U, 0xcb23c6dcU, 0xb6edfc68U, 0xb8e4f163U,
0xd731dccaU, 0x42638510U, 0x13972240U, 0x84c61120U,
0x854a247dU, 0xd2bb3df8U, 0xaef93211U, 0xc729a16dU,
0x1d9e2f4bU, 0xdcb230f3U, 0x0d8652ecU, 0x77c1e3d0U,
0x2bb3166cU, 0xa970b999U, 0x119448faU, 0x47e96422U,
0xa8fc8cc4U, 0xa0f03f1aU, 0x567d2cd8U, 0x223390efU,
0x87494ec7U, 0xd938d1c1U, 0x8ccaa2feU, 0x98d40b36U,
0xa6f581cfU, 0xa57ade28U, 0xdab78e26U, 0x3fadbfa4U,
0x2c3a9de4U, 0x5078920dU, 0x6a5fcc9bU, 0x547e4662U,
0xf68d13c2U, 0x90d8b8e8U, 0x2e39f75eU, 0x82c3aff5U,
0x9f5d80beU, 0x69d0937cU, 0x6fd52da9U, 0xcf2512b3U,
0xc8ac993bU, 0x10187da7U, 0xe89c636eU, 0xdb3bbb7bU,
0xcd267809U, 0x6e5918f4U, 0xec9ab701U, 0x834f9aa8U,
0xe6956e65U, 0xaaffe67eU, 0x21bccf08U, 0xef15e8e6U,
0xbae79bd9U, 0x4a6f36ceU, 0xea9f09d4U, 0x29b07cd6U,
0x31a4b2afU, 0x2a3f2331U, 0xc6a59430U, 0x35a266c0U,
0x744ebc37U, 0xfc82caa6U, 0xe090d0b0U, 0x33a7d815U,
0xf104984aU, 0x41ecdaf7U, 0x7fcd500eU, 0x1791f62fU,
0x764dd68dU, 0x43efb04dU, 0xccaa4d54U, 0xe49604dfU,
0x9ed1b5e3U, 0x4c6a881bU, 0xc12c1fb8U, 0x4665517fU,
0x9d5eea04U, 0x018c355dU, 0xfa877473U, 0xfb0b412eU,
0xb3671d5aU, 0x92dbd252U, 0xe9105633U, 0x6dd64713U,
0x9ad7618cU, 0x37a10c7aU, 0x59f8148eU, 0xeb133c89U,
0xcea927eeU, 0xb761c935U, 0xe11ce5edU, 0x7a47b13cU,
0x9cd2df59U, 0x55f2733fU, 0x1814ce79U, 0x73c737bfU,
0x53f7cdeaU, 0x5ffdaa5bU, 0xdf3d6f14U, 0x7844db86U,
0xcaaff381U, 0xb968c43eU, 0x3824342cU, 0xc2a3405fU,
0x161dc372U, 0xbce2250cU, 0x283c498bU, 0xff0d9541U,
0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U,
0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U,
};
static const u32 Td1[256] = {
0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU,
0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U,
0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU,
0xfc4fe5d7U, 0xd7c52acbU, 0x80263544U, 0x8fb562a3U,
0x49deb15aU, 0x6725ba1bU, 0x9845ea0eU, 0xe15dfec0U,
0x02c32f75U, 0x12814cf0U, 0xa38d4697U, 0xc66bd3f9U,
0xe7038f5fU, 0x9515929cU, 0xebbf6d7aU, 0xda955259U,
0x2dd4be83U, 0xd3587421U, 0x2949e069U, 0x448ec9c8U,
0x6a75c289U, 0x78f48e79U, 0x6b99583eU, 0xdd27b971U,
0xb6bee14fU, 0x17f088adU, 0x66c920acU, 0xb47dce3aU,
0x1863df4aU, 0x82e51a31U, 0x60975133U, 0x4562537fU,
0xe0b16477U, 0x84bb6baeU, 0x1cfe81a0U, 0x94f9082bU,
0x58704868U, 0x198f45fdU, 0x8794de6cU, 0xb7527bf8U,
0x23ab73d3U, 0xe2724b02U, 0x57e31f8fU, 0x2a6655abU,
0x07b2eb28U, 0x032fb5c2U, 0x9a86c57bU, 0xa5d33708U,
0xf2302887U, 0xb223bfa5U, 0xba02036aU, 0x5ced1682U,
0x2b8acf1cU, 0x92a779b4U, 0xf0f307f2U, 0xa14e69e2U,
0xcd65daf4U, 0xd50605beU, 0x1fd13462U, 0x8ac4a6feU,
0x9d342e53U, 0xa0a2f355U, 0x32058ae1U, 0x75a4f6ebU,
0x390b83ecU, 0xaa4060efU, 0x065e719fU, 0x51bd6e10U,
0xf93e218aU, 0x3d96dd06U, 0xaedd3e05U, 0x464de6bdU,
0xb591548dU, 0x0571c45dU, 0x6f0406d4U, 0xff605015U,
0x241998fbU, 0x97d6bde9U, 0xcc894043U, 0x7767d99eU,
0xbdb0e842U, 0x8807898bU, 0x38e7195bU, 0xdb79c8eeU,
0x47a17c0aU, 0xe97c420fU, 0xc9f8841eU, 0x00000000U,
0x83098086U, 0x48322bedU, 0xac1e1170U, 0x4e6c5a72U,
0xfbfd0effU, 0x560f8538U, 0x1e3daed5U, 0x27362d39U,
0x640a0fd9U, 0x21685ca6U, 0xd19b5b54U, 0x3a24362eU,
0xb10c0a67U, 0x0f9357e7U, 0xd2b4ee96U, 0x9e1b9b91U,
0x4f80c0c5U, 0xa261dc20U, 0x695a774bU, 0x161c121aU,
0x0ae293baU, 0xe5c0a02aU, 0x433c22e0U, 0x1d121b17U,
0x0b0e090dU, 0xadf28bc7U, 0xb92db6a8U, 0xc8141ea9U,
0x8557f119U, 0x4caf7507U, 0xbbee99ddU, 0xfda37f60U,
0x9ff70126U, 0xbc5c72f5U, 0xc544663bU, 0x345bfb7eU,
0x768b4329U, 0xdccb23c6U, 0x68b6edfcU, 0x63b8e4f1U,
0xcad731dcU, 0x10426385U, 0x40139722U, 0x2084c611U,
0x7d854a24U, 0xf8d2bb3dU, 0x11aef932U, 0x6dc729a1U,
0x4b1d9e2fU, 0xf3dcb230U, 0xec0d8652U, 0xd077c1e3U,
0x6c2bb316U, 0x99a970b9U, 0xfa119448U, 0x2247e964U,
0xc4a8fc8cU, 0x1aa0f03fU, 0xd8567d2cU, 0xef223390U,
0xc787494eU, 0xc1d938d1U, 0xfe8ccaa2U, 0x3698d40bU,
0xcfa6f581U, 0x28a57adeU, 0x26dab78eU, 0xa43fadbfU,
0xe42c3a9dU, 0x0d507892U, 0x9b6a5fccU, 0x62547e46U,
0xc2f68d13U, 0xe890d8b8U, 0x5e2e39f7U, 0xf582c3afU,
0xbe9f5d80U, 0x7c69d093U, 0xa96fd52dU, 0xb3cf2512U,
0x3bc8ac99U, 0xa710187dU, 0x6ee89c63U, 0x7bdb3bbbU,
0x09cd2678U, 0xf46e5918U, 0x01ec9ab7U, 0xa8834f9aU,
0x65e6956eU, 0x7eaaffe6U, 0x0821bccfU, 0xe6ef15e8U,
0xd9bae79bU, 0xce4a6f36U, 0xd4ea9f09U, 0xd629b07cU,
0xaf31a4b2U, 0x312a3f23U, 0x30c6a594U, 0xc035a266U,
0x37744ebcU, 0xa6fc82caU, 0xb0e090d0U, 0x1533a7d8U,
0x4af10498U, 0xf741ecdaU, 0x0e7fcd50U, 0x2f1791f6U,
0x8d764dd6U, 0x4d43efb0U, 0x54ccaa4dU, 0xdfe49604U,
0xe39ed1b5U, 0x1b4c6a88U, 0xb8c12c1fU, 0x7f466551U,
0x049d5eeaU, 0x5d018c35U, 0x73fa8774U, 0x2efb0b41U,
0x5ab3671dU, 0x5292dbd2U, 0x33e91056U, 0x136dd647U,
0x8c9ad761U, 0x7a37a10cU, 0x8e59f814U, 0x89eb133cU,
0xeecea927U, 0x35b761c9U, 0xede11ce5U, 0x3c7a47b1U,
0x599cd2dfU, 0x3f55f273U, 0x791814ceU, 0xbf73c737U,
0xea53f7cdU, 0x5b5ffdaaU, 0x14df3d6fU, 0x867844dbU,
0x81caaff3U, 0x3eb968c4U, 0x2c382434U, 0x5fc2a340U,
0x72161dc3U, 0x0cbce225U, 0x8b283c49U, 0x41ff0d95U,
0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U,
0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U,
};
static const u32 Td2[256] = {
0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U,
0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U,
0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U,
0xd7fc4fe5U, 0xcbd7c52aU, 0x44802635U, 0xa38fb562U,
0x5a49deb1U, 0x1b6725baU, 0x0e9845eaU, 0xc0e15dfeU,
0x7502c32fU, 0xf012814cU, 0x97a38d46U, 0xf9c66bd3U,
0x5fe7038fU, 0x9c951592U, 0x7aebbf6dU, 0x59da9552U,
0x832dd4beU, 0x21d35874U, 0x692949e0U, 0xc8448ec9U,
0x896a75c2U, 0x7978f48eU, 0x3e6b9958U, 0x71dd27b9U,
0x4fb6bee1U, 0xad17f088U, 0xac66c920U, 0x3ab47dceU,
0x4a1863dfU, 0x3182e51aU, 0x33609751U, 0x7f456253U,
0x77e0b164U, 0xae84bb6bU, 0xa01cfe81U, 0x2b94f908U,
0x68587048U, 0xfd198f45U, 0x6c8794deU, 0xf8b7527bU,
0xd323ab73U, 0x02e2724bU, 0x8f57e31fU, 0xab2a6655U,
0x2807b2ebU, 0xc2032fb5U, 0x7b9a86c5U, 0x08a5d337U,
0x87f23028U, 0xa5b223bfU, 0x6aba0203U, 0x825ced16U,
0x1c2b8acfU, 0xb492a779U, 0xf2f0f307U, 0xe2a14e69U,
0xf4cd65daU, 0xbed50605U, 0x621fd134U, 0xfe8ac4a6U,
0x539d342eU, 0x55a0a2f3U, 0xe132058aU, 0xeb75a4f6U,
0xec390b83U, 0xefaa4060U, 0x9f065e71U, 0x1051bd6eU,
0x8af93e21U, 0x063d96ddU, 0x05aedd3eU, 0xbd464de6U,
0x8db59154U, 0x5d0571c4U, 0xd46f0406U, 0x15ff6050U,
0xfb241998U, 0xe997d6bdU, 0x43cc8940U, 0x9e7767d9U,
0x42bdb0e8U, 0x8b880789U, 0x5b38e719U, 0xeedb79c8U,
0x0a47a17cU, 0x0fe97c42U, 0x1ec9f884U, 0x00000000U,
0x86830980U, 0xed48322bU, 0x70ac1e11U, 0x724e6c5aU,
0xfffbfd0eU, 0x38560f85U, 0xd51e3daeU, 0x3927362dU,
0xd9640a0fU, 0xa621685cU, 0x54d19b5bU, 0x2e3a2436U,
0x67b10c0aU, 0xe70f9357U, 0x96d2b4eeU, 0x919e1b9bU,
0xc54f80c0U, 0x20a261dcU, 0x4b695a77U, 0x1a161c12U,
0xba0ae293U, 0x2ae5c0a0U, 0xe0433c22U, 0x171d121bU,
0x0d0b0e09U, 0xc7adf28bU, 0xa8b92db6U, 0xa9c8141eU,
0x198557f1U, 0x074caf75U, 0xddbbee99U, 0x60fda37fU,
0x269ff701U, 0xf5bc5c72U, 0x3bc54466U, 0x7e345bfbU,
0x29768b43U, 0xc6dccb23U, 0xfc68b6edU, 0xf163b8e4U,
0xdccad731U, 0x85104263U, 0x22401397U, 0x112084c6U,
0x247d854aU, 0x3df8d2bbU, 0x3211aef9U, 0xa16dc729U,
0x2f4b1d9eU, 0x30f3dcb2U, 0x52ec0d86U, 0xe3d077c1U,
0x166c2bb3U, 0xb999a970U, 0x48fa1194U, 0x642247e9U,
0x8cc4a8fcU, 0x3f1aa0f0U, 0x2cd8567dU, 0x90ef2233U,
0x4ec78749U, 0xd1c1d938U, 0xa2fe8ccaU, 0x0b3698d4U,
0x81cfa6f5U, 0xde28a57aU, 0x8e26dab7U, 0xbfa43fadU,
0x9de42c3aU, 0x920d5078U, 0xcc9b6a5fU, 0x4662547eU,
0x13c2f68dU, 0xb8e890d8U, 0xf75e2e39U, 0xaff582c3U,
0x80be9f5dU, 0x937c69d0U, 0x2da96fd5U, 0x12b3cf25U,
0x993bc8acU, 0x7da71018U, 0x636ee89cU, 0xbb7bdb3bU,
0x7809cd26U, 0x18f46e59U, 0xb701ec9aU, 0x9aa8834fU,
0x6e65e695U, 0xe67eaaffU, 0xcf0821bcU, 0xe8e6ef15U,
0x9bd9bae7U, 0x36ce4a6fU, 0x09d4ea9fU, 0x7cd629b0U,
0xb2af31a4U, 0x23312a3fU, 0x9430c6a5U, 0x66c035a2U,
0xbc37744eU, 0xcaa6fc82U, 0xd0b0e090U, 0xd81533a7U,
0x984af104U, 0xdaf741ecU, 0x500e7fcdU, 0xf62f1791U,
0xd68d764dU, 0xb04d43efU, 0x4d54ccaaU, 0x04dfe496U,
0xb5e39ed1U, 0x881b4c6aU, 0x1fb8c12cU, 0x517f4665U,
0xea049d5eU, 0x355d018cU, 0x7473fa87U, 0x412efb0bU,
0x1d5ab367U, 0xd25292dbU, 0x5633e910U, 0x47136dd6U,
0x618c9ad7U, 0x0c7a37a1U, 0x148e59f8U, 0x3c89eb13U,
0x27eecea9U, 0xc935b761U, 0xe5ede11cU, 0xb13c7a47U,
0xdf599cd2U, 0x733f55f2U, 0xce791814U, 0x37bf73c7U,
0xcdea53f7U, 0xaa5b5ffdU, 0x6f14df3dU, 0xdb867844U,
0xf381caafU, 0xc43eb968U, 0x342c3824U, 0x405fc2a3U,
0xc372161dU, 0x250cbce2U, 0x498b283cU, 0x9541ff0dU,
0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U,
0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U,
};
static const u32 Td3[256] = {
0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU,
0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU,
0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U,
0xe5d7fc4fU, 0x2acbd7c5U, 0x35448026U, 0x62a38fb5U,
0xb15a49deU, 0xba1b6725U, 0xea0e9845U, 0xfec0e15dU,
0x2f7502c3U, 0x4cf01281U, 0x4697a38dU, 0xd3f9c66bU,
0x8f5fe703U, 0x929c9515U, 0x6d7aebbfU, 0x5259da95U,
0xbe832dd4U, 0x7421d358U, 0xe0692949U, 0xc9c8448eU,
0xc2896a75U, 0x8e7978f4U, 0x583e6b99U, 0xb971dd27U,
0xe14fb6beU, 0x88ad17f0U, 0x20ac66c9U, 0xce3ab47dU,
0xdf4a1863U, 0x1a3182e5U, 0x51336097U, 0x537f4562U,
0x6477e0b1U, 0x6bae84bbU, 0x81a01cfeU, 0x082b94f9U,
0x48685870U, 0x45fd198fU, 0xde6c8794U, 0x7bf8b752U,
0x73d323abU, 0x4b02e272U, 0x1f8f57e3U, 0x55ab2a66U,
0xeb2807b2U, 0xb5c2032fU, 0xc57b9a86U, 0x3708a5d3U,
0x2887f230U, 0xbfa5b223U, 0x036aba02U, 0x16825cedU,
0xcf1c2b8aU, 0x79b492a7U, 0x07f2f0f3U, 0x69e2a14eU,
0xdaf4cd65U, 0x05bed506U, 0x34621fd1U, 0xa6fe8ac4U,
0x2e539d34U, 0xf355a0a2U, 0x8ae13205U, 0xf6eb75a4U,
0x83ec390bU, 0x60efaa40U, 0x719f065eU, 0x6e1051bdU,
0x218af93eU, 0xdd063d96U, 0x3e05aeddU, 0xe6bd464dU,
0x548db591U, 0xc45d0571U, 0x06d46f04U, 0x5015ff60U,
0x98fb2419U, 0xbde997d6U, 0x4043cc89U, 0xd99e7767U,
0xe842bdb0U, 0x898b8807U, 0x195b38e7U, 0xc8eedb79U,
0x7c0a47a1U, 0x420fe97cU, 0x841ec9f8U, 0x00000000U,
0x80868309U, 0x2bed4832U, 0x1170ac1eU, 0x5a724e6cU,
0x0efffbfdU, 0x8538560fU, 0xaed51e3dU, 0x2d392736U,
0x0fd9640aU, 0x5ca62168U, 0x5b54d19bU, 0x362e3a24U,
0x0a67b10cU, 0x57e70f93U, 0xee96d2b4U, 0x9b919e1bU,
0xc0c54f80U, 0xdc20a261U, 0x774b695aU, 0x121a161cU,
0x93ba0ae2U, 0xa02ae5c0U, 0x22e0433cU, 0x1b171d12U,
0x090d0b0eU, 0x8bc7adf2U, 0xb6a8b92dU, 0x1ea9c814U,
0xf1198557U, 0x75074cafU, 0x99ddbbeeU, 0x7f60fda3U,
0x01269ff7U, 0x72f5bc5cU, 0x663bc544U, 0xfb7e345bU,
0x4329768bU, 0x23c6dccbU, 0xedfc68b6U, 0xe4f163b8U,
0x31dccad7U, 0x63851042U, 0x97224013U, 0xc6112084U,
0x4a247d85U, 0xbb3df8d2U, 0xf93211aeU, 0x29a16dc7U,
0x9e2f4b1dU, 0xb230f3dcU, 0x8652ec0dU, 0xc1e3d077U,
0xb3166c2bU, 0x70b999a9U, 0x9448fa11U, 0xe9642247U,
0xfc8cc4a8U, 0xf03f1aa0U, 0x7d2cd856U, 0x3390ef22U,
0x494ec787U, 0x38d1c1d9U, 0xcaa2fe8cU, 0xd40b3698U,
0xf581cfa6U, 0x7ade28a5U, 0xb78e26daU, 0xadbfa43fU,
0x3a9de42cU, 0x78920d50U, 0x5fcc9b6aU, 0x7e466254U,
0x8d13c2f6U, 0xd8b8e890U, 0x39f75e2eU, 0xc3aff582U,
0x5d80be9fU, 0xd0937c69U, 0xd52da96fU, 0x2512b3cfU,
0xac993bc8U, 0x187da710U, 0x9c636ee8U, 0x3bbb7bdbU,
0x267809cdU, 0x5918f46eU, 0x9ab701ecU, 0x4f9aa883U,
0x956e65e6U, 0xffe67eaaU, 0xbccf0821U, 0x15e8e6efU,
0xe79bd9baU, 0x6f36ce4aU, 0x9f09d4eaU, 0xb07cd629U,
0xa4b2af31U, 0x3f23312aU, 0xa59430c6U, 0xa266c035U,
0x4ebc3774U, 0x82caa6fcU, 0x90d0b0e0U, 0xa7d81533U,
0x04984af1U, 0xecdaf741U, 0xcd500e7fU, 0x91f62f17U,
0x4dd68d76U, 0xefb04d43U, 0xaa4d54ccU, 0x9604dfe4U,
0xd1b5e39eU, 0x6a881b4cU, 0x2c1fb8c1U, 0x65517f46U,
0x5eea049dU, 0x8c355d01U, 0x877473faU, 0x0b412efbU,
0x671d5ab3U, 0xdbd25292U, 0x105633e9U, 0xd647136dU,
0xd7618c9aU, 0xa10c7a37U, 0xf8148e59U, 0x133c89ebU,
0xa927eeceU, 0x61c935b7U, 0x1ce5ede1U, 0x47b13c7aU,
0xd2df599cU, 0xf2733f55U, 0x14ce7918U, 0xc737bf73U,
0xf7cdea53U, 0xfdaa5b5fU, 0x3d6f14dfU, 0x44db8678U,
0xaff381caU, 0x68c43eb9U, 0x24342c38U, 0xa3405fc2U,
0x1dc37216U, 0xe2250cbcU, 0x3c498b28U, 0x0d9541ffU,
0xa8017139U, 0x0cb3de08U, 0xb4e49cd8U, 0x56c19064U,
0xcb84617bU, 0x32b670d5U, 0x6c5c7448U, 0xb85742d0U,
};
static const u32 Td4[256] = {
0x52525252U, 0x09090909U, 0x6a6a6a6aU, 0xd5d5d5d5U,
0x30303030U, 0x36363636U, 0xa5a5a5a5U, 0x38383838U,
0xbfbfbfbfU, 0x40404040U, 0xa3a3a3a3U, 0x9e9e9e9eU,
0x81818181U, 0xf3f3f3f3U, 0xd7d7d7d7U, 0xfbfbfbfbU,
0x7c7c7c7cU, 0xe3e3e3e3U, 0x39393939U, 0x82828282U,
0x9b9b9b9bU, 0x2f2f2f2fU, 0xffffffffU, 0x87878787U,
0x34343434U, 0x8e8e8e8eU, 0x43434343U, 0x44444444U,
0xc4c4c4c4U, 0xdedededeU, 0xe9e9e9e9U, 0xcbcbcbcbU,
0x54545454U, 0x7b7b7b7bU, 0x94949494U, 0x32323232U,
0xa6a6a6a6U, 0xc2c2c2c2U, 0x23232323U, 0x3d3d3d3dU,
0xeeeeeeeeU, 0x4c4c4c4cU, 0x95959595U, 0x0b0b0b0bU,
0x42424242U, 0xfafafafaU, 0xc3c3c3c3U, 0x4e4e4e4eU,
0x08080808U, 0x2e2e2e2eU, 0xa1a1a1a1U, 0x66666666U,
0x28282828U, 0xd9d9d9d9U, 0x24242424U, 0xb2b2b2b2U,
0x76767676U, 0x5b5b5b5bU, 0xa2a2a2a2U, 0x49494949U,
0x6d6d6d6dU, 0x8b8b8b8bU, 0xd1d1d1d1U, 0x25252525U,
0x72727272U, 0xf8f8f8f8U, 0xf6f6f6f6U, 0x64646464U,
0x86868686U, 0x68686868U, 0x98989898U, 0x16161616U,
0xd4d4d4d4U, 0xa4a4a4a4U, 0x5c5c5c5cU, 0xccccccccU,
0x5d5d5d5dU, 0x65656565U, 0xb6b6b6b6U, 0x92929292U,
0x6c6c6c6cU, 0x70707070U, 0x48484848U, 0x50505050U,
0xfdfdfdfdU, 0xededededU, 0xb9b9b9b9U, 0xdadadadaU,
0x5e5e5e5eU, 0x15151515U, 0x46464646U, 0x57575757U,
0xa7a7a7a7U, 0x8d8d8d8dU, 0x9d9d9d9dU, 0x84848484U,
0x90909090U, 0xd8d8d8d8U, 0xababababU, 0x00000000U,
0x8c8c8c8cU, 0xbcbcbcbcU, 0xd3d3d3d3U, 0x0a0a0a0aU,
0xf7f7f7f7U, 0xe4e4e4e4U, 0x58585858U, 0x05050505U,
0xb8b8b8b8U, 0xb3b3b3b3U, 0x45454545U, 0x06060606U,
0xd0d0d0d0U, 0x2c2c2c2cU, 0x1e1e1e1eU, 0x8f8f8f8fU,
0xcacacacaU, 0x3f3f3f3fU, 0x0f0f0f0fU, 0x02020202U,
0xc1c1c1c1U, 0xafafafafU, 0xbdbdbdbdU, 0x03030303U,
0x01010101U, 0x13131313U, 0x8a8a8a8aU, 0x6b6b6b6bU,
0x3a3a3a3aU, 0x91919191U, 0x11111111U, 0x41414141U,
0x4f4f4f4fU, 0x67676767U, 0xdcdcdcdcU, 0xeaeaeaeaU,
0x97979797U, 0xf2f2f2f2U, 0xcfcfcfcfU, 0xcecececeU,
0xf0f0f0f0U, 0xb4b4b4b4U, 0xe6e6e6e6U, 0x73737373U,
0x96969696U, 0xacacacacU, 0x74747474U, 0x22222222U,
0xe7e7e7e7U, 0xadadadadU, 0x35353535U, 0x85858585U,
0xe2e2e2e2U, 0xf9f9f9f9U, 0x37373737U, 0xe8e8e8e8U,
0x1c1c1c1cU, 0x75757575U, 0xdfdfdfdfU, 0x6e6e6e6eU,
0x47474747U, 0xf1f1f1f1U, 0x1a1a1a1aU, 0x71717171U,
0x1d1d1d1dU, 0x29292929U, 0xc5c5c5c5U, 0x89898989U,
0x6f6f6f6fU, 0xb7b7b7b7U, 0x62626262U, 0x0e0e0e0eU,
0xaaaaaaaaU, 0x18181818U, 0xbebebebeU, 0x1b1b1b1bU,
0xfcfcfcfcU, 0x56565656U, 0x3e3e3e3eU, 0x4b4b4b4bU,
0xc6c6c6c6U, 0xd2d2d2d2U, 0x79797979U, 0x20202020U,
0x9a9a9a9aU, 0xdbdbdbdbU, 0xc0c0c0c0U, 0xfefefefeU,
0x78787878U, 0xcdcdcdcdU, 0x5a5a5a5aU, 0xf4f4f4f4U,
0x1f1f1f1fU, 0xddddddddU, 0xa8a8a8a8U, 0x33333333U,
0x88888888U, 0x07070707U, 0xc7c7c7c7U, 0x31313131U,
0xb1b1b1b1U, 0x12121212U, 0x10101010U, 0x59595959U,
0x27272727U, 0x80808080U, 0xececececU, 0x5f5f5f5fU,
0x60606060U, 0x51515151U, 0x7f7f7f7fU, 0xa9a9a9a9U,
0x19191919U, 0xb5b5b5b5U, 0x4a4a4a4aU, 0x0d0d0d0dU,
0x2d2d2d2dU, 0xe5e5e5e5U, 0x7a7a7a7aU, 0x9f9f9f9fU,
0x93939393U, 0xc9c9c9c9U, 0x9c9c9c9cU, 0xefefefefU,
0xa0a0a0a0U, 0xe0e0e0e0U, 0x3b3b3b3bU, 0x4d4d4d4dU,
0xaeaeaeaeU, 0x2a2a2a2aU, 0xf5f5f5f5U, 0xb0b0b0b0U,
0xc8c8c8c8U, 0xebebebebU, 0xbbbbbbbbU, 0x3c3c3c3cU,
0x83838383U, 0x53535353U, 0x99999999U, 0x61616161U,
0x17171717U, 0x2b2b2b2bU, 0x04040404U, 0x7e7e7e7eU,
0xbabababaU, 0x77777777U, 0xd6d6d6d6U, 0x26262626U,
0xe1e1e1e1U, 0x69696969U, 0x14141414U, 0x63636363U,
0x55555555U, 0x21212121U, 0x0c0c0c0cU, 0x7d7d7d7dU,
};
static const u32 rcon[] = {
0x01000000, 0x02000000, 0x04000000, 0x08000000,
0x10000000, 0x20000000, 0x40000000, 0x80000000,
0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */
};
#define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00)
#ifdef _MSC_VER
#define GETU32(p) SWAP(*((u32 *)(p)))
#define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); }
#else
#define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2] << 8) ^ ((u32)(pt)[3]))
#define PUTU32(ct, st) { (ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); (ct)[2] = (u8)((st) >> 8); (ct)[3] = (u8)(st); }
#endif
/**
* Expand the cipher key into the encryption key schedule.
*
* @return the number of rounds for the given cipher key size.
*/
static int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits) {
int i = 0;
u32 temp;
rk[0] = GETU32(cipherKey );
rk[1] = GETU32(cipherKey + 4);
rk[2] = GETU32(cipherKey + 8);
rk[3] = GETU32(cipherKey + 12);
if (keyBits == 128) {
for (;;) {
temp = rk[3];
rk[4] = rk[0] ^
(Te4[(temp >> 16) & 0xff] & 0xff000000) ^
(Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^
(Te4[(temp ) & 0xff] & 0x0000ff00) ^
(Te4[(temp >> 24) ] & 0x000000ff) ^
rcon[i];
rk[5] = rk[1] ^ rk[4];
rk[6] = rk[2] ^ rk[5];
rk[7] = rk[3] ^ rk[6];
if (++i == 10) {
return 10;
}
rk += 4;
}
}
rk[4] = GETU32(cipherKey + 16);
rk[5] = GETU32(cipherKey + 20);
if (keyBits == 192) {
for (;;) {
temp = rk[ 5];
rk[ 6] = rk[ 0] ^
(Te4[(temp >> 16) & 0xff] & 0xff000000) ^
(Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^
(Te4[(temp ) & 0xff] & 0x0000ff00) ^
(Te4[(temp >> 24) ] & 0x000000ff) ^
rcon[i];
rk[ 7] = rk[ 1] ^ rk[ 6];
rk[ 8] = rk[ 2] ^ rk[ 7];
rk[ 9] = rk[ 3] ^ rk[ 8];
if (++i == 8) {
return 12;
}
rk[10] = rk[ 4] ^ rk[ 9];
rk[11] = rk[ 5] ^ rk[10];
rk += 6;
}
}
rk[6] = GETU32(cipherKey + 24);
rk[7] = GETU32(cipherKey + 28);
if (keyBits == 256) {
for (;;) {
temp = rk[ 7];
rk[ 8] = rk[ 0] ^
(Te4[(temp >> 16) & 0xff] & 0xff000000) ^
(Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^
(Te4[(temp ) & 0xff] & 0x0000ff00) ^
(Te4[(temp >> 24) ] & 0x000000ff) ^
rcon[i];
rk[ 9] = rk[ 1] ^ rk[ 8];
rk[10] = rk[ 2] ^ rk[ 9];
rk[11] = rk[ 3] ^ rk[10];
if (++i == 7) {
return 14;
}
temp = rk[11];
rk[12] = rk[ 4] ^
(Te4[(temp >> 24) ] & 0xff000000) ^
(Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^
(Te4[(temp >> 8) & 0xff] & 0x0000ff00) ^
(Te4[(temp ) & 0xff] & 0x000000ff);
rk[13] = rk[ 5] ^ rk[12];
rk[14] = rk[ 6] ^ rk[13];
rk[15] = rk[ 7] ^ rk[14];
rk += 8;
}
}
return 0;
}
/**
* Expand the cipher key into the decryption key schedule.
*
* @return the number of rounds for the given cipher key size.
*/
static int rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits) {
int Nr, i, j;
u32 temp;
/* expand the cipher key: */
Nr = rijndaelKeySetupEnc(rk, cipherKey, keyBits);
/* invert the order of the round keys: */
for (i = 0, j = 4*Nr; i < j; i += 4, j -= 4) {
temp = rk[i ]; rk[i ] = rk[j ]; rk[j ] = temp;
temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp;
temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp;
temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp;
}
/* apply the inverse MixColumn transform to all round keys but the first and the last: */
for (i = 1; i < Nr; i++) {
rk += 4;
rk[0] =
Td0[Te4[(rk[0] >> 24) ] & 0xff] ^
Td1[Te4[(rk[0] >> 16) & 0xff] & 0xff] ^
Td2[Te4[(rk[0] >> 8) & 0xff] & 0xff] ^
Td3[Te4[(rk[0] ) & 0xff] & 0xff];
rk[1] =
Td0[Te4[(rk[1] >> 24) ] & 0xff] ^
Td1[Te4[(rk[1] >> 16) & 0xff] & 0xff] ^
Td2[Te4[(rk[1] >> 8) & 0xff] & 0xff] ^
Td3[Te4[(rk[1] ) & 0xff] & 0xff];
rk[2] =
Td0[Te4[(rk[2] >> 24) ] & 0xff] ^
Td1[Te4[(rk[2] >> 16) & 0xff] & 0xff] ^
Td2[Te4[(rk[2] >> 8) & 0xff] & 0xff] ^
Td3[Te4[(rk[2] ) & 0xff] & 0xff];
rk[3] =
Td0[Te4[(rk[3] >> 24) ] & 0xff] ^
Td1[Te4[(rk[3] >> 16) & 0xff] & 0xff] ^
Td2[Te4[(rk[3] >> 8) & 0xff] & 0xff] ^
Td3[Te4[(rk[3] ) & 0xff] & 0xff];
}
return Nr;
}
static void rijndaelEncrypt(u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 ct[16]) {
u32 s0, s1, s2, s3, t0, t1, t2, t3;
#ifndef FULL_UNROLL
int r;
#endif /* ?FULL_UNROLL */
/*
* map byte array block to cipher state
* and add initial round key:
*/
s0 = GETU32(pt ) ^ rk[0];
s1 = GETU32(pt + 4) ^ rk[1];
s2 = GETU32(pt + 8) ^ rk[2];
s3 = GETU32(pt + 12) ^ rk[3];
#ifdef FULL_UNROLL
/* round 1: */
t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[ 4];
t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[ 5];
t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[ 6];
t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[ 7];
/* round 2: */
s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[ 8];
s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[ 9];
s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[10];
s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[11];
/* round 3: */
t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[12];
t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[13];
t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[14];
t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[15];
/* round 4: */
s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[16];
s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[17];
s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[18];
s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[19];
/* round 5: */
t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[20];
t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[21];
t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[22];
t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[23];
/* round 6: */
s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[24];
s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[25];
s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[26];
s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[27];
/* round 7: */
t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[28];
t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[29];
t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[30];
t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[31];
/* round 8: */
s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[32];
s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[33];
s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[34];
s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[35];
/* round 9: */
t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[36];
t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[37];
t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[38];
t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[39];
if (Nr > 10) {
/* round 10: */
s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[40];
s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[41];
s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[42];
s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[43];
/* round 11: */
t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[44];
t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[45];
t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[46];
t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[47];
if (Nr > 12) {
/* round 12: */
s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[48];
s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[49];
s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[50];
s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[51];
/* round 13: */
t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[52];
t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[53];
t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[54];
t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[55];
}
}
rk += Nr << 2;
#else /* !FULL_UNROLL */
/*
* Nr - 1 full rounds:
*/
r = Nr >> 1;
for (;;) {
t0 =
Te0[(s0 >> 24) ] ^
Te1[(s1 >> 16) & 0xff] ^
Te2[(s2 >> 8) & 0xff] ^
Te3[(s3 ) & 0xff] ^
rk[4];
t1 =
Te0[(s1 >> 24) ] ^
Te1[(s2 >> 16) & 0xff] ^
Te2[(s3 >> 8) & 0xff] ^
Te3[(s0 ) & 0xff] ^
rk[5];
t2 =
Te0[(s2 >> 24) ] ^
Te1[(s3 >> 16) & 0xff] ^
Te2[(s0 >> 8) & 0xff] ^
Te3[(s1 ) & 0xff] ^
rk[6];
t3 =
Te0[(s3 >> 24) ] ^
Te1[(s0 >> 16) & 0xff] ^
Te2[(s1 >> 8) & 0xff] ^
Te3[(s2 ) & 0xff] ^
rk[7];
rk += 8;
if (--r == 0) {
break;
}
s0 =
Te0[(t0 >> 24) ] ^
Te1[(t1 >> 16) & 0xff] ^
Te2[(t2 >> 8) & 0xff] ^
Te3[(t3 ) & 0xff] ^
rk[0];
s1 =
Te0[(t1 >> 24) ] ^
Te1[(t2 >> 16) & 0xff] ^
Te2[(t3 >> 8) & 0xff] ^
Te3[(t0 ) & 0xff] ^
rk[1];
s2 =
Te0[(t2 >> 24) ] ^
Te1[(t3 >> 16) & 0xff] ^
Te2[(t0 >> 8) & 0xff] ^
Te3[(t1 ) & 0xff] ^
rk[2];
s3 =
Te0[(t3 >> 24) ] ^
Te1[(t0 >> 16) & 0xff] ^
Te2[(t1 >> 8) & 0xff] ^
Te3[(t2 ) & 0xff] ^
rk[3];
}
#endif /* ?FULL_UNROLL */
/*
* apply last round and
* map cipher state to byte array block:
*/
s0 =
(Te4[(t0 >> 24) ] & 0xff000000) ^
(Te4[(t1 >> 16) & 0xff] & 0x00ff0000) ^
(Te4[(t2 >> 8) & 0xff] & 0x0000ff00) ^
(Te4[(t3 ) & 0xff] & 0x000000ff) ^
rk[0];
PUTU32(ct , s0);
s1 =
(Te4[(t1 >> 24) ] & 0xff000000) ^
(Te4[(t2 >> 16) & 0xff] & 0x00ff0000) ^
(Te4[(t3 >> 8) & 0xff] & 0x0000ff00) ^
(Te4[(t0 ) & 0xff] & 0x000000ff) ^
rk[1];
PUTU32(ct + 4, s1);
s2 =
(Te4[(t2 >> 24) ] & 0xff000000) ^
(Te4[(t3 >> 16) & 0xff] & 0x00ff0000) ^
(Te4[(t0 >> 8) & 0xff] & 0x0000ff00) ^
(Te4[(t1 ) & 0xff] & 0x000000ff) ^
rk[2];
PUTU32(ct + 8, s2);
s3 =
(Te4[(t3 >> 24) ] & 0xff000000) ^
(Te4[(t0 >> 16) & 0xff] & 0x00ff0000) ^
(Te4[(t1 >> 8) & 0xff] & 0x0000ff00) ^
(Te4[(t2 ) & 0xff] & 0x000000ff) ^
rk[3];
PUTU32(ct + 12, s3);
}
static void rijndaelDecrypt(u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16], u8 pt[16]) {
u32 s0, s1, s2, s3, t0, t1, t2, t3;
#ifndef FULL_UNROLL
int r;
#endif /* ?FULL_UNROLL */
/*
* map byte array block to cipher state
* and add initial round key:
*/
s0 = GETU32(ct ) ^ rk[0];
s1 = GETU32(ct + 4) ^ rk[1];
s2 = GETU32(ct + 8) ^ rk[2];
s3 = GETU32(ct + 12) ^ rk[3];
#ifdef FULL_UNROLL
/* round 1: */
t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[ 4];
t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[ 5];
t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[ 6];
t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[ 7];
/* round 2: */
s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[ 8];
s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[ 9];
s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[10];
s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[11];
/* round 3: */
t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[12];
t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[13];
t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[14];
t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[15];
/* round 4: */
s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[16];
s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[17];
s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[18];
s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[19];
/* round 5: */
t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[20];
t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[21];
t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[22];
t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[23];
/* round 6: */
s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[24];
s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[25];
s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[26];
s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[27];
/* round 7: */
t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[28];
t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[29];
t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[30];
t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[31];
/* round 8: */
s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[32];
s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[33];
s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[34];
s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[35];
/* round 9: */
t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[36];
t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[37];
t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[38];
t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[39];
if (Nr > 10) {
/* round 10: */
s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[40];
s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[41];
s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[42];
s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[43];
/* round 11: */
t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[44];
t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[45];
t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[46];
t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[47];
if (Nr > 12) {
/* round 12: */
s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[48];
s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[49];
s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[50];
s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[51];
/* round 13: */
t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[52];
t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[53];
t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[54];
t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[55];
}
}
rk += Nr << 2;
#else /* !FULL_UNROLL */
/*
* Nr - 1 full rounds:
*/
r = Nr >> 1;
for (;;) {
t0 =
Td0[(s0 >> 24) ] ^
Td1[(s3 >> 16) & 0xff] ^
Td2[(s2 >> 8) & 0xff] ^
Td3[(s1 ) & 0xff] ^
rk[4];
t1 =
Td0[(s1 >> 24) ] ^
Td1[(s0 >> 16) & 0xff] ^
Td2[(s3 >> 8) & 0xff] ^
Td3[(s2 ) & 0xff] ^
rk[5];
t2 =
Td0[(s2 >> 24) ] ^
Td1[(s1 >> 16) & 0xff] ^
Td2[(s0 >> 8) & 0xff] ^
Td3[(s3 ) & 0xff] ^
rk[6];
t3 =
Td0[(s3 >> 24) ] ^
Td1[(s2 >> 16) & 0xff] ^
Td2[(s1 >> 8) & 0xff] ^
Td3[(s0 ) & 0xff] ^
rk[7];
rk += 8;
if (--r == 0) {
break;
}
s0 =
Td0[(t0 >> 24) ] ^
Td1[(t3 >> 16) & 0xff] ^
Td2[(t2 >> 8) & 0xff] ^
Td3[(t1 ) & 0xff] ^
rk[0];
s1 =
Td0[(t1 >> 24) ] ^
Td1[(t0 >> 16) & 0xff] ^
Td2[(t3 >> 8) & 0xff] ^
Td3[(t2 ) & 0xff] ^
rk[1];
s2 =
Td0[(t2 >> 24) ] ^
Td1[(t1 >> 16) & 0xff] ^
Td2[(t0 >> 8) & 0xff] ^
Td3[(t3 ) & 0xff] ^
rk[2];
s3 =
Td0[(t3 >> 24) ] ^
Td1[(t2 >> 16) & 0xff] ^
Td2[(t1 >> 8) & 0xff] ^
Td3[(t0 ) & 0xff] ^
rk[3];
}
#endif /* ?FULL_UNROLL */
/*
* apply last round and
* map cipher state to byte array block:
*/
s0 =
(Td4[(t0 >> 24) ] & 0xff000000) ^
(Td4[(t3 >> 16) & 0xff] & 0x00ff0000) ^
(Td4[(t2 >> 8) & 0xff] & 0x0000ff00) ^
(Td4[(t1 ) & 0xff] & 0x000000ff) ^
rk[0];
PUTU32(pt , s0);
s1 =
(Td4[(t1 >> 24) ] & 0xff000000) ^
(Td4[(t0 >> 16) & 0xff] & 0x00ff0000) ^
(Td4[(t3 >> 8) & 0xff] & 0x0000ff00) ^
(Td4[(t2 ) & 0xff] & 0x000000ff) ^
rk[1];
PUTU32(pt + 4, s1);
s2 =
(Td4[(t2 >> 24) ] & 0xff000000) ^
(Td4[(t1 >> 16) & 0xff] & 0x00ff0000) ^
(Td4[(t0 >> 8) & 0xff] & 0x0000ff00) ^
(Td4[(t3 ) & 0xff] & 0x000000ff) ^
rk[2];
PUTU32(pt + 8, s2);
s3 =
(Td4[(t3 >> 24) ] & 0xff000000) ^
(Td4[(t2 >> 16) & 0xff] & 0x00ff0000) ^
(Td4[(t1 >> 8) & 0xff] & 0x0000ff00) ^
(Td4[(t0 ) & 0xff] & 0x000000ff) ^
rk[3];
PUTU32(pt + 12, s3);
}
#ifdef INTERMEDIATE_VALUE_KAT
static void rijndaelEncryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], int rounds) {
int r;
u32 s0, s1, s2, s3, t0, t1, t2, t3;
/*
* map byte array block to cipher state
* and add initial round key:
*/
s0 = GETU32(block ) ^ rk[0];
s1 = GETU32(block + 4) ^ rk[1];
s2 = GETU32(block + 8) ^ rk[2];
s3 = GETU32(block + 12) ^ rk[3];
rk += 4;
/*
* Nr - 1 full rounds:
*/
for (r = (rounds < Nr ? rounds : Nr - 1); r > 0; r--) {
t0 =
Te0[(s0 >> 24) ] ^
Te1[(s1 >> 16) & 0xff] ^
Te2[(s2 >> 8) & 0xff] ^
Te3[(s3 ) & 0xff] ^
rk[0];
t1 =
Te0[(s1 >> 24) ] ^
Te1[(s2 >> 16) & 0xff] ^
Te2[(s3 >> 8) & 0xff] ^
Te3[(s0 ) & 0xff] ^
rk[1];
t2 =
Te0[(s2 >> 24) ] ^
Te1[(s3 >> 16) & 0xff] ^
Te2[(s0 >> 8) & 0xff] ^
Te3[(s1 ) &
gitextract_ibe0b64b/ ├── .bandit ├── .github/ │ └── workflows/ │ ├── build.yml │ └── ci.yml ├── .gitignore ├── .travis.yml ├── CHANGELOG ├── Dockerfile ├── Dockerfile.install-test ├── Dockerfile.install-test-arch ├── Dockerfile.install-test-fedora ├── Dockerfile.test ├── INSTALL ├── LICENSE.txt ├── MANIFEST.in ├── Makefile ├── README.md ├── VERSION ├── charm/ │ ├── __init__.py │ ├── adapters/ │ │ ├── __init__.py │ │ ├── abenc_adapt_hybrid.py │ │ ├── dabenc_adapt_hybrid.py │ │ ├── ibenc_adapt_hybrid.py │ │ ├── ibenc_adapt_identityhash.py │ │ ├── kpabenc_adapt_hybrid.py │ │ ├── pkenc_adapt_bchk05.py │ │ ├── pkenc_adapt_chk04.py │ │ ├── pkenc_adapt_hybrid.py │ │ └── pksig_adapt_naor01.py │ ├── core/ │ │ ├── __init__.py │ │ ├── benchmark/ │ │ │ ├── benchmark_util.c │ │ │ ├── benchmark_util.h │ │ │ ├── benchmarkmodule.c │ │ │ └── benchmarkmodule.h │ │ ├── crypto/ │ │ │ ├── AES/ │ │ │ │ └── AES.c │ │ │ ├── COMPILED_EXTENSION_MODULES_HERE │ │ │ ├── DES/ │ │ │ │ └── DES.c │ │ │ ├── DES3/ │ │ │ │ └── DES3.c │ │ │ ├── __init__.py │ │ │ └── cryptobase/ │ │ │ ├── XOR.c │ │ │ ├── _counter.c │ │ │ ├── _counter.h │ │ │ ├── block_template.c │ │ │ ├── block_template.h │ │ │ ├── cryptobasemodule.c │ │ │ ├── libtom/ │ │ │ │ ├── tomcrypt.h │ │ │ │ ├── tomcrypt_argchk.h │ │ │ │ ├── tomcrypt_cfg.h │ │ │ │ ├── tomcrypt_cipher.h │ │ │ │ ├── tomcrypt_custom.h │ │ │ │ ├── tomcrypt_des.c │ │ │ │ ├── tomcrypt_hash.h │ │ │ │ ├── tomcrypt_mac.h │ │ │ │ ├── tomcrypt_macros.h │ │ │ │ ├── tomcrypt_math.h │ │ │ │ ├── tomcrypt_misc.h │ │ │ │ ├── tomcrypt_pk.h │ │ │ │ ├── tomcrypt_pkcs.h │ │ │ │ └── tomcrypt_prng.h │ │ │ ├── stream_template.c │ │ │ └── strxor.c │ │ ├── engine/ │ │ │ ├── __init__.py │ │ │ ├── protocol.py │ │ │ └── util.py │ │ ├── math/ │ │ │ ├── COMPILED_EXTENSION_MODULES_HERE │ │ │ ├── __init__.py │ │ │ ├── elliptic_curve/ │ │ │ │ ├── ecmodule.c │ │ │ │ └── ecmodule.h │ │ │ ├── elliptic_curve.pyi │ │ │ ├── integer/ │ │ │ │ ├── integermodule.c │ │ │ │ └── integermodule.h │ │ │ ├── integer.pyi │ │ │ ├── pairing/ │ │ │ │ ├── miracl/ │ │ │ │ │ ├── bn_pair.patch │ │ │ │ │ ├── compile_miracl.sh │ │ │ │ │ ├── miracl_config.h │ │ │ │ │ ├── miracl_interface.cc │ │ │ │ │ ├── miracl_interface.h │ │ │ │ │ ├── miracl_interface2.cc │ │ │ │ │ ├── miracl_interface2.h │ │ │ │ │ ├── mnt_pair.patch │ │ │ │ │ ├── pairing1.patch │ │ │ │ │ ├── pairingmodule2.c │ │ │ │ │ ├── pairingmodule2.h │ │ │ │ │ └── ssp_pair.patch │ │ │ │ ├── pairingmodule.c │ │ │ │ ├── pairingmodule.h │ │ │ │ └── relic/ │ │ │ │ ├── buildRELIC.sh │ │ │ │ ├── pairingmodule3.c │ │ │ │ ├── pairingmodule3.h │ │ │ │ ├── relic_interface.c │ │ │ │ ├── relic_interface.h │ │ │ │ └── test_relic.c │ │ │ └── pairing.pyi │ │ └── utilities/ │ │ ├── base64.c │ │ └── base64.h │ ├── schemes/ │ │ ├── __init__.py │ │ ├── abenc/ │ │ │ ├── __init__.py │ │ │ ├── abenc_accountability_jyjxgd20.py │ │ │ ├── abenc_bsw07.py │ │ │ ├── abenc_ca_cpabe_ar17.py │ │ │ ├── abenc_dacmacs_yj14.py │ │ │ ├── abenc_lsw08.py │ │ │ ├── abenc_maabe_rw15.py │ │ │ ├── abenc_maabe_yj14.py │ │ │ ├── abenc_tbpre_lww14.py │ │ │ ├── abenc_unmcpabe_yahk14.py │ │ │ ├── abenc_waters09.py │ │ │ ├── abenc_yct14.py │ │ │ ├── abenc_yllc15.py │ │ │ ├── ac17.py │ │ │ ├── bsw07.py │ │ │ ├── cgw15.py │ │ │ ├── dabe_aw11.py │ │ │ ├── dfa_fe12.py │ │ │ ├── pk_hve08.py │ │ │ └── waters11.py │ │ ├── aggrsign_MuSig.py │ │ ├── aggrsign_bls.py │ │ ├── blindsig_ps16.py │ │ ├── chamhash_adm05.py │ │ ├── chamhash_rsa_hw09.py │ │ ├── commit/ │ │ │ ├── __init__.py │ │ │ ├── commit_gs08.py │ │ │ └── commit_pedersen92.py │ │ ├── encap_bchk05.py │ │ ├── grpsig/ │ │ │ ├── __init__.py │ │ │ ├── groupsig_bgls04.py │ │ │ └── groupsig_bgls04_var.py │ │ ├── hibenc/ │ │ │ ├── __init__.py │ │ │ ├── hibenc_bb04.py │ │ │ └── hibenc_lew11.py │ │ ├── ibenc/ │ │ │ ├── __init__.py │ │ │ ├── clpkc_rp03.py │ │ │ ├── ibenc_CW13_z.py │ │ │ ├── ibenc_bb03.py │ │ │ ├── ibenc_bf01.py │ │ │ ├── ibenc_ckrs09.py │ │ │ ├── ibenc_cllww12_z.py │ │ │ ├── ibenc_lsw08.py │ │ │ ├── ibenc_sw05.py │ │ │ ├── ibenc_waters05.py │ │ │ ├── ibenc_waters05_z.py │ │ │ ├── ibenc_waters09.py │ │ │ └── ibenc_waters09_z.py │ │ ├── joye_scheme.py │ │ ├── lem_scheme.py │ │ ├── pk_fre_ccv11.py │ │ ├── pk_vrf.py │ │ ├── pkenc/ │ │ │ ├── __init__.py │ │ │ ├── pkenc_cs98.py │ │ │ ├── pkenc_elgamal85.py │ │ │ ├── pkenc_gm82.py │ │ │ ├── pkenc_paillier99.py │ │ │ ├── pkenc_rabin.py │ │ │ └── pkenc_rsa.py │ │ ├── pksig/ │ │ │ ├── __init__.py │ │ │ ├── pksig_CW13_z.py │ │ │ ├── pksig_bls04.py │ │ │ ├── pksig_boyen.py │ │ │ ├── pksig_chch.py │ │ │ ├── pksig_chp.py │ │ │ ├── pksig_cl03.py │ │ │ ├── pksig_cl04.py │ │ │ ├── pksig_cllww12_z.py │ │ │ ├── pksig_cyh.py │ │ │ ├── pksig_dsa.py │ │ │ ├── pksig_ecdsa.py │ │ │ ├── pksig_hess.py │ │ │ ├── pksig_hw.py │ │ │ ├── pksig_lamport.py │ │ │ ├── pksig_ps01.py │ │ │ ├── pksig_ps02.py │ │ │ ├── pksig_ps03.py │ │ │ ├── pksig_rsa_hw09.py │ │ │ ├── pksig_schnorr91.py │ │ │ ├── pksig_waters.py │ │ │ ├── pksig_waters05.py │ │ │ └── pksig_waters09.py │ │ ├── pre_mg07.py │ │ ├── prenc/ │ │ │ ├── pre_afgh06.py │ │ │ ├── pre_bbs98.py │ │ │ └── pre_nal16.py │ │ ├── protocol_a01.py │ │ ├── protocol_ao00.py │ │ ├── protocol_cns07.py │ │ ├── protocol_schnorr91.py │ │ ├── sigma1.py │ │ ├── sigma2.py │ │ ├── sigma3.py │ │ └── threshold/ │ │ ├── __init__.py │ │ ├── cggmp21_dkg.py │ │ ├── cggmp21_presign.py │ │ ├── cggmp21_proofs.py │ │ ├── cggmp21_sign.py │ │ ├── dkls23_dkg.py │ │ ├── dkls23_presign.py │ │ ├── dkls23_sign.py │ │ ├── gg18_dkg.py │ │ ├── gg18_sign.py │ │ └── xrpl_wallet.py │ ├── test/ │ │ ├── __init__.py │ │ ├── adapters/ │ │ │ ├── __init__.py │ │ │ ├── abenc_adapt_hybrid_test.py │ │ │ ├── dabenc_adapt_hybrid_test.py │ │ │ ├── ibenc_adapt_hybrid_test.py │ │ │ ├── ibenc_adapt_identityhash_test.py │ │ │ └── kpabenc_adapt_hybrid_test.py │ │ ├── benchmark/ │ │ │ ├── abenc_yllc15_bench.py │ │ │ └── benchmark_test.py │ │ ├── benchmark_threshold.py │ │ ├── conftest.py │ │ ├── fuzz/ │ │ │ ├── README.md │ │ │ ├── __init__.py │ │ │ ├── conftest.py │ │ │ ├── fuzz_policy_parser.py │ │ │ └── fuzz_serialization.py │ │ ├── schemes/ │ │ │ ├── __init__.py │ │ │ ├── abenc/ │ │ │ │ ├── __init__.py │ │ │ │ ├── abenc_bsw07_test.py │ │ │ │ ├── abenc_dacmacs_yj14_test.py │ │ │ │ ├── abenc_lsw08_test.py │ │ │ │ ├── abenc_maabe_yj14_test.py │ │ │ │ ├── abenc_tbpre_lww14_test.py │ │ │ │ ├── abenc_waters09_test.py │ │ │ │ └── abenc_yllc15_test.py │ │ │ ├── chamhash_adm05_test.py │ │ │ ├── chamhash_rsa_hw09_test.py │ │ │ ├── commit/ │ │ │ │ ├── __init__.py │ │ │ │ ├── commit_gs08_test.py │ │ │ │ └── commit_pedersen92_test.py │ │ │ ├── dabe_aw11_test.py │ │ │ ├── encap_bchk05_test.py │ │ │ ├── grpsig/ │ │ │ │ ├── __init__.py │ │ │ │ ├── groupsig_bgls04_test.py │ │ │ │ └── groupsig_bgls04_var_test.py │ │ │ ├── hibenc/ │ │ │ │ ├── __init__.py │ │ │ │ └── hibenc_bb04_test.py │ │ │ ├── ibenc/ │ │ │ │ ├── __init__.py │ │ │ │ ├── ibenc_bb03_test.py │ │ │ │ ├── ibenc_bf01_test.py │ │ │ │ ├── ibenc_ckrs09_test.py │ │ │ │ ├── ibenc_lsw08_test.py │ │ │ │ ├── ibenc_sw05_test.py │ │ │ │ ├── ibenc_waters05_test.py │ │ │ │ └── ibenc_waters09_test.py │ │ │ ├── pk_vrf_test.py │ │ │ ├── pkenc/ │ │ │ │ └── __init__.py │ │ │ ├── pkenc_test.py │ │ │ ├── pksig/ │ │ │ │ └── __init__.py │ │ │ ├── pksig_test.py │ │ │ ├── rsa_alg_test.py │ │ │ └── threshold_test.py │ │ ├── serialize/ │ │ │ ├── __init__.py │ │ │ └── serialize_test.py │ │ ├── toolbox/ │ │ │ ├── __init__.py │ │ │ ├── conversion_test.py │ │ │ ├── ecgroup_test.py │ │ │ ├── integer_arithmetic_test.py │ │ │ ├── paddingschemes_test.py │ │ │ ├── policy_parser_stress_test.py │ │ │ ├── secretshare_test.py │ │ │ ├── symcrypto_test.py │ │ │ └── test_policy_expression.py │ │ ├── vectors/ │ │ │ ├── __init__.py │ │ │ ├── test_bls_vectors.py │ │ │ ├── test_pedersen_vectors.py │ │ │ └── test_schnorr_vectors.py │ │ └── zkp_compiler/ │ │ ├── __init__.py │ │ ├── benchmark_zkp.py │ │ ├── test_and_proof.py │ │ ├── test_batch_verify.py │ │ ├── test_dleq_proof.py │ │ ├── test_or_proof.py │ │ ├── test_proof_serialization.py │ │ ├── test_range_proof.py │ │ ├── test_representation_proof.py │ │ ├── test_schnorr_proof.py │ │ ├── test_thread_safety.py │ │ └── test_zkp_parser.py │ ├── toolbox/ │ │ ├── ABEnc.py │ │ ├── ABEncMultiAuth.py │ │ ├── ABEnumeric.py │ │ ├── Commit.py │ │ ├── DFA.py │ │ ├── FSA.py │ │ ├── Hash.py │ │ ├── IBEnc.py │ │ ├── IBSig.py │ │ ├── PKEnc.py │ │ ├── PKSig.py │ │ ├── PREnc.py │ │ ├── ZKProof.py │ │ ├── __init__.py │ │ ├── bitstring.py │ │ ├── broadcast.py │ │ ├── conversion.py │ │ ├── eccurve.py │ │ ├── ecgroup.py │ │ ├── enum.py │ │ ├── hash_module.py │ │ ├── integergroup.py │ │ ├── iterate.py │ │ ├── matrixops.py │ │ ├── mpc_utils.py │ │ ├── msp.py │ │ ├── mta.py │ │ ├── node.py │ │ ├── ot/ │ │ │ ├── __init__.py │ │ │ ├── base_ot.py │ │ │ ├── dpf.py │ │ │ ├── mpfss.py │ │ │ ├── ot_extension.py │ │ │ └── silent_ot.py │ │ ├── paddingschemes.py │ │ ├── paddingschemes_test.py │ │ ├── paillier_mta.py │ │ ├── paillier_zkproofs.py │ │ ├── pairingcurves.py │ │ ├── pairinggroup.py │ │ ├── policy_expression_spec.py │ │ ├── policytree.py │ │ ├── reCompiler.py │ │ ├── redundancyschemes.py │ │ ├── schemebase.py │ │ ├── secretshare.py │ │ ├── secretutil.py │ │ ├── securerandom.py │ │ ├── sigmaprotocol.py │ │ ├── specialprimes.py │ │ ├── symcrypto.py │ │ ├── threshold_sharing.py │ │ ├── xmlserialize.py │ │ └── zknode.py │ └── zkp_compiler/ │ ├── __init__.py │ ├── and_proof.py │ ├── batch_verify.py │ ├── dleq_proof.py │ ├── or_proof.py │ ├── range_proof.py │ ├── representation_proof.py │ ├── schnorr_proof.py │ ├── thread_safe.py │ ├── zk_demo.py │ ├── zkp_factory.py │ ├── zkp_generator.py │ └── zkparser.py ├── config.dist.py ├── configure.sh ├── conftest.py ├── deps/ │ ├── Makefile │ ├── pbc/ │ │ ├── Makefile │ │ └── download_libpbc.sh │ └── relic/ │ ├── .gitignore │ ├── Makefile │ ├── build_configs.py │ ├── get_relic_source.sh │ └── run_install_clean.sh ├── doc/ │ ├── Makefile │ ├── autoschemes.py │ ├── config.py │ ├── source/ │ │ ├── adapters.rst │ │ ├── charm/ │ │ │ ├── adapters/ │ │ │ │ ├── abenc_adapt_hybrid.rst │ │ │ │ ├── dabenc_adapt_hybrid.rst │ │ │ │ ├── ibenc_adapt_hybrid.rst │ │ │ │ ├── ibenc_adapt_identityhash.rst │ │ │ │ ├── kpabenc_adapt_hybrid.rst │ │ │ │ ├── pkenc_adapt_bchk05.rst │ │ │ │ ├── pkenc_adapt_chk04.rst │ │ │ │ ├── pkenc_adapt_hybrid.rst │ │ │ │ └── pksig_adapt_naor01.rst │ │ │ └── schemes/ │ │ │ ├── abenc/ │ │ │ │ ├── abenc_accountability_jyjxgd20.rst │ │ │ │ ├── abenc_bsw07.rst │ │ │ │ ├── abenc_ca_cpabe_ar17.rst │ │ │ │ ├── abenc_dacmacs_yj14.rst │ │ │ │ ├── abenc_lsw08.rst │ │ │ │ ├── abenc_maabe_rw15.rst │ │ │ │ ├── abenc_maabe_yj14.rst │ │ │ │ ├── abenc_tbpre_lww14.rst │ │ │ │ ├── abenc_unmcpabe_yahk14.rst │ │ │ │ ├── abenc_waters09.rst │ │ │ │ ├── abenc_yct14.rst │ │ │ │ ├── abenc_yllc15.rst │ │ │ │ ├── ac17.rst │ │ │ │ ├── bsw07.rst │ │ │ │ ├── cgw15.rst │ │ │ │ ├── dabe_aw11.rst │ │ │ │ ├── dfa_fe12.rst │ │ │ │ ├── pk_hve08.rst │ │ │ │ └── waters11.rst │ │ │ ├── aggrsign_MuSig.rst │ │ │ ├── aggrsign_bls.rst │ │ │ ├── blindsig_ps16.rst │ │ │ ├── chamhash_adm05.rst │ │ │ ├── chamhash_rsa_hw09.rst │ │ │ ├── encap_bchk05.rst │ │ │ ├── joye_scheme.rst │ │ │ ├── lem_scheme.rst │ │ │ ├── pk_vrf.rst │ │ │ ├── pkenc/ │ │ │ │ ├── pkenc_cs98.rst │ │ │ │ ├── pkenc_elgamal85.rst │ │ │ │ ├── pkenc_gm82.rst │ │ │ │ ├── pkenc_paillier99.rst │ │ │ │ ├── pkenc_rabin.rst │ │ │ │ └── pkenc_rsa.rst │ │ │ ├── pksig/ │ │ │ │ ├── pksig_CW13_z.rst │ │ │ │ ├── pksig_bls04.rst │ │ │ │ ├── pksig_boyen.rst │ │ │ │ ├── pksig_chch.rst │ │ │ │ ├── pksig_chp.rst │ │ │ │ ├── pksig_cl03.rst │ │ │ │ ├── pksig_cl04.rst │ │ │ │ ├── pksig_cllww12_z.rst │ │ │ │ ├── pksig_cyh.rst │ │ │ │ ├── pksig_dsa.rst │ │ │ │ ├── pksig_ecdsa.rst │ │ │ │ ├── pksig_hess.rst │ │ │ │ ├── pksig_hw.rst │ │ │ │ ├── pksig_lamport.rst │ │ │ │ ├── pksig_ps01.rst │ │ │ │ ├── pksig_ps02.rst │ │ │ │ ├── pksig_ps03.rst │ │ │ │ ├── pksig_rsa_hw09.rst │ │ │ │ ├── pksig_schnorr91.rst │ │ │ │ ├── pksig_waters.rst │ │ │ │ ├── pksig_waters05.rst │ │ │ │ └── pksig_waters09.rst │ │ │ ├── pre_mg07.rst │ │ │ ├── protocol_a01.rst │ │ │ ├── protocol_ao00.rst │ │ │ ├── protocol_cns07.rst │ │ │ ├── protocol_schnorr91.rst │ │ │ ├── sigma1.rst │ │ │ ├── sigma2.rst │ │ │ └── sigma3.rst │ │ ├── conf.py │ │ ├── cryptographers.rst │ │ ├── developers.rst │ │ ├── index.rst │ │ ├── install_source.rst │ │ ├── miracl.rst │ │ ├── mobile.rst │ │ ├── release_notes.rst │ │ ├── relic.rst │ │ ├── schemes.rst │ │ ├── test/ │ │ │ ├── chamhash_adm05_test.rst │ │ │ ├── chamhash_rsa_hw09_test.rst │ │ │ ├── conversion_test.rst │ │ │ ├── dabe_aw11_test.rst │ │ │ ├── ecgroup_test.rst │ │ │ ├── encap_bchk05_test.rst │ │ │ ├── integer_arithmetic_test.rst │ │ │ ├── paddingschemes_test.rst │ │ │ ├── pk_vrf_test.rst │ │ │ ├── pkenc_test.rst │ │ │ ├── pksig_test.rst │ │ │ ├── policy_parser_stress_test.rst │ │ │ ├── rsa_alg_test.rst │ │ │ ├── secretshare_test.rst │ │ │ ├── symcrypto_test.rst │ │ │ ├── test_policy_expression.rst │ │ │ └── threshold_test.rst │ │ ├── test_schemes.rst │ │ ├── test_toolbox.rst │ │ ├── test_vectors.rst │ │ ├── threshold.rst │ │ ├── toolbox/ │ │ │ ├── ABEnc.rst │ │ │ ├── ABEncMultiAuth.rst │ │ │ ├── ABEnumeric.rst │ │ │ ├── Commit.rst │ │ │ ├── DFA.rst │ │ │ ├── FSA.rst │ │ │ ├── Hash.rst │ │ │ ├── IBEnc.rst │ │ │ ├── IBSig.rst │ │ │ ├── PKEnc.rst │ │ │ ├── PKSig.rst │ │ │ ├── PREnc.rst │ │ │ ├── ZKProof.rst │ │ │ ├── bitstring.rst │ │ │ ├── broadcast.rst │ │ │ ├── conversion.rst │ │ │ ├── eccurve.rst │ │ │ ├── ecgroup.rst │ │ │ ├── enum.rst │ │ │ ├── hash_module.rst │ │ │ ├── integergroup.rst │ │ │ ├── iterate.rst │ │ │ ├── matrixops.rst │ │ │ ├── mpc_utils.rst │ │ │ ├── msp.rst │ │ │ ├── mta.rst │ │ │ ├── node.rst │ │ │ ├── paddingschemes.rst │ │ │ ├── paillier_mta.rst │ │ │ ├── paillier_zkproofs.rst │ │ │ ├── pairingcurves.rst │ │ │ ├── pairinggroup.rst │ │ │ ├── policy_expression_spec.rst │ │ │ ├── policytree.rst │ │ │ ├── reCompiler.rst │ │ │ ├── redundancyschemes.rst │ │ │ ├── schemebase.rst │ │ │ ├── secretshare.rst │ │ │ ├── secretutil.rst │ │ │ ├── securerandom.rst │ │ │ ├── sigmaprotocol.rst │ │ │ ├── specialprimes.rst │ │ │ ├── symcrypto.rst │ │ │ ├── xmlserialize.rst │ │ │ └── zknode.rst │ │ ├── toolbox.rst │ │ ├── tutorial.rst │ │ ├── updates.rst │ │ ├── updates_050.rst │ │ ├── updates_060.rst │ │ ├── updates_061.rst │ │ ├── updates_062.rst │ │ └── zkp_compiler.rst │ └── zkp_proof_types_design.md ├── docker/ │ ├── README.md │ ├── build.sh │ ├── debug-test.sh │ └── test.sh ├── docker-compose.test.yml ├── embed/ │ ├── Makefile │ ├── README.md │ ├── charm_embed_api.c │ ├── charm_embed_api.h │ ├── charm_embed_api.o │ ├── test │ ├── test.c │ └── test.o ├── examples/ │ └── xrpl_memo_demo.py ├── install.sh ├── installers/ │ ├── deb.installer/ │ │ └── create_deb.py │ ├── osx.installer/ │ │ ├── Charm Crypto.pkgproj │ │ ├── build-charm-dmg.sh │ │ ├── build-osx-installer.sh │ │ └── packages-src/ │ │ ├── Introduction.rtf │ │ ├── License.rtf │ │ ├── README-OSX.rtf │ │ ├── README.rtf │ │ ├── RunAtStartup.sh │ │ ├── charm-crypto-dmg-background-working.xcf │ │ ├── charm-usr-folders-working.xcf │ │ └── charm.pth │ └── win.installer/ │ ├── EnvVarUpdate.nsh │ ├── charm-exe-script.nsi │ ├── charm.pth │ ├── lgpl.txt │ └── update-nsis-charm-version.py ├── pyproject.toml ├── pytest.ini ├── requirements.txt ├── setup.cfg ├── setup.py └── tox.ini
Showing preview only (286K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (3622 symbols across 282 files)
FILE: charm/adapters/abenc_adapt_hybrid.py
class HybridABEnc (line 31) | class HybridABEnc(ABEnc):
method __init__ (line 44) | def __init__(self, scheme, groupObj):
method setup (line 50) | def setup(self):
method keygen (line 53) | def keygen(self, pk, mk, object):
method encrypt (line 56) | def encrypt(self, pk, M, object):
method decrypt (line 64) | def decrypt(self, pk, sk, ct):
function main (line 72) | def main():
FILE: charm/adapters/dabenc_adapt_hybrid.py
class HybridABEncMA (line 29) | class HybridABEncMA(ABEncMultiAuth):
method __init__ (line 68) | def __init__(self, scheme, groupObj):
method setup (line 74) | def setup(self):
method authsetup (line 77) | def authsetup(self, gp, attributes):
method keygen (line 80) | def keygen(self, gp, sk, i, gid, pkey):
method encrypt (line 83) | def encrypt(self, gp, pk, M, policy_str):
method decrypt (line 93) | def decrypt(self, gp, sk, ct):
function main (line 101) | def main():
FILE: charm/adapters/ibenc_adapt_hybrid.py
class HybridIBEnc (line 30) | class HybridIBEnc(IBEnc):
method __init__ (line 47) | def __init__(self, scheme, groupObj):
method setup (line 52) | def setup(self):
method extract (line 55) | def extract(self, mk, ID):
method encrypt (line 58) | def encrypt(self, pk, ID, M):
method decrypt (line 67) | def decrypt(self, pk, ID, ct):
FILE: charm/adapters/ibenc_adapt_identityhash.py
class HashIDAdapter (line 26) | class HashIDAdapter(IBEnc):
method __init__ (line 41) | def __init__(self, scheme, group):
method setup (line 56) | def setup(self):
method extract (line 60) | def extract(self, mk, ID):
method encrypt (line 69) | def encrypt(self, pk, ID, msg):
method decrypt (line 77) | def decrypt(self, pk, sk, ct):
FILE: charm/adapters/kpabenc_adapt_hybrid.py
class HybridABEnc (line 29) | class HybridABEnc(ABEnc):
method __init__ (line 45) | def __init__(self, scheme, groupObj):
method setup (line 52) | def setup(self):
method keygen (line 55) | def keygen(self, pk, mk, object):
method encrypt (line 58) | def encrypt(self, pk, M, object):
method decrypt (line 66) | def decrypt(self, ct, sk):
function main (line 72) | def main():
FILE: charm/adapters/pkenc_adapt_bchk05.py
class BCHKIBEnc (line 28) | class BCHKIBEnc(IBEnc):
method str_XOR (line 43) | def str_XOR(self, m, k):
method elmtToString (line 56) | def elmtToString(self, g, length):
method __init__ (line 64) | def __init__(self, scheme, groupObj, encscheme):
method keygen (line 70) | def keygen(self):
method encrypt (line 77) | def encrypt(self, pk, m):
method decrypt (line 103) | def decrypt(self, pk, sk, c):
FILE: charm/adapters/pkenc_adapt_chk04.py
class CHK04 (line 28) | class CHK04(PKEnc):
method __init__ (line 45) | def __init__(self, ibe_scheme, ots_scheme, groupObj):
method keygen (line 60) | def keygen(self, secparam):
method encrypt (line 67) | def encrypt(self, pk, message):
method decrypt (line 80) | def decrypt(self, pk, sk, c):
FILE: charm/adapters/pkenc_adapt_hybrid.py
class HybridEnc (line 34) | class HybridEnc(PKEnc):
method __init__ (line 46) | def __init__(self, pkenc, msg_len=16, key_len=16, mode=AES):
method keygen (line 56) | def keygen(self, secparam=None):
method encrypt (line 63) | def encrypt(self, pk, M):
method decrypt (line 74) | def decrypt(self, pk, sk, ct):
function main (line 82) | def main():
FILE: charm/adapters/pksig_adapt_naor01.py
class Sig_Generic_ibetosig_Naor01 (line 31) | class Sig_Generic_ibetosig_Naor01(PKSig):
method __init__ (line 46) | def __init__(self, ibe_scheme, groupObj):
method keygen (line 60) | def keygen(self):
method sign (line 67) | def sign(self, sk, m):
method verify (line 71) | def verify(self, pk, m, sig):
FILE: charm/core/benchmark/benchmark_util.c
function PyObject (line 4) | PyObject *Benchmark_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
function Benchmark_init (line 21) | int Benchmark_init(Benchmark *self, PyObject *args, PyObject *kwds)
function Benchmark_dealloc (line 26) | void Benchmark_dealloc(Benchmark *self) {
function Operations_dealloc (line 74) | void Operations_dealloc(Operations *self)
function PyObject (line 80) | PyObject *Operations_new(PyTypeObject *type, PyObject *args, PyObject *k...
function Operations_init (line 91) | int Operations_init(Operations *self, PyObject *args, PyObject *kwds)
function PyObject (line 139) | PyObject *InitBenchmark(PyObject *self, PyObject *args) {
function PyObject (line 195) | PyObject *StartBenchmark(PyObject *self, PyObject *args)
function PyObject (line 222) | PyObject *EndBenchmark(PyObject *self, PyObject *args)
function PyObject (line 243) | PyObject *GetAllBenchmarks(PyObject *self, PyObject *args)
function PyObject (line 269) | PyObject *GetBenchmark(PyObject *self, PyObject *args) {
function PyObject (line 292) | static PyObject *GranularBenchmark(PyObject *self, PyObject *args)
FILE: charm/core/benchmark/benchmarkmodule.c
function CalcUsecs (line 9) | double CalcUsecs(struct timeval *start, struct timeval *stop) {
function check_option (line 28) | int check_option(MeasureType o, Benchmark *d) {
function PyObject (line 41) | PyObject *Benchmark_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
function Benchmark_init (line 58) | int Benchmark_init(Benchmark *self, PyObject *args, PyObject *kwds)
function Benchmark_dealloc (line 63) | void Benchmark_dealloc(Benchmark *self) {
function PyStartBenchmark (line 68) | static int PyStartBenchmark(Benchmark *data, PyObject *opList, int opLis...
function PyEndBenchmark (line 155) | static int PyEndBenchmark(Benchmark *data)
function PyUpdateBenchmark (line 190) | static int PyUpdateBenchmark(MeasureType option, Benchmark *data) {
function PyClearBenchmark (line 218) | static int PyClearBenchmark(Benchmark *data) {
function PyObject (line 235) | PyObject *Benchmark_print(Benchmark *self) {
function PyObject (line 248) | PyObject *GetResults(Benchmark *self) {
function PyObject (line 259) | PyObject *GetResultsWithPair(Benchmark *self) {
function PyObject (line 271) | PyObject *Retrieve_result(Benchmark *self, char *option) {
type module_state (line 391) | struct module_state {
type module_state (line 399) | struct module_state
function bm_traverse (line 408) | static int bm_traverse(PyObject *m, visitproc visit, void *arg) {
function bm_clear (line 413) | static int bm_clear(PyObject *m) {
type PyModuleDef (line 418) | struct PyModuleDef
type module_state (line 422) | struct module_state
function initbenchmark (line 435) | void initbenchmark(void) {
FILE: charm/core/benchmark/benchmarkmodule.h
type Measure (line 64) | enum Measure {CPU_TIME = 0, REAL_TIME, NATIVE_TIME, ADDITION, SUBTRACTIO...
type MeasureType (line 65) | typedef enum Measure MeasureType;
type Benchmark (line 76) | typedef struct {
function import_benchmark (line 149) | static int import_benchmark(void)
FILE: charm/core/crypto/AES/AES.c
type u8 (line 44) | typedef unsigned char u8;
type u16 (line 45) | typedef unsigned short u16;
type u32 (line 46) | typedef unsigned int u32;
type block_state (line 48) | typedef struct {
function rijndaelKeySetupEnc (line 760) | static int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKe...
function rijndaelKeySetupDec (line 846) | static int rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKe...
function rijndaelEncrypt (line 886) | static void rijndaelEncrypt(u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[...
function rijndaelDecrypt (line 1067) | static void rijndaelDecrypt(u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[...
function rijndaelEncryptRound (line 1250) | static void rijndaelEncryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u...
function rijndaelDecryptRound (line 1343) | static void rijndaelDecryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u...
function block_init (line 1434) | static void block_init(block_state *state, unsigned char *key,
function block_encrypt (line 1454) | static void block_encrypt(block_state *self, u8 *in, u8 *out)
function block_decrypt (line 1459) | static void block_decrypt(block_state *self, u8 *in, u8 *out)
FILE: charm/core/crypto/DES/DES.c
type block_state (line 43) | typedef struct {
function ltcseterr (line 47) | static void ltcseterr(int rc)
function block_init (line 69) | static void block_init(block_state *self, unsigned char *key, int keylen)
function block_encrypt (line 82) | static void block_encrypt(block_state *self, unsigned char *in, unsigned...
function block_decrypt (line 93) | static void block_decrypt(block_state *self, unsigned char *in, unsigned...
FILE: charm/core/crypto/cryptobase/XOR.c
type stream_state (line 39) | typedef struct
function stream_init (line 45) | static void
function stream_encrypt (line 69) | static void stream_encrypt(stream_state *self, unsigned char *block,
FILE: charm/core/crypto/cryptobase/_counter.c
function CounterObject_init (line 32) | static int
function CounterObject_dealloc (line 120) | static void
function PyObject (line 139) | static inline PyObject *
function PyObject (line 209) | static PyObject *
function PyObject (line 215) | static PyObject *
function CounterLEObject_increment (line 221) | static void
function CounterBEObject_increment (line 243) | static void
function PyObject (line 265) | static PyObject *
function PyObject (line 299) | static PyObject *
function PyObject (line 317) | static PyObject *
function PyObject (line 403) | static PyObject *
function PyObject (line 429) | static PyObject *
type PyModuleDef (line 465) | struct PyModuleDef
function PyMODINIT_FUNC (line 477) | PyMODINIT_FUNC
FILE: charm/core/crypto/cryptobase/_counter.h
type PCT_CounterObject (line 40) | typedef struct {
FILE: charm/core/crypto/cryptobase/block_template.c
function ALGobject (line 29) | static ALGobject *
function ALGdealloc (line 41) | static void
function ALGobject (line 66) | static ALGobject *
function PyObject (line 630) | static PyObject *
function PyObject (line 659) | static PyObject *
function PrintState (line 677) | void PrintState(self, msg)
type module_state (line 769) | struct module_state {
type module_state (line 777) | struct module_state
function block_traverse (line 835) | static int block_traverse(PyObject *m, visitproc visit, void *arg) {
function block_clear (line 840) | static int block_clear(PyObject *m) {
type PyModuleDef (line 845) | struct PyModuleDef
type module_state (line 849) | struct module_state
function _MODULE_NAME (line 862) | void _MODULE_NAME(void) {
FILE: charm/core/crypto/cryptobase/block_template.h
type ALGobject (line 51) | typedef struct
FILE: charm/core/crypto/cryptobase/cryptobasemodule.c
type MOP (line 13) | enum MOP {NONE = 0, MODE_ECB, MODE_CBC, MODE_CFB, MODE_PGP, MODE_OFB, MO...
type ALG (line 14) | enum ALG {AES, DES, DES3}
type Base (line 16) | typedef struct {
function PyObject (line 25) | static PyObject *selectPRF(Base *self, PyObject *args) {
function PyObject (line 69) | static PyObject *selectPRP(Base *self, PyObject *args) {
type module_state (line 132) | struct module_state {
type module_state (line 140) | struct module_state
function base_traverse (line 151) | static int base_traverse(PyObject *m, visitproc visit, void *arg) {
function base_clear (line 156) | static int base_clear(PyObject *m) {
type PyModuleDef (line 162) | struct PyModuleDef
type module_state (line 166) | struct module_state
function initcryptobase (line 179) | void initcryptobase(void) {
FILE: charm/core/crypto/cryptobase/libtom/tomcrypt_cfg.h
type ulong64 (line 88) | typedef unsigned __int64 ulong64;
type ulong64 (line 91) | typedef unsigned long long ulong64;
type ulong32 (line 98) | typedef unsigned ulong32;
type ulong32 (line 100) | typedef unsigned long ulong32;
type ulong64 (line 112) | typedef ulong64 __attribute__((__may_alias__))
type ulong32 (line 114) | typedef ulong32 __attribute__((__may_alias__))
type ulong64 (line 130) | typedef ulong64 ltc_mp_digit;
type ulong32 (line 132) | typedef ulong32 ltc_mp_digit;
FILE: charm/core/crypto/cryptobase/libtom/tomcrypt_cipher.h
type blowfish_key (line 7) | struct blowfish_key {
type rc5_key (line 14) | struct rc5_key {
type rc6_key (line 21) | struct rc6_key {
type saferp_key (line 27) | struct saferp_key {
type rijndael_key (line 34) | struct rijndael_key {
type kseed_key (line 41) | struct kseed_key {
type kasumi_key (line 47) | struct kasumi_key {
type xtea_key (line 55) | struct xtea_key {
type twofish_key (line 62) | struct twofish_key {
type twofish_key (line 66) | struct twofish_key {
type safer_key (line 83) | struct safer_key { safer_key_t key; }
type rc2_key (line 87) | struct rc2_key { unsigned xkey[64]; }
type des_key (line 91) | struct des_key {
type des3_key (line 95) | struct des3_key {
type cast5_key (line 101) | struct cast5_key {
type noekeon_key (line 107) | struct noekeon_key {
type skipjack_key (line 113) | struct skipjack_key {
type khazad_key (line 119) | struct khazad_key {
type anubis_key (line 126) | struct anubis_key {
type multi2_key (line 135) | struct multi2_key {
type camellia_key (line 142) | struct camellia_key {
type symmetric_key (line 148) | typedef union Symmetric_key {
type symmetric_ECB (line 212) | typedef struct {
type symmetric_CFB (line 224) | typedef struct {
type symmetric_OFB (line 242) | typedef struct {
type symmetric_CBC (line 258) | typedef struct {
type symmetric_CTR (line 273) | typedef struct {
type symmetric_LRW (line 297) | typedef struct {
type symmetric_F8 (line 322) | typedef struct {
type ltc_cipher_descriptor (line 341) | struct ltc_cipher_descriptor {
type ltc_cipher_descriptor (line 595) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 605) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 615) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 625) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 635) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 651) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 678) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 679) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 689) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 699) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 715) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 725) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 735) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 745) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 755) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 765) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 775) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 785) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 796) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 806) | struct ltc_cipher_descriptor
type symmetric_xts (line 902) | typedef struct {
type ltc_cipher_descriptor (line 933) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 934) | struct ltc_cipher_descriptor
FILE: charm/core/crypto/cryptobase/libtom/tomcrypt_des.c
type ltc_cipher_descriptor (line 23) | struct ltc_cipher_descriptor
type ltc_cipher_descriptor (line 37) | struct ltc_cipher_descriptor
function deskey (line 1306) | static void deskey(const unsigned char *key, short edf, ulong32 *keyout)
function deskey (line 1356) | static void deskey(const unsigned char *key, short edf, ulong32 *keyout)
function cookey (line 1366) | static void cookey(const ulong32 *raw1, ulong32 *keyout)
function cookey (line 1392) | static void cookey(const ulong32 *raw1, ulong32 *keyout)
function _desfunc (line 1402) | static void _desfunc(ulong32 *block, const ulong32 *keys)
function desfunc (line 1514) | static void desfunc(ulong32 *block, const ulong32 *keys)
function des_setup (line 1529) | static int des_setup(const unsigned char *key, int keylen, int num_round...
function des3_setup (line 1556) | static int des3_setup(const unsigned char *key, int keylen, int num_roun...
function des_ecb_encrypt (line 1597) | static int des_ecb_encrypt(const unsigned char *pt, unsigned char *ct, s...
function des_ecb_decrypt (line 1618) | static int des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, s...
function des3_ecb_encrypt (line 1639) | static int des3_ecb_encrypt(const unsigned char *pt, unsigned char *ct, ...
function des3_ecb_decrypt (line 1663) | static int des3_ecb_decrypt(const unsigned char *ct, unsigned char *pt, ...
function des_test (line 1683) | static int des_test(void)
function des3_test (line 1826) | static int des3_test(void)
function des_done (line 1865) | static void des_done(symmetric_key *skey)
function des3_done (line 1872) | static void des3_done(symmetric_key *skey)
function des_keysize (line 1882) | static int des_keysize(int *keysize)
function des3_keysize (line 1897) | static int des3_keysize(int *keysize)
FILE: charm/core/crypto/cryptobase/libtom/tomcrypt_hash.h
type sha512_state (line 3) | struct sha512_state {
type sha256_state (line 11) | struct sha256_state {
type sha1_state (line 19) | struct sha1_state {
type md5_state (line 27) | struct md5_state {
type md4_state (line 35) | struct md4_state {
type tiger_state (line 43) | struct tiger_state {
type md2_state (line 51) | struct md2_state {
type rmd128_state (line 58) | struct rmd128_state {
type rmd160_state (line 66) | struct rmd160_state {
type rmd256_state (line 74) | struct rmd256_state {
type rmd320_state (line 82) | struct rmd320_state {
type whirlpool_state (line 90) | struct whirlpool_state {
type chc_state (line 98) | struct chc_state {
type hash_state (line 105) | typedef union Hash_state {
type ltc_hash_descriptor (line 150) | struct ltc_hash_descriptor {
type ltc_hash_descriptor (line 200) | struct ltc_hash_descriptor
type ltc_hash_descriptor (line 208) | struct ltc_hash_descriptor
type ltc_hash_descriptor (line 216) | struct ltc_hash_descriptor
type ltc_hash_descriptor (line 227) | struct ltc_hash_descriptor
type ltc_hash_descriptor (line 238) | struct ltc_hash_descriptor
type ltc_hash_descriptor (line 249) | struct ltc_hash_descriptor
type ltc_hash_descriptor (line 257) | struct ltc_hash_descriptor
type ltc_hash_descriptor (line 267) | struct ltc_hash_descriptor
type ltc_hash_descriptor (line 276) | struct ltc_hash_descriptor
type ltc_hash_descriptor (line 284) | struct ltc_hash_descriptor
type ltc_hash_descriptor (line 292) | struct ltc_hash_descriptor
type ltc_hash_descriptor (line 300) | struct ltc_hash_descriptor
type ltc_hash_descriptor (line 308) | struct ltc_hash_descriptor
type ltc_hash_descriptor (line 316) | struct ltc_hash_descriptor
type ltc_hash_descriptor (line 324) | struct ltc_hash_descriptor
type ltc_hash_descriptor (line 332) | struct ltc_hash_descriptor
type ltc_hash_descriptor (line 340) | struct ltc_hash_descriptor
type ltc_hash_descriptor (line 348) | struct ltc_hash_descriptor
type ltc_hash_descriptor (line 349) | struct ltc_hash_descriptor
FILE: charm/core/crypto/cryptobase/libtom/tomcrypt_mac.h
type hmac_state (line 2) | typedef struct Hmac_state {
type omac_state (line 28) | typedef struct {
type pmac_state (line 58) | typedef struct {
type eax_state (line 105) | typedef struct {
type ocb_state (line 141) | typedef struct {
type ocb3_state (line 197) | typedef struct {
type ccm_state (line 262) | typedef struct {
FILE: charm/core/crypto/cryptobase/libtom/tomcrypt_macros.h
function ulong32 (line 251) | static inline ulong32 ROL(ulong32 word, int i)
function ulong32 (line 259) | static inline ulong32 ROR(ulong32 word, int i)
function ulong32 (line 296) | static inline ulong32 ROL(ulong32 word, int i)
function ulong32 (line 304) | static inline ulong32 ROR(ulong32 word, int i)
function ulong32 (line 314) | static inline ulong32 ROLc(ulong32 word, const int i)
function ulong32 (line 322) | static inline ulong32 RORc(ulong32 word, const int i)
function ulong64 (line 352) | static inline ulong64 ROL64(ulong64 word, int i)
function ulong64 (line 360) | static inline ulong64 ROR64(ulong64 word, int i)
FILE: charm/core/crypto/cryptobase/libtom/tomcrypt_math.h
type ecc_point (line 11) | typedef void ecc_point;
type rsa_key (line 15) | typedef void rsa_key;
type ltc_math_descriptor (line 19) | typedef struct {
FILE: charm/core/crypto/cryptobase/libtom/tomcrypt_misc.h
type adler32_state (line 73) | typedef struct adler32_state_s
type crc32_state (line 85) | typedef struct crc32_state_s
FILE: charm/core/crypto/cryptobase/libtom/tomcrypt_pk.h
type oid_st (line 20) | typedef struct Oid {
type rsa_key (line 32) | typedef struct Rsa_key {
type katja_key (line 120) | typedef struct KAT_key {
type dh_key (line 170) | typedef struct Dh_key {
type ltc_ecc_set_type (line 220) | typedef struct {
type ecc_point (line 244) | typedef struct {
type ecc_key (line 256) | typedef struct {
type dsa_key (line 382) | typedef struct {
type ltc_asn1_type (line 445) | typedef enum ltc_asn1_type_ {
type ltc_asn1_list (line 473) | typedef struct ltc_asn1_list_ {
type ulong32 (line 611) | typedef ulong32 wchar_t;
type ltc_utctime (line 628) | typedef struct {
FILE: charm/core/crypto/cryptobase/libtom/tomcrypt_pkcs.h
type ltc_pkcs_1_v1_5_blocks (line 6) | enum ltc_pkcs_1_v1_5_blocks
type ltc_pkcs_1_paddings (line 12) | enum ltc_pkcs_1_paddings
FILE: charm/core/crypto/cryptobase/libtom/tomcrypt_prng.h
type rc4_prng (line 12) | struct rc4_prng {
type fortuna_prng (line 19) | struct fortuna_prng {
type ltc_prng_descriptor (line 67) | struct ltc_prng_descriptor {
type ltc_prng_descriptor (line 130) | struct ltc_prng_descriptor
type ltc_prng_descriptor (line 142) | struct ltc_prng_descriptor
type ltc_prng_descriptor (line 154) | struct ltc_prng_descriptor
type ltc_prng_descriptor (line 166) | struct ltc_prng_descriptor
type ltc_prng_descriptor (line 178) | struct ltc_prng_descriptor
type ltc_prng_descriptor (line 182) | struct ltc_prng_descriptor
type ltc_prng_descriptor (line 183) | struct ltc_prng_descriptor
FILE: charm/core/crypto/cryptobase/stream_template.c
type ALGobject (line 56) | typedef struct
function ALGobject (line 66) | static ALGobject *
function ALGdealloc (line 74) | static void
function ALGobject (line 89) | static ALGobject *
function PyObject (line 130) | static PyObject *
function PyObject (line 162) | static PyObject *
function PyObject (line 200) | static PyObject *
type PyMethodDef (line 217) | struct PyMethodDef
function _MODULE_NAME (line 249) | void
FILE: charm/core/crypto/cryptobase/strxor.c
function xor_strings (line 39) | static void
function xor_string_with_char (line 60) | static void
function runtime_test (line 88) | static void
function PyObject (line 133) | static PyObject *
function PyObject (line 174) | static PyObject *
function PyMODINIT_FUNC (line 215) | PyMODINIT_FUNC
FILE: charm/core/engine/protocol.py
class Protocol (line 11) | class Protocol:
method __init__ (line 12) | def __init__(self, error_states, max_size=2048): # any init information?
method setup (line 28) | def setup(self, *args):
method addInstance (line 39) | def addInstance(self, obj):
method addPartyType (line 52) | def addPartyType(self, type, state_map, trans_map, init_state=False):
method listStates (line 77) | def listStates(self, partyID):
method listParties (line 83) | def listParties(self):
method listParyTypes (line 86) | def listParyTypes(self):
method getInitState (line 89) | def getInitState(self, _type):
method setState (line 103) | def setState(self, state_num):
method send_msg (line 129) | def send_msg(self, object):
method recv_all (line 145) | def recv_all(self, n):
method recv_msg (line 153) | def recv_msg(self):
method setSubclassVars (line 179) | def setSubclassVars(self, group, state=None):
method get (line 186) | def get(self, keys, _type=tuple):
method store (line 202) | def store(self, *args):
method serialize (line 208) | def serialize(self, object):
method deserialize (line 212) | def deserialize(self, bytes_object):
method setUnsafePickleDeserialization (line 228) | def setUnsafePickleDeserialization(self, enabled=False):
method setSerializers (line 239) | def setSerializers(self, serial, deserial):
method setErrorCode (line 246) | def setErrorCode(self, value):
method execute (line 250) | def execute(self, party_type, close_sock=True):
method check (line 295) | def check(self):
method clean (line 301) | def clean(self):
FILE: charm/core/engine/util.py
function serializeDict (line 12) | def serializeDict(Object, group):
function serializeList (line 18) | def serializeList(Object, group):
function serializeObject (line 34) | def serializeObject(Objects, group):
function deserializeDict (line 45) | def deserializeDict(Object, group):
function deserializeList (line 52) | def deserializeList(Object, group):
function deserializeTuple (line 59) | def deserializeTuple(Object, group):
function deserializeStr (line 63) | def deserializeStr(object, group):
function deserializeObject (line 79) | def deserializeObject(Objects, group):
function pickleObject (line 89) | def pickleObject(Object):
function unpickleObject (line 105) | def unpickleObject(Object):
function to_json (line 123) | def to_json(object):
function from_json (line 130) | def from_json(json_object):
function objectToBytes (line 140) | def objectToBytes(object, group):
function bytesToObject (line 146) | def bytesToObject(byteobject, group):
function objectToBytesWithPickle (line 154) | def objectToBytesWithPickle(Object, group):
function bytesToObjectWithPickle (line 158) | def bytesToObjectWithPickle(byteobject, group):
FILE: charm/core/math/elliptic_curve.pyi
class ECGroup (line 9) | class ECGroup:
method __init__ (line 12) | def __init__(self, nid: int) -> None: ...
class Element (line 14) | class Element:
method __init__ (line 20) | def __init__(self) -> None: ...
method isInf (line 21) | def isInf(self) -> bool: ...
method __add__ (line 24) | def __add__(self, other: Element) -> Element: ...
method __radd__ (line 25) | def __radd__(self, other: Element) -> Element: ...
method __sub__ (line 26) | def __sub__(self, other: Element) -> Element: ...
method __rsub__ (line 27) | def __rsub__(self, other: Element) -> Element: ...
method __mul__ (line 28) | def __mul__(self, other: Element | int) -> Element: ...
method __rmul__ (line 29) | def __rmul__(self, other: Element | int) -> Element: ...
method __mod__ (line 30) | def __mod__(self, other: Element) -> Element: ...
method __pow__ (line 31) | def __pow__(self, exp: Element | int) -> Element: ...
method __neg__ (line 32) | def __neg__(self) -> Element: ...
method __invert__ (line 33) | def __invert__(self) -> Element: ...
method __eq__ (line 36) | def __eq__(self, other: object) -> bool: ...
method __ne__ (line 37) | def __ne__(self, other: object) -> bool: ...
method __lt__ (line 38) | def __lt__(self, other: Element) -> bool: ...
method __le__ (line 39) | def __le__(self, other: Element) -> bool: ...
method __gt__ (line 40) | def __gt__(self, other: Element) -> bool: ...
method __ge__ (line 41) | def __ge__(self, other: Element) -> bool: ...
method __int__ (line 44) | def __int__(self) -> int: ...
method __hash__ (line 45) | def __hash__(self) -> int: ...
function init (line 48) | def init(group: ECGroup, type: int, value: int = ...) -> Element: ...
function random (line 49) | def random(group: ECGroup, type: int) -> Element: ...
function order (line 50) | def order(group: ECGroup) -> Element: ...
function getGenerator (line 51) | def getGenerator(group: ECGroup) -> Element: ...
function bitsize (line 52) | def bitsize(group: ECGroup) -> int: ...
function serialize (line 53) | def serialize(element: Element) -> bytes: ...
function deserialize (line 54) | def deserialize(group: ECGroup, data: bytes, type: int) -> Element: ...
function hashEC (line 55) | def hashEC(group: ECGroup, data: bytes, type: int) -> Element: ...
function encode (line 56) | def encode(group: ECGroup, message: bytes) -> Element: ...
function decode (line 57) | def decode(element: Element) -> bytes: ...
function getXY (line 60) | def getXY(group: ECGroup, element: Element, x_only: bool = True) -> Elem...
function getXY (line 62) | def getXY(group: ECGroup, element: Element, x_only: bool = False) -> tup...
FILE: charm/core/math/elliptic_curve/ecmodule.c
function printf_buffer_as_hex (line 42) | void printf_buffer_as_hex(uint8_t * data, size_t len)
function setBigNum (line 54) | void setBigNum(PyLongObject *obj, BIGNUM **value) {
function hash_to_bytes (line 92) | int hash_to_bytes(uint8_t *input_buf, int input_len, uint8_t *output_buf...
function ECElement (line 154) | ECElement *createNewPoint(GroupType type, ECGroup *gobj) {
function ECElement_init (line 173) | int ECElement_init(ECElement *self, PyObject *args, PyObject *kwds)
function ECElement_dealloc (line 179) | void ECElement_dealloc(ECElement* self) {
function PyObject (line 187) | PyObject *ECElement_new(PyTypeObject *type, PyObject *args, PyObject *kw...
function ECGroup_dealloc (line 203) | void ECGroup_dealloc(ECGroup *self)
function PyObject (line 240) | PyObject *ECGroup_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
function ECGroup_init (line 259) | int ECGroup_init(ECGroup *self, PyObject *args, PyObject *kwds)
function PyObject (line 350) | PyObject *ECElement_call(ECElement *intObject, PyObject *args, PyObject ...
function PyObject (line 355) | PyObject *ECGroup_print(ECGroup *self) {
function PyObject (line 378) | PyObject *ECElement_print(ECElement *self) {
function PyObject (line 409) | PyObject *ECE_init(ECElement *self, PyObject *args) {
function PyObject (line 443) | PyObject *ECE_random(ECElement *self, PyObject *args)
function PyObject (line 505) | static PyObject *ECE_is_infinity(ECElement *self, PyObject *args) {
function PyObject (line 519) | static PyObject *ECE_add(PyObject *o1, PyObject *o2) {
function PyObject (line 584) | static PyObject *ECE_sub(PyObject *o1, PyObject *o2) {
function PyObject (line 646) | static PyObject *ECE_mul(PyObject *o1, PyObject *o2) {
function PyObject (line 712) | static PyObject *ECE_div(PyObject *o1, PyObject *o2) {
function PyObject (line 789) | static PyObject *ECE_rem(PyObject *o1, PyObject *o2) {
function PyObject (line 843) | static PyObject *ECE_pow(PyObject *o1, PyObject *o2, PyObject *o3) {
function ECElement (line 942) | ECElement *invertECElement(ECElement *self) {
function PyObject (line 967) | static PyObject *ECE_invert(PyObject *o1) {
function ECElement (line 987) | ECElement *negatePoint(ECElement *self) {
function PyObject (line 1006) | static PyObject *ECE_neg(PyObject *o1) {
function PyObject (line 1038) | static PyObject *ECE_long(PyObject *o1) {
function PyObject (line 1054) | static PyObject *ECE_convertToZR(ECElement *self, PyObject *args) {
function PyObject (line 1098) | static PyObject *ECE_getOrder(ECElement *self, PyObject *arg) {
function PyObject (line 1111) | static PyObject *ECE_bitsize(ECElement *self, PyObject *arg) {
function PyObject (line 1126) | static PyObject *ECE_equals(PyObject *o1, PyObject *o2, int opid) {
function PyObject (line 1191) | static PyObject *ECE_getGen(ECElement *self, PyObject *arg) {
function set_element_from_hash (line 1208) | void set_element_from_hash(ECElement *self, uint8_t *input, int input_len)
function PyObject (line 1249) | static PyObject *ECE_hash(ECElement *self, PyObject *args) {
function PyObject (line 1297) | static PyObject *ECE_encode(ECElement *self, PyObject *args) {
function PyObject (line 1412) | static PyObject *ECE_decode(ECElement *self, PyObject *args) {
function PyObject (line 1464) | static PyObject *Serialize(ECElement *self, PyObject *args) {
function PyObject (line 1514) | static PyObject *Deserialize(ECElement *self, PyObject *args)
function PyObject (line 1564) | PyObject *PyCreateList(Operations *gBench, MeasureType type)
type module_state (line 1846) | struct module_state {
type module_state (line 1857) | struct module_state
function ec_traverse (line 1885) | static int ec_traverse(PyObject *m, visitproc visit, void *arg) {
function ec_clear (line 1890) | static int ec_clear(PyObject *m) {
function ec_free (line 1896) | static int ec_free(PyObject *m) {
type PyModuleDef (line 1906) | struct PyModuleDef
type module_state (line 1910) | struct module_state
function initelliptic_curve (line 1925) | void initelliptic_curve(void) {
FILE: charm/core/math/elliptic_curve/ecmodule.h
type Group (line 86) | enum Group {ZR = 0, G, NONE_G}
type GroupType (line 87) | typedef enum Group GroupType;
type Operations (line 93) | typedef struct {
type ECGroup (line 105) | typedef struct {
type ECElement (line 119) | typedef struct {
FILE: charm/core/math/integer.pyi
class Element (line 7) | class Element:
method __init__ (line 11) | def __init__(self, number: int) -> None: ...
method __init__ (line 13) | def __init__(self, number: Element) -> None: ...
method __init__ (line 15) | def __init__(self, number: int, modulus: int) -> None: ...
method __init__ (line 17) | def __init__(self, number: int, modulus: Element) -> None: ...
method __init__ (line 19) | def __init__(self, number: Element, modulus: int) -> None: ...
method __init__ (line 21) | def __init__(self, number: Element, modulus: Element) -> None: ...
method set (line 22) | def set(self, other: Element) -> bool: ...
method isCoPrime (line 23) | def isCoPrime(self, other: Element | int) -> bool: ...
method isCongruent (line 24) | def isCongruent(self, a: int, n: int) -> bool: ...
method __add__ (line 27) | def __add__(self, other: Element | int) -> Element: ...
method __radd__ (line 28) | def __radd__(self, other: Element | int) -> Element: ...
method __sub__ (line 29) | def __sub__(self, other: Element | int) -> Element: ...
method __rsub__ (line 30) | def __rsub__(self, other: Element | int) -> Element: ...
method __mul__ (line 31) | def __mul__(self, other: Element | int) -> Element: ...
method __rmul__ (line 32) | def __rmul__(self, other: Element | int) -> Element: ...
method __truediv__ (line 33) | def __truediv__(self, other: Element | int) -> Element: ...
method __rtruediv__ (line 34) | def __rtruediv__(self, other: Element | int) -> Element: ...
method __mod__ (line 35) | def __mod__(self, other: Element | int) -> Element: ...
method __rmod__ (line 36) | def __rmod__(self, other: Element | int) -> Element: ...
method __pow__ (line 37) | def __pow__(self, other: Element | int) -> Element: ...
method __rpow__ (line 38) | def __rpow__(self, other: Element | int) -> Element: ...
method __neg__ (line 39) | def __neg__(self) -> Element: ...
method __invert__ (line 40) | def __invert__(self) -> Element: ...
method __xor__ (line 41) | def __xor__(self, other: Element | int) -> Element: ...
method __rxor__ (line 42) | def __rxor__(self, other: Element | int) -> Element: ...
method __eq__ (line 45) | def __eq__(self, other: object) -> bool: ...
method __ne__ (line 46) | def __ne__(self, other: object) -> bool: ...
method __lt__ (line 47) | def __lt__(self, other: Element | int) -> bool: ...
method __le__ (line 48) | def __le__(self, other: Element | int) -> bool: ...
method __gt__ (line 49) | def __gt__(self, other: Element | int) -> bool: ...
method __ge__ (line 50) | def __ge__(self, other: Element | int) -> bool: ...
method __int__ (line 53) | def __int__(self) -> int: ...
method __str__ (line 54) | def __str__(self) -> str: ...
method __repr__ (line 55) | def __repr__(self) -> str: ...
method __hash__ (line 56) | def __hash__(self) -> int: ...
function randomBits (line 59) | def randomBits(bits: int) -> Element: ...
function random (line 60) | def random(n: Element | int) -> Element: ...
function randomPrime (line 61) | def randomPrime(bits: int) -> Element: ...
function isPrime (line 62) | def isPrime(n: Element | int) -> bool: ...
function encode (line 63) | def encode(message: bytes, modulus: Element | int) -> Element: ...
function decode (line 64) | def decode(element: Element) -> bytes: ...
function hashInt (line 65) | def hashInt(value: bytes, modulus: Element | int) -> Element: ...
function bitsize (line 66) | def bitsize(n: Element | int) -> int: ...
function legendre (line 67) | def legendre(a: Element | int, p: Element | int) -> int: ...
function gcd (line 68) | def gcd(a: Element | int, b: Element | int) -> Element: ...
function lcm (line 69) | def lcm(a: Element | int, b: Element | int) -> Element: ...
function serialize (line 70) | def serialize(element: Element) -> bytes: ...
function deserialize (line 71) | def deserialize(data: bytes) -> Element: ...
function int2Bytes (line 72) | def int2Bytes(element: Element) -> bytes: ...
function toInt (line 73) | def toInt(element: Element) -> Element: ...
function getMod (line 74) | def getMod(element: Element) -> Element: ...
function reduce (line 75) | def reduce(element: Element) -> Element: ...
FILE: charm/core/math/integer/integermodule.c
type module_state (line 82) | struct module_state {
function size (line 114) | static inline size_t size(mpz_t n) {
function longObjToMPZ (line 118) | void longObjToMPZ(mpz_t m, PyObject * o) {
function PyObject (line 162) | PyObject *bnToLongObj(BIGNUM *m) {
function bnToMPZ (line 166) | int bnToMPZ(BIGNUM *p, mpz_t m) {
function mpzToBN (line 183) | int mpzToBN(mpz_t m, BIGNUM *b) {
function PyObject (line 199) | PyObject *mpzToLongObj(mpz_t m) {
function print_mpz (line 242) | void print_mpz(mpz_t x, int base) {
function print_bn_dec (line 255) | void print_bn_dec(const BIGNUM *bn) {
function printf_buffer_as_hex (line 264) | void printf_buffer_as_hex(uint8_t *data, size_t len) {
function hash_to_bytes (line 284) | int hash_to_bytes(uint8_t *input_buf, int input_len, uint8_t *output_buf...
function hash_to_group_element (line 343) | int hash_to_group_element(mpz_t x, int block_num, uint8_t *output_buf) {
function _reduce (line 378) | void _reduce(Integer *object) {
function Integer_dealloc (line 383) | void Integer_dealloc(Integer* self) {
function PyObject (line 390) | PyObject *Integer_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
function Integer_init (line 403) | int Integer_init(Integer *self, PyObject *args, PyObject *kwds) {
function PyObject (line 462) | static PyObject *Integer_equals(PyObject *o1, PyObject *o2, int opid) {
function PyObject (line 550) | PyObject *Integer_print(Integer *self) {
function Integer (line 584) | Integer *createNewInteger() {
function PyObject (line 602) | static PyObject *Integer_set(Integer *self, PyObject *args) {
function PyObject (line 620) | static PyObject *Integer_add(PyObject *o1, PyObject *o2) {
function PyObject (line 681) | static PyObject *Integer_sub(PyObject *o1, PyObject *o2) {
function PyObject (line 743) | static PyObject *Integer_mul(PyObject *o1, PyObject *o2) {
function PyObject (line 807) | static PyObject *Integer_invert(PyObject *o1) {
function PyObject (line 827) | static PyObject *Integer_long(PyObject *o1) {
function PyObject (line 838) | static PyObject *Integer_reduce(PyObject *self, PyObject *args) {
function PyObject (line 859) | static PyObject *Integer_div(PyObject *o1, PyObject *o2) {
function PyObject (line 955) | static PyObject *Integer_pow(PyObject *o1, PyObject *o2, PyObject *o3) {
function PyObject (line 1099) | static PyObject *Integer_hash(PyObject *self, PyObject *args) {
function PyObject (line 1345) | static PyObject *Integer_remainder(PyObject *o1, PyObject *o2) {
function PyObject (line 1399) | static PyObject *testPrimality(PyObject *self, PyObject *arg) {
function PyObject (line 1432) | static PyObject *genRandomBits(PyObject *self, PyObject *args) {
function PyObject (line 1472) | static PyObject *genRandom(PyObject *self, PyObject *args) {
function PyObject (line 1509) | static PyObject *genRandomPrime(PyObject *self, PyObject *args) {
function PyObject (line 1552) | static PyObject *encode_message(PyObject *self, PyObject *args) {
function PyObject (line 1666) | static PyObject *decode_message(PyObject *self, PyObject *args) {
function PyObject (line 1717) | static PyObject *bitsize(PyObject *self, PyObject *args) {
function PyObject (line 1741) | static PyObject *testCoPrime(Integer *self, PyObject *arg) {
function PyObject (line 1782) | static PyObject *testCongruency(Integer *self, PyObject *args) {
function PyObject (line 1825) | static PyObject *legendre(PyObject *self, PyObject *args) {
function PyObject (line 1861) | static PyObject *gcdCall(PyObject *self, PyObject *args) {
function PyObject (line 1901) | static PyObject *lcmCall(PyObject *self, PyObject *args) {
function PyObject (line 1941) | static PyObject *serialize(PyObject *self, PyObject *args) {
function deserialize_helper (line 1990) | void deserialize_helper(int length, char *encoded_value, mpz_t target)
function PyObject (line 2001) | static PyObject *deserialize(PyObject *self, PyObject *args) {
function PyObject (line 2067) | static PyObject *toBytes(PyObject *self, PyObject *args) {
function PyObject (line 2086) | static PyObject *toInt(PyObject *self, PyObject *args) {
function PyObject (line 2101) | static PyObject *getMod(PyObject *self, PyObject *args) {
function PyObject (line 2115) | static PyObject *Integer_xor(PyObject *self, PyObject *other) {
function PyObject (line 2140) | PyObject *Benchmark_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
function Benchmark_init (line 2157) | int Benchmark_init(Benchmark *self, PyObject *args, PyObject *kwds)
function Benchmark_dealloc (line 2162) | void Benchmark_dealloc(Benchmark *self) {
function PyObject (line 2210) | PyObject *InitBenchmark(PyObject *self, PyObject *args) {
function PyObject (line 2250) | PyObject *StartBenchmark(PyObject *self, PyObject *args) {
function PyObject (line 2272) | PyObject *EndBenchmark(PyObject *self, PyObject *args) {
function PyObject (line 2288) | static PyObject *GetBenchmark(PyObject *self, PyObject *args) {
function PyObject (line 2307) | static PyObject *GetAllBenchmarks(PyObject *self, PyObject *args) {
function int_traverse (line 2441) | static int int_traverse(PyObject *m, visitproc visit, void *arg) {
function int_clear (line 2449) | static int int_clear(PyObject *m) {
function int_free (line 2459) | static int int_free(PyObject *m) {
type PyModuleDef (line 2470) | struct PyModuleDef
type module_state (line 2474) | struct module_state
function PyMODINIT_FUNC (line 2484) | PyMODINIT_FUNC
FILE: charm/core/math/integer/integermodule.h
type Integer (line 119) | typedef struct {
FILE: charm/core/math/pairing.pyi
class Pairing (line 11) | class Pairing:
method __init__ (line 15) | def __init__(self) -> None: ...
method __init__ (line 17) | def __init__(self, params: str) -> None: ...
method __init__ (line 19) | def __init__(self, params: bytes) -> None: ...
class Element (line 21) | class Element:
method __init__ (line 28) | def __init__(self) -> None: ...
method initPP (line 29) | def initPP(self) -> None: ...
method set (line 30) | def set(self, value: int | Element) -> int: ...
method __add__ (line 33) | def __add__(self, other: Element) -> Element: ...
method __radd__ (line 34) | def __radd__(self, other: Element) -> Element: ...
method __sub__ (line 35) | def __sub__(self, other: Element) -> Element: ...
method __rsub__ (line 36) | def __rsub__(self, other: Element) -> Element: ...
method __mul__ (line 37) | def __mul__(self, other: Element) -> Element: ...
method __rmul__ (line 38) | def __rmul__(self, other: Element) -> Element: ...
method __pow__ (line 39) | def __pow__(self, other: Element | int) -> Element: ...
method __rpow__ (line 40) | def __rpow__(self, other: Element | int) -> Element: ...
method __neg__ (line 41) | def __neg__(self) -> Element: ...
method __invert__ (line 42) | def __invert__(self) -> Element: ...
method __eq__ (line 45) | def __eq__(self, other: object) -> bool: ...
method __ne__ (line 46) | def __ne__(self, other: object) -> bool: ...
method __lt__ (line 47) | def __lt__(self, other: Element) -> bool: ...
method __le__ (line 48) | def __le__(self, other: Element) -> bool: ...
method __gt__ (line 49) | def __gt__(self, other: Element) -> bool: ...
method __ge__ (line 50) | def __ge__(self, other: Element) -> bool: ...
method __int__ (line 53) | def __int__(self) -> int: ...
method __hash__ (line 54) | def __hash__(self) -> int: ...
function init (line 58) | def init(group: Pairing, type: int) -> Element: ...
function init (line 60) | def init(group: Pairing, type: int, value: int) -> Element: ...
function pair (line 62) | def pair(g1: Element, g2: Element) -> Element: ...
function hashPair (line 63) | def hashPair(element: Element) -> bytes: ...
function H (line 64) | def H(group: Pairing, data: bytes | str, type: int) -> Element: ...
function random (line 65) | def random(group: Pairing, type: int) -> Element: ...
function serialize (line 66) | def serialize(element: Element) -> bytes: ...
function deserialize (line 67) | def deserialize(group: Pairing, data: bytes, type: int) -> Element: ...
function ismember (line 68) | def ismember(element: Element) -> bool: ...
FILE: charm/core/math/pairing/miracl/miracl_interface.cc
function _printf_buffer_as_hex (line 43) | void _printf_buffer_as_hex(uint8_t * data, size_t len)
function string (line 55) | string bigToRawBytes(Big x)
function string (line 67) | string bigToBytes(Big x)
function Big (line 82) | Big *bytesToBig(string str, int *counter)
function pairing_t (line 98) | pairing_t *pairing_init(int securitylevel) {
function element_t (line 115) | element_t *order(pairing_t *pairing) {
function element_t (line 122) | element_t *element_init_ZR(int value = 0)
function element_t (line 128) | element_t *_element_init_G1()
function element_t (line 134) | element_t *_element_init_G2()
function element_t (line 140) | element_t *_element_init_GT(const pairing_t *pairing)
function element_is_member (line 148) | int element_is_member(Curve_t ctype, Group_t type, const pairing_t *pair...
function element_random (line 186) | void element_random(Group_t type, const pairing_t *pairing, element_t *e) {
function element_printf (line 210) | void element_printf(Group_t type, const element_t *e)
function _element_length_to_str (line 234) | int _element_length_to_str(Group_t type, const element_t *e)
function _element_to_str (line 266) | int _element_to_str(unsigned char **data_str, Group_t type, const elemen...
function _element_add (line 297) | void _element_add(Group_t type, element_t *c, const element_t *a, const ...
function _element_sub (line 321) | void _element_sub(Group_t type, element_t *c, const element_t *a, const ...
function _element_mul (line 341) | void _element_mul(Group_t type, element_t *c, const element_t *a, const ...
function _element_mul_si (line 371) | void _element_mul_si(Group_t type, const pairing_t *pairing, element_t *...
function _element_mul_zn (line 398) | void _element_mul_zn(Group_t type, const pairing_t *pairing, element_t *...
function _element_div (line 426) | void _element_div(Group_t type, element_t *c, const element_t *a, const ...
function element_t (line 454) | element_t *_element_pow_zr_zr(Group_t type, const pairing_t *pairing, co...
function element_t (line 466) | element_t *_element_pow_zr(Group_t type, const pairing_t *pairing, eleme...
function element_t (line 506) | element_t *_element_neg(Group_t type, const element_t *e, const element_...
function _element_inv (line 539) | void _element_inv(Group_t type, const pairing_t *pairing, const element_...
function Big (line 569) | Big *charToBig (char *c, int len)
function Big (line 579) | Big getx(Big y)
function G1 (line 586) | G1 *charToG1(char *c, int len)
function element_t (line 596) | element_t *hash_then_map(Group_t type, const pairing_t *pairing, char *d...
function _init_hash (line 621) | void _init_hash(const pairing_t *pairing)
function _element_add_str_hash (line 627) | void _element_add_str_hash(const pairing_t *pairing, void *data, int len)
function _element_add_to_hash (line 637) | void _element_add_to_hash(Group_t type, const pairing_t *pairing, const ...
function element_t (line 658) | element_t *finish_hash(Group_t type, const pairing_t *pairing)
function element_t (line 683) | element_t *_element_from_hash(Group_t type, const pairing_t *pairing, vo...
function element_is_value (line 699) | int element_is_value(Group_t type, element_t *n, int value) {
function _element_cmp (line 712) | int _element_cmp(Group_t type, element_t *a, element_t *b) {
function _element_set_si (line 740) | void _element_set_si(Group_t type, element_t *dst, const signed long int...
function _element_setG1 (line 749) | int _element_setG1(Group_t type, element_t *c, const element_t *a, const...
function _element_set (line 761) | void _element_set(Curve_t ctype, Group_t type, element_t *dst, const ele...
function _element_set_mpz (line 812) | void _element_set_mpz(Group_t type, element_t *dst, mpz_t src)
function _element_to_mpz (line 830) | void _element_to_mpz(Group_t type, element_t *src, mpz_t dst)
function _element_hash_key (line 850) | void _element_hash_key(const pairing_t *pairing, Group_t type, element_t...
function element_t (line 866) | element_t *_element_pairing_type3(const pairing_t *pairing, const elemen...
function element_t (line 890) | element_t *_element_prod_pairing_type3(const pairing_t *pairing, const e...
function _element_length_in_bytes (line 907) | int _element_length_in_bytes(Curve_t ctype, Group_t type, element_t *e) {
function _element_to_bytes (line 975) | int _element_to_bytes(unsigned char *data, Curve_t ctype, Group_t type, ...
function element_t (line 1058) | element_t *_element_from_bytes(Curve_t ctype, Group_t type, unsigned cha...
function element_delete (line 1132) | void element_delete(Group_t type, element_t *e) {
function pairing_clear (line 1156) | void pairing_clear(pairing_t *pairing) {
function miracl_clean (line 1161) | void miracl_clean() {
function is_base64 (line 1174) | static inline bool is_base64(unsigned char c) {
function string (line 1178) | string _base64_encode(unsigned char const* bytes_to_encode, unsigned int...
function string (line 1221) | string _base64_decode(string const& encoded_string) {
function aes_encrypt (line 1262) | int aes_encrypt(char *key, char *message, int len, char **out)
function aes_decrypt (line 1301) | int aes_decrypt(char *key, char *ciphertext, int len, char **out)
FILE: charm/core/math/pairing/miracl/miracl_interface.h
type pairing_t (line 32) | typedef void pairing_t;
type element_t (line 33) | typedef void element_t;
type Curve (line 39) | enum Curve {MNT, SS, BLS, NONE_C}
type Group (line 40) | enum Group {ZR_t = 0, G1_t, G2_t, GT_t, NONE_G}
type Group_t (line 41) | typedef enum Group Group_t;
type Curve_t (line 42) | typedef enum Curve Curve_t;
FILE: charm/core/math/pairing/miracl/miracl_interface2.cc
function _printf_buffer_as_hex (line 41) | void _printf_buffer_as_hex(uint8_t * data, size_t len)
function string (line 53) | string bigToRawBytes(Big x)
function string (line 65) | string bigToBytes(Big x)
function Big (line 84) | Big *bytesToBig(string str, int *counter)
function pairing_t (line 118) | pairing_t *pairing_init(int securitylevel) {
function element_t (line 135) | element_t *order(pairing_t *pairing) {
function element_t (line 142) | element_t *element_init_ZR(int value = 0)
function element_t (line 148) | element_t *_element_init_G1()
function element_t (line 154) | element_t *_element_init_G2()
function element_t (line 160) | element_t *_element_init_GT(const pairing_t *pairing)
function element_is_member (line 168) | int element_is_member(Curve_t ctype, Group_t type, const pairing_t *pair...
function _element_pp_init (line 195) | int _element_pp_init(const pairing_t *pairing, Group_t type, element_t *e)
function element_t (line 221) | element_t *element_gt(const pairing_t *pairing)
function element_random (line 235) | void element_random(Group_t type, const pairing_t *pairing, element_t *e) {
function element_printf (line 260) | void element_printf(Group_t type, const element_t *e)
function _element_length_to_str (line 284) | int _element_length_to_str(Group_t type, const element_t *e)
function _element_to_str (line 316) | int _element_to_str(unsigned char **data_str, Group_t type, const elemen...
function _element_add (line 347) | void _element_add(Group_t type, element_t *c, const element_t *a, const ...
function _element_sub (line 371) | void _element_sub(Group_t type, element_t *c, const element_t *a, const ...
function _element_mul (line 395) | void _element_mul(Group_t type, element_t *c, const element_t *a, const ...
function _element_mul_si (line 440) | void _element_mul_si(Group_t type, const pairing_t *pairing, element_t *...
function _element_mul_zn (line 475) | void _element_mul_zn(Group_t type, const pairing_t *pairing, element_t *...
function _element_div (line 511) | void _element_div(Group_t type, element_t *c, const element_t *a, const ...
function element_t (line 537) | element_t *_element_pow_zr_zr(Group_t type, const pairing_t *pairing, co...
function element_t (line 549) | element_t *_element_pow_zr(Group_t type, const pairing_t *pairing, eleme...
function element_t (line 591) | element_t *_element_neg(Group_t type, const element_t *e, const element_...
function _element_inv (line 624) | void _element_inv(Group_t type, const pairing_t *pairing, const element_...
function Big (line 654) | Big *charToBig (char *c, int len)
function Big (line 664) | Big getx(Big y)
function G1 (line 671) | G1 *charToG1(char *c, int len)
function element_t (line 681) | element_t *hash_then_map(Group_t type, const pairing_t *pairing, char *d...
function _init_hash (line 706) | void _init_hash(const pairing_t *pairing)
function _element_add_str_hash (line 712) | void _element_add_str_hash(const pairing_t *pairing, char *data, int len)
function _element_add_to_hash (line 727) | void _element_add_to_hash(Group_t type, const pairing_t *pairing, const ...
function element_t (line 748) | element_t *finish_hash(Group_t type, const pairing_t *pairing)
function element_t (line 780) | element_t *_element_from_hash(Group_t type, const pairing_t *pairing, vo...
function element_is_value (line 796) | int element_is_value(Group_t type, element_t *n, int value) {
function _element_cmp (line 809) | int _element_cmp(Group_t type, element_t *a, element_t *b) {
function _element_set_si (line 837) | void _element_set_si(Group_t type, element_t *dst, const signed long int...
function _element_setG1 (line 846) | int _element_setG1(Group_t type, element_t *c, const element_t *a, const...
function _element_set (line 858) | void _element_set(Curve_t ctype, Group_t type, element_t *dst, const ele...
function _element_set_mpz (line 937) | void _element_set_mpz(Group_t type, element_t *dst, mpz_t src)
function _element_to_mpz (line 955) | void _element_to_mpz(Group_t type, element_t *src, mpz_t dst)
function _element_hash_key (line 975) | void _element_hash_key(const pairing_t *pairing, Group_t type, element_t...
function element_t (line 993) | element_t *_element_pairing(const pairing_t *pairing, const element_t *i...
function element_t (line 1023) | element_t *_element_prod_pairing(const pairing_t *pairing, const element...
function _element_length_in_bytes (line 1085) | int _element_length_in_bytes(Curve_t ctype, Group_t type, element_t *e) {
function _element_to_bytes (line 1220) | int _element_to_bytes(unsigned char *data, Curve_t ctype, Group_t type, ...
function element_t (line 1362) | element_t *_element_from_bytes(Curve_t ctype, Group_t type, unsigned cha...
function element_delete (line 1525) | void element_delete(Group_t type, element_t *e) {
function pairing_clear (line 1552) | void pairing_clear(pairing_t *pairing) {
function miracl_clean (line 1557) | void miracl_clean(void) {
function is_base64 (line 1570) | static inline bool is_base64(unsigned char c) {
function string (line 1574) | string _base64_encode(unsigned char const* bytes_to_encode, unsigned int...
function string (line 1617) | string _base64_decode(string const& encoded_string) {
function aes_encrypt (line 1658) | int aes_encrypt(char *key, char *message, int len, char **out)
function aes_decrypt (line 1697) | int aes_decrypt(char *key, char *ciphertext, int len, char **out)
FILE: charm/core/math/pairing/miracl/miracl_interface2.h
type pairing_t (line 31) | typedef void pairing_t;
type element_t (line 32) | typedef void element_t;
type Curve (line 38) | enum Curve {MNT, BN, SS, NONE_C}
type Group (line 40) | enum Group {pyZR_t = 0, pyG1_t, pyG2_t, pyGT_t, NONE_G}
type Group (line 42) | enum Group {pyZR_t = 0, pyG1_t, pyGT_t, NONE_G}
type Group_t (line 47) | typedef enum Group Group_t;
type Curve_t (line 48) | typedef enum Curve Curve_t;
FILE: charm/core/math/pairing/miracl/pairingmodule2.c
function exp_rule (line 47) | int exp_rule(Group_t lhs, Group_t rhs)
function mul_rule (line 56) | int mul_rule(Group_t lhs, Group_t rhs)
function add_rule (line 63) | int add_rule(Group_t lhs, Group_t rhs)
function sub_rule (line 69) | int sub_rule(Group_t lhs, Group_t rhs)
function div_rule (line 75) | int div_rule(Group_t lhs, Group_t rhs)
function pair_rule (line 81) | int pair_rule(Group_t lhs, Group_t rhs)
function check_type (line 88) | int check_type(Group_t type) {
function PyObject (line 123) | PyObject *mpzToLongObj(mpz_t m) {
function longObjToMPZ (line 149) | void longObjToMPZ (mpz_t m, PyLongObject * p)
function printf_buffer_as_hex (line 189) | void printf_buffer_as_hex(uint8_t * data, size_t len)
function Check_Types (line 203) | int Check_Types(Group_t l_type, Group_t r_type, char op)
function Element (line 235) | static Element *createNewElement(Group_t element_type, Pairing *pairing) {
function Element (line 265) | Element *convertToZR(PyObject *longObj, PyObject *elemObj) {
function Pairing_dealloc (line 283) | void Pairing_dealloc(Pairing *self)
function Element_dealloc (line 305) | void Element_dealloc(Element* self)
function hash_to_bytes (line 330) | int hash_to_bytes(uint8_t *input_buf, int input_len, uint8_t *output_buf...
function hash_element_to_bytes (line 399) | int hash_element_to_bytes(Element *element, int hash_size, uint8_t* outp...
function PyObject (line 417) | PyObject *Element_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
function PyObject (line 431) | PyObject *Pairing_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
function Element_init (line 447) | int Element_init(Element *self, PyObject *args, PyObject *kwds)
function Pairing_init (line 453) | int Pairing_init(Pairing *self, PyObject *args, PyObject *kwds)
function PyObject (line 510) | static PyObject *Element_elem(Element* self, PyObject* args)
function PyObject (line 549) | PyObject *Pairing_print(Element* self)
function PyObject (line 555) | PyObject *Element_print(Element* self)
function PyObject (line 575) | static PyObject *Element_random(Element* self, PyObject* args)
function PyObject (line 623) | static PyObject *Element_add(Element *self, Element *other)
function PyObject (line 652) | static PyObject *Element_sub(Element *self, Element *other)
function PyObject (line 681) | static PyObject *Element_mul(PyObject *lhs, PyObject *rhs)
function PyObject (line 753) | static PyObject *Element_div(PyObject *lhs, PyObject *rhs)
function PyObject (line 837) | static PyObject *Element_invert(Element *self)
function PyObject (line 857) | static PyObject *Element_negate(Element *self)
function PyObject (line 869) | static PyObject *Element_pow(PyObject *o1, PyObject *o2, PyObject *o3)
function PyObject (line 973) | static PyObject *Element_set(Element *self, PyObject *args)
function PyObject (line 1014) | static PyObject *Element_setxy(Element *self, PyObject *args)
function PyObject (line 1042) | static PyObject *Element_initPP(Element *self, PyObject *args)
function PyObject (line 1061) | PyObject *multi_pairing_asymmetric(Pairing *groupObj, PyObject *listG1, ...
function PyObject (line 1120) | PyObject *Apply_pairing(Element *self, PyObject *args)
function PyObject (line 1161) | PyObject *sha2_hash(Element *self, PyObject *args) {
function PyObject (line 1199) | static PyObject *Element_hash(Element *self, PyObject *args)
function PyObject (line 1332) | static PyObject *Element_equals(PyObject *lhs, PyObject *rhs, int opid) {
function PyObject (line 1417) | static PyObject *Element_long(PyObject *o1) {
function Element_index (line 1434) | static long Element_index(Element *o1) {
function PyObject (line 1457) | static PyObject *Serialize_cmp(Element *o1, PyObject *args) {
function PyObject (line 1513) | static PyObject *Deserialize_cmp(Element *self, PyObject *args) {
function PyObject (line 1545) | static PyObject *Group_Check(Element *self, PyObject *args) {
function PyObject (line 1567) | static PyObject *Get_Order(Element *self, PyObject *args) {
function PyObject (line 1585) | PyObject *AES_Encrypt(Element *self, PyObject *args)
function PyObject (line 1621) | PyObject *AES_Decrypt(Element *self, PyObject *args)
function PyObject (line 1660) | PyObject *PyCreateList(Operations *gBench, MeasureType type)
type module_state (line 1932) | struct module_state {
type module_state (line 1943) | struct module_state
function pairings_traverse (line 1987) | static int pairings_traverse(PyObject *m, visitproc visit, void *arg) {
function pairings_clear (line 1992) | static int pairings_clear(PyObject *m) {
function pairings_free (line 1998) | static int pairings_free(PyObject *m) {
type PyModuleDef (line 2012) | struct PyModuleDef
type module_state (line 2016) | struct module_state
function initpairing (line 2031) | void initpairing(void) {
FILE: charm/core/math/pairing/miracl/pairingmodule2.h
type Operations (line 109) | typedef struct {
type Pairing (line 121) | typedef struct {
type Element (line 134) | typedef struct {
FILE: charm/core/math/pairing/pairingmodule.c
function exp_rule (line 58) | int exp_rule(GroupType lhs, GroupType rhs)
function mul_rule (line 67) | int mul_rule(GroupType lhs, GroupType rhs)
function add_rule (line 74) | int add_rule(GroupType lhs, GroupType rhs)
function sub_rule (line 80) | int sub_rule(GroupType lhs, GroupType rhs)
function div_rule (line 86) | int div_rule(GroupType lhs, GroupType rhs)
function pair_rule (line 92) | int pair_rule(GroupType lhs, GroupType rhs)
function check_type (line 99) | int check_type(GroupType type) {
function PyObject (line 137) | PyObject *mpzToLongObj (mpz_t m)
function longObjToMPZ (line 161) | void longObjToMPZ (mpz_t m, PyLongObject * p)
function printf_buffer_as_hex (line 200) | void printf_buffer_as_hex(uint8_t * data, size_t len)
function Check_Types (line 214) | int Check_Types(GroupType l_type, GroupType r_type, char op)
function Element (line 241) | static Element *createNewElement(GroupType element_type, Pairing *pairin...
function Element (line 268) | Element *convertToZR(PyObject *longObj, PyObject *elemObj) {
function Pairing_dealloc (line 286) | void Pairing_dealloc(Pairing *self)
function Element_dealloc (line 313) | void Element_dealloc(Element* self)
function read_file (line 328) | ssize_t read_file(FILE *f, char** out)
function hash_to_bytes (line 390) | int hash_to_bytes(uint8_t *input_buf, int input_len, uint8_t *output_buf...
function hash_element_to_bytes (line 452) | int hash_element_to_bytes(element_t *element, int hash_size, uint8_t* ou...
function hash2_element_to_bytes (line 474) | int hash2_element_to_bytes(element_t *element, uint8_t* last_buf, int ha...
function hash2_buffer_to_bytes (line 511) | int hash2_buffer_to_bytes(uint8_t *input_str, int input_len, uint8_t *la...
function PyObject (line 539) | PyObject *Element_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
function PyObject (line 554) | PyObject *Pairing_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
function Element_init (line 571) | int Element_init(Element *self, PyObject *args, PyObject *kwds)
function Pairing_init (line 576) | int Pairing_init(Pairing *self, PyObject *args, PyObject *kwds)
function PyObject (line 689) | static PyObject *Element_elem(Element* self, PyObject* args)
function PyObject (line 727) | PyObject *Pairing_print(Pairing* self)
function PyObject (line 739) | PyObject *Element_print(Element* self)
function PyObject (line 761) | static PyObject *Element_random(Element* self, PyObject* args)
function PyObject (line 808) | static PyObject *Element_add(Element *self, Element *other)
function PyObject (line 833) | static PyObject *Element_sub(Element *self, Element *other)
function PyObject (line 860) | static PyObject *Element_mul(PyObject *lhs, PyObject *rhs)
function PyObject (line 938) | static PyObject *Element_div(PyObject *lhs, PyObject *rhs)
function PyObject (line 1007) | static PyObject *Element_invert(Element *self)
function PyObject (line 1023) | static PyObject *Element_negate(Element *self)
function PyObject (line 1040) | static PyObject *Element_pow(PyObject *o1, PyObject *o2, PyObject *o3)
function PyObject (line 1139) | static PyObject *Element_set(Element *self, PyObject *args)
function PyObject (line 1175) | static PyObject *Element_initPP(Element *self, PyObject *args)
function PyObject (line 1198) | PyObject *multi_pairing(Pairing *groupObj, PyObject *listG1, PyObject *l...
function PyObject (line 1269) | PyObject *Apply_pairing(PyObject *self, PyObject *args)
function PyObject (line 1341) | PyObject *sha2_hash(Element *self, PyObject *args) {
function PyObject (line 1371) | static PyObject *Element_hash(Element *self, PyObject *args) {
function PyObject (line 1519) | static PyObject *Element_equals(PyObject *lhs, PyObject *rhs, int opid) {
function PyObject (line 1556) | static PyObject *Element_long(PyObject *o1) {
function Element_index (line 1572) | static long Element_index(Element *o1) {
function PyObject (line 1673) | static PyObject *Deserialize_cmp(PyObject *self, PyObject *args) {
function print_mpz (line 1724) | void print_mpz(mpz_t x, int base) {
function check_membership (line 1739) | int check_membership(Element *elementObj) {
function PyObject (line 1779) | static PyObject *Group_Check(Element *self, PyObject *args) {
function PyObject (line 1801) | static PyObject *Get_Order(Element *self, PyObject *args) {
function PyObject (line 1818) | PyObject *PyCreateList(Operations *gBench, MeasureType type)
type module_state (line 2089) | struct module_state {
type module_state (line 2097) | struct module_state
function pairings_traverse (line 2139) | static int pairings_traverse(PyObject *m, visitproc visit, void *arg) {
function pairings_clear (line 2144) | static int pairings_clear(PyObject *m) {
function pairings_free (line 2150) | static int pairings_free(PyObject *m) {
type PyModuleDef (line 2155) | struct PyModuleDef
type module_state (line 2159) | struct module_state
function initpairing (line 2174) | void initpairing(void) {
FILE: charm/core/math/pairing/pairingmodule.h
type Group (line 76) | enum Group {ZR = 0, G1, G2, GT, NONE_G}
type GroupType (line 77) | typedef enum Group GroupType;
type Operations (line 109) | typedef struct {
type Pairing (line 122) | typedef struct {
type Element (line 137) | typedef struct {
FILE: charm/core/math/pairing/relic/pairingmodule3.c
function exp_rule (line 32) | int exp_rule(GroupType lhs, GroupType rhs)
function mul_rule (line 41) | int mul_rule(GroupType lhs, GroupType rhs)
function add_rule (line 48) | int add_rule(GroupType lhs, GroupType rhs)
function sub_rule (line 54) | int sub_rule(GroupType lhs, GroupType rhs)
function div_rule (line 60) | int div_rule(GroupType lhs, GroupType rhs)
function pair_rule (line 66) | int pair_rule(GroupType lhs, GroupType rhs)
function check_type (line 73) | int check_type(GroupType type) {
function PyObject (line 111) | PyObject *intToLongObj(integer_t x)
function longObjToInt (line 152) | int longObjToInt(integer_t m, PyLongObject * p)
function printf_buffer_as_hex (line 197) | void printf_buffer_as_hex(uint8_t * data, size_t len)
function printf_buffer_as_hex_debug (line 209) | void printf_buffer_as_hex_debug(uint8_t * data, size_t len)
function Check_Types (line 222) | int Check_Types(GroupType l_type, GroupType r_type, char op)
function Element (line 249) | static Element *createNewElement(GroupType element_type, Pairing *pairin...
function Element (line 277) | Element *convertToZR(PyObject *longObj, PyObject *elemObj) {
function Pairing_dealloc (line 289) | void Pairing_dealloc(Pairing *self)
function Element_dealloc (line 309) | void Element_dealloc(Element* self)
function read_file (line 329) | ssize_t read_file(FILE *f, char** out)
function hash2_element_to_bytes (line 352) | int hash2_element_to_bytes(element_t *e, uint8_t* last_buf, int hash_siz...
function hash2_buffer_to_bytes (line 379) | int hash2_buffer_to_bytes(uint8_t *input_str, int input_len, uint8_t *la...
function PyObject (line 407) | PyObject *Element_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
function PyObject (line 422) | PyObject *Pairing_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
function Element_init (line 437) | int Element_init(Element *self, PyObject *args, PyObject *kwds)
function Pairing_init (line 443) | int Pairing_init(Pairing *self, PyObject *args, PyObject *kwds)
function PyObject (line 468) | static PyObject *Element_elem(Element* self, PyObject* args)
function PyObject (line 500) | PyObject *Pairing_print(Pairing* self)
function PyObject (line 505) | PyObject *Element_print(Element* self)
function PyObject (line 528) | static PyObject *Element_random(Element* self, PyObject* args)
function PyObject (line 572) | static PyObject *Element_add(Element *self, Element *other)
function PyObject (line 599) | static PyObject *Element_sub(Element *self, Element *other)
function PyObject (line 628) | static PyObject *Element_mul(PyObject *lhs, PyObject *rhs)
function PyObject (line 700) | static PyObject *Element_div(PyObject *lhs, PyObject *rhs)
function PyObject (line 781) | static PyObject *Element_invert(Element *self)
function PyObject (line 799) | static PyObject *Element_negate(Element *self)
function PyObject (line 818) | static PyObject *Element_pow(PyObject *o1, PyObject *o2, PyObject *o3)
function PyObject (line 908) | static PyObject *Element_set(Element *self, PyObject *args)
function PyObject (line 936) | static PyObject *Element_initPP(Element *self, PyObject *args)
function PyObject (line 1025) | PyObject *Apply_pairing(Element *self, PyObject *args)
function PyObject (line 1069) | PyObject *sha2_hash(Element *self, PyObject *args) {
function PyObject (line 1100) | static PyObject *Element_hash(Element *self, PyObject *args) {
function PyObject (line 1249) | static PyObject *Element_equals(PyObject *lhs, PyObject *rhs, int opid) {
function PyObject (line 1288) | static PyObject *Element_long(PyObject *o1) {
function Element_index (line 1304) | static long Element_index(Element *o1) {
function PyObject (line 1324) | static PyObject *Serialize_cmp(Element *o1, PyObject *args) {
function PyObject (line 1355) | static PyObject *Deserialize_cmp(Element *self, PyObject *args) {
function PyObject (line 1387) | static PyObject *Group_Check(Element *self, PyObject *args) {
function PyObject (line 1414) | static PyObject *Get_Order(Element *self, PyObject *args) {
function PyObject (line 1435) | PyObject *PyCreateList(Operations *gBench, MeasureType type)
type module_state (line 1708) | struct module_state {
type module_state (line 1716) | struct module_state
function pairings_traverse (line 1756) | static int pairings_traverse(PyObject *m, visitproc visit, void *arg) {
function pairings_clear (line 1761) | static int pairings_clear(PyObject *m) {
function pairings_free (line 1767) | static int pairings_free(PyObject *m) {
type PyModuleDef (line 1771) | struct PyModuleDef
type module_state (line 1775) | struct module_state
function initpairing (line 1790) | void initpairing(void) {
FILE: charm/core/math/pairing/relic/pairingmodule3.h
type Operations (line 95) | typedef struct {
type Pairing (line 109) | typedef struct {
type Element (line 120) | typedef struct {
FILE: charm/core/math/pairing/relic/relic_interface.c
function print_as_hex (line 33) | void print_as_hex(uint8_t *data, size_t len)
function fp_write_bin (line 48) | void fp_write_bin(unsigned char *str, int len, fp_t a) {
function fp_read_bin (line 67) | void fp_read_bin(fp_t a, const unsigned char *str, int len) {
function bn_is_one (line 94) | int bn_is_one(bn_t a)
function status_t (line 101) | status_t pairing_init(void)
function status_t (line 111) | status_t pairing_clear(void)
function status_t (line 120) | status_t element_init_Zr(element_t e, int init_value)
function status_t (line 136) | status_t element_init_G1(element_t e)
function status_t (line 148) | status_t element_init_G2(element_t e)
function status_t (line 159) | status_t element_init_GT(element_t e)
function status_t (line 170) | status_t element_pp_init(element_pp_t e_pp, element_t e)
function status_t (line 195) | status_t element_pp_clear(element_pp_t e_pp, GroupType type)
function status_t (line 214) | status_t element_pp_pow(element_t o, element_pp_t e_pp, GroupType type, ...
function status_t (line 232) | status_t element_pp_pow_int(element_t o, element_pp_t e_pp, GroupType ty...
function status_t (line 251) | status_t element_random(element_t e)
function status_t (line 281) | status_t element_printf(const char *msg, element_t e)
function status_t (line 300) | status_t element_to_str(char *data, int len, element_t e)
function status_t (line 343) | status_t element_clear(element_t e)
function status_t (line 373) | status_t element_add(element_t c, element_t a, element_t b)
function status_t (line 401) | status_t element_sub(element_t c, element_t a, element_t b)
function status_t (line 429) | status_t element_mul(element_t c, element_t a, element_t b)
function status_t (line 462) | status_t element_mul_zr(element_t c, element_t a, element_t b)
function status_t (line 486) | status_t element_mul_int(element_t c, element_t a, integer_t b)
function status_t (line 515) | status_t element_div(element_t c, element_t a, element_t b)
function status_t (line 563) | status_t element_div_int(element_t c, element_t a, integer_t b)
function status_t (line 609) | status_t element_int_div(element_t c, integer_t a, element_t b)
function status_t (line 640) | status_t element_neg(element_t c, element_t a)
function status_t (line 664) | status_t element_invert(element_t c, element_t a)
function status_t (line 692) | status_t element_pow_zr(element_t c, element_t a, element_t b)
function status_t (line 723) | status_t element_pow_int(element_t c, element_t a, integer_t b)
function element_cmp (line 753) | int element_cmp(element_t a, element_t b)
function status_t (line 771) | status_t element_set(element_t e, element_t a)
function status_t (line 796) | status_t element_set_int(element_t e, integer_t x)
function status_t (line 808) | status_t element_to_int(integer_t x, element_t e)
function status_t (line 825) | status_t element_set_si(element_t e, unsigned int x)
function status_t (line 835) | status_t element_from_hash(element_t e, unsigned char *data, int len)
function element_length (line 867) | int element_length(element_t e)
function status_t (line 882) | status_t charm_g1_read_bin(g1_t g, uint8_t *data, int data_len)
function status_t (line 893) | status_t charm_g1_write_bin(g1_t g, uint8_t *data, int data_len)
function status_t (line 917) | status_t charm_g1_write_str(g1_t g, uint8_t *data, int data_len)
function status_t (line 932) | status_t charm_g2_read_bin(g2_t g, uint8_t *data, int data_len)
function status_t (line 953) | status_t charm_g2_write_bin(g2_t g, uint8_t *data, int data_len)
function status_t (line 985) | status_t charm_g2_write_str(g2_t g, uint8_t *data, int data_len)
function status_t (line 1005) | status_t charm_gt_read_bin(gt_t g, uint8_t *data, int data_len)
function status_t (line 1043) | status_t charm_gt_write_bin(gt_t g, uint8_t *data, int data_len)
function status_t (line 1093) | status_t charm_gt_write_str(gt_t g, uint8_t *data, int data_len)
function status_t (line 1129) | status_t element_from_bytes(element_t e, unsigned char *data, int data_len)
function status_t (line 1152) | status_t element_to_bytes(unsigned char *data, int data_len, element_t e)
function status_t (line 1175) | status_t element_to_key(element_t e, uint8_t *data, int data_len, uint8_...
function status_t (line 1214) | status_t hash_buffer_to_bytes(uint8_t *input_buf, int input_len, uint8_t...
function status_t (line 1266) | status_t pairing_apply(element_t et, element_t e1, element_t e2)
function element_is_member (line 1279) | int element_is_member(element_t e)
function get_order (line 1330) | int get_order(integer_t x)
FILE: charm/core/math/pairing/relic/relic_interface.h
type status_t (line 45) | typedef enum _status_t { ELEMENT_OK = 2,
type Group (line 56) | enum Group {ZR, G1, G2, GT, NONE_G}
type GroupType (line 57) | typedef enum Group GroupType;
type element (line 77) | struct element {
type object (line 87) | struct object {
type element (line 93) | struct element
type element (line 94) | struct element
type object (line 95) | struct object
type bn_t (line 96) | typedef bn_t integer_t;
FILE: charm/core/math/pairing/relic/test_relic.c
function main (line 42) | int main(int argc, char *argv[])
FILE: charm/schemes/abenc/abenc_accountability_jyjxgd20.py
class Attribute (line 29) | class Attribute:
method __init__ (line 30) | def __init__(self, attr_name, values_list: List[str] = []):
method __validate_attribute_values_name (line 40) | def __validate_attribute_values_name(attr_value_name: str):
method add_value (line 43) | def add_value(self, value: str):
method set_values (line 47) | def set_values(self, values_list: List[str]):
method get_attribute_values_full_name (line 50) | def get_attribute_values_full_name(self):
method get_full_attribute_value_name (line 61) | def get_full_attribute_value_name(attr_name: str, value_name: str):
class CP_Hiding_ABE (line 67) | class CP_Hiding_ABE(ABEnc):
method __init__ (line 71) | def __init__(self, group_obj):
method setup (line 76) | def setup(self, attributes_dict: Dict[str, List[str]]):
method key_gen (line 104) | def key_gen(self, MSK, PK, attributes_list):
method _validate_attributes_list (line 139) | def _validate_attributes_list(self, attributes_list):
method encrypt (line 149) | def encrypt(self, m, PK, access_policy: Dict[str, List[str]]):
method decrypt (line 200) | def decrypt(self, CT, PK, SK):
class CP_Hiding_Accountability_ABE (line 230) | class CP_Hiding_Accountability_ABE(CP_Hiding_ABE):
method __init__ (line 234) | def __init__(self, group_obj):
method setup (line 239) | def setup(self, attributes_dict: Dict[str, List[str]]):
method key_gen (line 279) | def key_gen(self, MSK, PK, ID, attributes_list):
method key_gen_TA (line 316) | def key_gen_TA(self, MSK, PK, ID, R, attributes_list):
method encrypt (line 366) | def encrypt(self, m, PK, access_policy: Dict[str, List[str]]):
method decrypt (line 423) | def decrypt(self, CT, PK, SK):
method trace (line 453) | def trace(self, SK_suspected, authentic_user_IDs_list, PK):
method _is_SK_well_formed (line 481) | def _is_SK_well_formed(self, SK):
class ShnorrInteractiveZKP (line 490) | class ShnorrInteractiveZKP():
class Prover (line 494) | class Prover:
method __init__ (line 495) | def __init__(self, secret_x, groupObj):
method create_prover_commitments (line 500) | def create_prover_commitments(self, pk):
method create_proof (line 508) | def create_proof(self, c):
class Verifier (line 515) | class Verifier:
method __init__ (line 517) | def __init__(self, groupObj):
method create_verifier_challenge (line 520) | def create_verifier_challenge(self):
method is_proof_verified (line 527) | def is_proof_verified(self, z, pk, u, h):
function main (line 539) | def main():
function CP_policy_hiding_ABE_test (line 544) | def CP_policy_hiding_ABE_test():
function CP_policy_hiding_with_accountability_test (line 588) | def CP_policy_hiding_with_accountability_test():
FILE: charm/schemes/abenc/abenc_bsw07.py
class CPabe_BSW07 (line 33) | class CPabe_BSW07(ABEnc):
method __init__ (line 49) | def __init__(self, groupObj):
method setup (line 56) | def setup(self):
method keygen (line 71) | def keygen(self, pk, mk, S):
method encrypt (line 84) | def encrypt(self, pk, M, policy_str):
method decrypt (line 102) | def decrypt(self, pk, sk, ct):
function main (line 116) | def main():
FILE: charm/schemes/abenc/abenc_ca_cpabe_ar17.py
class TreeNode (line 35) | class TreeNode:
method __init__ (line 36) | def __init__(self, sequence_number, value, parent=None):
method __str__ (line 43) | def __str__(self):
method __repr__ (line 46) | def __repr__(self):
class UsersBinaryTree (line 50) | class UsersBinaryTree:
method __init__ (line 55) | def __init__(self, group_obj):
method create_node (line 63) | def create_node(self) -> TreeNode:
method add_node_to_tree (line 67) | def add_node_to_tree(self, tree_node: TreeNode):
method print_tree (line 85) | def print_tree(self):
method __print_tree_rec (line 90) | def __print_tree_rec(self, node: TreeNode):
class AM (line 98) | class AM:
method __init__ (line 100) | def __init__(self, group_obj):
method add_attr_to_user (line 106) | def add_attr_to_user(self, attr_str: str, user_name: str):
method __create_node_in_binary_tree_for_new_user (line 119) | def __create_node_in_binary_tree_for_new_user(self):
method remove_attr_from_user (line 126) | def remove_attr_from_user(self, attr_str: str, user_name: str):
method get_user_assignation_to_leafs_dict (line 133) | def get_user_assignation_to_leafs_dict(self) -> Dict[str, TreeNode]:
method get_minimum_nodes_list_that_represent_users_list (line 145) | def get_minimum_nodes_list_that_represent_users_list(self, user_names_...
method __traverse_to_mark_all_children_visited_arr (line 162) | def __traverse_to_mark_all_children_visited_arr(self, node: TreeNode, ...
method __traverse_bfs_to_get_minimum_number_nodes_to_cover_users_list (line 174) | def __traverse_bfs_to_get_minimum_number_nodes_to_cover_users_list(sel...
method get_user_path (line 191) | def get_user_path(self, user_name) -> List[TreeNode]:
method get_user_path_intersection_with_node_gi (line 206) | def get_user_path_intersection_with_node_gi(user_path: List[TreeNode],...
class CaCpabeAr (line 215) | class CaCpabeAr(ABEnc):
method __init__ (line 216) | def __init__(self, group_obj):
method system_setup (line 221) | def system_setup(self) -> (mk_t, pp_t):
method manager_setup (line 239) | def manager_setup(self, attribute_names: List[str], PP: pp_t):
method key_generation (line 260) | def key_generation(self, PP, MK, MPK, user_attribute_names_list: List[...
method user_attributes_key_gen (line 291) | def user_attributes_key_gen(self, MK, MPK, PP, user_attribute_names_li...
method user_attributes_kek_generation (line 327) | def user_attributes_kek_generation(self, TA_KEK, attributes_manager, u...
method generate_kek_for_user_with_attr (line 345) | def generate_kek_for_user_with_attr(self, TA_KEK, attr, attributes_man...
method encrypt (line 374) | def encrypt(self, PP, MMK, M, A: str, attributes_manager: AM):
method reencryption (line 392) | def reencryption(self, CT, MMK, PP, attributes_manager):
method __get_attr_name_without_idx (line 421) | def __get_attr_name_without_idx(self, attr_name: str):
method local_encryption (line 427) | def local_encryption(self, A, M, PP):
method decrypt (line 453) | def decrypt(self, PP, CT_tilde, Hdr, DSK, KEK, user_name: str, attribu...
method revoke_attribute (line 496) | def revoke_attribute(self, revoked_user_name, attribute_name, attribut...
method add_attribute (line 535) | def add_attribute(self, user_name, attribute_name, attributes_manager:...
function main (line 575) | def main():
FILE: charm/schemes/abenc/abenc_dacmacs_yj14.py
class DACMACS (line 27) | class DACMACS(object):
method __init__ (line 28) | def __init__(self, groupObj):
method setup (line 32) | def setup(self):
method registerUser (line 50) | def registerUser(self, GPP):
method setupAuthority (line 60) | def setupAuthority(self, GPP, authorityid, attributes, authorities):
method keygen (line 88) | def keygen(self, GPP, authority, attribute, userObj, USK = None):
method encrypt (line 111) | def encrypt(self, GPP, policy_str, k, authority):
method generateTK (line 142) | def generateTK(self, GPP, CT, UASK, g_u):
method decrypt (line 165) | def decrypt(self, CT, TK, z):
method ukeygen (line 169) | def ukeygen(self, GPP, authority, attribute, userObj):
method skupdate (line 188) | def skupdate(self, USK, attribute, KUK):
method ctupdate (line 192) | def ctupdate(self, GPP, CT, attribute, CUK):
function basicTest (line 196) | def basicTest():
function revokedTest (line 232) | def revokedTest():
function test (line 286) | def test():
FILE: charm/schemes/abenc/abenc_lsw08.py
class KPabe (line 28) | class KPabe(ABEnc):
method __init__ (line 44) | def __init__(self, groupObj, verbose=False):
method setup (line 50) | def setup(self):
method keygen (line 67) | def keygen(self, pk, mk, policy_str):
method negatedAttr (line 90) | def negatedAttr(self, attribute):
method encrypt (line 98) | def encrypt(self, pk, M, attr_list):
method decrypt (line 119) | def decrypt(self, E, D):
function main (line 136) | def main():
FILE: charm/schemes/abenc/abenc_maabe_rw15.py
function merge_dicts (line 31) | def merge_dicts(*dict_args):
class MaabeRW15 (line 42) | class MaabeRW15(ABEncMultiAuth):
method __init__ (line 79) | def __init__(self, group, verbose=False):
method setup (line 84) | def setup(self):
method unpack_attribute (line 96) | def unpack_attribute(self, attribute):
method authsetup (line 113) | def authsetup(self, gp, name):
method keygen (line 131) | def keygen(self, gp, sk, gid, attribute):
method multiple_attributes_keygen (line 152) | def multiple_attributes_keygen(self, gp, sk, gid, attributes):
method encrypt (line 166) | def encrypt(self, gp, pks, message, policy_str):
method decrypt (line 200) | def decrypt(self, gp, sk, ct):
FILE: charm/schemes/abenc/abenc_maabe_yj14.py
class MAABE (line 27) | class MAABE(object):
method __init__ (line 28) | def __init__(self, groupObj):
method setup (line 32) | def setup(self):
method registerUser (line 52) | def registerUser(self, GPP):
method setupAuthority (line 62) | def setupAuthority(self, GPP, authorityid, attributes, authorities):
method keygen (line 91) | def keygen(self, GPP, authority, attribute, userObj, USK = None):
method encrypt (line 113) | def encrypt(self, GPP, policy_str, k, authority):
method decrypt (line 146) | def decrypt(self, GPP, CT, user):
method ukeygen (line 174) | def ukeygen(self, GPP, authority, attribute, userObj):
method skupdate (line 192) | def skupdate(self, USK, attribute, UKs):
method ctupdate (line 196) | def ctupdate(self, GPP, CT, attribute, UKc):
function basicTest (line 201) | def basicTest():
function revokedTest (line 235) | def revokedTest():
function test (line 285) | def test():
FILE: charm/schemes/abenc/abenc_tbpre_lww14.py
function gcd (line 29) | def gcd(*numbers):
function lcm (line 39) | def lcm(numbers):
class TBPRE (line 45) | class TBPRE(object):
method __init__ (line 46) | def __init__(self, groupObj):
method setup (line 52) | def setup(self, attributes):
method registerUser (line 85) | def registerUser(self, PK, H):
method hashDate (line 94) | def hashDate(self, H, time, s):
method timeSuffices (line 113) | def timeSuffices(self, timeRange, needle):
method policyTerm (line 129) | def policyTerm(self, user, policy):
method keygen (line 141) | def keygen(self, MK, PK, H, s, user, pubuser, attribute, time):
method encrypt (line 159) | def encrypt(self, PK, policy, F):
method decrypt (line 174) | def decrypt(self, CT, user, term = None):
method reencrypt (line 198) | def reencrypt(self, PK, H, s, CT, currentTime):
function basicTest (line 234) | def basicTest():
function basicTest2 (line 272) | def basicTest2():
function test (line 302) | def test():
FILE: charm/schemes/abenc/abenc_unmcpabe_yahk14.py
class CPABE_YAHK14 (line 29) | class CPABE_YAHK14(ABEnc):
method __init__ (line 45) | def __init__(self, groupObj, verbose = False):
method exp (line 52) | def exp(self,value):
method setup (line 55) | def setup(self):
method keygen (line 65) | def keygen(self, pp, mk, S):
method encrypt (line 94) | def encrypt(self, pp, message, policy_str):
method decrypt (line 123) | def decrypt(self, pp, sk, ct):
method randomMessage (line 161) | def randomMessage(self):
function main (line 164) | def main():
FILE: charm/schemes/abenc/abenc_waters09.py
class CPabe09 (line 27) | class CPabe09(ABEnc):
method __init__ (line 43) | def __init__(self, groupObj):
method setup (line 49) | def setup(self):
method keygen (line 57) | def keygen(self, pk, msk, attributes):
method encrypt (line 70) | def encrypt(self, pk, M, policy_str):
method decrypt (line 92) | def decrypt(self, pk, sk, ct):
function main (line 116) | def main():
FILE: charm/schemes/abenc/abenc_yct14.py
class EKPabe (line 32) | class EKPabe(ABEnc):
method __init__ (line 48) | def __init__(self, groupObj, verbose=False):
method setup (line 54) | def setup(self, attributes):
method keygen (line 66) | def keygen(self, pk, mk, policy_str):
method encrypt (line 83) | def encrypt(self, pk, M, attr_list):
method decrypt (line 97) | def decrypt(self, C, D):
function main (line 116) | def main():
function benchmark (line 141) | def benchmark():
FILE: charm/schemes/abenc/abenc_yllc15.py
class YLLC15 (line 44) | class YLLC15(ABEnc):
method __init__ (line 48) | def __init__(self, group):
method setup (line 54) | def setup(self):
method ukgen (line 70) | def ukgen(self, params):
method proxy_keygen (line 79) | def proxy_keygen(self, params, msk, pkcs, pku, attribute_list):
method encrypt (line 103) | def encrypt(self, params, msg, policy_str):
method proxy_decrypt (line 134) | def proxy_decrypt(self, skcs, proxy_key_user, ciphertext):
method decrypt (line 167) | def decrypt(self, params, sku, intermediate_value):
FILE: charm/schemes/abenc/ac17.py
class AC17CPABE (line 30) | class AC17CPABE(ABEnc):
method __init__ (line 31) | def __init__(self, group_obj, assump_size, verbose=False):
method setup (line 37) | def setup(self):
method keygen (line 87) | def keygen(self, pk, msk, attr_list):
method encrypt (line 150) | def encrypt(self, pk, msg, policy_str):
method decrypt (line 220) | def decrypt(self, pk, ctxt, key):
FILE: charm/schemes/abenc/bsw07.py
class BSW07 (line 30) | class BSW07(ABEnc):
method __init__ (line 32) | def __init__(self, group_obj, verbose=False):
method setup (line 37) | def setup(self):
method keygen (line 61) | def keygen(self, pk, msk, attr_list):
method encrypt (line 83) | def encrypt(self, pk, msg, policy_str):
method decrypt (line 119) | def decrypt(self, pk, ctxt, key):
FILE: charm/schemes/abenc/cgw15.py
class CGW15CPABE (line 30) | class CGW15CPABE(ABEnc):
method __init__ (line 31) | def __init__(self, groupObj, assump_size, uni_size, verbose=False):
method setup (line 38) | def setup(self):
method keygen (line 126) | def keygen(self, pk, msk, attr_list):
method encrypt (line 177) | def encrypt(self, pk, msg, policy_str):
method decrypt (line 249) | def decrypt(self, pk, ctxt, key):
FILE: charm/schemes/abenc/dabe_aw11.py
class Dabe (line 28) | class Dabe(ABEncMultiAuth):
method __init__ (line 49) | def __init__(self, groupObj):
method setup (line 56) | def setup(self):
method authsetup (line 71) | def authsetup(self, GP, attributes):
method keygen (line 95) | def keygen(self, gp, sk, i, gid, pkey):
method encrypt (line 114) | def encrypt(self, gp, pk, M, policy_str):
method decrypt (line 144) | def decrypt(self, gp, sk, ct):
function main (line 169) | def main():
FILE: charm/schemes/abenc/dfa_fe12.py
class FE_DFA (line 26) | class FE_DFA:
method __init__ (line 27) | def __init__(self, _groupObj, _dfaObj):
method setup (line 32) | def setup(self, alphabet):
method keygen (line 43) | def keygen(self, mpk, msk, dfaM):
method encrypt (line 72) | def encrypt(self, mpk, w, M):
method decrypt (line 92) | def decrypt(self, sk, ct):
function main (line 114) | def main():
FILE: charm/schemes/abenc/pk_hve08.py
class HVE08 (line 25) | class HVE08:
method __init__ (line 26) | def __init__(self, groupObj):
method setup (line 30) | def setup(self, n):
method keygen (line 54) | def keygen(self, pk, msk, yVector):
method encrypt (line 105) | def encrypt(self, M, xVector, pk):
method decrypt (line 139) | def decrypt(self, CT, sk):
function main (line 160) | def main():
FILE: charm/schemes/abenc/waters11.py
class Waters11 (line 30) | class Waters11(ABEnc):
method __init__ (line 32) | def __init__(self, group_obj, uni_size, verbose=False):
method setup (line 38) | def setup(self):
method keygen (line 64) | def keygen(self, pk, msk, attr_list):
method encrypt (line 82) | def encrypt(self, pk, msg, policy_str):
method decrypt (line 121) | def decrypt(self, pk, ctxt, key):
FILE: charm/schemes/aggrsign_MuSig.py
class MuSig (line 33) | class MuSig:
method __init__ (line 34) | def __init__(self, groupObj):
method keygen (line 38) | def keygen(self, g, secparam=None):
method sign (line 45) | def sign(self, nonce, sk, pk, challenge, all_pub_keys):
method verify (line 50) | def verify(self, pub_keys, sig, message):
method aggregate_sigs (line 58) | def aggregate_sigs(signatures):
method new_nonce (line 62) | def new_nonce():
method aggregate_nonce (line 66) | def aggregate_nonce(g, nonces):
method hash_pub_keys (line 70) | def hash_pub_keys(pub_keys):
method aggregated_pub_key (line 77) | def aggregated_pub_key(pub_keys):
method compute_challenge (line 87) | def compute_challenge(aggregated_pub_key, aggregate_nonce, message):
method product (line 93) | def product(seq):
method dump (line 97) | def dump(obj):
function main (line 101) | def main():
FILE: charm/schemes/aggrsign_bls.py
class BLSAggregation (line 30) | class BLSAggregation:
method __init__ (line 31) | def __init__(self, groupObj):
method keygen (line 35) | def keygen(self, g, secparam=None):
method sign (line 42) | def sign(self, x, message):
method verify (line 48) | def verify(self, pk, sig, message):
method aggregate_sigs_vulnerable (line 53) | def aggregate_sigs_vulnerable(self, signatures):
method verify_aggregate_sig_vulnerable (line 59) | def verify_aggregate_sig_vulnerable(self, message, aggregate_sig, publ...
method aggregate_sigs_safe (line 67) | def aggregate_sigs_safe(self, pubkey_signatures):
method verify_aggregate_sig_safe (line 77) | def verify_aggregate_sig_safe(self, message, aggregate_sig, public_keys):
method product (line 86) | def product(seq):
method dump (line 90) | def dump(obj):
method check_and_return_same_generator_in_public_keys (line 94) | def check_and_return_same_generator_in_public_keys(public_keys):
method hash_keys (line 100) | def hash_keys(pk, all_pks):
method aggregate_pub_key (line 107) | def aggregate_pub_key(pks):
function vulnerable (line 115) | def vulnerable():
function demo_rogue_public_key_attack (line 159) | def demo_rogue_public_key_attack():
function safe (line 188) | def safe():
function defend_rogue_public_key_attack (line 233) | def defend_rogue_public_key_attack():
FILE: charm/schemes/blindsig_ps16.py
function dump_to_zp_element (line 29) | def dump_to_zp_element(obj, group_obj):
class ShnorrInteractiveZKP (line 34) | class ShnorrInteractiveZKP():
class Prover (line 35) | class Prover:
method __init__ (line 36) | def __init__(self, secret_t, secret_messages, groupObj):
method create_prover_commitments (line 43) | def create_prover_commitments(self, pk):
method create_proof (line 57) | def create_proof(self, c):
class Verifier (line 65) | class Verifier:
method __init__ (line 67) | def __init__(self, groupObj):
method create_verifier_challenge (line 70) | def create_verifier_challenge(self):
method is_proof_verified (line 77) | def is_proof_verified(self, s_t, s_ms, pk, blinded_message, commitme...
class PS_Sig (line 91) | class PS_Sig(PKSig):
method __init__ (line 93) | def __init__(self, groupObj):
method _dump_to_zp_element (line 97) | def _dump_to_zp_element(self, obj):
method keygen (line 101) | def keygen(self):
method sign (line 107) | def sign(self, sk, message):
method verify (line 118) | def verify(self, message, pk, sig) -> bool:
class PS_BlindSig (line 133) | class PS_BlindSig(PS_Sig):
method __init__ (line 135) | def __init__(self, groupObj):
method keygen (line 138) | def keygen(self):
method blind (line 144) | def blind(self, message):
method sign (line 154) | def sign(self, sk, blinded_message):
method unblind (line 165) | def unblind(self, blinded_sig, t):
method proof_of_knowledge_of_commitment_secrets (line 176) | def proof_of_knowledge_of_commitment_secrets(self, t, messages, blinde...
method verify (line 197) | def verify(self, message, pk, sig) -> bool:
class PS_BlindSingleMessageSig (line 212) | class PS_BlindSingleMessageSig(PS_BlindSig):
method __init__ (line 214) | def __init__(self, groupObj):
method keygen (line 217) | def keygen(self):
method blind (line 239) | def blind(self, message, pk):
method sign (line 255) | def sign(self, sk, pk, blinded_message):
method unblind (line 273) | def unblind(self, blinded_sig, t):
method verify (line 289) | def verify(self, message, pk, sig) -> bool:
class PS_BlindMultiMessageSig (line 308) | class PS_BlindMultiMessageSig(PS_BlindSig):
method __init__ (line 310) | def __init__(self, groupObj):
method keygen (line 313) | def keygen(self, num_messages):
method blind (line 335) | def blind(self, messages, pk):
method sign (line 354) | def sign(self, sk, pk, blinded_message):
method unblind (line 372) | def unblind(self, blinded_sig, t):
method verify (line 388) | def verify(self, messages, pk, sig) -> bool:
class PS_SigSingleMessage (line 410) | class PS_SigSingleMessage(PS_Sig):
method __init__ (line 412) | def __init__(self, groupObj):
method keygen (line 415) | def keygen(self):
method sign (line 430) | def sign(self, sk, message):
method verify (line 445) | def verify(self, message, pk, sig) -> bool:
class PS_SigMultiMessage (line 464) | class PS_SigMultiMessage(PS_Sig):
method __init__ (line 466) | def __init__(self, groupObj):
method keygen (line 469) | def keygen(self, num_messages):
method sign (line 486) | def sign(self, sk, messages):
method verify (line 504) | def verify(self, messages, pk, sig) -> bool:
function single_message_main (line 526) | def single_message_main(debug=False):
function multi_message_main (line 548) | def multi_message_main(debug=False):
function blinded_single_message_main (line 570) | def blinded_single_message_main(debug=False):
function blinded_multi_message_main (line 608) | def blinded_multi_message_main(debug=False):
FILE: charm/schemes/chamhash_adm05.py
class ChamHash_Adm05 (line 27) | class ChamHash_Adm05(ChamHash):
method __init__ (line 40) | def __init__(self, p=0, q=0):
method paramgen (line 46) | def paramgen(self, secparam=1024):
method hash (line 60) | def hash(self, pk, m, r=0, s=0):
method find_collision (line 71) | def find_collision(self, pk, sk, C, new_message):
function main (line 81) | def main():
FILE: charm/schemes/chamhash_rsa_hw09.py
class ChamHash_HW09 (line 28) | class ChamHash_HW09(ChamHash):
method __init__ (line 41) | def __init__(self):
method paramgen (line 45) | def paramgen(self, secparam, p = 0, q = 0):
method hash (line 93) | def hash(self, pk, message, r = 0):
FILE: charm/schemes/commit/commit_gs08.py
class Commitment_GS08 (line 27) | class Commitment_GS08(Commitment):
method __init__ (line 37) | def __init__(self, groupObj, setting='SXDH'):
method setup (line 46) | def setup(self, secparam=None, groupChoice=G1, commitType='binding'):
method commit (line 56) | def commit(self, params, msg):
method decommit (line 66) | def decommit(self, params, c, d, msg):
FILE: charm/schemes/commit/commit_pedersen92.py
class CM_Ped92 (line 27) | class CM_Ped92(Commitment):
method __init__ (line 37) | def __init__(self, groupObj):
method setup (line 42) | def setup(self, secparam=None):
method commit (line 45) | def commit(self, pk, msg):
method decommit (line 51) | def decommit(self, pk, c, d, msg):
FILE: charm/schemes/encap_bchk05.py
class EncapBCHK (line 26) | class EncapBCHK():
method __init__ (line 35) | def __init__(self):
method setup (line 39) | def setup(self):
method S (line 43) | def S(self, pub):
method R (line 55) | def R(self, pub, com, dec):
FILE: charm/schemes/grpsig/groupsig_bgls04.py
class ShortSig (line 26) | class ShortSig(PKSig):
method __init__ (line 38) | def __init__(self, groupObj):
method keygen (line 43) | def keygen(self, n):
method sign (line 63) | def sign(self, gpk, gsk, M):
method verify (line 86) | def verify(self, gpk, M, sigma):
method open (line 109) | def open(self, gpk, gmsk, M, sigma):
FILE: charm/schemes/grpsig/groupsig_bgls04_var.py
class ShortSig (line 26) | class ShortSig(PKSig):
method __init__ (line 38) | def __init__(self, groupObj):
method keygen (line 43) | def keygen(self, n):
method sign (line 63) | def sign(self, gpk, gsk, M):
method verify (line 86) | def verify(self, gpk, M, sigma):
method open (line 110) | def open(self, gpk, gmsk, M, sigma):
FILE: charm/schemes/hibenc/hibenc_bb04.py
class HIBE_BB04 (line 27) | class HIBE_BB04:
method __init__ (line 42) | def __init__(self, groupObj):
method setup (line 47) | def setup(self, l=5, z=32):
method extract (line 67) | def extract(self, level, mpk, mk, ID):
method derive (line 77) | def derive(self, mpk, pk):
method encrypt (line 88) | def encrypt(self, mpk, pk, M):
method decrypt (line 99) | def decrypt(self, pk, sk, ct):
FILE: charm/schemes/hibenc/hibenc_lew11.py
class HIBE_LW11 (line 29) | class HIBE_LW11:
method __init__ (line 55) | def __init__(self, groupObj):
method setup (line 61) | def setup(self):
method keyGen (line 96) | def keyGen(self, I, MSK, PP):
method delegate (line 129) | def delegate (self, PP, SK, I):
method encrypt (line 164) | def encrypt(self, M, I, PP):
method decrypt (line 187) | def decrypt(self, CT, SK):
FILE: charm/schemes/ibenc/clpkc_rp03.py
class CLPKC_RP03 (line 28) | class CLPKC_RP03():
method __init__ (line 30) | def __init__(self, groupObj):
method setup (line 36) | def setup(self, secparam=None):
method partial_private_key_extract (line 44) | def partial_private_key_extract(self, master_key, ID):
method set_private_key (line 53) | def set_private_key(self, DA, xA):
method set_public_key (line 59) | def set_public_key(self, params, xA):
method encrypt (line 65) | def encrypt(self, params, M, ID, P): # check length to make sure it is...
method decrypt (line 79) | def decrypt(self, params, SA, C):
method encodeToZn (line 93) | def encodeToZn(self, message):
method decodeFromZn (line 97) | def decodeFromZn(self, element):
function main (line 104) | def main():
FILE: charm/schemes/ibenc/ibenc_CW13_z.py
class IBE_CW13 (line 29) | class IBE_CW13(IBEnc):
method __init__ (line 42) | def __init__(self, groupObj):
method setup (line 48) | def setup(self):
method extract (line 109) | def extract(self, mpk, msk, ID):
method encrypt (line 125) | def encrypt(self, mpk, ID, M):
method decrypt (line 142) | def decrypt(self, mpk, sk_id, ct_id):
method vpair (line 150) | def vpair(self, g1v, g2v):
function main (line 153) | def main():
FILE: charm/schemes/ibenc/ibenc_bb03.py
class IBE_BB04 (line 28) | class IBE_BB04(IBEnc):
method __init__ (line 41) | def __init__(self, groupObj):
method setup (line 48) | def setup(self, secparam=None):
method extract (line 61) | def extract(self, mk, ID):
method encrypt (line 68) | def encrypt(self, params, ID, M):
method keyenc (line 76) | def keyenc(self, params, ID, msg):
method decrypt (line 85) | def decrypt(self, pk, dID, CT):
method keydec (line 90) | def keydec(self, pk, dID, CT):
FILE: charm/schemes/ibenc/ibenc_bf01.py
class IBE_BonehFranklin (line 28) | class IBE_BonehFranklin(IBEnc):
method __init__ (line 41) | def __init__(self, groupObj):
method setup (line 47) | def setup(self):
method extract (line 60) | def extract(self, sk, ID):
method encrypt (line 69) | def encrypt(self, pk, ID, M): # check length to make sure it is within...
method decrypt (line 92) | def decrypt(self, pk, sk, ct):
method encodeToZn (line 111) | def encodeToZn(self, message):
method decodeFromZn (line 115) | def decodeFromZn(self, element):
FILE: charm/schemes/ibenc/ibenc_ckrs09.py
class IBE_CKRS (line 31) | class IBE_CKRS(IBEnc):
method __init__ (line 45) | def __init__(self, groupObj):
method setup (line 49) | def setup(self, n=5, l=32):
method extract (line 68) | def extract(self, mpk, msk, ID):
method encrypt (line 81) | def encrypt(self, mpk, ID, msg):
method decrypt (line 94) | def decrypt(self, mpk, sk, ct):
function main (line 100) | def main():
FILE: charm/schemes/ibenc/ibenc_cllww12_z.py
class IBE_Chen12_z (line 31) | class IBE_Chen12_z(IBEnc):
method __init__ (line 44) | def __init__(self, groupObj):
method setup (line 49) | def setup(self):
method extract (line 115) | def extract(self, msk, ID):
method encrypt (line 132) | def encrypt(self, pk, ID, M):
method decrypt (line 149) | def decrypt(self, pk, sk, ct):
function main (line 157) | def main():
FILE: charm/schemes/ibenc/ibenc_lsw08.py
class IBE_Revoke (line 26) | class IBE_Revoke(IBEnc):
method __init__ (line 43) | def __init__(self, groupObj):
method setup (line 48) | def setup(self, n):
method keygen (line 62) | def keygen(self, mpk, msk, ID):
method encrypt (line 79) | def encrypt(self, mpk, M, S):
method decrypt (line 106) | def decrypt(self, S, ct, sk):
FILE: charm/schemes/ibenc/ibenc_sw05.py
class IBE_SW05 (line 28) | class IBE_SW05(IBEnc):
method __init__ (line 45) | def __init__(self, groupObj):
method setup (line 52) | def setup(self, n, d):
method intersection_subset (line 70) | def intersection_subset(self, w, wPrime, d):
method extract (line 83) | def extract(self, mk, ID, pk, dOver, n):
method encrypt (line 102) | def encrypt(self, pk, w_prime, M, n):
method decrypt (line 117) | def decrypt(self, pk, sk, CT, w, d):
class IBE_SW05_LUC (line 143) | class IBE_SW05_LUC(IBEnc):
method __init__ (line 144) | def __init__(self, groupObj):
method setup (line 151) | def setup(self, n, d):
method eval_T (line 169) | def eval_T(self, pk, n, x):
method intersection_subset (line 182) | def intersection_subset(self, w, wPrime, d):
method extract (line 195) | def extract(self, mk, ID, pk, dOver, n):
method encrypt (line 212) | def encrypt(self, pk, w_prime, M, n):
method decrypt (line 228) | def decrypt(self, pk, sk, CT, w, d):
FILE: charm/schemes/ibenc/ibenc_waters05.py
class IBE_N04 (line 30) | class IBE_N04(IBEnc):
method __init__ (line 49) | def __init__(self, groupObj):
method setup (line 55) | def setup(self, l=32):
method extract (line 82) | def extract(self, mk, v):
method encrypt (line 98) | def encrypt(self, pk, ID, M): # M:GT
method decrypt (line 114) | def decrypt(self, pk, sID, ct):
function main (line 126) | def main():
FILE: charm/schemes/ibenc/ibenc_waters05_z.py
function randomStringGen (line 37) | def randomStringGen(size=30, chars=string.ascii_uppercase + string.digits):
class IBE_N04_z (line 41) | class IBE_N04_z(IBEnc):
method __init__ (line 60) | def __init__(self, groupObj):
method setup (line 70) | def setup(self, l=32):
method extract (line 98) | def extract(self, mk, ID):
method encrypt (line 116) | def encrypt(self, pk, ID, M): # M:GT
method decrypt (line 135) | def decrypt(self, pk, sID, ct):
function main (line 147) | def main():
FILE: charm/schemes/ibenc/ibenc_waters09.py
class DSE09 (line 26) | class DSE09(IBEnc):
method __init__ (line 40) | def __init__(self, groupObj):
method setup (line 45) | def setup(self):
method keygen (line 59) | def keygen(self, mpk, msk, ID):
method encrypt (line 76) | def encrypt(self, mpk, M, ID):
method decrypt (line 96) | def decrypt(self, ct, sk):
FILE: charm/schemes/ibenc/ibenc_waters09_z.py
class DSE09_z (line 35) | class DSE09_z(IBEnc):
method __init__ (line 49) | def __init__(self, groupObj):
method setup (line 54) | def setup(self):
method keygen (line 84) | def keygen(self, mpk, msk, ID):
method encrypt (line 101) | def encrypt(self, mpk, M, ID):
method decrypt (line 121) | def decrypt(self, ct, sk):
function main (line 133) | def main():
FILE: charm/schemes/joye_scheme.py
class Joye (line 45) | class Joye():
method __init__ (line 47) | def __init__(self,users=2):
method destruction_keys (line 54) | def destruction_keys(self,pk):
method encrypt (line 63) | def encrypt(self,x,pk,sk):
method keygen (line 76) | def keygen(self):
method encode (line 80) | def encode(self,x,pk):
method sumfree (line 83) | def sumfree(self,x1,x2,pk):
method sum (line 91) | def sum(self,x1,x2,pk,k0):
FILE: charm/schemes/lem_scheme.py
function hash (line 48) | def hash():
function secretkey (line 65) | def secretkey():
class Aggregator (line 76) | class Aggregator():
method __init__ (line 81) | def __init__(self):
method decrypt (line 93) | def decrypt(self,*encarray):
function encryptfunc (line 119) | def encryptfunc(a,d):
function auxiliaryfunc (line 129) | def auxiliaryfunc(b):
function egcd (line 136) | def egcd(a, b):
function modinv (line 149) | def modinv(a, m):
class Users (line 160) | class Users():
method __init__ (line 165) | def __init__(self,*userdata):
method encrypt (line 171) | def encrypt(self):
method auxiliary (line 179) | def auxiliary(self):
class Collector (line 187) | class Collector():
method __init__ (line 192) | def __init__(self,*auxarray):
FILE: charm/schemes/pk_fre_ccv11.py
class InputEnc (line 25) | class InputEnc:
method __init__ (line 26) | def __init__(self, groupObj):
method setup (line 31) | def setup(self, d):
method encrypt (line 41) | def encrypt(self, i_pk, i, M : G1):
method decrypt (line 59) | def decrypt(self, i_sk, ct, M : [G1]):
class OutputEnc (line 76) | class OutputEnc:
method __init__ (line 77) | def __init__(self, groupObj):
method setup (line 81) | def setup(self):
method encrypt (line 89) | def encrypt(self, i_pk, o_pk, M : G1):
method decrypt (line 100) | def decrypt(self, a, ct, M : [G1]):
FILE: charm/schemes/pk_vrf.py
class VRF10 (line 26) | class VRF10:
method __init__ (line 42) | def __init__(self, groupObj):
method setup (line 47) | def setup(self, n):
method F (line 61) | def F(self, sk, x):
method prove (line 65) | def prove(self, sk, x):
method verify (line 76) | def verify(self, pk, x, st):
function main (line 104) | def main():
FILE: charm/schemes/pkenc/pkenc_cs98.py
class CS98 (line 32) | class CS98(PKEnc):
method __init__ (line 56) | def __init__(self, groupObj, p=0, q=0):
method keygen (line 64) | def keygen(self, secparam=0):
method encrypt (line 85) | def encrypt(self, pk, M):
method decrypt (line 99) | def decrypt(self, pk, sk, c):
FILE: charm/schemes/pkenc/pkenc_elgamal85.py
class ElGamalCipher (line 27) | class ElGamalCipher(dict):
method __init__ (line 28) | def __init__(self, ct):
method __add__ (line 33) | def __add__(self, other):
method __mul__ (line 41) | def __mul__(self, other):
class ElGamal (line 55) | class ElGamal(PKEnc):
method __init__ (line 79) | def __init__(self, groupObj, p=0, q=0):
method keygen (line 86) | def keygen(self, secparam=1024):
method encrypt (line 105) | def encrypt(self, pk, M):
method decrypt (line 113) | def decrypt(self, pk, sk, c):
FILE: charm/schemes/pkenc/pkenc_gm82.py
function isResidue (line 32) | def isResidue(x, p1, p2):
class GM82 (line 36) | class GM82(PKEnc):
method __init__ (line 55) | def __init__(self):
method keygen (line 59) | def keygen(self, secparam):
method encrypt (line 79) | def encrypt(self, pk, m):
method decrypt (line 91) | def decrypt(self, sk, c):
method xor (line 96) | def xor(self, pk, c1, c2):
FILE: charm/schemes/pkenc/pkenc_paillier99.py
class Ciphertext (line 27) | class Ciphertext(dict):
method __init__ (line 49) | def __init__(self, ct, pk, key):
method __add__ (line 53) | def __add__(self, other):
method __mul__ (line 64) | def __mul__(self, other):
method randomize (line 69) | def randomize(self, r): # need to provide random value
method __str__ (line 74) | def __str__(self):
class Pai99 (line 78) | class Pai99(PKEnc):
method __init__ (line 79) | def __init__(self, groupObj):
method L (line 84) | def L(self, u, n):
method keygen (line 91) | def keygen(self, secparam=1024):
method encrypt (line 100) | def encrypt(self, pk, m):
method decrypt (line 106) | def decrypt(self, pk, sk, ct):
method encode (line 111) | def encode(self, modulus, message):
method decode (line 116) | def decode(self, pk, element):
FILE: charm/schemes/pkenc/pkenc_rabin.py
class Rabin (line 35) | class Rabin():
method __init__ (line 36) | def __init__(self, modulus=BlumWilliamsInteger()):
method paramgen (line 40) | def paramgen(self, secparam):
method keygen (line 48) | def keygen(self, s0, secparam=1024, params=None):
method convert (line 62) | def convert(self, N, p, q, yp, yq):
class Rabin_Enc (line 65) | class Rabin_Enc(Rabin,PKEnc):
method __init__ (line 75) | def __init__(self, padding=SAEPEncryptionPadding(), redundancy=InMessa...
method encrypt (line 81) | def encrypt(self, pk, m, salt=None):
method decrypt (line 95) | def decrypt(self, pk, sk, c):
class Rabin_Sig (line 173) | class Rabin_Sig(Rabin, PKSig):
method __init__ (line 185) | def __init__(self, padding=OAEPEncryptionPadding()):
method sign (line 190) | def sign(self,sk, M, salt=None):
method verify (line 227) | def verify(self, pk, M, S, salt=None):
function main (line 245) | def main():
FILE: charm/schemes/pkenc/pkenc_rsa.py
class RSA (line 31) | class RSA():
method __init__ (line 32) | def __init__(self):
method paramgen (line 35) | def paramgen(self, secparam):
method keygen (line 44) | def keygen(self, secparam=1024, params=None):
method convert (line 93) | def convert(self, N, e, d, p, q):
class RSA_Enc (line 97) | class RSA_Enc(RSA,PKEnc):
method __init__ (line 107) | def __init__(self, padding=OAEPEncryptionPadding(), params=None):
method encrypt (line 112) | def encrypt(self, pk, m, salt=None):
method decrypt (line 120) | def decrypt(self, pk, sk, c):
class RSA_Sig (line 127) | class RSA_Sig(RSA, PKSig):
method __init__ (line 137) | def __init__(self, padding=PSSPadding()):
method sign (line 142) | def sign(self,sk, M, salt=None):
method verify (line 164) | def verify(self, pk, M, S):
FILE: charm/schemes/pksig/pksig_CW13_z.py
class Sign_CW13 (line 28) | class Sign_CW13(PKSig):
method __init__ (line 29) | def __init__(self, groupObj):
method keygen (line 34) | def keygen(self):
method sign (line 94) | def sign(self, pk, sk, m):
method verify (line 106) | def verify(self, pk, sig, m):
method vpair (line 117) | def vpair(self, g1v, g2v):
function main (line 120) | def main():
FILE: charm/schemes/pksig/pksig_bls04.py
class BLS01 (line 30) | class BLS01(IBSig):
method __init__ (line 41) | def __init__(self, groupObj):
method dump (line 46) | def dump(self, obj):
method keygen (line 49) | def keygen(self, secparam=None):
method sign (line 56) | def sign(self, x, message):
method verify (line 61) | def verify(self, pk, sig, message):
function main (line 69) | def main():
FILE: charm/schemes/pksig/pksig_boyen.py
class Boyen (line 28) | class Boyen(PKSig):
method __init__ (line 47) | def __init__(self, groupObj):
method setup (line 51) | def setup(self):
method keygen (line 64) | def keygen(self, mpk):
method getPKdict (line 72) | def getPKdict(self, mpk, pk, k):
method sign (line 83) | def sign(self, index, mpk, pk, sk, M):
method verify (line 113) | def verify(self, mpk, pk, M, sig):
function main (line 127) | def main():
FILE: charm/schemes/pksig/pksig_chch.py
class CHCH (line 26) | class CHCH(PKSig):
method __init__ (line 39) | def __init__(self, groupObj):
method setup (line 45) | def setup(self):
method keygen (line 52) | def keygen(self, msk, ID):
method sign (line 58) | def sign(self, pk, sk, M):
method verify (line 66) | def verify(self, mpk, pk, M, sig):
function main (line 74) | def main():
FILE: charm/schemes/pksig/pksig_chp.py
class CHP (line 27) | class CHP(PKSig):
method __init__ (line 39) | def __init__(self, groupObj):
method setup (line 43) | def setup(self):
method keygen (line 50) | def keygen(self, mpk):
method sign (line 56) | def sign(self, pk, sk, M):
method verify (line 63) | def verify(self, mpk, pk, M, sig):
FILE: charm/schemes/pksig/pksig_cl03.py
function SHA1 (line 26) | def SHA1(bytes1):
function randomQR (line 31) | def randomQR(n):
class Sig_CL03 (line 35) | class Sig_CL03(PKSig):
method __init__ (line 61) | def __init__(self, lmin=160, lin=160, secparam=512):
method keygen (line 68) | def keygen(self, secparam=512, p=0, q=0):
method sign (line 94) | def sign(self, pk, sk, m):
method signCommit (line 109) | def signCommit(self, pk, sk, Cx):
method verify (line 124) | def verify(self, pk, m, sig):
method verifyCommit (line 138) | def verifyCommit(self, pk, sig, Cx):
FILE: charm/schemes/pksig/pksig_cl04.py
class CL04 (line 26) | class CL04(PKSig):
method __init__ (line 38) | def __init__(self, groupObj):
method setup (line 42) | def setup(self):
method keygen (line 46) | def keygen(self, mpk):
method sign (line 52) | def sign(self, pk, sk, M):
method verify (line 58) | def verify(self, pk, M, sig):
function main (line 65) | def main():
FILE: charm/schemes/pksig/pksig_cllww12_z.py
class Sign_Chen12_z (line 29) | class Sign_Chen12_z(PKSig):
method __init__ (line 40) | def __init__(self, groupObj):
method keygen (line 46) | def keygen(self):
method sign (line 107) | def sign(self, pk, sk, m):
method verify (line 118) | def verify(self, pk, sig, m):
function main (line 128) | def main():
FILE: charm/schemes/pksig/pksig_cyh.py
class CYH (line 28) | class CYH(PKSig):
method __init__ (line 44) | def __init__(self, groupObj):
method concat (line 48) | def concat(self, L_id):
method setup (line 54) | def setup(self):
method keygen (line 65) | def keygen(self, msk, ID):
method sign (line 70) | def sign(self, sk, L, M):
method verify (line 93) | def verify(self, mpk, L, M, sig):
function main (line 108) | def main():
FILE: charm/schemes/pksig/pksig_dsa.py
class DSA (line 27) | class DSA(PKSig):
method __init__ (line 39) | def __init__(self, p=0, q=0):
method keygen (line 44) | def keygen(self, bits):
method sign (line 54) | def sign(self, pk, x, M):
method verify (line 66) | def verify(self, pk, sig, M):
FILE: charm/schemes/pksig/pksig_ecdsa.py
class ECDSA (line 26) | class ECDSA(PKSig):
method __init__ (line 37) | def __init__(self, groupObj):
method keygen (line 42) | def keygen(self, bits):
method sign (line 48) | def sign(self, pk, x, M):
method verify (line 61) | def verify(self, pk, sig, M):
FILE: charm/schemes/pksig/pksig_hess.py
class Hess (line 30) | class Hess(PKSig):
method __init__ (line 43) | def __init__(self, groupObj):
method setup (line 49) | def setup(self):
method keygen (line 56) | def keygen(self, msk, ID):
method sign (line 62) | def sign(self, pk, sk, M):
method verify (line 72) | def verify(self, mpk, pk, M, sig):
function main (line 80) | def main():
FILE: charm/schemes/pksig/pksig_hw.py
class HW (line 27) | class HW(PKSig):
method __init__ (line 38) | def __init__(self, groupObj):
method ceilog (line 42) | def ceilog(self, value):
method setup (line 45) | def setup(self):
method sign (line 64) | def sign(self, pk, sk, s, msg):
method verify (line 77) | def verify(self, pk, msg, sig):
function main (line 90) | def main():
FILE: charm/schemes/pksig/pksig_lamport.py
function _h (line 30) | def _h(x):
function _bytes_to_booleans (line 34) | def _bytes_to_booleans(x):
class Lamport (line 38) | class Lamport(PKSig):
method __init__ (line 47) | def __init__(self):
method keygen (line 50) | def keygen(self, securityparam=256):
method sign (line 56) | def sign(self, pk, sk, message):
method verify (line 60) | def verify(self, pk, message, sig):
FILE: charm/schemes/pksig/pksig_ps01.py
class PS01 (line 29) | class PS01:
method __init__ (line 34) | def __init__(self, groupObj):
method keygen (line 39) | def keygen(num_messages=1):
method sign (line 47) | def sign(self, sk, *messages):
method verify (line 53) | def verify(self, pk, sig, *messages):
method randomize_sig (line 61) | def randomize_sig(self, sig):
method product (line 67) | def product(seq):
function main (line 71) | def main():
FILE: charm/schemes/pksig/pksig_ps02.py
class PS02 (line 29) | class PS02:
method __init__ (line 34) | def __init__(self, groupObj):
method setup (line 38) | def setup(self):
method keygen (line 48) | def keygen(self, num_messages):
method sign (line 54) | def sign(self, sk, pk, messages):
method verify (line 77) | def verify(self, pk, sig, messages):
method product (line 87) | def product(seq):
function main (line 91) | def main():
FILE: charm/schemes/pksig/pksig_ps03.py
class PS01 (line 29) | class PS01:
method __init__ (line 34) | def __init__(self, groupObj):
method keygen (line 39) | def keygen(num_messages=1):
method commitment (line 51) | def commitment(self, pk, *messages):
method sign (line 55) | def sign(self, sk, pk, commitment):
method unblind_signature (line 60) | def unblind_signature(t, sig):
method verify (line 64) | def verify(self, pk, sig, *messages):
method randomize_sig (line 72) | def randomize_sig(self, sig):
method product (line 78) | def product(seq):
function main (line 82) | def main():
FILE: charm/schemes/pksig/pksig_rsa_hw09.py
function SHA1 (line 32) | def SHA1(bytes1):
function randomQR (line 38) | def randomQR(n):
class LogFunction (line 41) | class LogFunction:
method __init__ (line 42) | def __init__(self, base=10):
method __getitem__ (line 45) | def __getitem__(self, base):
method __call__ (line 48) | def __call__(self, val):
class Prf (line 52) | class Prf:
method __init__ (line 53) | def __init__(self):
method keygen (line 57) | def keygen(self, bits):
method eval (line 61) | def eval(self, k, input1):
class BlumIntegerSquareRoot (line 70) | class BlumIntegerSquareRoot:
method __init__ (line 71) | def __init__(self, p, q):
method pow (line 76) | def pow(self, modularInt):
method __pow__ (line 83) | def __pow__(self, power):
class Sig_RSA_Stateless_HW09 (line 88) | class Sig_RSA_Stateless_HW09(PKSig):
method __init__ (line 103) | def __init__(self, CH = ChamHash_HW09):
method keygen (line 108) | def keygen(self, keyLength=1024, p=0, q=0):
method sign (line 129) | def sign(self, pk, sk, message, s=0):
method verify (line 166) | def verify(self, pk, message, sig):
method HW_hash (line 199) | def HW_hash(self, key, c, input, keyLen):
FILE: charm/schemes/pksig/pksig_schnorr91.py
class SchnorrSig (line 26) | class SchnorrSig(PKSig):
method __init__ (line 39) | def __init__(self):
method params (line 42) | def params(self, p=0, q=0, bits=1024):
method keygen (line 50) | def keygen(self):
method sign (line 56) | def sign(self, pk, x, M):
method verify (line 65) | def verify(self, pk, sig, M):
FILE: charm/schemes/pksig/pksig_waters.py
class WatersSig (line 27) | class WatersSig:
method __init__ (line 40) | def __init__(self, groupObj):
method setup (line 45) | def setup(self, z, l=32):
method keygen (line 64) | def keygen(self, mpk, msk, ID):
method sign (line 73) | def sign(self, mpk, sk, M):
method verify (line 84) | def verify(self, mpk, ID, M, sig):
function main (line 98) | def main():
FILE: charm/schemes/pksig/pksig_waters05.py
class IBE_N04_Sig (line 30) | class IBE_N04_Sig(PKSig):
method __init__ (line 44) | def __init__(self, groupObj):
method keygen (line 52) | def keygen(self, l=32):
method sign (line 82) | def sign(self, pk, sk, m):
method verify (line 93) | def verify(self, pk, msg, sig):
function main (line 101) | def main():
FILE: charm/schemes/pksig/pksig_waters09.py
class IBEWaters09 (line 26) | class IBEWaters09(IBEnc):
method __init__ (line 36) | def __init__(self, groupObj):
method keygen (line 41) | def keygen(self):
method sign (line 69) | def sign(self, mpk, msk, m):
method verify (line 87) | def verify(self, mpk, sigma, m):
function main (line 104) | def main():
FILE: charm/schemes/pre_mg07.py
class PreGA (line 28) | class PreGA:
method __init__ (line 47) | def __init__(self, groupObj):
method setup (line 52) | def setup(self):
method keyGen (line 65) | def keyGen(self, msk, ID):
method encrypt (line 73) | def encrypt(self, params, ID, M):
method decryptFirstLevel (line 94) | def decryptFirstLevel(self, params, skid, cid, ID):
method rkGen (line 112) | def rkGen(self, params, skid, IDsrc, IDdest):
method reEncrypt (line 122) | def reEncrypt(self, params, IDsrc, rk, cid):
method decryptSecondLevel (line 136) | def decryptSecondLevel(self, params, skid, IDsrc, ID, cid):
FILE: charm/schemes/prenc/pre_afgh06.py
class AFGH06 (line 28) | class AFGH06(PREnc):
method __init__ (line 45) | def __init__(self, groupObj):
method setup (line 49) | def setup(self):
method keygen (line 59) | def keygen(self, params):
method rekeygen (line 73) | def rekeygen(self, params, pk_a, sk_a, pk_b, sk_b):
method encrypt (line 82) | def encrypt(self, params, pk, m):
method decrypt (line 100) | def decrypt(self, params, sk, c):
method re_encrypt (line 112) | def re_encrypt(self, params, rk, c_a):
FILE: charm/schemes/prenc/pre_bbs98.py
class BBS98 (line 27) | class BBS98(PREnc):
method __init__ (line 46) | def __init__(self, groupObj, p=0, q=0):
method setup (line 52) | def setup(self, secparam=0):
method keygen (line 68) | def keygen(self, params):
method rekeygen (line 81) | def rekeygen(self, params, pk_a, sk_a, pk_b, sk_b):
method encrypt (line 88) | def encrypt(self, params, pk, M):
method decrypt (line 103) | def decrypt(self, params, sk, c):
method re_encrypt (line 114) | def re_encrypt(self, params, rk, c_a):
FILE: charm/schemes/prenc/pre_nal16.py
class NAL16a (line 29) | class NAL16a(PREnc):
method __init__ (line 46) | def __init__(self, groupObj):
method F (line 50) | def F(self, params, t):
method setup (line 53) | def setup(self):
method keygen (line 63) | def keygen(self, params):
method rekeygen (line 76) | def rekeygen(self, params, pk_a, sk_a, pk_b, sk_b):
method encrypt (line 83) | def encrypt(self, params, pk, m):
method decrypt (line 102) | def decrypt(self, params, sk, c):
method re_encrypt (line 116) | def re_encrypt(self, params, rk, c_a):
class NAL16b (line 128) | class NAL16b(NAL16a):
method __init__ (line 145) | def __init__(self, groupObj):
method H (line 150) | def H(self, gt, s):
method G (line 161) | def G(self, x):
method encrypt (line 169) | def encrypt(self, params, pk, m):
method decrypt (line 187) | def decrypt(self, params, sk, c):
method re_encrypt (line 198) | def re_encrypt(self, params, rk, c_a):
FILE: charm/schemes/protocol_a01.py
function SHA1 (line 34) | def SHA1(bytes1):
class Asig (line 40) | class Asig(Protocol):
method __init__ (line 41) | def __init__(self, groupObj, p=0, q=0, secparam=0):
method signer_state1 (line 66) | def signer_state1(self):
method user_state2 (line 89) | def user_state2(self, input):
method signer_state3 (line 101) | def signer_state3(self, input):
method user_state4 (line 128) | def user_state4(self, input):
method signer_state5 (line 172) | def signer_state5(self, input):
method user_state6 (line 185) | def user_state6(self, input):
method signer_state7 (line 197) | def signer_state7(self, input):
method user_state8 (line 206) | def user_state8(self, input):
FILE: charm/schemes/protocol_ao00.py
function SHA2 (line 33) | def SHA2(bytes1):
class AOSig (line 39) | class AOSig(Protocol):
method __init__ (line 40) | def __init__(self, groupObj, p=0, q=0, secparam=0):
method signer_state1 (line 65) | def signer_state1(self):
method user_state2 (line 80) | def user_state2(self, input):
method signer_state3 (line 90) | def signer_state3(self, input):
method user_state4 (line 113) | def user_state4(self, input):
method signer_state5 (line 146) | def signer_state5(self, input):
method user_state6 (line 159) | def user_state6(self, input):
FILE: charm/schemes/protocol_cns07.py
class ObliviousTransfer (line 34) | class ObliviousTransfer(Protocol):
method __init__ (line 35) | def __init__(self, messages=None, groupObj=None, common_input=None):
method get_common (line 68) | def get_common(self):
method sender_init1 (line 78) | def sender_init1(self):
method sender_init3 (line 102) | def sender_init3(self, input):
method sender_transfer5 (line 121) | def sender_transfer5(self, input):
method sender_transfer7 (line 130) | def sender_transfer7(self, input):
method sender_transfer9 (line 152) | def sender_transfer9(self, input):
method receiver_init2 (line 169) | def receiver_init2(self, input):
method receiver_transfer4 (line 185) | def receiver_transfer4(self, input): # rec_tran4 -> sender_tran5
method receiver_transfer6 (line 195) | def receiver_transfer6(self, input):
method receiver_transfer8 (line 212) | def receiver_transfer8(self, input):
FILE: charm/schemes/protocol_schnorr91.py
class SchnorrZK (line 34) | class SchnorrZK(Protocol):
method __init__ (line 35) | def __init__(self, builtin_cv, common_input=None):
method prover_state1 (line 51) | def prover_state1(self):
method prover_state3 (line 60) | def prover_state3( self, input):
method prover_state5 (line 67) | def prover_state5( self, input ):
method verifier_state2 (line 75) | def verifier_state2(self, input):
method verifier_state4 (line 84) | def verifier_state4( self, input ):
method verifier_state6 (line 97) | def verifier_state6(self, input ):
FILE: charm/schemes/sigma1.py
class SigmaProtocol1 (line 24) | class SigmaProtocol1(Sigma):
method __init__ (line 25) | def __init__(self, groupObj, common_input=None):
method prover_state1 (line 28) | def prover_state1(self):
method prover_state3 (line 35) | def prover_state3(self, input):
method prover_state5 (line 41) | def prover_state5(self, input):
method verifier_state2 (line 46) | def verifier_state2(self, input):
method verifier_state4 (line 51) | def verifier_state4(self, input):
method verifier_state6 (line 61) | def verifier_state6(self, input):
FILE: charm/schemes/sigma2.py
class SigmaProtocol2 (line 24) | class SigmaProtocol2(Sigma):
method __init__ (line 25) | def __init__(self, groupObj, common_input=None):
method gen_common (line 30) | def gen_common(self):
method prover_state1 (line 41) | def prover_state1(self):
method prover_state3 (line 58) | def prover_state3(self, input):
method prover_state5 (line 69) | def prover_state5(self, input):
method verifier_state2 (line 75) | def verifier_state2(self, input):
method verifier_state4 (line 82) | def verifier_state4(self, input):
method verifier_state6 (line 95) | def verifier_state6(self, input):
FILE: charm/schemes/sigma3.py
class SigmaProtocol3 (line 25) | class SigmaProtocol3(Sigma):
method __init__ (line 26) | def __init__(self, groupObj=None, common_input=None):
method prover_state1 (line 43) | def prover_state1(self):
method prover_state3 (line 58) | def prover_state3(self, input):
method prover_state5 (line 67) | def prover_state5(self, input):
method verifier_state2 (line 73) | def verifier_state2(self, input):
method verifier_state4 (line 80) | def verifier_state4(self, input):
method verifier_state6 (line 92) | def verifier_state6(self, input):
FILE: charm/schemes/threshold/cggmp21_dkg.py
class CGGMP21_KeyShare (line 47) | class CGGMP21_KeyShare:
method get_paillier_pk (line 74) | def get_paillier_pk(self, party_id: PartyId) -> Dict:
class SecurityAbort (line 81) | class SecurityAbort(Exception):
method __init__ (line 84) | def __init__(self, message: str, accused_party: Optional[PartyId] = None,
class CGGMP21_DKG (line 91) | class CGGMP21_DKG:
method __init__ (line 123) | def __init__(self, ec_group: ECGroupType, rsa_group: RSAGroup,
method _hash_commitment (line 150) | def _hash_commitment(self, *args) -> bytes:
method keygen_round1 (line 161) | def keygen_round1(self, party_id: PartyId, generator: GElement,
method keygen_round2 (line 241) | def keygen_round2(self, party_id: PartyId, private_state: Dict[str, Any],
method keygen_round3 (line 286) | def keygen_round3(self, party_id: PartyId, private_state: Dict[str, Any],
FILE: charm/schemes/threshold/cggmp21_presign.py
class CGGMP21_Presignature (line 43) | class CGGMP21_Presignature:
method __repr__ (line 64) | def __repr__(self) -> str:
class CGGMP21_Presign (line 68) | class CGGMP21_Presign:
method __init__ (line 84) | def __init__(self, ec_group: ECGroupType, rsa_group: RSAGroup,
method _hash_commitment (line 100) | def _hash_commitment(self, value: GElement) -> bytes:
method _compute_lagrange_coeff (line 107) | def _compute_lagrange_coeff(self, party_id: int, participants: List[in...
method presign_round1 (line 120) | def presign_round1(self, party_id: PartyId, key_share: CGGMP21_KeyShare,
method presign_round2 (line 170) | def presign_round2(self, party_id: PartyId, private_state: Dict[str, A...
method presign_round3 (line 241) | def presign_round3(self, party_id: PartyId, private_state: Dict[str, A...
FILE: charm/schemes/threshold/cggmp21_proofs.py
class RingPedersenParams (line 37) | class RingPedersenParams:
method __post_init__ (line 53) | def __post_init__(self):
class AffGProof (line 59) | class AffGProof:
class MulProof (line 81) | class MulProof:
class RingPedersenGenerator (line 97) | class RingPedersenGenerator:
method __init__ (line 104) | def __init__(self, rsa_group: RSAGroup):
method generate (line 108) | def generate(self, bits: int = 2048) -> Tuple[RingPedersenParams, Dict...
method _generate_prime (line 145) | def _generate_prime(self, bits: int) -> int:
class CGGMP21_ZKProofs (line 151) | class CGGMP21_ZKProofs(PaillierZKProofs):
method __init__ (line 161) | def __init__(self, rsa_group: RSAGroup, ec_group: Any = None,
method _ring_pedersen_commit (line 174) | def _ring_pedersen_commit(self, x: int, r: int) -> int:
method prove_affine_g (line 183) | def prove_affine_g(self, x: int, y: int, rho: int,
method verify_affine_g (line 280) | def verify_affine_g(self, C: Any, D: Any, X: Any,
method prove_mul (line 337) | def prove_mul(self, x: int, C: Any, D: Any, pk: Dict,
method verify_mul (line 401) | def verify_mul(self, C: Any, D: Any, X: Any,
FILE: charm/schemes/threshold/cggmp21_sign.py
class CGGMP21_Signature (line 46) | class CGGMP21_Signature:
method to_tuple (line 51) | def to_tuple(self) -> Tuple[ZRElement, ZRElement]:
class CGGMP21_Sign (line 55) | class CGGMP21_Sign:
method __init__ (line 63) | def __init__(self, ec_group: ECGroupType, rsa_group: RSAGroup,
method _hash_message (line 79) | def _hash_message(self, message: bytes) -> ZRElement:
method sign_with_presignature (line 85) | def sign_with_presignature(self, party_id: PartyId,
method combine_signatures (line 116) | def combine_signatures(self, signature_shares: Dict[PartyId, ZRElement],
method _normalize_s (line 144) | def _normalize_s(self, s: ZRElement) -> ZRElement:
method verify (line 152) | def verify(self, public_key: GElement, signature: CGGMP21_Signature,
class CGGMP21 (line 168) | class CGGMP21(PKSig):
method __init__ (line 195) | def __init__(self, ec_group: ECGroupType, rsa_group: RSAGroup,
method keygen (line 221) | def keygen(self, generator: Optional[GElement] = None,
method presign (line 276) | def presign(self, key_shares: List[CGGMP21_KeyShare],
method sign (line 373) | def sign(self, key_shares: List[CGGMP21_KeyShare], message: bytes,
method verify (line 424) | def verify(self, public_key: GElement, message: bytes,
FILE: charm/schemes/threshold/dkls23_dkg.py
class KeyShare (line 35) | class KeyShare:
method __init__ (line 62) | def __init__(self, party_id: PartyId, private_share: ZRElement, public...
method __repr__ (line 70) | def __repr__(self) -> str:
class DKLS23_DKG (line 74) | class DKLS23_DKG:
method __init__ (line 141) | def __init__(self, groupObj: ECGroupType, threshold: int, num_parties:...
method keygen_round1 (line 167) | def keygen_round1(self, party_id: PartyId, generator: GElement, sessio...
method keygen_round2 (line 242) | def keygen_round2(self, party_id: PartyId, private_state: Dict[str, An...
method _verify_share_against_commitments (line 295) | def _verify_share_against_commitments(self, sender_id: PartyId, receiv...
method keygen_round3 (line 313) | def keygen_round3(self, party_id: PartyId, private_state: Dict[str, An...
method handle_complaints (line 403) | def handle_complaints(self, party_id: PartyId, complaints: Dict[PartyI...
method verify_broadcast_consistency (line 480) | def verify_broadcast_consistency(self, party_id: PartyId, all_round1_m...
method compute_public_key (line 516) | def compute_public_key(self, all_commitments: List[List[GElement]], ge...
FILE: charm/schemes/threshold/dkls23_presign.py
class SecurityAbort (line 65) | class SecurityAbort(Exception):
method __init__ (line 78) | def __init__(self, message, failed_parties=None):
class Presignature (line 84) | class Presignature:
method __init__ (line 105) | def __init__(self, party_id: PartyId, R: GElement, r: ZRElement, k_sha...
method is_valid (line 128) | def is_valid(self) -> bool:
method __repr__ (line 144) | def __repr__(self) -> str:
class DKLS23_Presign (line 148) | class DKLS23_Presign:
method __init__ (line 204) | def __init__(self, groupObj: ECGroupType) -> None:
method _compute_schnorr_challenge_hash (line 222) | def _compute_schnorr_challenge_hash(self, generator: GElement, public_...
method _schnorr_prove_dlog (line 260) | def _schnorr_prove_dlog(self, secret: ZRElement, public_point: GElemen...
method _schnorr_verify_dlog (line 302) | def _schnorr_verify_dlog(self, public_point: GElement, proof: Dict[str...
method _compute_commitment (line 344) | def _compute_commitment(self, *values: Any, session_id: Optional[bytes...
method presign_round1 (line 400) | def presign_round1(self, party_id: PartyId, key_share: Any, participan...
method presign_round2 (line 511) | def presign_round2(self, party_id: PartyId, state: Dict[str, Any], all...
method presign_round3 (line 622) | def presign_round3(self, party_id: PartyId, state: Dict[str, Any], all...
method presign_round4 (line 754) | def presign_round4(self, party_id: PartyId, state: Dict[str, Any], p2p...
FILE: charm/schemes/threshold/dkls23_sign.py
class ThresholdSignature (line 47) | class ThresholdSignature:
method __init__ (line 62) | def __init__(self, r: ZRElement, s: ZRElement) -> None:
method __repr__ (line 73) | def __repr__(self) -> str:
method __eq__ (line 76) | def __eq__(self, other: object) -> bool:
method to_der (line 81) | def to_der(self) -> bytes:
class DKLS23_Sign (line 106) | class DKLS23_Sign:
method __init__ (line 137) | def __init__(self, groupObj: ECGroupType) -> None:
method _hash_message (line 153) | def _hash_message(self, message: bytes) -> ZRElement:
method sign_round1 (line 170) | def sign_round1(self, party_id: PartyId, presignature: Presignature, k...
method verify_signature_share (line 242) | def verify_signature_share(self, party_id: PartyId, share: ZRElement, ...
method combine_signatures (line 274) | def combine_signatures(self, signature_shares: Dict[PartyId, ZRElement...
method _normalize_s (line 334) | def _normalize_s(self, s: ZRElement) -> ZRElement:
method verify (line 359) | def verify(self, public_key: GElement, signature: Union['ThresholdSign...
class DKLS23 (line 417) | class DKLS23(PKSig):
method __init__ (line 463) | def __init__(self, groupObj: ECGroupType, threshold: int = 2, num_part...
method keygen (line 491) | def keygen(self, securityparam: Optional[int] = None, generator: Optio...
method distributed_keygen (line 506) | def distributed_keygen(self, generator: GElement) -> Tuple[Dict[PartyI...
method presign (line 581) | def presign(self, participants: List[PartyId], key_shares: Dict[PartyI...
method sign (line 666) | def sign(self, participants: List[PartyId], presignatures: Dict[PartyI...
method verify (line 726) | def verify(self, public_key: GElement, signature: Union['ThresholdSign...
FILE: charm/schemes/threshold/gg18_dkg.py
class GG18_KeyShare (line 39) | class GG18_KeyShare:
method __init__ (line 56) | def __init__(self, party_id: PartyId, private_share: ZRElement,
method __repr__ (line 69) | def __repr__(self) -> str:
method get_paillier_pk (line 72) | def get_paillier_pk(self, party_id: PartyId) -> Dict:
class GG18_DKG (line 79) | class GG18_DKG:
method __init__ (line 115) | def __init__(self, ec_group: ECGroupType, rsa_group: RSAGroup,
method keygen_round1 (line 143) | def keygen_round1(self, party_id: PartyId, generator: GElement,
method keygen_round2 (line 199) | def keygen_round2(self, party_id: PartyId, private_state: Dict[str, Any],
method keygen_round3 (line 232) | def keygen_round3(self, party_id: PartyId, private_state: Dict[str, Any],
method compute_public_key (line 293) | def compute_public_key(self, all_commitments: List[List[GElement]]) ->...
FILE: charm/schemes/threshold/gg18_sign.py
class GG18_Signature (line 45) | class GG18_Signature:
method to_tuple (line 50) | def to_tuple(self) -> Tuple[ZRElement, ZRElement]:
class GG18_Sign (line 54) | class GG18_Sign:
method __init__ (line 71) | def __init__(self, ec_group: ECGroupType, rsa_group: RSAGroup,
method _hash_message (line 86) | def _hash_message(self, message: bytes) -> ZRElement:
method _hash_commitment (line 92) | def _hash_commitment(self, value: GElement) -> bytes:
method sign_round1 (line 99) | def sign_round1(self, party_id: PartyId, key_share: GG18_KeyShare,
method sign_round2 (line 144) | def sign_round2(self, party_id: PartyId, private_state: Dict[str, Any],
method sign_round3 (line 217) | def sign_round3(self, party_id: PartyId, private_state: Dict[str, Any],
method _compute_lagrange_coeff (line 337) | def _compute_lagrange_coeff(self, party_id: PartyId,
method sign_round4 (line 353) | def sign_round4(self, party_id: PartyId, private_state: Dict[str, Any],
method combine_signatures (line 435) | def combine_signatures(self, signature_shares: Dict[PartyId, ZRElement],
method _normalize_s (line 461) | def _normalize_s(self, s: ZRElement) -> ZRElement:
method verify (line 470) | def verify(self, public_key: GElement, signature: GG18_Signature,
class GG18 (line 503) | class GG18(PKSig):
method __init__ (line 529) | def __init__(self, ec_group: ECGroupType, rsa_group: RSAGroup,
method keygen (line 554) | def keygen(self, generator: Optional[GElement] = None) -> Tuple[GEleme...
method sign (line 608) | def sign(self, key_shares: List[GG18_KeyShare], message: bytes,
method verify (line 697) | def verify(self, public_key: GElement, message: bytes,
FILE: charm/schemes/threshold/xrpl_wallet.py
function get_secp256k1_generator (line 54) | def get_secp256k1_generator(group):
function _base58_encode (line 84) | def _base58_encode(data: bytes) -> str:
function _sha256 (line 105) | def _sha256(data: bytes) -> bytes:
function _ripemd160 (line 110) | def _ripemd160(data: bytes) -> bytes:
function _double_sha256 (line 117) | def _double_sha256(data: bytes) -> bytes:
function get_compressed_public_key (line 122) | def get_compressed_public_key(group: ECGroup, public_key: ec_element) ->...
function derive_account_id (line 163) | def derive_account_id(compressed_pubkey: bytes) -> bytes:
function encode_classic_address (line 184) | def encode_classic_address(account_id: bytes) -> str:
class XRPLThresholdWallet (line 209) | class XRPLThresholdWallet:
method __init__ (line 232) | def __init__(self, group: ECGroup, public_key: ec_element):
method get_compressed_public_key (line 246) | def get_compressed_public_key(self) -> bytes:
method get_account_id (line 252) | def get_account_id(self) -> bytes:
method get_classic_address (line 258) | def get_classic_address(self) -> str:
method get_account_id_hex (line 264) | def get_account_id_hex(self) -> str:
method get_public_key_hex (line 268) | def get_public_key_hex(self) -> str:
method get_x_address (line 272) | def get_x_address(self, tag: Optional[int] = None,
function sign_xrpl_transaction_hash (line 294) | def sign_xrpl_transaction_hash(
function format_xrpl_signature (line 349) | def format_xrpl_signature(der_signature: bytes, public_key_hex: str) -> ...
function _check_xrpl_py (line 372) | def _check_xrpl_py():
function get_x_address (line 381) | def get_x_address(classic_address: str, tag: Optional[int] = None,
function decode_x_address (line 416) | def decode_x_address(x_address: str) -> Tuple[str, Optional[int], bool]:
function compute_signing_hash (line 440) | def compute_signing_hash(transaction) -> bytes:
function sign_xrpl_transaction (line 488) | def sign_xrpl_transaction(
class XRPLClient (line 571) | class XRPLClient:
method __init__ (line 589) | def __init__(self, url: Optional[str] = None, is_testnet: bool = False):
method client (line 613) | def client(self):
method get_account_sequence (line 617) | def get_account_sequence(self, address: str) -> int:
method get_balance (line 639) | def get_balance(self, address: str) -> int:
method does_account_exist (line 658) | def does_account_exist(self, address: str) -> bool:
method submit_transaction (line 676) | def submit_transaction(self, signed_tx_blob: str, fail_hard: bool = Fa...
method submit_and_wait (line 693) | def submit_and_wait(self, signed_tx_blob: str,
method autofill_transaction (line 710) | def autofill_transaction(self, transaction) -> dict:
method get_transaction (line 743) | def get_transaction(self, tx_hash: str) -> dict:
method fund_from_faucet (line 760) | def fund_from_faucet(address: str, timeout: int = 60) -> dict:
function encode_memo_data (line 807) | def encode_memo_data(text: str) -> str:
function decode_memo_data (line 826) | def decode_memo_data(hex_data: str) -> str:
function create_memo (line 843) | def create_memo(data: str, memo_type: Optional[str] = None,
function create_payment_with_memo (line 876) | def create_payment_with_memo(
function get_transaction_memos (line 930) | def get_transaction_memos(tx_result: dict) -> list:
FILE: charm/test/adapters/abenc_adapt_hybrid_test.py
class HybridABEncTest (line 10) | class HybridABEncTest(unittest.TestCase):
method testHybridABEnc (line 11) | def testHybridABEnc(self):
FILE: charm/test/adapters/dabenc_adapt_hybrid_test.py
class HybridABEncMATest (line 10) | class HybridABEncMATest(unittest.TestCase):
method testHybridABEncMA (line 11) | def testHybridABEncMA(self):
FILE: charm/test/adapters/ibenc_adapt_hybrid_test.py
class HybridIBEncTest (line 11) | class HybridIBEncTest(unittest.TestCase):
method testHybridIBEnc (line 12) | def testHybridIBEnc(self):
FILE: charm/test/adapters/ibenc_adapt_identityhash_test.py
class HashIDAdapterTest (line 10) | class HashIDAdapterTest(unittest.TestCase):
method testHashIDAdapter (line 11) | def testHashIDAdapter(self):
FILE: charm/test/adapters/kpabenc_adapt_hybrid_test.py
class HybridKPABEncTest (line 10) | class HybridKPABEncTest(unittest.TestCase):
method testHybridKPABEnc (line 11) | def testHybridKPABEnc(self):
FILE: charm/test/benchmark/abenc_yllc15_bench.py
function run_keygen_encrypt_proxy_decrypt_decrypt_round_trip (line 10) | def run_keygen_encrypt_proxy_decrypt_decrypt_round_trip(policy_str):
function extract_attributes (line 53) | def extract_attributes(group, policy_str):
function end_bench (line 59) | def end_bench(group, operation, n):
function start_bench (line 67) | def start_bench(group):
FILE: charm/test/benchmark/benchmark_test.py
function isSaneBenchmark (line 10) | def isSaneBenchmark(dct):
class BenchmarkTest1 (line 21) | class BenchmarkTest1(unittest.TestCase):
method testPairing (line 22) | def testPairing(self):
class BenchmarkTest2 (line 56) | class BenchmarkTest2(unittest.TestCase):
method testECGroup (line 57) | def testECGroup(self):
class BenchmarkTest3 (line 93) | class BenchmarkTest3(unittest.TestCase):
method testInterleave (line 94) | def testInterleave(self):
class BenchmarkTest4 (line 118) | class BenchmarkTest4(unittest.TestCase):
method testInteger (line 119) | def testInteger(self):
FILE: charm/test/benchmark_threshold.py
function run_dkg (line 22) | def run_dkg(group, t, n, g):
function benchmark_dkg (line 61) | def benchmark_dkg(t, n, iterations=10):
function benchmark_presign (line 92) | def benchmark_presign(t, n, iterations=10):
function benchmark_sign (line 144) | def benchmark_sign(t, n, iterations=10):
function benchmark_full_flow (line 193) | def benchmark_full_flow(t, n, num_signatures=5):
function run_benchmarks (line 235) | def run_benchmarks(t=2, n=3):
FILE: charm/test/conftest.py
function pytest_configure (line 12) | def pytest_configure(config):
function pytest_collection_modifyitems (line 24) | def pytest_collection_modifyitems(config, items):
FILE: charm/test/fuzz/fuzz_policy_parser.py
function setup_module (line 24) | def setup_module():
function fuzz_policy_parser (line 30) | def fuzz_policy_parser(data: bytes) -> None:
function main (line 53) | def main():
FILE: charm/test/fuzz/fuzz_serialization.py
function setup_module (line 22) | def setup_module():
function fuzz_pairing_deserialization (line 29) | def fuzz_pairing_deserialization(data: bytes) -> None:
function fuzz_combined (line 45) | def fuzz_combined(data: bytes) -> None:
function main (line 62) | def main():
FILE: charm/test/schemes/abenc/abenc_bsw07_test.py
class CPabe_BSW07Test (line 9) | class CPabe_BSW07Test(unittest.TestCase):
method testCPabe_BSW07 (line 10) | def testCPabe_BSW07(self):
FILE: charm/test/schemes/abenc/abenc_dacmacs_yj14_test.py
class DacMacs_YJ14Test (line 9) | class DacMacs_YJ14Test(unittest.TestCase):
method testDacmacs_YJ14 (line 10) | def testDacmacs_YJ14(self):
FILE: charm/test/schemes/abenc/abenc_lsw08_test.py
class KPabeTest (line 9) | class KPabeTest(unittest.TestCase):
method testKPabe (line 10) | def testKPabe(self):
FILE: charm/test/schemes/abenc/abenc_maabe_yj14_test.py
class MAabe_YJ14Test (line 9) | class MAabe_YJ14Test(unittest.TestCase):
method testMAabe_YJ14 (line 10) | def testMAabe_YJ14(self):
FILE: charm/test/schemes/abenc/abenc_tbpre_lww14_test.py
class TBPre_LWW14Test (line 9) | class TBPre_LWW14Test(unittest.TestCase):
method testTBPre_LWW14 (line 10) | def testTBPre_LWW14(self):
FILE: charm/test/schemes/abenc/abenc_waters09_test.py
class CPabe09Test (line 9) | class CPabe09Test(unittest.TestCase):
method testCPabe (line 10) | def testCPabe(self):
FILE: charm/test/schemes/abenc/abenc_yllc15_test.py
class YLLC15Test (line 17) | class YLLC15Test(unittest.TestCase):
method setUp (line 19) | def setUp(self):
method test_ukgen (line 24) | def test_ukgen(self, user_id='bob@example.com'):
method test_proxy_key_gen_deduplicates_and_uppercases_attributes (line 31) | def test_proxy_key_gen_deduplicates_and_uppercases_attributes(self, at...
method test_encrypt_proxy_decrypt_decrypt_round_trip (line 39) | def test_encrypt_proxy_decrypt_decrypt_round_trip(self, policy_str):
method extract_attributes (line 51) | def extract_attributes(self, policy_str):
method test_policy_not_satisfied (line 60) | def test_policy_not_satisfied(self, policy):
FILE: charm/test/schemes/chamhash_adm05_test.py
class ChamHash_Adm05Test (line 11) | class ChamHash_Adm05Test(unittest.TestCase):
method testChamHash_Adm05 (line 13) | def testChamHash_Adm05(self):
FILE: charm/test/schemes/chamhash_rsa_hw09_test.py
class ChamHash_HW09Test (line 9) | class ChamHash_HW09Test(unittest.TestCase):
method testChamHash_HW09 (line 10) | def testChamHash_HW09(self):
FILE: charm/test/schemes/commit/commit_gs08_test.py
class Commitment_GS08Test (line 9) | class Commitment_GS08Test(unittest.TestCase):
method testCommitment_GS08 (line 10) | def testCommitment_GS08(self):
FILE: charm/test/schemes/commit/commit_pedersen92_test.py
class CM_Ped92Test (line 10) | class CM_Ped92Test(unittest.TestCase):
method testCM_Ped92 (line 11) | def testCM_Ped92(self):
FILE: charm/test/schemes/dabe_aw11_test.py
class DabeTest (line 9) | class DabeTest(unittest.TestCase):
method testDabe (line 10) | def testDabe(self):
FILE: charm/test/schemes/encap_bchk05_test.py
class EncapBCHKTest (line 5) | class EncapBCHKTest(unittest.TestCase):
method testEncapBCHK (line 6) | def testEncapBCHK(self):
FILE: charm/test/schemes/grpsig/groupsig_bgls04_test.py
class BGLS04Test (line 9) | class BGLS04Test(unittest.TestCase):
method testBGLS04 (line 10) | def testBGLS04(self):
FILE: charm/test/schemes/grpsig/groupsig_bgls04_var_test.py
class BGLS04_VarTest (line 9) | class BGLS04_VarTest(unittest.TestCase):
method testBGLS04_Var (line 10) | def testBGLS04_Var(self):
FILE: charm/test/schemes/hibenc/hibenc_bb04_test.py
class HIBE_BB04Test (line 7) | class HIBE_BB04Test(unittest.TestCase):
method testHIBE_BB04 (line 8) | def testHIBE_BB04(self):
FILE: charm/test/schemes/ibenc/ibenc_bb03_test.py
class IBE_BB04Test (line 10) | class IBE_BB04Test(unittest.TestCase):
method testIBE_BB04 (line 11) | def testIBE_BB04(self):
FILE: charm/test/schemes/ibenc/ibenc_bf01_test.py
class IBE_BonehFranklinTest (line 9) | class IBE_BonehFranklinTest(unittest.TestCase):
method testIBE_BonehFranklin (line 10) | def testIBE_BonehFranklin(self):
FILE: charm/test/schemes/ibenc/ibenc_ckrs09_test.py
class IBE_CKRSTest (line 9) | class IBE_CKRSTest(unittest.TestCase):
method testIBE_CKRS (line 10) | def testIBE_CKRS(self):
FILE: charm/test/schemes/ibenc/ibenc_lsw08_test.py
class IBE_RevokeTest (line 9) | class IBE_RevokeTest(unittest.TestCase):
method testIBE_Revoke (line 10) | def testIBE_Revoke(self):
FILE: charm/test/schemes/ibenc/ibenc_sw05_test.py
class IBE_SW05_LUCTest (line 9) | class IBE_SW05_LUCTest(unittest.TestCase):
method testIBE_SW05_LUC (line 10) | def testIBE_SW05_LUC(self):
FILE: charm/test/schemes/ibenc/ibenc_waters05_test.py
class IBE_N04Test (line 10) | class IBE_N04Test(unittest.TestCase):
method testIBE_N04 (line 11) | def testIBE_N04(self):
FILE: charm/test/schemes/ibenc/ibenc_waters09_test.py
class DSE09Test (line 9) | class DSE09Test(unittest.TestCase):
method testDSE09 (line 10) | def testDSE09(self):
FILE: charm/test/schemes/pk_vrf_test.py
class VRF10Test (line 6) | class VRF10Test(unittest.TestCase):
method testVRF10 (line 7) | def testVRF10(self):
FILE: charm/test/schemes/pkenc_test.py
class BCHKIBEncTest (line 24) | class BCHKIBEncTest(unittest.TestCase):
method testBCHKIBEnc (line 25) | def testBCHKIBEnc(self):
class CHK04Test (line 51) | class CHK04Test(unittest.TestCase):
method testCHK04 (line 52) | def testCHK04(self):
class HybridEncTest (line 73) | class HybridEncTest(unittest.TestCase):
method testHybridEnc (line 74) | def testHybridEnc(self):
class EC_CS98Test (line 88) | class EC_CS98Test(unittest.TestCase):
method testEC_CS98 (line 89) | def testEC_CS98(self):
class CS98Test (line 103) | class CS98Test(unittest.TestCase):
method testCS98 (line 104) | def testCS98(self):
class ElGamalTest (line 119) | class ElGamalTest(unittest.TestCase):
method testElGamal (line 120) | def testElGamal(self):
method testElGamal (line 132) | def testElGamal(self):
class ElGamalTest (line 131) | class ElGamalTest(unittest.TestCase):
method testElGamal (line 120) | def testElGamal(self):
method testElGamal (line 132) | def testElGamal(self):
class Pai99Test (line 144) | class Pai99Test(unittest.TestCase):
method testPai99 (line 145) | def testPai99(self):
class Rabin_EncTest (line 200) | class Rabin_EncTest(unittest.TestCase):
method testRabin_Enc (line 202) | def testRabin_Enc(self):
class Rabin_SigTest (line 219) | class Rabin_SigTest(unittest.TestCase):
method testRabin_Sig (line 221) | def testRabin_Sig(self):
class RSA_EncTest (line 229) | class RSA_EncTest(unittest.TestCase):
method testRSA_Enc (line 230) | def testRSA_Enc(self):
class RSA_SigTest (line 245) | class RSA_SigTest(unittest.TestCase):
method testRSA_Sig (line 246) | def testRSA_Sig(self):
FILE: charm/test/schemes/pksig_test.py
class PKSig_Naor01Test (line 29) | class PKSig_Naor01Test(unittest.TestCase):
method testPKSig_Naor01 (line 30) | def testPKSig_Naor01(self):
class BLS01Test (line 50) | class BLS01Test(unittest.TestCase):
method testBLS04 (line 51) | def testBLS04(self):
class BoyenTest (line 66) | class BoyenTest(unittest.TestCase):
method testBoyen (line 67) | def testBoyen(self):
class CHCHTest (line 95) | class CHCHTest(unittest.TestCase):
method testCHCH (line 96) | def testCHCH(self):
class CHPTest (line 117) | class CHPTest(unittest.TestCase):
method testCHP (line 118) | def testCHP(self):
class CL03Test (line 138) | class CL03Test(unittest.TestCase):
method testCL03 (line 139) | def testCL03(self):
class CL04Test (line 160) | class CL04Test(unittest.TestCase):
method testCL04 (line 161) | def testCL04(self):
class CYHTest (line 181) | class CYHTest(unittest.TestCase):
method testCYH (line 182) | def testCYH(self):
class DSATest (line 204) | class DSATest(unittest.TestCase):
method testDSA (line 205) | def testDSA(self):
class ECDSATest (line 217) | class ECDSATest(unittest.TestCase):
method testECDSA (line 218) | def testECDSA(self):
class HessTest (line 229) | class HessTest(unittest.TestCase):
method testHess (line 230) | def testHess(self):
class HWTest (line 251) | class HWTest(unittest.TestCase):
method testHW (line 252) | def testHW(self):
class SchnorrSigTest (line 300) | class SchnorrSigTest(unittest.TestCase):
method testSchnorrSig (line 301) | def testSchnorrSig(self):
class IBE_N04_SigTest (line 317) | class IBE_N04_SigTest(unittest.TestCase):
method testIBE_N04_Sig (line 318) | def testIBE_N04_Sig(self):
class IBEWaters09Test (line 338) | class IBEWaters09Test(unittest.TestCase):
method testIBEWaters09 (line 339) | def testIBEWaters09(self):
class WatersSigTest (line 354) | class WatersSigTest(unittest.TestCase):
method testWatersSig (line 355) | def testWatersSig(self):
FILE: charm/test/schemes/rsa_alg_test.py
class Test (line 13) | class Test(unittest.TestCase):
method testRSAEnc (line 16) | def testRSAEnc(self):
method testRSAVector (line 28) | def testRSAVector(self):
method testRSASig (line 175) | def testRSASig(self):
method testPSSVector (line 185) | def testPSSVector(self):
FILE: charm/test/schemes/threshold_test.py
class TestSimpleOT (line 60) | class TestSimpleOT(unittest.TestCase):
method setUp (line 63) | def setUp(self):
method test_ot_choice_zero (line 66) | def test_ot_choice_zero(self):
method test_ot_choice_one (line 87) | def test_ot_choice_one(self):
method test_ot_multiple_transfers (line 108) | def test_ot_multiple_transfers(self):
method test_ot_invalid_point_rejected (line 124) | def test_ot_invalid_point_rejected(self):
method test_ot_reset_sender (line 150) | def test_ot_reset_sender(self):
class TestOTExtension (line 173) | class TestOTExtension(unittest.TestCase):
method setUp (line 176) | def setUp(self):
method _run_base_ot_setup (line 179) | def _run_base_ot_setup(self, sender_ext, receiver_ext):
method test_ot_extension_basic (line 196) | def test_ot_extension_basic(self):
method test_ot_extension_alternating_bits (line 221) | def test_ot_extension_alternating_bits(self):
method test_base_ot_required_for_sender_init (line 247) | def test_base_ot_required_for_sender_init(self):
method test_base_ot_required_for_receiver_extend (line 255) | def test_base_ot_required_for_receiver_extend(self):
method test_sender_s_not_exposed (line 263) | def test_sender_s_not_exposed(self):
class TestMtA (line 279) | class TestMtA(unittest.TestCase):
method setUp (line 282) | def setUp(self):
method test_mta_correctness (line 285) | def test_mta_correctness(self):
method test_mta_multiple_invocations (line 313) | def test_mta_multiple_invocations(self):
method test_mta_uses_real_ot (line 329) | def test_mta_uses_real_ot(self):
method test_mta_edge_case_near_order (line 358) | def test_mta_edge_case_near_order(self):
method test_mta_return_types (line 399) | def test_mta_return_types(self):
class TestMtAwc (line 436) | class TestMtAwc(unittest.TestCase):
method setUp (line 439) | def setUp(self):
method test_mtawc_correctness (line 442) | def test_mtawc_correctness(self):
method test_mtawc_proof_does_not_reveal_sender_bits (line 464) | def test_mtawc_proof_does_not_reveal_sender_bits(self):
class TestThresholdSharing (line 494) | class TestThresholdSharing(unittest.TestCase):
method setUp (line 497) | def setUp(self):
method test_basic_sharing_and_reconstruction (line 501) | def test_basic_sharing_and_reconstruction(self):
method test_feldman_vss_verification (line 519) | def test_feldman_vss_verification(self):
method test_feldman_vss_detects_invalid_share (line 531) | def test_feldman_vss_detects_invalid_share(self):
method test_threshold_3_of_5 (line 545) | def test_threshold_3_of_5(self):
method test_insufficient_shares_raises_error (line 556) | def test_insufficient_shares_raises_error(self):
method test_invalid_threshold_raises_error (line 565) | def test_invalid_threshold_raises_error(self):
method test_threshold_limit_validation (line 577) | def test_threshold_limit_validation(self):
class TestPedersenVSS (line 592) | class TestPedersenVSS(unittest.TestCase):
method setUp (line 595) | def setUp(self):
method test_pedersen_vss_verification (line 599) | def test_pedersen_vss_verification(self):
method test_pedersen_vss_reconstruction (line 612) | def test_pedersen_vss_reconstruction(self):
class TestDKLS23_DKG (line 625) | class TestDKLS23_DKG(unittest.TestCase):
method setUp (line 628) | def setUp(self):
method test_2_of_3_dkg (line 631) | def test_2_of_3_dkg(self):
method test_all_parties_same_pubkey (line 665) | def test_all_parties_same_pubkey(self):
method test_dkg_computes_correct_public_key (line 691) | def test_dkg_computes_correct_public_key(self):
method test_dkg_rejects_none_session_id (line 711) | def test_dkg_rejects_none_session_id(self):
method test_dkg_rejects_empty_session_id (line 720) | def test_dkg_rejects_empty_session_id(self):
class TestDKLS23_Presign (line 731) | class TestDKLS23_Presign(unittest.TestCase):
method setUp (line 734) | def setUp(self):
method test_presign_generates_valid_presignature (line 738) | def test_presign_generates_valid_presignature(self):
method test_presignatures_have_same_r (line 798) | def test_presignatures_have_same_r(self):
method test_presign_rejects_none_session_id (line 846) | def test_presign_rejects_none_session_id(self):
method test_presign_rejects_empty_session_id (line 856) | def test_presign_rejects_empty_session_id(self):
class TestDKLS23_Sign (line 868) | class TestDKLS23_Sign(unittest.TestCase):
method setUp (line 871) | def setUp(self):
method test_signature_share_generation (line 876) | def test_signature_share_generation(self):
method test_signature_verification_correct (line 900) | def test_signature_verification_correct(self):
method test_signature_verification_wrong_message (line 919) | def test_signature_verification_wrong_message(self):
method test_signature_share_verification (line 938) | def test_signature_share_verification(self):
class TestDKLS23_Complete (line 1009) | class TestDKLS23_Complete(unittest.TestCase):
method setUp (line 1012) | def setUp(self):
method test_complete_2_of_3_signing (line 1015) | def test_complete_2_of_3_signing(self):
method test_different_participant_combinations (line 1041) | def test_different_participant_combinations(self):
method test_signature_is_standard_ecdsa (line 1059) | def test_signature_is_standard_ecdsa(self):
method test_wrong_message_fails_verification (line 1078) | def test_wrong_message_fails_verification(self):
method test_insufficient_participants_raises_error (line 1093) | def test_insufficient_participants_raises_error(self):
method test_3_of_5_threshold (line 1104) | def test_3_of_5_threshold(self):
method test_multiple_messages_same_keys (line 1120) | def test_multiple_messages_same_keys(self):
method test_invalid_threshold_raises_error (line 1141) | def test_invalid_threshold_raises_error(self):
method test_keygen_interface (line 1151) | def test_keygen_interface(self):
class TestCurveAgnostic (line 1162) | class TestCurveAgnostic(unittest.TestCase):
method test_curve_agnostic_prime256v1 (line 1165) | def test_curve_agnostic_prime256v1(self):
class TestThresholdSignature (line 1188) | class TestThresholdSignature(unittest.TestCase):
method setUp (line 1191) | def setUp(self):
method test_signature_equality (line 1194) | def test_signature_equality(self):
method test_signature_inequality (line 1204) | def test_signature_inequality(self):
method test_der_encoding (line 1216) | def test_der_encoding(self):
class TestMaliciousParties (line 1229) | class TestMaliciousParties(unittest.TestCase):
method setUpClass (line 1241) | def setUpClass(cls):
method test_dkg_invalid_share_detected (line 1245) | def test_dkg_invalid_share_detected(self):
method test_dkg_wrong_commitment_detected (line 1286) | def test_dkg_wrong_commitment_detected(self):
method test_presign_commitment_mismatch_detected (line 1324) | def test_presign_commitment_mismatch_detected(self):
method test_signature_invalid_share_produces_invalid_sig (line 1387) | def test_signature_invalid_share_produces_invalid_sig(self):
method test_mta_receiver_learns_only_chosen_message (line 1501) | def test_mta_receiver_learns_only_chosen_message(self):
method test_dkg_insufficient_honest_parties (line 1550) | def test_dkg_insufficient_honest_parties(self):
class TestDPF (line 1608) | class TestDPF(unittest.TestCase):
method test_dpf_single_point (line 1611) | def test_dpf_single_point(self):
method test_dpf_off_points (line 1622) | def test_dpf_off_points(self):
method test_dpf_full_eval (line 1634) | def test_dpf_full_eval(self):
method test_dpf_key_independence (line 1648) | def test_dpf_key_independence(self):
class TestMPFSS (line 1665) | class TestMPFSS(unittest.TestCase):
method test_mpfss_single_point (line 1668) | def test_mpfss_single_point(self):
method test_mpfss_multiple_points (line 1684) | def test_mpfss_multiple_points(self):
method test_mpfss_full_eval (line 1702) | def test_mpfss_full_eval(self):
method test_mpfss_empty (line 1717) | def test_mpfss_empty(self):
class TestSilentOT (line 1730) | class TestSilentOT(unittest.TestCase):
method test_silent_ot_basic (line 1733) | def test_silent_ot_basic(self):
method test_silent_ot_larger (line 1751) | def test_silent_ot_larger(self):
method test_silent_ot_choice_distribution (line 1765) | def test_silent_ot_choice_distribution(self):
method test_silent_ot_messages_32_bytes (line 1776) | def test_silent_ot_messages_32_bytes(self):
method test_silent_ot_different_messages (line 1791) | def test_silent_ot_different_messages(self):
class TestGG18_DKG (line 1803) | class TestGG18_DKG(unittest.TestCase):
method setUp (line 1806) | def setUp(self):
method test_2_of_3_dkg (line 1811) | def test_2_of_3_dkg(self):
method test_all_parties_same_pubkey (line 1845) | def test_all_parties_same_pubkey(self):
class TestGG18_Sign (line 1872) | class TestGG18_Sign(unittest.TestCase):
method setUp (line 1875) | def setUp(self):
method test_signature_verification_correct (line 1880) | def test_signature_verification_correct(self):
method test_signature_verification_wrong_message (line 1900) | def test_signature_verification_wrong_message(self):
class TestGG18_Complete (line 1920) | class TestGG18_Complete(unittest.TestCase):
method setUp (line 1923) | def setUp(self):
method test_complete_2_of_3_signing (line 1928) | def test_complete_2_of_3_signing(self):
method test_different_participant_combinations (line 1949) | def test_different_participant_combinations(self):
method test_3_of_5_threshold (line 1965) | def test_3_of_5_threshold(self):
class TestCGGMP21_Proofs (line 1981) | class TestCGGMP21_Proofs(unittest.TestCase):
method setUp (line 1984) | def setUp(self):
method test_ring_pedersen_generation (line 1989) | def test_ring_pedersen_generation(self):
class TestCGGMP21_DKG (line 2000) | class TestCGGMP21_DKG(unittest.TestCase):
method setUp (line 2003) | def setUp(self):
method test_2_of_3_dkg (line 2008) | def test_2_of_3_dkg(self):
method test_all_parties_same_pubkey (line 2043) | def test_all_parties_same_pubkey(self):
class TestCGGMP21_Presign (line 2071) | class TestCGGMP21_Presign(unittest.TestCase):
method setUp (line 2074) | def setUp(self):
method test_presign_generates_valid_presignature (line 2079) | def test_presign_generates_valid_presignature(self):
class TestCGGMP21_Complete (line 2140) | class TestCGGMP21_Complete(unittest.TestCase):
method setUp (line 2143) | def setUp(self):
method test_complete_2_of_3_with_presigning (line 2148) | def test_complete_2_of_3_with_presigning(self):
method test_different_participant_combinations (line 2175) | def test_different_participant_combinations(self):
method test_3_of_5_threshold (line 2193) | def test_3_of_5_threshold(self):
class TestCGGMP21_IdentifiableAbort (line 2211) | class TestCGGMP21_IdentifiableAbort(unittest.TestCase):
method setUp (line 2214) | def setUp(self):
method test_security_abort_exception (line 2217) | def test_security_abort_exception(self):
method test_security_abort_with_evidence (line 2227) | def test_security_abort_with_evidence(self):
FILE: charm/test/serialize/serialize_test.py
class SerializeTest (line 10) | class SerializeTest(unittest.TestCase):
method testIntegerGroup (line 11) | def testIntegerGroup(self):
method testPairingGroup (line 21) | def testPairingGroup(self):
method testECGroup (line 30) | def testECGroup(self):
FILE: charm/test/toolbox/conversion_test.py
class ConversionTest (line 9) | class ConversionTest(unittest.TestCase):
method testOS2IP (line 12) | def testOS2IP(self):
method testIP2OS (line 17) | def testIP2OS(self):
method testIP2OSLen (line 22) | def testIP2OSLen(self):
FILE: charm/test/toolbox/ecgroup_test.py
class ECGroupEncodeAndDecode (line 12) | class ECGroupEncodeAndDecode(unittest.TestCase):
method testRandomGroupDecode (line 13) | def testRandomGroupDecode(self):
method testRandomMessageDecode (line 22) | def testRandomMessageDecode(self):
method testBadMessage1Decode (line 31) | def testBadMessage1Decode(self):
method testBadMessage2Decode (line 38) | def testBadMessage2Decode(self):
method testBadMessage3Decode (line 45) | def testBadMessage3Decode(self):
FILE: charm/test/toolbox/integer_arithmetic_test.py
class IntegerConversionTest (line 24) | class IntegerConversionTest(unittest.TestCase):
method test_common_rsa_exponents (line 27) | def test_common_rsa_exponents(self):
method test_small_values (line 36) | def test_small_values(self):
method test_large_values (line 44) | def test_large_values(self):
method test_negative_values (line 61) | def test_negative_values(self):
method test_round_trip_conversion (line 69) | def test_round_trip_conversion(self):
method test_integer_from_integer (line 83) | def test_integer_from_integer(self):
class GCDOperationsTest (line 91) | class GCDOperationsTest(unittest.TestCase):
method test_gcd_python_ints (line 94) | def test_gcd_python_ints(self):
method test_gcd_integer_objects (line 108) | def test_gcd_integer_objects(self):
method test_gcd_mixed_types (line 115) | def test_gcd_mixed_types(self):
method test_gcd_edge_cases (line 123) | def test_gcd_edge_cases(self):
class IsCoPrimeTest (line 135) | class IsCoPrimeTest(unittest.TestCase):
method test_coprime_common_exponents (line 138) | def test_coprime_common_exponents(self):
method test_coprime_with_integer_objects (line 151) | def test_coprime_with_integer_objects(self):
method test_coprime_edge_cases (line 158) | def test_coprime_edge_cases(self):
class ModularArithmeticTest (line 168) | class ModularArithmeticTest(unittest.TestCase):
method test_modular_inverse_basic (line 171) | def test_modular_inverse_basic(self):
method test_modular_inverse_rsa_exponent (line 181) | def test_modular_inverse_rsa_exponent(self):
method test_modular_operations_respect_modulus (line 191) | def test_modular_operations_respect_modulus(self):
method test_modular_exponentiation (line 200) | def test_modular_exponentiation(self):
method test_integer_without_modulus (line 207) | def test_integer_without_modulus(self):
class Python312CompatibilityTest (line 216) | class Python312CompatibilityTest(unittest.TestCase):
method test_65537_regression (line 223) | def test_65537_regression(self):
method test_multi_digit_integers (line 234) | def test_multi_digit_integers(self):
method test_sign_handling (line 256) | def test_sign_handling(self):
method test_digit_boundary_values (line 282) | def test_digit_boundary_values(self):
method test_mpz_to_pylong_roundtrip (line 294) | def test_mpz_to_pylong_roundtrip(self):
class IntegrationSchemeTest (line 307) | class IntegrationSchemeTest(unittest.TestCase):
method test_rsa_coprime_search_pattern (line 310) | def test_rsa_coprime_search_pattern(self):
method test_rsa_encryption_decryption_pattern (line 341) | def test_rsa_encryption_decryption_pattern(self):
method test_paillier_pattern (line 358) | def test_paillier_pattern(self):
method test_serialization_roundtrip (line 379) | def test_serialization_roundtrip(self):
class ArithmeticOperationsTest (line 390) | class ArithmeticOperationsTest(unittest.TestCase):
method test_addition (line 393) | def test_addition(self):
method test_subtraction (line 400) | def test_subtraction(self):
method test_multiplication (line 407) | def test_multiplication(self):
method test_division (line 414) | def test_division(self):
method test_exponentiation (line 420) | def test_exponentiation(self):
method test_comparison (line 425) | def test_comparison(self):
FILE: charm/test/toolbox/paddingschemes_test.py
class PaddingSchemesTest (line 10) | class PaddingSchemesTest(unittest.TestCase):
method testOEAPVector1 (line 12) | def testOEAPVector1(self):
method testOAEPRoundTripEquiv (line 61) | def testOAEPRoundTripEquiv(self):
method testMFGLength (line 70) | def testMFGLength(self):
method testMFGvector (line 79) | def testMFGvector(self):
method testSHA1Vector (line 92) | def testSHA1Vector(self):
method testPSSRountTripEquiv (line 106) | def testPSSRountTripEquiv(self):
method testPSSTestVector (line 112) | def testPSSTestVector(self):
method suite (line 212) | def suite(self):
class Pkcs7PaddingTest (line 216) | class Pkcs7PaddingTest(unittest.TestCase):
method setUp (line 217) | def setUp(self):
method encodecode (line 219) | def encodecode(self,text):
method testBasic (line 227) | def testBasic(self):
method testEmpty (line 229) | def testEmpty(self):
method testFull (line 231) | def testFull(self):
method testLarge (line 233) | def testLarge(self):
FILE: charm/test/toolbox/policy_parser_stress_test.py
class PolicyParserStressTest (line 29) | class PolicyParserStressTest(unittest.TestCase):
method setUpClass (line 33) | def setUpClass(cls):
method test_single_attribute (line 42) | def test_single_attribute(self):
method test_attribute_with_index (line 57) | def test_attribute_with_index(self):
method test_basic_and (line 65) | def test_basic_and(self):
method test_basic_or (line 71) | def test_basic_or(self):
method test_nested_expressions (line 77) | def test_nested_expressions(self):
method test_negated_attributes (line 90) | def test_negated_attributes(self):
method test_deep_nesting (line 101) | def test_deep_nesting(self):
method test_many_attributes (line 109) | def test_many_attributes(self):
method test_wide_or_tree (line 119) | def test_wide_or_tree(self):
method test_balanced_tree (line 125) | def test_balanced_tree(self):
method test_random_policies (line 132) | def test_random_policies(self):
method test_prune_and_policy (line 146) | def test_prune_and_policy(self):
method test_prune_or_policy (line 159) | def test_prune_or_policy(self):
method test_prune_complex_policy (line 173) | def test_prune_complex_policy(self):
method test_msp_simple_and (line 193) | def test_msp_simple_and(self):
method test_msp_simple_or (line 204) | def test_msp_simple_or(self):
method test_msp_complex_policy (line 215) | def test_msp_complex_policy(self):
method test_msp_coefficient_recovery (line 225) | def test_msp_coefficient_recovery(self):
method test_duplicate_attributes (line 237) | def test_duplicate_attributes(self):
method test_duplicate_labeling (line 247) | def test_duplicate_labeling(self):
method test_special_characters_in_attributes (line 262) | def test_special_characters_in_attributes(self):
method test_underscore_limitation (line 281) | def test_underscore_limitation(self):
method test_parsing_performance (line 292) | def test_parsing_performance(self):
method test_msp_conversion_performance (line 305) | def test_msp_conversion_performance(self):
method _generate_random_policy (line 323) | def _generate_random_policy(self, depth: int, max_attrs: int) -> str:
class PolicyParserEdgeCaseTest (line 336) | class PolicyParserEdgeCaseTest(unittest.TestCase):
method setUpClass (line 340) | def setUpClass(cls):
method test_case_insensitive_operators (line 343) | def test_case_insensitive_operators(self):
method test_whitespace_handling (line 350) | def test_whitespace_handling(self):
method test_parentheses_variations (line 361) | def test_parentheses_variations(self):
class NumericAttributeTest (line 375) | class NumericAttributeTest(unittest.TestCase):
method setUpClass (line 379) | def setUpClass(cls):
method test_greater_than (line 385) | def test_greater_than(self):
method test_greater_than_or_equal (line 405) | def test_greater_than_or_equal(self):
method test_less_than (line 422) | def test_less_than(self):
method test_less_than_or_equal (line 439) | def test_less_than_or_equal(self):
method test_equality (line 456) | def test_equality(self):
method test_compound_numeric_policy (line 473) | def test_compound_numeric_policy(self):
method test_mixed_numeric_and_string_policy (line 490) | def test_mixed_numeric_and_string_policy(self):
method test_bit_encoding_correctness (line 504) | def test_bit_encoding_correctness(self):
method test_boundary_values (line 514) | def test_boundary_values(self):
method test_zero_comparisons (line 528) | def test_zero_comparisons(self):
class NumericAttributeEdgeCaseTest (line 541) | class NumericAttributeEdgeCaseTest(unittest.TestCase):
method setUp (line 544) | def setUp(self):
method test_bit_overflow_in_expand (line 564) | def test_bit_overflow_in_expand(self):
method test_bit_overflow_in_user_attributes (line 569) | def test_bit_overflow_in_user_attributes(self):
method test_bit_overflow_error_in_int_to_bits (line 574) | def test_bit_overflow_error_in_int_to_bits(self):
method test_boundary_value_at_max (line 579) | def test_boundary_value_at_max(self):
method test_boundary_value_just_over_max (line 585) | def test_boundary_value_just_over_max(self):
method test_negative_value_in_expand (line 591) | def test_negative_value_in_expand(self):
method test_negative_value_in_user_attributes (line 596) | def test_negative_value_in_user_attributes(self):
method test_negative_value_message (line 601) | def test_negative_value_message(self):
method test_invalid_operator_exclamation_equal (line 609) | def test_invalid_operator_exclamation_equal(self):
method test_invalid_operator_not_equal_diamond (line 614) | def test_invalid_operator_not_equal_diamond(self):
method test_invalid_operator_tilde (line 619) | def test_invalid_operator_tilde(self):
method test_valid_operators_all_work (line 624) | def test_valid_operators_all_work(self):
method test_zero_bit_width (line 631) | def test_zero_bit_width(self):
method test_negative_bit_width (line 636) | def test_negative_bit_width(self):
method test_excessive_bit_width (line 641) | def test_excessive_bit_width(self):
method test_non_integer_bit_width (line 646) | def test_non_integer_bit_width(self):
method test_string_bit_width (line 651) | def test_string_bit_width(self):
method test_attribute_name_with_encoding_pattern (line 657) | def test_attribute_name_with_encoding_pattern(self):
method test_attribute_name_with_partial_pattern (line 662) | def test_attribute_name_with_partial_pattern(self):
method test_valid_attribute_names (line 667) | def test_valid_attribute_names(self):
method test_none_policy (line 676) | def test_none_policy(self):
method test_empty_policy (line 681) | def test_empty_policy(self):
method test_whitespace_only_policy (line 686) | def test_whitespace_only_policy(self):
method test_policy_without_numeric (line 691) | def test_policy_without_numeric(self):
method test_extra_spaces_around_operator (line 698) | def test_extra_spaces_around_operator(self):
method test_no_spaces_around_operator (line 705) | def test_no_spaces_around_operator(self):
method test_mixed_spacing (line 711) | def test_mixed_spacing(self):
method test_multiple_parentheses (line 719) | def test_multiple_parentheses(self):
method test_attr_name_all_caps (line 726) | def test_attr_name_all_caps(self):
method test_attr_name_mixed_case (line 732) | def test_attr_name_mixed_case(self):
method test_strict_mode_raises_on_overflow (line 739) | def test_strict_mode_raises_on_overflow(self):
method test_non_strict_mode_continues_on_error (line 745) | def test_non_strict_mode_continues_on_error(self):
method test_strict_helper_raises_on_overflow (line 755) | def test_strict_helper_raises_on_overflow(self):
method test_greater_than_zero (line 761) | def test_greater_than_zero(self):
method test_greater_equal_zero_is_tautology (line 766) | def test_greater_equal_zero_is_tautology(self):
method test_less_than_zero_is_contradiction (line 772) | def test_less_than_zero_is_contradiction(self):
method test_equal_zero (line 778) | def test_equal_zero(self):
method test_helper_max_value_property (line 786) | def test_helper_max_value_property(self):
class NumericNegationTest (line 794) | class NumericNegationTest(unittest.TestCase):
method setUp (line 797) | def setUp(self):
method test_negate_greater_equal (line 810) | def test_negate_greater_equal(self):
method test_negate_greater_than (line 815) | def test_negate_greater_than(self):
method test_negate_less_equal (line 820) | def test_negate_less_equal(self):
method test_negate_less_than (line 825) | def test_negate_less_than(self):
method test_negate_equality (line 830) | def test_negate_equality(self):
method test_negate_to_policy_simple (line 836) | def test_negate_to_policy_simple(self):
method test_negate_to_policy_equality (line 843) | def test_negate_to_policy_equality(self):
method test_negate_invalid_operator (line 849) | def test_negate_invalid_operator(self):
method test_helper_negate_comparison (line 855) | def test_helper_negate_comparison(self):
method test_helper_expand_negated_policy_simple (line 860) | def test_helper_expand_negated_policy_simple(self):
method test_helper_expand_negated_policy_equality (line 867) | def test_helper_expand_negated_policy_equality(self):
method test_negated_policy_satisfaction (line 876) | def test_negated_policy_satisfaction(self):
method test_negated_equality_satisfaction (line 897) | def test_negated_equality_satisfaction(self):
method test_negate_at_zero (line 918) | def test_negate_at_zero(self):
method test_negate_at_max (line 928) | def test_negate_at_max(self):
function run_stress_test (line 935) | def run_stress_test():
FILE: charm/test/toolbox/secretshare_test.py
class SecretShareTest (line 7) | class SecretShareTest(unittest.TestCase):
method testSecretShare (line 8) | def testSecretShare(self):
FILE: charm/test/toolbox/symcrypto_test.py
class SymmetricCryptoAbstractionTest (line 5) | class SymmetricCryptoAbstractionTest(unittest.TestCase):
method testAESCBC (line 7) | def testAESCBC(self):
method testAESCBCLong (line 10) | def testAESCBCLong(self):
method testAESCBC_Seperate (line 15) | def testAESCBC_Seperate(self):
method MsgtestAESCBC (line 20) | def MsgtestAESCBC(self,msg):
method MsgTestAESCBCSeperate (line 27) | def MsgTestAESCBCSeperate(self,msg):
class AuthenticatedCryptoAbstractionTest (line 36) | class AuthenticatedCryptoAbstractionTest(unittest.TestCase):
method testAESCBC (line 38) | def testAESCBC(self):
method testAESCBCLong (line 41) | def testAESCBCLong(self):
method testAESCBC_Seperate (line 45) | def testAESCBC_Seperate(self):
method MsgtestAESCBC (line 51) | def MsgtestAESCBC(self,msg):
method MsgTestAESCBCSeperate (line 58) | def MsgTestAESCBCSeperate(self,msg):
class MessageAuthenticatorTest (line 67) | class MessageAuthenticatorTest(unittest.TestCase):
method testSelfVerify (line 68) | def testSelfVerify(self):
method testSeperateVerify (line 74) | def testSeperateVerify(self):
method testTamperData (line 81) | def testTamperData(self):
method testTamperMac (line 89) | def testTamperMac(self):
method testTamperAlg (line 97) | def testTamperAlg(self):
FILE: charm/test/toolbox/test_policy_expression.py
class TestPolicyExpressionSpec (line 8) | class TestPolicyExpressionSpec(unittest.TestCase):
method test_policy_expression_spec (line 11) | def test_policy_expression_spec(self, policy_expression):
method test_allAND_policy_expressions (line 15) | def test_allAND_policy_expressions(self, policy_expression):
FILE: charm/test/vectors/test_bls_vectors.py
class TestBLSMathematicalProperties (line 18) | class TestBLSMathematicalProperties(unittest.TestCase):
method setUp (line 26) | def setUp(self):
method test_signature_verification_equation (line 31) | def test_signature_verification_equation(self):
method test_signature_determinism (line 57) | def test_signature_determinism(self):
method test_different_messages_different_signatures (line 76) | def test_different_messages_different_signatures(self):
method test_wrong_key_verification_fails (line 95) | def test_wrong_key_verification_fails(self):
method test_modified_message_verification_fails (line 117) | def test_modified_message_verification_fails(self):
method test_bilinearity_property (line 137) | def test_bilinearity_property(self):
method test_non_degeneracy (line 156) | def test_non_degeneracy(self):
class TestBLSKnownAnswerTests (line 174) | class TestBLSKnownAnswerTests(unittest.TestCase):
method setUp (line 182) | def setUp(self):
method test_kat_signature_structure (line 187) | def test_kat_signature_structure(self):
method test_kat_empty_message (line 205) | def test_kat_empty_message(self):
method test_kat_large_message (line 219) | def test_kat_large_message(self):
class TestBLSSecurityProperties (line 236) | class TestBLSSecurityProperties(unittest.TestCase):
method setUp (line 243) | def setUp(self):
method test_identity_element_rejection (line 248) | def test_identity_element_rejection(self):
method test_random_signature_rejection (line 269) | def test_random_signature_rejection(self):
FILE: charm/test/vectors/test_pedersen_vectors.py
class TestPedersenMathematicalProperties (line 16) | class TestPedersenMathematicalProperties(unittest.TestCase):
method setUp (line 25) | def setUp(self):
method test_commitment_correctness (line 32) | def test_commitment_correctness(self):
method test_decommitment_verification (line 49) | def test_decommitment_verification(self):
method test_wrong_message_decommit_fails (line 65) | def test_wrong_message_decommit_fails(self):
method test_wrong_randomness_decommit_fails (line 84) | def test_wrong_randomness_decommit_fails(self):
method test_different_randomness_different_commitments (line 100) | def test_different_randomness_different_commitments(self):
method test_homomorphic_property (line 117) | def test_homomorphic_property(self):
method test_homomorphic_decommit (line 140) | def test_homomorphic_decommit(self):
class TestPedersenEdgeCases (line 162) | class TestPedersenEdgeCases(unittest.TestCase):
method setUp (line 167) | def setUp(self):
method test_zero_message (line 173) | def test_zero_message(self):
method test_one_message (line 187) | def test_one_message(self):
method test_negative_message (line 201) | def test_negative_message(self):
class TestPedersenSecurityProperties (line 217) | class TestPedersenSecurityProperties(unittest.TestCase):
method setUp (line 222) | def setUp(self):
method test_generators_are_independent (line 228) | def test_generators_are_independent(self):
method test_commitment_not_identity (line 240) | def test_commitment_not_identity(self):
method test_random_commitment_does_not_verify (line 254) | def test_random_commitment_does_not_verify(self):
class TestPedersenMultipleRuns (line 270) | class TestPedersenMultipleRuns(unittest.TestCase):
method setUp (line 275) | def setUp(self):
method test_multiple_commitments_all_verify (line 281) | def test_multiple_commitments_all_verify(self):
method test_all_commitments_unique (line 295) | def test_all_commitments_unique(self):
FILE: charm/test/vectors/test_schnorr_vectors.py
class TestSchnorrMathematicalProperties (line 18) | class TestSchnorrMathematicalProperties(unittest.TestCase):
method setUp (line 26) | def setUp(self):
method test_completeness_interactive (line 30) | def test_completeness_interactive(self):
method test_completeness_non_interactive (line 62) | def test_completeness_non_interactive(self):
method test_soundness_wrong_witness (line 83) | def test_soundness_wrong_witness(self):
method test_verification_equation (line 105) | def test_verification_equation(self):
method test_challenge_binding (line 127) | def test_challenge_binding(self):
method test_zero_knowledge_simulation (line 152) | def test_zero_knowledge_simulation(self):
class TestSchnorrEdgeCases (line 185) | class TestSchnorrEdgeCases(unittest.TestCase):
method setUp (line 190) | def setUp(self):
method test_identity_commitment_rejection (line 194) | def test_identity_commitment_rejection(self):
method test_zero_secret (line 220) | def test_zero_secret(self):
method test_one_secret (line 237) | def test_one_secret(self):
method test_large_secret (line 253) | def test_large_secret(self):
class TestSchnorrSerialization (line 271) | class TestSchnorrSerialization(unittest.TestCase):
method setUp (line 276) | def setUp(self):
method test_serialize_deserialize_roundtrip (line 280) | def test_serialize_deserialize_roundtrip(self):
method test_serialized_proof_is_bytes (line 303) | def test_serialized_proof_is_bytes(self):
class TestSchnorrMultipleRuns (line 320) | class TestSchnorrMultipleRuns(unittest.TestCase):
method setUp (line 325) | def setUp(self):
method test_multiple_proofs_all_verify (line 329) | def test_multiple_proofs_all_verify(self):
method test_different_generators (line 346) | def test_different_generators(self):
FILE: charm/test/zkp_compiler/benchmark_zkp.py
function benchmark_schnorr (line 28) | def benchmark_schnorr(group, iterations=ITERATIONS):
function benchmark_dleq (line 54) | def benchmark_dleq(group, iterations=ITERATIONS):
function benchmark_representation (line 82) | def benchmark_representation(group, iterations=ITERATIONS):
function benchmark_and (line 110) | def benchmark_and(group, iterations=ITERATIONS):
function benchmark_or (line 146) | def benchmark_or(group, iterations=ITERATIONS):
function benchmark_range (line 173) | def benchmark_range(group, iterations=ITERATIONS):
function run_benchmarks (line 200) | def run_benchmarks():
function print_results_table (line 226) | def print_results_table(results):
FILE: charm/test/zkp_compiler/test_and_proof.py
class TestANDProofNonInteractive (line 16) | class TestANDProofNonInteractive(unittest.TestCase):
method setUp (line 19) | def setUp(self):
method test_two_schnorr_proofs (line 23) | def test_two_schnorr_proofs(self):
method test_three_schnorr_proofs (line 51) | def test_three_schnorr_proofs(self):
method test_mixed_proof_types (line 81) | def test_mixed_proof_types(self):
method test_wrong_secret_fails (line 112) | def test_wrong_secret_fails(self):
method test_tampered_proof_fails (line 136) | def test_tampered_proof_fails(self):
method test_empty_statements_fails (line 168) | def test_empty_statements_fails(self):
class TestANDProofSerialization (line 174) | class TestANDProofSerialization(unittest.TestCase):
method setUp (line 177) | def setUp(self):
method test_serialization_roundtrip (line 181) | def test_serialization_roundtrip(self):
method test_serialized_proof_verifies (line 208) | def test_serialized_proof_verifies(self):
FILE: charm/test/zkp_compiler/test_batch_verify.py
class TestBatchVerifySchnorr (line 19) | class TestBatchVerifySchnorr(unittest.TestCase):
method setUp (line 22) | def setUp(self):
method _create_valid_schnorr_proof (line 27) | def _create_valid_schnorr_proof(self):
method _create_invalid_schnorr_proof (line 34) | def _create_invalid_schnorr_proof(self):
method test_batch_verify_all_valid (line 42) | def test_batch_verify_all_valid(self):
method test_batch_verify_one_invalid (line 48) | def test_batch_verify_one_invalid(self):
method test_batch_verify_empty (line 55) | def test_batch_verify_empty(self):
Condensed preview — 556 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (6,053K chars).
[
{
"path": ".bandit",
"chars": 258,
"preview": "# Bandit configuration for Charm-Crypto library\n# Targets production code, excludes test files\n\n# Exclude test directori"
},
{
"path": ".github/workflows/build.yml",
"chars": 12137,
"preview": "name: Build and Test\n\non:\n push:\n branches: [main, dev, pip-package]\n pull_request:\n branches: [main, dev]\n wor"
},
{
"path": ".github/workflows/ci.yml",
"chars": 4620,
"preview": "name: CI\n\non:\n push:\n branches:\n - dev\n pull_request:\n branches:\n - dev\n schedule:\n # Run fuzzing "
},
{
"path": ".gitignore",
"chars": 693,
"preview": "config.log\nconfig.mk\nMANIFEST\nDockerfile.readme-test\nlog.txt\ndist/\nbuild/\ndoc/build/*\ncharm/config.py\n.cache/\n.eggs/\n*.p"
},
{
"path": ".travis.yml",
"chars": 718,
"preview": "language: python\npython:\n - \"3.4\"\n - \"3.6\"\n - \"3.7\"\n #- \"3.8\"\nbefore_install:\n- sudo apt-get -qq update\n# Make sure "
},
{
"path": "CHANGELOG",
"chars": 8038,
"preview": "v0.61.1 release (PyPI installation fix)\n---------------------------------------\n- Fixed PyPI installation failure (Attri"
},
{
"path": "Dockerfile",
"chars": 456,
"preview": "FROM ubuntu:18.04\nMAINTAINER support@charm-crypto.com\n\nRUN apt update && apt install --yes build-essential flex bison wg"
},
{
"path": "Dockerfile.install-test",
"chars": 981,
"preview": "# Dockerfile for testing the install.sh script\n# Tests the minimal installation script on Ubuntu 22.04\n#\n# Usage:\n# do"
},
{
"path": "Dockerfile.install-test-arch",
"chars": 846,
"preview": "# Dockerfile for testing Charm-Crypto install script on Arch Linux\n#\n# Usage:\n# docker build --platform linux/amd64 -f"
},
{
"path": "Dockerfile.install-test-fedora",
"chars": 768,
"preview": "# Dockerfile for testing Charm-Crypto install script on Fedora\n#\n# Usage:\n# docker build -f Dockerfile.install-test-fe"
},
{
"path": "Dockerfile.test",
"chars": 2589,
"preview": "# Dockerfile for testing Charm-Crypto with Python 3.12+\n# This mirrors the GitHub Actions CI environment for local debug"
},
{
"path": "INSTALL",
"chars": 13367,
"preview": "Charm-Crypto: Installation Documentation\n-------------------------------------------------------------------------------"
},
{
"path": "LICENSE.txt",
"chars": 7651,
"preview": " GNU LESSER GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007"
},
{
"path": "MANIFEST.in",
"chars": 334,
"preview": "include VERSION README.md INSTALL configure.sh Makefile CHANGELOG setup.cfg\ninclude LICENSE.txt pyproject.toml config.di"
},
{
"path": "Makefile",
"chars": 6040,
"preview": "\nCONFIG=config.mk\ninclude ./${CONFIG}\nexport CONFIG_FILE=${CURDIR}/${CONFIG}\n\n# user config options\nsetup1=$(shell mkdir"
},
{
"path": "README.md",
"chars": 13035,
"preview": "Charm-Crypto\n============\n\n| Branch | Status "
},
{
"path": "VERSION",
"chars": 5,
"preview": "0.62\n"
},
{
"path": "charm/__init__.py",
"chars": 311,
"preview": "# This fixes an issue where certain python interpeters/operating systems\n# fail to properly load shared modules that c e"
},
{
"path": "charm/adapters/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "charm/adapters/abenc_adapt_hybrid.py",
"chars": 3165,
"preview": "'''\n**Hybrid Encryption Adapter for CP-ABE (CP-ABE Hybrid)**\n\n*Description:* Converts a Ciphertext-Policy Attribute-Base"
},
{
"path": "charm/adapters/dabenc_adapt_hybrid.py",
"chars": 5595,
"preview": "'''\n**Hybrid Encryption Adapter for Multi-Authority ABE (MA-ABE Hybrid)**\n\n*Description:* Converts a Decentralized/Multi"
},
{
"path": "charm/adapters/ibenc_adapt_hybrid.py",
"chars": 2399,
"preview": "'''\n**Hybrid Encryption Adapter for IBE (IBE Hybrid)**\n\n*Description:* Converts an Identity-Based Encryption scheme into"
},
{
"path": "charm/adapters/ibenc_adapt_identityhash.py",
"chars": 2831,
"preview": "'''\n**Identity Hashing Adapter for IBE (HashID Adapter)**\n\n*Description:* Converts an Identity-Based Encryption scheme t"
},
{
"path": "charm/adapters/kpabenc_adapt_hybrid.py",
"chars": 3084,
"preview": "'''\n**Hybrid Encryption Adapter for KP-ABE (KP-ABE Hybrid)**\n\n*Description:* Converts a Key-Policy Attribute-Based Encry"
},
{
"path": "charm/adapters/pkenc_adapt_bchk05.py",
"chars": 3760,
"preview": "'''\n**Boneh-Canetti-Halevi-Katz IBE-to-PKE Transform (BCHK05)**\n\n*Description:* Transforms an Identity-Based Encryption "
},
{
"path": "charm/adapters/pkenc_adapt_chk04.py",
"chars": 3573,
"preview": "'''\n**Canetti-Halevi-Katz IBE-to-PKE Transform (CHK04)**\n\n*Description:* Transforms an Identity-Based Encryption scheme "
},
{
"path": "charm/adapters/pkenc_adapt_hybrid.py",
"chars": 3413,
"preview": "'''\n**Hybrid Encryption Adapter for PKE (PKE Hybrid)**\n\n*Description:* Converts a Public Key Encryption scheme into a hy"
},
{
"path": "charm/adapters/pksig_adapt_naor01.py",
"chars": 3252,
"preview": "'''\n**Naor's IBE-to-Signature Transform (Naor01)**\n\n*Description:* Transforms a fully-secure Identity-Based Encryption s"
},
{
"path": "charm/core/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "charm/core/benchmark/benchmark_util.c",
"chars": 11271,
"preview": "\n#if defined(__APPLE__)\n// benchmark new\nPyObject *Benchmark_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n{\n "
},
{
"path": "charm/core/benchmark/benchmark_util.h",
"chars": 2529,
"preview": "#ifndef BENCHMARK_UTIL_H\n#define BENCHMARK_UTIL_H\n\n// for multiplicative notation\n#define Op_MUL(op_var_type, op_group_t"
},
{
"path": "charm/core/benchmark/benchmarkmodule.c",
"chars": 14779,
"preview": "#define BENCHMARK_MODULE\n#include \"benchmarkmodule.h\"\n#ifndef BENCHMARK_MODULE\n// define new benchmark type for benchmar"
},
{
"path": "charm/core/benchmark/benchmarkmodule.h",
"chars": 5362,
"preview": "/*\n * benchmarkmodule.h\n */\n#ifndef Py_BENCHMARKMODULE_H_\n#define Py_BENCHMARKMODULE_H_\n#ifdef __cplusplus\nextern \"C\" {\n"
},
{
"path": "charm/core/crypto/AES/AES.c",
"chars": 61685,
"preview": "/**\n * rijndael-alg-fst.c\n *\n * @version 3.0 (December 2000)\n *\n * Optimised ANSI C code for the Rijndael cipher (now AE"
},
{
"path": "charm/core/crypto/COMPILED_EXTENSION_MODULES_HERE",
"chars": 227,
"preview": "Compiled extension modules go here\n\nAs of 6/7/2012 these are :\nAES.cpython-32mu.so base.cpython-32mu.so DES3.cpython-3"
},
{
"path": "charm/core/crypto/DES/DES.c",
"chars": 3388,
"preview": "/*\n * DES.c: DES/3DES support for PyCrypto using LibTomCrypt\n *\n * Written in 2009 by Dwayne C. Litzenberger <dlitz@dli"
},
{
"path": "charm/core/crypto/DES3/DES3.c",
"chars": 1153,
"preview": "/*\n * DES3.c: 3DES support for PyCrypto using LibTomCrypt\n *\n * Written in 2009 by Dwayne C. Litzenberger <dlitz@dlitz."
},
{
"path": "charm/core/crypto/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "charm/core/crypto/cryptobase/XOR.c",
"chars": 2180,
"preview": "/*\n * xor.c : Source for the trivial cipher which XORs the message with the key.\n * The key can be up to 32 by"
},
{
"path": "charm/core/crypto/cryptobase/_counter.c",
"chars": 15542,
"preview": "/*\n * _counter.c: Fast counter for use with CTR-mode ciphers\n *\n * Written in 2008 by Dwayne C. Litzenberger <dlitz@dli"
},
{
"path": "charm/core/crypto/cryptobase/_counter.h",
"chars": 2485,
"preview": "/*\n * _counter.h: Fast counter for use with CTR-mode ciphers\n *\n * Written in 2008 by Dwayne C. Litzenberger <dlitz@dli"
},
{
"path": "charm/core/crypto/cryptobase/block_template.c",
"chars": 23290,
"preview": "\n/* -*- C -*- */\n/*\n * block_template.c : Generic framework for block encryption algorithms\n *\n * Written by Andrew Kuc"
},
{
"path": "charm/core/crypto/cryptobase/block_template.h",
"chars": 1336,
"preview": "\n\n#ifndef BLOCK_TEMPLATE_H\n#define BLOCK_TEMPLATE_H\n\n#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif\n\n#ifdef _HAVE_STDC_"
},
{
"path": "charm/core/crypto/cryptobase/cryptobasemodule.c",
"chars": 5990,
"preview": "#ifndef PY_SSIZE_T_CLEAN\n#define PY_SSIZE_T_CLEAN\n#endif\n#include <Python.h>\n#include <structmember.h>\n\nstatic PyTypeObj"
},
{
"path": "charm/core/crypto/cryptobase/libtom/tomcrypt.h",
"chars": 2549,
"preview": "#ifndef TOMCRYPT_H_\n#define TOMCRYPT_H_\n#include <assert.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#"
},
{
"path": "charm/core/crypto/cryptobase/libtom/tomcrypt_argchk.h",
"chars": 1093,
"preview": "/* Defines the LTC_ARGCHK macro used within the library */\n/* ARGTYPE is defined in tomcrypt_cfg.h */\n#if ARGTYPE == 0\n\n"
},
{
"path": "charm/core/crypto/cryptobase/libtom/tomcrypt_cfg.h",
"chars": 5562,
"preview": "/* This is the build config file.\n *\n * With this you can setup what to inlcude/exclude automatically during any build. "
},
{
"path": "charm/core/crypto/cryptobase/libtom/tomcrypt_cipher.h",
"chars": 33396,
"preview": "/* ---- SYMMETRIC KEY STUFF -----\n *\n * We put each of the ciphers scheduled keys in their own structs then we put all o"
},
{
"path": "charm/core/crypto/cryptobase/libtom/tomcrypt_custom.h",
"chars": 11682,
"preview": "#ifndef TOMCRYPT_CUSTOM_H_\n#define TOMCRYPT_CUSTOM_H_\n\n/* macros for various libc functions you can change for embedded "
},
{
"path": "charm/core/crypto/cryptobase/libtom/tomcrypt_des.c",
"chars": 152436,
"preview": "/* LibTomCrypt, modular cryptographic library -- Tom St Denis\n *\n * LibTomCrypt is a library that provides various crypt"
},
{
"path": "charm/core/crypto/cryptobase/libtom/tomcrypt_hash.h",
"chars": 13338,
"preview": "/* ---- HASH FUNCTIONS ---- */\n#ifdef LTC_SHA512\nstruct sha512_state {\n ulong64 length, state[8];\n unsigned long "
},
{
"path": "charm/core/crypto/cryptobase/libtom/tomcrypt_mac.h",
"chars": 19562,
"preview": "#ifdef LTC_HMAC\ntypedef struct Hmac_state {\n hash_state md;\n int hash;\n hash_state hashst"
},
{
"path": "charm/core/crypto/cryptobase/libtom/tomcrypt_macros.h",
"chars": 14958,
"preview": "\n/* ---- HELPER MACROS ---- */\n#ifdef ENDIAN_NEUTRAL\n\n#define STORE32L(x, y) "
},
{
"path": "charm/core/crypto/cryptobase/libtom/tomcrypt_math.h",
"chars": 18016,
"preview": "/** math functions **/\n\n#define LTC_MP_LT -1\n#define LTC_MP_EQ 0\n#define LTC_MP_GT 1\n\n#define LTC_MP_NO 0\n#de"
},
{
"path": "charm/core/crypto/cryptobase/libtom/tomcrypt_misc.h",
"chars": 3178,
"preview": "/* ---- LTC_BASE64 Routines ---- */\n#ifdef LTC_BASE64\nint base64_encode(const unsigned char *in, unsigned long len,\n "
},
{
"path": "charm/core/crypto/cryptobase/libtom/tomcrypt_pk.h",
"chars": 24374,
"preview": "/* ---- NUMBER THEORY ---- */\n\nenum {\n PK_PUBLIC=0,\n PK_PRIVATE=1\n};\n\n/* Indicates standard output formats that can "
},
{
"path": "charm/core/crypto/cryptobase/libtom/tomcrypt_pkcs.h",
"chars": 3870,
"preview": "/* PKCS Header Info */\n\n/* ===> PKCS #1 -- RSA Cryptography <=== */\n#ifdef LTC_PKCS_1\n\nenum ltc_pkcs_1_v1_5_blocks\n{\n L"
},
{
"path": "charm/core/crypto/cryptobase/libtom/tomcrypt_prng.h",
"chars": 7115,
"preview": "/* ---- PRNG Stuff ---- */\n#ifdef LTC_YARROW\nstruct yarrow_prng {\n int cipher, hash;\n unsigned c"
},
{
"path": "charm/core/crypto/cryptobase/stream_template.c",
"chars": 6320,
"preview": "/* -*- C -*- */\n\n/*\n * stream_template.c : Generic framework for stream ciphers\n *\n * Written by Andrew Kuchling and ot"
},
{
"path": "charm/core/crypto/cryptobase/strxor.c",
"chars": 5907,
"preview": "/*\n * strxor.c: string XOR functions\n *\n * Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net>\n *\n * =========="
},
{
"path": "charm/core/engine/__init__.py",
"chars": 47,
"preview": "\n#from protocol import *\n#from util import *\n\n\n"
},
{
"path": "charm/core/engine/protocol.py",
"chars": 11650,
"preview": "# TODO: provide a transition checker that prevents a feedback loop, inconsistent state.\n# in user db that way user can e"
},
{
"path": "charm/core/engine/util.py",
"chars": 5395,
"preview": "\"\"\"\nThe serialization API supports the following datatypes: dict, list, str, bytes, int, float, and whatever is supporte"
},
{
"path": "charm/core/math/COMPILED_EXTENSION_MODULES_HERE",
"chars": 223,
"preview": "Compiled extension modules go here\n\nAs of 6/7/2012 these are :\nelliptic_curve.cpython-32mu.so integer.cpython-32mu.so "
},
{
"path": "charm/core/math/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "charm/core/math/elliptic_curve/ecmodule.c",
"chars": 61079,
"preview": "/*\n * Charm-Crypto is a framework for rapidly prototyping cryptosystems.\n *\n * Charm-Crypto is free software; you can re"
},
{
"path": "charm/core/math/elliptic_curve/ecmodule.h",
"chars": 6372,
"preview": "/*\n * Charm-Crypto is a framework for rapidly prototyping cryptosystems.\n *\n * Charm-Crypto is free software; you can re"
},
{
"path": "charm/core/math/elliptic_curve.pyi",
"chars": 2229,
"preview": "\"\"\"Type stubs for charm.core.math.elliptic_curve C extension module.\"\"\"\n\nfrom typing import overload\n\n# Module-level con"
},
{
"path": "charm/core/math/integer/integermodule.c",
"chars": 70570,
"preview": "/*\n * Charm-Crypto is a framework for rapidly prototyping cryptosystems.\n *\n * Charm-Crypto is free software; you can re"
},
{
"path": "charm/core/math/integer/integermodule.h",
"chars": 4108,
"preview": "/*\n * Charm-Crypto is a framework for rapidly prototyping cryptosystems.\n *\n * Charm-Crypto is free software; you can re"
},
{
"path": "charm/core/math/integer.pyi",
"chars": 3177,
"preview": "\"\"\"Type stubs for charm.core.math.integer C extension module.\"\"\"\n\nfrom __future__ import annotations\n\nfrom typing import"
},
{
"path": "charm/core/math/pairing/miracl/bn_pair.patch",
"chars": 208,
"preview": "--- bn_pair.cpp\t2012-11-23 16:29:13.000000000 -0500\n+++ bn_pair_fix.cpp\t2012-11-23 16:36:37.000000000 -0500\n@@ -786,7 +7"
},
{
"path": "charm/core/math/pairing/miracl/compile_miracl.sh",
"chars": 4241,
"preview": "#!/bin/sh\n\n# Note: this script might require super-user privileges to install\n# binaries\n\n# untar MIRACL source into thi"
},
{
"path": "charm/core/math/pairing/miracl/miracl_config.h",
"chars": 1017,
"preview": "\n/* auto-generated configuration */\n//#define BUILD_MNT_CURVE 0\n//#define BUILD_BN_CURVE 0\n#define PAD_SIZE\t\t 2 // 2 "
},
{
"path": "charm/core/math/pairing/miracl/miracl_interface.cc",
"chars": 32713,
"preview": "/*\n * Charm-Crypto is a framework for rapidly prototyping cryptosystems.\n *\n * Charm-Crypto is free software; you can re"
},
{
"path": "charm/core/math/pairing/miracl/miracl_interface.h",
"chars": 5554,
"preview": "/*\n * Charm-Crypto is a framework for rapidly prototyping cryptosystems.\n *\n * Charm-Crypto is free software; you can re"
},
{
"path": "charm/core/math/pairing/miracl/miracl_interface2.cc",
"chars": 41933,
"preview": "/*\n * Charm-Crypto is a framework for rapidly prototyping cryptosystems.\n *\n * Charm-Crypto is free software; you can re"
},
{
"path": "charm/core/math/pairing/miracl/miracl_interface2.h",
"chars": 5841,
"preview": "/*\n * Charm-Crypto is a framework for rapidly prototyping cryptosystems.\n *\n * Charm-Crypto is free software; you can re"
},
{
"path": "charm/core/math/pairing/miracl/mnt_pair.patch",
"chars": 252,
"preview": "--- mnt_pair.cpp\t2012-04-20 02:01:39.000000000 -0400\n+++ mnt_pair.new.cpp\t2012-04-20 02:02:07.000000000 -0400\n@@ -687,7 "
},
{
"path": "charm/core/math/pairing/miracl/pairing1.patch",
"chars": 277,
"preview": "--- pairing_1.h\t2012-12-05 02:33:57.000000000 -0500\n+++ pairing_1.new.h\t2012-12-05 02:20:54.000000000 -0500\n@@ -187,7 +1"
},
{
"path": "charm/core/math/pairing/miracl/pairingmodule2.c",
"chars": 60736,
"preview": "/*\n * Charm-Crypto is a framework for rapidly prototyping cryptosystems.\n *\n * Charm-Crypto is free software; you can re"
},
{
"path": "charm/core/math/pairing/miracl/pairingmodule2.h",
"chars": 10524,
"preview": "/*\n * Charm-Crypto is a framework for rapidly prototyping cryptosystems.\n *\n * Charm-Crypto is free software; you can re"
},
{
"path": "charm/core/math/pairing/miracl/ssp_pair.patch",
"chars": 470,
"preview": "--- ssp_pair.cpp\t2013-02-18 01:07:01.000000000 -0500\n+++ ssp_pair_new.cpp\t2013-02-18 01:02:28.000000000 -0500\n@@ -42,7 +"
},
{
"path": "charm/core/math/pairing/pairingmodule.c",
"chars": 66965,
"preview": "/*\n * Charm-Crypto is a framework for rapidly prototyping cryptosystems.\n *\n * Charm-Crypto is free software; you can re"
},
{
"path": "charm/core/math/pairing/pairingmodule.h",
"chars": 6978,
"preview": "/*\n * Charm-Crypto is a framework for rapidly prototyping cryptosystems.\n *\n * Charm-Crypto is free software; you can re"
},
{
"path": "charm/core/math/pairing/relic/buildRELIC.sh",
"chars": 991,
"preview": "#!/bin/bash\n\nset -x\n#export VERBOSE=0\npath_to_relic=$1\npath_to_inc=/usr/local/include/relic\npath_to_lib=/usr/local/lib\n\n"
},
{
"path": "charm/core/math/pairing/relic/pairingmodule3.c",
"chars": 54398,
"preview": "/*\n * Charm-Crypto is a framework for rapidly prototyping cryptosystems.\n *\n * Charm-Crypto is free software; you can re"
},
{
"path": "charm/core/math/pairing/relic/pairingmodule3.h",
"chars": 6611,
"preview": "/*\n * Charm-Crypto is a framework for rapidly prototyping cryptosystems.\n *\n * Charm-Crypto is free software; you can re"
},
{
"path": "charm/core/math/pairing/relic/relic_interface.c",
"chars": 32520,
"preview": "/*\n * Charm-Crypto is a framework for rapidly prototyping cryptosystems.\n *\n * Charm-Crypto is free software; you can re"
},
{
"path": "charm/core/math/pairing/relic/relic_interface.h",
"chars": 6940,
"preview": "/*\n * Charm-Crypto is a framework for rapidly prototyping cryptosystems.\n *\n * Charm-Crypto is free software; you can re"
},
{
"path": "charm/core/math/pairing/relic/test_relic.c",
"chars": 4536,
"preview": "#include <stdio.h>\r\n#include <sys/time.h>\r\n#include \"relic_interface.h\"\r\n\r\n/* prime curves */\r\n#define DEBUG\t\t1\r\n#define"
},
{
"path": "charm/core/math/pairing.pyi",
"chars": 2198,
"preview": "\"\"\"Type stubs for charm.core.math.pairing C extension module.\"\"\"\n\nfrom typing import overload\n\n# Module-level constants "
},
{
"path": "charm/core/utilities/base64.c",
"chars": 6888,
"preview": "#include \"base64.h\"\n\n//\n// NSData+Base64.m\n// base64\n//\n// Created by Matt Gallagher on 2009/06/03.\n// Copyright 200"
},
{
"path": "charm/core/utilities/base64.h",
"chars": 333,
"preview": "#ifndef __BASE64_H__\n#define __BASE64_H__\n\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\n#define TRUE 1\n#d"
},
{
"path": "charm/schemes/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "charm/schemes/abenc/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "charm/schemes/abenc/abenc_accountability_jyjxgd20.py",
"chars": 27742,
"preview": "'''\r\n**ABE with Privacy Protection and Accountability (JYJXGD20)**\r\n\r\n*Authors:* Jiguo Li, Yichen Zhang, Jianting Ning, "
},
{
"path": "charm/schemes/abenc/abenc_bsw07.py",
"chars": 4804,
"preview": "'''\n**Ciphertext-Policy Attribute-Based Encryption (BSW07)**\n\n*Authors:* John Bethencourt, Brent Waters\n\n| **Title:** \"C"
},
{
"path": "charm/schemes/abenc/abenc_ca_cpabe_ar17.py",
"chars": 31358,
"preview": "'''\n**User Collusion Avoidance CP-ABE (AR17)**\n\n*Authors:* Jiguo Li, Wei Yao, Jinguang Han, Yichen Zhang, Jian Shen\n\n| *"
},
{
"path": "charm/schemes/abenc/abenc_dacmacs_yj14.py",
"chars": 11704,
"preview": "'''\r\n**DAC-MACS: Data Access Control for Multi-Authority Cloud Storage (YJ14)**\r\n\r\n*Authors:* Kan Yang, Xiaohua Jia\r\n\r\n|"
},
{
"path": "charm/schemes/abenc/abenc_lsw08.py",
"chars": 5635,
"preview": "'''\n**Key-Policy Attribute-Based Encryption (LSW08)**\n\n*Authors:* Allison Lewko, Amit Sahai, Brent Waters\n\n| **Title:** "
},
{
"path": "charm/schemes/abenc/abenc_maabe_rw15.py",
"chars": 8958,
"preview": "'''\n**Multi-Authority Attribute-Based Encryption (RW15)**\n\n*Authors:* Yannis Rouselakis, Brent Waters\n\n| **Title:** \"Eff"
},
{
"path": "charm/schemes/abenc/abenc_maabe_yj14.py",
"chars": 11453,
"preview": "'''\r\n**Multi-Authority ABE for Cloud Storage (YJ14)**\r\n\r\n*Authors:* Kan Yang, Xiaohua Jia\r\n\r\n| **Title:** \"Expressive, E"
},
{
"path": "charm/schemes/abenc/abenc_tbpre_lww14.py",
"chars": 11019,
"preview": "'''\r\n**Time-Based Proxy Re-Encryption (LWW14)**\r\n\r\n*Authors:* Qin Liu, Guojun Wang, Jie Wu\r\n\r\n| **Title:** \"Time-based p"
},
{
"path": "charm/schemes/abenc/abenc_unmcpabe_yahk14.py",
"chars": 7561,
"preview": "'''\r\n**Non-monotonic CP-ABE (YAHK14)**\r\n\r\n*Authors:* Shota Yamada, Nuttapong Attrapadung, Goichiro Hanaoka, Noboru Kunih"
},
{
"path": "charm/schemes/abenc/abenc_waters09.py",
"chars": 5167,
"preview": "'''\n**Ciphertext-Policy Attribute-Based Encryption (Waters09)**\n\n*Authors:* Brent Waters\n\n| **Title:** \"Ciphertext-Polic"
},
{
"path": "charm/schemes/abenc/abenc_yct14.py",
"chars": 6285,
"preview": "'''\n**Lightweight Key-Policy ABE for IoT (YCT14)**\n\n*Authors:* Xuanxia Yao, Zhi Chen, Ye Tian\n\n| **Title:** \"A lightweig"
},
{
"path": "charm/schemes/abenc/abenc_yllc15.py",
"chars": 6059,
"preview": "'''\n**Extended Proxy-Assisted Revocable CP-ABE (YLLC15)**\n\n*Authors:* Yanjiang Yang, Joseph K Liu, Kaitai Liang, Kim Kwa"
},
{
"path": "charm/schemes/abenc/ac17.py",
"chars": 7858,
"preview": "'''\n**FAME: Fast Attribute-based Message Encryption (AC17)**\n\n*Authors:* Shashank Agrawal, Melissa Chase\n\n| **Title:** \""
},
{
"path": "charm/schemes/abenc/bsw07.py",
"chars": 3992,
"preview": "'''\n**Ciphertext-Policy Attribute-Based Encryption (BSW07) - Asymmetric**\n\n*Authors:* John Bethencourt, Amit Sahai, Bren"
},
{
"path": "charm/schemes/abenc/cgw15.py",
"chars": 8578,
"preview": "'''\n**Improved Dual System ABE (CGW15)**\n\n*Authors:* Jie Chen, Romain Gay, Hoeteck Wee\n\n| **Title:** \"Improved Dual Syst"
},
{
"path": "charm/schemes/abenc/dabe_aw11.py",
"chars": 7728,
"preview": "'''\n**Decentralized Attribute-Based Encryption (AW11)**\n\n*Authors:* Allison Lewko, Brent Waters\n\n| **Title:** \"Decentral"
},
{
"path": "charm/schemes/abenc/dfa_fe12.py",
"chars": 4414,
"preview": "'''\n**Functional Encryption for Regular Languages (FE12)**\n\n*Authors:* Brent Waters\n\n| **Title:** \"Functional Encryption"
},
{
"path": "charm/schemes/abenc/pk_hve08.py",
"chars": 5309,
"preview": "'''\n**Hidden-Vector Encryption (HVE08)**\n\n*Authors:* Vincenzo Iovino, Giuseppe Persiano\n\n| **Title:** \"Hidden-Vector Enc"
},
{
"path": "charm/schemes/abenc/waters11.py",
"chars": 4122,
"preview": "'''\n**Ciphertext-Policy ABE: Expressive and Efficient (Waters11)**\n\n*Authors:* Brent Waters\n\n| **Title:** \"Ciphertext-Po"
},
{
"path": "charm/schemes/aggrsign_MuSig.py",
"chars": 4049,
"preview": "'''\n**MuSig: Key Aggregation for Schnorr Signatures (MuSig)**\n\n*Authors:* Gregory Maxwell, Andrew Poelstra, Yannick Seur"
},
{
"path": "charm/schemes/aggrsign_bls.py",
"chars": 8134,
"preview": "'''\n**BLS Multi-Signatures (BLS)**\n\n*Authors:* Dan Boneh, Manu Drijvers, Gregory Neven\n\n| **Title:** \"BLS Multi-Signatur"
},
{
"path": "charm/schemes/blindsig_ps16.py",
"chars": 24953,
"preview": "'''\r\n**Pointcheval-Sanders Short Randomizable Signatures (PS16)**\r\n\r\n*Authors:* David Pointcheval, Olivier Sanders\r\n\r\n| "
},
{
"path": "charm/schemes/chamhash_adm05.py",
"chars": 4381,
"preview": "'''\n**Ateniese-Medeiros Chameleon Hash (ADM05)**\n\n*Authors:* Giuseppe Ateniese, Breno de Medeiros\n\n| **Title:** \"On the "
},
{
"path": "charm/schemes/chamhash_rsa_hw09.py",
"chars": 4033,
"preview": "'''\n**Hohenberger-Waters Chameleon Hash (HW09)**\n\n*Authors:* Susan Hohenberger, Brent Waters\n\n| **Title:** \"Realizing Ha"
},
{
"path": "charm/schemes/commit/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "charm/schemes/commit/commit_gs08.py",
"chars": 2595,
"preview": "'''\n**Groth-Sahai Commitment (GS08)**\n\n*Authors:* Jens Groth, Amit Sahai\n\n| **Title:** \"Efficient Non-interactive Proof "
},
{
"path": "charm/schemes/commit/commit_pedersen92.py",
"chars": 1398,
"preview": "'''\n**Pedersen Commitment (Ped92)**\n\n*Authors:* Torben P. Pedersen\n\n| **Title:** \"Non-Interactive and Information-Theore"
},
{
"path": "charm/schemes/encap_bchk05.py",
"chars": 1414,
"preview": "'''\n**Key Encapsulation Mechanism (BCHK05)**\n\n*Authors:* Based on commitment scheme constructions\n\n| **Title:** \"Key Enc"
},
{
"path": "charm/schemes/grpsig/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "charm/schemes/grpsig/groupsig_bgls04.py",
"chars": 4269,
"preview": "'''\n**Short Group Signatures (BBS04)**\n\n*Authors:* Dan Boneh, Xavier Boyen, Hovav Shacham\n\n| **Title:** \"Short Group Sig"
},
{
"path": "charm/schemes/grpsig/groupsig_bgls04_var.py",
"chars": 4391,
"preview": "'''\n**Short Group Signatures - Batch Verification Variant (BBS04-Var)**\n\n*Authors:* Dan Boneh, Xavier Boyen, Hovav Shach"
},
{
"path": "charm/schemes/hibenc/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "charm/schemes/hibenc/hibenc_bb04.py",
"chars": 3847,
"preview": "'''\n**Boneh-Boyen Hierarchical Identity-Based Encryption (BB04-HIBE)**\n\n*Authors:* Dan Boneh, Xavier Boyen\n\n| **Title:**"
},
{
"path": "charm/schemes/hibenc/hibenc_lew11.py",
"chars": 7505,
"preview": "'''\n**Lewko-Waters Unbounded Hierarchical Identity-Based Encryption (LW11-HIBE)**\n\n*Authors:* Allison Lewko, Brent Water"
},
{
"path": "charm/schemes/ibenc/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "charm/schemes/ibenc/clpkc_rp03.py",
"chars": 3595,
"preview": "'''\n**Al-Riyami-Paterson Certificateless Public Key Cryptography (RP03)**\n\n*Authors:* Sattam S. Al-Riyami, Kenneth G. Pa"
},
{
"path": "charm/schemes/ibenc/ibenc_CW13_z.py",
"chars": 6071,
"preview": "'''\n**Chen-Wee Dual System Groups IBE (CW13)**\n\n*Authors:* Jie Chen, Hoeteck Wee\n\n| **Title:** \"Dual System Groups and i"
},
{
"path": "charm/schemes/ibenc/ibenc_bb03.py",
"chars": 3096,
"preview": "'''\n**Boneh-Boyen Identity-Based Encryption (BB-IBE)**\n\n*Authors:* Dan Boneh, Xavier Boyen\n\n| **Title:** \"Efficient Sele"
},
{
"path": "charm/schemes/ibenc/ibenc_bf01.py",
"chars": 3848,
"preview": "'''\n**Boneh-Franklin Identity-Based Encryption (BF-IBE)**\n\n*Authors:* Dan Boneh, Matthew Franklin\n\n| **Title:** \"Identit"
},
{
"path": "charm/schemes/ibenc/ibenc_ckrs09.py",
"chars": 4252,
"preview": "'''\n**Camenisch-Kohlweiss-Rial-Sheedy Blind Anonymous IBE (CKRS09)**\n\n*Authors:* Jan Camenisch, Markulf Kohlweiss, Alfre"
},
{
"path": "charm/schemes/ibenc/ibenc_cllww12_z.py",
"chars": 6866,
"preview": "r'''\n**Chen-Lim-Ling-Wang-Wee Shorter IBE (CLLWW12)**\n\n*Authors:* Jie Chen, Hoon Wei Lim, San Ling, Huaxiong Wang, Hoete"
},
{
"path": "charm/schemes/ibenc/ibenc_lsw08.py",
"chars": 4218,
"preview": "'''\n**Lewko-Sahai-Waters Revocable IBE (LSW08)**\n\n*Authors:* Allison Lewko, Amit Sahai, Brent Waters\n\n| **Title:** \"Revo"
},
{
"path": "charm/schemes/ibenc/ibenc_sw05.py",
"chars": 8105,
"preview": "'''\n**Sahai-Waters Fuzzy Identity-Based Encryption (SW05)**\n\n*Authors:* Amit Sahai, Brent Waters\n\n| **Title:** \"Fuzzy Id"
},
{
"path": "charm/schemes/ibenc/ibenc_waters05.py",
"chars": 4445,
"preview": "'''\n**Waters Identity-Based Encryption (Waters05)**\n\n*Authors:* Brent Waters\n\n| **Title:** \"Efficient Identity-Based Enc"
},
{
"path": "charm/schemes/ibenc/ibenc_waters05_z.py",
"chars": 5266,
"preview": "r'''\n**Waters Identity-Based Encryption - Optimized (Waters05-Z)**\n\n*Authors:* Brent Waters\n\n| **Title:** \"Efficient Ide"
},
{
"path": "charm/schemes/ibenc/ibenc_waters09.py",
"chars": 3714,
"preview": "'''\n**Waters Dual System Encryption (Waters09)**\n\n*Authors:* Brent Waters\n\n| **Title:** \"Dual System Encryption: Realizi"
},
{
"path": "charm/schemes/ibenc/ibenc_waters09_z.py",
"chars": 5222,
"preview": "'''\n**Waters Dual System Encryption - Optimized (Waters09-Z)**\n\n*Authors:* Brent Waters\n\n| **Title:** \"Dual System Encry"
},
{
"path": "charm/schemes/joye_scheme.py",
"chars": 3312,
"preview": "'''\n**Privacy-Preserving Aggregation Scheme (JL13)**\n\n*Authors:* Marc Joye, Benoit Libert\n\n| **Title:** \"A Scalable Sche"
},
{
"path": "charm/schemes/lem_scheme.py",
"chars": 4708,
"preview": "'''\n**Private and Dynamic Time-Series Data Aggregation (LEM14)**\n\n*Authors:* Iraklis Leontiadis, Kaoutar Elkhiyaoui, Ref"
},
{
"path": "charm/schemes/pk_fre_ccv11.py",
"chars": 3005,
"preview": "'''\n**Collusion-Resistant Obfuscation and Functional Re-encryption (CCV11)**\n\n*Authors:* Nishanth Chandran, Melissa Chas"
},
{
"path": "charm/schemes/pk_vrf.py",
"chars": 4707,
"preview": "'''\n**Verifiable Random Functions with Large Input Spaces (HW10)**\n\n*Authors:* Susan Hohenberger, Brent Waters\n\n| **Titl"
},
{
"path": "charm/schemes/pkenc/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "charm/schemes/pkenc/pkenc_cs98.py",
"chars": 4285,
"preview": "'''\n**Cramer-Shoup Public Key Encryption Scheme (CS98)**\n\n*Authors:* R. Cramer, V. Shoup\n\n| **Title:** \"A Practical Publ"
},
{
"path": "charm/schemes/pkenc/pkenc_elgamal85.py",
"chars": 4611,
"preview": "'''\n**ElGamal Public Key Encryption Scheme (ElGamal85)**\n\n*Authors:* T. ElGamal\n\n| **Title:** \"A Public Key Cryptosystem"
},
{
"path": "charm/schemes/pkenc/pkenc_gm82.py",
"chars": 2675,
"preview": "'''\n**Goldwasser-Micali Public Key Encryption Scheme (GM82)**\n\n*Authors:* S. Goldwasser, S. Micali\n\n| **Title:** \"Probab"
},
{
"path": "charm/schemes/pkenc/pkenc_paillier99.py",
"chars": 3780,
"preview": "'''\n**Paillier Public Key Encryption Scheme (Paillier99)**\n\n*Authors:* P. Paillier\n\n| **Title:** \"Public-Key Cryptosyste"
},
{
"path": "charm/schemes/pkenc/pkenc_rabin.py",
"chars": 8487,
"preview": "'''\n**Rabin Public Key Encryption Scheme (Rabin)**\n\n*Authors:* M. O. Rabin\n\n| **Title:** \"Digitalized Signatures and Pub"
},
{
"path": "charm/schemes/pkenc/pkenc_rsa.py",
"chars": 6532,
"preview": "'''\n**RSA Public Key Encryption Scheme (RSA)**\n\n*Authors:* R. Rivest, A. Shamir, L. Adleman\n\n| **Title:** \"A Method for "
},
{
"path": "charm/schemes/pksig/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "charm/schemes/pksig/pksig_CW13_z.py",
"chars": 4545,
"preview": "'''\n**Chen-Wee Dual System Signature (CW13)**\n\n*Authors:* J. Chen, H. Wee\n\n| **Title:** \"Dual System Groups and its Appl"
},
{
"path": "charm/schemes/pksig/pksig_bls04.py",
"chars": 2364,
"preview": "'''\n**Boneh-Lynn-Shacham Signature (BLS04)**\n\n*Authors:* D. Boneh, B. Lynn, H. Shacham\n\n| **Title:** \"Short Signatures f"
},
{
"path": "charm/schemes/pksig/pksig_boyen.py",
"chars": 5099,
"preview": "'''\n**Boyen Mesh Signatures (Boyen07)**\n\n*Authors:* X. Boyen\n\n| **Title:** \"Mesh Signatures: How to Leak a Secret with U"
},
{
"path": "charm/schemes/pksig/pksig_chch.py",
"chars": 2577,
"preview": "'''\n**Cha-Cheon Identity-Based Signature (CHCH03)**\n\n*Authors:* J. C. Cha, J. H. Cheon\n\n| **Title:** \"An Identity-Based "
},
{
"path": "charm/schemes/pksig/pksig_chp.py",
"chars": 1976,
"preview": "'''\n**Camenisch-Hohenberger-Pedersen Signature (CHP07)**\n\n*Authors:* J. Camenisch, S. Hohenberger, M. Pedersen\n\n| **Titl"
},
{
"path": "charm/schemes/pksig/pksig_cl03.py",
"chars": 4628,
"preview": "'''\n**Camenisch-Lysyanskaya Signature (CL03)**\n\n*Authors:* J. Camenisch, A. Lysyanskaya\n\n| **Title:** \"A Signature Schem"
},
{
"path": "charm/schemes/pksig/pksig_cl04.py",
"chars": 2473,
"preview": "'''\n**Camenisch-Lysyanskaya Signature (CL04)**\n\n*Authors:* J. Camenisch, A. Lysyanskaya\n\n| **Title:** \"Signature Schemes"
},
{
"path": "charm/schemes/pksig/pksig_cllww12_z.py",
"chars": 5855,
"preview": "'''\n**Chen-Lim-Ling-Wang-Wee Signature (CLLWW12)**\n\n*Authors:* J. Chen, H. Lim, S. Ling, H. Wang, H. Wee\n\n| **Title:** \""
},
{
"path": "charm/schemes/pksig/pksig_cyh.py",
"chars": 3809,
"preview": "'''\n**Chow-Yiu-Hui Identity-Based Ring Signature (CYH05)**\n\n*Authors:* S. Chow, S. Yiu, L. Hui\n\n| **Title:** \"Efficient "
},
{
"path": "charm/schemes/pksig/pksig_dsa.py",
"chars": 2675,
"preview": "'''\n**Digital Signature Algorithm (DSA)**\n\n*Authors:* NIST\n\n| **Title:** \"Digital Signature Standard (DSS)\"\n| **Publishe"
},
{
"path": "charm/schemes/pksig/pksig_ecdsa.py",
"chars": 1945,
"preview": "'''\n**Elliptic Curve Digital Signature Algorithm (ECDSA)**\n\n*Authors:* NIST\n\n| **Title:** \"Digital Signature Standard (D"
},
{
"path": "charm/schemes/pksig/pksig_hess.py",
"chars": 2717,
"preview": "'''\n**Hess Identity-Based Signature (Hess02)**\n\n*Authors:* F. Hess\n\n| **Title:** \"Efficient Identity Based Signature Sch"
},
{
"path": "charm/schemes/pksig/pksig_hw.py",
"chars": 3326,
"preview": "'''\n**Hohenberger-Waters Hash-and-Sign Signature (HW09)**\n\n*Authors:* S. Hohenberger, B. Waters\n\n| **Title:** \"Realizing"
},
{
"path": "charm/schemes/pksig/pksig_lamport.py",
"chars": 1829,
"preview": "'''\r\n**Lamport One-Time Signature (Lamport79)**\r\n\r\n*Authors:* L. Lamport\r\n\r\n| **Title:** \"Constructing Digital Signature"
},
{
"path": "charm/schemes/pksig/pksig_ps01.py",
"chars": 3412,
"preview": "'''\n**Pointcheval-Sanders Signature (PS16) - Known Messages**\n\n*Authors:* D. Pointcheval, O. Sanders\n\n| **Title:** \"Shor"
},
{
"path": "charm/schemes/pksig/pksig_ps02.py",
"chars": 3442,
"preview": "'''\n**Pointcheval-Sanders Signature (PS16) - Sequential Aggregate**\n\n*Authors:* D. Pointcheval, O. Sanders\n\n| **Title:**"
},
{
"path": "charm/schemes/pksig/pksig_ps03.py",
"chars": 3135,
"preview": "'''\n**Pointcheval-Sanders Signature (PS16) - Committed Messages**\n\n*Authors:* D. Pointcheval, O. Sanders\n\n| **Title:** \""
},
{
"path": "charm/schemes/pksig/pksig_rsa_hw09.py",
"chars": 6963,
"preview": "'''\n**Hohenberger-Waters RSA Stateless Signature (HW09-RSA)**\n\n*Authors:* S. Hohenberger, B. Waters\n\n| **Title:** \"Reali"
},
{
"path": "charm/schemes/pksig/pksig_schnorr91.py",
"chars": 2615,
"preview": "'''\n**Schnorr Signature (Schnorr91)**\n\n*Authors:* C. P. Schnorr\n\n| **Title:** \"Efficient Signature Generation by Smart C"
},
{
"path": "charm/schemes/pksig/pksig_waters.py",
"chars": 3829,
"preview": "'''\n**Waters Identity-Based Signature (Waters05)**\n\n*Authors:* B. Waters\n\n| **Title:** \"Efficient Identity-Based Encrypt"
},
{
"path": "charm/schemes/pksig/pksig_waters05.py",
"chars": 3748,
"preview": "'''\n**Naccache Identity-Based Signature (N04)**\n\n*Authors:* D. Naccache\n\n| **Title:** \"Secure and Practical Identity-Bas"
},
{
"path": "charm/schemes/pksig/pksig_waters09.py",
"chars": 4285,
"preview": "'''\n**Waters Dual System Signature (Waters09)**\n\n*Authors:* B. Waters\n\n| **Title:** \"Dual System Encryption: Realizing F"
},
{
"path": "charm/schemes/pre_mg07.py",
"chars": 5538,
"preview": "'''\n**Identity-Based Proxy Re-Encryption (MG07)**\n\n*Authors:* Matthew Green, Giuseppe Ateniese\n\n| **Title:** \"Identity-B"
},
{
"path": "charm/schemes/prenc/pre_afgh06.py",
"chars": 3446,
"preview": "'''\n**AFGH Proxy Re-Encryption (AFGH06)**\n\n*Authors:* Ateniese, Fu, Green, Hohenberger\n\n| **Title:** \"Improved Proxy Re-"
},
{
"path": "charm/schemes/prenc/pre_bbs98.py",
"chars": 3504,
"preview": "'''\n**BBS Proxy Re-Encryption (BBS98)**\n\n*Authors:* Blaze, Bleumer, Strauss\n\n| **Title:** \"Divertible Protocols and Atom"
},
{
"path": "charm/schemes/prenc/pre_nal16.py",
"chars": 6215,
"preview": "'''\n**NAL Proxy Re-Encryption (NAL16)**\n\n*Authors:* Nuñez, Agudo, Lopez\n\n| **Title:** \"On the Application of Generic CCA"
},
{
"path": "charm/schemes/protocol_a01.py",
"chars": 8928,
"preview": "'''\n**Abe Blind Signature Scheme (A01)**\n\n*Authors:* Masayuki Abe\n\n| **Title:** \"A Secure Three-move Blind Signature Sch"
},
{
"path": "charm/schemes/protocol_ao00.py",
"chars": 6623,
"preview": "'''\n**Abe-Okamoto Partially Blind Signature Scheme (AO00)**\n\n*Authors:* Masayuki Abe, Tatsuaki Okamoto\n\n| **Title:** \"Pr"
},
{
"path": "charm/schemes/protocol_cns07.py",
"chars": 10909,
"preview": "'''\n**Simulatable Adaptive Oblivious Transfer (CNS07)**\n\n*Authors:* Jan Camenisch, Gregory Neven, abhi shelat\n\n| **Title"
},
{
"path": "charm/schemes/protocol_schnorr91.py",
"chars": 4111,
"preview": "'''\n**Schnorr Zero-Knowledge Protocol (Schnorr91)**\n\n*Authors:* Claus-Peter Schnorr\n\n| **Title:** \"Efficient Signature G"
},
{
"path": "charm/schemes/sigma1.py",
"chars": 1700,
"preview": "'''\n**Sigma Protocol 1 (Sigma1)**\n\n*Authors:* Charm Developers\n\n| **Notes:** Sigma protocol for proving knowledge in pai"
},
{
"path": "charm/schemes/sigma2.py",
"chars": 4062,
"preview": "'''\n**Sigma Protocol 2 (Sigma2)**\n\n*Authors:* Charm Developers\n\n| **Notes:** Sigma protocol for proving knowledge with p"
},
{
"path": "charm/schemes/sigma3.py",
"chars": 4015,
"preview": "'''\n**Sigma Protocol 3 - Proof of Membership (Sigma3)**\n\n*Authors:* Charm Developers\n\n| **Notes:** Proof of membership: "
},
{
"path": "charm/schemes/threshold/__init__.py",
"chars": 2815,
"preview": "\"\"\"\nThreshold Cryptography Schemes\n\nThis module provides threshold cryptographic schemes including:\n- DKLS23 Distributed"
},
{
"path": "charm/schemes/threshold/cggmp21_dkg.py",
"chars": 13916,
"preview": "'''\nDistributed Key Generation for CGGMP21 Threshold ECDSA\n\n| From: \"UC Non-Interactive, Proactive, Threshold ECDSA with"
},
{
"path": "charm/schemes/threshold/cggmp21_presign.py",
"chars": 11846,
"preview": "'''\nPresigning Protocol for CGGMP21 Threshold ECDSA\n\n| From: \"UC Non-Interactive, Proactive, Threshold ECDSA with Identi"
},
{
"path": "charm/schemes/threshold/cggmp21_proofs.py",
"chars": 14272,
"preview": "'''\nZero-Knowledge Proofs for CGGMP21 Threshold ECDSA\n\n| From: \"UC Non-Interactive, Proactive, Threshold ECDSA with Iden"
},
{
"path": "charm/schemes/threshold/cggmp21_sign.py",
"chars": 15240,
"preview": "'''\nCGGMP21 Threshold ECDSA Signing Protocol\n\n| From: \"UC Non-Interactive, Proactive, Threshold ECDSA with Identifiable "
},
{
"path": "charm/schemes/threshold/dkls23_dkg.py",
"chars": 23375,
"preview": "'''\nDistributed Key Generation for DKLS23 Threshold ECDSA\n\n| From: \"Two-Round Threshold ECDSA from ECDSA Assumptions\"\n| "
},
{
"path": "charm/schemes/threshold/dkls23_presign.py",
"chars": 44917,
"preview": "'''\nDKLS23 Presigning Protocol (3 rounds) for Threshold ECDSA\n\n| From: \"Two-Round Threshold ECDSA from ECDSA Assumptions"
},
{
"path": "charm/schemes/threshold/dkls23_sign.py",
"chars": 28517,
"preview": "'''\nDKLS23 Signing Protocol and Main Class for Threshold ECDSA\n\n| From: \"Two-Round Threshold ECDSA from ECDSA Assumption"
},
{
"path": "charm/schemes/threshold/gg18_dkg.py",
"chars": 11102,
"preview": "'''\nDistributed Key Generation for GG18 Threshold ECDSA\n\n| From: \"Fast Multiparty Threshold ECDSA with Fast Trustless Se"
},
{
"path": "charm/schemes/threshold/gg18_sign.py",
"chars": 26570,
"preview": "'''\nGG18 Threshold ECDSA Signing Protocol\n\n| From: \"Fast Multiparty Threshold ECDSA with Fast Trustless Setup\"\n| By: R"
},
{
"path": "charm/schemes/threshold/xrpl_wallet.py",
"chars": 29736,
"preview": "\"\"\"\nXRPL Threshold Wallet Integration\n\nThis module provides XRPL (XRP Ledger) wallet functionality using the DKLS23\nthre"
},
{
"path": "charm/test/__init__.py",
"chars": 0,
"preview": ""
}
]
// ... and 356 more files (download for full content)
About this extraction
This page contains the full source code of the JHUISI/charm GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 556 files (4.7 MB), approximately 1.3M tokens, and a symbol index with 3622 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.