00001 /* 00002 * UFC-crypt: ultra fast crypt(3) implementation 00003 * 00004 * Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc. 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public 00017 * License along with the GNU C Library; see the file COPYING.LIB. If not, 00018 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 * Boston, MA 02111-1307, USA. 00020 * 00021 * @(#)crypt.h 1.5 12/20/96 00022 * 00023 */ 00024 00025 #ifndef _CRYPT_H 00026 #define _CRYPT_H 1 00027 00028 /* Encrypt at most 8 characters from KEY using salt to perturb DES. */ 00029 extern char *crypt(const char *__key, const char *__salt); 00030 00031 /* Setup DES tables according KEY. */ 00032 extern void setkey(const char *__key); 00033 00034 /* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt 00035 block in place. */ 00036 extern void encrypt (char *__block, int __edflag); 00037 00038 /* Reentrant versions of the functions above. The additional argument 00039 points to a structure where the results are placed in. */ 00040 struct crypt_data 00041 { 00042 char keysched[16 * 8]; 00043 char sb0[32768]; 00044 char sb1[32768]; 00045 char sb2[32768]; 00046 char sb3[32768]; 00047 /* end-of-aligment-critical-data */ 00048 char crypt_3_buf[14]; 00049 char current_salt[2]; 00050 long int current_saltbits; 00051 int direction, initialized; 00052 }; 00053 00054 extern char *__crypt_r(const char *__key, const char *__salt, struct crypt_data *__data); 00055 extern char *crypt_r(const char *__key, const char *__salt, struct crypt_data *__data); 00056 extern void __setkey_r(const char *__key, struct crypt_data *__data); 00057 extern void setkey_r(const char *__key, struct crypt_data *__data); 00058 extern void __encrypt_r(char *__block, int __edflag, struct crypt_data *__data); 00059 extern void encrypt_r(char *__block, int __edflag, struct crypt_data *__data); 00060 00061 #endif /* crypt.h */