/* Parameters: */
/* len: value to convert. */
/* ans: string returned. */
-/* ans_len: number of meanful bytes of ANS */
+/* ans_len: number of meaningful bytes of ANS */
/* (ans[0]..ans[ans_len-1]). */
/* Return: */
/******************************************************/
/* class: value to convert. */
/* tag_value: value to convert. */
/* ans: string returned. */
-/* ans_len: number of meanful bytes of ANS */
+/* ans_len: number of meaningful bytes of ANS */
/* (ans[0]..ans[ans_len-1]). */
/* Return: */
/******************************************************/
/* str: OCTET string. */
/* str_len: STR length (str[0]..str[str_len-1]). */
/* der: string returned. */
-/* der_len: number of meanful bytes of DER */
+/* der_len: number of meaningful bytes of DER */
/* (der[0]..der[ans_len-1]). */
/* Return: */
/******************************************************/
/* Parameters: */
/* str: TIME null-terminated string. */
/* der: string returned. */
-/* der_len: number of meanful bytes of DER */
+/* der_len: number of meaningful bytes of DER */
/* (der[0]..der[ans_len-1]). Initially it */
/* if must store the lenght of DER. */
/* Return: */
/* Parameters: */
/* str: OBJECT IDENTIFIER null-terminated string. */
/* der: string returned. */
-/* der_len: number of meanful bytes of DER */
+/* der_len: number of meaningful bytes of DER */
/* (der[0]..der[ans_len-1]). Initially it */
-/* if must store the lenght of DER. */
+/* must store the length of DER. */
/* Return: */
/* ASN1_MEM_ERROR when DER isn't big enough */
/* ASN1_SUCCESS otherwise */
/* STRING type (length and pad included). */
/* Parameters: */
/* str: BIT string. */
-/* bit_len: number of meanful bits in STR. */
+/* bit_len: number of meaningful bits in STR. */
/* der: string returned. */
-/* der_len: number of meanful bytes of DER */
+/* der_len: number of meaningful bytes of DER */
/* (der[0]..der[ans_len-1]). */
/* Return: */
/******************************************************/
/* Parameters: */
/* node: pointer to the tree element. */
/* der: string with the DER coding of the whole tree*/
-/* counter: number of meanful bytes of DER */
+/* counter: number of meaningful bytes of DER */
/* (der[0]..der[*counter-1]). */
/* max_len: size of der vector */
/* Return: */
p=node->down;
/* When there are nested tags we must complete them reverse to
the order they were created. This is because completing a tag
- modifies alla date within it, including the incomplete tags
+ modifies all data within it, including the incomplete tags
which store buffer positions -- simon@josefsson.org 2002-09-06
*/
while(p->right)
/* Parameters: */
/* node: pointer to the tree element. */
/* der: string returned */
-/* counter: number of meanful bytes of DER */
+/* counter: number of meaningful bytes of DER */
/* (counter[0]..der[*counter-1]). */
/* max_len: size of der vector */
/* Return: */
p_vet->value=(class<<24)|tag;
counter+=len2;
- /* extraction and length */
+ /* extraction and length */
len2=_asn1_get_length_der(der+counter,&len);
counter+=len+len2;
return ASN1_SUCCESS;
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
ans=0;
while(punt<=k) ans=ans*256+der[punt++];
}
- else{ /* indefinite lenght method */
+ else{ /* indefinite length method */
ans=-1;
}
*
* Fill the structure *ELEMENT with values of a DER encoding string. The sructure must just be
* created with function 'create_stucture'.
- * If an error accurs during de decoding procedure, the *ELEMENT is deleted
+ * If an error occurs during the decoding procedure, the *ELEMENT is deleted
* and set equal to ASN1_TYPE_EMPTY.
*
* Returns:
counter+=len2+len3;
}
else{ /* indefinite length */
- /* Check indefinite lenth method in a EXPLICIT TAG */
+ /* Check indefinite lenth method in an EXPLICIT TAG */
if((p->type&CONST_TAG) && (der[counter-1]==0x80))
indefinite=1;
else
counter+=len2;
/* Check if a couple of 0x00 are present due to an EXPLICIT TAG with
- a indefinite length method. */
+ an indefinite length method. */
if(indefinite){
if(!der[counter] && !der[counter+1]){
counter+=2;
* @elementName: name of the element to fill
* @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.
+ * @errorDescription: null-terminated string contains details when an error occurred.
*
* Description:
*
* Fill the element named ELEMENTNAME with values of a DER encoding string.
* The sructure must just be created with function 'create_stucture'.
* The DER vector must contain the encoding string of the whole STRUCTURE.
- * If an error accurs during the decoding procedure, the *STRUCTURE is deleted
+ * If an error occurs during the decoding procedure, the *STRUCTURE is deleted
* and set equal to ASN1_TYPE_EMPTY.
*
* Returns:
return ASN1_GENERIC_ERROR;
}
- if((*structure)->name){ /* Has *structure a name? */
+ if((*structure)->name){ /* Has *structure got a name? */
nameLen-=strlen((*structure)->name);
if(nameLen>0) strcpy(currentName,(*structure)->name);
else{
counter+=len2+len3;
}
else{ /* indefinite length */
- /* Check indefinite lenth method in a EXPLICIT TAG */
+ /* Check indefinite lenth method in an EXPLICIT TAG */
if((p->type&CONST_TAG) && (der[counter-1]==0x80))
indefinite=1;
else
counter+=len2;
/* Check if a couple of 0x00 are present due to an EXPLICIT TAG with
- a indefinite length method. */
+ an indefinite length method. */
if(indefinite){
if(!der[counter] && !der[counter+1]){
counter+=2;
counter+=len2+len4+len3;
}
else{ /* indefinite length */
- /* Check indefinite lenth method in a EXPLICIT TAG */
+ /* Check indefinite lenth method in an EXPLICIT TAG */
if((p->type&CONST_TAG) && (der[counter-1]==0x80))
indefinite=1;
else
counter+=len2;
/* Check if a couple of 0x00 are present due to an EXPLICIT TAG with
- a indefinite length method. */
+ an indefinite length method. */
if(indefinite){
if(!der[counter] && !der[counter+1])
counter+=2;
return retCode;
}
-
-
-
-
-
-
*len=SIZEOF_UNSIGNED_LONG_INT-k;
if (SIZEOF_UNSIGNED_LONG_INT-k> value_out_size)
- /* VALUE_OUT is too short to contain the value convertion */
+ /* VALUE_OUT is too short to contain the value conversion */
return ASN1_MEM_ERROR;
for(k2=k;k2<SIZEOF_UNSIGNED_LONG_INT;k2++)
* value="2001010112001.12-0700" , len=1 -> time=Jannuary 1st, 2001 at 12h 00m 01.12s
* Pacific Daylight Time
*
- * \item OCTET STRING\: VALUE contains the octet string and LEN is the number of octet.
+ * \item OCTET STRING\: VALUE contains the octet string and LEN is the number of octets.
* value="$\backslash$x01$\backslash$x02$\backslash$x03" , len=3 -> three bytes octet string
*
- * \item GeneralString\: VALUE contains the generalstring and LEN is the number of octet.
+ * \item GeneralString\: VALUE contains the generalstring and LEN is the number of octets.
* value="$\backslash$x01$\backslash$x02$\backslash$x03" , len=3 -> three bytes generalstring
*
* \item BIT STRING\: VALUE contains the bit string organized by bytes and LEN is the number of bits.
* \item GeneralizedTime\: VALUE will be a null terminated string in the same format used to set
* the value
*
- * \item OCTET STRING\: VALUE will contain the octet string and LEN will be the number of octet.
+ * \item OCTET STRING\: VALUE will contain the octet string and LEN will be the number of octets.
*
- * \item GeneralString\: VALUE will contain the generalstring and LEN will be the number of octet.
+ * \item GeneralString\: VALUE will contain the generalstring and LEN will be the number of octets.
*
* \item BIT STRING\: VALUE will contain the bit string organized by bytes and LEN will be the
* number of bits.
return ASN1_SUCCESS;
}
-
-
-
-
void _libtasn1_null_log( void* x, ...) { return; }
# endif /* C99_MACROS */
#endif /* DEBUG */
-
#endif /* DEBUG */
#endif /* ERRORS_H */
-
-
-
-
-
-
#define ASN1_NAME_TOO_LONG 15
#define ASN1_ARRAY_ERROR 16
#define ASN1_ELEMENT_NOT_EMPTY 17
-
-
#include <int.h>
/* These function are like strcat, strcpy. They only
- * do bound checking (they shouldn't cause buffer overruns),
+ * do bounds checking (they shouldn't cause buffer overruns),
* and they always produce null terminated strings.
*
* They should be used only with null terminated strings.
}
}
}
-
-
-
-
-
-
-
-
-
-
-
#define Estrcpy(x,y) _asn1_str_cpy(x,MAX_ERROR_DESCRIPTION_SIZE,y)
#define Estrcat(x,y) _asn1_str_cat(x,MAX_ERROR_DESCRIPTION_SIZE,y)
-
#define MAX16 65535
#define MAX_LOG_SIZE 1024 /* maximum number of characters of a log message */
-#define MAX_NAME_SIZE 128 /* maximum number of characters of a name inside an ASN1 file definitons */
+#define MAX_NAME_SIZE 128 /* maximum number of characters of a name inside an ASN1 file definiton */
#define MAX_ERROR_DESCRIPTION_SIZE 128 /* maximum number of characters of a description message */
/*****************************************/
/******************************************************/
/* Structure definition used for the node of the tree */
-/* that rappresent an ASN.1 DEFINITION. */
+/* that represent an ASN.1 DEFINITION. */
/******************************************************/
typedef struct node_asn_struct{
char *name; /* Node name */
/***********************************************************************/
-/* List of constants for specify better the type of typedef node_asn. */
+/* List of constants to better specify the type of typedef node_asn. */
/***********************************************************************/
/* Used with TYPE_TAG */
#define CONST_UNIVERSAL (1<<8)
#endif /* INT_H */
-
-
/******************************************************/
/* Structure definition used for the node of the tree */
-/* that rappresent an ASN.1 DEFINITION. */
+/* that represent an ASN.1 DEFINITION. */
/******************************************************/
typedef struct node_asn_struct{
char *name; /* Node name */
#endif
#endif /* LIBASN1_H */
-
-
-
-
-
-
-
-
-
-
-
-
-
/* Parameters: */
/* pointer: NODE_ASN element pointer. */
/* name: null terminated string with the element's name to find.*/
-/* Return: the searching result. NULL if not find. */
+/* Return: the searching result. NULL if not found. */
/******************************************************************/
node_asn *
_asn1_find_node(node_asn *pointer,const char *name)
p=pointer;
n_start=name;
- if(p->name != NULL){ /* has *pointer a name ? */
+ if(p->name != NULL){ /* has *pointer got a name ? */
n_end=strchr(n_start,'.'); /* search the first dot */
if(n_end){
memcpy(n,n_start,n_end-n_start);
/******************************************************************/
/* Function : _asn1_set_value */
/* Description: sets the field VALUE in a NODE_ASN element. The */
-/* previus value (if exist) will be lost */
+/* previous value (if exist) will be lost */
/* Parameters: */
/* node: element pointer. */
/* value: pointer to the value that you want to set. */
/******************************************************************/
/* Function : _asn1_set_name */
/* Description: sets the field NAME in a NODE_ASN element. The */
-/* previus value (if exist) will be lost */
+/* previous value (if exist) will be lost */
/* Parameters: */
/* node: element pointer. */
/* name: a null terminated string with the name that you want */
/* Parameters: */
/* node: pointer to a DEFINITIONS element. */
/* Return: */
-/* ASN1_ELEMENT_NOT_FOUND if NODE is NULL or not a pointer to */
+/* ASN1_ELEMENT_NOT_FOUND if NODE is NULL or not a pointer to */
/* a DEFINITIONS element, */
-/* otherwise ASN1_SUCCESS */
+/* otherwise ASN1_SUCCESS */
/******************************************************************/
asn1_retCode
_asn1_set_default_tag(ASN1_TYPE node)
* asn1_check_version - This function checks the library's version
* @req_version: the version to check
*
- * Check that the the version of the library is at minimum the requested one
+ * Check that the version of the library is at minimum the requested one
* and return the version string; return NULL if the condition is not
* satisfied. If a NULL is passed to this function, no check is done,
* but the version string is simply returned.
}
return NULL;
}
-
-