Annotation of embedaddon/strongswan/src/libstrongswan/math/libnttfft/ntt_fft.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2014 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 ntt_p libnttfft
                     18:  *
                     19:  * @defgroup ntt_fft ntt_fft
                     20:  * @{ @ingroup ntt_p
                     21:  */
                     22: 
                     23: #ifndef NTT_FFT_H_
                     24: #define NTT_FFT_H_
                     25: 
                     26: #include "ntt_fft_params.h"
                     27: 
                     28: #include <library.h>
                     29: 
                     30: typedef struct ntt_fft_t ntt_fft_t;
                     31: 
                     32: /**
                     33:  * Implements a Number Theoretic Transform (NTT) via the FFT algorithm
                     34:  */
                     35: struct ntt_fft_t {
                     36: 
                     37:        /**
                     38:         * Get the size of the Number Theoretic Transform
                     39:         *
                     40:         * @result                      Transform size
                     41:         */
                     42:        uint16_t (*get_size)(ntt_fft_t *this);
                     43: 
                     44:        /**
                     45:         * Get the prime modulus of the Number Theoretic Transform
                     46:         *
                     47:         * @result                      Prime modulus
                     48:         */
                     49:        uint16_t (*get_modulus)(ntt_fft_t *this);
                     50: 
                     51:        /**
                     52:         * Compute the [inverse] NTT of a polynomial
                     53:         *
                     54:         * @param a                     Coefficient of input polynomial
                     55:         * @param b                     Coefficient of output polynomial
                     56:         * @param inverse       TRUE if the inverse NTT has to be computed
                     57:         */
                     58:        void (*transform)(ntt_fft_t *this, uint32_t *a, uint32_t *b, bool inverse);
                     59: 
                     60:        /**
                     61:         * Destroy ntt_fft_t object
                     62:         */
                     63:        void (*destroy)(ntt_fft_t *this);
                     64: };
                     65: 
                     66: /**
                     67:  * Create a ntt_fft_t object for a given FFT parameter set
                     68:  *
                     69:  * @param params               FFT parameters
                     70:  */
                     71: ntt_fft_t *ntt_fft_create(const ntt_fft_params_t *params);
                     72: 
                     73: /**
                     74:  * Dummy libnttfft initialization function needed for integrity test
                     75:  */
                     76: void libnttfft_init(void);
                     77: 
                     78: 
                     79: #endif /** NTT_FFT_H_ @}*/

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