Commit eda062bf authored by bernd's avatar bernd
Browse files

Added Keccak reference stuff, to be built as library

parent aa326ab9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
#define	cKeccakR							1088
#define cKeccakFixedOutputLengthInBytes		32
+15 −0
Original line number Diff line number Diff line
/*
The Keccak sponge function, designed by Guido Bertoni, Joan Daemen,
Michaël Peeters and Gilles Van Assche. For more information, feedback or
questions, please refer to our website: http://keccak.noekeon.org/

Implementation by Ronny Van Keer,
hereby denoted as "the implementer".

To the extent possible under law, the implementer has waived all copyright
and related or neighboring rights to the source code in this file.
http://creativecommons.org/publicdomain/zero/1.0/
*/

const void * xorBytes( void* dest, const void* src, unsigned char n );
const void * xorLanes( void* dest, const void* src, unsigned char n );

keccak/Keccak-avr8.h

0 → 100644
+25 −0
Original line number Diff line number Diff line
/*
The Keccak sponge function, designed by Guido Bertoni, Joan Daemen,
Michaël Peeters and Gilles Van Assche. For more information, feedback or
questions, please refer to our website: http://keccak.noekeon.org/

Implementation by Ronny Van Keer, hereby denoted as "the implementer".

To the extent possible under law, the implementer has waived all copyright
and related or neighboring rights to the source code in this file.
http://creativecommons.org/publicdomain/zero/1.0/
*/

#ifndef _Keccak_AVR_h_
#define _Keccak_AVR_h_

#include "Keccak-avr8-settings.h"

#ifndef cKeccakB
/*	Only Keccak-F1600 is supported	*/
#define	cKeccakB	1600
#endif

int crypto_hash( unsigned char *out, const unsigned char *in, unsigned long long inlen );

#endif
+3 −0
Original line number Diff line number Diff line
#define cKeccakB    800
#define cKeccakR    512
//#define cKeccakFixedOutputLengthInBytes 64
+50 −0
Original line number Diff line number Diff line
/*
The Keccak sponge function, designed by Guido Bertoni, Joan Daemen,
Michaël Peeters and Gilles Van Assche. For more information, feedback or
questions, please refer to our website: http://keccak.noekeon.org/

Implementation by Ronny Van Keer,
hereby denoted as "the implementer".

To the extent possible under law, the implementer has waived all copyright
and related or neighboring rights to the source code in this file.
http://creativecommons.org/publicdomain/zero/1.0/
*/

#ifndef _Keccak_compact_h_
#define _Keccak_compact_h_

#include "Keccak-compact-settings.h"

int crypto_hash( unsigned char *out, const unsigned char *in, unsigned long long inlen );

/*
** API with message queue (inspired from NIST's API)
*/

typedef unsigned char BitSequence;
typedef unsigned long long DataLength;
typedef enum { SUCCESS = 0, FAIL = 1, BAD_HASHLEN = 2 } HashReturn;

#if defined(__GNUC__)
#define ALIGN __attribute__ ((aligned(32)))
#elif defined(_MSC_VER)
#define ALIGN __declspec(align(32))
#else
#define ALIGN
#endif

ALIGN typedef struct hashStateStruct 
{
	ALIGN unsigned char state[cKeccakB / 8];
	int bitsInQueue;
} hashState;


HashReturn Init(hashState *state);

HashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen);

HashReturn Final(hashState *state, BitSequence *hashval, int hashbytelen);

#endif
Loading