Skip to content

Commit

Permalink
fix: make MacOS builds work again after b86db81
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTMjugador committed Dec 18, 2024
1 parent 30c892c commit 873c0f4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/packsquash/src/squash_zip/system_id/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ pub(super) fn get_platform_serial_number() -> Option<SystemId> {
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;
Expand Down Expand Up @@ -342,9 +346,13 @@ pub(super) fn get_platform_serial_number() -> Option<SystemId> {
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; <Sha224 as OutputSizeUser>::OutputSize::USIZE]>::from(Sha224::digest(
serial_number_string
)),
false
);

release_objects();

Expand Down

0 comments on commit 873c0f4

Please sign in to comment.