xcrypt 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +106 -0
  3. data/ext/libxcrypt/AUTHORS +38 -0
  4. data/ext/libxcrypt/COPYING.LIB +502 -0
  5. data/ext/libxcrypt/ChangeLog +239 -0
  6. data/ext/libxcrypt/INSTALL +380 -0
  7. data/ext/libxcrypt/LICENSING +152 -0
  8. data/ext/libxcrypt/Makefile.am +704 -0
  9. data/ext/libxcrypt/Makefile.in +4110 -0
  10. data/ext/libxcrypt/NEWS +630 -0
  11. data/ext/libxcrypt/README +1 -0
  12. data/ext/libxcrypt/README.md +179 -0
  13. data/ext/libxcrypt/THANKS +13 -0
  14. data/ext/libxcrypt/TODO +1 -0
  15. data/ext/libxcrypt/TODO.md +100 -0
  16. data/ext/libxcrypt/aclocal.m4 +2617 -0
  17. data/ext/libxcrypt/autogen.sh +33 -0
  18. data/ext/libxcrypt/autom4te.cache/output.0 +19884 -0
  19. data/ext/libxcrypt/autom4te.cache/output.1 +19884 -0
  20. data/ext/libxcrypt/autom4te.cache/output.2 +19884 -0
  21. data/ext/libxcrypt/autom4te.cache/output.3 +19885 -0
  22. data/ext/libxcrypt/autom4te.cache/requests +714 -0
  23. data/ext/libxcrypt/autom4te.cache/traces.0 +4088 -0
  24. data/ext/libxcrypt/autom4te.cache/traces.1 +1060 -0
  25. data/ext/libxcrypt/autom4te.cache/traces.2 +4088 -0
  26. data/ext/libxcrypt/autom4te.cache/traces.3 +1060 -0
  27. data/ext/libxcrypt/build-aux/ci/ci-log-dependency-versions +79 -0
  28. data/ext/libxcrypt/build-aux/ci/ci-log-logfiles +22 -0
  29. data/ext/libxcrypt/build-aux/ci/clang-gcov-wrapper +2 -0
  30. data/ext/libxcrypt/build-aux/ci/configure-wrapper +10 -0
  31. data/ext/libxcrypt/build-aux/ci/summarize-coverage +24 -0
  32. data/ext/libxcrypt/build-aux/m4/ax_append_compile_flags.m4 +46 -0
  33. data/ext/libxcrypt/build-aux/m4/ax_append_flag.m4 +50 -0
  34. data/ext/libxcrypt/build-aux/m4/ax_check_compile_flag.m4 +53 -0
  35. data/ext/libxcrypt/build-aux/m4/ax_check_vscript.m4 +142 -0
  36. data/ext/libxcrypt/build-aux/m4/ax_gcc_func_attribute.m4 +246 -0
  37. data/ext/libxcrypt/build-aux/m4/ax_require_defined.m4 +37 -0
  38. data/ext/libxcrypt/build-aux/m4/ax_valgrind_check.m4 +239 -0
  39. data/ext/libxcrypt/build-aux/m4/libtool.m4 +8488 -0
  40. data/ext/libxcrypt/build-aux/m4/ltoptions.m4 +467 -0
  41. data/ext/libxcrypt/build-aux/m4/ltsugar.m4 +124 -0
  42. data/ext/libxcrypt/build-aux/m4/ltversion.m4 +24 -0
  43. data/ext/libxcrypt/build-aux/m4/lt~obsolete.m4 +99 -0
  44. data/ext/libxcrypt/build-aux/m4/pkg_compat.m4 +88 -0
  45. data/ext/libxcrypt/build-aux/m4/zw_alignment.m4 +90 -0
  46. data/ext/libxcrypt/build-aux/m4/zw_automodern.m4 +307 -0
  47. data/ext/libxcrypt/build-aux/m4/zw_detect_asan.m4 +24 -0
  48. data/ext/libxcrypt/build-aux/m4/zw_endianness.m4 +152 -0
  49. data/ext/libxcrypt/build-aux/m4/zw_ld_wrap.m4 +47 -0
  50. data/ext/libxcrypt/build-aux/m4/zw_prog_perl.m4 +40 -0
  51. data/ext/libxcrypt/build-aux/m4/zw_simple_warnings.m4 +150 -0
  52. data/ext/libxcrypt/build-aux/m4/zw_static_assert.m4 +68 -0
  53. data/ext/libxcrypt/build-aux/m4-autogen/compile +364 -0
  54. data/ext/libxcrypt/build-aux/m4-autogen/config.guess +1815 -0
  55. data/ext/libxcrypt/build-aux/m4-autogen/config.sub +2354 -0
  56. data/ext/libxcrypt/build-aux/m4-autogen/depcomp +792 -0
  57. data/ext/libxcrypt/build-aux/m4-autogen/install-sh +541 -0
  58. data/ext/libxcrypt/build-aux/m4-autogen/ltmain.sh +11524 -0
  59. data/ext/libxcrypt/build-aux/m4-autogen/missing +236 -0
  60. data/ext/libxcrypt/build-aux/m4-autogen/test-driver +160 -0
  61. data/ext/libxcrypt/build-aux/scripts/BuildCommon.pm +712 -0
  62. data/ext/libxcrypt/build-aux/scripts/check-perlcritic-config +76 -0
  63. data/ext/libxcrypt/build-aux/scripts/compute-symver-floor +116 -0
  64. data/ext/libxcrypt/build-aux/scripts/expand-selected-hashes +80 -0
  65. data/ext/libxcrypt/build-aux/scripts/gen-crypt-h +131 -0
  66. data/ext/libxcrypt/build-aux/scripts/gen-crypt-hashes-h +141 -0
  67. data/ext/libxcrypt/build-aux/scripts/gen-crypt-symbol-vers-h +150 -0
  68. data/ext/libxcrypt/build-aux/scripts/gen-libcrypt-map +67 -0
  69. data/ext/libxcrypt/build-aux/scripts/move-if-change +84 -0
  70. data/ext/libxcrypt/build-aux/scripts/skip-if-exec-format-error +78 -0
  71. data/ext/libxcrypt/codecov.yml +4 -0
  72. data/ext/libxcrypt/config.h.in +303 -0
  73. data/ext/libxcrypt/configure +19885 -0
  74. data/ext/libxcrypt/configure.ac +549 -0
  75. data/ext/libxcrypt/doc/crypt.3 +512 -0
  76. data/ext/libxcrypt/doc/crypt.5 +343 -0
  77. data/ext/libxcrypt/doc/crypt_checksalt.3 +106 -0
  78. data/ext/libxcrypt/doc/crypt_gensalt.3 +285 -0
  79. data/ext/libxcrypt/doc/crypt_gensalt_ra.3 +1 -0
  80. data/ext/libxcrypt/doc/crypt_gensalt_rn.3 +1 -0
  81. data/ext/libxcrypt/doc/crypt_preferred_method.3 +68 -0
  82. data/ext/libxcrypt/doc/crypt_r.3 +1 -0
  83. data/ext/libxcrypt/doc/crypt_ra.3 +1 -0
  84. data/ext/libxcrypt/doc/crypt_rn.3 +1 -0
  85. data/ext/libxcrypt/lib/alg-des-tables.c +3858 -0
  86. data/ext/libxcrypt/lib/alg-des.c +269 -0
  87. data/ext/libxcrypt/lib/alg-des.h +74 -0
  88. data/ext/libxcrypt/lib/alg-gost3411-2012-const.h +313 -0
  89. data/ext/libxcrypt/lib/alg-gost3411-2012-core.c +238 -0
  90. data/ext/libxcrypt/lib/alg-gost3411-2012-core.h +51 -0
  91. data/ext/libxcrypt/lib/alg-gost3411-2012-hmac.c +78 -0
  92. data/ext/libxcrypt/lib/alg-gost3411-2012-hmac.h +46 -0
  93. data/ext/libxcrypt/lib/alg-gost3411-2012-precalc.h +1426 -0
  94. data/ext/libxcrypt/lib/alg-gost3411-2012-ref.h +67 -0
  95. data/ext/libxcrypt/lib/alg-hmac-sha1.c +140 -0
  96. data/ext/libxcrypt/lib/alg-hmac-sha1.h +35 -0
  97. data/ext/libxcrypt/lib/alg-md4.c +270 -0
  98. data/ext/libxcrypt/lib/alg-md4.h +43 -0
  99. data/ext/libxcrypt/lib/alg-md5.c +291 -0
  100. data/ext/libxcrypt/lib/alg-md5.h +43 -0
  101. data/ext/libxcrypt/lib/alg-sha1.c +288 -0
  102. data/ext/libxcrypt/lib/alg-sha1.h +34 -0
  103. data/ext/libxcrypt/lib/alg-sha256.c +630 -0
  104. data/ext/libxcrypt/lib/alg-sha256.h +123 -0
  105. data/ext/libxcrypt/lib/alg-sha512.c +311 -0
  106. data/ext/libxcrypt/lib/alg-sha512.h +81 -0
  107. data/ext/libxcrypt/lib/alg-sm3-hmac.c +113 -0
  108. data/ext/libxcrypt/lib/alg-sm3-hmac.h +42 -0
  109. data/ext/libxcrypt/lib/alg-sm3.c +449 -0
  110. data/ext/libxcrypt/lib/alg-sm3.h +63 -0
  111. data/ext/libxcrypt/lib/alg-yescrypt-common.c +713 -0
  112. data/ext/libxcrypt/lib/alg-yescrypt-opt.c +1568 -0
  113. data/ext/libxcrypt/lib/alg-yescrypt-platform.c +106 -0
  114. data/ext/libxcrypt/lib/alg-yescrypt.h +360 -0
  115. data/ext/libxcrypt/lib/byteorder.h +164 -0
  116. data/ext/libxcrypt/lib/crypt-bcrypt.c +1061 -0
  117. data/ext/libxcrypt/lib/crypt-des-obsolete.c +215 -0
  118. data/ext/libxcrypt/lib/crypt-des.c +491 -0
  119. data/ext/libxcrypt/lib/crypt-gensalt-static.c +40 -0
  120. data/ext/libxcrypt/lib/crypt-gost-yescrypt.c +182 -0
  121. data/ext/libxcrypt/lib/crypt-md5.c +232 -0
  122. data/ext/libxcrypt/lib/crypt-nthash.c +134 -0
  123. data/ext/libxcrypt/lib/crypt-obsolete.h +40 -0
  124. data/ext/libxcrypt/lib/crypt-pbkdf1-sha1.c +260 -0
  125. data/ext/libxcrypt/lib/crypt-port.h +514 -0
  126. data/ext/libxcrypt/lib/crypt-scrypt.c +247 -0
  127. data/ext/libxcrypt/lib/crypt-sha256.c +308 -0
  128. data/ext/libxcrypt/lib/crypt-sha512.c +323 -0
  129. data/ext/libxcrypt/lib/crypt-sm3-yescrypt.c +189 -0
  130. data/ext/libxcrypt/lib/crypt-sm3.c +308 -0
  131. data/ext/libxcrypt/lib/crypt-static.c +44 -0
  132. data/ext/libxcrypt/lib/crypt-sunmd5.c +314 -0
  133. data/ext/libxcrypt/lib/crypt-yescrypt.c +177 -0
  134. data/ext/libxcrypt/lib/crypt.c +421 -0
  135. data/ext/libxcrypt/lib/crypt.h.in +249 -0
  136. data/ext/libxcrypt/lib/gen-des-tables.c +363 -0
  137. data/ext/libxcrypt/lib/hashes.conf +59 -0
  138. data/ext/libxcrypt/lib/libcrypt.map.in +48 -0
  139. data/ext/libxcrypt/lib/libcrypt.minver +97 -0
  140. data/ext/libxcrypt/lib/libxcrypt.pc.in +15 -0
  141. data/ext/libxcrypt/lib/util-base64.c +26 -0
  142. data/ext/libxcrypt/lib/util-gensalt-sha.c +88 -0
  143. data/ext/libxcrypt/lib/util-get-random-bytes.c +154 -0
  144. data/ext/libxcrypt/lib/util-make-failure-token.c +48 -0
  145. data/ext/libxcrypt/lib/util-xbzero.c +43 -0
  146. data/ext/libxcrypt/lib/util-xstrcpy.c +42 -0
  147. data/ext/libxcrypt/lib/xcrypt.h.in +58 -0
  148. data/ext/libxcrypt/libxcrypt.spec.rpkg +481 -0
  149. data/ext/libxcrypt/rpkg.conf +2 -0
  150. data/ext/libxcrypt/rpkg.macros +86 -0
  151. data/ext/libxcrypt/test/TestCommon.pm +326 -0
  152. data/ext/libxcrypt/test/alg-des.c +80 -0
  153. data/ext/libxcrypt/test/alg-gost3411-2012-hmac.c +90 -0
  154. data/ext/libxcrypt/test/alg-gost3411-2012.c +191 -0
  155. data/ext/libxcrypt/test/alg-hmac-sha1.c +187 -0
  156. data/ext/libxcrypt/test/alg-md4.c +111 -0
  157. data/ext/libxcrypt/test/alg-md5.c +134 -0
  158. data/ext/libxcrypt/test/alg-pbkdf-hmac-sha256.c +269 -0
  159. data/ext/libxcrypt/test/alg-sha1.c +111 -0
  160. data/ext/libxcrypt/test/alg-sha256.c +141 -0
  161. data/ext/libxcrypt/test/alg-sha512.c +170 -0
  162. data/ext/libxcrypt/test/alg-sm3-hmac.c +149 -0
  163. data/ext/libxcrypt/test/alg-sm3.c +168 -0
  164. data/ext/libxcrypt/test/alg-yescrypt.c +466 -0
  165. data/ext/libxcrypt/test/badsalt.c +726 -0
  166. data/ext/libxcrypt/test/badsetting.c +350 -0
  167. data/ext/libxcrypt/test/byteorder.c +254 -0
  168. data/ext/libxcrypt/test/checksalt.c +265 -0
  169. data/ext/libxcrypt/test/compile-strong-alias.c +43 -0
  170. data/ext/libxcrypt/test/crypt-badargs.c +392 -0
  171. data/ext/libxcrypt/test/crypt-gost-yescrypt.c +149 -0
  172. data/ext/libxcrypt/test/crypt-nested-call.c +180 -0
  173. data/ext/libxcrypt/test/crypt-sm3-yescrypt.c +149 -0
  174. data/ext/libxcrypt/test/crypt-too-long-phrase.c +157 -0
  175. data/ext/libxcrypt/test/des-cases.h +196 -0
  176. data/ext/libxcrypt/test/des-obsolete.c +206 -0
  177. data/ext/libxcrypt/test/des-obsolete_r.c +207 -0
  178. data/ext/libxcrypt/test/explicit-bzero.c +334 -0
  179. data/ext/libxcrypt/test/gensalt-bcrypt_x.c +54 -0
  180. data/ext/libxcrypt/test/gensalt-extradata.c +246 -0
  181. data/ext/libxcrypt/test/gensalt-nested-call.c +126 -0
  182. data/ext/libxcrypt/test/gensalt-nthash.c +65 -0
  183. data/ext/libxcrypt/test/gensalt.c +599 -0
  184. data/ext/libxcrypt/test/getrandom-fallbacks.c +295 -0
  185. data/ext/libxcrypt/test/getrandom-interface.c +211 -0
  186. data/ext/libxcrypt/test/ka-table-gen.py +945 -0
  187. data/ext/libxcrypt/test/ka-table.inc +5849 -0
  188. data/ext/libxcrypt/test/ka-tester.c +240 -0
  189. data/ext/libxcrypt/test/preferred-method.c +133 -0
  190. data/ext/libxcrypt/test/short-outbuf.c +119 -0
  191. data/ext/libxcrypt/test/special-char-salt.c +1160 -0
  192. data/ext/libxcrypt/test/symbols-compat.pl +137 -0
  193. data/ext/libxcrypt/test/symbols-renames.pl +107 -0
  194. data/ext/libxcrypt/test/symbols-static.pl +87 -0
  195. data/ext/xcrypt/xcrypt.c +9 -0
  196. data/lib/xcrypt/ffi.rb +76 -0
  197. data/lib/xcrypt/version.rb +5 -0
  198. data/lib/xcrypt.rb +89 -0
  199. metadata +267 -0
@@ -0,0 +1,549 @@
1
+ # Process this file with autoconf to produce a configure script.
2
+ m4_include([build-aux/m4/zw_automodern.m4])
3
+ AC_INIT([xcrypt],
4
+ [4.5.2],
5
+ [https://github.com/besser82/libxcrypt/issues],
6
+ [libxcrypt],
7
+ [https://github.com/besser82/libxcrypt])
8
+ AC_CONFIG_MACRO_DIR([build-aux/m4])
9
+ AC_CONFIG_AUX_DIR([build-aux/m4-autogen])
10
+ AC_CONFIG_SRCDIR([lib/crypt.c])
11
+ AC_CONFIG_HEADERS([config.h])
12
+ AC_CONFIG_FILES([
13
+ Makefile
14
+ libxcrypt.pc:lib/libxcrypt.pc.in
15
+ ])
16
+ AM_INIT_AUTOMAKE([tar-v7])
17
+
18
+ AH_TOP(
19
+ [#ifndef _CRYPT_CONFIG_H
20
+ #define _CRYPT_CONFIG_H 1])
21
+ AH_BOTTOM(
22
+ [#endif /* config.h */])
23
+
24
+ # PKG_INSTALLDIR may not be defined, but we have a
25
+ # compatibility replacement.
26
+ m4_pattern_allow([PKG_INSTALLDIR])
27
+ PKG_PROG_PKG_CONFIG_COMPAT([0.27], [PKG_CONFIG=false])
28
+ AS_IF([test x"$PKG_CONFIG" != xfalse],
29
+ [PKG_INSTALLDIR],
30
+ [PKG_INSTALLDIR_COMPAT])
31
+
32
+ # Checks for programs.
33
+ AC_CANONICAL_HOST
34
+ AC_PROG_CC
35
+
36
+ # C99 language and library features are used unconditionally.
37
+ # Don't even try to build with an older compiler.
38
+ case "$ac_prog_cc_stdc" in
39
+ c89 | no) AC_MSG_ERROR([a C99- or C11-compliant compiler is required]) ;;
40
+ esac
41
+
42
+ AC_PROG_CPP
43
+ AC_PROG_MAKE_SET
44
+ AC_PROG_LN_S
45
+ zw_PROG_PERL([5.14.0])
46
+ AC_PATH_PROG([GPG2], [gpg2], [false])
47
+ AC_PATH_PROG([SHA256SUM], [sha256sum], [false])
48
+
49
+ AC_USE_SYSTEM_EXTENSIONS
50
+ AC_SYS_LARGEFILE
51
+ zw_SIMPLE_ENABLE_WARNINGS
52
+ LT_INIT
53
+
54
+ # The test scripts need to know whether C global symbols have a
55
+ # leading underscore.
56
+ LT_SYS_SYMBOL_USCORE
57
+ if test x$sys_symbol_underscore = xno; then
58
+ SYMBOL_PREFIX=
59
+ else
60
+ SYMBOL_PREFIX=_
61
+ fi
62
+ AC_SUBST([SYMBOL_PREFIX])
63
+
64
+ # One of the test scripts needs to use -dD.
65
+ AC_CACHE_CHECK([whether the preprocessor ($CPP) supports -dD],
66
+ [ac_cv_prog_cpp_dD],
67
+ [printf '#include <errno.h>' |
68
+ $CPP -dD -xc - > conftest.i 2>&AS_MESSAGE_LOG_FD
69
+ if test $? -ne 0; then
70
+ ac_cv_prog_cpp_dD=no
71
+ elif grep '#define EDOM' conftest.i > /dev/null 2>&1; then
72
+ ac_cv_prog_cpp_dD=yes
73
+ else
74
+ ac_cv_prog_cpp_dD=no
75
+ fi
76
+ rm -f conftest.i
77
+ ])
78
+ AC_SUBST([HAVE_CPP_dD], [$ac_cv_prog_cpp_dD])
79
+
80
+ # Some of the tests need to be conditionally compiled depending on
81
+ # whether ASan is active.
82
+ AC_CACHE_CHECK([whether we are compiling with ASan],
83
+ [ac_cv_c_address_sanitizer],
84
+ [zw_ASAN_IFELSE(
85
+ [ac_cv_c_address_sanitizer=yes],
86
+ [ac_cv_c_address_sanitizer=no])])
87
+ if test x$ac_cv_c_address_sanitizer = xyes; then
88
+ AC_DEFINE([XCRYPT_USE_ASAN], [1],
89
+ [Define when compiling with ASan. Only affects tests.])
90
+ fi
91
+
92
+ # Checks for libraries: currently none needed.
93
+
94
+ # Checks for header files.
95
+ AC_CHECK_HEADERS_ONCE([
96
+ fcntl.h
97
+ stdbool.h
98
+ ucontext.h
99
+ sys/cdefs.h
100
+ sys/random.h
101
+ sys/syscall.h
102
+ valgrind/valgrind.h
103
+ ])
104
+
105
+ # stdint.h and inttypes.h were checked for by AC_INCLUDES_DEFAULT,
106
+ # invoked implicitly by the above.
107
+ if test $ac_cv_header_stdbool_h != yes ||
108
+ test $ac_cv_header_stdint_h != yes ||
109
+ test $ac_cv_header_inttypes_h != yes; then
110
+ AC_MSG_ERROR([a C99- or C11-compliant runtime library is required])
111
+ fi
112
+
113
+ # Checks for the specific things that we need from sys/cdefs.h, which
114
+ # might or might not be there (there's no standard for this header).
115
+ AS_IF([test $ac_cv_header_sys_cdefs_h = yes],
116
+ [AC_CACHE_CHECK([whether sys/cdefs.h defines __BEGIN_DECLS and __END_DECLS],
117
+ [ac_cv_header_sys_cdefs_begin_end_decls], [
118
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
119
+ #include <sys/cdefs.h>
120
+ __BEGIN_DECLS
121
+ extern int foo(void);
122
+ __END_DECLS
123
+ ]])],
124
+ [ac_cv_header_sys_cdefs_begin_end_decls=yes],
125
+ [ac_cv_header_sys_cdefs_begin_end_decls=no])
126
+ ])
127
+ AC_CACHE_CHECK([whether sys/cdefs.h defines __THROW],
128
+ [ac_cv_header_sys_cdefs_THROW], [
129
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
130
+ #include <sys/cdefs.h>
131
+ extern void foo(void) __THROW;
132
+ ]])],
133
+ [ac_cv_header_sys_cdefs_THROW=yes],
134
+ [ac_cv_header_sys_cdefs_THROW=no])
135
+ ])],
136
+ dnl AS_IF else
137
+ [ac_cv_header_sys_cdefs_begin_end_decls=no
138
+ ac_cv_header_sys_cdefs_THROW=no])
139
+
140
+ if test $ac_cv_header_sys_cdefs_begin_end_decls = yes; then
141
+ AC_DEFINE([HAVE_SYS_CDEFS_BEGIN_END_DECLS], 1,
142
+ [Define if <sys/cdefs.h> defines __BEGIN_DECLS and __END_DECLS.])
143
+ fi
144
+ if test $ac_cv_header_sys_cdefs_THROW = yes; then
145
+ AC_DEFINE([HAVE_SYS_CDEFS_THROW], 1,
146
+ [Define if <sys/cdefs.h> defines __THROW.])
147
+ fi
148
+
149
+ # Checks for typedefs, structures, and compiler characteristics.
150
+ zw_C_ALIGNAS
151
+ zw_C_ALIGNOF
152
+ zw_C_MAX_ALIGN_T
153
+ zw_C_ENDIANNESS
154
+ zw_C_STATIC_ASSERT
155
+ zw_PROG_LD_WRAP
156
+ AX_CHECK_VSCRIPT
157
+ AX_GCC_FUNC_ATTRIBUTE(symver)
158
+
159
+ # FIXME: This only checks whether the linker accepts either
160
+ # -Wl,-z,defs or -Wl,--no-undefined. It doesn't check that the switch
161
+ # actually does what we want it to do.
162
+ AC_CACHE_CHECK([how to make linking fail when undefined symbols remain],
163
+ [ac_cv_ld_no_undefined], [
164
+ ac_cv_ld_no_undefined=unknown
165
+ SAVED_LDFLAGS="$LDFLAGS"
166
+ LDFLAGS="$SAVED_LDFLAGS -Wl,-z,defs"
167
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [int i = 1;])],
168
+ [ac_cv_ld_no_undefined=-Wl,-z,defs])
169
+ if test "x$ac_cv_ld_no_undefined" = xunknown; then
170
+ LDFLAGS="$SAVED_LDFLAGS -Wl,--no-undefined"
171
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [int i = 1;])],
172
+ [ac_cv_ld_no_undefined=-Wl,--no-undefined])
173
+ fi
174
+ LDFLAGS="$SAVED_LDFLAGS"])
175
+
176
+ UNDEF_FLAG=
177
+ if test "x$ac_cv_ld_no_undefined" != xunknown; then
178
+ UNDEF_FLAG="$ac_cv_ld_no_undefined"
179
+ fi
180
+ AC_SUBST([UNDEF_FLAG])
181
+
182
+ # FIXME: This only checks whether the linker accepts -Wl,-z,text.
183
+ # It doesn't check that the switch actually does what we want it to do.
184
+ AC_CACHE_CHECK([how to make linking fail when there are text relocations],
185
+ [ac_cv_ld_no_textrel], [
186
+ ac_cv_ld_no_textrel=unknown
187
+ SAVED_LDFLAGS="$LDFLAGS"
188
+ LDFLAGS="$SAVED_LDFLAGS -Wl,-z,text"
189
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [int i = 1;])],
190
+ [ac_cv_ld_no_textrel=-Wl,-z,text])
191
+ LDFLAGS="$SAVED_LDFLAGS"])
192
+
193
+ TEXT_RELOC_FLAG=
194
+ if test "x$ac_cv_ld_no_textrel" != xunknown; then
195
+ TEXT_RELOC_FLAG="$ac_cv_ld_no_textrel"
196
+ fi
197
+ AC_SUBST([TEXT_RELOC_FLAG])
198
+
199
+ # FIXME: This only checks whether the linker accepts -Wl,-z,relro.
200
+ # It doesn't check that the switch actually does what we want it to do.
201
+ AC_CACHE_CHECK([how to link with read-only relocations],
202
+ [ac_cv_ld_relro], [
203
+ ac_cv_ld_relro=unknown
204
+ SAVED_LDFLAGS="$LDFLAGS"
205
+ LDFLAGS="$SAVED_LDFLAGS -Wl,-z,relro"
206
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [int i = 1;])],
207
+ [ac_cv_ld_relro=-Wl,-z,relro])
208
+ LDFLAGS="$SAVED_LDFLAGS"])
209
+
210
+ RELRO_FLAG=
211
+ if test "x$ac_cv_ld_relro" != xunknown; then
212
+ RELRO_FLAG="$ac_cv_ld_relro"
213
+ fi
214
+ AC_SUBST([RELRO_FLAG])
215
+
216
+ # FIXME: This only checks whether the linker accepts -Wl,-z,now.
217
+ # It doesn't check that the switch actually does what we want it to do.
218
+ AC_CACHE_CHECK([how to link with immediate binding],
219
+ [ac_cv_ld_now], [
220
+ ac_cv_ld_now=unknown
221
+ SAVED_LDFLAGS="$LDFLAGS"
222
+ LDFLAGS="$SAVED_LDFLAGS -Wl,-z,now"
223
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [int i = 1;])],
224
+ [ac_cv_ld_now=-Wl,-z,now])
225
+ LDFLAGS="$SAVED_LDFLAGS"])
226
+
227
+ BINDNOW_FLAG=
228
+ if test "x$ac_cv_ld_now" != xunknown; then
229
+ BINDNOW_FLAG="$ac_cv_ld_now"
230
+ fi
231
+ AC_SUBST([BINDNOW_FLAG])
232
+
233
+ # FIXME: This only checks whether the compiler accepts -fno-plt.
234
+ # It doesn't check that the switch actually does what we want it to do.
235
+ AX_APPEND_COMPILE_FLAGS([-fno-plt], [OPTI_FLAGS], [$WARN_CFLAGS])
236
+
237
+ # Export compiler flags for optimization.
238
+ AC_SUBST([OPTI_FLAGS])
239
+
240
+ # Checks for library functions.
241
+ AC_CHECK_FUNCS_ONCE([
242
+ arc4random_buf
243
+ explicit_bzero
244
+ explicit_memset
245
+ getentropy
246
+ getrandom
247
+ memset_explicit
248
+ memset_s
249
+ open64
250
+ syscall
251
+ ])
252
+
253
+ # Disable valgrind tools for checking multithreaded
254
+ # programs, as we don't use them in checks.
255
+ AX_VALGRIND_DFLT([drd], [off])
256
+ AX_VALGRIND_DFLT([helgrind], [off])
257
+
258
+ # Valgrind's sgcheck is b0rk3n upstream.
259
+ AX_VALGRIND_DFLT([sgcheck], [off])
260
+
261
+ # Add a target to run testsuite with valgrind.
262
+ AX_VALGRIND_CHECK()
263
+
264
+ # Requirements for running test/ka-table-gen.py.
265
+ AC_CACHE_CHECK([for Python 3.>=6 with Passlib],
266
+ [ac_cv_path_python3_passlib],
267
+ [AC_PATH_PROGS_FEATURE_CHECK([python3_passlib],
268
+ [python3 m4_for([minor], 11, 6, -1, [[python3.]minor ]) python],
269
+ [_AS_ECHO_LOG([trying $ac_path_python3_passlib...])
270
+ AS_IF([$ac_path_python3_passlib -c '
271
+ import sys
272
+ if sys.version_info < (3,6,0):
273
+ sys.stderr.write("too old: " + sys.version + "\n")
274
+ sys.exit(1)
275
+ import passlib
276
+ ' >&AS_MESSAGE_LOG_FD 2>&1],
277
+ [ac_cv_path_python3_passlib=$ac_path_python3_passlib
278
+ ac_path_python3_passlib_found=:])],
279
+ [ac_cv_path_python3_passlib="not found"])])
280
+ if test x"$ac_cv_path_python3_passlib" = x"not found"; then
281
+ PYTHON=false
282
+ AC_MSG_NOTICE(
283
+ [Disabling the "regen-ka-table" target, missing Python requirements.])
284
+ else
285
+ PYTHON="$ac_cv_path_python3_passlib"
286
+ fi
287
+ AC_SUBST([PYTHON])
288
+ AM_CONDITIONAL([ENABLE_KA_TABLE_GEN], [test x"$PYTHON" != "xfalse"])
289
+
290
+ # The ucontext.h functions that we use were withdrawn from
291
+ # POSIX.1-2008, so the existence of the header does not prove
292
+ # we can use the functions.
293
+ AS_IF([test $ac_cv_header_ucontext_h = yes],
294
+ [AC_CACHE_CHECK([whether all ucontext.h functions are available],
295
+ [ac_cv_header_ucontext_h_fns_available],
296
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
297
+ // This code isn't intended to make sense; it just validates the
298
+ // type signature of all four context functions, and avoids tripping
299
+ // any of the many warnings we may have active.
300
+ #include <ucontext.h>
301
+ static int x;
302
+ static void fn1(void) {}
303
+ ]], [[
304
+ ucontext_t uc1, uc2;
305
+ if (getcontext(&uc1)) return 1;
306
+ if (setcontext(&uc1)) return 1;
307
+ makecontext(&uc1, fn1, 0);
308
+ if (swapcontext(&uc1, &uc2)) return 1;
309
+ return x;
310
+ ]])],
311
+ [ac_cv_header_ucontext_h_fns_available=yes],
312
+ [ac_cv_header_ucontext_h_fns_available=no])])],
313
+ [ac_cv_header_ucontext_h_fns_available=no])
314
+
315
+ if test $ac_cv_header_ucontext_h_fns_available = yes; then
316
+ AC_DEFINE([USE_SWAPCONTEXT], 1,
317
+ [Define to 1 if getcontext, setcontext, makecontext, and swapcontext are
318
+ available from ucontext.h without deprecation warnings.])
319
+ fi
320
+
321
+ # Configure options.
322
+ AC_ARG_ENABLE([failure-tokens],
323
+ AS_HELP_STRING(
324
+ [--disable-failure-tokens],
325
+ [Make crypt and crypt_r return NULL on failure, instead of a
326
+ special "failure token" string that isn't the hash of any
327
+ passphrase. This matches the behavior of several other
328
+ crypt implementations, but will break programs that assume these
329
+ functions never return NULL. crypt_rn and crypt_ra are not affected
330
+ by this option, and will always return NULL on failure.]
331
+ ),
332
+ [case "$enableval" in
333
+ yes) enable_failure_tokens=1;;
334
+ no) enable_failure_tokens=0;;
335
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-failure-tokens]);;
336
+ esac],
337
+ [enable_failure_tokens=1])
338
+ AC_DEFINE_UNQUOTED([ENABLE_FAILURE_TOKENS], [$enable_failure_tokens],
339
+ [Define to 1 if crypt and crypt_r should return a "failure token" on
340
+ failure, or 0 if they should return NULL.])
341
+
342
+ AC_ARG_ENABLE([xcrypt-compat-files],
343
+ AS_HELP_STRING(
344
+ [--disable-xcrypt-compat-files],
345
+ [Disable the installation of the <xcrypt.h> header file and the
346
+ libxcrypt.{a,so} compatibility symlinks.]
347
+ ),
348
+ [case "$enableval" in
349
+ yes) enable_xcrypt_compat_files=1;;
350
+ no) enable_xcrypt_compat_files=0;;
351
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-xcrypt-compat-files]);;
352
+ esac],
353
+ [enable_xcrypt_compat_files=1])
354
+
355
+ AC_ARG_ENABLE([obsolete-api],
356
+ AS_HELP_STRING(
357
+ [--enable-obsolete-api[=ARG]],
358
+ [When set to "yes", include all compatibility interfaces.
359
+ When set to "alt", include interfaces for compatibility with ALT.
360
+ When set to "glibc", include interfaces for compatibility with glibc.
361
+ When set to "owl", include interfaces for compatibility with Owl.
362
+ When set to "suse", include interfaces for compatibility with SUSE.
363
+ When set to "no", do not include any compatibility definitions at all,
364
+ and change the soname of the installed library to libcrypt.so.2.
365
+ This setting only affects existing binaries; new programs cannot
366
+ be linked against the obsolete APIs (bigcrypt, fcrypt, encrypt, setkey)
367
+ in any case. [default=yes]]
368
+ ),
369
+ [enableval="`AS_ECHO("$enableval") |
370
+ $SED -e 'y!ABCDEFGHIJKLMNOPQRSTUVWXYZ-!abcdefghijklmnopqrstuvwxyz_!'`"
371
+ case "${enableval}" in
372
+ alt|glibc|owl)
373
+ enable_obsolete_api=1
374
+ enable_compat_suse=0
375
+ COMPAT_ABI=${enableval} ;;
376
+ yes|suse)
377
+ enable_obsolete_api=1
378
+ enable_compat_suse=1
379
+ COMPAT_ABI=${enableval} ;;
380
+ no)
381
+ enable_obsolete_api=0
382
+ enable_compat_suse=0
383
+ COMPAT_ABI=${enableval} ;;
384
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-obsolete-api]) ;;
385
+ esac],
386
+ [enable_obsolete_api=1
387
+ enable_compat_suse=1
388
+ COMPAT_ABI=yes]
389
+ )
390
+ AC_SUBST(COMPAT_ABI)
391
+
392
+ AC_ARG_ENABLE([obsolete-api-enosys],
393
+ AS_HELP_STRING(
394
+ [--enable-obsolete-api-enosys[=ARG]],
395
+ [If set to "yes", this option replaces the obsolete APIs
396
+ (fcrypt, encrypt{,_r}, and setkey{,_r}) with stubs that
397
+ set errno to ENOSYS and return without performing any real
398
+ operations. This allows one to disable descrypt support
399
+ while preserving POSIX compliance. For security reasons,
400
+ the encrypt{,r} functions will also overwrite their data-block
401
+ argument with random bits. The fcrypt function will always
402
+ produce a failure token (*0 or *1), unless the library was
403
+ also configured with --disable-failure-tokens, in which case
404
+ it will always return NULL. [default=no]]
405
+ ),
406
+ [case "$enableval" in
407
+ yes) enable_obsolete_api_enosys=1;;
408
+ no) enable_obsolete_api_enosys=0;;
409
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-obsolete-api-enosys]);;
410
+ esac],
411
+ [enable_obsolete_api_enosys=0])
412
+
413
+ AC_ARG_ENABLE([hashes],
414
+ AS_HELP_STRING(
415
+ [--enable-hashes=HASHES],
416
+ [Select hash methods to support. Acceptable values are
417
+ 'all' or a comma-separated list of names from the file
418
+ 'hashes.conf' and/or the keywords 'strong', 'alt',
419
+ 'fedora', 'freebsd', 'glibc', 'netbsd', 'openbsd',
420
+ 'osx', 'owl', 'solaris', and 'suse' which select groups
421
+ of methods as described in that file.
422
+ The default is 'all'.
423
+ Note: if binary compatibility with any historic libcrypt is
424
+ desired (i.e. any --enable-obsolete-api setting other than
425
+ 'no'), the 'descrypt' hash must be enabled.]),
426
+ [hashes_selected="`AS_ECHO("$enableval") |
427
+ $SED -e 'y!ABCDEFGHIJKLMNOPQRSTUVWXYZ-!abcdefghijklmnopqrstuvwxyz_!'`"],
428
+ [hashes_selected=all]
429
+ )
430
+ # This code must run after $PERL is set.
431
+ hashes_enabled=$(
432
+ $PERL "$srcdir"/build-aux/scripts/expand-selected-hashes \
433
+ "$srcdir"/lib/hashes.conf \
434
+ "$hashes_selected"
435
+ )
436
+ if test x"$hashes_enabled" = x || test x"$hashes_enabled" = x,; then
437
+ AC_MSG_ERROR([bad value '${hashes_selected}' for --enable-hashes])
438
+ fi
439
+ AC_SUBST([hashes_enabled])
440
+
441
+
442
+ # If the traditional DES hash is disabled, then the obsolete APIs are
443
+ # implicitly disabled, except when stubs are requested.
444
+ case "$hashes_enabled" in
445
+ *,descrypt,*) ;;
446
+ *)
447
+ if test x"$COMPAT_ABI" != xno && \
448
+ test x"$enable_obsolete_api_enosys" != x1; then
449
+ AC_MSG_WARN(
450
+ [--enable-hashes=${hashes_selected} forces --enable-obsolete-api=no])
451
+ enable_obsolete_api=0
452
+ enable_compat_suse=0
453
+ COMPAT_ABI=no
454
+ fi
455
+ ;;
456
+ esac
457
+
458
+ # If the obsolete APIs are disabled, the stubs implicitly disabled as well.
459
+ if test x"$COMPAT_ABI" = xno && test x"$enable_obsolete_api_enosys" = x1; then
460
+ AC_MSG_WARN(
461
+ [--enable-obsolete-api=no implies --enable-obsolete-api-enosys=no.])
462
+ enable_obsolete_api_enosys=0
463
+ fi
464
+
465
+ # Export the value for ENABLE_OBSOLETE_API_ENOSYS.
466
+ AC_DEFINE_UNQUOTED([ENABLE_OBSOLETE_API_ENOSYS], [$enable_obsolete_api_enosys],
467
+ [Define to 1 if fcrypt, encrypt{,_r}, setkey{,_r} should set errno to ENOSYS,
468
+ or 0 if they should perform real operations.])
469
+
470
+ # The obsolete APIs are unconditionally excluded from the static library,
471
+ # so if we are not building the shared library, we are effectively not
472
+ # building obsolete APIs, and we shouldn't try to test them.
473
+ if test x$enable_shared != xyes; then enable_obsolete_api=0; fi
474
+
475
+ # Determine whether there's even a GNU libc on this system that we
476
+ # need to be binary backward compatible with.
477
+ if test $enable_obsolete_api = 1; then
478
+ AC_MSG_CHECKING([minimum symbol version to use for compatibility symbols])
479
+ SYMVER_FLOOR=$(
480
+ export CC
481
+ $PERL "$srcdir"/build-aux/scripts/compute-symver-floor \
482
+ "$srcdir"/lib/libcrypt.minver $host_os $host_cpu \
483
+ 2>&AS_MESSAGE_LOG_FD
484
+ )
485
+ AC_MSG_RESULT([$SYMVER_FLOOR])
486
+ case "$SYMVER_FLOOR" in
487
+ '')
488
+ AC_MSG_ERROR([compute-symver-floor failed, see config.log for details])
489
+ ;;
490
+ ERROR)
491
+ AC_MSG_ERROR([libxcrypt port to $host is incomplete])
492
+ ;;
493
+ XCRYPT_2.0)
494
+ SYMVER_MIN=XCRYPT_2.0
495
+ enable_obsolete_api=0
496
+ enable_obsolete_api_enosys=0
497
+ enable_compat_suse=0
498
+ COMPAT_API=no
499
+ ;;
500
+ *)
501
+ SYMVER_MIN=GLIBC_2.0
502
+ ;;
503
+ esac
504
+ else
505
+ SYMVER_FLOOR=XCRYPT_2.0
506
+ SYMVER_MIN=XCRYPT_2.0
507
+ fi
508
+ AC_SUBST([SYMVER_FLOOR])
509
+ AC_SUBST([SYMVER_MIN])
510
+
511
+ # If symbol versioning is disabled for any reason, we should not rely on
512
+ # versioned symbols in the testsuite.
513
+ have_symver=0
514
+ if test x$ax_check_vscript_flag != x; then have_symver=1; fi
515
+
516
+ AC_DEFINE_UNQUOTED([HAVE_SYMVER], [$have_symver],
517
+ [Define as 1 if symbol versioning is enabled and applied.])
518
+
519
+ # If we are not building the obsolete APIs then we shouldn't install
520
+ # xcrypt.h or the compatibility symlinks either.
521
+ if test $enable_obsolete_api = 0; then enable_xcrypt_compat_files=0; fi
522
+
523
+ AC_DEFINE_UNQUOTED([SYMVER_FLOOR], [$SYMVER_FLOOR],
524
+ [Define as the lowest compatibility symbol version that is actually
525
+ included in libcrypt.so.])
526
+
527
+ AC_DEFINE_UNQUOTED([ENABLE_OBSOLETE_API], [$enable_obsolete_api],
528
+ [Define as 1 if the obsolete APIs (fcrypt, encrypt, setkey)
529
+ should be included, 0 otherwise.])
530
+
531
+ AM_CONDITIONAL([ENABLE_OBSOLETE_API], [test $enable_obsolete_api = 1])
532
+ AM_CONDITIONAL([ENABLE_COMPAT_SUSE], [test $enable_compat_suse = 1])
533
+ AM_CONDITIONAL([ENABLE_XCRYPT_COMPAT_FILES],
534
+ [test $enable_xcrypt_compat_files = 1])
535
+
536
+ # The Makefile needs to know which versions of the library we are building.
537
+ AM_CONDITIONAL([ENABLE_STATIC], [test $enable_static = yes])
538
+ AM_CONDITIONAL([ENABLE_SHARED], [test $enable_shared = yes])
539
+
540
+ # The Makefile needs to know if we are cross-compiling.
541
+ AM_CONDITIONAL([CROSS_COMPILING], [test $cross_compiling = yes])
542
+
543
+ XCRYPT_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d. -f1`
544
+ AC_SUBST([XCRYPT_VERSION_MAJOR])
545
+
546
+ XCRYPT_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d. -f2`
547
+ AC_SUBST([XCRYPT_VERSION_MINOR])
548
+
549
+ AC_OUTPUT