summaryrefslogtreecommitdiffhomepage
path: root/libtomcrypt/src/mac/pelican/pelican.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2018-02-17 19:29:51 +0800
committerMatt Johnston <matt@ucc.asn.au>2018-02-17 19:29:51 +0800
commit7e8094d53a1c01ac671156ff2e67157b64d01a3a (patch)
treec88345f5bdd118eb9414dff5ab5c307bb1806c57 /libtomcrypt/src/mac/pelican/pelican.c
parentf7a664f127d3dfde0e7c7a9ca74b1d14f9a2f983 (diff)
parentf042eb41ab0d31f8ba0c5ccc9c848ad01f08f986 (diff)
merge from main
--HG-- branch : fuzz
Diffstat (limited to 'libtomcrypt/src/mac/pelican/pelican.c')
-rw-r--r--libtomcrypt/src/mac/pelican/pelican.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/libtomcrypt/src/mac/pelican/pelican.c b/libtomcrypt/src/mac/pelican/pelican.c
index 47640a3..6a4dde6 100644
--- a/libtomcrypt/src/mac/pelican/pelican.c
+++ b/libtomcrypt/src/mac/pelican/pelican.c
@@ -5,18 +5,17 @@
*
* The library is free for all purposes without any express
* guarantee it works.
- *
- * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
*/
#include "tomcrypt.h"
-/**
+/**
@file pelican.c
- Pelican MAC, initialize state, by Tom St Denis
+ Pelican MAC, initialize state, by Tom St Denis
*/
#ifdef LTC_PELICAN
+#define __LTC_AES_TAB_C__
#define ENCRYPT_ONLY
#define PELI_TAB
#include "../../ciphers/aes/aes_tab.c"
@@ -24,14 +23,14 @@
/**
Initialize a Pelican state
@param pelmac The Pelican state to initialize
- @param key The secret key
+ @param key The secret key
@param keylen The length of the secret key (octets)
@return CRYPT_OK if successful
*/
int pelican_init(pelican_state *pelmac, const unsigned char *key, unsigned long keylen)
{
int err;
-
+
LTC_ARGCHK(pelmac != NULL);
LTC_ARGCHK(key != NULL);
@@ -49,10 +48,10 @@ int pelican_init(pelican_state *pelmac, const unsigned char *key, unsigned long
aes_ecb_encrypt(pelmac->state, pelmac->state, &pelmac->K);
pelmac->buflen = 0;
- return CRYPT_OK;
+ return CRYPT_OK;
}
-static void four_rounds(pelican_state *pelmac)
+static void _four_rounds(pelican_state *pelmac)
{
ulong32 s0, s1, s2, s3, t0, t1, t2, t3;
int r;
@@ -90,7 +89,7 @@ static void four_rounds(pelican_state *pelmac)
STORE32H(s3, pelmac->state + 12);
}
-/**
+/**
Process a block of text through Pelican
@param pelmac The Pelican MAC state
@param in The input
@@ -113,9 +112,9 @@ int pelican_process(pelican_state *pelmac, const unsigned char *in, unsigned lon
while (inlen & ~15) {
int x;
for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) {
- *((LTC_FAST_TYPE*)((unsigned char *)pelmac->state + x)) ^= *((LTC_FAST_TYPE*)((unsigned char *)in + x));
+ *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)pelmac->state + x)) ^= *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)in + x));
}
- four_rounds(pelmac);
+ _four_rounds(pelmac);
in += 16;
inlen -= 16;
}
@@ -125,7 +124,7 @@ int pelican_process(pelican_state *pelmac, const unsigned char *in, unsigned lon
while (inlen--) {
pelmac->state[pelmac->buflen++] ^= *in++;
if (pelmac->buflen == 16) {
- four_rounds(pelmac);
+ _four_rounds(pelmac);
pelmac->buflen = 0;
}
}
@@ -149,17 +148,17 @@ int pelican_done(pelican_state *pelmac, unsigned char *out)
}
if (pelmac->buflen == 16) {
- four_rounds(pelmac);
+ _four_rounds(pelmac);
pelmac->buflen = 0;
}
pelmac->state[pelmac->buflen++] ^= 0x80;
aes_ecb_encrypt(pelmac->state, out, &pelmac->K);
aes_done(&pelmac->K);
return CRYPT_OK;
-}
+}
#endif
-/* $Source$ */
-/* $Revision$ */
-/* $Date$ */
+/* ref: $Format:%D$ */
+/* git commit: $Format:%H$ */
+/* commit time: $Format:%ai$ */