summaryrefslogtreecommitdiff
path: root/lib/libkeynote
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>1999-10-09 06:59:38 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>1999-10-09 06:59:38 +0000
commit6eb9c3379a77019df4804ec2a94c4f44a23ff436 (patch)
treed4f432fef588d164d1850e71b26e8dd0b4bdc75d /lib/libkeynote
parent78a3820d7c72ca33ca89b44c87a2c5fb3d028e1e (diff)
Move all ifdefs in header.h (instead of keynote.h), include header.h
in all files including keynote.h, update manpage.
Diffstat (limited to 'lib/libkeynote')
-rw-r--r--lib/libkeynote/Makefile.in17
-rw-r--r--lib/libkeynote/aux.c3
-rw-r--r--lib/libkeynote/base64.c3
-rw-r--r--lib/libkeynote/environment.c5
-rw-r--r--lib/libkeynote/header.h66
-rw-r--r--lib/libkeynote/keynote-keygen.c4
-rw-r--r--lib/libkeynote/keynote-sign.c4
-rw-r--r--lib/libkeynote/keynote-sigver.c4
-rw-r--r--lib/libkeynote/keynote-ver.l6
-rw-r--r--lib/libkeynote/keynote-ver.y4
-rw-r--r--lib/libkeynote/keynote-verify.c4
-rw-r--r--lib/libkeynote/keynote.34
-rw-r--r--lib/libkeynote/keynote.h17
-rw-r--r--lib/libkeynote/keynote.l3
-rw-r--r--lib/libkeynote/keynote.y3
-rw-r--r--lib/libkeynote/parse_assertion.c3
-rw-r--r--lib/libkeynote/signature.c3
17 files changed, 105 insertions, 48 deletions
diff --git a/lib/libkeynote/Makefile.in b/lib/libkeynote/Makefile.in
index 0180ecba8df..273718b9171 100644
--- a/lib/libkeynote/Makefile.in
+++ b/lib/libkeynote/Makefile.in
@@ -1,3 +1,4 @@
+# $OpenBSD: Makefile.in,v 1.4 1999/10/09 06:59:37 angelos Exp $
#
# The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
#
@@ -83,13 +84,13 @@ $(TARGET): $(OBJS)
$(TARGET2): $(TARGET) $(OBJS2)
$(CC) $(CFLAGS) -o $(TARGET2) $(OBJS2) $(LIBS)
-k.tab.c: keynote.y keynote.h assertion.h config.h
+k.tab.c: keynote.y header.h keynote.h assertion.h config.h
$(YACC) $(YACCFLAGS) keynote.y
z.tab.c: keynote-ver.y keynote.h header.h config.h
$(YACC) $(YACCFLAGS2) keynote-ver.y
-lex.kn.c: keynote.l k.tab.h keynote.h assertion.h config.h
+lex.kn.c: keynote.l k.tab.h header.h keynote.h assertion.h config.h
$(LEX) $(LEXFLAGS) keynote.l
lex.kv.c: keynote-ver.l z.tab.h keynote.h header.h config.h
@@ -98,16 +99,16 @@ lex.kv.c: keynote-ver.l z.tab.h keynote.h header.h config.h
.c.o:
$(CC) $(CFLAGS) $(DEFS) $(INC) -c $<
-aux.c: keynote.h assertion.h signature.h config.h
-parse_assertion.c: keynote.h assertion.h signature.h config.h
-environment.c: keynote.h assertion.h config.h
-keynote-verify.c: keynote.h header.h config.h
-signature.c: keynote.h assertion.h signature.h config.h
+aux.c: header.h keynote.h assertion.h signature.h config.h
+parse_assertion.c: header.h keynote.h assertion.h signature.h config.h
+environment.c: header.h keynote.h assertion.h config.h
+keynote-verify.c: header.h keynote.h header.h config.h
+signature.c: header.h keynote.h assertion.h signature.h config.h
keynote-keygen.c: keynote.h assertion.h signature.h header.h config.h
keynote-sign.c: keynote.h header.h config.h
keynote-sigver.c: keynote.h header.h config.h
keynote-main.c: header.h config.h
-base64.c: keynote.h config.h
+base64.c: header.h keynote.h config.h
clean:
$(RM) $(RMFLAGS) $(OBJS) $(OBJS2) a.out *.core *~ */*~
diff --git a/lib/libkeynote/aux.c b/lib/libkeynote/aux.c
index fe9906bb4bd..6f58cf9e576 100644
--- a/lib/libkeynote/aux.c
+++ b/lib/libkeynote/aux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aux.c,v 1.4 1999/10/01 01:08:29 angelos Exp $ */
+/* $OpenBSD: aux.c,v 1.5 1999/10/09 06:59:37 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -36,6 +36,7 @@
#include <limits.h>
#endif /* HAVE_LIMITS_H */
+#include "header.h"
#include "keynote.h"
#include "assertion.h"
#include "signature.h"
diff --git a/lib/libkeynote/base64.c b/lib/libkeynote/base64.c
index 7bc0c961f46..59586c5f762 100644
--- a/lib/libkeynote/base64.c
+++ b/lib/libkeynote/base64.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: base64.c,v 1.3 1999/10/01 01:08:29 angelos Exp $ */
+/* $OpenBSD: base64.c,v 1.4 1999/10/09 06:59:37 angelos Exp $ */
/*
* Copyright (c) 1996 by Internet Software Consortium.
*
@@ -57,6 +57,7 @@
#endif /* !HAVE_STRCHR */
#endif /* STDC_HEADERS */
+#include "header.h"
#include "keynote.h"
#if defined(HAVE___B64_NTOP)
diff --git a/lib/libkeynote/environment.c b/lib/libkeynote/environment.c
index a82e6baed8b..daca4913f07 100644
--- a/lib/libkeynote/environment.c
+++ b/lib/libkeynote/environment.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: environment.c,v 1.6 1999/10/09 06:34:14 angelos Exp $ */
-/*
+/* $OpenBSD: environment.c,v 1.7 1999/10/09 06:59:37 angelos Exp $ */
+/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
* This code was written by Angelos D. Keromytis in Philadelphia, PA, USA,
@@ -49,6 +49,7 @@
#include <unistd.h>
#endif /* HAVE_IO_H */
+#include "header.h"
#include "keynote.h"
#include "assertion.h"
diff --git a/lib/libkeynote/header.h b/lib/libkeynote/header.h
index 8a82f93d3f6..7c14b508a55 100644
--- a/lib/libkeynote/header.h
+++ b/lib/libkeynote/header.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: header.h,v 1.2 1999/10/01 01:08:30 angelos Exp $ */
+/* $OpenBSD: header.h,v 1.3 1999/10/09 06:59:37 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -26,7 +26,6 @@
extern void keynote_sign(int, char **), keynote_sigver(int, char **);
extern void keynote_verify(int, char **), keynote_keygen(int, char **);
extern void print_key(FILE *, char *, char *, int, int);
-extern void mystrncpy(char *, char *, int);
extern void print_space(FILE *, int);
extern int read_environment(char *);
extern void parse_key(char *);
@@ -39,11 +38,72 @@ int sessid;
/* Defines */
#define SEED_LEN 40
#define RND_BYTES 1024
-#define DEFAULT_PUBLIC 0x10001
+#define DEFAULT_PUBLIC 0x10001
#define KEY_PRINT_OFFSET 12
#define KEY_PRINT_LENGTH 50
#define SIG_PRINT_OFFSET 12
#define SIG_PRINT_LENGTH 50
+
+#if !defined(HAVE_STRCASECMP) && defined(HAVE_STRICMP)
+#define strcasecmp stricmp
+#endif /* !HAVE_STRCASECMP && HAVE_STRICMP */
+
+#if !defined(HAVE_STRNCASECMP) && defined(HAVE_STRNICMP)
+#define strncasecmp strnicmp
+#endif /* !HAVE_STRNCASECMP && HAVE_STRNICMP */
+
+#if !defined(HAVE_OPEN) && defined(HAVE__OPEN)
+#define open _open
+#endif /* !HAVE_OPEN && HAVE__OPEN */
+
+#if !defined(HAVE_READ) && defined(HAVE__READ)
+#define read _read
+#endif /* !HAVE_READ && HAVE__OPEN */
+
+#if !defined(HAVE_CLOSE) && defined(HAVE__CLOSE)
+#define close _close
+#endif /* !HAVE_CLOSE && HAVE__CLOSE */
+
+#if defined(CRYPTO)
+#if HAVE__DEV_URANDOM
+#define KEYNOTERNDFILENAME "/dev/urandom"
+#else /* HAVE__DEV_URANDOM */
+#error "You need a random device!"
+#endif /* HAVE__DEV_URANDOM */
+#endif /* CRYPTO */
+
+/* Includes */
+#if HAVE_REGEX_H
+#include <sys/types.h>
+#include <regex.h>
+#endif /* HAVE_REGEX_H */
+
+#if defined(CRYPTO)
+#if HAVE_OPENSSL_CRYPTO_H
+#include <openssl/crypto.h>
+#include <openssl/dsa.h>
+#include <openssl/rsa.h>
+#include <openssl/sha.h>
+#include <openssl/md5.h>
+#include <openssl/err.h>
+#include <openssl/rand.h>
+#include <openssl/x509.h>
+#include <openssl/pem.h>
+#elif HAVE_SSL_CRYPTO_H
+#include <ssl/crypto.h>
+#include <ssl/dsa.h>
+#include <ssl/rsa.h>
+#include <ssl/sha.h>
+#include <ssl/md5.h>
+#include <ssl/err.h>
+#include <ssl/rand.h>
+#include <ssl/x509.h>
+#include <ssl/pem.h>
+#else /* HAVE_OPENSSL_CRYPTO_H */
+#error "SSLeay or OpenSSL not detected!"
+#endif /* HAVE_OPENSSL_CRYPTO_H */
+#endif /* CRYPTO */
+
#endif /* _HEADER_H_ */
diff --git a/lib/libkeynote/keynote-keygen.c b/lib/libkeynote/keynote-keygen.c
index bcdeeaf2094..40b236b42b9 100644
--- a/lib/libkeynote/keynote-keygen.c
+++ b/lib/libkeynote/keynote-keygen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keynote-keygen.c,v 1.5 1999/10/06 20:27:46 angelos Exp $ */
+/* $OpenBSD: keynote-keygen.c,v 1.6 1999/10/09 06:59:37 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -43,10 +43,10 @@
#include <unistd.h>
#endif /* HAVE_IO_H */
+#include "header.h"
#include "keynote.h"
#include "assertion.h"
#include "signature.h"
-#include "header.h"
void
keygenusage(void)
diff --git a/lib/libkeynote/keynote-sign.c b/lib/libkeynote/keynote-sign.c
index a8329444c29..f6d5076ef1b 100644
--- a/lib/libkeynote/keynote-sign.c
+++ b/lib/libkeynote/keynote-sign.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keynote-sign.c,v 1.6 1999/10/01 01:08:30 angelos Exp $ */
+/* $OpenBSD: keynote-sign.c,v 1.7 1999/10/09 06:59:37 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -43,8 +43,8 @@
#include <unistd.h>
#endif /* HAVE_IO_H */
-#include "keynote.h"
#include "header.h"
+#include "keynote.h"
void
signusage(void)
diff --git a/lib/libkeynote/keynote-sigver.c b/lib/libkeynote/keynote-sigver.c
index 0ac4dca8809..c32ca177eba 100644
--- a/lib/libkeynote/keynote-sigver.c
+++ b/lib/libkeynote/keynote-sigver.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keynote-sigver.c,v 1.5 1999/10/06 20:27:46 angelos Exp $ */
+/* $OpenBSD: keynote-sigver.c,v 1.6 1999/10/09 06:59:37 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -43,8 +43,8 @@
#include <unistd.h>
#endif /* HAVE_IO_H */
-#include "keynote.h"
#include "header.h"
+#include "keynote.h"
void
sigverusage(void)
diff --git a/lib/libkeynote/keynote-ver.l b/lib/libkeynote/keynote-ver.l
index 181de235d0a..08e7cab74a6 100644
--- a/lib/libkeynote/keynote-ver.l
+++ b/lib/libkeynote/keynote-ver.l
@@ -1,5 +1,5 @@
%{
-/* $OpenBSD: keynote-ver.l,v 1.4 1999/10/06 20:27:46 angelos Exp $ */
+/* $OpenBSD: keynote-ver.l,v 1.5 1999/10/09 06:59:37 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -47,8 +47,10 @@
#endif
#include "z.tab.h"
-#include "keynote.h"
#include "header.h"
+#include "keynote.h"
+
+static void mystrncpy(char *, char *, int);
%}
vstring [a-zA-Z0-9][a-zA-Z0-9_]*
litstring \"(([^\"\n])|(\\[\"\n\f\r\t.]))*\"
diff --git a/lib/libkeynote/keynote-ver.y b/lib/libkeynote/keynote-ver.y
index f2ad406eefb..7da60717606 100644
--- a/lib/libkeynote/keynote-ver.y
+++ b/lib/libkeynote/keynote-ver.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: keynote-ver.y,v 1.4 1999/10/06 20:27:46 angelos Exp $ */
+/* $OpenBSD: keynote-ver.y,v 1.5 1999/10/09 06:59:37 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -40,8 +40,8 @@
#include <string.h>
#endif /* STDC_HEADERS */
-#include "keynote.h"
#include "header.h"
+#include "keynote.h"
%}
%%
diff --git a/lib/libkeynote/keynote-verify.c b/lib/libkeynote/keynote-verify.c
index 2166ec74d06..16dba2baf50 100644
--- a/lib/libkeynote/keynote-verify.c
+++ b/lib/libkeynote/keynote-verify.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keynote-verify.c,v 1.5 1999/10/06 20:27:46 angelos Exp $ */
+/* $OpenBSD: keynote-verify.c,v 1.6 1999/10/09 06:59:37 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -54,8 +54,8 @@
#include <unistd.h>
#endif /* HAVE_IO_H */
-#include "keynote.h"
#include "header.h"
+#include "keynote.h"
void
verifyusage(void)
diff --git a/lib/libkeynote/keynote.3 b/lib/libkeynote/keynote.3
index 820b5ecde67..f1adb669eb1 100644
--- a/lib/libkeynote/keynote.3
+++ b/lib/libkeynote/keynote.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: keynote.3,v 1.12 1999/10/09 06:34:14 angelos Exp $
+.\" $OpenBSD: keynote.3,v 1.13 1999/10/09 06:59:37 angelos Exp $
.\"
.\" The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
.\"
@@ -28,6 +28,8 @@
.Nm KeyNote
.Nd a trust-management system library
.Sh SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <regex.h>
.Fd #include <keynote.h>
.Bd -literal
diff --git a/lib/libkeynote/keynote.h b/lib/libkeynote/keynote.h
index b5226818bb0..a08a3e0ac4f 100644
--- a/lib/libkeynote/keynote.h
+++ b/lib/libkeynote/keynote.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: keynote.h,v 1.8 1999/10/01 01:43:13 angelos Exp $ */
+/* $OpenBSD: keynote.h,v 1.9 1999/10/09 06:59:37 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -22,21 +22,6 @@
#ifndef __KEYNOTE_H__
#define __KEYNOTE_H__
-#include <sys/types.h>
-#include <regex.h>
-
-#include <ssl/crypto.h>
-#include <ssl/dsa.h>
-#include <ssl/rsa.h>
-#include <ssl/sha.h>
-#include <ssl/md5.h>
-#include <ssl/err.h>
-#include <ssl/rand.h>
-#include <ssl/x509.h>
-#include <ssl/pem.h>
-
-#define KEYNOTERNDFILENAME "/dev/urandom"
-
struct environment
{
char *env_name;
diff --git a/lib/libkeynote/keynote.l b/lib/libkeynote/keynote.l
index 8dae7164fc6..6acbb727a47 100644
--- a/lib/libkeynote/keynote.l
+++ b/lib/libkeynote/keynote.l
@@ -1,5 +1,5 @@
%{
-/* $OpenBSD: keynote.l,v 1.3 1999/10/01 01:08:30 angelos Exp $ */
+/* $OpenBSD: keynote.l,v 1.4 1999/10/09 06:59:37 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -47,6 +47,7 @@
#endif
#include "k.tab.h"
+#include "header.h"
#include "keynote.h"
#include "assertion.h"
diff --git a/lib/libkeynote/keynote.y b/lib/libkeynote/keynote.y
index 0ff077d993b..5f1786f6124 100644
--- a/lib/libkeynote/keynote.y
+++ b/lib/libkeynote/keynote.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: keynote.y,v 1.3 1999/10/01 01:08:30 angelos Exp $ */
+/* $OpenBSD: keynote.y,v 1.4 1999/10/09 06:59:37 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -57,6 +57,7 @@
#include <string.h>
#endif /* STDC_HEADERS */
+#include "header.h"
#include "keynote.h"
#include "assertion.h"
diff --git a/lib/libkeynote/parse_assertion.c b/lib/libkeynote/parse_assertion.c
index 370c2356035..2e520b1c2ce 100644
--- a/lib/libkeynote/parse_assertion.c
+++ b/lib/libkeynote/parse_assertion.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse_assertion.c,v 1.3 1999/10/01 01:08:30 angelos Exp $ */
+/* $OpenBSD: parse_assertion.c,v 1.4 1999/10/09 06:59:37 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -36,6 +36,7 @@
#include <limits.h>
#endif /* HAVE_LIMITS_H */
+#include "header.h"
#include "keynote.h"
#include "assertion.h"
#include "signature.h"
diff --git a/lib/libkeynote/signature.c b/lib/libkeynote/signature.c
index adc43aae591..2e42362c4f1 100644
--- a/lib/libkeynote/signature.c
+++ b/lib/libkeynote/signature.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: signature.c,v 1.7 1999/10/01 01:08:30 angelos Exp $ */
+/* $OpenBSD: signature.c,v 1.8 1999/10/09 06:59:37 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -40,6 +40,7 @@
#include <limits.h>
#endif /* HAVE_LIMITS_H */
+#include "header.h"
#include "keynote.h"
#include "assertion.h"
#include "signature.h"