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
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 */
16 /**
17 * @defgroup ntt_fft ntt_fft
18 * @{ @ingroup bliss_p
19 */
21 #ifndef NTT_FFT_H_
22 #define NTT_FFT_H_
24 #include "ntt_fft_params.h"
26 #include <library.h>
28 typedef struct ntt_fft_t ntt_fft_t;
30 /**
31 * Implements a Number Theoretic Transform (NTT) via the FFT algorithm
32 */
33 struct ntt_fft_t {
35 /**
36 * Get the size of the Number Theoretic Transform
37 *
38 * @result Transform size
39 */
40 uint16_t (*get_size)(ntt_fft_t *this);
42 /**
43 * Get the prime modulus of the Number Theoretic Transform
44 *
45 * @result Prime modulus
46 */
47 uint16_t (*get_modulus)(ntt_fft_t *this);
49 /**
50 * Compute the [inverse] NTT of a polynomial
51 *
52 * @param a Coefficient of input polynomial
53 * @param b Coefficient of output polynomial
54 * @param inverse TRUE if the inverse NTT has to be computed
55 */
56 void (*transform)(ntt_fft_t *this, uint32_t *a, uint32_t *b, bool inverse);
58 /**
59 * Destroy ntt_fft_t object
60 */
61 void (*destroy)(ntt_fft_t *this);
62 };
64 /**
65 * Create a ntt_fft_t object for a given FFT parameter set
66 *
67 * @param params FFT parameters
68 */
69 ntt_fft_t *ntt_fft_create(ntt_fft_params_t *params);
71 #endif /** NTT_FFT_H_ @}*/