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"
#include <string.h>
#include <ctype.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 MPI_SUPPORT   ENABLED
 
#define MPI_ASM_SUPPORT   DISABLED
 
#define BASE64_SUPPORT   ENABLED
 
#define MD2_SUPPORT   ENABLED
 
#define MD4_SUPPORT   ENABLED
 
#define MD5_SUPPORT   ENABLED
 
#define RIPEMD128_SUPPORT   ENABLED
 
#define RIPEMD160_SUPPORT   ENABLED
 
#define SHA1_SUPPORT   ENABLED
 
#define SHA224_SUPPORT   ENABLED
 
#define SHA256_SUPPORT   ENABLED
 
#define SHA384_SUPPORT   ENABLED
 
#define SHA512_SUPPORT   ENABLED
 
#define SHA512_224_SUPPORT   ENABLED
 
#define SHA512_256_SUPPORT   ENABLED
 
#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   ENABLED
 
#define WHIRLPOOL_SUPPORT   ENABLED
 
#define CMAC_SUPPORT   DISABLED
 
#define HMAC_SUPPORT   ENABLED
 
#define GMAC_SUPPORT   DISABLED
 
#define RC2_SUPPORT   DISABLED
 
#define RC4_SUPPORT   ENABLED
 
#define RC6_SUPPORT   ENABLED
 
#define IDEA_SUPPORT   ENABLED
 
#define DES_SUPPORT   ENABLED
 
#define DES3_SUPPORT   ENABLED
 
#define AES_SUPPORT   ENABLED
 
#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 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 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 cryptoMemset(p, value, length)   (void) memset(p, value, length)
 
#define cryptoMemcpy(dest, src, length)   (void) memcpy(dest, src, length)
 
#define cryptoMemmove(dest, src, length)   (void) memmove(dest, src, length)
 
#define cryptoMemcmp(p1, p2, length)   memcmp(p1, p2, length)
 
#define cryptoStrlen(s)   strlen(s)
 
#define cryptoStrcpy(s1, s2)   (void) strcpy(s1, s2)
 
#define cryptoStrncpy(s1, s2, length)   (void) strncpy(s1, s2, length)
 
#define cryptoTolower(c)   tolower((uint8_t) (c))
 
#define cryptoIsdigit(c)   isdigit((uint8_t) (c))
 
#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(AriaContext)
 
#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 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)))
 

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

Copyright (C) 2010-2018 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.0

Definition in file crypto.h.

Macro Definition Documentation

◆ _U16

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

Definition at line 872 of file crypto.h.

◆ _U32

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

Definition at line 873 of file crypto.h.

◆ _U8

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

Definition at line 871 of file crypto.h.

◆ AES_SUPPORT

#define AES_SUPPORT   ENABLED

Definition at line 370 of file crypto.h.

◆ ARIA_SUPPORT

#define ARIA_SUPPORT   ENABLED

Definition at line 391 of file crypto.h.

◆ ASN1_SUPPORT

#define ASN1_SUPPORT   ENABLED

Definition at line 552 of file crypto.h.

◆ BASE64_SUPPORT

#define BASE64_SUPPORT   ENABLED

Definition at line 83 of file crypto.h.

◆ BLAKE2B160_SUPPORT

#define BLAKE2B160_SUPPORT   DISABLED

Definition at line 230 of file crypto.h.

◆ BLAKE2B256_SUPPORT

#define BLAKE2B256_SUPPORT   DISABLED

Definition at line 237 of file crypto.h.

◆ BLAKE2B384_SUPPORT

#define BLAKE2B384_SUPPORT   DISABLED

Definition at line 244 of file crypto.h.

◆ BLAKE2B512_SUPPORT

#define BLAKE2B512_SUPPORT   DISABLED

Definition at line 251 of file crypto.h.

◆ BLAKE2B_SUPPORT

#define BLAKE2B_SUPPORT   DISABLED

Definition at line 223 of file crypto.h.

◆ BLAKE2S128_SUPPORT

#define BLAKE2S128_SUPPORT   DISABLED

Definition at line 265 of file crypto.h.

◆ BLAKE2S160_SUPPORT

#define BLAKE2S160_SUPPORT   DISABLED

Definition at line 272 of file crypto.h.

◆ BLAKE2S224_SUPPORT

#define BLAKE2S224_SUPPORT   DISABLED

Definition at line 279 of file crypto.h.

◆ BLAKE2S256_SUPPORT

#define BLAKE2S256_SUPPORT   DISABLED

Definition at line 286 of file crypto.h.

◆ BLAKE2S_SUPPORT

#define BLAKE2S_SUPPORT   DISABLED

Definition at line 258 of file crypto.h.

◆ CAMELLIA_SUPPORT

#define CAMELLIA_SUPPORT   ENABLED

Definition at line 377 of file crypto.h.

◆ CBC_SUPPORT

#define CBC_SUPPORT   ENABLED

Definition at line 412 of file crypto.h.

◆ CCM_SUPPORT

#define CCM_SUPPORT   ENABLED

Definition at line 447 of file crypto.h.

◆ CFB_SUPPORT

#define CFB_SUPPORT   ENABLED

Definition at line 419 of file crypto.h.

◆ CHACHA20_POLY1305_SUPPORT

#define CHACHA20_POLY1305_SUPPORT   DISABLED

Definition at line 475 of file crypto.h.

◆ CHACHA_SUPPORT

#define CHACHA_SUPPORT   DISABLED

Definition at line 461 of file crypto.h.

◆ CMAC_SUPPORT

#define CMAC_SUPPORT   DISABLED

Definition at line 307 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 944 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 980 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 908 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 920 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 956 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 884 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 936 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 972 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 900 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 940 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 976 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 904 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 928 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 964 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 892 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 932 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 968 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 896 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 924 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 960 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 888 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 916 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 952 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 880 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 912 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 948 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 876 of file crypto.h.

◆ cryptoAllocMem

#define cryptoAllocMem (   size)    osAllocMem(size)

Definition at line 573 of file crypto.h.

◆ cryptoFreeMem

#define cryptoFreeMem (   p)    osFreeMem(p)

Definition at line 578 of file crypto.h.

◆ cryptoIsdigit

#define cryptoIsdigit (   c)    isdigit((uint8_t) (c))

Definition at line 632 of file crypto.h.

◆ cryptoMemcmp

#define cryptoMemcmp (   p1,
  p2,
  length 
)    memcmp(p1, p2, length)

Definition at line 602 of file crypto.h.

◆ cryptoMemcpy

#define cryptoMemcpy (   dest,
  src,
  length 
)    (void) memcpy(dest, src, length)

Definition at line 590 of file crypto.h.

◆ cryptoMemmove

#define cryptoMemmove (   dest,
  src,
  length 
)    (void) memmove(dest, src, length)

Definition at line 596 of file crypto.h.

◆ cryptoMemset

#define cryptoMemset (   p,
  value,
  length 
)    (void) memset(p, value, length)

Definition at line 584 of file crypto.h.

◆ cryptoStrcpy

#define cryptoStrcpy (   s1,
  s2 
)    (void) strcpy(s1, s2)

Definition at line 614 of file crypto.h.

◆ cryptoStrlen

#define cryptoStrlen (   s)    strlen(s)

Definition at line 608 of file crypto.h.

◆ cryptoStrncpy

#define cryptoStrncpy (   s1,
  s2,
  length 
)    (void) strncpy(s1, s2, length)

Definition at line 620 of file crypto.h.

◆ cryptoTolower

#define cryptoTolower (   c)    tolower((uint8_t) (c))

Definition at line 626 of file crypto.h.

◆ CTR_SUPPORT

#define CTR_SUPPORT   ENABLED

Definition at line 433 of file crypto.h.

◆ DES3_SUPPORT

#define DES3_SUPPORT   ENABLED

Definition at line 363 of file crypto.h.

◆ DES_SUPPORT

#define DES_SUPPORT   ENABLED

Definition at line 356 of file crypto.h.

◆ DH_SUPPORT

#define DH_SUPPORT   ENABLED

Definition at line 482 of file crypto.h.

◆ DSA_SUPPORT

#define DSA_SUPPORT   ENABLED

Definition at line 496 of file crypto.h.

◆ EC_SUPPORT

#define EC_SUPPORT   ENABLED

Definition at line 503 of file crypto.h.

◆ ECB_SUPPORT

#define ECB_SUPPORT   ENABLED

Definition at line 405 of file crypto.h.

◆ ECDH_SUPPORT

#define ECDH_SUPPORT   ENABLED

Definition at line 510 of file crypto.h.

◆ ECDSA_SUPPORT

#define ECDSA_SUPPORT   ENABLED

Definition at line 517 of file crypto.h.

◆ GCM_SUPPORT

#define GCM_SUPPORT   ENABLED

Definition at line 454 of file crypto.h.

◆ GMAC_SUPPORT

#define GMAC_SUPPORT   DISABLED

Definition at line 321 of file crypto.h.

◆ HKDF_SUPPORT

#define HKDF_SUPPORT   DISABLED

Definition at line 524 of file crypto.h.

◆ HMAC_SUPPORT

#define HMAC_SUPPORT   ENABLED

Definition at line 314 of file crypto.h.

◆ IDEA_SUPPORT

#define IDEA_SUPPORT   ENABLED

Definition at line 349 of file crypto.h.

◆ KECCAK_SUPPORT

#define KECCAK_SUPPORT   DISABLED

Definition at line 216 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(AriaContext)

Definition at line 802 of file crypto.h.

◆ MAX_HASH_BLOCK_SIZE

#define MAX_HASH_BLOCK_SIZE   SHA3_224_BLOCK_SIZE

Definition at line 692 of file crypto.h.

◆ MAX_HASH_CONTEXT_SIZE

#define MAX_HASH_CONTEXT_SIZE   sizeof(Sha3_512Context)

Definition at line 637 of file crypto.h.

◆ MAX_HASH_DIGEST_SIZE

#define MAX_HASH_DIGEST_SIZE   WHIRLPOOL_DIGEST_SIZE

Definition at line 747 of file crypto.h.

◆ MD2_SUPPORT

#define MD2_SUPPORT   ENABLED

Definition at line 90 of file crypto.h.

◆ MD4_SUPPORT

#define MD4_SUPPORT   ENABLED

Definition at line 97 of file crypto.h.

◆ MD5_SUPPORT

#define MD5_SUPPORT   ENABLED

Definition at line 104 of file crypto.h.

◆ MPI_ASM_SUPPORT

#define MPI_ASM_SUPPORT   DISABLED

Definition at line 76 of file crypto.h.

◆ MPI_SUPPORT

#define MPI_SUPPORT   ENABLED

Definition at line 69 of file crypto.h.

◆ OFB_SUPPORT

#define OFB_SUPPORT   ENABLED

Definition at line 426 of file crypto.h.

◆ OID_SUPPORT

#define OID_SUPPORT   ENABLED

Definition at line 545 of file crypto.h.

◆ PEM_SUPPORT

#define PEM_SUPPORT   ENABLED

Definition at line 559 of file crypto.h.

◆ PKCS5_SUPPORT

#define PKCS5_SUPPORT   ENABLED

Definition at line 531 of file crypto.h.

◆ POLY1305_SUPPORT

#define POLY1305_SUPPORT   DISABLED

Definition at line 468 of file crypto.h.

◆ PRESENT_SUPPORT

#define PRESENT_SUPPORT   DISABLED

Definition at line 398 of file crypto.h.

◆ RC2_SUPPORT

#define RC2_SUPPORT   DISABLED

Definition at line 328 of file crypto.h.

◆ RC4_SUPPORT

#define RC4_SUPPORT   ENABLED

Definition at line 335 of file crypto.h.

◆ RC6_SUPPORT

#define RC6_SUPPORT   ENABLED

Definition at line 342 of file crypto.h.

◆ RIPEMD128_SUPPORT

#define RIPEMD128_SUPPORT   ENABLED

Definition at line 111 of file crypto.h.

◆ RIPEMD160_SUPPORT

#define RIPEMD160_SUPPORT   ENABLED

Definition at line 118 of file crypto.h.

◆ ROL16

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

Definition at line 848 of file crypto.h.

◆ ROL32

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

Definition at line 849 of file crypto.h.

◆ ROL64

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

Definition at line 850 of file crypto.h.

◆ ROL8

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

Definition at line 847 of file crypto.h.

◆ ROR16

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

Definition at line 854 of file crypto.h.

◆ ROR32

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

Definition at line 855 of file crypto.h.

◆ ROR64

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

Definition at line 856 of file crypto.h.

◆ ROR8

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

Definition at line 853 of file crypto.h.

◆ RSA_SUPPORT

#define RSA_SUPPORT   ENABLED

Definition at line 489 of file crypto.h.

◆ SEED_SUPPORT

#define SEED_SUPPORT   ENABLED

Definition at line 384 of file crypto.h.

◆ SHA1_SUPPORT

#define SHA1_SUPPORT   ENABLED

Definition at line 125 of file crypto.h.

◆ SHA224_SUPPORT

#define SHA224_SUPPORT   ENABLED

Definition at line 132 of file crypto.h.

◆ SHA256_SUPPORT

#define SHA256_SUPPORT   ENABLED

Definition at line 139 of file crypto.h.

◆ SHA384_SUPPORT

#define SHA384_SUPPORT   ENABLED

Definition at line 146 of file crypto.h.

◆ SHA3_224_SUPPORT

#define SHA3_224_SUPPORT   DISABLED

Definition at line 174 of file crypto.h.

◆ SHA3_256_SUPPORT

#define SHA3_256_SUPPORT   DISABLED

Definition at line 181 of file crypto.h.

◆ SHA3_384_SUPPORT

#define SHA3_384_SUPPORT   DISABLED

Definition at line 188 of file crypto.h.

◆ SHA3_512_SUPPORT

#define SHA3_512_SUPPORT   DISABLED

Definition at line 195 of file crypto.h.

◆ SHA512_224_SUPPORT

#define SHA512_224_SUPPORT   ENABLED

Definition at line 160 of file crypto.h.

◆ SHA512_256_SUPPORT

#define SHA512_256_SUPPORT   ENABLED

Definition at line 167 of file crypto.h.

◆ SHA512_SUPPORT

#define SHA512_SUPPORT   ENABLED

Definition at line 153 of file crypto.h.

◆ SHAKE128_SUPPORT

#define SHAKE128_SUPPORT   DISABLED

Definition at line 202 of file crypto.h.

◆ SHAKE256_SUPPORT

#define SHAKE256_SUPPORT   DISABLED

Definition at line 209 of file crypto.h.

◆ SHL16

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

Definition at line 860 of file crypto.h.

◆ SHL32

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

Definition at line 861 of file crypto.h.

◆ SHL64

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

Definition at line 862 of file crypto.h.

◆ SHL8

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

Definition at line 859 of file crypto.h.

◆ SHR16

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

Definition at line 866 of file crypto.h.

◆ SHR32

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

Definition at line 867 of file crypto.h.

◆ SHR64

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

Definition at line 868 of file crypto.h.

◆ SHR8

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

Definition at line 865 of file crypto.h.

◆ TIGER_SUPPORT

#define TIGER_SUPPORT   ENABLED

Definition at line 293 of file crypto.h.

◆ WHIRLPOOL_SUPPORT

#define WHIRLPOOL_SUPPORT   ENABLED

Definition at line 300 of file crypto.h.

◆ X509_SUPPORT

#define X509_SUPPORT   ENABLED

Definition at line 566 of file crypto.h.

◆ XTS_SUPPORT

#define XTS_SUPPORT   ENABLED

Definition at line 440 of file crypto.h.

◆ YARROW_SUPPORT

#define YARROW_SUPPORT   ENABLED

Definition at line 538 of file crypto.h.

Typedef Documentation

◆ CipherAlgoDecryptBlock

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

Definition at line 1030 of file crypto.h.

◆ CipherAlgoDecryptStream

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

Definition at line 1028 of file crypto.h.

◆ CipherAlgoEncryptBlock

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

Definition at line 1029 of file crypto.h.

◆ CipherAlgoEncryptStream

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

Definition at line 1027 of file crypto.h.

◆ CipherAlgoInit

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

Definition at line 1026 of file crypto.h.

◆ HashAlgoCompute

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

Definition at line 1020 of file crypto.h.

◆ HashAlgoFinal

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

Definition at line 1023 of file crypto.h.

◆ HashAlgoInit

typedef void(* HashAlgoInit) (void *context)

Definition at line 1021 of file crypto.h.

◆ HashAlgoUpdate

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

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

◆ PrngAlgoInit

typedef error_t(* PrngAlgoInit) (void *context)

Definition at line 1033 of file crypto.h.

◆ PrngAlgoRead

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

Definition at line 1037 of file crypto.h.

◆ PrngAlgoRelease

typedef void(* PrngAlgoRelease) (void *context)

Definition at line 1034 of file crypto.h.

◆ PrngAlgoSeed

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

Definition at line 1035 of file crypto.h.

Enumeration Type Documentation

◆ CipherAlgoType

Encryption algorithm type.

Enumerator
CIPHER_ALGO_TYPE_STREAM 
CIPHER_ALGO_TYPE_BLOCK 

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