Annotation of embedaddon/strongswan/src/libstrongswan/math/libnttfft/ntt_fft_params.h, revision 1.1.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 ntt_fft_params ntt_fft_params
                     18:  * @{ @ingroup ntt_p
                     19:  */
                     20: 
                     21: #ifndef NTT_FFT_PARAMS_H_
                     22: #define NTT_FFT_PARAMS_H_
                     23: 
                     24: #include <library.h>
                     25: 
                     26: typedef struct ntt_fft_params_t ntt_fft_params_t;
                     27: 
                     28: /**
                     29:  * Defines the parameters for an NTT computed via the FFT algorithm
                     30:  */
                     31: struct ntt_fft_params_t {
                     32: 
                     33:        /**
                     34:         * Prime modulus
                     35:         */
                     36:        uint16_t q;
                     37: 
                     38:        /**
                     39:         * Inverse of Prime modulus (-q_inv * q mod r = 1)
                     40:         */
                     41:        uint16_t q_inv;
                     42: 
                     43:        /**
                     44:         * Logarithm of Montgomery radix: log2(r)
                     45:         */
                     46:        uint16_t rlog;
                     47: 
                     48:        /**
                     49:         * Square of Montgomery radix: r^2 mod q
                     50:         */
                     51:        const uint32_t r2;
                     52: 
                     53:        /**
                     54:         * Montgomery radix mask: (1<<rlog) - 1
                     55:         */
                     56:        const uint32_t rmask;
                     57: 
                     58:        /**
                     59:         * Size of the FFT with the condition k * n = q-1
                     60:         */
                     61:        const uint16_t n;
                     62: 
                     63:        /**
                     64:         * Inverse of n mod q used for normalization of the FFT
                     65:         */
                     66:        const uint16_t n_inv;
                     67: 
                     68:        /**
                     69:         * Number of FFT stages  stages = log2(n)
                     70:         */
                     71:        const uint16_t stages;
                     72: 
                     73:        /**
                     74:         * FFT twiddle factors (n-th roots of unity) in Montgomery form
                     75:         */
                     76:        const uint16_t *wr;
                     77: 
                     78:        /**
                     79:         * FFT phase shift (2n-th roots of unity) in forward transform
                     80:         */
                     81:        const uint16_t *wf;
                     82: 
                     83:        /**
                     84:         * FFT phase shift (2n-th roots of unity) and scaling in inverse transform
                     85:         */
                     86:        const uint16_t *wi;
                     87: 
                     88:        /**
                     89:         * Subsampling of FFT twiddle factors table
                     90:         */
                     91:        const uint16_t s;
                     92: 
                     93:        /**
                     94:         * FFT bit reversal
                     95:         */
                     96:        const uint16_t *rev;
                     97: 
                     98: };
                     99: 
                    100: /**
                    101:  * FFT parameters for q = 12289 and n = 1024
                    102:  */
                    103: extern const ntt_fft_params_t ntt_fft_12289_1024;
                    104: 
                    105: /**
                    106:  * FFT parameters for q = 12289 and n = 512
                    107:  */
                    108: extern const ntt_fft_params_t ntt_fft_12289_512;
                    109: 
                    110: /**
                    111:  * FFT parameters for q = 17 and n = 8
                    112:  */
                    113: extern const ntt_fft_params_t ntt_fft_17_8;
                    114: 
                    115: #endif /** NTT_FFT_PARAMS_H_ @}*/

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