Makefile.am 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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. #
  12. # crypto_scrypt() does not require aesni or rdrand, but we need to include
  13. # the relevant cpusupport_x86 files so that cpusupport can link to them.
  14. crypto_scrypt_files= lib/crypto/crypto_scrypt_smix.c \
  15. lib/crypto/crypto_scrypt_smix.h \
  16. lib/crypto/crypto_scrypt_smix_sse2.h \
  17. lib-platform/platform.h \
  18. lib-platform/crypto/crypto_scrypt.c \
  19. lib-platform/crypto/crypto_scrypt.h \
  20. libcperciva/alg/sha256.c \
  21. libcperciva/alg/sha256.h \
  22. libcperciva/alg/sha256_arm.h \
  23. libcperciva/alg/sha256_shani.h \
  24. libcperciva/alg/sha256_sse2.h \
  25. libcperciva/cpusupport/cpusupport.h \
  26. libcperciva/cpusupport/cpusupport_arm_aes.c \
  27. libcperciva/cpusupport/cpusupport_arm_sha256.c \
  28. libcperciva/cpusupport/cpusupport_x86_aesni.c \
  29. libcperciva/cpusupport/cpusupport_x86_rdrand.c \
  30. libcperciva/cpusupport/cpusupport_x86_shani.c \
  31. libcperciva/cpusupport/cpusupport_x86_sse2.c \
  32. libcperciva/cpusupport/cpusupport_x86_ssse3.c \
  33. libcperciva/util/insecure_memzero.c \
  34. libcperciva/util/insecure_memzero.h \
  35. libcperciva/util/warnp.c \
  36. libcperciva/util/warnp.h
  37. # Don't include crypto_aesctr_shared.c in this list, as it should be included
  38. # directly into other translation unit(s), and not compiled on its own.
  39. scrypt_SOURCES= main.c \
  40. $(crypto_scrypt_files) \
  41. lib/scryptenc/scryptenc.c \
  42. lib/scryptenc/scryptenc.h \
  43. lib/scryptenc/scryptenc_cpuperf.c \
  44. lib/scryptenc/scryptenc_cpuperf.h \
  45. lib/scryptenc/scryptenc_print_error.c \
  46. lib/scryptenc/scryptenc_print_error.h \
  47. lib/util/passphrase_entry.c \
  48. lib/util/passphrase_entry.h \
  49. lib-platform/util/memlimit.h \
  50. libcperciva/crypto/crypto_aes.h \
  51. libcperciva/crypto/crypto_aes_aesni.h \
  52. libcperciva/crypto/crypto_aes_aesni_m128i.h \
  53. libcperciva/crypto/crypto_aes_arm.h \
  54. libcperciva/crypto/crypto_aes_arm_u8.h \
  55. libcperciva/crypto/crypto_aesctr.c \
  56. libcperciva/crypto/crypto_aesctr.h \
  57. libcperciva/crypto/crypto_aesctr_aesni.h \
  58. libcperciva/crypto/crypto_aesctr_arm.h \
  59. libcperciva/crypto/crypto_entropy.c \
  60. libcperciva/crypto/crypto_entropy.h \
  61. libcperciva/crypto/crypto_entropy_rdrand.h \
  62. libcperciva/crypto/crypto_verify_bytes.c \
  63. libcperciva/crypto/crypto_verify_bytes.h \
  64. libcperciva/util/align_ptr.h \
  65. libcperciva/util/asprintf.c \
  66. libcperciva/util/asprintf.h \
  67. libcperciva/util/entropy.c \
  68. libcperciva/util/entropy.h \
  69. libcperciva/util/getopt.c \
  70. libcperciva/util/getopt.h \
  71. libcperciva/util/humansize.c \
  72. libcperciva/util/humansize.h \
  73. libcperciva/util/monoclock.c \
  74. libcperciva/util/monoclock.h \
  75. libcperciva/util/parsenum.h \
  76. libcperciva/util/readpass.c \
  77. libcperciva/util/readpass.h \
  78. libcperciva/util/readpass_file.c \
  79. libcperciva/util/sysendian.h
  80. AM_CPPFLAGS= -I$(srcdir)/lib \
  81. -I$(srcdir)/lib/crypto \
  82. -I$(srcdir)/lib/scryptenc \
  83. -I$(srcdir)/lib/util \
  84. -I$(srcdir)/lib-platform \
  85. -I$(srcdir)/lib-platform/crypto \
  86. -I$(srcdir)/lib-platform/util \
  87. -I$(srcdir)/libcperciva/alg \
  88. -I$(srcdir)/libcperciva/cpusupport \
  89. -I$(srcdir)/libcperciva/crypto \
  90. -I$(srcdir)/libcperciva/util \
  91. -DCPUSUPPORT_CONFIG_FILE=\"cpusupport-config.h\" \
  92. -DAPISUPPORT_CONFIG_FILE=\"apisupport-config.h\" \
  93. -D_POSIX_C_SOURCE=200809L \
  94. -D_XOPEN_SOURCE=700 \
  95. ${CFLAGS_POSIX}
  96. scrypt_LDADD= libcperciva_aesni.la libcperciva_rdrand.la \
  97. libcperciva_shani.la libscrypt_sse2.la \
  98. libscrypt_memlimit.la \
  99. libscrypt_crypto_aes.la \
  100. libcperciva_arm_sha256.la \
  101. libcperciva_arm_aes.la \
  102. ${LDADD_POSIX}
  103. scrypt_man_MANS= scrypt.1
  104. # apisupport needs to access post-configure info: lib-platform/platform.h,
  105. # config.h, and -DHAVE_CONFIG_H.
  106. apisupport-config.h:
  107. ( export CC="${CC}"; export CFLAGS="-I${top_srcdir}/lib-platform -I${builddir} ${DEFS} ${CFLAGS}"; command -p sh $(srcdir)/libcperciva/apisupport/Build/apisupport.sh "$$PATH") > apisupport-config.h.tmp && command -p mv apisupport-config.h.tmp apisupport-config.h
  108. cpusupport-config.h:
  109. ( 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
  110. BUILT_SOURCES= apisupport-config.h cpusupport-config.h
  111. CLEANFILES= apisupport-config.h apisupport-config.h.tmp \
  112. cpusupport-config.h cpusupport-config.h.tmp
  113. # Libraries from libcperciva code.
  114. noinst_LTLIBRARIES= libcperciva_aesni.la
  115. libcperciva_aesni_la_SOURCES= libcperciva/crypto/crypto_aes_aesni.c \
  116. libcperciva/crypto/crypto_aesctr_aesni.c
  117. nodist_libcperciva_aesni_la_SOURCES= cpusupport-config.h
  118. libcperciva_aesni_la_CFLAGS=`. ./cpusupport-config.h; echo $${CFLAGS_X86_AESNI}`
  119. noinst_LTLIBRARIES+= libcperciva_arm_aes.la
  120. libcperciva_arm_aes_la_SOURCES= libcperciva/crypto/crypto_aes_arm.c \
  121. libcperciva/crypto/crypto_aesctr_arm.c
  122. nodist_libcperciva_arm_aes_la_SOURCES= cpusupport-config.h
  123. libcperciva_arm_aes_la_CFLAGS=`. ./cpusupport-config.h; echo $${CFLAGS_ARM_AES}`
  124. noinst_LTLIBRARIES+= libcperciva_rdrand.la
  125. libcperciva_rdrand_la_SOURCES= libcperciva/crypto/crypto_entropy_rdrand.c
  126. nodist_libcperciva_rdrand_la_SOURCES= cpusupport-config.h
  127. libcperciva_rdrand_la_CFLAGS= \
  128. `. ./cpusupport-config.h; echo $${CFLAGS_X86_RDRAND}`
  129. noinst_LTLIBRARIES+= libcperciva_shani.la
  130. libcperciva_shani_la_SOURCES= libcperciva/alg/sha256_shani.c
  131. nodist_libcperciva_shani_la_SOURCES= cpusupport-config.h
  132. libcperciva_shani_la_CFLAGS=`. ./cpusupport-config.h; echo $${CFLAGS_X86_SHANI} $${CFLAGS_X86_SSSE3}`
  133. noinst_LTLIBRARIES+= libcperciva_arm_sha256.la
  134. libcperciva_arm_sha256_la_SOURCES= libcperciva/alg/sha256_arm.c
  135. nodist_libcperciva_arm_sha256_la_SOURCES= cpusupport-config.h
  136. libcperciva_arm_sha256_la_CFLAGS=`. ./cpusupport-config.h; echo $${CFLAGS_ARM_SHA256}`
  137. # Library from libcperciva and scrypt code.
  138. noinst_LTLIBRARIES+= libscrypt_sse2.la
  139. libscrypt_sse2_la_SOURCES= libcperciva/alg/sha256_sse2.c \
  140. lib/crypto/crypto_scrypt_smix_sse2.c
  141. nodist_libscrypt_sse2_la_SOURCES= cpusupport-config.h
  142. libscrypt_sse2_la_CFLAGS=`. ./cpusupport-config.h; echo $${CFLAGS_X86_SSE2}`
  143. # This library uses non-POSIX functionality, so we need to cancel the
  144. # _POSIX_C_SOURCE and _XOPEN_SOURCE defined in AM_CPPFLAGS.
  145. noinst_LTLIBRARIES+= libscrypt_memlimit.la
  146. libscrypt_memlimit_la_SOURCES= lib-platform/util/memlimit.c \
  147. lib-platform/util/memlimit.h
  148. libscrypt_memlimit_la_CFLAGS=`. ./apisupport-config.h; echo $${CFLAGS_NONPOSIX_MEMLIMIT}`
  149. noinst_LTLIBRARIES+= libscrypt_crypto_aes.la
  150. libscrypt_crypto_aes_la_SOURCES= libcperciva/crypto/crypto_aes.c \
  151. libcperciva/crypto/crypto_aes.h
  152. libscrypt_crypto_aes_la_CFLAGS=`. ./apisupport-config.h; echo $${CFLAGS_LIBCRYPTO_LOW_LEVEL_AES}`
  153. # Install libscrypt-kdf?
  154. if LIBSCRYPT_KDF
  155. lib_LTLIBRARIES= libscrypt-kdf.la
  156. libscrypt_kdf_la_LDFLAGS= -version-info 1 \
  157. -export-symbols-regex 'crypto_scrypt$$'
  158. include_HEADERS= libscrypt-kdf/scrypt-kdf.h
  159. noinst_PROGRAMS+= tests/libscrypt-kdf/sample-libscrypt-kdf
  160. else
  161. # Allow the user to get a usable library even if they didn't run configure
  162. # with --enable-libscrypt-kdf. If we didn't include this, they would get
  163. # empty libraries if they ran `make libscrypt-kdf.la`.
  164. EXTRA_LTLIBRARIES= libscrypt-kdf.la
  165. endif
  166. # Shared definitions for libscrypt-kdf.
  167. libscrypt_kdf_la_SOURCES= $(crypto_scrypt_files)
  168. libscrypt_kdf_la_LIBADD= libcperciva_shani.la libscrypt_sse2.la \
  169. libcperciva_arm_sha256.la
  170. # Workaround for "created with both libtool and without".
  171. libscrypt_kdf_la_CFLAGS= $(AM_CFLAGS)
  172. # Test libscrypt-kdf compile.
  173. tests_libscrypt_kdf_sample_libscrypt_kdf_SOURCES= \
  174. tests/libscrypt-kdf/sample-libscrypt-kdf.c
  175. tests_libscrypt_kdf_sample_libscrypt_kdf_CPPFLAGS= \
  176. -I$(srcdir)/libscrypt-kdf/
  177. tests_libscrypt_kdf_sample_libscrypt_kdf_LDADD= libscrypt-kdf.la
  178. # crypto_aesctr_shared.c is in this list because it can't be included in the
  179. # _SOURCES because it should only be included as part of another translation
  180. # unit.
  181. EXTRA_DIST= \
  182. .autom4te.cfg \
  183. BUILDING \
  184. COPYRIGHT \
  185. FORMAT \
  186. README.md \
  187. STYLE \
  188. get-version.sh \
  189. lib/README \
  190. lib/crypto/crypto_scrypt-ref.c \
  191. libcperciva/POSIX/README \
  192. libcperciva/POSIX/posix-abstract-declarator.c \
  193. libcperciva/POSIX/posix-cflags.sh \
  194. libcperciva/POSIX/posix-clock_gettime.c \
  195. libcperciva/POSIX/posix-clock_realtime.c \
  196. libcperciva/POSIX/posix-inet-addrstrlen.c \
  197. libcperciva/POSIX/posix-inet6-addrstrlen.c \
  198. libcperciva/POSIX/posix-l.sh \
  199. libcperciva/POSIX/posix-msg_nosignal.c \
  200. libcperciva/POSIX/posix-restrict.c \
  201. libcperciva/POSIX/posix-stat-st_mtim.c \
  202. libcperciva/POSIX/posix-trivial.c \
  203. libcperciva/cpusupport/Build/cpusupport-ARM-AES.c \
  204. libcperciva/cpusupport/Build/cpusupport-ARM-SHA256.c \
  205. libcperciva/cpusupport/Build/cpusupport-HWCAP-ELF_AUX_INFO.c \
  206. libcperciva/cpusupport/Build/cpusupport-HWCAP-GETAUXVAL.c \
  207. libcperciva/cpusupport/Build/cpusupport-X86-AESNI.c \
  208. libcperciva/cpusupport/Build/cpusupport-X86-CPUID.c \
  209. libcperciva/cpusupport/Build/cpusupport-X86-CPUID_COUNT.c \
  210. libcperciva/cpusupport/Build/cpusupport-X86-RDRAND.c \
  211. libcperciva/cpusupport/Build/cpusupport-X86-SHANI.c \
  212. libcperciva/cpusupport/Build/cpusupport-X86-SSE2.c \
  213. libcperciva/cpusupport/Build/cpusupport-X86-SSSE3.c \
  214. libcperciva/cpusupport/Build/cpusupport.sh \
  215. libcperciva/crypto/crypto_aesctr_shared.c \
  216. tests/01-known-values.sh \
  217. tests/02-decrypt-reference-file.sh \
  218. tests/03-encrypt-decrypt-file.sh \
  219. tests/04-force-resources.sh \
  220. tests/05-system-scrypt-encrypt-decrypt.sh \
  221. tests/06-decrypt-fail.sh \
  222. tests/07-passphrase-env.sh \
  223. tests/08-passphrase-file.sh \
  224. tests/09-explicit-params.sh \
  225. tests/shared_test_functions.sh \
  226. tests/shared_valgrind_functions.sh \
  227. tests/test_scrypt.sh \
  228. tests/verify-strings/test_scrypt.good \
  229. tests/verify-strings/test_scrypt_good.enc \
  230. tests/verify-strings/test_scrypt_small.good
  231. # Binary to test the crypto_scrypt() function.
  232. tests_verify_strings_test_scrypt_SOURCES= \
  233. tests/verify-strings/test_scrypt.c \
  234. $(crypto_scrypt_files)
  235. tests_verify_strings_test_scrypt_LDADD= libcperciva_shani.la \
  236. libscrypt_sse2.la \
  237. libcperciva_arm_sha256.la \
  238. ${LDADD_POSIX}
  239. # Eliminate false positives while memory-checking for the test framework.
  240. tests_valgrind_potential_memleaks_SOURCES= tests/valgrind/potential-memleaks.c
  241. .PHONY: test
  242. # we can't only build "scrypt tests/verify-strings/test_scrypt" because that
  243. # won't build the BUILT_SOURCES.
  244. test: all
  245. $(top_srcdir)/tests/test_scrypt.sh .