diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-02-28 00:35:44 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-02-28 00:35:44 +0000 |
commit | 2c310f4b35adb1ec2b5495666d3db2d5f4a856e0 (patch) | |
tree | 158ea3b726ef66058c0bdeadae60de004948fe00 | |
parent | d04492a5df53ac998f5b45bf503547c618ed88d6 (diff) | |
download | gnutls-2c310f4b35adb1ec2b5495666d3db2d5f4a856e0.tar.gz |
added new libtasn1 (0.2.7)
-rw-r--r-- | lib/minitasn1/coding.c | 5 | ||||
-rw-r--r-- | lib/minitasn1/decoding.c | 15 | ||||
-rw-r--r-- | lib/minitasn1/element.c | 10 | ||||
-rw-r--r-- | lib/minitasn1/int.h | 6 | ||||
-rw-r--r-- | lib/minitasn1/libtasn1.h | 14 | ||||
-rw-r--r-- | lib/minitasn1/structure.c | 2 |
6 files changed, 29 insertions, 23 deletions
diff --git a/lib/minitasn1/coding.c b/lib/minitasn1/coding.c index d46dc7b3f0..4f3c575126 100644 --- a/lib/minitasn1/coding.c +++ b/lib/minitasn1/coding.c @@ -717,7 +717,7 @@ _asn1_ordering_set_of(unsigned char *der,node_asn *node) * asn1_der_coding - Creates the DER encoding for the NAME structure * @element: pointer to an ASN1 element * @name: the name of the structure you want to encode (it must be inside *POINTER). - * @der: vector that will contain the DER encoding. DER must be a pointer to memory cells already allocated. + * @ider: vector that will contain the DER encoding. DER must be a pointer to memory cells already allocated. * @len: number of bytes of *der: der[0]..der[len-1], Initialy holds the sizeof of der vector. * @errorDescription : return the error description or an empty string if success. * Description: @@ -737,13 +737,14 @@ _asn1_ordering_set_of(unsigned char *der,node_asn *node) * **/ asn1_retCode -asn1_der_coding(ASN1_TYPE element,const char *name,unsigned char *der,int *len, +asn1_der_coding(ASN1_TYPE element,const char *name,void *ider,int *len, char *ErrorDescription) { node_asn *node,*p,*p2; char temp[SIZEOF_UNSIGNED_LONG_INT*3+1]; int counter,counter_old,len2,len3,move,max_len,max_len_old; asn1_retCode ris; + unsigned char* der = ider; node=_asn1_find_node(element,name); if(node==NULL) return ASN1_ELEMENT_NOT_FOUND; diff --git a/lib/minitasn1/decoding.c b/lib/minitasn1/decoding.c index 3e3e9d85f2..34825e3f3a 100644 --- a/lib/minitasn1/decoding.c +++ b/lib/minitasn1/decoding.c @@ -485,7 +485,7 @@ _asn1_get_indefinite_length_string(const unsigned char* der,int* len) /** * asn1_der_decoding - Fill the structure *ELEMENT with values of a DER encoding string. * @element: pointer to an ASN1 structure - * @der: vector that contains the DER encoding. + * @ider: vector that contains the DER encoding. * @len: number of bytes of *der: der[0]..der[len-1] * Description: * @@ -504,7 +504,7 @@ _asn1_get_indefinite_length_string(const unsigned char* der,int* len) **/ asn1_retCode -asn1_der_decoding(ASN1_TYPE *element,const unsigned char *der,int len, +asn1_der_decoding(ASN1_TYPE *element,const void *ider,int len, char *errorDescription) { node_asn *node,*p,*p2,*p3; @@ -513,6 +513,7 @@ asn1_der_decoding(ASN1_TYPE *element,const unsigned char *der,int len, unsigned char class,*temp2; unsigned int tag; int indefinite; + const unsigned char* der = ider; node=*element; @@ -900,7 +901,7 @@ asn1_der_decoding(ASN1_TYPE *element,const unsigned char *der,int len, * asn1_der_decoding_element - Fill the element named ELEMENTNAME of the structure STRUCTURE with values of a DER encoding string. * @structure: pointer to an ASN1 structure * @elementName: name of the element to fill - * @der: vector that contains the DER encoding of the whole structure. + * @ider: vector that contains the DER encoding of the whole structure. * @len: number of bytes of *der: der[0]..der[len-1] * @errorDescription: null-terminated string contains details when an arror accured. * @@ -923,7 +924,7 @@ asn1_der_decoding(ASN1_TYPE *element,const unsigned char *der,int len, **/ asn1_retCode asn1_der_decoding_element(ASN1_TYPE *structure,const char *elementName, - const unsigned char *der,int len,char *errorDescription) + const void *ider,int len,char *errorDescription) { node_asn *node,*p,*p2,*p3,*nodeFound=ASN1_TYPE_EMPTY; char temp[128],currentName[MAX_NAME_SIZE*10],*dot_p,*char_p; @@ -932,6 +933,7 @@ asn1_der_decoding_element(ASN1_TYPE *structure,const char *elementName, unsigned char class,*temp2; unsigned int tag; int indefinite; + const unsigned char* der = ider; node=*structure; @@ -1473,7 +1475,7 @@ asn1_der_decoding_element(ASN1_TYPE *structure,const char *elementName, /** * asn1_der_decoding_startEnd - Find the start and end point of an element in a DER encoding string. * @element: pointer to an ASN1 element - * @der: vector that contains the DER encoding. + * @ider: vector that contains the DER encoding. * @len: number of bytes of *der: der[0]..der[len-1] * @name_element: an element of NAME structure. * @start: the position of the first byte of NAME_ELEMENT decoding (der[*start]) @@ -1496,7 +1498,7 @@ asn1_der_decoding_element(ASN1_TYPE *structure,const char *elementName, * **/ asn1_retCode -asn1_der_decoding_startEnd(ASN1_TYPE element,const unsigned char *der,int len, +asn1_der_decoding_startEnd(ASN1_TYPE element,const void *ider,int len, const char *name_element,int *start, int *end) { node_asn *node,*node_to_find,*p,*p2,*p3; @@ -1504,6 +1506,7 @@ asn1_der_decoding_startEnd(ASN1_TYPE element,const unsigned char *der,int len, unsigned char class; unsigned int tag; int indefinite; + const unsigned char* der = ider; node=element; diff --git a/lib/minitasn1/element.c b/lib/minitasn1/element.c index c2a71d935b..36f9248e7c 100644 --- a/lib/minitasn1/element.c +++ b/lib/minitasn1/element.c @@ -151,7 +151,7 @@ _asn1_append_sequence_set(node_asn *node) * asn1_write_value - Set the value of one element inside a structure. * @node_root: pointer to a structure * @name: the name of the element inside the structure that you want to set. - * @value: vector used to specify the value to set. If len is >0, + * @ivalue: vector used to specify the value to set. If len is >0, * VALUE must be a two's complement form integer. * if len=0 *VALUE must be a null terminated string with an integer value. * @len: number of bytes of *value to use to set the value: value[0]..value[len-1] @@ -244,11 +244,12 @@ _asn1_append_sequence_set(node_asn *node) **/ asn1_retCode asn1_write_value(node_asn *node_root,const char *name, - const unsigned char *value,int len) + const void *ivalue,int len) { node_asn *node,*p,*p2; unsigned char *temp,*value_temp=NULL,*default_temp=NULL; int len2,k,k2,negative; + const unsigned char* value = ivalue; node=_asn1_find_node(node_root,name); if(node==NULL) return ASN1_ELEMENT_NOT_FOUND; @@ -533,7 +534,7 @@ asn1_write_value(node_asn *node_root,const char *name, * asn1_read_value - Returns the value of one element inside a structure * @root: pointer to a structure * @name: the name of the element inside a structure that you want to read. - * @value: vector that will contain the element's content. + * @ivalue: vector that will contain the element's content. * VALUE must be a pointer to memory cells already allocated. * @len: number of bytes of *value: value[0]..value[len-1]. Initialy holds the sizeof value. * @@ -594,11 +595,12 @@ asn1_write_value(node_asn *node_root,const char *name, * **/ asn1_retCode -asn1_read_value(node_asn *root,const char *name,unsigned char *value, int *len) +asn1_read_value(node_asn *root,const char *name,void* ivalue, int *len) { node_asn *node,*p,*p2; int len2,len3; int value_size = *len; + unsigned char* value = ivalue; node=_asn1_find_node(root,name); if(node==NULL) return ASN1_ELEMENT_NOT_FOUND; diff --git a/lib/minitasn1/int.h b/lib/minitasn1/int.h index 65d45eb321..088cc9897a 100644 --- a/lib/minitasn1/int.h +++ b/lib/minitasn1/int.h @@ -32,7 +32,7 @@ #include <mem.h> -#define LIBTASN1_VERSION "0.2.6" +#define LIBTASN1_VERSION "0.2.7" #define MAX32 4294967295 #define MAX24 16777215 @@ -180,7 +180,7 @@ asn1_retCode asn1_create_element(ASN1_TYPE definitions,const char *source_name, ASN1_TYPE *element); asn1_retCode asn1_read_value(ASN1_TYPE element,const char *name, - unsigned char *value,int *len); + void *value,int *len); asn1_retCode asn1_expand_octet_string(ASN1_TYPE definitions,ASN1_TYPE *element, @@ -190,7 +190,7 @@ asn1_retCode asn1_expand_any_defined_by(ASN1_TYPE definitions,ASN1_TYPE *element); asn1_retCode -asn1_der_decoding(ASN1_TYPE *element,const unsigned char *der,int len, +asn1_der_decoding(ASN1_TYPE *element,const void *ider,int len, char *errorDescription); diff --git a/lib/minitasn1/libtasn1.h b/lib/minitasn1/libtasn1.h index 68d245a460..65faa47605 100644 --- a/lib/minitasn1/libtasn1.h +++ b/lib/minitasn1/libtasn1.h @@ -28,7 +28,7 @@ extern "C" { #endif -#define LIBTASN1_VERSION "0.2.6" +#define LIBTASN1_VERSION "0.2.7" #include <sys/types.h> #include <time.h> @@ -146,23 +146,23 @@ asn1_retCode asn1_create_element(ASN1_TYPE definitions,const char *source_name, asn1_retCode asn1_delete_structure(ASN1_TYPE *structure); asn1_retCode asn1_write_value(ASN1_TYPE element,const char *name, - const unsigned char *value,int len); + const void *value,int len); -asn1_retCode asn1_read_value(ASN1_TYPE element,const char *name,unsigned char *value, +asn1_retCode asn1_read_value(ASN1_TYPE element,const char *name,void *value, int *len); asn1_retCode asn1_number_of_elements(ASN1_TYPE element,const char *name,int *num); asn1_retCode asn1_der_coding(ASN1_TYPE element,const char *name, - unsigned char *der,int *len,char *ErrorDescription); + void *der,int *len,char *ErrorDescription); -asn1_retCode asn1_der_decoding(ASN1_TYPE *element,const unsigned char *der,int len, +asn1_retCode asn1_der_decoding(ASN1_TYPE *element,const void *der,int len, char *errorDescription); asn1_retCode asn1_der_decoding_element(ASN1_TYPE *structure,const char *elementName, - const unsigned char *der,int len,char *errorDescription); + const void *der,int len,char *errorDescription); -asn1_retCode asn1_der_decoding_startEnd(ASN1_TYPE element,const unsigned char *der, +asn1_retCode asn1_der_decoding_startEnd(ASN1_TYPE element,const void *der, int len,const char *name,int *start, int *end); asn1_retCode asn1_expand_any_defined_by(ASN1_TYPE definitions, diff --git a/lib/minitasn1/structure.c b/lib/minitasn1/structure.c index 1291a00981..97834e9e77 100644 --- a/lib/minitasn1/structure.c +++ b/lib/minitasn1/structure.c @@ -661,7 +661,7 @@ asn1_print_structure(FILE *out,ASN1_TYPE structure,const char *name,int mode) break; case TYPE_TAG: if(mode == ASN1_PRINT_ALL) - fprintf(out," value:%s",p->value); + if (p->value) fprintf(out," value:%s",p->value); break; case TYPE_SIZE: if(mode == ASN1_PRINT_ALL) |