summaryrefslogtreecommitdiffhomepage
path: root/libtomcrypt/src/mac
diff options
context:
space:
mode:
Diffstat (limited to 'libtomcrypt/src/mac')
-rw-r--r--libtomcrypt/src/mac/f9/f9_done.c8
-rw-r--r--libtomcrypt/src/mac/f9/f9_file.c8
-rw-r--r--libtomcrypt/src/mac/f9/f9_init.c8
-rw-r--r--libtomcrypt/src/mac/f9/f9_memory.c8
-rw-r--r--libtomcrypt/src/mac/f9/f9_memory_multi.c8
-rw-r--r--libtomcrypt/src/mac/f9/f9_process.c8
-rw-r--r--libtomcrypt/src/mac/f9/f9_test.c8
-rw-r--r--libtomcrypt/src/mac/hmac/hmac_done.c27
-rw-r--r--libtomcrypt/src/mac/hmac/hmac_file.c16
-rw-r--r--libtomcrypt/src/mac/hmac/hmac_init.c36
-rw-r--r--libtomcrypt/src/mac/hmac/hmac_memory.c16
-rw-r--r--libtomcrypt/src/mac/hmac/hmac_memory_multi.c18
-rw-r--r--libtomcrypt/src/mac/hmac/hmac_process.c16
-rw-r--r--libtomcrypt/src/mac/hmac/hmac_test.c26
-rw-r--r--libtomcrypt/src/mac/omac/omac_done.c14
-rw-r--r--libtomcrypt/src/mac/omac/omac_file.c14
-rw-r--r--libtomcrypt/src/mac/omac/omac_init.c14
-rw-r--r--libtomcrypt/src/mac/omac/omac_memory.c16
-rw-r--r--libtomcrypt/src/mac/omac/omac_memory_multi.c18
-rw-r--r--libtomcrypt/src/mac/omac/omac_process.c29
-rw-r--r--libtomcrypt/src/mac/omac/omac_test.c12
-rw-r--r--libtomcrypt/src/mac/pelican/pelican.c10
-rw-r--r--libtomcrypt/src/mac/pelican/pelican_memory.c10
-rw-r--r--libtomcrypt/src/mac/pelican/pelican_test.c10
-rw-r--r--libtomcrypt/src/mac/pmac/pmac_done.c8
-rw-r--r--libtomcrypt/src/mac/pmac/pmac_file.c8
-rw-r--r--libtomcrypt/src/mac/pmac/pmac_init.c8
-rw-r--r--libtomcrypt/src/mac/pmac/pmac_memory.c8
-rw-r--r--libtomcrypt/src/mac/pmac/pmac_memory_multi.c8
-rw-r--r--libtomcrypt/src/mac/pmac/pmac_ntz.c8
-rw-r--r--libtomcrypt/src/mac/pmac/pmac_process.c8
-rw-r--r--libtomcrypt/src/mac/pmac/pmac_shift_xor.c8
-rw-r--r--libtomcrypt/src/mac/pmac/pmac_test.c10
-rw-r--r--libtomcrypt/src/mac/xcbc/xcbc_done.c8
-rw-r--r--libtomcrypt/src/mac/xcbc/xcbc_file.c8
-rw-r--r--libtomcrypt/src/mac/xcbc/xcbc_init.c66
-rw-r--r--libtomcrypt/src/mac/xcbc/xcbc_memory.c8
-rw-r--r--libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c8
-rw-r--r--libtomcrypt/src/mac/xcbc/xcbc_process.c8
-rw-r--r--libtomcrypt/src/mac/xcbc/xcbc_test.c8
40 files changed, 284 insertions, 262 deletions
diff --git a/libtomcrypt/src/mac/f9/f9_done.c b/libtomcrypt/src/mac/f9/f9_done.c
index 1794ecc..8da4c73 100644
--- a/libtomcrypt/src/mac/f9/f9_done.c
+++ b/libtomcrypt/src/mac/f9/f9_done.c
@@ -6,7 +6,7 @@
* 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"
@@ -71,7 +71,7 @@ int f9_done(f9_state *f9, unsigned char *out, unsigned long *outlen)
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/f9/f9_done.c,v $ */
-/* $Revision: 1.5 $ */
-/* $Date: 2006/11/09 01:53:32 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/f9/f9_file.c b/libtomcrypt/src/mac/f9/f9_file.c
index 4c53e76..88216a9 100644
--- a/libtomcrypt/src/mac/f9/f9_file.c
+++ b/libtomcrypt/src/mac/f9/f9_file.c
@@ -6,7 +6,7 @@
* 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"
@@ -78,6 +78,6 @@ int f9_file(int cipher,
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/f9/f9_file.c,v $ */
-/* $Revision: 1.4 $ */
-/* $Date: 2006/11/21 00:18:23 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/f9/f9_init.c b/libtomcrypt/src/mac/f9/f9_init.c
index aefd8a7..b6b878f 100644
--- a/libtomcrypt/src/mac/f9/f9_init.c
+++ b/libtomcrypt/src/mac/f9/f9_init.c
@@ -6,7 +6,7 @@
* 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"
@@ -64,7 +64,7 @@ done:
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/f9/f9_init.c,v $ */
-/* $Revision: 1.4 $ */
-/* $Date: 2006/11/08 22:54:18 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/f9/f9_memory.c b/libtomcrypt/src/mac/f9/f9_memory.c
index 2b3901a..0850dc3 100644
--- a/libtomcrypt/src/mac/f9/f9_memory.c
+++ b/libtomcrypt/src/mac/f9/f9_memory.c
@@ -6,7 +6,7 @@
* 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"
@@ -66,6 +66,6 @@ done:
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/f9/f9_memory.c,v $ */
-/* $Revision: 1.4 $ */
-/* $Date: 2006/11/21 23:02:42 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/f9/f9_memory_multi.c b/libtomcrypt/src/mac/f9/f9_memory_multi.c
index 5b315f5..7a13ff9 100644
--- a/libtomcrypt/src/mac/f9/f9_memory_multi.c
+++ b/libtomcrypt/src/mac/f9/f9_memory_multi.c
@@ -6,7 +6,7 @@
* 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>
@@ -85,6 +85,6 @@ LBL_ERR:
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/f9/f9_memory_multi.c,v $ */
-/* $Revision: 1.2 $ */
-/* $Date: 2006/11/08 21:50:13 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/f9/f9_process.c b/libtomcrypt/src/mac/f9/f9_process.c
index e8bd88b..bf54d71 100644
--- a/libtomcrypt/src/mac/f9/f9_process.c
+++ b/libtomcrypt/src/mac/f9/f9_process.c
@@ -6,7 +6,7 @@
* 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"
@@ -72,7 +72,7 @@ int f9_process(f9_state *f9, const unsigned char *in, unsigned long inlen)
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/f9/f9_process.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2006/12/16 17:41:21 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/f9/f9_test.c b/libtomcrypt/src/mac/f9/f9_test.c
index 4cddfe6..b92c630 100644
--- a/libtomcrypt/src/mac/f9/f9_test.c
+++ b/libtomcrypt/src/mac/f9/f9_test.c
@@ -6,7 +6,7 @@
* 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"
@@ -72,7 +72,7 @@ int f9_test(void)
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/f9/f9_test.c,v $ */
-/* $Revision: 1.8 $ */
-/* $Date: 2006/11/21 23:02:42 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/hmac/hmac_done.c b/libtomcrypt/src/mac/hmac/hmac_done.c
index f48d672..9046110 100644
--- a/libtomcrypt/src/mac/hmac/hmac_done.c
+++ b/libtomcrypt/src/mac/hmac/hmac_done.c
@@ -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 hmac_done.c
- HMAC support, terminate stream, Tom St Denis/Dobes Vandermeer
+ LTC_HMAC support, terminate stream, Tom St Denis/Dobes Vandermeer
*/
#ifdef LTC_HMAC
-#define HMAC_BLOCKSIZE hash_descriptor[hash].blocksize
+#define LTC_HMAC_BLOCKSIZE hash_descriptor[hash].blocksize
/**
- Terminate an HMAC session
- @param hmac The HMAC state
- @param out [out] The destination of the HMAC authentication tag
- @param outlen [in/out] The max size and resulting size of the HMAC authentication tag
+ Terminate an LTC_HMAC session
+ @param hmac The LTC_HMAC state
+ @param out [out] The destination of the LTC_HMAC authentication tag
+ @param outlen [in/out] The max size and resulting size of the LTC_HMAC authentication tag
@return CRYPT_OK if successful
*/
int hmac_done(hmac_state *hmac, unsigned char *out, unsigned long *outlen)
@@ -44,13 +44,12 @@ int hmac_done(hmac_state *hmac, unsigned char *out, unsigned long *outlen)
/* get the hash message digest size */
hashsize = hash_descriptor[hash].hashsize;
- /* Get the hash of the first HMAC vector plus the data */
if ((err = hash_descriptor[hash].done(&hmac->md, isha)) != CRYPT_OK) {
goto LBL_ERR;
}
- /* Create the second HMAC vector vector for step (3) */
- for(i=0; i < HMAC_BLOCKSIZE; i++) {
+ /* Create the second LTC_HMAC vector vector for step (3) */
+ for(i=0; i < LTC_HMAC_BLOCKSIZE; i++) {
buf[i] = hmac->key[i] ^ 0x5C;
}
@@ -58,7 +57,7 @@ int hmac_done(hmac_state *hmac, unsigned char *out, unsigned long *outlen)
if ((err = hash_descriptor[hash].init(&hmac->md)) != CRYPT_OK) {
goto LBL_ERR;
}
- if ((err = hash_descriptor[hash].process(&hmac->md, buf, HMAC_BLOCKSIZE)) != CRYPT_OK) {
+ if ((err = hash_descriptor[hash].process(&hmac->md, buf, LTC_HMAC_BLOCKSIZE)) != CRYPT_OK) {
goto LBL_ERR;
}
if ((err = hash_descriptor[hash].process(&hmac->md, isha, hashsize)) != CRYPT_OK) {
@@ -88,6 +87,6 @@ LBL_ERR:
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_done.c,v $ */
-/* $Revision: 1.5 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/hmac/hmac_file.c b/libtomcrypt/src/mac/hmac/hmac_file.c
index d7c40b1..d9841bd 100644
--- a/libtomcrypt/src/mac/hmac/hmac_file.c
+++ b/libtomcrypt/src/mac/hmac/hmac_file.c
@@ -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 hmac_file.c
- HMAC support, process a file, Tom St Denis/Dobes Vandermeer
+ LTC_HMAC support, process a file, Tom St Denis/Dobes Vandermeer
*/
#ifdef LTC_HMAC
/**
- HMAC a file
+ LTC_HMAC a file
@param hash The index of the hash you wish to use
- @param fname The name of the file you wish to HMAC
+ @param fname The name of the file you wish to LTC_HMAC
@param key The secret key
@param keylen The length of the secret key
- @param out [out] The HMAC authentication tag
+ @param out [out] The LTC_HMAC authentication tag
@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
*/
@@ -89,6 +89,6 @@ int hmac_file(int hash, const char *fname,
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_file.c,v $ */
-/* $Revision: 1.5 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/hmac/hmac_init.c b/libtomcrypt/src/mac/hmac/hmac_init.c
index a4a4377..262002e 100644
--- a/libtomcrypt/src/mac/hmac/hmac_init.c
+++ b/libtomcrypt/src/mac/hmac/hmac_init.c
@@ -6,22 +6,22 @@
* 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 hmac_init.c
- HMAC support, initialize state, Tom St Denis/Dobes Vandermeer
+ LTC_HMAC support, initialize state, Tom St Denis/Dobes Vandermeer
*/
#ifdef LTC_HMAC
-#define HMAC_BLOCKSIZE hash_descriptor[hash].blocksize
+#define LTC_HMAC_BLOCKSIZE hash_descriptor[hash].blocksize
/**
- Initialize an HMAC context.
- @param hmac The HMAC state
+ Initialize an LTC_HMAC context.
+ @param hmac The LTC_HMAC state
@param hash The index of the hash you want to use
@param key The secret key
@param keylen The length of the secret key (octets)
@@ -50,30 +50,30 @@ int hmac_init(hmac_state *hmac, int hash, const unsigned char *key, unsigned lon
}
/* allocate memory for key */
- hmac->key = XMALLOC(HMAC_BLOCKSIZE);
+ hmac->key = XMALLOC(LTC_HMAC_BLOCKSIZE);
if (hmac->key == NULL) {
return CRYPT_MEM;
}
/* (1) make sure we have a large enough key */
- if(keylen > HMAC_BLOCKSIZE) {
- z = HMAC_BLOCKSIZE;
+ if(keylen > LTC_HMAC_BLOCKSIZE) {
+ z = LTC_HMAC_BLOCKSIZE;
if ((err = hash_memory(hash, key, keylen, hmac->key, &z)) != CRYPT_OK) {
goto LBL_ERR;
}
- if(hashsize < HMAC_BLOCKSIZE) {
- zeromem((hmac->key) + hashsize, (size_t)(HMAC_BLOCKSIZE - hashsize));
+ if(hashsize < LTC_HMAC_BLOCKSIZE) {
+ zeromem((hmac->key) + hashsize, (size_t)(LTC_HMAC_BLOCKSIZE - hashsize));
}
keylen = hashsize;
} else {
XMEMCPY(hmac->key, key, (size_t)keylen);
- if(keylen < HMAC_BLOCKSIZE) {
- zeromem((hmac->key) + keylen, (size_t)(HMAC_BLOCKSIZE - keylen));
+ if(keylen < LTC_HMAC_BLOCKSIZE) {
+ zeromem((hmac->key) + keylen, (size_t)(LTC_HMAC_BLOCKSIZE - keylen));
}
}
/* Create the initial vector for step (3) */
- for(i=0; i < HMAC_BLOCKSIZE; i++) {
+ for(i=0; i < LTC_HMAC_BLOCKSIZE; i++) {
buf[i] = hmac->key[i] ^ 0x36;
}
@@ -82,7 +82,7 @@ int hmac_init(hmac_state *hmac, int hash, const unsigned char *key, unsigned lon
goto LBL_ERR;
}
- if ((err = hash_descriptor[hash].process(&hmac->md, buf, HMAC_BLOCKSIZE)) != CRYPT_OK) {
+ if ((err = hash_descriptor[hash].process(&hmac->md, buf, LTC_HMAC_BLOCKSIZE)) != CRYPT_OK) {
goto LBL_ERR;
}
goto done;
@@ -91,7 +91,7 @@ LBL_ERR:
XFREE(hmac->key);
done:
#ifdef LTC_CLEAN_STACK
- zeromem(buf, HMAC_BLOCKSIZE);
+ zeromem(buf, LTC_HMAC_BLOCKSIZE);
#endif
return err;
@@ -99,6 +99,6 @@ done:
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_init.c,v $ */
-/* $Revision: 1.5 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/hmac/hmac_memory.c b/libtomcrypt/src/mac/hmac/hmac_memory.c
index 7dc364a..9df80ea 100644
--- a/libtomcrypt/src/mac/hmac/hmac_memory.c
+++ b/libtomcrypt/src/mac/hmac/hmac_memory.c
@@ -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 hmac_memory.c
- HMAC support, process a block of memory, Tom St Denis/Dobes Vandermeer
+ LTC_HMAC support, process a block of memory, Tom St Denis/Dobes Vandermeer
*/
#ifdef LTC_HMAC
/**
- HMAC a block of memory to produce the authentication tag
+ LTC_HMAC a block of memory to produce the authentication tag
@param hash The index of the hash to use
@param key The secret key
@param keylen The length of the secret key (octets)
- @param in The data to HMAC
- @param inlen The length of the data to HMAC (octets)
+ @param in The data to LTC_HMAC
+ @param inlen The length of the data to LTC_HMAC (octets)
@param out [out] Destination of the authentication tag
@param outlen [in/out] Max size and resulting size of authentication tag
@return CRYPT_OK if successful
@@ -83,6 +83,6 @@ LBL_ERR:
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_memory.c,v $ */
-/* $Revision: 1.6 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/hmac/hmac_memory_multi.c b/libtomcrypt/src/mac/hmac/hmac_memory_multi.c
index 2382502..c3d461b 100644
--- a/libtomcrypt/src/mac/hmac/hmac_memory_multi.c
+++ b/libtomcrypt/src/mac/hmac/hmac_memory_multi.c
@@ -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 hmac_memory_multi.c
- HMAC support, process multiple blocks of memory, Tom St Denis/Dobes Vandermeer
+ LTC_HMAC support, process multiple blocks of memory, Tom St Denis/Dobes Vandermeer
*/
#ifdef LTC_HMAC
/**
- HMAC multiple blocks of memory to produce the authentication tag
+ LTC_HMAC multiple blocks of memory to produce the authentication tag
@param hash The index of the hash to use
@param key The secret key
@param keylen The length of the secret key (octets)
@param out [out] Destination of the authentication tag
@param outlen [in/out] Max size and resulting size of authentication tag
- @param in The data to HMAC
- @param inlen The length of the data to HMAC (octets)
- @param ... tuples of (data,len) pairs to HMAC, terminated with a (NULL,x) (x=don't care)
+ @param in The data to LTC_HMAC
+ @param inlen The length of the data to LTC_HMAC (octets)
+ @param ... tuples of (data,len) pairs to LTC_HMAC, terminated with a (NULL,x) (x=don't care)
@return CRYPT_OK if successful
*/
int hmac_memory_multi(int hash,
@@ -87,6 +87,6 @@ LBL_ERR:
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_memory_multi.c,v $ */
-/* $Revision: 1.5 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/hmac/hmac_process.c b/libtomcrypt/src/mac/hmac/hmac_process.c
index 04b5ee2..802de1f 100644
--- a/libtomcrypt/src/mac/hmac/hmac_process.c
+++ b/libtomcrypt/src/mac/hmac/hmac_process.c
@@ -6,22 +6,22 @@
* 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 hmac_process.c
- HMAC support, process data, Tom St Denis/Dobes Vandermeer
+ LTC_HMAC support, process data, Tom St Denis/Dobes Vandermeer
*/
#ifdef LTC_HMAC
/**
- Process data through HMAC
+ Process data through LTC_HMAC
@param hmac The hmac state
- @param in The data to send through HMAC
- @param inlen The length of the data to HMAC (octets)
+ @param in The data to send through LTC_HMAC
+ @param inlen The length of the data to LTC_HMAC (octets)
@return CRYPT_OK if successful
*/
int hmac_process(hmac_state *hmac, const unsigned char *in, unsigned long inlen)
@@ -38,6 +38,6 @@ int hmac_process(hmac_state *hmac, const unsigned char *in, unsigned long inlen)
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_process.c,v $ */
-/* $Revision: 1.5 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/hmac/hmac_test.c b/libtomcrypt/src/mac/hmac/hmac_test.c
index 4a03f87..af43da6 100644
--- a/libtomcrypt/src/mac/hmac/hmac_test.c
+++ b/libtomcrypt/src/mac/hmac/hmac_test.c
@@ -6,18 +6,18 @@
* 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 hmac_test.c
- HMAC support, self-test, Tom St Denis/Dobes Vandermeer
+ LTC_HMAC support, self-test, Tom St Denis/Dobes Vandermeer
*/
#ifdef LTC_HMAC
-#define HMAC_BLOCKSIZE hash_descriptor[hash].blocksize
+#define LTC_HMAC_BLOCKSIZE hash_descriptor[hash].blocksize
/*
TEST CASES SOURCE:
@@ -27,11 +27,11 @@ Request for Comments: 2202 IBM
Category: Informational R. Glenn
NIST
September 1997
- Test Cases for HMAC-MD5 and HMAC-SHA-1
+ Test Cases for LTC_HMAC-LTC_MD5 and LTC_HMAC-LTC_SHA-1
*/
/**
- HMAC self-test
+ LTC_HMAC self-test
@return CRYPT_OK if successful, CRYPT_NOP if tests have been disabled.
*/
int hmac_test(void)
@@ -52,7 +52,7 @@ int hmac_test(void)
unsigned char digest[MAXBLOCKSIZE];
} cases[] = {
/*
- 3. Test Cases for HMAC-SHA-1
+ 3. Test Cases for LTC_HMAC-LTC_SHA-1
test_case = 1
key = 0x0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c
@@ -118,7 +118,7 @@ int hmac_test(void)
0x6b, 0xba, 0xa7, 0x96, 0x5c, 0x78, 0x08, 0xbb, 0xff, 0x1a, 0x91} },
/*
- 2. Test Cases for HMAC-MD5
+ 2. Test Cases for LTC_HMAC-LTC_MD5
test_case = 1
key = 0x0b 0b 0b 0b
@@ -272,7 +272,7 @@ Key First"
outlen = sizeof(digest);
if((err = hmac_memory(hash, cases[i].key, cases[i].keylen, cases[i].data, cases[i].datalen, digest, &outlen)) != CRYPT_OK) {
#if 0
- printf("HMAC-%s test #%d, %s\n", cases[i].algo, cases[i].num, error_to_string(err));
+ printf("LTC_HMAC-%s test #%d, %s\n", cases[i].algo, cases[i].num, error_to_string(err));
#endif
return err;
}
@@ -281,7 +281,7 @@ Key First"
failed++;
#if 0
unsigned int j;
- printf("\nHMAC-%s test #%d:\n", cases[i].algo, cases[i].num);
+ printf("\nLTC_HMAC-%s test #%d:\n", cases[i].algo, cases[i].num);
printf( "Result: 0x");
for(j=0; j < hash_descriptor[hash].hashsize; j++) {
printf("%2x ", digest[j]);
@@ -294,7 +294,7 @@ Key First"
return CRYPT_ERROR;
#endif
} else {
- /* printf("HMAC-%s test #%d: Passed\n", cases[i].algo, cases[i].num); */
+ /* printf("LTC_HMAC-%s test #%d: Passed\n", cases[i].algo, cases[i].num); */
}
}
@@ -311,6 +311,6 @@ Key First"
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_test.c,v $ */
-/* $Revision: 1.7 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/omac/omac_done.c b/libtomcrypt/src/mac/omac/omac_done.c
index 7a0453b..796bdf9 100644
--- a/libtomcrypt/src/mac/omac/omac_done.c
+++ b/libtomcrypt/src/mac/omac/omac_done.c
@@ -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
@@ -81,6 +81,6 @@ int omac_done(omac_state *omac, unsigned char *out, unsigned long *outlen)
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_done.c,v $ */
-/* $Revision: 1.7 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/omac/omac_file.c b/libtomcrypt/src/mac/omac/omac_file.c
index 7117ae3..54871e0 100644
--- a/libtomcrypt/src/mac/omac/omac_file.c
+++ b/libtomcrypt/src/mac/omac/omac_file.c
@@ -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
@@ -78,6 +78,6 @@ int omac_file(int cipher,
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_file.c,v $ */
-/* $Revision: 1.5 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/omac/omac_init.c b/libtomcrypt/src/mac/omac/omac_init.c
index cbf26a2..36a4a3d 100644
--- a/libtomcrypt/src/mac/omac/omac_init.c
+++ b/libtomcrypt/src/mac/omac/omac_init.c
@@ -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)
@@ -96,6 +96,6 @@ int omac_init(omac_state *omac, int cipher, const unsigned char *key, unsigned l
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_init.c,v $ */
-/* $Revision: 1.10 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/omac/omac_memory.c b/libtomcrypt/src/mac/omac/omac_memory.c
index 50b2db0..c9f3392 100644
--- a/libtomcrypt/src/mac/omac/omac_memory.c
+++ b/libtomcrypt/src/mac/omac/omac_memory.c
@@ -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
@@ -80,6 +80,6 @@ LBL_ERR:
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_memory.c,v $ */
-/* $Revision: 1.6 $ */
-/* $Date: 2006/11/08 23:01:06 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/omac/omac_memory_multi.c b/libtomcrypt/src/mac/omac/omac_memory_multi.c
index 4445ca2..3db8270 100644
--- a/libtomcrypt/src/mac/omac/omac_memory_multi.c
+++ b/libtomcrypt/src/mac/omac/omac_memory_multi.c
@@ -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,
@@ -85,6 +85,6 @@ LBL_ERR:
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_memory_multi.c,v $ */
-/* $Revision: 1.5 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/omac/omac_process.c b/libtomcrypt/src/mac/omac/omac_process.c
index f4b96f5..a70b179 100644
--- a/libtomcrypt/src/mac/omac/omac_process.c
+++ b/libtomcrypt/src/mac/omac/omac_process.c
@@ -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;
}
@@ -83,6 +84,6 @@ int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen)
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_process.c,v $ */
-/* $Revision: 1.9 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/omac/omac_test.c b/libtomcrypt/src/mac/omac/omac_test.c
index 3230a8c..10f5725 100644
--- a/libtomcrypt/src/mac/omac/omac_test.c
+++ b/libtomcrypt/src/mac/omac/omac_test.c
@@ -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)
@@ -105,6 +105,6 @@ int omac_test(void)
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_test.c,v $ */
-/* $Revision: 1.6 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/pelican/pelican.c b/libtomcrypt/src/mac/pelican/pelican.c
index 734cd38..47640a3 100644
--- a/libtomcrypt/src/mac/pelican/pelican.c
+++ b/libtomcrypt/src/mac/pelican/pelican.c
@@ -6,7 +6,7 @@
* 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"
@@ -15,7 +15,7 @@
Pelican MAC, initialize state, by Tom St Denis
*/
-#ifdef PELICAN
+#ifdef LTC_PELICAN
#define ENCRYPT_ONLY
#define PELI_TAB
@@ -160,6 +160,6 @@ int pelican_done(pelican_state *pelmac, unsigned char *out)
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/pelican/pelican.c,v $ */
-/* $Revision: 1.18 $ */
-/* $Date: 2006/04/02 13:19:10 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/pelican/pelican_memory.c b/libtomcrypt/src/mac/pelican/pelican_memory.c
index 7dde843..6eabaa1 100644
--- a/libtomcrypt/src/mac/pelican/pelican_memory.c
+++ b/libtomcrypt/src/mac/pelican/pelican_memory.c
@@ -6,7 +6,7 @@
* 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"
@@ -15,7 +15,7 @@
Pelican MAC, MAC a block of memory, by Tom St Denis
*/
-#ifdef PELICAN
+#ifdef LTC_PELICAN
/**
Pelican block of memory
@@ -54,6 +54,6 @@ int pelican_memory(const unsigned char *key, unsigned long keylen,
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/pelican/pelican_memory.c,v $ */
-/* $Revision: 1.6 $ */
-/* $Date: 2006/03/31 14:15:35 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/pelican/pelican_test.c b/libtomcrypt/src/mac/pelican/pelican_test.c
index 3cff8ec..e743faa 100644
--- a/libtomcrypt/src/mac/pelican/pelican_test.c
+++ b/libtomcrypt/src/mac/pelican/pelican_test.c
@@ -6,7 +6,7 @@
* 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"
@@ -15,7 +15,7 @@
Pelican MAC, test, by Tom St Denis
*/
-#ifdef PELICAN
+#ifdef LTC_PELICAN
int pelican_test(void)
{
@@ -115,6 +115,6 @@ int pelican_test(void)
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/pelican/pelican_test.c,v $ */
-/* $Revision: 1.12 $ */
-/* $Date: 2006/11/21 00:18:23 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/pmac/pmac_done.c b/libtomcrypt/src/mac/pmac/pmac_done.c
index 005f94f..88076c6 100644
--- a/libtomcrypt/src/mac/pmac/pmac_done.c
+++ b/libtomcrypt/src/mac/pmac/pmac_done.c
@@ -6,7 +6,7 @@
* 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"
@@ -69,6 +69,6 @@ int pmac_done(pmac_state *state, unsigned char *out, unsigned long *outlen)
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_done.c,v $ */
-/* $Revision: 1.8 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/pmac/pmac_file.c b/libtomcrypt/src/mac/pmac/pmac_file.c
index f8809e8..c7a9f74 100644
--- a/libtomcrypt/src/mac/pmac/pmac_file.c
+++ b/libtomcrypt/src/mac/pmac/pmac_file.c
@@ -6,7 +6,7 @@
* 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"
@@ -79,6 +79,6 @@ int pmac_file(int cipher,
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_file.c,v $ */
-/* $Revision: 1.5 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/pmac/pmac_init.c b/libtomcrypt/src/mac/pmac/pmac_init.c
index c842160..e4cf571 100644
--- a/libtomcrypt/src/mac/pmac/pmac_init.c
+++ b/libtomcrypt/src/mac/pmac/pmac_init.c
@@ -6,7 +6,7 @@
* 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"
@@ -142,6 +142,6 @@ error:
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_init.c,v $ */
-/* $Revision: 1.7 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/pmac/pmac_memory.c b/libtomcrypt/src/mac/pmac/pmac_memory.c
index ca15e63..70b9616 100644
--- a/libtomcrypt/src/mac/pmac/pmac_memory.c
+++ b/libtomcrypt/src/mac/pmac/pmac_memory.c
@@ -6,7 +6,7 @@
* 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"
@@ -69,6 +69,6 @@ LBL_ERR:
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_memory.c,v $ */
-/* $Revision: 1.5 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/pmac/pmac_memory_multi.c b/libtomcrypt/src/mac/pmac/pmac_memory_multi.c
index 70e2398..36783d3 100644
--- a/libtomcrypt/src/mac/pmac/pmac_memory_multi.c
+++ b/libtomcrypt/src/mac/pmac/pmac_memory_multi.c
@@ -6,7 +6,7 @@
* 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>
@@ -84,6 +84,6 @@ LBL_ERR:
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_memory_multi.c,v $ */
-/* $Revision: 1.6 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/pmac/pmac_ntz.c b/libtomcrypt/src/mac/pmac/pmac_ntz.c
index 8322563..b5137da 100644
--- a/libtomcrypt/src/mac/pmac/pmac_ntz.c
+++ b/libtomcrypt/src/mac/pmac/pmac_ntz.c
@@ -6,7 +6,7 @@
* 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"
@@ -34,6 +34,6 @@ int pmac_ntz(unsigned long x)
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_ntz.c,v $ */
-/* $Revision: 1.5 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/pmac/pmac_process.c b/libtomcrypt/src/mac/pmac/pmac_process.c
index a191812..e32e65f 100644
--- a/libtomcrypt/src/mac/pmac/pmac_process.c
+++ b/libtomcrypt/src/mac/pmac/pmac_process.c
@@ -6,7 +6,7 @@
* 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"
@@ -95,6 +95,6 @@ int pmac_process(pmac_state *pmac, const unsigned char *in, unsigned long inlen)
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_process.c,v $ */
-/* $Revision: 1.8 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/pmac/pmac_shift_xor.c b/libtomcrypt/src/mac/pmac/pmac_shift_xor.c
index 694a423..122cadb 100644
--- a/libtomcrypt/src/mac/pmac/pmac_shift_xor.c
+++ b/libtomcrypt/src/mac/pmac/pmac_shift_xor.c
@@ -6,7 +6,7 @@
* 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"
@@ -39,6 +39,6 @@ void pmac_shift_xor(pmac_state *pmac)
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_shift_xor.c,v $ */
-/* $Revision: 1.6 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/pmac/pmac_test.c b/libtomcrypt/src/mac/pmac/pmac_test.c
index a635e15..5d2e42a 100644
--- a/libtomcrypt/src/mac/pmac/pmac_test.c
+++ b/libtomcrypt/src/mac/pmac/pmac_test.c
@@ -6,7 +6,7 @@
* 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"
@@ -19,7 +19,7 @@
#ifdef LTC_PMAC
/**
- Test the OMAC implementation
+ Test the LTC_OMAC implementation
@return CRYPT_OK if successful, CRYPT_NOP if testing has been disabled
*/
int pmac_test(void)
@@ -160,6 +160,6 @@ int pmac_test(void)
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_test.c,v $ */
-/* $Revision: 1.6 $ */
-/* $Date: 2006/11/03 00:39:49 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/xcbc/xcbc_done.c b/libtomcrypt/src/mac/xcbc/xcbc_done.c
index 687c24d..6640eeb 100644
--- a/libtomcrypt/src/mac/xcbc/xcbc_done.c
+++ b/libtomcrypt/src/mac/xcbc/xcbc_done.c
@@ -6,7 +6,7 @@
* 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"
@@ -71,7 +71,7 @@ int xcbc_done(xcbc_state *xcbc, unsigned char *out, unsigned long *outlen)
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/xcbc/xcbc_done.c,v $ */
-/* $Revision: 1.4 $ */
-/* $Date: 2006/11/07 03:23:46 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/xcbc/xcbc_file.c b/libtomcrypt/src/mac/xcbc/xcbc_file.c
index 4a8f7af..3d75b4e 100644
--- a/libtomcrypt/src/mac/xcbc/xcbc_file.c
+++ b/libtomcrypt/src/mac/xcbc/xcbc_file.c
@@ -6,7 +6,7 @@
* 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"
@@ -78,6 +78,6 @@ int xcbc_file(int cipher,
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/xcbc/xcbc_file.c,v $ */
-/* $Revision: 1.1 $ */
-/* $Date: 2006/11/03 01:56:41 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/xcbc/xcbc_init.c b/libtomcrypt/src/mac/xcbc/xcbc_init.c
index 3a0dcaf..94c9d79 100644
--- a/libtomcrypt/src/mac/xcbc/xcbc_init.c
+++ b/libtomcrypt/src/mac/xcbc/xcbc_init.c
@@ -6,7 +6,7 @@
* 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"
@@ -28,6 +28,7 @@ int xcbc_init(xcbc_state *xcbc, int cipher, const unsigned char *key, unsigned l
{
int x, y, err;
symmetric_key *skey;
+ unsigned long k1;
LTC_ARGCHK(xcbc != NULL);
LTC_ARGCHK(key != NULL);
@@ -43,26 +44,45 @@ int xcbc_init(xcbc_state *xcbc, int cipher, const unsigned char *key, unsigned l
}
#endif
- /* schedule the user key */
- skey = XCALLOC(1, sizeof(*skey));
- if (skey == NULL) {
- return CRYPT_MEM;
- }
+ skey = NULL;
- if ((err = cipher_descriptor[cipher].setup(key, keylen, 0, skey)) != CRYPT_OK) {
- goto done;
- }
+ /* are we in pure XCBC mode with three keys? */
+ if (keylen & LTC_XCBC_PURE) {
+ keylen &= ~LTC_XCBC_PURE;
+
+ if (keylen < 2UL*cipher_descriptor[cipher].block_length) {
+ return CRYPT_INVALID_ARG;
+ }
+
+ k1 = keylen - 2*cipher_descriptor[cipher].block_length;
+ XMEMCPY(xcbc->K[0], key, k1);
+ XMEMCPY(xcbc->K[1], key+k1, cipher_descriptor[cipher].block_length);
+ XMEMCPY(xcbc->K[2], key+k1 + cipher_descriptor[cipher].block_length, cipher_descriptor[cipher].block_length);
+ } else {
+ /* use the key expansion */
+ k1 = cipher_descriptor[cipher].block_length;
+
+ /* schedule the user key */
+ skey = XCALLOC(1, sizeof(*skey));
+ if (skey == NULL) {
+ return CRYPT_MEM;
+ }
+
+ if ((err = cipher_descriptor[cipher].setup(key, keylen, 0, skey)) != CRYPT_OK) {
+ goto done;
+ }
- /* make the three keys */
- for (y = 0; y < 3; y++) {
- for (x = 0; x < cipher_descriptor[cipher].block_length; x++) {
- xcbc->K[y][x] = y + 1;
- }
- cipher_descriptor[cipher].ecb_encrypt(xcbc->K[y], xcbc->K[y], skey);
+ /* make the three keys */
+ for (y = 0; y < 3; y++) {
+ for (x = 0; x < cipher_descriptor[cipher].block_length; x++) {
+ xcbc->K[y][x] = y + 1;
+ }
+ cipher_descriptor[cipher].ecb_encrypt(xcbc->K[y], xcbc->K[y], skey);
+ }
}
-
+
/* setup K1 */
- err = cipher_descriptor[cipher].setup(xcbc->K[0], cipher_descriptor[cipher].block_length, 0, &xcbc->key);
+ err = cipher_descriptor[cipher].setup(xcbc->K[0], k1, 0, &xcbc->key);
/* setup struct */
zeromem(xcbc->IV, cipher_descriptor[cipher].block_length);
@@ -71,16 +91,18 @@ int xcbc_init(xcbc_state *xcbc, int cipher, const unsigned char *key, unsigned l
xcbc->buflen = 0;
done:
cipher_descriptor[cipher].done(skey);
+ if (skey != NULL) {
#ifdef LTC_CLEAN_STACK
- zeromem(skey, sizeof(*skey));
+ zeromem(skey, sizeof(*skey));
#endif
- XFREE(skey);
+ XFREE(skey);
+ }
return err;
}
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/xcbc/xcbc_init.c,v $ */
-/* $Revision: 1.4 $ */
-/* $Date: 2006/11/07 03:23:46 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/xcbc/xcbc_memory.c b/libtomcrypt/src/mac/xcbc/xcbc_memory.c
index 1826b6b..124817a 100644
--- a/libtomcrypt/src/mac/xcbc/xcbc_memory.c
+++ b/libtomcrypt/src/mac/xcbc/xcbc_memory.c
@@ -6,7 +6,7 @@
* 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"
@@ -66,6 +66,6 @@ done:
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/xcbc/xcbc_memory.c,v $ */
-/* $Revision: 1.4 $ */
-/* $Date: 2006/11/21 23:02:42 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c b/libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c
index ccae9de..a237907 100644
--- a/libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c
+++ b/libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c
@@ -6,7 +6,7 @@
* 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>
@@ -85,6 +85,6 @@ LBL_ERR:
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c,v $ */
-/* $Revision: 1.1 $ */
-/* $Date: 2006/11/03 01:53:25 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/xcbc/xcbc_process.c b/libtomcrypt/src/mac/xcbc/xcbc_process.c
index 4dd63b5..46ab4a0 100644
--- a/libtomcrypt/src/mac/xcbc/xcbc_process.c
+++ b/libtomcrypt/src/mac/xcbc/xcbc_process.c
@@ -6,7 +6,7 @@
* 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"
@@ -69,7 +69,7 @@ int xcbc_process(xcbc_state *xcbc, const unsigned char *in, unsigned long inlen)
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/xcbc/xcbc_process.c,v $ */
-/* $Revision: 1.9 $ */
-/* $Date: 2006/11/09 22:43:52 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */
diff --git a/libtomcrypt/src/mac/xcbc/xcbc_test.c b/libtomcrypt/src/mac/xcbc/xcbc_test.c
index 2c56c0a..1bd5840 100644
--- a/libtomcrypt/src/mac/xcbc/xcbc_test.c
+++ b/libtomcrypt/src/mac/xcbc/xcbc_test.c
@@ -6,7 +6,7 @@
* 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"
@@ -122,7 +122,7 @@ int xcbc_test(void)
#endif
-/* $Source: /cvs/libtom/libtomcrypt/src/mac/xcbc/xcbc_test.c,v $ */
-/* $Revision: 1.5 $ */
-/* $Date: 2006/11/21 23:02:42 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */