mbedtls_asn1_write_named_bitstring() function
This function writes a named bitstring tag (#MBEDTLS_ASN1_BIT_STRING) and value in ASN.1 format. As stated in RFC 5280 Appendix B, trailing zeroes are omitted when encoding named bitstrings in DER.
Syntax
int mbedtls_asn1_write_named_bitstring(unsigned char **p,
unsigned char *start,
const unsigned char *buf,
size_t bits);
Arguments
p
The reference to the current position pointer.
start
The start of the buffer which is used for bounds-checking.
buf
The bitstring to write.
bits
The total number of bits in the bitstring.
Return value
The number of bytes written to \p p on success. A negative error code on failure.
Notes
This function works backwards within the data buffer.