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,481 @@
1
+ # Build with new api?
2
+ %if 0%{?fedora} || 0%{?rhel} > 8
3
+ %bcond_without new_api
4
+ %else
5
+ %bcond_with new_api
6
+ %endif
7
+
8
+
9
+ # Build the compat package?
10
+ %if 0%{?fedora} >= 999 || 0%{?rhel} >= 10 || %{without new_api}
11
+ %bcond_with compat_pkg
12
+ %else
13
+ %bcond_without compat_pkg
14
+ %endif
15
+
16
+
17
+ # Replace obsolete functions with a stub?
18
+ %if %{with new_api} && %{with compat_pkg}
19
+ %bcond_without enosys_stubs
20
+ %else
21
+ %bcond_with enosys_stubs
22
+ %endif
23
+
24
+
25
+ # Build the static library?
26
+ %bcond_without staticlib
27
+
28
+
29
+ # Shared object version of libcrypt.
30
+ %if %{with new_api}
31
+ %global soc 2
32
+ %global sol 0
33
+ %global sof 0
34
+ %global sov %{soc}.%{sol}.%{sof}
35
+ %else
36
+ %global soc 1
37
+ %global sol 1
38
+ %global sof 0
39
+ %global sov %{soc}.%{sol}.%{sof}
40
+ %endif
41
+
42
+ %if %{with compat_pkg}
43
+ %global csoc 1
44
+ %global csol 1
45
+ %global csof 0
46
+ %global csov %{csoc}.%{csol}.%{csof}
47
+ %endif
48
+
49
+
50
+ # First version of glibc built without libcrypt.
51
+ %global glibc_minver 2.28
52
+
53
+
54
+ # Minimum version of Perl needed for some build-scripts.
55
+ %global perl_minver 5.14
56
+
57
+
58
+ # The libxcrypt-devel package conflicts with out-dated manuals
59
+ # shipped with the man-pages packages *before* this EVR.
60
+ %global man_pages_minver 4.15-3
61
+
62
+
63
+ # Need versioned requires on glibc and man-pages?
64
+ %if !(0%{?fedora} || 0%{?rhel} > 9)
65
+ %global trans_pkg 1
66
+ %endif
67
+
68
+
69
+ # Hash methods and API supported by libcrypt.
70
+ # NEVER EVER touch this, if you do NOT know what you are doing!
71
+ %global hash_methods all
72
+
73
+ %if %{with new_api}
74
+ %global obsolete_api no
75
+ %else
76
+ %global obsolete_api glibc
77
+ %endif
78
+
79
+ %if %{with compat_pkg}
80
+ %global compat_methods all
81
+ %global compat_api glibc
82
+ %endif
83
+
84
+
85
+ # Do we replace the obsolete API functions with stubs?
86
+ %if %{with enosys_stubs}
87
+ %global enosys_stubs yes
88
+ %else
89
+ %global enosys_stubs no
90
+ %endif
91
+
92
+
93
+ # Needed for the distribution README file.
94
+ %if 0%{?fedora}
95
+ %global distname .fedora
96
+ %else
97
+ %if 0%{?rhel}
98
+ %global distname .rhel
99
+ %else
100
+ %global distname .distribution
101
+ %endif
102
+ %endif
103
+
104
+
105
+ # Needed for out-of-tree builds.
106
+ %global _configure "$(realpath ../configure)"
107
+
108
+
109
+ # Create config.cache to speedup the run of
110
+ # the configure script for the compat package.
111
+ %global nvrt_str %{name}-%{version}-%{release}.%{_target_cpu}
112
+ %global mktemplate %{nvrt_str}-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
113
+ %global config_cache %(mktemp -tu %{mktemplate}-config.cache)
114
+
115
+
116
+ # Common configure options.
117
+ %global common_configure_options \\\
118
+ --cache-file=%{config_cache} \\\
119
+ --disable-failure-tokens \\\
120
+ --disable-silent-rules \\\
121
+ --enable-shared \\\
122
+ %if %{with staticlib} \
123
+ --enable-static \\\
124
+ %else \
125
+ --disable-static \\\
126
+ %endif \
127
+ --disable-valgrind \\\
128
+ --srcdir=$(realpath ..) \\\
129
+ --with-pkgconfigdir=%{_libdir}/pkgconfig
130
+
131
+
132
+ # Fail linking if there are undefined symbols.
133
+ # Required for proper ELF symbol versioning support.
134
+ %global _ld_strict_symbol_defs 1
135
+
136
+
137
+ Name: {{{ git_name }}}
138
+ Version: {{{ git_real_version }}}
139
+ Release: 0.{{{ git_real_release }}}%{?dist}
140
+ Summary: Extended crypt library for descrypt, md5crypt, bcrypt, and others
141
+
142
+ # For explicit license breakdown, see the
143
+ # LICENSING file in the source tarball.
144
+ License: LGPL-2.1-or-later AND BSD-3-Clause AND BSD-2-Clause AND BSD-2-Clause-FreeBSD AND 0BSD AND CC0-1.0 AND LicenseRef-Fedora-Public-Domain
145
+ URL: https://github.com/besser82/%{name}
146
+ VCS: {{{ git_dir_vcs }}}
147
+
148
+ Source0: {{{ git_dir_pack }}}
149
+
150
+ BuildRequires: autoconf
151
+ BuildRequires: automake
152
+ BuildRequires: coreutils
153
+ BuildRequires: gcc
154
+ %if 0%{?trans_pkg}
155
+ BuildRequires: glibc-devel >= %{glibc_minver}
156
+ %endif
157
+ BuildRequires: libtool
158
+ BuildRequires: make
159
+ BuildRequires: perl(:VERSION) >= %{perl_minver}
160
+ BuildRequires: perl(Class::Struct)
161
+ BuildRequires: perl(Cwd)
162
+ BuildRequires: perl(Exporter)
163
+ BuildRequires: perl(File::Spec::Functions)
164
+ BuildRequires: perl(File::Temp)
165
+ BuildRequires: perl(FindBin)
166
+ BuildRequires: perl(if)
167
+ BuildRequires: perl(IPC::Open3)
168
+ BuildRequires: perl(lib)
169
+ BuildRequires: perl(open)
170
+ BuildRequires: perl(POSIX)
171
+ BuildRequires: perl(Symbol)
172
+ BuildRequires: perl(utf8)
173
+ BuildRequires: perl(warnings)
174
+ BuildRequires: perl-interpreter
175
+
176
+ # We do not need to keep this forever.
177
+ %if 0%{?trans_pkg}
178
+ # Inherited from former libcrypt package.
179
+ Obsoletes: libcrypt-nss < %{glibc_minver}
180
+ Provides: libcrypt-nss = %{glibc_minver}
181
+ Provides: libcrypt-nss%{?_isa} = %{glibc_minver}
182
+
183
+ # Obsolete former libcrypt properly and provide a virtual libcrypt
184
+ # package as it has been done by the former packages, which were
185
+ # built by glibc before.
186
+ Obsoletes: libcrypt < %{glibc_minver}
187
+ Provides: libcrypt = %{glibc_minver}
188
+ Provides: libcrypt%{?_isa} = %{glibc_minver}
189
+
190
+ # Obsolete former libxcrypt-common properly.
191
+ Obsoletes: %{name}-common < 4.3.3-4
192
+ Provides: %{name}-common = %{version}-%{release}
193
+
194
+ # We need a version of glibc, that doesn't build libcrypt anymore.
195
+ Requires: glibc%{?_isa} >= %{glibc_minver}
196
+ %endif
197
+
198
+ %if %{with new_api} && %{without compat_pkg}
199
+ Obsoletes: %{name}-compat < %{version}-%{release}
200
+ %endif
201
+
202
+ %if 0%{?fedora}
203
+ Recommends: mkpasswd
204
+ %endif
205
+
206
+ %description
207
+ libxcrypt is a modern library for one-way hashing of passwords. It
208
+ supports a wide variety of both modern and historical hashing methods:
209
+ yescrypt, gost-yescrypt, sm3-yescrypt, scrypt, bcrypt, sm3crypt,
210
+ sha512crypt, sha256crypt, md5crypt, SunMD5, sha1crypt, NT, bsdicrypt,
211
+ bigcrypt, and descrypt. It provides the traditional Unix crypt and
212
+ crypt_r interfaces, as well as a set of extended interfaces pioneered
213
+ by Openwall Linux, crypt_rn, crypt_ra, crypt_gensalt, crypt_gensalt_rn,
214
+ and crypt_gensalt_ra.
215
+
216
+ libxcrypt is intended to be used by login(1), passwd(1), and other
217
+ similar programs; that is, to hash a small number of passwords during
218
+ an interactive authentication dialogue with a human. It is not suitable
219
+ for use in bulk password-cracking applications, or in any other situation
220
+ where speed is more important than careful handling of sensitive data.
221
+ However, it is intended to be fast and lightweight enough for use in
222
+ servers that must field thousands of login attempts per minute.
223
+ %if %{with new_api}
224
+ This version of the library does not provide the legacy API functions
225
+ that have been provided by glibc's libcrypt.so.1.
226
+ %endif
227
+
228
+
229
+ %if %{with compat_pkg}
230
+ %package compat
231
+ Summary: Compatibility library providing legacy API functions
232
+
233
+ # For testing the glibc compatibility symbols.
234
+ BuildRequires: libxcrypt-compat
235
+
236
+ Requires: %{name}%{?_isa} = %{version}-%{release}
237
+
238
+ %description compat
239
+ This package contains the library providing the compatibility API
240
+ for applications that are linked against glibc's libxcrypt, or that
241
+ are still using the unsafe and deprecated, encrypt, encrypt_r,
242
+ setkey, setkey_r, and fcrypt functions, which are still required by
243
+ recent versions of POSIX, the Single UNIX Specification, and various
244
+ other standards.
245
+
246
+ All existing binary executables linked against glibc's libcrypt should
247
+ work unmodified with the library supplied by this package.
248
+ %endif
249
+
250
+
251
+ %package devel
252
+ Summary: Development files for %{name}
253
+
254
+ Requires: %{name}%{?_isa} = %{version}-%{release}
255
+ Requires: glibc-devel%{?_isa}
256
+ %if 0%{?trans_pkg}
257
+ Conflicts: man-pages < %{man_pages_minver}
258
+ Requires: glibc-devel%{?_isa} >= %{glibc_minver}
259
+ %endif
260
+
261
+ %description devel
262
+ The %{name}-devel package contains libraries and header files for
263
+ developing applications that use %{name}.
264
+
265
+
266
+ %if %{with staticlib}
267
+ %package static
268
+ Summary: Static library for -static linking with %{name}
269
+
270
+ Requires: %{name}-devel%{?_isa} = %{version}-%{release}
271
+ Requires: glibc-static%{?_isa}
272
+ %if 0%{?trans_pkg}
273
+ Requires: glibc-static%{?_isa} >= %{glibc_minver}
274
+ %endif
275
+
276
+ %description static
277
+ This package contains the libxcrypt static library for -static
278
+ linking.
279
+
280
+ You don't need this, unless you link statically, which is highly
281
+ discouraged.
282
+ %endif
283
+
284
+
285
+ %prep
286
+ {{{ git_dir_setup_macro }}}
287
+
288
+ $(realpath ./autogen.sh)
289
+
290
+ %if %{with new_api}
291
+ cat << EOF >> README%{distname}
292
+ This version of the %{name} package ships the libcrypt.so.2
293
+ library and does not provide the legacy API functions that have
294
+ been provided by glibc's libcrypt.so.1. The removed functions
295
+ by name are encrypt, encrypt_r, setkey, setkey_r, and fcrypt.
296
+ %if %{with compat_pkg}
297
+
298
+ If you are using a third-party application that links against
299
+ those functions, or that is linked against glibc's libcrypt,
300
+ you may need to install the %{name}-compat package manually.
301
+
302
+ All existing binary executables linked against glibc's libcrypt
303
+ should work unmodified with the libcrypt.so.1 library supplied
304
+ by the %{name}-compat package.
305
+ %endif
306
+ EOF
307
+ %endif
308
+
309
+ %if %{with enosys_stubs}
310
+ cat << EOF >> README.posix
311
+ This version of the libcrypt.so.1 library has entirely removed
312
+ the functionality of the encrypt, encrypt_r, setkey, and setkey_r
313
+ functions, while keeping fully binary compatibility with existing
314
+ (third-party) applications possibly still using those funtions.
315
+ If such an application attemps to call one of these functions, the
316
+ corresponding function will indicate that it is not supported by
317
+ the system in a POSIX-compliant way.
318
+
319
+ For security reasons, the encrypt and encrypt_r functions will
320
+ also overwrite their data-block argument with random bits.
321
+
322
+ All existing binary executables linked against glibc's libcrypt
323
+ should work unmodified with the provided version of the
324
+ libcrypt.so.1 library in place.
325
+ EOF
326
+ %endif
327
+
328
+ %if %{with staticlib}
329
+ cat << EOF >> README.static
330
+ Applications that use certain legacy APIs supplied by glibc’s
331
+ libcrypt (encrypt, encrypt_r, setkey, setkey_r, and fcrypt)
332
+ cannot be compiled nor linked against the supplied build of
333
+ the object files provided in the static library libcrypt.a.
334
+ EOF
335
+ %endif
336
+
337
+
338
+ %build
339
+ touch %{config_cache}
340
+ mkdir -p %{_vpath_builddir}
341
+
342
+ # Build the default system library.
343
+ pushd %{_vpath_builddir}
344
+ %configure \
345
+ %{common_configure_options} \
346
+ --enable-hashes=%{hash_methods} \
347
+ --enable-obsolete-api=%{obsolete_api} \
348
+ %if %{with new_api}
349
+ --enable-obsolete-api-enosys=%{obsolete_api}
350
+ %else
351
+ --enable-obsolete-api-enosys=%{enosys_stubs}
352
+ %endif
353
+ %make_build
354
+ popd
355
+
356
+ %if %{with compat_pkg}
357
+ mkdir -p %{_vpath_builddir}-compat
358
+
359
+ # Build the compatibility library.
360
+ pushd %{_vpath_builddir}-compat
361
+ %configure \
362
+ %{common_configure_options} \
363
+ --enable-hashes=%{compat_methods} \
364
+ --enable-obsolete-api=%{compat_api} \
365
+ --enable-obsolete-api-enosys=%{enosys_stubs}
366
+ %make_build
367
+ popd
368
+ %endif
369
+ rm -f %{config_cache}
370
+
371
+
372
+ %install
373
+ %if %{with compat_pkg}
374
+ # Install the compatibility library.
375
+ %make_install -C %{_vpath_builddir}-compat
376
+
377
+ # Cleanup everything we do not need from the compatibility library.
378
+ find %{buildroot} \
379
+ -not -type d -not -name 'libcrypt.so.%{csoc}*' -delete -print
380
+ %endif
381
+
382
+ # Install the default system library.
383
+ %make_install -C %{_vpath_builddir}
384
+
385
+ # Get rid of libtool crap.
386
+ find %{buildroot} -name '*.la' -delete -print
387
+
388
+ # Install documentation to shared %%_pkgdocdir.
389
+ install -Dpm 0644 -t %{buildroot}%{_pkgdocdir} \
390
+ ChangeLog NEWS README* THANKS TODO
391
+
392
+ # Drop README.md as it is identical to README.
393
+ rm -f %{buildroot}%{_pkgdocdir}/README.md
394
+
395
+
396
+ %check
397
+ build_dirs="%{_vpath_builddir}"
398
+ %if %{with compat_pkg}
399
+ build_dirs="${build_dirs} %{_vpath_builddir}-compat"
400
+ %endif
401
+ for dir in ${build_dirs}; do
402
+ %make_build -C ${dir} check || \
403
+ {
404
+ rc=$?;
405
+ echo "-----BEGIN TESTLOG: ${dir}-----";
406
+ cat ${dir}/test-suite.log;
407
+ echo "-----END TESTLOG: ${dir}-----";
408
+ exit $rc;
409
+ }
410
+ done
411
+
412
+
413
+ %ldconfig_scriptlets
414
+ %if %{with compat_pkg}
415
+ %ldconfig_scriptlets compat
416
+ %endif
417
+
418
+
419
+ %files
420
+ %doc %dir %{_pkgdocdir}
421
+ %doc %{_pkgdocdir}/NEWS
422
+ %doc %{_pkgdocdir}/README
423
+ %if %{with new_api}
424
+ %doc %{_pkgdocdir}/README%{distname}
425
+ %endif
426
+ %if %{with enosys_stubs} && %{without compat_pkg}
427
+ %doc %{_pkgdocdir}/README.posix
428
+ %endif
429
+ %doc %{_pkgdocdir}/THANKS
430
+ %license AUTHORS COPYING.LIB LICENSING
431
+ %{_libdir}/libcrypt.so.%{soc}
432
+ %{_libdir}/libcrypt.so.%{sov}
433
+ %{_mandir}/man5/crypt.5*
434
+
435
+
436
+ %if %{with compat_pkg}
437
+ %files compat
438
+ %if %{with enosys_stubs}
439
+ %doc %{_pkgdocdir}/README.posix
440
+ %endif
441
+ %{_libdir}/libcrypt.so.%{csoc}
442
+ %{_libdir}/libcrypt.so.%{csov}
443
+ %endif
444
+
445
+
446
+ %files devel
447
+ %doc %{_pkgdocdir}/ChangeLog
448
+ %doc %{_pkgdocdir}/TODO
449
+ %{_libdir}/libcrypt.so
450
+ %if %{without new_api}
451
+ %{_libdir}/libxcrypt.so
452
+ %endif
453
+ %{_includedir}/crypt.h
454
+ %if %{without new_api}
455
+ %{_includedir}/xcrypt.h
456
+ %endif
457
+ %{_libdir}/pkgconfig/libcrypt.pc
458
+ %{_libdir}/pkgconfig/%{name}.pc
459
+ %{_mandir}/man3/crypt.3*
460
+ %{_mandir}/man3/crypt_r.3*
461
+ %{_mandir}/man3/crypt_ra.3*
462
+ %{_mandir}/man3/crypt_rn.3*
463
+ %{_mandir}/man3/crypt_checksalt.3*
464
+ %{_mandir}/man3/crypt_gensalt.3*
465
+ %{_mandir}/man3/crypt_gensalt_ra.3*
466
+ %{_mandir}/man3/crypt_gensalt_rn.3*
467
+ %{_mandir}/man3/crypt_preferred_method.3*
468
+
469
+
470
+ %if %{with staticlib}
471
+ %files static
472
+ %doc %{_pkgdocdir}/README.static
473
+ %{_libdir}/libcrypt.a
474
+ %if %{without new_api}
475
+ %{_libdir}/libxcrypt.a
476
+ %endif
477
+ %endif
478
+
479
+
480
+ %changelog
481
+ {{{ git_dir_changelog }}}
@@ -0,0 +1,2 @@
1
+ [rpkg]
2
+ user_macros = "${git_props:root}/rpkg.macros"
@@ -0,0 +1,86 @@
1
+ function filter_tags {
2
+ grep -E "^$1[^-]+$"
3
+ }
4
+
5
+ function latest_merged_tag {
6
+ if [ "$LEGACY_GIT" ]; then
7
+ git for-each-ref --sort=-v:refname refs/tags | cut -f2 |
8
+ while read tag; do
9
+ if [ -z "$(basename "$tag" | filter_tags "$1")" ]; then
10
+ continue
11
+ fi
12
+ if [ "$(git merge-base "$tag" HEAD)"="$(git rev-parse "$tag"^{commit})" ]; then
13
+ echo "$(basename "$tag")"
14
+ return
15
+ fi
16
+ done
17
+ else
18
+ git tag --list --sort=-v:refname "$1*" --merged 2> /dev/null | filter_tags "$1" | head -n 1
19
+ fi
20
+ }
21
+
22
+ function git_version {
23
+ declare name="v" lead=0 follow= "$@"
24
+
25
+ if [ -z "$name" ]; then
26
+ log_error "name cannot be empty."
27
+ return 1
28
+ fi
29
+
30
+ if echo "$lead.$follow" | grep -q '-'; then
31
+ log_error "lead and follow cannot contain dashes."
32
+ return 1
33
+ fi
34
+
35
+ if echo "$follow" | grep -q '\.'; then
36
+ log_error "follow cannot contain dots."
37
+ return 1
38
+ fi
39
+
40
+ latest_tag="$(latest_merged_tag "$name")"
41
+ latest_tag_version="$(echo $latest_tag | sed -E -n "s/^$name([^-]+)$/\1/p")"
42
+
43
+ if [ -n "$latest_tag" ]; then
44
+ commit_count="$(git rev-list "$latest_tag"..HEAD | wc -l)"
45
+ else
46
+ commit_count="$(git rev-list HEAD 2> /dev/null | wc -l || printf 0)"
47
+ fi
48
+
49
+ if [ "$commit_count" -eq 0 ]; then
50
+ commit_count_appendix=
51
+ else
52
+ commit_count_appendix=".git.$commit_count.$(git rev-parse --short HEAD)"
53
+ fi
54
+
55
+ latest_ctime="$(git_latest_ctime)"
56
+ if [ "$latest_ctime" -eq 0 ]; then
57
+ wtree_appendix=
58
+ else
59
+ wtree_appendix=".wtree.$(encode_decimal "$latest_ctime")"
60
+ fi
61
+
62
+ if [ -z "$follow" ]; then
63
+ follow="$(echo "$latest_tag_version" | sed -E -n "s/^.*\.([^.]*)$/\1/p")"
64
+ fi
65
+
66
+ if [ "$lead" = 0 ]; then
67
+ lead="$(echo "$latest_tag_version" | sed -E -n "s/\.$follow$//p")"
68
+ fi
69
+
70
+ follow=$((follow+1))
71
+
72
+ output "${lead}.${follow:-0}${commit_count_appendix}${wtree_appendix}"
73
+ }
74
+
75
+ function git_real_version {
76
+ real_version="$(git_version "$@" | sed -e "s/\.git.*$//")"
77
+ output "${real_version}"
78
+ }
79
+
80
+ function git_real_release {
81
+ git_version > /dev/null
82
+ commit_sha="$(echo ${commit_count_appendix} | sed -e "s/^.*\.//")"
83
+ commit_count_no="$(echo ${commit_count_appendix} | sed -e "s/^\.git\.//")"
84
+ commit_count_no="$(echo ${commit_count_no} | sed -e "s/\.${commit_sha}//")"
85
+ output "${commit_count_no}.git${commit_sha}${wtree_appendix}"
86
+ }