summaryrefslogtreecommitdiffhomepage
path: root/libtomcrypt/src/mac/hmac
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2007-01-11 02:41:05 +0000
committerMatt Johnston <matt@ucc.asn.au>2007-01-11 02:41:05 +0000
commita938f4cfe140e8561d9dbf108b896492a662a893 (patch)
treef2a74322f959ff6a505ba5e87274ebe3d17d5e74 /libtomcrypt/src/mac/hmac
parent692d737a821c5e401c227d936b8f0d76b955650f (diff)
parent28ad393b008b34bc3cdbaa192440b8cc615329f0 (diff)
propagate from branch 'au.asn.ucc.matt.ltc.dropbear' (head 2af22fb4e878750b88f80f90d439b316d229796f)
to branch 'au.asn.ucc.matt.dropbear' (head 02c413252c90e9de8e03d91e9939dde3029f5c0a) --HG-- extra : convert_revision : 52ccb0ad0587a62bc64aecb939adbb76546aac16
Diffstat (limited to 'libtomcrypt/src/mac/hmac')
-rw-r--r--libtomcrypt/src/mac/hmac/hmac_done.c8
-rw-r--r--libtomcrypt/src/mac/hmac/hmac_file.c8
-rw-r--r--libtomcrypt/src/mac/hmac/hmac_init.c8
-rw-r--r--libtomcrypt/src/mac/hmac/hmac_memory.c23
-rw-r--r--libtomcrypt/src/mac/hmac/hmac_memory_multi.c8
-rw-r--r--libtomcrypt/src/mac/hmac/hmac_process.c8
-rw-r--r--libtomcrypt/src/mac/hmac/hmac_test.c12
7 files changed, 43 insertions, 32 deletions
diff --git a/libtomcrypt/src/mac/hmac/hmac_done.c b/libtomcrypt/src/mac/hmac/hmac_done.c
index f64d044..5ba541a 100644
--- a/libtomcrypt/src/mac/hmac/hmac_done.c
+++ b/libtomcrypt/src/mac/hmac/hmac_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.org
+ * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
*/
#include "tomcrypt.h"
@@ -15,7 +15,7 @@
HMAC support, terminate stream, Tom St Denis/Dobes Vandermeer
*/
-#ifdef HMAC
+#ifdef LTC_HMAC
#define HMAC_BLOCKSIZE hash_descriptor[hash].blocksize
@@ -105,5 +105,5 @@ LBL_ERR:
#endif
/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_done.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2005/05/05 14:35:58 $ */
+/* $Revision: 1.5 $ */
+/* $Date: 2006/11/03 00:39:49 $ */
diff --git a/libtomcrypt/src/mac/hmac/hmac_file.c b/libtomcrypt/src/mac/hmac/hmac_file.c
index f88d692..b296320 100644
--- a/libtomcrypt/src/mac/hmac/hmac_file.c
+++ b/libtomcrypt/src/mac/hmac/hmac_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.org
+ * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
*/
#include "tomcrypt.h"
@@ -15,7 +15,7 @@
HMAC support, process a file, Tom St Denis/Dobes Vandermeer
*/
-#ifdef HMAC
+#ifdef LTC_HMAC
/**
HMAC a file
@@ -89,5 +89,5 @@ int hmac_file(int hash, const char *fname,
/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_file.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2005/05/05 14:35:58 $ */
+/* $Revision: 1.5 $ */
+/* $Date: 2006/11/03 00:39:49 $ */
diff --git a/libtomcrypt/src/mac/hmac/hmac_init.c b/libtomcrypt/src/mac/hmac/hmac_init.c
index e64d47f..2d61a9a 100644
--- a/libtomcrypt/src/mac/hmac/hmac_init.c
+++ b/libtomcrypt/src/mac/hmac/hmac_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.org
+ * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
*/
#include "tomcrypt.h"
@@ -15,7 +15,7 @@
HMAC support, initialize state, Tom St Denis/Dobes Vandermeer
*/
-#ifdef HMAC
+#ifdef LTC_HMAC
#define HMAC_BLOCKSIZE hash_descriptor[hash].blocksize
@@ -108,5 +108,5 @@ done:
#endif
/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_init.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2005/05/05 14:35:58 $ */
+/* $Revision: 1.5 $ */
+/* $Date: 2006/11/03 00:39:49 $ */
diff --git a/libtomcrypt/src/mac/hmac/hmac_memory.c b/libtomcrypt/src/mac/hmac/hmac_memory.c
index 99959f4..7dc364a 100644
--- a/libtomcrypt/src/mac/hmac/hmac_memory.c
+++ b/libtomcrypt/src/mac/hmac/hmac_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.org
+ * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
*/
#include "tomcrypt.h"
@@ -15,7 +15,7 @@
HMAC support, process a block of memory, Tom St Denis/Dobes Vandermeer
*/
-#ifdef HMAC
+#ifdef LTC_HMAC
/**
HMAC a block of memory to produce the authentication tag
@@ -34,13 +34,24 @@ int hmac_memory(int hash,
unsigned char *out, unsigned long *outlen)
{
hmac_state *hmac;
- int err;
+ int err;
LTC_ARGCHK(key != NULL);
- LTC_ARGCHK(in != NULL);
+ LTC_ARGCHK(in != NULL);
LTC_ARGCHK(out != NULL);
LTC_ARGCHK(outlen != NULL);
+ /* make sure hash descriptor is valid */
+ if ((err = hash_is_valid(hash)) != CRYPT_OK) {
+ return err;
+ }
+
+ /* is there a descriptor? */
+ if (hash_descriptor[hash].hmac_block != NULL) {
+ return hash_descriptor[hash].hmac_block(key, keylen, in, inlen, out, outlen);
+ }
+
+ /* nope, so call the hmac functions */
/* allocate ram for hmac state */
hmac = XMALLOC(sizeof(hmac_state));
if (hmac == NULL) {
@@ -73,5 +84,5 @@ LBL_ERR:
/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_memory.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2005/05/05 14:35:58 $ */
+/* $Revision: 1.6 $ */
+/* $Date: 2006/11/03 00:39:49 $ */
diff --git a/libtomcrypt/src/mac/hmac/hmac_memory_multi.c b/libtomcrypt/src/mac/hmac/hmac_memory_multi.c
index b7a6d96..2382502 100644
--- a/libtomcrypt/src/mac/hmac/hmac_memory_multi.c
+++ b/libtomcrypt/src/mac/hmac/hmac_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.org
+ * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
*/
#include "tomcrypt.h"
#include <stdarg.h>
@@ -16,7 +16,7 @@
HMAC support, process multiple blocks of memory, Tom St Denis/Dobes Vandermeer
*/
-#ifdef HMAC
+#ifdef LTC_HMAC
/**
HMAC multiple blocks of memory to produce the authentication tag
@@ -88,5 +88,5 @@ LBL_ERR:
/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_memory_multi.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2005/05/05 14:35:58 $ */
+/* $Revision: 1.5 $ */
+/* $Date: 2006/11/03 00:39:49 $ */
diff --git a/libtomcrypt/src/mac/hmac/hmac_process.c b/libtomcrypt/src/mac/hmac/hmac_process.c
index 2919282..04b5ee2 100644
--- a/libtomcrypt/src/mac/hmac/hmac_process.c
+++ b/libtomcrypt/src/mac/hmac/hmac_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.org
+ * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
*/
#include "tomcrypt.h"
@@ -15,7 +15,7 @@
HMAC support, process data, Tom St Denis/Dobes Vandermeer
*/
-#ifdef HMAC
+#ifdef LTC_HMAC
/**
Process data through HMAC
@@ -39,5 +39,5 @@ int hmac_process(hmac_state *hmac, const unsigned char *in, unsigned long inlen)
/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_process.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2005/05/05 14:35:58 $ */
+/* $Revision: 1.5 $ */
+/* $Date: 2006/11/03 00:39:49 $ */
diff --git a/libtomcrypt/src/mac/hmac/hmac_test.c b/libtomcrypt/src/mac/hmac/hmac_test.c
index 87758f5..4a03f87 100644
--- a/libtomcrypt/src/mac/hmac/hmac_test.c
+++ b/libtomcrypt/src/mac/hmac/hmac_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.org
+ * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
*/
#include "tomcrypt.h"
@@ -15,7 +15,7 @@
HMAC support, self-test, Tom St Denis/Dobes Vandermeer
*/
-#ifdef HMAC
+#ifdef LTC_HMAC
#define HMAC_BLOCKSIZE hash_descriptor[hash].blocksize
@@ -55,7 +55,7 @@ int hmac_test(void)
3. Test Cases for HMAC-SHA-1
test_case = 1
- key = 0x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
+ key = 0x0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c
key_len = 20
data = "Hi Ther 20
digest = 0x4c1a03424b55e07fe7f27be1d58bb9324a9a5a04
@@ -277,7 +277,7 @@ Key First"
return err;
}
- if(memcmp(digest, cases[i].digest, (size_t)hash_descriptor[hash].hashsize) != 0) {
+ if(XMEMCMP(digest, cases[i].digest, (size_t)hash_descriptor[hash].hashsize) != 0) {
failed++;
#if 0
unsigned int j;
@@ -312,5 +312,5 @@ Key First"
/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_test.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2005/05/05 14:35:58 $ */
+/* $Revision: 1.7 $ */
+/* $Date: 2006/11/03 00:39:49 $ */