1
0
Fork 0
mirror of https://github.com/vbatts/go-fips.git synced 2024-12-04 22:35:39 +00:00

tests and a README

Signed-off-by: Vincent Batts <vbatts@thisco.de>
This commit is contained in:
Vincent Batts 2014-10-02 23:13:51 -04:00
parent 5e72cd7b41
commit de1edc544e
3 changed files with 44 additions and 7 deletions

26
README.md Normal file
View file

@ -0,0 +1,26 @@
## go-fips
Proof-Of-Concept for using golang and building a FIPS enabled application.
## Setup
See http://www.openssl.org/docs/fips/UserGuide-2.0.pdf
to set up an environment where fips mode can be enabled
## Building
go build .
or
go build -tags fips .
## Testing
go test .
or
go test -tags fips .

View file

@ -1,10 +1,21 @@
package fips package fips
import ( import "testing"
"fmt"
"testing"
)
func TestTest(t *testing.T) { func TestTest(t *testing.T) {
fmt.Println(ModeSet(ON)) expected := ON
o, err := ModeSet(expected)
if err != nil {
if err == ErrFipsDisabled {
// ModeSet will not turn it on if fips is not linked in
expected = OFF
} else {
// the error is something else
t.Fatal(err)
}
}
if o != expected {
t.Errorf("expected %q, got %q", expected, o)
}
} }