home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue6 / SDL.ZIP / !gcc / include / unixlib / h / crypt < prev    next >
Encoding:
Text File  |  2006-09-17  |  2.7 KB  |  95 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /usr/local/cvsroot/gccsdk/unixlib/source/clib/crypt.h,v $
  4.  * $Date: 2004/10/17 16:24:43 $
  5.  * $Revision: 1.3 $
  6.  * $State: Exp $
  7.  * $Author: joty $
  8.  *
  9.  ***************************************************************************/
  10.  
  11. /*
  12.  * File taken from glibc 2.2.5.
  13.  * Following changes were made:
  14.  *  <none>
  15.  */
  16.  
  17. /*
  18.  * UFC-crypt: ultra fast crypt(3) implementation
  19.  *
  20.  * Copyright (C) 1991, 92, 93, 96, 97, 98, 2000 Free Software Foundation, Inc.
  21.  *
  22.  * The GNU C Library is free software; you can redistribute it and/or
  23.  * modify it under the terms of the GNU Lesser General Public
  24.  * License as published by the Free Software Foundation; either
  25.  * version 2.1 of the License, or (at your option) any later version.
  26.  *
  27.  * The GNU C Library is distributed in the hope that it will be useful,
  28.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  29.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  30.  * Lesser General Public License for more details.
  31.  *
  32.  * You should have received a copy of the GNU Lesser General Public
  33.  * License along with the GNU C Library; if not, write to the Free
  34.  * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  35.  * 02111-1307 USA.
  36.  *
  37.  * @(#)crypt.h    1.5 12/20/96
  38.  *
  39.  */
  40.  
  41. #ifndef __CRYPT_H
  42. #define __CRYPT_H    1
  43.  
  44. #include <features.h>
  45.  
  46. __BEGIN_DECLS
  47.  
  48. /* Encrypt at most 8 characters from KEY using salt to perturb DES.  */
  49. extern char *crypt (const char *__key, const char *__salt)
  50.      __THROW __nonnull ((1, 2));
  51.  
  52. extern char *fcrypt (const char *__key, const char *__salt)
  53.      __THROW __nonnull ((1, 2));
  54.  
  55. /* Setup DES tables according KEY.  */
  56. extern void setkey (const char *__key) __THROW __nonnull ((1));
  57.  
  58. /* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt
  59.    block in place.  */
  60. extern void encrypt (char *__block, int __edflag) __THROW __nonnull ((1));
  61.  
  62. #ifdef __USE_GNU
  63. /* Reentrant versions of the functions above.  The additional argument
  64.    points to a structure where the results are placed in.  */
  65. struct crypt_data
  66. {
  67.   char keysched[16 * 8];
  68.   char sb0[32768];
  69.   char sb1[32768];
  70.   char sb2[32768];
  71.   char sb3[32768];
  72.   /* end-of-aligment-critical-data */
  73.   char crypt_3_buf[14];
  74.   char current_salt[2];
  75.   long int current_saltbits;
  76.   int  direction, initialized;
  77. };
  78.  
  79. extern char *crypt_r (const char *__key, const char *__salt,
  80.               struct crypt_data *__restrict __data)
  81.      __THROW __nonnull ((1, 2, 3));
  82.  
  83. extern void setkey_r (const char *__key,
  84.               struct crypt_data *__restrict __data)
  85.      __THROW __nonnull ((1, 2));
  86.  
  87. extern void encrypt_r (char *__block, int __edflag,
  88.                struct crypt_data *__restrict __data)
  89.      __THROW __nonnull ((1, 3));
  90. #endif
  91.  
  92. __END_DECLS
  93.  
  94. #endif    /* crypt.h */
  95.