X.509 code.
+Version ?.?.?
+- Updated documentation
+- Combined error codes of ASN.1 parser and gnutls
+
Version 0.3.91 (3/03/2002)
- Added gnutls-cli-debug program
- Corrections in session resumption
gnutls-api.tex: $(COBJECTS)
@echo "\\newpage" > gnutls-api.tex
- @echo "\\section{Function Reference}" >> gnutls-api.tex
+ @echo "\\section{\\gnutls{} function reference}" >> gnutls-api.tex
@for i in $(COBJECTS); \
do echo -n "Creating documentation for file $$i... " && ../doc/scripts/gdoc -tex $$i >> gnutls-api.tex \
&& echo "ok"; \
asn1-api.tex: $(COBJECTS2)
@echo "\\newpage" > asn1-api.tex
- @echo "\\section{Function Reference}" >> asn1-api.tex
+ @echo "\\section{ASN.1 parser function reference}" >> asn1-api.tex
@for i in $(COBJECTS2); \
do echo -n "Creating documentation for file $$i... " && ../doc/scripts/gdoc -tex $$i >> asn1-api.tex \
&& echo "ok"; \
int len, result;
int start, end;
- if (asn1_create_structure
+ if ((result=asn1_create_structure
(_gnutls_get_pkix(), "PKIX1Implicit88.Certificate", &dn,
- "dn") != ASN_OK) {
+ "dn")) != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
result = asn1_get_der(dn, cert->raw.data, cert->raw.size);
/* couldn't decode DER */
gnutls_assert();
asn1_delete_structure(dn);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
result = asn1_get_start_end_der(dn, cert->raw.data, cert->raw.size,
/* couldn't decode DER */
gnutls_assert();
asn1_delete_structure(dn);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
asn1_delete_structure(dn);
case GNUTLS_E_ILLEGAL_PARAMETER:
ret = gnutls_alert_send( state, GNUTLS_AL_FATAL, GNUTLS_A_ILLEGAL_PARAMETER);
break;
- case GNUTLS_E_ASN1_PARSING_ERROR:
+ case GNUTLS_E_ASN1_ELEMENT_NOT_FOUND:
+ case GNUTLS_E_ASN1_IDENTIFIER_NOT_FOUND:
+ case GNUTLS_E_ASN1_DER_ERROR:
+ case GNUTLS_E_ASN1_VALUE_NOT_FOUND:
+ case GNUTLS_E_ASN1_GENERIC_ERROR:
+ case GNUTLS_E_ASN1_VALUE_NOT_VALID:
+ case GNUTLS_E_ASN1_TAG_ERROR:
+ case GNUTLS_E_ASN1_TAG_IMPLICIT:
+ case GNUTLS_E_ASN1_TYPE_ANY_ERROR:
+ case GNUTLS_E_ASN1_SYNTAX_ERROR:
+ case GNUTLS_E_ASN1_DER_OVERFLOW:
case GNUTLS_E_NO_CERTIFICATE_FOUND:
ret = gnutls_alert_send( state, GNUTLS_AL_FATAL, GNUTLS_A_BAD_CERTIFICATE);
break;
GNUTLS_ERROR_ENTRY( GNUTLS_E_PULL_ERROR, 1),
GNUTLS_ERROR_ENTRY( GNUTLS_E_PUSH_ERROR, 1),
GNUTLS_ERROR_ENTRY( GNUTLS_E_RECORD_LIMIT_REACHED, 1),
- GNUTLS_ERROR_ENTRY( GNUTLS_E_ASN1_PARSING_ERROR, 1),
- GNUTLS_ERROR_ENTRY( GNUTLS_E_ASN1_ERROR, 1),
GNUTLS_ERROR_ENTRY( GNUTLS_E_X509_CERTIFICATE_ERROR, 1),
GNUTLS_ERROR_ENTRY( GNUTLS_E_X509_UNKNOWN_SAN, 1),
GNUTLS_ERROR_ENTRY( GNUTLS_E_X509_UNSUPPORTED_CRITICAL_EXTENSION, 1),
GNUTLS_ERROR_ENTRY( GNUTLS_E_FILE, 1),
GNUTLS_ERROR_ENTRY( GNUTLS_E_ASCII_ARMOR, 1),
GNUTLS_ERROR_ENTRY( GNUTLS_E_UNIX_TIME_LIMIT_EXCEEDED, 1),
+ GNUTLS_ERROR_ENTRY( GNUTLS_E_ASN1_ELEMENT_NOT_FOUND, 1),
+ GNUTLS_ERROR_ENTRY( GNUTLS_E_ASN1_IDENTIFIER_NOT_FOUND, 1),
+ GNUTLS_ERROR_ENTRY( GNUTLS_E_ASN1_DER_ERROR, 1),
+ GNUTLS_ERROR_ENTRY( GNUTLS_E_ASN1_VALUE_NOT_FOUND, 1),
+ GNUTLS_ERROR_ENTRY( GNUTLS_E_ASN1_GENERIC_ERROR, 1),
+ GNUTLS_ERROR_ENTRY( GNUTLS_E_ASN1_VALUE_NOT_VALID, 1),
+ GNUTLS_ERROR_ENTRY( GNUTLS_E_ASN1_TAG_ERROR, 1),
+ GNUTLS_ERROR_ENTRY( GNUTLS_E_ASN1_TAG_IMPLICIT, 1),
+ GNUTLS_ERROR_ENTRY( GNUTLS_E_ASN1_TYPE_ANY_ERROR, 1),
+ GNUTLS_ERROR_ENTRY( GNUTLS_E_ASN1_SYNTAX_ERROR, 1),
+ GNUTLS_ERROR_ENTRY( GNUTLS_E_ASN1_DER_OVERFLOW, 1),
{0}
};
#define GNUTLS_E_GOT_APPLICATION_DATA -38
#define GNUTLS_E_RECORD_LIMIT_REACHED -39
#define GNUTLS_E_ENCRYPTION_FAILED -40
-#define GNUTLS_E_ASN1_ERROR -41
-#define GNUTLS_E_ASN1_PARSING_ERROR -42 /* GNUTLS_A_BAD_CERTIFICATE */
#define GNUTLS_E_X509_CERTIFICATE_ERROR -43
#define GNUTLS_E_PK_ENCRYPTION_FAILED -44
#define GNUTLS_E_PK_DECRYPTION_FAILED -45
#define GNUTLS_E_FILE -64
#define GNUTLS_E_ASCII_ARMOR -65
#define GNUTLS_E_UNIX_TIME_LIMIT_EXCEEDED -66
+#define GNUTLS_E_ASN1_ELEMENT_NOT_FOUND -67
+#define GNUTLS_E_ASN1_IDENTIFIER_NOT_FOUND -68
+#define GNUTLS_E_ASN1_DER_ERROR -69
+#define GNUTLS_E_ASN1_VALUE_NOT_FOUND -70
+#define GNUTLS_E_ASN1_GENERIC_ERROR -71
+#define GNUTLS_E_ASN1_VALUE_NOT_VALID -72
+#define GNUTLS_E_ASN1_TAG_ERROR -73
+#define GNUTLS_E_ASN1_TAG_IMPLICIT -74
+#define GNUTLS_E_ASN1_TYPE_ANY_ERROR -75
+#define GNUTLS_E_ASN1_SYNTAX_ERROR -76
+#define GNUTLS_E_ASN1_DER_OVERFLOW -77
#define GNUTLS_E_UNIMPLEMENTED_FEATURE -250
result = asn1_read_value(node, value, tmpstr, &len);
if (result != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
if (_gnutls_mpi_scan( ret_mpi, tmpstr, &len) != 0) {
result=asn1_create_tree( (void*)pkix_asn1_tab, &PKIX1_ASN);
if (result != ASN_OK) {
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
result=asn1_create_tree( (void*)gnutls_asn1_tab, &GNUTLS_ASN);
if (result != ASN_OK) {
asn1_delete_structure( PKIX1_ASN);
- return GNUTLS_E_PARSING_ERROR;
+ return result;
}
result = _gnutls_dh_calc_mpis();
int len = sizeof(str);
int tot_len = 0;
- if (asn1_create_structure( _gnutls_get_gnutls_asn(), "GNUTLS.DSASignatureValue",
- &sig, "sig")!=ASN_OK) {
+ if ((result=asn1_create_structure( _gnutls_get_gnutls_asn(), "GNUTLS.DSASignatureValue",
+ &sig, "sig"))!=ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
if ( _gnutls_mpi_print_lz( str, &len, r) < 0) {
if (result != ASN_OK) {
gnutls_assert();
asn1_delete_structure(sig);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
len = sizeof(str) - 1;
if (result != ASN_OK) {
gnutls_assert();
asn1_delete_structure(sig);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
sig_value->size = tot_len + 100;
if (result != ASN_OK) {
gnutls_assert();
asn1_delete_structure(sig);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
asn1_delete_structure(sig);
opaque str[MAX_PARAMETER_SIZE];
- if (asn1_create_structure( _gnutls_get_gnutls_asn(), "GNUTLS.DSASignatureValue", &sig, "sig")!=ASN_OK) {
+ if ((result=asn1_create_structure( _gnutls_get_gnutls_asn(), "GNUTLS.DSASignatureValue", &sig, "sig"))!=ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
result = asn1_get_der( sig, sig_value->data, sig_value->size);
if (result != ASN_OK) {
gnutls_assert();
asn1_delete_structure(sig);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
result =
pkey->pk_algorithm = GNUTLS_PK_RSA;
- if (asn1_create_structure( _gnutls_get_gnutls_asn(), "GNUTLS.RSAPrivateKey", &pkey_asn, "rsakey")!=ASN_OK) {
+ if ((result=asn1_create_structure( _gnutls_get_gnutls_asn(), "GNUTLS.RSAPrivateKey", &pkey_asn, "rsakey"))!=ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
if ((sizeof( pkey->params)/sizeof(MPI)) < RSA_PARAMS) {
result = asn1_get_der( pkey_asn, raw_key.data, raw_key.size);
if (result != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
if ( (result=_gnutls_x509_read_int( pkey_asn, "rsakey.modulus",
pkey->pk_algorithm = GNUTLS_PK_DSA;
- if (asn1_create_structure( _gnutls_get_gnutls_asn(), "GNUTLS.DSAPrivateKey", &dsa_asn, "dsakey")!=ASN_OK) {
+ if ((result=asn1_create_structure( _gnutls_get_gnutls_asn(), "GNUTLS.DSAPrivateKey", &dsa_asn, "dsakey"))!=ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
if ((sizeof( pkey->params)/sizeof(MPI)) < DSA_PRIVATE_PARAMS) {
result = asn1_get_der( dsa_asn, raw_key.data, raw_key.size);
if (result != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
if ( (result=_gnutls_x509_read_int( dsa_asn, "dsakey.p",
asn1_create_structure(_gnutls_get_pkix(), str,
&tmpasn, name2)) != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
len = sizeof(str) -1;
break;
if (result != ASN_VALUE_NOT_FOUND) {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
k2 = 0;
break;
if (result != ASN_VALUE_NOT_FOUND) {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
_gnutls_str_cpy(name3, sizeof(name3), name2);
break;
else if (result != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
_gnutls_str_cpy(name3, sizeof(name3), name2);
if (result == ASN_ELEMENT_NOT_FOUND)
return 0;
else
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
len = sizeof(gversion) - 1;
if ((result = asn1_read_value(c2, name, gversion, &len)) < 0) {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
return (int) gversion[0] + 1;
}
"PKIX1Implicit88.Name", &dn,
"dn")) != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
result = asn1_get_der(dn, idn->data, idn->size);
/* couldn't decode DER */
gnutls_assert();
asn1_delete_structure(dn);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
result = _gnutls_x509_get_name_type(dn, "dn", rdn);
"certificate2")
!= ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
gnutls_assert();
asn1_delete_structure(c2);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
if ((result =
_gnutls_x509_get_name_type(c2,
"certificate2")
!= ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
result = asn1_get_der(c2, cert->data, cert->size);
gnutls_assert();
asn1_delete_structure(c2);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
if ((result =
_gnutls_x509_get_name_type(c2,
return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE;
}
- if (asn1_create_structure
- (_gnutls_get_pkix(), "PKIX1Implicit88.SubjectAltName", &c2, "san")
+ if ((result=asn1_create_structure
+ (_gnutls_get_pkix(), "PKIX1Implicit88.SubjectAltName", &c2, "san"))
!= ASN_OK) {
gnutls_assert();
gnutls_free_datum( &dnsname);
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
result = asn1_get_der(c2, dnsname.data, dnsname.size);
_gnutls_log("X509_auth: Decoding error %d\n", result);
gnutls_assert();
asn1_delete_structure(c2);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
seq++; /* 0->1, 1->2 etc */
asn1_read_value(c2, nptr, ext_data, &len)) != ASN_OK) {
gnutls_assert();
asn1_delete_structure(c2);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
asn1_read_value(c2, nptr, ret, ret_size)) != ASN_OK) {
gnutls_assert();
asn1_delete_structure(c2);
- return GNUTLS_E_MEMORY_ERROR;
+ return result;
}
asn1_delete_structure(c2);
"certificate2")
!= ASN_OK) {
gnutls_assert();
- return -1;
+ return (time_t)-1;
}
result = asn1_get_der(c2, cert->data, cert->size);
_gnutls_log("X509_auth: Decoding error %d\n", result);
gnutls_assert();
- return -1;
+ return (time_t)-1;
}
ret = _gnutls_x509_get_time(c2, "certificate2", "notBefore");
"certificate2")
!= ASN_OK) {
gnutls_assert();
- return -1;
+ return (time_t)-1;
}
result = asn1_get_der(c2, cert->data, cert->size);
_gnutls_log("X509_auth: Decoding error %d\n", result);
gnutls_assert();
- return -1;
+ return (time_t)-1;
}
ret = _gnutls_x509_get_time(c2, "certificate2", "notAfter");
node_asn *c2;
int result;
- if (asn1_create_structure
+ if ((result=asn1_create_structure
(_gnutls_get_pkix(), "PKIX1Implicit88.Certificate", &c2,
- "certificate2")
+ "certificate2"))
!= ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
result = asn1_get_der(c2, cert->data, cert->size);
_gnutls_log("X509_auth: Decoding error %d\n", result);
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
result = _gnutls_x509_get_version(c2, "certificate2");
node_asn *c2;
int ret;
- if (asn1_create_structure
+ if ((ret=asn1_create_structure
(_gnutls_get_pkix(), "PKIX1Implicit88.Certificate", &c2,
- "certificate2")
+ "certificate2"))
!= ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_ERROR;
+ return ret;
}
ret = asn1_get_der(c2, cert->data, cert->size);
_gnutls_log("X509_auth: Decoding error %d\n", result);
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return ret;
}
if ((ret = asn1_read_value(c2, "certificate2.tbsCertificate.serialNumber", result, result_size)) < 0) {
gnutls_assert();
asn1_delete_structure(c2);
- return GNUTLS_E_INVALID_REQUEST;
+ return ret;
}
asn1_delete_structure(c2);
int result;
node_asn *spk;
- if (asn1_create_structure
+ if ((result=asn1_create_structure
(_gnutls_get_gnutls_asn(), "GNUTLS.RSAPublicKey", &spk,
- "rsa_public_key") != ASN_OK) {
+ "rsa_public_key")) != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
result = asn1_get_der(spk, der, dersize);
if (result != ASN_OK) {
gnutls_assert();
asn1_delete_structure(spk);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
str, sizeof(str)-1, ¶ms[0])) < 0) {
gnutls_assert();
asn1_delete_structure(spk);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return GNUTLS_E_ASN1_GENERIC_ERROR;
}
if ( (result=_gnutls_x509_read_int( spk, "rsa_public_key.publicExponent",
gnutls_assert();
_gnutls_mpi_release(¶ms[0]);
asn1_delete_structure(spk);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return GNUTLS_E_ASN1_GENERIC_ERROR;
}
asn1_delete_structure(spk);
int result;
node_asn *spk;
- if (asn1_create_structure
+ if ((result=asn1_create_structure
(_gnutls_get_pkix(), "PKIX1Implicit88.Dss-Parms", &spk,
- "dsa_parms") != ASN_OK) {
+ "dsa_parms")) != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
result = asn1_get_der(spk, der, dersize);
if (result != ASN_OK) {
gnutls_assert();
asn1_delete_structure(spk);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
/* FIXME: If the parameters are not included in the certificate
if ( (result=_gnutls_x509_read_int( spk, "dsa_parms.p", str, sizeof(str)-1, ¶ms[0])) < 0) {
gnutls_assert();
asn1_delete_structure(spk);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return GNUTLS_E_ASN1_GENERIC_ERROR;
}
/* Read q */
gnutls_assert();
asn1_delete_structure(spk);
_gnutls_mpi_release(¶ms[0]);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return GNUTLS_E_ASN1_GENERIC_ERROR;
}
/* Read g */
asn1_delete_structure(spk);
_gnutls_mpi_release(¶ms[0]);
_gnutls_mpi_release(¶ms[1]);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return GNUTLS_E_ASN1_GENERIC_ERROR;
}
asn1_delete_structure(spk);
(_gnutls_get_gnutls_asn(), "GNUTLS.DSAPublicKey", &spk,
"dsa_public_key")) != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
result = asn1_get_der(spk, der, dersize);
if (result != ASN_OK) {
gnutls_assert();
asn1_delete_structure(spk);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
/* Read p */
if ( (result=_gnutls_x509_read_int( spk, "dsa_public_key", str, sizeof(str)-1, ¶ms[3])) < 0) {
gnutls_assert();
asn1_delete_structure(spk);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return GNUTLS_E_ASN1_GENERIC_ERROR;
}
asn1_delete_structure(spk);
if (result != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
if ((sizeof(gCert->params) / sizeof(MPI)) < RSA_PARAMS) {
if (result != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
if ((sizeof(gCert->params) / sizeof(MPI)) < DSA_PUBLIC_PARAMS) {
if (result != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
if ((result =
return GNUTLS_E_MEMORY_ERROR;
}
- if (asn1_create_structure
+ if ((result=asn1_create_structure
(_gnutls_get_pkix(), "PKIX1Implicit88.Certificate", &c2,
- "certificate2")
+ "certificate2"))
!= ASN_OK) {
gnutls_assert();
gnutls_free_datum( &gCert->raw);
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
result = asn1_get_der(c2, derCert.data, derCert.size);
gnutls_assert();
asn1_delete_structure(c2);
gnutls_free_datum( &gCert->raw);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
len = sizeof(str) - 1;
gnutls_assert();
asn1_delete_structure(c2);
gnutls_free_datum( &gCert->raw);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
if ( (result=_gnutls_extract_x509_cert_mpi_params( str, gCert, c2, str, sizeof(str))) < 0) {
gCert->activation_time =
_gnutls_x509_get_time(c2, "certificate2", "notBefore");
+#if 0
if (gCert->expiration_time == (time_t)(-1) ||
gCert->activation_time == (time_t)(-1)) {
gnutls_assert();
asn1_delete_structure(c2);
return GNUTLS_E_UNIX_TIME_LIMIT_EXCEEDED;
}
+#endif
gCert->version = _gnutls_x509_get_version(c2, "certificate2");
if (gCert->version < 0) {
gnutls_assert();
asn1_delete_structure(c2);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return GNUTLS_E_ASN1_GENERIC_ERROR;
}
if ((result =
#line 30 "x509_ASN.y"
#include <gnutls_int.h>
-#include "x509_asn1.h"
+#include <x509_asn1.h>
+#include <gnutls_errors.h>
FILE *file_asn1; /* Pointer to file to parse */
extern int parse_mode; /* PARSE_MODE_CHECK = only syntax check
int yylex(void);
-#line 47 "x509_ASN.y"
+#line 48 "x509_ASN.y"
#ifndef YYSTYPE
typedef union {
unsigned int constant;
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const short yyrline[] =
{
- 0, 106, 107, 110, 111, 114, 118, 119, 122, 123,
- 126, 127, 130, 132, 137, 138, 142, 144, 150, 152,
- 157, 158, 162, 163, 164, 167, 169, 173, 174, 175,
- 178, 180, 181, 184, 185, 187, 194, 197, 198, 201,
- 203, 209, 210, 213, 214, 218, 223, 224, 228, 229,
- 234, 239, 242, 244, 247, 248, 249, 250, 251, 252,
- 253, 254, 255, 256, 257, 258, 261, 262, 267, 268,
- 271, 274, 277, 278, 282, 284, 286, 291, 293, 295,
- 300, 304, 305, 310, 313, 317, 322, 328, 329, 332,
- 333, 337, 340, 344, 345, 353, 354, 357
+ 0, 107, 108, 111, 112, 115, 119, 120, 123, 124,
+ 127, 128, 131, 133, 138, 139, 143, 145, 151, 153,
+ 158, 159, 163, 164, 165, 168, 170, 174, 175, 176,
+ 179, 181, 182, 185, 186, 188, 195, 198, 199, 202,
+ 204, 210, 211, 214, 215, 219, 224, 225, 229, 230,
+ 235, 240, 243, 245, 248, 249, 250, 251, 252, 253,
+ 254, 255, 256, 257, 258, 259, 262, 263, 268, 269,
+ 272, 275, 278, 279, 283, 285, 287, 292, 294, 296,
+ 301, 305, 306, 311, 314, 318, 323, 329, 330, 333,
+ 334, 338, 341, 345, 346, 354, 355, 358
};
#endif
switch (yyn) {
case 3:
-#line 110 "x509_ASN.y"
+#line 111 "x509_ASN.y"
{strcpy(yyval.str,yyvsp[0].str);}
break;
case 4:
-#line 111 "x509_ASN.y"
+#line 112 "x509_ASN.y"
{strcpy(yyval.str,yyvsp[0].str);}
break;
case 5:
-#line 114 "x509_ASN.y"
+#line 115 "x509_ASN.y"
{strcpy(yyval.str,"-");
strcat(yyval.str,yyvsp[0].str);}
break;
case 6:
-#line 118 "x509_ASN.y"
+#line 119 "x509_ASN.y"
{strcpy(yyval.str,yyvsp[0].str);}
break;
case 7:
-#line 119 "x509_ASN.y"
+#line 120 "x509_ASN.y"
{strcpy(yyval.str,yyvsp[0].str);}
break;
case 8:
-#line 122 "x509_ASN.y"
+#line 123 "x509_ASN.y"
{strcpy(yyval.str,yyvsp[0].str);}
break;
case 9:
-#line 123 "x509_ASN.y"
+#line 124 "x509_ASN.y"
{strcpy(yyval.str,yyvsp[0].str);}
break;
case 10:
-#line 126 "x509_ASN.y"
+#line 127 "x509_ASN.y"
{strcpy(yyval.str,yyvsp[0].str);}
break;
case 11:
-#line 127 "x509_ASN.y"
+#line 128 "x509_ASN.y"
{strcpy(yyval.str,yyvsp[0].str);}
break;
case 12:
-#line 130 "x509_ASN.y"
+#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;
case 13:
-#line 132 "x509_ASN.y"
+#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;
case 14:
-#line 137 "x509_ASN.y"
+#line 138 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 15:
-#line 138 "x509_ASN.y"
+#line 139 "x509_ASN.y"
{yyval.node=yyvsp[-2].node;
_asn1_set_right(_asn1_get_last_right(yyvsp[-2].node),yyvsp[0].node);}
break;
case 16:
-#line 142 "x509_ASN.y"
+#line 143 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_IDENTIFIER);
_asn1_set_name(yyval.node,yyvsp[0].str);}
break;
case 17:
-#line 145 "x509_ASN.y"
+#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;
case 18:
-#line 150 "x509_ASN.y"
+#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;
case 19:
-#line 152 "x509_ASN.y"
+#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;
case 20:
-#line 157 "x509_ASN.y"
+#line 158 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 21:
-#line 158 "x509_ASN.y"
+#line 159 "x509_ASN.y"
{yyval.node=yyvsp[-1].node;
_asn1_set_right(_asn1_get_last_right(yyvsp[-1].node),yyvsp[0].node);}
break;
case 22:
-#line 162 "x509_ASN.y"
+#line 163 "x509_ASN.y"
{yyval.constant=CONST_UNIVERSAL;}
break;
case 23:
-#line 163 "x509_ASN.y"
+#line 164 "x509_ASN.y"
{yyval.constant=CONST_PRIVATE;}
break;
case 24:
-#line 164 "x509_ASN.y"
+#line 165 "x509_ASN.y"
{yyval.constant=CONST_APPLICATION;}
break;
case 25:
-#line 167 "x509_ASN.y"
+#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;
case 26:
-#line 169 "x509_ASN.y"
+#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;
case 27:
-#line 173 "x509_ASN.y"
+#line 174 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 28:
-#line 174 "x509_ASN.y"
+#line 175 "x509_ASN.y"
{yyval.node=_asn1_mod_type(yyvsp[-1].node,CONST_EXPLICIT);}
break;
case 29:
-#line 175 "x509_ASN.y"
+#line 176 "x509_ASN.y"
{yyval.node=_asn1_mod_type(yyvsp[-1].node,CONST_IMPLICIT);}
break;
case 30:
-#line 178 "x509_ASN.y"
+#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;
case 31:
-#line 180 "x509_ASN.y"
+#line 181 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_DEFAULT|CONST_TRUE);}
break;
case 32:
-#line 181 "x509_ASN.y"
+#line 182 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_DEFAULT|CONST_FALSE);}
break;
case 33:
-#line 184 "x509_ASN.y"
+#line 185 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_INTEGER);}
break;
case 34:
-#line 185 "x509_ASN.y"
+#line 186 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_INTEGER|CONST_LIST);
_asn1_set_down(yyval.node,yyvsp[-1].node);}
break;
case 35:
-#line 188 "x509_ASN.y"
+#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;
case 36:
-#line 194 "x509_ASN.y"
+#line 195 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_BOOLEAN);}
break;
case 37:
-#line 197 "x509_ASN.y"
+#line 198 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_TIME|CONST_UTC);}
break;
case 38:
-#line 198 "x509_ASN.y"
+#line 199 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_TIME|CONST_GENERALIZED);}
break;
case 39:
-#line 201 "x509_ASN.y"
+#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;
case 40:
-#line 204 "x509_ASN.y"
+#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;
case 41:
-#line 209 "x509_ASN.y"
+#line 210 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 42:
-#line 210 "x509_ASN.y"
+#line 211 "x509_ASN.y"
{yyval.node=yyvsp[-1].node;}
break;
case 43:
-#line 213 "x509_ASN.y"
+#line 214 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_OCTET_STRING);}
break;
case 44:
-#line 214 "x509_ASN.y"
+#line 215 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_OCTET_STRING|CONST_SIZE);
_asn1_set_down(yyval.node,yyvsp[0].node);}
break;
case 45:
-#line 218 "x509_ASN.y"
+#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;
case 46:
-#line 223 "x509_ASN.y"
+#line 224 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 47:
-#line 224 "x509_ASN.y"
+#line 225 "x509_ASN.y"
{yyval.node=yyvsp[-2].node;
_asn1_set_right(_asn1_get_last_right(yyvsp[-2].node),yyvsp[0].node);}
break;
case 48:
-#line 228 "x509_ASN.y"
+#line 229 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_BIT_STRING);}
break;
case 49:
-#line 230 "x509_ASN.y"
+#line 231 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_BIT_STRING|CONST_LIST);
_asn1_set_down(yyval.node,yyvsp[-1].node);}
break;
case 50:
-#line 235 "x509_ASN.y"
+#line 236 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_ENUMERATED|CONST_LIST);
_asn1_set_down(yyval.node,yyvsp[-1].node);}
break;
case 51:
-#line 239 "x509_ASN.y"
+#line 240 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_OBJECT_ID);}
break;
case 52:
-#line 242 "x509_ASN.y"
+#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;
case 53:
-#line 244 "x509_ASN.y"
+#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;
case 54:
-#line 247 "x509_ASN.y"
+#line 248 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 55:
-#line 248 "x509_ASN.y"
+#line 249 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 56:
-#line 249 "x509_ASN.y"
+#line 250 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 58:
-#line 251 "x509_ASN.y"
+#line 252 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 59:
-#line 252 "x509_ASN.y"
+#line 253 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 60:
-#line 253 "x509_ASN.y"
+#line 254 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 61:
-#line 254 "x509_ASN.y"
+#line 255 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 62:
-#line 255 "x509_ASN.y"
+#line 256 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 63:
-#line 256 "x509_ASN.y"
+#line 257 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 64:
-#line 257 "x509_ASN.y"
+#line 258 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 65:
-#line 258 "x509_ASN.y"
+#line 259 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_NULL);}
break;
case 66:
-#line 261 "x509_ASN.y"
+#line 262 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 67:
-#line 262 "x509_ASN.y"
+#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;
case 68:
-#line 267 "x509_ASN.y"
+#line 268 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 69:
-#line 268 "x509_ASN.y"
+#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;
case 70:
-#line 271 "x509_ASN.y"
+#line 272 "x509_ASN.y"
{yyval.node=_asn1_mod_type(yyvsp[-1].node,CONST_OPTION);}
break;
case 71:
-#line 274 "x509_ASN.y"
+#line 275 "x509_ASN.y"
{yyval.node=_asn1_set_name(yyvsp[0].node,yyvsp[-1].str);}
break;
case 72:
-#line 277 "x509_ASN.y"
+#line 278 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 73:
-#line 278 "x509_ASN.y"
+#line 279 "x509_ASN.y"
{yyval.node=yyvsp[-2].node;
_asn1_set_right(_asn1_get_last_right(yyvsp[-2].node),yyvsp[0].node);}
break;
case 74:
-#line 282 "x509_ASN.y"
+#line 283 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_SEQUENCE);
_asn1_set_down(yyval.node,yyvsp[-1].node);}
break;
case 75:
-#line 284 "x509_ASN.y"
+#line 285 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_SEQUENCE_OF);
_asn1_set_down(yyval.node,yyvsp[0].node);}
break;
case 76:
-#line 286 "x509_ASN.y"
+#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;
case 77:
-#line 291 "x509_ASN.y"
+#line 292 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_SET);
_asn1_set_down(yyval.node,yyvsp[-1].node);}
break;
case 78:
-#line 293 "x509_ASN.y"
+#line 294 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_SET_OF);
_asn1_set_down(yyval.node,yyvsp[0].node);}
break;
case 79:
-#line 295 "x509_ASN.y"
+#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;
case 80:
-#line 300 "x509_ASN.y"
+#line 301 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_CHOICE);
_asn1_set_down(yyval.node,yyvsp[-1].node);}
break;
case 81:
-#line 304 "x509_ASN.y"
+#line 305 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_ANY);}
break;
case 82:
-#line 305 "x509_ASN.y"
+#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;
case 83:
-#line 310 "x509_ASN.y"
+#line 311 "x509_ASN.y"
{yyval.node=_asn1_set_name(yyvsp[0].node,yyvsp[-2].str);}
break;
case 84:
-#line 314 "x509_ASN.y"
+#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;
case 85:
-#line 318 "x509_ASN.y"
+#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;
case 86:
-#line 323 "x509_ASN.y"
+#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;
case 87:
-#line 328 "x509_ASN.y"
+#line 329 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 88:
-#line 329 "x509_ASN.y"
+#line 330 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 89:
-#line 332 "x509_ASN.y"
+#line 333 "x509_ASN.y"
{yyval.node=yyvsp[0].node;}
break;
case 90:
-#line 333 "x509_ASN.y"
+#line 334 "x509_ASN.y"
{yyval.node=yyvsp[-1].node;
_asn1_set_right(_asn1_get_last_right(yyvsp[-1].node),yyvsp[0].node);}
break;
case 91:
-#line 337 "x509_ASN.y"
+#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;
case 92:
-#line 340 "x509_ASN.y"
+#line 341 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_OBJECT_ID);
_asn1_set_name(yyval.node,yyvsp[-2].str);}
break;
case 93:
-#line 344 "x509_ASN.y"
+#line 345 "x509_ASN.y"
{yyval.node=NULL;}
break;
case 94:
-#line 346 "x509_ASN.y"
+#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_right(yyval.node,yyvsp[-3].node);}
break;
case 95:
-#line 353 "x509_ASN.y"
+#line 354 "x509_ASN.y"
{yyval.constant=CONST_EXPLICIT;}
break;
case 96:
-#line 354 "x509_ASN.y"
+#line 355 "x509_ASN.y"
{yyval.constant=CONST_IMPLICIT;}
break;
case 97:
-#line 360 "x509_ASN.y"
+#line 361 "x509_ASN.y"
{yyval.node=_asn1_add_node(TYPE_DEFINITIONS|yyvsp[-6].constant|((yyvsp[-2].node==NULL)?0:CONST_IMPORTS));
_asn1_set_name(yyval.node,_asn1_get_name(yyvsp[-8].node));
_asn1_set_name(yyvsp[-8].node,"");
#endif
return yyresult;
}
-#line 376 "x509_ASN.y"
+#line 377 "x509_ASN.y"
%{
#include <gnutls_int.h>
-#include "x509_asn1.h"
+#include <x509_asn1.h>
+#include <gnutls_errors.h>
FILE *file_asn1; /* Pointer to file to parse */
extern int parse_mode; /* PARSE_MODE_CHECK = only syntax check
#define ASN_OK 0
-#define ASN_FILE_NOT_FOUND 1
-#define ASN_ELEMENT_NOT_FOUND 2
-#define ASN_IDENTIFIER_NOT_FOUND 3
-#define ASN_DER_ERROR 4
-#define ASN_VALUE_NOT_FOUND 5
-#define ASN_GENERIC_ERROR 6
-#define ASN_VALUE_NOT_VALID 7
-#define ASN_TAG_ERROR 8
-#define ASN_TAG_IMPLICIT 9
-#define ASN_ERROR_TYPE_ANY 10
-#define ASN_SYNTAX_ERROR 11
-#define ASN_MEM_ERROR 12
-#define ASN_DER_OVERFLOW 13
+#define ASN_FILE_NOT_FOUND GNUTLS_E_FILE
+#define ASN_ELEMENT_NOT_FOUND GNUTLS_E_ASN1_ELEMENT_NOT_FOUND
+#define ASN_IDENTIFIER_NOT_FOUND GNUTLS_E_ASN1_IDENTIFIER_NOT_FOUND
+#define ASN_DER_ERROR GNUTLS_E_ASN1_DER_ERROR
+#define ASN_VALUE_NOT_FOUND GNUTLS_E_ASN1_VALUE_NOT_FOUND
+#define ASN_GENERIC_ERROR GNUTLS_E_ASN1_GENERIC_ERROR
+#define ASN_VALUE_NOT_VALID GNUTLS_E_ASN1_VALUE_NOT_VALID
+#define ASN_TAG_ERROR GNUTLS_E_ASN1_TAG_ERROR
+#define ASN_TAG_IMPLICIT GNUTLS_E_ASN1_TAG_IMPLICIT
+#define ASN_ERROR_TYPE_ANY GNUTLS_E_ASN1_TYPE_ANY_ERROR
+#define ASN_SYNTAX_ERROR GNUTLS_E_ASN1_SYNTAX_ERROR
+#define ASN_MEM_ERROR GNUTLS_E_MEMORY_ERROR
+#define ASN_DER_OVERFLOW GNUTLS_E_ASN1_DER_OVERFLOW
/******************************************************/
keyUsage[0] = 0;
- if (asn1_create_structure
+ if ((result=asn1_create_structure
(_gnutls_get_pkix(), "PKIX1Implicit88.KeyUsage", &ext,
- "ku") != ASN_OK) {
+ "ku")) != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
result = asn1_get_der(ext, extnValue, extnValueLen);
*CA = 0;
- if (asn1_create_structure
+ if ((result=asn1_create_structure
(_gnutls_get_pkix(), "PKIX1Implicit88.BasicConstraints", &ext,
- "bc") != ASN_OK) {
+ "bc")) != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
result = asn1_get_der(ext, extnValue, extnValueLen);
break;
else if (result != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
_gnutls_str_cpy(name2, sizeof(name2), name);
break;
else if (result != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
_gnutls_str_cpy(name2, sizeof(name2), name);
}
if (result != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
}
if (result == ASN_ELEMENT_NOT_FOUND)
return 0;
else
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
/* This function will attempt to return the requested extension found in
ret->data = NULL;
ret->size = 0;
- if (asn1_create_structure
+ if ((result=asn1_create_structure
(_gnutls_get_pkix(), "PKIX1Implicit88.Certificate", &rasn,
- "certificate2")
+ "certificate2"))
!= ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
result =
gnutls_assert();
asn1_delete_structure(rasn);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
k = 0;
break;
} else if (result != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
_gnutls_str_cpy(name2, sizeof(name2), name);
} else if (result != ASN_OK) {
gnutls_assert();
asn1_delete_structure(rasn);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
_gnutls_str_cpy(name2, sizeof(name2), name);
if (result != ASN_OK) {
gnutls_assert();
asn1_delete_structure(rasn);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
}
return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE;
} else {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
}
opaque str[1024];
int len;
- if (asn1_create_structure( _gnutls_get_gnutls_asn(), "GNUTLS.DigestInfo", &dinfo, "digest_info")!=ASN_OK) {
+ if ((result=asn1_create_structure( _gnutls_get_gnutls_asn(), "GNUTLS.DigestInfo", &dinfo, "digest_info"))!=ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
result = asn1_get_der( dinfo, info->data, info->size);
if (result != ASN_OK) {
gnutls_assert();
asn1_delete_structure(dinfo);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
len = sizeof(str)-1;
if (result != ASN_OK) {
gnutls_assert();
asn1_delete_structure(dinfo);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
*hash = -1;
if (result != ASN_OK) {
gnutls_assert();
asn1_delete_structure(dinfo);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
asn1_delete_structure(dinfo);
if (digest_size != gnutls_hash_get_algo_len(hash)) {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return GNUTLS_E_ASN1_GENERIC_ERROR;
}
hd = gnutls_hash_init( hash);
gnutls_assert();
/* sorry we don't support it yet
*/
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return GNUTLS_E_ASN1_GENERIC_ERROR;
}
xx[4] = 0;
static int check_if_expired(gnutls_cert * cert)
{
CertificateStatus ret = GNUTLS_CERT_EXPIRED;
+
+ if (cert->expiration_time == (time_t)(-1))
+ return GNUTLS_CERT_INVALID;
/* get the issuer of 'cert'
*/
/* get the issuer of 'cert'
*/
- if (asn1_create_structure(_gnutls_get_pkix(), "PKIX1Implicit88.Certificate", &c2, "certificate2") != ASN_OK) {
+ if ((result=asn1_create_structure(_gnutls_get_pkix(), "PKIX1Implicit88.Certificate", &c2, "certificate2")) != ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
result = asn1_get_der(c2, cert->raw.data, cert->raw.size);
/* couldn't decode DER */
gnutls_assert();
asn1_delete_structure(c2);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
/* get the 'subject' info of 'issuer_cert'
*/
- if (asn1_create_structure(_gnutls_get_pkix(), "PKIX1Implicit88.Certificate", &c3, "certificate2") != ASN_OK) {
+ if ((result=asn1_create_structure(_gnutls_get_pkix(), "PKIX1Implicit88.Certificate", &c3, "certificate2")) != ASN_OK) {
gnutls_assert();
asn1_delete_structure(c2);
- return GNUTLS_E_ASN1_ERROR;
+ return result;
}
result = asn1_get_der(c3, issuer_cert->raw.data, issuer_cert->raw.size);
/* couldn't decode DER */
gnutls_assert();
asn1_delete_structure(c2);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
if (result!=ASN_OK) {
gnutls_assert();
asn1_delete_structure( c3);
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
len1 = end1 - start1 + 1;
if (result!=ASN_OK) {
gnutls_assert();
- return GNUTLS_E_ASN1_PARSING_ERROR;
+ return result;
}
len2 = end2 - start2 + 1;
ret = check_if_expired( issuer);
if (ret != 0) {
gnutls_assert();
- return ret_else | GNUTLS_CERT_EXPIRED;
+ return ret_else | ret;
}
ret = gnutls_x509_verify_signature(cert, issuer);
ret = check_if_expired( &certificate_list[0]);
if (ret != 0) {
gnutls_assert();
- status |= GNUTLS_CERT_EXPIRED;
+ status |= ret;
}
/* Verify the certificate path */