diff options
| author | thorpej <thorpej@NetBSD.org> | 2000-06-16 16:27:32 +0000 |
|---|---|---|
| committer | thorpej <thorpej@NetBSD.org> | 2000-06-16 16:27:32 +0000 |
| commit | 9323d932342fac2ebc7dc419bcfc3bfa604b9c48 (patch) | |
| tree | 78fba6a088259e2707e5f88834d7cb4cbca5af22 /lib | |
| parent | a7a6978d06de8af8cb317d5267e44e4f4e942689 (diff) | |
Enable decryption in crypt(), from cryptosrc-intl, and lift the updated
manual page (which describes decryption) from cryptosrc-us.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libcrypt/crypt.3 | 17 | ||||
| -rw-r--r-- | lib/libcrypt/crypt.c | 8 |
2 files changed, 15 insertions, 10 deletions
diff --git a/lib/libcrypt/crypt.3 b/lib/libcrypt/crypt.3 index a58d64b7913..acb3e073270 100644 --- a/lib/libcrypt/crypt.3 +++ b/lib/libcrypt/crypt.3 @@ -1,4 +1,4 @@ -.\" $NetBSD: crypt.3,v 1.7 1999/07/02 15:18:37 simonb Exp $ +.\" $NetBSD: crypt.3,v 1.8 2000/06/16 16:27:32 thorpej Exp $ .\" .\" Copyright (c) 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" @(#)crypt.3 8.1.1.1 (Berkeley) 8/18/93 +.\" @(#)crypt.3 8.2 (Berkeley) 12/11/93 .\" -.Dd August 18, 1993 +.Dd December 11, 1993 .Dt CRYPT 3 .Os .Sh NAME @@ -79,7 +79,7 @@ underscore (``_'') followed by 4 bytes of iteration count and 4 bytes of salt. Both the iteration .Fa count -and the +and the .Fa salt are encoded with 6 bits per character, least significant bits first. The values 0 to 63 are encoded by the characters ``./0-9A-Za-z'', @@ -167,8 +167,9 @@ If the value of is 0, the argument .Fa block -is encrypted, otherwise it fails. -The encryption is returned in the original +is encrypted, otherwise it +is decrypted. +The encryption or decryption is returned in the original array .Fa block after using the @@ -194,7 +195,9 @@ 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 the 64-bits stored in the 8 characters at +encrypts (or decrypts if +.Fa count +is negative) 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 0e00967f2e7..d50169e9e38 100644 --- a/lib/libcrypt/crypt.c +++ b/lib/libcrypt/crypt.c @@ -1,4 +1,4 @@ -/* $NetBSD: crypt.c,v 1.14 2000/03/13 22:59:22 soren Exp $ */ +/* $NetBSD: crypt.c,v 1.15 2000/06/16 16:27:32 thorpej Exp $ */ /* * Copyright (c) 1989, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)crypt.c 8.1.1.1 (Berkeley) 8/18/93"; #else -__RCSID("$NetBSD: crypt.c,v 1.14 2000/03/13 22:59:22 soren Exp $"); +__RCSID("$NetBSD: crypt.c,v 1.15 2000/06/16 16:27:32 thorpej Exp $"); #endif #endif /* not lint */ @@ -666,7 +666,9 @@ des_cipher(in, out, salt, num_iter) } else { /* decryption */ - return (1); /* always fail */ + num_iter = -num_iter; + kp = &KS[KS_SIZE-1]; + ks_inc = -(long)sizeof(*kp); } while (--num_iter >= 0) { |
