File: drive_encryption.h

package info (click to toggle)
mdadm 4.4-14
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,088 kB
  • sloc: ansic: 46,742; sh: 2,407; makefile: 284; python: 44
file content (37 lines) | stat: -rw-r--r-- 1,211 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Read encryption information for Opal and ATA devices.
 *
 * Copyright (C) 2024 Intel Corporation
 *	Author: Blazej Kucman <blazej.kucman@intel.com>
 */

typedef enum encryption_status {
	/* The drive is not currently encrypted. */
	ENC_STATUS_UNENCRYPTED = 0,
	/* The drive is encrypted and the data is not accessible. */
	ENC_STATUS_LOCKED,
	/* The drive is encrypted but the data is accessible in unencrypted form. */
	ENC_STATUS_UNLOCKED
} encryption_status_t;

typedef enum encryption_ability {
	ENC_ABILITY_NONE = 0,
	ENC_ABILITY_OTHER,
	/* Self encrypted drive */
	ENC_ABILITY_SED
} encryption_ability_t;

typedef struct encryption_information {
	encryption_ability_t ability;
	encryption_status_t status;
} encryption_information_t;

mdadm_status_t
get_nvme_opal_encryption_information(int disk_fd, struct encryption_information *information,
				     const int verbose);
mdadm_status_t
get_ata_encryption_information(int disk_fd, struct encryption_information *information,
			       const int verbose);
const char *get_encryption_ability_string(enum encryption_ability ability);
const char *get_encryption_status_string(enum encryption_status status);