[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: generate shorter UUID strings f
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: generate shorter UUID strings for interaction with users (#7089) |
Date: |
Tue, 16 Nov 2021 15:05:31 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new 7815ced generate shorter UUID strings for interaction with users
(#7089)
7815ced is described below
commit 7815ced57e8849465e9d821ea8c8e9d705efd0ca
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Nov 16 15:05:29 2021 +0100
generate shorter UUID strings for interaction with users (#7089)
---
.../anastasis_authorization_plugin_email.c | 20 ++++++-----------
.../anastasis_authorization_plugin_post.c | 21 ++++++------------
.../anastasis_authorization_plugin_sms.c | 17 ++++-----------
src/include/anastasis_crypto_lib.h | 13 +++++++++++
src/util/anastasis_crypto.c | 25 ++++++++++++++++++++++
5 files changed, 54 insertions(+), 42 deletions(-)
diff --git a/src/authorization/anastasis_authorization_plugin_email.c
b/src/authorization/anastasis_authorization_plugin_email.c
index 0eefcc5..f618d7b 100644
--- a/src/authorization/anastasis_authorization_plugin_email.c
+++ b/src/authorization/anastasis_authorization_plugin_email.c
@@ -374,20 +374,12 @@ email_process (struct ANASTASIS_AUTHORIZATION_State *as,
GNUNET_DISK_PIPE_END_WRITE);
GNUNET_assert (NULL != pipe_stdin);
GNUNET_DISK_pipe_close (p);
- {
- char *tpk;
-
- tpk = GNUNET_STRINGS_data_to_string_alloc (
- &as->truth_uuid,
- sizeof (as->truth_uuid));
- GNUNET_asprintf (&as->msg,
- get_message (as->ctx->messages,
- connection,
- "body"),
- (unsigned long long) as->code,
- tpk);
- GNUNET_free (tpk);
- }
+ GNUNET_asprintf (&as->msg,
+ get_message (as->ctx->messages,
+ connection,
+ "body"),
+ (unsigned long long) as->code,
+ ANASTASIS_crypto_uuid2s (&as->truth_uuid));
{
const char *off = as->msg;
diff --git a/src/authorization/anastasis_authorization_plugin_post.c
b/src/authorization/anastasis_authorization_plugin_post.c
index 4adeffd..b938bce 100644
--- a/src/authorization/anastasis_authorization_plugin_post.c
+++ b/src/authorization/anastasis_authorization_plugin_post.c
@@ -448,21 +448,12 @@ post_process (struct ANASTASIS_AUTHORIZATION_State *as,
GNUNET_DISK_PIPE_END_WRITE);
GNUNET_assert (NULL != pipe_stdin);
GNUNET_DISK_pipe_close (p);
- {
- char *tpk;
-
- tpk = GNUNET_STRINGS_data_to_string_alloc (
- &as->truth_uuid,
- sizeof (as->truth_uuid));
- GNUNET_asprintf (&as->msg,
- get_message (as->ctx->messages,
- connection,
- "body"),
- (unsigned long long) as->code,
- tpk);
- GNUNET_free (tpk);
- }
-
+ GNUNET_asprintf (&as->msg,
+ get_message (as->ctx->messages,
+ connection,
+ "body"),
+ (unsigned long long) as->code,
+ ANASTASIS_CRYPTO_uuid2s (&as->truth_uuid));
{
const char *off = as->msg;
size_t left = strlen (off);
diff --git a/src/authorization/anastasis_authorization_plugin_sms.c
b/src/authorization/anastasis_authorization_plugin_sms.c
index 94b2c0d..2410677 100644
--- a/src/authorization/anastasis_authorization_plugin_sms.c
+++ b/src/authorization/anastasis_authorization_plugin_sms.c
@@ -373,19 +373,10 @@ sms_process (struct ANASTASIS_AUTHORIZATION_State *as,
GNUNET_DISK_PIPE_END_WRITE);
GNUNET_assert (NULL != pipe_stdin);
GNUNET_DISK_pipe_close (p);
- {
- char *tpk;
-
- tpk = GNUNET_STRINGS_data_to_string_alloc (
- &as->truth_uuid,
- sizeof (as->truth_uuid));
- GNUNET_asprintf (&as->msg,
- "A-%llu\nAnastasis\n%s",
- (unsigned long long) as->code,
- tpk);
- GNUNET_free (tpk);
- }
-
+ GNUNET_asprintf (&as->msg,
+ "A-%llu\nAnastasis\n: %s",
+ (unsigned long long) as->code,
+ ANASTASIS_CRYPTO_uuid2s (&as->truth_uuid));
{
const char *off = as->msg;
size_t left = strlen (off);
diff --git a/src/include/anastasis_crypto_lib.h
b/src/include/anastasis_crypto_lib.h
index fbafcd6..f824bfe 100644
--- a/src/include/anastasis_crypto_lib.h
+++ b/src/include/anastasis_crypto_lib.h
@@ -543,3 +543,16 @@ ANASTASIS_CRYPTO_core_secret_recover (
size_t encrypted_core_secret_size,
void **core_secret,
size_t *core_secret_size);
+
+
+/**
+ * Convert a @a uuid to a shortened, human-readable string
+ * useful to show to users to identify the truth.
+ * Note that the return value is in a global variable and
+ * only valid until the next invocation of this function.
+ *
+ * @param uuid UUID to convert
+ * @return string representation
+ */
+const char *
+ANASTASIS_CRYPTO_uuid2s (const struct ANASTASIS_CRYPTO_TruthUUIDP *uuid);
diff --git a/src/util/anastasis_crypto.c b/src/util/anastasis_crypto.c
index f5e6c77..8f218f7 100644
--- a/src/util/anastasis_crypto.c
+++ b/src/util/anastasis_crypto.c
@@ -579,4 +579,29 @@ ANASTASIS_CRYPTO_destroy_encrypted_core_secret (
}
+/**
+ * Convert a @a uuid to a shortened, human-readable string
+ * useful to show to users to identify the truth.
+ * Note that the return value is in a global variable and
+ * only valid until the next invocation of this function.
+ *
+ * @param uuid UUID to convert
+ * @return string representation
+ */
+const char *
+ANASTASIS_CRYPTO_uuid2s (const struct ANASTASIS_CRYPTO_TruthUUIDP *uuid)
+{
+ static char uuids[7];
+ char *tpk;
+
+ tpk = GNUNET_STRINGS_data_to_string_alloc (uuid,
+ sizeof (*uuid));
+ memcpy (uuids,
+ tpk,
+ sizeof (uuids) - 1);
+ GNUNET_free (tpk);
+ return uuids;
+}
+
+
/* end of anastasis_crypto.c */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis] branch master updated: generate shorter UUID strings for interaction with users (#7089),
gnunet <=