Thomas Mühlbacher
22495e0d31
feat: rewrite key.rs
...
- Introduce `KeyHandle` and `Passphrase` types
- Refactor the functions into associated functions
- Add `zeroizing` crate to handle passphrase memory safely
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-30 22:26:06 +02:00
Thomas Mühlbacher
21b1111b59
refactor: reduce UnlockPolicy
boilerplate
...
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-30 22:26:06 +02:00
Kent Overstreet
aa985e6a44
Format with rustfmt
...
Note that we're using struct/enum align options, which require nightly.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-05-26 20:38:08 -04:00
Thomas Mühlbacher
5b216318b8
check_for_key
before ask_for_passphrase
...
let's always first check if there is already a key in the keyring
available before we try to get the key from some more involved means.
Fixes : #261
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-05-26 13:32:56 -04:00
Thomas Mühlbacher
3882d1b1e4
refactor: manually fix remaining clippy lints
...
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-22 22:33:40 +02:00
Thomas Mühlbacher
3488d4f15f
refactor: cargo clippy --fix
...
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-22 22:33:40 +02:00
Roland Vet
817e957697
Apply naming convention: passphrase->unlock->key->decrypt->fs
...
Signed-off-by: Roland Vet <RlndVt@protonmail.com>
2024-02-23 08:37:23 +01:00
Roland Vet
b582c9b4b8
Improve error message
...
Signed-off-by: Roland Vet <RlndVt@protonmail.com>
2024-02-22 21:12:49 +01:00
Roland Vet
eaf5575080
Rename sb to block_device
...
Signed-off-by: Roland Vet <RlndVt@protonmail.com>
2024-02-22 21:12:49 +01:00
Roland Vet
ceb9eaa020
Rename password{,_policy}
...
Signed-off-by: Roland Vet <RlndVt@protonmail.com>
2024-02-22 21:12:49 +01:00
Roland Vet
37c0ae2e79
Rename KeyLocation to more appropriate KeyPolicy
...
Also key_location to key_policy
Improve help description key policy
Signed-off-by: Roland Vet <RlndVt@protonmail.com>
2024-02-22 21:12:49 +01:00
Roland Vet
ceb259b2a3
Typo
...
Signed-off-by: Roland Vet <RlndVt@protonmail.com>
2024-02-22 21:12:49 +01:00
Roland Vet
911c53266a
Remove unnecessary brackets
...
Signed-off-by: Roland Vet <RlndVt@protonmail.com>
2024-02-22 21:12:49 +01:00
Roland Vet
d67643f24c
Add decryption by key_file
...
- Add key_file option to Cli
- Rework decryption flow logic to first attempt key_file
- Read password from file and pass to decrypt_master_key
Explicity specify '-k' for key_location
Signed-off-by: Roland Vet <RlndVt@protonmail.com>
2024-02-22 21:12:49 +01:00
Roland Vet
0ff96b2a0f
Add fmt::Display for KeyLocation
...
Signed-off-by: Roland Vet <RlndVt@protonmail.com>
2024-02-22 21:12:36 +01:00
Roland Vet
86049a1641
Refactor ask_for_key to call new decrypt_master_key
...
Signed-off-by: Roland Vet <RlndVt@protonmail.com>
2024-02-22 21:12:02 +01:00
Alexander Fougner
a95a25dc1d
Replace atty with stdlib
...
is_terminal() is part of rust 1.70 std, no need for isatty
Signed-off-by: Alexander Fougner <fougner89@gmail.com>
2024-02-07 21:27:35 +01:00
Faidon Liambotis
06ff8b55b7
rust: bump rpassword to v7.x
...
Including a tiny API change.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-16 16:30:10 -05:00
Thomas Bertschinger
f5baaf48e3
move Rust sources to top level, C sources into c_src
...
This moves the Rust sources out of rust_src/ and into the top level.
Running the bcachefs executable out of the development tree is now:
$ ./target/release/bcachefs command
or
$ cargo run --profile release -- command
instead of "./bcachefs command".
Building and installing is still:
$ make && make install
Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-16 01:47:05 -05:00