Embedded SDK
Embedded SDK
Macros | Functions
cx_utils.h File Reference
#include "lcx_common.h"
#include "errors.h"
#include "exceptions.h"
#include <stddef.h>
#include <stdint.h>
Include dependency graph for cx_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _CX_INLINE_U32
 
#define cx_rotl(x, n)   (((x) << (n)) | ((x) >> (32 - (n))))
 
#define cx_rotr(x, n)   (((x) >> (n)) | ((x) << (32 - (n))))
 
#define cx_shr(x, n)   ((x) >> (n))
 
#define htole32(value)   ((uint32_t) (value))
 
#define _64BITS(h, l)
 
#define CLR64(x)
 
#define ADD64(x, y)   cx_add_64(&(x), &(y))
 
#define ASSIGN64(r, x)
 

Functions

uint32_t cx_swap_uint32 (uint32_t v)
 
void cx_swap_buffer32 (uint32_t *v, size_t len)
 
void cx_rotr64 (uint64bits_t *x, unsigned char n)
 
void cx_shr64 (uint64bits_t *x, unsigned char n)
 
void cx_add_64 (uint64bits_t *a, uint64bits_t *b)
 
void cx_swap_uint64 (uint64bits_t *v)
 
void cx_swap_buffer64 (uint64bits_t *v, int len)
 
void cx_memxor (uint8_t *buf1, const uint8_t *buf2, size_t len)
 
uint8_t cx_constant_time_eq (const uint8_t *buf1, uint8_t *buf2, size_t len)
 

Macro Definition Documentation

◆ _64BITS

#define _64BITS (   h,
 
)
Value:
{ \
h, l \
}

Definition at line 53 of file cx_utils.h.

◆ _CX_INLINE_U32

#define _CX_INLINE_U32

Definition at line 34 of file cx_utils.h.

◆ ADD64

#define ADD64 (   x,
 
)    cx_add_64(&(x), &(y))

Definition at line 62 of file cx_utils.h.

◆ ASSIGN64

#define ASSIGN64 (   r,
 
)
Value:
(r).l = (x).l; \
(r).h = (x).h

Definition at line 63 of file cx_utils.h.

◆ CLR64

#define CLR64 (   x)
Value:
(x).l = 0; \
(x).h = 0

Definition at line 59 of file cx_utils.h.

◆ cx_rotl

#define cx_rotl (   x,
 
)    (((x) << (n)) | ((x) >> (32 - (n))))

Definition at line 35 of file cx_utils.h.

◆ cx_rotr

#define cx_rotr (   x,
 
)    (((x) >> (n)) | ((x) << (32 - (n))))

Definition at line 36 of file cx_utils.h.

◆ cx_shr

#define cx_shr (   x,
 
)    ((x) >> (n))

Definition at line 37 of file cx_utils.h.

◆ htole32

#define htole32 (   value)    ((uint32_t) (value))

Definition at line 39 of file cx_utils.h.

Function Documentation

◆ cx_add_64()

void cx_add_64 ( uint64bits_t a,
uint64bits_t b 
)

Definition at line 156 of file cx_utils.c.

◆ cx_constant_time_eq()

uint8_t cx_constant_time_eq ( const uint8_t buf1,
uint8_t buf2,
size_t  len 
)

Definition at line 181 of file cx_utils.c.

◆ cx_memxor()

void cx_memxor ( uint8_t buf1,
const uint8_t buf2,
size_t  len 
)

Definition at line 173 of file cx_utils.c.

◆ cx_rotr64()

void cx_rotr64 ( uint64bits_t x,
unsigned char  n 
)

◆ cx_shr64()

void cx_shr64 ( uint64bits_t x,
unsigned char  n 
)

Definition at line 83 of file cx_utils.c.

◆ cx_swap_buffer32()

void cx_swap_buffer32 ( uint32_t *  v,
size_t  len 
)

Definition at line 47 of file cx_utils.c.

◆ cx_swap_buffer64()

void cx_swap_buffer64 ( uint64bits_t v,
int  len 
)

Definition at line 140 of file cx_utils.c.

◆ cx_swap_uint32()

uint32_t cx_swap_uint32 ( uint32_t  v)

Definition at line 41 of file cx_utils.c.

◆ cx_swap_uint64()

void cx_swap_uint64 ( uint64bits_t v)

Definition at line 118 of file cx_utils.c.