Leancrypto 1.7.2
Post-Quantum Cryptographic Library
Macros | Functions
lc_init.h File Reference

Go to the source code of this file.

Macros

#define LC_INIT_AES_SBOX   (1 << 0)
 
#define LC_INIT_AES_CT   (1 << 1)
 

Functions

int lc_init (unsigned int flags)
 Initialization of leancrypto. More...
 

Macro Definition Documentation

◆ LC_INIT_AES_CT

#define LC_INIT_AES_CT   (1 << 1)

Use the AES C implementation based on a constant time algorithm

This is a slower implementation, but based on current understanding free of side channels. Use ths if you need to rely on a C implementation of AES and have extra requirements regarding security.

Leancrypto applies a security-by-default strategy which implies that this implementation is used as default if no accelerated implementations are available. Yet, this implementation is about 3 to 5 times slower compared to the AES with S-Boxes enabled with LC_INIT_AES_SBOX. If you are sure that side-channels are of lesser concern in your environment and you use the C implementation, you may use the S-Box variant.

Definition at line 50 of file lc_init.h.

◆ LC_INIT_AES_SBOX

#define LC_INIT_AES_SBOX   (1 << 0)

Use the AES C implementation based on an S-Box

This is a fast implementation, but not guaranteed to be constant time and thus fully free of side-channels with respect to the plaintext or ciphertext. Yet, the key schedule generation is using a constant-time operation.

Definition at line 34 of file lc_init.h.

Function Documentation

◆ lc_init()

int lc_init ( unsigned int  flags)

Initialization of leancrypto.

This function invokes all necessary initialization functions required at the loading time of leancrypto. However, this function is only needed for environments without a constructor functionality such as the Linux kernel or the EFI environment.

For regular environments such as Linux, this function is not required to be called. But it does not hurt to be called.

Note
If this function is called, no other leancrypto service must be offered as this function may alter the global leancrypto state.
Parameters
[in]flagssee LC_INIT_* flags
Returns
0 on success, < 0 on error