diff --git a/libraries/libfc/include/fc/crypto/bls_public_key.hpp b/libraries/libfc/include/fc/crypto/bls_public_key.hpp index 2824acdc0d..81a6538fe1 100644 --- a/libraries/libfc/include/fc/crypto/bls_public_key.hpp +++ b/libraries/libfc/include/fc/crypto/bls_public_key.hpp @@ -56,8 +56,8 @@ namespace fc::crypto::blslib { template friend T& operator<<(T& ds, const bls_public_key& sig) { // Serialization as variable length array when it is stored as a fixed length array. This makes for easier deserialization by external tools - fc::raw::pack(ds, fc::unsigned_int(static_cast(sig._affine_non_montgomery_le.size()*sizeof(uint8_t)))); - ds.write(reinterpret_cast(sig._affine_non_montgomery_le.data()), sig._affine_non_montgomery_le.size()*sizeof(uint8_t)); + fc::raw::pack(ds, fc::unsigned_int(static_cast(sizeof(sig._affine_non_montgomery_le)))); + ds.write(reinterpret_cast(sig._affine_non_montgomery_le.data()), sizeof(sig._affine_non_montgomery_le)); return ds; } @@ -66,8 +66,8 @@ namespace fc::crypto::blslib { // Serialization as variable length array when it is stored as a fixed length array. This makes for easier deserialization by external tools fc::unsigned_int size; fc::raw::unpack( ds, size ); - FC_ASSERT(size.value == sig._affine_non_montgomery_le.size()*sizeof(uint8_t)); - ds.read(reinterpret_cast(sig._affine_non_montgomery_le.data()), sig._affine_non_montgomery_le.size()*sizeof(uint8_t)); + FC_ASSERT(size.value == sizeof(sig._affine_non_montgomery_le)); + ds.read(reinterpret_cast(sig._affine_non_montgomery_le.data()), sizeof(sig._affine_non_montgomery_le)); sig._jacobian_montgomery_le = from_affine_bytes_le(sig._affine_non_montgomery_le); return ds; } diff --git a/libraries/libfc/include/fc/crypto/bls_signature.hpp b/libraries/libfc/include/fc/crypto/bls_signature.hpp index 9c8a3d96a2..f536556a4b 100644 --- a/libraries/libfc/include/fc/crypto/bls_signature.hpp +++ b/libraries/libfc/include/fc/crypto/bls_signature.hpp @@ -47,8 +47,8 @@ namespace fc::crypto::blslib { template friend T& operator<<(T& ds, const bls_signature& sig) { // Serialization as variable length array when it is stored as a fixed length array. This makes for easier deserialization by external tools - fc::raw::pack(ds, fc::unsigned_int(static_cast(sig._affine_non_montgomery_le.size()*sizeof(uint8_t)))); - ds.write(reinterpret_cast(sig._affine_non_montgomery_le.data()), sig._affine_non_montgomery_le.size()*sizeof(uint8_t)); + fc::raw::pack(ds, fc::unsigned_int(static_cast(sizeof(sig._affine_non_montgomery_le)))); + ds.write(reinterpret_cast(sig._affine_non_montgomery_le.data()), sizeof(sig._affine_non_montgomery_le)); return ds; } @@ -58,8 +58,8 @@ namespace fc::crypto::blslib { // Serialization as variable length array when it is stored as a fixed length array. This makes for easier deserialization by external tools fc::unsigned_int size; fc::raw::unpack( ds, size ); - FC_ASSERT(size.value == sig._affine_non_montgomery_le.size()*sizeof(uint8_t)); - ds.read(reinterpret_cast(sig._affine_non_montgomery_le.data()), sig._affine_non_montgomery_le.size()*sizeof(uint8_t)); + FC_ASSERT(size.value == sizeof(sig._affine_non_montgomery_le)); + ds.read(reinterpret_cast(sig._affine_non_montgomery_le.data()), sizeof(sig._affine_non_montgomery_le)); sig._jacobian_montgomery_le = to_jacobian_montgomery_le(sig._affine_non_montgomery_le); return ds; } @@ -109,8 +109,8 @@ namespace fc::crypto::blslib { constexpr bool raw = false; std::array affine_non_montgomery_le = sig._jacobian_montgomery_le.toAffineBytesLE(raw); // Serialization as variable length array when it is stored as a fixed length array. This makes for easier deserialization by external tools - fc::raw::pack(ds, fc::unsigned_int(static_cast(affine_non_montgomery_le.size()*sizeof(uint8_t)))); - ds.write(reinterpret_cast(affine_non_montgomery_le.data()), affine_non_montgomery_le.size()*sizeof(uint8_t)); + fc::raw::pack(ds, fc::unsigned_int(static_cast(sizeof(affine_non_montgomery_le)))); + ds.write(reinterpret_cast(affine_non_montgomery_le.data()), sizeof(affine_non_montgomery_le)); return ds; } @@ -121,8 +121,8 @@ namespace fc::crypto::blslib { fc::unsigned_int size; fc::raw::unpack( ds, size ); std::array affine_non_montgomery_le; - FC_ASSERT(size.value == affine_non_montgomery_le.size()*sizeof(uint8_t)); - ds.read(reinterpret_cast(affine_non_montgomery_le.data()), affine_non_montgomery_le.size()*sizeof(uint8_t)); + FC_ASSERT(size.value == sizeof(affine_non_montgomery_le)); + ds.read(reinterpret_cast(affine_non_montgomery_le.data()), sizeof(affine_non_montgomery_le)); sig._jacobian_montgomery_le = bls_signature::to_jacobian_montgomery_le(affine_non_montgomery_le); return ds; }