summaryrefslogtreecommitdiffstats
path: root/crypto/mem_sec.c
diff options
context:
space:
mode:
authorCharles Milette <charles.milette@gmail.com>2022-05-13 21:42:29 -0400
committerHugo Landau <hlandau@openssl.org>2022-07-26 12:35:40 +0100
commitff1efe6e261598c3f71727b796767a8e716bcbe2 (patch)
tree06726c2bc75eeaf3ba72e74b00e2e77c4b02296e /crypto/mem_sec.c
parent9c90a0737b809048b56dfaa9e64b0a35d6609271 (diff)
Fix UWP builds by defining VirtualLock
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18311)
Diffstat (limited to 'crypto/mem_sec.c')
-rw-r--r--crypto/mem_sec.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/crypto/mem_sec.c b/crypto/mem_sec.c
index 53acd22c04..60559a930e 100644
--- a/crypto/mem_sec.c
+++ b/crypto/mem_sec.c
@@ -23,6 +23,20 @@
#ifndef OPENSSL_NO_SECURE_MEMORY
# if defined(_WIN32)
# include <windows.h>
+# if defined(WINAPI_FAMILY_PARTITION) \
+ && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
+/*
+ * While VirtualLock is available under the app partition (e.g. UWP),
+ * the headers do not define the API. Define it ourselves instead.
+ */
+WINBASEAPI
+BOOL
+WINAPI
+VirtualLock(
+ _In_ LPVOID lpAddress,
+ _In_ SIZE_T dwSize
+ );
+# endif
# endif
# include <stdlib.h>
# include <assert.h>