nvme-auth.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (c) 2021 Hannes Reinecke, SUSE Software Solutions
  4. */
  5. #ifndef _NVME_AUTH_H
  6. #define _NVME_AUTH_H
  7. #include <crypto/kpp.h>
  8. struct nvme_dhchap_key {
  9. u8 *key;
  10. size_t len;
  11. u8 hash;
  12. };
  13. u32 nvme_auth_get_seqnum(void);
  14. const char *nvme_auth_dhgroup_name(u8 dhgroup_id);
  15. const char *nvme_auth_dhgroup_kpp(u8 dhgroup_id);
  16. u8 nvme_auth_dhgroup_id(const char *dhgroup_name);
  17. const char *nvme_auth_hmac_name(u8 hmac_id);
  18. const char *nvme_auth_digest_name(u8 hmac_id);
  19. size_t nvme_auth_hmac_hash_len(u8 hmac_id);
  20. u8 nvme_auth_hmac_id(const char *hmac_name);
  21. struct nvme_dhchap_key *nvme_auth_extract_key(unsigned char *secret,
  22. u8 key_hash);
  23. void nvme_auth_free_key(struct nvme_dhchap_key *key);
  24. u8 *nvme_auth_transform_key(struct nvme_dhchap_key *key, char *nqn);
  25. int nvme_auth_generate_key(u8 *secret, struct nvme_dhchap_key **ret_key);
  26. int nvme_auth_augmented_challenge(u8 hmac_id, u8 *skey, size_t skey_len,
  27. u8 *challenge, u8 *aug, size_t hlen);
  28. int nvme_auth_gen_privkey(struct crypto_kpp *dh_tfm, u8 dh_gid);
  29. int nvme_auth_gen_pubkey(struct crypto_kpp *dh_tfm,
  30. u8 *host_key, size_t host_key_len);
  31. int nvme_auth_gen_shared_secret(struct crypto_kpp *dh_tfm,
  32. u8 *ctrl_key, size_t ctrl_key_len,
  33. u8 *sess_key, size_t sess_key_len);
  34. #endif /* _NVME_AUTH_H */