@@ -28,10 +28,8 @@ import (
28
28
"crypto"
29
29
cryptoRand "crypto/rand"
30
30
"crypto/subtle"
31
- "errors"
32
31
"fmt"
33
32
"io"
34
- "strconv"
35
33
36
34
"github.com/cloudflare/circl/ecc/goldilocks"
37
35
"github.com/cloudflare/circl/internal/sha3"
@@ -66,7 +64,8 @@ type SignerOptions struct {
66
64
// Its length must be less or equal than 255 bytes.
67
65
Context string
68
66
69
- // Scheme is an identifier for choosing a signature scheme.
67
+ // Scheme is an identifier for choosing a signature scheme. The zero value
68
+ // is ED448.
70
69
Scheme SchemeID
71
70
}
72
71
@@ -154,7 +153,7 @@ func (priv PrivateKey) Sign(
154
153
case scheme == ED448Ph && opts .HashFunc () == crypto .Hash (0 ):
155
154
return SignPh (priv , message , ctx ), nil
156
155
default :
157
- return nil , errors . New ("ed448: bad hash algorithm" )
156
+ return nil , fmt . Errorf ("ed448: bad hash algorithm" )
158
157
}
159
158
}
160
159
@@ -187,9 +186,9 @@ func NewKeyFromSeed(seed []byte) PrivateKey {
187
186
return privateKey
188
187
}
189
188
190
- func newKeyFromSeed (privateKey , seed []byte ) {
189
+ func newKeyFromSeed (privateKey PrivateKey , seed []byte ) {
191
190
if l := len (seed ); l != SeedSize {
192
- panic ("ed448: bad seed length: " + strconv . Itoa ( l ))
191
+ panic (fmt . Errorf ( "ed448: bad seed length: %v" , l ))
193
192
}
194
193
195
194
var h [hashSize ]byte
@@ -212,7 +211,7 @@ func newKeyFromSeed(privateKey, seed []byte) {
212
211
213
212
func signAll (signature []byte , privateKey PrivateKey , message , ctx []byte , preHash bool ) {
214
213
if len (ctx ) > ContextMaxSize {
215
- panic (fmt .Errorf ("ed448: bad context length: " + strconv . Itoa ( len (ctx ) )))
214
+ panic (fmt .Errorf ("ed448: bad context length: %v" , len (ctx )))
216
215
}
217
216
218
217
H := sha3 .NewShake256 ()
0 commit comments