-
Notifications
You must be signed in to change notification settings - Fork 465
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
Make low-level crypto algorithms implementation switchable #1599
Comments
Thanks for this proposal. Eliminating this OpenSSL dependency definitely makes sense for I wonder though, to which level of algorithm detail this needs to go: Is a distinction AES/SHA2/SHA3/RAND sufficient? Or should there be "redirection stubs" for all detail APIs e.g., as currently documented here for AES -- and equivalent for the other common crypto elements? Would you want to make a strawman proposal based on how you could envision a mapping onto GnuTLS APIs? In my personal opinion, it would be beneficial if this could be a compile-time switch (maybe macros based on the current common APIs, such as |
XMLSEc project https://github.com/lsh123/xmlsec uses multibackend scheme with compile-time choice, and I can't say it's easily maintained by a person foreign to the project but it's definitely not the only possible architecture |
Thanks for the prompt response!
Yes; I think that'd be sufficient. Let me try to create a PoC.
One idea to make this transition easier might be to delay the loading of libcrypto.so.* with dlopen, so the application can swap the implementation before OpenSSL is actually being used. I guess that wouldn't be too hard, as I see only 18 functions from libcrypto.so.* are used. |
Agreed, there's not so many entry points. Would a |
Currently liboqs uses OpenSSL as the default backend for low-level support algorithms, such as AES and SHA3 if the
OQS_USE_OPENSSL
build flag isON
; otherwise it will use the bundled implementation of those algorithms. While integrating liboqs in GnuTLS, we found neither of them optimal: it is not desirable to bring in OpenSSL as a dependency[1], while we also don't want to have the same algorithms implemented in multiple places. Therefore I would suggest providing a way to make those algorithm implementation pluggable at either compile time or runtime.More concretely, what I have in mind is something along the following lines:
OQS_COMMON_CRYPTO
, which takes a combo value, eitherOPENSSL
,DEFAULT
, orNONE
.OQS_COMMON_CRYPTO=OPENSSL
is the same as whatOQS_USE_OPENSSL=ON
currently does,DEFAULT
is equivalent toOQS_USE_OPENSSL=OFF
, andNONE
means only a stub implementation (all functions return error) is compiled inOQS_AES_register_implementation
,OQS_SHA3_register_implementation
, etc.liboqs_openssl.a
,liboqs_default.a
)This is similar to the approach taken by tpm2-tss[2].
The text was updated successfully, but these errors were encountered: