Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Baulig <mabaul@microsoft.com>2018-06-01 00:30:58 +0300
committerMarek Safar <marek.safar@gmail.com>2018-06-01 15:13:15 +0300
commit8d8d683b93ddeb1d240afaa832f6f790c6045f83 (patch)
tree42048a92508742d3b2ded1c8ebbe04c27650491e
parent269f0d7219e3221948b806bbc9014730b27ba9e3 (diff)
Convert System.Security.Cryptography.Native.Apple/pal_random.cpp to C (#29992)
* Convert System.Security.Cryptography.Native.Apple/pal_random.cpp to C for inclusion in Mono. * Wrap with `BEGIN_EXTERN_C` / `END_EXTERN_C` and add `DLLEXPORT`.
-rw-r--r--src/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt2
-rw-r--r--src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_random.c (renamed from src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_random.cpp)4
-rw-r--r--src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_random.h7
3 files changed, 9 insertions, 4 deletions
diff --git a/src/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt b/src/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt
index 0ed02c6e9d..762f405923 100644
--- a/src/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt
+++ b/src/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt
@@ -14,7 +14,7 @@ set(NATIVECRYPTO_SOURCES
pal_hmac.cpp
pal_keyagree.cpp
pal_keychain.cpp
- pal_random.cpp
+ pal_random.c
pal_rsa.cpp
pal_sec.cpp
pal_seckey.cpp
diff --git a/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_random.cpp b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_random.c
index 8115a62534..093b7bf3e8 100644
--- a/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_random.cpp
+++ b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_random.c
@@ -7,9 +7,9 @@
#include <CommonCrypto/CommonCrypto.h>
#include <CommonCrypto/CommonRandom.h>
-extern "C" int32_t AppleCryptoNative_GetRandomBytes(uint8_t* pBuf, uint32_t cbBuf, int32_t* pkCCStatus)
+int32_t AppleCryptoNative_GetRandomBytes(uint8_t* pBuf, uint32_t cbBuf, int32_t* pkCCStatus)
{
- if (pBuf == nullptr || pkCCStatus == nullptr)
+ if (pBuf == NULL || pkCCStatus == NULL)
return -1;
CCRNGStatus status = CCRandomGenerateBytes(pBuf, cbBuf);
diff --git a/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_random.h b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_random.h
index db202c5397..1d8b68c99d 100644
--- a/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_random.h
+++ b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_random.h
@@ -5,10 +5,15 @@
#pragma once
#include "pal_types.h"
+#include "pal_compiler.h"
+
+BEGIN_EXTERN_C
/*
Shims CCRandomGenerateBytes, putting the resulting CCRNGStatus value in pkCCStatus.
Returns 1 on success, 0 on system error (see pkCCStatus), -1 on input error.
*/
-extern "C" int32_t AppleCryptoNative_GetRandomBytes(uint8_t* pBuf, uint32_t cbBuf, int32_t* pkCCStatus);
+DLLEXPORT int32_t AppleCryptoNative_GetRandomBytes(uint8_t* pBuf, uint32_t cbBuf, int32_t* pkCCStatus);
+
+END_EXTERN_C