Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libkstream Fixup libkstream build.
details: https://anonhg.NetBSD.org/src/rev/584ec233b8ef
branches: trunk
changeset: 488054:584ec233b8ef
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sat Jun 17 06:39:32 2000 +0000
description:
Fixup libkstream build.
diffstat:
lib/libkstream/Makefile | 7 ++++-
lib/libkstream/kstream-des.c | 54 +++++++++++++-----------------------------
lib/libkstream/kstream.c | 55 ++++++++++++-------------------------------
3 files changed, 38 insertions(+), 78 deletions(-)
diffs (truncated from 311 to 300 lines):
diff -r 057f4fbe08d7 -r 584ec233b8ef lib/libkstream/Makefile
--- a/lib/libkstream/Makefile Sat Jun 17 06:38:25 2000 +0000
+++ b/lib/libkstream/Makefile Sat Jun 17 06:39:32 2000 +0000
@@ -1,10 +1,13 @@
-# $NetBSD: Makefile,v 1.1.1.1 2000/06/17 06:24:28 thorpej Exp $
+# $NetBSD: Makefile,v 1.2 2000/06/17 06:39:32 thorpej Exp $
LIB= kstream
SRCS= kstream.c kstream-des.c
-COPTS+= -g
+CPPFLAGS+=-I${DESTDIR}/usr/include/kerberosIV
+
+INCS= kstream.h
+INCSDIR=/usr/include/kerberosIV
SHLIB_MAJOR?= 1
SHLIB_MINOR?= 0
diff -r 057f4fbe08d7 -r 584ec233b8ef lib/libkstream/kstream-des.c
--- a/lib/libkstream/kstream-des.c Sat Jun 17 06:38:25 2000 +0000
+++ b/lib/libkstream/kstream-des.c Sat Jun 17 06:39:32 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kstream-des.c,v 1.1.1.1 2000/06/17 06:24:28 thorpej Exp $ */
+/* $NetBSD: kstream-des.c,v 1.2 2000/06/17 06:39:32 thorpej Exp $ */
/* DES-encrypted-stream implementation for MIT Kerberos.
Written by Ken Raeburn (Raeburn%Cygnus.COM@localhost), based on algorithms
@@ -73,10 +73,7 @@
between 8 and 16 is an annoyance, but rlogin actually relies on being
able to send 12 bytes in one chunk. Bleah! */
static void
-do_encrypt (out, inp, p)
- ksdb *out;
- ksdb *inp;
- priv *p;
+do_encrypt (ksdb *out, ksdb *inp, priv *p)
{
union {
char buf[16];
@@ -134,16 +131,13 @@
if (x)
abort ();
}
- des_pcbc_encrypt ((des_cblock *)in.ptr, (des_cblock *)ptr, in.length,
- p->x.u.sched, (des_cblock *)p->x.ivec, ENCRYPT);
+ des_pcbc_encrypt (in.ptr, ptr, in.length,
+ p->x.u.sched, (des_cblock *)p->x.ivec, 1);
out->ptr = ptr + ((in.length + 7) & ~7);
}
static int
-encrypt (outp, inp, k)
- ksdb *outp;
- ksdb *inp;
- kstream k;
+encrypt (ksdb *outp, ksdb *inp, kstream k)
{
const int small_block_size = 16;
priv *p = (priv *) k->data;
@@ -184,10 +178,7 @@
int _kstream_des_debug_OOB = 0;
static int
-decrypt (outp, inp, k)
- ksdb *outp;
- ksdb *inp;
- kstream k;
+decrypt (ksdb *outp, ksdb *inp, kstream k)
{
char *ptr = inp->ptr;
unsigned long x = 0;
@@ -202,7 +193,7 @@
and we still lose... */
x = *ptr & 0xff; /* get the first char */
while (x) {
- if(_kstream_des_debug_OOB) fprintf(stderr,"BAD BYTE %02x\n\r", x);
+ if(_kstream_des_debug_OOB) fprintf(stderr,"BAD BYTE %02lx\n\r", x);
error_count++; /* count the bad byte */
ptr++; /* and skip it */
if(inp->length == error_count) {
@@ -239,8 +230,8 @@
assert (p->buf1 != 0 || sz == 0);
outp->ptr = p->buf1;
outp->length = x;
- pcbc_encrypt ((des_cblock *)ptr, (des_cblock *)outp->ptr, sz, p->x.u.sched,
- (des_cblock *)p->x.ivec, DECRYPT);
+ pcbc_encrypt (ptr, outp->ptr, sz, p->x.u.sched,
+ (des_cblock *)p->x.ivec, 0);
if (p->no_right_justify == 0
&& x < 8)
outp->ptr = p->buf1 + 8 - x;
@@ -248,9 +239,7 @@
}
static int
-init (k, data)
- kstream k;
- void *data;
+init (kstream k, void *data)
{
priv *p;
@@ -267,9 +256,7 @@
}
static int
-rcp_init (k, data)
- kstream k;
- void *data;
+rcp_init (kstream k, void *data)
{
int x = init (k, data);
((priv *)(k->data))->no_right_justify = 1;
@@ -277,9 +264,7 @@
}
static int
-rlogin_init (k, data)
- kstream k;
- void *data;
+rlogin_init (kstream k, void *data)
{
int x = init (k, data);
((priv *)(k->data))->protect_rlogin_oob = 1;
@@ -287,8 +272,7 @@
}
static void
-destroy (k)
- kstream k;
+destroy (kstream k)
{
priv *p = (priv *) k->data;
if (p->buf1)
@@ -307,10 +291,8 @@
};
kstream
-kstream_create_rlogin_from_fd (fd, P_sched, ivec)
- int fd;
- kstream_ptr P_sched;
- des_cblock (*ivec);
+kstream_create_rlogin_from_fd (int fd, kstream_ptr P_sched,
+ des_cblock (*ivec))
{
Key_schedule *sched = (Key_schedule *) P_sched;
kstream_des_init_block x;
@@ -323,10 +305,8 @@
}
kstream
-kstream_create_rcp_from_fd (fd, P_sched, ivec)
- int fd;
- kstream_ptr P_sched;
- des_cblock (*ivec);
+kstream_create_rcp_from_fd (int fd, kstream_ptr P_sched,
+ des_cblock (*ivec))
{
Key_schedule *sched = (Key_schedule *) P_sched;
kstream_des_init_block x;
diff -r 057f4fbe08d7 -r 584ec233b8ef lib/libkstream/kstream.c
--- a/lib/libkstream/kstream.c Sat Jun 17 06:38:25 2000 +0000
+++ b/lib/libkstream/kstream.c Sat Jun 17 06:39:32 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kstream.c,v 1.1.1.1 2000/06/17 06:24:28 thorpej Exp $ */
+/* $NetBSD: kstream.c,v 1.2 2000/06/17 06:39:32 thorpej Exp $ */
/* Encrypted-stream implementation for MIT Kerberos.
Written by Ken Raeburn (Raeburn%Cygnus.COM@localhost).
@@ -42,6 +42,7 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
/* Only use alloca if we've got gcc 2 or better */
#ifdef __GNUC__
@@ -65,7 +66,6 @@
char *realloc ();
void free ();
#endif
-extern int errno;
#ifdef sun
#ifndef solaris20
@@ -74,31 +74,24 @@
#endif
#endif
-static void fifo__init (this)
- fifo *this;
+static void fifo__init (fifo *this)
{
this->next_write = this->next_read = 0;
memset (this->data, 0, sizeof (this->data));
}
-static char *fifo__data_start (this)
- fifo *this;
+static char *fifo__data_start (fifo *this)
{
return this->data + this->next_read;
}
-static size_t fifo__bytes_available (this)
- fifo *this;
+static size_t fifo__bytes_available (fifo *this)
{
return this->next_write - this->next_read;
}
-static size_t fifo__space_available (this)
- fifo *this;
+static size_t fifo__space_available (fifo *this)
{
return sizeof (this->data) - fifo__bytes_available (this);
}
-static int fifo__append (this, ptr, len)
- fifo *this;
- const char *ptr;
- size_t len;
+static int fifo__append (fifo *this, const char *ptr, size_t len)
{
if (len > fifo__space_available (this))
len = fifo__space_available (this);
@@ -113,10 +106,7 @@
this->next_write += len;
return len;
}
-static int fifo__extract (this, ptr, len)
- fifo *this;
- char *ptr;
- size_t len;
+static int fifo__extract (fifo *this, char *ptr, size_t len)
{
size_t n = fifo__bytes_available (this);
if (len > n)
@@ -129,8 +119,7 @@
return len;
}
-static void kstream_rec__init (this)
- kstream_rec *this;
+static void kstream_rec__init (kstream_rec *this)
{
fifo__init (&this->in_crypt);
fifo__init (&this->in_clear);
@@ -138,10 +127,8 @@
}
kstream
-kstream_create_from_fd (fd, ctl, data)
- int fd;
- const struct kstream_crypt_ctl_block *ctl;
- void *data;
+kstream_create_from_fd (int fd, const struct kstream_crypt_ctl_block *ctl,
+ void *data)
{
kstream k;
k = (kstream) malloc (sizeof (kstream_rec));
@@ -161,8 +148,7 @@
}
int
-kstream_destroy (k)
- kstream k;
+kstream_destroy (kstream k)
{
int x = kstream_flush (k);
if (k->ctl && k->ctl->destroy)
@@ -172,18 +158,13 @@
}
void
-kstream_set_buffer_mode (k, mode)
- kstream k;
- int mode;
+kstream_set_buffer_mode (kstream k, int mode)
{
k->buffering = mode;
}
int
-kstream_write (k, p_data, p_len)
- kstream k;
- kstream_ptr p_data;
- size_t p_len;
+kstream_write (kstream k, kstream_ptr p_data, size_t p_len)
{
size_t len = p_len;
char *data = p_data;
@@ -208,8 +189,7 @@
}
int
-kstream_flush (k)
- kstream k;
+kstream_flush (kstream k)
{
int x, n;
fifo *out = &k->out_clear;
@@ -253,10 +233,7 @@
Home |
Main Index |
Thread Index |
Old Index