Skip to content

Commit 28c7d6f

Browse files
committed
Not all tools build with OpenSSL-1.1.1.
This reshufles things in CMakeList.txt so options to run tools are kept along build targets. Fixes: #85
1 parent d18e910 commit 28c7d6f

1 file changed

Lines changed: 144 additions & 145 deletions

File tree

source/CMakeLists.txt

Lines changed: 144 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,93 @@ set(CMAKE_REQUIRED_LIBRARIES OpenSSL::Crypto)
158158
set(CMAKE_REQUIRED_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
159159
set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}")
160160

161+
check_symbol_exists(OSSL_LIB_CTX_freeze "openssl/crypto.h" HAVE_OSSL_LIB_CTX_FREEZE)
162+
check_symbol_exists(SSL_set1_dnsname "openssl/ssl.h" HAVE_SSL_SET1_DNSNAME)
163+
164+
set(run_tests CACHE STRING "List of tests to run")
165+
set(run_opts CACHE STRING "List of per-text options")
166+
161167
if( OPENSSL_VERSION VERSION_GREATER_EQUAL 3 )
162168
add_executable(evp_fetch evp_fetch.c)
163169
target_link_libraries(evp_fetch PRIVATE perf)
170+
list(APPEND run_tests evp_fetch)
171+
172+
set(run_evp_fetch_pqs
173+
evp_fetch "" "" "-q"
174+
CACHE STRING "Post-quantum option for evp_fetch")
175+
list(APPEND run_opts run_evp_fetch_pqs)
176+
if(HAVE_OSSL_LIB_CTX_FREEZE)
177+
set(run_evp_fetch_freeze
178+
evp_fetch "" "" "-F"
179+
CACHE STRING "Freeze LIB_CTX for evp_fetch")
180+
list(APPEND run_opts run_evp_fetch_pqs)
181+
endif()
164182

165183
add_executable(providerdoall providerdoall.c)
166184
target_link_libraries(providerdoall PRIVATE perf)
185+
list(APPEND run_tests providerdoall)
186+
187+
add_executable(evp_cipher evp_cipher.c)
188+
target_link_libraries(evp_cipher PRIVATE perf)
189+
list(APPEND run_tests evp_cipher)
190+
set(run_evp_cipher_operations
191+
evp_cipher "" "" "-o evp_isolated" "-o evp_shared"
192+
CACHE STRING "Modes of operation for evp_cipher")
193+
list(APPEND run_opts run_evp_cipher_operations)
194+
set(run_evp_cipher_algorithms
195+
evp_cipher "" "" "-a AES-128-CBC" "-a AES-256-CBC"
196+
CACHE STRING "Encryption algorithms for evp_cipher")
197+
list(APPEND run_opts run_evp_cipher_algorithms)
198+
if(HAVE_OSSL_LIB_CTX_FREEZE)
199+
set(run_evp_cipher_freeze
200+
evp_cipher "" "" "-f"
201+
CACHE STRING "Freeze LIB_CTX for evp_cipher")
202+
list(APPEND run_opts run_evp_cipher_freeze)
203+
endif()
167204

168-
endif()
205+
add_executable(evp_mac evp_mac.c)
206+
target_link_libraries(evp_mac PRIVATE perf)
207+
list(APPEND run_tests evp_mac)
208+
set(run_evp_mac_operations
209+
evp_mac "" "" "-o deprecated_isolated" "-o deprecated_shared" "-o evp_isolated" "-o evp_shared"
210+
CACHE STRING "Modes of operation for evp_mac")
211+
list(APPEND run_opts run_evp_mac_operations)
212+
213+
add_executable(evp_kdf evp_kdf.c)
214+
target_link_libraries(evp_kdf PRIVATE perf)
215+
list(APPEND run_tests evp_kdf)
216+
set(run_evp_kdf_operations
217+
evp_kdf "" "" "-o evp_shared" "-o evp_isolated" "-o deprecated_shared" "-o deprecated_isolated"
218+
CACHE STRING "Modes of operation for evp_kdf")
219+
list(APPEND run_opts run_evp_kdf_operations)
220+
221+
add_executable(evp_rand evp_rand.c)
222+
target_link_libraries(evp_rand PRIVATE perf)
223+
list(APPEND run_tests evp_rand)
224+
set(run_evp_rand_operations
225+
evp_rand "" "" "-o evp_isolated" "-o evp_shared"
226+
CACHE STRING "Modes of operation for evp_rand")
227+
list(APPEND run_opts run_evp_rand_operations)
228+
if(HAVE_OSSL_LIB_CTX_FREEZE)
229+
set(run_evp_rand_freeze
230+
evp_rand "" "" "-f"
231+
CACHE STRING "Freeze LIB_CTX for evp_rand")
232+
list(APPEND run_opts run_evp_rand_freeze)
233+
endif()
169234

170-
check_symbol_exists(OSSL_LIB_CTX_freeze "openssl/crypto.h" HAVE_OSSL_LIB_CTX_FREEZE)
171-
check_symbol_exists(SSL_set1_dnsname "openssl/ssl.h" HAVE_SSL_SET1_DNSNAME)
235+
add_executable(evp_pkey evp_pkey.c)
236+
target_link_libraries(evp_pkey PRIVATE perf)
237+
list(APPEND run_tests evp_pkey)
238+
set(run_evp_pkey_operations
239+
evp_pkey "" "" "-o evp_isolated" "-o evp_shared"
240+
CACHE STRING "Modes of operation for evp_pkey")
241+
list(APPEND run_opts run_evp_pkey_operations)
242+
set(run_evp_pkey_algorithms
243+
evp_pkey "" "" "-a RSA" "-a X25519" "-a X448" "-a ED25519" "-a ED448"
244+
CACHE STRING "Algorithms for evp_pkey")
245+
list(APPEND run_opts run_evp_pkey_algorithms)
246+
247+
endif()
172248

173249
if( OPENSSL_VERSION VERSION_GREATER_EQUAL 3.6 )
174250
add_executable(ssl_poll_perf ssl_poll_perf.c)
@@ -181,195 +257,118 @@ endif()
181257

182258
add_executable(randbytes randbytes.c)
183259
target_link_libraries(randbytes PRIVATE perf)
260+
list(APPEND run_tests randbytes)
184261

185262
add_executable(handshake handshake.c)
186263
target_link_libraries(handshake PRIVATE perf)
264+
list(APPEND run_tests handshake)
265+
set(run_handshake_pools
266+
handshake "" "-p" "-P" "-l"
267+
CACHE STRING "Pool types for handshake")
268+
list(APPEND run_opts run_handshake_pools)
269+
set(run_handshake_ctx_sharing
270+
handshake "" "" "-s"
271+
CACHE STRING "Context sharing option for handshake")
272+
list(APPEND run_opts run_handshake_ctx_sharing)
273+
set(run_handshake_pool_size
274+
handshake "" "" "-o 4" "-o 256"
275+
CACHE STRING "Pool size for handshake")
276+
list(APPEND run_opts run_handshake_pool_size)
277+
set(run_handshake_secure_memory
278+
handshake "" "-S 1048576"
279+
CACHE STRING "Secure memory usage for handshake")
280+
list(APPEND run_opts run_handshake_secure_memory)
187281

188282
add_executable(sslnew sslnew.c)
189283
target_link_libraries(sslnew PRIVATE perf)
284+
list(APPEND run_tests sslnew)
190285

191286
add_executable(newrawkey newrawkey.c)
192287
target_link_libraries(newrawkey PRIVATE perf)
288+
list(APPEND run_tests newrawkey)
289+
set(run_newrawkey_algos
290+
newrawkey "-a" x25519 ml-kem-512 ml-kem-768 ml-kem-1024
291+
CACHE STRING "Algorithms for newrawkey")
292+
list(APPEND run_opts run_newrawkey_algos)
193293

194294
add_executable(rsasign rsasign.c)
195295
target_link_libraries(rsasign PRIVATE perf)
296+
list(APPEND run_tests rsasign)
196297

197298
add_executable(x509storeissuer x509storeissuer.c)
198299
target_link_libraries(x509storeissuer PRIVATE perf)
300+
list(APPEND run_tests x509storeissuer)
199301

200302
add_executable(rwlocks rwlocks.c)
201303
target_link_libraries(rwlocks PRIVATE perf)
304+
list(APPEND run_tests rwlocks)
202305

203306
add_executable(pkeyread pkeyread.c)
204307
if(WIN32)
205308
target_link_libraries(pkeyread PRIVATE perf)
206309
else()
207310
target_link_libraries(pkeyread PUBLIC m PRIVATE perf)
208311
endif()
312+
list(APPEND run_tests pkeyread)
313+
set(run_pkeyread_keys
314+
pkeyread "-k" dh dhx dsa ec rsa x25519 all
315+
CACHE STRING "Key types for pkeyread")
316+
list(APPEND run_opts run_pkeyread_keys)
317+
set(run_pkeyread_fmts
318+
pkeyread "-f" pem der all
319+
CACHE STRING "Key formats for pkeyread")
320+
list(APPEND run_opts run_pkeyread_fmts)
209321

210322
add_executable(evp_setpeer evp_setpeer.c)
211323
target_link_libraries(evp_setpeer PRIVATE perf)
324+
list(APPEND run_tests evp_setpeer)
325+
set(run_evp_setpeer_keys
326+
evp_setpeer "-k" dh ec256 ec521 x25519 all
327+
CACHE STRING "Key types for evp_setpeer")
328+
list(APPEND run_opts run_evp_setpeer_keys)
212329

213330
add_executable(writeread writeread.c)
214331
target_link_libraries(writeread PRIVATE perf)
332+
list(APPEND run_tests writeread)
333+
set(run_writeread_ctx_sharing
334+
writeread "" "" "-s"
335+
CACHE STRING "Context sharing for writeread")
336+
list(APPEND run_opts run_writeread_ctx_sharing)
337+
set(run_writeread_dtls
338+
writeread "" "" "-d"
339+
CACHE STRING "DTLS mode for writeread")
340+
list(APPEND run_opts run_writeread_dtls)
341+
set(run_writeread_buffers
342+
writeread "" "" "-b 256" "-b 4096"
343+
CACHE STRING "Buffer size for writeread")
344+
list(APPEND run_opts run_writeread_buffers)
215345

216346
add_executable(evp_hash evp_hash.c)
217347
target_link_libraries(evp_hash PRIVATE perf)
218-
219-
add_executable(evp_cipher evp_cipher.c)
220-
target_link_libraries(evp_cipher PRIVATE perf)
221-
222-
add_executable(evp_mac evp_mac.c)
223-
target_link_libraries(evp_mac PRIVATE perf)
224-
225-
add_executable(evp_kdf evp_kdf.c)
226-
target_link_libraries(evp_kdf PRIVATE perf)
227-
228-
add_executable(evp_rand evp_rand.c)
229-
target_link_libraries(evp_rand PRIVATE perf)
230-
231-
add_executable(evp_pkey evp_pkey.c)
232-
target_link_libraries(evp_pkey PRIVATE perf)
233-
234-
## Running tests
235-
# Options
236-
set(run_tests evp_fetch
237-
evp_hash
238-
evp_cipher
239-
evp_mac
240-
evp_kdf
241-
evp_rand
242-
evp_pkey
243-
evp_setpeer
244-
handshake
245-
newrawkey
246-
pkeyread
247-
providerdoall
248-
randbytes
249-
rsasign
250-
rwlocks
251-
sslnew
252-
#ssl_poll_perf
253-
writeread
254-
x509storeissuer
255-
CACHE STRING "List of tests to run")
256-
257-
set(run_add_version_dep ON
258-
CACHE BOOL "Whether to print version information on run " +
259-
"(call all the tests with -V option before the main run)")
260-
261-
# Per-test options, the format: test option values
262-
set(run_evp_fetch_pqs
263-
evp_fetch "" "" "-q"
264-
CACHE STRING "Post-quantum option for evp_fetch")
265-
set(run_evp_fetch_freeze
266-
evp_fetch "" "" "-F"
267-
CACHE STRING "Freeze LIB_CTX for evp_fetch")
348+
list(APPEND run_tests evp_hash)
268349
set(run_evp_hash_operations
269350
evp_hash "" "" "-o deprecated" "-o evp_isolated" "-o evp_shared"
270351
CACHE STRING "Modes of operation for evp_hash")
352+
list(APPEND run_opts run_evp_hash_operations)
271353
set(run_evp_hash_update_times
272354
evp_hash "" "" "-u 1" "-u 5"
273355
CACHE STRING "Digest update times for evp_hash")
356+
list(APPEND run_opts run_evp_hash_update_times)
274357
set(run_evp_hash_algorithms
275358
evp_hash "" "" "-a SHA1" "-a SHA224" "-a SHA256" "-a SHA384" "-a SHA512"
276359
CACHE STRING "Digest hash algorithms for evp_hash")
277-
set(run_evp_hash_freeze
360+
list(APPEND run_opts run_evp_hash_algorithms)
361+
if(HAVE_OSSL_LIB_CTX_FREEZE)
362+
set(run_evp_hash_freeze
278363
evp_hash "" "" "-f"
279364
CACHE STRING "Freeze LIB_CTX for evp_hash")
280-
set(run_evp_cipher_operations
281-
evp_cipher "" "" "-o evp_isolated" "-o evp_shared"
282-
CACHE STRING "Modes of operation for evp_cipher")
283-
set(run_evp_cipher_algorithms
284-
evp_cipher "" "" "-a AES-128-CBC" "-a AES-256-CBC"
285-
CACHE STRING "Encryption algorithms for evp_cipher")
286-
set(run_evp_cipher_freeze
287-
evp_cipher "" "" "-f"
288-
CACHE STRING "Freeze LIB_CTX for evp_cipher")
289-
set(run_evp_mac_operations
290-
evp_mac "" "" "-o deprecated_isolated" "-o deprecated_shared" "-o evp_isolated" "-o evp_shared"
291-
CACHE STRING "Modes of operation for evp_mac")
292-
set(run_evp_kdf_operations
293-
evp_kdf "" "" "-o evp_shared" "-o evp_isolated" "-o deprecated_shared" "-o deprecated_isolated"
294-
CACHE STRING "Modes of operation for evp_kdf")
295-
set(run_evp_rand_operations
296-
evp_rand "" "" "-o evp_isolated" "-o evp_shared"
297-
CACHE STRING "Modes of operation for evp_rand")
298-
set(run_evp_pkey_operations
299-
evp_pkey "" "" "-o evp_isolated" "-o evp_shared"
300-
CACHE STRING "Modes of operation for evp_pkey")
301-
set(run_evp_pkey_algorithms
302-
evp_pkey "" "" "-a RSA" "-a X25519" "-a X448" "-a ED25519" "-a ED448"
303-
CACHE STRING "Algorithms for evp_pkey")
304-
set(run_evp_rand_freeze
305-
evp_rand "" "" "-f"
306-
CACHE STRING "Freeze LIB_CTX for evp_rand")
307-
set(run_evp_setpeer_keys
308-
evp_setpeer "-k" dh ec256 ec521 x25519 all
309-
CACHE STRING "Key types for evp_setpeer")
310-
set(run_newrawkey_algos
311-
newrawkey "-a" x25519 ml-kem-512 ml-kem-768 ml-kem-1024
312-
CACHE STRING "Algorithms for newrawkey")
313-
set(run_pkeyread_keys
314-
pkeyread "-k" dh dhx dsa ec rsa x25519 all
315-
CACHE STRING "Key types for pkeyread")
316-
set(run_pkeyread_fmts
317-
pkeyread "-f" pem der all
318-
CACHE STRING "Key formats for pkeyread")
319-
set(run_handshake_pools
320-
handshake "" "-p" "-P" "-l"
321-
CACHE STRING "Pool types for handshake")
322-
set(run_handshake_ctx_sharing
323-
handshake "" "" "-s"
324-
CACHE STRING "Context sharing option for handshake")
325-
set(run_handshake_pool_size
326-
handshake "" "" "-o 4" "-o 256"
327-
CACHE STRING "Pool size for handshake")
328-
set(run_handshake_secure_memory
329-
handshake "" "-S 1048576"
330-
CACHE STRING "Secure memory usage for handshake")
331-
set(run_writeread_ctx_sharing
332-
writeread "" "" "-s"
333-
CACHE STRING "Context sharing for writeread")
334-
set(run_writeread_dtls
335-
writeread "" "" "-d"
336-
CACHE STRING "DTLS mode for writeread")
337-
set(run_writeread_buffers
338-
writeread "" "" "-b 256" "-b 4096"
339-
CACHE STRING "Buffer size for writeread")
340-
341-
# The list of per-tet options
342-
set(run_opts run_evp_fetch_pqs
343-
run_evp_hash_operations
344-
run_evp_hash_update_times
345-
run_evp_hash_algorithms
346-
run_evp_cipher_operations
347-
run_evp_cipher_algorithms
348-
run_evp_mac_operations
349-
run_evp_kdf_operations
350-
run_evp_rand_operations
351-
run_evp_pkey_operations
352-
run_evp_pkey_algorithms
353-
run_evp_setpeer_keys
354-
run_newrawkey_algos
355-
run_pkeyread_keys
356-
run_pkeyread_fmts
357-
run_handshake_pools
358-
run_handshake_ctx_sharing
359-
run_handshake_pool_size
360-
run_handshake_secure_memory
361-
run_writeread_ctx_sharing
362-
run_writeread_dtls
363-
run_writeread_buffers
364-
CACHE STRING "List of per-text options")
365-
366-
if(HAVE_OSSL_LIB_CTX_FREEZE)
367-
list(APPEND run_opts run_evp_hash_freeze
368-
run_evp_cipher_freeze
369-
run_evp_rand_freeze
370-
run_evp_fetch_freeze)
365+
list(APPEND run_opts run_evp_hash_freeze)
371366
endif()
372367

368+
set(run_add_version_dep ON
369+
CACHE BOOL "Whether to print version information on run " +
370+
"(call all the tests with -V option before the main run)")
371+
373372
# Used across multiple tests
374373
set(run_certdir_tests handshake writeread x509storeissuer
375374
CACHE STRING "List of tests that require certdir parameter")

0 commit comments

Comments
 (0)