Closed tedjpoole closed 1 year ago
Prefixer looks good! Next step is to get the linking part done and then an example file to use the prefixed functions, right?
For each <function>
declared in the source OpenSSL headers, the prefixer now:
<prefix>_<function>
<prefix>_<function>_t
<prefix>_functions
struct, called <prefix>_<function>
(of type <prefix>_<function>_t
)dlopen()
/dlsym()
code to initialise the function pointer in the <prefix>_functions
struct.<prefix>_<function>
which calls through to the corresponding function pointer.The RAND_bytes()
function has been modified to #include the prefixed "ossl/openssl/rand.h"
header, and call onto the prefixed ossl_RAND_bytes()
wrapper function., and the test_rand
binary successfully links and runs.
LGTM! Compiling test_rand works fine when openssl is downloaded. But when I have openssl version 3.0.7 installed in the OS, the prefixer generates its files, but then compilation fails with
[ 21%] Building C object CMakeFiles/bssl-compat.dir/source/rand.c.o
In file included from /home/pflykt/projects/envoy-openssl/bssl-compat/source/rand.c:20:
In file included from /home/pflykt/projects/envoy-openssl/bssl-compat/build/include/ossl/openssl/rand.h:14:
/home/pflykt/projects/envoy-openssl/bssl-compat/build/include/ossl/openssl/macros.h:139:4: error: "The requested API level higher than the configured API compatibility level"
Thanks for spotting that @pfl. I still have 1.1.1 on my host so I hadn't tried OpenSSL 3 yet! I'll take a look
OpenSSL 3.0 will be addressed at a later date
Initial implementation of the header prefixer tool.
Signed-off-by: Ted Poole tpoole@redhat.com