[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r35365 - in gnunet/src: include util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r35365 - in gnunet/src: include util |
Date: |
Mon, 9 Mar 2015 12:59:33 +0100 |
Author: grothoff
Date: 2015-03-09 12:59:33 +0100 (Mon, 09 Mar 2015)
New Revision: 35365
Modified:
gnunet/src/include/gnunet_crypto_lib.h
gnunet/src/util/crypto_rsa.c
Log:
add GNUNET_CRYPTO_rsa_public_key_hash
Modified: gnunet/src/include/gnunet_crypto_lib.h
===================================================================
--- gnunet/src/include/gnunet_crypto_lib.h 2015-03-09 08:24:58 UTC (rev
35364)
+++ gnunet/src/include/gnunet_crypto_lib.h 2015-03-09 11:59:33 UTC (rev
35365)
@@ -1539,6 +1539,17 @@
/**
+ * Compute hash over the public key.
+ *
+ * @param key public key to hash
+ * @param hc where to store the hash code
+ */
+void
+GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_rsa_PublicKey
*key,
+ struct GNUNET_HashCode *hc);
+
+
+/**
* Free memory occupied by the public key.
*
* @param key pointer to the memory to free
Modified: gnunet/src/util/crypto_rsa.c
===================================================================
--- gnunet/src/util/crypto_rsa.c 2015-03-09 08:24:58 UTC (rev 35364)
+++ gnunet/src/util/crypto_rsa.c 2015-03-09 11:59:33 UTC (rev 35365)
@@ -299,7 +299,7 @@
*/
size_t
GNUNET_CRYPTO_rsa_public_key_encode (const struct GNUNET_CRYPTO_rsa_PublicKey
*key,
- char **buffer)
+ char **buffer)
{
size_t n;
char *b;
@@ -320,6 +320,28 @@
/**
+ * Compute hash over the public key.
+ *
+ * @param key public key to hash
+ * @param hc where to store the hash code
+ */
+void
+GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_rsa_PublicKey
*key,
+ struct GNUNET_HashCode *hc)
+{
+ char *buf;
+ size_t buf_size;
+
+ buf_size = GNUNET_CRYPTO_rsa_public_key_encode (key,
+ &buf);
+ GNUNET_CRYPTO_hash (buf,
+ buf_size,
+ hc);
+ GNUNET_free (buf);
+}
+
+
+/**
* Decode the public key from the data-format back
* to the "normal", internal format.
*
@@ -329,7 +351,7 @@
*/
struct GNUNET_CRYPTO_rsa_PublicKey *
GNUNET_CRYPTO_rsa_public_key_decode (const char *buf,
- size_t len)
+ size_t len)
{
struct GNUNET_CRYPTO_rsa_PublicKey *key;
gcry_mpi_t n;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r35365 - in gnunet/src: include util,
gnunet <=