Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions kms/mackms/mackms.go
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ func isSelfSigned(cert *x509.Certificate) bool {
return false
}

var notFoundError = apiv1.NotFoundError{
var errCertificateNotFound = apiv1.NotFoundError{
Message: "certificate not found",
}

Expand Down Expand Up @@ -1249,7 +1249,7 @@ func loadCertificate(u *certAttributes, subjectKeyID []byte, opts ...loadCertifi
}

if len(certs) == 0 {
return nil, notFoundError
return nil, errCertificateNotFound
}

// Filter the certificates by the subject distinguished name components
Expand All @@ -1261,7 +1261,7 @@ func loadCertificate(u *certAttributes, subjectKeyID []byte, opts ...loadCertifi
return !u.matchesSubject(cert)
})
if len(certs) == 0 {
return nil, notFoundError
return nil, errCertificateNotFound
}
}

Expand Down
4 changes: 2 additions & 2 deletions kms/mackms/mackms_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1934,9 +1934,9 @@ func TestMacKMS_DeleteCertificate_bySubject(t *testing.T) {
t.Cleanup(func() {
// The certificates are deleted by the test itself; this only removes
// the leftovers if the test fails early.
kms := &MacKMS{}
km := &MacKMS{}
for _, crt := range []*x509.Certificate{certA, certB, certC} {
_ = kms.DeleteCertificate(&apiv1.DeleteCertificateRequest{Name: serialURI(crt)})
_ = km.DeleteCertificate(&apiv1.DeleteCertificateRequest{Name: serialURI(crt)})
}
})

Expand Down
33 changes: 22 additions & 11 deletions mldsa/mldsa_go127.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,29 @@ import (
// true when compiled with Go 1.27 or later.
const Supported = true

type Options = mldsa.Options

type Parameters = mldsa.Parameters

type PrivateKey = mldsa.PrivateKey
const (
PrivateKeySize = mldsa.PrivateKeySize
MLDSA44PublicKeySize = mldsa.MLDSA44PublicKeySize
MLDSA65PublicKeySize = mldsa.MLDSA65PublicKeySize
MLDSA87PublicKeySize = mldsa.MLDSA87PublicKeySize
MLDSA44SignatureSize = mldsa.MLDSA44SignatureSize
MLDSA65SignatureSize = mldsa.MLDSA65SignatureSize
MLDSA87SignatureSize = mldsa.MLDSA87SignatureSize
)

type PublicKey = mldsa.PublicKey
type (
Options = mldsa.Options
Parameters = mldsa.Parameters
PrivateKey = mldsa.PrivateKey
PublicKey = mldsa.PublicKey
)

var (
GenerateKey = mldsa.GenerateKey
Verify = mldsa.Verify
MLDSA44 = mldsa.MLDSA44
MLDSA65 = mldsa.MLDSA65
MLDSA87 = mldsa.MLDSA87
GenerateKey = mldsa.GenerateKey
NewPrivateKey = mldsa.NewPrivateKey
NewPublicKey = mldsa.NewPublicKey
Verify = mldsa.Verify
MLDSA44 = mldsa.MLDSA44
MLDSA65 = mldsa.MLDSA65
MLDSA87 = mldsa.MLDSA87
)
48 changes: 41 additions & 7 deletions mldsa/mldsa_stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,24 @@ var errNotSupported = errors.New("mldsa is not supported")
// false when compiled with a Go toolchain older than 1.27.
const Supported = false

const (
PrivateKeySize = 32
MLDSA44PublicKeySize = 1312
MLDSA65PublicKeySize = 1952
MLDSA87PublicKeySize = 2592
MLDSA44SignatureSize = 2420
MLDSA65SignatureSize = 3309
MLDSA87SignatureSize = 4627
)

type Options struct {
Context string
}

func (o *Options) HashFunc() crypto.Hash {
return 0
}

type Parameters struct{}

func MLDSA44() Parameters {
Expand All @@ -35,16 +53,28 @@ func MLDSA87() Parameters {
return Parameters{}
}

type Options struct {
Context string
func (p Parameters) PublicKeySize() int {
return 0
}

func (o *Options) HashFunc() crypto.Hash {
func (p Parameters) SignatureSize() int {
return 0
}

func (p Parameters) String() string {
return ""
}

type PrivateKey struct{}

func GenerateKey(params Parameters) (*PrivateKey, error) {
return nil, errNotSupported
}

func NewPrivateKey(params Parameters, seed []byte) (*PrivateKey, error) {
return nil, errNotSupported
}

func (sk *PrivateKey) Bytes() []byte {
return nil
}
Expand All @@ -65,8 +95,16 @@ func (sk *PrivateKey) Sign(_ io.Reader, message []byte, opts crypto.SignerOpts)
return nil, errNotSupported
}

func (sk *PrivateKey) SignDeterministic(message []byte, opts crypto.SignerOpts) (signature []byte, err error) {
return nil, errNotSupported
}

type PublicKey struct{}

func NewPublicKey(params Parameters, encoding []byte) (*PublicKey, error) {
return nil, errNotSupported
}

func (pk *PublicKey) Bytes() []byte {
return nil
}
Expand All @@ -79,10 +117,6 @@ func (pk *PublicKey) Parameters() Parameters {
return Parameters{}
}

func GenerateKey(params Parameters) (*PrivateKey, error) {
return nil, errNotSupported
}

func Verify(pk *PublicKey, message, signature []byte, opts *Options) error {
return errNotSupported
}