From 72ac15ab6a8786d60931904ea0d7742be42f8017 Mon Sep 17 00:00:00 2001 From: Bas Westerbaan Date: Wed, 28 Feb 2024 23:59:31 +0100 Subject: [PATCH] dilithium: fix typo in privkey size panic Thanks-to: @wussler --- sign/dilithium/mldsa44.go | 2 +- sign/dilithium/mldsa65.go | 2 +- sign/dilithium/mldsa87.go | 2 +- sign/dilithium/mode2.go | 2 +- sign/dilithium/mode2aes.go | 2 +- sign/dilithium/mode3.go | 2 +- sign/dilithium/mode3aes.go | 2 +- sign/dilithium/mode5.go | 2 +- sign/dilithium/mode5aes.go | 2 +- sign/dilithium/templates/mode.templ.go | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sign/dilithium/mldsa44.go b/sign/dilithium/mldsa44.go index 1cbaf0174..5df54821e 100644 --- a/sign/dilithium/mldsa44.go +++ b/sign/dilithium/mldsa44.go @@ -58,7 +58,7 @@ func (m *implMLDSA44) PublicKeyFromBytes(data []byte) PublicKey { func (m *implMLDSA44) PrivateKeyFromBytes(data []byte) PrivateKey { var ret mldsa44.PrivateKey if len(data) != mldsa44.PrivateKeySize { - panic("packed public key must be of mldsa44.PrivateKeySize bytes") + panic("packed private key must be of mldsa44.PrivateKeySize bytes") } var buf [mldsa44.PrivateKeySize]byte copy(buf[:], data) diff --git a/sign/dilithium/mldsa65.go b/sign/dilithium/mldsa65.go index 8c39363e8..bb035227b 100644 --- a/sign/dilithium/mldsa65.go +++ b/sign/dilithium/mldsa65.go @@ -58,7 +58,7 @@ func (m *implMLDSA65) PublicKeyFromBytes(data []byte) PublicKey { func (m *implMLDSA65) PrivateKeyFromBytes(data []byte) PrivateKey { var ret mldsa65.PrivateKey if len(data) != mldsa65.PrivateKeySize { - panic("packed public key must be of mldsa65.PrivateKeySize bytes") + panic("packed private key must be of mldsa65.PrivateKeySize bytes") } var buf [mldsa65.PrivateKeySize]byte copy(buf[:], data) diff --git a/sign/dilithium/mldsa87.go b/sign/dilithium/mldsa87.go index bc125430b..d3d98420a 100644 --- a/sign/dilithium/mldsa87.go +++ b/sign/dilithium/mldsa87.go @@ -58,7 +58,7 @@ func (m *implMLDSA87) PublicKeyFromBytes(data []byte) PublicKey { func (m *implMLDSA87) PrivateKeyFromBytes(data []byte) PrivateKey { var ret mldsa87.PrivateKey if len(data) != mldsa87.PrivateKeySize { - panic("packed public key must be of mldsa87.PrivateKeySize bytes") + panic("packed private key must be of mldsa87.PrivateKeySize bytes") } var buf [mldsa87.PrivateKeySize]byte copy(buf[:], data) diff --git a/sign/dilithium/mode2.go b/sign/dilithium/mode2.go index 7e27eff2c..113715025 100644 --- a/sign/dilithium/mode2.go +++ b/sign/dilithium/mode2.go @@ -57,7 +57,7 @@ func (m *implMode2) PublicKeyFromBytes(data []byte) PublicKey { func (m *implMode2) PrivateKeyFromBytes(data []byte) PrivateKey { var ret mode2.PrivateKey if len(data) != mode2.PrivateKeySize { - panic("packed public key must be of mode2.PrivateKeySize bytes") + panic("packed private key must be of mode2.PrivateKeySize bytes") } var buf [mode2.PrivateKeySize]byte copy(buf[:], data) diff --git a/sign/dilithium/mode2aes.go b/sign/dilithium/mode2aes.go index e973a70f6..6985ccf84 100644 --- a/sign/dilithium/mode2aes.go +++ b/sign/dilithium/mode2aes.go @@ -57,7 +57,7 @@ func (m *implMode2AES) PublicKeyFromBytes(data []byte) PublicKey { func (m *implMode2AES) PrivateKeyFromBytes(data []byte) PrivateKey { var ret mode2aes.PrivateKey if len(data) != mode2aes.PrivateKeySize { - panic("packed public key must be of mode2aes.PrivateKeySize bytes") + panic("packed private key must be of mode2aes.PrivateKeySize bytes") } var buf [mode2aes.PrivateKeySize]byte copy(buf[:], data) diff --git a/sign/dilithium/mode3.go b/sign/dilithium/mode3.go index 147678612..7726023f2 100644 --- a/sign/dilithium/mode3.go +++ b/sign/dilithium/mode3.go @@ -57,7 +57,7 @@ func (m *implMode3) PublicKeyFromBytes(data []byte) PublicKey { func (m *implMode3) PrivateKeyFromBytes(data []byte) PrivateKey { var ret mode3.PrivateKey if len(data) != mode3.PrivateKeySize { - panic("packed public key must be of mode3.PrivateKeySize bytes") + panic("packed private key must be of mode3.PrivateKeySize bytes") } var buf [mode3.PrivateKeySize]byte copy(buf[:], data) diff --git a/sign/dilithium/mode3aes.go b/sign/dilithium/mode3aes.go index bdbe19020..f7414f15b 100644 --- a/sign/dilithium/mode3aes.go +++ b/sign/dilithium/mode3aes.go @@ -57,7 +57,7 @@ func (m *implMode3AES) PublicKeyFromBytes(data []byte) PublicKey { func (m *implMode3AES) PrivateKeyFromBytes(data []byte) PrivateKey { var ret mode3aes.PrivateKey if len(data) != mode3aes.PrivateKeySize { - panic("packed public key must be of mode3aes.PrivateKeySize bytes") + panic("packed private key must be of mode3aes.PrivateKeySize bytes") } var buf [mode3aes.PrivateKeySize]byte copy(buf[:], data) diff --git a/sign/dilithium/mode5.go b/sign/dilithium/mode5.go index c9b55dd30..2e282fe8f 100644 --- a/sign/dilithium/mode5.go +++ b/sign/dilithium/mode5.go @@ -57,7 +57,7 @@ func (m *implMode5) PublicKeyFromBytes(data []byte) PublicKey { func (m *implMode5) PrivateKeyFromBytes(data []byte) PrivateKey { var ret mode5.PrivateKey if len(data) != mode5.PrivateKeySize { - panic("packed public key must be of mode5.PrivateKeySize bytes") + panic("packed private key must be of mode5.PrivateKeySize bytes") } var buf [mode5.PrivateKeySize]byte copy(buf[:], data) diff --git a/sign/dilithium/mode5aes.go b/sign/dilithium/mode5aes.go index 0dfd3854f..b7f1cb485 100644 --- a/sign/dilithium/mode5aes.go +++ b/sign/dilithium/mode5aes.go @@ -57,7 +57,7 @@ func (m *implMode5AES) PublicKeyFromBytes(data []byte) PublicKey { func (m *implMode5AES) PrivateKeyFromBytes(data []byte) PrivateKey { var ret mode5aes.PrivateKey if len(data) != mode5aes.PrivateKeySize { - panic("packed public key must be of mode5aes.PrivateKeySize bytes") + panic("packed private key must be of mode5aes.PrivateKeySize bytes") } var buf [mode5aes.PrivateKeySize]byte copy(buf[:], data) diff --git a/sign/dilithium/templates/mode.templ.go b/sign/dilithium/templates/mode.templ.go index fb7930de9..445514bcc 100644 --- a/sign/dilithium/templates/mode.templ.go +++ b/sign/dilithium/templates/mode.templ.go @@ -67,7 +67,7 @@ func (m *{{.Impl}}) PublicKeyFromBytes(data []byte) PublicKey { func (m *{{.Impl}}) PrivateKeyFromBytes(data []byte) PrivateKey { var ret {{.Pkg}}.PrivateKey if len(data) != {{.Pkg}}.PrivateKeySize { - panic("packed public key must be of {{.Pkg}}.PrivateKeySize bytes") + panic("packed private key must be of {{.Pkg}}.PrivateKeySize bytes") } var buf [{{.Pkg}}.PrivateKeySize]byte copy(buf[:], data)