diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2022-04-26 11:23:27 +0200 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2022-04-26 11:23:27 +0200 |
commit | a92d3aae7bd7f6fe894fb901c351a0ce320c87a3 (patch) | |
tree | d13f2318c2165fbcbd3e7d7d2abc79a20100b29a /src/util | |
parent | f24fc1856401a7d10e8e1df7c8364c8e10ec1372 (diff) | |
download | exchange-a92d3aae7bd7f6fe894fb901c351a0ce320c87a3.tar.xz |
-use uint32_t instead of uint8_t + padding for the age
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/age_restriction.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/util/age_restriction.c b/src/util/age_restriction.c index 03c2001f4..45ebc03c4 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 |