gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: fix age attestation signature pa


From: gnunet
Subject: [taler-exchange] branch master updated: fix age attestation signature padding and endianess
Date: Tue, 26 Apr 2022 01:28:58 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 38fcca16 fix age attestation signature padding and endianess
38fcca16 is described below

commit 38fcca16c856c989cd0ed7b95e44ca0842a8a576
Author: Florian Dold <florian@dold.me>
AuthorDate: Tue Apr 26 01:28:36 2022 +0200

    fix age attestation signature padding and endianess
---
 src/util/age_restriction.c | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/src/util/age_restriction.c b/src/util/age_restriction.c
index dfb376b2..f4a58946 100644
--- a/src/util/age_restriction.c
+++ b/src/util/age_restriction.c
@@ -250,6 +250,16 @@ TALER_age_commitment_derive (
 }
 
 
+GNUNET_NETWORK_STRUCT_BEGIN
+
+/**
+ * Age group mask in network byte order.
+ */
+struct TALER_AgeMaskNBO
+{
+  uint32_t bits_nbo;
+};
+
 /**
  * Used for attestation of a particular age
  */
@@ -263,14 +273,24 @@ struct TALER_AgeAttestationPS
   /**
    * Age mask that defines the underlying age groups
    */
-  struct TALER_AgeMask mask;
+  struct TALER_AgeMaskNBO mask;
 
   /**
    * The particular age that this attestation is for
    */
   uint8_t age;
+
+  /**
+   * Pad to a total size of 16 bytes.
+   *
+   * (Strangly, the compiler leaves padding after the age
+   * field even with GNUNET_PACKED / GNUNET_NETWORK_STRUCT_BEGIN.
+   */
+  uint8_t padding[3];
 };
 
+GNUNET_NETWORK_STRUCT_END
+
 
 enum GNUNET_GenericReturnValue
 TALER_age_commitment_attest (
@@ -305,8 +325,9 @@ TALER_age_commitment_attest (
     struct TALER_AgeAttestationPS at = {
       .purpose.size = htonl (sizeof(at)),
       .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_AGE_ATTESTATION),
-      .mask = cp->commitment.mask,
-      .age = age
+      .mask.bits_nbo = GNUNET_htonll (cp->commitment.mask.bits),
+      .age = age,
+      .padding = { 0 },
     };
 
 #ifndef AGE_RESTRICTION_WITH_ECDSA
@@ -344,14 +365,18 @@ TALER_age_commitment_verify (
     return GNUNET_OK;
 
   if (group > comm->num)
+  {
+    GNUNET_break_op (0);
     return GNUNET_NO;
+  }
 
   {
     struct TALER_AgeAttestationPS at = {
       .purpose.size = htonl (sizeof(at)),
       .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_AGE_ATTESTATION),
-      .mask = comm->mask,
+      .mask.bits_nbo = GNUNET_htonll (comm->mask.bits),
       .age = age,
+      .padding = { 0 },
     };
 
 #ifndef AGE_RESTRICTION_WITH_ECDSA

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]