Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Fix signature crate build errors on Linux/arm64 #8339

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions signature/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<extern "C" fn(*const i8)>,
log_fn: Option<extern "C" fn(*const c_char)>,
) -> bool {
let logger = SignatureLogger { handler: log_fn };

Expand Down Expand Up @@ -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<extern "C" fn(*const i8)>,
signature: *const c_char,
root_hash: *const c_char,
leaf_subject: *const c_char,
log_fn: Option<extern "C" fn(*const c_char)>,
) -> bool {
let logger = SignatureLogger { handler: log_fn };

Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down
3 changes: 2 additions & 1 deletion signature/src/logger.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::ffi::CString;
use std::os::raw::c_char;

pub struct SignatureLogger {
pub handler: Option<extern "C" fn(*const i8)>,
pub handler: Option<extern "C" fn(*const c_char)>,
}

impl SignatureLogger {
Expand Down
Loading