From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup-qemu 2/2] fingerprint: rename variables
Date: Tue, 24 Nov 2020 14:05:20 +0100 [thread overview]
Message-ID: <20201124130520.1058725-4-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20201124130520.1058725-1-f.gruenbichler@proxmox.com>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
src/commands.rs | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/commands.rs b/src/commands.rs
index dcee5a1..cd81dae 100644
--- a/src/commands.rs
+++ b/src/commands.rs
@@ -23,7 +23,7 @@ lazy_static!{
Mutex::new(HashMap::new())
};
- static ref PREVIOUS_CRYPT_CONFIG_DIGEST: Mutex<Option<[u8;32]>> = {
+ static ref PREVIOUS_KEY_FINGERPRINT: Mutex<Option<[u8;32]>> = {
Mutex::new(None)
};
}
@@ -40,16 +40,16 @@ pub struct ImageUploadInfo {
pub(crate) fn serialize_state() -> Vec<u8> {
let prev_csums = &*PREVIOUS_CSUMS.lock().unwrap();
- let prev_crypt_digest = &*PREVIOUS_CRYPT_CONFIG_DIGEST.lock().unwrap();
- bincode::serialize(&(prev_csums, prev_crypt_digest)).unwrap()
+ let prev_key_fingerprint = &*PREVIOUS_KEY_FINGERPRINT.lock().unwrap();
+ bincode::serialize(&(prev_csums, prev_key_fingerprint)).unwrap()
}
pub(crate) fn deserialize_state(data: &[u8]) -> Result<(), Error> {
- let (prev_csums, prev_crypt_digest) = bincode::deserialize(data)?;
+ let (prev_csums, prev_key_fingerprint) = bincode::deserialize(data)?;
let mut prev_csums_guard = PREVIOUS_CSUMS.lock().unwrap();
- let mut prev_crypt_digest_guard = PREVIOUS_CRYPT_CONFIG_DIGEST.lock().unwrap();
+ let mut prev_key_fingerprint_guard = PREVIOUS_KEY_FINGERPRINT.lock().unwrap();
*prev_csums_guard = prev_csums;
- *prev_crypt_digest_guard = prev_crypt_digest;
+ *prev_key_fingerprint_guard = prev_key_fingerprint;
Ok(())
}
@@ -151,11 +151,11 @@ pub(crate) fn check_last_encryption_mode(
pub(crate) fn check_last_encryption_key(
config: Option<Arc<CryptConfig>>,
) -> bool {
- let digest_guard = PREVIOUS_CRYPT_CONFIG_DIGEST.lock().unwrap();
- match (*digest_guard, config) {
- (Some(last_digest), Some(current_config)) => {
- current_config.fingerprint().bytes() == &last_digest
- || crypt_config_digest(current_config) == last_digest
+ let fingerprint_guard = PREVIOUS_KEY_FINGERPRINT.lock().unwrap();
+ match (*fingerprint_guard, config) {
+ (Some(last_fingerprint), Some(current_config)) => {
+ current_config.fingerprint().bytes() == &last_fingerprint
+ || crypt_config_digest(current_config) == last_fingerprint
},
(None, None) => true,
_ => false,
@@ -442,7 +442,7 @@ pub(crate) async fn finish_backup(
};
{
- let crypt_config_digest = match crypt_config {
+ let key_fingerprint = match crypt_config {
Some(current_config) => {
let fp = current_config
.fingerprint()
@@ -453,8 +453,8 @@ pub(crate) async fn finish_backup(
None => None,
};
- let mut crypt_config_digest_guard = PREVIOUS_CRYPT_CONFIG_DIGEST.lock().unwrap();
- *crypt_config_digest_guard = crypt_config_digest;
+ let mut key_fingerprint_guard = PREVIOUS_KEY_FINGERPRINT.lock().unwrap();
+ *key_fingerprint_guard = key_fingerprint;
}
client
--
2.20.1
prev parent reply other threads:[~2020-11-24 13:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-24 13:05 [pbs-devel] [PATCH proxmox-backup(-qemu) 0/3] switch to fingerprint for tracking key Fabian Grünbichler
2020-11-24 13:05 ` [pbs-devel] [PATCH proxmox-backup-qemu 1/2] encryption key tracking: use fingerprint Fabian Grünbichler
2020-11-24 15:36 ` Dietmar Maurer
2020-11-24 15:44 ` Fabian Grünbichler
2020-11-25 7:28 ` [pbs-devel] applied: " Dietmar Maurer
2020-11-24 13:05 ` [pbs-devel] [PATCH proxmox-backup] fingerprint: add bytes() accessor Fabian Grünbichler
2020-11-25 7:27 ` [pbs-devel] applied: " Dietmar Maurer
2020-11-24 13:05 ` Fabian Grünbichler [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201124130520.1058725-4-f.gruenbichler@proxmox.com \
--to=f.gruenbichler@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.