diff options
author | Yan, Zheng <zyan@redhat.com> | 2014-11-04 03:33:37 -0500 |
---|---|---|
committer | Ilya Dryomov <idryomov@redhat.com> | 2014-12-17 12:09:50 -0500 |
commit | 33d07337962c7bbd2fd5cf7f1106735c9507fbe2 (patch) | |
tree | 93a95e7d02db4d7ba7d282483e32fd0627a3c281 /include/linux/ceph/auth.h | |
parent | ae385eaf24dc39c1703049112e4265b9f93b7d86 (diff) |
libceph: message signature support
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'include/linux/ceph/auth.h')
-rw-r--r-- | include/linux/ceph/auth.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/ceph/auth.h b/include/linux/ceph/auth.h index 5f3386844134..260d78b587c4 100644 --- a/include/linux/ceph/auth.h +++ b/include/linux/ceph/auth.h | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | struct ceph_auth_client; | 14 | struct ceph_auth_client; |
15 | struct ceph_authorizer; | 15 | struct ceph_authorizer; |
16 | struct ceph_msg; | ||
16 | 17 | ||
17 | struct ceph_auth_handshake { | 18 | struct ceph_auth_handshake { |
18 | struct ceph_authorizer *authorizer; | 19 | struct ceph_authorizer *authorizer; |
@@ -20,6 +21,10 @@ struct ceph_auth_handshake { | |||
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 | ||
25 | struct ceph_auth_client_ops { | 30 | struct ceph_auth_client_ops { |
@@ -66,6 +71,11 @@ struct ceph_auth_client_ops { | |||
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 | ||
71 | struct ceph_auth_client { | 81 | struct ceph_auth_client { |
@@ -113,4 +123,20 @@ extern int ceph_auth_verify_authorizer_reply(struct ceph_auth_client *ac, | |||
113 | extern void ceph_auth_invalidate_authorizer(struct ceph_auth_client *ac, | 123 | extern void ceph_auth_invalidate_authorizer(struct ceph_auth_client *ac, |
114 | int peer_type); | 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 | #endif | 142 | #endif |