(root)/
libxcrypt-4.4.36/
lib/
crypt-static.c
       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  #include <errno.h>
      20  
      21  /* The functions that use global state objects are isolated in their
      22     own files so that a statically-linked program that doesn't use them
      23     will not have the state objects in its data segment.  */
      24  
      25  #if INCLUDE_crypt
      26  char *
      27  crypt (const char *key, const char *setting)
      28  {
      29    static struct crypt_data nr_crypt_ctx;
      30    return crypt_r (key, setting, &nr_crypt_ctx);
      31  }
      32  SYMVER_crypt;
      33  #endif
      34  
      35  /* For code compatibility with old glibc.  */
      36  #if INCLUDE_fcrypt
      37  strong_alias (crypt, fcrypt);
      38  SYMVER_fcrypt;
      39  #endif
      40  
      41  /* For code compatibility with older versions (v3.1.1 and earlier).  */
      42  #if INCLUDE_crypt && INCLUDE_xcrypt
      43  strong_alias (crypt, xcrypt);
      44  SYMVER_xcrypt;
      45  #endif