/usr/include/libntru/encparams.h is in libntru-0.5-dev 0.5-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | #ifndef NTRU_ENCPARAMS_H
#define NTRU_ENCPARAMS_H
#include <stdint.h>
#include "hash.h"
/* max hash output length in bytes */
#define NTRU_MAX_HASH_LEN 64
/** upper limit for the parameter c in NtruEncParams */
#define NTRU_MAX_C 32
/** max length of a bit string in bytes */
#define NTRU_MAX_BIT_STR_LEN (NTRU_MAX_HASH_LEN * (NTRU_MAX_C+1))
/* A set of parameters for NtruEncrypt */
typedef struct NtruEncParams {
/* name of the parameter set */
char name[11];
/* number of polynomial coefficients */
uint16_t N;
/* modulus */
uint16_t q;
/* 1 for product-form private keys, 0 for ternary */
uint8_t prod_flag;
/*
* number of ones in the private polynomial f1 (if prod=1) or f (if prod=0)
*/
uint16_t df1;
/*
* number of ones in the private polynomial f2; ignored if prod=0
*/
uint16_t df2;
/*
* number of ones in the private polynomial f3; ignored if prod=0
*/
uint16_t df3;
/*
* number of ones in the polynomial g (used during key generation)
*/
uint16_t dg;
/*
* minimum acceptable number of -1's, 0's, and 1's in the polynomial m'
* in the last encryption step
*/
uint16_t dm0;
/* number of random bits to prepend to the message */
uint16_t db;
/* a parameter for the Index Generation Function */
uint16_t c;
/* minimum number of hash calls for the IGF to make */
uint16_t min_calls_r;
/* minimum number of calls to generate the masking polynomial */
uint16_t min_calls_mask;
/*
* whether to hash the seed in the MGF first (1) or
* use the seed directly (0)
*/
uint8_t hash_seed;
/* three bytes that uniquely identify the parameter set */
uint8_t oid[3];
/* hash function, e.g. ntru_sha256 */
void (*hash)(uint8_t[], uint16_t, uint8_t[]);
/* hash function for 4 inputs, e.g. ntru_sha256_4way */
void (*hash_4way)(uint8_t *[4], uint16_t, uint8_t *[4]);
/* hash function for 8 inputs, e.g. ntru_sha256_8way */
void (*hash_8way)(uint8_t *[8], uint16_t, uint8_t *[8]);
/* output length of the hash function */
uint16_t hlen;
/* number of bits of the public key to hash */
uint16_t pklen;
} NtruEncParams;
/*
* An IEEE 1361.1 parameter set that gives 112 bits of security and is optimized for key size.
*/
extern const NtruEncParams EES401EP1;
/*
* An IEEE 1361.1 parameter set that gives 128 bits of security and is optimized for key size.
*/
extern const NtruEncParams EES449EP1;
/*
* An IEEE 1361.1 parameter set that gives 192 bits of security and is optimized for key size.
*/
extern const NtruEncParams EES677EP1;
/*
* An IEEE 1361.1 parameter set that gives 256 bits of security and is optimized for key size.
*/
extern const NtruEncParams EES1087EP2;
/*
* An IEEE 1361.1 parameter set that gives 112 bits of security and is
* a tradeoff between key size and encryption/decryption speed.
*/
extern const NtruEncParams EES541EP1;
/*
* An IEEE 1361.1 parameter set that gives 128 bits of security and is
* a tradeoff between key size and encryption/decryption speed.
*/
extern const NtruEncParams EES613EP1;
/*
* An IEEE 1361.1 parameter set that gives 192 bits of security and is
* a tradeoff between key size and encryption/decryption speed.
*/
extern const NtruEncParams EES887EP1;
/*
* An IEEE 1361.1 parameter set that gives 256 bits of security and is
* a tradeoff between key size and encryption/decryption speed.
*/
extern const NtruEncParams EES1171EP1;
/*
* An IEEE 1361.1 parameter set that gives 112 bits of security and is
* optimized for encryption/decryption speed.
*/
extern const NtruEncParams EES659EP1;
/*
* An IEEE 1361.1 parameter set that gives 128 bits of security and is
* optimized for encryption/decryption speed.
*/
extern const NtruEncParams EES761EP1;
/*
* An IEEE 1361.1 parameter set that gives 192 bits of security and is
* optimized for encryption/decryption speed.
*/
extern const NtruEncParams EES1087EP1;
/*
* An IEEE 1361.1 parameter set that gives 256 bits of security and is
* optimized for encryption/decryption speed.
*/
extern const NtruEncParams EES1499EP1;
#ifndef NTRU_AVOID_HAMMING_WT_PATENT
/*
* A product-form parameter set that gives 112 bits of security.
*/
extern const NtruEncParams EES401EP2;
/*
* A product-form parameter set that gives 128 bits of security.
* DEPRECATED -- use EES443EP1 instead.
*/
extern const NtruEncParams EES439EP1;
/*
* A product-form parameter set that gives 128 bits of security.
*/
extern const NtruEncParams EES443EP1;
/*
* A product-form parameter set that gives 192 bits of security.
* DEPRECATED -- use EES587EP1 instead.
*/
extern const NtruEncParams EES593EP1;
/*
* A product-form parameter set that gives 192 bits of security.
*/
extern const NtruEncParams EES587EP1;
/*
* A product-form parameter set that gives 256 bits of security.
*/
extern const NtruEncParams EES743EP1;
#endif /* NTRU_AVOID_HAMMING_WT_PATENT */
#ifndef NTRU_AVOID_HAMMING_WT_PATENT
/*
* The default parameter set for 112 bits of security.
*/
#define NTRU_DEFAULT_PARAMS_112_BITS EES401EP2
/*
* The default parameter set for 128 bits of security.
*/
#define NTRU_DEFAULT_PARAMS_128_BITS EES443EP1
/*
* The default parameter set for 192 bits of security.
*/
#define NTRU_DEFAULT_PARAMS_192_BITS EES587EP1
/*
* The default parameter set for 256 bits of security.
*/
#define NTRU_DEFAULT_PARAMS_256_BITS EES743EP1
#define ALL_PARAM_SETS {EES401EP1, EES449EP1, EES677EP1, EES1087EP2, EES541EP1, EES613EP1, EES887EP1, EES1171EP1, EES659EP1, EES761EP1, EES1087EP1, EES1499EP1, EES401EP2, EES439EP1, EES443EP1, EES593EP1, EES587EP1, EES743EP1}
#else
/*
* The default parameter set for 112 bits of security.
*/
#define NTRU_DEFAULT_PARAMS_112_BITS EES541EP1
/*
* The default parameter set for 128 bits of security.
*/
#define NTRU_DEFAULT_PARAMS_128_BITS EES613EP1
/*
* The default parameter set for 192 bits of security.
*/
#define NTRU_DEFAULT_PARAMS_192_BITS EES887EP1
/*
* The default parameter set for 256 bits of security.
*/
#define NTRU_DEFAULT_PARAMS_256_BITS EES1171EP1
#define ALL_PARAM_SETS {EES401EP1, EES449EP1, EES677EP1, EES1087EP2, EES541EP1, EES613EP1, EES887EP1, EES1171EP1, EES659EP1, EES761EP1, EES1087EP1, EES1499EP1}
#endif /* NTRU_AVOID_HAMMING_WT_PATENT */
/**
* @brief Ciphertext length
*
* Returns the length of an encrypted message in bytes for a given parameter set.
*
* @param params
* @return the length in bytes or 0 if params->q is not a power of two
*/
uint16_t ntru_enc_len(const NtruEncParams *params);
/**
* @brief Ciphertext length
*
* Returns the length of an encrypted message in bytes for a given N and q value.
*
* @param N
* @param q
* @return the length in bytes or 0 if q is not a power of two
*/
uint16_t ntru_enc_len_Nq(uint16_t N, uint16_t q);
#endif /* NTRU_ENCPARAMS_H */
|