-
Notifications
You must be signed in to change notification settings - Fork 180
Add "external mu" variant of ML-DSA (65 and 87) in _CryptoExtras
#358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: wwdc-25
Are you sure you want to change the base?
Conversation
…nts)" This reverts commit e9de693.
…nts)" This reverts commit e9de693.
…ft-crypto into mldsa-external-mu
_CryptoExtras
|
||
@_implementationOnly import CCryptoBoringSSL | ||
#if canImport(FoundationEssentials) | ||
import FoundationEssentials | ||
#else | ||
import Foundation | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These imports were duplicated in the same file
public func signature(forPrehashedMessageRepresentative mu: some DataProtocol) throws -> Data { | ||
try self.signature_boring(forPrehashedMessageRepresentative: mu) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The public
method here and the equivalent package
one defined in Crypto/Signatures/MLDSA.swift
must have different names, otherwise the compiler thinks we are calling the same method and throws the warning Function call causes an infinite recursion
.
|
||
private var boringSSLKey: OpenSSLMLDSAPublicKeyImpl<MLDSA65> { | ||
get throws { | ||
self.impl is OpenSSLMLDSAPublicKeyImpl<MLDSA65> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This throws the warning 'is' test is always true
, should we use #if
checks instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated it to use #if
checks
Add an "external mu" variant of the ML-DSA API (65 and 87 variants) in
_CryptoExtras
.Checklist
If you've made changes to
gyb
files.script/generate_boilerplate_files_with_gyb
and included updated generated files in a commit of this pull requestMotivation:
BoringSSL now has an “external mu” variant of the ML-DSA API, which makes it possible to calculate the hash (called “mu”) of the message, context and public key separately, and then pass this “mu” to a signing function.
Basically, it is the same process as the traditional signature function, but separated into two steps.
This is supposed to be the alternative to the HashML-DSA algorithm, which does pure pre-hashing.
Modifications:
Add the "external mu" API to
MLDSA65
andMLDSA87
when importing_CryptoExtras
, add tests.Result:
The "external mu" variant of ML-DSA is now available in
_CryptoExtras
.