Showing the changes to include/linux/ceph (4 of 8 files). Show all
Unified · Split
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | struct ceph_auth_client; |
| 15 | 15 | struct ceph_authorizer; |
| 16 | +struct ceph_msg; | |
| 16 | 17 | |
| 17 | 18 | struct ceph_auth_handshake { |
| 18 | 19 | struct ceph_authorizer *authorizer; |
| @@ -20,6 +21,10 @@ struct ceph_auth_handshake { · 1 unmodified line | ||
| 20 | 21 | size_t authorizer_buf_len; |
| 21 | 22 | void *authorizer_reply_buf; |
| 22 | 23 | size_t authorizer_reply_buf_len; |
| 24 | + int (*sign_message)(struct ceph_auth_handshake *auth, | |
| 25 | + struct ceph_msg *msg); | |
| 26 | + int (*check_message_signature)(struct ceph_auth_handshake *auth, | |
| 27 | + struct ceph_msg *msg); | |
| 23 | 28 | }; |
| 24 | 29 | |
| 25 | 30 | struct ceph_auth_client_ops { |
| @@ -66,6 +71,11 @@ struct ceph_auth_client_ops { · 40 unmodified lines | ||
| 66 | 71 | void (*reset)(struct ceph_auth_client *ac); |
| 67 | 72 | |
| 68 | 73 | void (*destroy)(struct ceph_auth_client *ac); |
| 74 | + | |
| 75 | + int (*sign_message)(struct ceph_auth_handshake *auth, | |
| 76 | + struct ceph_msg *msg); | |
| 77 | + int (*check_message_signature)(struct ceph_auth_handshake *auth, | |
| 78 | + struct ceph_msg *msg); | |
| 69 | 79 | }; |
| 70 | 80 | |
| 71 | 81 | struct ceph_auth_client { |
| @@ -113,4 +123,20 @@ extern int ceph_auth_verify_authorizer_reply(struct ceph_auth_client *ac, · 41 unmodified lines | ||
| 113 | 123 | extern void ceph_auth_invalidate_authorizer(struct ceph_auth_client *ac, |
| 114 | 124 | int peer_type); |
| 115 | 125 | |
| 126 | +static inline int ceph_auth_sign_message(struct ceph_auth_handshake *auth, | |
| 127 | + struct ceph_msg *msg) | |
| 128 | +{ | |
| 129 | + if (auth->sign_message) | |
| 130 | + return auth->sign_message(auth, msg); | |
| 131 | + return 0; | |
| 132 | +} | |
| 133 | + | |
| 134 | +static inline | |
| 135 | +int ceph_auth_check_message_signature(struct ceph_auth_handshake *auth, | |
| 136 | + struct ceph_msg *msg) | |
| 137 | +{ | |
| 138 | + if (auth->check_message_signature) | |
| 139 | + return auth->check_message_signature(auth, msg); | |
| 140 | + return 0; | |
| 141 | +} | |
| 116 | 142 | #endif |
| @@ -84,6 +84,7 @@ static inline u64 ceph_sanitize_features(u64 features) · 83 unmodified lines | ||
| 84 | 84 | CEPH_FEATURE_PGPOOL3 | \ |
| 85 | 85 | CEPH_FEATURE_OSDENC | \ |
| 86 | 86 | CEPH_FEATURE_CRUSH_TUNABLES | \ |
| 87 | + CEPH_FEATURE_MSG_AUTH | \ | |
| 87 | 88 | CEPH_FEATURE_CRUSH_TUNABLES2 | \ |
| 88 | 89 | CEPH_FEATURE_REPLY_CREATE_INODE | \ |
| 89 | 90 | CEPH_FEATURE_OSDHASHPSPOOL | \ |
| @@ -42,6 +42,10 @@ struct ceph_connection_operations { · 41 unmodified lines | ||
| 42 | 42 | struct ceph_msg * (*alloc_msg) (struct ceph_connection *con, |
| 43 | 43 | struct ceph_msg_header *hdr, |
| 44 | 44 | int *skip); |
| 45 | + int (*sign_message) (struct ceph_connection *con, struct ceph_msg *msg); | |
| 46 | + | |
| 47 | + int (*check_message_signature) (struct ceph_connection *con, | |
| 48 | + struct ceph_msg *msg); | |
| 45 | 49 | }; |
| 46 | 50 | |
| 47 | 51 | /* use format string %s%d */ |
| @@ -142,7 +146,10 @@ struct ceph_msg_data_cursor { · 94 unmodified lines | ||
| 142 | 146 | */ |
| 143 | 147 | struct ceph_msg { |
| 144 | 148 | struct ceph_msg_header hdr; /* header */ |
| 145 | − struct ceph_msg_footer footer; /* footer */ | |
| 149 | + union { | |
| 150 | + struct ceph_msg_footer footer; /* footer */ | |
| 151 | + struct ceph_msg_footer_old old_footer; /* old format footer */ | |
| 152 | + }; | |
| 146 | 153 | struct kvec front; /* unaligned blobs of message */ |
| 147 | 154 | struct ceph_buffer *middle; |
| 148 | 155 | |
| @@ -164,13 +164,21 @@ struct ceph_msg_header { · 163 unmodified lines | ||
| 164 | 164 | /* |
| 165 | 165 | * follows data payload |
| 166 | 166 | */ |
| 167 | +struct ceph_msg_footer_old { | |
| 168 | + __le32 front_crc, middle_crc, data_crc; | |
| 169 | + __u8 flags; | |
| 170 | +} __attribute__ ((packed)); | |
| 171 | + | |
| 167 | 172 | struct ceph_msg_footer { |
| 168 | 173 | __le32 front_crc, middle_crc, data_crc; |
| 174 | + // sig holds the 64 bits of the digital signature for the message PLR | |
| 175 | + __le64 sig; | |
| 169 | 176 | __u8 flags; |
| 170 | 177 | } __attribute__ ((packed)); |
| 171 | 178 | |
| 172 | 179 | #define CEPH_MSG_FOOTER_COMPLETE (1<<0) /* msg wasn't aborted */ |
| 173 | 180 | #define CEPH_MSG_FOOTER_NOCRC (1<<1) /* no data crc */ |
| 181 | +#define CEPH_MSG_FOOTER_SIGNED (1<<2) /* msg was signed */ | |
| 174 | 182 | |
| 175 | 183 | |
| 176 | 184 | #endif |