]> git.ipfire.org Git - thirdparty/glibc.git/blame - crypt/crypt.h
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / crypt / crypt.h
CommitLineData
63f791d3
GK
1/*
2 * UFC-crypt: ultra fast crypt(3) implementation
3 *
04277e02 4 * Copyright (C) 1991-2019 Free Software Foundation, Inc.
63f791d3 5 *
a1b36134
AJ
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
63f791d3 8 * License as published by the Free Software Foundation; either
a1b36134 9 * version 2.1 of the License, or (at your option) any later version.
63f791d3 10 *
a1b36134 11 * The GNU C Library is distributed in the hope that it will be useful,
63f791d3
GK
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
a1b36134 14 * Lesser General Public License for more details.
63f791d3 15 *
a1b36134 16 * You should have received a copy of the GNU Lesser General Public
59ba27a6 17 * License along with the GNU C Library; if not, see
5a82c748 18 * <https://www.gnu.org/licenses/>.
63f791d3
GK
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
841785ba
ZW
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. */
36extern char *crypt (const char *__phrase, const char *__salt)
41102740 37 __THROW __nonnull ((1, 2));
63f791d3 38
63f791d3 39#ifdef __USE_GNU
841785ba
ZW
40
41/* This structure provides scratch and output buffers for 'crypt_r'.
42 Its contents should not be accessed directly. */
63f791d3
GK
43struct 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
841785ba
ZW
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.) */
63extern char *crypt_r (const char *__phrase, const char *__salt,
41102740
UD
64 struct crypt_data * __restrict __data)
65 __THROW __nonnull ((1, 2, 3));
63f791d3
GK
66#endif
67
68__END_DECLS
69
70#endif /* crypt.h */