Skip to content

Replace crate core_io with core2 to support more rust toolchain versions #210

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

Closed
wants to merge 1 commit into from

Conversation

gaojiaqi7
Copy link
Contributor

core_io has not been updated for a long time, the latest rust version it supports is 2021-03-25.
To support more rust toolchain versions, we can use core2 instead which does not depend on specific nightly versions.

Signed-off-by: Jiaqi Gao jiaqi.gao@intel.com

`core_io` has not been updated for a long time. The latest rust version
it supports is 2021-03-25. We can use `core2` instead which does not
depend on the rust toolchain versions.

Signed-off-by: Jiaqi Gao <jiaqi.gao@intel.com>
@jyao1
Copy link

jyao1 commented Oct 27, 2022

Hello, is there any feedback for this one?

@MihirLuthra
Copy link
Member

First of all - apologies for the late response on this PR.

I gave a look to core2 and I don't think we would prefer switching to it. As per its README, core2 doesn't depend on any specific version because it copies its code from Rust 1.47.0. I don't think silently using code from an older version along with a new toolchain would be a good practice. core_io ensures that the code taken from the rust lib corresponds to the toolchain being used. It seems preferable to maintain core_io instead of switching to core2.

Alternatively, PR #211 proposes to remove core_io completely. My only concern there is that core_io is more intuitive to use than the replacements made in the PR.

cc: @zugzwang @raoulstrackx @jethrogb

@gaojiaqi7
Copy link
Contributor Author

Thanks @MihirLuthra , I agree with you that using code from an older version along with a new toolchain is not a good choice, but it may take a lot effort to maintain core_io to make it work with the latest rust toolchain all the time.
I prefer PR #211 because it is more suitable for no_ std case and simple.

@MihirLuthra
Copy link
Member

@gaojiaqi7 we have discussed this internally and we were good with the solution proposed in #211. But the review is pending there. We will try to complete it soon. (hopefully in the coming week)

@gaojiaqi7
Copy link
Contributor Author

@MihirLuthra that's great! thank you :)

@MihirLuthra
Copy link
Member

Closing this in favour of #211.

bors bot added a commit that referenced this pull request Feb 21, 2023
211: Remove core_io dependency and add alternative interface for no_std environments r=zugzwang a=DrTobe

As already stated in #210, `core_io` "has not been updated for a long time, the latest rust version it supports is 2021-03-25." Since `no_std` usage of `rust-mbedtls` currently depends on `core_io`, this is a major barrier when adopting `rust-mbedtls` in `no_std` environments.

As opposed to #210, I propose to remove any `std::io` replacement altogether because we need a different interface (non `io::Write`, non `io::Read`) for DTLS anyways. So this interface can be used for TLS in `no_std` environments, too, which removes the necessity to have a `std::io` replacement at all. If you think the benefits are worth the effort, a `std::io` replacement could be added optionally with a feature. I have not had a detailed look at `core2` but I found working with `core_io` very limiting, so maybe `core2` could be a better option.

When working on these changes, I have also fixed some other minor issues with `no_std` usage. Specifically, this should also fix #208 (making #209 obsolete) while bringing `rust-mbedtls` to 32 bit targets (specifically the ARM `thumb...` targets commonly found on MCUs).

With the changes presented in this PR, I was finally able to successfully use `rust-mbedtls` on an STM32L452CCUx MCU.

Co-authored-by: Tobias Naumann <tobias.naumann@iml.fraunhofer.de>
bors bot added a commit that referenced this pull request Mar 7, 2023
211: Remove core_io dependency and add alternative interface for no_std environments r=zugzwang a=DrTobe

As already stated in #210, `core_io` "has not been updated for a long time, the latest rust version it supports is 2021-03-25." Since `no_std` usage of `rust-mbedtls` currently depends on `core_io`, this is a major barrier when adopting `rust-mbedtls` in `no_std` environments.

As opposed to #210, I propose to remove any `std::io` replacement altogether because we need a different interface (non `io::Write`, non `io::Read`) for DTLS anyways. So this interface can be used for TLS in `no_std` environments, too, which removes the necessity to have a `std::io` replacement at all. If you think the benefits are worth the effort, a `std::io` replacement could be added optionally with a feature. I have not had a detailed look at `core2` but I found working with `core_io` very limiting, so maybe `core2` could be a better option.

When working on these changes, I have also fixed some other minor issues with `no_std` usage. Specifically, this should also fix #208 (making #209 obsolete) while bringing `rust-mbedtls` to 32 bit targets (specifically the ARM `thumb...` targets commonly found on MCUs).

With the changes presented in this PR, I was finally able to successfully use `rust-mbedtls` on an STM32L452CCUx MCU.

Co-authored-by: Tobias Naumann <tobias.naumann@iml.fraunhofer.de>
Co-authored-by: Tobbe <tobias.naumann@iml.fraunhofer.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants