1 | /* |
2 | * UFC-crypt: ultra fast crypt(3) implementation |
3 | * |
4 | * Copyright (C) 1991-2021 Free Software Foundation, Inc. |
5 | * |
6 | * The GNU C Library is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Lesser General Public |
8 | * License as published by the Free Software Foundation; either |
9 | * version 2.1 of the License, or (at your option) any later version. |
10 | * |
11 | * The GNU C Library is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | * Lesser General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU Lesser General Public |
17 | * License along with the GNU C Library; if not, see |
18 | * <https://www.gnu.org/licenses/>. |
19 | * |
20 | * @(#)crypt.h 1.5 12/20/96 |
21 | * |
22 | */ |
23 | |
24 | #ifndef _CRYPT_H |
25 | #define _CRYPT_H 1 |
26 | |
27 | #include <features.h> |
28 | |
29 | __BEGIN_DECLS |
30 | |
31 | /* One-way hash PHRASE, returning a string suitable for storage in the |
32 | user database. SALT selects the one-way function to use, and |
33 | ensures that no two users' hashes are the same, even if they use |
34 | the same passphrase. The return value points to static storage |
35 | which will be overwritten by the next call to crypt. */ |
36 | extern char *crypt (const char *__phrase, const char *__salt) |
37 | __THROW __nonnull ((1, 2)); |
38 | |
39 | #ifdef __USE_GNU |
40 | |
41 | /* This structure provides scratch and output buffers for 'crypt_r'. |
42 | Its contents should not be accessed directly. */ |
43 | struct crypt_data |
44 | { |
45 | char keysched[16 * 8]; |
46 | char sb0[32768]; |
47 | char sb1[32768]; |
48 | char sb2[32768]; |
49 | char sb3[32768]; |
50 | /* end-of-aligment-critical-data */ |
51 | char crypt_3_buf[14]; |
52 | char current_salt[2]; |
53 | long int current_saltbits; |
54 | int direction, initialized; |
55 | }; |
56 | |
57 | /* Thread-safe version of 'crypt'. |
58 | DATA must point to a 'struct crypt_data' allocated by the caller. |
59 | Before the first call to 'crypt_r' with a new 'struct crypt_data', |
60 | that object must be initialized to all zeroes. The pointer |
61 | returned, if not NULL, will point within DATA. (It will still be |
62 | overwritten by the next call to 'crypt_r' with the same DATA.) */ |
63 | extern char *crypt_r (const char *__phrase, const char *__salt, |
64 | struct crypt_data * __restrict __data) |
65 | __THROW __nonnull ((1, 2, 3)); |
66 | #endif |
67 | |
68 | __END_DECLS |
69 | |
70 | #endif /* crypt.h */ |
71 | |