mirror of
https://github.com/vbatts/go-fips.git
synced 2025-07-01 08:08:33 +00:00
.: golint
This commit is contained in:
parent
237f89abc8
commit
8fae0bf8e0
3 changed files with 15 additions and 10 deletions
20
fips.go
20
fips.go
|
@ -1,22 +1,24 @@
|
||||||
/*
|
// see http://www.openssl.org/docs/fips/UserGuide-2.0.pdf
|
||||||
see http://www.openssl.org/docs/fips/UserGuide-2.0.pdf
|
// to set up an environment where fips mode can be enabled
|
||||||
to set up an environment where fips mode can be enabled
|
|
||||||
*/
|
|
||||||
package fips
|
package fips
|
||||||
|
|
||||||
import (
|
import "errors"
|
||||||
"errors"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
// ErrFipsDisabled is returned when this package is built without fips build tag
|
||||||
var ErrFipsDisabled = errors.New("not built with fips tags")
|
var ErrFipsDisabled = errors.New("not built with fips tags")
|
||||||
|
|
||||||
|
// ONOFF is either on or off
|
||||||
|
type ONOFF int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// OFF is off
|
||||||
OFF ONOFF = iota
|
OFF ONOFF = iota
|
||||||
|
// ON is on
|
||||||
ON
|
ON
|
||||||
)
|
)
|
||||||
|
|
||||||
type ONOFF int
|
// String is for the Stringer infterface
|
||||||
|
|
||||||
func (oo ONOFF) String() string {
|
func (oo ONOFF) String() string {
|
||||||
if oo == ON {
|
if oo == ON {
|
||||||
return "ON"
|
return "ON"
|
||||||
|
|
|
@ -2,14 +2,17 @@
|
||||||
|
|
||||||
package fips
|
package fips
|
||||||
|
|
||||||
|
// Mode checks whether is FIPS mode is on
|
||||||
func Mode() (ONOFF, error) {
|
func Mode() (ONOFF, error) {
|
||||||
return OFF, ErrFipsDisabled
|
return OFF, ErrFipsDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ModeSet attempts to turn on FIPS for the context of this executable
|
||||||
func ModeSet(mode ONOFF) (ONOFF, error) {
|
func ModeSet(mode ONOFF) (ONOFF, error) {
|
||||||
return OFF, ErrFipsDisabled
|
return OFF, ErrFipsDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LastError is empty when fips is not built
|
||||||
func LastError() string {
|
func LastError() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ package fips
|
||||||
import "C"
|
import "C"
|
||||||
import "errors"
|
import "errors"
|
||||||
|
|
||||||
// Check whether is FIPS mode is on
|
// Mode checks whether is FIPS mode is on
|
||||||
func Mode() (ONOFF, error) {
|
func Mode() (ONOFF, error) {
|
||||||
return ONOFF(C.FIPS_mode()), nil
|
return ONOFF(C.FIPS_mode()), nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue