Makefile.am 12 KB

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