@super-protocol/addons-tee 0.8.16 → 0.8.17-beta.1
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/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 +133 -0
- package/dist/sgx-native-module/sev-snp.js +533 -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,133 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { CpuInfo } from "../../bindings/amd-sev-snp-napi-rs/";
|
|
3
|
+
import { CertificateFormat } from "./pki.service";
|
|
4
|
+
export declare enum SupportedAmdSevSnpGenerations {
|
|
5
|
+
Milan = "Milan",
|
|
6
|
+
Genoa = "Genoa"
|
|
7
|
+
}
|
|
8
|
+
export declare enum SevSNPCertType {
|
|
9
|
+
ARK = "ARK",
|
|
10
|
+
ASK = "ASK",
|
|
11
|
+
VCEK = "VCEK"
|
|
12
|
+
}
|
|
13
|
+
export interface SnpCert {
|
|
14
|
+
type: SevSNPCertType;
|
|
15
|
+
cert: Buffer | string;
|
|
16
|
+
format: CertificateFormat;
|
|
17
|
+
}
|
|
18
|
+
export interface SNPReport {
|
|
19
|
+
report: Buffer;
|
|
20
|
+
cpuSig: number;
|
|
21
|
+
cores: number;
|
|
22
|
+
cmdLineHash: Buffer;
|
|
23
|
+
build: string;
|
|
24
|
+
}
|
|
25
|
+
export interface SNPReportWithChain extends SNPReport {
|
|
26
|
+
certs: SnpCert[];
|
|
27
|
+
}
|
|
28
|
+
export interface CalcSnpMrEnclaveParams {
|
|
29
|
+
ovmfPath: string;
|
|
30
|
+
kernelHash: Buffer;
|
|
31
|
+
initrdHash?: Buffer;
|
|
32
|
+
cmdLineHash: Buffer;
|
|
33
|
+
vcpuSig: number;
|
|
34
|
+
vcpuCount: number;
|
|
35
|
+
vmpl?: number;
|
|
36
|
+
policy?: bigint;
|
|
37
|
+
}
|
|
38
|
+
export declare const AMD_EPYC_MILAN_CPUINFO: CpuInfo;
|
|
39
|
+
export declare const EMPTY_INITRD_SHA256_HASH: Buffer;
|
|
40
|
+
export type ArkHashes = {
|
|
41
|
+
[key: string]: Buffer;
|
|
42
|
+
};
|
|
43
|
+
export declare const ARK_MILAN = "-----BEGIN CERTIFICATE-----\nMIIGYzCCBBKgAwIBAgIDAQAAMEYGCSqGSIb3DQEBCjA5oA8wDQYJYIZIAWUDBAIC\nBQChHDAaBgkqhkiG9w0BAQgwDQYJYIZIAWUDBAICBQCiAwIBMKMDAgEBMHsxFDAS\nBgNVBAsMC0VuZ2luZ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2bczxPE8\nHdS38ijiJmm9vl50RGUeOAXjSuInGR4bsRufeGPB9peTa9BcBOeTWzstqTUB/F/q\naZCIZKr4X6TyfUuSDz/1JDAGl+lxdM0P9+lLaP9NahQjHCVf0zf1c1salVuGFk2w\n/wMz1R1BHg==\n-----END CERTIFICATE-----";
|
|
45
|
+
export declare function getDefaultArkHashes(): ArkHashes;
|
|
46
|
+
export declare class SevSNP {
|
|
47
|
+
static serializeSNPReport(report: SNPReportWithChain): Buffer;
|
|
48
|
+
static deserializeSNPReport(serialized: Buffer): SNPReportWithChain;
|
|
49
|
+
protected static convertCertToPem(cert: Buffer): string;
|
|
50
|
+
protected static convertPemToDer(cert: string): Buffer;
|
|
51
|
+
protected static splitCerts(certsPem: string): string[];
|
|
52
|
+
protected static readCmdLine(): Promise<string>;
|
|
53
|
+
/**
|
|
54
|
+
* Method for generation AMD SEV-SNP Report
|
|
55
|
+
* @param userData - The data that will be included in the report and will be signed
|
|
56
|
+
*/
|
|
57
|
+
static generateSNPReport(userData: Buffer): Promise<SNPReport>;
|
|
58
|
+
/**
|
|
59
|
+
* Method for fetch certificates from AMD KDS
|
|
60
|
+
* @param report - report generated by the `generateSNPReport` method
|
|
61
|
+
* @param options - options for working with HTTP, allows you to configure repetitions and the interval between them,
|
|
62
|
+
* as well as the format of the returned certificates
|
|
63
|
+
*/
|
|
64
|
+
static getReportChain(report: SNPReport, options?: {
|
|
65
|
+
retryMax?: number;
|
|
66
|
+
retryInterval?: number;
|
|
67
|
+
certFormat?: CertificateFormat;
|
|
68
|
+
}): Promise<SnpCert[]>;
|
|
69
|
+
/**
|
|
70
|
+
* Method for generation AMD SEV-SNP Report and fetching certificates
|
|
71
|
+
* @param userData - @see generateSNPReport
|
|
72
|
+
* @param options - @see getReportChain
|
|
73
|
+
*/
|
|
74
|
+
static generateSNPReportWithChain(userData: Buffer, options?: {
|
|
75
|
+
retryMax?: number;
|
|
76
|
+
retryInterval?: number;
|
|
77
|
+
certFormat?: CertificateFormat;
|
|
78
|
+
}): Promise<SNPReportWithChain>;
|
|
79
|
+
protected static runSubProcess(binaryPath: string, args?: string[], options?: {
|
|
80
|
+
cwd?: string;
|
|
81
|
+
timeoutMs?: number;
|
|
82
|
+
}): Promise<{
|
|
83
|
+
exitCode: number;
|
|
84
|
+
stdout: string;
|
|
85
|
+
stderr: string;
|
|
86
|
+
}>;
|
|
87
|
+
static getCertHash(cert: SnpCert): Buffer;
|
|
88
|
+
protected static isValidArk(ARK: SnpCert, trustedHashes: ArkHashes): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* AMD SEV-SNP verification method
|
|
91
|
+
* @param report - report with full certificate chain
|
|
92
|
+
* @param options - trustedHashes - map of trusted AMD ARK Certificates (CommonName as Key, Sha256 Hash of Der Certificate as Value) - optional
|
|
93
|
+
* timeoutMs - timeout of the utility snpnost in ms
|
|
94
|
+
* snpGuestBinaryPath - path for snpguest util
|
|
95
|
+
*/
|
|
96
|
+
static verifyReport(report: SNPReportWithChain, options?: {
|
|
97
|
+
trustedHashes?: ArkHashes;
|
|
98
|
+
timeoutMs?: number;
|
|
99
|
+
snpGuestBinaryPath?: string;
|
|
100
|
+
}): Promise<void>;
|
|
101
|
+
protected static calcMrEnclave(measure: Buffer, vmpl: number, policy: bigint): Buffer;
|
|
102
|
+
/**
|
|
103
|
+
* Method for obtaining mrEnclave from report. MrEnclave includes report measure, report vmpl and report policy
|
|
104
|
+
* @param report - report without certificates
|
|
105
|
+
*/
|
|
106
|
+
static getMrEnclave(report: Buffer): Buffer;
|
|
107
|
+
/**
|
|
108
|
+
* Method for obtaining reportData. This data was passed when generating the report
|
|
109
|
+
* @param report - report without certificates
|
|
110
|
+
*/
|
|
111
|
+
static getReportData(report: Buffer): Promise<Buffer>;
|
|
112
|
+
/**
|
|
113
|
+
* Method for obtaining measure. Please do not confuse with mrenclave. Report measure is part of mrEnclave.
|
|
114
|
+
* @param report - report without certificates
|
|
115
|
+
*/
|
|
116
|
+
static getReportMeasure(report: Buffer): Promise<Buffer>;
|
|
117
|
+
protected static calculateFileSha256(filePath: string): Promise<Buffer>;
|
|
118
|
+
protected static calculateCmdlineHash(cmdLine: string): Buffer;
|
|
119
|
+
/**
|
|
120
|
+
* The method allows to get the expected mrEnclave without generating a report
|
|
121
|
+
* @param params - @see CalcSnpMrEnclaveParams
|
|
122
|
+
*/
|
|
123
|
+
static calcSnpMrEnclave(params: CalcSnpMrEnclaveParams): Promise<Buffer>;
|
|
124
|
+
protected static extractBuildFromCmdline(cmdLine: string, paramName?: string): string;
|
|
125
|
+
/**
|
|
126
|
+
* Compute the 32-bit CPUID signature from family, model, and stepping.
|
|
127
|
+
* This computation is described in AMD's CPUID Specification, publication #25481
|
|
128
|
+
* https://www.amd.com/system/files/TechDocs/25481.pdf
|
|
129
|
+
* See section: CPUID Fn0000_0001_EAX Family, Model, Stepping Identifiers
|
|
130
|
+
* @param cpuInfo - Structure containing family, model and stepping @see CpuInfo
|
|
131
|
+
*/
|
|
132
|
+
static getCpuSig(cpuInfo: CpuInfo): number;
|
|
133
|
+
}
|