script: Implement WebCrypto encapsulation and decapsulation with ML-KEM#41617
script: Implement WebCrypto encapsulation and decapsulation with ML-KEM#41617TimvdLippe merged 3 commits intoservo:mainfrom
Conversation
Continue on adding ML-KEM support to WebCrypto API. Specification: https://wicg.github.io/webcrypto-modern-algos/#ml-kem This patch implements encapsulate and decapsulate operations of ML-KEM, with `ml-kem` crate. Note that these two operations are not currently in use. They are intended for the upcoming `SubtleCrypto.encapsulateKey`, `SubtleCrypto.encapsulateBits`, `SubtleCrypto.decapsulateKey`, and `SubtleCrypto.decapsulateBits`` methods, which have not yet been implemented. This patch prepares usable encapsulation and decapsulation operations of ML-KEM to support those new methods when they are added. Testing: No behavioral change. Fixes: Part of 41473 Signed-off-by: Kingsley Yung <[email protected]>
|
Can you add a second commit that introduces the usages of these methods? That way we have test coverage. Otherwise it's only dead code and might drift from expectations in the future. |
|
Sure. I can bring in the implementation of I also have the implementation of |
|
Let's put that in two separate commits, but in the same PR. That way I can review them separately, but we can test them in combination |
This patch implements `SubtleCrypto.encapsulateBits` and `SubtleCrypto.decapsulateBits` of WebCrypto. Specification of `SubtleCrypto.encapsulateBits`: https://wicg.github.io/webcrypto-modern-algos/#SubtleCrypto-method-encapsulateBits Specification of `SubtleCrypto.decapsulateBits`: https://wicg.github.io/webcrypto-modern-algos/#SubtleCrypto-method-decapsulateBits Since we have implemented the "encapsulate" and "decapsulate" operations of ML-KEM, the `encapsulateBits` and `decapsulateBits` methods can call them to encapsulate and decapsulate bits using ML-KEM algorithm. Testing: Pass some WPT tests that were expected to fail. Fixes: Part of 41473 Signed-off-by: Kingsley Yung <[email protected]>
This patch implements `SubtleCrypto.encapsulateKey` and `SubtleCrypto.decapsulateKey` of WebCrypto. Specification of `SubtleCrypto.encapsulateKey`: https://wicg.github.io/webcrypto-modern-algos/#SubtleCrypto-method-encapsulateKey Specification of `SubtleCrypto.decapsulateKey`: https://wicg.github.io/webcrypto-modern-algos/#SubtleCrypto-method-decapsulateKey Since we have implemented the "encapsulate" and "decapsulate" operations of ML-KEM, the `encapsulateKey` and `decapsulateKey` methods can call them to encapsulate and decapsulate key using ML-KEM algorithm. Testing: Pass some WPT tests that were expected to fail. Fixes: Part of 41473 Signed-off-by: Kingsley Yung <[email protected]>
Complete the ML-KEM support in WebCrypto API, with the implementation of the "encapsulate" and "decapsulate" operations of ML-KEM, as well as four new methods
encapsulateKey,encapsulateBits,decapsulateKeyanddecapsulateBitsofSubtleCrypto.Specification:
https://wicg.github.io/webcrypto-modern-algos/#ml-kem-operations-encapsulate
https://wicg.github.io/webcrypto-modern-algos/#ml-kem-operations-decapsulate
https://wicg.github.io/webcrypto-modern-algos/#SubtleCrypto-method-encapsulateKey
https://wicg.github.io/webcrypto-modern-algos/#SubtleCrypto-method-encapsulateBits
https://wicg.github.io/webcrypto-modern-algos/#SubtleCrypto-method-decapsulateKey
https://wicg.github.io/webcrypto-modern-algos/#SubtleCrypto-method-decapsulateBits
Testing: Pass some WPT tests that were expected to fail.
Fixes: Part of #41473