Annotation of embedaddon/strongswan/src/libstrongswan/plugins/ntru/ntru_trits.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2013-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 ntru_trits ntru_trits
                     18:  * @{ @ingroup ntru_p
                     19:  */
                     20: 
                     21: #ifndef NTRU_TRITS_H_
                     22: #define NTRU_TRITS_H_
                     23: 
                     24: typedef struct ntru_trits_t ntru_trits_t;
                     25: 
                     26: #include <library.h>
                     27: #include <crypto/xofs/xof.h>
                     28: 
                     29: /**
                     30:  * Implements an array of trinary elements (trits)
                     31:  */
                     32: struct ntru_trits_t {
                     33: 
                     34:        /**
                     35:         * Get the size of the trits array
                     36:         *
                     37:         * @return                      number of trinary elements
                     38:         */
                     39:        size_t (*get_size)(ntru_trits_t *this);
                     40: 
                     41:        /**
                     42:         * @return                      octet array containing a trit per octet
                     43:         */
                     44:        uint8_t* (*get_trits)(ntru_trits_t *this);
                     45: 
                     46:        /**
                     47:         * Destroy ntru_trits_t object
                     48:         */
                     49:        void (*destroy)(ntru_trits_t *this);
                     50: };
                     51: 
                     52: /**
                     53:  * Create a trits array from a seed using MGF1 with a base hash function
                     54:  *
                     55:  * @param size                 size of the trits array
                     56:  * @param alg                  MGF1 algorithm used (XOF_MGF1_SHA1 or XOF_MGF_SHA256)
                     57:  * @param seed                 seed used by MGF1 to generate trits from
                     58:  */
                     59: ntru_trits_t *ntru_trits_create(size_t size, ext_out_function_t alg,
                     60:                                                                chunk_t seed);
                     61: 
                     62: #endif /** NTRU_TRITS_H_ @}*/
                     63: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>