mbed TLS v1.3.18
asn1write.h
Go to the documentation of this file.
1 
24 #ifndef POLARSSL_ASN1_WRITE_H
25 #define POLARSSL_ASN1_WRITE_H
26 
27 #include "asn1.h"
28 
29 #define ASN1_CHK_ADD(g, f) do { if( ( ret = f ) < 0 ) return( ret ); else \
30  g += ret; } while( 0 )
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
46 int asn1_write_len( unsigned char **p, unsigned char *start, size_t len );
47 
58 int asn1_write_tag( unsigned char **p, unsigned char *start,
59  unsigned char tag );
60 
72 int asn1_write_raw_buffer( unsigned char **p, unsigned char *start,
73  const unsigned char *buf, size_t size );
74 
75 #if defined(POLARSSL_BIGNUM_C)
76 
86 int asn1_write_mpi( unsigned char **p, unsigned char *start, mpi *X );
87 #endif /* POLARSSL_BIGNUM_C */
88 
98 int asn1_write_null( unsigned char **p, unsigned char *start );
99 
111 int asn1_write_oid( unsigned char **p, unsigned char *start,
112  const char *oid, size_t oid_len );
113 
127 int asn1_write_algorithm_identifier( unsigned char **p, unsigned char *start,
128  const char *oid, size_t oid_len,
129  size_t par_len );
130 
141 int asn1_write_bool( unsigned char **p, unsigned char *start, int boolean );
142 
153 int asn1_write_int( unsigned char **p, unsigned char *start, int val );
154 
167 int asn1_write_printable_string( unsigned char **p, unsigned char *start,
168  const char *text, size_t text_len );
169 
182 int asn1_write_ia5_string( unsigned char **p, unsigned char *start,
183  const char *text, size_t text_len );
184 
197 int asn1_write_bitstring( unsigned char **p, unsigned char *start,
198  const unsigned char *buf, size_t bits );
199 
212 int asn1_write_octet_string( unsigned char **p, unsigned char *start,
213  const unsigned char *buf, size_t size );
214 
232  const char *oid, size_t oid_len,
233  const unsigned char *val,
234  size_t val_len );
235 
236 #ifdef __cplusplus
237 }
238 #endif
239 
240 #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:183
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:156
Generic ASN.1 parsing.
asn1_buf oid
The object identifier.
Definition: asn1.h:155
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:153
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.