From: Ilya Dryomov Date: Mon, 4 May 2020 15:42:28 +0000 (+0200) Subject: msg/async/frames_v2: rename epilogue structs X-Git-Tag: v14.2.11~8^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=205f5319f348f46a0c1722944bf8f6cb504f93de;p=ceph.git msg/async/frames_v2: rename epilogue structs In preparation for msgr2,1, rename epilogue structs: epilogue_plain_block_t to epilogue_crc_rev0_block_t and epilogue_secure_block_t to epilogue_secure_rev0_block_t (rev0 stands for revision 0). Also, get rid of size constants that just disguise the struct type. Signed-off-by: Ilya Dryomov (cherry picked from commit 712915b3d46652c07c2b05162d610afd64891e9e) Conflicts: src/crimson/net/ProtocolV2.cc [ crimson doesn't support msgr2 in nautilus ] --- diff --git a/src/msg/async/frames_v2.cc b/src/msg/async/frames_v2.cc index f924d7880206..89fecac4eb96 100644 --- a/src/msg/async/frames_v2.cc +++ b/src/msg/async/frames_v2.cc @@ -89,7 +89,7 @@ uint64_t FrameAssembler::get_frame_onwire_len() const { bufferlist FrameAssembler::asm_crc_rev0(const preamble_block_t& preamble, bufferlist segment_bls[]) const { - epilogue_plain_block_t epilogue; + epilogue_crc_rev0_block_t epilogue; // FIPS zeroization audit 20191115: this memset is not security related. ::memset(&epilogue, 0, sizeof(epilogue)); @@ -112,7 +112,7 @@ bufferlist FrameAssembler::asm_secure_rev0(const preamble_block_t& preamble, preamble_bl.append(reinterpret_cast(&preamble), sizeof(preamble)); - epilogue_secure_block_t epilogue; + epilogue_secure_rev0_block_t epilogue; // FIPS zeroization audit 20191115: this memset is not security related. ::memset(&epilogue, 0, sizeof(epilogue)); bufferlist epilogue_bl(sizeof(epilogue)); @@ -209,8 +209,8 @@ Tag FrameAssembler::disassemble_preamble(bufferlist& preamble_bl) { bool FrameAssembler::disasm_all_crc_rev0(bufferlist segment_bls[], bufferlist& epilogue_bl) const { - ceph_assert(epilogue_bl.length() == sizeof(epilogue_plain_block_t)); - auto epilogue = reinterpret_cast( + ceph_assert(epilogue_bl.length() == sizeof(epilogue_crc_rev0_block_t)); + auto epilogue = reinterpret_cast( epilogue_bl.c_str()); for (size_t i = 0; i < m_descs.size(); i++) { @@ -230,10 +230,10 @@ bool FrameAssembler::disasm_all_secure_rev0(bufferlist segment_bls[], } } - ceph_assert(epilogue_bl.length() == sizeof(epilogue_secure_block_t) + + ceph_assert(epilogue_bl.length() == sizeof(epilogue_secure_rev0_block_t) + get_auth_tag_len()); m_crypto->rx->authenticated_decrypt_update_final(epilogue_bl); - auto epilogue = reinterpret_cast( + auto epilogue = reinterpret_cast( epilogue_bl.c_str()); return !(epilogue->late_flags & FRAME_FLAGS_LATEABRT); } diff --git a/src/msg/async/frames_v2.h b/src/msg/async/frames_v2.h index 194294cd30ee..2c137cfbafa6 100644 --- a/src/msg/async/frames_v2.h +++ b/src/msg/async/frames_v2.h @@ -129,27 +129,20 @@ static_assert(std::is_standard_layout::value); // In addition to integrity/authenticity data each variant of epilogue // conveys late_flags. The initial user of this field will be the late // frame abortion facility. -struct epilogue_plain_block_t { +struct epilogue_crc_rev0_block_t { __u8 late_flags; std::array crc_values; } __attribute__((packed)); -static_assert(std::is_standard_layout::value); +static_assert(std::is_standard_layout_v); -struct epilogue_secure_block_t { +struct epilogue_secure_rev0_block_t { __u8 late_flags; __u8 padding[CRYPTO_BLOCK_SIZE - sizeof(late_flags)]; __u8 ciphers_private_data[]; } __attribute__((packed)); -static_assert(sizeof(epilogue_secure_block_t) % CRYPTO_BLOCK_SIZE == 0); -static_assert(std::is_standard_layout::value); - - -static constexpr uint32_t FRAME_PREAMBLE_SIZE = sizeof(preamble_block_t); -static constexpr uint32_t FRAME_PLAIN_EPILOGUE_SIZE = - sizeof(epilogue_plain_block_t); -static constexpr uint32_t FRAME_SECURE_EPILOGUE_SIZE = - sizeof(epilogue_secure_block_t); +static_assert(sizeof(epilogue_secure_rev0_block_t) % CRYPTO_BLOCK_SIZE == 0); +static_assert(std::is_standard_layout_v); #define FRAME_FLAGS_LATEABRT (1<<0) /* frame was aborted after txing data */ @@ -193,9 +186,9 @@ public: uint32_t get_epilogue_onwire_len() const { ceph_assert(!m_descs.empty()); if (m_crypto->rx) { - return sizeof(epilogue_secure_block_t) + get_auth_tag_len(); + return sizeof(epilogue_secure_rev0_block_t) + get_auth_tag_len(); } - return sizeof(epilogue_plain_block_t); + return sizeof(epilogue_crc_rev0_block_t); } uint64_t get_frame_logical_len() const;