diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2023-11-10 18:51:20 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2023-11-10 18:51:20 +0100 |
commit | b56d5e12c913e32d97b6192afa14d84be6e236fb (patch) | |
tree | acf98a52ca9d07320a4e76293c62d49339a7977a /src/util/crypto_ecc_setup.c | |
parent | dd8b7a5debd702ba05a7cc022db4fd5d715781ea (diff) | |
download | gnunet-b56d5e12c913e32d97b6192afa14d84be6e236fb.tar.gz gnunet-b56d5e12c913e32d97b6192afa14d84be6e236fb.zip |
MESSENGER: Separate peer and member signed messages
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'src/util/crypto_ecc_setup.c')
-rw-r--r-- | src/util/crypto_ecc_setup.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/util/crypto_ecc_setup.c b/src/util/crypto_ecc_setup.c index e07d1e448..dd49049bc 100644 --- a/src/util/crypto_ecc_setup.c +++ b/src/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,34 @@ GNUNET_CRYPTO_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
289 | } | 289 | } |
290 | 290 | ||
291 | 291 | ||
292 | enum GNUNET_GenericReturnValue | ||
293 | GNUNET_CRYPTO_sign_by_peer_identity (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
294 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, | ||
295 | struct GNUNET_CRYPTO_EddsaSignature *sig) | ||
296 | { | ||
297 | struct GNUNET_CRYPTO_EddsaPrivateKey *priv; | ||
298 | |||
299 | if (NULL == (priv = GNUNET_CRYPTO_eddsa_key_create_from_configuration (cfg))) | ||
300 | { | ||
301 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
302 | _ ("Could not load peer's private key\n")); | ||
303 | return GNUNET_SYSERR; | ||
304 | } | ||
305 | |||
306 | return GNUNET_CRYPTO_eddsa_sign_ (priv, purpose, sig); | ||
307 | } | ||
308 | |||
309 | |||
310 | enum GNUNET_GenericReturnValue | ||
311 | GNUNET_CRYPTO_verify_peer_identity (uint32_t purpose, | ||
312 | const struct GNUNET_CRYPTO_EccSignaturePurpose * validate, | ||
313 | const struct GNUNET_CRYPTO_EddsaSignature *sig, | ||
314 | const struct GNUNET_PeerIdentity *identity) | ||
315 | { | ||
316 | return GNUNET_CRYPTO_eddsa_verify_ (purpose, validate, sig, &identity->public_key); | ||
317 | } | ||
318 | |||
319 | |||
292 | /** | 320 | /** |
293 | * Setup a key file for a peer given the name of the | 321 | * Setup a key file for a peer given the name of the |
294 | * configuration file (!). This function is used so that | 322 | * configuration file (!). This function is used so that |