The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/contrib/openzfs/include/sys/edonr.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * IDI,NTNU
    3  *
    4  * CDDL HEADER START
    5  *
    6  * The contents of this file are subject to the terms of the
    7  * Common Development and Distribution License (the "License").
    8  * You may not use this file except in compliance with the License.
    9  *
   10  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   11  * or http://opensource.org/licenses/CDDL-1.0.
   12  * See the License for the specific language governing permissions
   13  * and limitations under the License.
   14  *
   15  * When distributing Covered Code, include this CDDL HEADER in each
   16  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
   17  * If applicable, add the following below this CDDL HEADER, with the
   18  * fields enclosed by brackets "[]" replaced with your own identifying
   19  * information: Portions Copyright [yyyy] [name of copyright owner]
   20  *
   21  * 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 $
   28  */
   29 /*
   30  * Portions copyright (c) 2013, Saso Kiselkov, All rights reserved
   31  */
   32 
   33 #ifndef _SYS_EDONR_H_
   34 #define _SYS_EDONR_H_
   35 
   36 #ifdef  __cplusplus
   37 extern "C" {
   38 #endif
   39 
   40 #ifdef  _KERNEL
   41 #include <sys/types.h>
   42 #else
   43 #include <stdint.h> /* uint32_t... */
   44 #include <stdlib.h> /* size_t ... */
   45 #endif
   46 
   47 /*
   48  * EdonR allows to call EdonRUpdate() consecutively only if the total length
   49  * of stored unprocessed data and the new supplied data is less than or equal
   50  * to the BLOCK_SIZE on which the compression functions operates.
   51  * Otherwise an assertion failure is invoked.
   52  */
   53 
   54 /* 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
   61 #define EdonR512_DIGEST_SIZE    64
   62 #define EdonR512_BLOCK_SIZE     128
   63 
   64 #define EdonR256_BLOCK_BITSIZE  512
   65 #define EdonR512_BLOCK_BITSIZE  1024
   66 
   67 typedef struct {
   68         uint32_t DoublePipe[16];
   69         uint8_t LastPart[EdonR256_BLOCK_SIZE * 2];
   70 } EdonRData256;
   71 typedef struct {
   72         uint64_t DoublePipe[16];
   73         uint8_t LastPart[EdonR512_BLOCK_SIZE * 2];
   74 } EdonRData512;
   75 
   76 typedef struct {
   77         size_t hashbitlen;
   78 
   79         /* + algorithm specific parameters */
   80         int unprocessed_bits;
   81         uint64_t bits_processed;
   82         union {
   83                 EdonRData256 p256[1];
   84                 EdonRData512 p512[1];
   85         } pipe[1];
   86 } EdonRState;
   87 
   88 void EdonRInit(EdonRState *state, size_t hashbitlen);
   89 void EdonRUpdate(EdonRState *state, const uint8_t *data, size_t databitlen);
   90 void EdonRFinal(EdonRState *state, uint8_t *hashval);
   91 void EdonRHash(size_t hashbitlen, const uint8_t *data, size_t databitlen,
   92     uint8_t *hashval);
   93 
   94 #ifdef  __cplusplus
   95 }
   96 #endif
   97 
   98 #endif  /* _SYS_EDONR_H_ */

Cache object: 672dd6591b40e9737542c1d2f9aa5a55


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.