├── AUTHORS ├── COPYING ├── INSTALL ├── Makefile ├── README.md ├── THANKS ├── TODO ├── VERSION ├── acltest.gpr ├── doc ├── .log ├── Makefile ├── acldoc_de.tex ├── acldoc_en.tex ├── crypto.bib ├── de │ ├── acl.crypto.asymmetric.dsa.tex │ ├── acl.crypto.asymmetric.ecdsa.tex │ ├── acl.crypto.asymmetric.rsa.tex │ ├── acl.crypto.asymmetric.tex │ ├── acl.crypto.hashfunction.tex │ ├── acl.crypto.random.tex │ ├── acl.crypto.symmetric.algorithm.ecdh.tex │ ├── acl.crypto.symmetric.algorithm.ecies.tex │ ├── acl.crypto.symmetric.algorithm.ecmqv.tex │ ├── acl.crypto.symmetric.algorithm.oneway.tex │ ├── acl.crypto.symmetric.algorithm.tex │ ├── acl.crypto.symmetric.blockcipher.tex │ ├── acl.crypto.symmetric.mac.tex │ ├── acl.crypto.symmetric.mode.oneway.tex │ ├── acl.crypto.symmetric.mode.tex │ ├── acl.crypto.symmetric.oneway_blockcipher.tex │ ├── acl.crypto.symmetric.tex │ ├── acl.crypto.tex │ ├── acl.crypto.types.big-numbers.binfield.tex │ ├── acl.crypto.types.big-numbers.tex │ ├── acl.crypto.types.elliptic-curves.databasezp.tex │ ├── acl.crypto.types.elliptic-curves.tex │ ├── acl.crypto.types.tex │ ├── acl.tests.tex │ ├── acldoku-symmetric.tex │ ├── acldoku-types.tex │ └── acleinfuehrung.tex ├── en │ ├── acl.crypto.asymmetric.dsa.tex │ ├── acl.crypto.asymmetric.ecdh.tex │ ├── acl.crypto.asymmetric.ecdsa.tex │ ├── acl.crypto.asymmetric.rsa.tex │ ├── acl.crypto.asymmetric.tex │ ├── acl.crypto.debug_put.tex │ ├── acl.crypto.symmetric.ae.tex │ ├── acl.crypto.symmetric.algorithm.oneway.tex │ ├── acl.crypto.symmetric.algorithm.tex │ ├── acl.crypto.symmetric.blockcipher.oneway.tex │ ├── acl.crypto.symmetric.blockcipher.tex │ ├── acl.crypto.symmetric.hashfunction.tex │ ├── acl.crypto.symmetric.kdf.tex │ ├── acl.crypto.symmetric.mac.tex │ ├── acl.crypto.symmetric.mode.oneway.tex │ ├── acl.crypto.symmetric.mode.tex │ ├── acl.crypto.symmetric.tex │ ├── acl.crypto.symmetric.tweakable_blockcipher.tex │ ├── acl.crypto.types.big_numbers.tex │ ├── acl.crypto.types.elliptic_curves.tex │ ├── acl.crypto.types.nonces.tex │ ├── acl.crypto.types.random.tex │ ├── acl.crypto.types.tex │ ├── acl.introduction.tex │ ├── acl.regression.test.tex │ ├── acl.tests.tex │ └── documentation.tex └── images │ ├── AEAD_McOE.eps │ ├── AE_McOE.eps │ ├── AE_OCB_En.eps │ ├── BPS_En_De.eps │ ├── Big_Number.eps │ ├── CBC_De.eps │ ├── CBC_En.eps │ ├── CFB_De.eps │ ├── CFB_En.eps │ ├── CMAC.eps │ ├── CTR_De.eps │ ├── CTR_En.eps │ ├── DSA_En_De.eps │ ├── Group_law_of_ECC.eps │ ├── LCOV2.eps │ ├── Layout_of_Test_Suite.eps │ ├── Layout_of_the_ACL.eps │ ├── Nonce_Mixed_1.eps │ ├── Nonce_Mixed_2.eps │ ├── OFB_De.eps │ ├── OFB_En.eps │ ├── PBKDF2.eps │ ├── Random.ps │ ├── SHA512Crypt.eps │ ├── SIV_Encryption.eps │ ├── Scrypta.eps │ ├── Scryptb.eps │ ├── Scryptc.eps │ ├── Structure_Test.eps │ ├── Tweak_BC.eps │ ├── graph_aunit.eps │ ├── graph_suites.eps │ └── tabelle_gcov.eps ├── libadacrypt.gpr ├── src ├── Makefile ├── crypto-asymmetric-dh.adb ├── crypto-asymmetric-dh.ads ├── crypto-asymmetric-dsa.adb ├── crypto-asymmetric-dsa.ads ├── crypto-asymmetric-ecdh.adb ├── crypto-asymmetric-ecdh.ads ├── crypto-asymmetric-ecdsa.adb ├── crypto-asymmetric-ecdsa.ads ├── crypto-asymmetric-ecies.adb ├── crypto-asymmetric-ecies.ads ├── crypto-asymmetric-prime_tables.ads ├── crypto-asymmetric-rsa.adb ├── crypto-asymmetric-rsa.ads ├── crypto-asymmetric.ads ├── crypto-debug_put.adb ├── crypto-debug_put.ads ├── crypto-symmetric-ae-ad.ads ├── crypto-symmetric-ae.ads ├── crypto-symmetric-ae_ocb.adb ├── crypto-symmetric-ae_ocb.ads ├── crypto-symmetric-aead_mcoe.adb ├── crypto-symmetric-aead_mcoe.ads ├── crypto-symmetric-aead_ocb3.adb ├── crypto-symmetric-aead_ocb3.ads ├── crypto-symmetric-aead_siv.adb ├── crypto-symmetric-aead_siv.ads ├── crypto-symmetric-algorithm-aes-oneway.adb ├── crypto-symmetric-algorithm-aes-oneway.ads ├── crypto-symmetric-algorithm-aes-tables.ads ├── crypto-symmetric-algorithm-aes.adb ├── crypto-symmetric-algorithm-aes.ads ├── crypto-symmetric-algorithm-argoncf.adb ├── crypto-symmetric-algorithm-argoncf.ads ├── crypto-symmetric-algorithm-argoncfbla.adb ├── crypto-symmetric-algorithm-argoncfbla.ads ├── crypto-symmetric-algorithm-blake2b.adb ├── crypto-symmetric-algorithm-blake2b.ads ├── crypto-symmetric-algorithm-blake2b1.adb ├── crypto-symmetric-algorithm-blake2b1.ads ├── crypto-symmetric-algorithm-blake2b1bla.adb ├── crypto-symmetric-algorithm-blake2b1bla.ads ├── crypto-symmetric-algorithm-blake2b_utils.adb ├── crypto-symmetric-algorithm-blake2b_utils.ads ├── crypto-symmetric-algorithm-blowfish-oneway.adb ├── crypto-symmetric-algorithm-blowfish-oneway.ads ├── crypto-symmetric-algorithm-blowfish-tables.ads ├── crypto-symmetric-algorithm-blowfish.adb ├── crypto-symmetric-algorithm-blowfish.ads ├── crypto-symmetric-algorithm-cfaes.adb ├── crypto-symmetric-algorithm-cfaes.ads ├── crypto-symmetric-algorithm-mmh.adb ├── crypto-symmetric-algorithm-mmh.ads ├── crypto-symmetric-algorithm-noob.adb ├── crypto-symmetric-algorithm-noob.ads ├── crypto-symmetric-algorithm-pcompressbla.adb ├── crypto-symmetric-algorithm-pcompressbla.ads ├── crypto-symmetric-algorithm-pcompressg.adb ├── crypto-symmetric-algorithm-pcompressg.ads ├── crypto-symmetric-algorithm-serpent-oneway.adb ├── crypto-symmetric-algorithm-serpent-oneway.ads ├── crypto-symmetric-algorithm-serpent.adb ├── crypto-symmetric-algorithm-serpent.ads ├── crypto-symmetric-algorithm-sha1-oneway.adb ├── crypto-symmetric-algorithm-sha1-oneway.ads ├── crypto-symmetric-algorithm-sha1.adb ├── crypto-symmetric-algorithm-sha1.ads ├── crypto-symmetric-algorithm-sha256-oneway.adb ├── crypto-symmetric-algorithm-sha256-oneway.ads ├── crypto-symmetric-algorithm-sha256.adb ├── crypto-symmetric-algorithm-sha256.ads ├── crypto-symmetric-algorithm-sha384-oneway.adb ├── crypto-symmetric-algorithm-sha384-oneway.ads ├── crypto-symmetric-algorithm-sha384.adb ├── crypto-symmetric-algorithm-sha384.ads ├── crypto-symmetric-algorithm-sha512-oneway.adb ├── crypto-symmetric-algorithm-sha512-oneway.ads ├── crypto-symmetric-algorithm-sha512.adb ├── crypto-symmetric-algorithm-sha512.ads ├── crypto-symmetric-algorithm-sha512comp.adb ├── crypto-symmetric-algorithm-sha512comp.ads ├── crypto-symmetric-algorithm-sha_utils.adb ├── crypto-symmetric-algorithm-sha_utils.ads ├── crypto-symmetric-algorithm-skein.adb ├── crypto-symmetric-algorithm-skein.ads ├── crypto-symmetric-algorithm-threefish.adb ├── crypto-symmetric-algorithm-threefish.ads ├── crypto-symmetric-algorithm-tripledes-oneway.adb ├── crypto-symmetric-algorithm-tripledes-oneway.ads ├── crypto-symmetric-algorithm-tripledes-tables.ads ├── crypto-symmetric-algorithm-tripledes.adb ├── crypto-symmetric-algorithm-tripledes.ads ├── crypto-symmetric-algorithm-twofish-oneway.adb ├── crypto-symmetric-algorithm-twofish-oneway.ads ├── crypto-symmetric-algorithm-twofish-tables.ads ├── crypto-symmetric-algorithm-twofish.adb ├── crypto-symmetric-algorithm-twofish.ads ├── crypto-symmetric-algorithm-whirlpool-oneway.adb ├── crypto-symmetric-algorithm-whirlpool-oneway.ads ├── crypto-symmetric-algorithm-whirlpool-tables.ads ├── crypto-symmetric-algorithm-whirlpool.adb ├── crypto-symmetric-algorithm-whirlpool.ads ├── crypto-symmetric-algorithm.ads ├── crypto-symmetric-blockcipher.adb ├── crypto-symmetric-blockcipher.ads ├── crypto-symmetric-blockcipher_aes128.ads ├── crypto-symmetric-blockcipher_aes192.ads ├── crypto-symmetric-blockcipher_aes256.ads ├── crypto-symmetric-blockcipher_blowfish128.ads ├── crypto-symmetric-blockcipher_noob64.ads ├── crypto-symmetric-blockcipher_serpent256.ads ├── crypto-symmetric-blockcipher_tripledes.ads ├── crypto-symmetric-blockcipher_twofish128.ads ├── crypto-symmetric-blockcipher_twofish192.ads ├── crypto-symmetric-blockcipher_twofish256.ads ├── crypto-symmetric-compress.ads ├── crypto-symmetric-compress_argoncf.adb ├── crypto-symmetric-compress_argoncf.ads ├── crypto-symmetric-compress_argoncfbla.adb ├── crypto-symmetric-compress_argoncfbla.ads ├── crypto-symmetric-compress_blake2b.adb ├── crypto-symmetric-compress_blake2b.ads ├── crypto-symmetric-compress_blake2b1.adb ├── crypto-symmetric-compress_blake2b1.ads ├── crypto-symmetric-compress_blake2b1bla.adb ├── crypto-symmetric-compress_blake2b1bla.ads ├── crypto-symmetric-compress_cfaes.adb ├── crypto-symmetric-compress_cfaes.ads ├── crypto-symmetric-compress_pcompressbla.adb ├── crypto-symmetric-compress_pcompressbla.ads ├── crypto-symmetric-compress_pcompressg.adb ├── crypto-symmetric-compress_pcompressg.ads ├── crypto-symmetric-compress_sha512.adb ├── crypto-symmetric-compress_sha512.ads ├── crypto-symmetric-compression.adb ├── crypto-symmetric-compression.ads ├── crypto-symmetric-hashfunction.adb ├── crypto-symmetric-hashfunction.ads ├── crypto-symmetric-hashfunction_blake2b.ads ├── crypto-symmetric-hashfunction_sha1.ads ├── crypto-symmetric-hashfunction_sha256.ads ├── crypto-symmetric-hashfunction_sha384.ads ├── crypto-symmetric-hashfunction_sha512.ads ├── crypto-symmetric-hashfunction_skein512.ads ├── crypto-symmetric-hashfunction_whirlpool.ads ├── crypto-symmetric-kdf.adb ├── crypto-symmetric-kdf.ads ├── crypto-symmetric-kdf_catena.adb ├── crypto-symmetric-kdf_catena.ads ├── crypto-symmetric-kdf_pbkdf2.adb ├── crypto-symmetric-kdf_pbkdf2.ads ├── crypto-symmetric-kdf_scrypt.adb ├── crypto-symmetric-kdf_scrypt.ads ├── crypto-symmetric-kdf_sha512crypt.adb ├── crypto-symmetric-kdf_sha512crypt.ads ├── crypto-symmetric-mac-cmac.adb ├── crypto-symmetric-mac-cmac.ads ├── crypto-symmetric-mac-hmac.adb ├── crypto-symmetric-mac-hmac.ads ├── crypto-symmetric-mac-hmac_sha1.ads ├── crypto-symmetric-mac-hmac_sha256.ads ├── crypto-symmetric-mac-hmac_sha384.ads ├── crypto-symmetric-mac-hmac_sha512.ads ├── crypto-symmetric-mac-hmac_whirlpool.ads ├── crypto-symmetric-mac-rmac.adb ├── crypto-symmetric-mac-rmac.ads ├── crypto-symmetric-mac.adb ├── crypto-symmetric-mac.ads ├── crypto-symmetric-mode-bps.adb ├── crypto-symmetric-mode-bps.ads ├── crypto-symmetric-mode-cbc.adb ├── crypto-symmetric-mode-cbc.ads ├── crypto-symmetric-mode-cfb.adb ├── crypto-symmetric-mode-cfb.ads ├── crypto-symmetric-mode-ctr.adb ├── crypto-symmetric-mode-ctr.ads ├── crypto-symmetric-mode-ofb.adb ├── crypto-symmetric-mode-ofb.ads ├── crypto-symmetric-mode-oneway_cfb.adb ├── crypto-symmetric-mode-oneway_cfb.ads ├── crypto-symmetric-mode-oneway_ctr.adb ├── crypto-symmetric-mode-oneway_ctr.ads ├── crypto-symmetric-mode-oneway_ofb.adb ├── crypto-symmetric-mode-oneway_ofb.ads ├── crypto-symmetric-mode.ads ├── crypto-symmetric-oneway_blockcipher.adb ├── crypto-symmetric-oneway_blockcipher.ads ├── crypto-symmetric-oneway_blockcipher_aes128.ads ├── crypto-symmetric-oneway_blockcipher_aes192.ads ├── crypto-symmetric-oneway_blockcipher_aes256.ads ├── crypto-symmetric-oneway_blockcipher_blowfish128.ads ├── crypto-symmetric-oneway_blockcipher_serpent256.ads ├── crypto-symmetric-oneway_blockcipher_sha1.ads ├── crypto-symmetric-oneway_blockcipher_sha256.ads ├── crypto-symmetric-oneway_blockcipher_sha384.ads ├── crypto-symmetric-oneway_blockcipher_sha512.ads ├── crypto-symmetric-oneway_blockcipher_tripledes.ads ├── crypto-symmetric-oneway_blockcipher_twofish128.ads ├── crypto-symmetric-oneway_blockcipher_twofish192.ads ├── crypto-symmetric-oneway_blockcipher_twofish256.ads ├── crypto-symmetric-oneway_blockcipher_whirlpool.ads ├── crypto-symmetric-tweakable_blockcipher.ads ├── crypto-symmetric-tweakable_blockcipher_cmt.adb ├── crypto-symmetric-tweakable_blockcipher_cmt.ads ├── crypto-symmetric-tweakable_blockcipher_tx.adb ├── crypto-symmetric-tweakable_blockcipher_tx.ads ├── crypto-symmetric-utils.adb ├── crypto-symmetric-utils.ads ├── crypto-symmetric.ads ├── crypto-types-base64.adb ├── crypto-types-base64.ads ├── crypto-types-big_numbers-binfield_utils.adb ├── crypto-types-big_numbers-mod_utils.adb ├── crypto-types-big_numbers-utils.adb ├── crypto-types-big_numbers.adb ├── crypto-types-big_numbers.ads ├── crypto-types-elliptic_curves-nss_bf.adb ├── crypto-types-elliptic_curves-nss_bf.ads ├── crypto-types-elliptic_curves-ss_bf.adb ├── crypto-types-elliptic_curves-ss_bf.ads ├── crypto-types-elliptic_curves-zp-database.adb ├── crypto-types-elliptic_curves-zp-database.ads ├── crypto-types-elliptic_curves-zp.adb ├── crypto-types-elliptic_curves-zp.ads ├── crypto-types-elliptic_curves.adb ├── crypto-types-elliptic_curves.ads ├── crypto-types-mutexes.adb ├── crypto-types-mutexes.ads ├── crypto-types-nonces-nonces_ctr.adb ├── crypto-types-nonces-nonces_ctr.ads ├── crypto-types-nonces-nonces_mixed_1.adb ├── crypto-types-nonces-nonces_mixed_1.ads ├── crypto-types-nonces-nonces_mixed_2.adb ├── crypto-types-nonces-nonces_mixed_2.ads ├── crypto-types-nonces-nonces_random.adb ├── crypto-types-nonces-nonces_random.ads ├── crypto-types-nonces-nonces_randomized_counter.adb ├── crypto-types-nonces-nonces_randomized_counter.ads ├── crypto-types-nonces.ads ├── crypto-types-output.adb ├── crypto-types-output.ads ├── crypto-types-random.adb ├── crypto-types-random.ads ├── crypto-types-random_source-hashfunction.adb ├── crypto-types-random_source-hashfunction.ads ├── crypto-types-random_source.adb ├── crypto-types-random_source.ads ├── crypto-types-xorshiftstar.adb ├── crypto-types-xorshiftstar.ads ├── crypto-types.adb ├── crypto-types.ads ├── crypto.ads ├── unix │ ├── crypto-types-random_source-provider.adb │ └── crypto-types-random_source-provider.ads └── windows │ ├── crypto-types-random_source-provider.adb │ └── crypto-types-random_source-provider.ads └── test ├── .directory ├── GMGPL ├── Makefile ├── aunit-test_results-acl.adb ├── aunit-test_results-acl.ads ├── big_number_add_results.adb ├── big_number_add_results.ads ├── big_number_and_results.adb ├── big_number_and_results.ads ├── big_number_constants.adb ├── big_number_constants.ads ├── big_number_div_results.adb ├── big_number_div_results.ads ├── big_number_exponentiate_results.adb ├── big_number_exponentiate_results.ads ├── big_number_mod_results.adb ├── big_number_mod_results.ads ├── big_number_mult2_results.adb ├── big_number_mult2_results.ads ├── big_number_mult_results.adb ├── big_number_mult_results.ads ├── big_number_or_results.adb ├── big_number_or_results.ads ├── big_number_put_test.txt ├── big_number_sub_results.adb ├── big_number_sub_results.ads ├── big_number_xor_results.adb ├── big_number_xor_results.ads ├── big_numbers_mod_utils.adb ├── big_numbers_mod_utils.ads ├── crypto-symmetric-kdf_catena-testing.adb ├── crypto-symmetric-kdf_catena-testing.ads ├── crypto-symmetric-kdf_pbkdf2-testing.adb ├── crypto-symmetric-kdf_pbkdf2-testing.ads ├── crypto-symmetric-kdf_scrypt-testing.adb ├── crypto-symmetric-kdf_scrypt-testing.ads ├── crypto-symmetric-kdf_sha512crypt-testing.adb ├── crypto-symmetric-kdf_sha512crypt-testing.ads ├── gcov_compilation.txt ├── hash_message1.txt ├── hash_message2.txt ├── hash_message3.txt ├── hash_message4.txt ├── hash_message5.txt ├── hash_message6.txt ├── hash_message7.txt ├── message.txt ├── test-ae_ocb.adb ├── test-ae_ocb.ads ├── test-aes128.adb ├── test-aes128.ads ├── test-aes192.adb ├── test-aes192.ads ├── test-aes256.adb ├── test-aes256.ads ├── test-aes_oneway.adb ├── test-aes_oneway.ads ├── test-asymmetric_ciphers.adb ├── test-base64.adb ├── test-base64.ads ├── test-big_number.adb ├── test-big_number_add.adb ├── test-big_number_add.ads ├── test-big_number_add_mod_utils.adb ├── test-big_number_add_mod_utils.ads ├── test-big_number_and.adb ├── test-big_number_and.ads ├── test-big_number_b_add.adb ├── test-big_number_b_add.ads ├── test-big_number_b_div.adb ├── test-big_number_b_div.ads ├── test-big_number_b_mult.adb ├── test-big_number_b_mult.ads ├── test-big_number_b_sub.adb ├── test-big_number_b_sub.ads ├── test-big_number_comp.adb ├── test-big_number_comp.ads ├── test-big_number_dec.adb ├── test-big_number_dec.ads ├── test-big_number_div.adb ├── test-big_number_div.ads ├── test-big_number_div_mod_utils.adb ├── test-big_number_div_mod_utils.ads ├── test-big_number_exponentiate.adb ├── test-big_number_exponentiate.ads ├── test-big_number_inc.adb ├── test-big_number_inc.ads ├── test-big_number_inv_mod_utils.adb ├── test-big_number_inv_mod_utils.ads ├── test-big_number_iseven.adb ├── test-big_number_iseven.ads ├── test-big_number_isodd.adb ├── test-big_number_isodd.ads ├── test-big_number_lprime_mod_utils.adb ├── test-big_number_lprime_mod_utils.ads ├── test-big_number_lsb.adb ├── test-big_number_lsb.ads ├── test-big_number_min_max.adb ├── test-big_number_min_max.ads ├── test-big_number_mod.adb ├── test-big_number_mod.ads ├── test-big_number_mod_type_comp_and_add.adb ├── test-big_number_mod_type_comp_and_add.ads ├── test-big_number_mod_types.adb ├── test-big_number_mod_types.ads ├── test-big_number_mr_mod_utils.adb ├── test-big_number_mr_mod_utils.ads ├── test-big_number_msb.adb ├── test-big_number_msb.ads ├── test-big_number_mult2.adb ├── test-big_number_mult2.ads ├── test-big_number_mult_mod_utils.adb ├── test-big_number_mult_mod_utils.ads ├── test-big_number_multiplication.adb ├── test-big_number_multiplication.ads ├── test-big_number_or.adb ├── test-big_number_or.ads ├── test-big_number_pow_mod_utils.adb ├── test-big_number_pow_mod_utils.ads ├── test-big_number_prime_mod_utils.adb ├── test-big_number_prime_mod_utils.ads ├── test-big_number_rand_mod_utils.adb ├── test-big_number_rand_mod_utils.ads ├── test-big_number_rl.adb ├── test-big_number_rl.ads ├── test-big_number_sl.adb ├── test-big_number_sl.ads ├── test-big_number_sr.adb ├── test-big_number_sr.ads ├── test-big_number_sub.adb ├── test-big_number_sub.ads ├── test-big_number_sub_mod_utils.adb ├── test-big_number_sub_mod_utils.ads ├── test-big_number_swap.adb ├── test-big_number_swap.ads ├── test-big_number_xor.adb ├── test-big_number_xor.ads ├── test-big_numbers_division.adb ├── test-big_numbers_division.ads ├── test-big_numbers_utils.adb ├── test-big_numbers_utils.ads ├── test-blowfish.adb ├── test-blowfish.ads ├── test-blowfish_oneway.adb ├── test-blowfish_oneway.ads ├── test-bps_mode.adb ├── test-bps_mode.ads ├── test-catena.adb ├── test-catena.ads ├── test-cbc_mode.adb ├── test-cbc_mode.ads ├── test-cfb_mode.adb ├── test-cfb_mode.ads ├── test-cfb_oneway_mode.adb ├── test-cfb_oneway_mode.ads ├── test-cmac.adb ├── test-cmac.ads ├── test-counter_generator.adb ├── test-counter_generator.ads ├── test-ctr_mode.adb ├── test-ctr_mode.ads ├── test-ctr_oneway_mode.adb ├── test-ctr_oneway_mode.ads ├── test-dsa.adb ├── test-dsa.ads ├── test-ecdh.adb ├── test-ecdh.ads ├── test-ecdsa.adb ├── test-ecdsa.ads ├── test-ecies.adb ├── test-ecies.ads ├── test-elliptic_curves.adb ├── test-elliptic_curves.ads ├── test-elliptic_curves_nss_bf.adb ├── test-elliptic_curves_nss_bf.ads ├── test-elliptic_curves_zp.adb ├── test-elliptic_curves_zp.ads ├── test-hash.adb ├── test-hmac.adb ├── test-hmac.ads ├── test-kdf.adb ├── test-mmh.adb ├── test-mmh.ads ├── test-noobcipher.adb ├── test-noobcipher.ads ├── test-ocb.adb ├── test-ocb.ads ├── test-ofb_mode.adb ├── test-ofb_mode.ads ├── test-ofb_oneway_mode.adb ├── test-ofb_oneway_mode.ads ├── test-pbkdf2.adb ├── test-pbkdf2.ads ├── test-random.adb ├── test-random.ads ├── test-random_generator.adb ├── test-random_generator.ads ├── test-rmac.adb ├── test-rmac.ads ├── test-rsa.adb ├── test-rsa.ads ├── test-scrypt.adb ├── test-scrypt.ads ├── test-serpent.adb ├── test-serpent.ads ├── test-serpent_oneway.adb ├── test-serpent_oneway.ads ├── test-sha1.adb ├── test-sha1.ads ├── test-sha1_mac.adb ├── test-sha1_mac.ads ├── test-sha256.adb ├── test-sha256.ads ├── test-sha256_mac.adb ├── test-sha256_mac.ads ├── test-sha256_oneway.adb ├── test-sha256_oneway.ads ├── test-sha384.adb ├── test-sha384.ads ├── test-sha384_oneway.adb ├── test-sha384_oneway.ads ├── test-sha512.adb ├── test-sha512.ads ├── test-sha512_mac.adb ├── test-sha512_mac.ads ├── test-sha512_oneway.adb ├── test-sha512_oneway.ads ├── test-sha512crypt.adb ├── test-sha512crypt.ads ├── test-siv.adb ├── test-siv.ads ├── test-skein.adb ├── test-skein.ads ├── test-suite_ae.adb ├── test-suite_ae.ads ├── test-suite_all.adb ├── test-suite_all.ads ├── test-suite_asymmetric_ciphers.adb ├── test-suite_asymmetric_ciphers.ads ├── test-suite_authenticated_encryption.adb ├── test-suite_authenticated_encryption.ads ├── test-suite_big_num1.adb ├── test-suite_big_num1.ads ├── test-suite_big_num2.adb ├── test-suite_big_num2.ads ├── test-suite_big_num3.adb ├── test-suite_big_num3.ads ├── test-suite_big_num4.adb ├── test-suite_big_num4.ads ├── test-suite_big_num_all.adb ├── test-suite_big_num_all.ads ├── test-suite_blockciphers.adb ├── test-suite_blockciphers.ads ├── test-suite_elliptic_curves.adb ├── test-suite_elliptic_curves.ads ├── test-suite_hash_function.adb ├── test-suite_hash_function.ads ├── test-suite_key_derivation_function.adb ├── test-suite_key_derivation_function.ads ├── test-suite_mac.adb ├── test-suite_mac.ads ├── test-suite_misc.adb ├── test-suite_misc.ads ├── test-suite_nonces.adb ├── test-suite_nonces.ads ├── test-suite_oneway_blockciphers.adb ├── test-suite_oneway_blockciphers.ads ├── test-symmetric_ciphers.adb ├── test-symmetric_mac.adb ├── test-symmetric_mac.ads ├── test-tdes.adb ├── test-tdes.ads ├── test-tdes_oneway.adb ├── test-tdes_oneway.ads ├── test-template.adb ├── test-template.ads ├── test-tests.adb ├── test-twofish128.adb ├── test-twofish128.ads ├── test-twofish128_oneway.adb ├── test-twofish128_oneway.ads ├── test-twofish192.adb ├── test-twofish192.ads ├── test-twofish192_oneway.adb ├── test-twofish192_oneway.ads ├── test-twofish256.adb ├── test-twofish256.ads ├── test-twofish256_oneway.adb ├── test-twofish256_oneway.ads ├── test-types.adb ├── test-types.ads ├── test-whirlpool.adb ├── test-whirlpool.ads ├── test-whirlpool_mac.adb ├── test-whirlpool_mac.ads ├── test-whirlpool_oneway.adb ├── test-whirlpool_oneway.ads ├── test.ads ├── tools ├── e.adb ├── esbox.adb ├── gen_coverage_page.sh ├── lc.sh ├── morver.c ├── w.adb ├── y.sh └── z.sh └── vectors.txt /AUTHORS: -------------------------------------------------------------------------------- 1 | Thomas Knapke : Nonces, Tweakable Blockciphers, AE Schemes, AEAD, Schemes, 2 | CMAC, Symmetric Utils 3 | Bastian Weber : AUnit-Tests 4 | Heinrich Schilling : AUnit-Tests, KDF Schemes, OCB3, Hash Contexts, Debug_Put, Skein 5 | Anne 'Yu' Barshun : AUnit-Tests 6 | Hui Xue : AUnit-Tests, english documentation 7 | Markus G. Kuhn : Serpent256 8 | Maxim Reznik : Blowfish 9 | Christian Forler : Rest 10 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNAT Modified General Public License 2 | 3 | This program is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU General Public License as 5 | published by the Free Software Foundation; either version 2 of the 6 | License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 16 | 02111-1307, USA. 17 | 18 | As a special exception, if other files instantiate generics from 19 | this unit, or you link this unit with other files to produce an 20 | executable, this unit does not by itself cause the resulting 21 | executable to be covered by the GNU General Public License. This 22 | exception does not however invalidate any other reasons why the 23 | executable file might be covered by the GNU Public License. 24 | 25 | Read more about this license at http://en.wikipedia.org/wiki/GNAT_Modified_General_Public_License -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/INSTALL -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ADACC=gnatmake 2 | ADACLEAN=gnatclean 3 | SRCDIR = src 4 | DOC= ./doc/ 5 | SUBTDIR = test 6 | LIBDIR=lib 7 | MKDIR=mkdir 8 | 9 | all: acl 10 | clean: clean-acl clean-acltest 11 | 12 | ########################################################################### 13 | ################################### ACL ################################### 14 | ########################################################################### 15 | 16 | acl: 17 | $(MKDIR) -p $(LIBDIR) 18 | $(ADACC) -P libadacrypt.gpr 19 | 20 | clean-acl: 21 | $(ADACLEAN) -P libadacrypt.gpr 22 | 23 | 24 | ########################################################################### 25 | ################################### TEST ################################## 26 | ########################################################################### 27 | 28 | acltest: 29 | $(ADACC) -P acltest.gpr 30 | 31 | clean-acltest: 32 | $(ADACLEAN) -P acltest.gpr 33 | 34 | gcov: 35 | $(MAKE) -C $(SRCDIR) gcov 36 | $(MAKE) -C $(SUBTDIR) gcov 37 | 38 | ########################################################################### 39 | ############################## DOCUMENTATION ############################## 40 | ########################################################################### 41 | 42 | docu: 43 | $(MAKE) -C $(DOC) all 44 | 45 | install-docu: 46 | $(MAKE) -C $(DOC) install 47 | 48 | unistall-docu: 49 | $(MAKE) -C $(DOC) uninstall 50 | 51 | clean-docu: 52 | $(MAKE) -C $(DOC) clean 53 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- 1 | subject reason(s) 2 | ------- ----------- 3 | Stefan Lucks (supervision) 4 | Jakob Wenzel (fruitful design discussions) 5 | Niels Ferguson (twofishLib) 6 | Markus Kuhn (serpent-code) 7 | J. Delcourt (BIG_NUMBER library) 8 | RSA Security Inc. (PKCS #1) 9 | NIST (specs and test vectors) 10 | Erik Zenner (handout "Zahlenthoretische Algorithmen") 11 | Maxim Reznik (blowfish code) 12 | AdaCore Team (gnat + AUnit + SPARK) 13 | Free software community (Debian GNU/Linux) 14 | Roderick Chapman (bug reports) 15 | Michael Hardmann (Windows Support) -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | -- rename Hashfunction to two words Hash_Function (plus similar problems) 2 | 3 | -- secure storage pool. !IMPORTANT! 4 | A secure storage pool overrides every allocated byte and the complete stack. 5 | 6 | Now, the ACL don't burn down his heap and stack after usage. 7 | After execution of an application that uses the ACL you will find (parts of) 8 | the key in the memory. It's a very good and cheap cryptographic attacks to 9 | search key material in the memory after the execution of an application. 10 | So, without a secure storage pool this lib is only a toy for cryptographes 11 | and researchers. 12 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.8.8 2 | -------------------------------------------------------------------------------- /acltest.gpr: -------------------------------------------------------------------------------- 1 | with "libadacrypt.gpr"; 2 | 3 | project AclTest is 4 | 5 | for Source_Dirs use ("test/","/usr/share/ada/adainclude/aunit/"); 6 | for Object_Dir use "test"; 7 | for Main use ("test-asymmetric_ciphers.adb","test-big_number.adb", 8 | "test-hash.adb", "test-kdf.adb", "test-symmetric_ciphers.adb", 9 | "test-tests.adb"); 10 | 11 | 12 | 13 | package Compiler is 14 | for Default_Switches ("ada") use ("-O3", "-W", "-gnato", 15 | "-fno-strict-aliasing", "-gnatn", "-gnatwrclp", "-gnat12"); 16 | end Compiler; 17 | 18 | package Builder is 19 | for Default_Switches ("ada") use ("-j4", "-we"); 20 | end Builder; 21 | 22 | package Linker is 23 | end Linker; 24 | 25 | end AclTest; -------------------------------------------------------------------------------- /doc/.log: -------------------------------------------------------------------------------- 1 | This is TeX, Version 3.14159 (Web2C 7.3.7) (format=latex 2003.3.24) 22 NOV 2004 18:40 2 | **primzahlen.tex 3 | (/usr/share/texmf/tex/latex/tools/.tex 4 | ! Interruption. 5 | 6 | \begingroup 7 | l.1 8 | %% 9 | ? x 10 | 11 | Here is how much of TeX's memory you used: 12 | 5 strings out of 10847 13 | 121 string characters out of 70946 14 | 44507 words of memory out of 263001 15 | 3034 multiletter control sequences out of 10000+0 16 | 3640 words of font info for 14 fonts, out of 400000 for 1000 17 | 14 hyphenation exceptions out of 1000 18 | 3i,0n,1p,21b,6s stack positions out of 300i,100n,500p,50000b,4000s 19 | No pages of output. 20 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | DOCPATH =/usr/local/share/doc/libadacrypt-dev 2 | DE_PATH=./de 3 | EN_PATH=./en 4 | 5 | .PHONY : clean 6 | .SILENT : clean 7 | 8 | 9 | all: de en 10 | clean : clean_de clean_en 11 | de: dvi_de ps_de pdf_de 12 | en: dvi_en ps_en pdf_en 13 | 14 | dvi_de: 15 | latex acldoc_de 16 | bibtex acldoc_de 17 | latex acldoc_de 18 | bibtex acldoc_de 19 | 20 | pdf_de:dvi_de 21 | dvipdf acldoc_de.dvi acldoc-de.pdf 22 | 23 | ps_de:dvi_de 24 | dvips -o acldoc-de.ps acldoc_de.dvi 25 | 26 | 27 | clean_de: 28 | rm -f *.ps *.pdf *.dvi *.log *~ *.toc *.aux *.bbl *.blg 29 | rm -f $(DE_PATH)/*~ $(DE_PATH)/*aux 30 | 31 | 32 | 33 | 34 | dvi_en: 35 | latex acldoc_en 36 | bibtex acldoc_en 37 | latex acldoc_en 38 | bibtex acldoc_en 39 | 40 | pdf_en:dvi_en 41 | dvipdf acldoc_en.dvi acldoc-en.pdf 42 | 43 | ps_en:dvi_en 44 | dvips -o acldoc-en.ps acldoc_en.dvi 45 | 46 | 47 | clean_en: 48 | rm -f *.ps *.pdf *.dvi *.log *~ *.toc *.aux *.bbl *.blg 49 | rm -f $(EN_PATH)/*~ $(EN_PATH)/*aux 50 | 51 | install : 52 | mkdir -p $(DOCPATH) 53 | cp *.ps $(DOCPATH)/*.ps 54 | cp *.pdf $(DOCPATH)/*.pdf 55 | 56 | uninstall: 57 | rm -f $(DOCPATH)/acldoc-de.ps 58 | -------------------------------------------------------------------------------- /doc/acldoc_de.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/acldoc_de.tex -------------------------------------------------------------------------------- /doc/crypto.bib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/crypto.bib -------------------------------------------------------------------------------- /doc/de/acl.crypto.asymmetric.dsa.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.asymmetric.dsa.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.asymmetric.ecdsa.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.asymmetric.ecdsa.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.asymmetric.rsa.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.asymmetric.rsa.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.asymmetric.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.asymmetric.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.hashfunction.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.hashfunction.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.random.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.random.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.symmetric.algorithm.ecdh.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.symmetric.algorithm.ecdh.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.symmetric.algorithm.ecies.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.symmetric.algorithm.ecies.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.symmetric.algorithm.ecmqv.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.symmetric.algorithm.ecmqv.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.symmetric.algorithm.oneway.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.symmetric.algorithm.oneway.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.symmetric.algorithm.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.symmetric.algorithm.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.symmetric.blockcipher.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.symmetric.blockcipher.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.symmetric.mac.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.symmetric.mac.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.symmetric.mode.oneway.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.symmetric.mode.oneway.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.symmetric.mode.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.symmetric.mode.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.symmetric.oneway_blockcipher.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.symmetric.oneway_blockcipher.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.symmetric.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.symmetric.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.types.big-numbers.binfield.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.types.big-numbers.binfield.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.types.big-numbers.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.types.big-numbers.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.types.elliptic-curves.databasezp.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.types.elliptic-curves.databasezp.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.types.elliptic-curves.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.types.elliptic-curves.tex -------------------------------------------------------------------------------- /doc/de/acl.crypto.types.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acl.crypto.types.tex -------------------------------------------------------------------------------- /doc/de/acldoku-symmetric.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acldoku-symmetric.tex -------------------------------------------------------------------------------- /doc/de/acldoku-types.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acldoku-types.tex -------------------------------------------------------------------------------- /doc/de/acleinfuehrung.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/doc/de/acleinfuehrung.tex -------------------------------------------------------------------------------- /doc/en/acl.crypto.asymmetric.tex: -------------------------------------------------------------------------------- 1 | \chapter{Crypto.Asymmetric} 2 | The distinguishing technique used in public-key cryptography is the 3 | use of asymmetric key algorithms, where the key used to encrypt a 4 | message is not the same as the key used to decrypt it. Each user has a 5 | pair of cryptographic keys — a public encryption key and a private 6 | decryption key. The publicly available encryption key is widely 7 | distributed, while the private decryption key is known only to the 8 | recipient. Messages are encrypted with the recipient's public key and 9 | can be decrypted only with the corresponding private key. 10 | 11 | In the ACL, asymmetric algorithms are also 12 | provided. \texttt{Crypto.Asymmetric} is the root package for 13 | asymmetric cryptosystem. It enables direct access to 14 | \texttt{Crypto.Types} which contains fundamental types and 15 | corresponding basic functions. Furthermore it provides access to 16 | \texttt{Crypto.Types.Big\_Numbers}. 17 | -------------------------------------------------------------------------------- /doc/en/acl.crypto.debug_put.tex: -------------------------------------------------------------------------------- 1 | \chapter{Crypto.Debug\_Put} 2 | The package \texttt{Debug\_Put} provides a means of more differentiated debug output. The package is instantiated with true or false, and depending on the value, the function outputs the text on the debug output, or it does nothing. \linebreak 3 | The advantage of this is the possibility to instantiate the package multiple times and this way having separated switches for multiple output packages when debugging 4 | \section{Generic part} 5 | \begin{lstlisting}{} 6 | generic 7 | b : in Boolean := true; 8 | \end{lstlisting} 9 | \section{Functions} 10 | \begin{lstlisting}{} 11 | procedure Put_Line(S : in String); 12 | procedure Put(S : in String); 13 | procedure Put(Item : Integer; 14 | Width : Field := Ada.Integer_Text_IO.Default_Width; 15 | Base : Number_Base := Default_Base); 16 | \end{lstlisting} 17 | \begin{itemize} 18 | \item The procedure \texttt{Put\_Line()} puts the line \texttt{S} to debug output, followed by a line break, or does nothing, if \texttt{b} is false. 19 | \item The procedure \texttt{Put()} puts the line \texttt{S} to debug output, or does nothing, if \texttt{b} is false. 20 | \item The procedure \texttt{Put()} puts the integer number Item to debug output, base \texttt{Number\_Base}, or does nothing, if \texttt{b} is false. 21 | \end{itemize} 22 | -------------------------------------------------------------------------------- /libadacrypt.gpr: -------------------------------------------------------------------------------- 1 | project LibAdaCrypt is 2 | for Library_Name use "adacrypt-0.8"; 3 | for Library_Kind use "static"; 4 | for Library_Dir use "lib"; 5 | for Library_Src_Dir use "lib"; 6 | for Object_Dir use "src"; 7 | 8 | type System_Type is ("unix", "windows"); 9 | System : System_Type := external ("system", "unix"); 10 | 11 | for Source_Dirs use ("src", "src/" & System); 12 | 13 | type Mode_Type is ("debug", "release"); 14 | Mode : Mode_Type := external ("mode", "release"); 15 | 16 | package Builder is 17 | for Default_Switches ("ada") use ("-j4", "-we"); 18 | end Builder; 19 | 20 | package Compiler is 21 | case Mode is 22 | when "debug" => 23 | for Default_Switches ("ada") use ("-gnatwa", "-g", "-Werror", "-gnatn", "-gnat12"); 24 | when "release" => 25 | for Default_Switches ("ada") use ("-gnatwa", "-O3", "-Werror", "-gnatn", "-gnat12"); 26 | end case; 27 | end Compiler; 28 | 29 | end LibAdaCrypt; 30 | 31 | -------------------------------------------------------------------------------- /src/crypto-asymmetric.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | --with Crypto; 24 | 25 | package Crypto.Asymmetric is 26 | 27 | Invalid_Public_Key_Error : exception; 28 | Invalid_Private_Key_Error : exception; 29 | Plaintext_Too_Long_Error : exception; 30 | Decrypt_Error : exception; 31 | 32 | end Crypto.Asymmetric; 33 | -------------------------------------------------------------------------------- /src/crypto-debug_put.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | with Ada.Text_IO; use Ada.Text_IO; 24 | with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; 25 | generic 26 | b : in Boolean := true; 27 | package Crypto.Debug_Put is 28 | procedure Put_Line(S : in String); 29 | procedure Put(S : in String); 30 | procedure Put(Item : Integer; 31 | Width : Field := Ada.Integer_Text_IO.Default_Width; 32 | Base : Number_Base := Default_Base); 33 | procedure New_Line; 34 | end Crypto.Debug_Put; 35 | -------------------------------------------------------------------------------- /src/crypto-symmetric-algorithm-cfaes.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | -- This SHA-512 implementation is based on fips-180-2 24 | 25 | 26 | package Crypto.Symmetric.Algorithm.CFAES is 27 | 28 | procedure Compress( Number : in Integer; 29 | i1 : in DW_Block8192; 30 | i2 : in DW_Block8192; 31 | Output: out DW_Block8192); 32 | 33 | -- procedure resetState; 34 | 35 | private 36 | 37 | pragma Optimize (Time); 38 | 39 | end Crypto.Symmetric.Algorithm.CFAES; 40 | -------------------------------------------------------------------------------- /src/crypto-symmetric-algorithm-mmh.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | 24 | package Crypto.Symmetric.Algorithm.MMH is 25 | 26 | procedure Hash(Key, Message : in Word; Hash : out Word); 27 | procedure Hash(Key, Message : in Words; Hash : out Word); 28 | 29 | pragma Optimize (Time); 30 | 31 | end Crypto.Symmetric.Algorithm.MMH; 32 | 33 | -------------------------------------------------------------------------------- /src/crypto-symmetric-algorithm-pcompressbla.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | -- This SHA-512 implementation is based on fips-180-2 24 | 25 | package Crypto.Symmetric.Algorithm.PCompressBla is 26 | 27 | procedure Compress( Number : in Integer; 28 | i1 : in DW_Block512; 29 | i2 : in DW_Block512; 30 | Output: out DW_Block512); 31 | 32 | -- procedure resetState; 33 | 34 | procedure G (a : in out DWord; 35 | b : in out DWord; 36 | c : in out DWord; 37 | d : in out DWord); 38 | 39 | procedure Round_Blake2(r: in out DW_Block1024); 40 | 41 | private 42 | 43 | pragma Optimize (Time); 44 | 45 | end Crypto.Symmetric.Algorithm.PCompressBla; 46 | -------------------------------------------------------------------------------- /src/crypto-symmetric-algorithm-pcompressg.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | -- This SHA-512 implementation is based on fips-180-2 24 | 25 | 26 | package Crypto.Symmetric.Algorithm.PCompressG is 27 | 28 | procedure Compress( Number : in Integer; 29 | i1 : in DW_Block512; 30 | i2 : in DW_Block512; 31 | Output: out DW_Block512); 32 | 33 | -- procedure resetState; 34 | 35 | procedure G (a : in out DWord; 36 | b : in out DWord; 37 | c : in out DWord; 38 | d : in out DWord); 39 | 40 | procedure Round_Blake2(r: in out DW_Block1024); 41 | 42 | private 43 | 44 | pragma Optimize (Time); 45 | 46 | end Crypto.Symmetric.Algorithm.PCompressG; -------------------------------------------------------------------------------- /src/crypto-symmetric-algorithm-sha512comp.adb: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | -- All the procedures of this package based on FIPS 180-2 24 | 25 | 26 | with Crypto.Symmetric.Hashfunction_SHA512; 27 | 28 | package body Crypto.Symmetric.Algorithm.SHA512Comp is 29 | 30 | 31 | procedure Compress(Number : in Integer; 32 | i1 : in DW_Block512; 33 | i2 : in DW_Block512; 34 | Output: out DW_Block512) is 35 | begin 36 | output := Crypto.Symmetric.Hashfunction_SHA512.Hash(To_Bytes(i1)&To_Bytes(i2)); 37 | end Compress; 38 | end Crypto.Symmetric.Algorithm.SHA512Comp; 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/crypto-symmetric-algorithm-sha512comp.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | -- This SHA-512 implementation is based on fips-180-2 24 | 25 | 26 | package Crypto.Symmetric.Algorithm.SHA512Comp is 27 | 28 | procedure Compress( Number : in Integer; 29 | i1 : in DW_Block512; 30 | i2 : in DW_Block512; 31 | Output: out DW_Block512); 32 | private 33 | pragma Optimize (Time); 34 | end Crypto.Symmetric.Algorithm.SHA512Comp; 35 | -------------------------------------------------------------------------------- /src/crypto-symmetric-algorithm-tripledes-tables.ads: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cforler/Ada-Crypto-Library/a9c201d586f31b475802e04dfa1441e50d18d9ff/src/crypto-symmetric-algorithm-tripledes-tables.ads -------------------------------------------------------------------------------- /src/crypto-symmetric-compress.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | with Crypto.Types; use Crypto.Types; 24 | 25 | package Crypto.Symmetric.Compress is 26 | type Compress_Scheme is abstract tagged 27 | record 28 | Length : Natural; 29 | end record; 30 | 31 | function Process(This : in out Compress_Scheme; 32 | Input_1 : in Bytes; 33 | Input_2 : in Bytes; 34 | vindex : in Natural) return Bytes is abstract; 35 | 36 | function Get_Length(This : in out Compress_Scheme) return Integer is abstract; 37 | 38 | procedure Reset(This : in out Compress_Scheme) is abstract; 39 | 40 | end Crypto.Symmetric.Compress; 41 | -------------------------------------------------------------------------------- /src/crypto-symmetric-kdf.adb: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | 24 | package body Crypto.Symmetric.KDF is 25 | 26 | 27 | procedure Derive(This : in out KDF_Scheme'Class; 28 | Salt : in String; 29 | Password : in String; 30 | Key : out return_type) is 31 | begin 32 | 33 | This.Derive(Salt => To_Bytes(Message => Salt), 34 | Password => To_Bytes(Message => Password), 35 | Key => Key); 36 | 37 | end; 38 | 39 | 40 | 41 | end Crypto.Symmetric.KDF; 42 | -------------------------------------------------------------------------------- /src/crypto-symmetric-mac-cmac.ads: -------------------------------------------------------------------------------- 1 | with Crypto.Symmetric.Oneway_Blockcipher; 2 | 3 | generic 4 | with package C is new Crypto.Symmetric.Oneway_Blockcipher(<>); 5 | with function "xor" (Left, Right : C.Block) return C.Block is <>; 6 | 7 | package Crypto.Symmetric.MAC.CMAC is 8 | use C; 9 | 10 | type Blocks is array (Integer range <>) of Block; 11 | 12 | -- low level 13 | procedure Init(Key : in Key_Type); 14 | procedure Sign(Message_Block : in Block); 15 | procedure Final_Sign(Final_Message_Block : in Block; 16 | Bytes_Read : in Natural; 17 | Tag : out Block); 18 | 19 | 20 | procedure Verify(Message_Block : in Block); 21 | function Final_Verify(Final_Message_Block : in Block; 22 | Bytes_Read : in Natural; 23 | Tag : in Block) 24 | return Boolean; 25 | 26 | 27 | -- high level API 28 | procedure Sign(Message : in Blocks; 29 | Key : in Key_Type; 30 | Tag : out Block); 31 | 32 | 33 | function Verify(Message : in Blocks; 34 | Key : in Key_Type; 35 | Tag : in Block) return Boolean; 36 | 37 | 38 | private 39 | Blocklength_Not_Supported : exception; 40 | 41 | -- Function Generate_Constants calculates the two constants U and U2 (see paper) 42 | -- in addiction to the blocklength. Both constants are generated from L. 43 | function Generate_Constants(Value : Bytes) return Block; 44 | 45 | pragma Inline (Init, Sign); 46 | 47 | pragma Optimize (Time); 48 | 49 | 50 | end Crypto.Symmetric.MAC.CMAC; 51 | -------------------------------------------------------------------------------- /src/crypto-symmetric-mac-hmac_sha1.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | with Crypto.Symmetric.MAC.Hmac; 24 | with Crypto.Symmetric.Hashfunction_SHA1; 25 | 26 | pragma Elaborate_All (Crypto.Symmetric.Mac.Hmac); 27 | 28 | package Crypto.Symmetric.Mac.Hmac_SHA1 is 29 | new Crypto.Symmetric.Mac.Hmac(H => Crypto.Symmetric.Hashfunction_SHA1, 30 | Copy => Crypto.Symmetric.Mac.Copy, 31 | Fill36 => Crypto.Symmetric.Mac.Fill36, 32 | Fill5C => Crypto.Symmetric.Mac.Fill5C); 33 | -------------------------------------------------------------------------------- /src/crypto-symmetric-mac-hmac_sha256.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | with Crypto.Symmetric.MAC.Hmac; 24 | with Crypto.Symmetric.Hashfunction_SHA256; 25 | 26 | pragma Elaborate_All (Crypto.Symmetric.Mac.Hmac); 27 | 28 | package Crypto.Symmetric.Mac.Hmac_SHA256 is 29 | new Crypto.Symmetric.Mac.Hmac(H => Crypto.Symmetric.Hashfunction_SHA256, 30 | Copy => Crypto.Symmetric.Mac.Copy, 31 | Fill36 => Crypto.Symmetric.Mac.Fill36, 32 | Fill5C => Crypto.Symmetric.Mac.Fill5C); 33 | -------------------------------------------------------------------------------- /src/crypto-symmetric-mac-hmac_sha384.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | with Crypto.Symmetric.MAC.HMAC; 24 | with Crypto.Symmetric.Hashfunction_SHA384; 25 | 26 | pragma Elaborate_All (Crypto.Symmetric.Mac.Hmac); 27 | 28 | package Crypto.Symmetric.Mac.Hmac_SHA384 is 29 | new Crypto.Symmetric.Mac.Hmac(H => Crypto.Symmetric.Hashfunction_SHA384, 30 | Copy => Crypto.Symmetric.Mac.Copy, 31 | Fill36 => Crypto.Symmetric.Mac.Fill36, 32 | Fill5C => Crypto.Symmetric.Mac.Fill5C); 33 | -------------------------------------------------------------------------------- /src/crypto-symmetric-mac-hmac_sha512.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | with Crypto.Symmetric.MAC.HMAC; 24 | with Crypto.Symmetric.Hashfunction_SHA512; 25 | 26 | pragma Elaborate_All (Crypto.Symmetric.Mac.Hmac); 27 | 28 | package Crypto.Symmetric.Mac.Hmac_SHA512 is 29 | new Crypto.Symmetric.Mac.Hmac(H => Crypto.Symmetric.Hashfunction_SHA512, 30 | Copy => Crypto.Symmetric.Mac.Copy, 31 | Fill36 => Crypto.Symmetric.Mac.Fill36, 32 | Fill5C => Crypto.Symmetric.Mac.Fill5C); 33 | -------------------------------------------------------------------------------- /src/crypto-symmetric-mac-hmac_whirlpool.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | with Crypto.Symmetric.MAC.HMAC; 24 | with Crypto.Symmetric.Hashfunction_Whirlpool; 25 | 26 | 27 | pragma Elaborate_All (Crypto.Symmetric.Mac.Hmac); 28 | 29 | package Crypto.Symmetric.Mac.Hmac_Whirlpool is 30 | new Crypto.Symmetric.Mac.Hmac(H => Crypto.Symmetric.Hashfunction_Whirlpool, 31 | Copy => Crypto.Symmetric.Mac.Copy, 32 | Fill36 => Crypto.Symmetric.Mac.Fill36, 33 | Fill5C => Crypto.Symmetric.Mac.Fill5C); 34 | -------------------------------------------------------------------------------- /src/crypto-symmetric-mode.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | pragma Warnings (Off); 23 | with Crypto.Types; 24 | use Crypto.Types; 25 | pragma Warnings (On); 26 | 27 | package Crypto.Symmetric.Mode is 28 | end Crypto.Symmetric.Mode; 29 | -------------------------------------------------------------------------------- /src/crypto-symmetric-oneway_blockcipher_sha1.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | with Crypto.Symmetric.algorithm.SHA1.Oneway; 24 | with Crypto.Symmetric.Oneway_Blockcipher; 25 | with Crypto.Types; 26 | 27 | use Crypto.Types; 28 | use Crypto.Symmetric.algorithm.SHA1.Oneway; 29 | 30 | pragma Elaborate_All (Crypto.Symmetric.Oneway_Blockcipher); 31 | 32 | package Crypto.Symmetric.Oneway_Blockcipher_SHA1 is 33 | new Crypto.Symmetric.Oneway_Blockcipher 34 | (Block => W_Block160, 35 | Key_Type => W_Block256, 36 | Cipherkey_Type => Cipherkey_SHA1, 37 | Prepare_Key => Prepare_Key, 38 | Encrypt => Encrypt, 39 | To_Block_Type => To_W_Block160, 40 | Block_To_Bytes => To_Bytes); 41 | -------------------------------------------------------------------------------- /src/crypto-symmetric-oneway_blockcipher_sha256.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | with Crypto.Symmetric.Algorithm.SHA256.Oneway; 24 | with Crypto.Symmetric.Oneway_Blockcipher; 25 | with Crypto.Types; 26 | 27 | use Crypto.Types; 28 | use Crypto.Symmetric.Algorithm.SHA256.Oneway; 29 | 30 | 31 | pragma Elaborate_All (Crypto.Symmetric.Oneway_Blockcipher); 32 | 33 | package Crypto.Symmetric.Oneway_Blockcipher_SHA256 is 34 | new Crypto.Symmetric.Oneway_Blockcipher 35 | (Block => W_Block256, 36 | Key_Type => W_Block256, 37 | Cipherkey_Type => Cipherkey_SHA256, 38 | Prepare_Key => Prepare_Key, 39 | Encrypt => Encrypt, 40 | To_Block_Type => To_W_Block256, 41 | Block_To_Bytes => To_Bytes); 42 | 43 | -------------------------------------------------------------------------------- /src/crypto-symmetric-oneway_blockcipher_sha512.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | with Crypto.Symmetric.Algorithm.SHA512.Oneway; 24 | with Crypto.Symmetric.Oneway_Blockcipher; 25 | with Crypto.Types; 26 | 27 | use Crypto.Types; 28 | use Crypto.Symmetric.Algorithm.SHA512.Oneway; 29 | 30 | pragma Elaborate_All (Crypto.Symmetric.Oneway_Blockcipher); 31 | 32 | package Crypto.Symmetric.Oneway_Blockcipher_SHA512 is 33 | new Crypto.Symmetric.Oneway_Blockcipher 34 | (Block => DW_Block512, 35 | Key_Type => DW_Block256, 36 | Cipherkey_Type => Cipherkey_SHA512, 37 | Prepare_Key => Prepare_Key, 38 | Encrypt => Encrypt, 39 | To_Block_Type => To_DW_Block512, 40 | Block_To_Bytes => To_Bytes); 41 | -------------------------------------------------------------------------------- /src/crypto-symmetric-tweakable_blockcipher.ads: -------------------------------------------------------------------------------- 1 | generic 2 | type Block is private; 3 | type Key_Type is private; 4 | type Tweak_Type is private; 5 | 6 | package Crypto.Symmetric.Tweakable_Blockcipher is 7 | type TB_Interface is limited interface; 8 | 9 | procedure Key_Setup(This : in out TB_Interface; 10 | Key : in Key_Type) is abstract; 11 | 12 | function Encrypt(This : in out TB_Interface; 13 | Tweak : in Tweak_Type; 14 | Plaintext : in Block) return Block is abstract; 15 | 16 | function Decrypt(This : in out TB_Interface; 17 | Tweak : in Tweak_Type; 18 | Ciphertext : in Block) return Block is abstract; 19 | 20 | end Crypto.Symmetric.Tweakable_Blockcipher; 21 | -------------------------------------------------------------------------------- /src/crypto-symmetric-tweakable_blockcipher_cmt.adb: -------------------------------------------------------------------------------- 1 | package body Crypto.Symmetric.Tweakable_Blockcipher_CMT is 2 | 3 | -- Supress the following warning, since for CMT "This" is an empty record. 4 | -- warning: formal parameter "This" is not Referenced 5 | pragma Warnings("F"); 6 | 7 | 8 | 9 | procedure Key_Setup(This : in out CMT; 10 | Key : in BC.Key_Type) is 11 | begin 12 | BC.Prepare_Key(Key); 13 | end Key_Setup; 14 | 15 | function Encrypt(This : in out CMT; 16 | Tweak : in BC.Block; 17 | Plaintext : in BC.Block) return BC.Block is 18 | Ciphertext, C: BC.Block; 19 | begin 20 | BC.Encrypt(Plaintext, C); 21 | C := C xor Tweak; 22 | BC.Encrypt(C, Ciphertext); 23 | 24 | return Ciphertext; 25 | end Encrypt; 26 | 27 | function Decrypt(This : in out CMT; 28 | Tweak : in BC.Block; 29 | Ciphertext : in BC.Block) return BC.Block is 30 | Plaintext, P: BC.Block; 31 | begin 32 | BC.Decrypt(Ciphertext, P); 33 | P := P xor Tweak; 34 | BC.Decrypt(P, Plaintext); 35 | 36 | return Plaintext; 37 | end Decrypt; 38 | pragma Warnings("f"); 39 | 40 | end Crypto.Symmetric.Tweakable_Blockcipher_CMT; 41 | -------------------------------------------------------------------------------- /src/crypto-symmetric-tweakable_blockcipher_cmt.ads: -------------------------------------------------------------------------------- 1 | with Crypto.Symmetric.Blockcipher; 2 | with Crypto.Symmetric.Tweakable_Blockcipher; 3 | 4 | generic 5 | with package BC is new Crypto.Symmetric.Blockcipher(<>); 6 | with function "xor"(Left, Right: BC.Block) return BC.Block is <>; 7 | 8 | package Crypto.Symmetric.Tweakable_Blockcipher_CMT is 9 | 10 | package Tweakable_Blockciphers is new Crypto.Symmetric.Tweakable_Blockcipher(Block => BC.Block, 11 | Key_Type => BC.Key_Type, 12 | Tweak_Type => BC.Block); 13 | 14 | type CMT is new Tweakable_Blockciphers.TB_Interface with null record; 15 | 16 | overriding 17 | procedure Key_Setup(This : in out CMT; 18 | Key : in BC.Key_Type); 19 | 20 | overriding 21 | function Encrypt(This : in out CMT; 22 | Tweak : in BC.Block; 23 | Plaintext : in BC.Block) return BC.Block; 24 | 25 | overriding 26 | function Decrypt(This : in out CMT; 27 | Tweak : in BC.Block; 28 | Ciphertext : in BC.Block) return BC.Block; 29 | 30 | end Crypto.Symmetric.Tweakable_Blockcipher_CMT; 31 | -------------------------------------------------------------------------------- /src/crypto-symmetric-tweakable_blockcipher_tx.adb: -------------------------------------------------------------------------------- 1 | package body Crypto.Symmetric.Tweakable_Blockcipher_TX is 2 | 3 | use Crypto.Types; 4 | 5 | procedure Key_Setup(This : in out TX; 6 | Key : in BC.Key_Type) is 7 | begin 8 | This.Key := Key; 9 | end Key_Setup; 10 | 11 | function Encrypt(This : in out TX; 12 | Tweak : in BC.Block; 13 | Plaintext : in BC.Block) return BC.Block is 14 | Key: Bytes := To_Bytes(This.Key); 15 | Ciphertext: BC.Block; 16 | T: constant Bytes := BC.To_Bytes(Tweak); 17 | begin 18 | Key(T'Last-(T'Length-1)..T'Last) := Key(T'Last-(T'Length-1)..T'Last) xor T; 19 | BC.Prepare_Key(BC.To_Key(Key)); -- set new Key 20 | BC.Encrypt(Plaintext, Ciphertext); 21 | 22 | return Ciphertext; 23 | end Encrypt; 24 | 25 | function Decrypt(This : in out TX; 26 | Tweak : in BC.Block; 27 | Ciphertext : in BC.Block) return BC.Block is 28 | Key: Bytes := To_Bytes(This.Key); 29 | Plaintext: BC.Block; 30 | T: constant Bytes := BC.To_Bytes(Tweak); 31 | begin 32 | Key(T'Last-(T'Length-1)..T'Last) := Key(T'Last-(T'Length-1)..T'Last) xor T; 33 | BC.Prepare_Key(BC.To_Key(Key)); -- set new Key 34 | BC.Decrypt(Ciphertext, Plaintext); 35 | 36 | return Plaintext; 37 | end Decrypt; 38 | 39 | end Crypto.Symmetric.Tweakable_Blockcipher_TX; -------------------------------------------------------------------------------- /src/crypto-symmetric-tweakable_blockcipher_tx.ads: -------------------------------------------------------------------------------- 1 | with Crypto.Types; 2 | with Crypto.Symmetric.Blockcipher; 3 | with Crypto.Symmetric.Tweakable_Blockcipher; 4 | 5 | generic 6 | with package BC is new Crypto.Symmetric.Blockcipher(<>); 7 | with function To_Bytes(K : in BC.Key_Type) return Crypto.Types.Bytes; 8 | 9 | package Crypto.Symmetric.Tweakable_Blockcipher_TX is 10 | 11 | package Tweakable_Blockciphers is new Crypto.Symmetric.Tweakable_Blockcipher(Block => BC.Block, 12 | Key_Type => BC.Key_Type, 13 | Tweak_Type => BC.Block); 14 | 15 | type TX is new Tweakable_Blockciphers.TB_Interface with private; 16 | 17 | overriding 18 | procedure Key_Setup(This : in out TX; 19 | Key : in BC.Key_Type); 20 | 21 | overriding 22 | function Encrypt(This : in out TX; 23 | Tweak : in BC.Block; 24 | Plaintext : in BC.Block) return BC.Block; 25 | 26 | overriding 27 | function Decrypt(This : in out TX; 28 | Tweak : in BC.Block; 29 | Ciphertext : in BC.Block) return BC.Block; 30 | 31 | private 32 | 33 | type TX is new Tweakable_Blockciphers.TB_Interface with record 34 | Key: BC.Key_Type; 35 | end record; 36 | 37 | end Crypto.Symmetric.Tweakable_Blockcipher_TX; 38 | -------------------------------------------------------------------------------- /src/crypto-symmetric-utils.adb: -------------------------------------------------------------------------------- 1 | package body Crypto.Symmetric.Utils is 2 | 3 | function Password_To_Key(Password : in String) return Key_Type is 4 | B: constant Bytes := Hashfunction.To_Bytes(Hashfunction.Hash(Password)); 5 | Bytes_Per_Key_Block: constant Positive := Key_Type'Size / 8; 6 | begin 7 | if B'Length < Bytes_Per_Key_Block then 8 | raise Invalid_Key_Length; 9 | else 10 | return To_Key(B(B'First..B'First+Bytes_Per_Key_Block-1)); 11 | end if; 12 | end Password_To_Key; 13 | 14 | end Crypto.Symmetric.Utils; -------------------------------------------------------------------------------- /src/crypto-symmetric-utils.ads: -------------------------------------------------------------------------------- 1 | with Crypto.Types; 2 | with Crypto.Symmetric.Hashfunction; 3 | 4 | use Crypto.Types; 5 | 6 | generic 7 | with package Hashfunction is new Crypto.Symmetric.Hashfunction(<>); 8 | type Key_Type is private; 9 | with function To_Key(B : in Bytes) return Key_Type is <>; 10 | 11 | package Crypto.Symmetric.Utils is 12 | 13 | function Password_To_Key(Password : in String) return Key_Type; 14 | 15 | private 16 | Invalid_Key_Length: exception; 17 | end Crypto.Symmetric.Utils; -------------------------------------------------------------------------------- /src/crypto-symmetric.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | 24 | package Crypto.Symmetric is 25 | --null; 26 | end Crypto.Symmetric; 27 | -------------------------------------------------------------------------------- /src/crypto-types-base64.ads: -------------------------------------------------------------------------------- 1 | generic 2 | type Base64_Character is (<>); 3 | package Crypto.Types.Base64 is 4 | 5 | type Base64_String is array (Positive range <>) of Base64_Character; 6 | subtype Base64_SHA512Crypt is Base64_String(1..86); 7 | 8 | function Encode_Base64(B: Bytes) return Base64_String; 9 | function Decode_Base64(S: Base64_String) return Bytes; 10 | 11 | 12 | end Crypto.Types.Base64; 13 | -------------------------------------------------------------------------------- /src/crypto-types-elliptic_curves-nss_bf.ads: -------------------------------------------------------------------------------- 1 | 2 | -- non-supersingular elliptic curves over binary fields 3 | 4 | generic 5 | package Crypto.Types.Elliptic_Curves.NSS_BF is 6 | use Big; 7 | 8 | -- init an elliptic curve over GF(2**deg(F)) 9 | procedure Init(A, B, F : in Big_Unsigned); 10 | 11 | 12 | function Is_Elliptic_Curve return Boolean; 13 | 14 | function On_Elliptic_Curve(X : EC_Point) return Boolean; 15 | 16 | function Negative(X : EC_Point) return EC_Point; 17 | 18 | function "+"(Left, Right : EC_Point) return EC_Point; 19 | 20 | function "-"(Left, Right : EC_Point) return EC_Point; 21 | 22 | function Double(X : EC_Point) return EC_Point; 23 | 24 | function "*"(Left : Big_Unsigned; Right : EC_Point) return EC_Point; 25 | 26 | end Crypto.Types.Elliptic_Curves.NSS_BF; 27 | -------------------------------------------------------------------------------- /src/crypto-types-elliptic_curves-ss_bf.ads: -------------------------------------------------------------------------------- 1 | 2 | -- supersingular elliptic curves over binary fields 3 | 4 | generic 5 | package Crypto.Types.Elliptic_Curves.SS_BF is 6 | use Big; 7 | 8 | -- init an elliptic curve over GF(2**deg(F)) 9 | procedure Init(A, B,C, F : in Big_Unsigned); 10 | 11 | function Is_Elliptic_Curve return Boolean; 12 | 13 | function On_Elliptic_Curve(X : EC_Point) return Boolean; 14 | 15 | function Negative(X : EC_Point) return EC_Point; 16 | 17 | function "+"(Left, Right : EC_Point) return EC_Point; 18 | 19 | function "-"(Left, Right : EC_Point) return EC_Point; 20 | 21 | function Double(X : EC_Point) return EC_Point; 22 | 23 | function "*"(Left : Big_Unsigned; Right : EC_Point) return EC_Point; 24 | 25 | end Crypto.Types.Elliptic_Curves.SS_BF; 26 | -------------------------------------------------------------------------------- /src/crypto-types-mutexes.adb: -------------------------------------------------------------------------------- 1 | 2 | package body Crypto.Types.Mutexes is 3 | 4 | protected body Mutex_Type is 5 | entry Seize when not Owned is 6 | begin 7 | Owned := True; 8 | end Seize; 9 | 10 | procedure Release is 11 | begin 12 | Owned := False; 13 | end Release; 14 | end Mutex_Type; 15 | 16 | end Crypto.Types.Mutexes; 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/crypto-types-mutexes.ads: -------------------------------------------------------------------------------- 1 | 2 | 3 | package Crypto.Types.Mutexes is 4 | protected type Mutex_Type is 5 | entry Seize; 6 | procedure Release; 7 | private 8 | Owned : Boolean := False; 9 | end Mutex_Type; 10 | 11 | end Crypto.Types.Mutexes; 12 | -------------------------------------------------------------------------------- /src/crypto-types-nonces-nonces_ctr.ads: -------------------------------------------------------------------------------- 1 | with Ada.Direct_IO; 2 | 3 | generic 4 | with function Inc(B : in Crypto.Types.Nonces.Block) return Crypto.Types.Nonces.Block; 5 | 6 | package Crypto.Types.Nonces.Nonces_Ctr is 7 | package N renames Crypto.Types.Nonces; 8 | package ADIO is new Ada.Direct_IO(N.Block); 9 | 10 | type Nonce_Ctr is new N.Nonce with private; 11 | 12 | overriding 13 | function Update(This : in out Nonce_Ctr) return N.Block; 14 | 15 | overriding 16 | procedure Finalize(This : in out Nonce_Ctr); 17 | 18 | procedure Initialize(This : in out Nonce_Ctr; 19 | File_Path : in String; 20 | IV: in N.Block); 21 | 22 | procedure Initialize(This : in out Nonce_Ctr; File_Path : in String); 23 | 24 | private 25 | type Nonce_Ctr is new N.Nonce with 26 | record 27 | File : ADIO.File_Type; 28 | end record; 29 | 30 | end Crypto.Types.Nonces.Nonces_Ctr; 31 | -------------------------------------------------------------------------------- /src/crypto-types-nonces-nonces_mixed_1.ads: -------------------------------------------------------------------------------- 1 | -- Mixed solution 1 concatenates a random number and a counter. 2 | -- Every time a nonce is requested, this generator increment a counter by one and generates a new random value. 3 | -- Upon reset, the counter is set to the initial value and a new random value will be generated. 4 | with Ada.Direct_IO; 5 | 6 | generic 7 | Counter_Size: Positive := Block'Size / 16; -- set the size of the counter (in bytes) 8 | with function To_Block_Type(Byte_Array: in Crypto.Types.Bytes) return Crypto.Types.Nonces.Block; 9 | with function To_Bytes(Block: in Crypto.Types.Nonces.Block) return Crypto.Types.Bytes; 10 | 11 | package Crypto.Types.Nonces.Nonces_Mixed_1 is 12 | 13 | package N renames Crypto.Types.Nonces; 14 | package ADIO is new Ada.Direct_IO(N.Block); 15 | 16 | type Nonce_Mixed_1 is new N.Nonce with private; 17 | 18 | procedure Initialize(This : in out Nonce_Mixed_1; 19 | IV : in N.Block); 20 | 21 | -- The function Update calls the function Inc, generate a random value, 22 | -- and returns the concatenation random || counter (default: half half) as Block. 23 | overriding 24 | function Update(This : in out Nonce_Mixed_1) return N.Block; 25 | 26 | private 27 | 28 | -- The function Inc increments the counter by one and 29 | -- stores the counter in the second half (default) of the Block. 30 | function Inc(B: in Block) return Block; 31 | 32 | type Nonce_Mixed_1 is new N.Nonce with null record; 33 | 34 | CS: Positive := (Block'Size/8) - Counter_Size; 35 | End_of_Block: Positive := (Block'Size / 8)-1; 36 | 37 | end Crypto.Types.Nonces.Nonces_Mixed_1; -------------------------------------------------------------------------------- /src/crypto-types-nonces-nonces_mixed_2.ads: -------------------------------------------------------------------------------- 1 | -- Mixed solution 2 concatenates a random value and a counter. 2 | -- Every time a nonce is requested, this generator increment a counter and the random number value remains unchanged. 3 | -- Upon reset, the counter is set to the initial value and a new random value will be generated. 4 | with Ada.Direct_IO; 5 | 6 | generic 7 | Counter_Size: Positive := Block'Size / 16; -- set the size of the counter (in bytes) 8 | with function To_Block_Type(Byte_Array: in Crypto.Types.Bytes) return Crypto.Types.Nonces.Block; 9 | with function To_Bytes(Block: in Crypto.Types.Nonces.Block) return Crypto.Types.Bytes; 10 | 11 | package Crypto.Types.Nonces.Nonces_Mixed_2 is 12 | 13 | package N renames Crypto.Types.Nonces; 14 | package ADIO is new Ada.Direct_IO(N.Block); 15 | 16 | type Nonce_Mixed_2 is new N.Nonce with private; 17 | 18 | procedure Initialize(This : in out Nonce_Mixed_2; 19 | IV : in N.Block); 20 | 21 | -- The function Update calls the function Inc. 22 | overriding 23 | function Update(This : in out Nonce_Mixed_2) return N.Block; 24 | 25 | private 26 | 27 | -- The function Inc increments the counter by one and 28 | -- stores the counter in the second half (default) of the Block. 29 | function Inc(B: in Block) return Block; 30 | 31 | -- The function Set_Random generates a new random value and 32 | -- store it in the first half (default) of the Block. 33 | procedure Set_Random(B: in out N.Block); 34 | 35 | CS: Positive := (Block'Size/8) - Counter_Size; 36 | End_of_Block: Positive := (Block'Size / 8)-1; 37 | 38 | type Nonce_Mixed_2 is new N.Nonce with 39 | record 40 | IV: Crypto.Types.Bytes(CS..End_of_Block); 41 | end record; 42 | 43 | end Crypto.Types.Nonces.Nonces_Mixed_2; -------------------------------------------------------------------------------- /src/crypto-types-nonces-nonces_random.adb: -------------------------------------------------------------------------------- 1 | with Crypto.Types.Random; 2 | 3 | package body Crypto.Types.Nonces.Nonces_Random is 4 | 5 | function Update(This: in out Nonce_Rand) return N.Block is 6 | Byte_Array: Crypto.Types.Bytes(0..(Block'Size / 8)-1); 7 | pragma Unreferenced (This); 8 | begin 9 | Crypto.Types.Random.Read(Byte_Array); 10 | return To_Block_Type(Byte_Array); 11 | end Update; 12 | 13 | end Crypto.Types.Nonces.Nonces_Random; 14 | -------------------------------------------------------------------------------- /src/crypto-types-nonces-nonces_random.ads: -------------------------------------------------------------------------------- 1 | with Crypto.Types; 2 | 3 | generic 4 | with function To_Block_Type(B: in Crypto.Types.Bytes) return Crypto.Types.Nonces.Block; 5 | 6 | package Crypto.Types.Nonces.Nonces_Random is 7 | package N renames Crypto.Types.Nonces; 8 | 9 | type Nonce_Rand is new N.Nonce with private; 10 | 11 | overriding 12 | function Update(This: in out Nonce_Rand) return N.Block; 13 | 14 | private 15 | type Nonce_Rand is new N.Nonce with null record; 16 | 17 | end Crypto.Types.Nonces.Nonces_Random; 18 | -------------------------------------------------------------------------------- /src/crypto-types-nonces.ads: -------------------------------------------------------------------------------- 1 | with Ada.Finalization; 2 | private with Crypto.Types.Mutexes; 3 | 4 | generic 5 | type Block is private; 6 | 7 | package Crypto.Types.Nonces is 8 | package Fin renames Ada.Finalization; 9 | 10 | type Nonce is abstract limited new Fin.Limited_Controlled with private; 11 | 12 | overriding 13 | procedure Finalize(This : in out Nonce) is null; 14 | 15 | not overriding 16 | function Update(This : in out Nonce) return Block is abstract; 17 | 18 | private 19 | type Nonce is abstract limited new Fin.Limited_Controlled with 20 | record 21 | Value : Block; 22 | Mutex : Crypto.Types.Mutexes.Mutex_Type; 23 | end record; 24 | end Crypto.Types.Nonces; 25 | -------------------------------------------------------------------------------- /src/crypto-types-output.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | -- All the procedures of this package based on FIPS 180-2 24 | 25 | with Crypto.Types; use Crypto.Types; 26 | 27 | package Crypto.Types.Output is 28 | 29 | procedure Put_B_Block_128(input : B_Block128); 30 | procedure Put_DW_Block8192(input : DW_Block8192); 31 | procedure Put_DW_Block1024(input : DW_Block1024); 32 | procedure Put_Bytes(input : Bytes); 33 | 34 | end Crypto.Types.Output; -------------------------------------------------------------------------------- /src/crypto-types-random.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | with Crypto.Types.Random_Source; 24 | use Crypto.Types; 25 | 26 | package Crypto.Types.Random is 27 | procedure Set(Source : in Crypto.Types.Random_Source.Random_Source'Class); 28 | 29 | procedure Read(B : out Byte); 30 | procedure Read(Byte_Array : out Bytes); 31 | procedure Read(B : out B_Block128); 32 | 33 | procedure Read(W : out Word); 34 | procedure Read(Word_Array : out Words); 35 | 36 | procedure Read(D : out DWord); 37 | procedure Read(DWord_Array : out DWords); 38 | 39 | pragma Inline (Read); 40 | pragma Optimize (Time); 41 | end Crypto.Types.Random; 42 | -------------------------------------------------------------------------------- /src/crypto-types-random_source-hashfunction.ads: -------------------------------------------------------------------------------- 1 | with Crypto.Symmetric.Hashfunction; 2 | 3 | generic 4 | with package H is new Crypto.Symmetric.Hashfunction(<>); 5 | 6 | package Crypto.Types.Random_Source.Hashfunction is 7 | package Rnd renames Crypto.Types.Random_Source; 8 | 9 | type Random_Source_Hashfunction is new Rnd.Random_Source with private; 10 | type Random_Source_Hashfunction_Access is access Random_Source_Hashfunction; 11 | 12 | L : constant Natural := H.Hash_Type'Size/8; 13 | 14 | subtype B_Hash is Bytes(0.. L-1); 15 | 16 | Overriding 17 | procedure Initialize(This : in out Random_Source_Hashfunction); 18 | 19 | procedure Initialize(This : in out Random_Source_Hashfunction; 20 | Seed : in B_Hash); 21 | 22 | Overriding 23 | procedure Read(This : in out Random_Source_Hashfunction; B : out Byte); 24 | 25 | Overriding 26 | procedure Read(This : in out Random_Source_Hashfunction; 27 | Byte_Array : out Bytes); 28 | 29 | Overriding 30 | procedure Read(This : in out Random_Source_Hashfunction; B : out B_Block128); 31 | 32 | procedure Reset(This : in out Random_Source_Hashfunction; 33 | Seed : in B_Hash); 34 | 35 | 36 | private 37 | subtype Index_Type is Natural range 0..L; 38 | 39 | type Random_Source_Hashfunction is new Rnd.Random_Source with 40 | record 41 | -- Seed + 64 Bit Counter 42 | Input : Bytes(1..L+8) := (others => 0); 43 | 44 | Buffer : B_Hash := (others => 0); 45 | Index : Index_Type := 0; 46 | end record; 47 | 48 | procedure Update(This : in out Random_Source_Hashfunction); 49 | 50 | end Crypto.Types.Random_Source.Hashfunction; 51 | -------------------------------------------------------------------------------- /src/crypto-types-random_source.adb: -------------------------------------------------------------------------------- 1 | package body Crypto.Types.Random_Source is 2 | 3 | procedure Read(This : in out Random_Source; Byte_Array : out Bytes) is 4 | begin 5 | for I in Byte_Array'Range loop 6 | Read(Random_Source'class(This),Byte_Array(I)); 7 | end loop; 8 | end Read; 9 | 10 | ---------------------------------------------------------------------- 11 | 12 | procedure Read(This : in out Random_Source; B : out B_Block128) is 13 | begin 14 | for I in B'Range loop 15 | Read(Random_Source'class(This),B(I)); 16 | end loop; 17 | end Read; 18 | 19 | ---------------------------------------------------------------------- 20 | 21 | procedure Read(This : in out Random_Source; W : out Word) is 22 | B : Byte_Word; 23 | begin 24 | This.Read(Bytes(B)); 25 | W := To_Word(B); 26 | end Read; 27 | 28 | ---------------------------------------------------------------------- 29 | 30 | procedure Read(This : in out Random_Source; Word_Array : out Words) is 31 | begin 32 | for I in Word_Array'Range loop 33 | This.Read(Word_Array(I)); 34 | end loop; 35 | end Read; 36 | 37 | ---------------------------------------------------------------------- 38 | 39 | procedure Read(This : in out Random_Source; D : out DWord) is 40 | B : Byte_DWord; 41 | begin 42 | This.Read(Bytes(B)); 43 | D := To_DWord(B); 44 | end Read; 45 | 46 | ---------------------------------------------------------------------- 47 | 48 | procedure Read(This : in out Random_Source; DWord_Array : out DWords) is 49 | begin 50 | for I in DWord_Array'Range loop 51 | This.Read(DWord_Array(I)); 52 | end loop; 53 | end Read; 54 | 55 | end Crypto.Types.Random_Source; 56 | -------------------------------------------------------------------------------- /src/crypto-types-random_source.ads: -------------------------------------------------------------------------------- 1 | with Ada.Finalization; 2 | 3 | package Crypto.Types.Random_Source is 4 | use Crypto.Types; 5 | package Fin renames Ada.Finalization; 6 | 7 | type Random_Source is abstract new Fin.Controlled with null record; 8 | type Random_Source_Access is access Random_Source; 9 | 10 | Random_Source_Read_Error : exception; 11 | 12 | procedure Initialize (This: in out Random_Source) is abstract; 13 | 14 | procedure Read(This : in out Random_Source; B : out Byte) is abstract; 15 | 16 | procedure Read(This : in out Random_Source; Byte_Array : out Bytes); 17 | 18 | procedure Read(This : in out Random_Source; B : out B_Block128); 19 | 20 | procedure Read(This : in out Random_Source; W : out Word); 21 | procedure Read(This : in out Random_Source; Word_Array : out Words); 22 | 23 | procedure Read(This : in out Random_Source; D : out DWord); 24 | procedure Read(This : in out Random_Source; DWord_Array : out DWords); 25 | 26 | pragma Inline(Read); 27 | end Crypto.Types.Random_Source; 28 | -------------------------------------------------------------------------------- /src/crypto-types-xorshiftstar.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | -- All the procedures of this package based on FIPS 180-2 24 | 25 | with Crypto.Types; use Crypto.Types; 26 | with Crypto.Symmetric.Hashfunction; 27 | 28 | 29 | 30 | generic 31 | with package HF is new Crypto.Symmetric.Hashfunction(<>); 32 | 33 | package Crypto.Types.XORShiftSTAR is 34 | 35 | procedure init(Seed : Bytes); 36 | function getValue(bits : Natural) return Integer; 37 | private 38 | r : DW_Block1024; 39 | p : Integer; 40 | 41 | end Crypto.Types.XORShiftSTAR; 42 | -------------------------------------------------------------------------------- /src/crypto.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | 24 | package Crypto is 25 | end Crypto; 26 | -------------------------------------------------------------------------------- /test/.directory: -------------------------------------------------------------------------------- 1 | [Dolphin] 2 | AdditionalInfoV2=Details_Size,Details_Date,CustomizedDetails 3 | Timestamp=2012,1,9,10,16,12 4 | Version=2 5 | ViewMode=1 6 | -------------------------------------------------------------------------------- /test/GMGPL: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | -------------------------------------------------------------------------------- /test/Makefile: -------------------------------------------------------------------------------- 1 | GNATCLEAN=gnatclean 2 | DEL=rm -f 3 | BB = gnatbind 4 | LL = gnatlink 5 | CC = gnatmake 6 | GEN_HTML = tools/gen_coverage_page.sh 7 | 8 | CFLAGS = -W -Werror -ggdb -g -gnat12 -gnato -I../src -O3 -gnatn -gnatwrclp 9 | BFLAGS = -shared -aO./ -aO/lib/ -aO../src -I- -x 10 | LFLAGS = -j 0 -s -z combreloc -dy -x -X -O3 -I../src -aO./ -aO../src -lacl 11 | LFLAGS = -j 0 -s -z combreloc -dy -x -X -O3 -I../src -aO./ -aO../src 12 | 13 | 14 | all : big_number test asymmetric hash symmetric kdf 15 | 16 | 17 | #enable for use of GCOV: 18 | gcov: CFLAGS = -O0 -gnatwrclp -I../src -I../src -I$(AUNIT_DIR) -gnat12 -gnatE -gnatf -gnato -W -Wall -Werror -fprofile-arcs -ftest-coverage -fprofile-arcs -fno-inline 19 | gcov: all 20 | 21 | .PHONY : clean 22 | .SILENT : clean 23 | clean: test-clean aunit-clean 24 | 25 | 26 | #Compile all test-cases/-suites: 27 | test : 28 | $(CC) $(CFLAGS) test-tests 29 | $(BB) $(BFLAGS) test-tests.ali 30 | 31 | #Compile all asymmetric cipher test-cases/-suites 32 | asymmetric : 33 | $(CC) $(CFLAGS) test-asymmetric_ciphers 34 | $(BB) $(BFLAGS) test-asymmetric_ciphers.ali 35 | 36 | #Compile all big_number test-cases/-suites 37 | big_number : 38 | $(CC) $(CFLAGS) test-$@ 39 | $(BB) $(BFLAGS) test-$@.ali 40 | 41 | 42 | #Compile all hash test-cases/-suites and MAC's 43 | hash : 44 | $(CC) $(CFLAGS) test-$@ 45 | $(BB) $(BFLAGS) test-$@.ali 46 | 47 | #Compile all hash test-cases/-suites and MAC's 48 | kdf : 49 | $(CC) $(CFLAGS) test-$@ 50 | $(BB) $(BFLAGS) test-$@.ali 51 | 52 | #Compile all symmetric cipher and blockcipher test-cases/-suites 53 | symmetric : 54 | $(CC) $(CFLAGS) test-symmetric_ciphers 55 | $(BB) $(BFLAGS) test-symmetric_ciphers.ali 56 | 57 | test-clean: 58 | $(GNATCLEAN) *.o *.ali 59 | $(DEL) *.gcno *.gcov *.gcda 60 | $(DEL) -r coverage 61 | $(DEL) *~ 62 | lcov: 63 | $(GEN_HTML) 64 | -------------------------------------------------------------------------------- /test/aunit-test_results-acl.adb: -------------------------------------------------------------------------------- 1 | with Ada.Text_IO; 2 | use Ada.Text_IO; 3 | 4 | package body AUnit.Test_Results.ACL is 5 | 6 | procedure Add_Error 7 | (R : in out ACL_Result; 8 | Test_Name : Message_String; 9 | Routine_Name : Message_String; 10 | Error : Test_Error; 11 | Elapsed : Time) is 12 | begin 13 | Put("U"); 14 | Result(R).Add_Error(Test_Name, Routine_Name, Error, Elapsed); 15 | end Add_Error; 16 | 17 | procedure Add_Failure 18 | (R : in out ACL_Result; 19 | Test_Name : Message_String; 20 | Routine_Name : Message_String; 21 | Failure : Test_Failure; 22 | Elapsed : Time) is 23 | begin 24 | Put("-"); 25 | Result(R).Add_Failure(Test_Name, Routine_Name, Failure, Elapsed); 26 | end Add_Failure; 27 | 28 | 29 | procedure Add_Success 30 | (R : in out ACL_Result; 31 | Test_Name : Message_String; 32 | Routine_Name : Message_String; 33 | Elapsed : Time) is 34 | begin 35 | Put("+"); 36 | Result(R).Add_Success(Test_Name, Routine_Name,Elapsed); 37 | end Add_Success; 38 | end AUnit.Test_Results.ACL; 39 | -------------------------------------------------------------------------------- /test/aunit-test_results-acl.ads: -------------------------------------------------------------------------------- 1 | package AUnit.Test_Results.ACL is 2 | use AUnit.Test_Results; 3 | type ACL_Result is new Result with null record; 4 | 5 | Overriding 6 | procedure Add_Error 7 | (R : in out ACL_Result; 8 | Test_Name : Message_String; 9 | Routine_Name : Message_String; 10 | Error : Test_Error; 11 | Elapsed : Time); 12 | -- Record an unexpected exception 13 | 14 | Overriding 15 | procedure Add_Failure 16 | (R : in out ACL_Result; 17 | Test_Name : Message_String; 18 | Routine_Name : Message_String; 19 | Failure : Test_Failure; 20 | Elapsed : Time); 21 | -- Record a test routine failure 22 | 23 | Overriding 24 | procedure Add_Success 25 | (R : in out ACL_Result; 26 | Test_Name : Message_String; 27 | Routine_Name : Message_String; 28 | Elapsed : Time); 29 | -- Record a test routine success 30 | end AUnit.Test_Results.ACL; 31 | -------------------------------------------------------------------------------- /test/big_number_add_results.ads: -------------------------------------------------------------------------------- 1 | package Big_Number_Add_Results is 2 | 3 | function Result_0 return String; 4 | 5 | function Result_1 return String; 6 | 7 | function Result_2 return String; 8 | 9 | function Result_3 return String; 10 | 11 | function Result_4 return String; 12 | 13 | function Result_5 return String; 14 | 15 | function Result_6 return String; 16 | 17 | function Result_7 return String; 18 | 19 | function Result_8 return String; 20 | 21 | end Big_Number_Add_Results; 22 | -------------------------------------------------------------------------------- /test/big_number_and_results.ads: -------------------------------------------------------------------------------- 1 | package Big_Number_AND_Results is 2 | 3 | function Result_0 return String; 4 | 5 | function Result_1 return String; 6 | 7 | end Big_Number_AND_Results; 8 | -------------------------------------------------------------------------------- /test/big_number_constants.ads: -------------------------------------------------------------------------------- 1 | package Big_Number_Constants is 2 | 3 | function Cons_4096 return String; 4 | 5 | function Cons_4095 return String; 6 | 7 | function Cons_3812 return String; 8 | 9 | function Cons_2048 return String; 10 | 11 | function Cons_1025 return String; 12 | 13 | function Cons_1024 return String; 14 | 15 | function Cons_768 return String; 16 | 17 | function Cons_582 return String; 18 | 19 | end Big_Number_Constants; 20 | -------------------------------------------------------------------------------- /test/big_number_div_results.ads: -------------------------------------------------------------------------------- 1 | package Big_Number_Div_Results is 2 | 3 | function Result_0 return String; 4 | 5 | function Result_1 return String; 6 | 7 | function Result_2 return String; 8 | 9 | function Result_3 return String; 10 | 11 | function Result_4 return String; 12 | 13 | function Result_5 return String; 14 | 15 | end Big_Number_Div_Results; 16 | -------------------------------------------------------------------------------- /test/big_number_exponentiate_results.ads: -------------------------------------------------------------------------------- 1 | package Big_Number_Exponentiate_Results is 2 | 3 | function Result_0 return String; 4 | 5 | function Result_1 return String; 6 | 7 | function Result_2 return String; 8 | 9 | function Result_3 return String; 10 | 11 | function Result_4 return String; 12 | 13 | function Result_5 return String; 14 | 15 | function Result_6 return String; 16 | 17 | end Big_Number_Exponentiate_Results; 18 | -------------------------------------------------------------------------------- /test/big_number_mod_results.ads: -------------------------------------------------------------------------------- 1 | package Big_Number_Mod_Results is 2 | 3 | function Cons_1 return String; 4 | 5 | function Cons_2 return String; 6 | 7 | function Cons_3 return String; 8 | 9 | function Cons_4 return String; 10 | 11 | function Cons_5 return String; 12 | 13 | function Cons_6 return String; 14 | 15 | function Cons_7 return String; 16 | 17 | function Cons_8 return String; 18 | 19 | function Cons_9 return String; 20 | 21 | function Cons_10 return String; 22 | 23 | function Cons_11 return String; 24 | 25 | function Cons_12 return String; 26 | 27 | function Cons_13 return String; 28 | 29 | end Big_Number_Mod_Results; 30 | -------------------------------------------------------------------------------- /test/big_number_mult2_results.ads: -------------------------------------------------------------------------------- 1 | package Big_Number_Mult2_Results is 2 | 3 | function Cons_1 return String; 4 | 5 | function Cons_1_1 return String; 6 | 7 | function Cons_R1 return String; 8 | 9 | function Cons_2 return String; 10 | 11 | function Cons_2_1 return String; 12 | 13 | function Cons_R2 return String; 14 | 15 | function Cons_3 return String; 16 | 17 | function Cons_3_1 return String; 18 | 19 | function Cons_R3 return String; 20 | 21 | function Cons_4 return String; 22 | 23 | function Cons_4_1 return String; 24 | 25 | function Cons_R4 return String; 26 | 27 | function Cons_5 return String; 28 | 29 | function Cons_5_1 return String; 30 | 31 | function Cons_R5 return String; 32 | 33 | function Cons_6 return String; 34 | 35 | function Cons_6_1 return String; 36 | 37 | function Cons_R6 return String; 38 | 39 | function Cons_7 return String; 40 | 41 | function Cons_7_1 return String; 42 | 43 | function Cons_R7 return String; 44 | 45 | function Cons_8 return String; 46 | 47 | function Cons_8_1 return String; 48 | 49 | function Cons_R8 return String; 50 | 51 | function Cons_9 return String; 52 | 53 | function Cons_9_1 return String; 54 | 55 | function Cons_R9 return String; 56 | 57 | end Big_Number_Mult2_Results; 58 | -------------------------------------------------------------------------------- /test/big_number_mult_results.ads: -------------------------------------------------------------------------------- 1 | package Big_Number_Mult_Results is 2 | 3 | function Cons_1 return String; 4 | 5 | function Cons_R1 return String; 6 | 7 | function Cons_2 return String; 8 | 9 | function Cons_R2 return String; 10 | 11 | function Cons_3 return String; 12 | 13 | function Cons_R3 return String; 14 | 15 | function Cons_4 return String; 16 | 17 | function Cons_R4 return String; 18 | 19 | function Cons_5 return String; 20 | 21 | function Cons_R5 return String; 22 | 23 | function Cons_6 return String; 24 | 25 | function Cons_R6 return String; 26 | 27 | function Cons_7 return String; 28 | 29 | function Cons_R7 return String; 30 | 31 | function Cons_8 return String; 32 | 33 | function Cons_R8 return String; 34 | 35 | function Cons_9 return String; 36 | 37 | function Cons_R9 return String; 38 | 39 | end Big_Number_Mult_Results; 40 | -------------------------------------------------------------------------------- /test/big_number_or_results.ads: -------------------------------------------------------------------------------- 1 | package Big_Number_OR_Results is 2 | 3 | function Result_0 return String; 4 | 5 | function Result_1 return String; 6 | 7 | end Big_Number_OR_Results; 8 | -------------------------------------------------------------------------------- /test/big_number_sub_results.ads: -------------------------------------------------------------------------------- 1 | package Big_Number_Sub_Results is 2 | 3 | function Result_0 return String; 4 | 5 | function Result_1 return String; 6 | 7 | function Result_2 return String; 8 | 9 | function Result_3 return String; 10 | 11 | function Result_4 return String; 12 | 13 | function Result_5 return String; 14 | 15 | end Big_Number_Sub_Results; 16 | -------------------------------------------------------------------------------- /test/big_number_xor_results.ads: -------------------------------------------------------------------------------- 1 | package Big_Number_XOR_Results is 2 | 3 | function Result_0 return String; 4 | 5 | function Result_1 return String; 6 | 7 | function Result_2 return String; 8 | 9 | end Big_Number_XOR_Results; 10 | -------------------------------------------------------------------------------- /test/crypto-symmetric-kdf_sha512crypt-testing.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | with Crypto.Symmetric.Algorithm.SHA512; 24 | 25 | 26 | package Crypto.Symmetric.KDF_SHA512Crypt.Testing is 27 | 28 | 29 | --Adding Bytes to Digest 30 | procedure Add_Bytes_Testing 31 | (Bytes_To_Add : in Bytes; 32 | Digest_Bytes : in out Bytes; 33 | Digest_Bytes_Length : in out Natural; 34 | Digest_Hash : in out Crypto.Symmetric.Algorithm.SHA512.Sha512_Context); 35 | 36 | end Crypto.Symmetric.KDF_SHA512Crypt.Testing; 37 | -------------------------------------------------------------------------------- /test/gcov_compilation.txt: -------------------------------------------------------------------------------- 1 | gcov test-big_number_comp test-big_number_mod_type_comp_and_add test-big_number_mod_types test-big_number_min_max (bis 373) 2 | 3 | gcov test-big_number_add test-big_number_and test-big_number_div test-big_number_exponentiate test-big_number_mod test-big_number_mult2 test-big_number_multiplication test-big_number_or test-big_number_sub test-big_number_xor 4 | 5 | gcov test-big_number_dec test-big_number_inc test-big_number_iseven test-big_number_isodd test-big_number_swap test-big_number_lsb test-big_number_msb 6 | gcov test-big_number_sl test-big_number_sr test-big_numbers_utils 7 | 8 | test-big_number_rl 9 | 10 | gcov test-big_number_b_add test-big_number_b_div test-big_number_b_mult test-big_number_b_sub 11 | 12 | gcov test-big_number_add_mod_utils test-big_number_div_mod_utils test-big_number_inv_mod_utils test-big_number_lprime_mod_utils test-big_number_mr_mod_utils test-big_number_mult_mod_utils test-big_number_pow_mod_utils test-big_number_prime_mod_utils test-big_number_rand_mod_utils test-big_number_sub_mod_utils 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/hash_message1.txt: -------------------------------------------------------------------------------- 1 | abc -------------------------------------------------------------------------------- /test/hash_message2.txt: -------------------------------------------------------------------------------- 1 | abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq -------------------------------------------------------------------------------- /test/hash_message4.txt: -------------------------------------------------------------------------------- 1 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -------------------------------------------------------------------------------- /test/hash_message5.txt: -------------------------------------------------------------------------------- 1 | abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu -------------------------------------------------------------------------------- /test/hash_message6.txt: -------------------------------------------------------------------------------- 1 | ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 -------------------------------------------------------------------------------- /test/hash_message7.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/message.txt: -------------------------------------------------------------------------------- 1 | All your base are belong to us! 2 | -------------------------------------------------------------------------------- /test/test-ae_ocb.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.AE_OCB is 5 | use AUnit; 6 | 7 | type OCB_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out OCB_Test); 10 | 11 | function Name(T: OCB_Test) return Test_String; 12 | 13 | procedure OCB_Test1(T: in out Test_Cases.Test_Case'Class); 14 | 15 | end Test.AE_OCB; 16 | -------------------------------------------------------------------------------- /test/test-aes128.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.AES128 is 5 | use AUnit; 6 | type AES_Test is new Test_Cases.Test_Case with null record; 7 | 8 | procedure Register_Tests(T: in out AES_Test); 9 | 10 | function Name(T: AES_Test) return Test_String; 11 | 12 | procedure AES128_Test1(T: in out Test_Cases.Test_Case'Class); 13 | end Test.AES128; 14 | -------------------------------------------------------------------------------- /test/test-aes192.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.AES192 is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type AES_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out AES_Test); 12 | 13 | function Name(T: AES_Test) return Test_String; 14 | 15 | procedure AES192_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | end Test.AES192; 18 | -------------------------------------------------------------------------------- /test/test-aes256.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.AES256 is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type AES_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out AES_Test); 12 | 13 | function Name(T: AES_Test) return Test_String; 14 | 15 | procedure AES256_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | end Test.AES256; 18 | -------------------------------------------------------------------------------- /test/test-aes_oneway.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.Aes_Oneway is 5 | use AUnit; 6 | 7 | type Aes_Oneway_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out Aes_Oneway_Test); 10 | 11 | function Name(T: Aes_Oneway_Test) return Test_String; 12 | 13 | procedure Aes_Oneway_Test1921(T: in out Test_Cases.Test_Case'Class); 14 | procedure Aes_Oneway_Test1922(T: in out Test_Cases.Test_Case'Class); 15 | procedure Aes_Oneway_Test2561(T: in out Test_Cases.Test_Case'Class); 16 | procedure Aes_Oneway_Test2562(T: in out Test_Cases.Test_Case'Class); 17 | end Test.Aes_Oneway; 18 | -------------------------------------------------------------------------------- /test/test-asymmetric_ciphers.adb: -------------------------------------------------------------------------------- 1 | with Test.Suite_Asymmetric_Ciphers; 2 | with Test.Suite_Elliptic_Curves; 3 | with AUnit.Run; 4 | with AUnit.Reporter.Text; 5 | with Crypto.Types.Random_Source.Provider; 6 | with Crypto.Types.Random; 7 | with AUnit.Test_Results.ACL; 8 | 9 | 10 | procedure Test.Asymmetric_Ciphers is 11 | procedure Run_Asymmetric_Ciphers is new 12 | AUnit.Run.Test_Runner_With_Results(Test.Suite_Asymmetric_Ciphers.Suite); 13 | procedure Run_Elliptic_Curves is new 14 | AUnit.Run.Test_Runner_With_Results(Test.Suite_Elliptic_Curves.Suite); 15 | Reporter : AUnit.Reporter.Text.Text_Reporter; 16 | Results : AUnit.Test_Results.ACl.ACL_Result; 17 | 18 | use Crypto.Types.Random_Source.Provider; 19 | Dev_U_Rand : Random_Source_Provider; 20 | begin 21 | Dev_U_Rand.Initialize("/dev/urandom"); 22 | Crypto.Types.Random.Set(Dev_U_Rand); 23 | Run_Asymmetric_Ciphers(Reporter, Results); 24 | Run_Elliptic_Curves(Reporter, Results); 25 | end Test.Asymmetric_Ciphers; 26 | -------------------------------------------------------------------------------- /test/test-base64.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Crypto.Types.Base64; 4 | 5 | package Test.Base64 is 6 | use AUnit; 7 | 8 | type Base64_Character is 9 | ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 10 | 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 11 | 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 12 | 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', 13 | '4', '5', '6', '7', '8' ,'9', '+', '/', '='); 14 | 15 | package Base64 is new Crypto.Types.Base64 16 | (Base64_Character => Base64_Character); 17 | 18 | type Base64_Test is new Test_Cases.Test_Case with null record; 19 | 20 | procedure Register_Tests(T: in out Base64_Test); 21 | 22 | function Name(T: Base64_Test) return Test_String; 23 | 24 | procedure Base64_Rest0_Test(T: in out Test_Cases.Test_Case'Class); 25 | 26 | procedure Base64_Rest1_Test(T: in out Test_Cases.Test_Case'Class); 27 | 28 | procedure Base64_Rest2_Test(T: in out Test_Cases.Test_Case'Class); 29 | end Test.Base64; 30 | -------------------------------------------------------------------------------- /test/test-big_number.adb: -------------------------------------------------------------------------------- 1 | with Test.Suite_Big_Num_All; 2 | with AUnit.Run; 3 | with AUnit.Reporter.Text; 4 | with Crypto.Types.Random; 5 | with AUnit.Test_Results.ACL; 6 | with Crypto.Types.Random_Source.Provider; 7 | 8 | procedure Test.Big_Number is 9 | procedure Run is new AUnit.Run.Test_Runner_With_Results(Test.Suite_Big_Num_All.Suite); 10 | Reporter : AUnit.Reporter.Text.Text_Reporter; 11 | Results : AUnit.Test_Results.ACl.ACL_Result; 12 | 13 | use Crypto.Types.Random_Source.Provider; 14 | Dev_U_Rand : Random_Source_Provider; 15 | 16 | begin 17 | Dev_U_Rand.Initialize("/dev/urandom"); 18 | Crypto.Types.Random.Set(Dev_U_Rand); 19 | Run(Reporter, Results); 20 | end Test.Big_Number; 21 | -------------------------------------------------------------------------------- /test/test-big_number_add.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.Big_Number_Add is 5 | use AUnit; 6 | 7 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Constants; 10 | 11 | procedure Register_Tests(T: in out Big_Number_Test); 12 | 13 | function Name(T: Big_Number_Test) return Test_String; 14 | 15 | procedure Big_Number_Add_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure Big_Number_Add_Test2(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Add_Test3(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Add_Test4(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Add_Test5(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Add_Test6(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Add_Test7(T: in out Test_Cases.Test_Case'Class); 28 | end Test.Big_Number_Add; 29 | -------------------------------------------------------------------------------- /test/test-big_number_add_mod_utils.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.Big_Number_Add_Mod_Utils is 5 | use AUnit; 6 | 7 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Results; 10 | 11 | procedure Register_Tests(T: in out Big_Number_Test); 12 | 13 | function Name(T: Big_Number_Test) return Test_String; 14 | 15 | procedure Big_Number_Mod_Utils_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure Big_Number_Mod_Utils_Test2(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Mod_Utils_Test3(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Mod_Utils_Test4(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Mod_Utils_Test5(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Mod_Utils_Test6(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Mod_Utils_Test7(T: in out Test_Cases.Test_Case'Class); 28 | 29 | end Test.Big_Number_Add_Mod_Utils; 30 | -------------------------------------------------------------------------------- /test/test-big_number_and.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.Big_Number_AND is 5 | use AUnit; 6 | 7 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Constants; 10 | 11 | procedure Register_Tests(T: in out Big_Number_Test); 12 | 13 | function Name(T: Big_Number_Test) return Test_String; 14 | 15 | procedure Big_Number_AND_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure Big_Number_AND_Test2(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_AND_Test3(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_AND_Test4(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_AND_Test5(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_AND_Test6(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_AND_Test7(T: in out Test_Cases.Test_Case'Class); 28 | 29 | end Test.Big_Number_AND; 30 | -------------------------------------------------------------------------------- /test/test-big_number_b_add.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_B_Add is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Results; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Mod_Utils_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Mod_Utils_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Mod_Utils_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Mod_Utils_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Mod_Utils_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Mod_Utils_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number_Mod_Utils_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_B_Add; 32 | -------------------------------------------------------------------------------- /test/test-big_number_b_div.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.Big_Number_B_Div is 5 | use AUnit; 6 | 7 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Results; 10 | 11 | procedure Register_Tests(T: in out Big_Number_Test); 12 | 13 | function Name(T: Big_Number_Test) return Test_String; 14 | 15 | procedure Big_Number_Mod_Utils_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | -- procedure Big_Number_Mod_Utils_Test2(T: in out Test_Cases.Test_Case'Class); 18 | -- 19 | -- procedure Big_Number_Mod_Utils_Test3(T: in out Test_Cases.Test_Case'Class); 20 | -- 21 | -- procedure Big_Number_Mod_Utils_Test4(T: in out Test_Cases.Test_Case'Class); 22 | -- 23 | -- procedure Big_Number_Mod_Utils_Test5(T: in out Test_Cases.Test_Case'Class); 24 | -- 25 | -- procedure Big_Number_Mod_Utils_Test6(T: in out Test_Cases.Test_Case'Class); 26 | -- 27 | -- procedure Big_Number_Mod_Utils_Test7(T: in out Test_Cases.Test_Case'Class); 28 | 29 | end Test.Big_Number_B_Div; 30 | -------------------------------------------------------------------------------- /test/test-big_number_b_mult.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_B_Mult is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Results; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Mod_Utils_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Mod_Utils_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Mod_Utils_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Mod_Utils_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Mod_Utils_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Mod_Utils_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number_Mod_Utils_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_B_Mult; 32 | -------------------------------------------------------------------------------- /test/test-big_number_b_sub.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_B_Sub is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Results; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Mod_Utils_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Mod_Utils_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Mod_Utils_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Mod_Utils_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Mod_Utils_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Mod_Utils_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number_Mod_Utils_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_B_Sub; 32 | -------------------------------------------------------------------------------- /test/test-big_number_comp.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Comp is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Constants; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Comp_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Comp_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Comp_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Comp_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Comp_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | end Test.Big_Number_Comp; 28 | -------------------------------------------------------------------------------- /test/test-big_number_dec.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Dec is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Big_Number_Test); 12 | 13 | function Name(T: Big_Number_Test) return Test_String; 14 | 15 | procedure Constants; 16 | 17 | procedure Big_Number_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | end Test.Big_Number_Dec; 26 | -------------------------------------------------------------------------------- /test/test-big_number_div.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Div is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Constants; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Div_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Div_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Div_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Div_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Div_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Div_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number_Div_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_Div; 32 | -------------------------------------------------------------------------------- /test/test-big_number_div_mod_utils.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Div_Mod_Utils is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Results; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Mod_Utils_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Mod_Utils_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Mod_Utils_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Mod_Utils_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Mod_Utils_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Mod_Utils_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number_Mod_Utils_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_Div_Mod_Utils; 32 | -------------------------------------------------------------------------------- /test/test-big_number_exponentiate.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Exponentiate is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Constants; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Exponentiate_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Exponentiate_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Exponentiate_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Exponentiate_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Exponentiate_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Exponentiate_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number_Exponentiate_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_Exponentiate; 32 | -------------------------------------------------------------------------------- /test/test-big_number_inc.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Inc is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Big_Number_Test); 12 | 13 | function Name(T: Big_Number_Test) return Test_String; 14 | 15 | procedure Constants; 16 | 17 | procedure Big_Number_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | end Test.Big_Number_Inc; 28 | -------------------------------------------------------------------------------- /test/test-big_number_inv_mod_utils.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Inv_Mod_Utils is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Results; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Mod_Utils_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Mod_Utils_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Mod_Utils_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Mod_Utils_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Mod_Utils_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Mod_Utils_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number_Mod_Utils_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_Inv_Mod_Utils; 32 | -------------------------------------------------------------------------------- /test/test-big_number_iseven.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_IsEven is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Big_Number_Test); 12 | 13 | function Name(T: Big_Number_Test) return Test_String; 14 | 15 | procedure Constants; 16 | 17 | procedure Big_Number_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | end Test.Big_Number_IsEven; 30 | -------------------------------------------------------------------------------- /test/test-big_number_isodd.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_IsOdd is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Big_Number_Test); 12 | 13 | function Name(T: Big_Number_Test) return Test_String; 14 | 15 | procedure Constants; 16 | 17 | procedure Big_Number_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | end Test.Big_Number_IsOdd; 30 | -------------------------------------------------------------------------------- /test/test-big_number_lprime_mod_utils.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_LPrime_Mod_Utils is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Results; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Mod_Utils_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | -- procedure Big_Number_Mod_Utils_Test2(T: in out Test_Cases.Test_Case'Class); 20 | -- 21 | -- procedure Big_Number_Mod_Utils_Test3(T: in out Test_Cases.Test_Case'Class); 22 | -- 23 | -- procedure Big_Number_Mod_Utils_Test4(T: in out Test_Cases.Test_Case'Class); 24 | -- 25 | -- procedure Big_Number_Mod_Utils_Test5(T: in out Test_Cases.Test_Case'Class); 26 | -- 27 | -- procedure Big_Number_Mod_Utils_Test6(T: in out Test_Cases.Test_Case'Class); 28 | -- 29 | -- procedure Big_Number_Mod_Utils_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_LPrime_Mod_Utils; 32 | -------------------------------------------------------------------------------- /test/test-big_number_lsb.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_LSB is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Big_Number_Test); 12 | 13 | function Name(T: Big_Number_Test) return Test_String; 14 | 15 | procedure Constants; 16 | 17 | procedure Big_Number_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | end Test.Big_Number_LSB; 20 | -------------------------------------------------------------------------------- /test/test-big_number_min_max.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Min_Max is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Constants; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Min(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Max(T: in out Test_Cases.Test_Case'Class); 20 | 21 | end Test.Big_Number_Min_Max; 22 | -------------------------------------------------------------------------------- /test/test-big_number_mod.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Mod is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Constants; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Mod_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Mod_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Mod_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Mod_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Mod_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Mod_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number_Mod_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_Mod; 32 | -------------------------------------------------------------------------------- /test/test-big_number_mod_type_comp_and_add.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Mod_Type_Comp_and_Add is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Constants; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Mod_Type_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Mod_Type_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Mod_Type_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Mod_Type_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Mod_Type_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Mod_Type_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number_Mod_Type_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | procedure Big_Number_Mod_Type_Test8(T: in out Test_Cases.Test_Case'Class); 32 | 33 | procedure Big_Number_Mod_Type_Test9(T: in out Test_Cases.Test_Case'Class); 34 | 35 | procedure Big_Number_Mod_Type_Test10(T: in out Test_Cases.Test_Case'Class); 36 | 37 | procedure Big_Number_Mod_Type_Test11(T: in out Test_Cases.Test_Case'Class); 38 | 39 | procedure Big_Number_Mod_Type_Test12(T: in out Test_Cases.Test_Case'Class); 40 | 41 | end Test.Big_Number_Mod_Type_Comp_and_Add; 42 | -------------------------------------------------------------------------------- /test/test-big_number_mod_types.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Mod_Types is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Constants; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Mod_Type_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Mod_Type_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Mod_Type_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Mod_Type_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Mod_Type_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Mod_Type_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number_Mod_Type_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_Mod_Types; 32 | -------------------------------------------------------------------------------- /test/test-big_number_mr_mod_utils.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_MR_Mod_Utils is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Results; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Mod_Utils_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | -- procedure Big_Number_Mod_Utils_Test2(T: in out Test_Cases.Test_Case'Class); 20 | -- 21 | -- procedure Big_Number_Mod_Utils_Test3(T: in out Test_Cases.Test_Case'Class); 22 | -- 23 | -- procedure Big_Number_Mod_Utils_Test4(T: in out Test_Cases.Test_Case'Class); 24 | -- 25 | -- procedure Big_Number_Mod_Utils_Test5(T: in out Test_Cases.Test_Case'Class); 26 | -- 27 | -- procedure Big_Number_Mod_Utils_Test6(T: in out Test_Cases.Test_Case'Class); 28 | -- 29 | -- procedure Big_Number_Mod_Utils_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_MR_Mod_Utils; 32 | -------------------------------------------------------------------------------- /test/test-big_number_msb.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_MSB is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Big_Number_Test); 12 | 13 | function Name(T: Big_Number_Test) return Test_String; 14 | 15 | procedure Constants; 16 | 17 | procedure Big_Number_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | end Test.Big_Number_MSB; 20 | -------------------------------------------------------------------------------- /test/test-big_number_mult2.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Mult2 is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Big_Number_Test); 12 | 13 | function Name(T: Big_Number_Test) return Test_String; 14 | 15 | procedure Big_Number_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure Big_Number_Test2(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Test3(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Test4(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Test5(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Test6(T: in out Test_Cases.Test_Case'Class); 26 | 27 | end Test.Big_Number_Mult2; 28 | -------------------------------------------------------------------------------- /test/test-big_number_mult_mod_utils.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Mult_Mod_Utils is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Results; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Mod_Utils_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Mod_Utils_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Mod_Utils_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Mod_Utils_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Mod_Utils_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Mod_Utils_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number_Mod_Utils_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_Mult_Mod_Utils; 32 | -------------------------------------------------------------------------------- /test/test-big_number_multiplication.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Multiplication is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Big_Number_Test); 12 | 13 | function Name(T: Big_Number_Test) return Test_String; 14 | 15 | procedure Results; 16 | 17 | procedure Big_Number_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_Multiplication; 32 | -------------------------------------------------------------------------------- /test/test-big_number_or.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_OR is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Constants; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_OR_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_OR_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_OR_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_OR_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_OR_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_OR_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number_OR_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_OR; 32 | -------------------------------------------------------------------------------- /test/test-big_number_pow_mod_utils.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Pow_Mod_Utils is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Results; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Mod_Utils_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Mod_Utils_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Mod_Utils_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Mod_Utils_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Mod_Utils_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Mod_Utils_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number_Mod_Utils_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_Pow_Mod_Utils; 32 | -------------------------------------------------------------------------------- /test/test-big_number_prime_mod_utils.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Prime_Mod_Utils is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Results; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Mod_Utils_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | -- procedure Big_Number_Mod_Utils_Test2(T: in out Test_Cases.Test_Case'Class); 20 | -- 21 | -- procedure Big_Number_Mod_Utils_Test3(T: in out Test_Cases.Test_Case'Class); 22 | -- 23 | -- procedure Big_Number_Mod_Utils_Test4(T: in out Test_Cases.Test_Case'Class); 24 | -- 25 | -- procedure Big_Number_Mod_Utils_Test5(T: in out Test_Cases.Test_Case'Class); 26 | -- 27 | -- procedure Big_Number_Mod_Utils_Test6(T: in out Test_Cases.Test_Case'Class); 28 | -- 29 | -- procedure Big_Number_Mod_Utils_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_Prime_Mod_Utils; 32 | -------------------------------------------------------------------------------- /test/test-big_number_rand_mod_utils.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Rand_Mod_Utils is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Results; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Mod_Utils_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Mod_Utils_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Mod_Utils_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Mod_Utils_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Mod_Utils_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Mod_Utils_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number_Mod_Utils_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_Rand_Mod_Utils; 32 | -------------------------------------------------------------------------------- /test/test-big_number_rl.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_RL is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Big_Number_Test); 12 | 13 | function Name(T: Big_Number_Test) return Test_String; 14 | 15 | procedure Constants; 16 | 17 | procedure Big_Number_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | end Test.Big_Number_RL; 28 | -------------------------------------------------------------------------------- /test/test-big_number_sl.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_SL is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Big_Number_Test); 12 | 13 | function Name(T: Big_Number_Test) return Test_String; 14 | 15 | procedure Constants; 16 | 17 | procedure Big_Number_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | end Test.Big_Number_SL; 28 | -------------------------------------------------------------------------------- /test/test-big_number_sr.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_SR is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Big_Number_Test); 12 | 13 | function Name(T: Big_Number_Test) return Test_String; 14 | 15 | procedure Constants; 16 | 17 | procedure Big_Number_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | end Test.Big_Number_SR; 28 | -------------------------------------------------------------------------------- /test/test-big_number_sub.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Sub is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Constants; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number5_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number5_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number5_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number5_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number5_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number5_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number5_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_Sub; 32 | -------------------------------------------------------------------------------- /test/test-big_number_sub_mod_utils.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Sub_Mod_Utils is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Results; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_Mod_Utils_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Mod_Utils_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Mod_Utils_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Mod_Utils_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Mod_Utils_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Mod_Utils_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number_Mod_Utils_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_Sub_Mod_Utils; 32 | -------------------------------------------------------------------------------- /test/test-big_number_swap.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_Swap is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Big_Number_Test); 12 | 13 | function Name(T: Big_Number_Test) return Test_String; 14 | 15 | procedure Constants; 16 | 17 | procedure Big_Number_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | end Test.Big_Number_Swap; 26 | -------------------------------------------------------------------------------- /test/test-big_number_xor.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Big_Number_XOR is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Constants; 12 | 13 | procedure Register_Tests(T: in out Big_Number_Test); 14 | 15 | function Name(T: Big_Number_Test) return Test_String; 16 | 17 | procedure Big_Number_XOR_Test1(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_XOR_Test2(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_XOR_Test3(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_XOR_Test4(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_XOR_Test5(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_XOR_Test6(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number_XOR_Test7(T: in out Test_Cases.Test_Case'Class); 30 | 31 | end Test.Big_Number_XOR; 32 | -------------------------------------------------------------------------------- /test/test-big_numbers_division.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.Big_numbers_division is 5 | use AUnit; 6 | 7 | type Big_numbers_division_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out Big_numbers_division_Test); 10 | 11 | function Name(T: Big_numbers_division_Test) return Test_String; 12 | 13 | procedure Big_numbers_division_Test1(T: in out Test_Cases.Test_Case'Class); 14 | 15 | 16 | end Test.Big_numbers_division; 17 | -------------------------------------------------------------------------------- /test/test-big_numbers_utils.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.Big_Numbers_Utils is 5 | use AUnit; 6 | 7 | type Big_Number_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out Big_Number_Test); 10 | 11 | function Name(T: Big_Number_Test) return Test_String; 12 | 13 | procedure Big_Number_Test_Rotate_Left(T: in out Test_Cases.Test_Case'Class); 14 | 15 | procedure Big_Number_Test_Rotate_Right(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure Big_Number_Test_Random(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Big_Number_Test_Bit_Length(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Big_Number_Test_LSB(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Big_Number_Test_Length_In_Bytes(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Big_Number_Test_Gcd(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Big_Number_Test_To_Bytes(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Big_Number_Test_To_Mod_Types(T: in out Test_Cases.Test_Case'Class); 30 | 31 | procedure Big_Number_Test_To_String(T: in out Test_Cases.Test_Case'Class); 32 | 33 | procedure Big_Number_Test_Put(T: in out Test_Cases.Test_Case'Class); 34 | 35 | procedure Big_Number_Test_Big_Div(T: in out Test_Cases.Test_Case'Class); 36 | 37 | procedure Big_Number_Test_Short_Div(T: in out Test_Cases.Test_Case'Class); 38 | 39 | end Test.Big_Numbers_Utils; 40 | -------------------------------------------------------------------------------- /test/test-blowfish.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Blowfish is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Blowfish128_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Blowfish128_Test); 12 | 13 | function Name(T: Blowfish128_Test) return Test_String; 14 | 15 | procedure Blowfish_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure Blowfish_Test2(T: in out Test_Cases.Test_Case'Class); 18 | 19 | end Test.Blowfish; 20 | -------------------------------------------------------------------------------- /test/test-blowfish_oneway.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.Blowfish_Oneway is 5 | use AUnit; 6 | 7 | type Blowfish_Oneway_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out Blowfish_Oneway_Test); 10 | 11 | function Name(T: Blowfish_Oneway_Test) return Test_String; 12 | 13 | procedure Blowfish_Oneway_Test1(T: in out Test_Cases.Test_Case'Class); 14 | procedure Blowfish_Oneway_Test2(T: in out Test_Cases.Test_Case'Class); 15 | 16 | end Test.Blowfish_Oneway; 17 | -------------------------------------------------------------------------------- /test/test-bps_mode.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.BPS_Mode is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type BPS_Mode_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out BPS_Mode_Test); 12 | 13 | function Name(T: BPS_Mode_Test) return Test_String; 14 | 15 | procedure BPS_Mode_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure BPS_Mode_Test2(T: in out Test_Cases.Test_Case'Class); 18 | 19 | end Test.BPS_Mode; 20 | -------------------------------------------------------------------------------- /test/test-catena.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | 5 | package Test.Catena is 6 | use AUnit; 7 | 8 | type Catena_Test is new Test_Cases.Test_Case with null record; 9 | 10 | procedure Register_Tests(T: in out Catena_Test); 11 | 12 | function Name(T: Catena_Test) return Test_String; 13 | 14 | procedure Catena_Test_XORShift(T: in out Test_Cases.Test_Case'Class); 15 | procedure Catena_Test_Bitreverse(T: in out Test_Cases.Test_Case'Class); 16 | procedure Catena_Test_CFAES(T: in out Test_Cases.Test_Case'Class); 17 | procedure Catena_Test_Interface(T: in out Test_Cases.Test_Case'Class); 18 | procedure Catena_Test_SHA512(T: in out Test_Cases.Test_Case'Class); 19 | procedure Catena_Test_B2b1(T: in out Test_Cases.Test_Case'Class); 20 | procedure Catena_Test_B2b1Bla(T: in out Test_Cases.Test_Case'Class); 21 | procedure Catena_Test_GR(T: in out Test_Cases.Test_Case'Class); 22 | procedure Catena_Test_Pcompress(T: in out Test_Cases.Test_Case'Class); 23 | procedure Catena_Test_ArgonCF(T: in out Test_Cases.Test_Case'Class); 24 | procedure Catena_Test_Keyed(T: in out Test_Cases.Test_Case'Class); 25 | 26 | -- procedure Catena_Test_Debugging(T: in out Test_Cases.Test_Case'Class); 27 | -- procedure Catena_Test_Flap_DBG(T: in out Test_Cases.Test_Case'Class); 28 | -- procedure Catena_Test_Flap_BRG(T: in out Test_Cases.Test_Case'Class); 29 | -- procedure Catena_Test_Catena_BRG(T: in out Test_Cases.Test_Case'Class); 30 | -- procedure Catena_Test_Catena_DBG(T: in out Test_Cases.Test_Case'Class); 31 | -- procedure Catena_Test_HashFast(T: in out Test_Cases.Test_Case'Class); 32 | end Test.Catena; 33 | -------------------------------------------------------------------------------- /test/test-cbc_mode.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.CBC_Mode is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Mode_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Mode_Test); 12 | 13 | function Name(T: Mode_Test) return Test_String; 14 | 15 | procedure CBC_Mode_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | end Test.CBC_Mode; 18 | -------------------------------------------------------------------------------- /test/test-cfb_mode.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.CFB_Mode is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Mode_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Mode_Test); 12 | 13 | function Name(T: Mode_Test) return Test_String; 14 | 15 | procedure CFB_Mode_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | end Test.CFB_Mode; 18 | -------------------------------------------------------------------------------- /test/test-cfb_oneway_mode.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.CFB_Oneway_Mode is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Mode_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Mode_Test); 12 | 13 | function Name(T: Mode_Test) return Test_String; 14 | 15 | procedure CFB_Oneway_Mode_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | end Test.CFB_Oneway_Mode; 18 | -------------------------------------------------------------------------------- /test/test-cmac.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.CMAC is 5 | use AUnit; 6 | 7 | type CMAC_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out CMAC_Test); 10 | 11 | function Name(T: CMAC_Test) return Test_String; 12 | 13 | procedure CMAC_Test1(T: in out Test_Cases.Test_Case'Class); 14 | 15 | procedure CMAC_Test2(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure CMAC_Test3(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure CMAC_Test4(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure CMAC_Test5(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure CMAC_Test6(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure CMAC_Test7(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure CMAC_Test8(T: in out Test_Cases.Test_Case'Class); 28 | 29 | end Test.CMAC; 30 | -------------------------------------------------------------------------------- /test/test-counter_generator.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | use AUnit; 3 | with AUnit.Test_Cases; 4 | use AUnit.Test_Cases; 5 | 6 | 7 | package Test.Counter_Generator is 8 | 9 | type Test_Counter_Generator is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests (T: in out Test_Counter_Generator); 12 | 13 | function Name (T: Test_Counter_Generator) return Message_String; 14 | 15 | procedure Counter_Generator_Test1 (T : in out Test_Cases.Test_Case'Class); 16 | 17 | end Test.Counter_Generator; 18 | -------------------------------------------------------------------------------- /test/test-ctr_mode.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.CTR_Mode is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Mode_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Mode_Test); 12 | 13 | function Name(T: Mode_Test) return Test_String; 14 | 15 | procedure CTR_Mode_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | end Test.CTR_Mode; 18 | -------------------------------------------------------------------------------- /test/test-ctr_oneway_mode.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.CTR_Oneway_Mode is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Mode_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Mode_Test); 12 | 13 | function Name(T: Mode_Test) return Test_String; 14 | 15 | procedure CTR_Oneway_Mode_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | end Test.CTR_Oneway_Mode; 18 | -------------------------------------------------------------------------------- /test/test-dsa.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.DSA is 5 | use AUnit; 6 | 7 | type DSA_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out DSA_Test); 10 | 11 | function Name(T: DSA_Test) return Test_String; 12 | 13 | procedure DSA_Test1(T: in out Test_Cases.Test_Case'Class); 14 | 15 | procedure DSA_Test2(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure DSA_Test3(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure DSA_Test4(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure DSA_Test5(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure DSA_Test6(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure DSA_Test7(T: in out Test_Cases.Test_Case'Class); 26 | 27 | end Test.DSA; 28 | -------------------------------------------------------------------------------- /test/test-ecdh.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.ECDH is 5 | use AUnit; 6 | 7 | type ECDH_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out ECDH_Test); 10 | 11 | function Name(T: ECDH_Test) return Test_String; 12 | 13 | procedure ECDH_Test1(T: in out Test_Cases.Test_Case'Class); 14 | 15 | end Test.ECDH; 16 | -------------------------------------------------------------------------------- /test/test-ecdsa.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.ECDSA is 5 | use AUnit; 6 | 7 | type ECDSA_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out ECDSA_Test); 10 | 11 | function Name(T: ECDSA_Test) return Test_String; 12 | 13 | procedure ECDSA_Test1(T: in out Test_Cases.Test_Case'Class); 14 | 15 | procedure ECDSA_Test2(T: in out Test_Cases.Test_Case'Class); 16 | 17 | end Test.ECDSA; 18 | -------------------------------------------------------------------------------- /test/test-ecies.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.ECIES is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type ECIES_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out ECIES_Test); 12 | 13 | function Name(T: ECIES_Test) return Test_String; 14 | 15 | procedure ECIES_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | end Test.ECIES; 18 | -------------------------------------------------------------------------------- /test/test-elliptic_curves.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.Elliptic_curves is 5 | use AUnit; 6 | 7 | type Elliptic_curves_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out Elliptic_curves_Test); 10 | 11 | function Name(T: Elliptic_curves_Test) return Test_String; 12 | 13 | procedure Elliptic_curves_Test1(T: in out Test_Cases.Test_Case'Class); 14 | procedure Elliptic_curves_Test5(T: in out Test_Cases.Test_Case'Class); 15 | procedure Elliptic_curves_Put(T: in out Test_Cases.Test_Case'Class); 16 | 17 | end Test.Elliptic_curves; 18 | -------------------------------------------------------------------------------- /test/test-elliptic_curves_nss_bf.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Elliptic_Curves_NSS_BF is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Elliptic_Curves_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Elliptic_Curves_Test); 12 | 13 | function Name(T: Elliptic_Curves_Test) return Test_String; 14 | 15 | procedure Elliptic_Curves_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure Elliptic_Curves_Test2(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Elliptic_Curves_Test3(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Elliptic_Curves_Test4(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Elliptic_Curves_Test5(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Elliptic_Curves_Test6(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Elliptic_Curves_Test7(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Elliptic_Curves_Test8(T: in out Test_Cases.Test_Case'Class); 30 | 31 | procedure Elliptic_Curves_Test9(T: in out Test_Cases.Test_Case'Class); 32 | 33 | end Test.Elliptic_Curves_NSS_BF; 34 | -------------------------------------------------------------------------------- /test/test-elliptic_curves_zp.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Elliptic_Curves_ZP is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Elliptic_Curves_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Elliptic_Curves_Test); 12 | 13 | function Name(T: Elliptic_Curves_Test) return Test_String; 14 | 15 | procedure Elliptic_Curves_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure Elliptic_Curves_Test2(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Elliptic_Curves_Test3(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Elliptic_Curves_Test4(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Elliptic_Curves_Test5(T: in out Test_Cases.Test_Case'Class); 24 | 25 | end Test.Elliptic_Curves_ZP; 26 | -------------------------------------------------------------------------------- /test/test-hash.adb: -------------------------------------------------------------------------------- 1 | with Test.Suite_Hash_Function; 2 | with Test.Suite_MAC; 3 | with AUnit.Run; 4 | with AUnit.Reporter.Text; 5 | with Crypto.Types.Random_Source.Provider; 6 | with Crypto.Types.Random; 7 | 8 | procedure Test.HASH is 9 | procedure Run_HASH is new AUnit.Run.Test_Runner(Test.Suite_Hash_Function.Suite); 10 | procedure Run_MAC is new AUnit.Run.Test_Runner(Test.Suite_MAC.Suite); 11 | Reporter : AUnit.Reporter.Text.Text_Reporter; 12 | 13 | use Crypto.Types.Random_Source.Provider; 14 | Dev_U_Rand : Random_Source_Provider; 15 | 16 | begin 17 | Dev_U_Rand.Initialize("/dev/urandom"); 18 | Crypto.Types.Random.Set(Dev_U_Rand); 19 | 20 | Run_HASH(Reporter); 21 | Run_MAC(Reporter); 22 | end Test.HASH; 23 | -------------------------------------------------------------------------------- /test/test-hmac.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.Hmac is 5 | use AUnit; 6 | 7 | type Hmac_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out Hmac_Test); 10 | 11 | function Name(T: Hmac_Test) return Test_String; 12 | 13 | procedure Hmac_Test1(T: in out Test_Cases.Test_Case'Class); 14 | 15 | procedure Hmac_Test2(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure Hmac_Test3(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Hmac_Test4(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Hmac_Test5(T: in out Test_Cases.Test_Case'Class); 22 | 23 | end Test.Hmac; 24 | -------------------------------------------------------------------------------- /test/test-kdf.adb: -------------------------------------------------------------------------------- 1 | with Test.Suite_Key_Derivation_Function; 2 | with AUnit.Run; 3 | with AUnit.Reporter.Text; 4 | with Crypto.Types.Random_Source.Provider; 5 | with Crypto.Types.Random; 6 | 7 | procedure Test.KDF is 8 | procedure Run_KDF is new AUnit.Run.Test_Runner(Test.Suite_Key_Derivation_Function.Suite); 9 | Reporter : AUnit.Reporter.Text.Text_Reporter; 10 | 11 | use Crypto.Types.Random_Source.Provider; 12 | Dev_U_Rand : Random_Source_Provider; 13 | 14 | begin 15 | Dev_U_Rand.Initialize("/dev/urandom"); 16 | Crypto.Types.Random.Set(Dev_U_Rand); 17 | 18 | Run_KDF(Reporter); 19 | end Test.KDF; 20 | -------------------------------------------------------------------------------- /test/test-mmh.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.MMH is 5 | use AUnit; 6 | 7 | type MMH_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out MMH_Test); 10 | 11 | function Name(T: MMH_Test) return Test_String; 12 | 13 | procedure MMH_Test1(T: in out Test_Cases.Test_Case'Class); 14 | procedure MMH_Test2(T: in out Test_Cases.Test_Case'Class); 15 | 16 | end Test.MMH; 17 | -------------------------------------------------------------------------------- /test/test-noobcipher.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.Noobcipher is 5 | use AUnit; 6 | 7 | type Noobcipher_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out Noobcipher_Test); 10 | 11 | function Name(T: Noobcipher_Test) return Test_String; 12 | 13 | procedure Noobcipher_Test1(T: in out Test_Cases.Test_Case'Class); 14 | 15 | end Test.Noobcipher; 16 | -------------------------------------------------------------------------------- /test/test-ocb.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.OCB is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type OCB3_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out OCB3_Test); 12 | 13 | function Name(T: OCB3_Test) return Test_String; 14 | 15 | procedure OCB3_Test_Initialize(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure OCB3_Test_Encryption(T: in out Test_Cases.Test_Case'Class); 18 | 19 | end Test.OCB; 20 | -------------------------------------------------------------------------------- /test/test-ofb_mode.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.OFB_Mode is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Mode_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Mode_Test); 12 | 13 | function Name(T: Mode_Test) return Test_String; 14 | 15 | procedure OFB_Mode_Test1(T: in out Test_Cases.Test_Case'Class); 16 | procedure OFB_Mode_Test2(T: in out Test_Cases.Test_Case'Class); 17 | 18 | end Test.OFB_Mode; 19 | -------------------------------------------------------------------------------- /test/test-ofb_oneway_mode.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.OFB_Oneway_Mode is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Mode_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Mode_Test); 12 | 13 | function Name(T: Mode_Test) return Test_String; 14 | 15 | procedure OFB_Oneway_Mode_Test1(T: in out Test_Cases.Test_Case'Class); 16 | procedure OFB_Oneway_Mode_Test2(T: in out Test_Cases.Test_Case'Class); 17 | 18 | end Test.OFB_Oneway_Mode; 19 | -------------------------------------------------------------------------------- /test/test-pbkdf2.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.PBKDF2 is 5 | use AUnit; 6 | 7 | type PBKDF2_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out PBKDF2_Test); 10 | 11 | function Name(T: PBKDF2_Test) return Test_String; 12 | 13 | procedure PBKDF2_Test_One(T: in out Test_Cases.Test_Case'Class); 14 | 15 | end Test.PBKDF2; 16 | -------------------------------------------------------------------------------- /test/test-random.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.Random is 5 | use AUnit; 6 | 7 | type Random_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out Random_Test); 10 | 11 | function Name(T: Random_Test) return Test_String; 12 | 13 | procedure Random_Test1(T: in out Test_Cases.Test_Case'Class); 14 | procedure Random_Test2(T: in out Test_Cases.Test_Case'Class); 15 | procedure Random_Test3(T: in out Test_Cases.Test_Case'Class); 16 | procedure Random_Test4(T: in out Test_Cases.Test_Case'Class); 17 | procedure Random_Test5(T: in out Test_Cases.Test_Case'Class); 18 | 19 | end Test.Random; 20 | -------------------------------------------------------------------------------- /test/test-random_generator.adb: -------------------------------------------------------------------------------- 1 | with AUnit.Assertions; use AUnit.Assertions; 2 | with Crypto.Types.Nonces; 3 | with Crypto.Types.Nonces.Nonces_Random; 4 | use Crypto.Types; 5 | 6 | package body Test.Random_Generator is 7 | 8 | procedure Register_Tests (T: in out Test_Random_Generator) is 9 | use AUnit.Test_Cases.Registration; 10 | begin 11 | Register_Routine (T, Random_Generator_Test1'Access, "Random Generator"); 12 | end Register_Tests; 13 | 14 | function Name (T: Test_Random_Generator) return Test_String is 15 | begin 16 | return Format ("Random Generator Test"); 17 | end Name; 18 | 19 | procedure Random_Generator_Test1 (T : in out Test_Cases.Test_Case'Class) is 20 | package N is new Crypto.Types.Nonces(Crypto.Types.B_Block128); 21 | package Rand is new N.Nonces_Random(Crypto.Types.To_B_Block128); 22 | Nonce: Rand.Nonce_Rand; 23 | Byte_Array: Crypto.Types.B_Block128 := (others => 0); 24 | Result : array(0..99) of Crypto.Types.B_Block128; 25 | Distinct : Boolean := true; 26 | begin 27 | for i in Result'Range loop 28 | Result(i) := Rand.Update(Nonce); 29 | end loop; 30 | 31 | for i in Result'Range loop 32 | for j in (i+1)..Result'Last loop 33 | if Result(i) = Result(j) then 34 | Distinct := false; 35 | end if; 36 | end loop; 37 | end loop; 38 | Assert(Distinct,"Random Generator failed!"); 39 | end Random_Generator_Test1; 40 | 41 | end Test.Random_Generator; 42 | -------------------------------------------------------------------------------- /test/test-random_generator.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | use AUnit; 3 | with AUnit.Test_Cases; 4 | use AUnit.Test_Cases; 5 | 6 | 7 | package Test.Random_Generator is 8 | 9 | type Test_Random_Generator is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests (T: in out Test_Random_Generator); 12 | 13 | function Name (T: Test_Random_Generator) return Message_String; 14 | 15 | procedure Random_Generator_Test1 (T : in out Test_Cases.Test_Case'Class); 16 | 17 | end Test.Random_Generator; 18 | -------------------------------------------------------------------------------- /test/test-rmac.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.RMAC is 5 | use AUnit; 6 | 7 | type RMAC_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out RMAC_Test); 10 | 11 | function Name(T: RMAC_Test) return Test_String; 12 | 13 | procedure RMAC_Test1(T: in out Test_Cases.Test_Case'Class); 14 | procedure RMAC_Test2(T: in out Test_Cases.Test_Case'Class); 15 | 16 | end Test.RMAC; 17 | -------------------------------------------------------------------------------- /test/test-rsa.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.RSA is 5 | use AUnit; 6 | 7 | type RSA_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out RSA_Test); 10 | 11 | function Name(T: RSA_Test) return Test_String; 12 | 13 | procedure Test_Verify_Key_Pair(T: in out Test_Cases.Test_Case'Class); 14 | procedure Test_OAEP(T: in out Test_Cases.Test_Case'Class); 15 | procedure Test_Gen_Keypair(T: in out Test_Cases.Test_Case'Class); 16 | procedure Test_Get_Public_Key(T: in out Test_Cases.Test_Case'Class); 17 | procedure Test_Encryption(T: in out Test_Cases.Test_Case'Class); 18 | procedure Test_Zero_Encryption(T: in out Test_Cases.Test_Case'Class); 19 | procedure Test_Get_Private_Key(T: in out Test_Cases.Test_Case'Class); 20 | end Test.RSA; 21 | -------------------------------------------------------------------------------- /test/test-scrypt.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | 5 | package Test.Scrypt is 6 | use AUnit; 7 | 8 | type Scrypt_Test is new Test_Cases.Test_Case with null record; 9 | 10 | procedure Register_Tests(T: in out Scrypt_Test); 11 | 12 | function Name(T: Scrypt_Test) return Test_String; 13 | 14 | procedure Failing_XOR; 15 | procedure Failing_Power; 16 | 17 | procedure Scrypt_Test_Exceptions(T: in out Test_Cases.Test_Case'Class); 18 | procedure Scrypt_Test_Salsa(T: in out Test_Cases.Test_Case'Class); 19 | procedure Scrypt_Test_Block_Mix(T: in out Test_Cases.Test_Case'Class); 20 | procedure Scrypt_Test_ROMix(T: in out Test_Cases.Test_Case'Class); 21 | procedure Scrypt_Test_PBKDF2(T: in out Test_Cases.Test_Case'Class); 22 | procedure Scrypt_Test_SCRYPT(T: in out Test_Cases.Test_Case'Class); 23 | 24 | end Test.Scrypt; 25 | -------------------------------------------------------------------------------- /test/test-serpent.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Serpent is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Serpent_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Serpent_Test); 12 | 13 | function Name(T: Serpent_Test) return Test_String; 14 | 15 | procedure Serpent_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure Serpent_Test2(T: in out Test_Cases.Test_Case'Class); 18 | 19 | end Test.Serpent; 20 | -------------------------------------------------------------------------------- /test/test-serpent_oneway.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.Serpent_Oneway is 5 | use AUnit; 6 | 7 | type Serpent_Oneway_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out Serpent_Oneway_Test); 10 | 11 | function Name(T: Serpent_Oneway_Test) return Test_String; 12 | 13 | procedure Serpent_Oneway_Test1(T: in out Test_Cases.Test_Case'Class); 14 | procedure Serpent_Oneway_Test2(T: in out Test_Cases.Test_Case'Class); 15 | 16 | end Test.Serpent_Oneway; 17 | -------------------------------------------------------------------------------- /test/test-sha1.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.SHA1 is 5 | use AUnit; 6 | 7 | type SHA_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out SHA_Test); 10 | 11 | function Name(T: SHA_Test) return Test_String; 12 | 13 | procedure SHA_Test1(T: in out Test_Cases.Test_Case'Class); 14 | 15 | procedure SHA_Test2(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure SHA_Test3(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure SHA_Test4(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure SHA_Test5(T: in out Test_Cases.Test_Case'Class); 22 | 23 | end Test.SHA1; 24 | -------------------------------------------------------------------------------- /test/test-sha1_mac.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.SHA1_MAC is 5 | use AUnit; 6 | 7 | type HMAC_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out HMAC_Test); 10 | 11 | function Name(T: HMAC_Test) return Test_String; 12 | 13 | procedure SHA1_MAC_Test1(T: in out Test_Cases.Test_Case'Class); 14 | 15 | procedure SHA1_MAC_Test2(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure SHA1_MAC_Test3(T: in out Test_Cases.Test_Case'Class); 18 | 19 | end Test.SHA1_MAC; 20 | -------------------------------------------------------------------------------- /test/test-sha256.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.SHA256 is 5 | use AUnit; 6 | 7 | type SHA_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out SHA_Test); 10 | 11 | function Name(T: SHA_Test) return Test_String; 12 | 13 | procedure SHA256_Test1(T: in out Test_Cases.Test_Case'Class); 14 | 15 | procedure SHA256_Test2(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure SHA256_Test3(T: in out Test_Cases.Test_Case'Class); 18 | 19 | end Test.SHA256; 20 | -------------------------------------------------------------------------------- /test/test-sha256_mac.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.SHA256_MAC is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type HMAC_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out HMAC_Test); 12 | 13 | function Name(T: HMAC_Test) return Test_String; 14 | 15 | procedure SHA256_MAC_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure SHA256_MAC_Test2(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure SHA256_MAC_Test3(T: in out Test_Cases.Test_Case'Class); 20 | 21 | end Test.SHA256_MAC; 22 | -------------------------------------------------------------------------------- /test/test-sha256_oneway.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.SHA256_Oneway is 5 | use AUnit; 6 | 7 | type SHA256_Oneway_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out SHA256_Oneway_Test); 10 | 11 | function Name(T: SHA256_Oneway_Test) return Test_String; 12 | 13 | procedure SHA256_Oneway_Test1(T: in out Test_Cases.Test_Case'Class); 14 | procedure SHA256_Oneway_Test2(T: in out Test_Cases.Test_Case'Class); 15 | 16 | end Test.SHA256_Oneway; 17 | -------------------------------------------------------------------------------- /test/test-sha384.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.SHA384 is 5 | use AUnit; 6 | 7 | type SHA_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out SHA_Test); 10 | 11 | function Name(T: SHA_Test) return Test_String; 12 | 13 | procedure SHA384_Test1(T: in out Test_Cases.Test_Case'Class); 14 | 15 | procedure SHA384_Test2(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure SHA384_Test3(T: in out Test_Cases.Test_Case'Class); 18 | 19 | end Test.SHA384; 20 | -------------------------------------------------------------------------------- /test/test-sha384_oneway.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.SHA384_Oneway is 5 | use AUnit; 6 | 7 | type SHA384_Oneway_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out SHA384_Oneway_Test); 10 | 11 | function Name(T: SHA384_Oneway_Test) return Test_String; 12 | 13 | procedure SHA384_Oneway_Test1(T: in out Test_Cases.Test_Case'Class); 14 | procedure SHA384_Oneway_Test2(T: in out Test_Cases.Test_Case'Class); 15 | 16 | end Test.SHA384_Oneway; 17 | -------------------------------------------------------------------------------- /test/test-sha512.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.SHA512 is 5 | use AUnit; 6 | 7 | type SHA_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out SHA_Test); 10 | 11 | function Name(T: SHA_Test) return Test_String; 12 | 13 | procedure SHA512_Test1(T: in out Test_Cases.Test_Case'Class); 14 | 15 | procedure SHA512_Test2(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure SHA512_Test3(T: in out Test_Cases.Test_Case'Class); 18 | 19 | end Test.SHA512; 20 | -------------------------------------------------------------------------------- /test/test-sha512_mac.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.SHA512_MAC is 5 | use AUnit; 6 | 7 | 8 | type HMAC_Test is new Test_Cases.Test_Case with null record; 9 | 10 | procedure Register_Tests(T: in out HMAC_Test); 11 | 12 | function Name(T: HMAC_Test) return Test_String; 13 | 14 | procedure SHA512_MAC_Test1(T: in out Test_Cases.Test_Case'Class); 15 | 16 | procedure SHA512_MAC_Test2(T: in out Test_Cases.Test_Case'Class); 17 | 18 | procedure SHA512_MAC_Test3(T: in out Test_Cases.Test_Case'Class); 19 | 20 | end Test.SHA512_MAC; 21 | -------------------------------------------------------------------------------- /test/test-sha512_oneway.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.SHA512_Oneway is 5 | use AUnit; 6 | 7 | type SHA512_Oneway_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out SHA512_Oneway_Test); 10 | 11 | function Name(T: SHA512_Oneway_Test) return Test_String; 12 | 13 | procedure SHA512_Oneway_Test1(T: in out Test_Cases.Test_Case'Class); 14 | procedure SHA512_Oneway_Test2(T: in out Test_Cases.Test_Case'Class); 15 | 16 | end Test.SHA512_Oneway; 17 | -------------------------------------------------------------------------------- /test/test-sha512crypt.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.SHA512Crypt is 5 | use AUnit; 6 | 7 | type SHA512Crypt_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out SHA512Crypt_Test); 10 | 11 | function Name(T: SHA512Crypt_Test) return Test_String; 12 | 13 | procedure SHA512Crypt_Test_Add_Bytes(T: in out Test_Cases.Test_Case'Class); 14 | 15 | procedure SHA512Crypt_Test_Encryption(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure SHA512Crypt_Test_Exceptions(T: in out Test_Cases.Test_Case'Class); 18 | 19 | end Test.SHA512Crypt; 20 | -------------------------------------------------------------------------------- /test/test-siv.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.SIV is 5 | use AUnit; 6 | 7 | type SIV_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out SIV_Test); 10 | 11 | function Name(T: SIV_Test) return Test_String; 12 | 13 | procedure SIV_Test1(T: in out Test_Cases.Test_Case'Class); 14 | 15 | end Test.SIV; 16 | -------------------------------------------------------------------------------- /test/test-skein.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Crypto.Debug_Put; 4 | 5 | package Test.Skein is 6 | use AUnit; 7 | 8 | type Skein_Test is new Test_Cases.Test_Case with null record; 9 | 10 | procedure Register_Tests (T : in out Skein_Test); 11 | 12 | function Name (T : Skein_Test) return Test_String; 13 | 14 | package Error_Output is new Crypto.Debug_Put(b => false); 15 | 16 | procedure Skein_Test_256(T: in out Test_Cases.Test_Case'Class); 17 | procedure Skein_Test_512(T: in out Test_Cases.Test_Case'Class); 18 | procedure Skein_Test_1024(T: in out Test_Cases.Test_Case'Class); 19 | 20 | end Test.Skein; 21 | -------------------------------------------------------------------------------- /test/test-suite_ae.adb: -------------------------------------------------------------------------------- 1 | with Test.OCB; 2 | 3 | package body Test.Suite_AE is 4 | use AUnit.Test_Suites; 5 | 6 | Result: aliased Test_Suite; 7 | OCB3_Test: aliased Test.OCB.OCB3_Test; 8 | 9 | function Suite return AUnit.Test_Suites.Access_Test_Suite is 10 | begin 11 | Add_Test(Result'Access, OCB3_Test'Access); 12 | 13 | return Result'Access; 14 | end Suite; 15 | end Test.Suite_AE; 16 | -------------------------------------------------------------------------------- /test/test-suite_ae.ads: -------------------------------------------------------------------------------- 1 | with AUnit.Test_Suites; 2 | 3 | package Test.Suite_AE is 4 | function Suite return AUnit.Test_Suites.Access_Test_Suite; 5 | end Test.Suite_AE; 6 | -------------------------------------------------------------------------------- /test/test-suite_all.adb: -------------------------------------------------------------------------------- 1 | with Test.Suite_Asymmetric_Ciphers; 2 | with Test.Suite_Big_Num_All; 3 | with Test.Suite_Blockciphers; 4 | with Test.Suite_Oneway_Blockciphers; 5 | with Test.Suite_Elliptic_Curves; 6 | with Test.Suite_MAC; 7 | with Test.Suite_Hash_Function; 8 | with Test.Suite_Nonces; 9 | with Test.Suite_Misc; 10 | with Test.Suite_Key_Derivation_Function; 11 | 12 | package body Test.Suite_All is 13 | function Suite return Test_Suites.Access_Test_Suite is 14 | use AUnit.Test_Suites; 15 | Result : constant Access_Test_Suite := New_Suite; 16 | begin 17 | Result.Add_Test(Test.Suite_Asymmetric_Ciphers.Suite); 18 | Result.Add_Test(Test.Suite_Big_Num_All.Suite); 19 | Result.Add_Test(Test.Suite_Blockciphers.Suite); 20 | Result.Add_Test(Test.Suite_Oneway_Blockciphers.Suite); 21 | Result.Add_Test(Test.Suite_Elliptic_Curves.Suite); 22 | Result.Add_Test(Test.Suite_MAC.Suite); 23 | Result.Add_Test(Test.Suite_Hash_Function.Suite); 24 | Result.Add_Test(Test.Suite_Nonces.Suite); 25 | Result.Add_Test(Test.Suite_Misc.Suite); 26 | Result.Add_Test(Test.Suite_Key_Derivation_Function.Suite); 27 | return Result; 28 | end Suite; 29 | end Test.Suite_All; 30 | -------------------------------------------------------------------------------- /test/test-suite_all.ads: -------------------------------------------------------------------------------- 1 | with AUnit; use AUnit; 2 | with AUnit.Test_Suites; 3 | 4 | package Test.Suite_All is 5 | function Suite return Test_Suites.Access_Test_Suite; 6 | end Test.Suite_All; 7 | -------------------------------------------------------------------------------- /test/test-suite_asymmetric_ciphers.adb: -------------------------------------------------------------------------------- 1 | with Test.DSA; 2 | with Test.RSA; 3 | with Test.ECDSA; 4 | 5 | package body Test.Suite_Asymmetric_Ciphers is 6 | use Aunit.Test_Suites; 7 | Result: aliased Test_Suite; 8 | Test_DSA: aliased Test.DSA.DSA_Test; 9 | Test_RSA: aliased Test.RSA.RSA_Test; 10 | Test_ECDSA: aliased Test.ECDSA.ECDSA_Test; 11 | 12 | function Suite return Aunit.Test_Suites.Access_Test_Suite is 13 | begin 14 | Add_Test(Result'Access, Test_DSA'Access); 15 | Add_Test(Result'Access, Test_RSA'Access); 16 | Add_Test(Result'Access, Test_ECDSA'Access); 17 | return Result'Access; 18 | end Suite; 19 | end Test.Suite_Asymmetric_Ciphers; 20 | -------------------------------------------------------------------------------- /test/test-suite_asymmetric_ciphers.ads: -------------------------------------------------------------------------------- 1 | with AUnit.Test_Suites; 2 | 3 | package Test.Suite_Asymmetric_Ciphers is 4 | function Suite return AUnit.Test_Suites.Access_Test_Suite; 5 | end Test.Suite_Asymmetric_Ciphers; 6 | -------------------------------------------------------------------------------- /test/test-suite_authenticated_encryption.adb: -------------------------------------------------------------------------------- 1 | with Test.SHA1; 2 | with Test.SHA256; 3 | with Test.SHA384; 4 | with Test.SHA512; 5 | with Test.Whirlpool; 6 | with Test.Skein; 7 | with Test.OCB; 8 | with Test.Hmac; 9 | 10 | package body Test.Suite_Authenticated_Encryption is 11 | use AUnit.Test_Suites; 12 | 13 | Result: aliased Test_Suite; 14 | OCB_Test: aliased Test.OCB.OCB3_Test; 15 | 16 | function Suite return AUnit.Test_Suites.Access_Test_Suite is 17 | begin 18 | Add_Test(Result'Access, OCB_Test'Access); 19 | return Result'Access; 20 | end Suite; 21 | end Test.Suite_Authenticated_Encryption; 22 | -------------------------------------------------------------------------------- /test/test-suite_authenticated_encryption.ads: -------------------------------------------------------------------------------- 1 | with AUnit.Test_Suites; 2 | 3 | package Test.Suite_Authenticated_Encryption is 4 | function Suite return AUnit.Test_Suites.Access_Test_Suite; 5 | end Test.Suite_Authenticated_Encryption; 6 | -------------------------------------------------------------------------------- /test/test-suite_big_num1.adb: -------------------------------------------------------------------------------- 1 | with Test.Big_Number_Multiplication; 2 | with Test.Big_Number_Mult2; 3 | with Test.Big_Number_Mod_Type_Comp_and_Add; 4 | with Test.Big_Number_Mod_Types; 5 | with Test.Big_Number_Comp; 6 | with Test.Big_Number_Add; 7 | with Test.Big_Number_Sub; 8 | with Test.Big_Number_Div; 9 | 10 | 11 | package body Test.Suite_Big_Num1 is 12 | Result : aliased Test_Suite; 13 | Test_Mult : aliased Test.Big_Number_Multiplication.Big_Number_Test; 14 | Test_Mult2 : aliased Test.Big_Number_Mult2.Big_Number_Test; 15 | Test_Mod_Type_Comp_and_Add : aliased Test.Big_Number_Mod_Type_Comp_and_Add.Big_Number_Test; 16 | Test_Mod_Types : aliased Test.Big_Number_Mod_Types.Big_Number_Test; 17 | Test_Comp : aliased Test.Big_Number_Comp.Big_Number_Test; 18 | Test_Add : aliased Test.Big_Number_Add.Big_Number_Test; 19 | Test_Sub : aliased Test.Big_Number_Sub.Big_Number_Test; 20 | Test_Div : aliased Test.Big_Number_Div.Big_Number_Test; 21 | 22 | function Suite return Access_Test_Suite is 23 | begin 24 | Add_Test(Result'Access, Test_Mult'Access); 25 | Add_Test(Result'Access, Test_Mult2'Access); 26 | Add_Test(Result'Access, Test_Mod_Type_Comp_and_Add'Access); 27 | Add_Test(Result'Access, Test_Mod_Types'Access); 28 | Add_Test(Result'Access, Test_Comp'Access); 29 | Add_Test(Result'Access, Test_Add'Access); 30 | Add_Test(Result'Access, Test_Sub'Access); 31 | Add_Test(Result'Access, Test_Div'Access); 32 | return Result'Access; 33 | end Suite; 34 | 35 | end Test.Suite_Big_Num1; 36 | -------------------------------------------------------------------------------- /test/test-suite_big_num1.ads: -------------------------------------------------------------------------------- 1 | with AUnit.Test_Suites; 2 | use AUnit.Test_Suites; 3 | 4 | package Test.Suite_Big_Num1 is 5 | 6 | function Suite return Access_Test_Suite; 7 | 8 | end Test.Suite_Big_Num1; 9 | -------------------------------------------------------------------------------- /test/test-suite_big_num2.ads: -------------------------------------------------------------------------------- 1 | with AUnit.Test_Suites; 2 | use AUnit.Test_Suites; 3 | 4 | package Test.Suite_Big_Num2 is 5 | 6 | function Suite return Access_Test_Suite; 7 | 8 | end Test.Suite_Big_Num2; 9 | -------------------------------------------------------------------------------- /test/test-suite_big_num3.adb: -------------------------------------------------------------------------------- 1 | with Test.Big_Number_XOR; 2 | with Test.Big_Number_OR; 3 | with Test.Big_Number_AND; 4 | with Test.Big_Number_Exponentiate; 5 | with Test.Big_Number_Mod; 6 | with Test.Big_Number_Min_Max; 7 | with Test.Big_Numbers_Utils; 8 | with Test.Big_Number_Inc; 9 | with Test.Big_Number_Dec; 10 | 11 | 12 | package body Test.Suite_Big_Num3 is 13 | Result : aliased Test_Suite; 14 | Test_XOR : aliased Test.Big_Number_XOR.Big_Number_Test; 15 | Test_OR : aliased Test.Big_Number_OR.Big_Number_Test; 16 | Test_AND : aliased Test.Big_Number_AND.Big_Number_Test; 17 | Test_Exponentiate : aliased Test.Big_Number_Exponentiate.Big_Number_Test; 18 | Test_Mod : aliased Test.Big_Number_Mod.Big_Number_Test; 19 | Test_Min_Max : aliased Test.Big_Number_Min_Max.Big_Number_Test; 20 | Test_Utils : aliased Test.Big_Numbers_Utils.Big_Number_Test; 21 | Test_Increase : aliased Test.Big_Number_Inc.Big_Number_Test; 22 | Test_Decrease : aliased Test.Big_Number_Dec.Big_Number_Test; 23 | 24 | function Suite return Access_Test_Suite is 25 | begin 26 | Add_Test(Result'Access, Test_XOR'Access); 27 | Add_Test(Result'Access, Test_OR'Access); 28 | Add_Test(Result'Access, Test_AND'Access); 29 | Add_Test(Result'Access, Test_Exponentiate'Access); 30 | Add_Test(Result'Access, Test_Mod'Access); 31 | Add_Test(Result'Access, Test_Min_Max'Access); 32 | Add_Test(Result'Access, Test_Utils'Access); 33 | Add_Test(Result'Access, Test_Increase'Access); 34 | Add_Test(Result'Access, Test_Decrease'Access); 35 | return Result'Access; 36 | end Suite; 37 | 38 | end Test.Suite_Big_Num3; 39 | -------------------------------------------------------------------------------- /test/test-suite_big_num3.ads: -------------------------------------------------------------------------------- 1 | with AUnit.Test_Suites; 2 | use AUnit.Test_Suites; 3 | 4 | package Test.Suite_Big_Num3 is 5 | 6 | function Suite return Access_Test_Suite; 7 | 8 | end Test.Suite_Big_Num3; 9 | -------------------------------------------------------------------------------- /test/test-suite_big_num4.ads: -------------------------------------------------------------------------------- 1 | with AUnit.Test_Suites; 2 | use AUnit.Test_Suites; 3 | 4 | package Test.Suite_Big_Num4 is 5 | 6 | function Suite return Access_Test_Suite; 7 | 8 | end Test.Suite_Big_Num4; 9 | -------------------------------------------------------------------------------- /test/test-suite_big_num_all.adb: -------------------------------------------------------------------------------- 1 | with Test.Suite_Big_Num1; 2 | with Test.Suite_Big_Num2; 3 | with Test.Suite_Big_Num3; 4 | with Test.Suite_Big_Num4; 5 | 6 | 7 | package body Test.Suite_Big_Num_All is 8 | function Suite return Test_Suites.Access_Test_Suite is 9 | use AUnit.Test_Suites; 10 | Result : constant Access_Test_Suite := New_Suite; 11 | begin 12 | Result.Add_Test(Test.Suite_Big_Num1.Suite); 13 | Result.Add_Test(Test.Suite_Big_Num2.Suite); 14 | Result.Add_Test(Test.Suite_Big_Num3.Suite); 15 | Result.Add_Test(Test.Suite_Big_Num4.Suite); 16 | return Result; 17 | end Suite; 18 | end Test.Suite_Big_Num_All; 19 | -------------------------------------------------------------------------------- /test/test-suite_big_num_all.ads: -------------------------------------------------------------------------------- 1 | with AUnit; use AUnit; 2 | with AUnit.Test_Suites; 3 | 4 | package Test.Suite_Big_Num_All is 5 | function Suite return Test_Suites.Access_Test_Suite; 6 | end Test.Suite_Big_Num_All; 7 | -------------------------------------------------------------------------------- /test/test-suite_blockciphers.ads: -------------------------------------------------------------------------------- 1 | with AUnit.Test_Suites; 2 | 3 | package Test.Suite_Blockciphers is 4 | function Suite return AUnit.Test_Suites.Access_Test_Suite; 5 | end Test.Suite_Blockciphers; 6 | -------------------------------------------------------------------------------- /test/test-suite_elliptic_curves.adb: -------------------------------------------------------------------------------- 1 | with Test.Elliptic_Curves_ZP; 2 | with Test.Elliptic_Curves_NSS_BF; 3 | with Test.ECDH; 4 | with Test.ECIES; 5 | with Test.Elliptic_curves; 6 | 7 | package body Test.Suite_Elliptic_Curves is 8 | use Aunit.Test_Suites; 9 | 10 | Result: aliased Test_Suite; 11 | Test_Elliptic_Curves_ZP: aliased Test.Elliptic_Curves_ZP.Elliptic_Curves_Test; 12 | Test_Elliptic_Curves_NSS_BF: aliased Test.Elliptic_Curves_NSS_BF.Elliptic_Curves_Test; 13 | Test_ECDH: aliased Test.ECDH.ECDH_Test; 14 | Test_ECIES: aliased Test.ECIES.ECIES_Test; 15 | Test_Elliptic_curves: aliased Test.Elliptic_curves.Elliptic_curves_Test; 16 | 17 | function Suite return Aunit.Test_Suites.Access_Test_Suite is 18 | 19 | begin 20 | 21 | Add_Test(Result'Access, Test_Elliptic_Curves_ZP'Access); 22 | Add_Test(Result'Access, Test_Elliptic_Curves_NSS_BF'Access); 23 | Add_Test(Result'Access, Test_ECDH'Access); 24 | Add_Test(Result'Access, Test_ECIES'Access); 25 | Add_Test(Result'Access, Test_Elliptic_curves'Access); 26 | return Result'Access; 27 | 28 | end Suite; 29 | 30 | end Test.Suite_Elliptic_Curves; 31 | -------------------------------------------------------------------------------- /test/test-suite_elliptic_curves.ads: -------------------------------------------------------------------------------- 1 | with AUnit.Test_Suites; 2 | 3 | package Test.Suite_Elliptic_Curves is 4 | function Suite return AUnit.Test_Suites.Access_Test_Suite; 5 | end Test.Suite_Elliptic_Curves; 6 | -------------------------------------------------------------------------------- /test/test-suite_hash_function.adb: -------------------------------------------------------------------------------- 1 | with Test.Skein; 2 | with Test.SHA1; 3 | with Test.SHA256; 4 | with Test.SHA384; 5 | with Test.SHA512; 6 | with Test.Whirlpool; 7 | 8 | package body Test.Suite_Hash_Function is 9 | use AUnit.Test_Suites; 10 | 11 | Result: aliased Test_Suite; 12 | Secure_Hash_Algorithm1_Test: aliased Test.SHA1.SHA_Test; 13 | Secure_Hash_Algorithm2_256_Test: aliased Test.SHA256.SHA_Test; 14 | Secure_Hash_Algorithm2_384_Test: aliased Test.SHA384.SHA_Test; 15 | Secure_Hash_Algorithm2_512_Test: aliased Test.SHA512.SHA_Test; 16 | Skein_Test: aliased Test.Skein.Skein_Test; 17 | Whirlpool_Test: aliased Test.Whirlpool.SHA_Test; 18 | 19 | function Suite return AUnit.Test_Suites.Access_Test_Suite is 20 | begin 21 | Add_Test(Result'Access, Secure_Hash_Algorithm1_Test'Access); 22 | Add_Test(Result'Access, Secure_Hash_Algorithm2_256_Test'Access); 23 | Add_Test(Result'Access, Secure_Hash_Algorithm2_384_Test'Access); 24 | Add_Test(Result'Access, Secure_Hash_Algorithm2_512_Test'Access); 25 | Add_Test(Result'Access, Skein_Test'Access); 26 | Add_Test(Result'Access, Whirlpool_Test'Access); 27 | 28 | return Result'Access; 29 | end Suite; 30 | end Test.Suite_Hash_Function; 31 | -------------------------------------------------------------------------------- /test/test-suite_hash_function.ads: -------------------------------------------------------------------------------- 1 | with AUnit.Test_Suites; 2 | 3 | package Test.Suite_Hash_function is 4 | function Suite return AUnit.Test_Suites.Access_Test_Suite; 5 | end Test.Suite_Hash_Function; 6 | 7 | -------------------------------------------------------------------------------- /test/test-suite_key_derivation_function.adb: -------------------------------------------------------------------------------- 1 | with Test.SHA512Crypt; 2 | with Test.PBKDF2; 3 | with Test.Scrypt; 4 | with Test.Catena; 5 | 6 | package body Test.Suite_Key_Derivation_Function is 7 | use AUnit.Test_Suites; 8 | 9 | Result: aliased Test_Suite; 10 | SHA512Crypt_Test: aliased Test.SHA512Crypt.SHA512Crypt_Test; 11 | PBKDF2_Test: aliased Test.PBKDF2.PBKDF2_Test; 12 | Scrypt_Test: aliased Test.Scrypt.Scrypt_Test; 13 | Catena_Test: aliased Test.Catena.Catena_Test; 14 | 15 | 16 | function Suite return AUnit.Test_Suites.Access_Test_Suite is 17 | begin 18 | Add_Test(Result'Access, Scrypt_Test'Access); 19 | Add_Test(Result'Access, SHA512Crypt_Test'Access); 20 | Add_Test(Result'Access, PBKDF2_Test'Access); 21 | Add_Test(Result'Access, Catena_Test'Access); 22 | 23 | 24 | return Result'Access; 25 | end Suite; 26 | end Test.Suite_Key_Derivation_Function; 27 | -------------------------------------------------------------------------------- /test/test-suite_key_derivation_function.ads: -------------------------------------------------------------------------------- 1 | with AUnit.Test_Suites; 2 | 3 | package Test.Suite_Key_Derivation_Function is 4 | function Suite return AUnit.Test_Suites.Access_Test_Suite; 5 | end Test.Suite_Key_Derivation_Function; 6 | -------------------------------------------------------------------------------- /test/test-suite_mac.adb: -------------------------------------------------------------------------------- 1 | with Test.SHA1_MAC; 2 | with Test.SHA256_MAC; 3 | with Test.SHA512_MAC; 4 | with Test.Whirlpool_MAC; 5 | with Test.HMAC; 6 | with Test.Symmetric_Mac; 7 | with Test.RMAC; 8 | with Test.CMAC; 9 | 10 | package body Test.Suite_MAC is 11 | use AUnit.Test_Suites; 12 | 13 | Result : aliased Test_Suite; 14 | SHA1_MAC_Test : aliased Test.SHA1_MAC.HMAC_Test; 15 | SHA256_MAC_Test : aliased Test.SHA256_MAC.HMAC_Test; 16 | SHA512_MAC_Test : aliased Test.SHA512_MAC.HMAC_Test; 17 | Whirlpool_MAC_Test : aliased Test.Whirlpool_MAC.HMAC_Test; 18 | Test_HMAC : aliased Test.HMAC.HMAC_Test; 19 | Test_RMAC: aliased Test.RMAC.RMAC_Test; 20 | Test_Symmetric_Mac : aliased Test.Symmetric_Mac.Mac_Test; 21 | Test_CMAC : aliased Test.CMAC.CMAC_Test; 22 | 23 | function Suite return AUnit.Test_Suites.Access_Test_Suite is 24 | begin 25 | Add_Test(Result'Access, SHA1_MAC_Test'Access); 26 | Add_Test(Result'Access, SHA256_MAC_Test'Access); 27 | Add_Test(Result'Access, SHA512_MAC_Test'Access); 28 | Add_Test(Result'Access, Whirlpool_MAC_Test'Access); 29 | Add_Test(Result'Access, Test_HMAC'Access); 30 | Add_Test(Result'Access, Test_RMAC'Access); 31 | Add_Test(Result'Access, Test_Symmetric_Mac'Access); 32 | Add_Test(Result'Access, Test_CMAC'Access); 33 | return Result'Access; 34 | end Suite; 35 | end Test.Suite_MAC; 36 | -------------------------------------------------------------------------------- /test/test-suite_mac.ads: -------------------------------------------------------------------------------- 1 | with AUnit.Test_Suites; 2 | 3 | package Test.Suite_MAC is 4 | function Suite return AUnit.Test_Suites.Access_Test_Suite; 5 | end Test.Suite_MAC; 6 | 7 | -------------------------------------------------------------------------------- /test/test-suite_misc.adb: -------------------------------------------------------------------------------- 1 | with Test.Types; 2 | with Test.Random; 3 | with Test.Base64; 4 | with Test.MMH; 5 | 6 | package body Test.Suite_Misc is 7 | Result : aliased Test_Suite; 8 | Test_Types : aliased Test.Types.Types_Test; 9 | Test_Base64 : aliased Test.Base64.Base64_Test; 10 | Test_Random : aliased Test.Random.Random_Test; 11 | Test_MMH : aliased Test.MMH.MMH_Test; 12 | 13 | function Suite return Access_Test_Suite is 14 | begin 15 | Add_Test(Result'Access, Test_Types'Access); 16 | Add_Test(Result'Access, Test_Base64'Access); 17 | Add_Test(Result'Access, Test_Random'Access); 18 | Add_Test(Result'Access, Test_MMH'Access); 19 | return Result'Access; 20 | end Suite; 21 | 22 | end Test.Suite_Misc; 23 | -------------------------------------------------------------------------------- /test/test-suite_misc.ads: -------------------------------------------------------------------------------- 1 | with AUnit.Test_Suites; 2 | use AUnit.Test_Suites; 3 | 4 | package Test.Suite_Misc is 5 | 6 | function Suite return Access_Test_Suite; 7 | 8 | end Test.Suite_Misc; 9 | -------------------------------------------------------------------------------- /test/test-suite_nonces.adb: -------------------------------------------------------------------------------- 1 | with Test.Counter_Generator; 2 | with Test.Random_Generator; 3 | 4 | package body Test.Suite_Nonces is 5 | Result : aliased Test_Suite; 6 | Test_Counter_Generator : aliased Test.Counter_Generator.Test_Counter_Generator; 7 | Test_Random_Generator : aliased Test.Random_Generator.Test_Random_Generator; 8 | 9 | function Suite return Access_Test_Suite is 10 | begin 11 | Add_Test(Result'Access, Test_Counter_Generator'Access); 12 | Add_Test(Result'Access, Test_Random_Generator'Access); 13 | return Result'Access; 14 | end Suite; 15 | 16 | end Test.Suite_Nonces; 17 | -------------------------------------------------------------------------------- /test/test-suite_nonces.ads: -------------------------------------------------------------------------------- 1 | with AUnit.Test_Suites; 2 | use AUnit.Test_Suites; 3 | 4 | package Test.Suite_Nonces is 5 | 6 | function Suite return Access_Test_Suite; 7 | 8 | end Test.Suite_Nonces; 9 | -------------------------------------------------------------------------------- /test/test-suite_oneway_blockciphers.ads: -------------------------------------------------------------------------------- 1 | with AUnit.Test_Suites; 2 | 3 | package Test.Suite_Oneway_Blockciphers is 4 | function Suite return AUnit.Test_Suites.Access_Test_Suite; 5 | end Test.Suite_Oneway_Blockciphers; 6 | -------------------------------------------------------------------------------- /test/test-symmetric_ciphers.adb: -------------------------------------------------------------------------------- 1 | with Crypto.Types.Random_Source.Provider; 2 | with Test.Suite_Oneway_Blockciphers; 3 | with Test.Suite_Blockciphers; 4 | with Crypto.Types.Random; 5 | with AUnit.Reporter.Text; 6 | with Test.Suite_AE; 7 | with Test.Suite_Nonces; 8 | with AUnit.Run; 9 | 10 | 11 | procedure Test.Symmetric_Ciphers is 12 | procedure Run_Nonce is new AUnit.Run.Test_Runner(Test.Suite_Nonces.Suite); 13 | 14 | procedure Run_BC is new 15 | AUnit.Run.Test_Runner(Test.Suite_Blockciphers.Suite); 16 | procedure Run_OBC is new 17 | AUnit.Run.Test_Runner(Test.Suite_Oneway_Blockciphers.Suite); 18 | procedure Run_AE is new AUnit.Run.Test_Runner(Test.Suite_AE.Suite); 19 | 20 | Reporter : AUnit.Reporter.Text.Text_Reporter; 21 | 22 | use Crypto.Types.Random_Source.Provider; 23 | Dev_U_Rand : Random_Source_Provider; 24 | begin 25 | Dev_U_Rand.Initialize("/dev/urandom"); 26 | Crypto.Types.Random.Set(Dev_U_Rand); 27 | Run_Nonce(Reporter); 28 | Run_BC(Reporter); 29 | Run_OBC(Reporter); 30 | Run_AE(Reporter); 31 | end Test.Symmetric_Ciphers; 32 | -------------------------------------------------------------------------------- /test/test-symmetric_mac.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Symmetric_Mac is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Mac_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Mac_Test); 12 | 13 | function Name(T: Mac_Test) return Test_String; 14 | 15 | procedure Mac_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure Mac_Test2(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Mac_Test3(T: in out Test_Cases.Test_Case'Class); 20 | 21 | procedure Mac_Test4(T: in out Test_Cases.Test_Case'Class); 22 | 23 | procedure Mac_Test5(T: in out Test_Cases.Test_Case'Class); 24 | 25 | procedure Mac_Test6(T: in out Test_Cases.Test_Case'Class); 26 | 27 | procedure Mac_Test7(T: in out Test_Cases.Test_Case'Class); 28 | 29 | procedure Mac_Test8(T: in out Test_Cases.Test_Case'Class); 30 | 31 | procedure Mac_Test9(T: in out Test_Cases.Test_Case'Class); 32 | 33 | procedure Mac_Test10(T: in out Test_Cases.Test_Case'Class); 34 | 35 | procedure Mac_Test11(T: in out Test_Cases.Test_Case'Class); 36 | 37 | procedure Mac_Test12(T: in out Test_Cases.Test_Case'Class); 38 | 39 | procedure Mac_Test20(T: in out Test_Cases.Test_Case'Class); 40 | 41 | procedure Mac_Test21(T: in out Test_Cases.Test_Case'Class); 42 | 43 | procedure Mac_Test22(T: in out Test_Cases.Test_Case'Class); 44 | 45 | procedure Mac_Test23(T: in out Test_Cases.Test_Case'Class); 46 | 47 | procedure Mac_Test24(T: in out Test_Cases.Test_Case'Class); 48 | 49 | 50 | 51 | end Test.Symmetric_Mac; 52 | -------------------------------------------------------------------------------- /test/test-tdes.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.TDES is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type TDES_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out TDES_Test); 12 | 13 | function Name(T: TDES_Test) return Test_String; 14 | 15 | procedure TDES_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure TDES_Test2(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure TDES_Test3(T: in out Test_Cases.Test_Case'Class); 20 | 21 | end Test.TDES; 22 | -------------------------------------------------------------------------------- /test/test-tdes_oneway.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.TDES_Oneway is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type TDES_Oneway_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out TDES_Oneway_Test); 12 | 13 | function Name(T: TDES_Oneway_Test) return Test_String; 14 | 15 | procedure TDES_Oneway_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure TDES_Oneway_Test2(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure TDES_Oneway_Test3(T: in out Test_Cases.Test_Case'Class); 20 | 21 | 22 | 23 | end Test.TDES_Oneway; 24 | -------------------------------------------------------------------------------- /test/test-template.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.template is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type template_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out template_Test); 12 | 13 | function Name(T: template_Test) return Test_String; 14 | 15 | procedure template_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | end Test.template; 18 | -------------------------------------------------------------------------------- /test/test-tests.adb: -------------------------------------------------------------------------------- 1 | with Test.Suite_All; 2 | with AUnit.Run; 3 | with Crypto.Types.Random_Source.Provider; 4 | with Crypto.Types.Random; 5 | with AUnit.Reporter.Text; 6 | with AUnit.Test_Results.ACL; 7 | 8 | procedure Test.Tests is 9 | procedure Run_All is new AUnit.Run.Test_Runner_With_Results(Test.Suite_All.Suite); 10 | Reporter : AUnit.Reporter.Text.Text_Reporter; 11 | Results : AUnit.Test_Results.ACl.ACL_Result; 12 | 13 | use Crypto.Types.Random_Source.Provider; 14 | Dev_U_Rand : Random_Source_Provider; 15 | begin 16 | Dev_U_Rand.Initialize("/dev/urandom"); 17 | Crypto.Types.Random.Set(Dev_U_Rand); 18 | Run_All(Reporter, Results); 19 | end Test.Tests; 20 | -------------------------------------------------------------------------------- /test/test-twofish128.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Twofish128 is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Twofish_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Twofish_Test); 12 | 13 | function Name(T: Twofish_Test) return Test_String; 14 | 15 | procedure Twofish128_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure Twofish128_Test2(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Twofish128_Test3(T: in out Test_Cases.Test_Case'Class); 20 | 21 | end Test.Twofish128; 22 | -------------------------------------------------------------------------------- /test/test-twofish128_oneway.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Twofish128_Oneway is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Twofish_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Twofish_Test); 12 | 13 | function Name(T: Twofish_Test) return Test_String; 14 | 15 | procedure Twofish128_Oneway_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | 18 | end Test.Twofish128_Oneway; 19 | -------------------------------------------------------------------------------- /test/test-twofish192.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.Twofish192 is 5 | use AUnit; 6 | 7 | type Twofish_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out Twofish_Test); 10 | 11 | function Name(T: Twofish_Test) return Test_String; 12 | 13 | procedure Twofish192_Test1(T: in out Test_Cases.Test_Case'Class); 14 | 15 | procedure Twofish192_Test2(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure Twofish192_Test3(T: in out Test_Cases.Test_Case'Class); 18 | 19 | end Test.Twofish192; 20 | -------------------------------------------------------------------------------- /test/test-twofish192_oneway.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Twofish192_Oneway is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Twofish_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Twofish_Test); 12 | 13 | function Name(T: Twofish_Test) return Test_String; 14 | 15 | procedure Twofish192_Oneway_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | 18 | end Test.Twofish192_Oneway; 19 | -------------------------------------------------------------------------------- /test/test-twofish256.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Twofish256 is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Twofish_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Twofish_Test); 12 | 13 | function Name(T: Twofish_Test) return Test_String; 14 | 15 | procedure Twofish256_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure Twofish256_Test2(T: in out Test_Cases.Test_Case'Class); 18 | 19 | procedure Twofish256_Test3(T: in out Test_Cases.Test_Case'Class); 20 | 21 | end Test.Twofish256; 22 | -------------------------------------------------------------------------------- /test/test-twofish256_oneway.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Twofish256_Oneway is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Twofish_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Twofish_Test); 12 | 13 | function Name(T: Twofish_Test) return Test_String; 14 | 15 | procedure Twofish256_Oneway_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | 18 | end Test.Twofish256_Oneway; 19 | -------------------------------------------------------------------------------- /test/test-whirlpool.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | 4 | package Test.Whirlpool is 5 | use AUnit; 6 | 7 | type SHA_Test is new Test_Cases.Test_Case with null record; 8 | 9 | procedure Register_Tests(T: in out SHA_Test); 10 | 11 | function Name(T: SHA_Test) return Test_String; 12 | 13 | procedure Whirlpool_Test1(T: in out Test_Cases.Test_Case'Class); 14 | 15 | procedure Whirlpool_Test2(T: in out Test_Cases.Test_Case'Class); 16 | 17 | procedure Whirlpool_Test3(T: in out Test_Cases.Test_Case'Class); 18 | 19 | end Test.Whirlpool; 20 | -------------------------------------------------------------------------------- /test/test-whirlpool_mac.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Whirlpool_MAC is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type HMAC_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out HMAC_Test); 12 | 13 | function Name(T: HMAC_Test) return Test_String; 14 | 15 | procedure Whirlpool_MAC_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | end Test.Whirlpool_MAC; 18 | -------------------------------------------------------------------------------- /test/test-whirlpool_oneway.ads: -------------------------------------------------------------------------------- 1 | with AUnit; 2 | with AUnit.Test_Cases; 3 | with Ada.Strings.Unbounded; 4 | 5 | package Test.Whirlpool_Oneway is 6 | use AUnit; 7 | use Ada.Strings.Unbounded; 8 | 9 | type Whirlpool_Oneway_Test is new Test_Cases.Test_Case with null record; 10 | 11 | procedure Register_Tests(T: in out Whirlpool_Oneway_Test); 12 | 13 | function Name(T: Whirlpool_Oneway_Test) return Test_String; 14 | 15 | procedure Whirlpool_Oneway_Test1(T: in out Test_Cases.Test_Case'Class); 16 | 17 | 18 | end Test.Whirlpool_Oneway; 19 | -------------------------------------------------------------------------------- /test/test.ads: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | package Test is 24 | end Test; 25 | -------------------------------------------------------------------------------- /test/tools/gen_coverage_page.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | COVERAGE_DIR="coverage/" 3 | SRC_PATH="../src" 4 | TEST_PATH=".." 5 | 6 | mkdir -p ${COVERAGE_DIR} 7 | CURRENT=`pwd` 8 | cd ${SRC_PATH} 9 | gcov -a -b * 10 | cd ${CURRENT} 11 | gcov -a -b * 12 | cd ${COVERAGE_DIR} 13 | lcov -q -c -d ${TEST_PATH} -d ../${SRC_PATH} -o tracefile 14 | genhtml -q -s -t "Ada Crypto Library Coverage Report" --legend --highlight --function-coverage tracefile 15 | cd ${CURRENT} 16 | 17 | -------------------------------------------------------------------------------- /test/tools/lc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for i in $* 4 | do 5 | TEMP='mktemp' 6 | cat GMGPL $i > $TEMP 7 | mv $TEMP $i 8 | done -------------------------------------------------------------------------------- /test/tools/morver.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int args, char *argv[]) 4 | { 5 | 6 | int base = 16; 7 | 8 | while(*++argv) 9 | { 10 | printf("%i#%s#, ",base,*argv); 11 | } 12 | puts(""); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /test/tools/w.adb: -------------------------------------------------------------------------------- 1 | -- This program is free software; you can redistribute it and/or 2 | -- modify it under the terms of the GNU General Public License as 3 | -- published by the Free Software Foundation; either version 2 of the 4 | -- License, or (at your option) any later version. 5 | 6 | -- This program is distributed in the hope that it will be useful, 7 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 | -- General Public License for more details. 10 | 11 | -- You should have received a copy of the GNU General Public License 12 | -- along with this program; if not, write to the Free Software 13 | -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 | -- 02111-1307, USA. 15 | 16 | -- As a special exception, if other files instantiate generics from 17 | -- this unit, or you link this unit with other files to produce an 18 | -- executable, this unit does not by itself cause the resulting 19 | -- executable to be covered by the GNU General Public License. This 20 | -- exception does not however invalidate any other reasons why the 21 | -- executable file might be covered by the GNU Public License. 22 | 23 | with Crypto.Types; use Crypto.Types; 24 | with Crypto.Hashfunction.Tiger2; 25 | use Crypto.Hashfunction.Tiger2; 26 | with Ada.Text_IO; use Ada.Text_IO; 27 | 28 | procedure W is 29 | package DIO is new Ada.Text_Io.Modular_IO (DWord); 30 | 31 | 32 | M : Bytes := To_Bytes("abc"); 33 | 34 | H : DW_Block192; 35 | 36 | begin 37 | Tiger2(M,H); 38 | 39 | for I in H'Range loop 40 | DIO.Put(H(I), Base => 16); 41 | end loop; 42 | end W; 43 | 44 | -------------------------------------------------------------------------------- /test/tools/y.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for i in *.tex; do 4 | TEMP=`mktemp` 5 | sed s/"[a-zA-Z]*_To_"/To_/g $i > $TEMP; 6 | mv $TEMP $i 7 | done -------------------------------------------------------------------------------- /test/tools/z.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | for i in *.ad?; do 3 | TEMP=`mktemp` 4 | cat $i | grep -vi AUnit.Test_Cases.Registration > $TEMP; 5 | mv $TEMP $i 6 | done --------------------------------------------------------------------------------