Comments (3)
I checked over every instance of &mut self
and *mut
pointers within mbedtls
crate. Sadly I don't see anything to be done - the operations are either actually mutating the object, or they are not but mbedtls requires a non-const pointer for no particular reason. Eg pk_write_key_xxx
functions are logically const (and I checked and they actually do not modify the key argument), but still take it by non-const pointer. Ditto ecdh_calc_secret
, x509_crt_verify
, ... ISTR seeing a bug in mbedtls issue tracker about this, basically they are worried that adding const
to these declarations will break some application so are waiting for Mbedtls 3.0
We could start assuming these functions are actually const and then avoid having to take &mut self
by instead casting self.inner as *const _ as *mut _
, at the risk of nasty breakage if mbedtls instead changes to actually start mutating one of these arguments that they are accepting by mutable pointer. They seem to care about application compatibility so hopefully they wouldn't do that - but nothing in the docs for any of these functions states that the argument is not modified, so maybe as far as they are concerned all bets are off.
from rust-mbedtls.
We could start assuming these functions are actually const and then avoid having to take &mut self by instead casting self.inner as *const _ as *mut _,
Yes that's what I was thinking
from rust-mbedtls.
Sounds good to me. Some of these will require some digging to figure out if it is actually safe or not (for instance it appears ecdh_calc_secret
may actually modify the context). In Mbed-TLS/mbedtls#1485 (comment) I suggested to upstream that they document the situation better.
from rust-mbedtls.
Related Issues (20)
- Totally fix performance issue related to cflag `-f-no-builtin` HOT 1
- Profile changes on `mbedtls_x509_crt_profile_default` HOT 1
- [mbedtls3] `mbedlts` would breaks the record size limit when sending big record HOT 2
- Add support to pass salt length for RSASSA_PSS
- Avoid tests depending on external services
- Tracking outage of Travis CI HOT 2
- `gcm_context` size mismatch for target `i686-linux-android` HOT 6
- [mbedtls3] TLS 1.3 connection is unstable and sometime break in multi-thread env
- Build failed in ```no_std``` environment.
- Link error with v0.11.0 rust-lld: error: undefined symbol: mbedtls_pk_ec__extern mbedtls_cipher_get_cipher_mode__extern HOT 2
- Unable to build for ESP-IDF target HOT 3
- `mbedtls::x509::certificate::Certificate::verify()` segfaults when passing in an empty certificate chain to verify
- Don't use `alloca()` or variable-sized arrays in `rust_printf.c`
- Certificate from_pem_multiple error HOT 1
- [IMPORTANT] Crate status change
- A security vulnerability has been detected in spin v0.4.* used in v0.9.3 HOT 1
- Features that need to be ported to 2.28.X mbedtls (current master) HOT 1
- Encountered test failures when randomizing tests HOT 1
- Check to set `CMAKE_TRY_COMPILE_TARGET_TYPE` too restrictive HOT 1
- Fix and Setup daily CI for keeping track of nightly compiler changes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-mbedtls.