From cd3c1a9fcd02e30a767978b6eced5a57af0ea38a Mon Sep 17 00:00:00 2001 From: beerpiss Date: Thu, 27 Jun 2024 02:17:18 +0700 Subject: [PATCH] add a special case for when I screw up signing a release --- src/updater/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/updater/mod.rs b/src/updater/mod.rs index d2269ef..659eca1 100644 --- a/src/updater/mod.rs +++ b/src/updater/mod.rs @@ -18,8 +18,7 @@ use winapi::{ minwindef::{BOOL, DWORD, HMODULE, LPVOID, PROC}, ntdef::{LPCWSTR, LPSTR}, winerror::{ - CERT_E_CHAINING, CERT_E_EXPIRED, CERT_E_UNTRUSTEDROOT, CRYPT_E_SECURITY_SETTINGS, - TRUST_E_EXPLICIT_DISTRUST, TRUST_E_NOSIGNATURE, + CERT_E_CHAINING, CERT_E_EXPIRED, CERT_E_UNTRUSTEDROOT, CRYPT_E_SECURITY_SETTINGS, TRUST_E_BAD_DIGEST, TRUST_E_EXPLICIT_DISTRUST, TRUST_E_NOSIGNATURE }, }, um::{ @@ -148,6 +147,9 @@ pub enum VerifySignatureError { #[snafu(display("No signatures found."))] NoSignature, + #[snafu(display("The signature failed to verify."))] + SignatureBadDigest, + #[snafu(display("The signature was explicitly distrusted."))] ExplicitlyDistrusted, @@ -469,6 +471,7 @@ fn verify_signature(file: &str) -> Result<(), VerifySignatureError> { CRYPT_E_SECURITY_SETTINGS => Err(VerifySignatureError::VerificationDisabledByPolicy), TRUST_E_NOSIGNATURE => Err(VerifySignatureError::NoSignature), TRUST_E_EXPLICIT_DISTRUST => Err(VerifySignatureError::ExplicitlyDistrusted), + TRUST_E_BAD_DIGEST => Err(VerifySignatureError::SignatureBadDigest), _ => Err(VerifySignatureError::Unknown { errno: status }), } }