RetroArch
Functions
asn1write.c File Reference
#include "mbedtls/config.h"
#include "mbedtls/asn1write.h"
#include <string.h>
#include "mbedtls/platform.h"
Include dependency graph for asn1write.c:

Functions

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. More...
 
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. More...
 
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. More...
 
int mbedtls_asn1_write_mpi (unsigned char **p, unsigned char *start, const mbedtls_mpi *X)
 Write a big number (MBEDTLS_ASN1_INTEGER) in ASN.1 format Note: function works backwards in data buffer. More...
 
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 data buffer. More...
 
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 buffer. More...
 
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. More...
 
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 in data buffer. More...
 
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 data buffer. More...
 
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 works backwards in data buffer. More...
 
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 backwards in data buffer. More...
 
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 backwards in data buffer. More...
 
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 backwards in data buffer. More...
 
mbedtls_asn1_named_datambedtls_asn1_store_named_data (mbedtls_asn1_named_data **head, 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. If not already in there, a new entry is added to the head of the list. Warning: Destructive behaviour for the val data! More...
 

Function Documentation

◆ mbedtls_asn1_store_named_data()

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. If not already in there, a new entry is added to the head of the list. Warning: Destructive behaviour for the val data!

Parameters
listPointer to the location of the head of the list to seek through (will be updated in case of a new entry)
oidThe OID to look for
oid_lenSize of the OID
valData to store (can be NULL if you want to fill it by hand)
val_lenMinimum length of the data buffer needed
Returns
NULL if if there was a memory allocation error, or a pointer to the new / existing entry.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_asn1_write_algorithm_identifier()

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.

Parameters
preference to current position pointer
startstart of the buffer (for bounds-checking)
oidthe OID of the algorithm
oid_lenlength of the OID
par_lenlength of parameters, which must be already written. If 0, NULL parameters are added
Returns
the length written or a negative error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_asn1_write_bitstring()

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 backwards in data buffer.

Parameters
preference to current position pointer
startstart of the buffer (for bounds-checking)
bufthe bitstring
bitsthe total number of bits in the bitstring
Returns
the length written or a negative error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_asn1_write_bool()

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 in data buffer.

Parameters
preference to current position pointer
startstart of the buffer (for bounds-checking)
boolean0 or 1
Returns
the length written or a negative error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_asn1_write_ia5_string()

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 backwards in data buffer.

Parameters
preference to current position pointer
startstart of the buffer (for bounds-checking)
textthe text to write
text_lenlength of the text
Returns
the length written or a negative error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_asn1_write_int()

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 data buffer.

Parameters
preference to current position pointer
startstart of the buffer (for bounds-checking)
valthe integer value
Returns
the length written or a negative error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_asn1_write_len()

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.

Parameters
preference to current position pointer
startstart of the buffer (for bounds-checking)
lenthe length to write
Returns
the length written or a negative error code
Here is the caller graph for this function:

◆ mbedtls_asn1_write_mpi()

int mbedtls_asn1_write_mpi ( unsigned char **  p,
unsigned char *  start,
const mbedtls_mpi X 
)

Write a big number (MBEDTLS_ASN1_INTEGER) in ASN.1 format Note: function works backwards in data buffer.

Parameters
preference to current position pointer
startstart of the buffer (for bounds-checking)
Xthe MPI to write
Returns
the length written or a negative error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_asn1_write_null()

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 data buffer.

Parameters
preference to current position pointer
startstart of the buffer (for bounds-checking)
Returns
the length written or a negative error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_asn1_write_octet_string()

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 backwards in data buffer.

Parameters
preference to current position pointer
startstart of the buffer (for bounds-checking)
bufdata buffer to write
sizelength of the data buffer
Returns
the length written or a negative error code
Here is the call graph for this function:

◆ mbedtls_asn1_write_oid()

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 buffer.

Parameters
preference to current position pointer
startstart of the buffer (for bounds-checking)
oidthe OID to write
oid_lenlength of the OID
Returns
the length written or a negative error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_asn1_write_printable_string()

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 works backwards in data buffer.

Parameters
preference to current position pointer
startstart of the buffer (for bounds-checking)
textthe text to write
text_lenlength of the text
Returns
the length written or a negative error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_asn1_write_raw_buffer()

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.

Parameters
preference to current position pointer
startstart of the buffer (for bounds-checking)
bufdata buffer to write
sizelength of the data buffer
Returns
the length written or a negative error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_asn1_write_tag()

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.

Parameters
preference to current position pointer
startstart of the buffer (for bounds-checking)
tagthe tag to write
Returns
the length written or a negative error code
Here is the caller graph for this function: