@super-protocol/addons-tee 0.8.16 → 0.8.17-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bindings/amd-sev-snp-napi-rs/amd-sev-snp-napi-rs.linux-x64-gnu.node +0 -0
- package/bindings/amd-sev-snp-napi-rs/index.d.ts +24 -0
- package/bindings/amd-sev-snp-napi-rs/index.js +328 -0
- package/bindings/amd-sev-snp-napi-rs/package-lock.json +40 -0
- package/bindings/amd-sev-snp-napi-rs/package.json +31 -0
- package/bindings/sgx-native/build/Release/sgx_native.node +0 -0
- package/bindings/sp-sev/.github/auto_assign-issues.yml +5 -0
- package/bindings/sp-sev/.github/auto_assign.yml +21 -0
- package/bindings/sp-sev/.github/dependabot.yml +6 -0
- package/bindings/sp-sev/.github/workflows/dco.yml +10 -0
- package/bindings/sp-sev/.github/workflows/lint.yml +56 -0
- package/bindings/sp-sev/.github/workflows/test.yml +54 -0
- package/bindings/sp-sev/.rustfmt.toml +2 -0
- package/bindings/sp-sev/CODEOWNERS +1 -0
- package/bindings/sp-sev/Cargo.lock +2221 -0
- package/bindings/sp-sev/Cargo.toml +80 -0
- package/bindings/sp-sev/LICENSE +201 -0
- package/bindings/sp-sev/README.md +82 -0
- package/bindings/sp-sev/build.rs +17 -0
- package/bindings/sp-sev/docs/attestation/README.md +239 -0
- package/bindings/sp-sev/docs/attestation/certchain.dot +14 -0
- package/bindings/sp-sev/docs/attestation/certchain.dot.png +0 -0
- package/bindings/sp-sev/docs/attestation/prerequisites.md +6 -0
- package/bindings/sp-sev/docs/attestation/process.msc +60 -0
- package/bindings/sp-sev/docs/attestation/process.msc.png +0 -0
- package/bindings/sp-sev/docs/attestation/protections.md +53 -0
- package/bindings/sp-sev/package-version.py +11 -0
- package/bindings/sp-sev/tests/api.rs +191 -0
- package/bindings/sp-sev/tests/certs.rs +143 -0
- package/bindings/sp-sev/tests/certs_data/cert_chain_milan +74 -0
- package/bindings/sp-sev/tests/certs_data/cert_chain_turin +74 -0
- package/bindings/sp-sev/tests/certs_data/report_milan.hex +1 -0
- package/bindings/sp-sev/tests/certs_data/vcek_milan.der +0 -0
- package/bindings/sp-sev/tests/certs_data/vcek_turin.der +0 -0
- package/bindings/sp-sev/tests/guest.rs +56 -0
- package/bindings/sp-sev/tests/id-block.rs +168 -0
- package/bindings/sp-sev/tests/measurement/ovmf_AmdSev_suffix.bin +0 -0
- package/bindings/sp-sev/tests/measurement/ovmf_OvmfX64_suffix.bin +0 -0
- package/bindings/sp-sev/tests/measurement/test_auth_block.bin +0 -0
- package/bindings/sp-sev/tests/measurement/test_auth_key.pem +6 -0
- package/bindings/sp-sev/tests/measurement/test_auth_sig.bin +0 -0
- package/bindings/sp-sev/tests/measurement/test_id_key.pem +6 -0
- package/bindings/sp-sev/tests/measurement/test_id_sig.bin +0 -0
- package/bindings/sp-sev/tests/measurement.rs +510 -0
- package/bindings/sp-sev/tests/naples/ark.cert.bad +0 -0
- package/bindings/sp-sev/tests/naples/ark.cert.sig +0 -0
- package/bindings/sp-sev/tests/naples/ark.rs +38 -0
- package/bindings/sp-sev/tests/naples/ask.rs +29 -0
- package/bindings/sp-sev/tests/naples/cek.cert +0 -0
- package/bindings/sp-sev/tests/naples/cek.rs +30 -0
- package/bindings/sp-sev/tests/naples/mod.rs +20 -0
- package/bindings/sp-sev/tests/naples/oca.cert +0 -0
- package/bindings/sp-sev/tests/naples/oca.rs +45 -0
- package/bindings/sp-sev/tests/naples/pdh.cert +0 -0
- package/bindings/sp-sev/tests/naples/pdh.rs +28 -0
- package/bindings/sp-sev/tests/naples/pek.cert +0 -0
- package/bindings/sp-sev/tests/naples/pek.rs +32 -0
- package/bindings/sp-sev/tests/rome/ark.rs +33 -0
- package/bindings/sp-sev/tests/rome/ask.rs +29 -0
- package/bindings/sp-sev/tests/rome/cek.cert +0 -0
- package/bindings/sp-sev/tests/rome/cek.rs +29 -0
- package/bindings/sp-sev/tests/rome/mod.rs +16 -0
- package/bindings/sp-sev/tests/rome/oca.cert +0 -0
- package/bindings/sp-sev/tests/rome/oca.rs +45 -0
- package/bindings/sp-sev/tests/rome/pdh.cert +0 -0
- package/bindings/sp-sev/tests/rome/pdh.rs +28 -0
- package/bindings/sp-sev/tests/rome/pek.cert +0 -0
- package/bindings/sp-sev/tests/rome/pek.rs +32 -0
- package/bindings/sp-sev/tests/session.rs +39 -0
- package/bindings/sp-sev/tests/sev_launch.rs +120 -0
- package/bindings/sp-sev/tests/snp_launch.rs +108 -0
- package/bindings/utils/virtee/LICENSE +201 -0
- package/bindings/utils/virtee/libsev.so +0 -0
- package/bindings/utils/virtee/snpguest +0 -0
- package/dist/sgx-native-module/consts.d.ts +1 -1
- package/dist/sgx-native-module/consts.js +4 -4
- package/dist/sgx-native-module/dcap-quote-verify.service.js +1 -1
- package/dist/sgx-native-module/enclave.service.d.ts +5 -4
- package/dist/sgx-native-module/enclave.service.js +1 -1
- package/dist/sgx-native-module/errors.js +1 -1
- package/dist/sgx-native-module/index.d.ts +2 -0
- package/dist/sgx-native-module/index.js +3 -1
- package/dist/sgx-native-module/pki.service.d.ts +2 -2
- package/dist/sgx-native-module/pki.service.js +4 -4
- package/dist/sgx-native-module/sev-snp-mrenclave.d.ts +63 -0
- package/dist/sgx-native-module/sev-snp-mrenclave.js +290 -0
- package/dist/sgx-native-module/sev-snp.d.ts +134 -0
- package/dist/sgx-native-module/sev-snp.js +534 -0
- package/package.json +21 -14
- package/dist/sgx-native-module/sgx-tests.d.ts +0 -1
- package/dist/sgx-native-module/sgx-tests.js +0 -114
- package/dist/sgx-native-module/tdx-tests.d.ts +0 -1
- package/dist/sgx-native-module/tdx-tests.js +0 -64
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "sev"
|
|
3
|
+
version = "5.0.0"
|
|
4
|
+
authors = [
|
|
5
|
+
"Nathaniel McCallum <npmccallum@redhat.com>",
|
|
6
|
+
"The VirTEE Project Developers",
|
|
7
|
+
]
|
|
8
|
+
license = "Apache-2.0"
|
|
9
|
+
edition = "2018"
|
|
10
|
+
homepage = "https://github.com/virtee/sev"
|
|
11
|
+
repository = "https://github.com/virtee/sev"
|
|
12
|
+
description = "Library for AMD SEV"
|
|
13
|
+
readme = "README.md"
|
|
14
|
+
keywords = ["amd", "sev"]
|
|
15
|
+
categories = [
|
|
16
|
+
"os",
|
|
17
|
+
"os::linux-apis",
|
|
18
|
+
"parsing",
|
|
19
|
+
"network-programming",
|
|
20
|
+
"hardware-support",
|
|
21
|
+
]
|
|
22
|
+
exclude = [".gitignore", ".github/*"]
|
|
23
|
+
rust-version = "1.80.0"
|
|
24
|
+
|
|
25
|
+
[badges]
|
|
26
|
+
# See https://doc.rust-lang.org/cargo/reference/manifest.html#the-badges-section
|
|
27
|
+
github = { repository = "virtee/sev", workflow = "test" }
|
|
28
|
+
#github = { repository = "virtee/sev", workflow = "lint" }
|
|
29
|
+
maintenance = { status = "actively-developed" }
|
|
30
|
+
is-it-maintained-issue-resolution = { repository = "virtee/sev" }
|
|
31
|
+
is-it-maintained-open-issues = { repository = "virtee/sev" }
|
|
32
|
+
|
|
33
|
+
[lib]
|
|
34
|
+
name = 'sev'
|
|
35
|
+
path = "src/lib.rs"
|
|
36
|
+
doc = false
|
|
37
|
+
|
|
38
|
+
[features]
|
|
39
|
+
default = ["sev", "snp"]
|
|
40
|
+
openssl = ["dep:openssl", "dep:rdrand"]
|
|
41
|
+
hw_tests = []
|
|
42
|
+
dangerous_hw_tests = ["hw_tests", "dep:reqwest", "dep:tokio"]
|
|
43
|
+
sev = []
|
|
44
|
+
snp = []
|
|
45
|
+
crypto_nossl = ["dep:p384", "dep:rsa", "dep:sha2", "dep:x509-cert"]
|
|
46
|
+
|
|
47
|
+
[target.'cfg(target_os = "linux")'.dependencies]
|
|
48
|
+
iocuddle = "0.1"
|
|
49
|
+
|
|
50
|
+
[dependencies]
|
|
51
|
+
openssl = { version = "0.10", optional = true }
|
|
52
|
+
serde = { version = "1.0", features = ["derive"] }
|
|
53
|
+
serde_bytes = "0.11"
|
|
54
|
+
bitflags = "1.2"
|
|
55
|
+
codicon = "3.0"
|
|
56
|
+
dirs = "5.0"
|
|
57
|
+
serde-big-array = "0.5.1"
|
|
58
|
+
static_assertions = "^1.1.0"
|
|
59
|
+
bitfield = "^0.15"
|
|
60
|
+
uuid = { version = "^1.11", features = ["serde"] }
|
|
61
|
+
bincode = "^1.3"
|
|
62
|
+
hex = "0.4.3"
|
|
63
|
+
libc = "0.2.161"
|
|
64
|
+
lazy_static = "1.4.0"
|
|
65
|
+
p384 = { version = "0.13.0", optional = true }
|
|
66
|
+
rsa = { version = "0.9.6", optional = true }
|
|
67
|
+
sha2 = { version = "0.10.8", optional = true }
|
|
68
|
+
x509-cert = { version = "0.2.5", optional = true }
|
|
69
|
+
byteorder = "1.4.3"
|
|
70
|
+
base64 = "0.22.1"
|
|
71
|
+
rdrand = { version = "^0.8", optional = true }
|
|
72
|
+
reqwest = { version="0.11.10", features = ["blocking"], optional = true }
|
|
73
|
+
tokio = {version = "1.29.1", features =["rt-multi-thread"], optional = true }
|
|
74
|
+
|
|
75
|
+
[target.'cfg(target_os = "linux")'.dev-dependencies]
|
|
76
|
+
kvm-ioctls = ">=0.16"
|
|
77
|
+
|
|
78
|
+
[dev-dependencies]
|
|
79
|
+
kvm-bindings = ">=0.9.1"
|
|
80
|
+
serial_test = "3.0"
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<!-- cargo-rdme start -->
|
|
2
|
+
|
|
3
|
+
The `sev` crate provides an implementation of the [AMD Secure Encrypted
|
|
4
|
+
Virtualization (SEV)][SEV] APIs and the [SEV Secure Nested Paging
|
|
5
|
+
Firmware (SNP)][SNP] ABIs.
|
|
6
|
+
|
|
7
|
+
[SEV]: https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/programmer-references/55766_SEV-KM_API_Specification.pdf
|
|
8
|
+
[SNP]: https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/specifications/56860.pdf
|
|
9
|
+
|
|
10
|
+
## SEV APIs
|
|
11
|
+
|
|
12
|
+
The linux kernel exposes two technically distinct AMD SEV APIs:
|
|
13
|
+
|
|
14
|
+
1. An API for managing the SEV platform itself
|
|
15
|
+
2. An API for managing SEV-enabled KVM virtual machines
|
|
16
|
+
|
|
17
|
+
This crate implements both of those APIs and offers them to client.
|
|
18
|
+
code through a flexible and type-safe high-level interface.
|
|
19
|
+
|
|
20
|
+
## SNP ABIs
|
|
21
|
+
|
|
22
|
+
Like SEV, the linux kernel exposes another two different AMD SEV-SNP ABIs:
|
|
23
|
+
|
|
24
|
+
1. An ABI for managing the SEV-SNP platform itself
|
|
25
|
+
2. An ABI for managing SEV-SNP enabled KVM virtual machines
|
|
26
|
+
|
|
27
|
+
These new ABIs work only for **SEV-SNP** enabled hosts and guests.
|
|
28
|
+
|
|
29
|
+
This crate implements APIs for both SEV and SEV-SNP management.
|
|
30
|
+
|
|
31
|
+
## SEV and SEV-SNP enablement
|
|
32
|
+
|
|
33
|
+
By default, both the SEV and SEV-SNP libraries are compiled.
|
|
34
|
+
Because many modules provide support to both legacy SEV and SEV-SNP, they have been split into individual sub-modules `sev.rs` and `snp.rs`, isolating generation specific behavior.
|
|
35
|
+
If desired, you may opt to exclude either of the sub-modules by disabling its feature in your project's `Cargo.toml`
|
|
36
|
+
|
|
37
|
+
For example, to include the SEV APIs only:
|
|
38
|
+
`sev = { version = "1.2.1", default-features = false, features = ["sev"] }`
|
|
39
|
+
|
|
40
|
+
To include the SEV-SNP APIs only:
|
|
41
|
+
`sev = { version = "1.2.1", default-features = false, features = ["snp"] }`
|
|
42
|
+
|
|
43
|
+
## Platform Management
|
|
44
|
+
|
|
45
|
+
Refer to the [firmware](https://docs.rs/sev/latest/sev/firmware/) module for more information.
|
|
46
|
+
|
|
47
|
+
## Guest Management
|
|
48
|
+
|
|
49
|
+
Refer to the [launch](https://docs.rs/sev/latest/sev/launch/) module for more information.
|
|
50
|
+
|
|
51
|
+
## Cryptographic Verification
|
|
52
|
+
|
|
53
|
+
To enable the cryptographic verification of certificate chains and
|
|
54
|
+
attestation reports, either the `openssl` or `crypto_nossl` feature
|
|
55
|
+
has to be enabled manually. With `openssl`, OpenSSL is used for the
|
|
56
|
+
verification. With `crypto_nossl`, OpenSSL is _not_ used for the
|
|
57
|
+
verification and instead pure-Rust libraries (e.g., `p384`, `rsa`,
|
|
58
|
+
etc.) are used. `openssl` and `crypto_nossl` are mutually exclusive,
|
|
59
|
+
and enabling both at the same time leads to a compiler error.
|
|
60
|
+
|
|
61
|
+
## Remarks
|
|
62
|
+
|
|
63
|
+
Note that the linux kernel provides access to these APIs through a set
|
|
64
|
+
of `ioctl`s that are meant to be called on device nodes (`/dev/kvm` and
|
|
65
|
+
`/dev/sev`, to be specific). As a result, these `ioctl`s form the substrate
|
|
66
|
+
of the `sev` crate. Binaries that result from consumers of this crate are
|
|
67
|
+
expected to run as a process with the necessary privileges to interact
|
|
68
|
+
with the device nodes.
|
|
69
|
+
|
|
70
|
+
## Using the C API
|
|
71
|
+
|
|
72
|
+
Projects in C can take advantage of the C API for the SEV [launch] ioctls.
|
|
73
|
+
To install the C API, users can use `cargo-c` with the features they would
|
|
74
|
+
like to produce and install a `pkg-config` file, a static library, a dynamic
|
|
75
|
+
library, and a C header:
|
|
76
|
+
|
|
77
|
+
`cargo cinstall --prefix=/usr --libdir=/usr/lib64`
|
|
78
|
+
|
|
79
|
+
[firmware]: ./src/firmware/
|
|
80
|
+
[launch]: ./src/launch/
|
|
81
|
+
|
|
82
|
+
<!-- cargo-rdme end -->
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
|
|
3
|
+
fn main() {
|
|
4
|
+
use std::path::Path;
|
|
5
|
+
|
|
6
|
+
// Add in configurations to be checked within the code.
|
|
7
|
+
println!("cargo::rustc-check-cfg=cfg(host)");
|
|
8
|
+
println!("cargo::rustc-check-cfg=cfg(guest)");
|
|
9
|
+
|
|
10
|
+
if Path::new("/dev/sev").exists() {
|
|
11
|
+
println!("cargo:rustc-cfg=host");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if Path::new("/dev/sev-guest").exists() {
|
|
15
|
+
println!("cargo:rustc-cfg=guest");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# Attestation
|
|
2
|
+
|
|
3
|
+
Please note that attestation is a deeply technical process and readers
|
|
4
|
+
should be familiar with some [prerequisite concepts](./prerequisites.md)
|
|
5
|
+
before reading this document.
|
|
6
|
+
|
|
7
|
+
### Colors
|
|
8
|
+
|
|
9
|
+
In process diagrams, colors mean the following:
|
|
10
|
+
|
|
11
|
+
* Green: Implicitly Trusted
|
|
12
|
+
* Red: Untrusted
|
|
13
|
+
* Yellow: Trusted via a Cryptographic Root of Trust
|
|
14
|
+
* Orange: Trusted via Cryptographic Measurement
|
|
15
|
+
|
|
16
|
+
In certificate chain diagrams, colors mean the following:
|
|
17
|
+
|
|
18
|
+
* Blue: The private key is accessable only by hardware.
|
|
19
|
+
|
|
20
|
+
The AMD SEV attestation process is a series of cryptographic transactions between a tenant (entity that wants a
|
|
21
|
+
secure virtual machine) and a host (the entity that provides the virtual machine on their infrastructure).
|
|
22
|
+
This attestation process establishes the following:
|
|
23
|
+
|
|
24
|
+
* A guarantee that the tenant's secure virtual machine (the guest) is running on an authentic AMD processor which
|
|
25
|
+
correctly implements AMD's Secure Encrypted Virtualization (SEV) technology in microcode. This demonstrates
|
|
26
|
+
that the host's processor is capable of supporting an SEV-enabled guest and the guest can be assured it is
|
|
27
|
+
receiving the protections advertised by the SEV featureset once attestation is complete.
|
|
28
|
+
* A guarantee that the platform that tenant's virtual machine will be running on is actually owned by the host.
|
|
29
|
+
* The host-provided virtual machine image matches exactly what the tenant is expecting. That is, both the tenant
|
|
30
|
+
and the host calculate the same measurement of the image.
|
|
31
|
+
* A secure channel to inject a secret (or secrets) into the encrypted guest so that its workload is entirely
|
|
32
|
+
private and known only to the guest itself.
|
|
33
|
+
|
|
34
|
+
AMD SEV seeks to provide these guarantees even with the presence of a potentially hostile or compromised host.
|
|
35
|
+
|
|
36
|
+
#### Establishing Trust
|
|
37
|
+
|
|
38
|
+
The public-key cryptography employed in the attestation for AMD SEV forms a tree-like structure that can be traced
|
|
39
|
+
all the way back to two roots of trust (an authoritative, completely trusted entity):
|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
The above diagram illustrates the two roots of trust from which two chains of trust are established, each terminating
|
|
44
|
+
at the Platform Diffie-Hellman (PDH) node at the bottom. This relationship is important because it shows how trust
|
|
45
|
+
is traced back to what is known as a "root of trust", or in other words: a completely trusted, authoritative entity.
|
|
46
|
+
For AMD SEV, the roots of trust are Advanced Micro Devices (AMD) and the owner of the platform (the entity providing
|
|
47
|
+
the host or a group of hosts). A chain of trust is formed when a trusted entity uses its key to sign another entity's
|
|
48
|
+
key. When an entity's key is signed by a trusted entity, then the newly-signed key is also trusted.
|
|
49
|
+
|
|
50
|
+
Let's step through the two chains of trust shown in the above diagram:
|
|
51
|
+
|
|
52
|
+
The first root of trust is the **Owner Certificate Authority (OCA) signing key**. The OCA is exclusively owned
|
|
53
|
+
by the owner of the platform (the entity that provides the host). It is used to sign the Platform Endorsement Key
|
|
54
|
+
(PEK) to indicate that the owner controls the platform. The only exception to this is if the platform is considered
|
|
55
|
+
"self-owned". In this case, the SEV firmware will generate both the public and private OCA keys and store them. The
|
|
56
|
+
"self-owned" state is the default state.
|
|
57
|
+
|
|
58
|
+
The second root of trust is the **AMD Root Key (ARK)**. The ARK is used to sign the AMD SEV Signing Key (ASK) to mark
|
|
59
|
+
it as an authentic AMD key in the chain of trust. The ARK is an offline key, carefully protected and controlled by
|
|
60
|
+
AMD. This key is used to sign the AMD Signing Key (ASK), which is online.
|
|
61
|
+
|
|
62
|
+
The **AMD SEV Signing Key (ASK)** is signed by the ARK and is therefore branded as an authentic and trusted AMD key.
|
|
63
|
+
This key is used to sign the Chip Endorsement Key (CEK).
|
|
64
|
+
|
|
65
|
+
The **Chip Endorsement Key (CEK)** is a unique key stored within the fuses of the chip itself. This key is signed by
|
|
66
|
+
the ASK to officially associate the processor with the AMD chain of trust. The ASK's signature indicates that the chip
|
|
67
|
+
is an authentic AMD processor. This key is signed during provisioning, a process by which a platform owner takes
|
|
68
|
+
control over the platform. The platform owner exports this key, submits a POST request to an online service, and
|
|
69
|
+
AMD returns the key with an ASK signature on it.
|
|
70
|
+
|
|
71
|
+
The two chains of trust intersect at the **Platform Endorsement Key (PEK)** which is signed by both the OCA and the
|
|
72
|
+
CEK. This means that the PEK derives trust from both roots of trust: AMD and the platform owner. Any key signed by
|
|
73
|
+
the PEK is considered to be trusted by both the platform owner and AMD. This key is generated by the SEV firmware
|
|
74
|
+
(the software that controls the Platform Secure Processor).
|
|
75
|
+
|
|
76
|
+
Finally, the chain of trust terminates at the aforementioned **Platform Diffie-Hellman (PDH)** key. This key is used
|
|
77
|
+
to enable a key exchange between the PSP firmware and the tenant to create a master key.
|
|
78
|
+
|
|
79
|
+
#### Attestation Overview
|
|
80
|
+
|
|
81
|
+
1. **Validation:** Tenant will validate the certificate chain (described above) provided by the host.
|
|
82
|
+
|
|
83
|
+
1. **Secure Channel Establishment:** Tenant and Platform Secure Processor (PSP) will negotiate an encrypted channel.
|
|
84
|
+
|
|
85
|
+
1. **Measurement:** Tenant will validate the measurement of the VM provided by the PSP.
|
|
86
|
+
|
|
87
|
+
1. **Launch:** Attestation is successful. The tenant will inject secrets into the guest and the guest is launched.
|
|
88
|
+
|
|
89
|
+
#### Performing Attestation
|
|
90
|
+
|
|
91
|
+
Now let's examine how the keys are used in practice to perform attestation and safely establish the guarantees that
|
|
92
|
+
were described earlier in the document with a tenant.
|
|
93
|
+
|
|
94
|
+
First, have a quick look at the following diagram, then we'll unpack it:
|
|
95
|
+
|
|
96
|
+

|
|
97
|
+
|
|
98
|
+
##### Validation
|
|
99
|
+
|
|
100
|
+
1. To begin, the tenant will ask the host for the certificate chain. The host will route this request to the PSP which
|
|
101
|
+
will export the certificate chain. The certificate chain is the chain of trust that can be traced all the way to
|
|
102
|
+
the two roots of trust described above. The PSP's response contains the certificate chain and the firmware version
|
|
103
|
+
that drives the PSP. The host will relay this response to the tenant.
|
|
104
|
+
|
|
105
|
+
1. The tenant will verify the certificate chain. The components of the AMD signing keys can be obtained individually
|
|
106
|
+
to confirm the authenticity of the signatures on the certificate. Similarly, the owner's signature on the PEK
|
|
107
|
+
derived from the OCA can be used to verify that the expected owner is in control of the platform.
|
|
108
|
+
|
|
109
|
+
1. The tenant will verify the firmware version advertised by the PSP. Some SEV features are only available in certain
|
|
110
|
+
firmware revisions.
|
|
111
|
+
|
|
112
|
+
1. The tenant will build an execution policy. The execution policy contains configuration information. For example:
|
|
113
|
+
requiring SEV-ES support, disabling the ability to transmit the guest to another platform, or a minimum firmware
|
|
114
|
+
version. This policy will be delivered to the PSP in a secure channel, which will be established next.
|
|
115
|
+
|
|
116
|
+
##### Secure Channel Establishment
|
|
117
|
+
|
|
118
|
+
1. The tenant will create a trusted channel between itself and the PSP to facilitate attestation:
|
|
119
|
+
|
|
120
|
+
1. The tenant generates a random Transport Integrity Key ("tik") and random Transport Encryption Key ("tek").
|
|
121
|
+
|
|
122
|
+
1. The tenant already has the host's Platform Diffie-Hellman (PDH) key from the certificate chain it requested.
|
|
123
|
+
|
|
124
|
+
1. The tenant generates its own random Elliptic Curve Diffie-Hellman (ECDH) key pair.
|
|
125
|
+
|
|
126
|
+
1. The tenant derives a shared secret ("Z") from its own PDH and the host's PDH.
|
|
127
|
+
|
|
128
|
+
1. The tenant generates a random nonce ("N").
|
|
129
|
+
|
|
130
|
+
1. The tenant generates a random initialization vector ("IV").
|
|
131
|
+
|
|
132
|
+
1. The tenant derives the master key ("M") from the shared secret ("Z") and the nonce ("N") and from the string
|
|
133
|
+
"sev-master-secret".
|
|
134
|
+
|
|
135
|
+
1. The tenant derives a Key Encryption Key ("kek") from the master key and the string "sev-kek".
|
|
136
|
+
|
|
137
|
+
1. The tenant derives a Key Integrity Key ("kik") from the master key and the string "sev-kik".
|
|
138
|
+
|
|
139
|
+
1. The tenant concatenates the Transport Encryption Key ("tek") and the Transport Integrity Key ("tik") and wraps
|
|
140
|
+
the result with the Key Encryption Key ("kek"), which is then wrapped by the Key Integrity Key ("kik").
|
|
141
|
+
|
|
142
|
+
1. The Key Integrity Key ("kik") is used to hash and sign the wrapped data with HMAC-SHA256, seeded from the
|
|
143
|
+
initialization vector ("IV").
|
|
144
|
+
|
|
145
|
+
1. The Transport Integrity Key ("tik") is used to hash and sign (HMAC-SHA256) the guest's execution policy that
|
|
146
|
+
was crafted above.
|
|
147
|
+
|
|
148
|
+
1. Finally, the tenant has prepared everything that is required to establish a secure channel between itself
|
|
149
|
+
and the PSP. The tenant will transmit the following to the host (which will relay it to the PSP): the
|
|
150
|
+
tenant's PDH public key, the TIK-protected policy, KIK-protected KEK (TEK, TIK), the nonce ("N"), the
|
|
151
|
+
initialization vector ("IV"). This is everything the PSP needs to securely derive its own understanding
|
|
152
|
+
of the shared secret and decrypt the buffers. This initiates attestation and foreshadows a virtual machine
|
|
153
|
+
launch.
|
|
154
|
+
|
|
155
|
+
| transmitted as | component |
|
|
156
|
+
| --------------: | - |
|
|
157
|
+
| plaintext | N, IV, tenant's PDH (public key) |
|
|
158
|
+
| ciphertext | (KEK: TEK\|TIK) |
|
|
159
|
+
| integrity-protected | (TIK: guest policy), (KIK: KEK) |
|
|
160
|
+
|
|
161
|
+
1. The PSP will receive the tenant's request for a secure channel and decrypt it.
|
|
162
|
+
|
|
163
|
+
1. The PSP will use the nonce ("N"), its PDH and the tenant's PDH to derive the shared secret ("Z") that the
|
|
164
|
+
tenant had derived.
|
|
165
|
+
|
|
166
|
+
1. The PSP will derive the master secret ("M") using the shared secret it had just derived.
|
|
167
|
+
|
|
168
|
+
1. The PSP will derive the Key Encryption Key ("kek") and the Key Integrity Key ("kik") from the master
|
|
169
|
+
key ("M").
|
|
170
|
+
|
|
171
|
+
1. The PSP will decrypt the KIK-protected buffer sent by the tenant which contains the KEK (which itself wraps
|
|
172
|
+
around the concatenated TEK and TIK data).
|
|
173
|
+
|
|
174
|
+
1. The PSP will decrypt the KEK-wrapped buffer to reveal the TEK/TIK concatenated buffer.
|
|
175
|
+
|
|
176
|
+
##### Measurement
|
|
177
|
+
|
|
178
|
+
1. The PSP will create an SEV context for the tenant's virtual machine (guest) and begin bootstrapping an encrypted
|
|
179
|
+
environment for the it.
|
|
180
|
+
|
|
181
|
+
1. The PSP will use the TIK to decrypt the policy and associate the policy with the guest for the entirety
|
|
182
|
+
of its lifetime.
|
|
183
|
+
|
|
184
|
+
1. The PSP will create a cryptographic measurement of the pages provided by the host.
|
|
185
|
+
|
|
186
|
+
1. The PSP will encrypt the guest's pages.
|
|
187
|
+
|
|
188
|
+
1. The PSP will use the TIK to hash and sign the measurement it took of the pages prior to encryption and
|
|
189
|
+
send this reply to the host which then routes it to the tenant.
|
|
190
|
+
|
|
191
|
+
| transmitted as | component |
|
|
192
|
+
| --------------: | - |
|
|
193
|
+
| integrity-protected | (TIK: measurement) |
|
|
194
|
+
|
|
195
|
+
1. The tenant will digest the response from the PSP containing the measurement of the virtual machine image.
|
|
196
|
+
|
|
197
|
+
1. The tenant will perform its own measurement of the pages. If it calculates the same measurement, then the image is
|
|
198
|
+
exactly what the tenant was expecting. If not, attestation has failed, and the tenant should assume the image has
|
|
199
|
+
been tampered with.
|
|
200
|
+
|
|
201
|
+
##### Launch
|
|
202
|
+
|
|
203
|
+
1. If the tenant agrees with the PSP's measurement of the pages, the guest is now ready to securely receive any
|
|
204
|
+
secret metadata.
|
|
205
|
+
|
|
206
|
+
1. The tenant will generate a new initialization vector ("IV") to seed AES-128 encryption used to protect
|
|
207
|
+
the transmission of the secret.
|
|
208
|
+
|
|
209
|
+
1. The secret will be encrypted with AES 128 using the TEK to calculate the ciphertext.
|
|
210
|
+
|
|
211
|
+
1. The secret ciphertext will be hashed and signed by the TIK with HMAC-SHA256.
|
|
212
|
+
|
|
213
|
+
1. The tenant will send the encrypted metadata (secret) to the host which will then relay it to the PSP.
|
|
214
|
+
|
|
215
|
+
| transmitted as | component |
|
|
216
|
+
| --------------: | - |
|
|
217
|
+
| ciphertext | (TEK: secret metadata) |
|
|
218
|
+
| integrity-protected | (TIK: TEK) |
|
|
219
|
+
|
|
220
|
+
1. The PSP will decrypt the ciphertext containing the secret and place it into the guest's memory.
|
|
221
|
+
|
|
222
|
+
1. Finally, attestation has successfully concluded and the virtual machine's launch is complete. The virtual
|
|
223
|
+
machine is now ready to run under the protection of AMD SEV.
|
|
224
|
+
|
|
225
|
+
Please note that attestation for SEV-ES and SEV-SNP will be documented at a later date.
|
|
226
|
+
|
|
227
|
+
#### Protections
|
|
228
|
+
|
|
229
|
+
After attestation completes successfully, a guest is assured to receive [a number of protections](
|
|
230
|
+
./protections.md).
|
|
231
|
+
|
|
232
|
+
#### References
|
|
233
|
+
|
|
234
|
+
This document relies on a number of resources to accurately summarize the deeply technical process of attestation.
|
|
235
|
+
Please note that **this document will defer to AMD's official documentation if any component here is found to be in
|
|
236
|
+
disagreement with the AMD SEV's documentation.** If a discrepency is found, please reach out to file an issue and/or
|
|
237
|
+
open a pull request to notify the Enarx team. Your assistance is sincerely appreciated.
|
|
238
|
+
|
|
239
|
+
* [AMD Secure Encrypted Virtualization (SEV) API, revision 0.22](https://developer.amd.com/wp-content/resources/55766.PDF)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Commits which modify this file MUST generate the new .png!
|
|
2
|
+
digraph G {
|
|
3
|
+
node [style=filled];
|
|
4
|
+
|
|
5
|
+
node [fillcolor=blue, fontcolor=white];
|
|
6
|
+
CEK;
|
|
7
|
+
|
|
8
|
+
node [fillcolor=none, fontcolor=black];
|
|
9
|
+
ARK -> ASK;
|
|
10
|
+
ASK -> CEK;
|
|
11
|
+
CEK -> PEK;
|
|
12
|
+
PEK -> PDH;
|
|
13
|
+
OCA -> PEK;
|
|
14
|
+
}
|
|
Binary file
|