diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2001-12-06 12:18:04 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2001-12-06 12:18:04 +0000 |
commit | 430e38e3aa7d2cf790e46c7227dc0c2ba984e250 (patch) | |
tree | fcc4418b3ca4302ec38ef2180fe1910201adb8ad /lib | |
parent | 8a1d4c3c4db78f679e628679c0449f49a0d00a4c (diff) | |
download | gnutls-430e38e3aa7d2cf790e46c7227dc0c2ba984e250.tar.gz |
some changes to keep gcc -Wall happy
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/x509_ASN.y | 7 | ||||
-rwxr-xr-x | lib/x509_asn1.c | 35 | ||||
-rwxr-xr-x | lib/x509_asn1.h | 17 | ||||
-rw-r--r-- | lib/x509_der.c | 21 | ||||
-rw-r--r-- | lib/x509_der.h | 8 |
5 files changed, 54 insertions, 34 deletions
diff --git a/lib/x509_ASN.y b/lib/x509_ASN.y index 567a8e8d86..abe38013aa 100755 --- a/lib/x509_ASN.y +++ b/lib/x509_ASN.y @@ -37,6 +37,10 @@ extern int parse_mode; /* PARSE_MODE_CHECK = only syntax check int result_parse; /* result of the parser algorithm */ node_asn *p_tree; /* pointer to the root of the structure created by the parser*/ + +int yyerror (char *); +int yylex(); + %} @@ -546,7 +550,7 @@ int asn1_parser_asn1_file_c(char *file_name){ yyparse(); /* structure saved in a file */ - result=_asn1_create_static_structure(p_tree,file_name); + result=_asn1_create_static_structure(p_tree,file_name,NULL); /* delete structure in memory */ asn1_delete_structure(p_tree); @@ -573,6 +577,7 @@ int yyerror (char *s) /* Sends the error description to the std_out */ /* printf("%s\n",s); */ result_parse=ASN_SYNTAX_ERROR; + return 0; } diff --git a/lib/x509_asn1.c b/lib/x509_asn1.c index a377f91efa..4e01b543ba 100755 --- a/lib/x509_asn1.c +++ b/lib/x509_asn1.c @@ -30,6 +30,8 @@ #include "x509_asn1.h" #include "x509_der.h" + + /* define used for visiting trees */ #define UP 1 #define RIGHT 2 @@ -266,8 +268,6 @@ _asn1_mod_type(node_asn *node,unsigned int value) void _asn1_remove_node(node_asn *node) { - node_asn *punt,*punt_prev; - if(node==NULL) return; if (node->name!=NULL) @@ -520,7 +520,7 @@ _asn1_create_static_structure(node_asn *pointer,char *file_name, char* out_name) char_p=file_name; slash_p=file_name; - while(char_p=strchr(char_p,'/')){ + while((char_p=strchr(char_p,'/'))){ char_p++; slash_p=char_p; } @@ -528,7 +528,7 @@ _asn1_create_static_structure(node_asn *pointer,char *file_name, char* out_name) char_p=slash_p; dot_p=file_name+strlen(file_name); - while(char_p=strchr(char_p,'.')){ + while((char_p=strchr(char_p,'.'))){ dot_p=char_p; char_p++; } @@ -610,8 +610,6 @@ asn1_visit_tree(node_asn *pointer,char *name) { node_asn *p,*root; int k,indent=0,len,len2,len3; - unsigned char class; - unsigned long tag; root=_asn1_find_node(pointer,name); @@ -663,8 +661,8 @@ asn1_visit_tree(node_asn *pointer,char *name) case TYPE_BOOLEAN: printf("BOOLEAN"); if(p->value){ - if(p->value[0]=='T') printf(" value:TRUE",p->value); - else if(p->value[0]=='F') printf(" value:FALSE",p->value); + if(p->value[0]=='T') printf(" value:TRUE"); + else if(p->value[0]=='F') printf(" value:FALSE"); } break; case TYPE_SEQUENCE: @@ -1082,9 +1080,8 @@ int asn1_write_value(node_asn *node_root,char *name,unsigned char *value,int len) { node_asn *node,*p,*p2; - unsigned char *temp,*value_temp,*default_temp,val[4]; + unsigned char *temp,*value_temp,*default_temp; int len2,k,k2,negative; - unsigned char *root,*n_end; node=_asn1_find_node(node_root,name); if(node==NULL) return ASN_ELEMENT_NOT_FOUND; @@ -1364,8 +1361,6 @@ asn1_read_value(node_asn *root,char *name,unsigned char *value,int *len) { node_asn *node,*p; int len2,len3; - unsigned long tag; - unsigned char class; int value_size = *len; node=_asn1_find_node(root,name); @@ -1416,12 +1411,13 @@ asn1_read_value(node_asn *root,char *name,unsigned char *value,int *len) while(p){ if(type_field(p->type)==TYPE_CONSTANT){ ADD_STR_VALUE( value, value_size, p->value); - if(p->right) ADD_STR_VALUE( value, value_size, " "); + if(p->right) { + ADD_STR_VALUE( value, value_size, " "); + } } p=p->right; } - } - else { + } else { PUT_STR_VALUE(value, value_size, node->value); } break; @@ -1547,10 +1543,9 @@ _asn1_check_identifier(node_asn *node) int _asn1_change_integer_value(node_asn *node) { - node_asn *p,*p2; - char negative; - unsigned char val[4],val2[5],temp; - int len,k,force_exit; + node_asn *p; + unsigned char val[4],val2[5]; + int len; if(node==NULL) return ASN_ELEMENT_NOT_FOUND; @@ -1821,7 +1816,7 @@ int _asn1_expand_object_id(node_asn *node) { node_asn *p,*p2,*p3,*p4,*p5; - char name_root[129],name2[129],*c; + char name_root[129],name2[129]; int move; if(node==NULL) return ASN_ELEMENT_NOT_FOUND; diff --git a/lib/x509_asn1.h b/lib/x509_asn1.h index c3bdb98d34..988b53332c 100755 --- a/lib/x509_asn1.h +++ b/lib/x509_asn1.h @@ -160,6 +160,23 @@ _asn1_find_node(node_asn *pointer,char *name); node_asn * _asn1_find_up(node_asn *node); +int +_asn1_append_sequence_set(node_asn *node); + +int +_asn1_delete_not_used(node_asn *node); + +int +_asn1_set_default_tag(node_asn *node); + +/* prototypes - not defined elsewere */ +int _asn1_change_integer_value(node_asn *node); +int _asn1_expand_object_id(node_asn *node); +int _asn1_expand_identifier(node_asn **node,node_asn *root); +int _asn1_type_choice_config(node_asn *node); +int _asn1_type_set_config(node_asn *node); +int _asn1_check_identifier(node_asn *node); +int _asn1_create_static_structure(node_asn *pointer,char *file_name, char* out_name); int asn1_parser_asn1(char *file_name,node_asn **pointer); diff --git a/lib/x509_der.c b/lib/x509_der.c index f523e7f08a..78b8b6b04f 100644 --- a/lib/x509_der.c +++ b/lib/x509_der.c @@ -46,7 +46,7 @@ char * _asn1_ltostr(long v,char *str) { - long d,r,v2; + long d,r; char temp[20]; int count,k,start; @@ -152,7 +152,6 @@ _asn1_tag_der(unsigned char class,unsigned int tag_value,unsigned char *ans,int unsigned int _asn1_get_tag_der(unsigned char *der,unsigned char *class,int *len) { - unsigned long ans; int punt,ris; *class=der[0]&0xE0; @@ -276,7 +275,7 @@ _asn1_objectid_der(unsigned char *str,unsigned char *der,int *der_len) counter=0; n_start=temp; - while(n_end=strchr(n_start,' ')){ + while((n_end=strchr(n_start,' '))){ *n_end=0; val=strtoul(n_start,NULL,10); counter++; @@ -391,10 +390,9 @@ void _asn1_complete_explicit_tag(node_asn *node,unsigned char *der,int *counter) { node_asn *p; - int tag_len,is_tag_implicit,len2,len3; - unsigned char class,class_implicit,temp[10]; - unsigned long tag_implicit; - + int is_tag_implicit,len2,len3; + unsigned char temp[10]; + is_tag_implicit=0; if(node->type&CONST_TAG){ @@ -426,7 +424,7 @@ int _asn1_insert_tag_der(node_asn *node,unsigned char *der,int *counter) { node_asn *p; - int tag_len,is_tag_implicit,len2,len3; + int tag_len,is_tag_implicit; unsigned char class,class_implicit,temp[10]; unsigned long tag_implicit; @@ -833,9 +831,9 @@ _asn1_ordering_set_of(unsigned char *der,node_asn *node) int asn1_create_der(node_asn *root,char *name,unsigned char *der,int *len) { - node_asn *node,*p,*p2,*p3; + node_asn *node,*p; char temp[20]; - int counter,counter_old,len2,len3,len4,move,ris; + int counter,counter_old,len2,len3,move,ris; node=_asn1_find_node(root,name); if(node==NULL) return ASN_ELEMENT_NOT_FOUND; @@ -995,7 +993,6 @@ asn1_get_der(node_asn *root,unsigned char *der,int len) int counter,len2,len3,len4,move,ris; unsigned char class,*temp2; unsigned int tag; - long val; node=root; if(node==NULL) return ASN_ELEMENT_NOT_FOUND; @@ -1239,11 +1236,9 @@ int asn1_get_start_end_der(node_asn *root,unsigned char *der,int len,char *name_element,int *start, int *end) { node_asn *node,*node_to_find,*p,*p2,*p3; - char temp[128]; int counter,len2,len3,move,ris; unsigned char class; unsigned int tag; - long val; node=root; node_to_find=_asn1_find_node(root,name_element); diff --git a/lib/x509_der.h b/lib/x509_der.h index 024367f159..b926963dc2 100644 --- a/lib/x509_der.h +++ b/lib/x509_der.h @@ -37,6 +37,14 @@ asn1_get_der(node_asn *root,unsigned char *der,int len); int asn1_get_start_end_der(node_asn *root,unsigned char *der,int len,char *name_element,int *start, int *end); +unsigned long +_asn1_get_length_der(unsigned char *der,int *len); + +void +_asn1_length_der(unsigned long len,unsigned char *ans,int *ans_len); + +char * +_asn1_ltostr(long v,char *str); #endif |