RadioLib
Universal wireless communication library for Arduino
Loading...
Searching...
No Matches
RadioLibSoftwareAES128 Class Reference

Class to perform AES encryption and decryption in software only. Contains implementation of pure virtual methods from RadioLibAES128. More...

#include <Cryptography.h>

Inheritance diagram for RadioLibSoftwareAES128:
RadioLibAES128

Public Member Functions

 RadioLibSoftwareAES128 ()
 Default constructor.
 
void init (uint8_t *key) override
 Initialize the AES.
 
size_t encryptECB (const uint8_t *in, size_t len, uint8_t *out) override
 Perform ECB-type AES encryption.
 
size_t decryptECB (const uint8_t *in, size_t len, uint8_t *out) override
 Perform ECB-type AES decryption.
 
- Public Member Functions inherited from RadioLibAES128
 RadioLibAES128 ()
 Default constructor.
 
void generateCMAC (const uint8_t *in, size_t len, uint8_t *cmac)
 Calculate message authentication code according to RFC4493.
 
void initCMAC (RadioLibCmacState *st)
 Initialize the CMAC state. This must be called before any updateCMAC calls.
 
void updateCMAC (RadioLibCmacState *st, const uint8_t *data, size_t len)
 Update the CMAC state with a chunk of data. This can be called multiple times to process the data in chunks.
 
void finishCMAC (RadioLibCmacState *st, uint8_t *out)
 Finalize the CMAC calculation and save the result. This must be called after all updateCMAC calls are done.
 
bool verifyCMAC (const uint8_t *in, size_t len, const uint8_t *cmac)
 Verify the received CMAC. This just calculates the CMAC again and compares the results.
 

Detailed Description

Class to perform AES encryption and decryption in software only. Contains implementation of pure virtual methods from RadioLibAES128.

Most of the implementation here is adapted from https://github.com/kokke/tiny-AES-c

Member Function Documentation

◆ decryptECB()

size_t RadioLibSoftwareAES128::decryptECB ( const uint8_t *  in,
size_t  len,
uint8_t *  out 
)
overridevirtual

Perform ECB-type AES decryption.

Parameters
inInput ciphertext data.
lenLength of the input data.
outBuffer to save the output plaintext into. It is up to the caller to ensure the buffer is sufficiently large to save the data!
Returns
The number of bytes saved into the output buffer.

Implements RadioLibAES128.

◆ encryptECB()

size_t RadioLibSoftwareAES128::encryptECB ( const uint8_t *  in,
size_t  len,
uint8_t *  out 
)
overridevirtual

Perform ECB-type AES encryption.

Parameters
inInput plaintext data (unpadded).
lenLength of the input data.
outBuffer to save the output ciphertext into. It is up to the caller to ensure the buffer is sufficiently large to save the data!
Returns
The number of bytes saved into the output buffer.

Implements RadioLibAES128.

◆ init()

void RadioLibSoftwareAES128::init ( uint8_t *  key)
overridevirtual

Initialize the AES.

Parameters
keyAES key to use.

Implements RadioLibAES128.


The documentation for this class was generated from the following files: