crypto: fix compile error: use named type in sizeof

Btw, the warning 4200 remains disabled, but it did not get triggered
(GCC 6.1.1, ARM). But, perhaps a better way than disabling
the warning would be to do what is suggested here:
http://stackoverflow.com/questions/3350852/how-to-correctly-fix-zero-sized-array-in-struct-union-warning-c4200-without%3E
This commit is contained in:
redfish 2016-05-18 00:52:01 -04:00
parent a837c9cb0f
commit 6462a3a6db

View File

@ -263,16 +263,17 @@ namespace crypto {
PUSH_WARNINGS PUSH_WARNINGS
DISABLE_VS_WARNINGS(4200) DISABLE_VS_WARNINGS(4200)
struct ec_point_pair {
ec_point a, b;
};
struct rs_comm { struct rs_comm {
hash h; hash h;
struct { struct ec_point_pair ab[];
ec_point a, b;
} ab[];
}; };
POP_WARNINGS POP_WARNINGS
static inline size_t rs_comm_size(size_t pubs_count) { static inline size_t rs_comm_size(size_t pubs_count) {
return sizeof(rs_comm) + pubs_count * sizeof(rs_comm().ab[0]); return sizeof(rs_comm) + pubs_count * sizeof(ec_point_pair);
} }
void crypto_ops::generate_ring_signature(const hash &prefix_hash, const key_image &image, void crypto_ops::generate_ring_signature(const hash &prefix_hash, const key_image &image,