Makefile.am 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. bin_PROGRAMS= scrypt
  2. noinst_PROGRAMS= tests/verify-strings/test_scrypt \
  3. tests/valgrind/potential-memleaks
  4. dist_man_MANS=$(scrypt_man_MANS)
  5. ACLOCAL_AMFLAGS= -I m4
  6. # These files fulfill the crypto_scrypt() function, with the exception of
  7. # libcperciva/alg/sha256_shani.c
  8. # lib/crypto/crypto_scrypt_smix_sse2.c
  9. # which require special compiler flags and are thus compiled as separate
  10. # libraries. See test_scrypt for an example.
  11. crypto_scrypt_files= lib/crypto/crypto_scrypt.c \
  12. lib/crypto/crypto_scrypt.h \
  13. lib/crypto/crypto_scrypt_smix.c \
  14. lib/crypto/crypto_scrypt_smix.h \
  15. lib/crypto/crypto_scrypt_smix_sse2.h \
  16. lib/platform.h \
  17. libcperciva/alg/sha256.c \
  18. libcperciva/alg/sha256.h \
  19. libcperciva/alg/sha256_shani.h \
  20. libcperciva/cpusupport/cpusupport.h \
  21. libcperciva/cpusupport/cpusupport_x86_shani.c \
  22. libcperciva/cpusupport/cpusupport_x86_sse2.c \
  23. libcperciva/cpusupport/cpusupport_x86_ssse3.c \
  24. libcperciva/util/insecure_memzero.c \
  25. libcperciva/util/insecure_memzero.h \
  26. libcperciva/util/warnp.c \
  27. libcperciva/util/warnp.h
  28. scrypt_SOURCES= main.c \
  29. lib/scryptenc/scryptenc.c \
  30. lib/scryptenc/scryptenc.h \
  31. lib/scryptenc/scryptenc_cpuperf.c \
  32. lib/scryptenc/scryptenc_cpuperf.h \
  33. lib/util/memlimit.c \
  34. lib/util/memlimit.h \
  35. libcperciva/cpusupport/cpusupport_x86_aesni.c \
  36. libcperciva/cpusupport/cpusupport_x86_rdrand.c \
  37. libcperciva/crypto/crypto_aes.c \
  38. libcperciva/crypto/crypto_aes.h \
  39. libcperciva/crypto/crypto_aes_aesni.h \
  40. libcperciva/crypto/crypto_aesctr.c \
  41. libcperciva/crypto/crypto_aesctr.h \
  42. libcperciva/crypto/crypto_entropy.c \
  43. libcperciva/crypto/crypto_entropy.h \
  44. libcperciva/crypto/crypto_entropy_rdrand.h \
  45. libcperciva/crypto/crypto_verify_bytes.c \
  46. libcperciva/crypto/crypto_verify_bytes.h \
  47. libcperciva/util/asprintf.c \
  48. libcperciva/util/asprintf.h \
  49. libcperciva/util/entropy.c \
  50. libcperciva/util/entropy.h \
  51. libcperciva/util/getopt.c \
  52. libcperciva/util/getopt.h \
  53. libcperciva/util/humansize.c \
  54. libcperciva/util/humansize.h \
  55. libcperciva/util/monoclock.c \
  56. libcperciva/util/monoclock.h \
  57. libcperciva/util/parsenum.h \
  58. libcperciva/util/readpass.c \
  59. libcperciva/util/readpass.h \
  60. libcperciva/util/sysendian.h
  61. if LIBSCRYPT_KDF
  62. scrypt_LDADD= libscrypt-kdf.la
  63. # Although crypto_scrypt() will be provided by libscrypt-kdf, we need the
  64. # below functionality in other parts of scrypt.
  65. scrypt_SOURCES+= libcperciva/alg/sha256.c \
  66. libcperciva/alg/sha256.h \
  67. libcperciva/alg/sha256_shani.h \
  68. libcperciva/cpusupport/cpusupport_x86_shani.c \
  69. libcperciva/cpusupport/cpusupport_x86_sse2.c \
  70. libcperciva/cpusupport/cpusupport_x86_ssse3.c \
  71. libcperciva/util/insecure_memzero.c \
  72. libcperciva/util/insecure_memzero.h \
  73. libcperciva/util/warnp.c \
  74. libcperciva/util/warnp.h
  75. else
  76. scrypt_SOURCES+= $(crypto_scrypt_files)
  77. scrypt_LDADD=
  78. endif
  79. AM_CPPFLAGS= -I$(srcdir)/lib \
  80. -I$(srcdir)/lib/crypto \
  81. -I$(srcdir)/lib/scryptenc \
  82. -I$(srcdir)/lib/util \
  83. -I$(srcdir)/libcperciva/alg \
  84. -I$(srcdir)/libcperciva/cpusupport \
  85. -I$(srcdir)/libcperciva/crypto \
  86. -I$(srcdir)/libcperciva/util \
  87. -DCPUSUPPORT_CONFIG_FILE=\"cpusupport-config.h\" \
  88. -D_POSIX_C_SOURCE=200809L \
  89. -D_XOPEN_SOURCE=700 \
  90. ${CFLAGS_POSIX}
  91. scrypt_LDADD+= libcperciva_aesni.la libcperciva_rdrand.la \
  92. libcperciva_shani.la libscrypt_sse2.la \
  93. ${LDADD_POSIX}
  94. scrypt_man_MANS= scrypt.1
  95. cpusupport-config.h:
  96. ( export CC="${CC}"; export CFLAGS="${CFLAGS}"; command -p sh $(srcdir)/libcperciva/cpusupport/Build/cpusupport.sh "$$PATH") > cpusupport-config.h.tmp && command -p mv cpusupport-config.h.tmp cpusupport-config.h
  97. BUILT_SOURCES= cpusupport-config.h
  98. CLEANFILES= cpusupport-config.h cpusupport-config.h.tmp
  99. # Libraries from libcperciva code.
  100. noinst_LTLIBRARIES= libcperciva_aesni.la
  101. libcperciva_aesni_la_SOURCES= libcperciva/crypto/crypto_aes_aesni.c
  102. nodist_libcperciva_aesni_la_SOURCES= cpusupport-config.h
  103. libcperciva_aesni_la_CFLAGS=`. ./cpusupport-config.h; echo $${CFLAGS_X86_AESNI}`
  104. noinst_LTLIBRARIES+= libcperciva_rdrand.la
  105. libcperciva_rdrand_la_SOURCES= libcperciva/crypto/crypto_entropy_rdrand.c
  106. nodist_libcperciva_rdrand_la_SOURCES= cpusupport-config.h
  107. libcperciva_rdrand_la_CFLAGS= \
  108. `. ./cpusupport-config.h; echo $${CFLAGS_X86_RDRAND}`
  109. noinst_LTLIBRARIES+= libcperciva_shani.la
  110. libcperciva_shani_la_SOURCES= libcperciva/alg/sha256_shani.c
  111. nodist_libcperciva_shani_la_SOURCES= cpusupport-config.h
  112. libcperciva_shani_la_CFLAGS=`. ./cpusupport-config.h; echo $${CFLAGS_X86_SHANI} $${CFLAGS_X86_SSSE3}`
  113. # Library from scrypt code.
  114. noinst_LTLIBRARIES+= libscrypt_sse2.la
  115. libscrypt_sse2_la_SOURCES= lib/crypto/crypto_scrypt_smix_sse2.c
  116. nodist_libscrypt_sse2_la_SOURCES= cpusupport-config.h
  117. libscrypt_sse2_la_CFLAGS=`. ./cpusupport-config.h; echo $${CFLAGS_X86_SSE2}`
  118. # Install libscrypt-kdf?
  119. if LIBSCRYPT_KDF
  120. lib_LTLIBRARIES= libscrypt-kdf.la
  121. libscrypt_kdf_la_LDFLAGS= -version-info 1 \
  122. -export-symbols-regex 'crypto_scrypt$$'
  123. include_HEADERS= libscrypt-kdf/scrypt-kdf.h
  124. noinst_PROGRAMS+= tests/libscrypt-kdf/sample-libscrypt-kdf
  125. else
  126. # Allow the user to get a usable library even if they didn't run configure
  127. # with --enable-libscrypt-kdf. If we didn't include this, they would get
  128. # empty libraries if they ran `make libscrypt-kdf.la`.
  129. EXTRA_LTLIBRARIES= libscrypt-kdf.la
  130. endif
  131. # Shared definitions for libscrypt-kdf.
  132. libscrypt_kdf_la_SOURCES= $(crypto_scrypt_files)
  133. libscrypt_kdf_la_LIBADD= libcperciva_shani.la libscrypt_sse2.la
  134. # Workaround for "created with both libtool and without"
  135. libscrypt_kdf_la_CFLAGS= $(AM_CFLAGS)
  136. # Test libscrypt-kdf compile
  137. tests_libscrypt_kdf_sample_libscrypt_kdf_SOURCES= \
  138. tests/libscrypt-kdf/sample-libscrypt-kdf.c
  139. tests_libscrypt_kdf_sample_libscrypt_kdf_CPPFLAGS= \
  140. -I$(srcdir)/libscrypt-kdf/
  141. tests_libscrypt_kdf_sample_libscrypt_kdf_LDADD= libscrypt-kdf.la
  142. EXTRA_DIST = \
  143. COPYRIGHT \
  144. FORMAT \
  145. README.md \
  146. lib/README \
  147. lib/crypto/crypto_scrypt-ref.c \
  148. libcperciva/POSIX/README \
  149. libcperciva/POSIX/posix-cflags.sh \
  150. libcperciva/POSIX/posix-clock_gettime.c \
  151. libcperciva/POSIX/posix-clock_realtime.c \
  152. libcperciva/POSIX/posix-l.c \
  153. libcperciva/POSIX/posix-l.sh \
  154. libcperciva/POSIX/posix-msg_nosignal.c \
  155. libcperciva/POSIX/posix-restrict.c \
  156. libcperciva/cpusupport/Build/cpusupport-X86-AESNI.c \
  157. libcperciva/cpusupport/Build/cpusupport-X86-CPUID.c \
  158. libcperciva/cpusupport/Build/cpusupport-X86-RDRAND.c \
  159. libcperciva/cpusupport/Build/cpusupport-X86-SHANI.c \
  160. libcperciva/cpusupport/Build/cpusupport-X86-SSE2.c \
  161. libcperciva/cpusupport/Build/cpusupport-X86-SSSE3.c \
  162. libcperciva/cpusupport/Build/cpusupport.sh \
  163. tests/01-known-values.sh \
  164. tests/02-decrypt-reference-file.sh \
  165. tests/03-encrypt-decrypt-file.sh \
  166. tests/04-force-resources.sh \
  167. tests/05-system-scrypt-encrypt-decrypt.sh \
  168. tests/shared_test_functions.sh \
  169. tests/test_scrypt.sh \
  170. tests/verify-strings/test_scrypt.good \
  171. tests/verify-strings/test_scrypt_good.enc
  172. # Binary to test the crypto_scrypt() function.
  173. tests_verify_strings_test_scrypt_SOURCES = \
  174. tests/verify-strings/test_scrypt.c \
  175. $(crypto_scrypt_files)
  176. tests_verify_strings_test_scrypt_LDADD= libcperciva_shani.la \
  177. libscrypt_sse2.la \
  178. ${LDADD_POSIX}
  179. # Eliminate false positives while memory-checking for the test framework.
  180. tests_valgrind_potential_memleaks_SOURCES = tests/valgrind/potential-memleaks.c
  181. .PHONY: test
  182. # we can't only build "scrypt tests/verify-strings/test_scrypt" because that
  183. # won't build the BUILT_SOURCES.
  184. test: all
  185. $(top_srcdir)/tests/test_scrypt.sh .