Skip to content

Commit

Permalink
Merge pull request #265 from sespiros/keydata-v3-platform
Browse files Browse the repository at this point in the history
[1/3] Keydata v3 platform API changes
  • Loading branch information
chrisccoulson authored Feb 19, 2024
2 parents 3f5e143 + ce88f13 commit 179584a
Show file tree
Hide file tree
Showing 9 changed files with 1,394 additions and 717 deletions.
255 changes: 139 additions & 116 deletions crypt_test.go

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ import (
"github.com/snapcore/secboot/internal/luksview"
)

var (
UnmarshalV1KeyPayload = unmarshalV1KeyPayload
UnmarshalProtectedKeys = unmarshalProtectedKeys
KeyDataGeneration = keyDataGeneration
)

type ProtectedKeys = protectedKeys

func (o *KDFOptions) DeriveCostParams(keyLen int, kdf KDF) (*KDFCostParams, error) {
return o.deriveCostParams(keyLen, kdf)
}
Expand Down Expand Up @@ -119,3 +127,25 @@ func MockStderr(w io.Writer) (restore func()) {
osStderr = orig
}
}

func MockKeyDataGeneration(n int) (restore func()) {
orig := keyDataGeneration
keyDataGeneration = n
return func() {
keyDataGeneration = orig
}
}

func MockHashAlgAvailable() (restore func()) {
orig := hashAlgAvailable
hashAlgAvailable = func(*hashAlg) bool {
return false
}
return func() {
hashAlgAvailable = orig
}
}

func (d *KeyData) DerivePassphraseKeys(passphrase string, kdf KDF) (key, iv, auth []byte, err error) {
return d.derivePassphraseKeys(passphrase, kdf)
}
Loading

0 comments on commit 179584a

Please sign in to comment.