Key derivation without salt #529
Labels
No labels
P0
P1
P2
P3
good first issue
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-s3-gw#529
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This has a small potential to turn out to be a security issue, but most likely it's benign.
func deriveKey(secret []byte) ([]byte, error) {
hash := sha256.New
kdf := hkdf.New(hash, secret, nil, nil)
key := make([]byte, 32)
_, err := io.ReadFull(kdf, key)
return key, err
}
Currently we derive a 32-byte encryption key from a 32-byte ECDH shared secret without adding any salt or app info. This means that we map every ECDH SK to a single encryption key, 1-to-1, which negates most of the benefits that would be provided by using KDF. KDF still scrambles the input in a pseudo-random way, so it's not entirely useless here.
Adding salt would require us to store it somewhere inside AccessBox and thus would be a breaking change. I do not see any exploitation path here, so it's likely OK to be left as it is.
Bringing it up for discussion, hope others will chime in with their expertise.