#include <linux/module.h>
#include <linux/device.h>
#include <linux/ndctl.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/mm.h>
#include <linux/cred.h>
#include <linux/key.h>
#include <linux/key-type.h>
#include <keys/user-type.h>
#include <keys/encrypted-type.h>
#include "nd-core.h"
#include "nd.h"
#define NVDIMM_BASE_KEY …
#define NVDIMM_NEW_KEY …
static bool key_revalidate = …;
module_param(key_revalidate, bool, 0444);
MODULE_PARM_DESC(…) …;
static const char zero_key[NVDIMM_PASSPHRASE_LEN];
static void *key_data(struct key *key)
{ … }
static void nvdimm_put_key(struct key *key)
{ … }
static struct key *nvdimm_request_key(struct nvdimm *nvdimm)
{ … }
static const void *nvdimm_get_key_payload(struct nvdimm *nvdimm,
struct key **key)
{ … }
static struct key *nvdimm_lookup_user_key(struct nvdimm *nvdimm,
key_serial_t id, int subclass)
{ … }
static const void *nvdimm_get_user_key_payload(struct nvdimm *nvdimm,
key_serial_t id, int subclass, struct key **key)
{ … }
static int nvdimm_key_revalidate(struct nvdimm *nvdimm)
{ … }
static int __nvdimm_security_unlock(struct nvdimm *nvdimm)
{ … }
int nvdimm_security_unlock(struct device *dev)
{ … }
static int check_security_state(struct nvdimm *nvdimm)
{ … }
static int security_disable(struct nvdimm *nvdimm, unsigned int keyid,
enum nvdimm_passphrase_type pass_type)
{ … }
static int security_update(struct nvdimm *nvdimm, unsigned int keyid,
unsigned int new_keyid,
enum nvdimm_passphrase_type pass_type)
{ … }
static int security_erase(struct nvdimm *nvdimm, unsigned int keyid,
enum nvdimm_passphrase_type pass_type)
{ … }
static int security_overwrite(struct nvdimm *nvdimm, unsigned int keyid)
{ … }
static void __nvdimm_security_overwrite_query(struct nvdimm *nvdimm)
{ … }
void nvdimm_security_overwrite_query(struct work_struct *work)
{ … }
#define OPS …
#undef C
#define C …
enum nvdimmsec_op_ids { … };
#undef C
#define C …
static struct { … } ops[] = …;
#undef C
#define SEC_CMD_SIZE …
#define KEY_ID_SIZE …
ssize_t nvdimm_security_store(struct device *dev, const char *buf, size_t len)
{ … }