| SX126x-Arduino 2.0.1

Macros | Functions | Variables
aes.cpp File Reference
`#include <stdlib.h>`
`#include <stdint.h>`
`#include "aes.h"`

## Macros
#define | USE_TABLES
#define | VERSION_1
#define | WPOLY 0x011b
#define | BPOLY 0x1b
#define | DPOLY 0x008d
#define | f1(x) (x)
#define | f2(x) ((x << 1) ^ (((x >> 7) & 1) * WPOLY))
#define | f4(x) ((x << 2) ^ (((x >> 6) & 1) * WPOLY) ^ (((x >> 6) & 2) * WPOLY))
#define | f8(x) ((x << 3) ^ (((x >> 5) & 1) * WPOLY) ^ (((x >> 5) & 2) * WPOLY) ^ (((x >> 5) & 4) * WPOLY))
#define | d2(x) (((x) >> 1) ^ ((x)&1 ? DPOLY : 0))
#define | f3(x) (f2(x) ^ x)
#define | f9(x) (f8(x) ^ x)
#define | fb(x) (f8(x) ^ f2(x) ^ x)
#define | fd(x) (f8(x) ^ f4(x) ^ x)
#define | fe(x) (f8(x) ^ f4(x) ^ f2(x))
#define | sb_data(w)
#define | isb_data(w)
#define | mm_data(w)
#define | s_box(x) sbox[(x)]
#define | gfm2_sb(x) gfm2_sbox[(x)]
#define | gfm3_sb(x) gfm3_sbox[(x)]
#define | block_copy_nn(d, s, l) copy_block_nn(d, s, l)
#define | block_copy(d, s) copy_block(d, s)

## Functions
static void | copy_block (void *d, const void *s)
static void | copy_block_nn (uint8_t *d, const uint8_t *s, uint8_t nn)
static void | xor_block (void *d, const void *s)
static void | copy_and_key (void *d, const void *s, const void *k)
static void | add_round_key (uint8_t d[N_BLOCK], const uint8_t k[N_BLOCK])
static void | shift_sub_rows (uint8_t st[N_BLOCK])
static void | mix_sub_columns (uint8_t dt[N_BLOCK])
return_type | lora_aes_set_key (const uint8_t key[], length_type keylen, lora_aes_context ctx[1])
return_type | lora_aes_encrypt (const uint8_t in[N_BLOCK], uint8_t out[N_BLOCK], const lora_aes_context ctx[1])
return_type | lora_aes_cbc_encrypt (const uint8_t *in, uint8_t *out, int32_t n_block, uint8_t iv[N_BLOCK], const lora_aes_context ctx[1])

## Variables
static const uint8_t | sbox [256] = sb_data(f1)
static const uint8_t | gfm2_sbox [256] = sb_data(f2)
static const uint8_t | gfm3_sbox [256] = sb_data(f3)

## Macro Definition Documentation

## ◆ USE_TABLES

#define USE_TABLES

## ◆ VERSION_1

#define VERSION_1

## ◆ WPOLY

#define WPOLY 0x011b

## ◆ BPOLY

#define BPOLY 0x1b

## ◆ DPOLY

#define DPOLY 0x008d

## ◆ f1

#define f1 | ( |  | x | ) | (x)

## ◆ f2

#define f2 | ( |  | x | ) | ((x << 1) ^ (((x >> 7) & 1) * WPOLY))

## ◆ f4

#define f4 | ( |  | x | ) | ((x << 2) ^ (((x >> 6) & 1) * WPOLY) ^ (((x >> 6) & 2) * WPOLY))

## ◆ f8

#define f8 | ( |  | x | ) | ((x << 3) ^ (((x >> 5) & 1) * WPOLY) ^ (((x >> 5) & 2) * WPOLY) ^ (((x >> 5) & 4) * WPOLY))

## ◆ d2

#define d2 | ( |  | x | ) | (((x) >> 1) ^ ((x)&1 ? DPOLY : 0))

## ◆ f3

#define f3 | ( |  | x | ) | (f2(x) ^ x)

## ◆ f9

#define f9 | ( |  | x | ) | (f8(x) ^ x)

## ◆ fb

#define fb | ( |  | x | ) | (f8(x) ^ f2(x) ^ x)

## ◆ fd

#define fd | ( |  | x | ) | (f8(x) ^ f4(x) ^ x)

## ◆ fe

#define fe | ( |  | x | ) | (f8(x) ^ f4(x) ^ f2(x))

## ◆ sb_data

#define sb_data | ( |  | w | ) |

## ◆ isb_data

#define isb_data | ( |  | w | ) |

## ◆ mm_data

#define mm_data | ( |  | w | ) |

## ◆ s_box

#define s_box | ( |  | x | ) | sbox[(x)]

## ◆ gfm2_sb

#define gfm2_sb | ( |  | x | ) | gfm2_sbox[(x)]

## ◆ gfm3_sb

#define gfm3_sb | ( |  | x | ) | gfm3_sbox[(x)]

## ◆ block_copy_nn

#define block_copy_nn | ( |  | d,
|  |  | s,
|  |  | l
| ) |  | copy_block_nn(d, s, l)

## ◆ block_copy

#define block_copy | ( |  | d,
|  |  | s
| ) |  | copy_block(d, s)

## Function Documentation

## ◆ copy_block()

static void copy_block | ( | void * | d,
|  | const void * | s
| ) |  |
| static

## ◆ copy_block_nn()

static void copy_block_nn | ( | uint8_t * | d,
|  | const uint8_t * | s,
|  | uint8_t | nn
| ) |  |
| static

## ◆ xor_block()

static void xor_block | ( | void * | d,
|  | const void * | s
| ) |  |
| static

## ◆ copy_and_key()

static void copy_and_key | ( | void * | d,
|  | const void * | s,
|  | const void * | k
| ) |  |
| static

## ◆ add_round_key()

static void add_round_key | ( | uint8_t | d[N_BLOCK],
|  | const uint8_t | k[N_BLOCK]
| ) |  |
| static

## ◆ shift_sub_rows()

static void shift_sub_rows | ( | uint8_t | st[N_BLOCK] | ) |
| static

## ◆ mix_sub_columns()

static void mix_sub_columns | ( | uint8_t | dt[N_BLOCK] | ) |
| static

## ◆ lora_aes_set_key()

return_type lora_aes_set_key | ( | const uint8_t | key[],
|  | length_type | keylen,
|  | lora_aes_context | ctx[1]
| ) |  |

## ◆ lora_aes_encrypt()

return_type lora_aes_encrypt | ( | const uint8_t | in[N_BLOCK],
|  | uint8_t | out[N_BLOCK],
|  | const lora_aes_context | ctx[1]
| ) |  |

## ◆ lora_aes_cbc_encrypt()

return_type lora_aes_cbc_encrypt | ( | const uint8_t * | in,
|  | uint8_t * | out,
|  | int32_t | n_block,
|  | uint8_t | iv[N_BLOCK],
|  | const lora_aes_context | ctx[1]
| ) |  |

## Variable Documentation

## ◆ sbox

const uint8_t sbox[256] = sb_data(f1)
| static

## ◆ gfm2_sbox

const uint8_t gfm2_sbox[256] = sb_data(f2)
| static

## ◆ gfm3_sbox

const uint8_t gfm3_sbox[256] = sb_data(f3)
| static