From a43d8ee70f6bbc92f458a7a7ba79a362f3d7b76a Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Mon, 8 Oct 2018 01:13:08 +0200 Subject: [PATCH] Lint: Solve some linter issues Signed-off-by: Knut Ahlers --- generator.go | 12 ++++++------ generator_test.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/generator.go b/generator.go index 3c45ff9..e526e24 100644 --- a/generator.go +++ b/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 { diff --git a/generator_test.go b/generator_test.go index 22fd9a1..33c3a1f 100644 --- a/generator_test.go +++ b/generator_test.go @@ -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) }