gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: -use uint32_t instead of uint8_t


From: gnunet
Subject: [taler-exchange] branch master updated: -use uint32_t instead of uint8_t + padding for the age
Date: Tue, 26 Apr 2022 11:23:30 +0200

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

oec pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new a92d3aae -use uint32_t instead of uint8_t + padding for the age
a92d3aae is described below

commit a92d3aae7bd7f6fe894fb901c351a0ce320c87a3
Author: Özgür Kesim <oec-taler@kesim.org>
AuthorDate: Tue Apr 26 11:23:27 2022 +0200

    -use uint32_t instead of uint8_t + padding for the age
---
 src/util/age_restriction.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/src/util/age_restriction.c b/src/util/age_restriction.c
index 03c2001f..45ebc03c 100644
--- a/src/util/age_restriction.c
+++ b/src/util/age_restriction.c
@@ -267,8 +267,9 @@ struct TALER_AgeAttestationPS
 {
   /**
    * Purpose must be #TALER_SIGNATURE_WALLET_AGE_ATTESTATION.
+   * (no GNUNET_PACKED here because the struct is already packed)
    */
-  struct GNUNET_CRYPTO_EccSignaturePurpose purpose GNUNET_PACKED;
+  struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
 
   /**
    * Age mask that defines the underlying age groups
@@ -276,17 +277,10 @@ struct TALER_AgeAttestationPS
   struct TALER_AgeMaskNBO mask GNUNET_PACKED;
 
   /**
-   * The particular age that this attestation is for
+   * The particular age that this attestation is for.
+   * We use uint32_t here for alignment.
    */
-  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];
+  uint32_t age GNUNET_PACKED;
 };
 
 GNUNET_NETWORK_STRUCT_END
@@ -326,8 +320,7 @@ TALER_age_commitment_attest (
       .purpose.size = htonl (sizeof(at)),
       .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_AGE_ATTESTATION),
       .mask.bits_nbo = htonl (cp->commitment.mask.bits),
-      .age = age,
-      .padding = { 0 },
+      .age = htonl (age),
     };
 
 #ifndef AGE_RESTRICTION_WITH_ECDSA
@@ -375,8 +368,7 @@ TALER_age_commitment_verify (
       .purpose.size = htonl (sizeof(at)),
       .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_AGE_ATTESTATION),
       .mask.bits_nbo = htonl (comm->mask.bits),
-      .age = age,
-      .padding = { 0 },
+      .age = htonl (age),
     };
 
 #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]