summaryrefslogtreecommitdiffhomepage
path: root/src/mac/omac
diff options
context:
space:
mode:
Diffstat (limited to 'src/mac/omac')
-rw-r--r--src/mac/omac/omac_done.c12
-rw-r--r--src/mac/omac/omac_file.c8
-rw-r--r--src/mac/omac/omac_init.c12
-rw-r--r--src/mac/omac/omac_memory.c18
-rw-r--r--src/mac/omac/omac_memory_multi.c8
-rw-r--r--src/mac/omac/omac_process.c16
-rw-r--r--src/mac/omac/omac_test.c10
7 files changed, 51 insertions, 33 deletions
diff --git a/src/mac/omac/omac_done.c b/src/mac/omac/omac_done.c
index 37292d5..7a0453b 100644
--- a/src/mac/omac/omac_done.c
+++ b/src/mac/omac/omac_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 @@
OMAC1 support, terminate a stream, Tom St Denis
*/
-#ifdef OMAC
+#ifdef LTC_OMAC
/**
Terminate an OMAC stream
@@ -61,7 +61,9 @@ int omac_done(omac_state *omac, unsigned char *out, unsigned long *outlen)
}
/* encrypt it */
- cipher_descriptor[omac->cipher_idx].ecb_encrypt(omac->block, omac->block, &omac->key);
+ if ((err = cipher_descriptor[omac->cipher_idx].ecb_encrypt(omac->block, omac->block, &omac->key)) != CRYPT_OK) {
+ return err;
+ }
cipher_descriptor[omac->cipher_idx].done(&omac->key);
/* output it */
@@ -80,5 +82,5 @@ int omac_done(omac_state *omac, unsigned char *out, unsigned long *outlen)
/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_done.c,v $ */
-/* $Revision: 1.4 $ */
-/* $Date: 2005/05/05 14:35:58 $ */
+/* $Revision: 1.7 $ */
+/* $Date: 2006/11/03 00:39:49 $ */
diff --git a/src/mac/omac/omac_file.c b/src/mac/omac/omac_file.c
index 63784b0..7117ae3 100644
--- a/src/mac/omac/omac_file.c
+++ b/src/mac/omac/omac_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 @@
OMAC1 support, process a file, Tom St Denis
*/
-#ifdef OMAC
+#ifdef LTC_OMAC
/**
OMAC a file
@@ -79,5 +79,5 @@ int omac_file(int cipher,
#endif
/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_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/src/mac/omac/omac_init.c b/src/mac/omac/omac_init.c
index 8866772..cbf26a2 100644
--- a/src/mac/omac/omac_init.c
+++ b/src/mac/omac/omac_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"
@@ -16,7 +16,7 @@
*/
-#ifdef OMAC
+#ifdef LTC_OMAC
/**
Initialize an OMAC state
@@ -63,7 +63,9 @@ int omac_init(omac_state *omac, int cipher, const unsigned char *key, unsigned l
/* first calc L which is Ek(0) */
zeromem(omac->Lu[0], cipher_descriptor[cipher].block_length);
- cipher_descriptor[cipher].ecb_encrypt(omac->Lu[0], omac->Lu[0], &omac->key);
+ if ((err = cipher_descriptor[cipher].ecb_encrypt(omac->Lu[0], omac->Lu[0], &omac->key)) != CRYPT_OK) {
+ return err;
+ }
/* now do the mults, whoopy! */
for (x = 0; x < 2; x++) {
@@ -95,5 +97,5 @@ 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.5 $ */
-/* $Date: 2005/06/06 10:22:44 $ */
+/* $Revision: 1.10 $ */
+/* $Date: 2006/11/03 00:39:49 $ */
diff --git a/src/mac/omac/omac_memory.c b/src/mac/omac/omac_memory.c
index 3b1521c..50b2db0 100644
--- a/src/mac/omac/omac_memory.c
+++ b/src/mac/omac/omac_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 @@
OMAC1 support, process a block of memory, Tom St Denis
*/
-#ifdef OMAC
+#ifdef LTC_OMAC
/**
OMAC a block of memory
@@ -41,6 +41,16 @@ int omac_memory(int cipher,
LTC_ARGCHK(out != NULL);
LTC_ARGCHK(outlen != NULL);
+ /* is the cipher valid? */
+ if ((err = cipher_is_valid(cipher)) != CRYPT_OK) {
+ return err;
+ }
+
+ /* Use accelerator if found */
+ if (cipher_descriptor[cipher].omac_memory != NULL) {
+ return cipher_descriptor[cipher].omac_memory(key, keylen, in, inlen, out, outlen);
+ }
+
/* allocate ram for omac state */
omac = XMALLOC(sizeof(omac_state));
if (omac == NULL) {
@@ -71,5 +81,5 @@ LBL_ERR:
#endif
/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_memory.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2005/05/05 14:35:58 $ */
+/* $Revision: 1.6 $ */
+/* $Date: 2006/11/08 23:01:06 $ */
diff --git a/src/mac/omac/omac_memory_multi.c b/src/mac/omac/omac_memory_multi.c
index 52f7323..4445ca2 100644
--- a/src/mac/omac/omac_memory_multi.c
+++ b/src/mac/omac/omac_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 @@
OMAC1 support, process multiple blocks of memory, Tom St Denis
*/
-#ifdef OMAC
+#ifdef LTC_OMAC
/**
OMAC multiple blocks of memory
@@ -86,5 +86,5 @@ LBL_ERR:
#endif
/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_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/src/mac/omac/omac_process.c b/src/mac/omac/omac_process.c
index ca3ec6b..f4b96f5 100644
--- a/src/mac/omac/omac_process.c
+++ b/src/mac/omac/omac_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"
@@ -16,7 +16,7 @@
*/
-#ifdef OMAC
+#ifdef LTC_OMAC
/**
Process data through OMAC
@@ -49,7 +49,9 @@ int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen)
*((LTC_FAST_TYPE*)(&omac->prev[y])) ^= *((LTC_FAST_TYPE*)(&in[y]));
}
in += 16;
- cipher_descriptor[omac->cipher_idx].ecb_encrypt(omac->prev, omac->prev, &omac->key);
+ if ((err = cipher_descriptor[omac->cipher_idx].ecb_encrypt(omac->prev, omac->prev, &omac->key)) != CRYPT_OK) {
+ return err;
+ }
}
inlen -= x;
}
@@ -61,7 +63,9 @@ int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen)
for (x = 0; x < (unsigned long)omac->blklen; x++) {
omac->block[x] ^= omac->prev[x];
}
- cipher_descriptor[omac->cipher_idx].ecb_encrypt(omac->block, omac->prev, &omac->key);
+ if ((err = cipher_descriptor[omac->cipher_idx].ecb_encrypt(omac->block, omac->prev, &omac->key)) != CRYPT_OK) {
+ return err;
+ }
omac->buflen = 0;
}
@@ -80,5 +84,5 @@ int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen)
/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_process.c,v $ */
-/* $Revision: 1.6 $ */
-/* $Date: 2005/05/05 14:35:58 $ */
+/* $Revision: 1.9 $ */
+/* $Date: 2006/11/03 00:39:49 $ */
diff --git a/src/mac/omac/omac_test.c b/src/mac/omac/omac_test.c
index 1bc9ead..3230a8c 100644
--- a/src/mac/omac/omac_test.c
+++ b/src/mac/omac/omac_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 @@
OMAC1 support, self-test, by Tom St Denis
*/
-#ifdef OMAC
+#ifdef LTC_OMAC
/**
Test the OMAC setup
@@ -90,7 +90,7 @@ int omac_test(void)
return err;
}
- if (memcmp(out, tests[x].tag, 16) != 0) {
+ if (XMEMCMP(out, tests[x].tag, 16) != 0) {
#if 0
int y;
printf("\n\nTag: ");
@@ -106,5 +106,5 @@ int omac_test(void)
#endif
/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_test.c,v $ */
-/* $Revision: 1.3 $ */
-/* $Date: 2005/05/05 14:35:59 $ */
+/* $Revision: 1.6 $ */
+/* $Date: 2006/11/03 00:39:49 $ */