-
Notifications
You must be signed in to change notification settings - Fork 101
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
Issues building oqsprovider statically #236
Comments
Without further information on your build env (OS? OpenSSL version?), this is hard to tell. You surely already checked all #defines? One that gave headaches recently is "OSSL_CAPABILITY_TLS_SIGALG_NAME": This got introduced only in OpenSSL3.2.0-dev... Older OpenSSL versions will cause wildly different binaries to be created for this file. |
I'm building this on its own, rather than using I also suspect there's a minor issue with oqsprov.c,
as flag OQS_PROVIDER_STATIC is undocumented. Should this have been |
That surely needs to be correct to get identical binaries. But then again this should've been done by the
Indeed, this looks fishy to me. Tagging @thb-sb for feedback. |
Hi!
Using two different symbols may be useful to avoid confusion when |
Thanks for the explanation. Good for me. So "OQS_PROVIDER_STATIC" is an internal C-language define created when using the CMakeLists.txt files.
Alright -- but then again we're using the same symbols everywhere else (both for In any case the problem can only occur if the CMakeLists.txt files have not been used -- is this the case @marcbrevoort-cyberhive ? Same question as above with the single algorithm defines... |
The bit that I'm trying to troubleshoot is that somehow on my local build with my build script, I get
whereas a build produced by the same script on the build box shows undefined symbols,
As for the build script, it looks like this -
Both are ubuntu systems but given the different output, I expect the differences must be due to some build environment issue, just can't figure out what might be having such an impact on the resulting What was the headache with |
In both outputs I can see that oqs-provider/oqsprov/oqs_kmgmt.c Line 940 in b6da1e9
Can you try the following on your local build machine?:
you should see that |
Yes, I confirm this is the case. |
That it was not present when someone built to non-openssl-3.2.0-dev. Clearly not the problem here. I am still puzzled by the many |
Thanks for the help so far. I'd build with the One thing I came across was the
line which I believe should read
to work in the context of What I'm currently having trouble with is setting algorithm I have confirmed that the I can tell that the oqsprovider registers signature algorithms with openssl; I can see that
While this |
Absolutely correct. Thanks for the catch! Do you want to do a PR to fix this?
What's the output of
That's OK, KEMs don't have OIDs (yet -- until #194 is done).
"one" meaning "OpenSSL core logic", not users. |
Well, there's a bit of a rub there as I'm doing a static build of oqsprovider, which openssl won't pick up as a plugin.
vs.
but of course this doesn't say much about the state of the static build. |
Ah, OK - static libs may behave differently.
In that case, I'd suggest tracing/instrumenting this OpenSSL function: Is it called at all in case of a static provider? Maybe digging "upwards and downwards" from there could help. |
in file I have confirmed with a
In what ways might static libs behave differently? Obviously load time matters (for dynamic libraries typically during program startup) as well as load order. Is there a specific order in which things need to be executed for them to work? Currently up to the failure I have
|
Then that's the problem. The question thus changes to "what is required for static providers to be iterated over via Does your (static) app call oqs-provider/test/test_common.c Lines 55 to 59 in b6da1e9
|
Yes, that's correct, |
No, that should not be necessary -- it works ( When checking the tests of static builds I noticed I think we need to debug into |
Don't know if these are built with the regular
Happy to raise a PR for that one as well if useful. |
Indeed, it was missing! I also added a test for checking that |
In openssl in
So now we know it's not adding groups because it thinks the oqsprovider is not activated.
The config file in question contains, as you would expect,
|
It surely would be. Ideally together with some documentation that explains how the code needs to be used/integrated differently when built that way. May be as simple as an But we surely also need to understand why this happens:
Thanks for digging this far. Really weird. From reading this I would've expected that every provider explicitly loaded (via API) also gets activated. But then again, code like this makes me wonder whether it's getting deactivated.... |
The "return actual" line is generated by a printf statement just before
Looking into whether some destructors may be getting called prematurely now. |
I think the oqsprovider was being deactivated due to going out of scope (easy to happen in Rust). That's no longer happening but getting the "library has no ciphers" message now. I've confirmed both "default" and "oqsprovider" are being loaded:
In the openssl output from
and see this This still yielded the "library has no ciphers" message but this was resolved by going back to the CMAKE_C_FLAGS approach in my build script above. With all that sorted, things work as expected. Thanks so much for your help, it's been instrumental in getting troubleshooting this thing. |
OK -- I have no experience in Rust -- so thanks for (having & using) that perspective.
Looking forward to that. Feel free to add any further lessons to the BUILD_STATIC Markdown and add yourself to the Contributors section: You unearthed bugs and surely also helped me (and others reading this in the future) to understand "things static" some more. |
I have two oqsprovider builds created with the same build script on different systems.
On these two systems,
liboqs.a
is bit-identical.OpenSSL is built from the same commit;
libssl.a
is bit-identical between the systems,nm
on libcrypto.a reportsThe build of
oqsprovider.a
differs substantially between the two systems (despite the identical build scripts) with the main difference being in the object files generated fromoqsprov.c
/oqsprov_capabilities.c
. What might impact the content of these files?The text was updated successfully, but these errors were encountered: