Files
Ryan Schmidt 9f9482e99e bdes: Fix build failure
Fix build failure due to lack of return types on functions.

Also build using the right compiler and -arch flags and add universal
variant. Use port:-style dependencies. Simplify destroot. Add note about
DES being obsolete. Remove reinplace that does nothing.
2018-10-13 06:52:21 -05:00

194 lines
4.3 KiB
Diff

Add function prototypes and return types.
--- bdes.c.orig 2000-09-22 04:42:03.000000000 -0500
+++ bdes.c 2018-10-13 06:35:22.000000000 -0500
@@ -162,6 +162,29 @@
int fbbits = -1; /* number of feedback bits */
int pflag; /* 1 to preserve parity bits */
+static void ecbenc(void);
+static void ecbdec(void);
+static void cbcenc(void);
+static void cbcdec(void);
+static void cfbenc(void);
+static void cfbdec(void);
+static void cfbaenc(void);
+static void cfbadec(void);
+static void ofbenc(void);
+static void ofbdec(void);
+
+static void cbcauth(void);
+static void cfbauth(void);
+
+static void cvtkey(char *, char *);
+static int setbits(char *, int);
+static void makekey(Desbuf);
+static int tobinhex(char, int);
+static void err(int, char *);
+
+static void usage(void);
+
+int
main(ac, av)
int ac; /* arg count */
char **av; /* arg vector */
@@ -335,6 +358,7 @@
/*
* print a warning message and, possibly, terminate
*/
+static void
err(n, s)
int n; /* offending block number */
char *s; /* the message */
@@ -350,6 +374,7 @@
/*
* map a hex character to an integer
*/
+static int
tobinhex(c, radix)
char c; /* char to be converted */
int radix; /* base (2 to 16) */
@@ -381,6 +406,7 @@
/*
* convert the key to a bit pattern
*/
+static void
cvtkey(obuf, ibuf)
char *obuf; /* bit pattern */
char *ibuf; /* the key itself */
@@ -449,6 +475,7 @@
* 2. must be a valid decimal number
* 3. must be a multiple of mult
*/
+static int
setbits(s, mult)
char *s; /* the ASCII string */
int mult; /* what it must be a multiple of */
@@ -491,6 +518,7 @@
* systems set the parity (high) bit of each character to 0, and the
* DES ignores the low order bit of each character.
*/
+static void
makekey(buf)
Desbuf buf; /* key block */
{
@@ -519,6 +547,7 @@
/*
* This encrypts using the Electronic Code Book mode of DES
*/
+static void
ecbenc()
{
register int n; /* number of bytes actually read */
@@ -547,6 +576,7 @@
/*
* This decrypts using the Electronic Code Book mode of DES
*/
+static void
ecbdec()
{
register int n; /* number of bytes actually read */
@@ -578,6 +608,7 @@
/*
* This encrypts using the Cipher Block Chaining mode of DES
*/
+static void
cbcenc()
{
register int n; /* number of bytes actually read */
@@ -611,6 +642,7 @@
/*
* This decrypts using the Cipher Block Chaining mode of DES
*/
+static void
cbcdec()
{
register int n; /* number of bytes actually read */
@@ -647,6 +679,7 @@
/*
* This authenticates using the Cipher Block Chaining mode of DES
*/
+static void
cbcauth()
{
register int n, j; /* number of bytes actually read */
@@ -691,6 +724,7 @@
/*
* This encrypts using the Cipher FeedBack mode of DES
*/
+static void
cfbenc()
{
register int n; /* number of bytes actually read */
@@ -732,6 +766,7 @@
/*
* This decrypts using the Cipher Block Chaining mode of DES
*/
+static void
cfbdec()
{
register int n; /* number of bytes actually read */
@@ -777,6 +812,7 @@
/*
* This encrypts using the alternative Cipher FeedBack mode of DES
*/
+static void
cfbaenc()
{
register int n; /* number of bytes actually read */
@@ -822,6 +858,7 @@
/*
* This decrypts using the alternative Cipher Block Chaining mode of DES
*/
+static void
cfbadec()
{
register int n; /* number of bytes actually read */
@@ -868,6 +905,7 @@
/*
* This encrypts using the Output FeedBack mode of DES
*/
+static void
ofbenc()
{
register int n; /* number of bytes actually read */
@@ -913,6 +951,7 @@
/*
* This decrypts using the Output Block Chaining mode of DES
*/
+static void
ofbdec()
{
register int n; /* number of bytes actually read */
@@ -961,6 +1000,7 @@
/*
* This authenticates using the Cipher FeedBack mode of DES
*/
+static void
cfbauth()
{
register int n, j; /* number of bytes actually read */
@@ -1012,6 +1052,7 @@
/*
* change from 8 bits/Uchar to 1 bit/Uchar
*/
+static void
expand(from, to)
Desbuf from; /* 8bit/unsigned char string */
char *to; /* 1bit/char string */
@@ -1026,6 +1067,7 @@
/*
* change from 1 bit/char to 8 bits/Uchar
*/
+static void
compress(from, to)
char *from; /* 1bit/char string */
Desbuf to; /* 8bit/unsigned char string */
@@ -1043,6 +1085,7 @@
/*
* message about usage
*/
+static void
usage()
{
(void)fprintf(stderr, "%s\n",