11/*
2- * IDI,NTNU
3- *
42 * CDDL HEADER START
53 *
64 * The contents of this file are subject to the terms of the
1917 * information: Portions Copyright [yyyy] [name of copyright owner]
2018 *
2119 * CDDL HEADER END
22- *
23- * Copyright (C) 2009, 2010, Jorn Amundsen <jorn.amundsen@ntnu.no>
24- *
25- * Tweaked Edon-R implementation for SUPERCOP, based on NIST API.
26- *
27- * $Id: edonr.h 517 2013-02-17 20:34:39Z joern $
2820 */
21+
2922/*
30- * Portions copyright (c) 2013, Saso Kiselkov, All rights reserved
23+ * Based on Edon-R implementation for SUPERCOP, based on NIST API.
24+ * Copyright (c) 2009, 2010 Jørn Amundsen <jorn.amundsen@ntnu.no>
25+ * Copyright (c) 2013 Saso Kiselkov, All rights reserved
26+ * Copyright (c) 2022 Tino Reichardt <milky-zfs@mcmilk.de>
3127 */
3228
3329#ifndef _SYS_EDONR_H_
@@ -40,8 +36,8 @@ extern "C" {
4036#ifdef _KERNEL
4137#include <sys/types.h>
4238#else
43- #include <stdint.h> /* uint32_t... */
44- #include <stdlib.h> /* size_t ... */
39+ #include <stdint.h>
40+ #include <stdlib.h>
4541#endif
4642
4743/*
@@ -52,44 +48,29 @@ extern "C" {
5248 */
5349
5450/* Specific algorithm definitions */
55- #define EdonR224_DIGEST_SIZE 28
56- #define EdonR224_BLOCK_SIZE 64
57- #define EdonR256_DIGEST_SIZE 32
58- #define EdonR256_BLOCK_SIZE 64
59- #define EdonR384_DIGEST_SIZE 48
60- #define EdonR384_BLOCK_SIZE 128
6151#define EdonR512_DIGEST_SIZE 64
6252#define EdonR512_BLOCK_SIZE 128
6353
6454#define EdonR256_BLOCK_BITSIZE 512
6555#define EdonR512_BLOCK_BITSIZE 1024
6656
67- typedef struct {
68- uint32_t DoublePipe [16 ];
69- uint8_t LastPart [EdonR256_BLOCK_SIZE * 2 ];
70- } EdonRData256 ;
7157typedef struct {
7258 uint64_t DoublePipe [16 ];
7359 uint8_t LastPart [EdonR512_BLOCK_SIZE * 2 ];
7460} EdonRData512 ;
7561
7662typedef struct {
77- size_t hashbitlen ;
78-
79- /* + algorithm specific parameters */
80- int unprocessed_bits ;
8163 uint64_t bits_processed ;
64+ int unprocessed_bits ;
8265 union {
83- EdonRData256 p256 [1 ];
8466 EdonRData512 p512 [1 ];
8567 } pipe [1 ];
8668} EdonRState ;
8769
88- void EdonRInit (EdonRState * state , size_t hashbitlen );
70+ void EdonRInit (EdonRState * state );
8971void EdonRUpdate (EdonRState * state , const uint8_t * data , size_t databitlen );
9072void EdonRFinal (EdonRState * state , uint8_t * hashval );
91- void EdonRHash (size_t hashbitlen , const uint8_t * data , size_t databitlen ,
92- uint8_t * hashval );
73+ void EdonRHash (const uint8_t * data , size_t databitlen , uint8_t * hashval );
9374
9475#ifdef __cplusplus
9576}
0 commit comments