Skip to content

Commit 70b51a5

Browse files
committed
fix: fix various error
1. cfg macro related errors 2. wrong type error
1 parent eb0220a commit 70b51a5

File tree

5 files changed

+11
-3
lines changed

5 files changed

+11
-3
lines changed

mbedtls/src/bignum/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ impl Mpi {
173173
mpi_write_string(
174174
&self.inner,
175175
radix,
176-
buf.as_mut_ptr() as *mut i8,
176+
buf.as_mut_ptr() as *mut _,
177177
buf.len(),
178178
&mut olen,
179179
)

mbedtls/src/pk/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const CUSTOM_PK_INFO: pk_info_t = {
129129
sign_func: None,
130130
verify_func: None,
131131
get_bitlen: None,
132-
name: b"\0" as *const u8 as *const i8,
132+
name: b"\0" as *const u8 as *const _,
133133
ctx_alloc_func: Some(alloc_custom_pk_ctx),
134134
ctx_free_func: Some(free_custom_pk_ctx),
135135
}

mbedtls/src/pkcs12/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ impl BERDecodable for EncryptedData {
356356

357357
// EncryptedContentInfo from PKCS7 see RFC 2315 section 10.1
358358
#[derive(Debug, Clone)]
359+
#[allow(dead_code)]
359360
struct EncryptedContentInfo {
360361
content_type: ObjectIdentifier,
361362
encryption_algo: AlgorithmIdentifier,
@@ -458,6 +459,7 @@ enum Pkcs12BagSet {
458459
}
459460

460461
#[derive(Debug, Clone)]
462+
#[allow(dead_code)]
461463
struct SafeBag {
462464
bag_id: ObjectIdentifier,
463465
bag_value: Pkcs12BagSet,

mbedtls/src/ssl/config.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ use crate::ssl::context::HandshakeContext;
2323
use crate::ssl::ticket::TicketCallback;
2424
use crate::x509::{certificate, Crl, LinkedCertificate, Profile, VerifyError};
2525

26+
#[cfg(not(feature = "std"))]
27+
use crate::alloc_prelude::*;
28+
2629
extern "C" {
2730
fn calloc(n: usize, size: usize) -> *mut c_void;
2831
fn free(ptr: *mut c_void);

mbedtls/tests/alpn.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
extern crate mbedtls;
1111

1212
use std::net::TcpStream;
13-
use std::thread;
1413

1514
use mbedtls::pk::Pk;
1615
use mbedtls::rng::CtrDrbg;
@@ -83,8 +82,10 @@ fn server(mut conn: TcpStream, alpn_list: Option<&[&str]>, expected: Expected<'_
8382
Ok(())
8483
}
8584

85+
#[cfg(unix)]
8686
#[test]
8787
fn alpn() {
88+
use std::thread;
8889
#[derive(Clone)]
8990
struct TestConfig {
9091
client_list: Option<&'static [&'static str]>,
@@ -119,8 +120,10 @@ fn alpn() {
119120
}
120121
}
121122

123+
#[cfg(unix)]
122124
#[test]
123125
fn nothing_in_common() {
126+
use std::thread;
124127
let (c, s) = support::net::create_tcp_pair().unwrap();
125128
let c = thread::spawn(move || client(c, Some(&["a1\0", "a2\0"]), Expected::FailedHandshake(Error::SslFatalAlertMessage)).unwrap());
126129
let s = thread::spawn(move || server(s, Some(&["b1\0", "b2\0"]), Expected::FailedHandshake(Error::SslBadHsClientHello)).unwrap());

0 commit comments

Comments
 (0)