Comments (6)
@osobiehl These functions are completely unused and just for compile-time checks. If you just want the code to compile, remove these functions and try again.
from rust-mbedtls.
Hi @DrTobe , I guess this error is related to : 612e36c . Did you remember why you made this change?
It seems that that commit hard coded the size of many C types (which may change in different platform) when computing the size of contexts.
And more importantly, the size of these contexts actually are not able to be hard coded since the type definitions in C side can change with different config.
from rust-mbedtls.
The reasoning for these semi-hardcoded sizes is explained in the comment above:
// If the C API changes, the serde implementation needs to be reviewed for correctness. The
// following (unused) functions will most probably fail to compile when this happens so a
// compilation failure here reminds us of reviewing the serde impl.
Actually, I have tried to make this a little bit more platform-independent. Before, the sizes were fully-hardcoded with a 64-bit platform in mind. I changed these sizes to be dynamic in commit 5027a7c but that defeats the purpose of these checks. So I tried to calculate these sizes in a platform-independent way. Apparently, this does not work for some platforms.
Actually, it is unnecessarily painful to calculate C type sizes by hand for different platforms. Should we try to find a completely different approach here which avoids manual size calculations? Maybe, we could copy+translate the expected C types to Rust with a #[repr(C)]
attribute. Then, we could just compare the sizes of the copied Rust types and the actual C types. Whenever the C types change, these should be different.
from rust-mbedtls.
@DrTobe I see what you mean here.
And regarding the different approach you mentioned, I think it can be achieved by having a copy if the bindgen
rust code here, so we could use it for checking if C API is changed
from rust-mbedtls.
That sounds smart but there is still the problem you mentioned above:
And more importantly, the size of these contexts actually are not able to be hard coded since the type definitions in C side can change with different config.
How can we handle the config changes then?
from rust-mbedtls.
I think my words about config changes was wrong.
Because with a specific version of mbedtls-sys
, there is no feature about changing the config that will results the change on definition of those contexts.
So that's not a problem, and if a different version of mbedtls-sys
is using with different definition of contexts, then it fails in the case why we need these checks here.
from rust-mbedtls.
Related Issues (20)
- 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
- [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 2
- 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
- Update depdencies (and address vulnerabilities in them)
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.