added libtomcrypt-1.17

This commit is contained in:
Tom St Denis
2007-07-20 17:48:02 +00:00
committed by Steffen Jaeckel
parent e24b01d392
commit bbc52b9e1b
341 changed files with 4806 additions and 1740 deletions
+4 -4
View File
@@ -6,20 +6,20 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
*/
#include "tomcrypt.h"
/**
@file omac_done.c
OMAC1 support, terminate a stream, Tom St Denis
LTC_OMAC1 support, terminate a stream, Tom St Denis
*/
#ifdef LTC_OMAC
/**
Terminate an OMAC stream
@param omac The OMAC state
Terminate an LTC_OMAC stream
@param omac The LTC_OMAC state
@param out [out] Destination for the authentication tag
@param outlen [in/out] The max size and resulting size of the authentication tag
@return CRYPT_OK if successful
+4 -4
View File
@@ -6,23 +6,23 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
*/
#include "tomcrypt.h"
/**
@file omac_file.c
OMAC1 support, process a file, Tom St Denis
LTC_OMAC1 support, process a file, Tom St Denis
*/
#ifdef LTC_OMAC
/**
OMAC a file
LTC_OMAC a file
@param cipher The index of the cipher desired
@param key The secret key
@param keylen The length of the secret key (octets)
@param filename The name of the file you wish to OMAC
@param filename The name of the file you wish to LTC_OMAC
@param out [out] Where the authentication tag is to be stored
@param outlen [in/out] The max size and resulting size of the authentication tag
@return CRYPT_OK if successful, CRYPT_NOP if file support has been disabled
+4 -4
View File
@@ -6,21 +6,21 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
*/
#include "tomcrypt.h"
/**
@file omac_init.c
OMAC1 support, initialize state, by Tom St Denis
LTC_OMAC1 support, initialize state, by Tom St Denis
*/
#ifdef LTC_OMAC
/**
Initialize an OMAC state
@param omac The OMAC state to initialize
Initialize an LTC_OMAC state
@param omac The LTC_OMAC state to initialize
@param cipher The index of the desired cipher
@param key The secret key
@param keylen The length of the secret key (octets)
+5 -5
View File
@@ -6,24 +6,24 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
*/
#include "tomcrypt.h"
/**
@file omac_memory.c
OMAC1 support, process a block of memory, Tom St Denis
LTC_OMAC1 support, process a block of memory, Tom St Denis
*/
#ifdef LTC_OMAC
/**
OMAC a block of memory
LTC_OMAC a block of memory
@param cipher The index of the desired cipher
@param key The secret key
@param keylen The length of the secret key (octets)
@param in The data to send through OMAC
@param inlen The length of the data to send through OMAC (octets)
@param in The data to send through LTC_OMAC
@param inlen The length of the data to send through LTC_OMAC (octets)
@param out [out] The destination of the authentication tag
@param outlen [in/out] The max size and resulting size of the authentication tag (octets)
@return CRYPT_OK if successful
+6 -6
View File
@@ -6,28 +6,28 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
*/
#include "tomcrypt.h"
#include <stdarg.h>
/**
@file omac_memory_multi.c
OMAC1 support, process multiple blocks of memory, Tom St Denis
LTC_OMAC1 support, process multiple blocks of memory, Tom St Denis
*/
#ifdef LTC_OMAC
/**
OMAC multiple blocks of memory
LTC_OMAC multiple blocks of memory
@param cipher The index of the desired cipher
@param key The secret key
@param keylen The length of the secret key (octets)
@param out [out] The destination of the authentication tag
@param outlen [in/out] The max size and resulting size of the authentication tag (octets)
@param in The data to send through OMAC
@param inlen The length of the data to send through OMAC (octets)
@param ... tuples of (data,len) pairs to OMAC, terminated with a (NULL,x) (x=don't care)
@param in The data to send through LTC_OMAC
@param inlen The length of the data to send through LTC_OMAC (octets)
@param ... tuples of (data,len) pairs to LTC_OMAC, terminated with a (NULL,x) (x=don't care)
@return CRYPT_OK if successful
*/
int omac_memory_multi(int cipher,
+12 -11
View File
@@ -6,28 +6,28 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
*/
#include "tomcrypt.h"
/**
@file omac_process.c
OMAC1 support, process data, Tom St Denis
LTC_OMAC1 support, process data, Tom St Denis
*/
#ifdef LTC_OMAC
/**
Process data through OMAC
@param omac The OMAC state
@param in The input data to send through OMAC
Process data through LTC_OMAC
@param omac The LTC_OMAC state
@param in The input data to send through LTC_OMAC
@param inlen The length of the input (octets)
@return CRYPT_OK if successful
*/
int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen)
{
unsigned long n, x;
unsigned long n, x, blklen;
int err;
LTC_ARGCHK(omac != NULL);
@@ -42,13 +42,14 @@ int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen)
}
#ifdef LTC_FAST
if (omac->buflen == 0 && inlen > 16) {
int y;
for (x = 0; x < (inlen - 16); x += 16) {
for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) {
blklen = cipher_descriptor[omac->cipher_idx].block_length;
if (omac->buflen == 0 && inlen > blklen) {
unsigned long y;
for (x = 0; x < (inlen - blklen); x += blklen) {
for (y = 0; y < blklen; y += sizeof(LTC_FAST_TYPE)) {
*((LTC_FAST_TYPE*)(&omac->prev[y])) ^= *((LTC_FAST_TYPE*)(&in[y]));
}
in += 16;
in += blklen;
if ((err = cipher_descriptor[omac->cipher_idx].ecb_encrypt(omac->prev, omac->prev, &omac->key)) != CRYPT_OK) {
return err;
}
+3 -3
View File
@@ -6,19 +6,19 @@
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
*/
#include "tomcrypt.h"
/**
@file omac_test.c
OMAC1 support, self-test, by Tom St Denis
LTC_OMAC1 support, self-test, by Tom St Denis
*/
#ifdef LTC_OMAC
/**
Test the OMAC setup
Test the LTC_OMAC setup
@return CRYPT_OK if successful, CRYPT_NOP if tests have been disabled
*/
int omac_test(void)