added libtomcrypt-1.15

This commit is contained in:
Tom St Denis
2006-11-17 14:21:24 +00:00
committed by Steffen Jaeckel
parent 479cc9c261
commit 2de2976d25
141 changed files with 6686 additions and 1520 deletions
+20 -5
View File
@@ -110,6 +110,12 @@ const char *crypt_build_settings =
" (tweaked)"
#endif
"\n"
#if defined(KSEED)
" KSEED\n"
#endif
#if defined(LTC_KASUMI)
" KASUMI\n"
#endif
"\nHashes built-in:\n"
#if defined(SHA512)
@@ -166,8 +172,12 @@ const char *crypt_build_settings =
" CBC\n"
#endif
#if defined(LTC_CTR_MODE)
" CTR\n"
" CTR "
#endif
#if defined(LTC_CTR_OLD)
" (CTR_OLD) "
#endif
"\n"
#if defined(LRW_MODE)
" LRW_MODE"
#if defined(LRW_TABLES)
@@ -180,18 +190,24 @@ const char *crypt_build_settings =
#endif
"\nMACs:\n"
#if defined(HMAC)
#if defined(LTC_HMAC)
" HMAC\n"
#endif
#if defined(OMAC)
#if defined(LTC_OMAC)
" OMAC\n"
#endif
#if defined(PMAC)
#if defined(LTC_PMAC)
" PMAC\n"
#endif
#if defined(PELICAN)
" PELICAN\n"
#endif
#if defined(LTC_XCBC)
" XCBC-MAC\n"
#endif
#if defined(LTC_F9_MODE)
" F9-MAC\n"
#endif
"\nENC + AUTH modes:\n"
#if defined(EAX_MODE)
@@ -211,7 +227,6 @@ const char *crypt_build_settings =
#endif
"\n"
"\nPRNG:\n"
#if defined(YARROW)
" Yarrow\n"
+1 -1
View File
@@ -16,7 +16,7 @@
*/
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, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
};
LTC_MUTEX_GLOBAL(ltc_cipher_mutex)
+1 -1
View File
@@ -21,7 +21,7 @@ int find_hash_oid(const unsigned long *ID, unsigned long IDlen)
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 && !memcmp(hash_descriptor[x].OID, ID, sizeof(unsigned long) * IDlen)) {
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;
}
+59
View File
@@ -0,0 +1,59 @@
/* 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.
*
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
*/
#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, ...)
{
int err;
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 ((err = register_cipher(p)) != CRYPT_OK) {
va_end(args);
return err;
}
}
while ((p = va_arg(args, void*)) != NULL) {
if ((err = register_hash(p)) != CRYPT_OK) {
va_end(args);
return err;
}
}
while ((p = va_arg(args, void*)) != NULL) {
if ((err = register_prng(p)) != CRYPT_OK) {
va_end(args);
return err;
}
}
va_end(args);
return CRYPT_OK;
}
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+1 -1
View File
@@ -29,7 +29,7 @@ int register_hash(const struct ltc_hash_descriptor *hash)
/* is it already registered? */
LTC_MUTEX_LOCK(&ltc_hash_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (memcmp(&hash_descriptor[x], hash, sizeof(struct ltc_hash_descriptor)) == 0) {
if (XMEMCMP(&hash_descriptor[x], hash, sizeof(struct ltc_hash_descriptor)) == 0) {
LTC_MUTEX_UNLOCK(&ltc_hash_mutex);
return x;
}
+1 -1
View File
@@ -29,7 +29,7 @@ int register_prng(const struct ltc_prng_descriptor *prng)
/* is it already registered? */
LTC_MUTEX_LOCK(&ltc_prng_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (memcmp(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor)) == 0) {
if (XMEMCMP(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor)) == 0) {
LTC_MUTEX_UNLOCK(&ltc_prng_mutex);
return x;
}
+1 -1
View File
@@ -29,7 +29,7 @@ int unregister_cipher(const struct ltc_cipher_descriptor *cipher)
/* is it already registered? */
LTC_MUTEX_LOCK(&ltc_cipher_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (memcmp(&cipher_descriptor[x], cipher, sizeof(struct ltc_cipher_descriptor)) == 0) {
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);
+1 -1
View File
@@ -29,7 +29,7 @@ int unregister_hash(const struct ltc_hash_descriptor *hash)
/* is it already registered? */
LTC_MUTEX_LOCK(&ltc_hash_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (memcmp(&hash_descriptor[x], hash, sizeof(struct ltc_hash_descriptor)) == 0) {
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;
+1 -1
View File
@@ -29,7 +29,7 @@ int unregister_prng(const struct ltc_prng_descriptor *prng)
/* is it already registered? */
LTC_MUTEX_LOCK(&ltc_prng_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (memcmp(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor)) != 0) {
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;