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"
26 typedef struct private_curve25519_plugin_t private_curve25519_plugin_t
;
29 * private data of curve25519_plugin
31 struct private_curve25519_plugin_t
{
36 curve25519_plugin_t
public;
39 METHOD(plugin_t
, get_name
, char*,
40 private_curve25519_plugin_t
*this)
45 METHOD(plugin_t
, get_features
, int,
46 private_curve25519_plugin_t
*this, plugin_feature_t
*features
[])
48 static plugin_feature_t f
[] = {
50 PLUGIN_REGISTER(DH
, curve25519_dh_create
),
51 PLUGIN_PROVIDE(DH
, CURVE_25519
),
52 PLUGIN_DEPENDS(RNG
, RNG_STRONG
),
53 /* Ed25519 private/public keys */
54 PLUGIN_REGISTER(PRIVKEY
, curve25519_private_key_load
, TRUE
),
55 PLUGIN_PROVIDE(PRIVKEY
, KEY_ED25519
),
56 PLUGIN_REGISTER(PRIVKEY_GEN
, curve25519_private_key_gen
, FALSE
),
57 PLUGIN_PROVIDE(PRIVKEY_GEN
, KEY_ED25519
),
58 PLUGIN_DEPENDS(RNG
, RNG_TRUE
),
59 PLUGIN_DEPENDS(HASHER
, HASH_SHA512
),
60 PLUGIN_REGISTER(PUBKEY
, curve25519_public_key_load
, TRUE
),
61 PLUGIN_PROVIDE(PUBKEY
, KEY_ED25519
),
62 /* Ed25519 signature scheme, private */
63 PLUGIN_PROVIDE(PRIVKEY_SIGN
, SIGN_ED25519
),
64 PLUGIN_DEPENDS(HASHER
, HASH_SHA512
),
65 /* Ed25519 signature verification scheme, public */
66 PLUGIN_PROVIDE(PUBKEY_VERIFY
, SIGN_ED25519
),
67 PLUGIN_DEPENDS(HASHER
, HASH_SHA512
),
73 METHOD(plugin_t
, destroy
, void,
74 private_curve25519_plugin_t
*this)
82 plugin_t
*curve25519_plugin_create()
84 private_curve25519_plugin_t
*this;
89 .get_name
= _get_name
,
90 .get_features
= _get_features
,
96 return &this->public.plugin
;