diff options
Diffstat (limited to 'src/lib/libc/crypt/crypt.3')
-rw-r--r-- | src/lib/libc/crypt/crypt.3 | 87 |
1 files changed, 8 insertions, 79 deletions
diff --git a/src/lib/libc/crypt/crypt.3 b/src/lib/libc/crypt/crypt.3 index f6373c5125..c8ebf9861d 100644 --- a/src/lib/libc/crypt/crypt.3 +++ b/src/lib/libc/crypt/crypt.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: crypt.3,v 1.44 2014/12/08 20:46:04 tedu Exp $ | 1 | .\" $OpenBSD: crypt.3,v 1.45 2015/04/06 20:49:41 tedu Exp $ |
2 | .\" | 2 | .\" |
3 | .\" FreeSec: libcrypt | 3 | .\" FreeSec: libcrypt |
4 | .\" | 4 | .\" |
@@ -31,7 +31,7 @@ | |||
31 | .\" | 31 | .\" |
32 | .\" Manual page, using -mandoc macros | 32 | .\" Manual page, using -mandoc macros |
33 | .\" | 33 | .\" |
34 | .Dd $Mdocdate: December 8 2014 $ | 34 | .Dd $Mdocdate: April 6 2015 $ |
35 | .Dt CRYPT 3 | 35 | .Dt CRYPT 3 |
36 | .Os | 36 | .Os |
37 | .Sh NAME | 37 | .Sh NAME |
@@ -58,8 +58,7 @@ and | |||
58 | .Pp | 58 | .Pp |
59 | The | 59 | The |
60 | .Fn crypt | 60 | .Fn crypt |
61 | function performs password hashing based on the | 61 | function performs password hashing. |
62 | NBS Data Encryption Standard (DES). | ||
63 | Additional code has been added to deter key search attempts and to use | 62 | Additional code has been added to deter key search attempts and to use |
64 | stronger hashing algorithms. | 63 | stronger hashing algorithms. |
65 | .Pp | 64 | .Pp |
@@ -71,15 +70,7 @@ string | |||
71 | typically a user's typed password. | 70 | typically a user's typed password. |
72 | The second, | 71 | The second, |
73 | .Fa setting , | 72 | .Fa setting , |
74 | is in one of three forms: | 73 | currently supports a single form. |
75 | if it begins with an underscore | ||
76 | .Pq Ql _ | ||
77 | then an extended format is used | ||
78 | in interpreting both the | ||
79 | .Fa key | ||
80 | and the | ||
81 | .Fa setting , | ||
82 | as outlined below. | ||
83 | If it begins | 74 | If it begins |
84 | with a string character | 75 | with a string character |
85 | .Pq Ql $ | 76 | .Pq Ql $ |
@@ -87,28 +78,6 @@ and a number then a different algorithm is used depending on the number. | |||
87 | At the moment | 78 | At the moment |
88 | .Ql $2 | 79 | .Ql $2 |
89 | chooses Blowfish hashing; see below for more information. | 80 | chooses Blowfish hashing; see below for more information. |
90 | .Ss Extended crypt | ||
91 | The | ||
92 | .Fa key | ||
93 | is divided into groups of 8 characters (the last group is null-padded) | ||
94 | and the low-order 7 bits of each character (56 bits per group) are | ||
95 | used to form the DES key as follows: | ||
96 | the first group of 56 bits becomes the initial DES key. | ||
97 | For each additional group, the XOR of the encryption of the current DES | ||
98 | key with itself and the group bits becomes the next DES key. | ||
99 | .Pp | ||
100 | The | ||
101 | .Fa setting | ||
102 | is a 9-character array consisting of an underscore followed | ||
103 | by 4 bytes of iteration count and 4 bytes of salt. | ||
104 | These are encoded as printable characters, 6 bits per character, | ||
105 | least significant character first. | ||
106 | The values 0 to 63 are encoded as | ||
107 | .Dq \&./0-9A-Za-z . | ||
108 | This allows 24 bits for both | ||
109 | .Fa count | ||
110 | and | ||
111 | .Fa salt . | ||
112 | .Ss Blowfish crypt | 81 | .Ss Blowfish crypt |
113 | The Blowfish version of crypt has 128 bits of | 82 | The Blowfish version of crypt has 128 bits of |
114 | .Fa salt | 83 | .Fa salt |
@@ -141,42 +110,6 @@ A valid Blowfish password looks like this: | |||
141 | The whole Blowfish password string is passed as | 110 | The whole Blowfish password string is passed as |
142 | .Fa setting | 111 | .Fa setting |
143 | for interpretation. | 112 | for interpretation. |
144 | .Ss Traditional crypt | ||
145 | The first 8 bytes of the | ||
146 | .Fa key | ||
147 | are null-padded, and the low-order 7 bits of | ||
148 | each character is used to form the 56-bit DES key. | ||
149 | .Pp | ||
150 | The | ||
151 | .Fa setting | ||
152 | is a 2-character array of the ASCII-encoded salt. | ||
153 | Thus only 12 bits of | ||
154 | .Fa salt | ||
155 | are used. | ||
156 | .Fa count | ||
157 | is set to 25. | ||
158 | .Ss DES Algorithm | ||
159 | The | ||
160 | .Fa salt | ||
161 | introduces disorder in the DES | ||
162 | algorithm in one of 16777216 or 4096 possible ways | ||
163 | (i.e., with 24 or 12 bits: if bit | ||
164 | .Em i | ||
165 | of the | ||
166 | .Fa salt | ||
167 | is set, then bits | ||
168 | .Em i | ||
169 | and | ||
170 | .Em i+24 | ||
171 | are swapped in the DES E-box output). | ||
172 | .Pp | ||
173 | The DES key is used to encrypt a 64-bit constant using | ||
174 | .Fa count | ||
175 | iterations of DES. | ||
176 | The value returned is a NUL-terminated | ||
177 | string, 20 or 13 bytes (plus NUL) in length, consisting of the | ||
178 | .Fa setting | ||
179 | followed by the encoded 64-bit encryption. | ||
180 | .Sh RETURN VALUES | 113 | .Sh RETURN VALUES |
181 | The function | 114 | The function |
182 | .Fn crypt | 115 | .Fn crypt |
@@ -196,20 +129,16 @@ A rotor-based | |||
196 | .Fn crypt | 129 | .Fn crypt |
197 | function appeared in | 130 | function appeared in |
198 | .At v3 . | 131 | .At v3 . |
199 | The current style | 132 | A DES-based |
200 | .Fn crypt | 133 | .Fn crypt |
201 | first appeared in | 134 | first appeared in |
202 | .At v7 . | 135 | .At v7 . |
203 | .Sh AUTHORS | 136 | .Fn bcrypt |
204 | .An David Burren Aq Mt davidb@werj.com.au | 137 | first appeared in |
205 | wrote the original DES functions. | 138 | .Ox 2.1 . |
206 | .Sh BUGS | 139 | .Sh BUGS |
207 | The | 140 | The |
208 | .Fn crypt | 141 | .Fn crypt |
209 | function returns a pointer to static data, and subsequent calls to | 142 | function returns a pointer to static data, and subsequent calls to |
210 | .Fn crypt | 143 | .Fn crypt |
211 | will modify the same object. | 144 | will modify the same object. |
212 | .Pp | ||
213 | With DES hashing, passwords containing the byte 0x80 use less key entropy | ||
214 | than other passwords. | ||
215 | This is an implementation bug, not a bug in the DES cipher. | ||