summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2000-10-13 13:11:51 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2000-10-13 13:11:51 +0000
commit55846713e34133e1474a7e4449f59c8fb0890227 (patch)
treef08e97d4b389f12058e040f833ae1dec959eb42c
parentc1f58a3434456782e25ab7161c0e17c0de3a4f34 (diff)
downloadgnutls-55846713e34133e1474a7e4449f59c8fb0890227.tar.gz
added a DER parser from Tarun and updated authors
-rw-r--r--AUTHORS1
-rw-r--r--configure.in2
-rw-r--r--lib/gnutls_cert.lex177
-rw-r--r--src/Makefile.am4
-rw-r--r--src/cli.c2
5 files changed, 182 insertions, 4 deletions
diff --git a/AUTHORS b/AUTHORS
index 414ef7da37..2084eadc52 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1 +1,2 @@
Nikos Mavroyanopoulos <nmav@hellug.gr>
+Tarun Upadhyay <tarun@ebprovider.com>
diff --git a/configure.in b/configure.in
index 67caebf87a..4fa82023c7 100644
--- a/configure.in
+++ b/configure.in
@@ -11,7 +11,7 @@ AC_DEFINE_UNQUOTED(T_OS, "$target_os")
GNUTLS_MAJOR_VERSION=0
GNUTLS_MINOR_VERSION=0
-GNUTLS_MICRO_VERSION=2
+GNUTLS_MICRO_VERSION=3
GNUTLS_VERSION=$GNUTLS_MAJOR_VERSION.$GNUTLS_MINOR_VERSION.$GNUTLS_MICRO_VERSION
diff --git a/lib/gnutls_cert.lex b/lib/gnutls_cert.lex
new file mode 100644
index 0000000000..66fc1f3aca
--- /dev/null
+++ b/lib/gnutls_cert.lex
@@ -0,0 +1,177 @@
+/* scanner for DER encoded certificates */
+
+/*
+ * Copyright (C) 2000 Tarun Upadhyay <tarun@ebprovider.com>
+ *
+ * This file is part of GNUTLS.
+ *
+ * GNUTLS is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GNUTLS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+%{
+ /* C declarations block */
+#define CHOP(C) ((c)&'\x7f')
+
+ unsigned long size;
+ unsigned long levels[64];
+ int current = 0;
+ unsigned long realsize;
+
+ void parselen(void){
+ int i;
+ char c;
+ printf("\tLEN: ");
+ c = input();
+ realsize = 2;
+ if (c & '\x80') {
+ printf("%d/", CHOP(c));
+ realsize += CHOP(c);
+ for (size=0, i = 0; i < CHOP(c); i++){
+ size <<= 8;
+ size += input();
+ }
+ }
+ else
+ size = c;
+ realsize += size;
+ printf("%d ", size);
+ }
+
+ void increaselevel(void){
+ levels[current++] = realsize;
+ levels[current] = 0;
+ }
+
+ void checklevel(void){
+ levels[current] += realsize;
+ if (levels[current] == levels[current-1])
+ }
+%}
+
+%%
+
+\x01 {
+ printf("\nBOOLEAN");
+ input();
+ printf("%d ", input());
+}
+
+\x02 {
+ int i;
+ printf("\nINTEGER");
+ parselen();
+ for (i = 0; i < size; i++)
+ printf("%x ", input());
+ size = 0;
+}
+
+\x03 |
+\x04 {
+ int i;
+ printf("\nBIT STRING");
+ parselen();
+ for (i = 0; i < size ; i++)
+ printf("%x ", input());
+ size = 0;
+}
+
+\x05 {
+ printf("\nNULL");
+ input();
+}
+
+\x06 {
+ int i;
+ printf("\nOID");
+ parselen();
+ for (i = 0; i < size ; i++)
+ printf("%x.", input());
+ size = 0;
+}
+
+\x13 |
+\x16 {
+ int i;
+ printf("\nSTRING");
+ parselen();
+ for (i = 0; i < size ; i++)
+ printf("%c", input());
+ size = 0;
+}
+
+\x17 {
+ char c;
+ printf("\nUTC TIME");
+ parselen();
+ c = input();
+
+ /* year */
+ if (c <= '4')
+ printf("20");
+ else
+ printf("19");
+ printf("%c", c);
+ printf("%c", input());
+
+ /* month */
+ printf("/%c", input());
+ printf("%c", input());
+
+ /* day */
+ printf("/%c", input());
+ printf("%c", input());
+
+ /* hours */
+ printf(" %c", input());
+ printf("%c", input());
+
+ /* minutes */
+ printf(":%c", input());
+ printf("%c", input());
+
+ /* seconds */
+ printf(":%c", input());
+ printf("%c", input());
+
+ input();
+}
+
+[\xa0-\xaf] {
+ int i;
+ printf("\nARRAY[%d]", yytext[0] & '\x07');
+ parselen();
+ increaselevel();
+}
+
+\x30 {
+ printf("\nSEQUENCE");
+ parselen();
+ increaselevel();
+}
+
+\x31 {
+ printf("\nSET");
+ parselen();
+ increaselevel();
+}
+
+%%
+
+main (int argc, char ** argv){
+ yyin = stdin;
+ yylex();
+ printf("\n");
+}
+
diff --git a/src/Makefile.am b/src/Makefile.am
index 34769a9c75..dc4bd9abf3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,7 @@
EXTRA_DIST = port.h
noinst_PROGRAMS = serv cli
serv_SOURCES = serv.c
-serv_LDADD = ../lib/libgnutls.la -lgcrypt
+serv_LDADD = ../lib/libgnutls.la $(GCRYPT_LIBS)
cli_SOURCES = cli.c
-cli_LDADD = ../lib/libgnutls.la -lgcrypt
+cli_LDADD = ../lib/libgnutls.la $(GCRYPT_LIBS)
diff --git a/src/cli.c b/src/cli.c
index bb3e4a7637..e32369be01 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -98,7 +98,7 @@ int main()
gnutls_send( sd, state, buffer, strlen(buffer));
}
gnutls_close(sd, state);
-
+
shutdown( sd, SHUT_WR);
gnutls_deinit(&state);