Karel Miko 7 лет назад
Родитель
Сommit
34daa41871
7 измененных файлов с 513 добавлено и 6 удалено
  1. 24 0
      .gitignore
  2. 275 0
      Makefile.am
  3. 22 0
      autogen.sh
  4. 175 0
      configure.ac
  5. 12 1
      helper.pl
  6. 5 5
      libtomcrypt.pc.in
  7. 0 0
      makefile.static

+ 24 - 0
.gitignore

@@ -40,6 +40,7 @@ small
 small.exe
 test
 test.exe
+test_*
 tv_gen
 tv_gen.exe
 timing
@@ -102,3 +103,26 @@ coverage*.info
 cov-int/
 .coverity_*
 libtomcrypt.lzma
+
+# autotools related
+/autom4te.cache/
+/aux-dist/
+/m4/
+Makefile
+Makefile.in
+aclocal.m4
+config.h
+config.h.in
+config.log
+config.status
+configure
+configure.scan
+coverage_report
+depcomp
+missing
+libtool
+stamp-h1
+*.loT
+*~
+.deps
+.dirstamp

+ 275 - 0
Makefile.am

@@ -0,0 +1,275 @@
+ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+AUTOMAKE_OPTIONS = foreign nostdinc subdir-objects
+
+lib_LTLIBRARIES = libtomcrypt.la
+
+libtomcrypt_la_LDFLAGS = -version-number $(ABI_VERSION) -no-undefined $(LTM_LDFLAGS) $(GMP_LDFLAGS) $(TFM_LDFLAGS)
+libtomcrypt_la_CFLAGS = -I$(top_builddir)/src/headers $(LTM_CPPFLAGS) $(GMP_CPPFLAGS) $(TFM_CPPFLAGS) $(WARNING_FLAGS)
+
+EXTRA_DIST = libtomcrypt.pc.in autogen.sh configure.ac Makefile.am
+
+# the files in include_HEADERS are installed during "make install"
+include_HEADERS = src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
+src/headers/tomcrypt_cipher.h src/headers/tomcrypt_custom.h src/headers/tomcrypt_hash.h \
+src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h src/headers/tomcrypt_math.h \
+src/headers/tomcrypt_misc.h src/headers/tomcrypt_pk.h src/headers/tomcrypt_pkcs.h \
+src/headers/tomcrypt_prng.h
+
+# the following list is automatically updated
+libtomcrypt_la_SOURCES=src/ciphers/aes/aes.c src/ciphers/anubis.c src/ciphers/blowfish.c \
+src/ciphers/camellia.c src/ciphers/cast5.c src/ciphers/des.c src/ciphers/idea.c src/ciphers/kasumi.c \
+src/ciphers/khazad.c src/ciphers/kseed.c src/ciphers/multi2.c src/ciphers/noekeon.c src/ciphers/rc2.c \
+src/ciphers/rc5.c src/ciphers/rc6.c src/ciphers/safer/safer.c src/ciphers/safer/saferp.c \
+src/ciphers/serpent.c src/ciphers/skipjack.c src/ciphers/twofish/twofish.c src/ciphers/xtea.c \
+src/encauth/ccm/ccm_add_aad.c src/encauth/ccm/ccm_add_nonce.c src/encauth/ccm/ccm_done.c \
+src/encauth/ccm/ccm_init.c src/encauth/ccm/ccm_memory.c src/encauth/ccm/ccm_process.c \
+src/encauth/ccm/ccm_reset.c src/encauth/ccm/ccm_test.c \
+src/encauth/chachapoly/chacha20poly1305_add_aad.c src/encauth/chachapoly/chacha20poly1305_decrypt.c \
+src/encauth/chachapoly/chacha20poly1305_done.c src/encauth/chachapoly/chacha20poly1305_encrypt.c \
+src/encauth/chachapoly/chacha20poly1305_init.c src/encauth/chachapoly/chacha20poly1305_memory.c \
+src/encauth/chachapoly/chacha20poly1305_setiv.c \
+src/encauth/chachapoly/chacha20poly1305_setiv_rfc7905.c \
+src/encauth/chachapoly/chacha20poly1305_test.c src/encauth/eax/eax_addheader.c \
+src/encauth/eax/eax_decrypt.c src/encauth/eax/eax_decrypt_verify_memory.c src/encauth/eax/eax_done.c \
+src/encauth/eax/eax_encrypt.c src/encauth/eax/eax_encrypt_authenticate_memory.c \
+src/encauth/eax/eax_init.c src/encauth/eax/eax_test.c src/encauth/gcm/gcm_add_aad.c \
+src/encauth/gcm/gcm_add_iv.c src/encauth/gcm/gcm_done.c src/encauth/gcm/gcm_gf_mult.c \
+src/encauth/gcm/gcm_init.c src/encauth/gcm/gcm_memory.c src/encauth/gcm/gcm_mult_h.c \
+src/encauth/gcm/gcm_process.c src/encauth/gcm/gcm_reset.c src/encauth/gcm/gcm_test.c \
+src/encauth/ocb/ocb_decrypt.c src/encauth/ocb/ocb_decrypt_verify_memory.c \
+src/encauth/ocb/ocb_done_decrypt.c src/encauth/ocb/ocb_done_encrypt.c src/encauth/ocb/ocb_encrypt.c \
+src/encauth/ocb/ocb_encrypt_authenticate_memory.c src/encauth/ocb/ocb_init.c src/encauth/ocb/ocb_ntz.c \
+src/encauth/ocb/ocb_shift_xor.c src/encauth/ocb/ocb_test.c src/encauth/ocb/s_ocb_done.c \
+src/encauth/ocb3/ocb3_add_aad.c src/encauth/ocb3/ocb3_decrypt.c src/encauth/ocb3/ocb3_decrypt_last.c \
+src/encauth/ocb3/ocb3_decrypt_verify_memory.c src/encauth/ocb3/ocb3_done.c \
+src/encauth/ocb3/ocb3_encrypt.c src/encauth/ocb3/ocb3_encrypt_authenticate_memory.c \
+src/encauth/ocb3/ocb3_encrypt_last.c src/encauth/ocb3/ocb3_init.c src/encauth/ocb3/ocb3_int_ntz.c \
+src/encauth/ocb3/ocb3_int_xor_blocks.c src/encauth/ocb3/ocb3_test.c src/hashes/blake2b.c \
+src/hashes/blake2s.c src/hashes/chc/chc.c src/hashes/helper/hash_file.c \
+src/hashes/helper/hash_filehandle.c src/hashes/helper/hash_memory.c \
+src/hashes/helper/hash_memory_multi.c src/hashes/md2.c src/hashes/md4.c src/hashes/md5.c \
+src/hashes/rmd128.c src/hashes/rmd160.c src/hashes/rmd256.c src/hashes/rmd320.c src/hashes/sha1.c \
+src/hashes/sha2/sha224.c src/hashes/sha2/sha256.c src/hashes/sha2/sha384.c src/hashes/sha2/sha512.c \
+src/hashes/sha2/sha512_224.c src/hashes/sha2/sha512_256.c src/hashes/sha3.c src/hashes/sha3_test.c \
+src/hashes/tiger.c src/hashes/whirl/whirl.c src/mac/blake2/blake2bmac.c \
+src/mac/blake2/blake2bmac_file.c src/mac/blake2/blake2bmac_memory.c \
+src/mac/blake2/blake2bmac_memory_multi.c src/mac/blake2/blake2bmac_test.c src/mac/blake2/blake2smac.c \
+src/mac/blake2/blake2smac_file.c src/mac/blake2/blake2smac_memory.c \
+src/mac/blake2/blake2smac_memory_multi.c src/mac/blake2/blake2smac_test.c src/mac/f9/f9_done.c \
+src/mac/f9/f9_file.c src/mac/f9/f9_init.c src/mac/f9/f9_memory.c src/mac/f9/f9_memory_multi.c \
+src/mac/f9/f9_process.c src/mac/f9/f9_test.c src/mac/hmac/hmac_done.c src/mac/hmac/hmac_file.c \
+src/mac/hmac/hmac_init.c src/mac/hmac/hmac_memory.c src/mac/hmac/hmac_memory_multi.c \
+src/mac/hmac/hmac_process.c src/mac/hmac/hmac_test.c src/mac/omac/omac_done.c src/mac/omac/omac_file.c \
+src/mac/omac/omac_init.c src/mac/omac/omac_memory.c src/mac/omac/omac_memory_multi.c \
+src/mac/omac/omac_process.c src/mac/omac/omac_test.c src/mac/pelican/pelican.c \
+src/mac/pelican/pelican_memory.c src/mac/pelican/pelican_test.c src/mac/pmac/pmac_done.c \
+src/mac/pmac/pmac_file.c src/mac/pmac/pmac_init.c src/mac/pmac/pmac_memory.c \
+src/mac/pmac/pmac_memory_multi.c src/mac/pmac/pmac_ntz.c src/mac/pmac/pmac_process.c \
+src/mac/pmac/pmac_shift_xor.c src/mac/pmac/pmac_test.c src/mac/poly1305/poly1305.c \
+src/mac/poly1305/poly1305_file.c src/mac/poly1305/poly1305_memory.c \
+src/mac/poly1305/poly1305_memory_multi.c src/mac/poly1305/poly1305_test.c src/mac/xcbc/xcbc_done.c \
+src/mac/xcbc/xcbc_file.c src/mac/xcbc/xcbc_init.c src/mac/xcbc/xcbc_memory.c \
+src/mac/xcbc/xcbc_memory_multi.c src/mac/xcbc/xcbc_process.c src/mac/xcbc/xcbc_test.c \
+src/math/fp/ltc_ecc_fp_mulmod.c src/math/gmp_desc.c src/math/ltm_desc.c src/math/multi.c \
+src/math/radix_to_bin.c src/math/rand_bn.c src/math/rand_prime.c src/math/tfm_desc.c src/misc/adler32.c \
+src/misc/base16/base16_decode.c src/misc/base16/base16_encode.c src/misc/base32/base32_decode.c \
+src/misc/base32/base32_encode.c src/misc/base64/base64_decode.c src/misc/base64/base64_encode.c \
+src/misc/burn_stack.c src/misc/compare_testvector.c src/misc/copy_or_zeromem.c src/misc/crc32.c \
+src/misc/crypt/crypt.c src/misc/crypt/crypt_argchk.c src/misc/crypt/crypt_cipher_descriptor.c \
+src/misc/crypt/crypt_cipher_is_valid.c src/misc/crypt/crypt_constants.c \
+src/misc/crypt/crypt_find_cipher.c src/misc/crypt/crypt_find_cipher_any.c \
+src/misc/crypt/crypt_find_cipher_id.c src/misc/crypt/crypt_find_hash.c \
+src/misc/crypt/crypt_find_hash_any.c src/misc/crypt/crypt_find_hash_id.c \
+src/misc/crypt/crypt_find_hash_oid.c src/misc/crypt/crypt_find_prng.c src/misc/crypt/crypt_fsa.c \
+src/misc/crypt/crypt_hash_descriptor.c src/misc/crypt/crypt_hash_is_valid.c \
+src/misc/crypt/crypt_inits.c src/misc/crypt/crypt_ltc_mp_descriptor.c \
+src/misc/crypt/crypt_prng_descriptor.c src/misc/crypt/crypt_prng_is_valid.c \
+src/misc/crypt/crypt_prng_rng_descriptor.c src/misc/crypt/crypt_register_all_ciphers.c \
+src/misc/crypt/crypt_register_all_hashes.c src/misc/crypt/crypt_register_all_prngs.c \
+src/misc/crypt/crypt_register_cipher.c src/misc/crypt/crypt_register_hash.c \
+src/misc/crypt/crypt_register_prng.c src/misc/crypt/crypt_sizes.c \
+src/misc/crypt/crypt_unregister_cipher.c src/misc/crypt/crypt_unregister_hash.c \
+src/misc/crypt/crypt_unregister_prng.c src/misc/error_to_string.c src/misc/hkdf/hkdf.c \
+src/misc/hkdf/hkdf_test.c src/misc/mem_neq.c src/misc/padding/padding_depad.c \
+src/misc/padding/padding_pad.c src/misc/pk_get_oid.c src/misc/pk_oid_str.c src/misc/pkcs5/pkcs_5_1.c \
+src/misc/pkcs5/pkcs_5_2.c src/misc/pkcs5/pkcs_5_test.c src/misc/zeromem.c src/modes/cbc/cbc_decrypt.c \
+src/modes/cbc/cbc_done.c src/modes/cbc/cbc_encrypt.c src/modes/cbc/cbc_getiv.c \
+src/modes/cbc/cbc_setiv.c src/modes/cbc/cbc_start.c src/modes/cfb/cfb_decrypt.c \
+src/modes/cfb/cfb_done.c src/modes/cfb/cfb_encrypt.c src/modes/cfb/cfb_getiv.c \
+src/modes/cfb/cfb_setiv.c src/modes/cfb/cfb_start.c src/modes/ctr/ctr_decrypt.c \
+src/modes/ctr/ctr_done.c src/modes/ctr/ctr_encrypt.c src/modes/ctr/ctr_getiv.c \
+src/modes/ctr/ctr_setiv.c src/modes/ctr/ctr_start.c src/modes/ctr/ctr_test.c \
+src/modes/ecb/ecb_decrypt.c src/modes/ecb/ecb_done.c src/modes/ecb/ecb_encrypt.c \
+src/modes/ecb/ecb_start.c src/modes/f8/f8_decrypt.c src/modes/f8/f8_done.c src/modes/f8/f8_encrypt.c \
+src/modes/f8/f8_getiv.c src/modes/f8/f8_setiv.c src/modes/f8/f8_start.c src/modes/f8/f8_test_mode.c \
+src/modes/lrw/lrw_decrypt.c src/modes/lrw/lrw_done.c src/modes/lrw/lrw_encrypt.c \
+src/modes/lrw/lrw_getiv.c src/modes/lrw/lrw_process.c src/modes/lrw/lrw_setiv.c \
+src/modes/lrw/lrw_start.c src/modes/lrw/lrw_test.c src/modes/ofb/ofb_decrypt.c src/modes/ofb/ofb_done.c \
+src/modes/ofb/ofb_encrypt.c src/modes/ofb/ofb_getiv.c src/modes/ofb/ofb_setiv.c \
+src/modes/ofb/ofb_start.c src/modes/xts/xts_decrypt.c src/modes/xts/xts_done.c \
+src/modes/xts/xts_encrypt.c src/modes/xts/xts_init.c src/modes/xts/xts_mult_x.c \
+src/modes/xts/xts_test.c src/pk/asn1/der/bit/der_decode_bit_string.c \
+src/pk/asn1/der/bit/der_decode_raw_bit_string.c src/pk/asn1/der/bit/der_encode_bit_string.c \
+src/pk/asn1/der/bit/der_encode_raw_bit_string.c src/pk/asn1/der/bit/der_length_bit_string.c \
+src/pk/asn1/der/boolean/der_decode_boolean.c src/pk/asn1/der/boolean/der_encode_boolean.c \
+src/pk/asn1/der/boolean/der_length_boolean.c src/pk/asn1/der/choice/der_decode_choice.c \
+src/pk/asn1/der/custom_type/der_decode_custom_type.c \
+src/pk/asn1/der/custom_type/der_encode_custom_type.c \
+src/pk/asn1/der/custom_type/der_length_custom_type.c src/pk/asn1/der/general/der_asn1_maps.c \
+src/pk/asn1/der/general/der_decode_asn1_identifier.c src/pk/asn1/der/general/der_decode_asn1_length.c \
+src/pk/asn1/der/general/der_encode_asn1_identifier.c src/pk/asn1/der/general/der_encode_asn1_length.c \
+src/pk/asn1/der/general/der_length_asn1_identifier.c src/pk/asn1/der/general/der_length_asn1_length.c \
+src/pk/asn1/der/generalizedtime/der_decode_generalizedtime.c \
+src/pk/asn1/der/generalizedtime/der_encode_generalizedtime.c \
+src/pk/asn1/der/generalizedtime/der_length_generalizedtime.c \
+src/pk/asn1/der/ia5/der_decode_ia5_string.c src/pk/asn1/der/ia5/der_encode_ia5_string.c \
+src/pk/asn1/der/ia5/der_length_ia5_string.c src/pk/asn1/der/integer/der_decode_integer.c \
+src/pk/asn1/der/integer/der_encode_integer.c src/pk/asn1/der/integer/der_length_integer.c \
+src/pk/asn1/der/object_identifier/der_decode_object_identifier.c \
+src/pk/asn1/der/object_identifier/der_encode_object_identifier.c \
+src/pk/asn1/der/object_identifier/der_length_object_identifier.c \
+src/pk/asn1/der/octet/der_decode_octet_string.c src/pk/asn1/der/octet/der_encode_octet_string.c \
+src/pk/asn1/der/octet/der_length_octet_string.c \
+src/pk/asn1/der/printable_string/der_decode_printable_string.c \
+src/pk/asn1/der/printable_string/der_encode_printable_string.c \
+src/pk/asn1/der/printable_string/der_length_printable_string.c \
+src/pk/asn1/der/sequence/der_decode_sequence_ex.c \
+src/pk/asn1/der/sequence/der_decode_sequence_flexi.c \
+src/pk/asn1/der/sequence/der_decode_sequence_multi.c \
+src/pk/asn1/der/sequence/der_encode_sequence_ex.c \
+src/pk/asn1/der/sequence/der_encode_sequence_multi.c src/pk/asn1/der/sequence/der_length_sequence.c \
+src/pk/asn1/der/sequence/der_sequence_free.c src/pk/asn1/der/sequence/der_sequence_shrink.c \
+src/pk/asn1/der/set/der_encode_set.c src/pk/asn1/der/set/der_encode_setof.c \
+src/pk/asn1/der/short_integer/der_decode_short_integer.c \
+src/pk/asn1/der/short_integer/der_encode_short_integer.c \
+src/pk/asn1/der/short_integer/der_length_short_integer.c \
+src/pk/asn1/der/teletex_string/der_decode_teletex_string.c \
+src/pk/asn1/der/teletex_string/der_length_teletex_string.c \
+src/pk/asn1/der/utctime/der_decode_utctime.c src/pk/asn1/der/utctime/der_encode_utctime.c \
+src/pk/asn1/der/utctime/der_length_utctime.c src/pk/asn1/der/utf8/der_decode_utf8_string.c \
+src/pk/asn1/der/utf8/der_encode_utf8_string.c src/pk/asn1/der/utf8/der_length_utf8_string.c \
+src/pk/asn1/x509/x509_decode_subject_public_key_info.c \
+src/pk/asn1/x509/x509_encode_subject_public_key_info.c src/pk/dh/dh.c src/pk/dh/dh_check_pubkey.c \
+src/pk/dh/dh_export.c src/pk/dh/dh_export_key.c src/pk/dh/dh_free.c src/pk/dh/dh_generate_key.c \
+src/pk/dh/dh_import.c src/pk/dh/dh_set.c src/pk/dh/dh_set_pg_dhparam.c src/pk/dh/dh_shared_secret.c \
+src/pk/dsa/dsa_decrypt_key.c src/pk/dsa/dsa_encrypt_key.c src/pk/dsa/dsa_export.c src/pk/dsa/dsa_free.c \
+src/pk/dsa/dsa_generate_key.c src/pk/dsa/dsa_generate_pqg.c src/pk/dsa/dsa_import.c \
+src/pk/dsa/dsa_make_key.c src/pk/dsa/dsa_set.c src/pk/dsa/dsa_set_pqg_dsaparam.c \
+src/pk/dsa/dsa_shared_secret.c src/pk/dsa/dsa_sign_hash.c src/pk/dsa/dsa_verify_hash.c \
+src/pk/dsa/dsa_verify_key.c src/pk/ecc/ecc.c src/pk/ecc/ecc_ansi_x963_export.c \
+src/pk/ecc/ecc_ansi_x963_import.c src/pk/ecc/ecc_decrypt_key.c src/pk/ecc/ecc_encrypt_key.c \
+src/pk/ecc/ecc_export.c src/pk/ecc/ecc_export_openssl.c src/pk/ecc/ecc_find_curve.c \
+src/pk/ecc/ecc_free.c src/pk/ecc/ecc_get_key.c src/pk/ecc/ecc_get_oid_str.c src/pk/ecc/ecc_get_size.c \
+src/pk/ecc/ecc_import.c src/pk/ecc/ecc_import_openssl.c src/pk/ecc/ecc_import_x509.c \
+src/pk/ecc/ecc_make_key.c src/pk/ecc/ecc_set_curve.c src/pk/ecc/ecc_set_curve_internal.c \
+src/pk/ecc/ecc_set_key.c src/pk/ecc/ecc_shared_secret.c src/pk/ecc/ecc_sign_hash.c \
+src/pk/ecc/ecc_sizes.c src/pk/ecc/ecc_test.c src/pk/ecc/ecc_verify_hash.c \
+src/pk/ecc/ltc_ecc_export_point.c src/pk/ecc/ltc_ecc_import_point.c src/pk/ecc/ltc_ecc_is_point.c \
+src/pk/ecc/ltc_ecc_is_point_at_infinity.c src/pk/ecc/ltc_ecc_map.c src/pk/ecc/ltc_ecc_mul2add.c \
+src/pk/ecc/ltc_ecc_mulmod.c src/pk/ecc/ltc_ecc_mulmod_timing.c src/pk/ecc/ltc_ecc_points.c \
+src/pk/ecc/ltc_ecc_projective_add_point.c src/pk/ecc/ltc_ecc_projective_dbl_point.c \
+src/pk/ecc/ltc_ecc_verify_key.c src/pk/pkcs1/pkcs_1_i2osp.c src/pk/pkcs1/pkcs_1_mgf1.c \
+src/pk/pkcs1/pkcs_1_oaep_decode.c src/pk/pkcs1/pkcs_1_oaep_encode.c src/pk/pkcs1/pkcs_1_os2ip.c \
+src/pk/pkcs1/pkcs_1_pss_decode.c src/pk/pkcs1/pkcs_1_pss_encode.c src/pk/pkcs1/pkcs_1_v1_5_decode.c \
+src/pk/pkcs1/pkcs_1_v1_5_encode.c src/pk/rsa/rsa_decrypt_key.c src/pk/rsa/rsa_encrypt_key.c \
+src/pk/rsa/rsa_export.c src/pk/rsa/rsa_exptmod.c src/pk/rsa/rsa_free.c src/pk/rsa/rsa_get_size.c \
+src/pk/rsa/rsa_import.c src/pk/rsa/rsa_import_pkcs8.c src/pk/rsa/rsa_import_x509.c \
+src/pk/rsa/rsa_make_key.c src/pk/rsa/rsa_set.c src/pk/rsa/rsa_sign_hash.c \
+src/pk/rsa/rsa_sign_saltlen_get.c src/pk/rsa/rsa_verify_hash.c src/prngs/chacha20.c src/prngs/fortuna.c \
+src/prngs/rc4.c src/prngs/rng_get_bytes.c src/prngs/rng_make_prng.c src/prngs/sober128.c \
+src/prngs/sprng.c src/prngs/yarrow.c src/stream/chacha/chacha_crypt.c src/stream/chacha/chacha_done.c \
+src/stream/chacha/chacha_ivctr32.c src/stream/chacha/chacha_ivctr64.c \
+src/stream/chacha/chacha_keystream.c src/stream/chacha/chacha_setup.c src/stream/chacha/chacha_test.c \
+src/stream/rabbit/rabbit.c src/stream/rc4/rc4_stream.c src/stream/rc4/rc4_test.c \
+src/stream/salsa20/salsa20_crypt.c src/stream/salsa20/salsa20_done.c \
+src/stream/salsa20/salsa20_ivctr64.c src/stream/salsa20/salsa20_keystream.c \
+src/stream/salsa20/salsa20_setup.c src/stream/salsa20/salsa20_test.c \
+src/stream/salsa20/xsalsa20_setup.c src/stream/salsa20/xsalsa20_test.c \
+src/stream/sober128/sober128_stream.c src/stream/sober128/sober128_test.c \
+src/stream/sosemanuk/sosemanuk.c src/stream/sosemanuk/sosemanuk_test.c
+
+if WITH_TOOLS
+bin_PROGRAMS = hashsum
+hashsum_SOURCES = demos/hashsum.c
+hashsum_CFLAGS = -I$(top_builddir)/src/headers
+hashsum_LDADD = libtomcrypt.la
+endif WITH_TOOLS
+
+if WITH_DEMOS
+noinst_PROGRAMS = tv_gen constants timing ltcrypt small sizes
+
+tv_gen_SOURCES = demos/tv_gen.c
+tv_gen_CFLAGS = -I$(top_builddir)/src/headers
+tv_gen_LDADD = libtomcrypt.la
+
+constants_SOURCES = demos/constants.c
+constants_CFLAGS = -I$(top_builddir)/src/headers
+constants_LDADD = libtomcrypt.la
+
+timing_SOURCES = demos/timing.c
+timing_CFLAGS = -I$(top_builddir)/src/headers
+timing_LDADD = libtomcrypt.la
+
+ltcrypt_SOURCES = demos/ltcrypt.c
+ltcrypt_CFLAGS = -I$(top_builddir)/src/headers
+ltcrypt_LDADD = libtomcrypt.la
+
+small_SOURCES = demos/small.c
+small_CFLAGS = -I$(top_builddir)/src/headers
+small_LDADD = libtomcrypt.la
+
+sizes_SOURCES = demos/sizes.c
+sizes_CFLAGS = -I$(top_builddir)/src/headers
+sizes_LDADD = libtomcrypt.la
+endif WITH_DEMOS
+
+TEST_SOURCES=tests/base16_test.c tests/base32_test.c tests/base64_test.c tests/cipher_hash_test.c \
+tests/common.c tests/der_test.c tests/dh_test.c tests/dsa_test.c tests/ecc_test.c tests/file_test.c \
+tests/mac_test.c tests/misc_test.c tests/modes_test.c tests/mpi_test.c tests/multi_test.c tests/no_prng.c \
+tests/padding_test.c tests/pkcs_1_eme_test.c tests/pkcs_1_emsa_test.c tests/pkcs_1_oaep_test.c \
+tests/pkcs_1_pss_test.c tests/pkcs_1_test.c tests/prng_test.c tests/rotate_test.c tests/rsa_test.c \
+tests/store_test.c tests/test.c
+
+check_PROGRAMS =
+
+if WITH_LTM
+test_ltm_SOURCES = $(TEST_SOURCES)
+test_ltm_CFLAGS = -I$(top_builddir)/tests -I$(top_builddir)/src/headers $(WARNING_FLAGS) -DUSE_LTM
+test_ltm_LDADD = libtomcrypt.la
+check_PROGRAMS += test_ltm
+endif WITH_LTM
+
+if WITH_GMP
+test_gmp_SOURCES = $(TEST_SOURCES)
+test_gmp_CFLAGS = -I$(top_builddir)/tests -I$(top_builddir)/src/headers $(WARNING_FLAGS) -DUSE_GMP
+test_gmp_LDADD = libtomcrypt.la
+check_PROGRAMS += test_gmp
+endif WITH_GMP
+
+if WITH_TFM
+test_tfm_SOURCES = $(TEST_SOURCES)
+test_tfm_CFLAGS = -I$(top_builddir)/tests -I$(top_builddir)/src/headers $(WARNING_FLAGS) -DUSE_TFM
+test_tfm_LDADD = libtomcrypt.la
+check_PROGRAMS += test_tfm
+endif WITH_TFM
+
+if WITH_NOMATH
+test_nomath_SOURCES = $(TEST_SOURCES)
+test_nomath_CFLAGS = -I$(top_builddir)/tests -I$(top_builddir)/src/headers $(WARNING_FLAGS)
+test_nomath_LDADD = libtomcrypt.la
+check_PROGRAMS += test_nomath
+endif WITH_NOMATH
+
+check: $(check_PROGRAMS)
+if WITH_NOMATH
+	./test_nomath
+endif WITH_NOMATH
+if WITH_LTM
+	./test_ltm
+endif WITH_LTM
+if WITH_GMP
+	./test_gmp
+endif WITH_GMP
+if WITH_TFM
+	./test_tfm
+endif WITH_TFM

+ 22 - 0
autogen.sh

@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -e
+
+if [ -d /usr/local/share/aclocal ]; then
+  ACLOCAL_DIR=/usr/local/share/aclocal
+elif [ -d /opt/local/share/aclocal ]; then
+  ACLOCAL_DIR=/opt/local/share/aclocal
+elif [ -d /usr/share/aclocal ]; then
+  ACLOCAL_DIR=/usr/share/aclocal
+fi
+
+if [ `uname -s` = Darwin ]; then
+  glibtoolize --automake --copy
+else
+  libtoolize --automake --copy
+fi
+
+autoheader
+aclocal -I m4
+automake --add-missing --copy
+autoconf

+ 175 - 0
configure.ac

@@ -0,0 +1,175 @@
+# https://www.gnu.org/software/automake/manual/automake.html
+# https://www.gnu.org/software/autoconf/manual/autoconf.html
+
+AC_PREREQ([2.63])
+
+AC_INIT([libtomcrypt],[1.18.1])
+AC_SUBST([ABI_VERSION],[1:1:1])
+AC_LANG([C])
+
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_AUX_DIR(aux-dist)
+
+AM_INIT_AUTOMAKE([1.11.1 no-define])
+LT_PREREQ([2.2.6])
+LT_INIT
+
+AC_CONFIG_FILES([Makefile libtomcrypt.pc])
+
+AC_MSG_CHECKING([for compiler warning level (--enable-warnings)])
+AC_ARG_ENABLE([warnings],
+  [AS_HELP_STRING([--enable-warnings[[=0-9]]],[Enable compiler warnings. DEFAULT=0 (for development use 3)])],
+  [AS_CASE([$enableval],
+    [yes],[wlevel=1],
+    [no],[wlevel=0],
+    [[[0-9]]],[wlevel="$enableval"],
+    [wlevel=0]
+  )],
+  [wlevel=0])
+AC_MSG_RESULT([$wlevel])
+AS_CASE([$wlevel],
+  [0],[WARNING_FLAGS=""],
+  [1],[WARNING_FLAGS="-Wall"],
+  [2],[WARNING_FLAGS="-Wall -Wextra"],
+  [3],[WARNING_FLAGS="-Wall -Wextra -Werror"],
+  # --enable-warnings=6 requires gcc v6
+  [6],[WARNING_FLAGS="-Wall -Wextra -Werror -Wdeclaration-after-statement -Wmissing-declarations -Wmissing-prototypes -Wmissing-noreturn -Woverflow -Wnonnull -Wunused-const-variable -Wundef -Wshift-negative-value -Wshift-overflow -Wtautological-compare -Wmisleading-indentation -Woverride-init-side-effects -Wnonnull-compare -Wnull-dereference -Wwrite-strings -Wshadow -Wjump-misses-init -Wlogical-op -Wduplicated-cond -Wformat=2 -Wmaybe-uninitialized -Wunused-parameter -Wbad-function-cast -Wcast-align -Wchar-subscripts -Wcomment -Wfloat-equal -Wimplicit -Wnormalized=id -Woverride-init -Wparentheses -Wpointer-arith -Wstrict-prototypes"],
+  # --enable-warnings=7 requires gcc v7
+  [7],[WARNING_FLAGS="-Wall -Wextra -Werror -Wdeclaration-after-statement -Wimplicit-fallthrough -Wmissing-declarations -Wmissing-prototypes -Wmissing-noreturn -Woverflow -Wnonnull -Walloc-zero -Wdangling-else -Wswitch-unreachable -Wrestrict -Wduplicated-branches -Wpointer-compare -Wunused-const-variable -Wundef -Wshift-negative-value -Wshift-overflow -Wtautological-compare -Wmisleading-indentation -Woverride-init-side-effects -Wnonnull-compare -Wnull-dereference -Wwrite-strings -Wshadow -Wjump-misses-init -Wlogical-op -Wduplicated-cond -Wformat=2 -Wmaybe-uninitialized -Wunused-parameter -Wbad-function-cast -Wcast-align -Wchar-subscripts -Wcomment -Wfloat-equal -Wimplicit -Wnormalized=id -Woverride-init -Wparentheses -Wpointer-arith -Wstrict-prototypes"],
+)
+AC_SUBST(WARNING_FLAGS)
+
+# Check for LTM
+AC_MSG_CHECKING([whether to build libtomcrypt with libtommath (--with-ltm)])
+AC_ARG_WITH([ltm],
+  [AS_HELP_STRING(
+    [--with-ltm[[=ARG]]],
+    [Use libtommath to build libtomcrypt. Optional ARG is the libtommath installation prefix (if not given libtommath is detected via pkg-config). DEFAULT=enabled]
+  )],
+  [AS_CASE([$with_ltm],
+    [yes],[with_ltm_result=yes],
+    [no],[with_ltm_result=no],
+    [with_ltm_result=yes;with_ltm_path="$with_ltm"]
+  )],
+  [with_ltm_result=yes]
+)
+AC_MSG_RESULT([$with_ltm_result])
+AS_VAR_IF([with_ltm_result],[yes],[
+  AS_VAR_SET_IF([with_ltm_path],
+    [
+      extra_inc="-I$with_ltm_path/include"
+      extra_lib="-L$with_ltm_path/lib"
+    ],
+    [
+      extra_inc=`pkg-config --cflags-only-I libtommath 2>/dev/null`
+      extra_lib=`pkg-config --libs-only-L libtommath 2>/dev/null`
+    ]
+  )
+  CPPFLAGS="$CPPFLAGS $extra_inc"
+  LDFLAGS="$LDFLAGS $extra_lib"
+  AC_CHECK_HEADER([tommath.h],[extra_cppflags="$extra_inc -DLTM_DESC"],[AC_MSG_ERROR([libtommath is not usable.])])
+  AC_CHECK_LIB([tommath],[mp_add],[extra_ldflags="$extra_lib -ltommath"],[AC_MSG_ERROR([libtommath is not usable.])])
+  CPPFLAGS="$temp_cppflags"
+  LDFLAGS="$temp_ldflags"
+  AC_SUBST([LTM_CPPFLAGS],[$extra_cppflags])
+  AC_SUBST([LTM_LDFLAGS],[$extra_ldflags])
+  AC_MSG_RESULT([         Build with ltm: yes])
+  AC_MSG_RESULT([         LTM_CPPFLAGS=$extra_cppflags])
+  AC_MSG_RESULT([         LTM_LDFLAGS=$extra_ldflags])
+])
+
+# Check for GMP
+AC_MSG_CHECKING([whether to build libtomcrypt with GMP (--with-gmp)])
+AC_ARG_WITH([gmp],
+  [AS_HELP_STRING(
+    [--with-gmp[[=ARG]]],
+    [Use GMP to build libtomcrypt. Optional ARG is the GMP installation prefix (if not given GMP is detected via pkg-config). DEFAULT=disabled]
+  )],
+  [AS_CASE([$with_gmp],
+    [yes],[with_gmp_result=yes],
+    [no],[with_gmp_result=no],
+    [with_gmp_result=yes;with_gmp_path="$with_gmp"]
+  )],
+  [with_gmp_result=no]
+)
+AC_MSG_RESULT([$with_gmp_result])
+AS_VAR_IF([with_gmp_result],[yes],[
+  AS_VAR_SET_IF([with_gmp_path],
+    [
+      extra_inc="-I$with_gmp_path/include"
+      extra_lib="-L$with_gmp_path/lib"
+    ],
+    [
+      extra_inc=`pkg-config --cflags-only-I gmp 2>/dev/null`
+      extra_lib=`pkg-config --libs-only-L gmp 2>/dev/null`
+    ]
+  )
+  CPPFLAGS="$CPPFLAGS $extra_inc"
+  LDFLAGS="$LDFLAGS $extra_lib"
+  AC_CHECK_HEADER([gmp.h],[extra_cppflags="$extra_inc -DGMP_DESC"],[AC_MSG_ERROR([gmp is not usable.])])
+  AC_CHECK_LIB([gmp],[ __gmpz_init],[extra_ldflags="$extra_lib -lgmp"],[AC_MSG_ERROR([gmp is not usable.])])
+  CPPFLAGS="$temp_cppflags"
+  LDFLAGS="$temp_ldflags"
+  AC_SUBST([GMP_CPPFLAGS],[$extra_cppflags])
+  AC_SUBST([GMP_LDFLAGS],[$extra_ldflags])
+  AC_MSG_RESULT([         Build with gmp: yes])
+  AC_MSG_RESULT([         GMP_CPPFLAGS=$extra_cppflags])
+  AC_MSG_RESULT([         GMP_LDFLAGS=$extra_ldflags])
+])
+
+# Check for TFM
+AC_MSG_CHECKING([whether to build libtomcrypt with tomsfastmath (--with-tfm)])
+AC_ARG_WITH([tfm],
+  [AS_HELP_STRING(
+    [--with-tfm[[=ARG]]],
+    [Use tomsfastmath to build libtomcrypt. Optional ARG is the tfm installation prefix (if not given tfm is detected via pkg-config). DEFAULT=disabled]
+  )],
+  [AS_CASE([$with_tfm],
+    [yes],[with_tfm_result=yes],
+    [no],[with_tfm_result=no],
+    [with_tfm_result=yes;with_tfm_path="$with_tfm"]
+  )],
+  [with_tfm_result=no]
+)
+AC_MSG_RESULT([$with_tfm_result])
+AS_VAR_IF([with_tfm_result],[yes],[
+  AS_VAR_SET_IF([with_tfm_path],
+    [
+      extra_inc="-I$with_tfm_path/include"
+      extra_lib="-L$with_tfm_path/lib"
+    ],
+    [
+      extra_inc=`pkg-config --cflags-only-I tomsfastmath 2>/dev/null`
+      extra_lib=`pkg-config --libs-only-L tomsfastmath 2>/dev/null`
+    ]
+  )
+  CPPFLAGS="$CPPFLAGS $extra_inc"
+  LDFLAGS="$LDFLAGS $extra_lib"
+  AC_CHECK_HEADER([tfm.h],[extra_cppflags="$extra_inc -DTFM_DESC"],[AC_MSG_ERROR([tomsfastmath is not usable.])])
+  AC_CHECK_LIB([tfm],[fp_add],[extra_ldflags="$extra_lib -ltfm"],[AC_MSG_ERROR([tomsfastmath is not usable.])])
+  CPPFLAGS="$temp_cppflags"
+  LDFLAGS="$temp_ldflags"
+  AC_SUBST([TFM_CPPFLAGS],[$extra_cppflags])
+  AC_SUBST([TFM_LDFLAGS],[$extra_ldflags])
+  AC_MSG_RESULT([         Build with ltm: yes])
+  AC_MSG_RESULT([         TFM_CPPFLAGS=$extra_cppflags])
+  AC_MSG_RESULT([         TFM_LDFLAGS=$extra_ldflags])
+])
+
+AC_ARG_WITH(tools,AC_HELP_STRING([--with-tools],[Build and install libtomcrypt tools. DEFAULT=disabled]),build_tools=$withval,build_tools=no)
+AC_ARG_WITH(demos,AC_HELP_STRING([--with-demos],[Build libtomcrypt demos. DEFAULT=disabled]),build_demos=$withval,build_demos=no)
+
+AM_CONDITIONAL([WITH_DEMOS],[test "x$build_demos" = "xyes"])
+AM_CONDITIONAL([WITH_TOOLS],[test "x$build_tools" = "xyes"])
+
+AM_CONDITIONAL([WITH_LTM],[test -n "$LTM_LDFLAGS"])
+AM_CONDITIONAL([WITH_GMP],[test -n "$GMP_LDFLAGS"])
+AM_CONDITIONAL([WITH_TFM],[test -n "$TFM_LDFLAGS"])
+
+AM_CONDITIONAL([WITH_NOMATH],[test -z "$LTM_LDFLAGS$GMP_LDFLAGS$TFM_LDFLAGS"])
+
+AC_MSG_RESULT([         Build demos: $build_demos])
+AC_MSG_RESULT([         Build tools: $build_tools])
+
+AC_OUTPUT

+ 12 - 1
helper.pl

@@ -307,6 +307,17 @@ sub process_makefiles {
 
   my @ver_version = version_from_tomcrypt_h("src/headers/tomcrypt.h");
 
+  # update Makefile.am
+  my $old = read_file('Makefile.am');
+  my $var_sources = prepare_variable("libtomcrypt_la_SOURCES", sort @c);
+  my $var_tsources = prepare_variable("TEST_SOURCES", sort @t);
+  my $new = patch_file($old, $var_sources, $var_tsources);
+  if ($old ne $new) {
+    write_file('Makefile.am', $new) if $write;
+    warn "changed: Makefile.am\n";
+    $changed_count++;
+  }
+
   # update MSVC project files
   my $msvc_files = prepare_msvc_files_xml(\@all, qr/tab\.c$/, ['Debug|Win32', 'Release|Win32', 'Debug|x64', 'Release|x64']);
   for my $m (qw/libtomcrypt_VS2008.vcproj/) {
@@ -321,7 +332,7 @@ sub process_makefiles {
   }
 
   # update OBJECTS + HEADERS in makefile*
-  for my $m (qw/ makefile makefile.shared makefile.unix makefile.mingw makefile.msvc makefile_include.mk doc\/Doxyfile /) {
+  for my $m (qw/ makefile.static makefile.shared makefile.unix makefile.mingw makefile.msvc makefile_include.mk doc\/Doxyfile /) {
     my $old = read_file($m);
     my $new = $m eq 'makefile.msvc' ? patch_file($old, $var_obj, $var_h, $var_tobj, @ver_version)
                                     : patch_file($old, $var_o, $var_h, $var_to, @ver_version);

+ 5 - 5
libtomcrypt.pc.in

@@ -1,10 +1,10 @@
-prefix=@to-be-replaced@
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
-includedir=${prefix}/include
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
 
 Name: LibTomCrypt
 Description: public domain open source cryptographic toolkit
-Version: @to-be-replaced@
+Version: @PACKAGE_VERSION@
 Libs: -L${libdir} -ltomcrypt
 Cflags: -I${includedir}

+ 0 - 0
makefile → makefile.static