update code

Project: http://git-wip-us.apache.org/repos/asf/incubator-milagro-crypto-c/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-milagro-crypto-c/commit/8d28d2c3
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-milagro-crypto-c/tree/8d28d2c3
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-milagro-crypto-c/diff/8d28d2c3

Branch: refs/heads/master
Commit: 8d28d2c380ecef4277dd0c3de2bf217d22aea47a
Parents: 0620bcf
Author: Brian Spector <[email protected]>
Authored: Thu Nov 8 00:11:49 2018 +0000
Committer: Brian Spector <[email protected]>
Committed: Thu Nov 8 00:11:49 2018 +0000

----------------------------------------------------------------------
 .dockerignore                                   |     2 +
 .gitignore                                      |     3 +
 .travis.yml                                     |    17 +
 AMCLConfig.cmake.in                             |    31 +
 CMakeLists.txt                                  |   679 +
 CPackConfig.cmake                               |    62 +
 Dockerfile                                      |    30 +
 LICENSE                                         |   202 +
 Makefile                                        |   373 +
 Makefile.docker                                 |    43 +
 README.md                                       |   209 +
 RELEASE                                         |     1 +
 VERSION                                         |     1 +
 amcl.pc.in                                      |    10 +
 benchmark/CMakeLists.txt                        |    52 +
 benchmark/benchtest_ec_ZZZ.c.in                 |   116 +
 benchmark/benchtest_mpin_ZZZ.c.in               |   255 +
 benchmark/benchtest_pair_ZZZ.c.in               |   281 +
 benchmark/benchtest_rsa_WWW.c.in                |   127 +
 buildMulti.sh                                   |    22 +
 cmake/AMCLExpand.cmake                          |   104 +
 cmake/AMCLParameters.cmake                      |   205 +
 cmake/DetermineWordSize.cmake                   |    47 +
 cmake/PythonSiteDirs.cmake                      |    29 +
 cmake/SetOSVariable.cmake                       |    28 +
 cmake/determine_word_size/check_16.c            |     9 +
 cmake/determine_word_size/check_32.c            |    11 +
 cmake/determine_word_size/check_64.c            |    11 +
 cmake_uninstall.cmake.in                        |    21 +
 config.mk                                       |    52 +
 doc/AMCL.dox                                    |   278 +
 doc/AMCL.pdf                                    |   Bin 0 -> 423451 bytes
 doc/CMakeLists.txt                              |    19 +
 doc/Doxyfile                                    |  1800 +
 doc/Home.md                                     |     3 +
 doc/README.md                                   |    19 +
 doc/latex/Makefile                              |    32 +
 doc/latex/README.md                             |     3 +
 doc/latex/amcl.bib                              |   199 +
 doc/latex/amcl.tex                              |   512 +
 doc/latex/clint.eps                             |   682 +
 doc/latex/llncs.cls                             |  1190 +
 doc/latex/screen.eps                            | 65799 ++++++++++++++++
 doc/latex/words.eps                             |   469 +
 examples/CMakeLists.txt                         |    58 +
 examples/amcl_build.c                           |    32 +
 examples/testall.c                              |   913 +
 examples/testdvs_ZZZ.c.in                       |   308 +
 examples/testecdh_ZZZ.c.in                      |   231 +
 examples/testmpin_ZZZ.c.in                      |   372 +
 examples/testrsa_WWW.c.in                       |   106 +
 examples/testwcc_ZZZ.c.in                       |   394 +
 examples/testwcc_dta_ZZZ.c.in                   |   439 +
 examples/testx509.c                             |   466 +
 include/amcl.h.in                               |   590 +
 include/arch.h.in                               |   126 +
 include/big.h.in                                |   589 +
 include/config_big.h.in                         |    38 +
 include/config_curve.h.in                       |    44 +
 include/config_ff.h.in                          |    38 +
 include/config_field.h.in                       |    34 +
 include/config_test.h.in                        |    33 +
 include/ecdh.h.in                               |   128 +
 include/ecdh_support.h                          |   111 +
 include/ecp.h.in                                |   308 +
 include/ecp2.h.in                               |   219 +
 include/ecp4.h.in                               |   253 +
 include/ecp8.h.in                               |   267 +
 include/ff.h.in                                 |   296 +
 include/fp.h.in                                 |   245 +
 include/fp12.h.in                               |   216 +
 include/fp16.h.in                               |   286 +
 include/fp2.h.in                                |   240 +
 include/fp24.h.in                               |   222 +
 include/fp4.h.in                                |   304 +
 include/fp48.h.in                               |   222 +
 include/fp8.h.in                                |   320 +
 include/mpin.h.in                               |   357 +
 include/mpin192.h.in                            |   358 +
 include/mpin256.h.in                            |   358 +
 include/pair.h.in                               |   103 +
 include/pair192.h.in                            |    77 +
 include/pair256.h.in                            |    77 +
 include/pbc_support.h                           |    96 +
 include/randapi.h                               |    46 +
 include/rsa.h.in                                |   110 +
 include/rsa_support.h                           |    62 +
 include/utils.h                                 |    86 +
 include/version.h.in                            |    74 +
 include/wcc.h.in                                |   179 +
 include/wcc192.h.in                             |   179 +
 include/wcc256.h.in                             |   179 +
 include/x509.h                                  |   109 +
 resources/cmake/mingw32-cross.cmake             |    22 +
 resources/cmake/mingw64-cross.cmake             |    22 +
 resources/icon/icon.bmp                         |   Bin 0 -> 129738 bytes
 resources/icon/icon.ico                         |   Bin 0 -> 133982 bytes
 src/aes.c                                       |   704 +
 src/big.c.in                                    |  1438 +
 src/ecdh.c.in                                   |   408 +
 src/ecdh_support.c                              |   329 +
 src/ecp.c.in                                    |  1265 +
 src/ecp2.c.in                                   |   763 +
 src/ecp4.c.in                                   |   818 +
 src/ecp8.c.in                                   |  1023 +
 src/ff.c.in                                     |  1135 +
 src/fp.c.in                                     |   650 +
 src/fp12.c.in                                   |   870 +
 src/fp16.c.in                                   |   693 +
 src/fp2.c.in                                    |   469 +
 src/fp24.c.in                                   |   940 +
 src/fp4.c.in                                    |   785 +
 src/fp48.c.in                                   |  1143 +
 src/fp8.c.in                                    |   670 +
 src/gcm.c                                       |   411 +
 src/hash.c                                      |   606 +
 src/mpin.c.in                                   |   939 +
 src/mpin192.c.in                                |   952 +
 src/mpin256.c.in                                |   972 +
 src/oct.c                                       |   424 +
 src/pair.c.in                                   |   781 +
 src/pair192.c.in                                |   652 +
 src/pair256.c.in                                |   730 +
 src/pbc_support.c                               |   177 +
 src/rand.c                                      |   171 +
 src/randapi.c                                   |    15 +
 src/rom_curve_ANSSI.c                           |    34 +
 src/rom_curve_BLS24.c                           |    64 +
 src/rom_curve_BLS381.c                          |    56 +
 src/rom_curve_BLS383.c                          |    56 +
 src/rom_curve_BLS461.c                          |    56 +
 src/rom_curve_BLS48.c                           |    80 +
 src/rom_curve_BN254.c                           |    75 +
 src/rom_curve_BN254CX.c                         |    75 +
 src/rom_curve_BRAINPOOL.c                       |    35 +
 src/rom_curve_C25519.c                          |    28 +
 src/rom_curve_C41417.c                          |    34 +
 src/rom_curve_ED25519.c                         |    41 +
 src/rom_curve_FP256BN.c                         |    59 +
 src/rom_curve_FP512BN.c                         |    58 +
 src/rom_curve_GOLDILOCKS.c                      |    36 +
 src/rom_curve_HIFIVE.c                          |    36 +
 src/rom_curve_NIST256.c                         |    35 +
 src/rom_curve_NIST384.c                         |    36 +
 src/rom_curve_NIST521.c                         |    35 +
 src/rom_curve_NUMS256E.c                        |    42 +
 src/rom_curve_NUMS256W.c                        |    34 +
 src/rom_curve_NUMS384E.c                        |    34 +
 src/rom_curve_NUMS384W.c                        |    34 +
 src/rom_curve_NUMS512E.c                        |    34 +
 src/rom_curve_NUMS512W.c                        |    34 +
 src/rom_curve_SECP256K1.c                       |    35 +
 src/rom_field_25519.c                           |    25 +
 src/rom_field_256PME.c                          |    25 +
 src/rom_field_256PMW.c                          |    24 +
 src/rom_field_384PM.c                           |    24 +
 src/rom_field_512PM.c                           |    24 +
 src/rom_field_ANSSI.c                           |    24 +
 src/rom_field_BLS24.c                           |    28 +
 src/rom_field_BLS381.c                          |    28 +
 src/rom_field_BLS383.c                          |    28 +
 src/rom_field_BLS461.c                          |    28 +
 src/rom_field_BLS48.c                           |    28 +
 src/rom_field_BN254.c                           |    33 +
 src/rom_field_BN254CX.c                         |    33 +
 src/rom_field_BRAINPOOL.c                       |    24 +
 src/rom_field_C41417.c                          |    24 +
 src/rom_field_FP256BN.c                         |    30 +
 src/rom_field_FP512BN.c                         |    30 +
 src/rom_field_GOLDILOCKS.c                      |    24 +
 src/rom_field_HIFIVE.c                          |    24 +
 src/rom_field_NIST256.c                         |    25 +
 src/rom_field_NIST384.c                         |    24 +
 src/rom_field_NIST521.c                         |    24 +
 src/rom_field_SECP256K1.c                       |    24 +
 src/rsa.c.in                                    |   159 +
 src/rsa_support.c                               |   237 +
 src/utils.c                                     |   131 +
 src/version.c                                   |   136 +
 src/wcc.c.in                                    |   343 +
 src/wcc192.c.in                                 |   368 +
 src/wcc256.c.in                                 |   413 +
 src/x509.c                                      |  1081 +
 test/CMakeLists.txt                             |   257 +
 test/test_aes_decrypt.c                         |   252 +
 test/test_aes_encrypt.c                         |   253 +
 test/test_big_arithmetics_XXX.c.in              |   361 +
 test/test_big_consistency_XXX.c.in              |   254 +
 test/test_ecc_ZZZ.c.in                          |   233 +
 test/test_ecdh_ZZZ.c.in                         |   308 +
 test/test_ecdsa_keypair_ZZZ.c.in                |   171 +
 test/test_ecdsa_sign_ZZZ.c.in                   |   329 +
 test/test_ecdsa_verify_ZZZ.c.in                 |   263 +
 test/test_ecp2_arithmetics_ZZZ.c.in             |   400 +
 test/test_ecp4_arithmetics_ZZZ.c.in             |   413 +
 test/test_ecp8_arithmetics_ZZZ.c.in             |   416 +
 test/test_ecp_arithmetics_ZZZ.c.in              |   443 +
 test/test_fp12_arithmetics_YYY.c.in             |   605 +
 test/test_fp16_arithmetics_YYY.c.in             |   584 +
 test/test_fp24_arithmetics_YYY.c.in             |   526 +
 test/test_fp2_arithmetics_YYY.c.in              |   453 +
 test/test_fp48_arithmetics_YYY.c.in             |   541 +
 test/test_fp4_arithmetics_YYY.c.in              |   630 +
 test/test_fp8_arithmetics_YYY.c.in              |   723 +
 test/test_fp_arithmetics_YYY.c.in               |   376 +
 test/test_gcm_decrypt.c                         |   294 +
 test/test_gcm_encrypt.c                         |   272 +
 test/test_hash.c                                |   184 +
 test/test_mpin_ZZZ.c.in                         |   302 +
 test/test_mpin_bad_pin_ZZZ.c.in                 |   292 +
 test/test_mpin_bad_token_ZZZ.c.in               |   291 +
 test/test_mpin_dvs_ZZZ.c.in                     |   300 +
 test/test_mpin_dvs_wrong_pk_ZZZ.c.in            |   315 +
 test/test_mpin_expired_tp_ZZZ.c.in              |   292 +
 test/test_mpin_good_ZZZ.c.in                    |   297 +
 test/test_mpin_random_ZZZ.c.in                  |   346 +
 test/test_mpin_sign_ZZZ.c.in                    |   507 +
 test/test_mpin_tp_ZZZ.c.in                      |   305 +
 test/test_mpin_vectors_ZZZ.c.in                 |   540 +
 test/test_mpin_vectors_dta_ZZZ.c.in             |   505 +
 test/test_mpinfull_ZZZ.c.in                     |   355 +
 test/test_mpinfull_onepass_ZZZ.c.in             |   331 +
 test/test_mpinfull_random_ZZZ.c.in              |   389 +
 test/test_mpinfull_tp_ZZZ.c.in                  |   382 +
 test/test_octet_consistency.c                   |   134 +
 test/test_output_functions_ZZZ.c.in             |   695 +
 test/test_pair_ZZZ.c.in                         |   229 +
 test/test_rsa_WWW.c.in                          |   116 +
 test/test_rsa_sign_WWW_ZZZ.c.in                 |   310 +
 test/test_utils.c                               |   106 +
 test/test_version.c                             |    38 +
 test/test_wcc_ZZZ.c.in                          |   271 +
 test/test_wcc_bad_receiver_key_ZZZ.c.in         |   590 +
 test/test_wcc_bad_sender_key_ZZZ.c.in           |   591 +
 test/test_wcc_invalid_points_ZZZ.c.in           |   245 +
 test/test_wcc_random_ZZZ.c.in                   |   466 +
 test/test_x509_WWW_ZZZ.c.in                     |  1054 +
 testVectors/aes/CBCMMT128.rsp                   |   131 +
 testVectors/aes/CBCMMT256.rsp                   |   131 +
 testVectors/aes/CFB8MMT128.rsp                  |   131 +
 testVectors/aes/CFB8MMT256.rsp                  |   131 +
 testVectors/aes/ECBMMT128.rsp                   |   111 +
 testVectors/aes/ECBMMT256.rsp                   |   111 +
 testVectors/aes/amcl_CTRMCL128.rsp              |   113 +
 testVectors/aes/amcl_CTRMCL256.rsp              |   112 +
 testVectors/big/test_vector_big.txt             |   123 +
 .../ecdh/C25519/KAS_ECC_CDH_PrimitiveTest.txt   |    98 +
 .../ecdh/P-256/KAS_ECC_CDH_PrimitiveTest.txt    |   201 +
 .../ecdh/P-384/KAS_ECC_CDH_PrimitiveTest.txt    |   201 +
 .../ecdh/P-521/KAS_ECC_CDH_PrimitiveTest.txt    |   201 +
 testVectors/ecdsa/P-256/KeyPair.rsp             |    45 +
 testVectors/ecdsa/P-256/sha256Sign.rsp          |   121 +
 testVectors/ecdsa/P-256/sha256Verify.rsp        |   106 +
 testVectors/ecdsa/P-256/sha512Sign.rsp          |   122 +
 testVectors/ecdsa/P-256/sha512Verify.rsp        |   106 +
 testVectors/ecdsa/P-384/KeyPair.rsp             |    44 +
 testVectors/ecdsa/P-384/sha256Sign.rsp          |   121 +
 testVectors/ecdsa/P-384/sha256Verify.rsp        |   106 +
 testVectors/ecdsa/P-384/sha384Sign.rsp          |   121 +
 testVectors/ecdsa/P-384/sha384Verify.rsp        |   106 +
 testVectors/ecdsa/P-384/sha512Sign.rsp          |   121 +
 testVectors/ecdsa/P-384/sha512Verify.rsp        |   106 +
 testVectors/ecdsa/P-521/KeyPair.rsp             |    45 +
 testVectors/ecdsa/P-521/sha256Sign.rsp          |   121 +
 testVectors/ecdsa/P-521/sha256Verify.rsp        |   106 +
 testVectors/ecdsa/P-521/sha512Sign.rsp          |   121 +
 testVectors/ecdsa/P-521/sha512Verify.rsp        |   106 +
 testVectors/ecp/test_vector_ANSSI.txt           |   173 +
 testVectors/ecp/test_vector_BLS24.txt           |   173 +
 testVectors/ecp/test_vector_BLS381.txt          |   174 +
 testVectors/ecp/test_vector_BLS383.txt          |   173 +
 testVectors/ecp/test_vector_BLS461.txt          |   173 +
 testVectors/ecp/test_vector_BLS48.txt           |   173 +
 testVectors/ecp/test_vector_BN254.txt           |   173 +
 testVectors/ecp/test_vector_BN254CX.txt         |   173 +
 testVectors/ecp/test_vector_BRAINPOOL.txt       |   173 +
 testVectors/ecp/test_vector_C25519.txt          |    93 +
 testVectors/ecp/test_vector_C41417.txt          |   173 +
 testVectors/ecp/test_vector_ED25519.txt         |   173 +
 testVectors/ecp/test_vector_FP256BN.txt         |   173 +
 testVectors/ecp/test_vector_FP512BN.txt         |   173 +
 testVectors/ecp/test_vector_GOLDILOCKS.txt      |   173 +
 testVectors/ecp/test_vector_HIFIVE.txt          |   173 +
 testVectors/ecp/test_vector_NIST256.txt         |   173 +
 testVectors/ecp/test_vector_NIST384.txt         |   173 +
 testVectors/ecp/test_vector_NIST521.txt         |   173 +
 testVectors/ecp/test_vector_NUMS256W.txt        |   173 +
 testVectors/ecp/test_vector_NUMS384W.txt        |   173 +
 testVectors/ecp/test_vector_NUMS512W.txt        |   173 +
 testVectors/ecp/test_vector_SECP256K1.txt       |   173 +
 testVectors/ecp2/test_vector_BLS381.txt         |   193 +
 testVectors/ecp2/test_vector_BLS383.txt         |   193 +
 testVectors/ecp2/test_vector_BLS461.txt         |   193 +
 testVectors/ecp2/test_vector_BN254.txt          |   193 +
 testVectors/ecp2/test_vector_BN254CX.txt        |   204 +
 testVectors/ecp2/test_vector_FP256BN.txt        |   193 +
 testVectors/ecp2/test_vector_FP512BN.txt        |   193 +
 testVectors/ecp4/test_vector_BLS24.txt          |   228 +
 testVectors/ecp8/test_vector_BLS48.txt          |   308 +
 testVectors/fp/test_vector_25519.txt            |   161 +
 testVectors/fp/test_vector_256PME.txt           |   161 +
 testVectors/fp/test_vector_256PMW.txt           |   161 +
 testVectors/fp/test_vector_384PM.txt            |   161 +
 testVectors/fp/test_vector_512PM.txt            |   161 +
 testVectors/fp/test_vector_ANSSI.txt            |   161 +
 testVectors/fp/test_vector_BLS24.txt            |   161 +
 testVectors/fp/test_vector_BLS381.txt           |   162 +
 testVectors/fp/test_vector_BLS383.txt           |   161 +
 testVectors/fp/test_vector_BLS461.txt           |   161 +
 testVectors/fp/test_vector_BLS48.txt            |   161 +
 testVectors/fp/test_vector_BN254.txt            |   161 +
 testVectors/fp/test_vector_BN254CX.txt          |   161 +
 testVectors/fp/test_vector_BRAINPOOL.txt        |   162 +
 testVectors/fp/test_vector_C41417.txt           |   161 +
 testVectors/fp/test_vector_FP256BN.txt          |   161 +
 testVectors/fp/test_vector_FP512BN.txt          |   161 +
 testVectors/fp/test_vector_GOLDILOCKS.txt       |   162 +
 testVectors/fp/test_vector_HIFIVE.txt           |   161 +
 testVectors/fp/test_vector_NIST256.txt          |   161 +
 testVectors/fp/test_vector_NIST384.txt          |   161 +
 testVectors/fp/test_vector_NIST521.txt          |   161 +
 testVectors/fp/test_vector_SECP256K1.txt        |   161 +
 testVectors/fp12/test_vector_BLS381.txt         |   291 +
 testVectors/fp12/test_vector_BLS383.txt         |   291 +
 testVectors/fp12/test_vector_BLS461.txt         |   291 +
 testVectors/fp12/test_vector_BN254.txt          |   291 +
 testVectors/fp12/test_vector_BN254CX.txt        |   291 +
 testVectors/fp12/test_vector_FP256BN.txt        |   291 +
 testVectors/fp12/test_vector_FP512BN.txt        |   291 +
 testVectors/fp16/test_vector_BLS48.txt          |    91 +
 testVectors/fp2/test_vector_BLS24.txt           |   181 +
 testVectors/fp2/test_vector_BLS381.txt          |   181 +
 testVectors/fp2/test_vector_BLS383.txt          |   181 +
 testVectors/fp2/test_vector_BLS461.txt          |   181 +
 testVectors/fp2/test_vector_BLS48.txt           |   183 +
 testVectors/fp2/test_vector_BN254.txt           |   181 +
 testVectors/fp2/test_vector_BN254CX.txt         |   181 +
 testVectors/fp2/test_vector_FP256BN.txt         |   181 +
 testVectors/fp2/test_vector_FP512BN.txt         |   181 +
 testVectors/fp24/test_vector_BLS24.txt          |    94 +
 testVectors/fp4/test_vector_BLS24.txt           |   321 +
 testVectors/fp4/test_vector_BLS381.txt          |   321 +
 testVectors/fp4/test_vector_BLS383.txt          |   225 +
 testVectors/fp4/test_vector_BLS461.txt          |   281 +
 testVectors/fp4/test_vector_BLS48.txt           |   323 +
 testVectors/fp4/test_vector_BN254.txt           |   281 +
 testVectors/fp4/test_vector_BN254CX.txt         |   281 +
 testVectors/fp4/test_vector_FP256BN.txt         |   281 +
 testVectors/fp4/test_vector_FP512BN.txt         |   281 +
 testVectors/fp48/test_vector_BLS48.txt          |   118 +
 testVectors/fp8/test_vector_BLS24.txt           |   106 +
 testVectors/fp8/test_vector_BLS48.txt           |   108 +
 testVectors/gcm/gcmDecrypt128.rsp               | 66156 +++++++++++++++++
 testVectors/gcm/gcmDecrypt256.rsp               | 66156 +++++++++++++++++
 testVectors/gcm/gcmEncryptExtIV128.rsp          | 66156 +++++++++++++++++
 testVectors/gcm/gcmEncryptExtIV256.rsp          | 66156 +++++++++++++++++
 testVectors/mpin/BLS383.json                    |     1 +
 testVectors/mpin/BLS383.txt                     |  3000 +
 testVectors/mpin/BN254_CX.json                  |     1 +
 testVectors/mpin/BN254_CX.txt                   |  7500 ++
 testVectors/mpin/BN254_CXOnePass.json           |     1 +
 testVectors/output/test_vector_BLS24_32.txt     |    34 +
 testVectors/output/test_vector_BLS24_64.txt     |    34 +
 testVectors/output/test_vector_BLS381_32.txt    |    33 +
 testVectors/output/test_vector_BLS381_64.txt    |    33 +
 testVectors/output/test_vector_BLS383_32.txt    |    33 +
 testVectors/output/test_vector_BLS383_64.txt    |    33 +
 testVectors/output/test_vector_BLS461_32.txt    |    31 +
 testVectors/output/test_vector_BLS461_64.txt    |    32 +
 testVectors/output/test_vector_BLS48_32.txt     |    37 +
 testVectors/output/test_vector_BLS48_64.txt     |    37 +
 testVectors/output/test_vector_BN254CX_16.txt   |    31 +
 testVectors/output/test_vector_BN254CX_32.txt   |    31 +
 testVectors/output/test_vector_BN254CX_64.txt   |    31 +
 testVectors/output/test_vector_BN254_16.txt     |    31 +
 testVectors/output/test_vector_BN254_32.txt     |    31 +
 testVectors/output/test_vector_BN254_64.txt     |    32 +
 testVectors/output/test_vector_FP256BN_32.txt   |    31 +
 testVectors/output/test_vector_FP256BN_64.txt   |    31 +
 testVectors/output/test_vector_FP512BN_32.txt   |    31 +
 testVectors/output/test_vector_FP512BN_64.txt   |    31 +
 testVectors/rsa/2048/pkcs-vect.txt              |    25 +
 testVectors/rsa/3072/pkcs-vect.txt              |    28 +
 testVectors/rsa/4096/pkcs-vect.txt              |    28 +
 testVectors/sha/256/SHA256ShortMsg.rsp          |   267 +
 testVectors/sha/384/SHA384ShortMsg.rsp          |   266 +
 testVectors/sha/512/SHA512ShortMsg.rsp          |   523 +
 testVectors/x509/2048_P256/pkits-vect.txt       |  2819 +
 testVectors/x509/2048_P256/x509-vect.txt        |   323 +
 testVectors/x509/3072_P384/x509-vect.txt        |   317 +
 testVectors/x509/4096/x509-vect.txt             |    95 +
 testVectors/x509/P521/x509-vect.txt             |    90 +
 wrappers/python/CMakeLists.txt                  |    54 +
 wrappers/python/README.md                       |     7 +
 wrappers/python/TestMPINInstall_ZZZ.py.in       |   412 +
 wrappers/python/TestMPIN_BN254CX.py             |   140 +
 wrappers/python/TimeMPIN_ZZZ.py.in              |   371 +
 wrappers/python/mpin_ZZZ.py.in                  |  1723 +
 wrappers/python/wcc_ZZZ.py.in                   |   420 +
 399 files changed, 434183 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-milagro-crypto-c/blob/8d28d2c3/.dockerignore
----------------------------------------------------------------------
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..3ea0852
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+target/
+.git/

http://git-wip-us.apache.org/repos/asf/incubator-milagro-crypto-c/blob/8d28d2c3/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c1efd00
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+build
+target
+*~

http://git-wip-us.apache.org/repos/asf/incubator-milagro-crypto-c/blob/8d28d2c3/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..1f263c4
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,17 @@
+language: clang
+sudo: required
+dist: trusty
+services:
+  - docker
+
+install:
+  - gem install coveralls-lcov
+
+# The fcntl line works around a bug where Travis truncates logs and fails.
+script:
+  - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)"
+  - make -f Makefile.docker
+  - make -f Makefile.docker buildall
+
+after_success:
+  - coveralls-lcov 
/home/travis/build/milagro-crypto/milagro-crypto-c/target/LINUX_64BIT_COVERAGE/coverage/amcl.info

http://git-wip-us.apache.org/repos/asf/incubator-milagro-crypto-c/blob/8d28d2c3/AMCLConfig.cmake.in
----------------------------------------------------------------------
diff --git a/AMCLConfig.cmake.in b/AMCLConfig.cmake.in
new file mode 100644
index 0000000..f041a4a
--- /dev/null
+++ b/AMCLConfig.cmake.in
@@ -0,0 +1,31 @@
+get_filename_component(amcl_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+set(AMCL_LIBRARIES "@AMCL_LIBRARIES@")
+
+if(NOT TARGET AMCL::AMCL)
+  include("${amcl_CMAKE_DIR}/AMCLTargets.cmake")
+
+  # Add change prefix to get target names
+  foreach(_lib ${AMCL_LIBRARIES})
+    string(REGEX REPLACE "^amcl_" "AMCL::" _target "${_lib}")
+    list(APPEND AMCL_TARGETS "${_target}")
+  endforeach()
+
+  # Create an uber-target depending on all install AMCL libraries
+  add_library(AMCL::AMCL INTERFACE IMPORTED)
+  set_target_properties(AMCL::AMCL PROPERTIES INTERFACE_LINK_LIBRARIES 
"${AMCL_TARGETS}")
+endif()
+
+# If components were specified, determine which were actually found.
+if(AMCL_FIND_COMPONENTS)
+  foreach(comp ${AMCL_FIND_COMPONENTS})
+    if(TARGET "AMCL::${comp}")
+      set(AMCL_${comp}_FOUND 1)
+    else()
+      set(AMCL_${comp}_FOUND 0)
+      if(AMCL_FIND_REQUIRED_${comp})
+        message(FATAL_ERROR "AMCL::${comp} not available.")
+      endif()
+    endif()
+  endforeach()
+endif()

http://git-wip-us.apache.org/repos/asf/incubator-milagro-crypto-c/blob/8d28d2c3/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..b6ec5ed
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,679 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
+
+file(STRINGS "VERSION" VERSION_STRING)
+project(AMCL VERSION "${VERSION_STRING}" LANGUAGES C)
+
+##################################################
+# Helper Macros
+##################################################
+macro(log var)
+  message(STATUS "${var}: ${${var}}")
+endmacro()
+
+macro(set_if_unset var val)
+  if(NOT ${var})
+    set(${var} "${val}")
+  endif()
+  log(${var})
+endmacro()
+
+##################################################
+# Includes
+##################################################
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+include(AMCLExpand)
+include(CMakeDependentOption)
+include(CTest)
+include(DetermineWordSize)
+include(GNUInstallDirs)
+include(SetOSVariable)
+
+##################################################
+# Internal settings
+##################################################
+message(STATUS "AMCL")
+log(PROJECT_VERSION)
+log(CMAKE_GENERATOR)
+
+add_definitions(-DCMAKE)
+
+set(AMCL_VERSION       ${PROJECT_VERSION})
+set(AMCL_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
+set(AMCL_VERSION_MINOR ${PROJECT_VERSION_MINOR})
+set(AMCL_VERSION_PATCH ${PROJECT_VERSION_PATCH})
+
+set(AMCL_SOVERSION ${AMCL_VERSION_MAJOR})
+
+if(CMAKE_COMPILER_IS_GNUCC)
+    execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
+                    OUTPUT_VARIABLE GCC_VERSION)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -static-libgcc -Wall -Wextra 
-Wno-strict-prototypes -Wunused-value -Wcast-align -Wunused-variable -Wundef 
-Wformat-security")
+
+    if (GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
+        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow")
+        set(CMAKE_C_FLAGS_ASAN    "-O0 -g3 -fsanitize=address")
+    else (GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
+        message(STATUS "GCC 4.8 required to run address sanitizer - please 
upgrade your installation")
+    endif(GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
+
+    set(CMAKE_C_FLAGS_RELEASE     "-O2")
+    set(CMAKE_C_FLAGS_DEBUG       "-O0 -g3")
+    set(CMAKE_C_FLAGS_COVERAGE    "-O0 -g3 --coverage")
+    set(CMAKE_C_FLAGS_CHECK       "-O2 -Werror")
+    set(CMAKE_C_FLAGS_CHECKFULL   "${CMAKE_C_FLAGS_CHECK} -Wcast-qual")
+endif(CMAKE_COMPILER_IS_GNUCC)
+
+if(CMAKE_BUILD_TYPE STREQUAL "Coverage")
+    set(CMAKE_SHARED_LINKER_FLAGS "--coverage")
+endif(CMAKE_BUILD_TYPE STREQUAL "Coverage")
+
+##################################################
+# Options
+##################################################
+### Build Type ###
+if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+  set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose type of build." FORCE)
+endif()
+set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release" "Debug" 
"Coverage" "ASan" "Check" "CheckFull")
+log(CMAKE_BUILD_TYPE)
+
+### Configurations ###
+set_if_unset(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
+set_if_unset(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
+set_if_unset(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
+log(CMAKE_INSTALL_PREFIX)
+
+### Options ###
+option(BUILD_SHARED_LIBS "Build shared libraries" ON)
+log(BUILD_SHARED_LIBS)
+
+option(BUILD_BENCHMARKS  "Build benchmarks"       ON)
+option(BUILD_DOCS        "Build docs"             ON)
+option(BUILD_EXAMPLES    "Build examples"         ON)
+cmake_dependent_option(BUILD_PYTHON "Build Python" OFF "BUILD_SHARED_LIBS" OFF)
+log(BUILD_BENCHMARKS)
+log(BUILD_DOCS)
+log(BUILD_EXAMPLES)
+log(BUILD_PYTHON)
+log(BUILD_TESTING) # added by 'include(CTest)'
+
+option(BUILD_MPIN    "Build MPIN"    ON)
+option(BUILD_WCC     "Build WCC"     ON)
+option(BUILD_X509    "BUild X509"    ON)
+log(BUILD_MPIN)
+log(BUILD_WCC)
+log(BUILD_X509)
+
+option(DEBUG_REDUCE "Print debug message for field reduction" OFF)
+option(DEBUG_NORM "Detect digit overflow" OFF)
+option(GET_STATS "Debug statistics" OFF)
+log(DEBUG_REDUCE)
+log(DEBUG_NORM)
+log(GET_STATS)
+
+### /include subdir ###
+set(INSTALL_INCLUDESUBDIR "${CMAKE_INSTALL_INCLUDEDIR}/amcl")
+log(CMAKE_INSTALL_INCLUDEDIR)
+log(INSTALL_INCLUDESUBDIR)
+
+### Word/Chunk Size ###
+determine_word_size(DEFAULT_WORD_SIZE)
+set(WORD_SIZE ${DEFAULT_WORD_SIZE} CACHE STRING "Word length in bits. See 
./include/arch.h")
+set_property(CACHE WORD_SIZE PROPERTY STRINGS "16;32;64")
+log(WORD_SIZE)
+
+if(WORD_SIZE STREQUAL "")
+  message(FATAL_ERROR "Must explicitly set WORD_SIZE.")
+endif()
+
+### RSA Levels ###
+amcl_supported_rsa_levels(AMCL_RSA_LEVELS ${WORD_SIZE})
+set(AMCL_RSA "${AMCL_RSA_LEVELS}" CACHE STRING "RSA levels of security 
supported. See ./include/rsa_WWW.h")
+set_property(CACHE AMCL_RSA PROPERTY STRINGS ${AMCL_RSA_LEVELS})
+string(REPLACE "," ";" AMCL_RSA "${AMCL_RSA}")
+log(AMCL_RSA)
+
+### Curves ###
+amcl_supported_curves(AMCL_CURVE_NAMES ${WORD_SIZE})
+set(AMCL_CURVE "${AMCL_CURVE_NAMES}" CACHE STRING "Choice of Field. See 
./include/amcl.h")
+set_property(CACHE AMCL_CURVE PROPERTY STRINGS ${AMCL_CURVE_NAMES})
+string(REPLACE "," ";" AMCL_CURVE "${AMCL_CURVE}")
+log(AMCL_CURVE)
+
+### MPIN ###
+if(BUILD_MPIN)
+  set(AMCL_MAXPIN 10000 CACHE STRING "Maximum PIN value. See 
./include/mpin_ZZZ.h for explanation.")
+  set(AMCL_PBLEN 14 CACHE STRING "Maximum PIN value in bits. See 
./include/mpin_ZZZ.h for explanation.")
+  log(AMCL_MAXPIN)
+  log(AMCL_PBLEN)
+endif()
+
+### PBC ###
+if(BUILD_MPIN OR BUILD_WCC)
+  set(PBC_TIME_PERMIT_TESTS 10 CACHE STRING "Number of days in the future to 
test M-PIN/WCC time permits")
+  set(PBC_RANDOM_TESTS 5 CACHE STRING "Number of random M-PIN/WCC tests")
+  log(PBC_TIME_PERMIT_TESTS)
+  log(PBC_RANDOM_TESTS)
+endif()
+
+##################################################
+# AMCL_Core Library
+##################################################
+amcl_configure_file_core(include/amcl.h.in include/amcl.h amcl_core_GEN_HDRS)
+amcl_configure_file_core(include/arch.h.in include/arch.h amcl_core_GEN_HDRS)
+
+amcl_generate_SC(SC)
+amcl_generate_RSL(RSL)
+amcl_configure_file_core(include/version.h.in include/version.h 
amcl_core_GEN_HDRS)
+unset(SC)
+unset(RSL)
+
+add_library(amcl_core
+  src/hash.c
+  src/rand.c
+  src/randapi.c
+  src/aes.c
+  src/gcm.c
+  src/oct.c
+  src/utils.c
+  src/version.c
+)
+list(APPEND AMCL_LIBRARIES amcl_core)
+
+set_target_properties(amcl_core PROPERTIES
+  EXPORT_NAME core
+  VERSION ${AMCL_VERSION}
+  SOVERSION ${AMCL_SOVERSION}
+)
+
+target_include_directories(amcl_core PUBLIC
+  $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
+  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+  $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+)
+
+install(TARGETS amcl_core
+  EXPORT AMCLTargets
+  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+install(FILES
+  ${amcl_core_GEN_HDRS}
+  include/utils.h
+  include/randapi.h
+  DESTINATION ${INSTALL_INCLUDESUBDIR}
+)
+
+if (BUILD_MPIN OR BUILD_WCC)
+  amcl_configure_file_core(include/config_test.h.in include/config_test.h 
amcl_core_pbc_GEN_HDRS)
+
+  target_sources(amcl_core PRIVATE src/pbc_support.c)
+
+  install(FILES
+    ${amcl_core_pbc_GEN_HDRS}
+    include/pbc_support.h
+    DESTINATION ${INSTALL_INCLUDESUBDIR}
+  )
+endif()
+
+if (NOT AMCL_RSA STREQUAL "")
+  target_sources(amcl_core PRIVATE src/rsa_support.c)
+
+  install(FILES
+    include/rsa_support.h
+    DESTINATION ${INSTALL_INCLUDESUBDIR}
+  )
+endif()
+
+if (NOT AMCL_CURVE STREQUAL "")
+  target_sources(amcl_core PRIVATE src/ecdh_support.c)
+
+  install(FILES
+    include/ecdh_support.h
+    DESTINATION ${INSTALL_INCLUDESUBDIR}
+  )
+endif()
+
+##################################################
+# AMCL_X509 Library
+##################################################
+if(BUILD_X509)
+  message(STATUS "Build libamcl_x509")
+  add_library(amcl_x509
+    src/x509.c
+  )
+  list(APPEND AMCL_LIBRARIES amcl_x509)
+
+  set_target_properties(amcl_x509 PROPERTIES
+    EXPORT_NAME x509
+    VERSION ${AMCL_VERSION}
+    SOVERSION ${AMCL_SOVERSION}
+  )
+
+  target_include_directories(amcl_x509 PUBLIC
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+    $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+  )
+
+  target_link_libraries(amcl_x509 PUBLIC
+    amcl_core
+  )
+
+  install(TARGETS amcl_x509
+    EXPORT AMCLTargets
+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+  )
+
+  install(FILES
+    include/x509.h
+    DESTINATION ${INSTALL_INCLUDESUBDIR}
+  )
+endif()
+
+##################################################
+# AMCL_RSA_*** Libraries
+##################################################
+foreach(level ${AMCL_RSA})
+  amcl_rsa_field(BD "${level}")
+  amcl_rsa_field(TFF "${level}")
+
+  amcl_configure_file_rsa(include/config_big.h.in include/config_big_${BD}.h 
"${level}" amcl_rsa_${level}_GEN_HDRS)
+  amcl_configure_file_rsa(include/config_ff.h.in  include/config_ff_${TFF}.h 
"${level}" amcl_rsa_${level}_GEN_HDRS)
+  amcl_configure_file_rsa(include/big.h.in        include/big_${BD}.h        
"${level}" amcl_rsa_${level}_GEN_HDRS)
+  amcl_configure_file_rsa(include/ff.h.in         include/ff_${TFF}.h        
"${level}" amcl_rsa_${level}_GEN_HDRS)
+  amcl_configure_file_rsa(include/rsa.h.in        include/rsa_${TFF}.h       
"${level}" amcl_rsa_${level}_GEN_HDRS)
+
+  amcl_configure_file_rsa(src/big.c.in src/big_${BD}.c  "${level}" 
amcl_rsa_${level}_GEN_SRCS)
+  amcl_configure_file_rsa(src/ff.c.in  src/ff_${TFF}.c  "${level}" 
amcl_rsa_${level}_GEN_SRCS)
+  amcl_configure_file_rsa(src/rsa.c.in src/rsa_${TFF}.c "${level}" 
amcl_rsa_${level}_GEN_SRCS)
+
+  message(STATUS "Build libamcl_rsa_${TFF}")
+  add_library(amcl_rsa_${level}
+    ${amcl_rsa_${level}_GEN_SRCS}
+  )
+  list(APPEND AMCL_LIBRARIES amcl_rsa_${TFF})
+
+  set_target_properties(amcl_rsa_${level} PROPERTIES
+    EXPORT_NAME rsa_${level}
+    VERSION ${AMCL_VERSION}
+    SOVERSION ${AMCL_SOVERSION}
+  )
+
+  target_include_directories(amcl_rsa_${level} PUBLIC
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+    $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+  )
+
+  target_link_libraries(amcl_rsa_${level} PUBLIC
+    amcl_core
+  )
+
+  install(TARGETS amcl_rsa_${level}
+    EXPORT AMCLTargets
+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+  )
+
+  install(FILES
+    ${amcl_rsa_${level}_GEN_HDRS}
+    DESTINATION ${INSTALL_INCLUDESUBDIR}
+  )
+
+endforeach()
+
+##################################################
+# AMCL_CURVE_*** Libraries
+##################################################
+foreach(curve ${AMCL_CURVE})
+  amcl_curve_field(BD "${curve}")
+  amcl_curve_field(PF "${curve}")
+  amcl_curve_field(TC "${curve}")
+  amcl_curve_field(TF "${curve}")
+
+  amcl_configure_file_curve(include/big.h.in          include/big_${BD}.h      
    "${curve}" amcl_curve_${TC}_GEN_HDRS)
+  amcl_configure_file_curve(include/config_big.h.in   
include/config_big_${BD}.h   "${curve}" amcl_curve_${TC}_GEN_HDRS)
+  amcl_configure_file_curve(include/config_field.h.in 
include/config_field_${TF}.h "${curve}" amcl_curve_${TC}_GEN_HDRS)
+  amcl_configure_file_curve(include/config_curve.h.in 
include/config_curve_${TC}.h "${curve}" amcl_curve_${TC}_GEN_HDRS)
+  amcl_configure_file_curve(include/fp.h.in           include/fp_${TF}.h       
    "${curve}" amcl_curve_${TC}_GEN_HDRS)
+  amcl_configure_file_curve(include/ecdh.h.in         include/ecdh_${TC}.h     
    "${curve}" amcl_curve_${TC}_GEN_HDRS)
+  amcl_configure_file_curve(include/ecp.h.in          include/ecp_${TC}.h      
    "${curve}" amcl_curve_${TC}_GEN_HDRS)
+
+  amcl_configure_file_curve(src/big.c.in  src/big_${BD}.c  "${curve}" 
amcl_curve_${TC}_GEN_SRCS)
+  amcl_configure_file_curve(src/fp.c.in   src/fp_${TF}.c   "${curve}" 
amcl_curve_${TC}_GEN_SRCS)
+  amcl_configure_file_curve(src/ecp.c.in  src/ecp_${TC}.c  "${curve}" 
amcl_curve_${TC}_GEN_SRCS)
+  amcl_configure_file_curve(src/ecdh.c.in src/ecdh_${TC}.c "${curve}" 
amcl_curve_${TC}_GEN_SRCS)
+
+  message(STATUS "Build libamcl_curve_${TC}")
+  add_library(amcl_curve_${TC}
+    ${amcl_curve_${TC}_GEN_SRCS}
+    src/rom_curve_${TC}.c
+    src/rom_field_${TF}.c
+  )
+  list(APPEND AMCL_LIBRARIES amcl_curve_${TC})
+
+  set_target_properties(amcl_curve_${TC} PROPERTIES
+    EXPORT_NAME curve_${TC}
+    VERSION ${AMCL_VERSION}
+    SOVERSION ${AMCL_SOVERSION}
+  )
+
+  target_include_directories(amcl_curve_${TC} PUBLIC
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+    $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+  )
+
+  target_link_libraries(amcl_curve_${TC} PUBLIC
+    amcl_core
+  )
+
+  install(TARGETS amcl_curve_${TC}
+    EXPORT AMCLTargets
+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+  )
+
+  install(FILES
+    ${amcl_curve_${TC}_GEN_HDRS}
+    DESTINATION ${INSTALL_INCLUDESUBDIR}
+  )
+endforeach()
+
+##################################################
+# AMCL_PAIRING_*** Libraries
+##################################################
+foreach(curve ${AMCL_CURVE})
+  amcl_curve_field(PF "${curve}")
+  amcl_curve_field(TC "${curve}")
+  amcl_curve_field(TF "${curve}")
+  amcl_curve_field(CS "${curve}")
+
+  if(NOT(PF STREQUAL "NOT"))
+    amcl_configure_file_curve(include/fp2.h.in  include/fp2_${TF}.h  
"${curve}" amcl_pairing_${TC}_GEN_HDRS)
+    amcl_configure_file_curve(include/fp4.h.in  include/fp4_${TF}.h  
"${curve}" amcl_pairing_${TC}_GEN_HDRS)
+
+    amcl_configure_file_curve(src/fp2.c.in  src/fp2_${TC}.c  "${curve}" 
amcl_pairing_${TC}_GEN_SRCS)
+    amcl_configure_file_curve(src/fp4.c.in  src/fp4_${TC}.c  "${curve}" 
amcl_pairing_${TC}_GEN_SRCS)
+
+    if(CS STREQUAL "128")
+      amcl_configure_file_curve(include/fp12.h.in include/fp12_${TF}.h 
"${curve}" amcl_pairing_${TC}_GEN_HDRS)
+      amcl_configure_file_curve(include/ecp2.h.in include/ecp2_${TC}.h 
"${curve}" amcl_pairing_${TC}_GEN_HDRS)
+      amcl_configure_file_curve(include/pair.h.in include/pair_${TC}.h 
"${curve}" amcl_pairing_${TC}_GEN_HDRS)
+
+      amcl_configure_file_curve(src/fp12.c.in src/fp12_${TC}.c "${curve}" 
amcl_pairing_${TC}_GEN_SRCS)
+      amcl_configure_file_curve(src/ecp2.c.in src/ecp2_${TC}.c "${curve}" 
amcl_pairing_${TC}_GEN_SRCS)
+      amcl_configure_file_curve(src/pair.c.in src/pair_${TC}.c "${curve}" 
amcl_pairing_${TC}_GEN_SRCS)
+    elseif(CS STREQUAL "192")
+      amcl_configure_file_curve(include/fp8.h.in include/fp8_${TF}.h 
"${curve}" amcl_pairing_${TC}_GEN_HDRS)
+      amcl_configure_file_curve(include/fp24.h.in include/fp24_${TF}.h 
"${curve}" amcl_pairing_${TC}_GEN_HDRS)
+      amcl_configure_file_curve(include/ecp4.h.in include/ecp4_${TC}.h 
"${curve}" amcl_pairing_${TC}_GEN_HDRS)
+      amcl_configure_file_curve(include/pair192.h.in include/pair192_${TC}.h 
"${curve}" amcl_pairing_${TC}_GEN_HDRS)
+
+      amcl_configure_file_curve(src/fp8.c.in src/fp8_${TC}.c "${curve}" 
amcl_pairing_${TC}_GEN_SRCS)
+      amcl_configure_file_curve(src/fp24.c.in src/fp24_${TC}.c "${curve}" 
amcl_pairing_${TC}_GEN_SRCS)
+      amcl_configure_file_curve(src/ecp4.c.in src/ecp4_${TC}.c "${curve}" 
amcl_pairing_${TC}_GEN_SRCS)
+      amcl_configure_file_curve(src/pair192.c.in src/pair192_${TC}.c 
"${curve}" amcl_pairing_${TC}_GEN_SRCS)
+    elseif(CS STREQUAL "256")
+      amcl_configure_file_curve(include/fp8.h.in include/fp8_${TF}.h 
"${curve}" amcl_pairing_${TC}_GEN_HDRS)
+      amcl_configure_file_curve(include/fp16.h.in include/fp16_${TF}.h 
"${curve}" amcl_pairing_${TC}_GEN_HDRS)
+      amcl_configure_file_curve(include/fp48.h.in include/fp48_${TF}.h 
"${curve}" amcl_pairing_${TC}_GEN_HDRS)
+      amcl_configure_file_curve(include/ecp8.h.in include/ecp8_${TC}.h 
"${curve}" amcl_pairing_${TC}_GEN_HDRS)
+      amcl_configure_file_curve(include/pair256.h.in include/pair256_${TC}.h 
"${curve}" amcl_pairing_${TC}_GEN_HDRS)
+
+      amcl_configure_file_curve(src/fp8.c.in src/fp8_${TC}.c "${curve}" 
amcl_pairing_${TC}_GEN_SRCS)
+      amcl_configure_file_curve(src/fp16.c.in src/fp16_${TC}.c "${curve}" 
amcl_pairing_${TC}_GEN_SRCS)
+      amcl_configure_file_curve(src/fp48.c.in src/fp48_${TC}.c "${curve}" 
amcl_pairing_${TC}_GEN_SRCS)
+      amcl_configure_file_curve(src/ecp8.c.in src/ecp8_${TC}.c "${curve}" 
amcl_pairing_${TC}_GEN_SRCS)
+      amcl_configure_file_curve(src/pair256.c.in src/pair256_${TC}.c 
"${curve}" amcl_pairing_${TC}_GEN_SRCS)
+    endif(CS STREQUAL "128")
+
+    message(STATUS "Build libamcl_pairing_${TC}")
+    add_library(amcl_pairing_${TC}
+      ${amcl_pairing_${TC}_GEN_SRCS}
+    )
+    list(APPEND AMCL_LIBRARIES amcl_pairing_${TC})
+
+    set_target_properties(amcl_pairing_${TC} PROPERTIES
+      EXPORT_NAME pairing_${TC}
+      VERSION ${AMCL_VERSION}
+      SOVERSION ${AMCL_SOVERSION}
+    )
+
+    target_include_directories(amcl_pairing_${TC} PUBLIC
+      $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
+      $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+      $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+    )
+
+    target_link_libraries(amcl_pairing_${TC} PUBLIC
+      amcl_curve_${TC}
+    )
+
+    install(TARGETS amcl_pairing_${TC}
+      EXPORT AMCLTargets
+      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+      LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+      ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    )
+
+    install(FILES
+      ${amcl_pairing_${TC}_GEN_HDRS}
+      DESTINATION ${INSTALL_INCLUDESUBDIR}
+    )
+  endif(NOT(PF STREQUAL "NOT"))
+endforeach()
+
+##################################################
+# AMCL_MPIN_*** Libraries
+##################################################
+if(BUILD_MPIN)
+  foreach(curve ${AMCL_CURVE})
+    amcl_curve_field(TC "${curve}")
+    amcl_curve_field(CS "${curve}")
+
+    if(TARGET amcl_pairing_${TC})
+      if(CS STREQUAL "128")
+        amcl_configure_file_curve(include/mpin.h.in include/mpin_${TC}.h 
"${curve}" amcl_mpin_${TC}_GEN_HDRS)
+        amcl_configure_file_curve(src/mpin.c.in     src/mpin_${TC}.c     
"${curve}" amcl_mpin_${TC}_GEN_SRCS)
+      else(CS STREQUAL "128")
+        amcl_configure_file_curve(include/mpin${CS}.h.in 
include/mpin${CS}_${TC}.h "${curve}" amcl_mpin_${TC}_GEN_HDRS)
+        amcl_configure_file_curve(src/mpin${CS}.c.in     src/mpin${CS}_${TC}.c 
    "${curve}" amcl_mpin_${TC}_GEN_SRCS)
+      endif(CS STREQUAL "128")
+
+      message(STATUS "Build libamcl_mpin_${TC}")
+      add_library(amcl_mpin_${TC}
+        ${amcl_mpin_${TC}_GEN_SRCS}
+      )
+      list(APPEND AMCL_LIBRARIES amcl_mpin_${TC})
+
+      set_target_properties(amcl_mpin_${TC} PROPERTIES
+        EXPORT_NAME mpin_${TC}
+        VERSION ${AMCL_VERSION}
+        SOVERSION ${AMCL_SOVERSION}
+      )
+
+      target_include_directories(amcl_mpin_${TC} PUBLIC
+        $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
+        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+        $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+      )
+
+      target_link_libraries(amcl_mpin_${TC} PUBLIC
+        amcl_pairing_${TC}
+      )
+
+      install(TARGETS amcl_mpin_${TC}
+        EXPORT AMCLTargets
+        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+      )
+
+      install(FILES
+        ${amcl_mpin_${TC}_GEN_HDRS}
+        DESTINATION ${INSTALL_INCLUDESUBDIR}
+      )
+    endif()
+  endforeach()
+endif()
+
+##################################################
+# AMCL_WCC_*** Libraries
+##################################################
+if(BUILD_WCC)
+  foreach(curve ${AMCL_CURVE})
+    amcl_curve_field(TC "${curve}")
+    amcl_curve_field(CS "${curve}")
+
+    if(TARGET amcl_pairing_${TC})
+      if(CS STREQUAL "128")
+        amcl_configure_file_curve(include/wcc.h.in include/wcc_${TC}.h 
"${curve}" amcl_wcc_${TC}_GEN_HDRS)
+        amcl_configure_file_curve(src/wcc.c.in     src/wcc_${TC}.c     
"${curve}" amcl_wcc_${TC}_GEN_SRCS)
+      else(CS STREQUAL "128")
+        amcl_configure_file_curve(include/wcc${CS}.h.in 
include/wcc${CS}_${TC}.h "${curve}" amcl_wcc_${TC}_GEN_HDRS)
+        amcl_configure_file_curve(src/wcc${CS}.c.in     src/wcc${CS}_${TC}.c   
  "${curve}" amcl_wcc_${TC}_GEN_SRCS)
+      endif(CS STREQUAL "128")
+
+      message(STATUS "Build libamcl_wcc_${TC}")
+      add_library(amcl_wcc_${TC}
+        ${amcl_wcc_${TC}_GEN_SRCS}
+      )
+      list(APPEND AMCL_LIBRARIES amcl_wcc_${TC})
+
+      set_target_properties(amcl_wcc_${TC} PROPERTIES
+        EXPORT_NAME wcc_${TC}
+        VERSION ${AMCL_VERSION}
+        SOVERSION ${AMCL_SOVERSION}
+      )
+
+      target_include_directories(amcl_wcc_${TC} PUBLIC
+        $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
+        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+        $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+      )
+
+      target_link_libraries(amcl_wcc_${TC} PUBLIC
+        amcl_pairing_${TC}
+      )
+
+      install(TARGETS amcl_wcc_${TC}
+        EXPORT AMCLTargets
+        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+      )
+
+      install(FILES
+        ${amcl_wcc_${TC}_GEN_HDRS}
+        DESTINATION ${INSTALL_INCLUDESUBDIR}
+      )
+    endif()
+  endforeach()
+endif()
+
+##################################################
+# pkgconfig
+##################################################
+foreach(lib ${AMCL_LIBRARIES})
+  set(AMCL_PRIVATE_LIBS "${AMCL_PRIVATE_LIBS} -l${lib}")
+endforeach()
+configure_file(amcl.pc.in amcl.pc @ONLY)
+install(FILES
+  ${CMAKE_CURRENT_BINARY_DIR}/amcl.pc
+  DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
+)
+
+##################################################
+# CMake export
+##################################################
+set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/amcl)
+
+install(EXPORT AMCLTargets
+  FILE AMCLTargets.cmake
+  NAMESPACE AMCL::
+  DESTINATION ${INSTALL_CONFIGDIR}
+)
+
+include(CMakePackageConfigHelpers)
+write_basic_package_version_file(
+  ${CMAKE_CURRENT_BINARY_DIR}/AMCLConfigVersion.cmake
+  VERSION ${AMCL_VERSION}
+  COMPATIBILITY SameMajorVersion
+)
+
+configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/AMCLConfig.cmake.in
+  ${CMAKE_CURRENT_BINARY_DIR}/AMCLConfig.cmake
+  INSTALL_DESTINATION ${INSTALL_CONFIGDIR}
+)
+
+install(FILES
+  ${CMAKE_CURRENT_BINARY_DIR}/AMCLConfig.cmake
+  ${CMAKE_CURRENT_BINARY_DIR}/AMCLConfigVersion.cmake
+  DESTINATION ${INSTALL_CONFIGDIR}
+)
+
+##################################################
+# Uninstall Target
+##################################################
+configure_file(
+    "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
+    "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+    IMMEDIATE @ONLY)
+
+add_custom_target(uninstall
+    COMMAND ${CMAKE_COMMAND} -P 
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
+
+##################################################
+# Add subdirectories
+##################################################
+if(BUILD_BENCHMARKS)
+  message(STATUS "Build benchmarks")
+  add_subdirectory(benchmark)
+endif()
+
+if(BUILD_DOCS)
+  message(STATUS "Build docs")
+  add_subdirectory(doc)
+endif()
+
+if(BUILD_EXAMPLES)
+  message(STATUS "Build examples")
+  add_subdirectory(examples)
+endif()
+
+if(BUILD_PYTHON)
+  message(STATUS "Build Python wrappers")
+  add_subdirectory(wrappers/python)
+endif()
+
+if(BUILD_TESTING)
+  message(STATUS "Build tests")
+  add_subdirectory(test)
+endif()
+
+include(CPackConfig.cmake)

http://git-wip-us.apache.org/repos/asf/incubator-milagro-crypto-c/blob/8d28d2c3/CPackConfig.cmake
----------------------------------------------------------------------
diff --git a/CPackConfig.cmake b/CPackConfig.cmake
new file mode 100644
index 0000000..bdd4e35
--- /dev/null
+++ b/CPackConfig.cmake
@@ -0,0 +1,62 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+include (InstallRequiredSystemLibraries)
+
+########################### General Settings ###########################
+set(CPACK_PACKAGE_NAME "AMCL")
+set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
+set(CPACK_PACKAGE_RELEASE 1)
+set(CPACK_DESCRIPTION_SUMMARY "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
+set(CPACK_PACKAGE_VENDOR "MIRACL")
+set(CPACK_PACKAGE_CONTACT "[email protected]")
+set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}")
+
+if (BUILD_PYTHON)
+  set(CPACK_RPM_PACKAGE_REQUIRES "python >= 2.7.0")
+endif (BUILD_PYTHON)
+
+set(CPACK_PACKAGE_FILE_NAME 
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CMAKE_SYSTEM_PROCESSOR}")
+
+########################### Linux Settings ###########################
+if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+  set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
+
+  # Prevents CPack from generating file conflicts
+  set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION 
"${CPACK_PACKAGING_INSTALL_PREFIX}")
+  list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION 
"${CPACK_PACKAGING_INSTALL_PREFIX}/bin")
+  list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION 
"${CPACK_PACKAGING_INSTALL_PREFIX}/include")
+  list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION 
"${CPACK_PACKAGING_INSTALL_PREFIX}/lib")
+  list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION 
"${PYTHON_SITE_LIB}")
+  list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION 
"${PYTHON_SITE_PACKAGES}")
+  set(CPACK_GENERATOR "RPM")
+endif()
+
+########################### Windows Settings ###########################
+if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+  set(CPACK_PACKAGE_INSTALL_DIRECTORY "AMCL")
+  set(CPACK_NSIS_MODIFY_PATH ON)
+  set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources/icon\\\\icon.bmp")
+  set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/resources/icon\\\\icon.ico")
+  set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/resources/icon\\\\icon.ico")
+  set(CPACK_NSIS_HELP_LINK "http://www.miracl.com";)
+  set(CPACK_NSIS_URL_INFO_ABOUT "http://www.miracl.com";)
+  set(CPACK_NSIS_CONTACT "[email protected]")
+endif()
+
+include (CPack)

http://git-wip-us.apache.org/repos/asf/incubator-milagro-crypto-c/blob/8d28d2c3/Dockerfile
----------------------------------------------------------------------
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..1dbc9d6
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,30 @@
+FROM ubuntu:latest
+
+RUN dpkg --add-architecture i386 \
+    && apt-get update && apt-get install -y --no-install-recommends \
+    astyle \
+    ca-certificates \
+    cmake \
+    doxygen \
+    doxygen-latex \
+    g++ \
+    g++-multilib \
+    gcc \
+    git \
+    lcov \
+    make \
+    mingw-w64 \
+    parallel \
+    python-pip \
+    python-setuptools\
+    wine-stable \
+    wine64 \
+    wine32 \
+    && apt-get clean \
+    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
+    && pip install \
+    autopep8 \
+    cffi \
+    wheel
+
+CMD ["/bin/bash"]

http://git-wip-us.apache.org/repos/asf/incubator-milagro-crypto-c/blob/8d28d2c3/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..19efef5
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright 2016 MIRACL UK Ltd
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

http://git-wip-us.apache.org/repos/asf/incubator-milagro-crypto-c/blob/8d28d2c3/Makefile
----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b493640
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,373 @@
+# MAKEFILE
+#
+# @author      Nicola Asuni <[email protected]>
+# @link        https://github.com/milagro-crypto/milagro-crypto-c
+#
+# Requires GNU parallel: https://www.gnu.org/software/parallel/
+# -----------------------------------------------------------------------------
+
+# List special make targets that are not associated with files
+.PHONY: help all default format clean qa z build build_qa_item build_item 
buildx buildall pubdocs doc print-%
+
+# Use bash as shell (Note: Ubuntu now uses dash which doesn't support 
PIPESTATUS).
+SHELL=/bin/bash
+
+# Project root directory
+PROJECTROOT=$(shell pwd)
+
+# CVS path (path to the parent dir containing the project)
+CVSPATH=github.com/miracl
+
+# Project owner
+OWNER=MIRACL
+
+# Project vendor
+VENDOR=miracl
+
+# Project name
+PROJECT=amcl
+
+# Project version
+VERSION=$(shell cat VERSION)
+
+# Project release number (packaging build number)
+RELEASE=$(shell cat RELEASE)
+
+# Include default build configuration
+include $(PROJECTROOT)/config.mk
+
+# Common CMake options for building the language wrappers
+WRAPPYTHON="-DBUILD_PYTHON=on"
+
+# Space-separated list of build options (grouped by type):
+# <NAME>:<DOUBLECOMMA-SEPARATED_LIST_OF_CMAKE_OPTIONS>
+
+BUILDS_PF64=LINUX_64BIT_BLS383:-DWORD_SIZE=64,,-DAMCL_CURVE=BLS383,,-DAMCL_RSA=2048,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,${WRAPPYTHON}
 \
+       
LINUX_64BIT_BN254CX:-DWORD_SIZE=64,,-DAMCL_CURVE=BN254CX,,-DAMCL_RSA=2048,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,${WRAPPYTHON}
 \
+       
LINUX_64BIT_BN254:-DWORD_SIZE=64,,-DAMCL_CURVE=BN254,,-DAMCL_RSA=2048,,-DCMAKE_INSTALL_PREFIX=/opt/amcl
 \
+       
LINUX_64BIT_FP256BN:-DWORD_SIZE=64,,-DAMCL_CURVE=FP256BN,,-DAMCL_RSA=2048,,-DCMAKE_INSTALL_PREFIX=/opt/amcl
 \
+       
LINUX_64BIT_FP512BN:-DWORD_SIZE=64,,-DAMCL_CURVE=FP512BN,,-DAMCL_RSA=2048,,-DCMAKE_INSTALL_PREFIX=/opt/amcl
 \
+       
LINUX_64BIT_BLS461:-DWORD_SIZE=64,,-DAMCL_CURVE=BLS461,,-DAMCL_RSA=2048,,-DCMAKE_INSTALL_PREFIX=/opt/amcl
 \
+       
LINUX_64BIT_BLS381:-DWORD_SIZE=64,,-DAMCL_CURVE=BLS381,,-DAMCL_RSA=2048,,-DCMAKE_INSTALL_PREFIX=/opt/amcl
 \
+       
LINUX_64BIT_BLS24:-DWORD_SIZE=64,,-DAMCL_CURVE=BLS24,,-DAMCL_RSA=2048,,-DCMAKE_INSTALL_PREFIX=/opt/amcl
 \
+       
LINUX_64BIT_BLS48:-DWORD_SIZE=64,,-DAMCL_CURVE=BLS48,,-DAMCL_RSA=2048,,-DCMAKE_INSTALL_PREFIX=/opt/amcl
+
+BUILDS_NIST64=LINUX_64BIT_NIST256_RSA2048:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NIST256,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_NIST256_RSA4096:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NIST256,,-DAMCL_RSA=4096
 \
+       
LINUX_64BIT_NIST384_RSA3072:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NIST384,,-DAMCL_RSA=3072
 \
+       
LINUX_64BIT_NIST521_RSA4096:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NIST521,,-DAMCL_RSA=4096
 \
+       
LINUX_64BIT_NIST_RSA_ALL:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NIST256,NIST384,NIST521,,-DAMCL_RSA=2048,3072,4096
+
+BUILDS_MISC64=LINUX_64BIT_C25519_RSA2048:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=C25519,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_BRAINPOOL:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=BRAINPOOL,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_ANSSI:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=ANSSI,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_ED25519:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=ED25519,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_NUMS256E:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NUMS256E,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_NUMS256W:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NUMS256W,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_NUMS384E:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NUMS384E,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_NUMS384W:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NUMS384W,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_NUMS512E:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NUMS512E,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_NUMS512W:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NUMS512W,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_HIFIVE:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=HIFIVE,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_GOLDILOCKS:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=GOLDILOCKS,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_C41417:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=C41417,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_SECP256K1:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=SECP256K1,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_C25519_BN254CX_RSA2048:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=C25519,BN254CX,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_NIST256_BN254CX_RSA2048:-DWORD_SIZE=64,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NIST256,BN254CX,,-DAMCL_RSA=2048
 \
+       
WINDOWS_64BIT_BN254CX:-DWORD_SIZE=64,,-DAMCL_CURVE=BN254CX,,-DAMCL_RSA=2048,,-DCMAKE_TOOLCHAIN_FILE=../../resources/cmake/mingw64-cross.cmake
 \
+       
WINDOWS_64BIT_BN254CX_STATIC:-DWORD_SIZE=64,,-DAMCL_CURVE=BN254CX,,-DAMCL_RSA=2048,,-DCMAKE_TOOLCHAIN_FILE=../../resources/cmake/mingw64-cross.cmake,,-DBUILD_SHARED_LIBS=OFF
+
+BUILDS_PF32=LINUX_32BIT_BLS383:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DAMCL_CURVE=BLS383,,-DAMCL_RSA=2048,,-DCMAKE_INSTALL_PREFIX=/opt/amcl
 \
+       
LINUX_32BIT_BLS381:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DAMCL_CURVE=BLS381,,-DAMCL_RSA=2048,,-DCMAKE_INSTALL_PREFIX=/opt/amcl
 \
+       
LINUX_32BIT_BN254CX:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DAMCL_CURVE=BN254CX,,-DAMCL_RSA=2048,,-DCMAKE_INSTALL_PREFIX=/opt/amcl
 \
+       
LINUX_32BIT_BN254:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DAMCL_CURVE=BN254,,-DAMCL_RSA=2048,,-DCMAKE_INSTALL_PREFIX=/opt/amcl
 \
+       
LINUX_32BIT_FP256BN:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DAMCL_CURVE=FP256BN,,-DAMCL_RSA=2048,,-DCMAKE_INSTALL_PREFIX=/opt/amcl
 \
+       
LINUX_32BIT_FP512BN:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DAMCL_CURVE=FP512BN,,-DAMCL_RSA=2048,,-DCMAKE_INSTALL_PREFIX=/opt/amcl
 \
+       
LINUX_32BIT_BLS461:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DAMCL_CURVE=BLS461,,-DAMCL_RSA=2048,,-DCMAKE_INSTALL_PREFIX=/opt/amcl
 \
+       
LINUX_32BIT_BLS24:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DAMCL_CURVE=BLS24,,-DAMCL_RSA=2048,,-DCMAKE_INSTALL_PREFIX=/opt/amcl
 \
+       
LINUX_32BIT_BLS48:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DAMCL_CURVE=BLS48,,-DAMCL_RSA=2048,,-DCMAKE_INSTALL_PREFIX=/opt/amcl
+
+BUILDS_NIST32=LINUX_32BIT_NIST256_RSA2048:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NIST256,,-DAMCL_RSA=2048
 \
+       
LINUX_32BIT_NIST256_RSA4096:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NIST256,,-DAMCL_RSA=4096
 \
+       
LINUX_32BIT_NIST384_RSA3072:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NIST384,,-DAMCL_RSA=3072
 \
+       
LINUX_32BIT_NIST521_RSA4096:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NIST521,,-DAMCL_RSA=4096
 \
+       
LINUX_32BIT_NIST_RSA_ALL:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NIST256,NIST384,NIST521,,-DAMCL_RSA=2048,3072,4096
+
+BUILDS_MISC32=LINUX_32BIT_C25519_RSA2048:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=C25519,,-DAMCL_RSA=2048
 \
+       
LINUX_32BIT_BRAINPOOL:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=BRAINPOOL,,-DAMCL_RSA=2048
 \
+       
LINUX_32BIT_ANSSI:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=ANSSI,,-DAMCL_RSA=2048
 \
+       
LINUX_32BIT_ED25519:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=ED25519,,-DAMCL_RSA=2048
 \
+       
LINUX_32BIT_NUMS256E:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NUMS256E,,-DAMCL_RSA=2048
 \
+       
LINUX_32BIT_NUMS256W:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NUMS256W,,-DAMCL_RSA=2048
 \
+       
LINUX_32BIT_NUMS384E:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NUMS384E,,-DAMCL_RSA=2048
 \
+       
LINUX_32BIT_NUMS384W:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NUMS384W,,-DAMCL_RSA=2048
 \
+       
LINUX_32BIT_NUMS512E:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NUMS512E,,-DAMCL_RSA=2048
 \
+       
LINUX_32BIT_NUMS512W:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NUMS512W,,-DAMCL_RSA=2048
 \
+       
LINUX_32BIT_HIFIVE:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=HIFIVE,,-DAMCL_RSA=2048
 \
+       
LINUX_32BIT_GOLDILOCKS:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=GOLDILOCKS,,-DAMCL_RSA=2048
 \
+       
LINUX_32BIT_C41417:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=C41417,,-DAMCL_RSA=2048
 \
+       
LINUX_32BIT_SECP256K1:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=SECP256K1,,-DAMCL_RSA=2048
 \
+       
LINUX_32BIT_C25519_BN254CX_RSA2048:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=C25519,BN254CX,,-DAMCL_RSA=2048
 \
+       
LINUX_32BIT_NIST256_BN254CX_RSA2048:-DCMAKE_C_FLAGS=-m32,,-DWORD_SIZE=32,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NIST256,BN254CX,,-DAMCL_RSA=2048
 \
+       
WINDOWS_32BIT_BN254CX:-DCMAKE_C_FLAGS=-m32,,-DAMCL_CURVE=BN254CX,,-DAMCL_RSA=2048,,-DWORD_SIZE=32,,-DCMAKE_TOOLCHAIN_FILE=../../resources/cmake/mingw32-cross.cmake
+
+BUILDS_PFS16=LINUX_16BIT_BN254CX:-DWORD_SIZE=16,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=BN254CX,,-DAMCL_RSA=2048
 \
+       
LINUX_16BIT_BN254:-DWORD_SIZE=16,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=BN254,,-DAMCL_RSA=2048
+
+BUILDS_MISC16=LINUX_16BIT_ED25519:-DWORD_SIZE=16,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=ED25519,,-DAMCL_RSA=2048
 \
+       
LINUX_16BIT_NUMS256E:-DWORD_SIZE=16,,-DCMAKE_INSTALL_PREFIX=/opt/amcl,,-DAMCL_CURVE=NUMS256E,,-DAMCL_RSA=2048
+
+BUILDS_ASAN=LINUX_64BIT_BN254CX_ASan:-DWORD_SIZE=64,,-DCMAKE_BUILD_TYPE=ASan,,-DAMCL_CURVE=BN254CX,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_BLS383_ASan:-DWORD_SIZE=64,,-DCMAKE_BUILD_TYPE=ASan,,-DAMCL_CURVE=BLS383,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_NIST256_RSA2048_ASan:-DWORD_SIZE=64,,-DCMAKE_BUILD_TYPE=ASan,,-DAMCL_CURVE=NIST256,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_NIST256_RSA4096_ASan:-DWORD_SIZE=64,,-DCMAKE_BUILD_TYPE=ASan,,-DAMCL_CURVE=NIST256,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_NIST384_RSA3072_ASan:-DWORD_SIZE=64,,-DCMAKE_BUILD_TYPE=ASan,,-DAMCL_CURVE=NIST384,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_NIST521_ASan:-DWORD_SIZE=64,,-DCMAKE_BUILD_TYPE=ASan,,-DAMCL_CURVE=NIST521,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_C25519_RSA2048_MONTGOMERY_ASan:-DWORD_SIZE=64,,-DCMAKE_BUILD_TYPE=ASan,,-DAMCL_CURVE=C25519,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_C25519_RSA2048_EDWARDS_ASan:-DWORD_SIZE=64,,-DCMAKE_BUILD_TYPE=ASan,,-DAMCL_CURVE=C25519,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_GOLDILOCKS_ASan:-DWORD_SIZE=64,,-DCMAKE_BUILD_TYPE=ASan,,-DAMCL_CURVE=GOLDILOCKS,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_C41417_ASan:-DWORD_SIZE=64,,-DCMAKE_BUILD_TYPE=ASan,,-DAMCL_CURVE=C41417,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_BLS24_ASan:-DWORD_SIZE=64,,-DCMAKE_BUILD_TYPE=ASan,,-DAMCL_CURVE=BLS24,,-DAMCL_RSA=2048
 \
+       
LINUX_64BIT_BLS48_ASan:-DWORD_SIZE=64,,-DCMAKE_BUILD_TYPE=ASan,,-DAMCL_CURVE=BLS48,,-DAMCL_RSA=2048
+
+BUILDS_COVERAGE=LINUX_64BIT_COVERAGE:-DWORD_SIZE=64,,-DCMAKE_BUILD_TYPE=Coverage,,-DAMCL_CURVE=NIST256,BN254CX,BLS24,BLS48,,-DAMCL_RSA=2048
+
+# Merge all build types in a single list
+BUILDS_64=$(BUILDS_PF64) $(BUILDS_NIST64) $(BUILDS_MISC64)
+BUILDS_32=$(BUILDS_PF32) $(BUILDS_NIST32) $(BUILDS_MISC32)
+BUILDS_16=$(BUILDS_BN16) $(BUILDS_MISC16)
+
+BUILDS=$(BUILDS_64) $(BUILDS_32) $(BUILDS_16) $(BUILDS_ASAN) $(BUILDS_COVERAGE)
+
+# Variables used in text substitution
+dcomma := ,,
+space :=
+space +=
+
+# --- MAKE TARGETS ---
+
+# Default build configured in config.mk
+all: default
+
+# Display general help about this command
+help:
+       @echo ""
+       @echo "$(PROJECT) Makefile."
+       @echo "The following commands are available:"
+       @echo ""
+       @echo "    make         :  Build library based on options in config.mk"
+       @echo "    make format  :  Format the source code"
+       @echo "    make clean   :  Remove any build artifact"
+       @echo "    make doc     :  Build documentation"
+       @echo "    make pubdocs :  Publish documentation to GitHub"
+       @echo ""
+       @echo "    Testing:"
+       @echo ""
+       @echo "    make qa      :  Build all versions in this makefile and 
generate reports"
+       @echo ""
+       @echo "    You can also build individual types, groups or sub-groups:"
+       @echo ""
+       @echo ""
+       @$(foreach PARAMS,$(BUILDS_ASAN), \
+               echo "    make build TYPE=$(word 1,$(subst :, ,${PARAMS}))" ; \
+       )
+       @echo ""
+       @$(foreach PARAMS,$(BUILDS_COVERAGE), \
+               echo "    make build TYPE=$(word 1,$(subst :, ,${PARAMS}))" ; \
+       )
+       @echo ""
+       @$(foreach PARAMS,$(BUILDS_64), \
+               echo "    make build TYPE=$(word 1,$(subst :, ,${PARAMS}))" ; \
+       )
+       @echo ""
+       @$(foreach PARAMS,$(BUILDS_32), \
+               echo "    make build TYPE=$(word 1,$(subst :, ,${PARAMS}))" ; \
+       )
+       @echo ""
+       @$(foreach PARAMS,$(BUILDS_16), \
+               echo "    make build TYPE=$(word 1,$(subst :, ,${PARAMS}))" ; \
+       )
+       @echo ""
+
+# Default build configured in config.mk
+default:
+       @echo -e "\n\n*** BUILD default - see config.mk ***\n"
+       rm -rf target/default/*
+ifeq ($(CMAKE_BUILD_TYPE),Coverage)
+       mkdir -p target/default/coverage
+       cd target/default && \
+       cmake -DCMAKE_C_FLAGS=$(CMAKE_C_FLAGS) \
+       -DCMAKE_TOOLCHAIN_FILE=$(CMAKE_TOOLCHAIN_FILE) \
+       -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \
+       -DCMAKE_INSTALL_PREFIX=$(CMAKE_INSTALL_PATH) \
+       -DBUILD_SHARED_LIBS=$(AMCL_BUILD_SHARED_LIBS) \
+       -DBUILD_PYTHON=$(AMCL_BUILD_PYTHON) \
+       -DWORD_SIZE=$(WORD_SIZE) \
+       -DAMCL_CURVE=$(AMCL_CURVE) \
+       -DAMCL_RSA=$(AMCL_RSA) \
+       -DBUILD_MPIN=$(AMCL_BUILD_MPIN) \
+       -DBUILD_WCC=$(AMCL_BUILD_WCC) \
+       -DBUILD_DOCS=$(AMCL_BUILD_DOCS) \
+       -DAMCL_MAXPIN=$(AMCL_MAXPIN) \
+       -DAMCL_PBLEN=$(AMCL_PBLEN) \
+       -DDEBUG_REDUCE=$(DEBUG_REDUCE) \
+       -DDEBUG_NORM=$(DEBUG_NORM) \
+       ../.. | tee cmake.log ; test $${PIPESTATUS[0]} -eq 0 && \
+       export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./ && \
+       make | tee make.log ; test $${PIPESTATUS[0]} -eq 0 && \
+       lcov --zerocounters --directory . && \
+       lcov --capture --initial --directory . --output-file coverage/amcl && \
+       env CTEST_OUTPUT_ON_FAILURE=1 make test | tee test.log ; test 
$${PIPESTATUS[0]} -eq 0 && \
+       lcov --no-checksum --directory . --capture --output-file 
coverage/amcl.info && \
+       lcov --remove coverage/amcl.info "/test_*" --output-file 
coverage/amcl.info && \
+       genhtml -o coverage -t "milagro-crypto-c Test Coverage" 
coverage/amcl.info
+else
+       mkdir -p target/default
+       cd target/default && \
+       cmake -DCMAKE_C_FLAGS=$(CMAKE_C_FLAGS) \
+       -DCMAKE_TOOLCHAIN_FILE=$(CMAKE_TOOLCHAIN_FILE) \
+       -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \
+       -DCMAKE_INSTALL_PREFIX=$(CMAKE_INSTALL_PATH) \
+       -DBUILD_SHARED_LIBS=$(AMCL_BUILD_SHARED_LIBS) \
+       -DBUILD_PYTHON=$(AMCL_BUILD_PYTHON) \
+       -DWORD_SIZE=$(WORD_SIZE) \
+       -DAMCL_CURVE=$(AMCL_CURVE) \
+       -DAMCL_RSA=$(AMCL_RSA) \
+       -DBUILD_MPIN=$(AMCL_BUILD_MPIN) \
+       -DBUILD_WCC=$(AMCL_BUILD_WCC) \
+       -DBUILD_DOCS=$(AMCL_BUILD_DOCS) \
+       -DAMCL_MAXPIN=$(AMCL_MAXPIN) \
+       -DAMCL_PBLEN=$(AMCL_PBLEN) \
+       -DDEBUG_REDUCE=$(DEBUG_REDUCE) \
+       -DDEBUG_NORM=$(DEBUG_NORM) \
+       ../.. | tee cmake.log ; test $${PIPESTATUS[0]} -eq 0 && \
+       make | tee make.log ; test $${PIPESTATUS[0]} -eq 0
+ifeq ($(AMCL_TEST),ON)
+       cd target/default && \
+       export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./ && \
+       env CTEST_OUTPUT_ON_FAILURE=1 make test | tee test.log ; test 
$${PIPESTATUS[0]} -eq 0
+endif
+ifeq ($(AMCL_BUILD_DOCS),ON)
+       cd target/default && \
+       make doc | tee doc.log ; test $${PIPESTATUS[0]} -eq 0
+endif
+endif
+
+
+# Format the source code
+format:
+       astyle --style=allman --recursive --suffix=none 'include/*.h'
+       astyle --style=allman --recursive --suffix=none 'include/*.h.in'
+       astyle --style=allman --recursive --suffix=none 'src/*.c'
+       astyle --style=allman --recursive --suffix=none 'src/*.c.in'
+       astyle --style=allman --recursive --suffix=none 'test/*.c'
+       astyle --style=allman --recursive --suffix=none 'test/*.c.in'
+       astyle --style=allman --recursive --suffix=none 'examples/*.c'
+       astyle --style=allman --recursive --suffix=none 'examples/*.c.in'
+       astyle --style=allman --recursive --suffix=none 'benchmark/*.c.in'
+       autopep8 --in-place --aggressive --aggressive ./wrappers/python/*.py
+
+# Remove any build artifact
+clean:
+       mkdir -p target/
+       rm -rf ./target/*
+
+# Execute all builds and tests
+qa:
+       @mkdir -p target/
+       @echo 0 > target/make.exit
+       @echo '' > target/make_qa_errors.log
+       make build_group BUILD_GROUP=BUILDS
+       @cat target/make_qa_errors.log
+       @exit `cat target/make.exit`
+
+# Build the specified group of options
+build_group:
+       @parallel --no-notice --verbose make build_qa_item ITEM={} ::: 
${${BUILD_GROUP}}
+
+# Build the project using one of the pre-defined targets (example: "make build 
TYPE=LINUX_64BIT_BN254CX")
+build:
+       make build_item ITEM=$(filter ${TYPE}:%,$(BUILDS))
+
+# Same as build_item but stores the exit code and failing items
+build_qa_item:
+       make build_item ITEM=${ITEM} || (echo $$? > target/make.exit && echo 
${ITEM} >> target/make_qa_errors.log);
+
+# Build the specified item entry from the BUILDS list
+build_item:
+       make buildx BUILD_NAME=$(word 1,$(subst :, ,${ITEM})) 
BUILD_PARAMS=$(word 2,$(subst :, ,${ITEM}))
+
+# Build with the specified parameters
+buildx:
+       @echo -e "\n\n*** BUILD ${BUILD_NAME} ***\n"
+       rm -rf target/${BUILD_NAME}/*
+ifneq ($(findstring -DCMAKE_BUILD_TYPE=Coverage,${BUILD_PARAMS}),)
+       mkdir -p target/${BUILD_NAME}/coverage
+       cd target/${BUILD_NAME} && \
+       cmake $(subst $(dcomma),$(space),${BUILD_PARAMS}) ../.. | tee cmake.log 
; test $${PIPESTATUS[0]} -eq 0 && \
+       export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./ && \
+       make | tee make.log ; test $${PIPESTATUS[0]} -eq 0 &&\
+       lcov --zerocounters --directory . && \
+       lcov --capture --initial --directory . --output-file coverage/amcl && \
+       env CTEST_OUTPUT_ON_FAILURE=1 make test | tee test.log ; test 
$${PIPESTATUS[0]} -eq 0 && \
+       lcov --no-checksum --directory . --capture --output-file 
coverage/amcl.info && \
+       lcov --remove coverage/amcl.info "*/test_*" --output-file 
coverage/amcl.info && \
+       genhtml -o coverage -t "milagro-crypto-c Test Coverage" 
coverage/amcl.info
+else
+       mkdir -p target/${BUILD_NAME}
+       cd target/${BUILD_NAME} && \
+       cmake $(subst $(dcomma),$(space),${BUILD_PARAMS}) ../.. | tee cmake.log 
; test $${PIPESTATUS[0]} -eq 0 && \
+       export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./ && \
+       make | tee make.log ; test $${PIPESTATUS[0]} -eq 0 && \
+       env CTEST_OUTPUT_ON_FAILURE=1 make test | tee test.log ; test 
$${PIPESTATUS[0]} -eq 0
+endif
+
+# Alias for building all inside the Docker container
+buildall: default qa doc
+
+# Build documentation
+doc:
+       @echo -e "\n\n*** BUILD documentation ***\n"
+       rm -rf target/documentation/*
+       mkdir -p target/documentation
+       cd target/documentation && \
+       cmake -DCMAKE_C_FLAGS=$(CMAKE_C_FLAGS) \
+       -DCMAKE_TOOLCHAIN_FILE=$(CMAKE_TOOLCHAIN_FILE) \
+       -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \
+       -DCMAKE_INSTALL_PREFIX=$(CMAKE_INSTALL_PATH) \
+       -DBUILD_SHARED_LIBS=$(AMCL_BUILD_SHARED_LIBS) \
+       -DBUILD_PYTHON=$(AMCL_BUILD_PYTHON) \
+       -DAMCL_CHUNK=$(AMCL_CHUNK) \
+       -DAMCL_CURVE=$(AMCL_CURVE) \
+       -DAMCL_RSA=$(AMCL_RSA) \
+       -DBUILD_MPIN=$(AMCL_BUILD_MPIN) \
+       -DBUILD_WCC=$(AMCL_BUILD_WCC) \
+       -DBUILD_DOXYGEN=$(AMCL_BUILD_DOXYGEN) \
+       -DAMCL_MAXPIN=$(AMCL_MAXPIN) \
+       -DAMCL_PBLEN=$(AMCL_PBLEN) \
+       -DDEBUG_REDUCE=$(DEBUG_REDUCE) \
+       -DDEBUG_NORM=$(DEBUG_NORM) \
+       ../.. | tee cmake.log ; test $${PIPESTATUS[0]} -eq 0 && \
+       make | tee make.log ; test $${PIPESTATUS[0]} -eq 0 && \
+       export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./ && \
+       env CTEST_OUTPUT_ON_FAILURE=1 make test | tee test.log ; test 
$${PIPESTATUS[0]} -eq 0 && \
+       make doc | tee doc.log ; test $${PIPESTATUS[0]} -eq 0
+
+# Publish Documentation in GitHub (requires writing permissions)
+pubdocs: doc
+       rm -rf ./target/DOCS
+       rm -rf ./target/WIKI
+       mkdir -p ./target/DOCS/doc
+       cp -r ./target/documentation/doc/html/* ./target/DOCS/doc
+       cp ./doc/Home.md ./target/DOCS/
+       git clone https://github.com/milagro-crypto/milagro-crypto-c.wiki.git 
./target/WIKI
+       mv -f ./target/WIKI/.git ./target/DOCS/
+       cd ./target/DOCS/ && \
+       git add . -A && \
+       git commit -m 'Update documentation' && \
+       git push origin master --force
+       rm -rf ./target/DOCS
+       rm -rf ./target/WIKI
+
+# Print variables usage: make print-VARIABLE
+print-%: ; @echo $* = $($*)


Reply via email to