Prototype implementation of IKE key exchange via NTRU encryption
[strongswan.git] / src / libstrongswan / plugins / ntru / ntru_crypto / ntru_crypto_ntru_encrypt_param_sets.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_encrypt_param_sets.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_encrypt_param_sets.h
28 *
29 * Contents: Definitions and declarations for the NTRUEncrypt parameter sets.
30 *
31 *****************************************************************************/
32
33 #ifndef NTRU_CRYPTO_NTRU_ENCRYPT_PARAM_SETS_H
34 #define NTRU_CRYPTO_NTRU_ENCRYPT_PARAM_SETS_H
35
36 #include "ntru_crypto.h"
37 #include "ntru_crypto_hash_basics.h"
38
39
40 /* structures */
41
42 typedef struct _NTRU_ENCRYPT_PARAM_SET {
43 NTRU_ENCRYPT_PARAM_SET_ID id; /* parameter-set ID */
44 uint8_t const OID[3]; /* pointer to OID */
45 uint8_t der_id; /* parameter-set DER id */
46 uint8_t N_bits; /* no. of bits in N (i.e. in
47 an index */
48 uint16_t N; /* ring dimension */
49 uint16_t sec_strength_len; /* no. of octets of
50 security strength */
51 uint16_t q; /* big modulus */
52 uint8_t q_bits; /* no. of bits in q (i.e. in
53 a coefficient */
54 bool is_product_form; /* if product form used */
55 uint32_t dF_r; /* no. of 1 or -1 coefficients
56 in ring elements F, r */
57 uint16_t dg; /* no. - 1 of 1 coefficients
58 or no. of -1 coefficients
59 in ring element g */
60 uint16_t m_len_max; /* max no. of plaintext
61 octets */
62 uint16_t min_msg_rep_wt; /* min. message
63 representative weight */
64 uint16_t no_bias_limit; /* limit for no bias in
65 IGF-2 */
66 uint8_t c_bits; /* no. bits in candidate for
67 deriving an index in
68 IGF-2 */
69 uint8_t m_len_len; /* no. of octets to hold
70 mLenOctets */
71 uint8_t min_IGF_hash_calls; /* min. no. of hash calls for
72 IGF-2 */
73 uint8_t min_MGF_hash_calls; /* min. no. of hash calls for
74 MGF-TP-1 */
75 } NTRU_ENCRYPT_PARAM_SET;
76
77
78
79 /* function declarations */
80
81 /* ntru_encrypt_get_params_with_id
82 *
83 * Looks up a set of NTRU Encrypt parameters based on the id of the
84 * parameter set.
85 *
86 * Returns a pointer to the parameter set parameters if successful.
87 * Returns NULL if the parameter set cannot be found.
88 */
89
90 extern NTRU_ENCRYPT_PARAM_SET *
91 ntru_encrypt_get_params_with_id(
92 NTRU_ENCRYPT_PARAM_SET_ID id); /* in - parameter-set id */
93
94
95 /* ntru_encrypt_get_params_with_OID
96 *
97 * Looks up a set of NTRU Encrypt parameters based on the OID of the
98 * parameter set.
99 *
100 * Returns a pointer to the parameter set parameters if successful.
101 * Returns NULL if the parameter set cannot be found.
102 */
103
104 extern NTRU_ENCRYPT_PARAM_SET *
105 ntru_encrypt_get_params_with_OID(
106 uint8_t const *oid); /* in - pointer to parameter-set OID */
107
108
109 /* ntru_encrypt_get_params_with_DER_id
110 *
111 * Looks up a set of NTRUEncrypt parameters based on the DER id of the
112 * parameter set.
113 *
114 * Returns a pointer to the parameter set parameters if successful.
115 * Returns NULL if the parameter set cannot be found.
116 */
117
118 extern NTRU_ENCRYPT_PARAM_SET *
119 ntru_encrypt_get_params_with_DER_id(
120 uint8_t der_id); /* in - parameter-set DER id */
121
122
123 #endif /* NTRU_CRYPTO_NTRU_ENCRYPT_PARAM_SETS_H */
124