PolarSSL v1.3.9
asn1write.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_ASN1_WRITE_H
28 #define POLARSSL_ASN1_WRITE_H
29 
30 #include "asn1.h"
31 
32 #define ASN1_CHK_ADD(g, f) do { if( ( ret = f ) < 0 ) return( ret ); else \
33  g += ret; } while( 0 )
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
49 int asn1_write_len( unsigned char **p, unsigned char *start, size_t len );
50 
61 int asn1_write_tag( unsigned char **p, unsigned char *start,
62  unsigned char tag );
63 
75 int asn1_write_raw_buffer( unsigned char **p, unsigned char *start,
76  const unsigned char *buf, size_t size );
77 
78 #if defined(POLARSSL_BIGNUM_C)
79 
89 int asn1_write_mpi( unsigned char **p, unsigned char *start, mpi *X );
90 #endif /* POLARSSL_BIGNUM_C */
91 
101 int asn1_write_null( unsigned char **p, unsigned char *start );
102 
114 int asn1_write_oid( unsigned char **p, unsigned char *start,
115  const char *oid, size_t oid_len );
116 
130 int asn1_write_algorithm_identifier( unsigned char **p, unsigned char *start,
131  const char *oid, size_t oid_len,
132  size_t par_len );
133 
144 int asn1_write_bool( unsigned char **p, unsigned char *start, int boolean );
145 
156 int asn1_write_int( unsigned char **p, unsigned char *start, int val );
157 
170 int asn1_write_printable_string( unsigned char **p, unsigned char *start,
171  const char *text, size_t text_len );
172 
185 int asn1_write_ia5_string( unsigned char **p, unsigned char *start,
186  const char *text, size_t text_len );
187 
200 int asn1_write_bitstring( unsigned char **p, unsigned char *start,
201  const unsigned char *buf, size_t bits );
202 
215 int asn1_write_octet_string( unsigned char **p, unsigned char *start,
216  const unsigned char *buf, size_t size );
217 
235  const char *oid, size_t oid_len,
236  const unsigned char *val,
237  size_t val_len );
238 
239 #ifdef __cplusplus
240 }
241 #endif
242 
243 #endif /* POLARSSL_ASN1_WRITE_H */
int asn1_write_octet_string(unsigned char **p, unsigned char *start, const unsigned char *buf, size_t size)
Write an octet string tag (ASN1_OCTET_STRING) and value in ASN.1 format Note: function works backward...
int asn1_write_ia5_string(unsigned char **p, unsigned char *start, const char *text, size_t text_len)
Write an IA5 string tag (ASN1_IA5_STRING) and value in ASN.1 format Note: function works backwards in...
asn1_named_data * asn1_store_named_data(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...
MPI structure.
Definition: bignum.h:182
int 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.
int asn1_write_printable_string(unsigned char **p, unsigned char *start, const char *text, size_t text_len)
Write a printable string tag (ASN1_PRINTABLE_STRING) and value in ASN.1 format Note: function works b...
asn1_buf val
The named value.
Definition: asn1.h:159
Generic ASN.1 parsing.
asn1_buf oid
The object identifier.
Definition: asn1.h:158
int 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 asn1_write_null(unsigned char **p, unsigned char *start)
Write a NULL tag (ASN1_NULL) with zero data in ASN.1 format Note: function works backwards in data bu...
int asn1_write_mpi(unsigned char **p, unsigned char *start, mpi *X)
Write a big number (ASN1_INTEGER) in ASN.1 format Note: function works backwards in data buffer...
int asn1_write_bitstring(unsigned char **p, unsigned char *start, const unsigned char *buf, size_t bits)
Write a bitstring tag (ASN1_BIT_STRING) and value in ASN.1 format Note: function works backwards in d...
int asn1_write_int(unsigned char **p, unsigned char *start, int val)
Write an int tag (ASN1_INTEGER) and value in ASN.1 format Note: function works backwards in data buff...
Container for a sequence or list of 'named' ASN.1 data items.
Definition: asn1.h:156
int 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...
int asn1_write_bool(unsigned char **p, unsigned char *start, int boolean)
Write a boolean tag (ASN1_BOOLEAN) and value in ASN.1 format Note: function works backwards in data b...
int asn1_write_oid(unsigned char **p, unsigned char *start, const char *oid, size_t oid_len)
Write an OID tag (ASN1_OID) and data in ASN.1 format Note: function works backwards in data buffer...
int 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.