rust/pv: Replace libc wherever possible

Replace all libc references to rust-std references if available.
This eliminates the need to include libc in the pv crate.
However, pv_base still refers to libc::ioctl and libc::ENOTTY.

Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Steffen Eiden
2023-12-07 10:52:32 +01:00
committed by Jan Höppner
parent b71279cda5
commit 02dded11a5
9 changed files with 14 additions and 21 deletions
+1 -4
View File
@@ -7,7 +7,6 @@ use crate::misc::read_crls;
use crate::HkdVerifyErrorType::*;
use crate::{Error, Result};
use curl::easy::{Easy2, Handler, WriteError};
use libc::c_int;
use log::debug;
use openssl::{
asn1::{Asn1Time, Asn1TimeRef},
@@ -26,9 +25,7 @@ use openssl_extensions::{
akid::{AkidCheckResult, AkidExtension},
crl::X509StoreExtension,
};
use std::cmp::Ordering;
use std::time::Duration;
use std::usize;
use std::{cmp::Ordering, ffi::c_int, time::Duration, usize};
/// Minimum security level for the keys/certificates used to establish a chain of
/// trust (see https://www.openssl.org/docs/man1.1.1/man3/X509_VERIFY_PARAM_set_auth_level.html
+3 -2
View File
@@ -8,6 +8,7 @@ use super::{helper, helper::*, *};
use crate::{Error, HkdVerifyErrorType::*};
use core::slice;
use openssl::stack::Stack;
use std::ffi::c_int;
use crate::test_utils::*;
@@ -23,10 +24,10 @@ pub fn mock_endpt(res: &str) -> mockito::Mock {
}
#[track_caller]
fn verify_sign_error(exp_raw: libc::c_int, obs: Error) {
fn verify_sign_error(exp_raw: c_int, obs: Error) {
verify_sign_error_slice(&[exp_raw], obs)
}
fn verify_sign_error_slice(exp_raw: &[libc::c_int], obs: Error) {
fn verify_sign_error_slice(exp_raw: &[c_int], obs: Error) {
if exp_raw
.iter()
.filter(|e| match &obs {