[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: add pack helper for blinded sig
From: |
gnunet |
Subject: |
[gnunet] branch master updated: add pack helper for blinded sig |
Date: |
Mon, 06 May 2024 21:11:40 +0200 |
This is an automated email from the git hooks/post-receive script.
christian-blaettler pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new dbfd21c2f add pack helper for blinded sig
dbfd21c2f is described below
commit dbfd21c2f14d439ce897edb427222a4445a07072
Author: Christian Blättler <blatc2@bfh.ch>
AuthorDate: Mon May 6 21:11:35 2024 +0200
add pack helper for blinded sig
---
src/include/gnunet_json_lib.h | 12 ++++++++++++
src/lib/json/json_helper.c | 2 ++
src/lib/json/json_pack.c | 37 +++++++++++++++++++++++++++++++++++++
3 files changed, 51 insertions(+)
diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h
index 44dbf8965..e9c17eef9 100644
--- a/src/include/gnunet_json_lib.h
+++ b/src/include/gnunet_json_lib.h
@@ -1003,6 +1003,18 @@ GNUNET_JSON_pack_blinded_message (const char *name,
const struct GNUNET_CRYPTO_BlindedMessage
*msg);
+/**
+ * Generate packer instruction for a JSON field of type
+ * blinded signature.
+ *
+ * @param name name of the field to add to the object
+ * @param sig blinded signature
+ * @return json pack specification
+ */
+struct GNUNET_JSON_PackSpec
+GNUNET_JSON_pack_blinded_sig (const char *name,
+ const struct GNUNET_CRYPTO_BlindedSignature
*sig);
+
#endif
/* end of gnunet_json_lib.h */
diff --git a/src/lib/json/json_helper.c b/src/lib/json/json_helper.c
index a5adcddc6..ce73fb316 100644
--- a/src/lib/json/json_helper.c
+++ b/src/lib/json/json_helper.c
@@ -1249,6 +1249,8 @@ parse_blinded_message (void *cls,
{
struct GNUNET_JSON_Specification ispec[] = {
GNUNET_JSON_spec_varsize (
+ /* TODO: Change this field name to something
+ more generic / pass in as argument. */
"rsa_blinded_planchet",
&blinded_message->details.rsa_blinded_message.blinded_msg,
&blinded_message->details.rsa_blinded_message.blinded_msg_size),
diff --git a/src/lib/json/json_pack.c b/src/lib/json/json_pack.c
index 7b41a967e..d298e6efe 100644
--- a/src/lib/json/json_pack.c
+++ b/src/lib/json/json_pack.c
@@ -440,4 +440,41 @@ GNUNET_JSON_pack_blinded_message (const char *name,
return ps;
}
+
+struct GNUNET_JSON_PackSpec
+GNUNET_JSON_pack_blinded_sig (
+ const char *name,
+ const struct GNUNET_CRYPTO_BlindedSignature *sig)
+{
+ struct GNUNET_JSON_PackSpec ps = {
+ .field_name = name,
+ };
+
+ if (NULL == sig)
+ return ps;
+ switch (sig->cipher)
+ {
+ case GNUNET_CRYPTO_BSA_INVALID:
+ break;
+ case GNUNET_CRYPTO_BSA_RSA:
+ ps.object = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_string ("cipher",
+ "RSA"),
+ GNUNET_JSON_pack_rsa_signature ("blinded_rsa_signature",
+ sig->details.blinded_rsa_signature));
+ return ps;
+ case GNUNET_CRYPTO_BSA_CS:
+ ps.object = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_string ("cipher",
+ "CS"),
+ GNUNET_JSON_pack_uint64 ("b",
+ sig->details.blinded_cs_answer.b),
+ GNUNET_JSON_pack_data_auto ("s",
+ &sig->details.blinded_cs_answer.s_scalar));
+ return ps;
+ }
+ GNUNET_assert (0);
+ return ps;
+}
+
/* end of json_pack.c */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: add pack helper for blinded sig,
gnunet <=