summaryrefslogtreecommitdiffstats
path: root/secure/lib
diff options
context:
space:
mode:
authorcsgr <csgr@FreeBSD.org>1994-09-07 21:48:54 +0000
committercsgr <csgr@FreeBSD.org>1994-09-07 21:48:54 +0000
commit9baa6a9d3fde056bbc58129bf40860b28a23f68a (patch)
treebc67dfb4b3f603c884b4cb569368cb86aa03b7e0 /secure/lib
parent8956b2c26c304a8e555863a4f790e5334bc18510 (diff)
downloadFreeBSD-src-9baa6a9d3fde056bbc58129bf40860b28a23f68a.zip
FreeBSD-src-9baa6a9d3fde056bbc58129bf40860b28a23f68a.tar.gz
- Remove crypt() - it's in libcrypt
- remove ^L's - CTM will probably choke on them - add PRECIOUSLIB to Makefile - name changes libcrypt -> libcipher Submitted by: Geoff.
Diffstat (limited to 'secure/lib')
-rw-r--r--secure/lib/libcipher/Makefile11
-rw-r--r--secure/lib/libcipher/crypt.c109
-rw-r--r--secure/lib/libcipher/test/Makefile7
3 files changed, 11 insertions, 116 deletions
diff --git a/secure/lib/libcipher/Makefile b/secure/lib/libcipher/Makefile
index 47650e5..85b23f5 100644
--- a/secure/lib/libcipher/Makefile
+++ b/secure/lib/libcipher/Makefile
@@ -1,15 +1,16 @@
#
-# $Id: Makefile,v 1.1 1994/09/07 08:55:24 g89r4222 Exp $
+# $Id: Makefile,v 1.1.1.1 1994/09/07 21:18:07 csgr Exp $
#
-SUBDIR= test
+SUBDIR= test
-LIB= crypt
-SRCS= crypt.c
+LIB= cipher
+SRCS= crypt.c
+PRECIOUSLIB= yes
+NOPROFILE= yes
#MAN3= crypt.0
#MLINKS= crypt.3 encrypt.3 crypt.3 setkey.3
#MLINKS+=crypt.3 des_cipher.3 crypt.3 des_setkey.3
-.include <bsd.lib.mk>
.include <bsd.subdir.mk>
diff --git a/secure/lib/libcipher/crypt.c b/secure/lib/libcipher/crypt.c
index 4442369..f6c3126 100644
--- a/secure/lib/libcipher/crypt.c
+++ b/secure/lib/libcipher/crypt.c
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: crypt.c,v 1.1 1994/09/07 08:55:24 g89r4222 Exp $
+ * $Id: crypt.c,v 1.1.1.1 1994/09/07 21:18:07 csgr Exp $
*
* This is an original implementation of the DES and the crypt(3) interfaces
* by David Burren <davidb@werj.com.au>.
@@ -621,110 +621,3 @@ encrypt(char *block, int flag)
return(retval);
}
-
-char *
-crypt(char *key, char *setting)
-{
- int i;
- u_long count, salt, l, r0, r1, keybuf[2];
- u_char *p, *q;
- static u_char output[21];
-
- if (!des_initialised)
- des_init();
-
- /*
- * Need to check if setting is "*" - otherwise
- * crypt(k, "*") gives back "*"
- */
- for(i = 0 ; i < 2; i++)
- if(setting[i] == '\0')
- { setting[i] = 'A'; break ; }
-
-
- /*
- * Copy the key, shifting each character up by one bit
- * and padding with zeros.
- */
- q = (u_char *) keybuf;
- while (q - (u_char *) keybuf - 8) {
- if (*q++ = *key << 1)
- key++;
- }
- if (des_setkey((u_char *) keybuf))
- return(NULL);
-
- if (*setting == _PASSWORD_EFMT1) {
- /*
- * "new"-style:
- * setting - underscore, 4 bytes of count, 4 bytes of salt
- * key - unlimited characters
- */
- for (i = 1, count = 0L; i < 5; i++)
- count |= ascii_to_bin(setting[i]) << (i - 1) * 6;
-
- for (i = 5, salt = 0L; i < 9; i++)
- salt |= ascii_to_bin(setting[i]) << (i - 5) * 6;
-
- while (*key) {
- /*
- * Encrypt the key with itself.
- */
- if (des_cipher((u_char*)keybuf, (u_char*)keybuf, 0L, 1))
- return(NULL);
- /*
- * And XOR with the next 8 characters of the key.
- */
- q = (u_char *) keybuf;
- while (q - (u_char *) keybuf - 8 && *key)
- *q++ ^= *key++ << 1;
-
- if (des_setkey((u_char *) keybuf))
- return(NULL);
- }
- strncpy(output, setting, 9);
- p = output + 9;
- } else {
- /*
- * "old"-style:
- * setting - 2 bytes of salt
- * key - up to 8 characters
- */
- count = 25;
-
- salt = (ascii_to_bin(setting[1]) << 6)
- | ascii_to_bin(setting[0]);
-
- output[0] = setting[0];
- output[1] = setting[1];
- p = output + 2;
- }
- setup_salt(salt);
- /*
- * Do it.
- */
- if (do_des(0L, 0L, &r0, &r1, count))
- return(NULL);
- /*
- * Now encode the result...
- */
- l = (r0 >> 8);
- *p++ = ascii64[(l >> 18) & 0x3f];
- *p++ = ascii64[(l >> 12) & 0x3f];
- *p++ = ascii64[(l >> 6) & 0x3f];
- *p++ = ascii64[l & 0x3f];
-
- l = (r0 << 16) | ((r1 >> 16) & 0xffff);
- *p++ = ascii64[(l >> 18) & 0x3f];
- *p++ = ascii64[(l >> 12) & 0x3f];
- *p++ = ascii64[(l >> 6) & 0x3f];
- *p++ = ascii64[l & 0x3f];
-
- l = r1 << 2;
- *p++ = ascii64[(l >> 12) & 0x3f];
- *p++ = ascii64[(l >> 6) & 0x3f];
- *p++ = ascii64[l & 0x3f];
- *p = 0;
-
- return(output);
-}
diff --git a/secure/lib/libcipher/test/Makefile b/secure/lib/libcipher/test/Makefile
index 3afec4b..f1cf6cc 100644
--- a/secure/lib/libcipher/test/Makefile
+++ b/secure/lib/libcipher/test/Makefile
@@ -2,12 +2,13 @@
# Hacked Makefile to compile and run the DES-certification program,
# but not install anything.
#
-# $Id: Makefile,v 1.1 1994/09/07 08:55:26 g89r4222 Exp $
+# $Id: Makefile,v 1.1.1.1 1994/09/07 21:18:08 csgr Exp $
#
LIBCRYPT!=cd $(.CURDIR)/..; \
- printf "xxx:\n\techo \$${.OBJDIR}/libcrypt.a\n" | make -r -s -f - xxx
+ printf "xxx:\n\techo \$${.OBJDIR}/libcipher.a\n" | make -r -s -f - xxx
#CFLAGS+= -DHAVE_CRYPT16
+LIBCRYPT+= -lcrypt
TARGETS=cert speedcrypt speeddes
@@ -52,4 +53,4 @@ clean:
install:
-.include <bsd.obj.mk>
+.include <bsd.prog.mk>
OpenPOWER on IntegriCloud