diff options
author | aaron <> | 2000-04-18 02:31:34 +0000 |
---|---|---|
committer | aaron <> | 2000-04-18 02:31:34 +0000 |
commit | 59ca3f5f8991ab72904434fb49ef0999d64ae2e8 (patch) | |
tree | 1dd6f422d13137d3acf29ca8d4d3e3b69d122d98 /src/lib/libc/crypt | |
parent | 6c6b1d3d1d43480c21468b276a64c1fb7d82c152 (diff) | |
download | openbsd-59ca3f5f8991ab72904434fb49ef0999d64ae2e8.tar.gz openbsd-59ca3f5f8991ab72904434fb49ef0999d64ae2e8.tar.bz2 openbsd-59ca3f5f8991ab72904434fb49ef0999d64ae2e8.zip |
Repairs.
Diffstat (limited to 'src/lib/libc/crypt')
-rw-r--r-- | src/lib/libc/crypt/arc4random.3 | 10 | ||||
-rw-r--r-- | src/lib/libc/crypt/blowfish.3 | 5 | ||||
-rw-r--r-- | src/lib/libc/crypt/crypt.3 | 105 |
3 files changed, 69 insertions, 51 deletions
diff --git a/src/lib/libc/crypt/arc4random.3 b/src/lib/libc/crypt/arc4random.3 index f4116a1e82..2bf63eca72 100644 --- a/src/lib/libc/crypt/arc4random.3 +++ b/src/lib/libc/crypt/arc4random.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: arc4random.3,v 1.13 2000/04/15 02:15:22 aaron Exp $ | 1 | .\" $OpenBSD: arc4random.3,v 1.14 2000/04/18 02:31:34 aaron Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> | 3 | .\" Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> |
4 | .\" All rights reserved. | 4 | .\" All rights reserved. |
@@ -50,8 +50,8 @@ | |||
50 | The | 50 | The |
51 | .Fn arc4random | 51 | .Fn arc4random |
52 | function uses the key stream generator employed by the | 52 | function uses the key stream generator employed by the |
53 | arc4 cipher, which uses 8*8 8 bit S-Boxes. The S-Boxes | 53 | arc4 cipher, which uses 8*8 8 bit S-Boxes. |
54 | can be in about (2**1700) states. | 54 | The S-Boxes can be in about (2**1700) states. |
55 | .Pp | 55 | .Pp |
56 | The | 56 | The |
57 | .Fn arc4random_stir | 57 | .Fn arc4random_stir |
@@ -74,8 +74,8 @@ automatically initializes itself. | |||
74 | .Sh HISTORY | 74 | .Sh HISTORY |
75 | An algorithm call | 75 | An algorithm call |
76 | .Pa RC4 | 76 | .Pa RC4 |
77 | was designed by RSA Data Security, Inc. It was considered a trade secret, | 77 | was designed by RSA Data Security, Inc. |
78 | but not trademarked. | 78 | It was considered a trade secret, but not trademarked. |
79 | A clone of this was posted anonymously to the USENET and was confirmed to | 79 | A clone of this was posted anonymously to the USENET and was confirmed to |
80 | be equivalent by several sources who had access to the original cipher. | 80 | be equivalent by several sources who had access to the original cipher. |
81 | Because of the trade secret situation, RSA Data Security, Inc. can do | 81 | Because of the trade secret situation, RSA Data Security, Inc. can do |
diff --git a/src/lib/libc/crypt/blowfish.3 b/src/lib/libc/crypt/blowfish.3 index b5fdae92b1..6d8c5db88d 100644 --- a/src/lib/libc/crypt/blowfish.3 +++ b/src/lib/libc/crypt/blowfish.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: blowfish.3,v 1.8 2000/04/15 02:15:22 aaron Exp $ | 1 | .\" $OpenBSD: blowfish.3,v 1.9 2000/04/18 02:31:34 aaron Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> | 3 | .\" Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> |
4 | .\" All rights reserved. | 4 | .\" All rights reserved. |
@@ -63,7 +63,8 @@ The block size is 64 bit and the key size is maximal 448 bit. | |||
63 | The | 63 | The |
64 | .Fn blf_key | 64 | .Fn blf_key |
65 | function initializes the 4 8bit S-boxes and the 18 Subkeys with | 65 | function initializes the 4 8bit S-boxes and the 18 Subkeys with |
66 | the hexadecimal digits of Pi. The key is used for further randomization. | 66 | the hexadecimal digits of Pi. |
67 | The key is used for further randomization. | ||
67 | The first argument to | 68 | The first argument to |
68 | .Fn blf_enc | 69 | .Fn blf_enc |
69 | is the initialized state derived from | 70 | is the initialized state derived from |
diff --git a/src/lib/libc/crypt/crypt.3 b/src/lib/libc/crypt/crypt.3 index daa9c4d844..36058c7567 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.15 2000/04/15 02:15:22 aaron Exp $ | 1 | .\" $OpenBSD: crypt.3,v 1.16 2000/04/18 02:31:34 aaron Exp $ |
2 | .\" | 2 | .\" |
3 | .\" FreeSec: libcrypt | 3 | .\" FreeSec: libcrypt |
4 | .\" | 4 | .\" |
@@ -56,24 +56,32 @@ | |||
56 | .Sh DESCRIPTION | 56 | .Sh DESCRIPTION |
57 | The | 57 | The |
58 | .Fn crypt | 58 | .Fn crypt |
59 | function performs password encryption, based on the | 59 | function performs password encryption based on the |
60 | .Tn NBS | 60 | .Tn NBS |
61 | Data Encryption Standard (DES). | 61 | Data Encryption Standard (DES). |
62 | 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 |
63 | stronger hashing algorithms. | 63 | stronger hashing algorithms. |
64 | .Pp | ||
64 | The first argument to | 65 | The first argument to |
65 | .Fn crypt | 66 | .Fn crypt |
66 | is a | 67 | is a |
67 | .Dv null Ns -terminated | 68 | .Dv null Ns -terminated |
68 | string, typically a user's typed password. | 69 | string, typically a user's typed password. |
69 | The second is in one of three forms: | 70 | The second is in one of three forms: |
70 | if it begins with an underscore (``_'') then an extended format is used | 71 | if it begins with an underscore |
71 | in interpreting both the key and the setting, as outlined below. If it begins | 72 | .Pq Ql _ |
72 | with an string character (``$'') and a number then a different algorithm | 73 | then an extended format is used |
73 | is used depending on the number. At the moment a ``$1'' chooses MD5 hashing | 74 | in interpreting both the key and the setting, as outlined below. |
74 | and a ``$2'' chooses Blowfish hashing, see below for more information. | 75 | If it begins |
75 | .Ss Extended crypt: | 76 | with a string character |
76 | .Pp | 77 | .Pq Ql $ |
78 | and a number then a different algorithm is used depending on the number. | ||
79 | At the moment a | ||
80 | .Ql $1 | ||
81 | chooses MD5 hashing and a | ||
82 | .Ql $2 | ||
83 | chooses Blowfish hashing; see below for more information. | ||
84 | .Ss Extended crypt | ||
77 | The | 85 | The |
78 | .Ar key | 86 | .Ar key |
79 | is divided into groups of 8 characters (the last group is null-padded) | 87 | is divided into groups of 8 characters (the last group is null-padded) |
@@ -87,61 +95,68 @@ The setting is a 9-character array consisting of an underscore followed | |||
87 | by 4 bytes of iteration count and 4 bytes of salt. | 95 | by 4 bytes of iteration count and 4 bytes of salt. |
88 | These are encoded as printable characters, 6 bits per character, | 96 | These are encoded as printable characters, 6 bits per character, |
89 | least significant character first. | 97 | least significant character first. |
90 | The values 0 to 63 are encoded as ``./0-9A-Za-z''. | 98 | The values 0 to 63 are encoded as |
99 | .Dq \&./0-9A-Za-z . | ||
91 | This allows 24 bits for both | 100 | This allows 24 bits for both |
92 | .Fa count | 101 | .Fa count |
93 | and | 102 | and |
94 | .Fa salt . | 103 | .Fa salt . |
95 | .Ss "MD5" crypt: | 104 | .Ss "MD5" crypt |
96 | .Pp | ||
97 | For | 105 | For |
98 | .Tn MD5 | 106 | .Tn MD5 |
99 | crypt the version number, | 107 | crypt the version number, |
100 | .Fa salt | 108 | .Fa salt |
101 | and the hashed password are separated | 109 | and the hashed password are separated by the |
102 | by the ``$'' character. The maximum length of a password is limited by | 110 | .Ql $ |
111 | character. | ||
112 | The maximum length of a password is limited by | ||
103 | the length counter of the MD5 context, which is about | 113 | the length counter of the MD5 context, which is about |
104 | 2**64. A valid MD5 password entry looks like this: | 114 | 2**64. |
115 | A valid MD5 password entry looks like this: | ||
105 | .Pp | 116 | .Pp |
106 | ``$1$caeiHQwX$hsKqOjrFRRN6K32OWkCBf1''. | 117 | .Dq $1$caeiHQwX$hsKqOjrFRRN6K32OWkCBf1 . |
107 | .Pp | 118 | .Pp |
108 | The whole MD5 password string is passed as | 119 | The whole MD5 password string is passed as |
109 | .Fa setting | 120 | .Fa setting |
110 | for interpretation. | 121 | for interpretation. |
111 | .Ss "Blowfish" crypt: | 122 | .Ss "Blowfish" crypt |
112 | .Pp | ||
113 | The | 123 | The |
114 | .Tn Blowfish | 124 | .Tn Blowfish |
115 | version of crypt has 128 bits of | 125 | version of crypt has 128 bits of |
116 | .Fa salt | 126 | .Fa salt |
117 | in order to make building | 127 | in order to make building dictionaries of common passwords space consuming. |
118 | dictionaries of common passwords space consuming. The initial state | 128 | The initial state of the |
119 | of the | ||
120 | .Tn Blowfish | 129 | .Tn Blowfish |
121 | cipher is expanded using the | 130 | cipher is expanded using the |
122 | .Fa salt | 131 | .Fa salt |
123 | and the | 132 | and the |
124 | .Fa password | 133 | .Fa password |
125 | repeating the process a variable number of rounds, which is encoded in | 134 | repeating the process a variable number of rounds, which is encoded in |
126 | the password string. The maximum password length is 72. The final Blowfish | 135 | the password string. |
127 | password entry is created by encrypting | 136 | The maximum password length is 72. |
128 | the string ``OrpheanBeholderScryDoubt'' with the | 137 | The final Blowfish password entry is created by encrypting the string |
138 | .Pp | ||
139 | .Dq OrpheanBeholderScryDoubt | ||
140 | .Pp | ||
141 | with the | ||
129 | .Tn Blowfish | 142 | .Tn Blowfish |
130 | state 64 times. | 143 | state 64 times. |
131 | .Pp | 144 | .Pp |
132 | The version number, the logarithm of the number of rounds and | 145 | The version number, the logarithm of the number of rounds and |
133 | the concatenation of salt and | 146 | the concatenation of salt and hashed password are separated by the |
134 | hashed password are separated by the ``$'' character. An encoded ``8'' | 147 | .Ql $ |
148 | character. | ||
149 | An encoded | ||
150 | .Sq 8 | ||
135 | would specify 256 rounds. | 151 | would specify 256 rounds. |
136 | A valid Blowfish password looks like this: | 152 | A valid Blowfish password looks like this: |
137 | .Pp | 153 | .Pp |
138 | ``$2a$12$eIAq8PR8sIUnJ1HaohxX2O9x9Qlm2vK97LJ5dsXdmB.eXF42qjchC''. | 154 | .Dq $2a$12$eIAq8PR8sIUnJ1HaohxX2O9x9Qlm2vK97LJ5dsXdmB.eXF42qjchC . |
139 | .Pp | 155 | .Pp |
140 | The whole Blowfish password string is passed as | 156 | The whole Blowfish password string is passed as |
141 | .Fa setting | 157 | .Fa setting |
142 | for interpretation. | 158 | for interpretation. |
143 | .Ss "Traditional" crypt: | 159 | .Ss "Traditional" crypt |
144 | .Pp | ||
145 | The first 8 bytes of the key are null-padded, and the low-order 7 bits of | 160 | The first 8 bytes of the key are null-padded, and the low-order 7 bits of |
146 | each character is used to form the 56-bit | 161 | each character is used to form the 56-bit |
147 | .Tn DES | 162 | .Tn DES |
@@ -153,8 +168,7 @@ Thus only 12 bits of | |||
153 | are used. | 168 | are used. |
154 | .Fa count | 169 | .Fa count |
155 | is set to 25. | 170 | is set to 25. |
156 | .Ss DES Algorithm: | 171 | .Ss DES Algorithm |
157 | .Pp | ||
158 | The | 172 | The |
159 | .Fa salt | 173 | .Fa salt |
160 | introduces disorder in the | 174 | introduces disorder in the |
@@ -182,10 +196,10 @@ string, 20 or 13 bytes (plus null) in length, consisting of the | |||
182 | .Ar setting | 196 | .Ar setting |
183 | followed by the encoded 64-bit encryption. | 197 | followed by the encoded 64-bit encryption. |
184 | .Pp | 198 | .Pp |
185 | The functions, | 199 | The functions |
186 | .Fn encrypt , | 200 | .Fn encrypt , |
187 | .Fn setkey , | 201 | .Fn setkey , |
188 | .Fn des_setkey | 202 | .Fn des_setkey , |
189 | and | 203 | and |
190 | .Fn des_cipher | 204 | .Fn des_cipher |
191 | provide access to the | 205 | provide access to the |
@@ -243,7 +257,9 @@ E-box output as described above. | |||
243 | .Pp | 257 | .Pp |
244 | The function | 258 | The function |
245 | .Fn crypt | 259 | .Fn crypt |
246 | returns a pointer to the encrypted value on success, and NULL on failure. | 260 | returns a pointer to the encrypted value on success, and |
261 | .Dv NULL | ||
262 | on failure. | ||
247 | The functions | 263 | The functions |
248 | .Fn setkey , | 264 | .Fn setkey , |
249 | .Fn encrypt , | 265 | .Fn encrypt , |
@@ -254,7 +270,7 @@ return 0 on success and 1 on failure. | |||
254 | .Pp | 270 | .Pp |
255 | The | 271 | The |
256 | .Fn crypt , | 272 | .Fn crypt , |
257 | .Fn setkey | 273 | .Fn setkey , |
258 | and | 274 | and |
259 | .Fn des_setkey | 275 | .Fn des_setkey |
260 | functions all manipulate the same key space. | 276 | functions all manipulate the same key space. |
@@ -265,12 +281,8 @@ functions all manipulate the same key space. | |||
265 | .Xr getpass 3 , | 281 | .Xr getpass 3 , |
266 | .Xr md5 3 , | 282 | .Xr md5 3 , |
267 | .Xr passwd 5 | 283 | .Xr passwd 5 |
268 | .Sh BUGS | 284 | .Sh AUTHOR |
269 | The | 285 | David Burren <davidb@werj.com.au> |
270 | .Fn crypt | ||
271 | function returns a pointer to static data, and subsequent calls to | ||
272 | .Fn crypt | ||
273 | will modify the same object. | ||
274 | .Sh HISTORY | 286 | .Sh HISTORY |
275 | A rotor-based | 287 | A rotor-based |
276 | .Fn crypt | 288 | .Fn crypt |
@@ -289,9 +301,14 @@ Programs linked against the | |||
289 | interface may be exported from the U.S.A. only if they use | 301 | interface may be exported from the U.S.A. only if they use |
290 | .Fn crypt | 302 | .Fn crypt |
291 | solely for authentication purposes and avoid use of | 303 | solely for authentication purposes and avoid use of |
292 | the other programmer interfaces listed above. Special care has been taken | 304 | the other programmer interfaces listed above. |
305 | Special care has been taken | ||
293 | in the library so that programs which only use the | 306 | in the library so that programs which only use the |
294 | .Fn crypt | 307 | .Fn crypt |
295 | interface do not pull in the other components. | 308 | interface do not pull in the other components. |
296 | .Sh AUTHOR | 309 | .Sh BUGS |
297 | David Burren <davidb@werj.com.au> | 310 | The |
311 | .Fn crypt | ||
312 | function returns a pointer to static data, and subsequent calls to | ||
313 | .Fn crypt | ||
314 | will modify the same object. | ||