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
13 13
14struct ceph_auth_client;14struct ceph_auth_client;
15struct ceph_authorizer;15struct ceph_authorizer;
16struct ceph_msg;
16 17
17struct ceph_auth_handshake {18struct ceph_auth_handshake {
18 struct ceph_authorizer *authorizer;19 struct ceph_authorizer *authorizer;
@@ -20,6 +21,10 @@ struct ceph_auth_handshake { · 1 unmodified line
20 size_t authorizer_buf_len;21 size_t authorizer_buf_len;
21 void *authorizer_reply_buf;22 void *authorizer_reply_buf;
22 size_t authorizer_reply_buf_len;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
25struct ceph_auth_client_ops {30struct ceph_auth_client_ops {
@@ -66,6 +71,11 @@ struct ceph_auth_client_ops { · 40 unmodified lines
66 void (*reset)(struct ceph_auth_client *ac);71 void (*reset)(struct ceph_auth_client *ac);
67 72
68 void (*destroy)(struct ceph_auth_client *ac);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
71struct ceph_auth_client {81struct ceph_auth_client {
@@ -113,4 +123,20 @@ extern int ceph_auth_verify_authorizer_reply(struct ceph_auth_client *ac, · 41 unmodified lines
113extern void ceph_auth_invalidate_authorizer(struct ceph_auth_client *ac,123extern void ceph_auth_invalidate_authorizer(struct ceph_auth_client *ac,
114 int peer_type);124 int peer_type);
115 125
126static 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
134static inline
135int 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#endif142#endif
include/linux/ceph/ceph_features.h+1−0
@@ -84,6 +84,7 @@ static inline u64 ceph_sanitize_features(u64 features) · 83 unmodified lines
84 CEPH_FEATURE_PGPOOL3 | \84 CEPH_FEATURE_PGPOOL3 | \
85 CEPH_FEATURE_OSDENC | \85 CEPH_FEATURE_OSDENC | \
86 CEPH_FEATURE_CRUSH_TUNABLES | \86 CEPH_FEATURE_CRUSH_TUNABLES | \
87 CEPH_FEATURE_MSG_AUTH | \
87 CEPH_FEATURE_CRUSH_TUNABLES2 | \88 CEPH_FEATURE_CRUSH_TUNABLES2 | \
88 CEPH_FEATURE_REPLY_CREATE_INODE | \89 CEPH_FEATURE_REPLY_CREATE_INODE | \
89 CEPH_FEATURE_OSDHASHPSPOOL | \90 CEPH_FEATURE_OSDHASHPSPOOL | \
include/linux/ceph/messenger.h+8−1
@@ -42,6 +42,10 @@ struct ceph_connection_operations { · 41 unmodified lines
42 struct ceph_msg * (*alloc_msg) (struct ceph_connection *con,42 struct ceph_msg * (*alloc_msg) (struct ceph_connection *con,
43 struct ceph_msg_header *hdr,43 struct ceph_msg_header *hdr,
44 int *skip);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/* use format string %s%d */51/* use format string %s%d */
@@ -142,7 +146,10 @@ struct ceph_msg_data_cursor { · 94 unmodified lines
142 */146 */
143struct ceph_msg {147struct ceph_msg {
144 struct ceph_msg_header hdr; /* header */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 struct kvec front; /* unaligned blobs of message */153 struct kvec front; /* unaligned blobs of message */
147 struct ceph_buffer *middle;154 struct ceph_buffer *middle;
148 155
include/linux/ceph/msgr.h+8−0
@@ -164,13 +164,21 @@ struct ceph_msg_header { · 163 unmodified lines
164/*164/*
165 * follows data payload165 * follows data payload
166 */166 */
167struct ceph_msg_footer_old {
168 __le32 front_crc, middle_crc, data_crc;
169 __u8 flags;
170} __attribute__ ((packed));
171
167struct ceph_msg_footer {172struct ceph_msg_footer {
168 __le32 front_crc, middle_crc, data_crc;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 __u8 flags;176 __u8 flags;
170} __attribute__ ((packed));177} __attribute__ ((packed));
171 178
172#define CEPH_MSG_FOOTER_COMPLETE (1<<0) /* msg wasn't aborted */179#define CEPH_MSG_FOOTER_COMPLETE (1<<0) /* msg wasn't aborted */
173#define CEPH_MSG_FOOTER_NOCRC (1<<1) /* no data crc */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#endif184#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