From 873c0f48afe84445eb909a45bdeac7f9e46e1960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Gonz=C3=A1lez?= Date: Thu, 19 Dec 2024 00:39:14 +0100 Subject: [PATCH] fix: make MacOS builds work again after b86db81f162013d7e857cf383daf55fd5cbe21ed --- packages/packsquash/src/squash_zip/system_id/os.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/packsquash/src/squash_zip/system_id/os.rs b/packages/packsquash/src/squash_zip/system_id/os.rs index 575982817..a83d37463 100644 --- a/packages/packsquash/src/squash_zip/system_id/os.rs +++ b/packages/packsquash/src/squash_zip/system_id/os.rs @@ -277,6 +277,10 @@ pub(super) fn get_platform_serial_number() -> Option { string::{CFString, CFStringRef} }; use mach2::kern_return::kern_return_t; + use sha2::{ + Digest, Sha224, + digest::{OutputSizeUser, typenum::Unsigned} + }; use std::{ffi::CString, os::raw::c_char}; type io_object_t = mach_port_t; @@ -342,9 +346,13 @@ pub(super) fn get_platform_serial_number() -> Option { let serial_number_string = unsafe { CFString::wrap_under_create_rule(serial_number_cf_string_ref as CFStringRef) } .to_string(); - let mut serial_number_bytes = serial_number_string.as_bytes(); - let result = SystemId::new(serial_number_bytes, false); + let result = SystemId::new( + <[u8; ::OutputSize::USIZE]>::from(Sha224::digest( + serial_number_string + )), + false + ); release_objects();