|
| #define | CYCLONE_CRYPTO_VERSION_STRING "2.5.4" |
| |
| #define | CYCLONE_CRYPTO_MAJOR_VERSION 2 |
| |
| #define | CYCLONE_CRYPTO_MINOR_VERSION 5 |
| |
| #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 | ASCON_HASH256_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 | KECCAK_SUPPORT DISABLED |
| |
| #define | SHAKE_SUPPORT DISABLED |
| |
| #define | CSHAKE_SUPPORT DISABLED |
| |
| #define | ASCON_XOF128_SUPPORT DISABLED |
| |
| #define | ASCON_CXOF128_SUPPORT DISABLED |
| |
| #define | CMAC_SUPPORT DISABLED |
| |
| #define | HMAC_SUPPORT ENABLED |
| |
| #define | GMAC_SUPPORT DISABLED |
| |
| #define | KMAC_SUPPORT DISABLED |
| |
| #define | XCBC_MAC_SUPPORT DISABLED |
| |
| #define | POLY1305_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 | CHACHA_SUPPORT DISABLED |
| |
| #define | SALSA20_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 | ASCON_AEAD128_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 | KEM_SUPPORT DISABLED |
| |
| #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 | HASH_DRBG_SUPPORT DISABLED |
| |
| #define | HMAC_DRBG_SUPPORT DISABLED |
| |
| #define | CTR_DRBG_SUPPORT DISABLED |
| |
| #define | XDRBG_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 | PKCS7_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 |
| |
|
| 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(* | XofAlgoCompute) (const void *input, size_t inputLen, uint8_t *output, size_t outputLen) |
| |
| typedef void(* | XofAlgoInit) (void *context) |
| |
| typedef void(* | XofAlgoAbsorb) (void *context, const void *input, size_t length) |
| |
| typedef void(* | XofAlgoFinal) (void *context) |
| |
| typedef void(* | XofAlgoSqueeze) (void *context, uint8_t *output, size_t length) |
| |
| 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 *seed, size_t length) |
| |
| typedef error_t(* | PrngAlgoReseed) (void *context, const uint8_t *seed, size_t length) |
| |
| typedef error_t(* | PrngAlgoGenerate) (void *context, uint8_t *output, size_t length) |
| |
| typedef void(* | PrngAlgoDeinit) (void *context) |
| |
General definitions for cryptographic algorithms.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2025 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.5.4
Definition in file crypto.h.