Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (c) 2021 Hannes Reinecke, SUSE Software Solutions
0004  */
0005 
0006 #ifndef _NVME_AUTH_H
0007 #define _NVME_AUTH_H
0008 
0009 #include <crypto/kpp.h>
0010 
0011 struct nvme_dhchap_key {
0012     u8 *key;
0013     size_t len;
0014     u8 hash;
0015 };
0016 
0017 u32 nvme_auth_get_seqnum(void);
0018 const char *nvme_auth_dhgroup_name(u8 dhgroup_id);
0019 const char *nvme_auth_dhgroup_kpp(u8 dhgroup_id);
0020 u8 nvme_auth_dhgroup_id(const char *dhgroup_name);
0021 
0022 const char *nvme_auth_hmac_name(u8 hmac_id);
0023 const char *nvme_auth_digest_name(u8 hmac_id);
0024 size_t nvme_auth_hmac_hash_len(u8 hmac_id);
0025 u8 nvme_auth_hmac_id(const char *hmac_name);
0026 
0027 struct nvme_dhchap_key *nvme_auth_extract_key(unsigned char *secret,
0028                           u8 key_hash);
0029 void nvme_auth_free_key(struct nvme_dhchap_key *key);
0030 u8 *nvme_auth_transform_key(struct nvme_dhchap_key *key, char *nqn);
0031 int nvme_auth_generate_key(u8 *secret, struct nvme_dhchap_key **ret_key);
0032 int nvme_auth_augmented_challenge(u8 hmac_id, u8 *skey, size_t skey_len,
0033                   u8 *challenge, u8 *aug, size_t hlen);
0034 int nvme_auth_gen_privkey(struct crypto_kpp *dh_tfm, u8 dh_gid);
0035 int nvme_auth_gen_pubkey(struct crypto_kpp *dh_tfm,
0036              u8 *host_key, size_t host_key_len);
0037 int nvme_auth_gen_shared_secret(struct crypto_kpp *dh_tfm,
0038                 u8 *ctrl_key, size_t ctrl_key_len,
0039                 u8 *sess_key, size_t sess_key_len);
0040 
0041 #endif /* _NVME_AUTH_H */