mirror of
https://github.com/Luzifer/go-dhparam.git
synced 2024-11-08 15:20:03 +00:00
Lint: Solve some linter issues
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
4668979017
commit
a43d8ee70f
2 changed files with 7 additions and 7 deletions
12
generator.go
12
generator.go
|
@ -13,11 +13,11 @@ const pemHeader = "DH PARAMETERS"
|
|||
type GeneratorResult uint
|
||||
|
||||
const (
|
||||
// A possible (non-verified) prime number was found (OpenSSL: ".")
|
||||
// GeneratorFoundPossiblePrime signals a possible (non-verified) prime number was found (OpenSSL: ".")
|
||||
GeneratorFoundPossiblePrime GeneratorResult = iota
|
||||
// The prime number itself was verified but is not yet considered "safe" (OpenSSL: "+")
|
||||
// GeneratorFirstConfirmation signals the prime number itself was verified but is not yet considered "safe" (OpenSSL: "+")
|
||||
GeneratorFirstConfirmation
|
||||
// The prime number now is considered "safe" (OpenSSL: "*")
|
||||
// GeneratorSafePrimeFound signals the prime number now is considered "safe" (OpenSSL: "*")
|
||||
GeneratorSafePrimeFound
|
||||
)
|
||||
|
||||
|
@ -26,8 +26,8 @@ type GeneratorCallback func(r GeneratorResult)
|
|||
|
||||
func nullCallback(r GeneratorResult) {}
|
||||
|
||||
// GenerateDHParam determines a prime number according to the generator having the specified number of bits
|
||||
func GenerateDHParam(bits, generator int, cb GeneratorCallback) (*DH, error) {
|
||||
// Generate determines a prime number according to the generator having the specified number of bits
|
||||
func Generate(bits, generator int, cb GeneratorCallback) (*DH, error) {
|
||||
var (
|
||||
err error
|
||||
padd, rem int64
|
||||
|
@ -130,7 +130,7 @@ func genRand(bits int) (*big.Int, error) {
|
|||
|
||||
buf := make([]byte, bytes)
|
||||
if _, err := rand.Read(buf); err != nil {
|
||||
errors.Wrap(err, "Unable to read random")
|
||||
return nil, errors.Wrap(err, "Unable to read random")
|
||||
}
|
||||
|
||||
if bit == 0 {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
)
|
||||
|
||||
func execGeneratorIntegration(t *testing.T, bitsize, generator int) {
|
||||
dh, err := GenerateDHParam(bitsize, generator, nil)
|
||||
dh, err := Generate(bitsize, generator, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("Unable to generate DH params: %s", err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue