diff --git a/fips.go b/fips.go index a35afd0..852d0c0 100644 --- a/fips.go +++ b/fips.go @@ -1,22 +1,24 @@ -/* -see http://www.openssl.org/docs/fips/UserGuide-2.0.pdf -to set up an environment where fips mode can be enabled -*/ +// see http://www.openssl.org/docs/fips/UserGuide-2.0.pdf +// to set up an environment where fips mode can be enabled + package fips -import ( - "errors" -) +import "errors" +// ErrFipsDisabled is returned when this package is built without fips build tag var ErrFipsDisabled = errors.New("not built with fips tags") +// ONOFF is either on or off +type ONOFF int + const ( + // OFF is off OFF ONOFF = iota + // ON is on ON ) -type ONOFF int - +// String is for the Stringer infterface func (oo ONOFF) String() string { if oo == ON { return "ON" diff --git a/fips_off.go b/fips_off.go index 2500a44..01aa9e8 100644 --- a/fips_off.go +++ b/fips_off.go @@ -2,14 +2,17 @@ package fips +// Mode checks whether is FIPS mode is on func Mode() (ONOFF, error) { return OFF, ErrFipsDisabled } +// ModeSet attempts to turn on FIPS for the context of this executable func ModeSet(mode ONOFF) (ONOFF, error) { return OFF, ErrFipsDisabled } +// LastError is empty when fips is not built func LastError() string { return "" } diff --git a/fips_on.go b/fips_on.go index 2ee05c8..3f7c1a1 100644 --- a/fips_on.go +++ b/fips_on.go @@ -11,7 +11,7 @@ package fips import "C" import "errors" -// Check whether is FIPS mode is on +// Mode checks whether is FIPS mode is on func Mode() (ONOFF, error) { return ONOFF(C.FIPS_mode()), nil }