diff options
author | luigi1111 <luigi1111w@gmail.com> | 2023-11-06 09:29:03 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2023-11-06 09:29:03 -0500 |
commit | d5c667a5ad1e78f6b49da7c370814ff1478d692b (patch) | |
tree | db4f260f4d07b1cc28566d90881cb3757caee60a /src | |
parent | Merge pull request #9034 (diff) | |
parent | ringct: make `rctSigBase` serialization follow strict aliasing rule (diff) | |
download | monero-d5c667a5ad1e78f6b49da7c370814ff1478d692b.tar.xz |
Merge pull request #9036
eae62a0 ringct: make
ctSigBase serialization follow strict aliasing rule (jeffro256)
Diffstat (limited to 'src')
-rw-r--r-- | src/ringct/rctTypes.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/ringct/rctTypes.h b/src/ringct/rctTypes.h index ab1a26b26..32cd8dc6f 100644 --- a/src/ringct/rctTypes.h +++ b/src/ringct/rctTypes.h @@ -362,11 +362,17 @@ namespace rct { { if (type == RCTTypeBulletproof2 || type == RCTTypeCLSAG || type == RCTTypeBulletproofPlus) { + // Since RCTTypeBulletproof2 enote types, we don't serialize the blinding factor, and only serialize the + // first 8 bytes of ecdhInfo[i].amount ar.begin_object(); - if (!typename Archive<W>::is_saving()) + crypto::hash8 trunc_amount; // placeholder variable needed to maintain "strict aliasing" + if (!typename Archive<W>::is_saving()) // loading memset(ecdhInfo[i].amount.bytes, 0, sizeof(ecdhInfo[i].amount.bytes)); - crypto::hash8 &amount = (crypto::hash8&)ecdhInfo[i].amount; - FIELD(amount); + else // saving + memcpy(trunc_amount.data, ecdhInfo[i].amount.bytes, sizeof(trunc_amount)); + FIELD(trunc_amount); + if (!typename Archive<W>::is_saving()) // loading + memcpy(ecdhInfo[i].amount.bytes, trunc_amount.data, sizeof(trunc_amount)); ar.end_object(); } else |