home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue2 / SDL.ARC / !unixlib / source / clib / h / crypt < prev    next >
Encoding:
Text File  |  2004-09-05  |  2.6 KB  |  88 lines

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