Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[linux-block.git] / include / linux / nvme-auth.h
CommitLineData
f50fff73
HR
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (c) 2021 Hannes Reinecke, SUSE Software Solutions
4 */
5
6#ifndef _NVME_AUTH_H
7#define _NVME_AUTH_H
8
9#include <crypto/kpp.h>
10
11struct nvme_dhchap_key {
f50fff73
HR
12 size_t len;
13 u8 hash;
3ebed374 14 u8 key[];
f50fff73
HR
15};
16
17u32 nvme_auth_get_seqnum(void);
18const char *nvme_auth_dhgroup_name(u8 dhgroup_id);
19const char *nvme_auth_dhgroup_kpp(u8 dhgroup_id);
20u8 nvme_auth_dhgroup_id(const char *dhgroup_name);
21
22const char *nvme_auth_hmac_name(u8 hmac_id);
23const char *nvme_auth_digest_name(u8 hmac_id);
24size_t nvme_auth_hmac_hash_len(u8 hmac_id);
25u8 nvme_auth_hmac_id(const char *hmac_name);
26
3ebed374 27u32 nvme_auth_key_struct_size(u32 key_len);
f50fff73
HR
28struct nvme_dhchap_key *nvme_auth_extract_key(unsigned char *secret,
29 u8 key_hash);
30void nvme_auth_free_key(struct nvme_dhchap_key *key);
3ebed374 31struct nvme_dhchap_key *nvme_auth_alloc_key(u32 len, u8 hash);
f047daed
MD
32struct nvme_dhchap_key *nvme_auth_transform_key(
33 struct nvme_dhchap_key *key, char *nqn);
f50fff73 34int nvme_auth_generate_key(u8 *secret, struct nvme_dhchap_key **ret_key);
b61775d1
HR
35int nvme_auth_augmented_challenge(u8 hmac_id, u8 *skey, size_t skey_len,
36 u8 *challenge, u8 *aug, size_t hlen);
37int nvme_auth_gen_privkey(struct crypto_kpp *dh_tfm, u8 dh_gid);
38int nvme_auth_gen_pubkey(struct crypto_kpp *dh_tfm,
39 u8 *host_key, size_t host_key_len);
40int nvme_auth_gen_shared_secret(struct crypto_kpp *dh_tfm,
41 u8 *ctrl_key, size_t ctrl_key_len,
42 u8 *sess_key, size_t sess_key_len);
f50fff73
HR
43
44#endif /* _NVME_AUTH_H */