Debian Codegraph @

lib/crypt-static.c

raw
1 /* Copyright (C) 2007-2017 Thorsten Kukuk
2 Copyright (C) 2019 Björn Esser
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public License
6 as published by the Free Software Foundation; either version 2.1 of
7 the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18 #include "crypt-port.h"
19
20 /* The functions that use global state objects are isolated in their
21 own files so that a statically-linked program that doesn't use them
22 will not have the state objects in its data segment. */
23
24 #if INCLUDE_crypt
25 char *
26 crypt (const char *key, const char *setting)
27 {
28 static struct crypt_data nr_crypt_ctx;
29 return crypt_r (key, setting, &nr_crypt_ctx);
30 }
31 SYMVER_crypt;
32 #endif
33
34 /* For code compatibility with old glibc. */
35 #if INCLUDE_fcrypt
36 strong_alias (crypt, fcrypt);
37 SYMVER_fcrypt;
38 #endif
39
40 /* For code compatibility with older versions (v3.1.1 and earlier). */
41 #if INCLUDE_crypt && INCLUDE_xcrypt
42 strong_alias (crypt, xcrypt);
43 SYMVER_xcrypt;
44 #endif