webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
internal.h
Go to the documentation of this file.
1 /* Copyright (c) 2016, Google Inc.
2  *
3  * Permission to use, copy, modify, and/or distribute this software for any
4  * purpose with or without fee is hereby granted, provided that the above
5  * copyright notice and this permission notice appear in all copies.
6  *
7  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14 
15 #ifndef OPENSSL_HEADER_NEWHOPE_INTERNAL_H
16 #define OPENSSL_HEADER_NEWHOPE_INTERNAL_H
17 
18 #include <openssl/newhope.h>
19 #include <openssl/sha.h>
20 
21 #include "../internal.h"
22 
23 
24 /* The number of polynomial coefficients. */
25 #define PARAM_N 1024
26 
27 /* The width the noise distribution. */
28 #define PARAM_K 16
29 
30 /* Modulus. */
31 #define PARAM_Q 12289
32 
33 /* Polynomial coefficients in unpacked form. */
36 };
37 
38 /* SEED_LENGTH is the length of the AES-CTR seed used to derive a polynomial. */
39 #define SEED_LENGTH 32
40 
41 /* newhope_poly_uniform generates the polynomial |a| using AES-CTR mode with the
42  * seed
43  * |seed|. (In the reference implementation this was done with SHAKE-128.) */
45 
47  const uint8_t rbits[32]);
48 
49 /* newhope_reconcile performs the error-reconciliation step using the input |v|
50  * and
51  * reconciliation data |c|, writing the resulting key to |key|. */
53  const NEWHOPE_POLY* c);
54 
55 /* newhope_poly_invntt performs the inverse of NTT(r) in-place. */
57 
59  const NEWHOPE_POLY* b);
61  const NEWHOPE_POLY* b);
62 
65 
67 void newhope_mul_coefficients(uint16_t* poly, const uint16_t* factors);
68 void newhope_ntt(uint16_t* poly, const uint16_t* omegas);
69 
70 
71 #endif /* OPENSSL_HEADER_NEWHOPE_INTERNAL_H */
void newhope_helprec(NEWHOPE_POLY *c, const NEWHOPE_POLY *v, const uint8_t rbits[32])
Definition: error_correction.c:84
uint16_t newhope_barrett_reduce(uint16_t a)
Definition: reduce.c:35
int c
Definition: cpp_unittests.cpp:275
long seed
Definition: float-mm.c:84
unsigned int uint32_t
Definition: ptypes.h:105
void newhope_poly_uniform(NEWHOPE_POLY *a, const uint8_t *seed)
Definition: poly.c:86
void newhope_reconcile(uint8_t *key, const NEWHOPE_POLY *v, const NEWHOPE_POLY *c)
Definition: error_correction.c:112
GLint GLenum GLint const GLfloat * coeffs
Definition: gl2ext.h:992
Definition: internal.h:34
void newhope_poly_add(NEWHOPE_POLY *r, const NEWHOPE_POLY *a, const NEWHOPE_POLY *b)
Definition: poly.c:161
unsigned char uint8_t
Definition: ptypes.h:89
void newhope_poly_pointwise(NEWHOPE_POLY *r, const NEWHOPE_POLY *a, const NEWHOPE_POLY *b)
Definition: poly.c:151
unsigned short uint16_t
Definition: ptypes.h:97
GLboolean GLboolean GLboolean GLboolean a
Definition: gl2ext.h:306
#define PARAM_N
Definition: internal.h:25
const GLfloat * v
Definition: gl2.h:514
uint16_t newhope_montgomery_reduce(uint32_t a)
Definition: reduce.c:25
void newhope_ntt(uint16_t *poly, const uint16_t *omegas)
Definition: ntt.c:117
void newhope_poly_invntt(NEWHOPE_POLY *r)
Definition: poly.c:179
void newhope_mul_coefficients(uint16_t *poly, const uint16_t *factors)
Definition: ntt.c:108
GLboolean GLboolean GLboolean b
Definition: gl2ext.h:306
void newhope_bitrev_vector(uint16_t *poly)
Definition: ntt.c:94
CFArrayRef CFTypeRef key
Definition: AVFoundationCFSoftLinking.h:129
GLboolean r
Definition: gl2ext.h:306