Skip to content

proposal: crypto/mldsa: Verify API can't verify signatures created with crypto.MLDSAMu #80272

Description

@gojuukaze

Proposal Details

In the crypto/mldsa package (go 1.27), PrivateKey.Sign accepts crypto.SignerOpts. It allows signing an external μ message by checking opts.HashFunc() == crypto.MLDSAMu:

func (sk *PrivateKey) Sign(_ io.Reader, message []byte, opts crypto.SignerOpts) (signature []byte, err error) {
    // ...
    switch opts.HashFunc() {
    case 0:
        // ... directly-signed message
    case crypto.MLDSAMu:
        return mldsa.SignExternalMu(&sk.k, message)
    default:
        return nil, errInvalidSignerOpts
    }
}

However, the public Verify API only accepts *Options instead of an interface like crypto.SignerOpts or a mechanism to support crypto.MLDSAMu.

func Verify(pk *PublicKey, message []byte, signature []byte, opts *Options) error {
    // ...
    return mldsa.Verify(&pk.p, message, signature, opts.Context)
}

Because Verify only passes opts.Context into the internal mldsa.Verify, there is currently no way to verify a signature that was generated using crypto.MLDSAMu. The underlying mldsa.VerifyExternalMu functionality is completely trapped and unexported to consumers of the public crypto/mldsa package.

Proposal:

Change the opts parameter of Verify to support crypto.MLDSAMu, or export a dedicated VerifyExternalMu function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions