PolarSSL v1.3.3
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 g += ret; } while( 0 )
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
48 int asn1_write_len( unsigned char **p, unsigned char *start, size_t len );
49 
60 int asn1_write_tag( unsigned char **p, unsigned char *start, unsigned char tag );
61 
73 int asn1_write_raw_buffer( unsigned char **p, unsigned char *start,
74  const unsigned char *buf, size_t size );
75 
76 #if defined(POLARSSL_BIGNUM_C)
77 
87 int asn1_write_mpi( unsigned char **p, unsigned char *start, mpi *X );
88 #endif
89 
99 int asn1_write_null( unsigned char **p, unsigned char *start );
100 
112 int asn1_write_oid( unsigned char **p, unsigned char *start,
113  const char *oid, size_t oid_len );
114 
128 int asn1_write_algorithm_identifier( unsigned char **p, unsigned char *start,
129  const char *oid, size_t oid_len,
130  size_t par_len );
131 
142 int asn1_write_bool( unsigned char **p, unsigned char *start, int boolean );
143 
154 int asn1_write_int( unsigned char **p, unsigned char *start, int val );
155 
168 int asn1_write_printable_string( unsigned char **p, unsigned char *start,
169  const char *text, size_t text_len );
170 
183 int asn1_write_ia5_string( unsigned char **p, unsigned char *start,
184  const char *text, size_t text_len );
185 
198 int asn1_write_bitstring( unsigned char **p, unsigned char *start,
199  const unsigned char *buf, size_t bits );
200 
213 int asn1_write_octet_string( unsigned char **p, unsigned char *start,
214  const unsigned char *buf, size_t size );
215 
233  const char *oid, size_t oid_len,
234  const unsigned char *val,
235  size_t val_len );
236 
237 #ifdef __cplusplus
238 }
239 #endif
240 
241 #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:177
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:151
Generic ASN.1 parsing.
asn1_buf oid
The object identifier.
Definition: asn1.h:150
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 &#39;named&#39; ASN.1 data items.
Definition: asn1.h:148
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.