Embedded SDK
Embedded SDK
Classes | Macros | Typedefs
lcx_common.h File Reference

Cryptography flags. More...

#include <stdint.h>
#include <stddef.h>
Include dependency graph for lcx_common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  uint64_s
 64-bit types, native or by-hands, depending on target and/or compiler support. More...
 
struct  cx_iovec_t
 Similar to libc iovec type. More...
 

Macros

#define ARCH_LITTLE_ENDIAN
 
#define CX_FLAG
 Cryptography flags. More...
 
#define CX_LAST   (1 << 0)
 
#define CX_SIG_MODE   (1 << 1)
 
#define CX_MASK_SIGCRYPT   (3 << 1)
 
#define CX_ENCRYPT   (2 << 1)
 
#define CX_DECRYPT   (0 << 1)
 
#define CX_SIGN   (CX_SIG_MODE | CX_ENCRYPT)
 
#define CX_VERIFY   (CX_SIG_MODE | CX_DECRYPT)
 
#define CX_MASK_PAD   (7 << 3)
 
#define CX_PAD_NONE   (0 << 3)
 
#define CX_PAD_ISO9797M1   (1 << 3)
 
#define CX_PAD_ISO9797M2   (2 << 3)
 
#define CX_PAD_PKCS1_1o5   (3 << 3)
 
#define CX_PAD_PKCS1_PSS   (4 << 3)
 
#define CX_PAD_PKCS1_OAEP   (5 << 3)
 
#define CX_MASK_CHAIN   (7 << 6)
 
#define CX_CHAIN_ECB   (0 << 6)
 
#define CX_CHAIN_CBC   (1 << 6)
 
#define CX_CHAIN_CTR   (2 << 6)
 
#define CX_CHAIN_CFB   (3 << 6)
 
#define CX_CHAIN_OFB   (4 << 6)
 
#define CX_MASK_ECC_VARIANT   (7 << 6)
 
#define CX_NO_CANONICAL   (1 << 6)
 
#define CX_MASK_RND   (7 << 9)
 
#define CX_RND_PRNG   (1 << 9)
 
#define CX_RND_TRNG   (2 << 9)
 
#define CX_RND_RFC6979   (3 << 9)
 
#define CX_RND_PROVIDED   (4 << 9)
 
#define CX_MASK_EC   (7 << 12)
 
#define CX_ECSCHNORR_BIP0340   (0 << 12)
 
#define CX_ECDH_POINT   (1 << 12)
 
#define CX_ECDH_X   (2 << 12)
 
#define CX_ECSCHNORR_ISO14888_XY   (3 << 12)
 
#define CX_ECSCHNORR_ISO14888_X   (4 << 12)
 
#define CX_ECSCHNORR_BSI03111   (5 << 12)
 
#define CX_ECSCHNORR_LIBSECP   (6 << 12)
 
#define CX_ECSCHNORR_Z   (7 << 12)
 
#define CX_NO_REINIT   (1 << 15)
 

Typedefs

typedef struct uint64_s uint64bits_t
 

Detailed Description

Cryptography flags.

Flags required by some functions.

Definition in file lcx_common.h.

Macro Definition Documentation

◆ ARCH_LITTLE_ENDIAN

#define ARCH_LITTLE_ENDIAN

Definition at line 33 of file lcx_common.h.

◆ CX_CHAIN_CBC

#define CX_CHAIN_CBC   (1 << 6)

Definition at line 147 of file lcx_common.h.

◆ CX_CHAIN_CFB

#define CX_CHAIN_CFB   (3 << 6)

Definition at line 149 of file lcx_common.h.

◆ CX_CHAIN_CTR

#define CX_CHAIN_CTR   (2 << 6)

Definition at line 148 of file lcx_common.h.

◆ CX_CHAIN_ECB

#define CX_CHAIN_ECB   (0 << 6)

Definition at line 146 of file lcx_common.h.

◆ CX_CHAIN_OFB

#define CX_CHAIN_OFB   (4 << 6)

Definition at line 150 of file lcx_common.h.

◆ CX_DECRYPT

#define CX_DECRYPT   (0 << 1)

Definition at line 127 of file lcx_common.h.

◆ CX_ECDH_POINT

#define CX_ECDH_POINT   (1 << 12)

Definition at line 172 of file lcx_common.h.

◆ CX_ECDH_X

#define CX_ECDH_X   (2 << 12)

Definition at line 173 of file lcx_common.h.

◆ CX_ECSCHNORR_BIP0340

#define CX_ECSCHNORR_BIP0340   (0 << 12)

Definition at line 171 of file lcx_common.h.

◆ CX_ECSCHNORR_BSI03111

#define CX_ECSCHNORR_BSI03111   (5 << 12)

Definition at line 176 of file lcx_common.h.

◆ CX_ECSCHNORR_ISO14888_X

#define CX_ECSCHNORR_ISO14888_X   (4 << 12)

Definition at line 175 of file lcx_common.h.

◆ CX_ECSCHNORR_ISO14888_XY

#define CX_ECSCHNORR_ISO14888_XY   (3 << 12)

Definition at line 174 of file lcx_common.h.

◆ CX_ECSCHNORR_LIBSECP

#define CX_ECSCHNORR_LIBSECP   (6 << 12)

Definition at line 177 of file lcx_common.h.

◆ CX_ECSCHNORR_Z

#define CX_ECSCHNORR_Z   (7 << 12)

Definition at line 178 of file lcx_common.h.

◆ CX_ENCRYPT

#define CX_ENCRYPT   (2 << 1)

Definition at line 126 of file lcx_common.h.

◆ CX_FLAG

#define CX_FLAG

Cryptography flags.

Some functions take logical or of various flags. The following flags are globally defined:

Bits position Values Flags Meaning Algorithms
15 1000000000000000 CX_NO_REINIT Do not reinitialize the context on CX_LAST
14:12 0111000000000000 CX_ECSCHNORR_Z Zilliqa scheme ECSCHNORR
14:12 0110000000000000 CX_ECSCHNORR_LIBSECP ECSCHNORR according to libsecp256k1 ECSCHNORR
14:12 0101000000000000 CX_ECSCHNORR_BSI03111 ECSCHNORR according to BSI TR-03111 ECSCHNORR
14:12 0100000000000000 CX_ECSCHNORR_ISO14888_X ECSCHNORR according to ISO/IEC 14888-3 ECSCHNORR
14:12 0011000000000000 CX_ECSCHNORR_ISO14888_XY ECSCHNORR according to ISO/IEC 14888-3 ECSCHNORR
14:12 0010000000000000 CX_ECDH_X ECDH with the x-coordinate of the point ECDH
14:12 0001000000000000 CX_ECDH_POINT ECDH with a point ECDH
11:9 0000100000000000 CX_RND_PROVIDED Provided random
11:9 0000011000000000 CX_RND_RFC6979 Random from RFC6979
11:9 0000010000000000 CX_RND_TRNG Random from a PRNG
11:9 0000001000000000 CX_RND_PRNG Random from a TRNG
8:6 0000000100000000 CX_CHAIN_OFB Output feedback mode AES
8:6 0000000011000000 CX_CHAIN_CFB Cipher feedback mode AES
8:6 0000000010000000 CX_CHAIN_CTR Counter mode AES
8:6 0000000001000000 CX_CHAIN_CBC Cipher block chaining mode AES
8:6 0000000001000000 CX_NO_CANONICAL Do not compute a canonical signature ECDSA/EDDSA/ECSCHNORR
8:6 0000000000000000 CX_CHAIN_ECB Electronic codebook mode AES
5:3 0000000010100000 CX_PAD_PKCS1_OAEP PKCS1_OAEP padding
5:3 0000000010000000 CX_PAD_PKCS1_PSS PKCS1_PSS padding
5:3 0000000001100000 CX_PAD_PKCS1_1o5 PKCS1-v1_5 padding
5:3 0000000001000000 CX_PAD_ISO9797M2 ISO9797 padding, method 2
5:3 0000000000100000 CX_PAD_ISO9797M1 ISO9797 padding, method 1
5:3 0000000000000000 CX_PAD_NONE No padding
2:1 0000000000000110 CX_SIGN Signature AES
2:1 0000000000000100 CX_ENCRYPT Encryption AES
2:1 0000000000000010 CX_VERIFY Signature verification AES
2:1 0000000000000000 CX_DECRYPT Decryption AES
0 0000000000000001 CX_LAST Last block

Definition at line 110 of file lcx_common.h.

◆ CX_LAST

#define CX_LAST   (1 << 0)

Bit 0: Last block

Definition at line 115 of file lcx_common.h.

◆ CX_MASK_CHAIN

#define CX_MASK_CHAIN   (7 << 6)

Bit 8:6 AES chaining

Definition at line 145 of file lcx_common.h.

◆ CX_MASK_EC

#define CX_MASK_EC   (7 << 12)

Bit 14:12: ECDH and ECSCHNORR specificities

Definition at line 170 of file lcx_common.h.

◆ CX_MASK_ECC_VARIANT

#define CX_MASK_ECC_VARIANT   (7 << 6)

Bit 8:6 ECC variant

Definition at line 155 of file lcx_common.h.

◆ CX_MASK_PAD

#define CX_MASK_PAD   (7 << 3)

Bit 5:3: Padding

Definition at line 134 of file lcx_common.h.

◆ CX_MASK_RND

#define CX_MASK_RND   (7 << 9)

Bit 11:9 Random number generation

Definition at line 161 of file lcx_common.h.

◆ CX_MASK_SIGCRYPT

#define CX_MASK_SIGCRYPT   (3 << 1)

Bit 2:1: Signature and/or encryption

Definition at line 125 of file lcx_common.h.

◆ CX_NO_CANONICAL

#define CX_NO_CANONICAL   (1 << 6)

Definition at line 156 of file lcx_common.h.

◆ CX_NO_REINIT

#define CX_NO_REINIT   (1 << 15)

Bit 15: No reinitialization

Definition at line 183 of file lcx_common.h.

◆ CX_PAD_ISO9797M1

#define CX_PAD_ISO9797M1   (1 << 3)

Definition at line 136 of file lcx_common.h.

◆ CX_PAD_ISO9797M2

#define CX_PAD_ISO9797M2   (2 << 3)

Definition at line 137 of file lcx_common.h.

◆ CX_PAD_NONE

#define CX_PAD_NONE   (0 << 3)

Definition at line 135 of file lcx_common.h.

◆ CX_PAD_PKCS1_1o5

#define CX_PAD_PKCS1_1o5   (3 << 3)

Definition at line 138 of file lcx_common.h.

◆ CX_PAD_PKCS1_OAEP

#define CX_PAD_PKCS1_OAEP   (5 << 3)

Definition at line 140 of file lcx_common.h.

◆ CX_PAD_PKCS1_PSS

#define CX_PAD_PKCS1_PSS   (4 << 3)

Definition at line 139 of file lcx_common.h.

◆ CX_RND_PRNG

#define CX_RND_PRNG   (1 << 9)

Definition at line 162 of file lcx_common.h.

◆ CX_RND_PROVIDED

#define CX_RND_PROVIDED   (4 << 9)

Definition at line 165 of file lcx_common.h.

◆ CX_RND_RFC6979

#define CX_RND_RFC6979   (3 << 9)

Definition at line 164 of file lcx_common.h.

◆ CX_RND_TRNG

#define CX_RND_TRNG   (2 << 9)

Definition at line 163 of file lcx_common.h.

◆ CX_SIG_MODE

#define CX_SIG_MODE   (1 << 1)

Bit 1: Signature or verification

Definition at line 120 of file lcx_common.h.

◆ CX_SIGN

#define CX_SIGN   (CX_SIG_MODE | CX_ENCRYPT)

Definition at line 128 of file lcx_common.h.

◆ CX_VERIFY

#define CX_VERIFY   (CX_SIG_MODE | CX_DECRYPT)

Definition at line 129 of file lcx_common.h.

Typedef Documentation

◆ uint64bits_t

typedef struct uint64_s uint64bits_t

Definition at line 1 of file lcx_common.h.