Annotation of embedaddon/strongswan/src/libstrongswan/plugins/sha3/sha3_keccak.h, revision 1.1
1.1 ! misho 1: /*
! 2: * Copyright (C) 2016 Andreas Steffen
! 3: * HSR Hochschule fuer Technik Rapperswil
! 4: *
! 5: * This program is free software; you can redistribute it and/or modify it
! 6: * under the terms of the GNU General Public License as published by the
! 7: * Free Software Foundation; either version 2 of the License, or (at your
! 8: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
! 9: *
! 10: * This program is distributed in the hope that it will be useful, but
! 11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
! 12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
! 13: * for more details.
! 14: n */
! 15:
! 16: /**
! 17: * @defgroup sha3_keccak sha3_keccak
! 18: * @{ @ingroup sha3_p
! 19: */
! 20:
! 21: #ifndef SHA3_KECCAK_H_
! 22: #define SHA3_KECCAK_H_
! 23:
! 24: typedef struct sha3_keccak_t sha3_keccak_t;
! 25:
! 26: #include <crypto/hashers/hasher.h>
! 27:
! 28: /**
! 29: * Implements the Keccak-f[1600] sponge function as defined by FIPS-202.
! 30: */
! 31: struct sha3_keccak_t {
! 32:
! 33: /**
! 34: * Get the available rate in bytes
! 35: *
! 36: * @return rate in bytes
! 37: */
! 38: u_int (*get_rate)(sha3_keccak_t *this);
! 39:
! 40: /**
! 41: * Resets the internal Keccak state
! 42: */
! 43: void (*reset)(sha3_keccak_t *this);
! 44:
! 45: /**
! 46: * Absorbs data into the Keccak state
! 47: *
! 48: * @param data data to be absorbed
! 49: */
! 50: void (*absorb)(sha3_keccak_t *this, chunk_t data);
! 51:
! 52: /**
! 53: * Finalize the absorption phase and switch to the squeeze phase
! 54: */
! 55: void (*finalize)(sha3_keccak_t *this);
! 56:
! 57: /**
! 58: * Squeeze the Keccak state to get output data
! 59: * Can be called multiple times
! 60: *
! 61: * @param out_len number of output bytes requested
! 62: * @param out output buffer, must comprise at least out_len bytes
! 63: */
! 64: void (*squeeze)(sha3_keccak_t *this, size_t out_len, uint8_t *out);
! 65:
! 66: /**
! 67: * Destroy the sha3_keccak_t object
! 68: */
! 69: void (*destroy)(sha3_keccak_t *this);
! 70:
! 71: };
! 72:
! 73: /**
! 74: * Creates a new sha3_keccak_t.
! 75: *
! 76: * @param capacity required capacity to achieve a given security level
! 77: * @param delimited_suffix bits delimiting the input message
! 78: * @return sha3_keccak_t object, NULL if capacity too big
! 79: */
! 80: sha3_keccak_t *sha3_keccak_create(u_int capacity, uint8_t delimited_suffix);
! 81:
! 82: #endif /** SHA3_KECCAK_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>