Initial D-Bus interface
This sets up an initial D-Bus interface without any real functionality.
It doesn't interact with any storage hardware yet.
The yaml files are included temporarily until the
phosphor-dbus-interfaces review is complete:
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-dbus-interfaces/+/48636
The .clang-tidy file has been removed because clang-tidy can't filter
out the generated files. It should be re-enabled when we no longer need
to generate the D-Bus sources in this repo.
Signed-off-by: John Edward Broadbent <jebr@google.com>
Change-Id: If704e69ef7225257efc7c865424df4421999f62d
Signed-off-by: John Wedig <johnwedig@google.com>
diff --git a/xyz/openbmc_project/eStoraged.errors.yaml b/xyz/openbmc_project/eStoraged.errors.yaml
new file mode 100644
index 0000000..d3d3603
--- /dev/null
+++ b/xyz/openbmc_project/eStoraged.errors.yaml
@@ -0,0 +1,6 @@
+- name: EncryptionError
+ description: One of the cryptsetup APIs returned an error.
+- name: EraseError
+ description: Failed to erase the device.
+- name: FilesystemError
+ description: Failed to create or remove the filesystem.
diff --git a/xyz/openbmc_project/eStoraged.interface.yaml b/xyz/openbmc_project/eStoraged.interface.yaml
new file mode 100644
index 0000000..29bb85c
--- /dev/null
+++ b/xyz/openbmc_project/eStoraged.interface.yaml
@@ -0,0 +1,110 @@
+description: >
+ D-bus interface to manage an encrypted storage device.
+
+methods:
+ - name: Format
+ description: >
+ Format the encrypted device and create an ext4 filesystem.
+ parameters:
+ - name: Password
+ type: array[byte]
+ description: >
+ Array of bytes to use as the LUKS password.
+ errors:
+ - self.Error.EncryptionError
+ - self.Error.FilesystemError
+
+ - name: Erase
+ description: >
+ Erase the contents of the device.
+ parameters:
+ - name: Password
+ type: array[byte]
+ description: >
+ Array of bytes to use as the LUKS password.
+ - name: EraseType
+ type: enum[self.EraseMethod]
+ description: >
+ Describes what type of erase is done.
+ errors:
+ - self.Error.EncryptionError
+ - self.Error.EraseError
+ - self.Error.FilesystemError
+
+ - name: Lock
+ description: >
+ Unmount the filesystem, lock the device, and remove sensitive data
+ (e.g. volume key) from memory.
+ parameters:
+ - name: Password
+ type: array[byte]
+ description: >
+ Array of bytes to use as the LUKS password.
+ errors:
+ - self.Error.EncryptionError
+ - self.Error.FilesystemError
+
+ - name: Unlock
+ description: >
+ Activate the device and mount the filesystem.
+ parameters:
+ - name: Password
+ type: array[byte]
+ description: >
+ Array of bytes to use as the LUKS password.
+ errors:
+ - self.Error.EncryptionError
+ - self.Error.FilesystemError
+
+ - name: ChangePassword
+ description: >
+ Change the password that unlocks the storage device.
+ parameters:
+ - name: OldPassword
+ type: array[byte]
+ description: >
+ Array of bytes for the old LUKS password.
+ - name: NewPassword
+ type: array[byte]
+ description: >
+ Array of bytes to use as the LUKS password.
+ errors:
+ - self.Error.EncryptionError
+
+properties:
+ - name: Locked
+ type: boolean
+ default: false
+ description: >
+ Indicates whether the device is locked.
+
+enumerations:
+ - name: EraseMethod
+ description: >
+ Indicates which erase method/step is being requested.
+ values:
+ - name: CryptoErase
+ description: >
+ Destroys the encryption key slots, preventing decyrption.
+ - name: VerifyGeometry
+ description: >
+ Confirms a set percent of the disk is accessible.
+ - name: LogicalOverWrite
+ description: >
+ Overwrites the disk with a reproducible incompressible pattern.
+ - name: LogicalVerify
+ description: >
+ Verifies a reproducible pattern has been written to the disk.
+ - name: VendorSanitize
+ description: >
+ Uses the sanitization provided by the device firmware.
+ - name: ZeroOverWrite
+ description: >
+ Writes zeros over the whole disk.
+ - name: ZeroVerify
+ description: >
+ Verifies the the entire disk has been zeroed.
+ - name: SecuredLocked
+ description: >
+ Locks the disk to prevent data being written to it.
+
diff --git a/xyz/openbmc_project/eStoraged/meson.build b/xyz/openbmc_project/eStoraged/meson.build
new file mode 100644
index 0000000..d143487
--- /dev/null
+++ b/xyz/openbmc_project/eStoraged/meson.build
@@ -0,0 +1,74 @@
+sdbuspp_prog = find_program('sdbus++')
+
+domain = 'xyz.openbmc_project.eStoraged'
+if_yaml_file = files('../eStoraged.interface.yaml')
+
+if_cpp = custom_target(
+ 'server.cpp',
+ output: 'server.cpp',
+ input: if_yaml_file,
+ capture: true,
+ command: [sdbuspp_prog, '-r', eStoraged_root, 'interface', 'server-cpp', domain])
+
+if_hpp = custom_target(
+ 'server.hpp',
+ output: 'server.hpp',
+ input: if_yaml_file,
+ capture: true,
+ command: [sdbuspp_prog, '-r', eStoraged_root, 'interface', 'server-header', domain],
+ install: true,
+ install_dir: get_option('includedir') / 'xyz/openbmc_project/eStoraged')
+
+error_yaml_file = files('../eStoraged.errors.yaml')
+
+error_cpp = custom_target(
+ 'error.cpp',
+ output: 'error.cpp',
+ input: error_yaml_file,
+ capture: true,
+ command: [sdbuspp_prog, '-r', eStoraged_root, 'error', 'exception-cpp', domain])
+
+error_hpp = custom_target(
+ 'error.hpp',
+ output: 'error.hpp',
+ input: error_yaml_file,
+ capture: true,
+ command: [sdbuspp_prog, '-r', eStoraged_root, 'error', 'exception-header', domain],
+ install: true,
+ install_dir: get_option('includedir') / 'xyz/openbmc_project/eStoraged')
+
+eStoraged_dbus_deps = [
+ dependency('sdbusplus'),
+]
+
+eStoraged_dbus_lib = library(
+ 'eStoraged-dbus',
+ if_cpp,
+ if_hpp,
+ error_cpp,
+ error_hpp,
+ implicit_include_directories: false,
+ include_directories: eStoraged_dbus_headers,
+ version: meson.project_version(),
+ dependencies: eStoraged_dbus_deps,
+ install: true)
+
+eStoraged_dbus = declare_dependency(
+ dependencies: eStoraged_dbus_deps,
+ sources: [if_hpp, error_hpp],
+ include_directories: eStoraged_dbus_headers,
+ link_with: eStoraged_dbus_lib)
+
+eStoraged_dbus_reqs = []
+foreach dep : eStoraged_dbus_deps
+ if dep.type_name() == 'pkgconfig'
+ eStoraged_dbus_reqs += dep
+ endif
+endforeach
+
+import('pkgconfig').generate(
+ name: 'eStoraged-dbus',
+ description: 'eStoraged DBus Bindings',
+ version: meson.project_version(),
+ libraries: eStoraged_dbus,
+ requires: eStoraged_dbus_reqs)