added libtomcrypt-1.01
This commit is contained in:
committed by
Steffen Jaeckel
parent
bfc2f5b078
commit
6ac9952498
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
@@ -65,8 +65,20 @@ int base64_decode(const unsigned char *in, unsigned long inlen,
|
||||
for (x = y = z = t = 0; x < inlen; x++) {
|
||||
c = map[in[x]&0xFF];
|
||||
if (c == 255) continue;
|
||||
if (c == 254) { c = 0; g--; }
|
||||
/* the final = symbols are read and used to trim the remaining bytes */
|
||||
if (c == 254) {
|
||||
c = 0;
|
||||
/* prevent g < 0 which would potentially allow an overflow later */
|
||||
if (--g < 0) {
|
||||
return CRYPT_INVALID_PACKET;
|
||||
}
|
||||
} else if (g != 3) {
|
||||
/* we only allow = to be at the end */
|
||||
return CRYPT_INVALID_PACKET;
|
||||
}
|
||||
|
||||
t = (t<<6)|c;
|
||||
|
||||
if (++y == 4) {
|
||||
if (z + g > *outlen) {
|
||||
return CRYPT_BUFFER_OVERFLOW;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
+26
-1
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
@@ -179,6 +179,9 @@ const char *crypt_build_settings =
|
||||
#if defined(PMAC)
|
||||
" PMAC\n"
|
||||
#endif
|
||||
#if defined(PELICAN)
|
||||
" PELICAN\n"
|
||||
#endif
|
||||
|
||||
"\nENC + AUTH modes:\n"
|
||||
#if defined(EAX_MODE)
|
||||
@@ -187,6 +190,16 @@ const char *crypt_build_settings =
|
||||
#if defined(OCB_MODE)
|
||||
" OCB_MODE\n"
|
||||
#endif
|
||||
#if defined(CCM_MODE)
|
||||
" CCM_MODE\n"
|
||||
#endif
|
||||
#if defined(GCM_MODE)
|
||||
" GCM_MODE "
|
||||
#endif
|
||||
#if defined(GCM_TABLES)
|
||||
" (GCM_TABLES) "
|
||||
#endif
|
||||
"\n"
|
||||
|
||||
|
||||
"\nPRNG:\n"
|
||||
@@ -270,6 +283,18 @@ const char *crypt_build_settings =
|
||||
#endif
|
||||
#if defined(LTC_DER)
|
||||
" LTC_DER "
|
||||
#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
|
||||
"\n"
|
||||
"\n\n\n"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
#include <signal.h>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
@@ -15,5 +15,7 @@
|
||||
Stores the cipher descriptor table, Tom St Denis
|
||||
*/
|
||||
|
||||
struct ltc_cipher_descriptor cipher_descriptor[TAB_SIZE];
|
||||
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 }
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
@@ -6,14 +6,15 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file crypt_hash_decriptor.c
|
||||
@file crypt_hash_descriptor.c
|
||||
Stores the hash descriptor table, Tom St Denis
|
||||
*/
|
||||
|
||||
struct ltc_hash_descriptor hash_descriptor[TAB_SIZE];
|
||||
|
||||
struct ltc_hash_descriptor hash_descriptor[TAB_SIZE] = {
|
||||
{ NULL, 0, 0, 0, { 0 }, 0, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
@@ -14,4 +14,6 @@
|
||||
@file crypt_prng_descriptor.c
|
||||
Stores the PRNG descriptors, Tom St Denis
|
||||
*/
|
||||
struct ltc_prng_descriptor prng_descriptor[TAB_SIZE];
|
||||
struct ltc_prng_descriptor prng_descriptor[TAB_SIZE] = {
|
||||
{ NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file register_prng.c
|
||||
@file crypt_register_prng.c
|
||||
Register a PRNG, Tom St Denis
|
||||
*/
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
|
||||
#include "tomcrypt.h"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
+454
-229
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
@@ -54,6 +54,7 @@ int rand_prime(mp_int *N, long len, prng_state *prng, int wprng)
|
||||
} else {
|
||||
type = 0;
|
||||
}
|
||||
type |= LTM_PRIME_2MSB_ON;
|
||||
|
||||
/* New prime generation makes the code even more cryptoish-insane. Do you know what this means!!!
|
||||
-- Gir: Yeah, oh wait, er, no.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include <tomcrypt.h>
|
||||
|
||||
@@ -74,7 +74,7 @@ int pkcs_5_alg1(const unsigned char *password, unsigned long password_len,
|
||||
}
|
||||
|
||||
while (--iteration_count) {
|
||||
// code goes here.
|
||||
/* code goes here. */
|
||||
x = MAXBLOCKSIZE;
|
||||
if ((err = hash_memory(hash_idx, buf, hash_descriptor[hash_idx].hashsize, buf, &x)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include <tomcrypt.h>
|
||||
|
||||
@@ -34,7 +34,8 @@ int pkcs_5_alg2(const unsigned char *password, unsigned long password_len,
|
||||
unsigned char *out, unsigned long *outlen)
|
||||
{
|
||||
int err, itts;
|
||||
unsigned long stored, left, x, y, blkno;
|
||||
ulong32 blkno;
|
||||
unsigned long stored, left, x, y;
|
||||
unsigned char *buf[2];
|
||||
hmac_state *hmac;
|
||||
|
||||
|
||||
+6
-5
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
@@ -22,8 +22,9 @@
|
||||
*/
|
||||
void zeromem(void *out, size_t outlen)
|
||||
{
|
||||
unsigned char *mem = (unsigned char *)out;
|
||||
LTC_ARGCHK(out != NULL);
|
||||
while (outlen-- > 0)
|
||||
*mem++ = 0;
|
||||
unsigned char *mem = out;
|
||||
LTC_ARGCHK(out != NULL);
|
||||
while (outlen-- > 0) {
|
||||
*mem++ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user