crypto.h File Reference

General definitions for cryptographic algorithms. More...

#include "os_port.h"
#include "crypto_config.h"
#include "crypto_legacy.h"
#include "cpu_endian.h"
#include "error.h"

Go to the source code of this file.

Data Structures

struct  DataChunk
 Data chunk descriptor. More...
 
struct  HashAlgo
 Common interface for hash algorithms. More...
 
struct  CipherAlgo
 Common interface for encryption algorithms. More...
 
struct  KemAlgo
 Common interface for key encapsulation mechanisms (KEM) More...
 
struct  _PrngAlgo
 Common interface for pseudo-random number generators (PRNG) More...
 

Macros

#define CYCLONE_CRYPTO_VERSION_STRING   "2.4.4"
 
#define CYCLONE_CRYPTO_MAJOR_VERSION   2
 
#define CYCLONE_CRYPTO_MINOR_VERSION   4
 
#define CYCLONE_CRYPTO_REV_NUMBER   4
 
#define CRYPTO_STATIC_MEM_SUPPORT   DISABLED
 
#define MPI_SUPPORT   ENABLED
 
#define MPI_ASM_SUPPORT   DISABLED
 
#define BASE64_SUPPORT   ENABLED
 
#define BASE64URL_SUPPORT   ENABLED
 
#define RADIX64_SUPPORT   ENABLED
 
#define MD2_SUPPORT   DISABLED
 
#define MD4_SUPPORT   DISABLED
 
#define MD5_SUPPORT   DISABLED
 
#define RIPEMD128_SUPPORT   DISABLED
 
#define RIPEMD160_SUPPORT   DISABLED
 
#define SHA1_SUPPORT   ENABLED
 
#define SHA224_SUPPORT   ENABLED
 
#define SHA256_SUPPORT   ENABLED
 
#define SHA384_SUPPORT   ENABLED
 
#define SHA512_SUPPORT   ENABLED
 
#define SHA512_224_SUPPORT   DISABLED
 
#define SHA512_256_SUPPORT   DISABLED
 
#define SHA3_224_SUPPORT   DISABLED
 
#define SHA3_256_SUPPORT   DISABLED
 
#define SHA3_384_SUPPORT   DISABLED
 
#define SHA3_512_SUPPORT   DISABLED
 
#define SHAKE_SUPPORT   DISABLED
 
#define CSHAKE_SUPPORT   DISABLED
 
#define KECCAK_SUPPORT   DISABLED
 
#define BLAKE2B_SUPPORT   DISABLED
 
#define BLAKE2B160_SUPPORT   DISABLED
 
#define BLAKE2B256_SUPPORT   DISABLED
 
#define BLAKE2B384_SUPPORT   DISABLED
 
#define BLAKE2B512_SUPPORT   DISABLED
 
#define BLAKE2S_SUPPORT   DISABLED
 
#define BLAKE2S128_SUPPORT   DISABLED
 
#define BLAKE2S160_SUPPORT   DISABLED
 
#define BLAKE2S224_SUPPORT   DISABLED
 
#define BLAKE2S256_SUPPORT   DISABLED
 
#define SM3_SUPPORT   DISABLED
 
#define TIGER_SUPPORT   DISABLED
 
#define WHIRLPOOL_SUPPORT   DISABLED
 
#define CMAC_SUPPORT   DISABLED
 
#define HMAC_SUPPORT   ENABLED
 
#define GMAC_SUPPORT   DISABLED
 
#define KMAC_SUPPORT   DISABLED
 
#define XCBC_MAC_SUPPORT   DISABLED
 
#define RC2_SUPPORT   DISABLED
 
#define RC4_SUPPORT   DISABLED
 
#define RC6_SUPPORT   DISABLED
 
#define CAST128_SUPPORT   DISABLED
 
#define CAST256_SUPPORT   DISABLED
 
#define IDEA_SUPPORT   DISABLED
 
#define DES_SUPPORT   DISABLED
 
#define DES3_SUPPORT   DISABLED
 
#define AES_SUPPORT   ENABLED
 
#define BLOWFISH_SUPPORT   DISABLED
 
#define TWOFISH_SUPPORT   DISABLED
 
#define MARS_SUPPORT   DISABLED
 
#define SERPENT_SUPPORT   DISABLED
 
#define CAMELLIA_SUPPORT   DISABLED
 
#define ARIA_SUPPORT   DISABLED
 
#define SEED_SUPPORT   DISABLED
 
#define SM4_SUPPORT   DISABLED
 
#define PRESENT_SUPPORT   DISABLED
 
#define TEA_SUPPORT   DISABLED
 
#define XTEA_SUPPORT   DISABLED
 
#define TRIVIUM_SUPPORT   DISABLED
 
#define ZUC_SUPPORT   DISABLED
 
#define ECB_SUPPORT   ENABLED
 
#define CBC_SUPPORT   ENABLED
 
#define CFB_SUPPORT   ENABLED
 
#define OFB_SUPPORT   ENABLED
 
#define CTR_SUPPORT   ENABLED
 
#define XTS_SUPPORT   ENABLED
 
#define CCM_SUPPORT   ENABLED
 
#define GCM_SUPPORT   ENABLED
 
#define SIV_SUPPORT   DISABLED
 
#define SALSA20_SUPPORT   DISABLED
 
#define CHACHA_SUPPORT   DISABLED
 
#define POLY1305_SUPPORT   DISABLED
 
#define CHACHA20_POLY1305_SUPPORT   DISABLED
 
#define DH_SUPPORT   DISABLED
 
#define RSA_SUPPORT   ENABLED
 
#define DSA_SUPPORT   DISABLED
 
#define EC_SUPPORT   ENABLED
 
#define ECDH_SUPPORT   ENABLED
 
#define ECDSA_SUPPORT   ENABLED
 
#define MLKEM512_SUPPORT   DISABLED
 
#define MLKEM768_SUPPORT   DISABLED
 
#define MLKEM1024_SUPPORT   DISABLED
 
#define SNTRUP761_SUPPORT   DISABLED
 
#define HKDF_SUPPORT   DISABLED
 
#define PBKDF_SUPPORT   DISABLED
 
#define CONCAT_KDF_SUPPORT   DISABLED
 
#define BCRYPT_SUPPORT   DISABLED
 
#define SCRYPT_SUPPORT   DISABLED
 
#define MD5_CRYPT_SUPPORT   DISABLED
 
#define SHA_CRYPT_SUPPORT   DISABLED
 
#define YARROW_SUPPORT   ENABLED
 
#define OID_SUPPORT   ENABLED
 
#define ASN1_SUPPORT   ENABLED
 
#define PEM_SUPPORT   ENABLED
 
#define X509_SUPPORT   ENABLED
 
#define PKCS5_SUPPORT   DISABLED
 
#define cryptoAllocMem(size)   osAllocMem(size)
 
#define cryptoFreeMem(p)   osFreeMem(p)
 
#define ROL8(a, n)   (((a) << (n)) | ((a) >> (8 - (n))))
 
#define ROL16(a, n)   (((a) << (n)) | ((a) >> (16 - (n))))
 
#define ROL32(a, n)   (((a) << (n)) | ((a) >> (32 - (n))))
 
#define ROL64(a, n)   (((a) << (n)) | ((a) >> (64 - (n))))
 
#define ROR8(a, n)   (((a) >> (n)) | ((a) << (8 - (n))))
 
#define ROR16(a, n)   (((a) >> (n)) | ((a) << (16 - (n))))
 
#define ROR32(a, n)   (((a) >> (n)) | ((a) << (32 - (n))))
 
#define ROR64(a, n)   (((a) >> (n)) | ((a) << (64 - (n))))
 
#define SHL8(a, n)   ((a) << (n))
 
#define SHL16(a, n)   ((a) << (n))
 
#define SHL32(a, n)   ((a) << (n))
 
#define SHL64(a, n)   ((a) << (n))
 
#define SHR8(a, n)   ((a) >> (n))
 
#define SHR16(a, n)   ((a) >> (n))
 
#define SHR32(a, n)   ((a) >> (n))
 
#define SHR64(a, n)   ((a) >> (n))
 
#define _U8(x)   ((uint8_t) (x))
 
#define _U16(x)   ((uint16_t) (x))
 
#define _U32(x)   ((uint32_t) (x))
 
#define _U64(x)   ((uint64_t) (x))
 
#define CRYPTO_TEST_Z_8(a)    _U8((_U8((_U8(a) | (~_U8(a) + 1U))) >> 7U) ^ 1U)
 
#define CRYPTO_TEST_NZ_8(a)    _U8(_U8((_U8(a) | (~_U8(a) + 1U))) >> 7U)
 
#define CRYPTO_TEST_EQ_8(a, b)    _U8((_U8(((_U8(a) ^ _U8(b)) | (~(_U8(a) ^ _U8(b)) + 1U))) >> 7U) ^ 1U)
 
#define CRYPTO_TEST_NEQ_8(a, b)    _U8(_U8(((_U8(a) ^ _U8(b)) | (~(_U8(a) ^ _U8(b)) + 1U))) >> 7U)
 
#define CRYPTO_TEST_LT_8(a, b)    _U8(_U8((((_U8(a) - _U8(b)) ^ _U8(b)) | (_U8(a) ^ _U8(b))) ^ _U8(a)) >> 7U)
 
#define CRYPTO_TEST_LTE_8(a, b)    _U8((_U8((((_U8(b) - _U8(a)) ^ _U8(a)) | (_U8(a) ^ _U8(b))) ^ _U8(b)) >> 7U) ^ 1U)
 
#define CRYPTO_TEST_GT_8(a, b)    _U8(_U8((((_U8(b) - _U8(a)) ^ _U8(a)) | (_U8(a) ^ _U8(b))) ^ _U8(b)) >> 7U)
 
#define CRYPTO_TEST_GTE_8(a, b)    _U8((_U8((((_U8(a) - _U8(b)) ^ _U8(b)) | (_U8(a) ^ _U8(b))) ^ _U8(a)) >> 7U) ^ 1U)
 
#define CRYPTO_SELECT_8(a, b, c)    _U8((_U8(a) & (_U8(c) - 1U)) | (_U8(b) & ~(_U8(c) - 1U)))
 
#define CRYPTO_TEST_Z_16(a)    _U16((_U16((_U16(a) | (~_U16(a) + 1U))) >> 15U) ^ 1U)
 
#define CRYPTO_TEST_NZ_16(a)    _U16(_U16((_U16(a) | (~_U16(a) + 1U))) >> 15U)
 
#define CRYPTO_TEST_EQ_16(a, b)    _U16((_U16(((_U16(a) ^ _U16(b)) | (~(_U16(a) ^ _U16(b)) + 1U))) >> 15U) ^ 1U)
 
#define CRYPTO_TEST_NEQ_16(a, b)    _U16(_U16(((_U16(a) ^ _U16(b)) | (~(_U16(a) ^ _U16(b)) + 1U))) >> 15U)
 
#define CRYPTO_TEST_LT_16(a, b)    _U16(_U16((((_U16(a) - _U16(b)) ^ _U16(b)) | (_U16(a) ^ _U16(b))) ^ _U16(a)) >> 15U)
 
#define CRYPTO_TEST_LTE_16(a, b)    _U16((_U16((((_U16(b) - _U16(a)) ^ _U16(a)) | (_U16(a) ^ _U16(b))) ^ _U16(b)) >> 15U) ^ 1U)
 
#define CRYPTO_TEST_GT_16(a, b)    _U16(_U16((((_U16(b) - _U16(a)) ^ _U16(a)) | (_U16(a) ^ _U16(b))) ^ _U16(b)) >> 15U)
 
#define CRYPTO_TEST_GTE_16(a, b)    _U16((_U16((((_U16(a) - _U16(b)) ^ _U16(b)) | (_U16(a) ^ _U16(b))) ^ _U16(a)) >> 15U) ^ 1U)
 
#define CRYPTO_SELECT_16(a, b, c)    _U16((_U16(a) & (_U16(c) - 1U)) | (_U16(b) & ~(_U16(c) - 1U)))
 
#define CRYPTO_TEST_Z_32(a)    _U32((_U32((_U32(a) | (~_U32(a) + 1U))) >> 31U) ^ 1U)
 
#define CRYPTO_TEST_NZ_32(a)    _U32(_U32((_U32(a) | (~_U32(a) + 1U))) >> 31U)
 
#define CRYPTO_TEST_EQ_32(a, b)    _U32((_U32(((_U32(a) ^ _U32(b)) | (~(_U32(a) ^ _U32(b)) + 1U))) >> 31U) ^ 1U)
 
#define CRYPTO_TEST_NEQ_32(a, b)    _U32(_U32(((_U32(a) ^ _U32(b)) | (~(_U32(a) ^ _U32(b)) + 1U))) >> 31U)
 
#define CRYPTO_TEST_LT_32(a, b)    _U32(_U32((((_U32(a) - _U32(b)) ^ _U32(b)) | (_U32(a) ^ _U32(b))) ^ _U32(a)) >> 31U)
 
#define CRYPTO_TEST_LTE_32(a, b)    _U32((_U32((((_U32(b) - _U32(a)) ^ _U32(a)) | (_U32(a) ^ _U32(b))) ^ _U32(b)) >> 31U) ^ 1U)
 
#define CRYPTO_TEST_GT_32(a, b)    _U32(_U32((((_U32(b) - _U32(a)) ^ _U32(a)) | (_U32(a) ^ _U32(b))) ^ _U32(b)) >> 31U)
 
#define CRYPTO_TEST_GTE_32(a, b)    _U32((_U32((((_U32(a) - _U32(b)) ^ _U32(b)) | (_U32(a) ^ _U32(b))) ^ _U32(a)) >> 31U) ^ 1U)
 
#define CRYPTO_SELECT_32(a, b, c)    _U32((_U32(a) & (_U32(c) - 1U)) | (_U32(b) & ~(_U32(c) - 1U)))
 
#define CRYPTO_SELECT_64(a, b, c)    _U64((_U64(a) & (_U64(c) - 1U)) | (_U64(b) & ~(_U64(c) - 1U)))
 
#define PrngAlgo   struct _PrngAlgo
 

Typedefs

typedef error_t(* HashAlgoCompute) (const void *data, size_t length, uint8_t *digest)
 
typedef void(* HashAlgoInit) (void *context)
 
typedef void(* HashAlgoUpdate) (void *context, const void *data, size_t length)
 
typedef void(* HashAlgoFinal) (void *context, uint8_t *digest)
 
typedef void(* HashAlgoFinalRaw) (void *context, uint8_t *digest)
 
typedef error_t(* CipherAlgoInit) (void *context, const uint8_t *key, size_t keyLen)
 
typedef void(* CipherAlgoEncryptStream) (void *context, const uint8_t *input, uint8_t *output, size_t length)
 
typedef void(* CipherAlgoDecryptStream) (void *context, const uint8_t *input, uint8_t *output, size_t length)
 
typedef void(* CipherAlgoEncryptBlock) (void *context, const uint8_t *input, uint8_t *output)
 
typedef void(* CipherAlgoDecryptBlock) (void *context, const uint8_t *input, uint8_t *output)
 
typedef void(* CipherAlgoDeinit) (void *context)
 
typedef error_t(* KemAlgoGenerateKeyPair) (const PrngAlgo *prngAlgo, void *prngContext, uint8_t *pk, uint8_t *sk)
 
typedef error_t(* KemAlgoEncapsulate) (const PrngAlgo *prngAlgo, void *prngContext, uint8_t *ct, uint8_t *ss, const uint8_t *pk)
 
typedef error_t(* KemAlgoDecapsulate) (uint8_t *ss, const uint8_t *ct, const uint8_t *sk)
 
typedef error_t(* PrngAlgoInit) (void *context)
 
typedef error_t(* PrngAlgoSeed) (void *context, const uint8_t *input, size_t length)
 
typedef error_t(* PrngAlgoAddEntropy) (void *context, uint_t source, const uint8_t *input, size_t length, size_t entropy)
 
typedef error_t(* PrngAlgoRead) (void *context, uint8_t *output, size_t length)
 
typedef void(* PrngAlgoDeinit) (void *context)
 

Enumerations

enum  CipherAlgoType { CIPHER_ALGO_TYPE_STREAM = 0, CIPHER_ALGO_TYPE_BLOCK = 1 }
 Encryption algorithm type. More...
 
enum  CipherMode {
  CIPHER_MODE_NULL = 0, CIPHER_MODE_STREAM = 1, CIPHER_MODE_ECB = 2, CIPHER_MODE_CBC = 3,
  CIPHER_MODE_CFB = 4, CIPHER_MODE_OFB = 5, CIPHER_MODE_CTR = 6, CIPHER_MODE_CCM = 7,
  CIPHER_MODE_GCM = 8, CIPHER_MODE_CHACHA20_POLY1305 = 9
}
 Cipher operation modes. More...
 

Detailed Description

General definitions for cryptographic algorithms.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneCRYPTO Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file crypto.h.

Macro Definition Documentation

◆ _U16

#define _U16 (   x)    ((uint16_t) (x))

Definition at line 820 of file crypto.h.

◆ _U32

#define _U32 (   x)    ((uint32_t) (x))

Definition at line 821 of file crypto.h.

◆ _U64

#define _U64 (   x)    ((uint64_t) (x))

Definition at line 822 of file crypto.h.

◆ _U8

#define _U8 (   x)    ((uint8_t) (x))

Definition at line 819 of file crypto.h.

◆ AES_SUPPORT

#define AES_SUPPORT   ENABLED

Definition at line 436 of file crypto.h.

◆ ARIA_SUPPORT

#define ARIA_SUPPORT   DISABLED

Definition at line 478 of file crypto.h.

◆ ASN1_SUPPORT

#define ASN1_SUPPORT   ENABLED

Definition at line 758 of file crypto.h.

◆ BASE64_SUPPORT

#define BASE64_SUPPORT   ENABLED

Definition at line 100 of file crypto.h.

◆ BASE64URL_SUPPORT

#define BASE64URL_SUPPORT   ENABLED

Definition at line 107 of file crypto.h.

◆ BCRYPT_SUPPORT

#define BCRYPT_SUPPORT   DISABLED

Definition at line 716 of file crypto.h.

◆ BLAKE2B160_SUPPORT

#define BLAKE2B160_SUPPORT   DISABLED

Definition at line 261 of file crypto.h.

◆ BLAKE2B256_SUPPORT

#define BLAKE2B256_SUPPORT   DISABLED

Definition at line 268 of file crypto.h.

◆ BLAKE2B384_SUPPORT

#define BLAKE2B384_SUPPORT   DISABLED

Definition at line 275 of file crypto.h.

◆ BLAKE2B512_SUPPORT

#define BLAKE2B512_SUPPORT   DISABLED

Definition at line 282 of file crypto.h.

◆ BLAKE2B_SUPPORT

#define BLAKE2B_SUPPORT   DISABLED

Definition at line 254 of file crypto.h.

◆ BLAKE2S128_SUPPORT

#define BLAKE2S128_SUPPORT   DISABLED

Definition at line 296 of file crypto.h.

◆ BLAKE2S160_SUPPORT

#define BLAKE2S160_SUPPORT   DISABLED

Definition at line 303 of file crypto.h.

◆ BLAKE2S224_SUPPORT

#define BLAKE2S224_SUPPORT   DISABLED

Definition at line 310 of file crypto.h.

◆ BLAKE2S256_SUPPORT

#define BLAKE2S256_SUPPORT   DISABLED

Definition at line 317 of file crypto.h.

◆ BLAKE2S_SUPPORT

#define BLAKE2S_SUPPORT   DISABLED

Definition at line 289 of file crypto.h.

◆ BLOWFISH_SUPPORT

#define BLOWFISH_SUPPORT   DISABLED

Definition at line 443 of file crypto.h.

◆ CAMELLIA_SUPPORT

#define CAMELLIA_SUPPORT   DISABLED

Definition at line 471 of file crypto.h.

◆ CAST128_SUPPORT

#define CAST128_SUPPORT   DISABLED

Definition at line 401 of file crypto.h.

◆ CAST256_SUPPORT

#define CAST256_SUPPORT   DISABLED

Definition at line 408 of file crypto.h.

◆ CBC_SUPPORT

#define CBC_SUPPORT   ENABLED

Definition at line 541 of file crypto.h.

◆ CCM_SUPPORT

#define CCM_SUPPORT   ENABLED

Definition at line 576 of file crypto.h.

◆ CFB_SUPPORT

#define CFB_SUPPORT   ENABLED

Definition at line 548 of file crypto.h.

◆ CHACHA20_POLY1305_SUPPORT

#define CHACHA20_POLY1305_SUPPORT   DISABLED

Definition at line 618 of file crypto.h.

◆ CHACHA_SUPPORT

#define CHACHA_SUPPORT   DISABLED

Definition at line 604 of file crypto.h.

◆ CMAC_SUPPORT

#define CMAC_SUPPORT   DISABLED

Definition at line 345 of file crypto.h.

◆ CONCAT_KDF_SUPPORT

#define CONCAT_KDF_SUPPORT   DISABLED

Definition at line 709 of file crypto.h.

◆ CRYPTO_SELECT_16

#define CRYPTO_SELECT_16 (   a,
  b,
  c 
)     _U16((_U16(a) & (_U16(c) - 1U)) | (_U16(b) & ~(_U16(c) - 1U)))

Definition at line 893 of file crypto.h.

◆ CRYPTO_SELECT_32

#define CRYPTO_SELECT_32 (   a,
  b,
  c 
)     _U32((_U32(a) & (_U32(c) - 1U)) | (_U32(b) & ~(_U32(c) - 1U)))

Definition at line 929 of file crypto.h.

◆ CRYPTO_SELECT_64

#define CRYPTO_SELECT_64 (   a,
  b,
  c 
)     _U64((_U64(a) & (_U64(c) - 1U)) | (_U64(b) & ~(_U64(c) - 1U)))

Definition at line 933 of file crypto.h.

◆ CRYPTO_SELECT_8

#define CRYPTO_SELECT_8 (   a,
  b,
  c 
)     _U8((_U8(a) & (_U8(c) - 1U)) | (_U8(b) & ~(_U8(c) - 1U)))

Definition at line 857 of file crypto.h.

◆ CRYPTO_STATIC_MEM_SUPPORT

#define CRYPTO_STATIC_MEM_SUPPORT   DISABLED

Definition at line 79 of file crypto.h.

◆ CRYPTO_TEST_EQ_16

#define CRYPTO_TEST_EQ_16 (   a,
  b 
)     _U16((_U16(((_U16(a) ^ _U16(b)) | (~(_U16(a) ^ _U16(b)) + 1U))) >> 15U) ^ 1U)

Definition at line 869 of file crypto.h.

◆ CRYPTO_TEST_EQ_32

#define CRYPTO_TEST_EQ_32 (   a,
  b 
)     _U32((_U32(((_U32(a) ^ _U32(b)) | (~(_U32(a) ^ _U32(b)) + 1U))) >> 31U) ^ 1U)

Definition at line 905 of file crypto.h.

◆ CRYPTO_TEST_EQ_8

#define CRYPTO_TEST_EQ_8 (   a,
  b 
)     _U8((_U8(((_U8(a) ^ _U8(b)) | (~(_U8(a) ^ _U8(b)) + 1U))) >> 7U) ^ 1U)

Definition at line 833 of file crypto.h.

◆ CRYPTO_TEST_GT_16

#define CRYPTO_TEST_GT_16 (   a,
  b 
)     _U16(_U16((((_U16(b) - _U16(a)) ^ _U16(a)) | (_U16(a) ^ _U16(b))) ^ _U16(b)) >> 15U)

Definition at line 885 of file crypto.h.

◆ CRYPTO_TEST_GT_32

#define CRYPTO_TEST_GT_32 (   a,
  b 
)     _U32(_U32((((_U32(b) - _U32(a)) ^ _U32(a)) | (_U32(a) ^ _U32(b))) ^ _U32(b)) >> 31U)

Definition at line 921 of file crypto.h.

◆ CRYPTO_TEST_GT_8

#define CRYPTO_TEST_GT_8 (   a,
  b 
)     _U8(_U8((((_U8(b) - _U8(a)) ^ _U8(a)) | (_U8(a) ^ _U8(b))) ^ _U8(b)) >> 7U)

Definition at line 849 of file crypto.h.

◆ CRYPTO_TEST_GTE_16

#define CRYPTO_TEST_GTE_16 (   a,
  b 
)     _U16((_U16((((_U16(a) - _U16(b)) ^ _U16(b)) | (_U16(a) ^ _U16(b))) ^ _U16(a)) >> 15U) ^ 1U)

Definition at line 889 of file crypto.h.

◆ CRYPTO_TEST_GTE_32

#define CRYPTO_TEST_GTE_32 (   a,
  b 
)     _U32((_U32((((_U32(a) - _U32(b)) ^ _U32(b)) | (_U32(a) ^ _U32(b))) ^ _U32(a)) >> 31U) ^ 1U)

Definition at line 925 of file crypto.h.

◆ CRYPTO_TEST_GTE_8

#define CRYPTO_TEST_GTE_8 (   a,
  b 
)     _U8((_U8((((_U8(a) - _U8(b)) ^ _U8(b)) | (_U8(a) ^ _U8(b))) ^ _U8(a)) >> 7U) ^ 1U)

Definition at line 853 of file crypto.h.

◆ CRYPTO_TEST_LT_16

#define CRYPTO_TEST_LT_16 (   a,
  b 
)     _U16(_U16((((_U16(a) - _U16(b)) ^ _U16(b)) | (_U16(a) ^ _U16(b))) ^ _U16(a)) >> 15U)

Definition at line 877 of file crypto.h.

◆ CRYPTO_TEST_LT_32

#define CRYPTO_TEST_LT_32 (   a,
  b 
)     _U32(_U32((((_U32(a) - _U32(b)) ^ _U32(b)) | (_U32(a) ^ _U32(b))) ^ _U32(a)) >> 31U)

Definition at line 913 of file crypto.h.

◆ CRYPTO_TEST_LT_8

#define CRYPTO_TEST_LT_8 (   a,
  b 
)     _U8(_U8((((_U8(a) - _U8(b)) ^ _U8(b)) | (_U8(a) ^ _U8(b))) ^ _U8(a)) >> 7U)

Definition at line 841 of file crypto.h.

◆ CRYPTO_TEST_LTE_16

#define CRYPTO_TEST_LTE_16 (   a,
  b 
)     _U16((_U16((((_U16(b) - _U16(a)) ^ _U16(a)) | (_U16(a) ^ _U16(b))) ^ _U16(b)) >> 15U) ^ 1U)

Definition at line 881 of file crypto.h.

◆ CRYPTO_TEST_LTE_32

#define CRYPTO_TEST_LTE_32 (   a,
  b 
)     _U32((_U32((((_U32(b) - _U32(a)) ^ _U32(a)) | (_U32(a) ^ _U32(b))) ^ _U32(b)) >> 31U) ^ 1U)

Definition at line 917 of file crypto.h.

◆ CRYPTO_TEST_LTE_8

#define CRYPTO_TEST_LTE_8 (   a,
  b 
)     _U8((_U8((((_U8(b) - _U8(a)) ^ _U8(a)) | (_U8(a) ^ _U8(b))) ^ _U8(b)) >> 7U) ^ 1U)

Definition at line 845 of file crypto.h.

◆ CRYPTO_TEST_NEQ_16

#define CRYPTO_TEST_NEQ_16 (   a,
  b 
)     _U16(_U16(((_U16(a) ^ _U16(b)) | (~(_U16(a) ^ _U16(b)) + 1U))) >> 15U)

Definition at line 873 of file crypto.h.

◆ CRYPTO_TEST_NEQ_32

#define CRYPTO_TEST_NEQ_32 (   a,
  b 
)     _U32(_U32(((_U32(a) ^ _U32(b)) | (~(_U32(a) ^ _U32(b)) + 1U))) >> 31U)

Definition at line 909 of file crypto.h.

◆ CRYPTO_TEST_NEQ_8

#define CRYPTO_TEST_NEQ_8 (   a,
  b 
)     _U8(_U8(((_U8(a) ^ _U8(b)) | (~(_U8(a) ^ _U8(b)) + 1U))) >> 7U)

Definition at line 837 of file crypto.h.

◆ CRYPTO_TEST_NZ_16

#define CRYPTO_TEST_NZ_16 (   a)     _U16(_U16((_U16(a) | (~_U16(a) + 1U))) >> 15U)

Definition at line 865 of file crypto.h.

◆ CRYPTO_TEST_NZ_32

#define CRYPTO_TEST_NZ_32 (   a)     _U32(_U32((_U32(a) | (~_U32(a) + 1U))) >> 31U)

Definition at line 901 of file crypto.h.

◆ CRYPTO_TEST_NZ_8

#define CRYPTO_TEST_NZ_8 (   a)     _U8(_U8((_U8(a) | (~_U8(a) + 1U))) >> 7U)

Definition at line 829 of file crypto.h.

◆ CRYPTO_TEST_Z_16

#define CRYPTO_TEST_Z_16 (   a)     _U16((_U16((_U16(a) | (~_U16(a) + 1U))) >> 15U) ^ 1U)

Definition at line 861 of file crypto.h.

◆ CRYPTO_TEST_Z_32

#define CRYPTO_TEST_Z_32 (   a)     _U32((_U32((_U32(a) | (~_U32(a) + 1U))) >> 31U) ^ 1U)

Definition at line 897 of file crypto.h.

◆ CRYPTO_TEST_Z_8

#define CRYPTO_TEST_Z_8 (   a)     _U8((_U8((_U8(a) | (~_U8(a) + 1U))) >> 7U) ^ 1U)

Definition at line 825 of file crypto.h.

◆ cryptoAllocMem

#define cryptoAllocMem (   size)    osAllocMem(size)

Definition at line 786 of file crypto.h.

◆ cryptoFreeMem

#define cryptoFreeMem (   p)    osFreeMem(p)

Definition at line 791 of file crypto.h.

◆ CSHAKE_SUPPORT

#define CSHAKE_SUPPORT   DISABLED

Definition at line 240 of file crypto.h.

◆ CTR_SUPPORT

#define CTR_SUPPORT   ENABLED

Definition at line 562 of file crypto.h.

◆ CYCLONE_CRYPTO_MAJOR_VERSION

#define CYCLONE_CRYPTO_MAJOR_VERSION   2

Definition at line 71 of file crypto.h.

◆ CYCLONE_CRYPTO_MINOR_VERSION

#define CYCLONE_CRYPTO_MINOR_VERSION   4

Definition at line 73 of file crypto.h.

◆ CYCLONE_CRYPTO_REV_NUMBER

#define CYCLONE_CRYPTO_REV_NUMBER   4

Definition at line 75 of file crypto.h.

◆ CYCLONE_CRYPTO_VERSION_STRING

#define CYCLONE_CRYPTO_VERSION_STRING   "2.4.4"

Definition at line 69 of file crypto.h.

◆ DES3_SUPPORT

#define DES3_SUPPORT   DISABLED

Definition at line 429 of file crypto.h.

◆ DES_SUPPORT

#define DES_SUPPORT   DISABLED

Definition at line 422 of file crypto.h.

◆ DH_SUPPORT

#define DH_SUPPORT   DISABLED

Definition at line 625 of file crypto.h.

◆ DSA_SUPPORT

#define DSA_SUPPORT   DISABLED

Definition at line 639 of file crypto.h.

◆ EC_SUPPORT

#define EC_SUPPORT   ENABLED

Definition at line 646 of file crypto.h.

◆ ECB_SUPPORT

#define ECB_SUPPORT   ENABLED

Definition at line 534 of file crypto.h.

◆ ECDH_SUPPORT

#define ECDH_SUPPORT   ENABLED

Definition at line 653 of file crypto.h.

◆ ECDSA_SUPPORT

#define ECDSA_SUPPORT   ENABLED

Definition at line 660 of file crypto.h.

◆ GCM_SUPPORT

#define GCM_SUPPORT   ENABLED

Definition at line 583 of file crypto.h.

◆ GMAC_SUPPORT

#define GMAC_SUPPORT   DISABLED

Definition at line 359 of file crypto.h.

◆ HKDF_SUPPORT

#define HKDF_SUPPORT   DISABLED

Definition at line 695 of file crypto.h.

◆ HMAC_SUPPORT

#define HMAC_SUPPORT   ENABLED

Definition at line 352 of file crypto.h.

◆ IDEA_SUPPORT

#define IDEA_SUPPORT   DISABLED

Definition at line 415 of file crypto.h.

◆ KECCAK_SUPPORT

#define KECCAK_SUPPORT   DISABLED

Definition at line 247 of file crypto.h.

◆ KMAC_SUPPORT

#define KMAC_SUPPORT   DISABLED

Definition at line 366 of file crypto.h.

◆ MARS_SUPPORT

#define MARS_SUPPORT   DISABLED

Definition at line 457 of file crypto.h.

◆ MD2_SUPPORT

#define MD2_SUPPORT   DISABLED

Definition at line 121 of file crypto.h.

◆ MD4_SUPPORT

#define MD4_SUPPORT   DISABLED

Definition at line 128 of file crypto.h.

◆ MD5_CRYPT_SUPPORT

#define MD5_CRYPT_SUPPORT   DISABLED

Definition at line 730 of file crypto.h.

◆ MD5_SUPPORT

#define MD5_SUPPORT   DISABLED

Definition at line 135 of file crypto.h.

◆ MLKEM1024_SUPPORT

#define MLKEM1024_SUPPORT   DISABLED

Definition at line 681 of file crypto.h.

◆ MLKEM512_SUPPORT

#define MLKEM512_SUPPORT   DISABLED

Definition at line 667 of file crypto.h.

◆ MLKEM768_SUPPORT

#define MLKEM768_SUPPORT   DISABLED

Definition at line 674 of file crypto.h.

◆ MPI_ASM_SUPPORT

#define MPI_ASM_SUPPORT   DISABLED

Definition at line 93 of file crypto.h.

◆ MPI_SUPPORT

#define MPI_SUPPORT   ENABLED

Definition at line 86 of file crypto.h.

◆ OFB_SUPPORT

#define OFB_SUPPORT   ENABLED

Definition at line 555 of file crypto.h.

◆ OID_SUPPORT

#define OID_SUPPORT   ENABLED

Definition at line 751 of file crypto.h.

◆ PBKDF_SUPPORT

#define PBKDF_SUPPORT   DISABLED

Definition at line 702 of file crypto.h.

◆ PEM_SUPPORT

#define PEM_SUPPORT   ENABLED

Definition at line 765 of file crypto.h.

◆ PKCS5_SUPPORT

#define PKCS5_SUPPORT   DISABLED

Definition at line 779 of file crypto.h.

◆ POLY1305_SUPPORT

#define POLY1305_SUPPORT   DISABLED

Definition at line 611 of file crypto.h.

◆ PRESENT_SUPPORT

#define PRESENT_SUPPORT   DISABLED

Definition at line 499 of file crypto.h.

◆ PrngAlgo

#define PrngAlgo   struct _PrngAlgo

Definition at line 938 of file crypto.h.

◆ RADIX64_SUPPORT

#define RADIX64_SUPPORT   ENABLED

Definition at line 114 of file crypto.h.

◆ RC2_SUPPORT

#define RC2_SUPPORT   DISABLED

Definition at line 380 of file crypto.h.

◆ RC4_SUPPORT

#define RC4_SUPPORT   DISABLED

Definition at line 387 of file crypto.h.

◆ RC6_SUPPORT

#define RC6_SUPPORT   DISABLED

Definition at line 394 of file crypto.h.

◆ RIPEMD128_SUPPORT

#define RIPEMD128_SUPPORT   DISABLED

Definition at line 142 of file crypto.h.

◆ RIPEMD160_SUPPORT

#define RIPEMD160_SUPPORT   DISABLED

Definition at line 149 of file crypto.h.

◆ ROL16

#define ROL16 (   a,
  n 
)    (((a) << (n)) | ((a) >> (16 - (n))))

Definition at line 796 of file crypto.h.

◆ ROL32

#define ROL32 (   a,
  n 
)    (((a) << (n)) | ((a) >> (32 - (n))))

Definition at line 797 of file crypto.h.

◆ ROL64

#define ROL64 (   a,
  n 
)    (((a) << (n)) | ((a) >> (64 - (n))))

Definition at line 798 of file crypto.h.

◆ ROL8

#define ROL8 (   a,
  n 
)    (((a) << (n)) | ((a) >> (8 - (n))))

Definition at line 795 of file crypto.h.

◆ ROR16

#define ROR16 (   a,
  n 
)    (((a) >> (n)) | ((a) << (16 - (n))))

Definition at line 802 of file crypto.h.

◆ ROR32

#define ROR32 (   a,
  n 
)    (((a) >> (n)) | ((a) << (32 - (n))))

Definition at line 803 of file crypto.h.

◆ ROR64

#define ROR64 (   a,
  n 
)    (((a) >> (n)) | ((a) << (64 - (n))))

Definition at line 804 of file crypto.h.

◆ ROR8

#define ROR8 (   a,
  n 
)    (((a) >> (n)) | ((a) << (8 - (n))))

Definition at line 801 of file crypto.h.

◆ RSA_SUPPORT

#define RSA_SUPPORT   ENABLED

Definition at line 632 of file crypto.h.

◆ SALSA20_SUPPORT

#define SALSA20_SUPPORT   DISABLED

Definition at line 597 of file crypto.h.

◆ SCRYPT_SUPPORT

#define SCRYPT_SUPPORT   DISABLED

Definition at line 723 of file crypto.h.

◆ SEED_SUPPORT

#define SEED_SUPPORT   DISABLED

Definition at line 485 of file crypto.h.

◆ SERPENT_SUPPORT

#define SERPENT_SUPPORT   DISABLED

Definition at line 464 of file crypto.h.

◆ SHA1_SUPPORT

#define SHA1_SUPPORT   ENABLED

Definition at line 156 of file crypto.h.

◆ SHA224_SUPPORT

#define SHA224_SUPPORT   ENABLED

Definition at line 163 of file crypto.h.

◆ SHA256_SUPPORT

#define SHA256_SUPPORT   ENABLED

Definition at line 170 of file crypto.h.

◆ SHA384_SUPPORT

#define SHA384_SUPPORT   ENABLED

Definition at line 177 of file crypto.h.

◆ SHA3_224_SUPPORT

#define SHA3_224_SUPPORT   DISABLED

Definition at line 205 of file crypto.h.

◆ SHA3_256_SUPPORT

#define SHA3_256_SUPPORT   DISABLED

Definition at line 212 of file crypto.h.

◆ SHA3_384_SUPPORT

#define SHA3_384_SUPPORT   DISABLED

Definition at line 219 of file crypto.h.

◆ SHA3_512_SUPPORT

#define SHA3_512_SUPPORT   DISABLED

Definition at line 226 of file crypto.h.

◆ SHA512_224_SUPPORT

#define SHA512_224_SUPPORT   DISABLED

Definition at line 191 of file crypto.h.

◆ SHA512_256_SUPPORT

#define SHA512_256_SUPPORT   DISABLED

Definition at line 198 of file crypto.h.

◆ SHA512_SUPPORT

#define SHA512_SUPPORT   ENABLED

Definition at line 184 of file crypto.h.

◆ SHA_CRYPT_SUPPORT

#define SHA_CRYPT_SUPPORT   DISABLED

Definition at line 737 of file crypto.h.

◆ SHAKE_SUPPORT

#define SHAKE_SUPPORT   DISABLED

Definition at line 233 of file crypto.h.

◆ SHL16

#define SHL16 (   a,
  n 
)    ((a) << (n))

Definition at line 808 of file crypto.h.

◆ SHL32

#define SHL32 (   a,
  n 
)    ((a) << (n))

Definition at line 809 of file crypto.h.

◆ SHL64

#define SHL64 (   a,
  n 
)    ((a) << (n))

Definition at line 810 of file crypto.h.

◆ SHL8

#define SHL8 (   a,
  n 
)    ((a) << (n))

Definition at line 807 of file crypto.h.

◆ SHR16

#define SHR16 (   a,
  n 
)    ((a) >> (n))

Definition at line 814 of file crypto.h.

◆ SHR32

#define SHR32 (   a,
  n 
)    ((a) >> (n))

Definition at line 815 of file crypto.h.

◆ SHR64

#define SHR64 (   a,
  n 
)    ((a) >> (n))

Definition at line 816 of file crypto.h.

◆ SHR8

#define SHR8 (   a,
  n 
)    ((a) >> (n))

Definition at line 813 of file crypto.h.

◆ SIV_SUPPORT

#define SIV_SUPPORT   DISABLED

Definition at line 590 of file crypto.h.

◆ SM3_SUPPORT

#define SM3_SUPPORT   DISABLED

Definition at line 324 of file crypto.h.

◆ SM4_SUPPORT

#define SM4_SUPPORT   DISABLED

Definition at line 492 of file crypto.h.

◆ SNTRUP761_SUPPORT

#define SNTRUP761_SUPPORT   DISABLED

Definition at line 688 of file crypto.h.

◆ TEA_SUPPORT

#define TEA_SUPPORT   DISABLED

Definition at line 506 of file crypto.h.

◆ TIGER_SUPPORT

#define TIGER_SUPPORT   DISABLED

Definition at line 331 of file crypto.h.

◆ TRIVIUM_SUPPORT

#define TRIVIUM_SUPPORT   DISABLED

Definition at line 520 of file crypto.h.

◆ TWOFISH_SUPPORT

#define TWOFISH_SUPPORT   DISABLED

Definition at line 450 of file crypto.h.

◆ WHIRLPOOL_SUPPORT

#define WHIRLPOOL_SUPPORT   DISABLED

Definition at line 338 of file crypto.h.

◆ X509_SUPPORT

#define X509_SUPPORT   ENABLED

Definition at line 772 of file crypto.h.

◆ XCBC_MAC_SUPPORT

#define XCBC_MAC_SUPPORT   DISABLED

Definition at line 373 of file crypto.h.

◆ XTEA_SUPPORT

#define XTEA_SUPPORT   DISABLED

Definition at line 513 of file crypto.h.

◆ XTS_SUPPORT

#define XTS_SUPPORT   ENABLED

Definition at line 569 of file crypto.h.

◆ YARROW_SUPPORT

#define YARROW_SUPPORT   ENABLED

Definition at line 744 of file crypto.h.

◆ ZUC_SUPPORT

#define ZUC_SUPPORT   DISABLED

Definition at line 527 of file crypto.h.

Typedef Documentation

◆ CipherAlgoDecryptBlock

typedef void(* CipherAlgoDecryptBlock) (void *context, const uint8_t *input, uint8_t *output)

Definition at line 1012 of file crypto.h.

◆ CipherAlgoDecryptStream

typedef void(* CipherAlgoDecryptStream) (void *context, const uint8_t *input, uint8_t *output, size_t length)

Definition at line 1006 of file crypto.h.

◆ CipherAlgoDeinit

typedef void(* CipherAlgoDeinit) (void *context)

Definition at line 1015 of file crypto.h.

◆ CipherAlgoEncryptBlock

typedef void(* CipherAlgoEncryptBlock) (void *context, const uint8_t *input, uint8_t *output)

Definition at line 1009 of file crypto.h.

◆ CipherAlgoEncryptStream

typedef void(* CipherAlgoEncryptStream) (void *context, const uint8_t *input, uint8_t *output, size_t length)

Definition at line 1003 of file crypto.h.

◆ CipherAlgoInit

typedef error_t(* CipherAlgoInit) (void *context, const uint8_t *key, size_t keyLen)

Definition at line 1000 of file crypto.h.

◆ HashAlgoCompute

typedef error_t(* HashAlgoCompute) (const void *data, size_t length, uint8_t *digest)

Definition at line 988 of file crypto.h.

◆ HashAlgoFinal

typedef void(* HashAlgoFinal) (void *context, uint8_t *digest)

Definition at line 995 of file crypto.h.

◆ HashAlgoFinalRaw

typedef void(* HashAlgoFinalRaw) (void *context, uint8_t *digest)

Definition at line 997 of file crypto.h.

◆ HashAlgoInit

typedef void(* HashAlgoInit) (void *context)

Definition at line 991 of file crypto.h.

◆ HashAlgoUpdate

typedef void(* HashAlgoUpdate) (void *context, const void *data, size_t length)

Definition at line 993 of file crypto.h.

◆ KemAlgoDecapsulate

typedef error_t(* KemAlgoDecapsulate) (uint8_t *ss, const uint8_t *ct, const uint8_t *sk)

Definition at line 1024 of file crypto.h.

◆ KemAlgoEncapsulate

typedef error_t(* KemAlgoEncapsulate) (const PrngAlgo *prngAlgo, void *prngContext, uint8_t *ct, uint8_t *ss, const uint8_t *pk)

Definition at line 1021 of file crypto.h.

◆ KemAlgoGenerateKeyPair

typedef error_t(* KemAlgoGenerateKeyPair) (const PrngAlgo *prngAlgo, void *prngContext, uint8_t *pk, uint8_t *sk)

Definition at line 1018 of file crypto.h.

◆ PrngAlgoAddEntropy

typedef error_t(* PrngAlgoAddEntropy) (void *context, uint_t source, const uint8_t *input, size_t length, size_t entropy)

Definition at line 1033 of file crypto.h.

◆ PrngAlgoDeinit

typedef void(* PrngAlgoDeinit) (void *context)

Definition at line 1038 of file crypto.h.

◆ PrngAlgoInit

typedef error_t(* PrngAlgoInit) (void *context)

Definition at line 1028 of file crypto.h.

◆ PrngAlgoRead

typedef error_t(* PrngAlgoRead) (void *context, uint8_t *output, size_t length)

Definition at line 1036 of file crypto.h.

◆ PrngAlgoSeed

typedef error_t(* PrngAlgoSeed) (void *context, const uint8_t *input, size_t length)

Definition at line 1030 of file crypto.h.

Enumeration Type Documentation

◆ CipherAlgoType

Encryption algorithm type.

Enumerator
CIPHER_ALGO_TYPE_STREAM 
CIPHER_ALGO_TYPE_BLOCK 

Definition at line 950 of file crypto.h.

◆ CipherMode

enum CipherMode

Cipher operation modes.

Enumerator
CIPHER_MODE_NULL 
CIPHER_MODE_STREAM 
CIPHER_MODE_ECB 
CIPHER_MODE_CBC 
CIPHER_MODE_CFB 
CIPHER_MODE_OFB 
CIPHER_MODE_CTR 
CIPHER_MODE_CCM 
CIPHER_MODE_GCM 
CIPHER_MODE_CHACHA20_POLY1305 

Definition at line 961 of file crypto.h.