From 645be207c73855cbdb44fddd64d5fb92767b9a1d Mon Sep 17 00:00:00 2001 From: Naomi Kirby Date: Thu, 19 Oct 2023 11:06:27 -0700 Subject: [PATCH] Fix signature crate build errors on Linux/arm64 --- signature/src/lib.rs | 15 ++++++++------- signature/src/logger.rs | 3 ++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/signature/src/lib.rs b/signature/src/lib.rs index ddd31cd4b2..71e2167d9b 100644 --- a/signature/src/lib.rs +++ b/signature/src/lib.rs @@ -7,6 +7,7 @@ use crate::logger::*; use ring::signature; use std::ffi::CStr; use std::os::raw::c_uchar; +use std::os::raw::c_char; use x509_parser::prelude::*; pub mod balrog; @@ -31,7 +32,7 @@ pub extern "C" fn verify_rsa( message_length: usize, message_signature_ptr: *const c_uchar, message_signature_length: usize, - log_fn: Option, + log_fn: Option, ) -> bool { let logger = SignatureLogger { handler: log_fn }; @@ -70,10 +71,10 @@ pub extern "C" fn verify_content_signature( x5u_length: usize, input_ptr: *const c_uchar, input_length: usize, - signature: *const i8, - root_hash: *const i8, - leaf_subject: *const i8, - log_fn: Option, + signature: *const c_char, + root_hash: *const c_char, + leaf_subject: *const c_char, + log_fn: Option, ) -> bool { let logger = SignatureLogger { handler: log_fn }; @@ -197,7 +198,7 @@ mod test { #[test] #[should_panic] fn test_rsa_ffi_logger() { - extern "C" fn logfn(msg: *const i8) { + extern "C" fn logfn(msg: *const c_char) { match unsafe { CStr::from_ptr(msg) }.to_str() { Err(_e) => {} Ok(x) => panic!("{}", x), @@ -270,7 +271,7 @@ mod test { let prod_root_hash_cstr = CString::new(PROD_ROOT_HASH).unwrap().into_raw(); let invalid_hostname_cstr = CString::new("example.com").unwrap().into_raw(); - extern "C" fn logfn(msg: *const i8) { + extern "C" fn logfn(msg: *const c_char) { match unsafe { CStr::from_ptr(msg) }.to_str() { Err(_e) => {} Ok(x) => panic!("{}", x), diff --git a/signature/src/logger.rs b/signature/src/logger.rs index 202a11a4f2..d140daba32 100644 --- a/signature/src/logger.rs +++ b/signature/src/logger.rs @@ -1,7 +1,8 @@ use std::ffi::CString; +use std::os::raw::c_char; pub struct SignatureLogger { - pub handler: Option, + pub handler: Option, } impl SignatureLogger {