-
Notifications
You must be signed in to change notification settings - Fork 27
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 a prefix to the library names and to every global symbol #115
Add a prefix to the library names and to every global symbol #115
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing solution! Makes me think whether we should do this for other crates.
The code looks good, the one request I have is that you add a short notice about this in the psa-crypto-sys README.
cde17a4
to
5d18094
Compare
Done. Tell me if you think of any other comments/documentation that might be useful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
9d8496a
to
834689d
Compare
Is this still in draft state or can I review it? :) |
I've left this as "draft" because it requires (and includes as separate commits) updating the minimal Rust version from 1.58.1 to 1.60.0. I think someone said that there's a good reason for the minimal Rust version being 1.58.1, but it would be nice to document here what that reason is so that we can know when that reason has gone away. But that's the only reason I've left this as "draft". |
Hello @egrimley-arm could you resolve the conflicts? IMO this is ready for final review and merge |
Signed-off-by: Edmund Grimley Evans <[email protected]>
Signed-off-by: Edmund Grimley Evans <[email protected]>
To reduce the risk of a name collision with some other crate. No need for the println stuff: cc handles it for us. Signed-off-by: Edmund Grimley Evans <[email protected]>
A collision with another crate, even another crate that uses the same C library, should now be very unlikely, so the "links" line in Cargo.toml is removed. It should also be possible for a project to use multiple versions of this crate. The libraries are now called libpsa_crypto_0_10_0_shim.a and libpsa_crypto_0_10_0_mbedcrypto.a and there is a new directory for them (.../out/llib) which does not contain any other libraries. All the globally defined symbols have the prefix "psa_crypto_0_10_0_". Signed-off-by: Edmund Grimley Evans <[email protected]>
834689d
to
8cac14a
Compare
It looks like an update to some crate we depend on has made |
@egrimley-arm Yes, if possible, could you use 1.66.0 instead? Thanks |
Note that these are build-dependencies, which perhaps alleviates the security implications. But changing our rust-version to 1.63.0 still might be a better plan. Signed-off-by: Edmund Grimley Evans <[email protected]>
A collision with another crate, even another crate that uses the same C library, should now be very unlikely, so the
links
line inCargo.toml
is removed. It should also be possible for a project to use multiple versions of this crate.The libraries are now called
libpsa_crypto_0_10_0_shim.a
andlibpsa_crypto_0_10_0_mbedcrypto.a
and there is a new directory for them (.../out/llib
) which does not contain any other libraries. All the globally defined symbols have the prefixpsa_crypto_0_10_0_
.This relies on
bindgen::callbacks::ParseCallbacks::generated_name_override
, which was added inbindgen
0.64.0, which requires Rust 1.60.0. Currently we wantpsa-crypto
to work with Rust 1.58.1. We could perhaps make this prefixing optional, enabled by a feature, but I don't think there's any way to make thelinks
field inCargo.toml
conditional on a feature so perhaps we will just have to wait till people are happy to move torust-version = "1.60.0"
.I've done this on top of #116, which tests with two versions of Rust, and I've updated the minimal version from 1.58.1 to 1.60.0 in a separate commit.