1
0
Fork 0
mirror of https://github.com/Luzifer/go-dhparam.git synced 2024-11-10 00:00:06 +00:00

Lint: Solve some linter issues

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-10-08 01:13:08 +02:00
parent 4668979017
commit a43d8ee70f
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
2 changed files with 7 additions and 7 deletions

View file

@ -13,11 +13,11 @@ const pemHeader = "DH PARAMETERS"
type GeneratorResult uint type GeneratorResult uint
const ( const (
// A possible (non-verified) prime number was found (OpenSSL: ".") // GeneratorFoundPossiblePrime signals a possible (non-verified) prime number was found (OpenSSL: ".")
GeneratorFoundPossiblePrime GeneratorResult = iota 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 GeneratorFirstConfirmation
// The prime number now is considered "safe" (OpenSSL: "*") // GeneratorSafePrimeFound signals the prime number now is considered "safe" (OpenSSL: "*")
GeneratorSafePrimeFound GeneratorSafePrimeFound
) )
@ -26,8 +26,8 @@ type GeneratorCallback func(r GeneratorResult)
func nullCallback(r GeneratorResult) {} func nullCallback(r GeneratorResult) {}
// GenerateDHParam determines a prime number according to the generator having the specified number of bits // Generate determines a prime number according to the generator having the specified number of bits
func GenerateDHParam(bits, generator int, cb GeneratorCallback) (*DH, error) { func Generate(bits, generator int, cb GeneratorCallback) (*DH, error) {
var ( var (
err error err error
padd, rem int64 padd, rem int64
@ -130,7 +130,7 @@ func genRand(bits int) (*big.Int, error) {
buf := make([]byte, bytes) buf := make([]byte, bytes)
if _, err := rand.Read(buf); err != nil { 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 { if bit == 0 {

View file

@ -9,7 +9,7 @@ import (
) )
func execGeneratorIntegration(t *testing.T, bitsize, generator int) { func execGeneratorIntegration(t *testing.T, bitsize, generator int) {
dh, err := GenerateDHParam(bitsize, generator, nil) dh, err := Generate(bitsize, generator, nil)
if err != nil { if err != nil {
t.Fatalf("Unable to generate DH params: %s", err) t.Fatalf("Unable to generate DH params: %s", err)
} }