93 const uint8_t *value,
size_t value_len,
size_t *written);
Parsed TLV: pointers alias into the caller-supplied buffer.
tlv_status_t tlv_parse(const uint8_t *buf, size_t buf_len, size_t *pos, tlv_t *out)
Parse a single TLV starting at pos. On success pos advances past the entire field and out is filled.
tlv_status_t tlv_write_tag(uint8_t *buf, size_t buf_max, uint16_t tag, size_t *written)
Encode a tag. Writes either one or two bytes depending on the magnitude of tag.
tlv_status_t tlv_build(uint8_t *buf, size_t buf_max, uint16_t tag, const uint8_t *value, size_t value_len, size_t *written)
Build a complete TLV: tag, length, and value (which may be NULL when value_len == 0).
tlv_status_t tlv_write_len(uint8_t *buf, size_t buf_max, size_t value_len, size_t *written)
Encode a BER definite length field.
tlv_status_t tlv_read_tag(const uint8_t *buf, size_t buf_len, size_t *pos, uint16_t *tag_out)
Read a tag from the input buffer at pos.
tlv_status_t
BER-TLV codec for OpenPGP Data Objects.
size_t tlv_len_size(size_t value_len)
Compute the BER definite-length encoded size for a length value.
tlv_status_t tlv_read_len(const uint8_t *buf, size_t buf_len, size_t *pos, size_t *length_out)
Read a BER definite length field starting at pos.
size_t tlv_tag_size(uint16_t tag)
Compute the encoded size of a tag.