Skip to content
This repository was archived by the owner on Dec 4, 2019. It is now read-only.

Commit 926a972

Browse files
enjNathaniel McCallum
authored andcommitted
Always zero encryption key on Stop
This change moves the zero key on Stop logic into cmdKEK.run. This guarantees via a defer that it is the last thing executed when run exits (and thus the key is always zeroed). Signed-off-by: Monis Khan <mkhan@redhat.com>
1 parent 87ffa8a commit 926a972

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/kek/kek.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ func (c *cmdKEK) Get() ([]byte, error) {
4747
}
4848

4949
func (c *cmdKEK) Stop() {
50-
c.setErrorState(errEmptyKey)
5150
close(c.stop)
5251
}
5352

@@ -81,6 +80,7 @@ func (c *cmdKEK) run() {
8180
const factor = 5 // TODO move constant, maybe make configurable?
8281
ticker := time.NewTicker(c.duration / factor)
8382
defer ticker.Stop()
83+
defer c.setErrorState(errEmptyKey)
8484

8585
current := 0
8686

0 commit comments

Comments
 (0)