Alexander Graf b9873755a6 misc: Add Nitro Secure Module driver
When running Linux inside a Nitro Enclave, the hypervisor provides a
special virtio device called "Nitro Security Module" (NSM). This device
has 3 main functions:

  1) Provide attestation reports
  2) Modify PCR state
  3) Provide entropy

This patch adds a driver for NSM that exposes a /dev/nsm device node which
user space can issue an ioctl on this device with raw NSM CBOR formatted
commands to request attestation documents, influence PCR states, read
entropy and enumerate status of the device. In addition, the driver
implements a hwrng backend.

Originally-by: Petre Eftime <petre.eftime@gmail.com>
Signed-off-by: Alexander Graf <graf@amazon.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20231011213522.51781-1-graf@amazon.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-11-28 19:05:16 +00:00

32 lines
740 B
C

/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*/
#ifndef __UAPI_LINUX_NSM_H
#define __UAPI_LINUX_NSM_H
#include <linux/ioctl.h>
#include <linux/types.h>
#define NSM_MAGIC 0x0A
#define NSM_REQUEST_MAX_SIZE 0x1000
#define NSM_RESPONSE_MAX_SIZE 0x3000
struct nsm_iovec {
__u64 addr; /* Virtual address of target buffer */
__u64 len; /* Length of target buffer */
};
/* Raw NSM message. Only available with CAP_SYS_ADMIN. */
struct nsm_raw {
/* Request from user */
struct nsm_iovec request;
/* Response to user */
struct nsm_iovec response;
};
#define NSM_IOCTL_RAW _IOWR(NSM_MAGIC, 0x0, struct nsm_raw)
#endif /* __UAPI_LINUX_NSM_H */