diff -Nu crypt.orig/crypt-entry.c crypt/crypt-entry.c --- crypt.orig/crypt-entry.c Sat Jul 7 20:20:50 2001 +++ crypt/crypt-entry.c Tue Aug 5 03:07:26 1997 @@ -3,20 +3,20 @@ * * Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc. * - * The GNU C Library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * version 2 of the License, or (at your option) any later version. * - * The GNU C Library is distributed in the hope that it will be useful, + * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * Library General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with the GNU C Library; if not, write to the Free - * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA. + * You should have received a copy of the GNU Library General Public + * License along with this library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. * * crypt entry points * @@ -34,12 +34,14 @@ #endif #ifndef DOS +#include "patchlevel.h" #include "ufc-crypt.h" #else /* * Thanks to greg%wind@plains.NoDak.edu (Greg W. Wettstein) * for DOS patches */ +#include "pl.h" #include "ufc.h" #endif #include "crypt.h" @@ -52,6 +54,13 @@ #else #define _ufc_clearmem(start, cnt) memset(start, 0, cnt) #endif +extern void _ufc_setup_salt_r (__const char *s, struct crypt_data *__data); +extern void _ufc_mk_keytab_r (char *key, struct crypt_data *__data); +extern void _ufc_dofinalperm_r (ufc_long *res, struct crypt_data *__data); +extern void _ufc_output_conversion_r (ufc_long v1, ufc_long v2, + __const char *salt, + struct crypt_data *__data); + extern char *__md5_crypt_r (const char *key, const char *salt, char *buffer, int buflen); extern char *__md5_crypt (const char *key, const char *salt); @@ -73,7 +82,7 @@ __crypt_r (key, salt, data) const char *key; const char *salt; - struct crypt_data * __restrict data; + struct crypt_data *data; { ufc_long res[4]; char ktab[9]; @@ -128,7 +137,7 @@ return __md5_crypt (key, salt); #endif - return __crypt_r (key, salt, &_ufc_foobar); + return crypt_r (key, salt, &_ufc_foobar); } diff -Nu crypt.orig/crypt-private.h crypt/crypt-private.h --- crypt.orig/crypt-private.h Sat Jul 7 20:20:50 2001 +++ crypt/crypt-private.h Tue Aug 5 03:07:26 1997 @@ -1,60 +1,43 @@ /* * UFC-crypt: ultra fast crypt(3) implementation * - * Copyright (C) 1991, 92, 93, 96, 97, 98 Free Software Foundation, Inc. + * Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc. * - * The GNU C Library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * version 2 of the License, or (at your option) any later version. * - * The GNU C Library is distributed in the hope that it will be useful, + * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * Library General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with the GNU C Library; if not, write to the Free - * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA. + * You should have received a copy of the GNU Library General Public + * License along with this library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. * * @(#)crypt-private.h 1.4 12/20/96 */ -/* Prototypes for local functions in libcrypt.a. */ - -#ifndef CRYPT_PRIVATE_H -#define CRYPT_PRIVATE_H 1 - -#include +/* Prototypes for local functions in libcrypt.h. */ +#ifdef __STDC__ /* crypt.c */ -extern void _ufc_doit_r (ufc_long itr, struct crypt_data * __restrict __data, +extern void _ufc_doit_r (ufc_long itr, struct crypt_data *__data, ufc_long *res); /* crypt_util.c */ -extern void __init_des_r (struct crypt_data * __restrict __data); +extern void __init_des_r (struct crypt_data *__data); extern void __init_des (void); +extern char *fcrypt (__const char *key, __const char *salt); -extern void _ufc_setup_salt_r (__const char *s, - struct crypt_data * __restrict __data); -extern void _ufc_mk_keytab_r (__const char *key, - struct crypt_data * __restrict __data); -extern void _ufc_dofinalperm_r (ufc_long *res, - struct crypt_data * __restrict __data); +extern void _ufc_setup_salt_r (__const char *s, struct crypt_data *__data); +extern void _ufc_mk_keytab_r (char *key, struct crypt_data *__data); +extern void _ufc_dofinalperm_r (ufc_long *res, struct crypt_data *__data); extern void _ufc_output_conversion_r (ufc_long v1, ufc_long v2, __const char *salt, - struct crypt_data * __restrict __data); - -extern void __setkey_r (__const char *__key, - struct crypt_data * __restrict __data); -extern void __encrypt_r (char * __restrict __block, int __edflag, - struct crypt_data * __restrict __data); - -/* crypt-entry.c */ -extern char *__crypt_r (__const char *__key, __const char *__salt, - struct crypt_data * __restrict __data); -extern char *fcrypt (__const char *key, __const char *salt); - -#endif /* crypt-private.h */ + struct crypt_data *__data); +#endif diff -Nu crypt.orig/crypt.c crypt/crypt.c --- crypt.orig/crypt.c Tue Aug 27 05:52:34 2002 +++ crypt/crypt.c Wed Mar 5 01:33:58 1997 @@ -4,16 +4,16 @@ * Copyright (C) 1991, 1992, 1993, 1996 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public + * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * Library General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public + * You should have received a copy of the GNU Library General Public * License along with this library; see the file COPYING.LIB. If not, * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. @@ -39,7 +39,7 @@ void _ufc_doit_r(itr, __data, res) ufc_long itr, *res; - struct crypt_data * __restrict __data; + struct crypt_data *__data; { int i; long32 s, *k; @@ -85,7 +85,7 @@ void _ufc_doit_r(itr, __data, res) ufc_long itr, *res; - struct crypt_data * __restrict __data; + struct crypt_data *__data; { int i; long64 l, r, s, *k; diff -Nu crypt.orig/crypt.h crypt/crypt.h --- crypt.orig/crypt.h Sat Jul 7 20:20:50 2001 +++ crypt/crypt.h Wed Dec 31 16:04:52 1997 @@ -1,22 +1,22 @@ /* * UFC-crypt: ultra fast crypt(3) implementation * - * Copyright (C) 1991, 92, 93, 96, 97, 98, 2000 Free Software Foundation, Inc. + * Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc. * - * The GNU C Library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * version 2 of the License, or (at your option) any later version. * - * The GNU C Library is distributed in the hope that it will be useful, + * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * Library General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with the GNU C Library; if not, write to the Free - * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA. + * You should have received a copy of the GNU Library General Public + * License along with the GNU C Library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. * * @(#)crypt.h 1.5 12/20/96 * @@ -25,19 +25,32 @@ #ifndef _CRYPT_H #define _CRYPT_H 1 +#ifdef __EMX__ +#define __BEGIN_DECLS +#define __END_DECLS +#define __P(p) p +#define __USE_GNU +#define weak_alias(x, y) +#define __crypt_r crypt_r +#define __fcrypt fcrypt +#define __encrypt_r encrypt_r +#define __setkey_r setkey_r +#define __init_des init_des +#else #include +#endif __BEGIN_DECLS /* Encrypt at most 8 characters from KEY using salt to perturb DES. */ -extern char *crypt (__const char *__key, __const char *__salt) __THROW; +extern char *crypt __P ((__const char *__key, __const char *__salt)); /* Setup DES tables according KEY. */ -extern void setkey (__const char *__key) __THROW; +extern void setkey __P ((__const char *__key)); /* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt block in place. */ -extern void encrypt (char *__block, int __edflag) __THROW; +extern void encrypt __P ((char *__block, int __edflag)); #ifdef __USE_GNU /* Reentrant versions of the functions above. The additional argument @@ -56,14 +69,18 @@ int direction, initialized; }; -extern char *crypt_r (__const char *__key, __const char *__salt, - struct crypt_data * __restrict __data) __THROW; - -extern void setkey_r (__const char *__key, - struct crypt_data * __restrict __data) __THROW; - -extern void encrypt_r (char *__block, int __edflag, - struct crypt_data * __restrict __data) __THROW; +extern char *__crypt_r __P ((__const char *__key, __const char *__salt, + struct crypt_data *__data)); +extern char *crypt_r __P ((__const char *__key, __const char *__salt, + struct crypt_data *__data)); + +extern void __setkey_r __P ((__const char *__key, struct crypt_data *__data)); +extern void setkey_r __P ((__const char *__key, struct crypt_data *__data)); + +extern void __encrypt_r __P ((char *__block, int __edflag, + struct crypt_data *__data)); +extern void encrypt_r __P ((char *__block, int __edflag, + struct crypt_data *__data)); #endif __END_DECLS diff -Nu crypt.orig/crypt_util.c crypt/crypt_util.c --- crypt.orig/crypt_util.c Sun Nov 3 04:48:24 2002 +++ crypt/crypt_util.c Tue Aug 5 18:03:32 1997 @@ -1,19 +1,19 @@ /* * UFC-crypt: ultra fast crypt(3) implementation * - * Copyright (C) 1991, 92, 93, 96, 97, 98, 2000 Free Software Foundation, Inc. + * Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public + * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * Library General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public + * You should have received a copy of the GNU Library General Public * License along with this library; see the file COPYING.LIB. If not, * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. @@ -34,6 +34,7 @@ #endif #ifndef DOS +#include "patchlevel.h" #include "ufc-crypt.h" #else /* @@ -60,6 +61,8 @@ #endif +static const char patchlevel_str[] = PATCHLEVEL; + /* * Permutation done once on the 56 bit * key derived from the original 8 byte ASCII key. @@ -262,7 +265,7 @@ struct crypt_data _ufc_foobar; #ifdef __GNU_LIBRARY__ -#include +#include __libc_lock_define_initialized (static, _ufc_tables_lock) #endif @@ -342,7 +345,7 @@ void __init_des_r(__data) - struct crypt_data * __restrict __data; + struct crypt_data *__data; { int comes_from_bit; int bit, sg; @@ -536,9 +539,6 @@ } } - __data->current_saltbits = 0; - __data->current_salt[0] = 0; - __data->current_salt[1] = 0; __data->initialized++; } @@ -592,7 +592,7 @@ void _ufc_setup_salt_r(s, __data) __const char *s; - struct crypt_data * __restrict __data; + struct crypt_data *__data; { ufc_long i, j, saltbits; @@ -639,8 +639,8 @@ void _ufc_mk_keytab_r(key, __data) - const char *key; - struct crypt_data * __restrict __data; + char *key; + struct crypt_data *__data; { ufc_long v1, v2, *k1; int i; @@ -700,7 +700,7 @@ void _ufc_dofinalperm_r(res, __data) ufc_long *res; - struct crypt_data * __restrict __data; + struct crypt_data *__data; { ufc_long v1, v2, x; ufc_long l1,l2,r1,r2; @@ -745,7 +745,7 @@ _ufc_output_conversion_r(v1, v2, salt, __data) ufc_long v1, v2; __const char *salt; - struct crypt_data * __restrict __data; + struct crypt_data *__data; { int i, s, shf; @@ -780,7 +780,7 @@ __encrypt_r(__block, __edflag, __data) char *__block; int __edflag; - struct crypt_data * __restrict __data; + struct crypt_data *__data; { ufc_long l1, l2, r1, r2, res[4]; int i; @@ -889,7 +889,7 @@ void __setkey_r(__key, __data) __const char *__key; - struct crypt_data * __restrict __data; + struct crypt_data *__data; { int i,j; unsigned char c; diff -Nu crypt.orig/patchlevel.h crypt/patchlevel.h --- crypt.orig/patchlevel.h Thu Jan 1 00:00:00 1970 +++ crypt/patchlevel.h Wed Mar 5 01:33:58 1997 @@ -0,0 +1,25 @@ +/* + * UFC-crypt: ultra fast crypt(3) implementation + * + * Copyright (C) 1991, 1992, 1993, 1996 Free Software Foundation, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * @(#)patchlevel.h 1.13 9/10/96 + * + */ + +#define PATCHLEVEL "UFC-crypt, patchlevel 1e, @(#)patchlevel.h 1.13 9/10/96" diff -Nu crypt.orig/speeds.c crypt/speeds.c --- crypt.orig/speeds.c Tue Feb 29 02:46:06 2000 +++ crypt/speeds.c Fri Mar 21 09:22:46 2003 @@ -28,13 +28,14 @@ #ifdef NO_ITIMER #include #include +#include #else #include #endif static int cnt; #ifdef NO_ITIMER -char *hz; +int hz; struct tms tstart, tfinish; #endif #define ITIME 10 /* Number of seconds to run test. */ @@ -48,7 +49,7 @@ #ifdef NO_ITIMER (void) times(&tfinish); elapsed = ((tfinish.tms_utime + tfinish.tms_stime) - - (tstart.tms_utime + tstart.tms_stime)) / atoi(hz); + (tstart.tms_utime + tstart.tms_stime)) / hz; printf("elapsed time = %d sec, CPU time = %f sec\n", ITIME, elapsed); #else elapsed = ITIME; @@ -81,15 +82,21 @@ char *s; #ifdef NO_ITIMER extern char *getenv(); + char *zh; #else struct itimerval itv; #endif #ifdef NO_ITIMER - if ((hz = getenv("HZ")) == NULL) { +#ifdef __EMX__ + hz = HZ; +#else + if ((zh = getenv("HZ")) == NULL) { fprintf(stderr, "HZ environment parameter undefined\n"); exit(1); } + hz = atoi(zh); +#endif #endif #ifdef FCRYPT diff -Nu crypt.orig/ufc-crypt.h crypt/ufc-crypt.h --- crypt.orig/ufc-crypt.h Sat Jul 7 20:20:50 2001 +++ crypt/ufc-crypt.h Tue Aug 5 03:07:26 1997 @@ -1,29 +1,131 @@ -/* Types for UFC-crypt. - Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include - -typedef uint_fast32_t ufc_long; -typedef uint64_t long64; -typedef uint32_t long32; -#if UINT_FAST32_MAX == UINT_FAST64_MAX -# define _UFC_64_ +/* + * UFC-crypt: ultra fast crypt(3) implementation + * + * Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * @(#)ufc-crypt.h 1.27 12/20/96 + * + * Definitions of datatypes + * + */ + +#ifndef __GNUC__ +#define __const +#ifndef __STDC__ +#define const +#define volatile +#endif +#endif + +/* + * Requirements for datatypes: + * + * A datatype 'ufc_long' of at least 32 bit + * *and* + * A type 'long32' of exactly 32 bits (_UFC_32_) + * *or* + * A type 'long64' of exactly 64 bits (_UFC_64_) + * + * 'int' is assumed to be at least 8 bit + */ + +/* + * #ifdef's for various architectures + */ + +#ifdef cray +/* thanks to (Tom Hutton) for testing */ +typedef unsigned long ufc_long; +typedef unsigned long long64; +#define _UFC_64_ +#endif + +#if defined convex || defined __convexc__ +/* thanks to pcl@convex.oxford.ac.uk (Paul Leyland) for testing */ +typedef unsigned long ufc_long; +typedef long long long64; +#define _UFC_64_ +#endif + +#ifdef __sgi +#if _MIPS_SZLONG == 64 +typedef unsigned long ufc_long; +typedef long long64; +#define _UFC_64_ #else -# define _UFC_32_ +typedef unsigned long ufc_long; +typedef int long32; +#define _UFC_32_ +#endif +#endif + +/* + * Thanks to (Mike Iglesias) + */ + +#ifdef __alpha +typedef unsigned long ufc_long; +typedef unsigned long long64; +#define _UFC_64_ +#endif + +#if defined __sparc__ && defined __arch64__ +typedef unsigned long ufc_long; +typedef unsigned long long64; +#define _UFC_64_ +#endif + +/* + * For debugging 64 bit code etc with 'gcc' + */ + +#ifdef GCC3232 +typedef unsigned long ufc_long; +typedef unsigned long long32; +#define _UFC_32_ +#endif + +#ifdef GCC3264 +typedef unsigned long ufc_long; +typedef long long long64; +#define _UFC_64_ +#endif + +#ifdef GCC6432 +typedef long long ufc_long; +typedef unsigned long long32; +#define _UFC_32_ +#endif + +#ifdef GCC6464 +typedef long long ufc_long; +typedef long long long64; +#define _UFC_64_ +#endif + +/* + * Catch all for 99.95% of all UNIX machines + */ + +#ifndef _UFC_64_ +#ifndef _UFC_32_ +#define _UFC_32_ +typedef unsigned long ufc_long; +typedef unsigned long long32; +#endif #endif