@@ -231,11 +231,11 @@ Enclave providers must be queryable for capabilities which can then be used by t
231231to use. Common capabilities with existing enclaves are in the following rust code. These are not mutually exclusive
232232``` rust
233233pub enum EnclaveOperation {
234- DeriveDiffieHellman ( DeriveParams ),
234+ Attestation ( AttestationParams ),
235235 GenerateAsymmetricKey (GenerateAsymmetricParams ),
236236 GenerateSymmetricKey (GenerateSymmetricParams ),
237237 GenerateRandom (RandomParams ),
238- Attestation ( AttestationParams ),
238+ KeyAgreement ( AgreementParams ),
239239 Sign (SigningParams ),
240240 Verify (VerifyParams ),
241241 Encrypt (EncryptParams ),
@@ -251,9 +251,13 @@ pub enum EnclaveOperation {
251251 DeviceInfo
252252}
253253
254- pub enum DeriveParams {
254+ /// Key agreement derivation parameters
255+ pub enum AgreementParams {
256+ /// Key agreement using PKCS3
255257 Pkcs3 (Pkcs3Params ),
258+ /// Key agreement using ECDH
256259 Ecdh (EcdhParams ),
260+ /// Key agreement using Post-Quantum algorithms
257261 Pq (PostQuantumParams )
258262}
259263
@@ -265,21 +269,33 @@ pub struct Pkcs3Params {
265269 g : BigNum ,
266270 /// This enclave's key id
267271 id : String ,
272+ /// Mask generating function
273+ mgf : Pkcs3Mgf ,
268274 /// Other's public key
269- peer : BigNum
275+ peer : BigNum ,
270276}
271277
272278/// Pkcs3 diffie hellman prime
273279pub struct Pkcs3DhP {
274280 value : BigNum
275281}
276282
283+ /// Valid mask generating functions for Pkcs3
284+ pub enum Pkcs3Mgf {
285+ Sha224 ,
286+ Sha256 ,
287+ Sha384 ,
288+ Sha512
289+ }
290+
277291/// Elliptic Curve Diffie Hellman parameters
278292pub struct EcdhParams {
279293 /// The curve to use
280294 curve : EccCurve ,
281295 /// This enclave's key id
282296 id : String ,
297+ /// Mask generating function
298+ mgf : EcdhMgf ,
283299 /// Other's public key as an uncompressed point for curves that support compressed points
284300 /// typically is 57, 65, 97, 129, 133, 193 bytes
285301 peer : EcPoint
@@ -335,6 +351,23 @@ pub enum EccCurve {
335351 /// BrainPool 512
336352 EcBP512 ,
337353}
354+
355+ /// Valid mask generating functions for Ecdh
356+ pub enum EcdhMgf {
357+ Sha2_224 ,
358+ Sha2_256 ,
359+ Sha2_384 ,
360+ Sha2_512 ,
361+ Sha3_224 ,
362+ Sha3_256 ,
363+ Sha3_384 ,
364+ Sha3_512 ,
365+ Blake2_224 ,
366+ Blake2_256 ,
367+ Blake2_384 ,
368+ Blake2_512 ,
369+ Blake3_256 ,
370+ }
338371```
339372
340373Some capabilities offer multiple options like ` DeriveDiffieHellman ` which can be either PKCS #3 DHParameter structure
@@ -353,7 +386,8 @@ enclave provider that is to be supported.
353386
354387Another possibility is that this approach is too flexible and requires intimate knowledge about crypto algorithms.
355388To mitigate this, predefined ciphers can be created for end consumers like RSA-3072-PSS-SHA256 or
356- AES-256-GCM or AES-128-CBC-HMAC-SHA256 or XCHACHA20-POLY1305. This reduces algorithmic agility that is an inherent problem
389+ AES-256-GCM, AES-128-CBC-HMAC-SHA256, XCHACHA20-POLY1305, ED25519, ECDSA-SHA256, or ECIES-SHA512-AES-GCM.
390+ This reduces algorithmic agility that is an inherent problem
357391with many cryptographic libraries.
358392
359393# Rationale and alternatives
0 commit comments