Annotation of embedaddon/strongswan/src/libstrongswan/plugins/newhope/newhope_reconciliation.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2016 Andreas Steffen
3: * HSR Hochschule fuer Technik Rapperswil
4: *
5: * This program is free software; you can redistribute it and/or modify it
6: * under the terms of the GNU General Public License as published by the
7: * Free Software Foundation; either version 2 of the License, or (at your
8: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9: *
10: * This program is distributed in the hope that it will be useful, but
11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13: * for more details.
14: */
15:
16: /**
17: * @defgroup newhope_reconciliation newhope_reconciliation
18: * @{ @ingroup newhope_p
19: */
20:
21: #ifndef NEWHOPE_RECONCILIATION_H_
22: #define NEWHOPE_RECONCILIATION_H_
23:
24: typedef struct newhope_reconciliation_t newhope_reconciliation_t;
25:
26: #include <library.h>
27:
28: /**
29: * Class assisting the error reconciliation
30: * resulting in a key exchange error rate < 2^(-60)
31: */
32: struct newhope_reconciliation_t {
33:
34: /**
35: * Generate reconciliation polynomial
36: *
37: * @param v polynomial v
38: * @param rbits pseudo random bit array
39: * @return return array with reconciliation polynomial
40: */
41: uint8_t* (*help_reconcile)(newhope_reconciliation_t *this,
42: uint32_t *v, uint8_t *rbits);
43:
44: /**
45: * Use reconciliation polynomial r to derive shared secret
46: *
47: * @param v polynomial v or v'
48: * @param r reconciliation polynomial r
49: * @return Return shared secret
50: */
51: chunk_t (*reconcile)(newhope_reconciliation_t *this,
52: uint32_t *v, uint8_t *r);
53:
54: /**
55: * Destroy a newhope_reconciliation_t object
56: */
57: void (*destroy)(newhope_reconciliation_t *this);
58: };
59:
60: /**
61: * Creates a new newhope_reconciliation_t object.
62: *
63: * @param n array size
64: * @param q prime modulus
65: * @return newhope_reconciliation_t object
66: */
67: newhope_reconciliation_t *newhope_reconciliation_create(int n, int32_t q);
68:
69: #endif /** NEWHOPE_RECONCILIATION_H_ @}*/
70:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>