summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2002-03-20 12:21:51 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2002-03-20 12:21:51 +0000
commit9409242790e0363d0c2d779c1897a4fe089739a1 (patch)
tree0a79ee5245d2fbd0941521a0d031e4fa4fc8af99
parentc2a598b64f17b05cb0c00f2bbfa5fb88f4d43d08 (diff)
downloadgnutls-9409242790e0363d0c2d779c1897a4fe089739a1.tar.gz
Improved compression support. Corrected several bugs in empty
fragment sending and receiving.
-rw-r--r--lib/auth_cert.c11
-rw-r--r--lib/gnutls_cipher.c53
-rw-r--r--lib/gnutls_compress.c6
-rw-r--r--lib/gnutls_compress_int.c199
-rw-r--r--lib/gnutls_compress_int.h23
-rw-r--r--lib/gnutls_constate.c54
-rw-r--r--lib/gnutls_int.h5
-rw-r--r--lib/gnutls_state.c5
-rw-r--r--lib/x509_ASN.c928
-rwxr-xr-xlib/x509_ASN.y4
-rwxr-xr-xlib/x509_asn1.c3
11 files changed, 798 insertions, 493 deletions
diff --git a/lib/auth_cert.c b/lib/auth_cert.c
index db5c88abca..b00c1b0f73 100644
--- a/lib/auth_cert.c
+++ b/lib/auth_cert.c
@@ -751,17 +751,14 @@ int _gnutls_proc_x509_server_certificate(GNUTLS_STATE state, opaque * data,
}
i = dsize;
- DECR_LEN(dsize, 3);
- len = READuint24(p);
- p += 3;
-
- for (; i > 0; len = READuint24(p), p += 3) {
+ while(i > 0) {
+ DECR_LEN(dsize, 3);
+ len = READuint24(p);
+ p += 3;
DECR_LEN(dsize, len);
peer_certificate_list_size++;
p += len;
i -= len + 3;
- if (i > 0)
- DECR_LEN(dsize, 3);
}
if (peer_certificate_list_size == 0) {
diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c
index 15c4cad969..1c1cb456a0 100644
--- a/lib/gnutls_cipher.c
+++ b/lib/gnutls_cipher.c
@@ -46,10 +46,13 @@ int _gnutls_encrypt(GNUTLS_STATE state, const char* headers, int headers_size,
gnutls_datum comp, ciph;
int err;
- err = _gnutls_plaintext2TLSCompressed(state, &comp, plain);
- if (err < 0) {
- gnutls_assert();
- return err;
+ if (plain.size == 0) comp = plain;
+ else {
+ err = _gnutls_plaintext2TLSCompressed(state, &comp, plain);
+ if (err < 0) {
+ gnutls_assert();
+ return err;
+ }
}
err = _gnutls_compressed2TLSCiphertext(state, &ciph, comp, type, headers_size, random_pad);
@@ -58,7 +61,8 @@ int _gnutls_encrypt(GNUTLS_STATE state, const char* headers, int headers_size,
return err;
}
- gnutls_free_datum(&comp);
+ if (plain.size != 0) /* in that case it is not allocated */
+ gnutls_free_datum(&comp);
/* copy the headers */
memcpy( ciph.data, headers, headers_size);
@@ -78,6 +82,8 @@ int _gnutls_decrypt(GNUTLS_STATE state, char *ciphertext,
gnutls_datum gcipher;
int ret;
+ *data = NULL;
+
if (ciphertext_size == 0)
return 0;
@@ -89,14 +95,17 @@ int _gnutls_decrypt(GNUTLS_STATE state, char *ciphertext,
return ret;
}
- ret = _gnutls_TLSCompressed2plaintext(state, &gtxt, gcomp);
- if (ret < 0) {
+ if (gcomp.size==0) gtxt = gcomp;
+ else {
+ ret = _gnutls_TLSCompressed2plaintext(state, &gtxt, gcomp);
+ if (ret < 0) {
+ gnutls_free_datum(&gcomp);
+ return ret;
+ }
+
gnutls_free_datum(&gcomp);
- return ret;
}
-
- gnutls_free_datum(&gcomp);
-
+
ret = gtxt.size;
*data = gtxt.data;
@@ -351,19 +360,20 @@ int _gnutls_ciphertext2TLSCompressed(GNUTLS_STATE state,
return GNUTLS_E_UNKNOWN_CIPHER_TYPE;
}
+ if (length > 0) {
+ data = gnutls_malloc(length);
+ if (data==NULL) {
+ gnutls_assert();
+ return GNUTLS_E_MEMORY_ERROR;
+ }
+ } else data = NULL;
- data = gnutls_malloc(length);
- if (data==NULL) {
- gnutls_assert();
- return GNUTLS_E_MEMORY_ERROR;
+ if (data!=NULL) {
+ memcpy(data, ciphertext.data, length);
}
-
- memcpy(data, ciphertext.data, length);
compress->data = data;
compress->size = length;
-
-
c_length = CONVuint16((uint16) compress->size);
seq_num = CONVuint64( &state->connection_state.read_sequence_number);
@@ -376,7 +386,10 @@ int _gnutls_ciphertext2TLSCompressed(GNUTLS_STATE state,
gnutls_hmac(td, &minor, 1);
}
gnutls_hmac(td, &c_length, 2);
- gnutls_hmac(td, data, compress->size);
+
+ if (data!=NULL)
+ gnutls_hmac(td, data, compress->size);
+
if ( ver == GNUTLS_SSL3) { /* SSL 3.0 */
gnutls_mac_deinit_ssl3(td, MAC);
} else {
diff --git a/lib/gnutls_compress.c b/lib/gnutls_compress.c
index d2f0218e34..ff8dedf6de 100644
--- a/lib/gnutls_compress.c
+++ b/lib/gnutls_compress.c
@@ -33,7 +33,8 @@ int _gnutls_plaintext2TLSCompressed(GNUTLS_STATE state,
data=NULL;
- size = gnutls_compress( state->security_parameters.write_compression_algorithm, plaintext.data, plaintext.size, &data);
+ size = gnutls_compress( state->connection_state.write_compression_state,
+ plaintext.data, plaintext.size, &data, MAX_RECORD_SIZE+1024);
if (size < 0) {
gnutls_assert();
return GNUTLS_E_COMPRESSION_FAILED;
@@ -54,7 +55,8 @@ int _gnutls_TLSCompressed2plaintext(GNUTLS_STATE state,
data=NULL;
- size = gnutls_decompress( state->security_parameters.read_compression_algorithm, compressed.data, compressed.size, &data);
+ size = gnutls_decompress( state->connection_state.read_compression_state,
+ compressed.data, compressed.size, &data, MAX_RECORD_SIZE);
if (size < 0) {
gnutls_assert();
return GNUTLS_E_DECOMPRESSION_FAILED;
diff --git a/lib/gnutls_compress_int.c b/lib/gnutls_compress_int.c
index 489ef4f275..5a30c61b89 100644
--- a/lib/gnutls_compress_int.c
+++ b/lib/gnutls_compress_int.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000 Nikos Mavroyanopoulos
+ * Copyright (C) 2000,2002 Nikos Mavroyanopoulos
*
* This file is part of GNUTLS.
*
@@ -18,66 +18,134 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include "gnutls_int.h"
-#include "gnutls_compress.h"
+#include <gnutls_int.h>
+#include <gnutls_compress.h>
#include "gnutls_errors.h"
-#include "gnutls_compress_int.h"
+
+/* The flag d is the direction (compressed, decompress). Non zero is
+ * decompress.
+ */
+GNUTLS_COMP_HANDLE gnutls_comp_init( CompressionMethod method, int d)
+{
+#ifdef HAVE_LIBZ
+GNUTLS_COMP_HANDLE ret;
+int err;
+
+ if (method==GNUTLS_COMP_ZLIB) {
+ ret = gnutls_malloc( sizeof(z_stream));
+
+ if (ret==NULL) {
+ gnutls_assert();
+ return NULL;
+ }
+
+ ret->zalloc = (alloc_func)0;
+ ret->zfree = (free_func)0;
+ ret->opaque = (voidpf)0;
+
+ if (d)
+ err = inflateInit(ret);
+ else
+ err = deflateInit(ret, Z_DEFAULT_COMPRESSION);
+ if (err!=Z_OK) {
+ gnutls_assert();
+ gnutls_free( ret);
+ return NULL;
+ }
+
+ return ret;
+ }
+#endif
+ return NULL;
+}
+
+void gnutls_comp_deinit(GNUTLS_COMP_HANDLE handle, int d) {
#ifdef HAVE_LIBZ
-#include <zlib.h>
+int err;
+
+ if (handle!=NULL) {
+ if (d)
+ err = inflateEnd( handle);
+ else
+ err = deflateEnd( handle);
+ gnutls_free( handle);
+ if (err!=Z_OK) {
+ gnutls_assert();
+ return;
+ }
+ }
#endif
+ return;
+}
+
+/* These functions are memory consuming
+ */
-#define MAX_COMP_SIZE 17408 /* 2^14+1024 */
-int gnutls_compress( CompressionMethod algorithm, char* plain, int plain_size, char** compressed) {
-int compressed_size;
+int gnutls_compress( GNUTLS_COMP_HANDLE handle, char* plain, int plain_size, char** compressed, int max_comp_size) {
+int compressed_size=GNUTLS_E_COMPRESSION_FAILED;
#ifdef HAVE_LIBZ
uLongf size;
#endif
int err;
- switch (algorithm) {
- case GNUTLS_COMP_NULL:
+ if (handle==NULL) {
*compressed = gnutls_malloc(plain_size);
+ if (*compressed==NULL) {
+ gnutls_assert();
+ return GNUTLS_E_MEMORY_ERROR;
+ }
memcpy(*compressed, plain, plain_size);
compressed_size = plain_size;
- break;
+ }
#ifdef HAVE_LIBZ
- case GNUTLS_COMP_ZLIB:
- size = (plain_size*1.2)+12;
+ else {
+ size = (plain_size*2)+10;
*compressed=NULL;
- do {
- size += size;
- if (*compressed!=NULL) gnutls_free(*compressed);
- *compressed = gnutls_malloc(size);
- err = compress( *compressed, &size, plain, plain_size);
- } while(err==Z_BUF_ERROR && size <= MAX_COMP_SIZE);
- if (err!=Z_OK) {
- gnutls_free(*compressed);
- return GNUTLS_E_COMPRESSION_FAILED;
+
+ *compressed = gnutls_malloc(size);
+ if (*compressed==NULL) {
+ gnutls_assert();
+ return GNUTLS_E_MEMORY_ERROR;
}
- compressed_size = size;
- break;
-#endif
- default:
- *compressed=NULL;
- return GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM;
+
+ handle->next_in = (Bytef*) plain;
+ handle->avail_in = plain_size;
+ handle->next_out = (Bytef*) *compressed;
+ handle->avail_out = size;
+
+ err = deflate( handle, Z_SYNC_FLUSH);
+
+ if (err!=Z_OK || handle->avail_in != 0) {
+ gnutls_assert();
+ gnutls_free( *compressed);
+ return GNUTLS_E_COMPRESSION_FAILED;
+ }
+
+ compressed_size = size - handle->avail_out;
+
}
+#endif
- if (compressed_size > MAX_COMP_SIZE) {
+ if (compressed_size > max_comp_size) {
gnutls_free(*compressed);
return GNUTLS_E_COMPRESSION_FAILED;
}
+
return compressed_size;
}
-int gnutls_decompress( CompressionMethod algorithm, char* compressed, int compressed_size, char** plain) {
-int plain_size, err;
+int gnutls_decompress( GNUTLS_COMP_HANDLE handle, char* compressed, int compressed_size, char** plain, int max_record_size) {
+int plain_size=GNUTLS_E_DECOMPRESSION_FAILED, err;
#ifdef HAVE_LIBZ
uLongf size;
#endif
- if (compressed_size > MAX_COMP_SIZE) return GNUTLS_E_DECOMPRESSION_FAILED;
- switch (algorithm) {
- case GNUTLS_COMP_NULL:
+ if (compressed_size > max_record_size+1024) {
+ gnutls_assert();
+ return GNUTLS_E_DECOMPRESSION_FAILED;
+ }
+
+ if (handle==NULL) {
*plain = gnutls_malloc(compressed_size);
if (*plain==NULL) {
gnutls_assert();
@@ -86,28 +154,57 @@ uLongf size;
memcpy(*plain, compressed, compressed_size);
plain_size = compressed_size;
- break;
+ }
#ifdef HAVE_LIBZ
- case GNUTLS_COMP_ZLIB:
+ else {
*plain = NULL;
size = compressed_size;
+ plain_size = 0;
+
+ handle->next_in = (Bytef*) compressed;
+ handle->avail_in = compressed_size;
+
do {
- size += compressed_size;
- *plain = gnutls_realloc(*plain, size);
- if (*plain==NULL) return GNUTLS_E_MEMORY_ERROR;
-
- err = uncompress( *plain, &size, compressed, compressed_size);
- } while( err==Z_BUF_ERROR && size <= MAX_COMP_SIZE);
- if (err!=Z_OK) {
- gnutls_free(*plain);
- return GNUTLS_E_DECOMPRESSION_FAILED;
- }
- plain_size = size;
- break;
+ size*=2;
+ *plain = gnutls_realloc( *plain, size);
+ if (*plain==NULL) {
+ gnutls_assert();
+ return GNUTLS_E_MEMORY_ERROR;
+ }
+
+ handle->next_out = (Bytef*) *plain;
+ handle->avail_out = size;
+
+ err = inflate( handle, Z_SYNC_FLUSH);
+
+ } while( err==Z_BUF_ERROR && handle->avail_out==0 && size < max_record_size);
+
+#if 0
+ *plain = gnutls_malloc(2048);
+ size =2048;
+ handle->next_out = (Bytef*) *plain;
+ handle->avail_out = size;
+
+ err = inflate( handle, Z_SYNC_FLUSH);
+
#endif
- default:
- *plain=NULL;
- return GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM;
+
+ if (err!=Z_OK || handle->avail_in != 0) {
+ gnutls_assert();
+ gnutls_free( *plain);
+ return GNUTLS_E_DECOMPRESSION_FAILED;
+ }
+
+ plain_size = size - handle->avail_out;
+
}
+#endif
+
+ if (plain_size > max_record_size) {
+ gnutls_assert();
+ gnutls_free( *plain);
+ return GNUTLS_E_DECOMPRESSION_FAILED;
+ }
+
return plain_size;
}
diff --git a/lib/gnutls_compress_int.h b/lib/gnutls_compress_int.h
index ea0e6cf372..7026041dd2 100644
--- a/lib/gnutls_compress_int.h
+++ b/lib/gnutls_compress_int.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000 Nikos Mavroyanopoulos
+ * Copyright (C) 2000,2002 Nikos Mavroyanopoulos
*
* This file is part of GNUTLS.
*
@@ -18,5 +18,22 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-int gnutls_decompress( CompressionMethod algorithm, char* compressed, int compressed_size, char** plain);
-int gnutls_compress( CompressionMethod algorithm, char* plain, int plain_size, char** compressed);
+#ifndef GNUTLS_COMP_INT
+# define GNUTLS_COMP_INT
+
+#ifdef HAVE_LIBZ
+# include <zlib.h>
+# define GNUTLS_COMP_HANDLE z_stream*
+# define GNUTLS_COMP_FAILED NULL
+#else
+# define GNUTLS_COMP_HANDLE void*
+# define GNUTLS_COMP_FAILED NULL
+#endif
+
+GNUTLS_COMP_HANDLE gnutls_comp_init( CompressionMethod, int d);
+void gnutls_comp_deinit(GNUTLS_COMP_HANDLE handle, int d);
+
+int gnutls_decompress( GNUTLS_COMP_HANDLE handle, char* compressed, int compressed_size, char** plain, int max_record_size);
+int gnutls_compress( GNUTLS_COMP_HANDLE, char* plain, int plain_size, char** compressed, int max_comp_size);
+
+#endif
diff --git a/lib/gnutls_constate.c b/lib/gnutls_constate.c
index cea17c6620..e359ef1c40 100644
--- a/lib/gnutls_constate.c
+++ b/lib/gnutls_constate.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001 Nikos Mavroyanopoulos
+ * Copyright (C) 2001,2002 Nikos Mavroyanopoulos
*
* This file is part of GNUTLS.
*
@@ -283,6 +283,10 @@ int rc;
gnutls_cipher_deinit(state->connection_state.
read_cipher_state);
+ if (state->connection_state.read_compression_state != NULL)
+ gnutls_comp_deinit(state->connection_state.
+ read_compression_state, 1);
+
mac_size =
_gnutls_mac_get_digest_size(state->security_parameters.
@@ -307,6 +311,17 @@ int rc;
return GNUTLS_E_UNKNOWN_CIPHER;
}
+ state->connection_state.read_compression_state =
+ gnutls_comp_init(state->security_parameters.
+ read_compression_algorithm, 1);
+ if (state->connection_state.read_compression_state ==
+ GNUTLS_COMP_FAILED
+ && state->security_parameters.read_compression_algorithm !=
+ GNUTLS_COMP_NULL) {
+ gnutls_assert();
+ return GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM;
+ }
+
/* copy mac secrets from cipherspecs, to connection
* state.
*/
@@ -336,6 +351,18 @@ int rc;
return GNUTLS_E_UNKNOWN_CIPHER;
}
+ state->connection_state.read_compression_state =
+ gnutls_comp_init(state->security_parameters.
+ read_compression_algorithm, 1);
+
+ if (state->connection_state.read_compression_state ==
+ GNUTLS_COMP_FAILED
+ && state->security_parameters.read_compression_algorithm !=
+ GNUTLS_COMP_NULL) {
+ gnutls_assert();
+ return GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM;
+ }
+
/* copy mac secret to connection state
*/
@@ -428,6 +455,10 @@ int rc;
gnutls_cipher_deinit(state->connection_state.
write_cipher_state);
+ if (state->connection_state.write_compression_state != NULL)
+ gnutls_comp_deinit(state->connection_state.
+ write_compression_state, 0);
+
mac_size =
_gnutls_mac_get_digest_size(state->security_parameters.
write_mac_algorithm);
@@ -449,6 +480,16 @@ int rc;
return GNUTLS_E_UNKNOWN_CIPHER;
}
+ state->connection_state.write_compression_state =
+ gnutls_comp_init(state->security_parameters.write_compression_algorithm, 0);
+
+ if (state->connection_state.write_compression_state == GNUTLS_COMP_FAILED
+ && state->security_parameters.write_compression_algorithm != GNUTLS_COMP_NULL) {
+ gnutls_assert();
+ return GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM;
+ }
+
+
/* copy mac secrets from cipherspecs, to connection
* state.
*/
@@ -477,6 +518,17 @@ int rc;
return GNUTLS_E_UNKNOWN_CIPHER;
}
+ state->connection_state.write_compression_state =
+ gnutls_comp_init(state->security_parameters.write_compression_algorithm, 0);
+
+ if (state->connection_state.write_compression_state ==
+ GNUTLS_COMP_FAILED
+ && state->security_parameters.write_compression_algorithm !=
+ GNUTLS_CIPHER_NULL) {
+ gnutls_assert();
+ return GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM;
+ }
+
/* copy mac secret to connection state
*/
if (mac_size > 0) {
diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h
index 40861b1727..ff4ba840be 100644
--- a/lib/gnutls_int.h
+++ b/lib/gnutls_int.h
@@ -35,8 +35,6 @@
#define RECORD_DEBUG
#define DEBUG
*/
-#define HANDSHAKE_DEBUG // Prints some information on handshake
-#define DEBUG
/* It might be a good idea to replace int with void*
* here.
@@ -270,6 +268,7 @@ typedef struct GNUTLS_KEY_INT* GNUTLS_KEY;
#include <gnutls_hash_int.h>
#include <gnutls_cipher_int.h>
+#include <gnutls_compress_int.h>
#include <gnutls_cert.h>
typedef struct {
@@ -355,6 +354,8 @@ typedef struct {
typedef struct {
GNUTLS_CIPHER_HANDLE write_cipher_state;
GNUTLS_CIPHER_HANDLE read_cipher_state;
+ GNUTLS_COMP_HANDLE read_compression_state;
+ GNUTLS_COMP_HANDLE write_compression_state;
gnutls_datum read_mac_secret;
gnutls_datum write_mac_secret;
uint64 read_sequence_number;
diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c
index 011a2f5bb4..f381b7ca24 100644
--- a/lib/gnutls_state.c
+++ b/lib/gnutls_state.c
@@ -241,6 +241,11 @@ void gnutls_deinit(GNUTLS_STATE state)
if (state->connection_state.write_cipher_state != NULL)
gnutls_cipher_deinit(state->connection_state.write_cipher_state);
+ if (state->connection_state.read_compression_state != NULL)
+ gnutls_comp_deinit(state->connection_state.read_compression_state, 1);
+ if (state->connection_state.write_compression_state != NULL)
+ gnutls_comp_deinit(state->connection_state.write_compression_state, 0);
+
gnutls_sfree_datum( &state->cipher_specs.server_write_mac_secret);
gnutls_sfree_datum( &state->cipher_specs.client_write_mac_secret);
gnutls_sfree_datum( &state->cipher_specs.server_write_IV);
diff --git a/lib/x509_ASN.c b/lib/x509_ASN.c
index ea1102fd85..0621d79d54 100644
--- a/lib/x509_ASN.c
+++ b/lib/x509_ASN.c
@@ -1,6 +1,5 @@
-
/* A Bison parser, made from x509_ASN.y
- by GNU bison 1.30. */
+ by GNU bison 1.32. */
#define YYBISON 1 /* Identify Bison output. */
@@ -44,9 +43,9 @@
#line 30 "x509_ASN.y"
-#include <gnutls_int.h>
+#include <defines.h>
#include <x509_asn1.h>
-#include <gnutls_errors.h>
+#include <gnutls_errors_int.h>
FILE *file_asn1; /* Pointer to file to parse */
extern int parse_mode; /* PARSE_MODE_CHECK = only syntax check
@@ -60,12 +59,17 @@ int yylex(void);
#line 48 "x509_ASN.y"
+#ifndef YYSTYPE
typedef union {
unsigned int constant;
char str[129];
node_asn* node;
-} YYSTYPE;
-#include <stdio.h>
+} yystype;
+# define YYSTYPE yystype
+#endif
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
@@ -111,7 +115,7 @@ static const char yytranslate[] =
36, 37, 38, 39
};
-#if YYDEBUG != 0
+#if YYDEBUG
static const short yyprhs[] =
{
0, 0, 1, 4, 6, 9, 12, 14, 16, 18,
@@ -163,7 +167,7 @@ static const short yyrhs[] =
#endif
-#if YYDEBUG != 0
+#if YYDEBUG
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const short yyrline[] =
{
@@ -181,7 +185,7 @@ static const short yyrline[] =
#endif
-#if YYDEBUG != 0 || defined YYERROR_VERBOSE
+#if (YYDEBUG) || defined YYERROR_VERBOSE
/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
static const char *const yytname[] =
@@ -357,7 +361,7 @@ static const short yycheck[] =
#line 3 "/usr/share/bison/bison.simple"
/* Skeleton output parser for bison,
- Copyright 1984, 1989, 1990, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989, 1990, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -384,58 +388,120 @@ static const short yycheck[] =
It was written by Richard Stallman by simplifying the hairy parser
used when %semantic_parser is specified. */
-#ifndef YYSTACK_USE_ALLOCA
-# ifdef alloca
-# define YYSTACK_USE_ALLOCA 1
-# else /* alloca not defined */
-# ifdef __GNUC__
-# define YYSTACK_USE_ALLOCA 1
-# define alloca __builtin_alloca
-# else /* not GNU C. */
-# if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
-# define YYSTACK_USE_ALLOCA 1
-# include <alloca.h>
-# else /* not sparc */
- /* We think this test detects Watcom and Microsoft C. */
- /* This used to test MSDOS, but that is a bad idea since that
- symbol is in the user namespace. */
-# if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
-# if 0
- /* No need for malloc.h, which pollutes the namespace; instead,
- just don't use alloca. */
-# include <malloc.h>
-# endif
-# else /* not MSDOS, or __TURBOC__ */
-# if defined(_AIX)
- /* I don't know what this was needed for, but it pollutes the
- namespace. So I turned it off. rms, 2 May 1997. */
- /* #include <malloc.h> */
- #pragma alloca
-# define YYSTACK_USE_ALLOCA 1
-# else /* not MSDOS, or __TURBOC__, or _AIX */
-# if 0
- /* haible@ilog.fr says this works for HPUX 9.05 and up, and on
- HPUX 10. Eventually we can turn this on. */
-# ifdef __hpux
-# define YYSTACK_USE_ALLOCA 1
-# define alloca __builtin_alloca
-# endif /* __hpux */
-# endif
-# endif /* not _AIX */
-# endif /* not MSDOS, or __TURBOC__ */
-# endif /* not sparc */
-# endif /* not GNU C */
-# endif /* alloca not defined */
-#endif /* YYSTACK_USE_ALLOCA not defined */
-
-#ifndef YYSTACK_USE_ALLOCA
-# define YYSTACK_USE_ALLOCA 0
-#endif
+/* All symbols defined below should begin with yy or YY, to avoid
+ infringing on user name space. This should be done even for local
+ variables, as they might otherwise be expanded by user macros.
+ There are some unavoidable exceptions within include files to
+ define necessary library symbols; they are noted "INFRINGES ON
+ USER NAME SPACE" below. */
-#if YYSTACK_USE_ALLOCA
-# define YYSTACK_ALLOC alloca
+#ifdef __cplusplus
+# define YYSTD(x) std::x
#else
-# define YYSTACK_ALLOC malloc
+# define YYSTD(x) x
+#endif
+
+#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
+
+/* The parser invokes alloca or malloc; define the necessary symbols. */
+
+# if YYSTACK_USE_ALLOCA
+# define YYSTACK_ALLOC alloca
+# define YYSIZE_T YYSTD (size_t)
+# else
+# ifndef YYSTACK_USE_ALLOCA
+# if defined (alloca) || defined (_ALLOCA_H)
+# define YYSTACK_ALLOC alloca
+# define YYSIZE_T YYSTD (size_t)
+# else
+# ifdef __GNUC__
+# define YYSTACK_ALLOC __builtin_alloca
+# endif
+# endif
+# endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+ /* Pacify GCC's `empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+# else
+# ifdef __cplusplus
+# include <cstdlib> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T std::size_t
+# else
+# ifdef __STDC__
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# endif
+# endif
+# define YYSTACK_ALLOC YYSTD (malloc)
+# define YYSTACK_FREE YYSTD (free)
+# endif
+
+/* A type that is properly aligned for any stack member. */
+union yyalloc
+{
+ short yyss;
+ YYSTYPE yyvs;
+# if YYLSP_NEEDED
+ YYLTYPE yyls;
+# endif
+};
+
+/* The size of the maximum gap between one aligned stack and the next. */
+# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+ N elements. */
+# if YYLSP_NEEDED
+# define YYSTACK_BYTES(N) \
+ ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ + 2 * YYSTACK_GAP_MAX)
+# else
+# define YYSTACK_BYTES(N) \
+ ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
+ + YYSTACK_GAP_MAX)
+# endif
+
+/* Relocate the TYPE STACK from its old location to the new one. The
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
+ elements in the stack, and YYPTR gives the new location of the
+ stack. Advance YYPTR to a properly aligned location for the next
+ stack. */
+# define YYSTACK_RELOCATE(Type, Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ yymemcpy ((char *) yyptr, (char *) (Stack), \
+ yysize * (YYSIZE_T) sizeof (Type)); \
+ Stack = &yyptr->Stack; \
+ yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (0)
+
+#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
+
+
+#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
+# define YYSIZE_T __SIZE_TYPE__
+#endif
+#if ! defined (YYSIZE_T) && defined (size_t)
+# define YYSIZE_T size_t
+#endif
+#if ! defined (YYSIZE_T)
+# ifdef __cplusplus
+# include <cstddef> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T std::size_t
+# else
+# ifdef __STDC__
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# endif
+# endif
+#endif
+#if ! defined (YYSIZE_T)
+# define YYSIZE_T unsigned int
#endif
#define yyerrok (yyerrstatus = 0)
@@ -508,10 +574,20 @@ while (0)
/* Enable debugging if requested. */
#if YYDEBUG
+
+# ifndef YYFPRINTF
+# ifdef __cplusplus
+# include <cstdio> /* INFRINGES ON USER NAME SPACE */
+# else
+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+# endif
+# define YYFPRINTF YYSTD (fprintf)
+# endif
+
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
- fprintf Args; \
+ YYFPRINTF Args; \
} while (0)
/* Nonzero means print parse trace. [The following comment makes no
sense to me. Could someone clarify it? --akim] Since this is
@@ -528,7 +604,12 @@ int yydebug;
#endif
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
- if the built-in stack extension method is used). */
+ if the built-in stack extension method is used).
+
+ Do not make this value too large; the results are undefined if
+ SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
+ evaluated with infinite-precision integer arithmetic. */
+
#if YYMAXDEPTH == 0
# undef YYMAXDEPTH
#endif
@@ -537,38 +618,86 @@ int yydebug;
# define YYMAXDEPTH 10000
#endif
-/* Define __yy_memcpy. Note that the size argument
- should be passed with type unsigned int, because that is what the non-GCC
- definitions require. With GCC, __builtin_memcpy takes an arg
- of type size_t, but it can handle unsigned int. */
-
-#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
-# define __yy_memcpy(To, From, Count) __builtin_memcpy (To, From, Count)
-#else /* not GNU C or C++ */
+#if ! defined (yyoverflow) && ! defined (yymemcpy)
+# if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
+# define yymemcpy __builtin_memcpy
+# else /* not GNU C or C++ */
/* This is the most reliable way to avoid incompatibilities
in available built-in functions on various systems. */
static void
-# ifndef __cplusplus
-__yy_memcpy (to, from, count)
- char *to;
- const char *from;
- unsigned int count;
-# else /* __cplusplus */
-__yy_memcpy (char *to, const char *from, unsigned int count)
+# if defined (__STDC__) || defined (__cplusplus)
+yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
+# else
+yymemcpy (yyto, yyfrom, yycount)
+ char *yyto;
+ const char *yyfrom;
+ YYSIZE_T yycount;
+# endif
+{
+ register const char *yyf = yyfrom;
+ register char *yyt = yyto;
+ register YYSIZE_T yyi = yycount;
+
+ while (yyi-- != 0)
+ *yyt++ = *yyf++;
+}
# endif
+#endif
+
+#ifdef YYERROR_VERBOSE
+
+# ifndef yystrlen
+# if defined (__GLIBC__) && defined (_STRING_H)
+# define yystrlen strlen
+# else
+/* Return the length of YYSTR. */
+static YYSIZE_T
+# if defined (__STDC__) || defined (__cplusplus)
+yystrlen (const char *yystr)
+# else
+yystrlen (yystr)
+ const char *yystr;
+# endif
{
- register const char *f = from;
- register char *t = to;
- register int i = count;
+ register const char *yys = yystr;
- while (i-- > 0)
- *t++ = *f++;
+ while (*yys++ != '\0')
+ continue;
+
+ return yys - yystr - 1;
}
+# endif
+# endif
+
+# ifndef yystpcpy
+# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
+# define yystpcpy stpcpy
+# else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+ YYDEST. */
+static char *
+# if defined (__STDC__) || defined (__cplusplus)
+yystpcpy (char *yydest, const char *yysrc)
+# else
+yystpcpy (yydest, yysrc)
+ char *yydest;
+ const char *yysrc;
+# endif
+{
+ register char *yyd = yydest;
+ register const char *yys = yysrc;
+ while ((*yyd++ = *yys++) != '\0')
+ continue;
+
+ return yyd - 1;
+}
+# endif
+# endif
#endif
-#line 216 "/usr/share/bison/bison.simple"
+#line 341 "/usr/share/bison/bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
@@ -602,7 +731,7 @@ int yyparse (void);
/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
variables are global, or local to YYPARSE. */
-#define _YY_DECL_VARIABLES \
+#define YY_DECL_NON_LSP_VARIABLES \
/* The lookahead symbol. */ \
int yychar; \
\
@@ -614,13 +743,13 @@ int yynerrs;
#if YYLSP_NEEDED
# define YY_DECL_VARIABLES \
-_YY_DECL_VARIABLES \
+YY_DECL_NON_LSP_VARIABLES \
\
/* Location data for the lookahead symbol. */ \
YYLTYPE yylloc;
#else
# define YY_DECL_VARIABLES \
-_YY_DECL_VARIABLES
+YY_DECL_NON_LSP_VARIABLES
#endif
@@ -641,6 +770,7 @@ yyparse (YYPARSE_PARAM_ARG)
register int yystate;
register int yyn;
+ int yyresult;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* Lookahead token as an internal (translated) token number. */
@@ -648,7 +778,7 @@ yyparse (YYPARSE_PARAM_ARG)
/* Three stacks and their tools:
`yyss': related to states,
- `yysv': related to semantic values,
+ `yyvs': related to semantic values,
`yyls': related to locations.
Refer to the stacks thru separate pointers, to allow yyoverflow
@@ -677,16 +807,15 @@ yyparse (YYPARSE_PARAM_ARG)
# define YYPOPSTACK (yyvsp--, yyssp--)
#endif
- int yystacksize = YYINITDEPTH;
- int yyfree_stacks = 0;
+ YYSIZE_T yystacksize = YYINITDEPTH;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
-# if YYLSP_NEEDED
+#if YYLSP_NEEDED
YYLTYPE yyloc;
-# endif
+#endif
/* When reducing, the number of symbols on the RHS of the reduced
rule. */
@@ -725,81 +854,71 @@ yyparse (YYPARSE_PARAM_ARG)
if (yyssp >= yyss + yystacksize - 1)
{
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into memory.
- */
- YYSTYPE *yyvs1 = yyvs;
- short *yyss1 = yyss;
-#if YYLSP_NEEDED
- YYLTYPE *yyls1 = yyls;
-#endif
-
/* Get the current used size of the three stacks, in elements. */
- int size = yyssp - yyss + 1;
+ YYSIZE_T yysize = yyssp - yyss + 1;
#ifdef yyoverflow
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. */
+ {
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ short *yyss1 = yyss;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. */
# if YYLSP_NEEDED
- /* This used to be a conditional around just the two extra args,
- but that might be undefined if yyoverflow is a macro. */
- yyoverflow ("parser stack overflow",
- &yyss1, size * sizeof (*yyssp),
- &yyvs1, size * sizeof (*yyvsp),
- &yyls1, size * sizeof (*yylsp),
- &yystacksize);
+ YYLTYPE *yyls1 = yyls;
+ /* This used to be a conditional around just the two extra args,
+ but that might be undefined if yyoverflow is a macro. */
+ yyoverflow ("parser stack overflow",
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yyls1, yysize * sizeof (*yylsp),
+ &yystacksize);
+ yyls = yyls1;
# else
- yyoverflow ("parser stack overflow",
- &yyss1, size * sizeof (*yyssp),
- &yyvs1, size * sizeof (*yyvsp),
- &yystacksize);
-# endif
-
- yyss = yyss1; yyvs = yyvs1;
-# if YYLSP_NEEDED
- yyls = yyls1;
+ yyoverflow ("parser stack overflow",
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yystacksize);
# endif
+ yyss = yyss1;
+ yyvs = yyvs1;
+ }
#else /* no yyoverflow */
/* Extend the stack our own way. */
if (yystacksize >= YYMAXDEPTH)
- {
- yyerror ("parser stack overflow");
- if (yyfree_stacks)
- {
- free (yyss);
- free (yyvs);
-# if YYLSP_NEEDED
- free (yyls);
-# endif
- }
- return 2;
- }
+ goto yyoverflowlab;
yystacksize *= 2;
if (yystacksize > YYMAXDEPTH)
yystacksize = YYMAXDEPTH;
-# if !YYSTACK_USE_ALLOCA
- yyfree_stacks = 1;
-# endif
- yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
- __yy_memcpy ((char *)yyss, (char *)yyss1,
- size * (unsigned int) sizeof (*yyssp));
- yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
- __yy_memcpy ((char *)yyvs, (char *)yyvs1,
- size * (unsigned int) sizeof (*yyvsp));
+
+ {
+ short *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyoverflowlab;
+ YYSTACK_RELOCATE (short, yyss);
+ YYSTACK_RELOCATE (YYSTYPE, yyvs);
# if YYLSP_NEEDED
- yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
- __yy_memcpy ((char *)yyls, (char *)yyls1,
- size * (unsigned int) sizeof (*yylsp));
+ YYSTACK_RELOCATE (YYLTYPE, yyls);
# endif
+# undef YYSTACK_RELOCATE
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
+ }
#endif /* no yyoverflow */
- yyssp = yyss + size - 1;
- yyvsp = yyvs + size - 1;
+ yyssp = yyss + yysize - 1;
+ yyvsp = yyvs + yysize - 1;
#if YYLSP_NEEDED
- yylsp = yyls + size - 1;
+ yylsp = yyls + yysize - 1;
#endif
- YYDPRINTF ((stderr, "Stack size increased to %d\n", yystacksize));
+ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+ (unsigned long int) yystacksize));
if (yyssp >= yyss + yystacksize - 1)
YYABORT;
@@ -854,13 +973,14 @@ yybackup:
which are defined only if `YYDEBUG' is set. */
if (yydebug)
{
- fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
+ YYFPRINTF (stderr, "Next token is %d (%s",
+ yychar, yytname[yychar1]);
/* Give the individual parser a way to print the precise
meaning of a token, for further debugging info. */
# ifdef YYPRINT
YYPRINT (stderr, yychar, yylval);
# endif
- fprintf (stderr, ")\n");
+ YYFPRINTF (stderr, ")\n");
}
#endif
}
@@ -892,7 +1012,8 @@ yybackup:
YYACCEPT;
/* Shift the lookahead token. */
- YYDPRINTF ((stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]));
+ YYDPRINTF ((stderr, "Shifting token %d (%s), ",
+ yychar, yytname[yychar1]));
/* Discard the token being shifted unless it is eof. */
if (yychar != YYEOF)
@@ -951,15 +1072,15 @@ yyreduce:
are defined only if `YYDEBUG' is set. */
if (yydebug)
{
- int i;
+ int yyi;
- fprintf (stderr, "Reducing via rule %d (line %d), ",
- yyn, yyrline[yyn]);
+ YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
+ yyn, yyrline[yyn]);
/* Print the symbols being reduced, and their result. */
- for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
- fprintf (stderr, "%s ", yytname[yyrhs[i]]);
- fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
+ for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
+ YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
+ YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
}
#endif
@@ -967,438 +1088,438 @@ yyreduce:
case 3:
#line 111 "x509_ASN.y"
-{strcpy(yyval.str,yyvsp[0].str);;
- break;}
+{strcpy(yyval.str,yyvsp[0].str);}
+ break;
case 4:
#line 112 "x509_ASN.y"
-{strcpy(yyval.str,yyvsp[0].str);;
- break;}
+{strcpy(yyval.str,yyvsp[0].str);}
+ break;
case 5:
#line 115 "x509_ASN.y"
{strcpy(yyval.str,"-");
- strcat(yyval.str,yyvsp[0].str);;
- break;}
+ strcat(yyval.str,yyvsp[0].str);}
+ break;
case 6:
#line 119 "x509_ASN.y"
-{strcpy(yyval.str,yyvsp[0].str);;
- break;}
+{strcpy(yyval.str,yyvsp[0].str);}
+ break;
case 7:
#line 120 "x509_ASN.y"
-{strcpy(yyval.str,yyvsp[0].str);;
- break;}
+{strcpy(yyval.str,yyvsp[0].str);}
+ break;
case 8:
#line 123 "x509_ASN.y"
-{strcpy(yyval.str,yyvsp[0].str);;
- break;}
+{strcpy(yyval.str,yyvsp[0].str);}
+ break;
case 9:
#line 124 "x509_ASN.y"
-{strcpy(yyval.str,yyvsp[0].str);;
- break;}
+{strcpy(yyval.str,yyvsp[0].str);}
+ break;
case 10:
#line 127 "x509_ASN.y"
-{strcpy(yyval.str,yyvsp[0].str);;
- break;}
+{strcpy(yyval.str,yyvsp[0].str);}
+ break;
case 11:
#line 128 "x509_ASN.y"
-{strcpy(yyval.str,yyvsp[0].str);;
- break;}
+{strcpy(yyval.str,yyvsp[0].str);}
+ break;
case 12:
#line 131 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_CONSTANT);
- _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);;
- break;}
+ _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
+ break;
case 13:
#line 133 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_CONSTANT);
_asn1_set_name(yyval.node,yyvsp[-3].str);
- _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);;
- break;}
+ _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
+ break;
case 14:
#line 138 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 15:
#line 139 "x509_ASN.y"
{yyval.node=yyvsp[-2].node;
- _asn1_set_right(_asn1_get_last_right(yyvsp[-2].node),yyvsp[0].node);;
- break;}
+ _asn1_set_right(_asn1_get_last_right(yyvsp[-2].node),yyvsp[0].node);}
+ break;
case 16:
#line 143 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_IDENTIFIER);
- _asn1_set_name(yyval.node,yyvsp[0].str);;
- break;}
+ _asn1_set_name(yyval.node,yyvsp[0].str);}
+ break;
case 17:
#line 146 "x509_ASN.y"
{yyval.node=yyvsp[-1].node;
_asn1_set_right(_asn1_get_last_right(yyval.node),_asn1_add_node(TYPE_IDENTIFIER));
- _asn1_set_name(_asn1_get_last_right(yyval.node),yyvsp[0].str);;
- break;}
+ _asn1_set_name(_asn1_get_last_right(yyval.node),yyvsp[0].str);}
+ break;
case 18:
#line 151 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_CONSTANT);
- _asn1_set_value(yyval.node,yyvsp[0].str,strlen(yyvsp[0].str)+1);;
- break;}
+ _asn1_set_value(yyval.node,yyvsp[0].str,strlen(yyvsp[0].str)+1);}
+ break;
case 19:
#line 153 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_CONSTANT);
_asn1_set_name(yyval.node,yyvsp[-3].str);
- _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);;
- break;}
+ _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
+ break;
case 20:
#line 158 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 21:
#line 159 "x509_ASN.y"
{yyval.node=yyvsp[-1].node;
- _asn1_set_right(_asn1_get_last_right(yyvsp[-1].node),yyvsp[0].node);;
- break;}
+ _asn1_set_right(_asn1_get_last_right(yyvsp[-1].node),yyvsp[0].node);}
+ break;
case 22:
#line 163 "x509_ASN.y"
-{yyval.constant=CONST_UNIVERSAL;;
- break;}
+{yyval.constant=CONST_UNIVERSAL;}
+ break;
case 23:
#line 164 "x509_ASN.y"
-{yyval.constant=CONST_PRIVATE;;
- break;}
+{yyval.constant=CONST_PRIVATE;}
+ break;
case 24:
#line 165 "x509_ASN.y"
-{yyval.constant=CONST_APPLICATION;;
- break;}
+{yyval.constant=CONST_APPLICATION;}
+ break;
case 25:
#line 168 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_TAG);
- _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);;
- break;}
+ _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
+ break;
case 26:
#line 170 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_TAG | yyvsp[-2].constant);
- _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);;
- break;}
+ _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
+ break;
case 27:
#line 174 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 28:
#line 175 "x509_ASN.y"
-{yyval.node=_asn1_mod_type(yyvsp[-1].node,CONST_EXPLICIT);;
- break;}
+{yyval.node=_asn1_mod_type(yyvsp[-1].node,CONST_EXPLICIT);}
+ break;
case 29:
#line 176 "x509_ASN.y"
-{yyval.node=_asn1_mod_type(yyvsp[-1].node,CONST_IMPLICIT);;
- break;}
+{yyval.node=_asn1_mod_type(yyvsp[-1].node,CONST_IMPLICIT);}
+ break;
case 30:
#line 179 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_DEFAULT);
- _asn1_set_value(yyval.node,yyvsp[0].str,strlen(yyvsp[0].str)+1);;
- break;}
+ _asn1_set_value(yyval.node,yyvsp[0].str,strlen(yyvsp[0].str)+1);}
+ break;
case 31:
#line 181 "x509_ASN.y"
-{yyval.node=_asn1_add_node(TYPE_DEFAULT|CONST_TRUE);;
- break;}
+{yyval.node=_asn1_add_node(TYPE_DEFAULT|CONST_TRUE);}
+ break;
case 32:
#line 182 "x509_ASN.y"
-{yyval.node=_asn1_add_node(TYPE_DEFAULT|CONST_FALSE);;
- break;}
+{yyval.node=_asn1_add_node(TYPE_DEFAULT|CONST_FALSE);}
+ break;
case 33:
#line 185 "x509_ASN.y"
-{yyval.node=_asn1_add_node(TYPE_INTEGER);;
- break;}
+{yyval.node=_asn1_add_node(TYPE_INTEGER);}
+ break;
case 34:
#line 186 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_INTEGER|CONST_LIST);
- _asn1_set_down(yyval.node,yyvsp[-1].node);;
- break;}
+ _asn1_set_down(yyval.node,yyvsp[-1].node);}
+ break;
case 35:
#line 189 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_INTEGER|CONST_MIN_MAX);
_asn1_set_down(yyval.node,_asn1_add_node(TYPE_SIZE));
_asn1_set_value(_asn1_get_down(yyval.node),yyvsp[-1].str,strlen(yyvsp[-1].str)+1);
- _asn1_set_name(_asn1_get_down(yyval.node),yyvsp[-4].str);;
- break;}
+ _asn1_set_name(_asn1_get_down(yyval.node),yyvsp[-4].str);}
+ break;
case 36:
#line 195 "x509_ASN.y"
-{yyval.node=_asn1_add_node(TYPE_BOOLEAN);;
- break;}
+{yyval.node=_asn1_add_node(TYPE_BOOLEAN);}
+ break;
case 37:
#line 198 "x509_ASN.y"
-{yyval.node=_asn1_add_node(TYPE_TIME|CONST_UTC);;
- break;}
+{yyval.node=_asn1_add_node(TYPE_TIME|CONST_UTC);}
+ break;
case 38:
#line 199 "x509_ASN.y"
-{yyval.node=_asn1_add_node(TYPE_TIME|CONST_GENERALIZED);;
- break;}
+{yyval.node=_asn1_add_node(TYPE_TIME|CONST_GENERALIZED);}
+ break;
case 39:
#line 202 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_SIZE|CONST_1_PARAM);
- _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);;
- break;}
+ _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
+ break;
case 40:
#line 205 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_SIZE|CONST_MIN_MAX);
_asn1_set_value(yyval.node,yyvsp[-4].str,strlen(yyvsp[-4].str)+1);
- _asn1_set_name(yyval.node,yyvsp[-1].str);;
- break;}
+ _asn1_set_name(yyval.node,yyvsp[-1].str);}
+ break;
case 41:
#line 210 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 42:
#line 211 "x509_ASN.y"
-{yyval.node=yyvsp[-1].node;;
- break;}
+{yyval.node=yyvsp[-1].node;}
+ break;
case 43:
#line 214 "x509_ASN.y"
-{yyval.node=_asn1_add_node(TYPE_OCTET_STRING);;
- break;}
+{yyval.node=_asn1_add_node(TYPE_OCTET_STRING);}
+ break;
case 44:
#line 215 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_OCTET_STRING|CONST_SIZE);
- _asn1_set_down(yyval.node,yyvsp[0].node);;
- break;}
+ _asn1_set_down(yyval.node,yyvsp[0].node);}
+ break;
case 45:
#line 219 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_CONSTANT);
_asn1_set_name(yyval.node,yyvsp[-3].str);
- _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);;
- break;}
+ _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
+ break;
case 46:
#line 224 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 47:
#line 225 "x509_ASN.y"
{yyval.node=yyvsp[-2].node;
- _asn1_set_right(_asn1_get_last_right(yyvsp[-2].node),yyvsp[0].node);;
- break;}
+ _asn1_set_right(_asn1_get_last_right(yyvsp[-2].node),yyvsp[0].node);}
+ break;
case 48:
#line 229 "x509_ASN.y"
-{yyval.node=_asn1_add_node(TYPE_BIT_STRING);;
- break;}
+{yyval.node=_asn1_add_node(TYPE_BIT_STRING);}
+ break;
case 49:
#line 231 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_BIT_STRING|CONST_LIST);
- _asn1_set_down(yyval.node,yyvsp[-1].node);;
- break;}
+ _asn1_set_down(yyval.node,yyvsp[-1].node);}
+ break;
case 50:
#line 236 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_ENUMERATED|CONST_LIST);
- _asn1_set_down(yyval.node,yyvsp[-1].node);;
- break;}
+ _asn1_set_down(yyval.node,yyvsp[-1].node);}
+ break;
case 51:
#line 240 "x509_ASN.y"
-{yyval.node=_asn1_add_node(TYPE_OBJECT_ID);;
- break;}
+{yyval.node=_asn1_add_node(TYPE_OBJECT_ID);}
+ break;
case 52:
#line 243 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_IDENTIFIER);
- _asn1_set_value(yyval.node,yyvsp[0].str,strlen(yyvsp[0].str)+1);;
- break;}
+ _asn1_set_value(yyval.node,yyvsp[0].str,strlen(yyvsp[0].str)+1);}
+ break;
case 53:
#line 245 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_IDENTIFIER|CONST_SIZE);
_asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);
- _asn1_set_down(yyval.node,yyvsp[0].node);;
- break;}
+ _asn1_set_down(yyval.node,yyvsp[0].node);}
+ break;
case 54:
#line 248 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 55:
#line 249 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 56:
#line 250 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 58:
#line 252 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 59:
#line 253 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 60:
#line 254 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 61:
#line 255 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 62:
#line 256 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 63:
#line 257 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 64:
#line 258 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 65:
#line 259 "x509_ASN.y"
-{yyval.node=_asn1_add_node(TYPE_NULL);;
- break;}
+{yyval.node=_asn1_add_node(TYPE_NULL);}
+ break;
case 66:
#line 262 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 67:
#line 263 "x509_ASN.y"
{yyval.node=_asn1_mod_type(yyvsp[0].node,CONST_TAG);
_asn1_set_right(yyvsp[-1].node,_asn1_get_down(yyval.node));
- _asn1_set_down(yyval.node,yyvsp[-1].node);;
- break;}
+ _asn1_set_down(yyval.node,yyvsp[-1].node);}
+ break;
case 68:
#line 268 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 69:
#line 269 "x509_ASN.y"
{yyval.node=_asn1_mod_type(yyvsp[-1].node,CONST_DEFAULT);
_asn1_set_right(yyvsp[0].node,_asn1_get_down(yyval.node));
- _asn1_set_down(yyval.node,yyvsp[0].node);;
- break;}
+ _asn1_set_down(yyval.node,yyvsp[0].node);}
+ break;
case 70:
#line 272 "x509_ASN.y"
-{yyval.node=_asn1_mod_type(yyvsp[-1].node,CONST_OPTION);;
- break;}
+{yyval.node=_asn1_mod_type(yyvsp[-1].node,CONST_OPTION);}
+ break;
case 71:
#line 275 "x509_ASN.y"
-{yyval.node=_asn1_set_name(yyvsp[0].node,yyvsp[-1].str);;
- break;}
+{yyval.node=_asn1_set_name(yyvsp[0].node,yyvsp[-1].str);}
+ break;
case 72:
#line 278 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 73:
#line 279 "x509_ASN.y"
{yyval.node=yyvsp[-2].node;
- _asn1_set_right(_asn1_get_last_right(yyvsp[-2].node),yyvsp[0].node);;
- break;}
+ _asn1_set_right(_asn1_get_last_right(yyvsp[-2].node),yyvsp[0].node);}
+ break;
case 74:
#line 283 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_SEQUENCE);
- _asn1_set_down(yyval.node,yyvsp[-1].node);;
- break;}
+ _asn1_set_down(yyval.node,yyvsp[-1].node);}
+ break;
case 75:
#line 285 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_SEQUENCE_OF);
- _asn1_set_down(yyval.node,yyvsp[0].node);;
- break;}
+ _asn1_set_down(yyval.node,yyvsp[0].node);}
+ break;
case 76:
#line 287 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_SEQUENCE_OF|CONST_SIZE);
_asn1_set_right(yyvsp[-2].node,yyvsp[0].node);
- _asn1_set_down(yyval.node,yyvsp[-2].node);;
- break;}
+ _asn1_set_down(yyval.node,yyvsp[-2].node);}
+ break;
case 77:
#line 292 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_SET);
- _asn1_set_down(yyval.node,yyvsp[-1].node);;
- break;}
+ _asn1_set_down(yyval.node,yyvsp[-1].node);}
+ break;
case 78:
#line 294 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_SET_OF);
- _asn1_set_down(yyval.node,yyvsp[0].node);;
- break;}
+ _asn1_set_down(yyval.node,yyvsp[0].node);}
+ break;
case 79:
#line 296 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_SET_OF|CONST_SIZE);
_asn1_set_right(yyvsp[-2].node,yyvsp[0].node);
- _asn1_set_down(yyval.node,yyvsp[-2].node);;
- break;}
+ _asn1_set_down(yyval.node,yyvsp[-2].node);}
+ break;
case 80:
#line 301 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_CHOICE);
- _asn1_set_down(yyval.node,yyvsp[-1].node);;
- break;}
+ _asn1_set_down(yyval.node,yyvsp[-1].node);}
+ break;
case 81:
#line 305 "x509_ASN.y"
-{yyval.node=_asn1_add_node(TYPE_ANY);;
- break;}
+{yyval.node=_asn1_add_node(TYPE_ANY);}
+ break;
case 82:
#line 306 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_ANY|CONST_DEFINED_BY);
_asn1_set_down(yyval.node,_asn1_add_node(TYPE_CONSTANT));
- _asn1_set_name(_asn1_get_down(yyval.node),yyvsp[0].str);;
- break;}
+ _asn1_set_name(_asn1_get_down(yyval.node),yyvsp[0].str);}
+ break;
case 83:
#line 311 "x509_ASN.y"
-{yyval.node=_asn1_set_name(yyvsp[0].node,yyvsp[-2].str);;
- break;}
+{yyval.node=_asn1_set_name(yyvsp[0].node,yyvsp[-2].str);}
+ break;
case 84:
#line 315 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_OBJECT_ID|CONST_ASSIGN);
_asn1_set_name(yyval.node,yyvsp[-6].str);
- _asn1_set_down(yyval.node,yyvsp[-1].node);;
- break;}
+ _asn1_set_down(yyval.node,yyvsp[-1].node);}
+ break;
case 85:
#line 319 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_OBJECT_ID|CONST_ASSIGN|CONST_1_PARAM);
_asn1_set_name(yyval.node,yyvsp[-5].str);
_asn1_set_value(yyval.node,yyvsp[-4].str,strlen(yyvsp[-4].str)+1);
- _asn1_set_down(yyval.node,yyvsp[-1].node);;
- break;}
+ _asn1_set_down(yyval.node,yyvsp[-1].node);}
+ break;
case 86:
#line 324 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_INTEGER|CONST_ASSIGN);
_asn1_set_name(yyval.node,yyvsp[-3].str);
- _asn1_set_value(yyval.node,yyvsp[0].str,strlen(yyvsp[0].str)+1);;
- break;}
+ _asn1_set_value(yyval.node,yyvsp[0].str,strlen(yyvsp[0].str)+1);}
+ break;
case 87:
#line 329 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 88:
#line 330 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 89:
#line 333 "x509_ASN.y"
-{yyval.node=yyvsp[0].node;;
- break;}
+{yyval.node=yyvsp[0].node;}
+ break;
case 90:
#line 334 "x509_ASN.y"
{yyval.node=yyvsp[-1].node;
- _asn1_set_right(_asn1_get_last_right(yyvsp[-1].node),yyvsp[0].node);;
- break;}
+ _asn1_set_right(_asn1_get_last_right(yyvsp[-1].node),yyvsp[0].node);}
+ break;
case 91:
#line 338 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_OBJECT_ID);
_asn1_set_down(yyval.node,yyvsp[-1].node);
- _asn1_set_name(yyval.node,yyvsp[-3].str);;
- break;}
+ _asn1_set_name(yyval.node,yyvsp[-3].str);}
+ break;
case 92:
#line 341 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_OBJECT_ID);
- _asn1_set_name(yyval.node,yyvsp[-2].str);;
- break;}
+ _asn1_set_name(yyval.node,yyvsp[-2].str);}
+ break;
case 93:
#line 345 "x509_ASN.y"
-{yyval.node=NULL;;
- break;}
+{yyval.node=NULL;}
+ break;
case 94:
#line 347 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_IMPORTS);
_asn1_set_down(yyval.node,_asn1_add_node(TYPE_OBJECT_ID));
_asn1_set_name(_asn1_get_down(yyval.node),yyvsp[-1].str);
_asn1_set_down(_asn1_get_down(yyval.node),yyvsp[0].node);
- _asn1_set_right(yyval.node,yyvsp[-3].node);;
- break;}
+ _asn1_set_right(yyval.node,yyvsp[-3].node);}
+ break;
case 95:
#line 354 "x509_ASN.y"
-{yyval.constant=CONST_EXPLICIT;;
- break;}
+{yyval.constant=CONST_EXPLICIT;}
+ break;
case 96:
#line 355 "x509_ASN.y"
-{yyval.constant=CONST_IMPLICIT;;
- break;}
+{yyval.constant=CONST_IMPLICIT;}
+ break;
case 97:
#line 361 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_DEFINITIONS|yyvsp[-6].constant|((yyvsp[-2].node==NULL)?0:CONST_IMPORTS));
@@ -1414,11 +1535,11 @@ case 97:
if(result_parse==ASN_IDENTIFIER_NOT_FOUND)
asn1_delete_structure(yyval.node);
else p_tree=yyval.node;
- };
- break;}
+ }}
+ break;
}
-#line 610 "/usr/share/bison/bison.simple"
+#line 727 "/usr/share/bison/bison.simple"
yyvsp -= yylen;
@@ -1430,11 +1551,11 @@ case 97:
#if YYDEBUG
if (yydebug)
{
- short *ssp1 = yyss - 1;
- fprintf (stderr, "state stack now");
- while (ssp1 != yyssp)
- fprintf (stderr, " %d", *++ssp1);
- fprintf (stderr, "\n");
+ short *yyssp1 = yyss - 1;
+ YYFPRINTF (stderr, "state stack now");
+ while (yyssp1 != yyssp)
+ YYFPRINTF (stderr, " %d", *++yyssp1);
+ YYFPRINTF (stderr, "\n");
}
#endif
@@ -1472,46 +1593,47 @@ yyerrlab:
if (yyn > YYFLAG && yyn < YYLAST)
{
- int size = 0;
- char *msg;
- int x, count;
-
- count = 0;
- /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
- for (x = (yyn < 0 ? -yyn : 0);
- x < (int) (sizeof (yytname) / sizeof (char *)); x++)
- if (yycheck[x + yyn] == x)
- size += strlen (yytname[x]) + 15, count++;
- size += strlen ("parse error, unexpected `") + 1;
- size += strlen (yytname[YYTRANSLATE (yychar)]);
- msg = (char *) malloc (size);
- if (msg != 0)
+ YYSIZE_T yysize = 0;
+ char *yymsg;
+ int yyx, yycount;
+
+ yycount = 0;
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. */
+ for (yyx = yyn < 0 ? -yyn : 0;
+ yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
+ if (yycheck[yyx + yyn] == yyx)
+ yysize += yystrlen (yytname[yyx]) + 15, yycount++;
+ yysize += yystrlen ("parse error, unexpected ") + 1;
+ yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
+ yymsg = (char *) YYSTACK_ALLOC (yysize);
+ if (yymsg != 0)
{
- strcpy (msg, "parse error, unexpected `");
- strcat (msg, yytname[YYTRANSLATE (yychar)]);
- strcat (msg, "'");
+ char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
+ yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
- if (count < 5)
+ if (yycount < 5)
{
- count = 0;
- for (x = (yyn < 0 ? -yyn : 0);
- x < (int) (sizeof (yytname) / sizeof (char *)); x++)
- if (yycheck[x + yyn] == x)
+ yycount = 0;
+ for (yyx = yyn < 0 ? -yyn : 0;
+ yyx < (int) (sizeof (yytname) / sizeof (char *));
+ yyx++)
+ if (yycheck[yyx + yyn] == yyx)
{
- strcat (msg, count == 0 ? ", expecting `" : " or `");
- strcat (msg, yytname[x]);
- strcat (msg, "'");
- count++;
+ const char *yyq = ! yycount ? ", expecting " : " or ";
+ yyp = yystpcpy (yyp, yyq);
+ yyp = yystpcpy (yyp, yytname[yyx]);
+ yycount++;
}
}
- yyerror (msg);
- free (msg);
+ yyerror (yymsg);
+ YYSTACK_FREE (yymsg);
}
else
- yyerror ("parse error; also virtual memory exceeded");
+ yyerror ("parse error; also virtual memory exhausted");
}
else
-#endif /* YYERROR_VERBOSE */
+#endif /* defined (YYERROR_VERBOSE) */
yyerror ("parse error");
}
goto yyerrlab1;
@@ -1574,11 +1696,11 @@ yyerrpop:
#if YYDEBUG
if (yydebug)
{
- short *ssp1 = yyss - 1;
- fprintf (stderr, "Error: state stack now");
- while (ssp1 != yyssp)
- fprintf (stderr, " %d", *++ssp1);
- fprintf (stderr, "\n");
+ short *yyssp1 = yyss - 1;
+ YYFPRINTF (stderr, "Error: state stack now");
+ while (yyssp1 != yyssp)
+ YYFPRINTF (stderr, " %d", *++yyssp1);
+ YYFPRINTF (stderr, "\n");
}
#endif
@@ -1623,30 +1745,30 @@ yyerrhandle:
| yyacceptlab -- YYACCEPT comes here. |
`-------------------------------------*/
yyacceptlab:
- if (yyfree_stacks)
- {
- free (yyss);
- free (yyvs);
-#if YYLSP_NEEDED
- free (yyls);
-#endif
- }
- return 0;
-
+ yyresult = 0;
+ goto yyreturn;
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
yyabortlab:
- if (yyfree_stacks)
- {
- free (yyss);
- free (yyvs);
-#if YYLSP_NEEDED
- free (yyls);
+ yyresult = 1;
+ goto yyreturn;
+
+/*---------------------------------------------.
+| yyoverflowab -- parser overflow comes here. |
+`---------------------------------------------*/
+yyoverflowlab:
+ yyerror ("parser stack overflow");
+ yyresult = 2;
+ /* Fall through. */
+
+yyreturn:
+#ifndef yyoverflow
+ if (yyss != yyssa)
+ YYSTACK_FREE (yyss);
#endif
- }
- return 1;
+ return yyresult;
}
#line 377 "x509_ASN.y"
diff --git a/lib/x509_ASN.y b/lib/x509_ASN.y
index f1bb9cbce6..74bc5fb9ed 100755
--- a/lib/x509_ASN.y
+++ b/lib/x509_ASN.y
@@ -28,9 +28,9 @@
%{
-#include <gnutls_int.h>
+#include <defines.h>
#include <x509_asn1.h>
-#include <gnutls_errors.h>
+#include <gnutls_errors_int.h>
FILE *file_asn1; /* Pointer to file to parse */
extern int parse_mode; /* PARSE_MODE_CHECK = only syntax check
diff --git a/lib/x509_asn1.c b/lib/x509_asn1.c
index 112b3a3488..6784b2b783 100755
--- a/lib/x509_asn1.c
+++ b/lib/x509_asn1.c
@@ -25,8 +25,7 @@
/*****************************************************/
-#include <gnutls_int.h>
-
+#include <gnutls_int.h>
#include "x509_asn1.h"
#include "x509_der.h"
#include <gnutls_str.h>