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

Add support for MSRV #340

Closed
wants to merge 2 commits into from
Closed
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
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,24 @@ jobs:
cargo fmt --check -p mbedtls
cargo fmt --check -p mbedtls-platform-support
cargo fmt --check -p mbedtls-sys-auto
msrv:
name: MSRV
runs-on: ubuntu-20.04
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false

- uses: dtolnay/rust-toolchain@master
with:
toolchain: "nightly-2021-09-08"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little strange to have the MSRV be a nightly build IMO.


- run: |
cargo check --locked --features ssl,rdrand,async-rt
cargo check --locked --no-default-features --features ssl,no_std_deps,rdrand,time
working-directory: mbedtls

ci-success:
name: ci
if: always()
Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions mbedtls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ mbedtls-sys-auto = { path = "../mbedtls-sys", version = "2.25.0", default-featur
] }

mbedtls-platform-support = { version = "0.1", path = "../mbedtls-platform-support" }
rustversion = "1.0.14"

[target.x86_64-fortanix-unknown-sgx.dependencies]
rs-libc = "0.2.0"
Expand Down
11 changes: 8 additions & 3 deletions mbedtls/src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
* option. This file may not be copied, modified, or distributed except
* according to those terms. */

use core::ffi::{c_char, CStr};
#[rustversion::since(1.64)]
use core::ffi::c_char;
#[rustversion::before(1.64)]
use mbedtls_sys::types::raw_types::c_char;

use core::fmt;
use core::mem::ManuallyDrop;
use core::ops::{Deref, DerefMut};
Expand Down Expand Up @@ -98,11 +102,12 @@ impl Drop for CString {
}
}

#[rustversion::since(1.64)]
impl Deref for CString {
type Target = CStr;
type Target = core::ffi::CStr;

fn deref(&self) -> &Self::Target {
unsafe { CStr::from_ptr(self.inner.as_ptr() as *const c_char) }
unsafe { core::ffi::CStr::from_ptr(self.inner.as_ptr() as *const c_char) }
}
}

Expand Down
1 change: 1 addition & 0 deletions mbedtls/src/rng/ctr_drbg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crate::alloc_prelude::*;
use crate::error::{IntoResult, Result};
use crate::rng::{EntropyCallback, EntropyCallbackMut, RngCallback, RngCallbackMut};

#[allow(dead_code)]
enum EntropyHolder {
Shared(Arc<dyn EntropyCallback + 'static>),
Unique(Box<dyn EntropyCallbackMut + 'static>),
Expand Down
Loading