mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-27 00:19:36 -05:00
8cb155d5c5
* Refactor disk-mapper recovery * Adapt constellation recover command to use new disk-mapper recovery API * Fix Cilium connectivity on rebooting nodes (#89) * Lower CoreDNS reschedule timeout to 10 seconds (#93) Signed-off-by: Daniel Weiße <dw@edgeless.systems>
39 lines
759 B
Go
39 lines
759 B
Go
/*
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
package proto
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/edgelesssys/constellation/internal/crypto/testvector"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestDeriveStateDiskKey(t *testing.T) {
|
|
testCases := map[string]struct {
|
|
masterSecret testvector.HKDF
|
|
}{
|
|
"all zero": {
|
|
masterSecret: testvector.HKDFZero,
|
|
},
|
|
"all 0xff": {
|
|
masterSecret: testvector.HKDF0xFF,
|
|
},
|
|
}
|
|
|
|
for name, tc := range testCases {
|
|
t.Run(name, func(t *testing.T) {
|
|
assert := assert.New(t)
|
|
|
|
stateDiskKey, err := deriveStateDiskKey(tc.masterSecret.Secret, tc.masterSecret.Salt, tc.masterSecret.Info)
|
|
|
|
assert.NoError(err)
|
|
assert.Equal(tc.masterSecret.Output, stateDiskKey)
|
|
})
|
|
}
|
|
}
|