Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _ertgo
Submodule _ertgo updated 2616 files
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN apt-get install -y --no-install-recommends \

ARG erttag=v0.5.1
ARG egotag=v1.8.1
RUN wget -qO- https://go.dev/dl/go1.25.6.linux-amd64.tar.gz | tar -C /usr/local -xz \
RUN wget -qO- https://go.dev/dl/go1.26.1.linux-amd64.tar.gz | tar -C /usr/local -xz \
&& git clone -b $erttag --depth=1 https://github.com/edgelesssys/edgelessrt \
&& git clone -b $egotag --depth=1 https://github.com/edgelesssys/ego \
&& mkdir ertbuild egobuild
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile.focal
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \

ARG erttag=v0.5.1
ARG egotag=v1.8.1
RUN wget -qO- https://go.dev/dl/go1.25.6.linux-amd64.tar.gz | tar -C /usr/local -xz \
RUN wget -qO- https://go.dev/dl/go1.26.1.linux-amd64.tar.gz | tar -C /usr/local -xz \
&& git clone -b $erttag --depth=1 https://github.com/edgelesssys/edgelessrt \
&& git clone -b $egotag --depth=1 https://github.com/edgelesssys/ego \
&& mkdir ertbuild egobuild
Expand Down
32 changes: 32 additions & 0 deletions ego/cmd/integration-test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
package main

import (
"crypto/rand"
"io"
"log"
"math"
"os"

"github.com/edgelesssys/ego/ego/test"
Expand All @@ -28,6 +30,7 @@ func main() {
testFileSystemMounts(assert, require)
testEnvVars(assert, require)
testCpuid(assert, require)
testRand(assert, require)
}

func testFileSystemMounts(assert *assert.Assertions, require *require.Assertions) {
Expand Down Expand Up @@ -104,3 +107,32 @@ func testEnvVars(assert *assert.Assertions, require *require.Assertions) {
func testCpuid(assert *assert.Assertions, require *require.Assertions) {
assert.True(cpuid.CPU.Has(cpuid.CMOV))
}

func testRand(assert *assert.Assertions, require *require.Assertions) {
// This test
// - does a sanity check of returned randomness
// - implicitly verifies that FIPS entropy initialization succeeds when built with GOFIPS140
buf := make([]byte, 8192)
n, err := rand.Read(buf)
require.NoError(err)
require.Equal(8192, n)
assert.Greater(entropy(buf), 7.9)
}

func entropy(data []byte) float64 {
var freq [256]int
for _, b := range data {
freq[b]++
}

lenData := float64(len(data))
var entropy float64
for _, n := range freq {
if n > 0 {
p := float64(n) / lenData
entropy -= p * math.Log2(p)
}
}

return entropy
}
6 changes: 6 additions & 0 deletions ego/test/t.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ func (t *T) FailNow() {

// Exit exits the program with an appropriate exit code.
func (t *T) Exit() {
// This func is usually run deferred, so repanic on panic
// because otherwise the test would be marked as passed.
if e := recover(); e != nil {
panic(e)
}

var msg string
if t.exitCode == 0 {
msg = "passed"
Expand Down
Loading