Skip to content

Commit

Permalink
use OPENSSL_cleanse if OpenSSL is used
Browse files Browse the repository at this point in the history
Signed-off-by: Bence Mali <[email protected]>
  • Loading branch information
bencemali committed May 8, 2024
1 parent 9c8db18 commit a5b1ee2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/common/common.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0 AND MIT

#if !defined(_WIN32) && !defined(OQS_HAVE_EXPLICIT_BZERO)
#if !defined(OQS_USE_OPENSSL) && !defined(_WIN32) && !defined(OQS_HAVE_EXPLICIT_BZERO)
// Request memset_s
#define __STDC_WANT_LIB_EXT1__ 1
#endif
Expand Down Expand Up @@ -256,7 +256,9 @@ OQS_API int OQS_MEM_secure_bcmp(const void *a, const void *b, size_t len) {
}

OQS_API void OQS_MEM_cleanse(void *ptr, size_t len) {
#if defined(_WIN32)
#if defined(OQS_USE_OPENSSL)
OPENSSL_cleanse(ptr, len);
#elif defined(_WIN32)
SecureZeroMemory(ptr, len);
#elif defined(OQS_HAVE_EXPLICIT_BZERO)
explicit_bzero(ptr, len);
Expand Down

0 comments on commit a5b1ee2

Please sign in to comment.