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  HashContext
 Generic hash algorithm context. More...
 
struct  HashAlgo
 Common interface for hash algorithms. More...
 
struct  CipherAlgo
 Common interface for encryption algorithms. More...
 
struct  PrngAlgo
 Common interface for pseudo-random number generators. More...
 

Macros

#define CYCLONE_CRYPTO_VERSION_STRING   "1.9.8"
 
#define CYCLONE_CRYPTO_MAJOR_VERSION   1
 
#define CYCLONE_CRYPTO_MINOR_VERSION   9
 
#define CYCLONE_CRYPTO_REV_NUMBER   8
 
#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   ENABLED
 
#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 SHAKE128_SUPPORT   DISABLED
 
#define SHAKE256_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 TIGER_SUPPORT   DISABLED
 
#define WHIRLPOOL_SUPPORT   DISABLED
 
#define CMAC_SUPPORT   DISABLED
 
#define HMAC_SUPPORT   ENABLED
 
#define GMAC_SUPPORT   DISABLED
 
#define RC2_SUPPORT   DISABLED
 
#define RC4_SUPPORT   DISABLED
 
#define RC6_SUPPORT   DISABLED
 
#define IDEA_SUPPORT   DISABLED
 
#define DES_SUPPORT   ENABLED
 
#define DES3_SUPPORT   ENABLED
 
#define AES_SUPPORT   ENABLED
 
#define BLOWFISH_SUPPORT   DISABLED
 
#define CAMELLIA_SUPPORT   ENABLED
 
#define SEED_SUPPORT   ENABLED
 
#define ARIA_SUPPORT   ENABLED
 
#define PRESENT_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 SALSA20_SUPPORT   DISABLED
 
#define CHACHA_SUPPORT   DISABLED
 
#define POLY1305_SUPPORT   DISABLED
 
#define CHACHA20_POLY1305_SUPPORT   DISABLED
 
#define DH_SUPPORT   ENABLED
 
#define RSA_SUPPORT   ENABLED
 
#define DSA_SUPPORT   ENABLED
 
#define EC_SUPPORT   ENABLED
 
#define ECDH_SUPPORT   ENABLED
 
#define ECDSA_SUPPORT   ENABLED
 
#define HKDF_SUPPORT   DISABLED
 
#define PKCS5_SUPPORT   ENABLED
 
#define BCRYPT_SUPPORT   ENABLED
 
#define SCRYPT_SUPPORT   ENABLED
 
#define YARROW_SUPPORT   ENABLED
 
#define OID_SUPPORT   ENABLED
 
#define ASN1_SUPPORT   ENABLED
 
#define PEM_SUPPORT   ENABLED
 
#define X509_SUPPORT   ENABLED
 
#define cryptoAllocMem(size)   osAllocMem(size)
 
#define cryptoFreeMem(p)   osFreeMem(p)
 
#define MAX_HASH_CONTEXT_SIZE   sizeof(Sha3_512Context)
 
#define MAX_HASH_BLOCK_SIZE   SHA3_224_BLOCK_SIZE
 
#define MAX_HASH_DIGEST_SIZE   WHIRLPOOL_DIGEST_SIZE
 
#define MAX_CIPHER_CONTEXT_SIZE   sizeof(BlowfishContext)
 
#define MAX_CIPHER_BLOCK_SIZE   CAMELLIA_BLOCK_SIZE
 
#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)))
 

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 error_t(* PrngAlgoInit) (void *context)
 
typedef void(* PrngAlgoRelease) (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)
 

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-2020 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
1.9.8

Definition in file crypto.h.

Macro Definition Documentation

◆ _U16

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

Definition at line 874 of file crypto.h.

◆ _U32

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

Definition at line 875 of file crypto.h.

◆ _U64

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

Definition at line 876 of file crypto.h.

◆ _U8

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

Definition at line 873 of file crypto.h.

◆ AES_SUPPORT

#define AES_SUPPORT   ENABLED

Definition at line 394 of file crypto.h.

◆ ARIA_SUPPORT

#define ARIA_SUPPORT   ENABLED

Definition at line 422 of file crypto.h.

◆ ASN1_SUPPORT

#define ASN1_SUPPORT   ENABLED

Definition at line 604 of file crypto.h.

◆ BASE64_SUPPORT

#define BASE64_SUPPORT   ENABLED

Definition at line 93 of file crypto.h.

◆ BASE64URL_SUPPORT

#define BASE64URL_SUPPORT   ENABLED

Definition at line 100 of file crypto.h.

◆ BCRYPT_SUPPORT

#define BCRYPT_SUPPORT   ENABLED

Definition at line 576 of file crypto.h.

◆ BLAKE2B160_SUPPORT

#define BLAKE2B160_SUPPORT   DISABLED

Definition at line 254 of file crypto.h.

◆ BLAKE2B256_SUPPORT

#define BLAKE2B256_SUPPORT   DISABLED

Definition at line 261 of file crypto.h.

◆ BLAKE2B384_SUPPORT

#define BLAKE2B384_SUPPORT   DISABLED

Definition at line 268 of file crypto.h.

◆ BLAKE2B512_SUPPORT

#define BLAKE2B512_SUPPORT   DISABLED

Definition at line 275 of file crypto.h.

◆ BLAKE2B_SUPPORT

#define BLAKE2B_SUPPORT   DISABLED

Definition at line 247 of file crypto.h.

◆ BLAKE2S128_SUPPORT

#define BLAKE2S128_SUPPORT   DISABLED

Definition at line 289 of file crypto.h.

◆ BLAKE2S160_SUPPORT

#define BLAKE2S160_SUPPORT   DISABLED

Definition at line 296 of file crypto.h.

◆ BLAKE2S224_SUPPORT

#define BLAKE2S224_SUPPORT   DISABLED

Definition at line 303 of file crypto.h.

◆ BLAKE2S256_SUPPORT

#define BLAKE2S256_SUPPORT   DISABLED

Definition at line 310 of file crypto.h.

◆ BLAKE2S_SUPPORT

#define BLAKE2S_SUPPORT   DISABLED

Definition at line 282 of file crypto.h.

◆ BLOWFISH_SUPPORT

#define BLOWFISH_SUPPORT   DISABLED

Definition at line 401 of file crypto.h.

◆ CAMELLIA_SUPPORT

#define CAMELLIA_SUPPORT   ENABLED

Definition at line 408 of file crypto.h.

◆ CBC_SUPPORT

#define CBC_SUPPORT   ENABLED

Definition at line 443 of file crypto.h.

◆ CCM_SUPPORT

#define CCM_SUPPORT   ENABLED

Definition at line 478 of file crypto.h.

◆ CFB_SUPPORT

#define CFB_SUPPORT   ENABLED

Definition at line 450 of file crypto.h.

◆ CHACHA20_POLY1305_SUPPORT

#define CHACHA20_POLY1305_SUPPORT   DISABLED

Definition at line 513 of file crypto.h.

◆ CHACHA_SUPPORT

#define CHACHA_SUPPORT   DISABLED

Definition at line 499 of file crypto.h.

◆ CMAC_SUPPORT

#define CMAC_SUPPORT   DISABLED

Definition at line 331 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 947 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 983 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 987 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 911 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 923 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 959 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 887 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 939 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 975 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 903 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 943 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 979 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 907 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 931 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 967 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 895 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 935 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 971 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 899 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 927 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 963 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 891 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 919 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 955 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 883 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 915 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 951 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 879 of file crypto.h.

◆ cryptoAllocMem

#define cryptoAllocMem (   size)    osAllocMem(size)

Definition at line 625 of file crypto.h.

◆ cryptoFreeMem

#define cryptoFreeMem (   p)    osFreeMem(p)

Definition at line 630 of file crypto.h.

◆ CTR_SUPPORT

#define CTR_SUPPORT   ENABLED

Definition at line 464 of file crypto.h.

◆ CYCLONE_CRYPTO_MAJOR_VERSION

#define CYCLONE_CRYPTO_MAJOR_VERSION   1

Definition at line 71 of file crypto.h.

◆ CYCLONE_CRYPTO_MINOR_VERSION

#define CYCLONE_CRYPTO_MINOR_VERSION   9

Definition at line 73 of file crypto.h.

◆ CYCLONE_CRYPTO_REV_NUMBER

#define CYCLONE_CRYPTO_REV_NUMBER   8

Definition at line 75 of file crypto.h.

◆ CYCLONE_CRYPTO_VERSION_STRING

#define CYCLONE_CRYPTO_VERSION_STRING   "1.9.8"

Definition at line 69 of file crypto.h.

◆ DES3_SUPPORT

#define DES3_SUPPORT   ENABLED

Definition at line 387 of file crypto.h.

◆ DES_SUPPORT

#define DES_SUPPORT   ENABLED

Definition at line 380 of file crypto.h.

◆ DH_SUPPORT

#define DH_SUPPORT   ENABLED

Definition at line 520 of file crypto.h.

◆ DSA_SUPPORT

#define DSA_SUPPORT   ENABLED

Definition at line 534 of file crypto.h.

◆ EC_SUPPORT

#define EC_SUPPORT   ENABLED

Definition at line 541 of file crypto.h.

◆ ECB_SUPPORT

#define ECB_SUPPORT   ENABLED

Definition at line 436 of file crypto.h.

◆ ECDH_SUPPORT

#define ECDH_SUPPORT   ENABLED

Definition at line 548 of file crypto.h.

◆ ECDSA_SUPPORT

#define ECDSA_SUPPORT   ENABLED

Definition at line 555 of file crypto.h.

◆ GCM_SUPPORT

#define GCM_SUPPORT   ENABLED

Definition at line 485 of file crypto.h.

◆ GMAC_SUPPORT

#define GMAC_SUPPORT   DISABLED

Definition at line 345 of file crypto.h.

◆ HKDF_SUPPORT

#define HKDF_SUPPORT   DISABLED

Definition at line 562 of file crypto.h.

◆ HMAC_SUPPORT

#define HMAC_SUPPORT   ENABLED

Definition at line 338 of file crypto.h.

◆ IDEA_SUPPORT

#define IDEA_SUPPORT   DISABLED

Definition at line 373 of file crypto.h.

◆ KECCAK_SUPPORT

#define KECCAK_SUPPORT   DISABLED

Definition at line 240 of file crypto.h.

◆ MAX_CIPHER_BLOCK_SIZE

#define MAX_CIPHER_BLOCK_SIZE   CAMELLIA_BLOCK_SIZE

Definition at line 825 of file crypto.h.

◆ MAX_CIPHER_CONTEXT_SIZE

#define MAX_CIPHER_CONTEXT_SIZE   sizeof(BlowfishContext)

Definition at line 800 of file crypto.h.

◆ MAX_HASH_BLOCK_SIZE

#define MAX_HASH_BLOCK_SIZE   SHA3_224_BLOCK_SIZE

Definition at line 690 of file crypto.h.

◆ MAX_HASH_CONTEXT_SIZE

#define MAX_HASH_CONTEXT_SIZE   sizeof(Sha3_512Context)

Definition at line 635 of file crypto.h.

◆ MAX_HASH_DIGEST_SIZE

#define MAX_HASH_DIGEST_SIZE   WHIRLPOOL_DIGEST_SIZE

Definition at line 745 of file crypto.h.

◆ MD2_SUPPORT

#define MD2_SUPPORT   DISABLED

Definition at line 114 of file crypto.h.

◆ MD4_SUPPORT

#define MD4_SUPPORT   DISABLED

Definition at line 121 of file crypto.h.

◆ MD5_SUPPORT

#define MD5_SUPPORT   ENABLED

Definition at line 128 of file crypto.h.

◆ MPI_ASM_SUPPORT

#define MPI_ASM_SUPPORT   DISABLED

Definition at line 86 of file crypto.h.

◆ MPI_SUPPORT

#define MPI_SUPPORT   ENABLED

Definition at line 79 of file crypto.h.

◆ OFB_SUPPORT

#define OFB_SUPPORT   ENABLED

Definition at line 457 of file crypto.h.

◆ OID_SUPPORT

#define OID_SUPPORT   ENABLED

Definition at line 597 of file crypto.h.

◆ PEM_SUPPORT

#define PEM_SUPPORT   ENABLED

Definition at line 611 of file crypto.h.

◆ PKCS5_SUPPORT

#define PKCS5_SUPPORT   ENABLED

Definition at line 569 of file crypto.h.

◆ POLY1305_SUPPORT

#define POLY1305_SUPPORT   DISABLED

Definition at line 506 of file crypto.h.

◆ PRESENT_SUPPORT

#define PRESENT_SUPPORT   DISABLED

Definition at line 429 of file crypto.h.

◆ RADIX64_SUPPORT

#define RADIX64_SUPPORT   ENABLED

Definition at line 107 of file crypto.h.

◆ RC2_SUPPORT

#define RC2_SUPPORT   DISABLED

Definition at line 352 of file crypto.h.

◆ RC4_SUPPORT

#define RC4_SUPPORT   DISABLED

Definition at line 359 of file crypto.h.

◆ RC6_SUPPORT

#define RC6_SUPPORT   DISABLED

Definition at line 366 of file crypto.h.

◆ RIPEMD128_SUPPORT

#define RIPEMD128_SUPPORT   DISABLED

Definition at line 135 of file crypto.h.

◆ RIPEMD160_SUPPORT

#define RIPEMD160_SUPPORT   DISABLED

Definition at line 142 of file crypto.h.

◆ ROL16

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

Definition at line 850 of file crypto.h.

◆ ROL32

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

Definition at line 851 of file crypto.h.

◆ ROL64

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

Definition at line 852 of file crypto.h.

◆ ROL8

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

Definition at line 849 of file crypto.h.

◆ ROR16

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

Definition at line 856 of file crypto.h.

◆ ROR32

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

Definition at line 857 of file crypto.h.

◆ ROR64

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

Definition at line 858 of file crypto.h.

◆ ROR8

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

Definition at line 855 of file crypto.h.

◆ RSA_SUPPORT

#define RSA_SUPPORT   ENABLED

Definition at line 527 of file crypto.h.

◆ SALSA20_SUPPORT

#define SALSA20_SUPPORT   DISABLED

Definition at line 492 of file crypto.h.

◆ SCRYPT_SUPPORT

#define SCRYPT_SUPPORT   ENABLED

Definition at line 583 of file crypto.h.

◆ SEED_SUPPORT

#define SEED_SUPPORT   ENABLED

Definition at line 415 of file crypto.h.

◆ SHA1_SUPPORT

#define SHA1_SUPPORT   ENABLED

Definition at line 149 of file crypto.h.

◆ SHA224_SUPPORT

#define SHA224_SUPPORT   ENABLED

Definition at line 156 of file crypto.h.

◆ SHA256_SUPPORT

#define SHA256_SUPPORT   ENABLED

Definition at line 163 of file crypto.h.

◆ SHA384_SUPPORT

#define SHA384_SUPPORT   ENABLED

Definition at line 170 of file crypto.h.

◆ SHA3_224_SUPPORT

#define SHA3_224_SUPPORT   DISABLED

Definition at line 198 of file crypto.h.

◆ SHA3_256_SUPPORT

#define SHA3_256_SUPPORT   DISABLED

Definition at line 205 of file crypto.h.

◆ SHA3_384_SUPPORT

#define SHA3_384_SUPPORT   DISABLED

Definition at line 212 of file crypto.h.

◆ SHA3_512_SUPPORT

#define SHA3_512_SUPPORT   DISABLED

Definition at line 219 of file crypto.h.

◆ SHA512_224_SUPPORT

#define SHA512_224_SUPPORT   DISABLED

Definition at line 184 of file crypto.h.

◆ SHA512_256_SUPPORT

#define SHA512_256_SUPPORT   DISABLED

Definition at line 191 of file crypto.h.

◆ SHA512_SUPPORT

#define SHA512_SUPPORT   ENABLED

Definition at line 177 of file crypto.h.

◆ SHAKE128_SUPPORT

#define SHAKE128_SUPPORT   DISABLED

Definition at line 226 of file crypto.h.

◆ SHAKE256_SUPPORT

#define SHAKE256_SUPPORT   DISABLED

Definition at line 233 of file crypto.h.

◆ SHL16

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

Definition at line 862 of file crypto.h.

◆ SHL32

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

Definition at line 863 of file crypto.h.

◆ SHL64

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

Definition at line 864 of file crypto.h.

◆ SHL8

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

Definition at line 861 of file crypto.h.

◆ SHR16

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

Definition at line 868 of file crypto.h.

◆ SHR32

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

Definition at line 869 of file crypto.h.

◆ SHR64

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

Definition at line 870 of file crypto.h.

◆ SHR8

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

Definition at line 867 of file crypto.h.

◆ TIGER_SUPPORT

#define TIGER_SUPPORT   DISABLED

Definition at line 317 of file crypto.h.

◆ WHIRLPOOL_SUPPORT

#define WHIRLPOOL_SUPPORT   DISABLED

Definition at line 324 of file crypto.h.

◆ X509_SUPPORT

#define X509_SUPPORT   ENABLED

Definition at line 618 of file crypto.h.

◆ XTS_SUPPORT

#define XTS_SUPPORT   ENABLED

Definition at line 471 of file crypto.h.

◆ YARROW_SUPPORT

#define YARROW_SUPPORT   ENABLED

Definition at line 590 of file crypto.h.

Typedef Documentation

◆ CipherAlgoDecryptBlock

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

Definition at line 1038 of file crypto.h.

◆ CipherAlgoDecryptStream

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

Definition at line 1036 of file crypto.h.

◆ CipherAlgoEncryptBlock

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

Definition at line 1037 of file crypto.h.

◆ CipherAlgoEncryptStream

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

Definition at line 1035 of file crypto.h.

◆ CipherAlgoInit

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

Definition at line 1034 of file crypto.h.

◆ HashAlgoCompute

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

Definition at line 1027 of file crypto.h.

◆ HashAlgoFinal

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

Definition at line 1030 of file crypto.h.

◆ HashAlgoFinalRaw

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

Definition at line 1031 of file crypto.h.

◆ HashAlgoInit

typedef void(* HashAlgoInit) (void *context)

Definition at line 1028 of file crypto.h.

◆ HashAlgoUpdate

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

Definition at line 1029 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 1044 of file crypto.h.

◆ PrngAlgoInit

typedef error_t(* PrngAlgoInit) (void *context)

Definition at line 1041 of file crypto.h.

◆ PrngAlgoRead

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

Definition at line 1045 of file crypto.h.

◆ PrngAlgoRelease

typedef void(* PrngAlgoRelease) (void *context)

Definition at line 1042 of file crypto.h.

◆ PrngAlgoSeed

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

Definition at line 1043 of file crypto.h.

Enumeration Type Documentation

◆ CipherAlgoType

Encryption algorithm type.

Enumerator
CIPHER_ALGO_TYPE_STREAM 
CIPHER_ALGO_TYPE_BLOCK 

Definition at line 1000 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 1011 of file crypto.h.