summaryrefslogtreecommitdiff
path: root/lib/libcrypt
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libcrypt')
-rw-r--r--lib/libcrypt/Makefile14
-rw-r--r--lib/libcrypt/crypt.322
-rw-r--r--lib/libcrypt/crypt.c18
3 files changed, 25 insertions, 29 deletions
diff --git a/lib/libcrypt/Makefile b/lib/libcrypt/Makefile
index 93e23333411..e77e2dd7701 100644
--- a/lib/libcrypt/Makefile
+++ b/lib/libcrypt/Makefile
@@ -1,17 +1,13 @@
-# This directory contains an implementation of crypt(3) and associated
-# routines. the file crypt.c can't be shipped out of the US. it was put
-# into this directory to make distribution of exportable and non-exportable
-# systems easier.
+# $NetBSD: Makefile,v 1.6 1995/02/19 12:18:56 cgd Exp $
#
-# $Id: Makefile,v 1.5 1994/12/22 09:49:34 cgd Exp $
+# This directory contains an implementation of crypt(3) and associated
+# routines. They have been modified so that decryption is no longer possible,
+# and thus are exportable. They were taken from the 4.4BSD-Lite foreign
+# distribution.
LIB= crypt
-.if exists(crypt.c) && !defined(EXPORTABLE_SYSTEM)
SRCS= crypt.c
-.else
-SRCS= crypt_dummy.c
-.endif
MAN= crypt.3
MLINKS= crypt.3 encrypt.3 crypt.3 setkey.3
diff --git a/lib/libcrypt/crypt.3 b/lib/libcrypt/crypt.3
index 6ccea968062..01f11e06136 100644
--- a/lib/libcrypt/crypt.3
+++ b/lib/libcrypt/crypt.3
@@ -1,5 +1,7 @@
-.\" Copyright (c) 1989, 1991 The Regents of the University of California.
-.\" All rights reserved.
+.\" $NetBSD: crypt.3,v 1.2 1995/02/19 12:19:00 cgd Exp $
+.\"
+.\" Copyright (c) 1989, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@@ -29,10 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" from: @(#)crypt.3 6.7 (Berkeley) 5/21/91
-.\" $Id: crypt.3,v 1.1 1993/10/07 01:36:22 cgd Exp $
+.\" @(#)crypt.3 8.1.1.1 (Berkeley) 8/18/93
.\"
-.Dd May 21, 1991
+.Dd August 18, 1993
.Dt CRYPT 3
.Os
.Sh NAME
@@ -101,7 +102,7 @@ are swapped in the
The
.Ar key
is divided into groups of 8 characters (a short final group is null-padded)
-and the low-order 7 bits of each each character (56 bits per group) are
+and the low-order 7 bits of each character (56 bits per group) are
used to form the DES key as follows: the first group of 56 bits becomes the
initial DES key.
For each additional group, the XOR of the group bits and the encryption of
@@ -162,9 +163,8 @@ If the value of
is 0,
the argument
.Fa block
-is encrypted, otherwise it
-is decrypted.
-The encryption or decryption is returned in the original
+is encrypted, otherwise it fails.
+The encryption is returned in the original
array
.Fa block
after using the
@@ -190,9 +190,7 @@ significant bit in each character is ignored and the next 7 bits of each
character are concatenated to yield a 56-bit key.
The function
.Fn des_cipher
-encrypts (or decrypts if
-.Fa count
-is negative) the 64-bits stored in the 8 characters at
+encrypts the 64-bits stored in the 8 characters at
.Fa in
using
.Xr abs 3
diff --git a/lib/libcrypt/crypt.c b/lib/libcrypt/crypt.c
index aeffe461bae..66b15a7b7d2 100644
--- a/lib/libcrypt/crypt.c
+++ b/lib/libcrypt/crypt.c
@@ -1,6 +1,8 @@
+/* $NetBSD: crypt.c,v 1.5 1995/02/19 12:19:03 cgd Exp $ */
+
/*
- * Copyright (c) 1989 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Tom Truscott.
@@ -35,8 +37,10 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-/*static char sccsid[] = "from: @(#)crypt.c 5.11 (Berkeley) 6/25/91";*/
-static char rcsid[] = "$Id: crypt.c,v 1.4 1994/12/20 16:00:32 cgd Exp $";
+#if 0
+static char sccsid[] = "@(#)crypt.c 8.1.1.1 (Berkeley) 8/18/93";
+#endif
+static char rcsid[] = "$NetBSD: crypt.c,v 1.5 1995/02/19 12:19:03 cgd Exp $";
#endif /* LIBC_SCCS and not lint */
#include <unistd.h>
@@ -649,9 +653,7 @@ des_cipher(in, out, salt, num_iter)
}
else
{ /* decryption */
- num_iter = -num_iter;
- kp = &KS[KS_SIZE-1];
- ks_inc = -(long)sizeof(*kp);
+ return (1); /* always fail */
}
while (--num_iter >= 0) {
@@ -659,7 +661,7 @@ des_cipher(in, out, salt, num_iter)
do {
#define SPTAB(t, i) \
- (*(int32_t*)((unsigned char *)t + i*(sizeof(int32_t)/4)))
+ (*(int32_t *)((unsigned char *)t + i*(sizeof(int32_t)/4)))
#if defined(gould)
/* use this if B.b[i] is evaluated just once ... */
#define DOXOR(x,y,i) x^=SPTAB(SPE[0][i],B.b[i]); y^=SPTAB(SPE[1][i],B.b[i]);