commit 40b9351a334b6f1ef0a9d088394c278ea4908c96
parent 7011143dc4a04272c8d7a7744e8e674509b1c727
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date: Wed, 28 Jun 2023 22:43:49 +0200
GNS: Fix hash for storage key to include zone type as specified in
LSD0001.
Diffstat:
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/gnsrecord/gnsrecord_crypto.c b/src/gnsrecord/gnsrecord_crypto.c
@@ -195,6 +195,7 @@ block_get_size_ecdsa (const struct GNUNET_GNSRECORD_Data *rd,
return len;
}
+
enum GNUNET_GenericReturnValue
block_sign_ecdsa (const struct
GNUNET_CRYPTO_EcdsaPrivateKey *key,
@@ -400,6 +401,7 @@ block_create_ecdsa (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
return GNUNET_OK;
}
+
static ssize_t
block_get_size_eddsa (const struct GNUNET_GNSRECORD_Data *rd,
unsigned int rd_count)
@@ -505,6 +507,7 @@ block_create_eddsa (const struct GNUNET_CRYPTO_EddsaPrivateKey *key,
return GNUNET_OK;
}
+
ssize_t
GNUNET_GNSRECORD_block_calculate_size (const struct
GNUNET_IDENTITY_PrivateKey *key,
@@ -531,6 +534,7 @@ GNUNET_GNSRECORD_block_calculate_size (const struct
}
+
enum GNUNET_GenericReturnValue
GNUNET_GNSRECORD_block_create (const struct GNUNET_IDENTITY_PrivateKey *key,
struct GNUNET_TIME_Absolute expire,
@@ -655,7 +659,6 @@ block_create2 (const struct GNUNET_IDENTITY_PrivateKey *pkey,
}
-
enum GNUNET_GenericReturnValue
GNUNET_GNSRECORD_block_create_unsigned (const struct
GNUNET_IDENTITY_PrivateKey *pkey,
@@ -669,7 +672,6 @@ GNUNET_GNSRECORD_block_create_unsigned (const struct
}
-
enum GNUNET_GenericReturnValue
GNUNET_GNSRECORD_block_create2 (const struct GNUNET_IDENTITY_PrivateKey *pkey,
struct GNUNET_TIME_Absolute expire,
@@ -681,6 +683,7 @@ GNUNET_GNSRECORD_block_create2 (const struct GNUNET_IDENTITY_PrivateKey *pkey,
return block_create2 (pkey, expire, label, rd, rd_count, result, GNUNET_YES);
}
+
/**
* Check if a signature is valid. This API is used by the GNS Block
* to validate signatures received from the network.
@@ -1064,8 +1067,8 @@ GNUNET_GNSRECORD_query_from_public_key (const struct
norm_label,
"gns",
&pd.ecdsa_key);
- GNUNET_CRYPTO_hash (&pd.ecdsa_key,
- sizeof (pd.ecdsa_key),
+ GNUNET_CRYPTO_hash (&pd,
+ GNUNET_IDENTITY_public_key_get_length (&pd),
query);
break;
case GNUNET_GNSRECORD_TYPE_EDKEY:
@@ -1075,7 +1078,7 @@ GNUNET_GNSRECORD_query_from_public_key (const struct
"gns",
&(pd.eddsa_key));
GNUNET_CRYPTO_hash (&pd.eddsa_key,
- sizeof (pd.eddsa_key),
+ GNUNET_IDENTITY_public_key_get_length (&pd),
query);
break;
default: