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,285 @@
1
+ .\" Written and revised by Solar Designer <solar at openwall.com> in 2000-2011.
2
+ .\" Revised by Zack Weinberg <zackw at panix.com> in 2017.
3
+ .\" Converted to mdoc format by Zack Weinberg in 2018.
4
+ .\"
5
+ .\" No copyright is claimed, and this man page is hereby placed in the public
6
+ .\" domain. In case this attempt to disclaim copyright and place the man page
7
+ .\" in the public domain is deemed null and void, then the man page is
8
+ .\" Copyright 2000-2011 Solar Designer, 2017 Zack Weinberg, and it is
9
+ .\" hereby released to the general public under the following terms:
10
+ .\"
11
+ .\" Redistribution and use in source and binary forms, with or without
12
+ .\" modification, are permitted.
13
+ .\"
14
+ .\" There's ABSOLUTELY NO WARRANTY, express or implied.
15
+ .\"
16
+ .Dd March 27, 2024
17
+ .Dt CRYPT_GENSALT 3
18
+ .Os "Openwall Project"
19
+ .Sh NAME
20
+ .Nm crypt_gensalt , crypt_gensalt_rn , crypt_gensalt_ra
21
+ .Nd encode settings for passphrase hashing
22
+ .Sh LIBRARY
23
+ .Lb libcrypt
24
+ .Sh SYNOPSIS
25
+ .In crypt.h
26
+ .Ft "char *"
27
+ .Fo crypt_gensalt
28
+ .Fa "const char *prefix"
29
+ .Fa "unsigned long count"
30
+ .Fa "const char *rbytes"
31
+ .Fa "int nrbytes"
32
+ .Fc
33
+ .Ft "char *"
34
+ .Fo crypt_gensalt_rn
35
+ .Fa "const char * prefix"
36
+ .Fa "unsigned long count"
37
+ .Fa "const char *rbytes"
38
+ .Fa "int nrbytes"
39
+ .Fa "char * output"
40
+ .Fa "int output_size"
41
+ .Fc
42
+ .Ft "char *"
43
+ .Fo crypt_gensalt_ra
44
+ .Fa "const char *prefix"
45
+ .Fa "unsigned long count"
46
+ .Fa "const char *rbytes"
47
+ .Fa "int nrbytes"
48
+ .Fc
49
+ .Sh DESCRIPTION
50
+ The
51
+ .Nm crypt_gensalt ,
52
+ .Nm crypt_gensalt_rn ,
53
+ and
54
+ .Nm crypt_gensalt_ra
55
+ functions compile a string for use as the
56
+ .Fa setting
57
+ argument to
58
+ .Nm crypt ,
59
+ .Nm crypt_r ,
60
+ .Nm crypt_rn ,
61
+ and
62
+ .Nm crypt_ra .
63
+ .Fa prefix
64
+ selects the hashing method to use.
65
+ .Fa count
66
+ controls the processing cost of the hash;
67
+ the valid range and exact meaning of
68
+ .Fa count
69
+ depend on the hashing method,
70
+ but larger numbers correspond to more costly hashes
71
+ in terms of CPU time and possibly memory usage.
72
+ .Fa rbytes
73
+ should point to
74
+ .Fa nrbytes
75
+ cryptographically random bytes for use as
76
+ .Dq salt.
77
+ .Pp
78
+ If
79
+ .Fa prefix
80
+ is a null pointer, the best available hashing method will be selected.
81
+ .Po Sy CAUTION :
82
+ if
83
+ .Fa prefix
84
+ is an empty string,
85
+ the
86
+ .Dq traditional
87
+ DES-based hashing method will be selected;
88
+ this method is unacceptably weak by modern standards.
89
+ .Pc
90
+ If
91
+ .Fa count
92
+ is 0, a low default cost will be selected.
93
+ If
94
+ .Fa rbytes
95
+ is a null pointer, an appropriate number of random bytes will be
96
+ obtained from the operating system, and
97
+ .Fa nrbytes
98
+ is ignored.
99
+ .Pp
100
+ See
101
+ .Xr crypt 5
102
+ for other strings that can be used as
103
+ .Fa prefix ,
104
+ and valid values of
105
+ .Fa count
106
+ for each.
107
+ .Sh RETURN VALUES
108
+ .Nm crypt_gensalt ,
109
+ .Nm crypt_gensalt_rn ,
110
+ and
111
+ .Nm crypt_gensalt_ra
112
+ return a pointer to an encoded setting string.
113
+ This string will be entirely printable ASCII,
114
+ and will not contain whitespace or the characters
115
+ .Sq Li \&: ,
116
+ .Sq Li \&; ,
117
+ .Sq Li \&* ,
118
+ .Sq Li \&! ,
119
+ or
120
+ .Sq Li \&\e .
121
+ See
122
+ .Xr crypt 5
123
+ for more detail on the format of this string.
124
+ Upon error, they return a null pointer and set
125
+ .Va errno
126
+ to an appropriate error code.
127
+ When the functions succeed, the value of
128
+ .Va errno
129
+ is unspecified and must not be relied upon.
130
+ .Pp
131
+ .Nm crypt_gensalt
132
+ places its result in a static storage area,
133
+ which will be overwritten by subsequent calls to
134
+ .Nm crypt_gensalt .
135
+ It is not safe to call
136
+ .Nm crypt_gensalt
137
+ from multiple threads simultaneously.
138
+ It's also not recommended to use the pointer
139
+ returned as an argument for another call to
140
+ .Nm crypt_gensalt ,
141
+ as some implementations, including earlier
142
+ releases of libxcrypt, may overwrite the underlying
143
+ static output buffer before computing the setting.
144
+ However, it
145
+ .Em is
146
+ safe to pass the string returned by
147
+ .Nm crypt_gensalt
148
+ directly to
149
+ .Nm crypt
150
+ without copying it;
151
+ each function has its own static storage area.
152
+ .Pp
153
+ .Nm crypt_gensalt_rn
154
+ places its result in the supplied
155
+ .Fa output
156
+ buffer, which has
157
+ .Fa output_size
158
+ bytes of storage available.
159
+ .Fa output_size
160
+ should be greater than or equal to
161
+ .Dv CRYPT_GENSALT_OUTPUT_SIZE .
162
+ It's also not recommended to use the pointer
163
+ returned as an argument for another call to
164
+ .Nm crypt_gensalt_rn
165
+ using the same
166
+ .Fa output
167
+ buffer for subsequent calls, as some implementations,
168
+ including earlier releases of libxcrypt, may overwrite
169
+ the supplied buffer before computing the setting.
170
+ .Pp
171
+ .Nm crypt_gensalt_ra
172
+ allocates memory for its result using
173
+ .Xr malloc 3 .
174
+ It should be freed with
175
+ .Xr free 3
176
+ after use.
177
+ .Pp
178
+ Upon error, in addition to returning a null pointer,
179
+ .Nm crypt_gensalt
180
+ and
181
+ .Nm crypt_gensalt_rn
182
+ will write an invalid setting string
183
+ to their output buffer, if there is enough space;
184
+ this string will begin with a
185
+ .Sq Li \&*
186
+ and will not be equal to
187
+ .Fa prefix .
188
+ .Sh ERRORS
189
+ .Bl -tag -width Er
190
+ .It Er EINVAL
191
+ .Fa prefix
192
+ is invalid or not supported by this implementation;
193
+ .Fa count
194
+ is invalid for the requested
195
+ .Fa prefix ;
196
+ the input
197
+ .Fa nrbytes
198
+ is insufficient for the smallest valid salt with the requested
199
+ .Fa prefix .
200
+ .It Er ERANGE
201
+ .Nm crypt_gensalt_rn
202
+ only:
203
+ .Fa output_size
204
+ is too small to hold the compiled
205
+ .Fa setting
206
+ string.
207
+ .It Er ENOMEM
208
+ Failed to allocate internal scratch memory.
209
+ .br
210
+ .Nm crypt_gensalt_ra
211
+ only:
212
+ failed to allocate memory for the compiled
213
+ .Fa setting
214
+ string.
215
+ .It Er ENOSYS , EACCES , EIO , No etc.\&
216
+ Obtaining random bytes from the operating system failed.
217
+ This can only happen when
218
+ .Fa rbytes
219
+ is a null pointer.
220
+ .El
221
+ .Sh FEATURE TEST MACROS
222
+ The following macros are defined by
223
+ .In crypt.h :
224
+ .Bl -tag -width 6n
225
+ .It Dv CRYPT_GENSALT_IMPLEMENTS_DEFAULT_PREFIX
226
+ A null pointer can be specified as the
227
+ .Fa prefix
228
+ argument.
229
+ .It Dv CRYPT_GENSALT_IMPLEMENTS_AUTO_ENTROPY
230
+ A null pointer can be specified as the
231
+ .Fa rbytes
232
+ argument.
233
+ .El
234
+ .Sh PORTABILITY NOTES
235
+ The functions
236
+ .Nm crypt_gensalt ,
237
+ .Nm crypt_gensalt_rn ,
238
+ and
239
+ .Nm crypt_gensalt_ra
240
+ are not part of any standard.
241
+ They originate with the Openwall project.
242
+ A function with the name
243
+ .Nm crypt_gensalt
244
+ also exists on Solaris 10 and newer, but its prototype and semantics differ.
245
+ .Pp
246
+ The default prefix and auto entropy features are available since libxcrypt
247
+ version 4.0.0. Portable software can use feature test macros to find out
248
+ whether null pointers can be used for the
249
+ .Fa prefix
250
+ and
251
+ .Fa rbytes
252
+ arguments.
253
+ .Pp
254
+ The set of supported hashing methods varies considerably from system
255
+ to system.
256
+ .Sh ATTRIBUTES
257
+ For an explanation of the terms used in this section, see
258
+ .Xr attributes 7 .
259
+ .ad l
260
+ .TS
261
+ allbox;
262
+ lb lb lb
263
+ l l l.
264
+ Interface Attribute Value
265
+ T{
266
+ .Nm crypt_gensalt
267
+ T} Thread safety MT-Unsafe race:crypt_gensalt
268
+ T{
269
+ .Nm crypt_gensalt_rn ,
270
+ .Nm crypt_gensalt_ra
271
+ T} Thread safety MT-Safe
272
+ .TE
273
+ .ad
274
+ .sp
275
+ .Sh SEE ALSO
276
+ .Xr crypt 3 ,
277
+ .Xr getpass 3 ,
278
+ .Xr getpwent 3 ,
279
+ .Xr shadow 3 ,
280
+ .Xr login 1 ,
281
+ .Xr passwd 1 ,
282
+ .Xr crypt 5 ,
283
+ .Xr passwd 5 ,
284
+ .Xr shadow 5 ,
285
+ .Xr pam 8
@@ -0,0 +1 @@
1
+ .so man3/crypt_gensalt.3
@@ -0,0 +1 @@
1
+ .so man3/crypt_gensalt.3
@@ -0,0 +1,68 @@
1
+ .\" Written by Björn Esser <besser82 at fedoraproject.org> in 2018.
2
+ .\"
3
+ .\" To the extent possible under law, the authors have waived
4
+ .\" all copyright and related or neighboring rights to this work.
5
+ .\" See https://creativecommons.org/publicdomain/zero/1.0/ for further
6
+ .\" details.
7
+ .\"
8
+ .Dd November 16, 2018
9
+ .Dt CRYPT_PREFERRED_METHOD 3
10
+ .Os libxcrypt
11
+ .Sh NAME
12
+ .Nm crypt_preferred_method
13
+ .Nd get the prefix of the preferred hash method
14
+ .Sh LIBRARY
15
+ .Lb libcrypt
16
+ .Sh SYNOPSIS
17
+ .In crypt.h
18
+ .Ft const char*
19
+ .Fo crypt_preferred_method
20
+ .Fa void
21
+ .Fc
22
+ .Sh DESCRIPTION
23
+ .Nm
24
+ is a convenience function to get the prefix of the preferred hash
25
+ method. If a preferred method is available,
26
+ it is the same as the one also used by the
27
+ .Nm crypt_gensalt functions ,
28
+ if their given
29
+ .Ar prefix
30
+ parameter is NULL.
31
+ .Sh RETURN VALUES
32
+ The string returned equals the prefix of the preferred hash method.
33
+ If no preferred hash method is available it is NULL.
34
+ It
35
+ .Em is
36
+ safe to pass the string returned by
37
+ .Nm crypt_preferred_method
38
+ directly to
39
+ .Nm crypt_gensalt
40
+ without prior string-sanitizing nor NULL-pointer checks.
41
+ .Sh FEATURE TEST MACROS
42
+ .In crypt.h
43
+ will define the macro
44
+ .Dv CRYPT_PREFERRED_METHOD_AVAILABLE
45
+ if
46
+ .Nm
47
+ is available in the current version of libxcrypt.
48
+ .Sh PORTABILITY NOTES
49
+ The function
50
+ .Nm
51
+ is not part of any standard.
52
+ It was added to libxcrypt in version 4.4.0.
53
+ .Sh ATTRIBUTES
54
+ For an explanation of the terms used in this section,
55
+ see
56
+ .Xr attributes 7 .
57
+ .TS
58
+ allbox;
59
+ lb lb lb
60
+ lw(22n) l l.
61
+ Interface Attribute Value
62
+ T{
63
+ .Nm
64
+ T} Thread safety MT-Safe
65
+ .TE
66
+ .sp
67
+ .Sh SEE ALSO
68
+ .Xr crypt_gensalt 3
@@ -0,0 +1 @@
1
+ .so man3/crypt.3
@@ -0,0 +1 @@
1
+ .so man3/crypt.3
@@ -0,0 +1 @@
1
+ .so man3/crypt.3