aboutsummaryrefslogtreecommitdiff
path: root/src/lib/util/crypto_ecc_setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/util/crypto_ecc_setup.c')
-rw-r--r--src/lib/util/crypto_ecc_setup.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/lib/util/crypto_ecc_setup.c b/src/lib/util/crypto_ecc_setup.c
index e07d1e448..2ee9ed931 100644
--- a/src/lib/util/crypto_ecc_setup.c
+++ b/src/lib/util/crypto_ecc_setup.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2012, 2013, 2015, 2020 GNUnet e.V. 3 Copyright (C) 2012, 2013, 2015, 2020, 2023 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published 6 under the terms of the GNU Affero General Public License as published
@@ -289,6 +289,39 @@ GNUNET_CRYPTO_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle *cfg,
289} 289}
290 290
291 291
292enum GNUNET_GenericReturnValue
293GNUNET_CRYPTO_sign_by_peer_identity (const struct
294 GNUNET_CONFIGURATION_Handle *cfg,
295 const struct
296 GNUNET_CRYPTO_EccSignaturePurpose *purpose,
297 struct GNUNET_CRYPTO_EddsaSignature *sig)
298{
299 struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
300
301 if (NULL == (priv = GNUNET_CRYPTO_eddsa_key_create_from_configuration (cfg)))
302 {
303 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
304 _ ("Could not load peer's private key\n"));
305 return GNUNET_SYSERR;
306 }
307
308 return GNUNET_CRYPTO_eddsa_sign_ (priv, purpose, sig);
309}
310
311
312enum GNUNET_GenericReturnValue
313GNUNET_CRYPTO_verify_peer_identity (uint32_t purpose,
314 const struct
315 GNUNET_CRYPTO_EccSignaturePurpose *validate,
316 const struct
317 GNUNET_CRYPTO_EddsaSignature *sig,
318 const struct GNUNET_PeerIdentity *identity)
319{
320 return GNUNET_CRYPTO_eddsa_verify_ (purpose, validate, sig,
321 &identity->public_key);
322}
323
324
292/** 325/**
293 * Setup a key file for a peer given the name of the 326 * Setup a key file for a peer given the name of the
294 * configuration file (!). This function is used so that 327 * configuration file (!). This function is used so that