]> git.ipfire.org Git - thirdparty/strongswan.git/blame - src/libstrongswan/plugins/ntru/ntru_public_key.h
Update copyright headers after acquisition by secunet
[thirdparty/strongswan.git] / src / libstrongswan / plugins / ntru / ntru_public_key.h
CommitLineData
337f0c8a
AS
1/*
2 * Copyright (C) 2014 Andreas Steffen
337f0c8a
AS
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 */
14
15/**
16 * @defgroup ntru_public_key ntru_public_key
17 * @{ @ingroup ntru_p
18 */
19
20#ifndef NTRU_PUBLIC_KEY_H_
21#define NTRU_PUBLIC_KEY_H_
22
23typedef struct ntru_public_key_t ntru_public_key_t;
24
25#include "ntru_param_set.h"
26
27#include <library.h>
6d3a743d 28#include <crypto/drbgs/drbg.h>
337f0c8a
AS
29
30/**
31 * Implements an NTRU encryption public key
32 */
33struct ntru_public_key_t {
34
22e1aa51
AS
35 /**
36 * Returns NTRU parameter set ID of the public key
37 *
38 * @return NTRU parameter set ID
39 */
40 ntru_param_set_id_t (*get_id)(ntru_public_key_t *this);
41
337f0c8a
AS
42 /**
43 * Returns the packed encoding of the NTRU encryption public key
44 *
45 * @return Packed encoding of NTRU encryption public key
46 */
47 chunk_t (*get_encoding)(ntru_public_key_t *this);
48
22e1aa51
AS
49 /**
50 * Encrypts a plaintext with the NTRU public key
51 *
52 * @param ciphertext Plaintext
53 * @param plaintext Ciphertext
54 * @return TRUE if encryption was successful
55 */
56 bool (*encrypt)(ntru_public_key_t *this, chunk_t plaintext,
57 chunk_t *ciphertext);
58
337f0c8a
AS
59 /**
60 * Destroy ntru_public_key_t object
61 */
62 void (*destroy)(ntru_public_key_t *this);
63};
64
65/**
22e1aa51 66 * Creates an NTRU encryption public key from coefficients
337f0c8a 67 *
22e1aa51 68 * @param drbg Deterministic random bit generator
337f0c8a
AS
69 * @param params NTRU encryption parameter set to be used
70 * @param pubkey Coefficients of public key polynomial h
71 */
6d3a743d 72ntru_public_key_t *ntru_public_key_create(drbg_t *drbg,
b8070e2c 73 const ntru_param_set_t *params,
337f0c8a
AS
74 uint16_t *pubkey);
75
22e1aa51
AS
76/**
77 * Creates an NTRU encryption public key from encoding
78 *
79 * @param drbg Deterministic random bit generator
80 * @param data Encoded NTRU public key
81 */
6d3a743d 82ntru_public_key_t *ntru_public_key_create_from_data(drbg_t *drbg,
22e1aa51
AS
83 chunk_t data);
84
337f0c8a
AS
85
86#endif /** NTRU_PUBLIC_KEY_H_ @}*/
87