Skip to content

Commit

Permalink
protect ossl cleanup from multithreading errors (#1472)
Browse files Browse the repository at this point in the history
  • Loading branch information
baentsch authored May 18, 2023
1 parent e11e2d1 commit aaa5695
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/common/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#if defined(OQS_USE_OPENSSL)
#include <openssl/evp.h>
#include "ossl_helpers.h"
CRYPTO_ONCE OQS_ONCE_STATIC_FREE;
#endif

/* Identifying the CPU is expensive so we cache the results in cpu_ext_data */
Expand Down Expand Up @@ -216,7 +217,7 @@ OQS_API const char *OQS_version(void) {

OQS_API void OQS_destroy(void) {
#if defined(OQS_USE_OPENSSL)
oqs_free_ossl_objects();
CRYPTO_THREAD_run_once(&OQS_ONCE_STATIC_FREE, oqs_free_ossl_objects);
#endif
return;
}
Expand Down

0 comments on commit aaa5695

Please # to comment.