1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (c) 2023 Hannes Reinecke, SUSE Labs 4 */ 5 6 #ifndef _NVME_KEYRING_H 7 #define _NVME_KEYRING_H 8 9 #include <linux/key.h> 10 11 #if IS_ENABLED(CONFIG_NVME_KEYRING) 12 13 struct key *nvme_tls_psk_refresh(struct key *keyring, 14 const char *hostnqn, const char *subnqn, u8 hmac_id, 15 u8 *data, size_t data_len, const char *digest); 16 key_serial_t nvme_tls_psk_default(struct key *keyring, 17 const char *hostnqn, const char *subnqn); 18 19 key_serial_t nvme_keyring_id(void); 20 struct key *nvme_tls_key_lookup(key_serial_t key_id); 21 #else 22 static inline struct key *nvme_tls_psk_refresh(struct key *keyring, 23 const char *hostnqn, char *subnqn, u8 hmac_id, 24 u8 *data, size_t data_len, const char *digest) 25 { 26 return ERR_PTR(-ENOTSUPP); 27 } 28 static inline key_serial_t nvme_tls_psk_default(struct key *keyring, 29 const char *hostnqn, const char *subnqn) 30 { 31 return 0; 32 } 33 static inline key_serial_t nvme_keyring_id(void) 34 { 35 return 0; 36 } 37 static inline struct key *nvme_tls_key_lookup(key_serial_t key_id) 38 { 39 return ERR_PTR(-ENOTSUPP); 40 } 41 #endif /* !CONFIG_NVME_KEYRING */ 42 #endif /* _NVME_KEYRING_H */ 43