2 * Copyright (C) 2014 Martin Willi
3 * Copyright (C) 2014 revosec AG
5 * Copyright (C) 2016 Andreas Steffen
6 * HSR Hochschule fuer Technik Rapperswil
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 #include "curve25519_plugin.h"
20 #include "curve25519_dh.h"
21 #include "curve25519_private_key.h"
22 #include "curve25519_public_key.h"
23 #include "curve25519_identity_hasher.h"
27 typedef struct private_curve25519_plugin_t private_curve25519_plugin_t
;
30 * private data of curve25519_plugin
32 struct private_curve25519_plugin_t
{
37 curve25519_plugin_t
public;
40 METHOD(plugin_t
, get_name
, char*,
41 private_curve25519_plugin_t
*this)
46 METHOD(plugin_t
, get_features
, int,
47 private_curve25519_plugin_t
*this, plugin_feature_t
*features
[])
49 static plugin_feature_t f
[] = {
51 PLUGIN_REGISTER(DH
, curve25519_dh_create
),
52 PLUGIN_PROVIDE(DH
, CURVE_25519
),
53 PLUGIN_DEPENDS(RNG
, RNG_STRONG
),
54 /* Ed25519 private/public keys */
55 PLUGIN_REGISTER(PRIVKEY
, curve25519_private_key_load
, TRUE
),
56 PLUGIN_PROVIDE(PRIVKEY
, KEY_ED25519
),
57 PLUGIN_REGISTER(PRIVKEY_GEN
, curve25519_private_key_gen
, FALSE
),
58 PLUGIN_PROVIDE(PRIVKEY_GEN
, KEY_ED25519
),
59 PLUGIN_DEPENDS(RNG
, RNG_TRUE
),
60 PLUGIN_DEPENDS(HASHER
, HASH_SHA512
),
61 PLUGIN_REGISTER(PUBKEY
, curve25519_public_key_load
, TRUE
),
62 PLUGIN_PROVIDE(PUBKEY
, KEY_ED25519
),
63 /* Ed25519 signature scheme, private */
64 PLUGIN_PROVIDE(PRIVKEY_SIGN
, SIGN_ED25519
),
65 PLUGIN_DEPENDS(HASHER
, HASH_SHA512
),
66 /* Ed25519 signature verification scheme, public */
67 PLUGIN_PROVIDE(PUBKEY_VERIFY
, SIGN_ED25519
),
68 PLUGIN_DEPENDS(HASHER
, HASH_SHA512
),
69 /* register a pro forma identity hasher */
70 PLUGIN_REGISTER(HASHER
, curve25519_identity_hasher_create
),
71 PLUGIN_PROVIDE(HASHER
, HASH_IDENTITY
),
77 METHOD(plugin_t
, destroy
, void,
78 private_curve25519_plugin_t
*this)
86 plugin_t
*curve25519_plugin_create()
88 private_curve25519_plugin_t
*this;
93 .get_name
= _get_name
,
94 .get_features
= _get_features
,
100 return &this->public.plugin
;