blob: 667f1c4cfa236bc7fda83b7b429624ad9c609d5a (
plain)
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
|
/*
* NEWHOPE Ring-LWE scheme
* Based on the public domain reference implementation by the
* designers (https://github.com/tpoeppelmann/newhope)
*
* Further changes
* (C) 2016 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#ifndef BOTAN_NEWHOPE_H__
#define BOTAN_NEWHOPE_H__
#include <botan/rng.h>
namespace Botan {
/*
* WARNING: This API is preliminary and will change
* Currently pubkey.h does not support a 2-phase KEM scheme of
* the sort NEWHOPE exports.
*/
#define NEWHOPE_SENDABYTES 1824
#define NEWHOPE_SENDBBYTES 2048
typedef struct {
uint16_t coeffs[1024];
} newhope_poly;
/**
* This chooses the XOF + hash for NewHope
* The official NewHope specification and reference implementation use
* SHA-3 and SHAKE-128. BoringSSL instead uses SHA-256 and AES-128 in
* CTR mode.
*/
enum class Newhope_Mode {
SHA3,
BoringSSL
};
void BOTAN_DLL newhope_keygen(uint8_t *send,
newhope_poly *sk,
RandomNumberGenerator& rng,
Newhope_Mode = Newhope_Mode::SHA3);
void BOTAN_DLL newhope_sharedb(uint8_t *sharedkey,
uint8_t *send,
const uint8_t *received,
RandomNumberGenerator& rng,
Newhope_Mode mode = Newhope_Mode::SHA3);
void BOTAN_DLL newhope_shareda(uint8_t *sharedkey,
const newhope_poly *ska,
const uint8_t *received,
Newhope_Mode mode = Newhope_Mode::SHA3);
}
#endif
|