Bug 282567 - [geli] geli setkey can clear key components, perfectory
Summary: [geli] geli setkey can clear key components, perfectory
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-geom (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-05 16:25 UTC by Norikatsu Shigemura
Modified: 2024-12-05 10:57 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Norikatsu Shigemura freebsd_committer freebsd_triage 2024-11-05 16:25:21 UTC

    
Comment 1 Norikatsu Shigemura freebsd_committer freebsd_triage 2024-11-05 16:46:21 UTC
I tested following case as a bug of "geli setkey":

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# truncate -s 1M testfile
# # mdconfig -f testfile
md0
# geli init -e AES-XTS -l 256 -B none -s 4096 md0
Enter new passphrase:
Reenter new passphrase:
# geli attach md0
Enter passphrase:
# geli setkey -i $((65536*65536-1)) md0
Enter new passphrase:
Reenter new passphrase:
Note, that the master key encrypted with old keys and/or passphrase may still exist in a metadata backup file.
# geli detach md0
# geli attach md0
geli: Missing -p flag.
geli: There was an error with at least one provider.
# geli attach -p md0
geli: No key components given.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I found this issue because I tried reset passphrase key like "geli setkey -k keyfile -P md0".
But I couldn't reset passphrase, so I noticed that the "md_iterations" doesn't reset to -1 (= 2^32-1 = 65536*65536-1).

SEE ALSO: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196834

So there is a bug of "geli setkey -P doesn't reset md_iterations" yet.

To reset iterations, "geli setkey -P" should reset the md_iteratitons, or describe how to reset passphrase by setting iterations and save no key compoents status.