Streamlined DRBG and MGF1 debug output
[strongswan.git] / src / libstrongswan / plugins / ntru / ntru_crypto / ntru_crypto_ntru_mgftp1.h
1 /******************************************************************************
2 * NTRU Cryptography Reference Source Code
3 * Copyright (c) 2009-2013, by Security Innovation, Inc. All rights reserved.
4 *
5 * ntru_crypto_ntru_mgftp1.h is a component of ntru-crypto.
6 *
7 * Copyright (C) 2009-2013 Security Innovation
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 *
23 *****************************************************************************/
24
25 /******************************************************************************
26 *
27 * File: ntru_crypto_ntru_mgftp1.h
28 *
29 * Contents: Public header file for MGF-TP-1 in the NTRU algorithm.
30 *
31 *****************************************************************************/
32
33
34 #ifndef NTRU_CRYPTO_NTRU_MGF1_H
35 #define NTRU_CRYPTO_NTRU_MGF1_H
36
37
38 #include "ntru_crypto.h"
39
40 #include <crypto/hashers/hasher.h>
41
42 /* ntru_mgftp1
43 *
44 * Implements a mask-generation function for trinary polynomials,
45 * MGF-TP-1, generating an arbitrary number of octets based on hashing
46 * a digest-length string concatenated with a 4-octet counter. From
47 * these octets, N trits are derived.
48 *
49 * The state (string and counter) is initialized when a seed is present.
50 *
51 * Returns NTRU_OK if successful.
52 * Returns NTRU_CRYPTO_HASH_ errors if they occur.
53 *
54 */
55
56 extern uint32_t
57 ntru_mgftp1(
58 hash_algorithm_t hash_algid, /* in - hash alg ID for
59 MGF-TP-1 */
60 uint8_t min_calls, /* in - minimum no. of hash
61 calls */
62 uint16_t seed_len, /* in - no. of octets in seed */
63 uint8_t *seed, /* in - pointer to seed */
64 uint8_t *buf, /* in - pointer to working
65 buffer */
66 uint16_t num_trits_needed, /* in - no. of trits in mask */
67 uint8_t *mask); /* out - address for mask trits */
68
69
70 #endif /* NTRU_CRYPTO_NTRU_MGF1_H */