Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
base64.h File Reference
#include <stddef.h>
#include <zephyr/types.h>

Go to the source code of this file.

Functions

int base64_encode (uint8_t *dst, size_t dlen, size_t *olen, const uint8_t *src, size_t slen)
 Encode a buffer into base64 format. More...
 
int base64_decode (uint8_t *dst, size_t dlen, size_t *olen, const uint8_t *src, size_t slen)
 Decode a base64-formatted buffer. More...
 

Function Documentation

◆ base64_decode()

int base64_decode ( uint8_t dst,
size_t  dlen,
size_t *  olen,
const uint8_t src,
size_t  slen 
)

Decode a base64-formatted buffer.

Parameters
dstdestination buffer (can be NULL for checking size)
dlensize of the destination buffer
olennumber of bytes written
srcsource buffer
slenamount of data to be decoded
Returns
0 if successful, -ENOMEM, or -EINVAL if the input data is not correct. *olen is always updated to reflect the amount of data that has (or would have) been written.
Note
Call this function with *dst = NULL or dlen = 0 to obtain the required buffer size in *olen

◆ base64_encode()

int base64_encode ( uint8_t dst,
size_t  dlen,
size_t *  olen,
const uint8_t src,
size_t  slen 
)

Encode a buffer into base64 format.

Parameters
dstdestination buffer
dlensize of the destination buffer
olennumber of bytes written
srcsource buffer
slenamount of data to be encoded
Returns
0 if successful, or -ENOMEM if the buffer is too small. *olen is always updated to reflect the amount of data that has (or would have) been written. If that length cannot be represented, then no data is written to the buffer and *olen is set to the maximum length representable as a size_t.
Note
Call this function with dlen = 0 to obtain the required buffer size in *olen