From: Keith Bostic Date: Fri, 28 Jun 1991 06:03:43 +0000 (-0800) Subject: test returns of des_setkey, des_cipher, setkey, encrypt X-Git-Tag: BSD-4_4-Snapshot-Development~10033 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/936ef1078abe60585db481cde4bdbafd9f04b8c9 test returns of des_setkey, des_cipher, setkey, encrypt SCCS-vsn: usr.bin/bdes/bdes.c 5.5 --- diff --git a/usr/src/usr.bin/bdes/bdes.c b/usr/src/usr.bin/bdes/bdes.c index e6e8fcfeed..52ae082525 100644 --- a/usr/src/usr.bin/bdes/bdes.c +++ b/usr/src/usr.bin/bdes/bdes.c @@ -19,7 +19,7 @@ char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)bdes.c 5.4 (Berkeley) %G%"; +static char sccsid[] = "@(#)bdes.c 5.5 (Berkeley) %G%"; #endif /* not lint */ /* @@ -69,18 +69,24 @@ static char sccsid[] = "@(#)bdes.c 5.4 (Berkeley) %G%"; /* Hide the calls to the primitive encryption routines. */ #define FASTWAY #ifdef FASTWAY -#define DES_KEY(buf) des_setkey(buf) -#define DES_XFORM(buf) des_cipher(buf, buf, 0L, (inverse ? -1 : 1)) +#define DES_KEY(buf) \ + if (des_setkey(buf)) \ + err("des_setkey", 0); +#define DES_XFORM(buf) \ + if (des_cipher(buf, buf, 0L, (inverse ? -1 : 1))) \ + err("des_cipher", 0); #else #define DES_KEY(buf) { \ char bits1[64]; /* bits of key */ \ expand(buf, bits1); \ - setkey(bits1); \ + if (setkey(bits1)) \ + err("setkey", 0); \ } #define DES_XFORM(buf) { \ char bits1[64]; /* bits of message */ \ expand(buf, bits1); \ - encrypt(bits1, inverse); \ + if (encrypt(bits1, inverse)) \ + err("encrypt", 0); \ compress(bits1, buf); \ } #endif @@ -475,14 +481,8 @@ makekey(buf) UCHAR(buf, i) = (UCHAR(buf, i)&0177)|0200; } } - /* - * Make the key schedule. If an error, the system probably does - * not have the encryption routines available. - */ - errno = 0; + DES_KEY(UBUFFER(buf)); - if (errno) - err(0, NULL); } /*