tiger.c File Reference

Tiger hash function. More...

#include "core/crypto.h"
#include "hash/tiger.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL
 
#define ROUND(a, b, c, x, mul)
 
#define KEY_SCHEDULE(x)
 

Functions

error_t tigerCompute (const void *data, size_t length, uint8_t *digest)
 Digest a message using Tiger. More...
 
void tigerInit (TigerContext *context)
 Initialize Tiger message digest context. More...
 
void tigerUpdate (TigerContext *context, const void *data, size_t length)
 Update the Tiger context with a portion of the message being hashed. More...
 
void tigerFinal (TigerContext *context, uint8_t *digest)
 Finish the Tiger message digest. More...
 
void tigerProcessBlock (TigerContext *context)
 Process message in 16-word blocks. More...
 

Variables

const uint8_t tigerOid [9] = {0x2B, 0x06, 0x01, 0x04, 0x01, 0xDA, 0x47, 0x0C, 0x02}
 
const HashAlgo tigerHashAlgo
 

Detailed Description

Tiger hash function.

License

Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneCrypto Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
1.9.0

Definition in file tiger.c.

Macro Definition Documentation

◆ KEY_SCHEDULE

#define KEY_SCHEDULE (   x)
Value:
{ \
x[0] -= x[7] ^ 0xA5A5A5A5A5A5A5A5; \
x[1] ^= x[0]; \
x[2] += x[1]; \
x[3] -= x[2] ^ ((~x[1]) << 19); \
x[4] ^= x[3]; \
x[5] += x[4]; \
x[6] -= x[5] ^ ((~x[4]) >> 23); \
x[7] ^= x[6]; \
x[0] += x[7]; \
x[1] -= x[0] ^ ((~x[7]) << 19); \
x[2] ^= x[1]; \
x[3] += x[2]; \
x[4] -= x[3] ^ ((~x[2]) >> 23); \
x[5] ^= x[4]; \
x[6] += x[5]; \
x[7] -= x[6] ^ 0x0123456789ABCDEF; \
}

Definition at line 49 of file tiger.c.

◆ ROUND

#define ROUND (   a,
  b,
  c,
  x,
  mul 
)
Value:
{ \
c ^= x; \
a -= t1[c & 0xFF] ^ t2[(c >> 16) & 0xFF] ^ t3[(c >> 32) & 0xFF] ^ t4[(c >> 48) & 0xFF]; \
b += t4[(c >> 8) & 0xFF] ^ t3[(c >> 24) & 0xFF] ^ t2[(c >> 40) & 0xFF] ^ t1[(c >> 56) & 0xFF]; \
b *= mul; \
}
uint8_t c
Definition: ndp.h:510
uint32_t t2
uint32_t t1

Definition at line 40 of file tiger.c.

◆ TRACE_LEVEL

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL

Definition at line 30 of file tiger.c.

Function Documentation

◆ tigerCompute()

error_t tigerCompute ( const void *  data,
size_t  length,
uint8_t *  digest 
)

Digest a message using Tiger.

Parameters
[in]dataPointer to the message being hashed
[in]lengthLength of the message
[out]digestPointer to the calculated digest
Returns
Error code

Definition at line 381 of file tiger.c.

◆ tigerFinal()

void tigerFinal ( TigerContext context,
uint8_t *  digest 
)

Finish the Tiger message digest.

Parameters
[in]contextPointer to the Tiger context
[out]digestCalculated digest (optional parameter)

Definition at line 468 of file tiger.c.

◆ tigerInit()

void tigerInit ( TigerContext context)

Initialize Tiger message digest context.

Parameters
[in]contextPointer to the Tiger context to initialize

Definition at line 408 of file tiger.c.

◆ tigerProcessBlock()

void tigerProcessBlock ( TigerContext context)

Process message in 16-word blocks.

Parameters
[in]contextPointer to the Tiger context

Definition at line 507 of file tiger.c.

◆ tigerUpdate()

void tigerUpdate ( TigerContext context,
const void *  data,
size_t  length 
)

Update the Tiger context with a portion of the message being hashed.

Parameters
[in]contextPointer to the Tiger context
[in]dataPointer to the buffer being hashed
[in]lengthLength of the buffer

Definition at line 429 of file tiger.c.

Variable Documentation

◆ tigerHashAlgo

const HashAlgo tigerHashAlgo
Initial value:
=
{
"TIGER",
sizeof(tigerOid),
sizeof(TigerContext),
}
void tigerInit(TigerContext *context)
Initialize Tiger message digest context.
Definition: tiger.c:408
#define TIGER_DIGEST_SIZE
Definition: tiger.h:38
error_t(* HashAlgoCompute)(const void *data, size_t length, uint8_t *digest)
Definition: crypto.h:1020
void(* HashAlgoInit)(void *context)
Definition: crypto.h:1021
void(* HashAlgoUpdate)(void *context, const void *data, size_t length)
Definition: crypto.h:1022
error_t tigerCompute(const void *data, size_t length, uint8_t *digest)
Digest a message using Tiger.
Definition: tiger.c:381
Tiger algorithm context.
Definition: tiger.h:54
#define TIGER_BLOCK_SIZE
Definition: tiger.h:36
const uint8_t tigerOid[9]
Definition: tiger.c:355
void tigerFinal(TigerContext *context, uint8_t *digest)
Finish the Tiger message digest.
Definition: tiger.c:468
void tigerUpdate(TigerContext *context, const void *data, size_t length)
Update the Tiger context with a portion of the message being hashed.
Definition: tiger.c:429
void(* HashAlgoFinal)(void *context, uint8_t *digest)
Definition: crypto.h:1023

Definition at line 358 of file tiger.c.

◆ tigerOid

const uint8_t tigerOid[9] = {0x2B, 0x06, 0x01, 0x04, 0x01, 0xDA, 0x47, 0x0C, 0x02}

Definition at line 355 of file tiger.c.