History

libceph: message signature support

Yan, Zheng committed 12 years ago

Commit 33d07331 parent ae385ea8 files · +162 −4Browse files

Showing the changes to include/linux/ceph (4 of 8 files). Show all

Unified · Split

4 files
  1. include/linux/ceph/auth.h +26 −0
  2. include/linux/ceph/ceph_features.h +1 −0
  3. include/linux/ceph/messenger.h +8 −1
  4. include/linux/ceph/msgr.h +8 −0
include/linux/ceph/auth.h+26−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313
1414 struct ceph_auth_client;
1515 struct ceph_authorizer;
16+struct ceph_msg;
1617
1718 struct ceph_auth_handshake {
1819 struct ceph_authorizer *authorizer;
@@ -20,6 +21,10 @@ struct ceph_auth_handshake { · 1 unmodified line
2021 size_t authorizer_buf_len;
2122 void *authorizer_reply_buf;
2223 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);
2328 };
2429
2530 struct ceph_auth_client_ops {
@@ -66,6 +71,11 @@ struct ceph_auth_client_ops { · 40 unmodified lines
6671 void (*reset)(struct ceph_auth_client *ac);
6772
6873 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);
6979 };
7080
7181 struct ceph_auth_client {
@@ -113,4 +123,20 @@ extern int ceph_auth_verify_authorizer_reply(struct ceph_auth_client *ac, · 41 unmodified lines
113123 extern void ceph_auth_invalidate_authorizer(struct ceph_auth_client *ac,
114124 int peer_type);
115125
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+}
116142 #endif
include/linux/ceph/ceph_features.h+1−0
@@ -84,6 +84,7 @@ static inline u64 ceph_sanitize_features(u64 features) · 83 unmodified lines
8484 CEPH_FEATURE_PGPOOL3 | \
8585 CEPH_FEATURE_OSDENC | \
8686 CEPH_FEATURE_CRUSH_TUNABLES | \
87+ CEPH_FEATURE_MSG_AUTH | \
8788 CEPH_FEATURE_CRUSH_TUNABLES2 | \
8889 CEPH_FEATURE_REPLY_CREATE_INODE | \
8990 CEPH_FEATURE_OSDHASHPSPOOL | \
include/linux/ceph/messenger.h+8−1
@@ -42,6 +42,10 @@ struct ceph_connection_operations { · 41 unmodified lines
4242 struct ceph_msg * (*alloc_msg) (struct ceph_connection *con,
4343 struct ceph_msg_header *hdr,
4444 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);
4549 };
4650
4751 /* use format string %s%d */
@@ -142,7 +146,10 @@ struct ceph_msg_data_cursor { · 94 unmodified lines
142146 */
143147 struct ceph_msg {
144148 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+ };
146153 struct kvec front; /* unaligned blobs of message */
147154 struct ceph_buffer *middle;
148155
include/linux/ceph/msgr.h+8−0
@@ -164,13 +164,21 @@ struct ceph_msg_header { · 163 unmodified lines
164164 /*
165165 * follows data payload
166166 */
167+struct ceph_msg_footer_old {
168+ __le32 front_crc, middle_crc, data_crc;
169+ __u8 flags;
170+} __attribute__ ((packed));
171+
167172 struct ceph_msg_footer {
168173 __le32 front_crc, middle_crc, data_crc;
174+ // sig holds the 64 bits of the digital signature for the message PLR
175+ __le64 sig;
169176 __u8 flags;
170177 } __attribute__ ((packed));
171178
172179 #define CEPH_MSG_FOOTER_COMPLETE (1<<0) /* msg wasn't aborted */
173180 #define CEPH_MSG_FOOTER_NOCRC (1<<1) /* no data crc */
181+#define CEPH_MSG_FOOTER_SIGNED (1<<2) /* msg was signed */
174182
175183
176184 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t