CryptoAuthLib v3.7.6
Microchip CryptoAuthentication Library
 
Loading...
Searching...
No Matches
cal_buffer.c File Reference

Cryptoauthlib buffer management system. More...

#include <string.h>
#include "cal_buffer.h"

Functions

ATCA_STATUS cal_buf_read_bytes (cal_buffer *cab, size_t offset, void *dest, size_t length)
 Read bytes from a cal_buffer or cal_buffer linked list.
 
ATCA_STATUS cal_buf_read_byte (cal_buffer *cab, size_t offset, uint8_t *value)
 
ATCA_STATUS cal_buf_write_byte (cal_buffer *cab, size_t offset, uint8_t value)
 
ATCA_STATUS cal_buf_write_bytes (cal_buffer *cab, size_t offset, const void *source, size_t length)
 Write bytes into a single cal_buffer structure or cal_buffer linked list.
 
ATCA_STATUS cal_buf_read_number (cal_buffer *cab, size_t offset, void *dest, size_t num_size, bool buf_big_endian)
 Read a number from a cal_buffer or cal_buffer linked list This function does not reinterpet the number and signedness is only preserved if the destination is the same size as the representation in the buffer.
 
ATCA_STATUS cal_buf_write_number (cal_buffer *cab, size_t offset, const void *source, size_t num_size, bool buf_big_endian)
 Write a number into a cal_buffer or cal_buffer linked list This function does not reinterpet the number and signedness is only preserved if the destination is the same size as the source.
 
ATCA_STATUS cal_buf_set_used (cal_buffer *buf, size_t used)
 
size_t cal_buf_get_used (cal_buffer *buf)
 
ATCA_STATUS cal_buf_copy (cal_buffer *dst, size_t dst_offset, cal_buffer *src, size_t src_offset, size_t length)
 
ATCA_STATUS cal_buf_set (cal_buffer *dst, size_t dst_offset, uint8_t value, size_t length)
 
cal_buffer cal_buf_init_const_ptr (size_t len, const uint8_t *message)
 Initialize a cal buffer with constant pointer Returns the initialized cal buffer.
 

Detailed Description

Cryptoauthlib buffer management system.

Function Documentation

◆ cal_buf_read_bytes()

ATCA_STATUS cal_buf_read_bytes ( cal_buffer cab,
size_t  offset,
void *  dest,
size_t  length 
)

Read bytes from a cal_buffer or cal_buffer linked list.

Parameters
[in]cabPointer to a buffer structure or the head of a buffer structure linked list
[in]offsetOffset to start the read from
[in]destPointer to a destination buffer
[in]lengthLength of the read - assumes dest has sufficent memory to accept the bytes being read

◆ cal_buf_read_number()

ATCA_STATUS cal_buf_read_number ( cal_buffer cab,
size_t  offset,
void *  dest,
size_t  num_size,
bool  buf_big_endian 
)

Read a number from a cal_buffer or cal_buffer linked list This function does not reinterpet the number and signedness is only preserved if the destination is the same size as the representation in the buffer.

Parameters
[in]cabPointer to a buffer structure or the head of a buffer structure linked list
[in]offsetOffset to start the read from
[in]destPointer to a destination number
[in]num_sizeSize of the number in bytes
[in]buf_big_endianSpecifies the expected endianness representation within the buffer

◆ cal_buf_write_bytes()

ATCA_STATUS cal_buf_write_bytes ( cal_buffer cab,
size_t  offset,
const void *  source,
size_t  length 
)

Write bytes into a single cal_buffer structure or cal_buffer linked list.

Parameters
[in]cabPointer to a buffer structure or the head of a buffer structure linked list
[in]offsetTarget offset to start the write at
[in]sourcePointer to a source buffer
[in]lengthLength of the write - assumes source is sufficently large to support this operation

◆ cal_buf_write_number()

ATCA_STATUS cal_buf_write_number ( cal_buffer cab,
size_t  offset,
const void *  source,
size_t  num_size,
bool  buf_big_endian 
)

Write a number into a cal_buffer or cal_buffer linked list This function does not reinterpet the number and signedness is only preserved if the destination is the same size as the source.

Parameters
[in]cabPointer to a buffer structure or the head of a buffer structure linked list
[in]offsetOffset to start the write at
[in]sourcePointer to a number to be written
[in]num_sizeSize of the number in bytes
[in]buf_big_endianSpecifies the expected endianness representation within the buffer