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 TIGER_OID [9] = {0x2B, 0x06, 0x01, 0x04, 0x01, 0xDA, 0x47, 0x0C, 0x02}
 
const HashAlgo tigerHashAlgo
 

Detailed Description

Tiger hash function.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 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
2.4.4

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 51 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; \
}

Definition at line 42 of file tiger.c.

◆ TRACE_LEVEL

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL

Definition at line 32 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 386 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 491 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 431 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 538 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 452 of file tiger.c.

Variable Documentation

◆ TIGER_OID

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

Definition at line 357 of file tiger.c.

◆ tigerHashAlgo

const HashAlgo tigerHashAlgo
void(* HashAlgoInit)(void *context)
Definition: crypto.h:991
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:452
uint8_t x
Definition: lldp_ext_med.h:211
const uint8_t TIGER_OID[9]
Definition: tiger.c:357
void(* HashAlgoUpdate)(void *context, const void *data, size_t length)
Definition: crypto.h:993
#define FALSE
Definition: os_port.h:46
#define TIGER_MIN_PAD_SIZE
Definition: tiger.h:42
uint32_t t2
Tiger algorithm context.
Definition: tiger.h:57
void(* HashAlgoFinal)(void *context, uint8_t *digest)
Definition: crypto.h:995
uint32_t t1
#define TIGER_BLOCK_SIZE
Definition: tiger.h:38
void tigerFinal(TigerContext *context, uint8_t *digest)
Finish the Tiger message digest.
Definition: tiger.c:491
#define TIGER_DIGEST_SIZE
Definition: tiger.h:40
error_t tigerCompute(const void *data, size_t length, uint8_t *digest)
Digest a message using Tiger.
Definition: tiger.c:386
error_t(* HashAlgoCompute)(const void *data, size_t length, uint8_t *digest)
Definition: crypto.h:988
void tigerInit(TigerContext *context)
Initialize Tiger message digest context.
Definition: tiger.c:431
uint8_t c
Definition: ndp.h:514