diff options
author | Matt Johnston <matt@ucc.asn.au> | 2007-01-11 02:41:05 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2007-01-11 02:41:05 +0000 |
commit | a938f4cfe140e8561d9dbf108b896492a662a893 (patch) | |
tree | f2a74322f959ff6a505ba5e87274ebe3d17d5e74 /libtomcrypt/src/mac/omac | |
parent | 692d737a821c5e401c227d936b8f0d76b955650f (diff) | |
parent | 28ad393b008b34bc3cdbaa192440b8cc615329f0 (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/omac')
-rw-r--r-- | libtomcrypt/src/mac/omac/omac_done.c | 12 | ||||
-rw-r--r-- | libtomcrypt/src/mac/omac/omac_file.c | 8 | ||||
-rw-r--r-- | libtomcrypt/src/mac/omac/omac_init.c | 12 | ||||
-rw-r--r-- | libtomcrypt/src/mac/omac/omac_memory.c | 18 | ||||
-rw-r--r-- | libtomcrypt/src/mac/omac/omac_memory_multi.c | 8 | ||||
-rw-r--r-- | libtomcrypt/src/mac/omac/omac_process.c | 16 | ||||
-rw-r--r-- | libtomcrypt/src/mac/omac/omac_test.c | 10 |
7 files changed, 51 insertions, 33 deletions
diff --git a/libtomcrypt/src/mac/omac/omac_done.c b/libtomcrypt/src/mac/omac/omac_done.c index 37292d5..7a0453b 100644 --- a/libtomcrypt/src/mac/omac/omac_done.c +++ b/libtomcrypt/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/libtomcrypt/src/mac/omac/omac_file.c b/libtomcrypt/src/mac/omac/omac_file.c index 63784b0..7117ae3 100644 --- a/libtomcrypt/src/mac/omac/omac_file.c +++ b/libtomcrypt/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/libtomcrypt/src/mac/omac/omac_init.c b/libtomcrypt/src/mac/omac/omac_init.c index 8866772..cbf26a2 100644 --- a/libtomcrypt/src/mac/omac/omac_init.c +++ b/libtomcrypt/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/libtomcrypt/src/mac/omac/omac_memory.c b/libtomcrypt/src/mac/omac/omac_memory.c index 3b1521c..50b2db0 100644 --- a/libtomcrypt/src/mac/omac/omac_memory.c +++ b/libtomcrypt/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/libtomcrypt/src/mac/omac/omac_memory_multi.c b/libtomcrypt/src/mac/omac/omac_memory_multi.c index 52f7323..4445ca2 100644 --- a/libtomcrypt/src/mac/omac/omac_memory_multi.c +++ b/libtomcrypt/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/libtomcrypt/src/mac/omac/omac_process.c b/libtomcrypt/src/mac/omac/omac_process.c index ca3ec6b..f4b96f5 100644 --- a/libtomcrypt/src/mac/omac/omac_process.c +++ b/libtomcrypt/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/libtomcrypt/src/mac/omac/omac_test.c b/libtomcrypt/src/mac/omac/omac_test.c index 1bc9ead..3230a8c 100644 --- a/libtomcrypt/src/mac/omac/omac_test.c +++ b/libtomcrypt/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 $ */ |