]> git.ipfire.org Git - thirdparty/strongswan.git/blob - src/libstrongswan/plugins/ntru/ntru_trits.h
Update copyright headers after acquisition by secunet
[thirdparty/strongswan.git] / src / libstrongswan / plugins / ntru / ntru_trits.h
1 /*
2 * Copyright (C) 2013-2016 Andreas Steffen
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 */
14
15 /**
16 * @defgroup ntru_trits ntru_trits
17 * @{ @ingroup ntru_p
18 */
19
20 #ifndef NTRU_TRITS_H_
21 #define NTRU_TRITS_H_
22
23 typedef struct ntru_trits_t ntru_trits_t;
24
25 #include <library.h>
26 #include <crypto/xofs/xof.h>
27
28 /**
29 * Implements an array of trinary elements (trits)
30 */
31 struct ntru_trits_t {
32
33 /**
34 * Get the size of the trits array
35 *
36 * @return number of trinary elements
37 */
38 size_t (*get_size)(ntru_trits_t *this);
39
40 /**
41 * @return octet array containing a trit per octet
42 */
43 uint8_t* (*get_trits)(ntru_trits_t *this);
44
45 /**
46 * Destroy ntru_trits_t object
47 */
48 void (*destroy)(ntru_trits_t *this);
49 };
50
51 /**
52 * Create a trits array from a seed using MGF1 with a base hash function
53 *
54 * @param size size of the trits array
55 * @param alg MGF1 algorithm used (XOF_MGF1_SHA1 or XOF_MGF_SHA256)
56 * @param seed seed used by MGF1 to generate trits from
57 */
58 ntru_trits_t *ntru_trits_create(size_t size, ext_out_function_t alg,
59 chunk_t seed);
60
61 #endif /** NTRU_TRITS_H_ @}*/
62