mbed TLS v2.2.0
asn1write.h
Go to the documentation of this file.
1 
23 #ifndef MBEDTLS_ASN1_WRITE_H
24 #define MBEDTLS_ASN1_WRITE_H
25 
26 #include "asn1.h"
27 
28 #define MBEDTLS_ASN1_CHK_ADD(g, f) do { if( ( ret = f ) < 0 ) return( ret ); else \
29  g += ret; } while( 0 )
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
45 int mbedtls_asn1_write_len( unsigned char **p, unsigned char *start, size_t len );
46 
57 int mbedtls_asn1_write_tag( unsigned char **p, unsigned char *start,
58  unsigned char tag );
59 
71 int mbedtls_asn1_write_raw_buffer( unsigned char **p, unsigned char *start,
72  const unsigned char *buf, size_t size );
73 
74 #if defined(MBEDTLS_BIGNUM_C)
75 
85 int mbedtls_asn1_write_mpi( unsigned char **p, unsigned char *start, const mbedtls_mpi *X );
86 #endif /* MBEDTLS_BIGNUM_C */
87 
97 int mbedtls_asn1_write_null( unsigned char **p, unsigned char *start );
98 
110 int mbedtls_asn1_write_oid( unsigned char **p, unsigned char *start,
111  const char *oid, size_t oid_len );
112 
126 int mbedtls_asn1_write_algorithm_identifier( unsigned char **p, unsigned char *start,
127  const char *oid, size_t oid_len,
128  size_t par_len );
129 
140 int mbedtls_asn1_write_bool( unsigned char **p, unsigned char *start, int boolean );
141 
152 int mbedtls_asn1_write_int( unsigned char **p, unsigned char *start, int val );
153 
166 int mbedtls_asn1_write_printable_string( unsigned char **p, unsigned char *start,
167  const char *text, size_t text_len );
168 
181 int mbedtls_asn1_write_ia5_string( unsigned char **p, unsigned char *start,
182  const char *text, size_t text_len );
183 
196 int mbedtls_asn1_write_bitstring( unsigned char **p, unsigned char *start,
197  const unsigned char *buf, size_t bits );
198 
211 int mbedtls_asn1_write_octet_string( unsigned char **p, unsigned char *start,
212  const unsigned char *buf, size_t size );
213 
231  const char *oid, size_t oid_len,
232  const unsigned char *val,
233  size_t val_len );
234 
235 #ifdef __cplusplus
236 }
237 #endif
238 
239 #endif /* MBEDTLS_ASN1_WRITE_H */
int mbedtls_asn1_write_bitstring(unsigned char **p, unsigned char *start, const unsigned char *buf, size_t bits)
Write a bitstring tag (MBEDTLS_ASN1_BIT_STRING) and value in ASN.1 format Note: function works backwa...
mbedtls_asn1_buf oid
The object identifier.
Definition: asn1.h:152
int mbedtls_asn1_write_null(unsigned char **p, unsigned char *start)
Write a NULL tag (MBEDTLS_ASN1_NULL) with zero data in ASN.1 format Note: function works backwards in...
Container for a sequence or list of 'named' ASN.1 data items.
Definition: asn1.h:150
Generic ASN.1 parsing.
int mbedtls_asn1_write_int(unsigned char **p, unsigned char *start, int val)
Write an int tag (MBEDTLS_ASN1_INTEGER) and value in ASN.1 format Note: function works backwards in d...
int mbedtls_asn1_write_bool(unsigned char **p, unsigned char *start, int boolean)
Write a boolean tag (MBEDTLS_ASN1_BOOLEAN) and value in ASN.1 format Note: function works backwards i...
int mbedtls_asn1_write_len(unsigned char **p, unsigned char *start, size_t len)
Write a length field in ASN.1 format Note: function works backwards in data buffer.
mbedtls_asn1_buf val
The named value.
Definition: asn1.h:153
int mbedtls_asn1_write_octet_string(unsigned char **p, unsigned char *start, const unsigned char *buf, size_t size)
Write an octet string tag (MBEDTLS_ASN1_OCTET_STRING) and value in ASN.1 format Note: function works ...
int mbedtls_asn1_write_printable_string(unsigned char **p, unsigned char *start, const char *text, size_t text_len)
Write a printable string tag (MBEDTLS_ASN1_PRINTABLE_STRING) and value in ASN.1 format Note: function...
int mbedtls_asn1_write_algorithm_identifier(unsigned char **p, unsigned char *start, const char *oid, size_t oid_len, size_t par_len)
Write an AlgorithmIdentifier sequence in ASN.1 format Note: function works backwards in data buffer...
MPI structure.
Definition: bignum.h:143
mbedtls_asn1_named_data * mbedtls_asn1_store_named_data(mbedtls_asn1_named_data **list, const char *oid, size_t oid_len, const unsigned char *val, size_t val_len)
Create or find a specific named_data entry for writing in a sequence or list based on the OID...
int mbedtls_asn1_write_ia5_string(unsigned char **p, unsigned char *start, const char *text, size_t text_len)
Write an IA5 string tag (MBEDTLS_ASN1_IA5_STRING) and value in ASN.1 format Note: function works back...
int mbedtls_asn1_write_raw_buffer(unsigned char **p, unsigned char *start, const unsigned char *buf, size_t size)
Write raw buffer data Note: function works backwards in data buffer.
int mbedtls_asn1_write_tag(unsigned char **p, unsigned char *start, unsigned char tag)
Write a ASN.1 tag in ASN.1 format Note: function works backwards in data buffer.
int mbedtls_asn1_write_oid(unsigned char **p, unsigned char *start, const char *oid, size_t oid_len)
Write an OID tag (MBEDTLS_ASN1_OID) and data in ASN.1 format Note: function works backwards in data b...