Commit dc41ddc 1 parent 9e1bb08 commit dc41ddc Copy full SHA for dc41ddc
File tree 2 files changed +23
-6
lines changed
2 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -152,10 +152,21 @@ if (BYO_CRYPTO)
152
152
endif ()
153
153
154
154
if (USE_S2N)
155
- file (GLOB AWS_IO_TLS_SRC
156
- "source/s2n/*.c"
157
- )
158
- aws_use_package(s2n)
155
+ file (GLOB AWS_IO_TLS_SRC
156
+ "source/s2n/*.c"
157
+ )
158
+ # Prefer find_package() because it's the normal CMake way to do dependencies.
159
+ # But fall back on aws_use_package() because some projects still need to do an IN_SOURCE_BUILD of S2N.
160
+ # (e.g. aws-crt-java until this is resolved: https://github.com/awslabs/aws-crt-java/pull/817)
161
+ find_package (s2n QUIET )
162
+
163
+ if (s2n_FOUND)
164
+ list (APPEND DEP_AWS_LIBS AWS::s2n)
165
+ else ()
166
+ # Set flag to use in-source path to <s2n/unstable/*.h> headers if we do an IN_SOURCE_BUILD.
167
+ aws_use_package(s2n)
168
+ add_definitions (-DAWS_S2N_INSOURCE_PATH)
169
+ endif ()
159
170
endif ()
160
171
161
172
file (GLOB IO_HEADERS
Original file line number Diff line number Diff line change 20
20
#include <aws/common/task_scheduler.h>
21
21
#include <aws/common/thread.h>
22
22
23
+ #include <s2n.h>
24
+ #ifdef AWS_S2N_INSOURCE_PATH
25
+ # include <api/unstable/cleanup.h>
26
+ #else
27
+ # include <s2n/unstable/cleanup.h>
28
+ #endif
29
+
23
30
#include <errno.h>
24
31
#include <inttypes.h>
25
32
#include <math.h>
26
- #include <s2n.h>
27
33
#include <stdio.h>
28
34
#include <stdlib.h>
29
35
@@ -1247,7 +1253,7 @@ static struct aws_event_loop_local_object s_tl_cleanup_object = {
1247
1253
static void s_aws_cleanup_s2n_thread_local_state (void * user_data ) {
1248
1254
(void )user_data ;
1249
1255
1250
- s2n_cleanup ();
1256
+ s2n_cleanup_thread ();
1251
1257
}
1252
1258
1253
1259
/* s2n allocates thread-local data structures. We need to clean these up when the event loop's thread exits. */
You can’t perform that action at this time.
0 commit comments