summaryrefslogtreecommitdiff
path: root/lib/libkeynote
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>1999-05-31 20:10:01 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>1999-05-31 20:10:01 +0000
commit5b9b4546172d8ee78fb8946941ec6e490a67d76a (patch)
tree81b01493f156e6239f4d2fd7db386f01c4fce4d8 /lib/libkeynote
parenta96d5d8ab75b6309c1dd8f9940fa8ed8f7fcc88e (diff)
Sanitize prototypes and variable extern definitions, remove
unnecessary header file, add prototypes header file for utility building.
Diffstat (limited to 'lib/libkeynote')
-rw-r--r--lib/libkeynote/Makefile6
-rw-r--r--lib/libkeynote/Makefile.distribution30
-rw-r--r--lib/libkeynote/assertion.h105
-rw-r--r--lib/libkeynote/aux.c7
-rw-r--r--lib/libkeynote/base64.c4
-rw-r--r--lib/libkeynote/environment.c29
-rw-r--r--lib/libkeynote/environment.h68
-rw-r--r--lib/libkeynote/header.h49
-rw-r--r--lib/libkeynote/keynote-keygen.c14
-rw-r--r--lib/libkeynote/keynote-main.c6
-rw-r--r--lib/libkeynote/keynote-sign.c14
-rw-r--r--lib/libkeynote/keynote-sigver.c7
-rw-r--r--lib/libkeynote/keynote-ver.l11
-rw-r--r--lib/libkeynote/keynote-ver.y11
-rw-r--r--lib/libkeynote/keynote-verify.c9
-rw-r--r--lib/libkeynote/keynote.h9
-rw-r--r--lib/libkeynote/keynote.l18
-rw-r--r--lib/libkeynote/keynote.y20
-rw-r--r--lib/libkeynote/parse_assertion.c12
-rw-r--r--lib/libkeynote/signature.c6
-rw-r--r--lib/libkeynote/signature.h9
21 files changed, 218 insertions, 226 deletions
diff --git a/lib/libkeynote/Makefile b/lib/libkeynote/Makefile
index e69d6b39f8b..9c0399326c7 100644
--- a/lib/libkeynote/Makefile
+++ b/lib/libkeynote/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.3 1999/05/31 18:30:49 angelos Exp $
+# $OpenBSD: Makefile,v 1.4 1999/05/31 20:09:58 angelos Exp $
LIB= keynote
MAN= keynote.3 keynote.4
@@ -13,10 +13,10 @@ SRCS= k.tab.c lex.kn.c environment.c parse_assertion.c signature.c aux.c \
CLEANFILES+= k.tab.c lex.kn.c k.tab.h
-k.tab.c: keynote.y environment.h signature.h
+k.tab.c: keynote.y keynote.h signature.h
$(YACC.y) $(YACCFLAGS) ${.CURDIR}/keynote.y
-lex.kn.c: keynote.l keynote.y environment.h assertion.h signature.h
+lex.kn.c: keynote.l keynote.y keynote.h assertion.h signature.h
$(LEX.l) $(LEXFLAGS) ${.CURDIR}/keynote.l
includes:
diff --git a/lib/libkeynote/Makefile.distribution b/lib/libkeynote/Makefile.distribution
index 6be3e12d2f1..33846c29069 100644
--- a/lib/libkeynote/Makefile.distribution
+++ b/lib/libkeynote/Makefile.distribution
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.distribution,v 1.3 1999/05/31 18:29:17 angelos Exp $
+# $OpenBSD: Makefile.distribution,v 1.4 1999/05/31 20:09:58 angelos Exp $
#
# The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
#
@@ -86,32 +86,30 @@ $(TARGET): $(OBJS)
$(TARGET2): $(TARGET) $(OBJS2)
$(CC) $(CFLAGS) -o $(TARGET2) $(OBJS2) $(LIBS)
-k.tab.c: keynote.y environment.h signature.h
+k.tab.c: keynote.y keynote.h assertion.h
$(YACC) $(YACCFLAGS) keynote.y
-z.tab.c: keynote-ver.y keynote.h
+z.tab.c: keynote-ver.y keynote.h header.h
$(YACC) $(YACCFLAGS2) keynote-ver.y
-lex.kn.c: keynote.l k.tab.h environment.h assertion.h signature.h
+lex.kn.c: keynote.l k.tab.h keynote.h assertion.h
$(LEX) $(LEXFLAGS) keynote.l
-lex.kv.c: keynote-ver.l z.tab.h keynote.h
+lex.kv.c: keynote-ver.l z.tab.h keynote.h header.h
$(LEX) $(LEXFLAGS2) keynote-ver.l
.c.o:
$(CC) $(CFLAGS) $(DEFS) $(INC) -c $<
-aux.c: environment.h signature.h
-parse_assertion.c: assertion.h environment.h signature.h
-environment.c: environment.h
-keynote-verify.c: keynote.h
-environment.h: keynote.h
-assertion.h: keynote.h
-signature.h: assertion.h
-signature.c: signature.h
-keynote-keygen.c: signature.h
-keynote-sign.c: signature.h
-keynote-sigver.c: signature.h
+aux.c: keynote.h assertion.h signature.h
+parse_assertion.c: keynote.h assertion.h signature.h
+environment.c: keynote.h assertion.h
+keynote-verify.c: keynote.h header.h
+signature.c: keynote.h assertion.h signature.h
+keynote-keygen.c: keynote.h assertion.h signature.h header.h
+keynote-sign.c: keynote.h header.h
+keynote-sigver.c: keynote.h header.h
+keynote-main.c: header.h
base64.c: keynote.h
clean:
diff --git a/lib/libkeynote/assertion.h b/lib/libkeynote/assertion.h
index d559e52beeb..90ea6427003 100644
--- a/lib/libkeynote/assertion.h
+++ b/lib/libkeynote/assertion.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: assertion.h,v 1.1 1999/05/23 22:11:03 angelos Exp $ */
-
+/* $OpenBSD: assertion.h,v 1.2 1999/05/31 20:09:58 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -23,7 +22,28 @@
#ifndef __ASSERTION_H__
#define __ASSERTION_H__
-#include "keynote.h"
+/*
+ * These can be changed to reflect more assertions/session or more
+ * sessions respectively
+ */
+#define HASHTABLESIZE 37
+#define SESSIONTABLESIZE 37
+
+struct keynote_session
+{
+ int ks_id;
+ int ks_assertioncounter;
+ int ks_values_num;
+ struct environment *ks_env_table[HASHTABLESIZE];
+ struct environment *ks_env_regex;
+ struct keylist *ks_action_authorizers;
+ struct assertion *ks_assertion_table[HASHTABLESIZE];
+ char **ks_values;
+ char *ks_authorizers_cache;
+ char *ks_values_cache;
+ struct keynote_session *ks_prev;
+ struct keynote_session *ks_next;
+};
struct keylist
{
@@ -70,8 +90,6 @@ struct assertion
#define ASSERT_IFLAG_NEEDPROC 0x0008 /* Needs "key field" processing */
#define ASSERT_IFLAG_PROCESSED 0x0010 /* Handled repositioning already */
-extern struct assertion *keynote_current_assertion;
-
#define KRESULT_UNTOUCHED 0
#define KRESULT_IN_PROGRESS 1 /* For cycle detection */
#define KRESULT_DONE 2
@@ -86,21 +104,68 @@ extern struct assertion *keynote_current_assertion;
#define KEYNOTE_FLAG_EXPORTALL 0x1
+/* List types for cleanup */
#define LEXTYPE_CHAR 0x1
-struct keylist *keynote_keylist_find(struct keylist *, char *);
-struct assertion *keynote_parse_assertion(char *, int, int);
-int keynote_evaluate_authorizer(struct assertion *, int);
-struct assertion *keynote_find_assertion(void *, int, int);
-int keynote_evaluate_assertion(struct assertion *);
-int keynote_parse_keypred(struct assertion *, int);
-int keynote_keylist_add(struct keylist **, char *);
-int keynote_add_htable(struct assertion *, int);
-void keynote_free_assertion(struct assertion *);
-void keynote_keylist_free(struct keylist *);
-int keynote_in_authorizers(void *, int);
-char *keynote_get_private_key(char *);
-int keynote_evaluate_query(void);
-int keynote_lex_add(void *, int);
-void keynote_lex_remove(void *);
+/* Length of random initializer */
+#define KEYNOTE_RAND_INIT_LEN 1024
+
+/* Variables */
+extern char **keynote_values;
+extern char *keynote_privkey;
+
+extern struct assertion *keynote_current_assertion;
+
+extern struct environment *keynote_init_list;
+extern struct environment *keynote_temp_list;
+
+extern struct keylist *keynote_keypred_keylist;
+
+extern struct keynote_session *keynote_sessions[SESSIONTABLESIZE];
+extern struct keynote_session *keynote_current_session;
+
+extern int keynote_exceptionflag;
+extern int keynote_used_variable;
+extern int keynote_returnvalue;
+extern int keynote_justrecord;
+extern int keynote_donteval;
+extern int keynote_errno;
+
+/* Extern definitions */
+extern int knlineno;
+
+/* Function prototypes */
+extern int keynote_env_add(char *, char *, struct environment **, u_int, int);
+extern char *keynote_env_lookup(char *, struct environment **, u_int);
+extern int keynote_env_delete(char *, struct environment **, u_int);
+extern struct keylist *keynote_keylist_find(struct keylist *, char *);
+extern struct environment *keynote_get_envlist(char *, char *, int);
+extern struct assertion *keynote_parse_assertion(char *, int, int);
+extern int keynote_evaluate_authorizer(struct assertion *, int);
+extern struct assertion *keynote_find_assertion(void *, int, int);
+extern void keynote_env_cleanup(struct environment **, u_int);
+extern int keynote_get_key_algorithm(char *, int *, int *);
+extern int keynote_sigverify_assertion(struct assertion *);
+extern int keynote_evaluate_assertion(struct assertion *);
+extern int keynote_parse_keypred(struct assertion *, int);
+extern int keynote_keylist_add(struct keylist **, char *);
+extern int keynote_add_htable(struct assertion *, int);
+extern void keynote_free_assertion(struct assertion *);
+extern int keynote_in_action_authorizers(void *, int);
+extern struct keynote_session *keynote_find_session(int);
+extern void keynote_keylist_free(struct keylist *);
+extern void keynote_free_env(struct environment *);
+extern int keynote_in_authorizers(void *, int);
+extern int keynote_sremove_assertion(int, int);
+extern u_int keynote_stringhash(char *, u_int);
+extern char *keynote_get_private_key(char *);
+extern void keynote_free_key(void *, int);
+extern int keynote_evaluate_query(void);
+extern int keynote_lex_add(void *, int);
+extern void keynote_lex_remove(void *);
+extern void keynote_cleanup_kth(void);
+extern int keynote_retindex(char *);
+extern void knerror(char *);
+extern int knparse();
+extern int knlex();
#endif /* __ASSERTION_H__ */
diff --git a/lib/libkeynote/aux.c b/lib/libkeynote/aux.c
index aa10ba0d049..425a07451a1 100644
--- a/lib/libkeynote/aux.c
+++ b/lib/libkeynote/aux.c
@@ -1,5 +1,4 @@
-/* $OpenBSD: aux.c,v 1.2 1999/05/25 21:42:20 angelos Exp $ */
-
+/* $OpenBSD: aux.c,v 1.3 1999/05/31 20:09:58 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -29,7 +28,9 @@
#ifndef PILOT
#include <time.h>
#endif /* PILOT */
-#include "environment.h"
+
+#include "keynote.h"
+#include "assertion.h"
#include "signature.h"
/*
diff --git a/lib/libkeynote/base64.c b/lib/libkeynote/base64.c
index 51331ff8c21..284d48ec37f 100644
--- a/lib/libkeynote/base64.c
+++ b/lib/libkeynote/base64.c
@@ -1,5 +1,4 @@
-/* $OpenBSD: base64.c,v 1.1 1999/05/23 22:11:06 angelos Exp $ */
-
+/* $OpenBSD: base64.c,v 1.2 1999/05/31 20:09:58 angelos Exp $ */
/*
* Copyright (c) 1996 by Internet Software Consortium.
*
@@ -47,6 +46,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
#include "keynote.h"
#define Assert(Cond) if (!(Cond)) return -1;
diff --git a/lib/libkeynote/environment.c b/lib/libkeynote/environment.c
index a8c0fce540d..232f98aaaf9 100644
--- a/lib/libkeynote/environment.c
+++ b/lib/libkeynote/environment.c
@@ -1,5 +1,4 @@
-/* $OpenBSD: environment.c,v 1.1 1999/05/23 22:11:04 angelos Exp $ */
-
+/* $OpenBSD: environment.c,v 1.2 1999/05/31 20:09:58 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -31,16 +30,30 @@
#include <unistd.h>
#endif
-#include "environment.h"
-#include "signature.h"
+#include "keynote.h"
+#include "assertion.h"
static int sessioncounter = 0;
-/* Globals */
+char **keynote_values = (char **) NULL;
+char *keynote_privkey = (char *) NULL;
+
+struct assertion *keynote_current_assertion = (struct assertion *) NULL;
+
+struct environment *keynote_init_list = (struct environment *) NULL;
+struct environment *keynote_temp_list = (struct environment *) NULL;
+
+struct keylist *keynote_keypred_keylist = (struct keylist *) NULL;
+
struct keynote_session *keynote_sessions[SESSIONTABLESIZE];
-struct keynote_session *keynote_current_session;
-int keynote_justrecord = 0;
-int keynote_returnvalue = 0;
+struct keynote_session *keynote_current_session = NULL;
+
+int keynote_exceptionflag = 0;
+int keynote_used_variable = 0;
+int keynote_returnvalue = 0;
+int keynote_justrecord = 0;
+int keynote_donteval = 0;
+int keynote_errno = 0;
/*
* Construct the _ACTION_AUTHORIZERS variable value.
diff --git a/lib/libkeynote/environment.h b/lib/libkeynote/environment.h
deleted file mode 100644
index 5baba46e290..00000000000
--- a/lib/libkeynote/environment.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $OpenBSD: environment.h,v 1.1 1999/05/23 22:11:04 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,
- * in April-May 1998
- *
- * Copyright (C) 1998, 1999 by Angelos D. Keromytis.
- *
- * Permission to use, copy, and modify this software without fee
- * is hereby granted, provided that this entire notice is included in
- * all copies of any software which is or includes a copy or
- * modification of this software.
- *
- * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO
- * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
- * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
- * PURPOSE.
- */
-
-#ifndef __ENVIRONMENT_H__
-#define __ENVIRONMENT_H__
-
-#include "keynote.h"
-
-#define KEYNOTE_RAND_INIT_LEN 1024
-
-/*
- * These can be changed to reflect more assertions/session or more
- * sessions respectively
- */
-#define HASHTABLESIZE 37
-#define SESSIONTABLESIZE 37
-
-struct keynote_session
-{
- int ks_id;
- int ks_assertioncounter;
- int ks_values_num;
- struct environment *ks_env_table[HASHTABLESIZE];
- struct environment *ks_env_regex;
- struct keylist *ks_action_authorizers;
- struct assertion *ks_assertion_table[HASHTABLESIZE];
- char **ks_values;
- char *ks_authorizers_cache;
- char *ks_values_cache;
- struct keynote_session *ks_prev;
- struct keynote_session *ks_next;
-};
-
-int keynote_env_add(char *, char *, struct environment **, u_int, int);
-char *keynote_env_lookup(char *, struct environment **, u_int);
-int keynote_env_delete(char *, struct environment **, u_int);
-struct environment *keynote_get_envlist(char *, char *, int);
-void keynote_env_cleanup(struct environment **, u_int);
-struct keynote_session *keynote_find_session(int);
-void keynote_free_env(struct environment *);
-int keynote_sremove_assertion(int, int);
-u_int keynote_stringhash(char *, u_int);
-void keynote_cleanup_kth(void);
-int keynote_retindex(char *);
-
-extern struct keynote_session *keynote_current_session;
-extern int keynote_returnvalue;
-extern int keynote_justrecord;
-#endif /* __ENVIRONMENT_H__ */
diff --git a/lib/libkeynote/header.h b/lib/libkeynote/header.h
new file mode 100644
index 00000000000..29752468e4d
--- /dev/null
+++ b/lib/libkeynote/header.h
@@ -0,0 +1,49 @@
+/* $OpenBSD: header.h,v 1.1 1999/05/31 20:09:59 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,
+ * in April-May 1998
+ *
+ * Copyright (C) 1998, 1999 by Angelos D. Keromytis.
+ *
+ * Permission to use, copy, and modify this software without fee
+ * is hereby granted, provided that this entire notice is included in
+ * all copies of any software which is or includes a copy or
+ * modification of this software.
+ *
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO
+ * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
+ * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
+ * PURPOSE.
+ */
+
+#ifndef _HEADER_H_
+#define _HEADER_H_
+
+/* Functions */
+extern int keynote_sign(int, char **), keynote_sigver(int, char **);
+extern int 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 *);
+extern int kvparse(), kvlex();
+extern void kverror(char *);
+
+/* Variables */
+int sessid;
+
+/* Defines */
+#define SEED_LEN 40
+#define RND_BYTES 1024
+#define DEFAULT_PUBLIC 0x10001
+
+#define KEY_PRINT_OFFSET 12
+#define KEY_PRINT_LENGTH 50
+
+#define SIG_PRINT_OFFSET 12
+#define SIG_PRINT_LENGTH 50
+#endif /* _HEADER_H_ */
diff --git a/lib/libkeynote/keynote-keygen.c b/lib/libkeynote/keynote-keygen.c
index 745f8bb58ea..06cca5c14ee 100644
--- a/lib/libkeynote/keynote-keygen.c
+++ b/lib/libkeynote/keynote-keygen.c
@@ -1,5 +1,4 @@
-/* $OpenBSD: keynote-keygen.c,v 1.2 1999/05/24 01:29:22 angelos Exp $ */
-
+/* $OpenBSD: keynote-keygen.c,v 1.3 1999/05/31 20:09:59 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -34,9 +33,10 @@
#include <unistd.h>
#endif /* WIN32 */
+#include "keynote.h"
+#include "assertion.h"
#include "signature.h"
-
-#define DEFAULT_PUBLIC 0x10001
+#include "header.h"
void
keygenusage(void)
@@ -47,12 +47,6 @@ keygenusage(void)
"<print-length>]\n");
}
-#define SEED_LEN 40
-#define RND_BYTES 1024
-
-#define KEY_PRINT_OFFSET 12
-#define KEY_PRINT_LENGTH 50
-
/*
* Print the specified number of spaces.
*/
diff --git a/lib/libkeynote/keynote-main.c b/lib/libkeynote/keynote-main.c
index f1c703eea3f..65127e338c4 100644
--- a/lib/libkeynote/keynote-main.c
+++ b/lib/libkeynote/keynote-main.c
@@ -1,5 +1,4 @@
-/* $OpenBSD: keynote-main.c,v 1.3 1999/05/24 02:11:41 angelos Exp $ */
-
+/* $OpenBSD: keynote-main.c,v 1.4 1999/05/31 20:09:59 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -35,8 +34,7 @@
#include <unistd.h>
#endif /* WIN32 */
-extern int keynote_sign(int, char **), keynote_sigver(int, char **);
-extern int keynote_verify(int, char **), keynote_keygen(int, char **);
+#include "header.h"
void
mainusage()
diff --git a/lib/libkeynote/keynote-sign.c b/lib/libkeynote/keynote-sign.c
index f24de988a0d..37fb931a4ec 100644
--- a/lib/libkeynote/keynote-sign.c
+++ b/lib/libkeynote/keynote-sign.c
@@ -1,5 +1,4 @@
-/* $OpenBSD: keynote-sign.c,v 1.4 1999/05/31 18:29:18 angelos Exp $ */
-
+/* $OpenBSD: keynote-sign.c,v 1.5 1999/05/31 20:09:59 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -35,14 +34,8 @@
#include <unistd.h>
#endif /* WIN32 */
-#include "assertion.h"
-#include "signature.h"
-
-#define SIG_PRINT_OFFSET 12
-#define SIG_PRINT_LENGTH 50
-
-extern void print_key(FILE *, char *, char *, int, int);
-extern void print_space(FILE *, int);
+#include "keynote.h"
+#include "header.h"
void
signusage(void)
@@ -52,7 +45,6 @@ signusage(void)
"<PrivateKeyFile>\n");
}
-
#ifdef WIN32
void
#else /* WIN32 */
diff --git a/lib/libkeynote/keynote-sigver.c b/lib/libkeynote/keynote-sigver.c
index a7eafdec2aa..11cc0c3e169 100644
--- a/lib/libkeynote/keynote-sigver.c
+++ b/lib/libkeynote/keynote-sigver.c
@@ -1,5 +1,4 @@
-/* $OpenBSD: keynote-sigver.c,v 1.2 1999/05/24 01:29:22 angelos Exp $ */
-
+/* $OpenBSD: keynote-sigver.c,v 1.3 1999/05/31 20:09:59 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -35,8 +34,8 @@
#include <unistd.h>
#endif /* WIN32 */
-#include "assertion.h"
-#include "signature.h"
+#include "keynote.h"
+#include "header.h"
void
sigverusage(void)
diff --git a/lib/libkeynote/keynote-ver.l b/lib/libkeynote/keynote-ver.l
index 9084d8e6ad5..d50101f1e3d 100644
--- a/lib/libkeynote/keynote-ver.l
+++ b/lib/libkeynote/keynote-ver.l
@@ -1,6 +1,5 @@
%{
-/* $OpenBSD: keynote-ver.l,v 1.1 1999/05/23 22:11:04 angelos Exp $ */
-
+/* $OpenBSD: keynote-ver.l,v 1.2 1999/05/31 20:09:59 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -26,12 +25,10 @@
#include <ctype.h>
#include <time.h>
#include <string.h>
+
#include "z.tab.h"
#include "keynote.h"
-
-static void mystrncpy(char *, char *, int);
-
-extern int kvparse();
+#include "header.h"
%}
string ([a-zA-Z])([a-zA-Z0-9_-])*
vstring [a-zA-Z0-9][a-zA-Z0-9_]*
@@ -142,7 +139,7 @@ get_octal(char *s, int len, int *adv)
* care of escaped characters in the process. String s1 is assumed
* to have enough space, and be zero'ed.
*/
-static void
+void
mystrncpy(char *s1, char *s2, int len)
{
unsigned char c;
diff --git a/lib/libkeynote/keynote-ver.y b/lib/libkeynote/keynote-ver.y
index 204a5b1dbea..8da630254ad 100644
--- a/lib/libkeynote/keynote-ver.y
+++ b/lib/libkeynote/keynote-ver.y
@@ -1,5 +1,4 @@
-/* $OpenBSD: keynote-ver.y,v 1.1 1999/05/23 22:11:04 angelos Exp $ */
-
+/* $OpenBSD: keynote-ver.y,v 1.2 1999/05/31 20:09:59 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -33,13 +32,9 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include "keynote.h"
-
-void kverror(char *);
-extern int kvlex();
-
-extern int sessid;
+#include "keynote.h"
+#include "header.h"
%}
%%
diff --git a/lib/libkeynote/keynote-verify.c b/lib/libkeynote/keynote-verify.c
index 4477fbcc961..64dd8b4419a 100644
--- a/lib/libkeynote/keynote-verify.c
+++ b/lib/libkeynote/keynote-verify.c
@@ -1,5 +1,4 @@
-/* $OpenBSD: keynote-verify.c,v 1.2 1999/05/24 01:29:22 angelos Exp $ */
-
+/* $OpenBSD: keynote-verify.c,v 1.3 1999/05/31 20:09:59 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -39,11 +38,7 @@
#endif /* WIN32 */
#include "keynote.h"
-
-extern int read_environment(char *);
-extern void parse_key(char *);
-
-int sessid;
+#include "header.h"
void
verifyusage(void)
diff --git a/lib/libkeynote/keynote.h b/lib/libkeynote/keynote.h
index 3d37fa57c0e..0fbfc449fe9 100644
--- a/lib/libkeynote/keynote.h
+++ b/lib/libkeynote/keynote.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: keynote.h,v 1.3 1999/05/31 18:29:18 angelos Exp $ */
-
+/* $OpenBSD: keynote.h,v 1.4 1999/05/31 20:09:59 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -20,8 +19,8 @@
* PURPOSE.
*/
-#ifndef _KEYNOTE_H_
-#define _KEYNOTE_H_
+#ifndef __KEYNOTE_H__
+#define __KEYNOTE_H__
#include <regex.h>
@@ -194,4 +193,4 @@ char *kn_encode_key(struct keynote_deckey *, int, int, int);
/* Crypto API */
char *kn_sign_assertion(char *, int, char *, char *, int);
int kn_verify_assertion(char *, int);
-#endif /* _KEYNOTE_H_ */
+#endif /* __KEYNOTE_H__ */
diff --git a/lib/libkeynote/keynote.l b/lib/libkeynote/keynote.l
index d1e4eb6235d..b4972435ca1 100644
--- a/lib/libkeynote/keynote.l
+++ b/lib/libkeynote/keynote.l
@@ -1,6 +1,5 @@
%{
-/* $OpenBSD: keynote.l,v 1.1 1999/05/23 22:11:05 angelos Exp $ */
-
+/* $OpenBSD: keynote.l,v 1.2 1999/05/31 20:09:59 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -28,13 +27,12 @@
#include <time.h>
#endif /* PILOT */
#include <string.h>
+
#include "k.tab.h"
-#include "environment.h"
+#include "keynote.h"
#include "assertion.h"
-#include "signature.h"
static void mystrncpy(char *, char *, int);
-extern int knparse();
struct lex_list
{
@@ -46,16 +44,6 @@ static struct lex_list *keynote_lex_list = (struct lex_list *) NULL;
static int keynote_max_lex_list = 32;
static int keynote_lex_counter = 0;
static int first_tok = 0;
-
-int keynote_used_variable = 0;
-int keynote_exceptionflag = 0;
-int keynote_donteval = 0;
-
-char *keynote_privkey = (char *) NULL;
-
-struct environment *keynote_init_list = (struct environment *) NULL;
-struct environment *keynote_temp_list = (struct environment *) NULL;
-struct keylist *keynote_keypred_keylist = (struct keylist *) NULL;
%}
digit [0-9]
specnumber [1-9][0-9]*
diff --git a/lib/libkeynote/keynote.y b/lib/libkeynote/keynote.y
index ca6c3fbf066..64c1e6443f4 100644
--- a/lib/libkeynote/keynote.y
+++ b/lib/libkeynote/keynote.y
@@ -1,5 +1,4 @@
-/* $OpenBSD: keynote.y,v 1.1 1999/05/23 22:11:05 angelos Exp $ */
-
+/* $OpenBSD: keynote.y,v 1.2 1999/05/31 20:09:59 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -51,8 +50,9 @@
#include <stdlib.h>
#include <ctype.h>
#include <regex.h>
-#include "environment.h"
-#include "signature.h"
+
+#include "keynote.h"
+#include "assertion.h"
static int *keynote_kth_array = (int *) NULL;
static int keylistcount = 0;
@@ -64,18 +64,6 @@ static int checkexception(int);
static char *my_lookup(char *);
static int intpow(int, int);
static int get_kth(int);
-
-extern int keynote_in_action_authorizers(void *, int);
-extern int knlex();
-
-extern int keynote_exceptionflag, keynote_donteval;
-extern char **keynote_values, *keynote_privkey;
-extern struct keylist *keynote_keypred_keylist;
-extern struct environment *keynote_temp_list;
-extern struct environment *keynote_init_list;
-extern int knlineno, keynote_used_variable;
-
-void knerror(char *);
%}
%%
diff --git a/lib/libkeynote/parse_assertion.c b/lib/libkeynote/parse_assertion.c
index 4427782d54e..1d39e34ecc9 100644
--- a/lib/libkeynote/parse_assertion.c
+++ b/lib/libkeynote/parse_assertion.c
@@ -1,5 +1,4 @@
-/* $OpenBSD: parse_assertion.c,v 1.1 1999/05/23 22:11:06 angelos Exp $ */
-
+/* $OpenBSD: parse_assertion.c,v 1.2 1999/05/31 20:09:59 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -26,16 +25,11 @@
#include <ctype.h>
#include <string.h>
#include <limits.h>
+
+#include "keynote.h"
#include "assertion.h"
-#include "environment.h"
#include "signature.h"
-/* Globals */
-struct assertion *keynote_current_assertion = (struct assertion *) NULL;
-int keynote_errno = 0;
-
-extern int keynote_in_action_authorizers(void *, int);
-
/*
* Recurse on graph discovery.
*/
diff --git a/lib/libkeynote/signature.c b/lib/libkeynote/signature.c
index ee05bf14b27..c3d29da4655 100644
--- a/lib/libkeynote/signature.c
+++ b/lib/libkeynote/signature.c
@@ -1,5 +1,4 @@
-/* $OpenBSD: signature.c,v 1.3 1999/05/31 18:29:19 angelos Exp $ */
-
+/* $OpenBSD: signature.c,v 1.4 1999/05/31 20:10:00 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -29,6 +28,9 @@
#include <stdlib.h>
#include <limits.h>
#include <string.h>
+
+#include "keynote.h"
+#include "assertion.h"
#include "signature.h"
static const char hextab[] = {
diff --git a/lib/libkeynote/signature.h b/lib/libkeynote/signature.h
index 03d23d825d7..665b9038448 100644
--- a/lib/libkeynote/signature.h
+++ b/lib/libkeynote/signature.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: signature.h,v 1.2 1999/05/25 21:42:23 angelos Exp $ */
-
+/* $OpenBSD: signature.h,v 1.3 1999/05/31 20:10:00 angelos Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -54,10 +53,4 @@
#define KEYNOTE_PRIVATE_KEY_PREFIX_LEN strlen(KEYNOTE_PRIVATE_KEY_PREFIX)
#define LARGEST_HASH_SIZE 20 /* In bytes, length of SHA1 hash */
-
-#include "assertion.h"
-
-int keynote_get_key_algorithm(char *, int *, int *);
-int keynote_sigverify_assertion(struct assertion *);
-void keynote_free_key(void *, int);
#endif /* __SIGNATURE_H__ */