#define dout_subsys ceph_subsys_auth
+namespace {
+#ifdef WITH_SEASTAR
+ crimson::common::ConfigProxy& conf(CephContext*) {
+ return crimson::common::local_conf();
+ }
+#else
+ ConfigProxy& conf(CephContext* cct) {
+ return cct->_conf;
+ }
+#endif
+}
+
int CephxSessionHandler::_calc_signature(Message *m, uint64_t *psig)
{
const ceph_msg_header& header = m->get_header();
// - skip the leading 4 byte wrapper from encode_encrypt
struct {
__u8 v;
- __le64 magic;
- __le32 len;
- __le32 header_crc;
- __le32 front_crc;
- __le32 middle_crc;
- __le32 data_crc;
+ ceph_le64 magic;
+ ceph_le32 len;
+ ceph_le32 header_crc;
+ ceph_le32 front_crc;
+ ceph_le32 middle_crc;
+ ceph_le32 data_crc;
} __attribute__ ((packed)) sigblock = {
- 1, mswab(AUTH_ENC_MAGIC), mswab<uint32_t>(4*4),
- mswab<uint32_t>(header.crc), mswab<uint32_t>(footer.front_crc),
- mswab<uint32_t>(footer.middle_crc), mswab<uint32_t>(footer.data_crc)
+ 1, ceph_le64(AUTH_ENC_MAGIC), ceph_le32(4 * 4),
+ ceph_le32(header.crc), ceph_le32(footer.front_crc),
+ ceph_le32(footer.middle_crc), ceph_le32(footer.data_crc)
};
char exp_buf[CryptoKey::get_max_outbuf_size(sizeof(sigblock))];
return -1;
}
- *psig = *reinterpret_cast<__le64*>(exp_buf);
+ *psig = *reinterpret_cast<ceph_le64*>(exp_buf);
} else {
// newer mimic+ signatures
struct {
- __le32 header_crc;
- __le32 front_crc;
- __le32 front_len;
- __le32 middle_crc;
- __le32 middle_len;
- __le32 data_crc;
- __le32 data_len;
- __le32 seq_lower_word;
+ ceph_le32 header_crc;
+ ceph_le32 front_crc;
+ ceph_le32 front_len;
+ ceph_le32 middle_crc;
+ ceph_le32 middle_len;
+ ceph_le32 data_crc;
+ ceph_le32 data_len;
+ ceph_le32 seq_lower_word;
} __attribute__ ((packed)) sigblock = {
- mswab<uint32_t>(header.crc),
- mswab<uint32_t>(footer.front_crc),
- mswab<uint32_t>(header.front_len),
- mswab<uint32_t>(footer.middle_crc),
- mswab<uint32_t>(header.middle_len),
- mswab<uint32_t>(footer.data_crc),
- mswab<uint32_t>(header.data_len),
- mswab<uint32_t>(header.seq)
+ ceph_le32(header.crc),
+ ceph_le32(footer.front_crc),
+ ceph_le32(header.front_len),
+ ceph_le32(footer.middle_crc),
+ ceph_le32(header.middle_len),
+ ceph_le32(footer.data_crc),
+ ceph_le32(header.data_len),
+ ceph_le32(header.seq)
};
char exp_buf[CryptoKey::get_max_outbuf_size(sizeof(sigblock))];
}
struct enc {
- __le64 a, b, c, d;
+ ceph_le64 a, b, c, d;
} *penc = reinterpret_cast<enc*>(exp_buf);
*psig = penc->a ^ penc->b ^ penc->c ^ penc->d;
}
int CephxSessionHandler::sign_message(Message *m)
{
// If runtime signing option is off, just return success without signing.
- if (!cct->_conf->cephx_sign_messages) {
+ if (!conf(cct)->cephx_sign_messages) {
return 0;
}
int CephxSessionHandler::check_message_signature(Message *m)
{
// If runtime signing option is off, just return success without checking signature.
- if (!cct->_conf->cephx_sign_messages) {
+ if (!conf(cct)->cephx_sign_messages) {
return 0;
}
if ((features & CEPH_FEATURE_MSG_AUTH) == 0) {