Skip to content
This repository was archived by the owner on Apr 27, 2023. It is now read-only.

Commit 994e7db

Browse files
committed
Changed Derive to Key Agreement
Signed-off-by: Michael Lodder <redmike7@gmail.com>
1 parent 7cc6fe1 commit 994e7db

File tree

1 file changed

+39
-5
lines changed

1 file changed

+39
-5
lines changed

enclave-interface/README.md

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,11 @@ Enclave providers must be queryable for capabilities which can then be used by t
231231
to use. Common capabilities with existing enclaves are in the following rust code. These are not mutually exclusive
232232
```rust
233233
pub 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
273279
pub 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
278292
pub 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

340373
Some 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

354387
Another possibility is that this approach is too flexible and requires intimate knowledge about crypto algorithms.
355388
To 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
357391
with many cryptographic libraries.
358392

359393
# Rationale and alternatives

0 commit comments

Comments
 (0)