mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
nvmet-tcp: support secure channel concatenation
Evaluate the SC_C flag during DH-CHAP-HMAC negotiation to check if secure concatenation as specified in the NVMe Base Specification v2.1, section 8.3.4.3: "Secure Channel Concatenationand" is requested. If requested the generated PSK is inserted into the keyring once negotiation has finished allowing for an encrypted connection once the admin queue is restarted. Signed-off-by: Hannes Reinecke <hare@kernel.org> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
committed by
Keith Busch
parent
5032167264
commit
fa2e0f8bbc
@@ -164,6 +164,9 @@ struct nvmet_sq {
|
||||
u32 dhchap_s2;
|
||||
u8 *dhchap_skey;
|
||||
int dhchap_skey_len;
|
||||
#endif
|
||||
#ifdef CONFIG_NVME_TARGET_TCP_TLS
|
||||
struct key *tls_key;
|
||||
#endif
|
||||
struct completion free_done;
|
||||
struct completion confirm_done;
|
||||
@@ -289,6 +292,7 @@ struct nvmet_ctrl {
|
||||
u64 err_counter;
|
||||
struct nvme_error_slot slots[NVMET_ERROR_LOG_SLOTS];
|
||||
bool pi_support;
|
||||
bool concat;
|
||||
#ifdef CONFIG_NVME_TARGET_AUTH
|
||||
struct nvme_dhchap_key *host_key;
|
||||
struct nvme_dhchap_key *ctrl_key;
|
||||
@@ -297,6 +301,9 @@ struct nvmet_ctrl {
|
||||
u8 dh_gid;
|
||||
u8 *dh_key;
|
||||
size_t dh_keysize;
|
||||
#endif
|
||||
#ifdef CONFIG_NVME_TARGET_TCP_TLS
|
||||
struct key *tls_key;
|
||||
#endif
|
||||
struct nvmet_pr_log_mgr pr_log_mgr;
|
||||
};
|
||||
@@ -853,6 +860,22 @@ static inline void nvmet_req_bio_put(struct nvmet_req *req, struct bio *bio)
|
||||
bio_put(bio);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NVME_TARGET_TCP_TLS
|
||||
static inline key_serial_t nvmet_queue_tls_keyid(struct nvmet_sq *sq)
|
||||
{
|
||||
return sq->tls_key ? key_serial(sq->tls_key) : 0;
|
||||
}
|
||||
static inline void nvmet_sq_put_tls_key(struct nvmet_sq *sq)
|
||||
{
|
||||
if (sq->tls_key) {
|
||||
key_put(sq->tls_key);
|
||||
sq->tls_key = NULL;
|
||||
}
|
||||
}
|
||||
#else
|
||||
static inline key_serial_t nvmet_queue_tls_keyid(struct nvmet_sq *sq) { return 0; }
|
||||
static inline void nvmet_sq_put_tls_key(struct nvmet_sq *sq) {}
|
||||
#endif
|
||||
#ifdef CONFIG_NVME_TARGET_AUTH
|
||||
u32 nvmet_auth_send_data_len(struct nvmet_req *req);
|
||||
void nvmet_execute_auth_send(struct nvmet_req *req);
|
||||
@@ -871,14 +894,15 @@ int nvmet_auth_host_hash(struct nvmet_req *req, u8 *response,
|
||||
unsigned int hash_len);
|
||||
int nvmet_auth_ctrl_hash(struct nvmet_req *req, u8 *response,
|
||||
unsigned int hash_len);
|
||||
static inline bool nvmet_has_auth(struct nvmet_ctrl *ctrl)
|
||||
static inline bool nvmet_has_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq)
|
||||
{
|
||||
return ctrl->host_key != NULL;
|
||||
return ctrl->host_key != NULL && !nvmet_queue_tls_keyid(sq);
|
||||
}
|
||||
int nvmet_auth_ctrl_exponential(struct nvmet_req *req,
|
||||
u8 *buf, int buf_size);
|
||||
int nvmet_auth_ctrl_sesskey(struct nvmet_req *req,
|
||||
u8 *buf, int buf_size);
|
||||
void nvmet_auth_insert_psk(struct nvmet_sq *sq);
|
||||
#else
|
||||
static inline u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl,
|
||||
struct nvmet_sq *sq)
|
||||
@@ -894,11 +918,13 @@ static inline bool nvmet_check_auth_status(struct nvmet_req *req)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
static inline bool nvmet_has_auth(struct nvmet_ctrl *ctrl)
|
||||
static inline bool nvmet_has_auth(struct nvmet_ctrl *ctrl,
|
||||
struct nvmet_sq *sq)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
static inline const char *nvmet_dhchap_dhgroup_name(u8 dhgid) { return NULL; }
|
||||
static inline void nvmet_auth_insert_psk(struct nvmet_sq *sq) {};
|
||||
#endif
|
||||
|
||||
int nvmet_pr_init_ns(struct nvmet_ns *ns);
|
||||
|
||||
Reference in New Issue
Block a user