Annotation of embedaddon/strongswan/src/libstrongswan/crypto/xofs/xof_bitspender.h, revision 1.1
1.1 ! misho 1: /*
! 2: * Copyright (C) 2014-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: */
! 15:
! 16: /**
! 17: * @defgroup xof_bitspender xof_bitspender
! 18: * @{ @ingroup mgf1
! 19: */
! 20:
! 21: #ifndef XOF_BITSPENDER_H_
! 22: #define XOF_BITSPENDER_H_
! 23:
! 24: #include "xof.h"
! 25:
! 26: #include <library.h>
! 27:
! 28: typedef struct xof_bitspender_t xof_bitspender_t;
! 29:
! 30: /**
! 31: * Generates a given number of pseudo-random bits at a time using an
! 32: * Extended Output Function (XOF)
! 33: */
! 34: struct xof_bitspender_t {
! 35:
! 36: /**
! 37: * Get pseudo-random bits
! 38: *
! 39: * @param bits_needed Number of needed bits (1..32)
! 40: * @param bits Pseudo-random bits
! 41: * @result FALSE if internal MGF1 error occurred
! 42: */
! 43: bool (*get_bits)(xof_bitspender_t *this, int bits_needed, uint32_t *bits);
! 44:
! 45: /**
! 46: * Get a pseudo-random byte
! 47: *
! 48: * @param byte Pseudo-random byte
! 49: * @result FALSE if internal MGF1 error occurred
! 50: */
! 51: bool (*get_byte)(xof_bitspender_t *this, uint8_t *byte);
! 52:
! 53: /**
! 54: * Destroy xof_bitspender_t object
! 55: */
! 56: void (*destroy)(xof_bitspender_t *this);
! 57: };
! 58:
! 59: /**
! 60: * Create a xof_bitspender_t object
! 61: *
! 62: * @param alg XOF to be used
! 63: * @param seed Seed used to initialize XOF
! 64: * @param hash_seed Hash seed before using it as a seed for MFG1
! 65: */
! 66: xof_bitspender_t *xof_bitspender_create(ext_out_function_t alg, chunk_t seed,
! 67: bool hash_seed);
! 68:
! 69: #endif /** XOF_BITSPENDER_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>