seastar::future<Tag> ProtocolV2::read_main_preamble()
{
- return read_exactly(FRAME_PREAMBLE_SIZE)
+ return read_exactly(sizeof(preamble_block_t))
.then([this] (auto bl) {
if (session_stream_handlers.rx) {
session_stream_handlers.rx->reset_rx_handler();
).then([this] {
// TODO: get_epilogue_size()
ceph_assert(!session_stream_handlers.rx);
- return read_exactly(FRAME_PLAIN_EPILOGUE_SIZE);
+ return read_exactly(sizeof(epilogue_crc_rev0_block_t));
}).then([this] (auto bl) {
logger().trace("{} RECV({}) frame epilogue", conn, bl.size());
// TODO
ceph_assert(false);
} else {
- auto& epilogue = *reinterpret_cast<const epilogue_plain_block_t*>(bl.get());
+ auto& epilogue = *reinterpret_cast<const epilogue_crc_rev0_block_t*>(bl.get());
for (std::uint8_t idx = 0; idx < rx_segments_data.size(); idx++) {
const __u32 expected_crc = epilogue.crc_values[idx];
const __u32 calculated_crc = rx_segments_data[idx].crc32c(-1);
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));
preamble_bl.append(reinterpret_cast<const char*>(&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));
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<const epilogue_plain_block_t*>(
+ ceph_assert(epilogue_bl.length() == sizeof(epilogue_crc_rev0_block_t));
+ auto epilogue = reinterpret_cast<const epilogue_crc_rev0_block_t*>(
epilogue_bl.c_str());
for (size_t i = 0; i < m_descs.size(); i++) {
}
}
- 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<const epilogue_secure_block_t*>(
+ auto epilogue = reinterpret_cast<const epilogue_secure_rev0_block_t*>(
epilogue_bl.c_str());
return !(epilogue->late_flags & FRAME_FLAGS_LATEABRT);
}
// 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;
ceph_le32 crc_values[MAX_NUM_SEGMENTS];
} __attribute__((packed));
-static_assert(std::is_standard_layout<epilogue_plain_block_t>::value);
+static_assert(std::is_standard_layout_v<epilogue_crc_rev0_block_t>);
-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<epilogue_secure_block_t>::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<epilogue_secure_rev0_block_t>);
#define FRAME_FLAGS_LATEABRT (1<<0) /* frame was aborted after txing data */
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;