Import code from previous AssetBuilder version

This commit is contained in:
Jan
2019-09-24 10:45:09 +02:00
parent 5609557516
commit 0d8432d4f7
919 changed files with 154412 additions and 26 deletions

View File

@ -0,0 +1,496 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt.c
Build strings, Tom St Denis
*/
#define NAME_VALUE(s) #s"="NAME(s)
#define NAME(s) #s
const char *crypt_build_settings =
"LibTomCrypt " SCRYPT " (www.libtom.net)\n"
"LibTomCrypt is public domain software.\n"
#if defined(INCLUDE_BUILD_DATE)
"Built on " __DATE__ " at " __TIME__ "\n"
#endif
"\n\nEndianness: "
#if defined(ENDIAN_NEUTRAL)
"neutral/"
#endif
#if defined(ENDIAN_LITTLE)
"little"
#elif defined(ENDIAN_BIG)
"big"
#endif
#if defined(ENDIAN_32BITWORD)
" (32-bit words)\n"
#elif defined(ENDIAN_64BITWORD)
" (64-bit words)\n"
#else
" (no wordsize defined)\n"
#endif
"Clean stack: "
#if defined(LTC_CLEAN_STACK)
"enabled\n"
#else
"disabled\n"
#endif
"\nCiphers built-in:\n"
#if defined(LTC_BLOWFISH)
" Blowfish\n"
#endif
#if defined(LTC_RC2)
" RC2\n"
#endif
#if defined(LTC_RC5)
" RC5\n"
#endif
#if defined(LTC_RC6)
" RC6\n"
#endif
#if defined(LTC_SAFERP)
" Safer+\n"
#endif
#if defined(LTC_SAFER)
" Safer\n"
#endif
#if defined(LTC_RIJNDAEL)
" Rijndael\n"
#endif
#if defined(LTC_XTEA)
" XTEA\n"
#endif
#if defined(LTC_TWOFISH)
" Twofish "
#if defined(LTC_TWOFISH_SMALL) && defined(LTC_TWOFISH_TABLES) && defined(LTC_TWOFISH_ALL_TABLES)
"(small, tables, all_tables)\n"
#elif defined(LTC_TWOFISH_SMALL) && defined(LTC_TWOFISH_TABLES)
"(small, tables)\n"
#elif defined(LTC_TWOFISH_SMALL) && defined(LTC_TWOFISH_ALL_TABLES)
"(small, all_tables)\n"
#elif defined(LTC_TWOFISH_TABLES) && defined(LTC_TWOFISH_ALL_TABLES)
"(tables, all_tables)\n"
#elif defined(LTC_TWOFISH_SMALL)
"(small)\n"
#elif defined(LTC_TWOFISH_TABLES)
"(tables)\n"
#elif defined(LTC_TWOFISH_ALL_TABLES)
"(all_tables)\n"
#else
"\n"
#endif
#endif
#if defined(LTC_DES)
" DES\n"
#endif
#if defined(LTC_CAST5)
" CAST5\n"
#endif
#if defined(LTC_NOEKEON)
" Noekeon\n"
#endif
#if defined(LTC_SKIPJACK)
" Skipjack\n"
#endif
#if defined(LTC_KHAZAD)
" Khazad\n"
#endif
#if defined(LTC_ANUBIS)
" Anubis "
#endif
#if defined(LTC_ANUBIS_TWEAK)
" (tweaked)"
#endif
"\n"
#if defined(LTC_KSEED)
" KSEED\n"
#endif
#if defined(LTC_KASUMI)
" KASUMI\n"
#endif
#if defined(LTC_MULTI2)
" MULTI2\n"
#endif
#if defined(LTC_CAMELLIA)
" Camellia\n"
#endif
"Stream ciphers built-in:\n"
#if defined(LTC_CHACHA)
" ChaCha\n"
#endif
#if defined(LTC_RC4_STREAM)
" RC4\n"
#endif
#if defined(LTC_SOBER128_STREAM)
" SOBER128\n"
#endif
"\nHashes built-in:\n"
#if defined(LTC_SHA3)
" SHA3\n"
#endif
#if defined(LTC_SHA512)
" SHA-512\n"
#endif
#if defined(LTC_SHA384)
" SHA-384\n"
#endif
#if defined(LTC_SHA512_256)
" SHA-512/256\n"
#endif
#if defined(LTC_SHA256)
" SHA-256\n"
#endif
#if defined(LTC_SHA512_224)
" SHA-512/224\n"
#endif
#if defined(LTC_SHA224)
" SHA-224\n"
#endif
#if defined(LTC_TIGER)
" TIGER\n"
#endif
#if defined(LTC_SHA1)
" SHA1\n"
#endif
#if defined(LTC_MD5)
" MD5\n"
#endif
#if defined(LTC_MD4)
" MD4\n"
#endif
#if defined(LTC_MD2)
" MD2\n"
#endif
#if defined(LTC_RIPEMD128)
" RIPEMD128\n"
#endif
#if defined(LTC_RIPEMD160)
" RIPEMD160\n"
#endif
#if defined(LTC_RIPEMD256)
" RIPEMD256\n"
#endif
#if defined(LTC_RIPEMD320)
" RIPEMD320\n"
#endif
#if defined(LTC_WHIRLPOOL)
" WHIRLPOOL\n"
#endif
#if defined(LTC_BLAKE2S)
" BLAKE2S\n"
#endif
#if defined(LTC_BLAKE2B)
" BLAKE2B\n"
#endif
#if defined(LTC_CHC_HASH)
" CHC_HASH\n"
#endif
"\nBlock Chaining Modes:\n"
#if defined(LTC_CFB_MODE)
" CFB\n"
#endif
#if defined(LTC_OFB_MODE)
" OFB\n"
#endif
#if defined(LTC_ECB_MODE)
" ECB\n"
#endif
#if defined(LTC_CBC_MODE)
" CBC\n"
#endif
#if defined(LTC_CTR_MODE)
" CTR\n"
#endif
#if defined(LTC_LRW_MODE)
" LRW"
#if defined(LTC_LRW_TABLES)
" (tables) "
#endif
"\n"
#endif
#if defined(LTC_F8_MODE)
" F8\n"
#endif
#if defined(LTC_XTS_MODE)
" XTS\n"
#endif
"\nMACs:\n"
#if defined(LTC_HMAC)
" HMAC\n"
#endif
#if defined(LTC_OMAC)
" OMAC\n"
#endif
#if defined(LTC_PMAC)
" PMAC\n"
#endif
#if defined(LTC_PELICAN)
" PELICAN\n"
#endif
#if defined(LTC_XCBC)
" XCBC\n"
#endif
#if defined(LTC_F9_MODE)
" F9\n"
#endif
#if defined(LTC_POLY1305)
" POLY1305\n"
#endif
#if defined(LTC_BLAKE2SMAC)
" BLAKE2S MAC\n"
#endif
#if defined(LTC_BLAKE2BMAC)
" BLAKE2B MAC\n"
#endif
"\nENC + AUTH modes:\n"
#if defined(LTC_EAX_MODE)
" EAX\n"
#endif
#if defined(LTC_OCB_MODE)
" OCB\n"
#endif
#if defined(LTC_OCB3_MODE)
" OCB3\n"
#endif
#if defined(LTC_CCM_MODE)
" CCM\n"
#endif
#if defined(LTC_GCM_MODE)
" GCM"
#if defined(LTC_GCM_TABLES)
" (tables) "
#endif
#if defined(LTC_GCM_TABLES_SSE2)
" (SSE2) "
#endif
"\n"
#endif
#if defined(LTC_CHACHA20POLY1305_MODE)
" CHACHA20POLY1305\n"
#endif
"\nPRNG:\n"
#if defined(LTC_YARROW)
" Yarrow ("NAME_VALUE(LTC_YARROW_AES)")\n"
#endif
#if defined(LTC_SPRNG)
" SPRNG\n"
#endif
#if defined(LTC_RC4)
" RC4\n"
#endif
#if defined(LTC_CHACHA20_PRNG)
" ChaCha20\n"
#endif
#if defined(LTC_FORTUNA)
" Fortuna (" NAME_VALUE(LTC_FORTUNA_POOLS) ", " NAME_VALUE(LTC_FORTUNA_WD) ")\n"
#endif
#if defined(LTC_SOBER128)
" SOBER128\n"
#endif
"\nPK Crypto:\n"
#if defined(LTC_MRSA)
" RSA"
#if defined(LTC_RSA_BLINDING) && defined(LTC_RSA_CRT_HARDENING)
" (with blinding and CRT hardening)"
#elif defined(LTC_RSA_BLINDING)
" (with blinding)"
#elif defined(LTC_RSA_CRT_HARDENING)
" (with CRT hardening)"
#endif
"\n"
#endif
#if defined(LTC_MDH)
" DH\n"
#endif
#if defined(LTC_MECC)
" ECC"
#if defined(LTC_ECC_TIMING_RESISTANT)
" (with blinding)"
#endif
"\n"
#endif
#if defined(LTC_MDSA)
" DSA\n"
#endif
#if defined(LTC_MKAT)
" Katja\n"
#endif
#if defined(LTC_PK_MAX_RETRIES)
" "NAME_VALUE(LTC_PK_MAX_RETRIES)"\n"
#endif
"\nMPI (Math):\n"
#if defined(LTC_MPI)
" LTC_MPI\n"
#endif
#if defined(LTM_DESC)
" LTM_DESC\n"
#endif
#if defined(TFM_DESC)
" TFM_DESC\n"
#endif
#if defined(GMP_DESC)
" GMP_DESC\n"
#endif
#if defined(LTC_MILLER_RABIN_REPS)
" "NAME_VALUE(LTC_MILLER_RABIN_REPS)"\n"
#endif
"\nCompiler:\n"
#if defined(_WIN64)
" WIN64 platform detected.\n"
#elif defined(_WIN32)
" WIN32 platform detected.\n"
#endif
#if defined(__CYGWIN__)
" CYGWIN Detected.\n"
#endif
#if defined(__DJGPP__)
" DJGPP Detected.\n"
#endif
#if defined(_MSC_VER)
" MSVC compiler detected.\n"
#endif
#if defined(__clang_version__)
" Clang compiler " __clang_version__ ".\n"
#elif defined(INTEL_CC)
" Intel C Compiler " __VERSION__ ".\n"
#elif defined(__GNUC__) /* clang and icc also define __GNUC__ */
" GCC compiler " __VERSION__ ".\n"
#endif
#if defined(__x86_64__)
" x86-64 detected.\n"
#endif
#if defined(LTC_PPC32)
" PPC32 detected.\n"
#endif
"\nVarious others: "
#if defined(ARGTYPE)
" " NAME_VALUE(ARGTYPE) " "
#endif
#if defined(LTC_ADLER32)
" ADLER32 "
#endif
#if defined(LTC_BASE64)
" BASE64 "
#endif
#if defined(LTC_BASE64_URL)
" BASE64-URL-SAFE "
#endif
#if defined(LTC_CRC32)
" CRC32 "
#endif
#if defined(LTC_DER)
" DER "
" " NAME_VALUE(LTC_DER_MAX_RECURSION) " "
#endif
#if defined(LTC_PKCS_1)
" PKCS#1 "
#endif
#if defined(LTC_PKCS_5)
" PKCS#5 "
#endif
#if defined(LTC_HKDF)
" HKDF "
#endif
#if defined(LTC_DEVRANDOM)
" LTC_DEVRANDOM "
#endif
#if defined(LTC_TRY_URANDOM_FIRST)
" LTC_TRY_URANDOM_FIRST "
#endif
#if defined(LTC_RNG_GET_BYTES)
" LTC_RNG_GET_BYTES "
#endif
#if defined(LTC_RNG_MAKE_PRNG)
" LTC_RNG_MAKE_PRNG "
#endif
#if defined(LTC_PRNG_ENABLE_LTC_RNG)
" LTC_PRNG_ENABLE_LTC_RNG "
#endif
#if defined(LTC_HASH_HELPERS)
" LTC_HASH_HELPERS "
#endif
#if defined(LTC_VALGRIND)
" LTC_VALGRIND "
#endif
#if defined(LTC_TEST)
" LTC_TEST "
#endif
#if defined(LTC_TEST_DBG)
" " NAME_VALUE(LTC_TEST_DBG) " "
#endif
#if defined(LTC_TEST_EXT)
" LTC_TEST_EXT "
#endif
#if defined(LTC_SMALL_CODE)
" LTC_SMALL_CODE "
#endif
#if defined(LTC_NO_FILE)
" LTC_NO_FILE "
#endif
#if defined(LTC_FILE_READ_BUFSIZE)
" " NAME_VALUE(LTC_FILE_READ_BUFSIZE) " "
#endif
#if defined(LTC_FAST)
" LTC_FAST "
#endif
#if defined(LTC_NO_FAST)
" LTC_NO_FAST "
#endif
#if defined(LTC_NO_BSWAP)
" LTC_NO_BSWAP "
#endif
#if defined(LTC_NO_ASM)
" LTC_NO_ASM "
#endif
#if defined(LTC_ROx_ASM)
" LTC_ROx_ASM "
#if defined(LTC_NO_ROLC)
" LTC_NO_ROLC "
#endif
#endif
#if defined(LTC_NO_TEST)
" LTC_NO_TEST "
#endif
#if defined(LTC_NO_TABLES)
" LTC_NO_TABLES "
#endif
#if defined(LTC_PTHREAD)
" LTC_PTHREAD "
#endif
#if defined(LTC_EASY)
" LTC_EASY "
#endif
#if defined(LTC_MECC_ACCEL)
" LTC_MECC_ACCEL "
#endif
#if defined(LTC_MECC_FP)
" LTC_MECC_FP "
#endif
#if defined(LTC_ECC_SHAMIR)
" LTC_ECC_SHAMIR "
#endif
"\n"
;
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,27 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_argchk.c
Perform argument checking, Tom St Denis
*/
#if (ARGTYPE == 0)
void crypt_argchk(const char *v, const char *s, int d)
{
fprintf(stderr, "LTC_ARGCHK '%s' failure on line %d of file %s\n",
v, d, s);
abort();
}
#endif
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,25 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_cipher_descriptor.c
Stores the cipher descriptor table, Tom St Denis
*/
struct ltc_cipher_descriptor cipher_descriptor[TAB_SIZE] = {
{ NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
};
LTC_MUTEX_GLOBAL(ltc_cipher_mutex)
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,34 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_cipher_is_valid.c
Determine if cipher is valid, Tom St Denis
*/
/*
Test if a cipher index is valid
@param idx The index of the cipher to search for
@return CRYPT_OK if valid
*/
int cipher_is_valid(int idx)
{
LTC_MUTEX_LOCK(&ltc_cipher_mutex);
if (idx < 0 || idx >= TAB_SIZE || cipher_descriptor[idx].name == NULL) {
LTC_MUTEX_UNLOCK(&ltc_cipher_mutex);
return CRYPT_INVALID_CIPHER;
}
LTC_MUTEX_UNLOCK(&ltc_cipher_mutex);
return CRYPT_OK;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,292 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_constants.c
Make various constants available to dynamic languages
like Python - Larry Bugbee, February 2013
LB - Dec 2013 - revised to include compiler define options
LB - Mar 2014 - added endianness and word size
*/
typedef struct {
const char *name;
const int value;
} crypt_constant;
#define _C_STRINGIFY(s) { #s, s }
static const crypt_constant _crypt_constants[] = {
_C_STRINGIFY(CRYPT_OK),
_C_STRINGIFY(CRYPT_ERROR),
_C_STRINGIFY(CRYPT_NOP),
_C_STRINGIFY(CRYPT_INVALID_KEYSIZE),
_C_STRINGIFY(CRYPT_INVALID_ROUNDS),
_C_STRINGIFY(CRYPT_FAIL_TESTVECTOR),
_C_STRINGIFY(CRYPT_BUFFER_OVERFLOW),
_C_STRINGIFY(CRYPT_INVALID_PACKET),
_C_STRINGIFY(CRYPT_INVALID_PRNGSIZE),
_C_STRINGIFY(CRYPT_ERROR_READPRNG),
_C_STRINGIFY(CRYPT_INVALID_CIPHER),
_C_STRINGIFY(CRYPT_INVALID_HASH),
_C_STRINGIFY(CRYPT_INVALID_PRNG),
_C_STRINGIFY(CRYPT_MEM),
_C_STRINGIFY(CRYPT_PK_TYPE_MISMATCH),
_C_STRINGIFY(CRYPT_PK_NOT_PRIVATE),
_C_STRINGIFY(CRYPT_INVALID_ARG),
_C_STRINGIFY(CRYPT_FILE_NOTFOUND),
_C_STRINGIFY(CRYPT_PK_INVALID_TYPE),
_C_STRINGIFY(CRYPT_OVERFLOW),
_C_STRINGIFY(CRYPT_UNUSED1),
_C_STRINGIFY(CRYPT_INPUT_TOO_LONG),
_C_STRINGIFY(CRYPT_PK_INVALID_SIZE),
_C_STRINGIFY(CRYPT_INVALID_PRIME_SIZE),
_C_STRINGIFY(CRYPT_PK_INVALID_PADDING),
_C_STRINGIFY(CRYPT_HASH_OVERFLOW),
_C_STRINGIFY(PK_PUBLIC),
_C_STRINGIFY(PK_PRIVATE),
_C_STRINGIFY(LTC_ENCRYPT),
_C_STRINGIFY(LTC_DECRYPT),
#ifdef LTC_PKCS_1
{"LTC_PKCS_1", 1},
/* Block types */
_C_STRINGIFY(LTC_PKCS_1_EMSA),
_C_STRINGIFY(LTC_PKCS_1_EME),
/* Padding types */
_C_STRINGIFY(LTC_PKCS_1_V1_5),
_C_STRINGIFY(LTC_PKCS_1_OAEP),
_C_STRINGIFY(LTC_PKCS_1_PSS),
_C_STRINGIFY(LTC_PKCS_1_V1_5_NA1),
#else
{"LTC_PKCS_1", 0},
#endif
#ifdef LTC_MRSA
{"LTC_MRSA", 1},
#else
{"LTC_MRSA", 0},
#endif
#ifdef LTC_MKAT
{"LTC_MKAT", 1},
_C_STRINGIFY(MIN_KAT_SIZE),
_C_STRINGIFY(MAX_KAT_SIZE),
#else
{"LTC_MKAT", 0},
#endif
#ifdef LTC_MECC
{"LTC_MECC", 1},
_C_STRINGIFY(ECC_BUF_SIZE),
_C_STRINGIFY(ECC_MAXSIZE),
#else
{"LTC_MECC", 0},
#endif
#ifdef LTC_MDSA
{"LTC_MDSA", 1},
_C_STRINGIFY(LTC_MDSA_DELTA),
_C_STRINGIFY(LTC_MDSA_MAX_GROUP),
#else
{"LTC_MDSA", 0},
#endif
#ifdef LTC_MILLER_RABIN_REPS
_C_STRINGIFY(LTC_MILLER_RABIN_REPS),
#endif
#ifdef LTC_DER
/* DER handling */
{"LTC_DER", 1},
_C_STRINGIFY(LTC_ASN1_EOL),
_C_STRINGIFY(LTC_ASN1_BOOLEAN),
_C_STRINGIFY(LTC_ASN1_INTEGER),
_C_STRINGIFY(LTC_ASN1_SHORT_INTEGER),
_C_STRINGIFY(LTC_ASN1_BIT_STRING),
_C_STRINGIFY(LTC_ASN1_OCTET_STRING),
_C_STRINGIFY(LTC_ASN1_NULL),
_C_STRINGIFY(LTC_ASN1_OBJECT_IDENTIFIER),
_C_STRINGIFY(LTC_ASN1_IA5_STRING),
_C_STRINGIFY(LTC_ASN1_PRINTABLE_STRING),
_C_STRINGIFY(LTC_ASN1_UTF8_STRING),
_C_STRINGIFY(LTC_ASN1_UTCTIME),
_C_STRINGIFY(LTC_ASN1_CHOICE),
_C_STRINGIFY(LTC_ASN1_SEQUENCE),
_C_STRINGIFY(LTC_ASN1_SET),
_C_STRINGIFY(LTC_ASN1_SETOF),
_C_STRINGIFY(LTC_ASN1_RAW_BIT_STRING),
_C_STRINGIFY(LTC_ASN1_TELETEX_STRING),
_C_STRINGIFY(LTC_ASN1_CONSTRUCTED),
_C_STRINGIFY(LTC_ASN1_CONTEXT_SPECIFIC),
_C_STRINGIFY(LTC_ASN1_GENERALIZEDTIME),
_C_STRINGIFY(LTC_DER_MAX_RECURSION),
#else
{"LTC_DER", 0},
#endif
#ifdef LTC_CTR_MODE
{"LTC_CTR_MODE", 1},
_C_STRINGIFY(CTR_COUNTER_LITTLE_ENDIAN),
_C_STRINGIFY(CTR_COUNTER_BIG_ENDIAN),
_C_STRINGIFY(LTC_CTR_RFC3686),
#else
{"LTC_CTR_MODE", 0},
#endif
#ifdef LTC_GCM_MODE
_C_STRINGIFY(LTC_GCM_MODE_IV),
_C_STRINGIFY(LTC_GCM_MODE_AAD),
_C_STRINGIFY(LTC_GCM_MODE_TEXT),
#endif
_C_STRINGIFY(LTC_MP_LT),
_C_STRINGIFY(LTC_MP_EQ),
_C_STRINGIFY(LTC_MP_GT),
_C_STRINGIFY(LTC_MP_NO),
_C_STRINGIFY(LTC_MP_YES),
_C_STRINGIFY(MAXBLOCKSIZE),
_C_STRINGIFY(TAB_SIZE),
_C_STRINGIFY(ARGTYPE),
#ifdef LTM_DESC
{"LTM_DESC", 1},
#else
{"LTM_DESC", 0},
#endif
#ifdef TFM_DESC
{"TFM_DESC", 1},
#else
{"TFM_DESC", 0},
#endif
#ifdef GMP_DESC
{"GMP_DESC", 1},
#else
{"GMP_DESC", 0},
#endif
#ifdef LTC_FAST
{"LTC_FAST", 1},
#else
{"LTC_FAST", 0},
#endif
#ifdef LTC_NO_FILE
{"LTC_NO_FILE", 1},
#else
{"LTC_NO_FILE", 0},
#endif
#ifdef ENDIAN_LITTLE
{"ENDIAN_LITTLE", 1},
#else
{"ENDIAN_LITTLE", 0},
#endif
#ifdef ENDIAN_BIG
{"ENDIAN_BIG", 1},
#else
{"ENDIAN_BIG", 0},
#endif
#ifdef ENDIAN_32BITWORD
{"ENDIAN_32BITWORD", 1},
#else
{"ENDIAN_32BITWORD", 0},
#endif
#ifdef ENDIAN_64BITWORD
{"ENDIAN_64BITWORD", 1},
#else
{"ENDIAN_64BITWORD", 0},
#endif
#ifdef ENDIAN_NEUTRAL
{"ENDIAN_NEUTRAL", 1},
#else
{"ENDIAN_NEUTRAL", 0},
#endif
};
/* crypt_get_constant()
* valueout will be the value of the named constant
* return -1 if named item not found
*/
int crypt_get_constant(const char* namein, int *valueout) {
int i;
int _crypt_constants_len = sizeof(_crypt_constants) / sizeof(_crypt_constants[0]);
for (i=0; i<_crypt_constants_len; i++) {
if (XSTRCMP(_crypt_constants[i].name, namein) == 0) {
*valueout = _crypt_constants[i].value;
return 0;
}
}
return 1;
}
/* crypt_list_all_constants()
* if names_list is NULL, names_list_size will be the minimum
* number of bytes needed to receive the complete names_list
* if names_list is NOT NULL, names_list must be the addr of
* sufficient memory allocated into which the names_list
* is to be written. Also, the value in names_list_size
* sets the upper bound of the number of characters to be
* written.
* a -1 return value signifies insufficient space made available
*/
int crypt_list_all_constants(char *names_list, unsigned int *names_list_size) {
int i;
unsigned int total_len = 0;
char *ptr;
int number_len;
int count = sizeof(_crypt_constants) / sizeof(_crypt_constants[0]);
/* calculate amount of memory required for the list */
for (i=0; i<count; i++) {
number_len = snprintf(NULL, 0, "%s,%d\n", _crypt_constants[i].name, _crypt_constants[i].value);
if (number_len < 0)
return -1;
total_len += number_len;
}
if (names_list == NULL) {
*names_list_size = total_len;
} else {
if (total_len > *names_list_size) {
return -1;
}
/* build the names list */
ptr = names_list;
for (i=0; i<count; i++) {
number_len = snprintf(ptr, total_len, "%s,%d\n", _crypt_constants[i].name, _crypt_constants[i].value);
if (number_len < 0) return -1;
if ((unsigned int)number_len > total_len) return -1;
total_len -= number_len;
ptr += number_len;
}
/* to remove the trailing new-line */
ptr -= 1;
*ptr = 0;
}
return 0;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,39 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_find_cipher.c
Find a cipher in the descriptor tables, Tom St Denis
*/
/**
Find a registered cipher by name
@param name The name of the cipher to look for
@return >= 0 if found, -1 if not present
*/
int find_cipher(const char *name)
{
int x;
LTC_ARGCHK(name != NULL);
LTC_MUTEX_LOCK(&ltc_cipher_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (cipher_descriptor[x].name != NULL && !XSTRCMP(cipher_descriptor[x].name, name)) {
LTC_MUTEX_UNLOCK(&ltc_cipher_mutex);
return x;
}
}
LTC_MUTEX_UNLOCK(&ltc_cipher_mutex);
return -1;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,48 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_find_cipher_any.c
Find a cipher in the descriptor tables, Tom St Denis
*/
/**
Find a cipher flexibly. First by name then if not present by block and key size
@param name The name of the cipher desired
@param blocklen The minimum length of the block cipher desired (octets)
@param keylen The minimum length of the key size desired (octets)
@return >= 0 if found, -1 if not present
*/
int find_cipher_any(const char *name, int blocklen, int keylen)
{
int x;
if(name != NULL) {
x = find_cipher(name);
if (x != -1) return x;
}
LTC_MUTEX_LOCK(&ltc_cipher_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (cipher_descriptor[x].name == NULL) {
continue;
}
if (blocklen <= (int)cipher_descriptor[x].block_length && keylen <= (int)cipher_descriptor[x].max_key_length) {
LTC_MUTEX_UNLOCK(&ltc_cipher_mutex);
return x;
}
}
LTC_MUTEX_UNLOCK(&ltc_cipher_mutex);
return -1;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,38 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_find_cipher_id.c
Find cipher by ID, Tom St Denis
*/
/**
Find a cipher by ID number
@param ID The ID (not same as index) of the cipher to find
@return >= 0 if found, -1 if not present
*/
int find_cipher_id(unsigned char ID)
{
int x;
LTC_MUTEX_LOCK(&ltc_cipher_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (cipher_descriptor[x].ID == ID) {
x = (cipher_descriptor[x].name == NULL) ? -1 : x;
LTC_MUTEX_UNLOCK(&ltc_cipher_mutex);
return x;
}
}
LTC_MUTEX_UNLOCK(&ltc_cipher_mutex);
return -1;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,38 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_find_hash.c
Find a hash, Tom St Denis
*/
/**
Find a registered hash by name
@param name The name of the hash to look for
@return >= 0 if found, -1 if not present
*/
int find_hash(const char *name)
{
int x;
LTC_ARGCHK(name != NULL);
LTC_MUTEX_LOCK(&ltc_hash_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (hash_descriptor[x].name != NULL && XSTRCMP(hash_descriptor[x].name, name) == 0) {
LTC_MUTEX_UNLOCK(&ltc_hash_mutex);
return x;
}
}
LTC_MUTEX_UNLOCK(&ltc_hash_mutex);
return -1;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,47 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_find_hash_any.c
Find a hash, Tom St Denis
*/
/**
Find a hash flexibly. First by name then if not present by digest size
@param name The name of the hash desired
@param digestlen The minimum length of the digest size (octets)
@return >= 0 if found, -1 if not present
*/int find_hash_any(const char *name, int digestlen)
{
int x, y, z;
LTC_ARGCHK(name != NULL);
x = find_hash(name);
if (x != -1) return x;
LTC_MUTEX_LOCK(&ltc_hash_mutex);
y = MAXBLOCKSIZE+1;
z = -1;
for (x = 0; x < TAB_SIZE; x++) {
if (hash_descriptor[x].name == NULL) {
continue;
}
if ((int)hash_descriptor[x].hashsize >= digestlen && (int)hash_descriptor[x].hashsize < y) {
z = x;
y = hash_descriptor[x].hashsize;
}
}
LTC_MUTEX_UNLOCK(&ltc_hash_mutex);
return z;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,38 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_find_hash_id.c
Find hash by ID, Tom St Denis
*/
/**
Find a hash by ID number
@param ID The ID (not same as index) of the hash to find
@return >= 0 if found, -1 if not present
*/
int find_hash_id(unsigned char ID)
{
int x;
LTC_MUTEX_LOCK(&ltc_hash_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (hash_descriptor[x].ID == ID) {
x = (hash_descriptor[x].name == NULL) ? -1 : x;
LTC_MUTEX_UNLOCK(&ltc_hash_mutex);
return x;
}
}
LTC_MUTEX_UNLOCK(&ltc_hash_mutex);
return -1;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,33 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_find_hash_oid.c
Find a hash, Tom St Denis
*/
int find_hash_oid(const unsigned long *ID, unsigned long IDlen)
{
int x;
LTC_ARGCHK(ID != NULL);
LTC_MUTEX_LOCK(&ltc_hash_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (hash_descriptor[x].name != NULL && hash_descriptor[x].OIDlen == IDlen && !XMEMCMP(hash_descriptor[x].OID, ID, sizeof(unsigned long) * IDlen)) {
LTC_MUTEX_UNLOCK(&ltc_hash_mutex);
return x;
}
}
LTC_MUTEX_UNLOCK(&ltc_hash_mutex);
return -1;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,39 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_find_prng.c
Find a PRNG, Tom St Denis
*/
/**
Find a registered PRNG by name
@param name The name of the PRNG to look for
@return >= 0 if found, -1 if not present
*/
int find_prng(const char *name)
{
int x;
LTC_ARGCHK(name != NULL);
LTC_MUTEX_LOCK(&ltc_prng_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if ((prng_descriptor[x].name != NULL) && XSTRCMP(prng_descriptor[x].name, name) == 0) {
LTC_MUTEX_UNLOCK(&ltc_prng_mutex);
return x;
}
}
LTC_MUTEX_UNLOCK(&ltc_prng_mutex);
return -1;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,56 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include <stdarg.h>
/**
@file crypt_fsa.c
LibTomCrypt FULL SPEED AHEAD!, Tom St Denis
*/
/* format is ltc_mp, cipher_desc, [cipher_desc], NULL, hash_desc, [hash_desc], NULL, prng_desc, [prng_desc], NULL */
int crypt_fsa(void *mp, ...)
{
va_list args;
void *p;
va_start(args, mp);
if (mp != NULL) {
XMEMCPY(&ltc_mp, mp, sizeof(ltc_mp));
}
while ((p = va_arg(args, void*)) != NULL) {
if (register_cipher(p) == -1) {
va_end(args);
return CRYPT_INVALID_CIPHER;
}
}
while ((p = va_arg(args, void*)) != NULL) {
if (register_hash(p) == -1) {
va_end(args);
return CRYPT_INVALID_HASH;
}
}
while ((p = va_arg(args, void*)) != NULL) {
if (register_prng(p) == -1) {
va_end(args);
return CRYPT_INVALID_PRNG;
}
}
va_end(args);
return CRYPT_OK;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,25 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_hash_descriptor.c
Stores the hash descriptor table, Tom St Denis
*/
struct ltc_hash_descriptor hash_descriptor[TAB_SIZE] = {
{ NULL, 0, 0, 0, { 0 }, 0, NULL, NULL, NULL, NULL, NULL }
};
LTC_MUTEX_GLOBAL(ltc_hash_mutex)
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,34 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_hash_is_valid.c
Determine if hash is valid, Tom St Denis
*/
/*
Test if a hash index is valid
@param idx The index of the hash to search for
@return CRYPT_OK if valid
*/
int hash_is_valid(int idx)
{
LTC_MUTEX_LOCK(&ltc_hash_mutex);
if (idx < 0 || idx >= TAB_SIZE || hash_descriptor[idx].name == NULL) {
LTC_MUTEX_UNLOCK(&ltc_hash_mutex);
return CRYPT_INVALID_HASH;
}
LTC_MUTEX_UNLOCK(&ltc_hash_mutex);
return CRYPT_OK;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,43 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_inits.c
Provide math library functions for dynamic languages
like Python - Larry Bugbee, February 2013
*/
#ifdef LTM_DESC
void init_LTM(void)
{
ltc_mp = ltm_desc;
}
#endif
#ifdef TFM_DESC
void init_TFM(void)
{
ltc_mp = tfm_desc;
}
#endif
#ifdef GMP_DESC
void init_GMP(void)
{
ltc_mp = gmp_desc;
}
#endif
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,16 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/* Initialize ltc_mp to nulls, to force allocation on all platforms, including macOS. */
ltc_math_descriptor ltc_mp = { 0 };
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,24 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_prng_descriptor.c
Stores the PRNG descriptors, Tom St Denis
*/
struct ltc_prng_descriptor prng_descriptor[TAB_SIZE] = {
{ NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
};
LTC_MUTEX_GLOBAL(ltc_prng_mutex)
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,34 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_prng_is_valid.c
Determine if PRNG is valid, Tom St Denis
*/
/*
Test if a PRNG index is valid
@param idx The index of the PRNG to search for
@return CRYPT_OK if valid
*/
int prng_is_valid(int idx)
{
LTC_MUTEX_LOCK(&ltc_prng_mutex);
if (idx < 0 || idx >= TAB_SIZE || prng_descriptor[idx].name == NULL) {
LTC_MUTEX_UNLOCK(&ltc_prng_mutex);
return CRYPT_INVALID_PRNG;
}
LTC_MUTEX_UNLOCK(&ltc_prng_mutex);
return CRYPT_OK;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,17 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#ifdef LTC_PRNG_ENABLE_LTC_RNG
unsigned long (*ltc_rng)(unsigned char *out, unsigned long outlen, void (*callback)(void));
#endif
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,100 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_register_all_ciphers.c
Steffen Jaeckel
*/
#define REGISTER_CIPHER(h) do {\
LTC_ARGCHK(register_cipher(h) != -1); \
} while(0)
int register_all_ciphers(void)
{
#ifdef LTC_RIJNDAEL
#ifdef ENCRYPT_ONLY
/* alternative would be
* register_cipher(&rijndael_enc_desc);
*/
REGISTER_CIPHER(&aes_enc_desc);
#else
/* alternative would be
* register_cipher(&rijndael_desc);
*/
REGISTER_CIPHER(&aes_desc);
#endif
#endif
#ifdef LTC_BLOWFISH
REGISTER_CIPHER(&blowfish_desc);
#endif
#ifdef LTC_XTEA
REGISTER_CIPHER(&xtea_desc);
#endif
#ifdef LTC_RC5
REGISTER_CIPHER(&rc5_desc);
#endif
#ifdef LTC_RC6
REGISTER_CIPHER(&rc6_desc);
#endif
#ifdef LTC_SAFERP
REGISTER_CIPHER(&saferp_desc);
#endif
#ifdef LTC_TWOFISH
REGISTER_CIPHER(&twofish_desc);
#endif
#ifdef LTC_SAFER
REGISTER_CIPHER(&safer_k64_desc);
REGISTER_CIPHER(&safer_sk64_desc);
REGISTER_CIPHER(&safer_k128_desc);
REGISTER_CIPHER(&safer_sk128_desc);
#endif
#ifdef LTC_RC2
REGISTER_CIPHER(&rc2_desc);
#endif
#ifdef LTC_DES
REGISTER_CIPHER(&des_desc);
REGISTER_CIPHER(&des3_desc);
#endif
#ifdef LTC_CAST5
REGISTER_CIPHER(&cast5_desc);
#endif
#ifdef LTC_NOEKEON
REGISTER_CIPHER(&noekeon_desc);
#endif
#ifdef LTC_SKIPJACK
REGISTER_CIPHER(&skipjack_desc);
#endif
#ifdef LTC_ANUBIS
REGISTER_CIPHER(&anubis_desc);
#endif
#ifdef LTC_KHAZAD
REGISTER_CIPHER(&khazad_desc);
#endif
#ifdef LTC_KSEED
REGISTER_CIPHER(&kseed_desc);
#endif
#ifdef LTC_KASUMI
REGISTER_CIPHER(&kasumi_desc);
#endif
#ifdef LTC_MULTI2
REGISTER_CIPHER(&multi2_desc);
#endif
#ifdef LTC_CAMELLIA
REGISTER_CIPHER(&camellia_desc);
#endif
return CRYPT_OK;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,99 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_register_all_hashes.c
Steffen Jaeckel
*/
#define REGISTER_HASH(h) do {\
LTC_ARGCHK(register_hash(h) != -1); \
} while(0)
int register_all_hashes(void)
{
#ifdef LTC_TIGER
REGISTER_HASH(&tiger_desc);
#endif
#ifdef LTC_MD2
REGISTER_HASH(&md2_desc);
#endif
#ifdef LTC_MD4
REGISTER_HASH(&md4_desc);
#endif
#ifdef LTC_MD5
REGISTER_HASH(&md5_desc);
#endif
#ifdef LTC_SHA1
REGISTER_HASH(&sha1_desc);
#endif
#ifdef LTC_SHA224
REGISTER_HASH(&sha224_desc);
#endif
#ifdef LTC_SHA256
REGISTER_HASH(&sha256_desc);
#endif
#ifdef LTC_SHA384
REGISTER_HASH(&sha384_desc);
#endif
#ifdef LTC_SHA512
REGISTER_HASH(&sha512_desc);
#endif
#ifdef LTC_SHA512_224
REGISTER_HASH(&sha512_224_desc);
#endif
#ifdef LTC_SHA512_256
REGISTER_HASH(&sha512_256_desc);
#endif
#ifdef LTC_SHA3
REGISTER_HASH(&sha3_224_desc);
REGISTER_HASH(&sha3_256_desc);
REGISTER_HASH(&sha3_384_desc);
REGISTER_HASH(&sha3_512_desc);
#endif
#ifdef LTC_RIPEMD128
REGISTER_HASH(&rmd128_desc);
#endif
#ifdef LTC_RIPEMD160
REGISTER_HASH(&rmd160_desc);
#endif
#ifdef LTC_RIPEMD256
REGISTER_HASH(&rmd256_desc);
#endif
#ifdef LTC_RIPEMD320
REGISTER_HASH(&rmd320_desc);
#endif
#ifdef LTC_WHIRLPOOL
REGISTER_HASH(&whirlpool_desc);
#endif
#ifdef LTC_BLAKE2S
REGISTER_HASH(&blake2s_128_desc);
REGISTER_HASH(&blake2s_160_desc);
REGISTER_HASH(&blake2s_224_desc);
REGISTER_HASH(&blake2s_256_desc);
#endif
#ifdef LTC_BLAKE2S
REGISTER_HASH(&blake2b_160_desc);
REGISTER_HASH(&blake2b_256_desc);
REGISTER_HASH(&blake2b_384_desc);
REGISTER_HASH(&blake2b_512_desc);
#endif
#ifdef LTC_CHC_HASH
REGISTER_HASH(&chc_desc);
LTC_ARGCHK(chc_register(find_cipher_any("aes", 8, 16)) == CRYPT_OK);
#endif
return CRYPT_OK;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,48 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_register_all_prngs.c
Steffen Jaeckel
*/
#define REGISTER_PRNG(h) do {\
LTC_ARGCHK(register_prng(h) != -1); \
} while(0)
int register_all_prngs(void)
{
#ifdef LTC_YARROW
REGISTER_PRNG(&yarrow_desc);
#endif
#ifdef LTC_FORTUNA
REGISTER_PRNG(&fortuna_desc);
#endif
#ifdef LTC_RC4
REGISTER_PRNG(&rc4_desc);
#endif
#ifdef LTC_CHACHA20_PRNG
REGISTER_PRNG(&chacha20_prng_desc);
#endif
#ifdef LTC_SOBER128
REGISTER_PRNG(&sober128_desc);
#endif
#ifdef LTC_SPRNG
REGISTER_PRNG(&sprng_desc);
#endif
return CRYPT_OK;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,52 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_register_cipher.c
Register a cipher, Tom St Denis
*/
/**
Register a cipher with the descriptor table
@param cipher The cipher you wish to register
@return value >= 0 if successfully added (or already present), -1 if unsuccessful
*/
int register_cipher(const struct ltc_cipher_descriptor *cipher)
{
int x;
LTC_ARGCHK(cipher != NULL);
/* is it already registered? */
LTC_MUTEX_LOCK(&ltc_cipher_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (cipher_descriptor[x].name != NULL && cipher_descriptor[x].ID == cipher->ID) {
LTC_MUTEX_UNLOCK(&ltc_cipher_mutex);
return x;
}
}
/* find a blank spot */
for (x = 0; x < TAB_SIZE; x++) {
if (cipher_descriptor[x].name == NULL) {
XMEMCPY(&cipher_descriptor[x], cipher, sizeof(struct ltc_cipher_descriptor));
LTC_MUTEX_UNLOCK(&ltc_cipher_mutex);
return x;
}
}
/* no spot */
LTC_MUTEX_UNLOCK(&ltc_cipher_mutex);
return -1;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,52 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_register_hash.c
Register a HASH, Tom St Denis
*/
/**
Register a hash with the descriptor table
@param hash The hash you wish to register
@return value >= 0 if successfully added (or already present), -1 if unsuccessful
*/
int register_hash(const struct ltc_hash_descriptor *hash)
{
int x;
LTC_ARGCHK(hash != NULL);
/* is it already registered? */
LTC_MUTEX_LOCK(&ltc_hash_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (XMEMCMP(&hash_descriptor[x], hash, sizeof(struct ltc_hash_descriptor)) == 0) {
LTC_MUTEX_UNLOCK(&ltc_hash_mutex);
return x;
}
}
/* find a blank spot */
for (x = 0; x < TAB_SIZE; x++) {
if (hash_descriptor[x].name == NULL) {
XMEMCPY(&hash_descriptor[x], hash, sizeof(struct ltc_hash_descriptor));
LTC_MUTEX_UNLOCK(&ltc_hash_mutex);
return x;
}
}
/* no spot */
LTC_MUTEX_UNLOCK(&ltc_hash_mutex);
return -1;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,52 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_register_prng.c
Register a PRNG, Tom St Denis
*/
/**
Register a PRNG with the descriptor table
@param prng The PRNG you wish to register
@return value >= 0 if successfully added (or already present), -1 if unsuccessful
*/
int register_prng(const struct ltc_prng_descriptor *prng)
{
int x;
LTC_ARGCHK(prng != NULL);
/* is it already registered? */
LTC_MUTEX_LOCK(&ltc_prng_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (XMEMCMP(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor)) == 0) {
LTC_MUTEX_UNLOCK(&ltc_prng_mutex);
return x;
}
}
/* find a blank spot */
for (x = 0; x < TAB_SIZE; x++) {
if (prng_descriptor[x].name == NULL) {
XMEMCPY(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor));
LTC_MUTEX_UNLOCK(&ltc_prng_mutex);
return x;
}
}
/* no spot */
LTC_MUTEX_UNLOCK(&ltc_prng_mutex);
return -1;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,348 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_sizes.c
Make various struct sizes available to dynamic languages
like Python - Larry Bugbee, February 2013
LB - Dec 2013 - revised to include compiler define options
*/
typedef struct {
const char *name;
const unsigned int size;
} crypt_size;
#define _SZ_STRINGIFY_S(s) { #s, sizeof(struct s) }
#define _SZ_STRINGIFY_T(s) { #s, sizeof(s) }
static const crypt_size _crypt_sizes[] = {
/* hash state sizes */
_SZ_STRINGIFY_S(ltc_hash_descriptor),
_SZ_STRINGIFY_T(hash_state),
#ifdef LTC_CHC_HASH
_SZ_STRINGIFY_S(chc_state),
#endif
#ifdef LTC_WHIRLPOOL
_SZ_STRINGIFY_S(whirlpool_state),
#endif
#ifdef LTC_SHA3
_SZ_STRINGIFY_S(sha3_state),
#endif
#ifdef LTC_SHA512
_SZ_STRINGIFY_S(sha512_state),
#endif
#ifdef LTC_SHA256
_SZ_STRINGIFY_S(sha256_state),
#endif
#ifdef LTC_SHA1
_SZ_STRINGIFY_S(sha1_state),
#endif
#ifdef LTC_MD5
_SZ_STRINGIFY_S(md5_state),
#endif
#ifdef LTC_MD4
_SZ_STRINGIFY_S(md4_state),
#endif
#ifdef LTC_MD2
_SZ_STRINGIFY_S(md2_state),
#endif
#ifdef LTC_TIGER
_SZ_STRINGIFY_S(tiger_state),
#endif
#ifdef LTC_RIPEMD128
_SZ_STRINGIFY_S(rmd128_state),
#endif
#ifdef LTC_RIPEMD160
_SZ_STRINGIFY_S(rmd160_state),
#endif
#ifdef LTC_RIPEMD256
_SZ_STRINGIFY_S(rmd256_state),
#endif
#ifdef LTC_RIPEMD320
_SZ_STRINGIFY_S(rmd320_state),
#endif
#ifdef LTC_BLAKE2S
_SZ_STRINGIFY_S(blake2s_state),
#endif
#ifdef LTC_BLAKE2B
_SZ_STRINGIFY_S(blake2b_state),
#endif
/* block cipher key sizes */
_SZ_STRINGIFY_S(ltc_cipher_descriptor),
_SZ_STRINGIFY_T(symmetric_key),
#ifdef LTC_ANUBIS
_SZ_STRINGIFY_S(anubis_key),
#endif
#ifdef LTC_CAMELLIA
_SZ_STRINGIFY_S(camellia_key),
#endif
#ifdef LTC_BLOWFISH
_SZ_STRINGIFY_S(blowfish_key),
#endif
#ifdef LTC_CAST5
_SZ_STRINGIFY_S(cast5_key),
#endif
#ifdef LTC_DES
_SZ_STRINGIFY_S(des_key),
_SZ_STRINGIFY_S(des3_key),
#endif
#ifdef LTC_KASUMI
_SZ_STRINGIFY_S(kasumi_key),
#endif
#ifdef LTC_KHAZAD
_SZ_STRINGIFY_S(khazad_key),
#endif
#ifdef LTC_KSEED
_SZ_STRINGIFY_S(kseed_key),
#endif
#ifdef LTC_MULTI2
_SZ_STRINGIFY_S(multi2_key),
#endif
#ifdef LTC_NOEKEON
_SZ_STRINGIFY_S(noekeon_key),
#endif
#ifdef LTC_RC2
_SZ_STRINGIFY_S(rc2_key),
#endif
#ifdef LTC_RC5
_SZ_STRINGIFY_S(rc5_key),
#endif
#ifdef LTC_RC6
_SZ_STRINGIFY_S(rc6_key),
#endif
#ifdef LTC_SKIPJACK
_SZ_STRINGIFY_S(skipjack_key),
#endif
#ifdef LTC_XTEA
_SZ_STRINGIFY_S(xtea_key),
#endif
#ifdef LTC_RIJNDAEL
_SZ_STRINGIFY_S(rijndael_key),
#endif
#ifdef LTC_SAFER
_SZ_STRINGIFY_S(safer_key),
#endif
#ifdef LTC_SAFERP
_SZ_STRINGIFY_S(saferp_key),
#endif
#ifdef LTC_TWOFISH
_SZ_STRINGIFY_S(twofish_key),
#endif
/* mode sizes */
#ifdef LTC_ECB_MODE
_SZ_STRINGIFY_T(symmetric_ECB),
#endif
#ifdef LTC_CFB_MODE
_SZ_STRINGIFY_T(symmetric_CFB),
#endif
#ifdef LTC_OFB_MODE
_SZ_STRINGIFY_T(symmetric_OFB),
#endif
#ifdef LTC_CBC_MODE
_SZ_STRINGIFY_T(symmetric_CBC),
#endif
#ifdef LTC_CTR_MODE
_SZ_STRINGIFY_T(symmetric_CTR),
#endif
#ifdef LTC_LRW_MODE
_SZ_STRINGIFY_T(symmetric_LRW),
#endif
#ifdef LTC_F8_MODE
_SZ_STRINGIFY_T(symmetric_F8),
#endif
#ifdef LTC_XTS_MODE
_SZ_STRINGIFY_T(symmetric_xts),
#endif
/* stream cipher sizes */
#ifdef LTC_CHACHA
_SZ_STRINGIFY_T(chacha_state),
#endif
#ifdef LTC_RC4_STREAM
_SZ_STRINGIFY_T(rc4_state),
#endif
#ifdef LTC_SOBER128_STREAM
_SZ_STRINGIFY_T(sober128_state),
#endif
/* MAC sizes -- no states for ccm, lrw */
#ifdef LTC_HMAC
_SZ_STRINGIFY_T(hmac_state),
#endif
#ifdef LTC_OMAC
_SZ_STRINGIFY_T(omac_state),
#endif
#ifdef LTC_PMAC
_SZ_STRINGIFY_T(pmac_state),
#endif
#ifdef LTC_POLY1305
_SZ_STRINGIFY_T(poly1305_state),
#endif
#ifdef LTC_EAX_MODE
_SZ_STRINGIFY_T(eax_state),
#endif
#ifdef LTC_OCB_MODE
_SZ_STRINGIFY_T(ocb_state),
#endif
#ifdef LTC_OCB3_MODE
_SZ_STRINGIFY_T(ocb3_state),
#endif
#ifdef LTC_CCM_MODE
_SZ_STRINGIFY_T(ccm_state),
#endif
#ifdef LTC_GCM_MODE
_SZ_STRINGIFY_T(gcm_state),
#endif
#ifdef LTC_PELICAN
_SZ_STRINGIFY_T(pelican_state),
#endif
#ifdef LTC_XCBC
_SZ_STRINGIFY_T(xcbc_state),
#endif
#ifdef LTC_F9_MODE
_SZ_STRINGIFY_T(f9_state),
#endif
#ifdef LTC_CHACHA20POLY1305_MODE
_SZ_STRINGIFY_T(chacha20poly1305_state),
#endif
/* asymmetric keys */
#ifdef LTC_MRSA
_SZ_STRINGIFY_T(rsa_key),
#endif
#ifdef LTC_MDSA
_SZ_STRINGIFY_T(dsa_key),
#endif
#ifdef LTC_MDH
_SZ_STRINGIFY_T(dh_key),
#endif
#ifdef LTC_MECC
_SZ_STRINGIFY_T(ltc_ecc_set_type),
_SZ_STRINGIFY_T(ecc_point),
_SZ_STRINGIFY_T(ecc_key),
#endif
#ifdef LTC_MKAT
_SZ_STRINGIFY_T(katja_key),
#endif
/* DER handling */
#ifdef LTC_DER
_SZ_STRINGIFY_T(ltc_asn1_list), /* a list entry */
_SZ_STRINGIFY_T(ltc_utctime),
_SZ_STRINGIFY_T(ltc_generalizedtime),
#endif
/* prng state sizes */
_SZ_STRINGIFY_S(ltc_prng_descriptor),
_SZ_STRINGIFY_T(prng_state),
#ifdef LTC_FORTUNA
_SZ_STRINGIFY_S(fortuna_prng),
#endif
#ifdef LTC_CHACHA20_PRNG
_SZ_STRINGIFY_S(chacha20_prng),
#endif
#ifdef LTC_RC4
_SZ_STRINGIFY_S(rc4_prng),
#endif
#ifdef LTC_SOBER128
_SZ_STRINGIFY_S(sober128_prng),
#endif
#ifdef LTC_YARROW
_SZ_STRINGIFY_S(yarrow_prng),
#endif
/* sprng has no state as it uses other potentially available sources */
/* like /dev/random. See Developers Guide for more info. */
#ifdef LTC_ADLER32
_SZ_STRINGIFY_T(adler32_state),
#endif
#ifdef LTC_CRC32
_SZ_STRINGIFY_T(crc32_state),
#endif
_SZ_STRINGIFY_T(ltc_mp_digit),
_SZ_STRINGIFY_T(ltc_math_descriptor)
};
/* crypt_get_size()
* sizeout will be the size (bytes) of the named struct or union
* return -1 if named item not found
*/
int crypt_get_size(const char* namein, unsigned int *sizeout) {
int i;
int count = sizeof(_crypt_sizes) / sizeof(_crypt_sizes[0]);
for (i=0; i<count; i++) {
if (XSTRCMP(_crypt_sizes[i].name, namein) == 0) {
*sizeout = _crypt_sizes[i].size;
return 0;
}
}
return -1;
}
/* crypt_list_all_sizes()
* if names_list is NULL, names_list_size will be the minimum
* size needed to receive the complete names_list
* if names_list is NOT NULL, names_list must be the addr with
* sufficient memory allocated into which the names_list
* is to be written. Also, the value in names_list_size
* sets the upper bound of the number of characters to be
* written.
* a -1 return value signifies insufficient space made available
*/
int crypt_list_all_sizes(char *names_list, unsigned int *names_list_size) {
int i;
unsigned int total_len = 0;
char *ptr;
int number_len;
int count = sizeof(_crypt_sizes) / sizeof(_crypt_sizes[0]);
/* calculate amount of memory required for the list */
for (i=0; i<count; i++) {
number_len = snprintf(NULL, 0, "%s,%u\n", _crypt_sizes[i].name, _crypt_sizes[i].size);
if (number_len < 0)
return -1;
total_len += number_len;
/* this last +1 is for newlines (and ending NULL) */
}
if (names_list == NULL) {
*names_list_size = total_len;
} else {
if (total_len > *names_list_size) {
return -1;
}
/* build the names list */
ptr = names_list;
for (i=0; i<count; i++) {
number_len = snprintf(ptr, total_len, "%s,%u\n", _crypt_sizes[i].name, _crypt_sizes[i].size);
if (number_len < 0) return -1;
if ((unsigned int)number_len > total_len) return -1;
total_len -= number_len;
ptr += number_len;
}
/* to remove the trailing new-line */
ptr -= 1;
*ptr = 0;
}
return 0;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,43 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_unregister_cipher.c
Unregister a cipher, Tom St Denis
*/
/**
Unregister a cipher from the descriptor table
@param cipher The cipher descriptor to remove
@return CRYPT_OK on success
*/
int unregister_cipher(const struct ltc_cipher_descriptor *cipher)
{
int x;
LTC_ARGCHK(cipher != NULL);
/* is it already registered? */
LTC_MUTEX_LOCK(&ltc_cipher_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (XMEMCMP(&cipher_descriptor[x], cipher, sizeof(struct ltc_cipher_descriptor)) == 0) {
cipher_descriptor[x].name = NULL;
cipher_descriptor[x].ID = 255;
LTC_MUTEX_UNLOCK(&ltc_cipher_mutex);
return CRYPT_OK;
}
}
LTC_MUTEX_UNLOCK(&ltc_cipher_mutex);
return CRYPT_ERROR;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,42 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_unregister_hash.c
Unregister a hash, Tom St Denis
*/
/**
Unregister a hash from the descriptor table
@param hash The hash descriptor to remove
@return CRYPT_OK on success
*/
int unregister_hash(const struct ltc_hash_descriptor *hash)
{
int x;
LTC_ARGCHK(hash != NULL);
/* is it already registered? */
LTC_MUTEX_LOCK(&ltc_hash_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (XMEMCMP(&hash_descriptor[x], hash, sizeof(struct ltc_hash_descriptor)) == 0) {
hash_descriptor[x].name = NULL;
LTC_MUTEX_UNLOCK(&ltc_hash_mutex);
return CRYPT_OK;
}
}
LTC_MUTEX_UNLOCK(&ltc_hash_mutex);
return CRYPT_ERROR;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */

View File

@ -0,0 +1,42 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
/**
@file crypt_unregister_prng.c
Unregister a PRNG, Tom St Denis
*/
/**
Unregister a PRNG from the descriptor table
@param prng The PRNG descriptor to remove
@return CRYPT_OK on success
*/
int unregister_prng(const struct ltc_prng_descriptor *prng)
{
int x;
LTC_ARGCHK(prng != NULL);
/* is it already registered? */
LTC_MUTEX_LOCK(&ltc_prng_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (XMEMCMP(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor)) == 0) {
prng_descriptor[x].name = NULL;
LTC_MUTEX_UNLOCK(&ltc_prng_mutex);
return CRYPT_OK;
}
}
LTC_MUTEX_UNLOCK(&ltc_prng_mutex);
return CRYPT_ERROR;
}
/* ref: HEAD -> master, tag: v1.18.2 */
/* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */
/* commit time: 2018-07-01 22:49:01 +0200 */