Skip to content

Commit

Permalink
1.1 by default
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 committed Aug 15, 2024
1 parent c15051a commit 9709074
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions source/unix/openssl_platform_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,15 +494,11 @@ static enum aws_libcrypto_version s_resolve_libcrypto_symbols(enum aws_libcrypto
}

static enum aws_libcrypto_version s_resolve_libcrypto_compile_version(void) {
// TODO: only assert on major and minor?
// TODO: do I need to care about openssl vs aws-lc vs boringssl here?
// TODO: this is not defined in Opensslv3, should I use something else? Probably wrap it in a defined block
#ifdef SHLIB_VERSION_NUMBER
if (strcmp(SHLIB_VERSION_NUMBER, "1.1") == 0) {
return AWS_LIBCRYPTO_1_1_1;
}
if (strcmp(SHLIB_VERSION_NUMBER, "1.0.0") == 0) {
#ifdef OPENSSL_IS_OPENSSL
if (OPENSSL_VERSION_MAJOR == 1 && OPENSSL_VERSION_MINOR == 0) {
return AWS_LIBCRYPTO_1_0_2;
} else if(OPENSSL_VERSION_MAJOR == 1 && OPENSSL_VERSION_MINOR == 1) {
return AWS_LIBCRYPTO_1_1_1;
}
#endif
return AWS_LIBCRYPTO_NONE;
Expand Down Expand Up @@ -549,20 +545,21 @@ static enum aws_libcrypto_version s_resolve_libcrypto_lib(void) {
}
}

if (compiled_version != AWS_LIBCRYPTO_1_0_2) {
enum aws_libcrypto_version result = s_resolve_libcrypto_lib_impl(AWS_LIBCRYPTO_1_0_2);
if (result == AWS_LIBCRYPTO_1_0_2) {
if (compiled_version != AWS_LIBCRYPTO_1_1_1) {
enum aws_libcrypto_version result = s_resolve_libcrypto_lib_impl(AWS_LIBCRYPTO_1_1_1);
if (result == AWS_LIBCRYPTO_1_1_1) {
return result;
}
}

if (compiled_version != AWS_LIBCRYPTO_1_1_1) {
enum aws_libcrypto_version result = s_resolve_libcrypto_lib_impl(AWS_LIBCRYPTO_1_1_1);
if (result == AWS_LIBCRYPTO_1_1_1) {
if (compiled_version != AWS_LIBCRYPTO_1_0_2) {
enum aws_libcrypto_version result = s_resolve_libcrypto_lib_impl(AWS_LIBCRYPTO_1_0_2);
if (result == AWS_LIBCRYPTO_1_0_2) {
return result;
}
}


AWS_LOGF_DEBUG(AWS_LS_CAL_LIBCRYPTO_RESOLVE, "loading libcrypto.so");
void *module = dlopen("libcrypto.so", RTLD_NOW);
if (module) {
Expand Down Expand Up @@ -652,16 +649,16 @@ static enum aws_libcrypto_version s_resolve_libcrypto(void) {
}
if (result == AWS_LIBCRYPTO_NONE) {
AWS_LOGF_DEBUG(AWS_LS_CAL_LIBCRYPTO_RESOLVE, "did not find boringssl symbols linked");
result = s_resolve_libcrypto_symbols(AWS_LIBCRYPTO_1_0_2, process);
result = s_resolve_libcrypto_symbols(AWS_LIBCRYPTO_1_1_1, process);
}
if (result == AWS_LIBCRYPTO_NONE) {
AWS_LOGF_DEBUG(AWS_LS_CAL_LIBCRYPTO_RESOLVE, "did not find libcrypto 1.0.2 symbols linked");
// result = s_resolve_libcrypto_symbols(AWS_LIBCRYPTO_1_1_1, process);
AWS_LOGF_DEBUG(AWS_LS_CAL_LIBCRYPTO_RESOLVE, "did not find libcrypto 1.1.1 symbols linked");
result = s_resolve_libcrypto_symbols(AWS_LIBCRYPTO_1_0_2, process);
}
dlclose(process);

if (result == AWS_LIBCRYPTO_NONE) {
AWS_LOGF_DEBUG(AWS_LS_CAL_LIBCRYPTO_RESOLVE, "did not find libcrypto 1.1.1 symbols linked");
AWS_LOGF_DEBUG(AWS_LS_CAL_LIBCRYPTO_RESOLVE, "did not find libcrypto 1.0.2 symbols linked");
AWS_LOGF_DEBUG(
AWS_LS_CAL_LIBCRYPTO_RESOLVE,
"libcrypto symbols were not statically linked, searching for shared libraries");
Expand Down

0 comments on commit 9709074

Please sign in to comment.