From: Santiago Fernandez Madero Date: Wed, 19 Feb 2020 01:06:11 +0000 (-0800) Subject: Convert System.Globalization unix calls to QCalls into coreclr (#32132) X-Git-Tag: submit/tizen/20210909.063632~9640 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4365af16fcf99708df04315b19eadee6e533e4bd;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Convert System.Globalization unix calls to QCalls into coreclr (#32132) * Convert System.Globalization unix calls to QCalls into coreclr * Fix build errors, define UChar instead of using uint16_t * Fix indentation in some header files * Add libraries-native library to define qcalls entrypoints for libraries native shims * Change DLLEXPORT to PALEXPORT and declare visibility hidden when in entrypoints.c * Fix build and PALEXPORT definition * Fix mono tests * Fix System.Globalization tests by getting the icu version via NativeLibrary.Load * Fix full framework build * PR Feedback * Revert changes in Interop.Libraries.cs * Fix build and default version to 0.0.0.0 if pinvoke not found * Remove __LIB_NATIVE_ENTRYPOINTS define and move icu headers to internal header file * Add GetICUVersion to trimmer xml for mono and PR Feedback * PR Feedback: move mono link entry to bottom --- diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt index 5a33d25..d51dc5e 100644 --- a/src/coreclr/CMakeLists.txt +++ b/src/coreclr/CMakeLists.txt @@ -131,7 +131,12 @@ endif(CLR_CROSS_COMPONENTS_BUILD) #------------------- include(pgosupport.cmake) -add_subdirectory(src/libraries-native) +#------------------------------- +# Include libraries native shims +#------------------------------- +if(NOT CLR_CROSS_COMPONENTS_BUILD) + add_subdirectory(src/libraries-native) +endif(NOT CLR_CROSS_COMPONENTS_BUILD) #----------------------------------------- # Add Projects diff --git a/src/coreclr/src/System.Private.CoreLib/ILLinkTrim.xml b/src/coreclr/src/System.Private.CoreLib/ILLinkTrim.xml index 850fc77..1dc8146 100644 --- a/src/coreclr/src/System.Private.CoreLib/ILLinkTrim.xml +++ b/src/coreclr/src/System.Private.CoreLib/ILLinkTrim.xml @@ -1,5 +1,9 @@ + + + + diff --git a/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt b/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt index 527ac04..1f5f625 100644 --- a/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt @@ -104,6 +104,7 @@ set(CORECLR_LIBRARIES gcinfo # Condition="'$(TargetCpu)'=='amd64' or '$(TargetCpu)' == 'arm' or '$(TargetCpu)' == 'arm64'" ildbsymlib utilcode + libraries-native ) if(CLR_CMAKE_TARGET_WIN32) diff --git a/src/coreclr/src/libraries-native/CMakeLists.txt b/src/coreclr/src/libraries-native/CMakeLists.txt index 4835c64..aaf7f9b 100644 --- a/src/coreclr/src/libraries-native/CMakeLists.txt +++ b/src/coreclr/src/libraries-native/CMakeLists.txt @@ -1,5 +1,17 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(GLOBALIZATION_NATIVE_DIR ${CLR_REPO_ROOT_DIR}/src/libraries/Native/Unix/System.Globalization.Native) -if(CLR_CMAKE_HOST_UNIX AND NOT CLR_CROSS_COMPONENTS_BUILD) - add_subdirectory(${CLR_REPO_ROOT_DIR}/src/libraries/Native/Unix/System.Globalization.Native System.Globalization.Native) +# Suppress exporting of the PAL APIs +add_definitions(-DPALEXPORT=) + +if(CLR_CMAKE_HOST_UNIX) + include_directories("${CLR_REPO_ROOT_DIR}/src/libraries/Native/Unix/Common") + include_directories("${GLOBALIZATION_NATIVE_DIR}") + + add_subdirectory(${GLOBALIZATION_NATIVE_DIR} System.Globalization.Native) endif() + +add_library(libraries-native + STATIC + entrypoints.c +) diff --git a/src/coreclr/src/libraries-native/entrypoints.c b/src/coreclr/src/libraries-native/entrypoints.c new file mode 100644 index 0000000..75c5b73 --- /dev/null +++ b/src/coreclr/src/libraries-native/entrypoints.c @@ -0,0 +1,67 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#ifdef TARGET_UNIX + +#include "pal_types.h" + +typedef uint16_t UChar; + +// Include System.Globalization.Native headers +#include "pal_calendarData.h" +#include "pal_casing.h" +#include "pal_collation.h" +#include "pal_locale.h" +#include "pal_localeNumberData.h" +#include "pal_localeStringData.h" +#include "pal_icushim.h" +#include "pal_idna.h" +#include "pal_normalization.h" +#include "pal_timeZoneInfo.h" +#endif // TARGET_UNIX + +#define FCFuncStart(name) extern const void* name[]; const void* name[] = { +#define FCFuncEnd() (void*)0x01 /* FCFuncFlag_EndOfArray */ }; + +#define QCFuncElement(name,impl) \ + (void*)0x8 /* FCFuncFlag_QCall */, (void*)(impl), (void*)name, + +#ifdef TARGET_UNIX +FCFuncStart(gPalGlobalizationNative) + QCFuncElement("ChangeCase", GlobalizationNative_ChangeCase) + QCFuncElement("ChangeCaseInvariant", GlobalizationNative_ChangeCaseInvariant) + QCFuncElement("ChangeCaseTurkish", GlobalizationNative_ChangeCaseTurkish) + QCFuncElement("CloseSortHandle", GlobalizationNative_CloseSortHandle) + QCFuncElement("CompareString", GlobalizationNative_CompareString) + QCFuncElement("CompareStringOrdinalIgnoreCase", GlobalizationNative_CompareStringOrdinalIgnoreCase) + QCFuncElement("EndsWith", GlobalizationNative_EndsWith) + QCFuncElement("EnumCalendarInfo", GlobalizationNative_EnumCalendarInfo) + QCFuncElement("GetCalendarInfo", GlobalizationNative_GetCalendarInfo) + QCFuncElement("GetCalendars", GlobalizationNative_GetCalendars) + QCFuncElement("GetDefaultLocaleName", GlobalizationNative_GetDefaultLocaleName) + QCFuncElement("GetICUVersion", GlobalizationNative_GetICUVersion) + QCFuncElement("GetJapaneseEraStartDate", GlobalizationNative_GetJapaneseEraStartDate) + QCFuncElement("GetLatestJapaneseEra", GlobalizationNative_GetLatestJapaneseEra) + QCFuncElement("GetLocaleInfoGroupingSizes", GlobalizationNative_GetLocaleInfoGroupingSizes) + QCFuncElement("GetLocaleInfoInt", GlobalizationNative_GetLocaleInfoInt) + QCFuncElement("GetLocaleInfoString", GlobalizationNative_GetLocaleInfoString) + QCFuncElement("GetLocaleName", GlobalizationNative_GetLocaleName) + QCFuncElement("GetLocales", GlobalizationNative_GetLocales) + QCFuncElement("GetLocaleTimeFormat", GlobalizationNative_GetLocaleTimeFormat) + QCFuncElement("GetSortHandle", GlobalizationNative_GetSortHandle) + QCFuncElement("GetSortKey", GlobalizationNative_GetSortKey) + QCFuncElement("GetSortVersion", GlobalizationNative_GetSortVersion) + QCFuncElement("GetTimeZoneDisplayName", GlobalizationNative_GetTimeZoneDisplayName) + QCFuncElement("IndexOf", GlobalizationNative_IndexOf) + QCFuncElement("IndexOfOrdinalIgnoreCase", GlobalizationNative_IndexOfOrdinalIgnoreCase) + QCFuncElement("IsNormalized", GlobalizationNative_IsNormalized) + QCFuncElement("IsPredefinedLocale", GlobalizationNative_IsPredefinedLocale) + QCFuncElement("LastIndexOf", GlobalizationNative_LastIndexOf) + QCFuncElement("LoadICU", GlobalizationNative_LoadICU) + QCFuncElement("NormalizeString", GlobalizationNative_NormalizeString) + QCFuncElement("StartsWith", GlobalizationNative_StartsWith) + QCFuncElement("ToAscii", GlobalizationNative_ToAscii) + QCFuncElement("ToUnicode", GlobalizationNative_ToUnicode) +FCFuncEnd() +#endif // TARGET_UNIX diff --git a/src/coreclr/src/vm/dllimport.cpp b/src/coreclr/src/vm/dllimport.cpp index 4792aa9..ed8fa72 100644 --- a/src/coreclr/src/vm/dllimport.cpp +++ b/src/coreclr/src/vm/dllimport.cpp @@ -4828,7 +4828,7 @@ void NDirect::PopulateNDirectMethodDesc(NDirectMethodDesc* pNMD, PInvokeStaticSi if (callConv == pmCallConvThiscall) ndirectflags |= NDirectMethodDesc::kThisCall; - if (pNMD->GetLoaderModule()->IsSystem() && strcmp(szLibName, "QCall") == 0) + if (pNMD->GetLoaderModule()->IsSystem() && (strcmp(szLibName, "QCall") == 0 || strcmp(szLibName, "System.Globalization.Native") == 0)) { ndirectflags |= NDirectMethodDesc::kIsQCall; } diff --git a/src/coreclr/src/vm/ecalllist.h b/src/coreclr/src/vm/ecalllist.h index 1e7163d..7fa9dc4 100644 --- a/src/coreclr/src/vm/ecalllist.h +++ b/src/coreclr/src/vm/ecalllist.h @@ -1226,6 +1226,11 @@ FCClassElement("FileLoadException", "System.IO", gFileLoadExceptionFuncs) FCClassElement("GC", "System", gGCInterfaceFuncs) FCClassElement("GCHandle", "System.Runtime.InteropServices", gGCHandleFuncs) FCClassElement("GCSettings", "System.Runtime", gGCSettingsFuncs) +#ifdef TARGET_UNIX +#ifndef CROSSGEN_COMPILE +FCClassElement("Globalization", "", gPalGlobalizationNative) +#endif +#endif #ifdef FEATURE_COMINTEROP FCClassElement("IEnumerable", "System.Collections", gStdMngIEnumerableFuncs) FCClassElement("IEnumerator", "System.Collections", gStdMngIEnumeratorFuncs) diff --git a/src/coreclr/src/vm/mscorlib.cpp b/src/coreclr/src/vm/mscorlib.cpp index a6d652c..40a1e14 100644 --- a/src/coreclr/src/vm/mscorlib.cpp +++ b/src/coreclr/src/vm/mscorlib.cpp @@ -367,15 +367,14 @@ const MscorlibFieldDescription c_rgMscorlibFieldDescriptions[] = }; const USHORT c_nMscorlibFieldDescriptions = NumItems(c_rgMscorlibFieldDescriptions) + 1; - - - - /////////////////////////////////////////////////////////////////////////////// // // ECalls // +// ECalls defined by libraries-native shims +EXTERN_C const LPVOID gPalGlobalizationNative[]; + // When compiling crossgen, we only need the target version of the ecall tables #if !defined(CROSSGEN_COMPILE) || defined(CROSSGEN_MSCORLIB) diff --git a/src/libraries/Common/src/Interop/Unix/System.Globalization.Native/Interop.ICU.cs b/src/libraries/Common/src/Interop/Unix/System.Globalization.Native/Interop.ICU.cs index a16c813..f24c260 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Globalization.Native/Interop.ICU.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Globalization.Native/Interop.ICU.cs @@ -12,5 +12,8 @@ internal static partial class Interop { [DllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_LoadICU")] internal static extern int LoadICU(); + + [DllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetICUVersion")] + internal static extern int GetICUVersion(); } } diff --git a/src/libraries/Common/tests/CoreFx.Private.TestUtilities/System/PlatformDetection.Unix.cs b/src/libraries/Common/tests/CoreFx.Private.TestUtilities/System/PlatformDetection.Unix.cs index 22a7046..b4a7c56 100644 --- a/src/libraries/Common/tests/CoreFx.Private.TestUtilities/System/PlatformDetection.Unix.cs +++ b/src/libraries/Common/tests/CoreFx.Private.TestUtilities/System/PlatformDetection.Unix.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Reflection; using System.Runtime.InteropServices; using System.Xml.Linq; @@ -113,18 +114,21 @@ namespace System private static Version GetICUVersion() { - if (IsWindows) + int version = 0; + Type interopGlobalization = Type.GetType("Interop+Globalization"); + if (interopGlobalization != null) { - return new Version(0, 0, 0, 0); - } - else - { - int ver = libc.GlobalizationNative_GetICUVersion(); - return new Version( ver & 0xFF, - (ver >> 8) & 0xFF, - (ver >> 16) & 0xFF, - ver >> 24); + MethodInfo methodInfo = interopGlobalization.GetMethod("GetICUVersion", BindingFlags.NonPublic | BindingFlags.Static); + if (methodInfo != null) + { + version = (int)methodInfo.Invoke(null, null); + } } + + return new Version( version & 0xFF, + (version >> 8) & 0xFF, + (version >> 16) & 0xFF, + version >> 24); } private static Version GetOSXProductVersion() @@ -327,9 +331,6 @@ namespace System [DllImport("libc", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr gnu_get_libc_version(); - - [DllImport("System.Globalization.Native", SetLastError = true)] - public static extern int GlobalizationNative_GetICUVersion(); } } } diff --git a/src/libraries/Native/AnyOS/zlib/pal_zlib.h b/src/libraries/Native/AnyOS/zlib/pal_zlib.h index 93daa5e..d784a20 100644 --- a/src/libraries/Native/AnyOS/zlib/pal_zlib.h +++ b/src/libraries/Native/AnyOS/zlib/pal_zlib.h @@ -10,7 +10,7 @@ #else #include "pal_types.h" #include "pal_compiler.h" - #define FUNCTIONEXPORT DLLEXPORT + #define FUNCTIONEXPORT PALEXPORT #define FUNCTIONCALLINGCONVENCTION #endif diff --git a/src/libraries/Native/Unix/CMakeLists.txt b/src/libraries/Native/Unix/CMakeLists.txt index 2728337..f6570bc 100644 --- a/src/libraries/Native/Unix/CMakeLists.txt +++ b/src/libraries/Native/Unix/CMakeLists.txt @@ -16,7 +16,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") set(CMAKE_SHARED_LIBRARY_PREFIX "") set(VERSION_FILE_PATH "${CMAKE_BINARY_DIR}/version.c") -# We mark the function which needs exporting with DLLEXPORT +# We mark the function which needs exporting with PALEXPORT add_compile_options(-fvisibility=hidden) add_compile_options(-Wno-format-nonliteral) diff --git a/src/libraries/Native/Unix/Common/pal_compiler.h b/src/libraries/Native/Unix/Common/pal_compiler.h index cb22fc1..52471c6 100644 --- a/src/libraries/Native/Unix/Common/pal_compiler.h +++ b/src/libraries/Native/Unix/Common/pal_compiler.h @@ -19,4 +19,6 @@ #define c_static_assert(e) c_static_assert_msg(e, "") #endif -#define DLLEXPORT __attribute__ ((__visibility__ ("default"))) +#ifndef PALEXPORT +#define PALEXPORT __attribute__ ((__visibility__ ("default"))) +#endif // ifndef PALEXPORT diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_calendarData.c b/src/libraries/Native/Unix/System.Globalization.Native/pal_calendarData.c index 68005cb..10bdcfa 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_calendarData.c +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_calendarData.c @@ -7,6 +7,8 @@ #include #include +#include "pal_locale_internal.h" +#include "pal_errors_internal.h" #include "pal_calendarData.h" #define GREGORIAN_NAME "gregorian" diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_calendarData.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_calendarData.h index e0d5ac5..77e8a75 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_calendarData.h +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_calendarData.h @@ -2,10 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#pragma once + #include -#include "pal_compiler.h" #include "pal_locale.h" +#include "pal_compiler.h" #include "pal_errors.h" /* @@ -68,25 +70,25 @@ typedef enum // the function pointer definition for the callback used in EnumCalendarInfo typedef void (*EnumCalendarInfoCallback)(const UChar*, const void*); -DLLEXPORT int32_t GlobalizationNative_GetCalendars(const UChar* localeName, +PALEXPORT int32_t GlobalizationNative_GetCalendars(const UChar* localeName, CalendarId* calendars, int32_t calendarsCapacity); -DLLEXPORT ResultCode GlobalizationNative_GetCalendarInfo(const UChar* localeName, +PALEXPORT ResultCode GlobalizationNative_GetCalendarInfo(const UChar* localeName, CalendarId calendarId, CalendarDataType dataType, UChar* result, int32_t resultCapacity); -DLLEXPORT int32_t GlobalizationNative_EnumCalendarInfo(EnumCalendarInfoCallback callback, +PALEXPORT int32_t GlobalizationNative_EnumCalendarInfo(EnumCalendarInfoCallback callback, const UChar* localeName, CalendarId calendarId, CalendarDataType dataType, const void* context); -DLLEXPORT int32_t GlobalizationNative_GetLatestJapaneseEra(void); +PALEXPORT int32_t GlobalizationNative_GetLatestJapaneseEra(void); -DLLEXPORT int32_t GlobalizationNative_GetJapaneseEraStartDate(int32_t era, +PALEXPORT int32_t GlobalizationNative_GetJapaneseEraStartDate(int32_t era, int32_t* startYear, int32_t* startMonth, int32_t* startDay); diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_casing.c b/src/libraries/Native/Unix/System.Globalization.Native/pal_casing.c index 3535423..2e90f14 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_casing.c +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_casing.c @@ -6,8 +6,8 @@ #include #include +#include "pal_icushim_internal.h" #include "pal_casing.h" -#include "pal_icushim.h" // Workaround for warnings produced by U16_NEXT and U16_APPEND macro expansions #pragma clang diagnostic push diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_casing.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_casing.h index 3ea29dd..8b790b3 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_casing.h +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_casing.h @@ -2,22 +2,22 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#include "pal_compiler.h" #include "pal_locale.h" +#include "pal_compiler.h" -DLLEXPORT void GlobalizationNative_ChangeCase(const UChar* lpSrc, +PALEXPORT void GlobalizationNative_ChangeCase(const UChar* lpSrc, int32_t cwSrcLength, UChar* lpDst, int32_t cwDstLength, int32_t bToUpper); -DLLEXPORT void GlobalizationNative_ChangeCaseInvariant(const UChar* lpSrc, +PALEXPORT void GlobalizationNative_ChangeCaseInvariant(const UChar* lpSrc, int32_t cwSrcLength, UChar* lpDst, int32_t cwDstLength, int32_t bToUpper); -DLLEXPORT void GlobalizationNative_ChangeCaseTurkish(const UChar* lpSrc, +PALEXPORT void GlobalizationNative_ChangeCaseTurkish(const UChar* lpSrc, int32_t cwSrcLength, UChar* lpDst, int32_t cwDstLength, diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_collation.c b/src/libraries/Native/Unix/System.Globalization.Native/pal_collation.c index 4b07e75..c5ba1ca 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_collation.c +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_collation.c @@ -10,6 +10,7 @@ #include #include +#include "pal_errors_internal.h" #include "pal_collation.h" c_static_assert_msg(UCOL_EQUAL == 0, "managed side requires 0 for equal strings"); diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_collation.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_collation.h index 482a59a..dd2fcc4 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_collation.h +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_collation.h @@ -2,26 +2,28 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#include "pal_compiler.h" +#pragma once + #include "pal_locale.h" +#include "pal_compiler.h" #include "pal_errors.h" typedef struct SortHandle SortHandle; -DLLEXPORT ResultCode GlobalizationNative_GetSortHandle(const char* lpLocaleName, SortHandle** ppSortHandle); +PALEXPORT ResultCode GlobalizationNative_GetSortHandle(const char* lpLocaleName, SortHandle** ppSortHandle); -DLLEXPORT void GlobalizationNative_CloseSortHandle(SortHandle* pSortHandle); +PALEXPORT void GlobalizationNative_CloseSortHandle(SortHandle* pSortHandle); -DLLEXPORT int32_t GlobalizationNative_GetSortVersion(SortHandle* pSortHandle); +PALEXPORT int32_t GlobalizationNative_GetSortVersion(SortHandle* pSortHandle); -DLLEXPORT int32_t GlobalizationNative_CompareString(SortHandle* pSortHandle, +PALEXPORT int32_t GlobalizationNative_CompareString(SortHandle* pSortHandle, const UChar* lpStr1, int32_t cwStr1Length, const UChar* lpStr2, int32_t cwStr2Length, int32_t options); -DLLEXPORT int32_t GlobalizationNative_IndexOf(SortHandle* pSortHandle, +PALEXPORT int32_t GlobalizationNative_IndexOf(SortHandle* pSortHandle, const UChar* lpTarget, int32_t cwTargetLength, const UChar* lpSource, @@ -29,41 +31,41 @@ DLLEXPORT int32_t GlobalizationNative_IndexOf(SortHandle* pSortHandle, int32_t options, int32_t* pMatchedLength); -DLLEXPORT int32_t GlobalizationNative_LastIndexOf(SortHandle* pSortHandle, +PALEXPORT int32_t GlobalizationNative_LastIndexOf(SortHandle* pSortHandle, const UChar* lpTarget, int32_t cwTargetLength, const UChar* lpSource, int32_t cwSourceLength, int32_t options); -DLLEXPORT int32_t GlobalizationNative_IndexOfOrdinalIgnoreCase(const UChar* lpTarget, +PALEXPORT int32_t GlobalizationNative_IndexOfOrdinalIgnoreCase(const UChar* lpTarget, int32_t cwTargetLength, const UChar* lpSource, int32_t cwSourceLength, int32_t findLast); -DLLEXPORT int32_t GlobalizationNative_StartsWith(SortHandle* pSortHandle, +PALEXPORT int32_t GlobalizationNative_StartsWith(SortHandle* pSortHandle, const UChar* lpTarget, int32_t cwTargetLength, const UChar* lpSource, int32_t cwSourceLength, int32_t options); -DLLEXPORT int32_t GlobalizationNative_EndsWith(SortHandle* pSortHandle, +PALEXPORT int32_t GlobalizationNative_EndsWith(SortHandle* pSortHandle, const UChar* lpTarget, int32_t cwTargetLength, const UChar* lpSource, int32_t cwSourceLength, int32_t options); -DLLEXPORT int32_t GlobalizationNative_GetSortKey(SortHandle* pSortHandle, +PALEXPORT int32_t GlobalizationNative_GetSortKey(SortHandle* pSortHandle, const UChar* lpStr, int32_t cwStrLength, uint8_t* sortKey, int32_t cbSortKeyLength, int32_t options); -DLLEXPORT int32_t GlobalizationNative_CompareStringOrdinalIgnoreCase(const UChar* lpStr1, +PALEXPORT int32_t GlobalizationNative_CompareStringOrdinalIgnoreCase(const UChar* lpStr1, int32_t cwStr1Length, const UChar* lpStr2, int32_t cwStr2Length); diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_errors.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_errors.h index 55d9ca0..8ef1e62 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_errors.h +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_errors.h @@ -4,8 +4,6 @@ #pragma once -#include "pal_compiler.h" - /* * These values should be kept in sync with * Interop.GlobalizationInterop.ResultCode @@ -17,26 +15,3 @@ typedef enum InsufficentBuffer = 2, OutOfMemory = 3 } ResultCode; - -/* -Converts a UErrorCode to a ResultCode. -*/ -static ResultCode GetResultCode(UErrorCode err) -{ - if (err == U_BUFFER_OVERFLOW_ERROR || err == U_STRING_NOT_TERMINATED_WARNING) - { - return InsufficentBuffer; - } - - if (err == U_MEMORY_ALLOCATION_ERROR) - { - return OutOfMemory; - } - - if (U_SUCCESS(err)) - { - return Success; - } - - return UnknownError; -} diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_errors_internal.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_errors_internal.h new file mode 100644 index 0000000..a0b1447 --- /dev/null +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_errors_internal.h @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#pragma once + +#include "pal_icushim_internal.h" +#include "pal_errors.h" + +/* +Converts a UErrorCode to a ResultCode. +*/ +static ResultCode GetResultCode(UErrorCode err) +{ + if (err == U_BUFFER_OVERFLOW_ERROR || err == U_STRING_NOT_TERMINATED_WARNING) + { + return InsufficentBuffer; + } + + if (err == U_MEMORY_ALLOCATION_ERROR) + { + return OutOfMemory; + } + + if (U_SUCCESS(err)) + { + return Success; + } + + return UnknownError; +} diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.c b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.c index a71c47a..bb418e8 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.c +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.c @@ -9,6 +9,7 @@ #include #include +#include "pal_icushim_internal.h" #include "pal_icushim.h" // Define pointers to all the used ICU functions diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.h index fff2364..49db552 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.h +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.h @@ -1,245 +1,8 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -// - -// Enable calling ICU functions through shims to enable support for -// multiple versions of ICU. #pragma once -#include "config.h" #include "pal_compiler.h" -#define U_DISABLE_RENAMING 1 - -// All ICU headers need to be included here so that all function prototypes are -// available before the function pointers are declared below. -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// List of all functions from the ICU libraries that are used in the System.Globalization.Native.so -#define FOR_ALL_UNCONDITIONAL_ICU_FUNCTIONS \ - PER_FUNCTION_BLOCK(u_charsToUChars, libicuuc) \ - PER_FUNCTION_BLOCK(u_getVersion, libicuuc) \ - PER_FUNCTION_BLOCK(u_strlen, libicuuc) \ - PER_FUNCTION_BLOCK(u_strncpy, libicuuc) \ - PER_FUNCTION_BLOCK(u_tolower, libicuuc) \ - PER_FUNCTION_BLOCK(u_toupper, libicuuc) \ - PER_FUNCTION_BLOCK(ucal_add, libicui18n) \ - PER_FUNCTION_BLOCK(ucal_close, libicui18n) \ - PER_FUNCTION_BLOCK(ucal_get, libicui18n) \ - PER_FUNCTION_BLOCK(ucal_getAttribute, libicui18n) \ - PER_FUNCTION_BLOCK(ucal_getKeywordValuesForLocale, libicui18n) \ - PER_FUNCTION_BLOCK(ucal_getLimit, libicui18n) \ - PER_FUNCTION_BLOCK(ucal_getTimeZoneDisplayName, libicui18n) \ - PER_FUNCTION_BLOCK(ucal_open, libicui18n) \ - PER_FUNCTION_BLOCK(ucal_set, libicui18n) \ - PER_FUNCTION_BLOCK(ucol_close, libicui18n) \ - PER_FUNCTION_BLOCK(ucol_closeElements, libicui18n) \ - PER_FUNCTION_BLOCK(ucol_getRules, libicui18n) \ - PER_FUNCTION_BLOCK(ucol_getSortKey, libicui18n) \ - PER_FUNCTION_BLOCK(ucol_getStrength, libicui18n) \ - PER_FUNCTION_BLOCK(ucol_getVersion, libicui18n) \ - PER_FUNCTION_BLOCK(ucol_next, libicui18n) \ - PER_FUNCTION_BLOCK(ucol_previous, libicui18n) \ - PER_FUNCTION_BLOCK(ucol_open, libicui18n) \ - PER_FUNCTION_BLOCK(ucol_openElements, libicui18n) \ - PER_FUNCTION_BLOCK(ucol_openRules, libicui18n) \ - PER_FUNCTION_BLOCK(ucol_safeClone, libicui18n) \ - PER_FUNCTION_BLOCK(ucol_setAttribute, libicui18n) \ - PER_FUNCTION_BLOCK(ucol_strcoll, libicui18n) \ - PER_FUNCTION_BLOCK(ucurr_forLocale, libicui18n) \ - PER_FUNCTION_BLOCK(ucurr_getName, libicui18n) \ - PER_FUNCTION_BLOCK(udat_close, libicui18n) \ - PER_FUNCTION_BLOCK(udat_countSymbols, libicui18n) \ - PER_FUNCTION_BLOCK(udat_getSymbols, libicui18n) \ - PER_FUNCTION_BLOCK(udat_open, libicui18n) \ - PER_FUNCTION_BLOCK(udat_setCalendar, libicui18n) \ - PER_FUNCTION_BLOCK(udat_toPattern, libicui18n) \ - PER_FUNCTION_BLOCK(udatpg_close, libicui18n) \ - PER_FUNCTION_BLOCK(udatpg_getBestPattern, libicui18n) \ - PER_FUNCTION_BLOCK(udatpg_open, libicui18n) \ - PER_FUNCTION_BLOCK(uenum_close, libicuuc) \ - PER_FUNCTION_BLOCK(uenum_count, libicuuc) \ - PER_FUNCTION_BLOCK(uenum_next, libicuuc) \ - PER_FUNCTION_BLOCK(uidna_close, libicuuc) \ - PER_FUNCTION_BLOCK(uidna_nameToASCII, libicuuc) \ - PER_FUNCTION_BLOCK(uidna_nameToUnicode, libicuuc) \ - PER_FUNCTION_BLOCK(uidna_openUTS46, libicuuc) \ - PER_FUNCTION_BLOCK(uldn_close, libicui18n) \ - PER_FUNCTION_BLOCK(uldn_keyValueDisplayName, libicui18n) \ - PER_FUNCTION_BLOCK(uldn_open, libicui18n) \ - PER_FUNCTION_BLOCK(uloc_canonicalize, libicuuc) \ - PER_FUNCTION_BLOCK(uloc_countAvailable, libicuuc) \ - PER_FUNCTION_BLOCK(uloc_getAvailable, libicuuc) \ - PER_FUNCTION_BLOCK(uloc_getBaseName, libicuuc) \ - PER_FUNCTION_BLOCK(uloc_getCharacterOrientation, libicuuc) \ - PER_FUNCTION_BLOCK(uloc_getCountry, libicuuc) \ - PER_FUNCTION_BLOCK(uloc_getDefault, libicuuc) \ - PER_FUNCTION_BLOCK(uloc_getDisplayCountry, libicuuc) \ - PER_FUNCTION_BLOCK(uloc_getDisplayLanguage, libicuuc) \ - PER_FUNCTION_BLOCK(uloc_getDisplayName, libicuuc) \ - PER_FUNCTION_BLOCK(uloc_getISO3Country, libicuuc) \ - PER_FUNCTION_BLOCK(uloc_getISO3Language, libicuuc) \ - PER_FUNCTION_BLOCK(uloc_getKeywordValue, libicuuc) \ - PER_FUNCTION_BLOCK(uloc_getLanguage, libicuuc) \ - PER_FUNCTION_BLOCK(uloc_getLCID, libicuuc) \ - PER_FUNCTION_BLOCK(uloc_getName, libicuuc) \ - PER_FUNCTION_BLOCK(uloc_getParent, libicuuc) \ - PER_FUNCTION_BLOCK(uloc_setKeywordValue, libicuuc) \ - PER_FUNCTION_BLOCK(ulocdata_getMeasurementSystem, libicui18n) \ - PER_FUNCTION_BLOCK(unorm2_getNFCInstance, libicuuc) \ - PER_FUNCTION_BLOCK(unorm2_getNFDInstance, libicuuc) \ - PER_FUNCTION_BLOCK(unorm2_getNFKCInstance, libicuuc) \ - PER_FUNCTION_BLOCK(unorm2_getNFKDInstance, libicuuc) \ - PER_FUNCTION_BLOCK(unorm2_isNormalized, libicuuc) \ - PER_FUNCTION_BLOCK(unorm2_normalize, libicuuc) \ - PER_FUNCTION_BLOCK(unum_close, libicui18n) \ - PER_FUNCTION_BLOCK(unum_getAttribute, libicui18n) \ - PER_FUNCTION_BLOCK(unum_getSymbol, libicui18n) \ - PER_FUNCTION_BLOCK(unum_open, libicui18n) \ - PER_FUNCTION_BLOCK(unum_toPattern, libicui18n) \ - PER_FUNCTION_BLOCK(ures_close, libicuuc) \ - PER_FUNCTION_BLOCK(ures_getByKey, libicuuc) \ - PER_FUNCTION_BLOCK(ures_getSize, libicuuc) \ - PER_FUNCTION_BLOCK(ures_getStringByIndex, libicuuc) \ - PER_FUNCTION_BLOCK(ures_open, libicuuc) \ - PER_FUNCTION_BLOCK(usearch_close, libicui18n) \ - PER_FUNCTION_BLOCK(usearch_first, libicui18n) \ - PER_FUNCTION_BLOCK(usearch_getMatchedLength, libicui18n) \ - PER_FUNCTION_BLOCK(usearch_last, libicui18n) \ - PER_FUNCTION_BLOCK(usearch_openFromCollator, libicui18n) - -#if HAVE_SET_MAX_VARIABLE -#define FOR_ALL_ICU_FUNCTIONS \ - FOR_ALL_UNCONDITIONAL_ICU_FUNCTIONS \ - PER_FUNCTION_BLOCK(ucol_setMaxVariable, libicui18n) -#else -#define FOR_ALL_ICU_FUNCTIONS \ - FOR_ALL_UNCONDITIONAL_ICU_FUNCTIONS \ - PER_FUNCTION_BLOCK(ucol_setVariableTop, libicui18n) -#endif - -// Declare pointers to all the used ICU functions -#define PER_FUNCTION_BLOCK(fn, lib) extern __typeof(fn)* fn##_ptr; -FOR_ALL_ICU_FUNCTIONS -#undef PER_FUNCTION_BLOCK - -// Redefine all calls to ICU functions as calls through pointers that are set -// to the functions of the selected version of ICU in the initialization. -#define u_charsToUChars(...) u_charsToUChars_ptr(__VA_ARGS__) -#define u_getVersion(...) u_getVersion_ptr(__VA_ARGS__) -#define u_strlen(...) u_strlen_ptr(__VA_ARGS__) -#define u_strncpy(...) u_strncpy_ptr(__VA_ARGS__) -#define u_tolower(...) u_tolower_ptr(__VA_ARGS__) -#define u_toupper(...) u_toupper_ptr(__VA_ARGS__) -#define ucal_add(...) ucal_add_ptr(__VA_ARGS__) -#define ucal_close(...) ucal_close_ptr(__VA_ARGS__) -#define ucal_get(...) ucal_get_ptr(__VA_ARGS__) -#define ucal_getAttribute(...) ucal_getAttribute_ptr(__VA_ARGS__) -#define ucal_getKeywordValuesForLocale(...) ucal_getKeywordValuesForLocale_ptr(__VA_ARGS__) -#define ucal_getLimit(...) ucal_getLimit_ptr(__VA_ARGS__) -#define ucal_getTimeZoneDisplayName(...) ucal_getTimeZoneDisplayName_ptr(__VA_ARGS__) -#define ucal_open(...) ucal_open_ptr(__VA_ARGS__) -#define ucal_set(...) ucal_set_ptr(__VA_ARGS__) -#define ucol_close(...) ucol_close_ptr(__VA_ARGS__) -#define ucol_closeElements(...) ucol_closeElements_ptr(__VA_ARGS__) -#define ucol_getRules(...) ucol_getRules_ptr(__VA_ARGS__) -#define ucol_getSortKey(...) ucol_getSortKey_ptr(__VA_ARGS__) -#define ucol_getStrength(...) ucol_getStrength_ptr(__VA_ARGS__) -#define ucol_getVersion(...) ucol_getVersion_ptr(__VA_ARGS__) -#define ucol_next(...) ucol_next_ptr(__VA_ARGS__) -#define ucol_previous(...) ucol_previous_ptr(__VA_ARGS__) -#define ucol_open(...) ucol_open_ptr(__VA_ARGS__) -#define ucol_openElements(...) ucol_openElements_ptr(__VA_ARGS__) -#define ucol_openRules(...) ucol_openRules_ptr(__VA_ARGS__) -#define ucol_safeClone(...) ucol_safeClone_ptr(__VA_ARGS__) -#define ucol_setAttribute(...) ucol_setAttribute_ptr(__VA_ARGS__) -#if HAVE_SET_MAX_VARIABLE -#define ucol_setMaxVariable(...) ucol_setMaxVariable_ptr(__VA_ARGS__) -#else -#define ucol_setVariableTop(...) ucol_setVariableTop_ptr(__VA_ARGS__) -#endif -#define ucol_strcoll(...) ucol_strcoll_ptr(__VA_ARGS__) -#define ucurr_forLocale(...) ucurr_forLocale_ptr(__VA_ARGS__) -#define ucurr_getName(...) ucurr_getName_ptr(__VA_ARGS__) -#define udat_close(...) udat_close_ptr(__VA_ARGS__) -#define udat_countSymbols(...) udat_countSymbols_ptr(__VA_ARGS__) -#define udat_getSymbols(...) udat_getSymbols_ptr(__VA_ARGS__) -#define udat_open(...) udat_open_ptr(__VA_ARGS__) -#define udat_setCalendar(...) udat_setCalendar_ptr(__VA_ARGS__) -#define udat_toPattern(...) udat_toPattern_ptr(__VA_ARGS__) -#define udatpg_close(...) udatpg_close_ptr(__VA_ARGS__) -#define udatpg_getBestPattern(...) udatpg_getBestPattern_ptr(__VA_ARGS__) -#define udatpg_open(...) udatpg_open_ptr(__VA_ARGS__) -#define uenum_close(...) uenum_close_ptr(__VA_ARGS__) -#define uenum_count(...) uenum_count_ptr(__VA_ARGS__) -#define uenum_next(...) uenum_next_ptr(__VA_ARGS__) -#define uidna_close(...) uidna_close_ptr(__VA_ARGS__) -#define uidna_nameToASCII(...) uidna_nameToASCII_ptr(__VA_ARGS__) -#define uidna_nameToUnicode(...) uidna_nameToUnicode_ptr(__VA_ARGS__) -#define uidna_openUTS46(...) uidna_openUTS46_ptr(__VA_ARGS__) -#define uldn_close(...) uldn_close_ptr(__VA_ARGS__) -#define uldn_keyValueDisplayName(...) uldn_keyValueDisplayName_ptr(__VA_ARGS__) -#define uldn_open(...) uldn_open_ptr(__VA_ARGS__) -#define uloc_canonicalize(...) uloc_canonicalize_ptr(__VA_ARGS__) -#define uloc_countAvailable(...) uloc_countAvailable_ptr(__VA_ARGS__) -#define uloc_getAvailable(...) uloc_getAvailable_ptr(__VA_ARGS__) -#define uloc_getBaseName(...) uloc_getBaseName_ptr(__VA_ARGS__) -#define uloc_getCharacterOrientation(...) uloc_getCharacterOrientation_ptr(__VA_ARGS__) -#define uloc_getCountry(...) uloc_getCountry_ptr(__VA_ARGS__) -#define uloc_getDefault(...) uloc_getDefault_ptr(__VA_ARGS__) -#define uloc_getDisplayCountry(...) uloc_getDisplayCountry_ptr(__VA_ARGS__) -#define uloc_getDisplayLanguage(...) uloc_getDisplayLanguage_ptr(__VA_ARGS__) -#define uloc_getDisplayName(...) uloc_getDisplayName_ptr(__VA_ARGS__) -#define uloc_getISO3Country(...) uloc_getISO3Country_ptr(__VA_ARGS__) -#define uloc_getISO3Language(...) uloc_getISO3Language_ptr(__VA_ARGS__) -#define uloc_getKeywordValue(...) uloc_getKeywordValue_ptr(__VA_ARGS__) -#define uloc_getLanguage(...) uloc_getLanguage_ptr(__VA_ARGS__) -#define uloc_getLCID(...) uloc_getLCID_ptr(__VA_ARGS__) -#define uloc_getName(...) uloc_getName_ptr(__VA_ARGS__) -#define uloc_getParent(...) uloc_getParent_ptr(__VA_ARGS__) -#define uloc_setKeywordValue(...) uloc_setKeywordValue_ptr(__VA_ARGS__) -#define ulocdata_getMeasurementSystem(...) ulocdata_getMeasurementSystem_ptr(__VA_ARGS__) -#define unorm2_getNFCInstance(...) unorm2_getNFCInstance_ptr(__VA_ARGS__) -#define unorm2_getNFDInstance(...) unorm2_getNFDInstance_ptr(__VA_ARGS__) -#define unorm2_getNFKCInstance(...) unorm2_getNFKCInstance_ptr(__VA_ARGS__) -#define unorm2_getNFKDInstance(...) unorm2_getNFKDInstance_ptr(__VA_ARGS__) -#define unorm2_isNormalized(...) unorm2_isNormalized_ptr(__VA_ARGS__) -#define unorm2_normalize(...) unorm2_normalize_ptr(__VA_ARGS__) -#define unum_close(...) unum_close_ptr(__VA_ARGS__) -#define unum_getAttribute(...) unum_getAttribute_ptr(__VA_ARGS__) -#define unum_getSymbol(...) unum_getSymbol_ptr(__VA_ARGS__) -#define unum_open(...) unum_open_ptr(__VA_ARGS__) -#define unum_toPattern(...) unum_toPattern_ptr(__VA_ARGS__) -#define ures_close(...) ures_close_ptr(__VA_ARGS__) -#define ures_getByKey(...) ures_getByKey_ptr(__VA_ARGS__) -#define ures_getSize(...) ures_getSize_ptr(__VA_ARGS__) -#define ures_getStringByIndex(...) ures_getStringByIndex_ptr(__VA_ARGS__) -#define ures_open(...) ures_open_ptr(__VA_ARGS__) -#define usearch_close(...) usearch_close_ptr(__VA_ARGS__) -#define usearch_first(...) usearch_first_ptr(__VA_ARGS__) -#define usearch_getMatchedLength(...) usearch_getMatchedLength_ptr(__VA_ARGS__) -#define usearch_last(...) usearch_last_ptr(__VA_ARGS__) -#define usearch_openFromCollator(...) usearch_openFromCollator_ptr(__VA_ARGS__) - -DLLEXPORT int32_t GlobalizationNative_LoadICU(void); +PALEXPORT int32_t GlobalizationNative_LoadICU(void); -DLLEXPORT int32_t GlobalizationNative_GetICUVersion(void); +PALEXPORT int32_t GlobalizationNative_GetICUVersion(void); diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_internal.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_internal.h new file mode 100644 index 0000000..c6a48f9 --- /dev/null +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_internal.h @@ -0,0 +1,240 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// + +// Enable calling ICU functions through shims to enable support for +// multiple versions of ICU. + +#pragma once + +#include "config.h" + +#define U_DISABLE_RENAMING 1 + +// All ICU headers need to be included here so that all function prototypes are +// available before the function pointers are declared below. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// List of all functions from the ICU libraries that are used in the System.Globalization.Native.so +#define FOR_ALL_UNCONDITIONAL_ICU_FUNCTIONS \ + PER_FUNCTION_BLOCK(u_charsToUChars, libicuuc) \ + PER_FUNCTION_BLOCK(u_getVersion, libicuuc) \ + PER_FUNCTION_BLOCK(u_strlen, libicuuc) \ + PER_FUNCTION_BLOCK(u_strncpy, libicuuc) \ + PER_FUNCTION_BLOCK(u_tolower, libicuuc) \ + PER_FUNCTION_BLOCK(u_toupper, libicuuc) \ + PER_FUNCTION_BLOCK(ucal_add, libicui18n) \ + PER_FUNCTION_BLOCK(ucal_close, libicui18n) \ + PER_FUNCTION_BLOCK(ucal_get, libicui18n) \ + PER_FUNCTION_BLOCK(ucal_getAttribute, libicui18n) \ + PER_FUNCTION_BLOCK(ucal_getKeywordValuesForLocale, libicui18n) \ + PER_FUNCTION_BLOCK(ucal_getLimit, libicui18n) \ + PER_FUNCTION_BLOCK(ucal_getTimeZoneDisplayName, libicui18n) \ + PER_FUNCTION_BLOCK(ucal_open, libicui18n) \ + PER_FUNCTION_BLOCK(ucal_set, libicui18n) \ + PER_FUNCTION_BLOCK(ucol_close, libicui18n) \ + PER_FUNCTION_BLOCK(ucol_closeElements, libicui18n) \ + PER_FUNCTION_BLOCK(ucol_getRules, libicui18n) \ + PER_FUNCTION_BLOCK(ucol_getSortKey, libicui18n) \ + PER_FUNCTION_BLOCK(ucol_getStrength, libicui18n) \ + PER_FUNCTION_BLOCK(ucol_getVersion, libicui18n) \ + PER_FUNCTION_BLOCK(ucol_next, libicui18n) \ + PER_FUNCTION_BLOCK(ucol_previous, libicui18n) \ + PER_FUNCTION_BLOCK(ucol_open, libicui18n) \ + PER_FUNCTION_BLOCK(ucol_openElements, libicui18n) \ + PER_FUNCTION_BLOCK(ucol_openRules, libicui18n) \ + PER_FUNCTION_BLOCK(ucol_safeClone, libicui18n) \ + PER_FUNCTION_BLOCK(ucol_setAttribute, libicui18n) \ + PER_FUNCTION_BLOCK(ucol_strcoll, libicui18n) \ + PER_FUNCTION_BLOCK(ucurr_forLocale, libicui18n) \ + PER_FUNCTION_BLOCK(ucurr_getName, libicui18n) \ + PER_FUNCTION_BLOCK(udat_close, libicui18n) \ + PER_FUNCTION_BLOCK(udat_countSymbols, libicui18n) \ + PER_FUNCTION_BLOCK(udat_getSymbols, libicui18n) \ + PER_FUNCTION_BLOCK(udat_open, libicui18n) \ + PER_FUNCTION_BLOCK(udat_setCalendar, libicui18n) \ + PER_FUNCTION_BLOCK(udat_toPattern, libicui18n) \ + PER_FUNCTION_BLOCK(udatpg_close, libicui18n) \ + PER_FUNCTION_BLOCK(udatpg_getBestPattern, libicui18n) \ + PER_FUNCTION_BLOCK(udatpg_open, libicui18n) \ + PER_FUNCTION_BLOCK(uenum_close, libicuuc) \ + PER_FUNCTION_BLOCK(uenum_count, libicuuc) \ + PER_FUNCTION_BLOCK(uenum_next, libicuuc) \ + PER_FUNCTION_BLOCK(uidna_close, libicuuc) \ + PER_FUNCTION_BLOCK(uidna_nameToASCII, libicuuc) \ + PER_FUNCTION_BLOCK(uidna_nameToUnicode, libicuuc) \ + PER_FUNCTION_BLOCK(uidna_openUTS46, libicuuc) \ + PER_FUNCTION_BLOCK(uldn_close, libicui18n) \ + PER_FUNCTION_BLOCK(uldn_keyValueDisplayName, libicui18n) \ + PER_FUNCTION_BLOCK(uldn_open, libicui18n) \ + PER_FUNCTION_BLOCK(uloc_canonicalize, libicuuc) \ + PER_FUNCTION_BLOCK(uloc_countAvailable, libicuuc) \ + PER_FUNCTION_BLOCK(uloc_getAvailable, libicuuc) \ + PER_FUNCTION_BLOCK(uloc_getBaseName, libicuuc) \ + PER_FUNCTION_BLOCK(uloc_getCharacterOrientation, libicuuc) \ + PER_FUNCTION_BLOCK(uloc_getCountry, libicuuc) \ + PER_FUNCTION_BLOCK(uloc_getDefault, libicuuc) \ + PER_FUNCTION_BLOCK(uloc_getDisplayCountry, libicuuc) \ + PER_FUNCTION_BLOCK(uloc_getDisplayLanguage, libicuuc) \ + PER_FUNCTION_BLOCK(uloc_getDisplayName, libicuuc) \ + PER_FUNCTION_BLOCK(uloc_getISO3Country, libicuuc) \ + PER_FUNCTION_BLOCK(uloc_getISO3Language, libicuuc) \ + PER_FUNCTION_BLOCK(uloc_getKeywordValue, libicuuc) \ + PER_FUNCTION_BLOCK(uloc_getLanguage, libicuuc) \ + PER_FUNCTION_BLOCK(uloc_getLCID, libicuuc) \ + PER_FUNCTION_BLOCK(uloc_getName, libicuuc) \ + PER_FUNCTION_BLOCK(uloc_getParent, libicuuc) \ + PER_FUNCTION_BLOCK(uloc_setKeywordValue, libicuuc) \ + PER_FUNCTION_BLOCK(ulocdata_getMeasurementSystem, libicui18n) \ + PER_FUNCTION_BLOCK(unorm2_getNFCInstance, libicuuc) \ + PER_FUNCTION_BLOCK(unorm2_getNFDInstance, libicuuc) \ + PER_FUNCTION_BLOCK(unorm2_getNFKCInstance, libicuuc) \ + PER_FUNCTION_BLOCK(unorm2_getNFKDInstance, libicuuc) \ + PER_FUNCTION_BLOCK(unorm2_isNormalized, libicuuc) \ + PER_FUNCTION_BLOCK(unorm2_normalize, libicuuc) \ + PER_FUNCTION_BLOCK(unum_close, libicui18n) \ + PER_FUNCTION_BLOCK(unum_getAttribute, libicui18n) \ + PER_FUNCTION_BLOCK(unum_getSymbol, libicui18n) \ + PER_FUNCTION_BLOCK(unum_open, libicui18n) \ + PER_FUNCTION_BLOCK(unum_toPattern, libicui18n) \ + PER_FUNCTION_BLOCK(ures_close, libicuuc) \ + PER_FUNCTION_BLOCK(ures_getByKey, libicuuc) \ + PER_FUNCTION_BLOCK(ures_getSize, libicuuc) \ + PER_FUNCTION_BLOCK(ures_getStringByIndex, libicuuc) \ + PER_FUNCTION_BLOCK(ures_open, libicuuc) \ + PER_FUNCTION_BLOCK(usearch_close, libicui18n) \ + PER_FUNCTION_BLOCK(usearch_first, libicui18n) \ + PER_FUNCTION_BLOCK(usearch_getMatchedLength, libicui18n) \ + PER_FUNCTION_BLOCK(usearch_last, libicui18n) \ + PER_FUNCTION_BLOCK(usearch_openFromCollator, libicui18n) + +#if HAVE_SET_MAX_VARIABLE +#define FOR_ALL_ICU_FUNCTIONS \ + FOR_ALL_UNCONDITIONAL_ICU_FUNCTIONS \ + PER_FUNCTION_BLOCK(ucol_setMaxVariable, libicui18n) +#else +#define FOR_ALL_ICU_FUNCTIONS \ + FOR_ALL_UNCONDITIONAL_ICU_FUNCTIONS \ + PER_FUNCTION_BLOCK(ucol_setVariableTop, libicui18n) +#endif + +// Declare pointers to all the used ICU functions +#define PER_FUNCTION_BLOCK(fn, lib) extern __typeof(fn)* fn##_ptr; +FOR_ALL_ICU_FUNCTIONS +#undef PER_FUNCTION_BLOCK + +// Redefine all calls to ICU functions as calls through pointers that are set +// to the functions of the selected version of ICU in the initialization. +#define u_charsToUChars(...) u_charsToUChars_ptr(__VA_ARGS__) +#define u_getVersion(...) u_getVersion_ptr(__VA_ARGS__) +#define u_strlen(...) u_strlen_ptr(__VA_ARGS__) +#define u_strncpy(...) u_strncpy_ptr(__VA_ARGS__) +#define u_tolower(...) u_tolower_ptr(__VA_ARGS__) +#define u_toupper(...) u_toupper_ptr(__VA_ARGS__) +#define ucal_add(...) ucal_add_ptr(__VA_ARGS__) +#define ucal_close(...) ucal_close_ptr(__VA_ARGS__) +#define ucal_get(...) ucal_get_ptr(__VA_ARGS__) +#define ucal_getAttribute(...) ucal_getAttribute_ptr(__VA_ARGS__) +#define ucal_getKeywordValuesForLocale(...) ucal_getKeywordValuesForLocale_ptr(__VA_ARGS__) +#define ucal_getLimit(...) ucal_getLimit_ptr(__VA_ARGS__) +#define ucal_getTimeZoneDisplayName(...) ucal_getTimeZoneDisplayName_ptr(__VA_ARGS__) +#define ucal_open(...) ucal_open_ptr(__VA_ARGS__) +#define ucal_set(...) ucal_set_ptr(__VA_ARGS__) +#define ucol_close(...) ucol_close_ptr(__VA_ARGS__) +#define ucol_closeElements(...) ucol_closeElements_ptr(__VA_ARGS__) +#define ucol_getRules(...) ucol_getRules_ptr(__VA_ARGS__) +#define ucol_getSortKey(...) ucol_getSortKey_ptr(__VA_ARGS__) +#define ucol_getStrength(...) ucol_getStrength_ptr(__VA_ARGS__) +#define ucol_getVersion(...) ucol_getVersion_ptr(__VA_ARGS__) +#define ucol_next(...) ucol_next_ptr(__VA_ARGS__) +#define ucol_previous(...) ucol_previous_ptr(__VA_ARGS__) +#define ucol_open(...) ucol_open_ptr(__VA_ARGS__) +#define ucol_openElements(...) ucol_openElements_ptr(__VA_ARGS__) +#define ucol_openRules(...) ucol_openRules_ptr(__VA_ARGS__) +#define ucol_safeClone(...) ucol_safeClone_ptr(__VA_ARGS__) +#define ucol_setAttribute(...) ucol_setAttribute_ptr(__VA_ARGS__) +#if HAVE_SET_MAX_VARIABLE +#define ucol_setMaxVariable(...) ucol_setMaxVariable_ptr(__VA_ARGS__) +#else +#define ucol_setVariableTop(...) ucol_setVariableTop_ptr(__VA_ARGS__) +#endif +#define ucol_strcoll(...) ucol_strcoll_ptr(__VA_ARGS__) +#define ucurr_forLocale(...) ucurr_forLocale_ptr(__VA_ARGS__) +#define ucurr_getName(...) ucurr_getName_ptr(__VA_ARGS__) +#define udat_close(...) udat_close_ptr(__VA_ARGS__) +#define udat_countSymbols(...) udat_countSymbols_ptr(__VA_ARGS__) +#define udat_getSymbols(...) udat_getSymbols_ptr(__VA_ARGS__) +#define udat_open(...) udat_open_ptr(__VA_ARGS__) +#define udat_setCalendar(...) udat_setCalendar_ptr(__VA_ARGS__) +#define udat_toPattern(...) udat_toPattern_ptr(__VA_ARGS__) +#define udatpg_close(...) udatpg_close_ptr(__VA_ARGS__) +#define udatpg_getBestPattern(...) udatpg_getBestPattern_ptr(__VA_ARGS__) +#define udatpg_open(...) udatpg_open_ptr(__VA_ARGS__) +#define uenum_close(...) uenum_close_ptr(__VA_ARGS__) +#define uenum_count(...) uenum_count_ptr(__VA_ARGS__) +#define uenum_next(...) uenum_next_ptr(__VA_ARGS__) +#define uidna_close(...) uidna_close_ptr(__VA_ARGS__) +#define uidna_nameToASCII(...) uidna_nameToASCII_ptr(__VA_ARGS__) +#define uidna_nameToUnicode(...) uidna_nameToUnicode_ptr(__VA_ARGS__) +#define uidna_openUTS46(...) uidna_openUTS46_ptr(__VA_ARGS__) +#define uldn_close(...) uldn_close_ptr(__VA_ARGS__) +#define uldn_keyValueDisplayName(...) uldn_keyValueDisplayName_ptr(__VA_ARGS__) +#define uldn_open(...) uldn_open_ptr(__VA_ARGS__) +#define uloc_canonicalize(...) uloc_canonicalize_ptr(__VA_ARGS__) +#define uloc_countAvailable(...) uloc_countAvailable_ptr(__VA_ARGS__) +#define uloc_getAvailable(...) uloc_getAvailable_ptr(__VA_ARGS__) +#define uloc_getBaseName(...) uloc_getBaseName_ptr(__VA_ARGS__) +#define uloc_getCharacterOrientation(...) uloc_getCharacterOrientation_ptr(__VA_ARGS__) +#define uloc_getCountry(...) uloc_getCountry_ptr(__VA_ARGS__) +#define uloc_getDefault(...) uloc_getDefault_ptr(__VA_ARGS__) +#define uloc_getDisplayCountry(...) uloc_getDisplayCountry_ptr(__VA_ARGS__) +#define uloc_getDisplayLanguage(...) uloc_getDisplayLanguage_ptr(__VA_ARGS__) +#define uloc_getDisplayName(...) uloc_getDisplayName_ptr(__VA_ARGS__) +#define uloc_getISO3Country(...) uloc_getISO3Country_ptr(__VA_ARGS__) +#define uloc_getISO3Language(...) uloc_getISO3Language_ptr(__VA_ARGS__) +#define uloc_getKeywordValue(...) uloc_getKeywordValue_ptr(__VA_ARGS__) +#define uloc_getLanguage(...) uloc_getLanguage_ptr(__VA_ARGS__) +#define uloc_getLCID(...) uloc_getLCID_ptr(__VA_ARGS__) +#define uloc_getName(...) uloc_getName_ptr(__VA_ARGS__) +#define uloc_getParent(...) uloc_getParent_ptr(__VA_ARGS__) +#define uloc_setKeywordValue(...) uloc_setKeywordValue_ptr(__VA_ARGS__) +#define ulocdata_getMeasurementSystem(...) ulocdata_getMeasurementSystem_ptr(__VA_ARGS__) +#define unorm2_getNFCInstance(...) unorm2_getNFCInstance_ptr(__VA_ARGS__) +#define unorm2_getNFDInstance(...) unorm2_getNFDInstance_ptr(__VA_ARGS__) +#define unorm2_getNFKCInstance(...) unorm2_getNFKCInstance_ptr(__VA_ARGS__) +#define unorm2_getNFKDInstance(...) unorm2_getNFKDInstance_ptr(__VA_ARGS__) +#define unorm2_isNormalized(...) unorm2_isNormalized_ptr(__VA_ARGS__) +#define unorm2_normalize(...) unorm2_normalize_ptr(__VA_ARGS__) +#define unum_close(...) unum_close_ptr(__VA_ARGS__) +#define unum_getAttribute(...) unum_getAttribute_ptr(__VA_ARGS__) +#define unum_getSymbol(...) unum_getSymbol_ptr(__VA_ARGS__) +#define unum_open(...) unum_open_ptr(__VA_ARGS__) +#define unum_toPattern(...) unum_toPattern_ptr(__VA_ARGS__) +#define ures_close(...) ures_close_ptr(__VA_ARGS__) +#define ures_getByKey(...) ures_getByKey_ptr(__VA_ARGS__) +#define ures_getSize(...) ures_getSize_ptr(__VA_ARGS__) +#define ures_getStringByIndex(...) ures_getStringByIndex_ptr(__VA_ARGS__) +#define ures_open(...) ures_open_ptr(__VA_ARGS__) +#define usearch_close(...) usearch_close_ptr(__VA_ARGS__) +#define usearch_first(...) usearch_first_ptr(__VA_ARGS__) +#define usearch_getMatchedLength(...) usearch_getMatchedLength_ptr(__VA_ARGS__) +#define usearch_last(...) usearch_last_ptr(__VA_ARGS__) +#define usearch_openFromCollator(...) usearch_openFromCollator_ptr(__VA_ARGS__) diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_idna.c b/src/libraries/Native/Unix/System.Globalization.Native/pal_idna.c index 6ce504d..97fe231 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_idna.c +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_idna.c @@ -5,7 +5,7 @@ #include -#include "pal_icushim.h" +#include "pal_icushim_internal.h" #include "pal_idna.h" static const uint32_t AllowUnassigned = 0x1; diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_idna.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_idna.h index f2228cb..b7cf6fa 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_idna.h +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_idna.h @@ -3,16 +3,18 @@ // See the LICENSE file in the project root for more information. // -#include "pal_compiler.h" +#pragma once + #include "pal_locale.h" +#include "pal_compiler.h" -DLLEXPORT int32_t GlobalizationNative_ToAscii(uint32_t flags, +PALEXPORT int32_t GlobalizationNative_ToAscii(uint32_t flags, const UChar* lpSrc, int32_t cwSrcLength, UChar* lpDst, int32_t cwDstLength); -DLLEXPORT int32_t GlobalizationNative_ToUnicode(uint32_t flags, +PALEXPORT int32_t GlobalizationNative_ToUnicode(uint32_t flags, const UChar* lpSrc, int32_t cwSrcLength, UChar* lpDst, diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_locale.c b/src/libraries/Native/Unix/System.Globalization.Native/pal_locale.c index ffbeef3..8dab4d9 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_locale.c +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_locale.c @@ -9,6 +9,7 @@ #include #include +#include "pal_locale_internal.h" #include "pal_locale.h" int32_t UErrorCodeToBool(UErrorCode status) diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_locale.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_locale.h index f771954..4f7dd55 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_locale.h +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_locale.h @@ -2,59 +2,14 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#include "pal_icushim.h" +#pragma once -/* -Function: -UErrorCodeToBool +#include "pal_compiler.h" -Convert an ICU UErrorCode to a Bool compatible with Win32 -Returns 1 for success, 0 otherwise -*/ -int32_t UErrorCodeToBool(UErrorCode code); +PALEXPORT int32_t GlobalizationNative_GetLocales(UChar *value, int32_t valueLength); -/* -Function: -GetLocale +PALEXPORT int32_t GlobalizationNative_GetLocaleName(const UChar* localeName, UChar* value, int32_t valueLength); -Converts a managed localeName into something ICU understands and can use as a localeName. -*/ -int32_t GetLocale(const UChar* localeName, - char* localeNameResult, - int32_t localeNameResultLength, - UBool canonicalize, - UErrorCode* err); +PALEXPORT int32_t GlobalizationNative_GetDefaultLocaleName(UChar* value, int32_t valueLength); -/* -Function: -u_charsToUChars_safe - -Copies the given null terminated char* to UChar with error checking. Replacement for ICU u_charsToUChars -*/ -void u_charsToUChars_safe(const char* str, UChar* value, int32_t valueLength, UErrorCode* err); - -/* -Function: -FixupLocaleName - -Replace underscores with hyphens to interop with existing .NET code. -Returns the length of the string. -*/ -int32_t FixupLocaleName(UChar* value, int32_t valueLength); - -/* -Function: -DetectDefaultLocaleName - -Detect the default locale for the machine, defaulting to Invaraint if -we can't compute one (different from uloc_getDefault()) would do. -*/ -const char* DetectDefaultLocaleName(void); - -DLLEXPORT int32_t GlobalizationNative_GetLocales(UChar *value, int32_t valueLength); - -DLLEXPORT int32_t GlobalizationNative_GetLocaleName(const UChar* localeName, UChar* value, int32_t valueLength); - -DLLEXPORT int32_t GlobalizationNative_GetDefaultLocaleName(UChar* value, int32_t valueLength); - -DLLEXPORT int32_t GlobalizationNative_IsPredefinedLocale(const UChar* localeName); +PALEXPORT int32_t GlobalizationNative_IsPredefinedLocale(const UChar* localeName); diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_localeNumberData.c b/src/libraries/Native/Unix/System.Globalization.Native/pal_localeNumberData.c index 01d970a..0beae27 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_localeNumberData.c +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_localeNumberData.c @@ -7,6 +7,7 @@ #include #include +#include "pal_locale_internal.h" #include "pal_localeNumberData.h" // invariant character definitions used by ICU diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_localeNumberData.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_localeNumberData.h index 32eb3fd..2599ba5 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_localeNumberData.h +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_localeNumberData.h @@ -3,8 +3,10 @@ // See the LICENSE file in the project root for more information. // -#include "pal_compiler.h" +#pragma once + #include "pal_locale.h" +#include "pal_compiler.h" // Enum that corresponds to managed enum CultureData.LocaleNumberData. // The numeric values of the enum members match their Win32 counterparts. @@ -34,11 +36,11 @@ typedef enum WeekRule_FirstFourDayWeek = 2 } CalendarWeekRule; -DLLEXPORT int32_t GlobalizationNative_GetLocaleInfoInt(const UChar* localeName, +PALEXPORT int32_t GlobalizationNative_GetLocaleInfoInt(const UChar* localeName, LocaleNumberData localeNumberData, int32_t* value); -DLLEXPORT int32_t GlobalizationNative_GetLocaleInfoGroupingSizes(const UChar* localeName, +PALEXPORT int32_t GlobalizationNative_GetLocaleInfoGroupingSizes(const UChar* localeName, LocaleNumberData localeGroupingData, int32_t* primaryGroupSize, int32_t* secondaryGroupSize); diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_localeStringData.c b/src/libraries/Native/Unix/System.Globalization.Native/pal_localeStringData.c index c16b87d..f0894b7 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_localeStringData.c +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_localeStringData.c @@ -7,6 +7,7 @@ #include #include +#include "pal_locale_internal.h" #include "pal_localeStringData.h" /* diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_localeStringData.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_localeStringData.h index 5889428..01584d2 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_localeStringData.h +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_localeStringData.h @@ -3,8 +3,10 @@ // See the LICENSE file in the project root for more information. // -#include "pal_compiler.h" +#pragma once + #include "pal_locale.h" +#include "pal_compiler.h" // Enum that corresponds to managed enum CultureData.LocaleStringData. // The numeric values of the enum members match their Win32 counterparts. @@ -43,12 +45,12 @@ typedef enum LocaleString_PerMilleSymbol = 0x00000077 } LocaleStringData; -DLLEXPORT int32_t GlobalizationNative_GetLocaleInfoString(const UChar* localeName, +PALEXPORT int32_t GlobalizationNative_GetLocaleInfoString(const UChar* localeName, LocaleStringData localeStringData, UChar* value, int32_t valueLength); -DLLEXPORT int32_t GlobalizationNative_GetLocaleTimeFormat(const UChar* localeName, +PALEXPORT int32_t GlobalizationNative_GetLocaleTimeFormat(const UChar* localeName, int shortFormat, UChar* value, int32_t valueLength); diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_locale_internal.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_locale_internal.h new file mode 100644 index 0000000..24a6307e --- /dev/null +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_locale_internal.h @@ -0,0 +1,54 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#pragma once + +#include "pal_icushim_internal.h" + +/* +Function: +UErrorCodeToBool + +Convert an ICU UErrorCode to a Bool compatible with Win32 +Returns 1 for success, 0 otherwise +*/ +int32_t UErrorCodeToBool(UErrorCode code); + +/* +Function: +GetLocale + +Converts a managed localeName into something ICU understands and can use as a localeName. +*/ +int32_t GetLocale(const UChar* localeName, + char* localeNameResult, + int32_t localeNameResultLength, + UBool canonicalize, + UErrorCode* err); + +/* +Function: +u_charsToUChars_safe + +Copies the given null terminated char* to UChar with error checking. Replacement for ICU u_charsToUChars +*/ +void u_charsToUChars_safe(const char* str, UChar* value, int32_t valueLength, UErrorCode* err); + +/* +Function: +FixupLocaleName + +Replace underscores with hyphens to interop with existing .NET code. +Returns the length of the string. +*/ +int32_t FixupLocaleName(UChar* value, int32_t valueLength); + +/* +Function: +DetectDefaultLocaleName + +Detect the default locale for the machine, defaulting to Invaraint if +we can't compute one (different from uloc_getDefault()) would do. +*/ +const char* DetectDefaultLocaleName(void); diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_normalization.c b/src/libraries/Native/Unix/System.Globalization.Native/pal_normalization.c index 46b4155..7b2c641 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_normalization.c +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_normalization.c @@ -5,7 +5,7 @@ #include -#include "pal_icushim.h" +#include "pal_icushim_internal.h" #include "pal_normalization.h" static const UNormalizer2* GetNormalizerForForm(NormalizationForm normalizationForm, UErrorCode* pErrorCode) diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_normalization.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_normalization.h index 993d956..aca8b50 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_normalization.h +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_normalization.h @@ -3,8 +3,10 @@ // See the LICENSE file in the project root for more information. // -#include "pal_compiler.h" +#pragma once + #include "pal_locale.h" +#include "pal_compiler.h" /* * These values should be kept in sync with System.Text.NormalizationForm @@ -17,11 +19,11 @@ typedef enum FormKD = 0x6 } NormalizationForm; -DLLEXPORT int32_t GlobalizationNative_IsNormalized(NormalizationForm normalizationForm, +PALEXPORT int32_t GlobalizationNative_IsNormalized(NormalizationForm normalizationForm, const UChar* lpStr, int32_t cwStrLength); -DLLEXPORT int32_t GlobalizationNative_NormalizeString(NormalizationForm normalizationForm, +PALEXPORT int32_t GlobalizationNative_NormalizeString(NormalizationForm normalizationForm, const UChar* lpSrc, int32_t cwSrcLength, UChar* lpDst, diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_timeZoneInfo.c b/src/libraries/Native/Unix/System.Globalization.Native/pal_timeZoneInfo.c index bf2a9dc..537464d 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_timeZoneInfo.c +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_timeZoneInfo.c @@ -6,6 +6,8 @@ #include #include +#include "pal_errors_internal.h" +#include "pal_locale_internal.h" #include "pal_timeZoneInfo.h" /* diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_timeZoneInfo.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_timeZoneInfo.h index 1c030ca..e08439d 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_timeZoneInfo.h +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_timeZoneInfo.h @@ -3,8 +3,10 @@ // See the LICENSE file in the project root for more information. // -#include "pal_compiler.h" +#pragma once + #include "pal_locale.h" +#include "pal_compiler.h" #include "pal_errors.h" /* @@ -17,7 +19,7 @@ typedef enum TimeZoneDisplayName_DaylightSavings = 2, } TimeZoneDisplayNameType; -DLLEXPORT ResultCode GlobalizationNative_GetTimeZoneDisplayName(const UChar* localeName, +PALEXPORT ResultCode GlobalizationNative_GetTimeZoneDisplayName(const UChar* localeName, const UChar* timeZoneId, TimeZoneDisplayNameType type, UChar* result, diff --git a/src/libraries/Native/Unix/System.IO.Ports.Native/pal_serial.h b/src/libraries/Native/Unix/System.IO.Ports.Native/pal_serial.h index b998de8..3d35b81 100644 --- a/src/libraries/Native/Unix/System.IO.Ports.Native/pal_serial.h +++ b/src/libraries/Native/Unix/System.IO.Ports.Native/pal_serial.h @@ -5,5 +5,5 @@ #include "pal_types.h" #include "pal_compiler.h" -DLLEXPORT intptr_t SystemIoPortsNative_SerialPortOpen(const char * name); -DLLEXPORT int SystemIoPortsNative_SerialPortClose(intptr_t fd); +PALEXPORT intptr_t SystemIoPortsNative_SerialPortOpen(const char * name); +PALEXPORT int SystemIoPortsNative_SerialPortClose(intptr_t fd); diff --git a/src/libraries/Native/Unix/System.IO.Ports.Native/pal_termios.h b/src/libraries/Native/Unix/System.IO.Ports.Native/pal_termios.h index ae260a7..5b3c8f6 100644 --- a/src/libraries/Native/Unix/System.IO.Ports.Native/pal_termios.h +++ b/src/libraries/Native/Unix/System.IO.Ports.Native/pal_termios.h @@ -5,16 +5,16 @@ #include "pal_types.h" #include "pal_compiler.h" -DLLEXPORT int32_t SystemIoPortsNative_TermiosGetSignal(intptr_t fd, int32_t signal); -DLLEXPORT int32_t SystemIoPortsNative_TermiosSetSignal(intptr_t fd, int32_t signal, int32_t set); -DLLEXPORT int32_t SystemIoPortsNative_TermiosGetAllSignals(intptr_t fd); +PALEXPORT int32_t SystemIoPortsNative_TermiosGetSignal(intptr_t fd, int32_t signal); +PALEXPORT int32_t SystemIoPortsNative_TermiosSetSignal(intptr_t fd, int32_t signal, int32_t set); +PALEXPORT int32_t SystemIoPortsNative_TermiosGetAllSignals(intptr_t fd); -DLLEXPORT int32_t SystemIoPortsNative_TermiosGetSpeed(intptr_t fd); -DLLEXPORT int32_t SystemIoPortsNative_TermiosSetSpeed(intptr_t fd, int32_t speed); +PALEXPORT int32_t SystemIoPortsNative_TermiosGetSpeed(intptr_t fd); +PALEXPORT int32_t SystemIoPortsNative_TermiosSetSpeed(intptr_t fd, int32_t speed); -DLLEXPORT int32_t SystemIoPortsNative_TermiosAvailableBytes(intptr_t fd, int32_t readBuffer); +PALEXPORT int32_t SystemIoPortsNative_TermiosAvailableBytes(intptr_t fd, int32_t readBuffer); -DLLEXPORT int32_t SystemIoPortsNative_TermiosReset(intptr_t fd, int32_t speed, int32_t dataBits, int32_t stopBits, int32_t parity, int32_t handshake); -DLLEXPORT int32_t SystemIoPortsNative_TermiosDiscard(intptr_t fd, int32_t queue); -DLLEXPORT int32_t SystemIoPortsNative_TermiosDrain(intptr_t fd); -DLLEXPORT int32_t SystemIoPortsNative_TermiosSendBreak(intptr_t fd, int32_t duration); +PALEXPORT int32_t SystemIoPortsNative_TermiosReset(intptr_t fd, int32_t speed, int32_t dataBits, int32_t stopBits, int32_t parity, int32_t handshake); +PALEXPORT int32_t SystemIoPortsNative_TermiosDiscard(intptr_t fd, int32_t queue); +PALEXPORT int32_t SystemIoPortsNative_TermiosDrain(intptr_t fd); +PALEXPORT int32_t SystemIoPortsNative_TermiosSendBreak(intptr_t fd, int32_t duration); diff --git a/src/libraries/Native/Unix/System.Native/pal_console.h b/src/libraries/Native/Unix/System.Native/pal_console.h index f5b59c0..db0837e 100644 --- a/src/libraries/Native/Unix/System.Native/pal_console.h +++ b/src/libraries/Native/Unix/System.Native/pal_console.h @@ -47,7 +47,7 @@ typedef struct * * Returns 0 on success; otherwise, returns errorNo. */ -DLLEXPORT int32_t SystemNative_GetWindowSize(WinSize* windowsSize); +PALEXPORT int32_t SystemNative_GetWindowSize(WinSize* windowsSize); /** * Gets whether the specified file descriptor is for a terminal. @@ -55,14 +55,14 @@ DLLEXPORT int32_t SystemNative_GetWindowSize(WinSize* windowsSize); * Returns 1 if the file descriptor is referring to a terminal; * otherwise returns 0 and sets errno. */ -DLLEXPORT int32_t SystemNative_IsATty(intptr_t fd); +PALEXPORT int32_t SystemNative_IsATty(intptr_t fd); /** * Initializes signal handling and terminal for use by System.Console and System.Diagnostics.Process. * * Returns 1 on success; otherwise returns 0 and sets errno. */ -DLLEXPORT int32_t SystemNative_InitializeTerminalAndSignalHandling(void); +PALEXPORT int32_t SystemNative_InitializeTerminalAndSignalHandling(void); /** * Stores the string that can be written to stdout to transition @@ -70,7 +70,7 @@ DLLEXPORT int32_t SystemNative_InitializeTerminalAndSignalHandling(void); * * Returns 1 on success; otherwise returns 0 and sets errno. */ -DLLEXPORT void SystemNative_SetKeypadXmit(const char* terminfoString); +PALEXPORT void SystemNative_SetKeypadXmit(const char* terminfoString); /** * Gets the special control character codes for the requested control characters. @@ -80,40 +80,40 @@ DLLEXPORT void SystemNative_SetKeypadXmit(const char* terminfoString); * or 0 if a particular name is unsupported or disabled. posixDisableValue is the special sentinel used in the output * controlCharacterValues array to indicate no value is available. */ -DLLEXPORT void SystemNative_GetControlCharacters( +PALEXPORT void SystemNative_GetControlCharacters( int32_t* controlCharacterNames, uint8_t* controlCharacterValues, int32_t controlCharacterLength, uint8_t* posixDisableValue); /** * Returns 1 if any input is waiting on stdin; otherwise, 0. */ -DLLEXPORT int32_t SystemNative_StdinReady(void); +PALEXPORT int32_t SystemNative_StdinReady(void); /** * Configures the terminal for System.Console Read. */ -DLLEXPORT void SystemNative_InitializeConsoleBeforeRead(uint8_t minChars, uint8_t decisecondsTimeout); +PALEXPORT void SystemNative_InitializeConsoleBeforeRead(uint8_t minChars, uint8_t decisecondsTimeout); /** * Configures the terminal after System.Console Read. */ -DLLEXPORT void SystemNative_UninitializeConsoleAfterRead(void); +PALEXPORT void SystemNative_UninitializeConsoleAfterRead(void); /** * Configures the terminal for child processes. */ -DLLEXPORT void SystemNative_ConfigureTerminalForChildProcess(int32_t enable); +PALEXPORT void SystemNative_ConfigureTerminalForChildProcess(int32_t enable); /** * Reads the number of bytes specified into the provided buffer from stdin. * Returns the number of bytes read on success; otherwise, -1 is returned an errno is set. */ -DLLEXPORT int32_t SystemNative_ReadStdin(void* buffer, int32_t bufferSize); +PALEXPORT int32_t SystemNative_ReadStdin(void* buffer, int32_t bufferSize); /** * Gets the terminal's break mode. */ -DLLEXPORT int32_t SystemNative_GetSignalForBreak(void); +PALEXPORT int32_t SystemNative_GetSignalForBreak(void); /** * Configures the terminal's break mode. @@ -122,7 +122,7 @@ DLLEXPORT int32_t SystemNative_GetSignalForBreak(void); * * Returns 1 on success, 0 on failure, in which case errno is set. */ -DLLEXPORT int32_t SystemNative_SetSignalForBreak(int32_t signalForBreak); +PALEXPORT int32_t SystemNative_SetSignalForBreak(int32_t signalForBreak); typedef enum { diff --git a/src/libraries/Native/Unix/System.Native/pal_datetime.h b/src/libraries/Native/Unix/System.Native/pal_datetime.h index 7cae837..3440bc3 100644 --- a/src/libraries/Native/Unix/System.Native/pal_datetime.h +++ b/src/libraries/Native/Unix/System.Native/pal_datetime.h @@ -6,4 +6,4 @@ #include "pal_compiler.h" -DLLEXPORT int64_t SystemNative_GetSystemTimeAsTicks(void); +PALEXPORT int64_t SystemNative_GetSystemTimeAsTicks(void); diff --git a/src/libraries/Native/Unix/System.Native/pal_errno.h b/src/libraries/Native/Unix/System.Native/pal_errno.h index 1aa566ff..c4ba9cc 100644 --- a/src/libraries/Native/Unix/System.Native/pal_errno.h +++ b/src/libraries/Native/Unix/System.Native/pal_errno.h @@ -132,14 +132,14 @@ typedef enum * Error above. If the value is not recognized, returns * Error_ENONSTANDARD. */ -DLLEXPORT int32_t SystemNative_ConvertErrorPlatformToPal(int32_t platformErrno); +PALEXPORT int32_t SystemNative_ConvertErrorPlatformToPal(int32_t platformErrno); /** * Converts the given PAL Error value to a platform-specific errno * value. This is to be used when we want to synthesize a given error * and obtain the appropriate error message via StrErrorR. */ -DLLEXPORT int32_t SystemNative_ConvertErrorPalToPlatform(int32_t error); +PALEXPORT int32_t SystemNative_ConvertErrorPalToPlatform(int32_t error); /** * Obtains the system error message for the given raw numeric value @@ -162,4 +162,4 @@ DLLEXPORT int32_t SystemNative_ConvertErrorPalToPlatform(int32_t error); * returned and the buffer is filled with as much of the message * as possible and null-terminated. */ -DLLEXPORT const char* SystemNative_StrErrorR(int32_t platformErrno, char* buffer, int32_t bufferSize); +PALEXPORT const char* SystemNative_StrErrorR(int32_t platformErrno, char* buffer, int32_t bufferSize); diff --git a/src/libraries/Native/Unix/System.Native/pal_interfaceaddresses.h b/src/libraries/Native/Unix/System.Native/pal_interfaceaddresses.h index feb1da2..7ea4fb6 100644 --- a/src/libraries/Native/Unix/System.Native/pal_interfaceaddresses.h +++ b/src/libraries/Native/Unix/System.Native/pal_interfaceaddresses.h @@ -53,10 +53,10 @@ typedef void (*IPv6AddressFound)(const char* interfaceName, IpAddressInfo* info, typedef void (*LinkLayerAddressFound)(const char* interfaceName, LinkLayerAddressInfo* llAddress); typedef void (*GatewayAddressFound)(IpAddressInfo* addressInfo); -DLLEXPORT int32_t SystemNative_EnumerateInterfaceAddresses( +PALEXPORT int32_t SystemNative_EnumerateInterfaceAddresses( IPv4AddressFound onIpv4Found, IPv6AddressFound onIpv6Found, LinkLayerAddressFound onLinkLayerFound); -DLLEXPORT int32_t SystemNative_GetNetworkInterfaces(int32_t * interfaceCount, NetworkInterfaceInfo** interfaces, int32_t * addressCount, IpAddressInfo **addressList); +PALEXPORT int32_t SystemNative_GetNetworkInterfaces(int32_t * interfaceCount, NetworkInterfaceInfo** interfaces, int32_t * addressCount, IpAddressInfo **addressList); #if HAVE_RT_MSGHDR -DLLEXPORT int32_t SystemNative_EnumerateGatewayAddressesForInterface(uint32_t interfaceIndex, GatewayAddressFound onGatewayFound); +PALEXPORT int32_t SystemNative_EnumerateGatewayAddressesForInterface(uint32_t interfaceIndex, GatewayAddressFound onGatewayFound); #endif diff --git a/src/libraries/Native/Unix/System.Native/pal_io.h b/src/libraries/Native/Unix/System.Native/pal_io.h index 147e64e..136f534 100644 --- a/src/libraries/Native/Unix/System.Native/pal_io.h +++ b/src/libraries/Native/Unix/System.Native/pal_io.h @@ -332,85 +332,85 @@ typedef enum * * Returns 0 for success, -1 for failure. Sets errno on failure. */ -DLLEXPORT int32_t SystemNative_FStat(intptr_t fd, FileStatus* output); +PALEXPORT int32_t SystemNative_FStat(intptr_t fd, FileStatus* output); /** * Get file status from a full path. Implemented as shim to stat(2). * * Returns 0 for success, -1 for failure. Sets errno on failure. */ -DLLEXPORT int32_t SystemNative_Stat(const char* path, FileStatus* output); +PALEXPORT int32_t SystemNative_Stat(const char* path, FileStatus* output); /** * Get file stats from a full path. Implemented as shim to lstat(2). * * Returns 0 for success, -1 for failure. Sets errno on failure. */ -DLLEXPORT int32_t SystemNative_LStat(const char* path, FileStatus* output); +PALEXPORT int32_t SystemNative_LStat(const char* path, FileStatus* output); /** * Open or create a file or device. Implemented as shim to open(2). * * Returns file descriptor or -1 for failure. Sets errno on failure. */ -DLLEXPORT intptr_t SystemNative_Open(const char* path, int32_t flags, int32_t mode); +PALEXPORT intptr_t SystemNative_Open(const char* path, int32_t flags, int32_t mode); /** * Close a file descriptor. Implemented as shim to open(2). * * Returns 0 for success, -1 for failure. Sets errno on failure. */ -DLLEXPORT int32_t SystemNative_Close(intptr_t fd); +PALEXPORT int32_t SystemNative_Close(intptr_t fd); /** * Duplicates a file descriptor. * * Returns the duplication descriptor for success, -1 for failure. Sets errno on failure. */ -DLLEXPORT intptr_t SystemNative_Dup(intptr_t oldfd); +PALEXPORT intptr_t SystemNative_Dup(intptr_t oldfd); /** * Delete an entry from the file system. Implemented as shim to unlink(2). * * Returns 0 for success, -1 for failure. Sets errno on failure. */ -DLLEXPORT int32_t SystemNative_Unlink(const char* path); +PALEXPORT int32_t SystemNative_Unlink(const char* path); /** * Open or create a shared memory object. Implemented as shim to shm_open(3). * * Returns file descriptor or -1 on fiailure. Sets errno on failure. */ -DLLEXPORT intptr_t SystemNative_ShmOpen(const char* name, int32_t flags, int32_t mode); +PALEXPORT intptr_t SystemNative_ShmOpen(const char* name, int32_t flags, int32_t mode); /** * Unlink a shared memory object. Implemented as shim to shm_unlink(3). * * Returns 0 for success, -1 for failure. Sets errno on failure. */ -DLLEXPORT int32_t SystemNative_ShmUnlink(const char* name); +PALEXPORT int32_t SystemNative_ShmUnlink(const char* name); /** * Returns the size of the dirent struct on the current architecture */ -DLLEXPORT int32_t SystemNative_GetReadDirRBufferSize(void); +PALEXPORT int32_t SystemNative_GetReadDirRBufferSize(void); /** * Re-entrant readdir that will retrieve the next dirent from the directory stream pointed to by dir. * * Returns 0 when data is retrieved; returns -1 when end-of-stream is reached; returns an error code on failure */ -DLLEXPORT int32_t SystemNative_ReadDirR(DIR* dir, uint8_t* buffer, int32_t bufferSize, DirectoryEntry* outputEntry); +PALEXPORT int32_t SystemNative_ReadDirR(DIR* dir, uint8_t* buffer, int32_t bufferSize, DirectoryEntry* outputEntry); /** * Returns a DIR struct containing info about the current path or NULL on failure; sets errno on fail. */ -DLLEXPORT DIR* SystemNative_OpenDir(const char* path); +PALEXPORT DIR* SystemNative_OpenDir(const char* path); /** * Closes the directory stream opened by opendir and returns 0 on success. On fail, -1 is returned and errno is set */ -DLLEXPORT int32_t SystemNative_CloseDir(DIR* dir); +PALEXPORT int32_t SystemNative_CloseDir(DIR* dir); /** * Creates a pipe. Implemented as shim to pipe(2) or pipe2(2) if available. @@ -418,7 +418,7 @@ DLLEXPORT int32_t SystemNative_CloseDir(DIR* dir); * * Returns 0 for success, -1 for failure. Sets errno on failure. */ -DLLEXPORT int32_t SystemNative_Pipe(int32_t pipefd[2], // [out] pipefds[0] gets read end, pipefd[1] gets write end. +PALEXPORT int32_t SystemNative_Pipe(int32_t pipefd[2], // [out] pipefds[0] gets read end, pipefd[1] gets write end. int32_t flags); // 0 for defaults or PAL_O_CLOEXEC for close-on-exec // NOTE: Rather than a general fcntl shim, we opt to export separate functions @@ -430,21 +430,21 @@ DLLEXPORT int32_t SystemNative_Pipe(int32_t pipefd[2], // [out] pipefds[0] gets * * Returns 0 for success; -1 for failure. Sets errno for failure. */ -DLLEXPORT int32_t SystemNative_FcntlSetFD(intptr_t fd, int32_t flags); +PALEXPORT int32_t SystemNative_FcntlSetFD(intptr_t fd, int32_t flags); /** * Gets the flags on a file descriptor. * * Returns flags for success; -1 for failure. Sets errno for failure. */ -DLLEXPORT int32_t SystemNative_FcntlGetFD(intptr_t fd); +PALEXPORT int32_t SystemNative_FcntlGetFD(intptr_t fd); /** * Determines if the current platform supports getting and setting pipe capacity. * * Returns true (non-zero) if supported, false (zero) if not. */ -DLLEXPORT int32_t SystemNative_FcntlCanGetSetPipeSz(void); +PALEXPORT int32_t SystemNative_FcntlCanGetSetPipeSz(void); /** * Gets the capacity of a pipe. @@ -453,7 +453,7 @@ DLLEXPORT int32_t SystemNative_FcntlCanGetSetPipeSz(void); * * NOTE: Some platforms do not support this operation and will always fail with errno = ENOTSUP. */ -DLLEXPORT int32_t SystemNative_FcntlGetPipeSz(intptr_t fd); +PALEXPORT int32_t SystemNative_FcntlGetPipeSz(intptr_t fd); /** * Sets the capacity of a pipe. @@ -462,56 +462,56 @@ DLLEXPORT int32_t SystemNative_FcntlGetPipeSz(intptr_t fd); * * NOTE: Some platforms do not support this operation and will always fail with errno = ENOTSUP. */ -DLLEXPORT int32_t SystemNative_FcntlSetPipeSz(intptr_t fd, int32_t size); +PALEXPORT int32_t SystemNative_FcntlSetPipeSz(intptr_t fd, int32_t size); /** * Sets whether or not a file descriptor is non-blocking. * * Returns 0 for success, -1 for failure. Sets errno for failure. */ -DLLEXPORT int32_t SystemNative_FcntlSetIsNonBlocking(intptr_t fd, int32_t isNonBlocking); +PALEXPORT int32_t SystemNative_FcntlSetIsNonBlocking(intptr_t fd, int32_t isNonBlocking); /** * Create a directory. Implemented as a shim to mkdir(2). * * Returns 0 for success, -1 for failure. Sets errno for failure. */ -DLLEXPORT int32_t SystemNative_MkDir(const char* path, int32_t mode); +PALEXPORT int32_t SystemNative_MkDir(const char* path, int32_t mode); /** * Change permissions of a file. Implemented as a shim to chmod(2). * * Returns 0 for success, -1 for failure. Sets errno for failure. */ -DLLEXPORT int32_t SystemNative_ChMod(const char* path, int32_t mode); +PALEXPORT int32_t SystemNative_ChMod(const char* path, int32_t mode); /** * Change permissions of a file. Implemented as a shim to fchmod(2). * * Returns 0 for success, -1 for failure. Sets errno for failure. */ -DLLEXPORT int32_t SystemNative_FChMod(intptr_t fd, int32_t mode); +PALEXPORT int32_t SystemNative_FChMod(intptr_t fd, int32_t mode); /** * Flushes all modified data and attribtues of the specified File Descriptor to the storage medium. * * Returns 0 for success; on fail, -1 is returned and errno is set. */ -DLLEXPORT int32_t SystemNative_FSync(intptr_t fd); +PALEXPORT int32_t SystemNative_FSync(intptr_t fd); /** * Changes the advisory lock status on a given File Descriptor * * Returns 0 on success; otherwise, -1 is returned and errno is set */ -DLLEXPORT int32_t SystemNative_FLock(intptr_t fd, int32_t operation); +PALEXPORT int32_t SystemNative_FLock(intptr_t fd, int32_t operation); /** * Changes the current working directory to be the specified path. * * Returns 0 on success; otherwise, returns -1 and errno is set */ -DLLEXPORT int32_t SystemNative_ChDir(const char* path); +PALEXPORT int32_t SystemNative_ChDir(const char* path); /** * Checks the access permissions of the current calling user on the specified path for the specified mode. @@ -519,7 +519,7 @@ DLLEXPORT int32_t SystemNative_ChDir(const char* path); * Returns -1 if the path cannot be found or the if desired access is not granted and errno is set; otherwise, returns * 0. */ -DLLEXPORT int32_t SystemNative_Access(const char* path, int32_t mode); +PALEXPORT int32_t SystemNative_Access(const char* path, int32_t mode); /** * Seek to a specified location within a seekable stream @@ -527,14 +527,14 @@ DLLEXPORT int32_t SystemNative_Access(const char* path, int32_t mode); * On success, the resulting offet, in bytes, from the beginning of the stream; otherwise, * returns -1 and errno is set. */ -DLLEXPORT int64_t SystemNative_LSeek(intptr_t fd, int64_t offset, int32_t whence); +PALEXPORT int64_t SystemNative_LSeek(intptr_t fd, int64_t offset, int32_t whence); /** * Creates a hard-link at link pointing to source. * * Returns 0 on success; otherwise, returns -1 and errno is set. */ -DLLEXPORT int32_t SystemNative_Link(const char* source, const char* linkTarget); +PALEXPORT int32_t SystemNative_Link(const char* source, const char* linkTarget); /** * Creates a file name that adheres to the specified template, creates the file on disk with @@ -542,7 +542,7 @@ DLLEXPORT int32_t SystemNative_Link(const char* source, const char* linkTarget); * * Returns a valid File Descriptor on success; otherwise, returns -1 and errno is set. */ -DLLEXPORT intptr_t SystemNative_MksTemps(char* pathTemplate, int32_t suffixLength); +PALEXPORT intptr_t SystemNative_MksTemps(char* pathTemplate, int32_t suffixLength); /** * Map file or device into memory. Implemented as shim to mmap(2). @@ -552,7 +552,7 @@ DLLEXPORT intptr_t SystemNative_MksTemps(char* pathTemplate, int32_t suffixLengt * Note that null failure result is a departure from underlying * mmap(2) using non-null sentinel. */ -DLLEXPORT void* SystemNative_MMap(void* address, +PALEXPORT void* SystemNative_MMap(void* address, uint64_t length, int32_t protection, // bitwise OR of PAL_PROT_* int32_t flags, // bitwise OR of PAL_MAP_*, but PRIVATE and SHARED are mutually exclusive. @@ -564,21 +564,21 @@ DLLEXPORT void* SystemNative_MMap(void* address, * * Returns 0 for success, -1 for failure. Sets errno on failure. */ -DLLEXPORT int32_t SystemNative_MUnmap(void* address, uint64_t length); +PALEXPORT int32_t SystemNative_MUnmap(void* address, uint64_t length); /** * Give advice about use of memory. Implemented as shim to madvise(2). * * Returns 0 for success, -1 for failure. Sets errno on failure. */ -DLLEXPORT int32_t SystemNative_MAdvise(void* address, uint64_t length, int32_t advice); +PALEXPORT int32_t SystemNative_MAdvise(void* address, uint64_t length, int32_t advice); /** * Sycnhronize a file with a memory map. Implemented as shim to mmap(2). * * Returns 0 for success, -1 for failure. Sets errno on failure. */ -DLLEXPORT int32_t SystemNative_MSync(void* address, uint64_t length, int32_t flags); +PALEXPORT int32_t SystemNative_MSync(void* address, uint64_t length, int32_t flags); /** * Get system configuration value. Implemented as shim to sysconf(3). @@ -589,14 +589,14 @@ DLLEXPORT int32_t SystemNative_MSync(void* address, uint64_t length, int32_t fla * note that -1 can also be a meaningful successful return value, in * which case errno is unchanged. */ -DLLEXPORT int64_t SystemNative_SysConf(int32_t name); +PALEXPORT int64_t SystemNative_SysConf(int32_t name); /** * Truncate a file to given length. Implemented as shim to ftruncate(2). * * Returns 0 for success, -1 for failure. Sets errno on failure. */ -DLLEXPORT int32_t SystemNative_FTruncate(intptr_t fd, int64_t length); +PALEXPORT int32_t SystemNative_FTruncate(intptr_t fd, int64_t length); /** * Examines one or more file descriptors for the specified state(s) and blocks until the state(s) occur or the timeout @@ -605,7 +605,7 @@ DLLEXPORT int32_t SystemNative_FTruncate(intptr_t fd, int64_t length); * Returns an error or Error_SUCCESS. `triggered` is set to the number of ready descriptors if any. The number of * triggered descriptors may be zero in the event of a timeout. */ -DLLEXPORT int32_t SystemNative_Poll(PollEvent* pollEvents, uint32_t eventCount, int32_t milliseconds, uint32_t* triggered); +PALEXPORT int32_t SystemNative_Poll(PollEvent* pollEvents, uint32_t eventCount, int32_t milliseconds, uint32_t* triggered); /** * Notifies the OS kernel that the specified file will be accessed in a particular way soon; this allows the kernel to @@ -613,14 +613,14 @@ DLLEXPORT int32_t SystemNative_Poll(PollEvent* pollEvents, uint32_t eventCount, * * Returns 0 on success; otherwise, the error code is returned and errno is NOT set. */ -DLLEXPORT int32_t SystemNative_PosixFAdvise(intptr_t fd, int64_t offset, int64_t length, int32_t advice); +PALEXPORT int32_t SystemNative_PosixFAdvise(intptr_t fd, int64_t offset, int64_t length, int32_t advice); /** * Reads a line from the provided stream. * * Returns the read line, or null if no line could be read. The caller is responsible for freeing the malloc'd line. */ -DLLEXPORT char* SystemNative_GetLine(FILE* stream); +PALEXPORT char* SystemNative_GetLine(FILE* stream); /** * Reads the number of bytes specified into the provided buffer from the specified, opened file descriptor. @@ -629,7 +629,7 @@ DLLEXPORT char* SystemNative_GetLine(FILE* stream); * * Note - on fail. the position of the stream may change depending on the platform; consult man 2 read for more info */ -DLLEXPORT int32_t SystemNative_Read(intptr_t fd, void* buffer, int32_t bufferSize); +PALEXPORT int32_t SystemNative_Read(intptr_t fd, void* buffer, int32_t bufferSize); /** * Takes a path to a symbolic link and attempts to place the link target path into the buffer. If the buffer is too @@ -637,7 +637,7 @@ DLLEXPORT int32_t SystemNative_Read(intptr_t fd, void* buffer, int32_t bufferSiz * * Returns the number of bytes placed into the buffer on success; otherwise, -1 is returned and errno is set. */ -DLLEXPORT int32_t SystemNative_ReadLink(const char* path, char* buffer, int32_t bufferSize); +PALEXPORT int32_t SystemNative_ReadLink(const char* path, char* buffer, int32_t bufferSize); /** * Renames a file, moving to the correct destination if necessary. There are many edge cases to this call, check man 2 @@ -645,33 +645,33 @@ DLLEXPORT int32_t SystemNative_ReadLink(const char* path, char* buffer, int32_t * * Returns 0 on succes; otherwise, returns -1 and errno is set. */ -DLLEXPORT int32_t SystemNative_Rename(const char* oldPath, const char* newPath); +PALEXPORT int32_t SystemNative_Rename(const char* oldPath, const char* newPath); /** * Deletes the specified empty directory. * * Returns 0 on success; otherwise, returns -1 and errno is set. */ -DLLEXPORT int32_t SystemNative_RmDir(const char* path); +PALEXPORT int32_t SystemNative_RmDir(const char* path); /** * Forces a write of all modified I/O buffers to their storage mediums. */ -DLLEXPORT void SystemNative_Sync(void); +PALEXPORT void SystemNative_Sync(void); /** * Writes the specified buffer to the provided open file descriptor * * Returns the number of bytes written on success; otherwise, returns -1 and sets errno */ -DLLEXPORT int32_t SystemNative_Write(intptr_t fd, const void* buffer, int32_t bufferSize); +PALEXPORT int32_t SystemNative_Write(intptr_t fd, const void* buffer, int32_t bufferSize); /** * Copies all data from the source file descriptor/path to the destination file path. * * Returns 0 on success; otherwise, returns -1 and sets errno. */ -DLLEXPORT int32_t SystemNative_CopyFile(intptr_t sourceFd, const char* srcPath, const char* destPath, int32_t overwrite); +PALEXPORT int32_t SystemNative_CopyFile(intptr_t sourceFd, const char* srcPath, const char* destPath, int32_t overwrite); /** * Initializes a new inotify instance and returns a file @@ -680,7 +680,7 @@ DLLEXPORT int32_t SystemNative_CopyFile(intptr_t sourceFd, const char* srcPath, * Returns a new file descriptor on success. * On error, -1 is returned, and errno is set to indicate the error. */ -DLLEXPORT intptr_t SystemNative_INotifyInit(void); +PALEXPORT intptr_t SystemNative_INotifyInit(void); /** * Adds a new watch, or modifies an existing watch, @@ -689,7 +689,7 @@ DLLEXPORT intptr_t SystemNative_INotifyInit(void); * Returns a nonnegative watch descriptor on success. * On error -1 is returned and errno is set appropriately. */ -DLLEXPORT int32_t SystemNative_INotifyAddWatch(intptr_t fd, const char* pathName, uint32_t mask); +PALEXPORT int32_t SystemNative_INotifyAddWatch(intptr_t fd, const char* pathName, uint32_t mask); /** * Removes the watch associated with the watch descriptor wd @@ -697,21 +697,21 @@ DLLEXPORT int32_t SystemNative_INotifyAddWatch(intptr_t fd, const char* pathName * * Returns 0 on success, or -1 if an error occurred (in which case, errno is set appropriately). */ -DLLEXPORT int32_t SystemNative_INotifyRemoveWatch(intptr_t fd, int32_t wd); +PALEXPORT int32_t SystemNative_INotifyRemoveWatch(intptr_t fd, int32_t wd); /** * Expands all symbolic links and expands all paths to return an absolute path * * Returns the result absolute path on success or null on error with errno set appropriately. */ -DLLEXPORT char* SystemNative_RealPath(const char* path); +PALEXPORT char* SystemNative_RealPath(const char* path); /** * Attempts to retrieve the ID of the process at the end of the given socket * * Returns 0 on success, or -1 if an error occurred (in which case, errno is set appropriately). */ -DLLEXPORT int32_t SystemNative_GetPeerID(intptr_t socket, uid_t* euid); +PALEXPORT int32_t SystemNative_GetPeerID(intptr_t socket, uid_t* euid); /** * Attempts to lock/unlock the region of the file "fd" specified by the offset and length. lockType @@ -719,18 +719,18 @@ DLLEXPORT int32_t SystemNative_GetPeerID(intptr_t socket, uid_t* euid); * * Returns 0 on success, or -1 if an error occurred (in which case, errno is set appropriately). */ -DLLEXPORT int32_t SystemNative_LockFileRegion(intptr_t fd, int64_t offset, int64_t length, int16_t lockType); +PALEXPORT int32_t SystemNative_LockFileRegion(intptr_t fd, int64_t offset, int64_t length, int16_t lockType); /** * Changes the file flags of the file whose location is specified in path * * Returns 0 for success, -1 for failure. Sets errno for failure. */ -DLLEXPORT int32_t SystemNative_LChflags(const char* path, uint32_t flags); +PALEXPORT int32_t SystemNative_LChflags(const char* path, uint32_t flags); /** * Determines if the current platform supports setting UF_HIDDEN (0x8000) flag * * Returns true (non-zero) if supported, false (zero) if not. */ -DLLEXPORT int32_t SystemNative_LChflagsCanSetHiddenFlag(void); +PALEXPORT int32_t SystemNative_LChflagsCanSetHiddenFlag(void); diff --git a/src/libraries/Native/Unix/System.Native/pal_memory.h b/src/libraries/Native/Unix/System.Native/pal_memory.h index a5b1bdb..c77d211 100644 --- a/src/libraries/Native/Unix/System.Native/pal_memory.h +++ b/src/libraries/Native/Unix/System.Native/pal_memory.h @@ -12,4 +12,4 @@ * * Returns a pointer to the memory. */ -DLLEXPORT void* SystemNative_MemSet(void *s, int c, uintptr_t n); +PALEXPORT void* SystemNative_MemSet(void *s, int c, uintptr_t n); diff --git a/src/libraries/Native/Unix/System.Native/pal_mount.h b/src/libraries/Native/Unix/System.Native/pal_mount.h index beec364..0a42570 100644 --- a/src/libraries/Native/Unix/System.Native/pal_mount.h +++ b/src/libraries/Native/Unix/System.Native/pal_mount.h @@ -27,7 +27,7 @@ typedef void (*MountPointFound)(const char* name); /** * Gets the space information for the given mount point and populates the input struct with the data. */ -DLLEXPORT int32_t SystemNative_GetSpaceInfoForMountPoint(const char* name, MountPointInformation* mpi); +PALEXPORT int32_t SystemNative_GetSpaceInfoForMountPoint(const char* name, MountPointInformation* mpi); /** * Gets the format information about the given mount point. @@ -38,7 +38,7 @@ DLLEXPORT int32_t SystemNative_GetSpaceInfoForMountPoint(const char* name, Mount * Since C# is much better at enum and string handling, pass either the char buffer or the long type * back, depending on what the platform gives us, and let C# reason on it in an easy way. */ -DLLEXPORT int32_t SystemNative_GetFormatInfoForMountPoint( +PALEXPORT int32_t SystemNative_GetFormatInfoForMountPoint( const char* name, char* formatNameBuffer, int32_t bufferLength, int64_t* formatType); /** @@ -46,4 +46,4 @@ DLLEXPORT int32_t SystemNative_GetFormatInfoForMountPoint( * function pointer once-per-mount-point to prevent heap allocs * as much as possible. */ -DLLEXPORT int32_t SystemNative_GetAllMountPoints(MountPointFound onFound); +PALEXPORT int32_t SystemNative_GetAllMountPoints(MountPointFound onFound); diff --git a/src/libraries/Native/Unix/System.Native/pal_networkchange.h b/src/libraries/Native/Unix/System.Native/pal_networkchange.h index 727f17b..cc178ae 100644 --- a/src/libraries/Native/Unix/System.Native/pal_networkchange.h +++ b/src/libraries/Native/Unix/System.Native/pal_networkchange.h @@ -19,8 +19,8 @@ typedef enum typedef void (*NetworkChangeEvent)(int32_t sock, NetworkChangeKind notificationKind); -DLLEXPORT void SystemNative_ReadEvents(int32_t sock, NetworkChangeEvent onNetworkChange); +PALEXPORT void SystemNative_ReadEvents(int32_t sock, NetworkChangeEvent onNetworkChange); -DLLEXPORT Error SystemNative_CreateNetworkChangeListenerSocket(int32_t* retSocket); +PALEXPORT Error SystemNative_CreateNetworkChangeListenerSocket(int32_t* retSocket); -DLLEXPORT Error SystemNative_CloseNetworkChangeListenerSocket(int32_t socket); +PALEXPORT Error SystemNative_CloseNetworkChangeListenerSocket(int32_t socket); diff --git a/src/libraries/Native/Unix/System.Native/pal_networking.h b/src/libraries/Native/Unix/System.Native/pal_networking.h index e92f39a..b8377ef 100644 --- a/src/libraries/Native/Unix/System.Native/pal_networking.h +++ b/src/libraries/Native/Unix/System.Native/pal_networking.h @@ -310,12 +310,12 @@ typedef struct uint32_t Padding; // Pad out to 8-byte alignment } SocketEvent; -DLLEXPORT int32_t SystemNative_GetHostEntryForName(const uint8_t* address, HostEntry* entry); +PALEXPORT int32_t SystemNative_GetHostEntryForName(const uint8_t* address, HostEntry* entry); -DLLEXPORT void SystemNative_FreeHostEntry(HostEntry* entry); +PALEXPORT void SystemNative_FreeHostEntry(HostEntry* entry); -DLLEXPORT int32_t SystemNative_GetNameInfo(const uint8_t* address, +PALEXPORT int32_t SystemNative_GetNameInfo(const uint8_t* address, int32_t addressLength, int8_t isIPv6, uint8_t* host, @@ -324,103 +324,103 @@ DLLEXPORT int32_t SystemNative_GetNameInfo(const uint8_t* address, int32_t serviceLength, int32_t flags); -DLLEXPORT int32_t SystemNative_GetDomainName(uint8_t* name, int32_t nameLength); +PALEXPORT int32_t SystemNative_GetDomainName(uint8_t* name, int32_t nameLength); -DLLEXPORT int32_t SystemNative_GetHostName(uint8_t* name, int32_t nameLength); +PALEXPORT int32_t SystemNative_GetHostName(uint8_t* name, int32_t nameLength); -DLLEXPORT int32_t SystemNative_GetIPSocketAddressSizes(int32_t* ipv4SocketAddressSize, int32_t* ipv6SocketAddressSize); +PALEXPORT int32_t SystemNative_GetIPSocketAddressSizes(int32_t* ipv4SocketAddressSize, int32_t* ipv6SocketAddressSize); -DLLEXPORT int32_t SystemNative_GetAddressFamily(const uint8_t* socketAddress, int32_t socketAddressLen, int32_t* addressFamily); +PALEXPORT int32_t SystemNative_GetAddressFamily(const uint8_t* socketAddress, int32_t socketAddressLen, int32_t* addressFamily); -DLLEXPORT int32_t SystemNative_SetAddressFamily(uint8_t* socketAddress, int32_t socketAddressLen, int32_t addressFamily); +PALEXPORT int32_t SystemNative_SetAddressFamily(uint8_t* socketAddress, int32_t socketAddressLen, int32_t addressFamily); -DLLEXPORT int32_t SystemNative_GetPort(const uint8_t* socketAddress, int32_t socketAddressLen, uint16_t* port); +PALEXPORT int32_t SystemNative_GetPort(const uint8_t* socketAddress, int32_t socketAddressLen, uint16_t* port); -DLLEXPORT int32_t SystemNative_SetPort(uint8_t* socketAddress, int32_t socketAddressLen, uint16_t port); +PALEXPORT int32_t SystemNative_SetPort(uint8_t* socketAddress, int32_t socketAddressLen, uint16_t port); -DLLEXPORT int32_t SystemNative_GetIPv4Address(const uint8_t* socketAddress, int32_t socketAddressLen, uint32_t* address); +PALEXPORT int32_t SystemNative_GetIPv4Address(const uint8_t* socketAddress, int32_t socketAddressLen, uint32_t* address); -DLLEXPORT int32_t SystemNative_SetIPv4Address(uint8_t* socketAddress, int32_t socketAddressLen, uint32_t address); +PALEXPORT int32_t SystemNative_SetIPv4Address(uint8_t* socketAddress, int32_t socketAddressLen, uint32_t address); -DLLEXPORT int32_t SystemNative_GetIPv6Address( +PALEXPORT int32_t SystemNative_GetIPv6Address( const uint8_t* socketAddress, int32_t socketAddressLen, uint8_t* address, int32_t addressLen, uint32_t* scopeId); -DLLEXPORT int32_t SystemNative_SetIPv6Address( +PALEXPORT int32_t SystemNative_SetIPv6Address( uint8_t* socketAddress, int32_t socketAddressLen, uint8_t* address, int32_t addressLen, uint32_t scopeId); -DLLEXPORT int32_t SystemNative_GetControlMessageBufferSize(int32_t isIPv4, int32_t isIPv6); +PALEXPORT int32_t SystemNative_GetControlMessageBufferSize(int32_t isIPv4, int32_t isIPv6); -DLLEXPORT int32_t SystemNative_TryGetIPPacketInformation(MessageHeader* messageHeader, int32_t isIPv4, IPPacketInformation* packetInfo); +PALEXPORT int32_t SystemNative_TryGetIPPacketInformation(MessageHeader* messageHeader, int32_t isIPv4, IPPacketInformation* packetInfo); -DLLEXPORT int32_t SystemNative_GetIPv4MulticastOption(intptr_t socket, int32_t multicastOption, IPv4MulticastOption* option); +PALEXPORT int32_t SystemNative_GetIPv4MulticastOption(intptr_t socket, int32_t multicastOption, IPv4MulticastOption* option); -DLLEXPORT int32_t SystemNative_SetIPv4MulticastOption(intptr_t socket, int32_t multicastOption, IPv4MulticastOption* option); +PALEXPORT int32_t SystemNative_SetIPv4MulticastOption(intptr_t socket, int32_t multicastOption, IPv4MulticastOption* option); -DLLEXPORT int32_t SystemNative_GetIPv6MulticastOption(intptr_t socket, int32_t multicastOption, IPv6MulticastOption* option); +PALEXPORT int32_t SystemNative_GetIPv6MulticastOption(intptr_t socket, int32_t multicastOption, IPv6MulticastOption* option); -DLLEXPORT int32_t SystemNative_SetIPv6MulticastOption(intptr_t socket, int32_t multicastOption, IPv6MulticastOption* option); +PALEXPORT int32_t SystemNative_SetIPv6MulticastOption(intptr_t socket, int32_t multicastOption, IPv6MulticastOption* option); -DLLEXPORT int32_t SystemNative_GetLingerOption(intptr_t socket, LingerOption* option); +PALEXPORT int32_t SystemNative_GetLingerOption(intptr_t socket, LingerOption* option); -DLLEXPORT int32_t SystemNative_SetLingerOption(intptr_t socket, LingerOption* option); +PALEXPORT int32_t SystemNative_SetLingerOption(intptr_t socket, LingerOption* option); -DLLEXPORT int32_t SystemNative_SetReceiveTimeout(intptr_t socket, int32_t millisecondsTimeout); +PALEXPORT int32_t SystemNative_SetReceiveTimeout(intptr_t socket, int32_t millisecondsTimeout); -DLLEXPORT int32_t SystemNative_SetSendTimeout(intptr_t socket, int32_t millisecondsTimeout); +PALEXPORT int32_t SystemNative_SetSendTimeout(intptr_t socket, int32_t millisecondsTimeout); -DLLEXPORT int32_t SystemNative_ReceiveMessage(intptr_t socket, MessageHeader* messageHeader, int32_t flags, int64_t* received); +PALEXPORT int32_t SystemNative_ReceiveMessage(intptr_t socket, MessageHeader* messageHeader, int32_t flags, int64_t* received); -DLLEXPORT int32_t SystemNative_SendMessage(intptr_t socket, MessageHeader* messageHeader, int32_t flags, int64_t* sent); +PALEXPORT int32_t SystemNative_SendMessage(intptr_t socket, MessageHeader* messageHeader, int32_t flags, int64_t* sent); -DLLEXPORT int32_t SystemNative_Accept(intptr_t socket, uint8_t* socketAddress, int32_t* socketAddressLen, intptr_t* acceptedSocket); +PALEXPORT int32_t SystemNative_Accept(intptr_t socket, uint8_t* socketAddress, int32_t* socketAddressLen, intptr_t* acceptedSocket); -DLLEXPORT int32_t SystemNative_Bind(intptr_t socket, int32_t protocolType, uint8_t* socketAddress, int32_t socketAddressLen); +PALEXPORT int32_t SystemNative_Bind(intptr_t socket, int32_t protocolType, uint8_t* socketAddress, int32_t socketAddressLen); -DLLEXPORT int32_t SystemNative_Connect(intptr_t socket, uint8_t* socketAddress, int32_t socketAddressLen); +PALEXPORT int32_t SystemNative_Connect(intptr_t socket, uint8_t* socketAddress, int32_t socketAddressLen); -DLLEXPORT int32_t SystemNative_GetPeerName(intptr_t socket, uint8_t* socketAddress, int32_t* socketAddressLen); +PALEXPORT int32_t SystemNative_GetPeerName(intptr_t socket, uint8_t* socketAddress, int32_t* socketAddressLen); -DLLEXPORT int32_t SystemNative_GetSockName(intptr_t socket, uint8_t* socketAddress, int32_t* socketAddressLen); +PALEXPORT int32_t SystemNative_GetSockName(intptr_t socket, uint8_t* socketAddress, int32_t* socketAddressLen); -DLLEXPORT int32_t SystemNative_Listen(intptr_t socket, int32_t backlog); +PALEXPORT int32_t SystemNative_Listen(intptr_t socket, int32_t backlog); -DLLEXPORT int32_t SystemNative_Shutdown(intptr_t socket, int32_t socketShutdown); +PALEXPORT int32_t SystemNative_Shutdown(intptr_t socket, int32_t socketShutdown); -DLLEXPORT int32_t SystemNative_GetSocketErrorOption(intptr_t socket, int32_t* error); +PALEXPORT int32_t SystemNative_GetSocketErrorOption(intptr_t socket, int32_t* error); -DLLEXPORT int32_t SystemNative_GetSockOpt( +PALEXPORT int32_t SystemNative_GetSockOpt( intptr_t socket, int32_t socketOptionLevel, int32_t socketOptionName, uint8_t* optionValue, int32_t* optionLen); -DLLEXPORT int32_t SystemNative_SetSockOpt( +PALEXPORT int32_t SystemNative_SetSockOpt( intptr_t socket, int32_t socketOptionLevel, int32_t socketOptionName, uint8_t* optionValue, int32_t optionLen); -DLLEXPORT int32_t SystemNative_Socket(int32_t addressFamily, int32_t socketType, int32_t protocolType, intptr_t* createdSocket); +PALEXPORT int32_t SystemNative_Socket(int32_t addressFamily, int32_t socketType, int32_t protocolType, intptr_t* createdSocket); -DLLEXPORT int32_t SystemNative_GetAtOutOfBandMark(intptr_t socket, int32_t* available); +PALEXPORT int32_t SystemNative_GetAtOutOfBandMark(intptr_t socket, int32_t* available); -DLLEXPORT int32_t SystemNative_GetBytesAvailable(intptr_t socket, int32_t* available); +PALEXPORT int32_t SystemNative_GetBytesAvailable(intptr_t socket, int32_t* available); -DLLEXPORT int32_t SystemNative_CreateSocketEventPort(intptr_t* port); +PALEXPORT int32_t SystemNative_CreateSocketEventPort(intptr_t* port); -DLLEXPORT int32_t SystemNative_CloseSocketEventPort(intptr_t port); +PALEXPORT int32_t SystemNative_CloseSocketEventPort(intptr_t port); -DLLEXPORT int32_t SystemNative_CreateSocketEventBuffer(int32_t count, SocketEvent** buffer); +PALEXPORT int32_t SystemNative_CreateSocketEventBuffer(int32_t count, SocketEvent** buffer); -DLLEXPORT int32_t SystemNative_FreeSocketEventBuffer(SocketEvent* buffer); +PALEXPORT int32_t SystemNative_FreeSocketEventBuffer(SocketEvent* buffer); -DLLEXPORT int32_t SystemNative_TryChangeSocketEventRegistration( +PALEXPORT int32_t SystemNative_TryChangeSocketEventRegistration( intptr_t port, intptr_t socket, int32_t currentEvents, int32_t newEvents, uintptr_t data); -DLLEXPORT int32_t SystemNative_WaitForSocketEvents(intptr_t port, SocketEvent* buffer, int32_t* count); +PALEXPORT int32_t SystemNative_WaitForSocketEvents(intptr_t port, SocketEvent* buffer, int32_t* count); -DLLEXPORT int32_t SystemNative_PlatformSupportsDualModeIPv4PacketInfo(void); +PALEXPORT int32_t SystemNative_PlatformSupportsDualModeIPv4PacketInfo(void); -DLLEXPORT char* SystemNative_GetPeerUserName(intptr_t socket); +PALEXPORT char* SystemNative_GetPeerUserName(intptr_t socket); -DLLEXPORT void SystemNative_GetDomainSocketSizes(int32_t* pathOffset, int32_t* pathSize, int32_t* addressSize); +PALEXPORT void SystemNative_GetDomainSocketSizes(int32_t* pathOffset, int32_t* pathSize, int32_t* addressSize); -DLLEXPORT int32_t SystemNative_SendFile(intptr_t out_fd, intptr_t in_fd, int64_t offset, int64_t count, int64_t* sent); +PALEXPORT int32_t SystemNative_SendFile(intptr_t out_fd, intptr_t in_fd, int64_t offset, int64_t count, int64_t* sent); -DLLEXPORT int32_t SystemNative_Disconnect(intptr_t socket); +PALEXPORT int32_t SystemNative_Disconnect(intptr_t socket); -DLLEXPORT uint32_t SystemNative_InterfaceNameToIndex(char* interfaceName); +PALEXPORT uint32_t SystemNative_InterfaceNameToIndex(char* interfaceName); diff --git a/src/libraries/Native/Unix/System.Native/pal_networkstatistics.h b/src/libraries/Native/Unix/System.Native/pal_networkstatistics.h index 7434152..8dbae90 100644 --- a/src/libraries/Native/Unix/System.Native/pal_networkstatistics.h +++ b/src/libraries/Native/Unix/System.Native/pal_networkstatistics.h @@ -149,24 +149,24 @@ typedef struct uint64_t Flags; } NativeIPInterfaceStatistics; -DLLEXPORT int32_t SystemNative_GetTcpGlobalStatistics(TcpGlobalStatistics* retStats); +PALEXPORT int32_t SystemNative_GetTcpGlobalStatistics(TcpGlobalStatistics* retStats); -DLLEXPORT int32_t SystemNative_GetIPv4GlobalStatistics(IPv4GlobalStatistics* retStats); +PALEXPORT int32_t SystemNative_GetIPv4GlobalStatistics(IPv4GlobalStatistics* retStats); -DLLEXPORT int32_t SystemNative_GetUdpGlobalStatistics(UdpGlobalStatistics* retStats); +PALEXPORT int32_t SystemNative_GetUdpGlobalStatistics(UdpGlobalStatistics* retStats); -DLLEXPORT int32_t SystemNative_GetIcmpv4GlobalStatistics(Icmpv4GlobalStatistics* retStats); +PALEXPORT int32_t SystemNative_GetIcmpv4GlobalStatistics(Icmpv4GlobalStatistics* retStats); -DLLEXPORT int32_t SystemNative_GetIcmpv6GlobalStatistics(Icmpv6GlobalStatistics* retStats); +PALEXPORT int32_t SystemNative_GetIcmpv6GlobalStatistics(Icmpv6GlobalStatistics* retStats); -DLLEXPORT int32_t SystemNative_GetEstimatedTcpConnectionCount(void); +PALEXPORT int32_t SystemNative_GetEstimatedTcpConnectionCount(void); -DLLEXPORT int32_t SystemNative_GetActiveTcpConnectionInfos(NativeTcpConnectionInformation* infos, int32_t* infoCount); +PALEXPORT int32_t SystemNative_GetActiveTcpConnectionInfos(NativeTcpConnectionInformation* infos, int32_t* infoCount); -DLLEXPORT int32_t SystemNative_GetEstimatedUdpListenerCount(void); +PALEXPORT int32_t SystemNative_GetEstimatedUdpListenerCount(void); -DLLEXPORT int32_t SystemNative_GetActiveUdpListeners(IPEndPointInfo* infos, int32_t* infoCount); +PALEXPORT int32_t SystemNative_GetActiveUdpListeners(IPEndPointInfo* infos, int32_t* infoCount); -DLLEXPORT int32_t SystemNative_GetNativeIPInterfaceStatistics(char* interfaceName, NativeIPInterfaceStatistics* retStats); +PALEXPORT int32_t SystemNative_GetNativeIPInterfaceStatistics(char* interfaceName, NativeIPInterfaceStatistics* retStats); -DLLEXPORT int32_t SystemNative_GetNumRoutes(void); +PALEXPORT int32_t SystemNative_GetNumRoutes(void); diff --git a/src/libraries/Native/Unix/System.Native/pal_process.h b/src/libraries/Native/Unix/System.Native/pal_process.h index cb5add6..d75f25b 100644 --- a/src/libraries/Native/Unix/System.Native/pal_process.h +++ b/src/libraries/Native/Unix/System.Native/pal_process.h @@ -19,7 +19,7 @@ * As would have been the case with fork/execve, a return value of 0 is success and -1 * is failure; if failure, error information is provided in errno. */ -DLLEXPORT int32_t SystemNative_ForkAndExecProcess( +PALEXPORT int32_t SystemNative_ForkAndExecProcess( const char* filename, // filename argument to execve char* const argv[], // argv argument to execve char* const envp[], // envp argument to execve @@ -40,12 +40,12 @@ DLLEXPORT int32_t SystemNative_ForkAndExecProcess( /** * Shim for the popen function. */ -DLLEXPORT FILE* SystemNative_POpen(const char* command, const char* type); +PALEXPORT FILE* SystemNative_POpen(const char* command, const char* type); /** * Shim for the pclose function. */ -DLLEXPORT int32_t SystemNative_PClose(FILE* stream); +PALEXPORT int32_t SystemNative_PClose(FILE* stream); /************ * The values below in the header are fixed and correct for managed callers to use forever. @@ -173,40 +173,40 @@ typedef struct * Get the current limit for the specified resource of the current process. * Returns 0 on success; returns -1 on failure and errno is set to the error reason. */ -DLLEXPORT int32_t SystemNative_GetRLimit(RLimitResources resourceType, RLimit* limits); +PALEXPORT int32_t SystemNative_GetRLimit(RLimitResources resourceType, RLimit* limits); /** * Set the soft and hard limits for the specified resource. * Only a super-user can increase hard limits for the current process. * Returns 0 on success; returns -1 on failure and errno is set to the error reason. */ -DLLEXPORT int32_t SystemNative_SetRLimit(RLimitResources resourceType, const RLimit* limits); +PALEXPORT int32_t SystemNative_SetRLimit(RLimitResources resourceType, const RLimit* limits); /** * Kill the specified process (or process group) identified by the supplied pid; the * process or process group will be killed by the specified signal. * Returns 0 on success; on failure, -1 is returned and errno is set */ -DLLEXPORT int32_t SystemNative_Kill(int32_t pid, int32_t signal); +PALEXPORT int32_t SystemNative_Kill(int32_t pid, int32_t signal); /** * Returns the Process ID of the current executing process. * This call should never fail */ -DLLEXPORT int32_t SystemNative_GetPid(void); +PALEXPORT int32_t SystemNative_GetPid(void); /** * Returns the sessions ID of the specified process; if 0 is passed in, returns the * session ID of the current process. * Returns a session ID on success; otherwise, returns -1 and sets errno. */ -DLLEXPORT int32_t SystemNative_GetSid(int32_t pid); +PALEXPORT int32_t SystemNative_GetSid(int32_t pid); /** * Write a message to the system logger, which in turn writes the message to the system console, log files, etc. * See man 3 syslog for more info */ -DLLEXPORT void SystemNative_SysLog(SysLogPriority priority, const char* message, const char* arg1); +PALEXPORT void SystemNative_SysLog(SysLogPriority priority, const char* message, const char* arg1); /** * Returns the pid of a terminated child without reaping it. @@ -215,7 +215,7 @@ DLLEXPORT void SystemNative_SysLog(SysLogPriority priority, const char* message, * 2) if no children are terminated, 0 is returned * 3) on error, -1 is returned */ -DLLEXPORT int32_t SystemNative_WaitIdAnyExitedNoHangNoWait(void); +PALEXPORT int32_t SystemNative_WaitIdAnyExitedNoHangNoWait(void); /** * Reaps a terminated child. @@ -225,7 +225,7 @@ DLLEXPORT int32_t SystemNative_WaitIdAnyExitedNoHangNoWait(void); * 3) if the child has not yet terminated, 0 is returned * 4) on error, -1 is returned. */ -DLLEXPORT int32_t SystemNative_WaitPidExitedNoHang(int32_t pid, int32_t* exitCode); +PALEXPORT int32_t SystemNative_WaitPidExitedNoHang(int32_t pid, int32_t* exitCode); /** * Gets the configurable limit or variable for system path or file descriptor options. @@ -233,7 +233,7 @@ DLLEXPORT int32_t SystemNative_WaitPidExitedNoHang(int32_t pid, int32_t* exitCod * Returns the requested variable value on success; if the variable does not have a limit, -1 is returned and errno * is not set; otherwise, -1 is returned and errno is set. */ -DLLEXPORT int64_t SystemNative_PathConf(const char* path, PathConfName name); +PALEXPORT int64_t SystemNative_PathConf(const char* path, PathConfName name); /** * Gets the priority (nice value) of a certain execution group. @@ -242,19 +242,19 @@ DLLEXPORT int64_t SystemNative_PathConf(const char* path, PathConfName name); * valid nice value, meaning we can't use that value to determine valid output or not. Errno is set on failure so * we need to reset errno before a call and check the value if we get -1. */ -DLLEXPORT int32_t SystemNative_GetPriority(PriorityWhich which, int32_t who); +PALEXPORT int32_t SystemNative_GetPriority(PriorityWhich which, int32_t who); /** * Sets the priority (nice value) of a certain execution group. * * Returns 0 on success; otherwise, -1 and errno is set. */ -DLLEXPORT int32_t SystemNative_SetPriority(PriorityWhich which, int32_t who, int32_t nice); +PALEXPORT int32_t SystemNative_SetPriority(PriorityWhich which, int32_t who, int32_t nice); /** * Gets the current working directory of the currently executing process. */ -DLLEXPORT char* SystemNative_GetCwd(char* buffer, int32_t bufferSize); +PALEXPORT char* SystemNative_GetCwd(char* buffer, int32_t bufferSize); #if HAVE_SCHED_SETAFFINITY /** @@ -262,7 +262,7 @@ DLLEXPORT char* SystemNative_GetCwd(char* buffer, int32_t bufferSize); * * Returns 0 on success; otherwise, -1 is returned and errno is set */ -DLLEXPORT int32_t SystemNative_SchedSetAffinity(int32_t pid, intptr_t* mask); +PALEXPORT int32_t SystemNative_SchedSetAffinity(int32_t pid, intptr_t* mask); #endif #if HAVE_SCHED_GETAFFINITY @@ -271,5 +271,5 @@ DLLEXPORT int32_t SystemNative_SchedSetAffinity(int32_t pid, intptr_t* mask); * * Returns 0 on success; otherwise, -1 is returned and errno is set. */ -DLLEXPORT int32_t SystemNative_SchedGetAffinity(int32_t pid, intptr_t* mask); +PALEXPORT int32_t SystemNative_SchedGetAffinity(int32_t pid, intptr_t* mask); #endif diff --git a/src/libraries/Native/Unix/System.Native/pal_random.h b/src/libraries/Native/Unix/System.Native/pal_random.h index b828d32..bde525b 100644 --- a/src/libraries/Native/Unix/System.Native/pal_random.h +++ b/src/libraries/Native/Unix/System.Native/pal_random.h @@ -7,4 +7,4 @@ #include "pal_compiler.h" #include "pal_types.h" -DLLEXPORT void SystemNative_GetNonCryptographicallySecureRandomBytes(uint8_t* buffer, int32_t bufferLength); +PALEXPORT void SystemNative_GetNonCryptographicallySecureRandomBytes(uint8_t* buffer, int32_t bufferLength); diff --git a/src/libraries/Native/Unix/System.Native/pal_runtimeextensions.h b/src/libraries/Native/Unix/System.Native/pal_runtimeextensions.h index b92d76b..ff7fca1 100644 --- a/src/libraries/Native/Unix/System.Native/pal_runtimeextensions.h +++ b/src/libraries/Native/Unix/System.Native/pal_runtimeextensions.h @@ -7,4 +7,4 @@ #include "pal_compiler.h" #include "pal_types.h" -DLLEXPORT int32_t SystemNative_GetNodeName(char* version, int* capacity); +PALEXPORT int32_t SystemNative_GetNodeName(char* version, int* capacity); diff --git a/src/libraries/Native/Unix/System.Native/pal_runtimeinformation.h b/src/libraries/Native/Unix/System.Native/pal_runtimeinformation.h index 370a6b4..8265fef 100644 --- a/src/libraries/Native/Unix/System.Native/pal_runtimeinformation.h +++ b/src/libraries/Native/Unix/System.Native/pal_runtimeinformation.h @@ -7,15 +7,15 @@ #include "pal_compiler.h" #include "pal_types.h" -DLLEXPORT const char* SystemNative_GetUnixName(void); +PALEXPORT const char* SystemNative_GetUnixName(void); -DLLEXPORT char* SystemNative_GetUnixRelease(void); +PALEXPORT char* SystemNative_GetUnixRelease(void); -DLLEXPORT int32_t SystemNative_GetUnixVersion(char* version, int* capacity); +PALEXPORT int32_t SystemNative_GetUnixVersion(char* version, int* capacity); -DLLEXPORT int32_t SystemNative_GetOSArchitecture(void); +PALEXPORT int32_t SystemNative_GetOSArchitecture(void); -DLLEXPORT int32_t SystemNative_GetProcessArchitecture(void); +PALEXPORT int32_t SystemNative_GetProcessArchitecture(void); enum { diff --git a/src/libraries/Native/Unix/System.Native/pal_signal.h b/src/libraries/Native/Unix/System.Native/pal_signal.h index 41e51e0..752cbf0 100644 --- a/src/libraries/Native/Unix/System.Native/pal_signal.h +++ b/src/libraries/Native/Unix/System.Native/pal_signal.h @@ -22,7 +22,7 @@ int32_t InitializeSignalHandlingCore(void); * * Should only be called when a callback is not currently registered. */ -DLLEXPORT void SystemNative_RegisterForCtrl(CtrlCallback callback); +PALEXPORT void SystemNative_RegisterForCtrl(CtrlCallback callback); /** * Unregisters the previously registered ctrlCCallback. @@ -34,7 +34,7 @@ DLLEXPORT void SystemNative_RegisterForCtrl(CtrlCallback callback); * previously registered must remain valid until all ctrl handling activity * has quiesced. */ -DLLEXPORT void SystemNative_UnregisterForCtrl(void); +PALEXPORT void SystemNative_UnregisterForCtrl(void); typedef void (*SigChldCallback)(int reapAll); @@ -43,7 +43,7 @@ typedef void (*SigChldCallback)(int reapAll); * * Should only be called when a callback is not currently registered. */ -DLLEXPORT void SystemNative_RegisterForSigChld(SigChldCallback callback); +PALEXPORT void SystemNative_RegisterForSigChld(SigChldCallback callback); /** * Remove our handler and reissue the signal to be picked up by the previously registered handler. @@ -51,7 +51,7 @@ DLLEXPORT void SystemNative_RegisterForSigChld(SigChldCallback callback); * In the most common case, this will be the default handler, causing the process to be torn down. * It could also be a custom handler registered by other code before us. */ -DLLEXPORT void SystemNative_RestoreAndHandleCtrl(CtrlCode ctrlCode); +PALEXPORT void SystemNative_RestoreAndHandleCtrl(CtrlCode ctrlCode); typedef void (*TerminalInvalidationCallback)(void); @@ -59,4 +59,4 @@ typedef void (*TerminalInvalidationCallback)(void); * Hooks up the specified callback for notifications when SIGCHLD, SIGCONT, SIGWINCH are received. * */ -DLLEXPORT void SystemNative_SetTerminalInvalidationHandler(TerminalInvalidationCallback callback); +PALEXPORT void SystemNative_SetTerminalInvalidationHandler(TerminalInvalidationCallback callback); diff --git a/src/libraries/Native/Unix/System.Native/pal_string.h b/src/libraries/Native/Unix/System.Native/pal_string.h index 380c75e..331d7d8 100644 --- a/src/libraries/Native/Unix/System.Native/pal_string.h +++ b/src/libraries/Native/Unix/System.Native/pal_string.h @@ -15,4 +15,4 @@ * success; if the return value is equal to the size then the result may have been truncated. * On failure, returns a negative value. */ -DLLEXPORT int32_t SystemNative_SNPrintF(char* string, int32_t size, const char* format, ...); +PALEXPORT int32_t SystemNative_SNPrintF(char* string, int32_t size, const char* format, ...); diff --git a/src/libraries/Native/Unix/System.Native/pal_sysctl.h b/src/libraries/Native/Unix/System.Native/pal_sysctl.h index b9c9408..1064da5 100644 --- a/src/libraries/Native/Unix/System.Native/pal_sysctl.h +++ b/src/libraries/Native/Unix/System.Native/pal_sysctl.h @@ -8,4 +8,4 @@ #include "pal_types.h" #include "pal_errno.h" -DLLEXPORT int32_t SystemNative_Sysctl(int* name, unsigned int namelen, void* value, size_t* len); +PALEXPORT int32_t SystemNative_Sysctl(int* name, unsigned int namelen, void* value, size_t* len); diff --git a/src/libraries/Native/Unix/System.Native/pal_tcpstate.h b/src/libraries/Native/Unix/System.Native/pal_tcpstate.h index 1bc36ce6..7d096fc 100644 --- a/src/libraries/Native/Unix/System.Native/pal_tcpstate.h +++ b/src/libraries/Native/Unix/System.Native/pal_tcpstate.h @@ -24,4 +24,4 @@ typedef enum TcpState_DeleteTcb } TcpState; -DLLEXPORT int32_t SystemNative_MapTcpState(int32_t tcpState); +PALEXPORT int32_t SystemNative_MapTcpState(int32_t tcpState); diff --git a/src/libraries/Native/Unix/System.Native/pal_time.h b/src/libraries/Native/Unix/System.Native/pal_time.h index 0a9c980..ae0b50b 100644 --- a/src/libraries/Native/Unix/System.Native/pal_time.h +++ b/src/libraries/Native/Unix/System.Native/pal_time.h @@ -26,17 +26,17 @@ typedef struct ProcessCpuInformation * * Returns 0 on success; otherwise, returns -1 and errno is set. */ -DLLEXPORT int32_t SystemNative_UTimensat(const char* path, TimeSpec* times); +PALEXPORT int32_t SystemNative_UTimensat(const char* path, TimeSpec* times); /** * Gets the resolution of the timestamp, in counts per second. */ -DLLEXPORT uint64_t SystemNative_GetTimestampResolution(void); +PALEXPORT uint64_t SystemNative_GetTimestampResolution(void); /** * Gets a high-resolution timestamp that can be used for time-interval measurements. */ -DLLEXPORT uint64_t SystemNative_GetTimestamp(void); +PALEXPORT uint64_t SystemNative_GetTimestamp(void); /** * The main purpose of this function is to compute the overall CPU utilization @@ -47,4 +47,4 @@ DLLEXPORT uint64_t SystemNative_GetTimestamp(void); * returned is sum of utilization accross all processors, e.g. this function will * return 200 when two cores are running at 100%. */ -DLLEXPORT int32_t SystemNative_GetCpuUtilization(ProcessCpuInformation* previousCpuInfo); +PALEXPORT int32_t SystemNative_GetCpuUtilization(ProcessCpuInformation* previousCpuInfo); diff --git a/src/libraries/Native/Unix/System.Native/pal_uid.h b/src/libraries/Native/Unix/System.Native/pal_uid.h index b32916c..3117fa0 100644 --- a/src/libraries/Native/Unix/System.Native/pal_uid.h +++ b/src/libraries/Native/Unix/System.Native/pal_uid.h @@ -30,7 +30,7 @@ typedef struct * number for any other failure. * */ -DLLEXPORT int32_t SystemNative_GetPwUidR(uint32_t uid, Passwd* pwd, char* buf, int32_t buflen); +PALEXPORT int32_t SystemNative_GetPwUidR(uint32_t uid, Passwd* pwd, char* buf, int32_t buflen); /** * Gets a password structure for the given user name. @@ -39,7 +39,7 @@ DLLEXPORT int32_t SystemNative_GetPwUidR(uint32_t uid, Passwd* pwd, char* buf, i * Returns 0 for success, -1 if no entry found, positive error * number for any other failure. */ -DLLEXPORT int32_t SystemNative_GetPwNamR(const char* name, Passwd* pwd, char* buf, int32_t buflen); +PALEXPORT int32_t SystemNative_GetPwNamR(const char* name, Passwd* pwd, char* buf, int32_t buflen); /** * Gets and returns the effective user's identity. @@ -47,7 +47,7 @@ DLLEXPORT int32_t SystemNative_GetPwNamR(const char* name, Passwd* pwd, char* bu * * Always succeeds. */ -DLLEXPORT uint32_t SystemNative_GetEUid(void); +PALEXPORT uint32_t SystemNative_GetEUid(void); /** * Gets and returns the effective group's identity. @@ -55,7 +55,7 @@ DLLEXPORT uint32_t SystemNative_GetEUid(void); * * Always succeeds. */ -DLLEXPORT uint32_t SystemNative_GetEGid(void); +PALEXPORT uint32_t SystemNative_GetEGid(void); /** * Sets the effective user ID of the calling process @@ -63,7 +63,7 @@ DLLEXPORT uint32_t SystemNative_GetEGid(void); * * Returns 0 for success. On error, -1 is returned and errno is set. */ -DLLEXPORT int32_t SystemNative_SetEUid(uint32_t euid); +PALEXPORT int32_t SystemNative_SetEUid(uint32_t euid); /** * Gets the list of groups to which a user belongs. @@ -73,7 +73,7 @@ DLLEXPORT int32_t SystemNative_SetEUid(uint32_t euid); * If the buffer is too small, -1 is returned and ngroups contains the required size. * On error, -1 is returned and errno is set. */ -DLLEXPORT int32_t SystemNative_GetGroupList(const char* name, uint32_t group, uint32_t* groups, int32_t* ngroups); +PALEXPORT int32_t SystemNative_GetGroupList(const char* name, uint32_t group, uint32_t* groups, int32_t* ngroups); /** * Gets and returns the real user's identity. @@ -81,4 +81,4 @@ DLLEXPORT int32_t SystemNative_GetGroupList(const char* name, uint32_t group, ui * * Always succeeds. */ -DLLEXPORT uint32_t SystemNative_GetUid(void); +PALEXPORT uint32_t SystemNative_GetUid(void); diff --git a/src/libraries/Native/Unix/System.Net.Security.Native/pal_gssapi.h b/src/libraries/Native/Unix/System.Net.Security.Native/pal_gssapi.h index 58b9ef9..11e232d0 100644 --- a/src/libraries/Native/Unix/System.Net.Security.Native/pal_gssapi.h +++ b/src/libraries/Native/Unix/System.Net.Security.Native/pal_gssapi.h @@ -56,30 +56,30 @@ typedef struct /* Shims the gss_release_buffer method. */ -DLLEXPORT void NetSecurityNative_ReleaseGssBuffer(void* buffer, uint64_t length); +PALEXPORT void NetSecurityNative_ReleaseGssBuffer(void* buffer, uint64_t length); /* Shims the gss_display_status method for minor status (status_type = GSS_C_MECH_CODE). */ -DLLEXPORT uint32_t +PALEXPORT uint32_t NetSecurityNative_DisplayMinorStatus(uint32_t* minorStatus, uint32_t statusValue, PAL_GssBuffer* outBuffer); /* Shims the gss_display_status method for major status (status_type = GSS_C_GSS_CODE). */ -DLLEXPORT uint32_t +PALEXPORT uint32_t NetSecurityNative_DisplayMajorStatus(uint32_t* minorStatus, uint32_t statusValue, PAL_GssBuffer* outBuffer); /* Shims the gss_import_name method with nametype = GSS_C_NT_USER_NAME. */ -DLLEXPORT uint32_t +PALEXPORT uint32_t NetSecurityNative_ImportUserName(uint32_t* minorStatus, char* inputName, uint32_t inputNameLen, GssName** outputName); /* Shims the gss_import_name method with nametype = GSS_C_NT_USER_NAME. */ -DLLEXPORT uint32_t NetSecurityNative_ImportPrincipalName(uint32_t* minorStatus, +PALEXPORT uint32_t NetSecurityNative_ImportPrincipalName(uint32_t* minorStatus, char* inputName, uint32_t inputNameLen, GssName** outputName); @@ -87,28 +87,28 @@ DLLEXPORT uint32_t NetSecurityNative_ImportPrincipalName(uint32_t* minorStatus, /* Shims the gss_release_name method. */ -DLLEXPORT uint32_t NetSecurityNative_ReleaseName(uint32_t* minorStatus, GssName** inputName); +PALEXPORT uint32_t NetSecurityNative_ReleaseName(uint32_t* minorStatus, GssName** inputName); /* Shims the gss_acquire_cred method with GSS_C_ACCEPT. */ -DLLEXPORT uint32_t NetSecurityNative_AcquireAcceptorCred(uint32_t* minorStatus, GssCredId** outputCredHandle); +PALEXPORT uint32_t NetSecurityNative_AcquireAcceptorCred(uint32_t* minorStatus, GssCredId** outputCredHandle); /* Shims the gss_acquire_cred method with SPNEGO oids with GSS_C_INITIATE. */ -DLLEXPORT uint32_t +PALEXPORT uint32_t NetSecurityNative_InitiateCredSpNego(uint32_t* minorStatus, GssName* desiredName, GssCredId** outputCredHandle); /* Shims the gss_release_cred method. */ -DLLEXPORT uint32_t NetSecurityNative_ReleaseCred(uint32_t* minorStatus, GssCredId** credHandle); +PALEXPORT uint32_t NetSecurityNative_ReleaseCred(uint32_t* minorStatus, GssCredId** credHandle); /* Shims the gss_init_sec_context method with SPNEGO oids. */ -DLLEXPORT uint32_t NetSecurityNative_InitSecContext(uint32_t* minorStatus, +PALEXPORT uint32_t NetSecurityNative_InitSecContext(uint32_t* minorStatus, GssCredId* claimantCredHandle, GssCtxId** contextHandle, uint32_t isNtlm, @@ -120,7 +120,7 @@ DLLEXPORT uint32_t NetSecurityNative_InitSecContext(uint32_t* minorStatus, uint32_t* retFlags, int32_t* isNtlmUsed); -DLLEXPORT uint32_t NetSecurityNative_InitSecContextEx(uint32_t* minorStatus, +PALEXPORT uint32_t NetSecurityNative_InitSecContextEx(uint32_t* minorStatus, GssCredId* claimantCredHandle, GssCtxId** contextHandle, uint32_t isNtlm, @@ -137,7 +137,7 @@ DLLEXPORT uint32_t NetSecurityNative_InitSecContextEx(uint32_t* minorStatus, /* Shims the gss_accept_sec_context method. */ -DLLEXPORT uint32_t NetSecurityNative_AcceptSecContext(uint32_t* minorStatus, +PALEXPORT uint32_t NetSecurityNative_AcceptSecContext(uint32_t* minorStatus, GssCredId* acceptorCredHandle, GssCtxId** contextHandle, uint8_t* inputBytes, @@ -150,12 +150,12 @@ DLLEXPORT uint32_t NetSecurityNative_AcceptSecContext(uint32_t* minorStatus, Shims the gss_delete_sec_context method. */ -DLLEXPORT uint32_t NetSecurityNative_DeleteSecContext(uint32_t* minorStatus, GssCtxId** contextHandle); +PALEXPORT uint32_t NetSecurityNative_DeleteSecContext(uint32_t* minorStatus, GssCtxId** contextHandle); /* Shims the gss_wrap method. */ -DLLEXPORT uint32_t NetSecurityNative_Wrap(uint32_t* minorStatus, +PALEXPORT uint32_t NetSecurityNative_Wrap(uint32_t* minorStatus, GssCtxId* contextHandle, int32_t isEncrypt, uint8_t* inputBytes, @@ -166,7 +166,7 @@ DLLEXPORT uint32_t NetSecurityNative_Wrap(uint32_t* minorStatus, /* Shims the gss_unwrap method. */ -DLLEXPORT uint32_t NetSecurityNative_Unwrap(uint32_t* minorStatus, +PALEXPORT uint32_t NetSecurityNative_Unwrap(uint32_t* minorStatus, GssCtxId* contextHandle, uint8_t* inputBytes, int32_t offset, @@ -176,7 +176,7 @@ DLLEXPORT uint32_t NetSecurityNative_Unwrap(uint32_t* minorStatus, /* Shims the gss_acquire_cred_with_password method with GSS_C_INITIATE. */ -DLLEXPORT uint32_t NetSecurityNative_InitiateCredWithPassword(uint32_t* minorStatus, +PALEXPORT uint32_t NetSecurityNative_InitiateCredWithPassword(uint32_t* minorStatus, int32_t isNtlm, GssName* desiredName, char* password, @@ -186,11 +186,11 @@ DLLEXPORT uint32_t NetSecurityNative_InitiateCredWithPassword(uint32_t* minorSta /* Shims the gss_indicate_mechs method to detect if NTLM mech is installed. */ -DLLEXPORT uint32_t NetSecurityNative_IsNtlmInstalled(void); +PALEXPORT uint32_t NetSecurityNative_IsNtlmInstalled(void); /* Shims gss_inquire_context and gss_display_name to get the remote user principal name. */ -DLLEXPORT uint32_t NetSecurityNative_GetUser(uint32_t* minorStatus, +PALEXPORT uint32_t NetSecurityNative_GetUser(uint32_t* minorStatus, GssCtxId* contextHandle, PAL_GssBuffer* outBuffer); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_digest.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_digest.h index 5d31aa2..72e6574 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_digest.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_digest.h @@ -26,7 +26,7 @@ typedef struct digest_ctx_st DigestCtx; /* Free the resources held by a DigestCtx */ -DLLEXPORT void AppleCryptoNative_DigestFree(DigestCtx* pDigest); +PALEXPORT void AppleCryptoNative_DigestFree(DigestCtx* pDigest); /* Create a digest handle for the specified algorithm. @@ -35,18 +35,18 @@ Returns NULL when the algorithm is unknown, or pcbDigest is NULL; otherwise retu to a digest context suitable for calling DigestUpdate and DigestFinal on and sets pcbDigest to the size of the digest output. */ -DLLEXPORT DigestCtx* AppleCryptoNative_DigestCreate(PAL_HashAlgorithm algorithm, int32_t* pcbDigest); +PALEXPORT DigestCtx* AppleCryptoNative_DigestCreate(PAL_HashAlgorithm algorithm, int32_t* pcbDigest); /* Apply cbBuf bytes of data from pBuf to the ongoing digest represented in ctx. Returns 1 on success, 0 on failure, any other value on invalid inputs/state. */ -DLLEXPORT int32_t AppleCryptoNative_DigestUpdate(DigestCtx* ctx, uint8_t* pBuf, int32_t cbBuf); +PALEXPORT int32_t AppleCryptoNative_DigestUpdate(DigestCtx* ctx, uint8_t* pBuf, int32_t cbBuf); /* Complete the digest in ctx, copying the results to pOutput, and reset ctx for a new digest. Returns 1 on success, 0 on failure, any other value on invalid inputs/state. */ -DLLEXPORT int32_t AppleCryptoNative_DigestFinal(DigestCtx* ctx, uint8_t* pOutput, int32_t cbOutput); +PALEXPORT int32_t AppleCryptoNative_DigestFinal(DigestCtx* ctx, uint8_t* pOutput, int32_t cbOutput); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ecc.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ecc.h index 71df9e2..3ae5da5 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ecc.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ecc.h @@ -14,7 +14,7 @@ Generate an ECC keypair of the specified size. Returns 1 on success, 0 on failure. On failure, *pOSStatus should carry the OS failure code. */ -DLLEXPORT int32_t AppleCryptoNative_EccGenerateKey(int32_t keySizeBits, +PALEXPORT int32_t AppleCryptoNative_EccGenerateKey(int32_t keySizeBits, SecKeychainRef tempKeychain, SecKeyRef* pPublicKey, SecKeyRef* pPrivateKey, @@ -25,4 +25,4 @@ Get the keysize, in bits, of an ECC key. Returns the keysize, in bits, of the ECC key, or 0 on error. */ -DLLEXPORT uint64_t AppleCryptoNative_EccGetKeySizeInBits(SecKeyRef publicKey); +PALEXPORT uint64_t AppleCryptoNative_EccGetKeySizeInBits(SecKeyRef publicKey); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_hmac.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_hmac.h index 1268234..59b8330 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_hmac.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_hmac.h @@ -13,7 +13,7 @@ typedef struct hmac_ctx_st HmacCtx; /* Free a HmacCtx created by AppleCryptoNative_HmacCreate */ -DLLEXPORT void AppleCryptoNative_HmacFree(HmacCtx* pHmac); +PALEXPORT void AppleCryptoNative_HmacFree(HmacCtx* pHmac); /* Create an HmacCtx for the specified algorithm, receiving the hash output size in pcbHmac. @@ -23,25 +23,25 @@ it should be freed via AppleCryptoNative_HmacFree regardless of a negative pbHma Returns NULL on error, an unkeyed HmacCtx otherwise. */ -DLLEXPORT HmacCtx* AppleCryptoNative_HmacCreate(PAL_HashAlgorithm algorithm, int32_t* pcbHmac); +PALEXPORT HmacCtx* AppleCryptoNative_HmacCreate(PAL_HashAlgorithm algorithm, int32_t* pcbHmac); /* Initialize an HMAC to the correct key and start state. Returns 1 on success, 0 on error. */ -DLLEXPORT int32_t AppleCryptoNative_HmacInit(HmacCtx* ctx, uint8_t* pbKey, int32_t cbKey); +PALEXPORT int32_t AppleCryptoNative_HmacInit(HmacCtx* ctx, uint8_t* pbKey, int32_t cbKey); /* Add data into the HMAC Returns 1 on success, 0 on error. */ -DLLEXPORT int32_t AppleCryptoNative_HmacUpdate(HmacCtx* ctx, uint8_t* pbData, int32_t cbData); +PALEXPORT int32_t AppleCryptoNative_HmacUpdate(HmacCtx* ctx, uint8_t* pbData, int32_t cbData); /* Complete the HMAC and copy the result into pbOutput. Returns 1 on success, 0 on error. */ -DLLEXPORT int32_t AppleCryptoNative_HmacFinal(HmacCtx* ctx, uint8_t* pbOutput); +PALEXPORT int32_t AppleCryptoNative_HmacFinal(HmacCtx* ctx, uint8_t* pbOutput); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keyagree.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keyagree.h index 32c65f6..153972a 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keyagree.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keyagree.h @@ -14,5 +14,5 @@ Perform the EC Diffie-Hellman key agreement between the provided keys. Follows pal_seckey return conventions. */ -DLLEXPORT int32_t +PALEXPORT int32_t AppleCryptoNative_EcdhKeyAgree(SecKeyRef privateKey, SecKeyRef publicKey, CFDataRef* pAgreeOut, CFErrorRef* pErrorOut); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.h index e7b8681..7dbcd5e 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.h @@ -18,7 +18,7 @@ Errors of the item having no keychain are suppressed, returning success (0) with For all other situations, see SecKeychainItemCopyKeychain documentation. */ -DLLEXPORT int32_t AppleCryptoNative_SecKeychainItemCopyKeychain(SecKeychainItemRef item, SecKeychainRef* pKeychainOut); +PALEXPORT int32_t AppleCryptoNative_SecKeychainItemCopyKeychain(SecKeychainItemRef item, SecKeychainRef* pKeychainOut); /* Create a keychain at the specified location with a given (UTF-8 encoded) lock passphrase. @@ -28,7 +28,7 @@ Returns the result of SecKeychainCreate. Output: pKeychainOut: The SecKeychainRef created by this function */ -DLLEXPORT int32_t AppleCryptoNative_SecKeychainCreate(const char* pathName, +PALEXPORT int32_t AppleCryptoNative_SecKeychainCreate(const char* pathName, uint32_t passphraseLength, const uint8_t* passphraseUtf8, SecKeychainRef* pKeychainOut); @@ -38,7 +38,7 @@ Delete a keychain, including the file on disk. Returns the result of SecKeychainDelete */ -DLLEXPORT int32_t AppleCryptoNative_SecKeychainDelete(SecKeychainRef keychain); +PALEXPORT int32_t AppleCryptoNative_SecKeychainDelete(SecKeychainRef keychain); /* Open the default keychain. @@ -49,7 +49,7 @@ Returns the result of SecKeychainCopyDefault. Output: pKeyChainOut: Receives the SecKeychainRef for the default keychain. */ -DLLEXPORT int32_t AppleCryptoNative_SecKeychainCopyDefault(SecKeychainRef* pKeychainOut); +PALEXPORT int32_t AppleCryptoNative_SecKeychainCopyDefault(SecKeychainRef* pKeychainOut); /* Open the named keychain (full path to the file). @@ -59,14 +59,14 @@ Returns the result of SecKeychainOpen. Output: pKeychainOut: Receives the SecKeychainRef for the named keychain. */ -DLLEXPORT int32_t AppleCryptoNative_SecKeychainOpen(const char* pszKeychainPath, SecKeychainRef* pKeychainOut); +PALEXPORT int32_t AppleCryptoNative_SecKeychainOpen(const char* pszKeychainPath, SecKeychainRef* pKeychainOut); /* Unlock an opened keychain with a given (UTF-8 encoded) lock passphrase. Returns the result of SecKeychainUnlock. */ -DLLEXPORT int32_t AppleCryptoNative_SecKeychainUnlock(SecKeychainRef keychain, +PALEXPORT int32_t AppleCryptoNative_SecKeychainUnlock(SecKeychainRef keychain, uint32_t passphraseLength, const uint8_t* passphraseUtf8); @@ -75,7 +75,7 @@ Set a keychain to never (automatically) lock. Returns the result of SecKeychainSetSettings to a never-auto-lock policy. */ -DLLEXPORT int32_t AppleCryptoNative_SetKeychainNeverLock(SecKeychainRef keychain); +PALEXPORT int32_t AppleCryptoNative_SetKeychainNeverLock(SecKeychainRef keychain); /* Enumerate the certificate objects within the given keychain. @@ -87,7 +87,7 @@ pCertsOut: When the return value is not 1, NULL. Otherwise NULL on "no certs fou (including a single match). pOSStatus: Receives the last OSStatus value. */ -DLLEXPORT int32_t +PALEXPORT int32_t AppleCryptoNative_SecKeychainEnumerateCerts(SecKeychainRef keychain, CFArrayRef* pCertsOut, int32_t* pOSStatus); /* @@ -103,7 +103,7 @@ pCertsOut: When the return value is not 1, NULL. Otherwise NULL on "no certs fou (including a single match). pOSStatus: Receives the last OSStatus value. */ -DLLEXPORT int32_t AppleCryptoNative_SecKeychainEnumerateIdentities(SecKeychainRef keychain, +PALEXPORT int32_t AppleCryptoNative_SecKeychainEnumerateIdentities(SecKeychainRef keychain, CFArrayRef* pIdentitiesOut, int32_t* pOSStatus); @@ -118,7 +118,7 @@ any other value is invalid Output: pOSStatus: Receives the last OSStatus value.. */ -DLLEXPORT int32_t +PALEXPORT int32_t AppleCryptoNative_X509StoreAddCertificate(CFTypeRef certOrIdentity, SecKeychainRef keychain, int32_t* pOSStatus); /* @@ -135,5 +135,5 @@ any other value is invalid Output: pOSStatus: Receives the last OSStatus value.. */ -DLLEXPORT int32_t +PALEXPORT int32_t AppleCryptoNative_X509StoreRemoveCertificate(CFTypeRef certOrIdentity, SecKeychainRef keychain, uint8_t isReadOnlyMode, int32_t* pOSStatus); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_random.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_random.h index 311cad6..615291e 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_random.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_random.h @@ -12,4 +12,4 @@ Shims CCRandomGenerateBytes, putting the resulting CCRNGStatus value in pkCCStat Returns 1 on success, 0 on system error (see pkCCStatus), -1 on input error. */ -DLLEXPORT int32_t AppleCryptoNative_GetRandomBytes(uint8_t* pBuf, uint32_t cbBuf, int32_t* pkCCStatus); +PALEXPORT int32_t AppleCryptoNative_GetRandomBytes(uint8_t* pBuf, uint32_t cbBuf, int32_t* pkCCStatus); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.h index ae2a8fd..b9d0834 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.h @@ -15,7 +15,7 @@ Generate a new RSA keypair with the specified key size, in bits. Returns 1 on success, 0 on failure. On failure, *pOSStatus should contain the OS reported error. */ -DLLEXPORT int32_t AppleCryptoNative_RsaGenerateKey(int32_t keySizeBits, +PALEXPORT int32_t AppleCryptoNative_RsaGenerateKey(int32_t keySizeBits, SecKeychainRef tempKeychain, SecKeyRef* pPublicKey, SecKeyRef* pPrivateKey, @@ -26,7 +26,7 @@ Decrypt the contents of pbData using the provided privateKey under OAEP padding. Follows pal_seckey return conventions. */ -DLLEXPORT int32_t AppleCryptoNative_RsaDecryptOaep(SecKeyRef privateKey, +PALEXPORT int32_t AppleCryptoNative_RsaDecryptOaep(SecKeyRef privateKey, uint8_t* pbData, int32_t cbData, PAL_HashAlgorithm mfgAlgorithm, @@ -38,7 +38,7 @@ Decrypt the contents of pbData using the provided privateKey under PKCS#1 paddin Follows pal_seckey return conventions. */ -DLLEXPORT int32_t AppleCryptoNative_RsaDecryptPkcs( +PALEXPORT int32_t AppleCryptoNative_RsaDecryptPkcs( SecKeyRef privateKey, uint8_t* pbData, int32_t cbData, CFDataRef* pDecryptedOut, CFErrorRef* pErrorOut); /* @@ -46,7 +46,7 @@ Encrypt pbData for the provided publicKey using OAEP padding. Follows pal_seckey return conventions. */ -DLLEXPORT int32_t AppleCryptoNative_RsaEncryptOaep(SecKeyRef publicKey, +PALEXPORT int32_t AppleCryptoNative_RsaEncryptOaep(SecKeyRef publicKey, uint8_t* pbData, int32_t cbData, PAL_HashAlgorithm mgfAlgorithm, @@ -58,7 +58,7 @@ Encrypt pbData for the provided publicKey using PKCS#1 padding. Follows pal_seckey return conventions. */ -DLLEXPORT int32_t AppleCryptoNative_RsaEncryptPkcs( +PALEXPORT int32_t AppleCryptoNative_RsaEncryptPkcs( SecKeyRef publicKey, uint8_t* pbData, int32_t cbData, CFDataRef* pEncryptedOut, CFErrorRef* pErrorOut); /* @@ -66,7 +66,7 @@ Apply an RSA private key to a signing operation on data which was already padded Follows pal_seckey return conventions. */ -DLLEXPORT int32_t AppleCryptoNative_RsaSignaturePrimitive( +PALEXPORT int32_t AppleCryptoNative_RsaSignaturePrimitive( SecKeyRef privateKey, uint8_t* pbData, int32_t cbData, CFDataRef* pDataOut, CFErrorRef* pErrorOut); /* @@ -74,7 +74,7 @@ Apply an RSA private key to an encryption operation to emit data which is still Follows pal_seckey return conventions. */ -DLLEXPORT int32_t AppleCryptoNative_RsaDecryptionPrimitive( +PALEXPORT int32_t AppleCryptoNative_RsaDecryptionPrimitive( SecKeyRef privateKey, uint8_t* pbData, int32_t cbData, CFDataRef* pDataOut, CFErrorRef* pErrorOut); /* @@ -82,7 +82,7 @@ Apply an RSA public key to an encryption operation on data which was already pad Follows pal_seckey return conventions. */ -DLLEXPORT int32_t AppleCryptoNative_RsaEncryptionPrimitive( +PALEXPORT int32_t AppleCryptoNative_RsaEncryptionPrimitive( SecKeyRef publicKey, uint8_t* pbData, int32_t cbData, CFDataRef* pDataOut, CFErrorRef* pErrorOut); /* @@ -90,5 +90,5 @@ Apply an RSA public key to a signing operation to emit data which is still padde Follows pal_seckey return conventions. */ -DLLEXPORT int32_t AppleCryptoNative_RsaVerificationPrimitive( +PALEXPORT int32_t AppleCryptoNative_RsaVerificationPrimitive( SecKeyRef publicKey, uint8_t* pbData, int32_t cbData, CFDataRef* pDataOut, CFErrorRef* pErrorOut); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_sec.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_sec.h index 4317d72..4e81d6b 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_sec.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_sec.h @@ -15,4 +15,4 @@ Get an error message for an OSStatus error from the security library. Returns NULL if no message is available for the code. */ -DLLEXPORT CFStringRef AppleCryptoNative_SecCopyErrorMessageString(OSStatus osStatus); +PALEXPORT CFStringRef AppleCryptoNative_SecCopyErrorMessageString(OSStatus osStatus); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_seckey.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_seckey.h index a0f0f39..a645d86 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_seckey.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_seckey.h @@ -31,7 +31,7 @@ An export passphrase is required for private keys, and ignored for public keys. Follows pal_seckey return conventions. */ -DLLEXPORT int32_t AppleCryptoNative_SecKeyExport( +PALEXPORT int32_t AppleCryptoNative_SecKeyExport( SecKeyRef pKey, int32_t exportPrivate, CFStringRef cfExportPassphrase, CFDataRef* ppDataOut, int32_t* pOSStatus); /* @@ -46,7 +46,7 @@ but is in fact the X.509 SubjectPublicKeyInfo structure. Returns 1 on success, 0 on failure (*pOSStatus should be set) and negative numbers for various state machine errors. */ -DLLEXPORT int32_t AppleCryptoNative_SecKeyImportEphemeral( +PALEXPORT int32_t AppleCryptoNative_SecKeyImportEphemeral( uint8_t* pbKeyBlob, int32_t cbKeyBlob, int32_t isPrivateKey, SecKeyRef* ppKeyOut, int32_t* pOSStatus); /* @@ -57,7 +57,7 @@ For ECC the value should not be used. 0 is returned for invalid inputs. */ -DLLEXPORT uint64_t AppleCryptoNative_SecKeyGetSimpleKeySizeInBytes(SecKeyRef publicKey); +PALEXPORT uint64_t AppleCryptoNative_SecKeyGetSimpleKeySizeInBytes(SecKeyRef publicKey); /* Export a key and re-import it to the NULL keychain. diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_signverify.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_signverify.h index d872649..37060b9 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_signverify.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_signverify.h @@ -15,7 +15,7 @@ Generate a signature for algorithms which require only the data hash blob, like Follows pal_seckey return conventions. */ -DLLEXPORT int32_t AppleCryptoNative_GenerateSignature( +PALEXPORT int32_t AppleCryptoNative_GenerateSignature( SecKeyRef privateKey, uint8_t* pbDataHash, int32_t cbDataHash, CFDataRef* pSignatureOut, CFErrorRef* pErrorOut); /* @@ -23,7 +23,7 @@ Generate a signature for algorithms which require the pair of (dataHash, algorit Follows pal_seckey return conventions. */ -DLLEXPORT int32_t AppleCryptoNative_GenerateSignatureWithHashAlgorithm(SecKeyRef privateKey, +PALEXPORT int32_t AppleCryptoNative_GenerateSignatureWithHashAlgorithm(SecKeyRef privateKey, uint8_t* pbDataHash, int32_t cbDataHash, PAL_HashAlgorithm hashAlgorithm, @@ -36,7 +36,7 @@ Verify a signature for algorithms which only require the data hash blob, like DS Returns 1 when the signature is correct, 0 when it is incorrect, and otherwise follows pal_seckey return conventions. */ -DLLEXPORT int32_t AppleCryptoNative_VerifySignatureWithHashAlgorithm(SecKeyRef publicKey, +PALEXPORT int32_t AppleCryptoNative_VerifySignatureWithHashAlgorithm(SecKeyRef publicKey, uint8_t* pbDataHash, int32_t cbDataHash, uint8_t* pbSignature, @@ -50,7 +50,7 @@ Verify a signature for algorithms which require the pair of (dataHash, algorithm Returns 1 when the signature is correct, 0 when it is incorrect, and otherwise follows pal_seckey return conventions. */ -DLLEXPORT int32_t AppleCryptoNative_VerifySignature(SecKeyRef publicKey, +PALEXPORT int32_t AppleCryptoNative_VerifySignature(SecKeyRef publicKey, uint8_t* pbDataHash, int32_t cbDataHash, uint8_t* pbSignature, diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ssl.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ssl.h index 784d97b..48cff88 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ssl.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ssl.h @@ -44,28 +44,28 @@ Create an SSL context, for the Server or Client role as determined by isServer. Returns NULL if an invalid boolean is given for isServer, an SSLContextRef otherwise. */ -DLLEXPORT SSLContextRef AppleCryptoNative_SslCreateContext(int32_t isServer); +PALEXPORT SSLContextRef AppleCryptoNative_SslCreateContext(int32_t isServer); /* Indicate that an SSL Context (in server mode) should allow a client to present a mutual auth cert. Returns The result of SSLSetClientSideAuthenticate */ -DLLEXPORT int32_t AppleCryptoNative_SslSetAcceptClientCert(SSLContextRef sslContext); +PALEXPORT int32_t AppleCryptoNative_SslSetAcceptClientCert(SSLContextRef sslContext); /* Assign a minimum to the TLS protocol version for this connection. Returns the output of SSLSetProtocolVersionMin */ -DLLEXPORT int32_t AppleCryptoNative_SslSetMinProtocolVersion(SSLContextRef sslContext, PAL_SslProtocol sslProtocol); +PALEXPORT int32_t AppleCryptoNative_SslSetMinProtocolVersion(SSLContextRef sslContext, PAL_SslProtocol sslProtocol); /* Assign a maximum to the TLS protocol version for this connection. Returns the output of SSLSetProtocolVersionMax */ -DLLEXPORT int32_t AppleCryptoNative_SslSetMaxProtocolVersion(SSLContextRef sslContext, PAL_SslProtocol sslProtocol); +PALEXPORT int32_t AppleCryptoNative_SslSetMaxProtocolVersion(SSLContextRef sslContext, PAL_SslProtocol sslProtocol); /* Get the SecTrustRef from the SSL context which represents the certificte chain. @@ -76,7 +76,7 @@ Output: pChainOut: Receives the SecTrustRef representing the populated chain pOSStatus: Receives the value returned by SSLCopyPeerTrust */ -DLLEXPORT int32_t +PALEXPORT int32_t AppleCryptoNative_SslCopyCertChain(SSLContextRef sslContext, SecTrustRef* pChainOut, int32_t* pOSStatus); /* @@ -90,7 +90,7 @@ values sent by the server. pOSStatus: Receives the output of SSLCopyDistinguishedNames. */ -DLLEXPORT int32_t +PALEXPORT int32_t AppleCryptoNative_SslCopyCADistinguishedNames(SSLContextRef sslContext, CFArrayRef* pArrayOut, int32_t* pOSStatus); /* @@ -101,7 +101,7 @@ Returns 1 on success, 0 on failure, other values on invalid state. Output: pOSStatus: Receives the value returned by SSLSetSessionOption */ -DLLEXPORT int32_t +PALEXPORT int32_t AppleCryptoNative_SslSetBreakOnServerAuth(SSLContextRef sslContext, int32_t setBreak, int32_t* pOSStatus); /* @@ -112,7 +112,7 @@ Returns 1 on success, 0 on failure, other values on invalid state. Output: pOSStatus: Receives the value returned by SSLSetSessionOption */ -DLLEXPORT int32_t +PALEXPORT int32_t AppleCryptoNative_SslSetBreakOnClientAuth(SSLContextRef sslContext, int32_t setBreak, int32_t* pOSStatus); /* @@ -124,7 +124,7 @@ intermediate (non-root) certificate. Returns the output of SSLSetCertificate */ -DLLEXPORT int32_t AppleCryptoNative_SslSetCertificate(SSLContextRef sslContext, CFArrayRef certRefs); +PALEXPORT int32_t AppleCryptoNative_SslSetCertificate(SSLContextRef sslContext, CFArrayRef certRefs); /* Set the target hostname for SNI. pszTargetName must already be converted for IDNA if required. @@ -134,7 +134,7 @@ Returns 1 on success, 0 on failure, other values for invalid state. Output: pOSStatus: Receives the value for SSLSetPeerDomainName */ -DLLEXPORT int32_t AppleCryptoNative_SslSetTargetName(SSLContextRef sslContext, +PALEXPORT int32_t AppleCryptoNative_SslSetTargetName(SSLContextRef sslContext, const char* pszTargetName, int32_t cbTargetName, int32_t* pOSStatus); @@ -147,19 +147,19 @@ Returns 1 on success, 0 on failure, other values for invalid state. Output: pOSStatus: Receives the value from SSLSetALPNData() */ -DLLEXPORT int32_t AppleCryptoNative_SSLSetALPNProtocols(SSLContextRef sslContext, CFArrayRef protocols, int32_t* pOSStatus); +PALEXPORT int32_t AppleCryptoNative_SSLSetALPNProtocols(SSLContextRef sslContext, CFArrayRef protocols, int32_t* pOSStatus); /* Get negotiated protocol value from ServerHello. */ -DLLEXPORT int32_t AppleCryptoNative_SslGetAlpnSelected(SSLContextRef sslContext, CFDataRef *protocol); +PALEXPORT int32_t AppleCryptoNative_SslGetAlpnSelected(SSLContextRef sslContext, CFDataRef *protocol); /* Register the callbacks for reading and writing data to the SSL context. Returns the output of SSLSetIOFuncs. */ -DLLEXPORT int32_t +PALEXPORT int32_t AppleCryptoNative_SslSetIoCallbacks(SSLContextRef sslContext, SSLReadFunc readFunc, SSLWriteFunc writeFunc); /* @@ -167,7 +167,7 @@ Pump the TLS handshake. Returns an indication of what state the error is in. Any negative number means an error occurred. */ -DLLEXPORT PAL_TlsHandshakeState AppleCryptoNative_SslHandshake(SSLContextRef sslContext); +PALEXPORT PAL_TlsHandshakeState AppleCryptoNative_SslHandshake(SSLContextRef sslContext); /* Take bufLen bytes of cleartext data from buf and encrypt/frame the data. @@ -180,7 +180,7 @@ bytesWritten: When any value other than PAL_TlsIo_Success is returned, receives which were read from buf. On PAL_TlsIo_Success the parameter is not written through (but must still not be NULL) */ -DLLEXPORT PAL_TlsIo +PALEXPORT PAL_TlsIo AppleCryptoNative_SslWrite(SSLContextRef sslContext, const uint8_t* buf, uint32_t bufLen, uint32_t* bytesWritten); /* @@ -193,7 +193,7 @@ Returns a PAL_TlsIo code indicating how to proceed. Output: written: Receives the number of bytes written into buf */ -DLLEXPORT PAL_TlsIo +PALEXPORT PAL_TlsIo AppleCryptoNative_SslRead(SSLContextRef sslContext, uint8_t* buf, uint32_t bufLen, uint32_t* written); /* @@ -204,7 +204,7 @@ the certificate being expired (or not yet valid). Returns 1 on match, 0 on mismatch, any other value indicates an invalid state. */ -DLLEXPORT int32_t +PALEXPORT int32_t AppleCryptoNative_SslIsHostnameMatch(SSLContextRef sslContext, CFStringRef cfHostname, CFDateRef notBefore, int32_t* pOSStatus); /* @@ -212,7 +212,7 @@ Generate a TLS Close alert to terminate the session. Returns the output of SSLClose */ -DLLEXPORT int32_t AppleCryptoNative_SslShutdown(SSLContextRef sslContext); +PALEXPORT int32_t AppleCryptoNative_SslShutdown(SSLContextRef sslContext); /* Retrieve the TLS Protocol Version (e.g. TLS1.2) for the current session. @@ -222,7 +222,7 @@ Returns the output of SSLGetNegotiatedProtocolVersion. Output: pProtocol: Receives the protocol ID. PAL_SslProtocol_None is issued on error or an unknown mapping. */ -DLLEXPORT int32_t AppleCryptoNative_SslGetProtocolVersion(SSLContextRef sslContext, PAL_SslProtocol* pProtocol); +PALEXPORT int32_t AppleCryptoNative_SslGetProtocolVersion(SSLContextRef sslContext, PAL_SslProtocol* pProtocol); /* Retrieve the TLS Cipher Suite which was negotiated for the current session. @@ -233,11 +233,11 @@ Output: pProtocol: The TLS CipherSuite value (from the RFC), e.g. ((uint16_t)0xC030) for TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 */ -DLLEXPORT int32_t AppleCryptoNative_SslGetCipherSuite(SSLContextRef sslContext, uint16_t* pCipherSuiteOut); +PALEXPORT int32_t AppleCryptoNative_SslGetCipherSuite(SSLContextRef sslContext, uint16_t* pCipherSuiteOut); /* Sets enabled cipher suites for the current session. Returns the output of SSLSetEnabledCiphers. */ -DLLEXPORT int32_t AppleCryptoNative_SslSetEnabledCipherSuites(SSLContextRef sslContext, const uint32_t* cipherSuites, int32_t numCipherSuites); +PALEXPORT int32_t AppleCryptoNative_SslSetEnabledCipherSuites(SSLContextRef sslContext, const uint32_t* cipherSuites, int32_t numCipherSuites); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_symmetric.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_symmetric.h index 458f96a..9bbab56 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_symmetric.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_symmetric.h @@ -54,7 +54,7 @@ typedef uint32_t PAL_SymmetricOptions; /* Free a CCCryptor created by AppleCryptoNative_CryptorCreate. */ -DLLEXPORT void AppleCryptoNative_CryptorFree(CCCryptorRef cryptor); +PALEXPORT void AppleCryptoNative_CryptorFree(CCCryptorRef cryptor); /* Create a CCCryptor for the described symmetric algorithm with a chosen operation, chainingMode, @@ -66,7 +66,7 @@ algorithm and assumed valid. pbIv is only allowed to be NULL for PAL_ChainingMod Returns 1 on success, 0 on system error, -1 on input error. */ -DLLEXPORT int32_t AppleCryptoNative_CryptorCreate(PAL_SymmetricOperation operation, +PALEXPORT int32_t AppleCryptoNative_CryptorCreate(PAL_SymmetricOperation operation, PAL_SymmetricAlgorithm algorithm, PAL_ChainingMode chainingMode, PAL_PaddingMode paddingMode, @@ -82,7 +82,7 @@ Shims CCCryptorUpdate, updating *pkCCStatus as its output. Returns 1 on success, 0 on system error, -1 on input error. */ -DLLEXPORT int32_t AppleCryptoNative_CryptorUpdate(CCCryptorRef cryptor, +PALEXPORT int32_t AppleCryptoNative_CryptorUpdate(CCCryptorRef cryptor, const uint8_t* pbData, int32_t cbData, uint32_t* pbOutput, @@ -95,7 +95,7 @@ Shims CCCryptorFinal, updating *pkCCStatus as its output. Returns 1 on success, 0 on system error, -1 on input error. */ -DLLEXPORT int32_t AppleCryptoNative_CryptorFinal( +PALEXPORT int32_t AppleCryptoNative_CryptorFinal( CCCryptorRef cryptor, uint8_t* pbOutput, int32_t cbOutput, int32_t* pcbWritten, int32_t* pkCCStatus); /* @@ -103,4 +103,4 @@ Shims CCCryptorReset, updating *pkCCStatus as its output. Returns 1 on success, 0 on system error, -1 on input error. */ -DLLEXPORT int32_t AppleCryptoNative_CryptorReset(CCCryptorRef cryptor, const uint8_t* pbIv, int32_t* pkCCStatus); +PALEXPORT int32_t AppleCryptoNative_CryptorReset(CCCryptorRef cryptor, const uint8_t* pbIv, int32_t* pkCCStatus); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_trust.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_trust.h index 1523a22..ae2ee23 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_trust.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_trust.h @@ -19,7 +19,7 @@ pCertsOut: When the return value is not 1, NULL. Otherwise NULL on "no certs fou (including a single match). pOSStatus: Receives the last OSStatus value. */ -DLLEXPORT int32_t AppleCryptoNative_StoreEnumerateUserRoot(CFArrayRef* pCertsOut, int32_t* pOSStatusOut); +PALEXPORT int32_t AppleCryptoNative_StoreEnumerateUserRoot(CFArrayRef* pCertsOut, int32_t* pOSStatusOut); /* Enumerate the certificates which are root trusted by the machine ("admin" and "system" domains). @@ -34,7 +34,7 @@ pCertsOut: When the return value is not 1, NULL. Otherwise NULL on "no certs fou (including a single match). pOSStatus: Receives the last OSStatus value. */ -DLLEXPORT int32_t AppleCryptoNative_StoreEnumerateMachineRoot(CFArrayRef* pCertsOut, int32_t* pOSStatusOut); +PALEXPORT int32_t AppleCryptoNative_StoreEnumerateMachineRoot(CFArrayRef* pCertsOut, int32_t* pOSStatusOut); /* Enumerate the certificates which are disallowed by the user. @@ -46,7 +46,7 @@ pCertsOut: When the return value is not 1, NULL. Otherwise NULL on "no certs fou (including a single match). pOSStatus: Receives the last OSStatus value. */ -DLLEXPORT int32_t AppleCryptoNative_StoreEnumerateUserDisallowed(CFArrayRef* pCertsOut, int32_t* pOSStatusOut); +PALEXPORT int32_t AppleCryptoNative_StoreEnumerateUserDisallowed(CFArrayRef* pCertsOut, int32_t* pOSStatusOut); /* Enumerate the certificates which are disallowed by the machine ("admin" and "system" domains). @@ -61,4 +61,4 @@ pCertsOut: When the return value is not 1, NULL. Otherwise NULL on "no certs fou (including a single match). pOSStatus: Receives the last OSStatus value. */ -DLLEXPORT int32_t AppleCryptoNative_StoreEnumerateMachineDisallowed(CFArrayRef* pCertsOut, int32_t* pOSStatusOut); +PALEXPORT int32_t AppleCryptoNative_StoreEnumerateMachineDisallowed(CFArrayRef* pCertsOut, int32_t* pOSStatusOut); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509.h index 844065f..951a25a 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509.h @@ -32,7 +32,7 @@ Output: pCertOut: If handle is a certificate, receives handle, otherwise NULL pIdentityut: If handle is an identity, receives handle, otherwise NULL */ -DLLEXPORT int32_t +PALEXPORT int32_t AppleCryptoNative_X509DemuxAndRetainHandle(CFTypeRef handle, SecCertificateRef* pCertOut, SecIdentityRef* pIdentityOut); /* @@ -44,7 +44,7 @@ Output: pPublicKeyOut: Receives a CFRetain()ed SecKeyRef for the public key pOSStatusOut: Receives the result of SecCertificateCopyKey or SecCertificateCopyPublicKey, depending on the OS version. */ -DLLEXPORT int32_t +PALEXPORT int32_t AppleCryptoNative_X509GetPublicKey(SecCertificateRef cert, SecKeyRef* pPublicKeyOut, int32_t* pOSStatusOut); /* @@ -52,7 +52,7 @@ Determines the data type of the provided input. Returns the data (format) type of the provided input, PAL_X509Unknown if it cannot be determined. */ -DLLEXPORT PAL_X509ContentType AppleCryptoNative_X509GetContentType(uint8_t* pbData, int32_t cbData); +PALEXPORT PAL_X509ContentType AppleCryptoNative_X509GetContentType(uint8_t* pbData, int32_t cbData); /* Extract a SecCertificateRef for the certificate from an identity handle. @@ -62,7 +62,7 @@ Returns the result of SecIdentityCopyCertificate. Output: pCertOut: Receives a SecCertificateRef for the certificate associated with the identity */ -DLLEXPORT int32_t AppleCryptoNative_X509CopyCertFromIdentity(SecIdentityRef identity, SecCertificateRef* pCertOut); +PALEXPORT int32_t AppleCryptoNative_X509CopyCertFromIdentity(SecIdentityRef identity, SecCertificateRef* pCertOut); /* Extract a SecKeyRef for the private key from an identity handle. @@ -72,7 +72,7 @@ Returns the result of SecIdentityCopyPrivateKey Output: pPrivateKeyOut: Receives a SecKeyRef for the private key associated with the identity */ -DLLEXPORT int32_t AppleCryptoNative_X509CopyPrivateKeyFromIdentity(SecIdentityRef identity, SecKeyRef* pPrivateKeyOut); +PALEXPORT int32_t AppleCryptoNative_X509CopyPrivateKeyFromIdentity(SecIdentityRef identity, SecKeyRef* pPrivateKeyOut); /* Read cbData bytes of data from pbData and interpret it to a collection of certificates (or identities). @@ -90,7 +90,7 @@ pCollectionOut: Receives an array which contains SecCertificateRef, SecIdentityR read out of the provided blob pOSStatus: Receives the output of SecItemImport for the last attempted read */ -DLLEXPORT int32_t AppleCryptoNative_X509ImportCollection(uint8_t* pbData, +PALEXPORT int32_t AppleCryptoNative_X509ImportCollection(uint8_t* pbData, int32_t cbData, PAL_X509ContentType contentType, CFStringRef cfPfxPassphrase, @@ -120,7 +120,7 @@ pCertOut: If the best matched value was a certificate, receives the SecCertifica pIdentityOut: If the best matched value was an identity, receives the SecIdentityRef, otherwise receives NULL pOSStatus: Receives the return of the last call to SecItemImport */ -DLLEXPORT int32_t AppleCryptoNative_X509ImportCertificate(uint8_t* pbData, +PALEXPORT int32_t AppleCryptoNative_X509ImportCertificate(uint8_t* pbData, int32_t cbData, PAL_X509ContentType contentType, CFStringRef cfPfxPassphrase, @@ -141,7 +141,7 @@ Output: pExportOut: Receives a CFDataRef with the exported blob pOSStatus: Receives the result of SecItemExport */ -DLLEXPORT int32_t AppleCryptoNative_X509ExportData(CFArrayRef data, +PALEXPORT int32_t AppleCryptoNative_X509ExportData(CFArrayRef data, PAL_X509ContentType type, CFStringRef cfExportPassphrase, CFDataRef* pExportOut, @@ -156,7 +156,7 @@ Output: ppDataOut: Receives a CFDataRef with the exported blob pOSStatus: Receives the result of SecItemExport */ -DLLEXPORT int32_t AppleCryptoNative_X509GetRawData(SecCertificateRef cert, CFDataRef* ppDataOut, int32_t* pOSStatus); +PALEXPORT int32_t AppleCryptoNative_X509GetRawData(SecCertificateRef cert, CFDataRef* ppDataOut, int32_t* pOSStatus); /* Find a SecIdentityRef for the given cert and private key in the target keychain. @@ -169,7 +169,7 @@ Output: pIdentityOut: Receives the SecIdentityRef of the mated cert/key pair. pOSStatus: Receives the result of the last executed system call. */ -DLLEXPORT int32_t AppleCryptoNative_X509CopyWithPrivateKey(SecCertificateRef cert, +PALEXPORT int32_t AppleCryptoNative_X509CopyWithPrivateKey(SecCertificateRef cert, SecKeyRef privateKey, SecKeychainRef targetKeychain, SecIdentityRef* pIdentityOut, @@ -186,7 +186,7 @@ Output: pIdentityOut: Receives the SecIdentityRef of the mated cert/key pair, when applicable. pOSStatus: Receives the result of the last executed system call. */ -DLLEXPORT int32_t AppleCryptoNative_X509MoveToKeychain(SecCertificateRef cert, +PALEXPORT int32_t AppleCryptoNative_X509MoveToKeychain(SecCertificateRef cert, SecKeychainRef keychain, SecKeyRef privateKey, SecIdentityRef* pIdentityOut, diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509chain.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509chain.h index 1fcf322..599d240 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509chain.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509chain.h @@ -49,12 +49,12 @@ typedef uint64_t PAL_X509ChainErrorFlags; /* Create a SecPolicyRef representing the basic X.509 policy */ -DLLEXPORT SecPolicyRef AppleCryptoNative_X509ChainCreateDefaultPolicy(void); +PALEXPORT SecPolicyRef AppleCryptoNative_X509ChainCreateDefaultPolicy(void); /* Create a SecPolicyRef which checks for revocation (OCSP or CRL) */ -DLLEXPORT SecPolicyRef AppleCryptoNative_X509ChainCreateRevocationPolicy(void); +PALEXPORT SecPolicyRef AppleCryptoNative_X509ChainCreateRevocationPolicy(void); /* Create a SecTrustRef to build a chain over the specified certificates with the given policies. @@ -69,7 +69,7 @@ Output: pTrustOut: Receives the SecTrustRef to build the chain, in an unbuilt state pOSStatus: Receives the result of SecTrustCreateWithCertificates */ -DLLEXPORT int32_t +PALEXPORT int32_t AppleCryptoNative_X509ChainCreate(CFTypeRef certs, CFTypeRef policies, SecTrustRef* pTrustOut, int32_t* pOSStatus); /* @@ -83,7 +83,7 @@ state. Note that an untrusted chain building successfully still returns 1. Output: pOSStatus: Receives the result of SecTrustEvaluate */ -DLLEXPORT int32_t AppleCryptoNative_X509ChainEvaluate(SecTrustRef chain, +PALEXPORT int32_t AppleCryptoNative_X509ChainEvaluate(SecTrustRef chain, CFDateRef cfEvaluationTime, bool allowNetwork, int32_t* pOSStatus); @@ -91,19 +91,19 @@ DLLEXPORT int32_t AppleCryptoNative_X509ChainEvaluate(SecTrustRef chain, /* Gets the number of certificates in the chain. */ -DLLEXPORT int64_t AppleCryptoNative_X509ChainGetChainSize(SecTrustRef chain); +PALEXPORT int64_t AppleCryptoNative_X509ChainGetChainSize(SecTrustRef chain); /* Fetches the SecCertificateRef at a given position in the chain. Position 0 is the End-Entity certificate, postiion 1 is the issuer of position 0, et cetera. */ -DLLEXPORT SecCertificateRef AppleCryptoNative_X509ChainGetCertificateAtIndex(SecTrustRef chain, int64_t index); +PALEXPORT SecCertificateRef AppleCryptoNative_X509ChainGetCertificateAtIndex(SecTrustRef chain, int64_t index); /* Get a CFRetain()ed array of dictionaries which contain the detailed results for each element in the certificate chain. */ -DLLEXPORT CFArrayRef AppleCryptoNative_X509ChainGetTrustResults(SecTrustRef chain); +PALEXPORT CFArrayRef AppleCryptoNative_X509ChainGetTrustResults(SecTrustRef chain); /* Get the PAL_X509ChainStatusFlags values for the certificate at the requested position within the @@ -114,7 +114,7 @@ Returns 0 on success, non-zero on error. Output: pdwStatus: Receives a flags value for the various status codes that went awry at the given position */ -DLLEXPORT int32_t AppleCryptoNative_X509ChainGetStatusAtIndex(CFArrayRef details, int64_t index, int32_t* pdwStatus); +PALEXPORT int32_t AppleCryptoNative_X509ChainGetStatusAtIndex(CFArrayRef details, int64_t index, int32_t* pdwStatus); /* Looks up the equivalent OSStatus code for a given PAL_X509ChainStatusFlags single-bit value. @@ -124,9 +124,9 @@ Returns errSecCoreFoundationUnknown on bad/unmapped input, otherwise the appropr Note that PAL_X509ChainNotTimeValid is an ambiguous code, it could be errSecCertificateExpired or errSecCertificateNotValidYet. A caller should resolve that code via other means. */ -DLLEXPORT int32_t AppleCryptoNative_GetOSStatusForChainStatus(PAL_X509ChainStatusFlags chainStatusFlag); +PALEXPORT int32_t AppleCryptoNative_GetOSStatusForChainStatus(PAL_X509ChainStatusFlags chainStatusFlag); /* Sets the trusted certificates used when evaluating a chain. */ -DLLEXPORT int32_t AppleCryptoNative_X509ChainSetTrustAnchorCertificates(SecTrustRef chain, CFArrayRef anchorCertificates); +PALEXPORT int32_t AppleCryptoNative_X509ChainSetTrustAnchorCertificates(SecTrustRef chain, CFArrayRef anchorCertificates); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/openssl.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/openssl.h index 1b46040..8e1ff96 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/openssl.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/openssl.h @@ -8,46 +8,46 @@ #include "pal_compiler.h" #include "opensslshim.h" -DLLEXPORT int32_t CryptoNative_GetX509Thumbprint(X509* x509, uint8_t* pBuf, int32_t cBuf); +PALEXPORT int32_t CryptoNative_GetX509Thumbprint(X509* x509, uint8_t* pBuf, int32_t cBuf); -DLLEXPORT const ASN1_TIME* CryptoNative_GetX509NotBefore(X509* x509); +PALEXPORT const ASN1_TIME* CryptoNative_GetX509NotBefore(X509* x509); -DLLEXPORT const ASN1_TIME* CryptoNative_GetX509NotAfter(X509* x509); +PALEXPORT const ASN1_TIME* CryptoNative_GetX509NotAfter(X509* x509); -DLLEXPORT const ASN1_TIME* CryptoNative_GetX509CrlNextUpdate(X509_CRL* crl); +PALEXPORT const ASN1_TIME* CryptoNative_GetX509CrlNextUpdate(X509_CRL* crl); -DLLEXPORT int32_t CryptoNative_GetX509Version(X509* x509); +PALEXPORT int32_t CryptoNative_GetX509Version(X509* x509); -DLLEXPORT ASN1_OBJECT* CryptoNative_GetX509PublicKeyAlgorithm(X509* x509); +PALEXPORT ASN1_OBJECT* CryptoNative_GetX509PublicKeyAlgorithm(X509* x509); -DLLEXPORT ASN1_OBJECT* CryptoNative_GetX509SignatureAlgorithm(X509* x509); +PALEXPORT ASN1_OBJECT* CryptoNative_GetX509SignatureAlgorithm(X509* x509); -DLLEXPORT int32_t CryptoNative_GetX509PublicKeyParameterBytes(X509* x509, uint8_t* pBuf, int32_t cBuf); +PALEXPORT int32_t CryptoNative_GetX509PublicKeyParameterBytes(X509* x509, uint8_t* pBuf, int32_t cBuf); -DLLEXPORT ASN1_BIT_STRING* CryptoNative_GetX509PublicKeyBytes(X509* x509); +PALEXPORT ASN1_BIT_STRING* CryptoNative_GetX509PublicKeyBytes(X509* x509); -DLLEXPORT int32_t CryptoNative_GetAsn1StringBytes(ASN1_STRING* asn1, uint8_t* pBuf, int32_t cBuf); +PALEXPORT int32_t CryptoNative_GetAsn1StringBytes(ASN1_STRING* asn1, uint8_t* pBuf, int32_t cBuf); -DLLEXPORT int32_t CryptoNative_GetX509NameRawBytes(X509_NAME* x509Name, uint8_t* pBuf, int32_t cBuf); +PALEXPORT int32_t CryptoNative_GetX509NameRawBytes(X509_NAME* x509Name, uint8_t* pBuf, int32_t cBuf); -DLLEXPORT int32_t CryptoNative_GetX509EkuFieldCount(EXTENDED_KEY_USAGE* eku); +PALEXPORT int32_t CryptoNative_GetX509EkuFieldCount(EXTENDED_KEY_USAGE* eku); -DLLEXPORT ASN1_OBJECT* CryptoNative_GetX509EkuField(EXTENDED_KEY_USAGE* eku, int32_t loc); +PALEXPORT ASN1_OBJECT* CryptoNative_GetX509EkuField(EXTENDED_KEY_USAGE* eku, int32_t loc); -DLLEXPORT BIO* CryptoNative_GetX509NameInfo(X509* x509, int32_t nameType, int32_t forIssuer); +PALEXPORT BIO* CryptoNative_GetX509NameInfo(X509* x509, int32_t nameType, int32_t forIssuer); -DLLEXPORT int32_t CryptoNative_CheckX509Hostname(X509* x509, const char* hostname, int32_t cchHostname); +PALEXPORT int32_t CryptoNative_CheckX509Hostname(X509* x509, const char* hostname, int32_t cchHostname); -DLLEXPORT int32_t CryptoNative_CheckX509IpAddress( +PALEXPORT int32_t CryptoNative_CheckX509IpAddress( X509* x509, const uint8_t* addressBytes, int32_t addressBytesLen, const char* hostname, int32_t cchHostname); -DLLEXPORT int32_t CryptoNative_GetX509StackFieldCount(STACK_OF(X509) * stack); +PALEXPORT int32_t CryptoNative_GetX509StackFieldCount(STACK_OF(X509) * stack); -DLLEXPORT X509* CryptoNative_GetX509StackField(STACK_OF(X509) * stack, int loc); +PALEXPORT X509* CryptoNative_GetX509StackField(STACK_OF(X509) * stack, int loc); -DLLEXPORT void CryptoNative_RecursiveFreeX509Stack(STACK_OF(X509) * stack); +PALEXPORT void CryptoNative_RecursiveFreeX509Stack(STACK_OF(X509) * stack); -DLLEXPORT int32_t CryptoNative_X509StoreSetVerifyTime(X509_STORE* ctx, +PALEXPORT int32_t CryptoNative_X509StoreSetVerifyTime(X509_STORE* ctx, int32_t year, int32_t month, int32_t day, @@ -56,20 +56,20 @@ DLLEXPORT int32_t CryptoNative_X509StoreSetVerifyTime(X509_STORE* ctx, int32_t second, int32_t isDst); -DLLEXPORT X509* CryptoNative_ReadX509AsDerFromBio(BIO* bio); +PALEXPORT X509* CryptoNative_ReadX509AsDerFromBio(BIO* bio); -DLLEXPORT int32_t CryptoNative_BioTell(BIO* bio); +PALEXPORT int32_t CryptoNative_BioTell(BIO* bio); -DLLEXPORT int32_t CryptoNative_BioSeek(BIO* bio, int32_t ofs); +PALEXPORT int32_t CryptoNative_BioSeek(BIO* bio, int32_t ofs); -DLLEXPORT STACK_OF(X509) * CryptoNative_NewX509Stack(void); +PALEXPORT STACK_OF(X509) * CryptoNative_NewX509Stack(void); -DLLEXPORT int32_t CryptoNative_PushX509StackField(STACK_OF(X509) * stack, X509* x509); +PALEXPORT int32_t CryptoNative_PushX509StackField(STACK_OF(X509) * stack, X509* x509); -DLLEXPORT int32_t CryptoNative_GetRandomBytes(uint8_t* buf, int32_t num); +PALEXPORT int32_t CryptoNative_GetRandomBytes(uint8_t* buf, int32_t num); -DLLEXPORT int32_t CryptoNative_LookupFriendlyNameByOid(const char* oidValue, const char** friendlyName); +PALEXPORT int32_t CryptoNative_LookupFriendlyNameByOid(const char* oidValue, const char** friendlyName); -DLLEXPORT int32_t CryptoNative_EnsureOpenSslInitialized(void); +PALEXPORT int32_t CryptoNative_EnsureOpenSslInitialized(void); -DLLEXPORT int64_t CryptoNative_OpenSslVersionNumber(void); +PALEXPORT int64_t CryptoNative_OpenSslVersionNumber(void); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_asn1.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_asn1.h index 1650a45..93f193f 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_asn1.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_asn1.h @@ -21,79 +21,79 @@ typedef enum /* Direct shim to OBJ_txt2obj. */ -DLLEXPORT const ASN1_OBJECT* CryptoNative_ObjTxt2Obj(const char* s); +PALEXPORT const ASN1_OBJECT* CryptoNative_ObjTxt2Obj(const char* s); /* Direct shim to OBJ_obj2txt. */ -DLLEXPORT int32_t CryptoNative_ObjObj2Txt(char* buf, int32_t buf_len, const ASN1_OBJECT* a); +PALEXPORT int32_t CryptoNative_ObjObj2Txt(char* buf, int32_t buf_len, const ASN1_OBJECT* a); /* Retrieves the ASN1_OBJECT for the specified friendly name. Can return nullptr if there isn't a corresponding shared object. */ -DLLEXPORT const ASN1_OBJECT* CryptoNative_GetObjectDefinitionByName(const char* friendlyName); +PALEXPORT const ASN1_OBJECT* CryptoNative_GetObjectDefinitionByName(const char* friendlyName); /* Direct shim to OBJ_sn2nid. */ -DLLEXPORT int32_t CryptoNative_ObjSn2Nid(const char* sn); +PALEXPORT int32_t CryptoNative_ObjSn2Nid(const char* sn); /* Direct shim to OBJ_txt2nid. */ -DLLEXPORT int32_t CryptoNative_ObjTxt2Nid(const char* sn); +PALEXPORT int32_t CryptoNative_ObjTxt2Nid(const char* sn); /* Direct shim to OBJ_nid2obj. */ -DLLEXPORT const ASN1_OBJECT* CryptoNative_ObjNid2Obj(int32_t nid); +PALEXPORT const ASN1_OBJECT* CryptoNative_ObjNid2Obj(int32_t nid); /* Direct shim to ASN1_OBJECT_free. */ -DLLEXPORT void CryptoNative_Asn1ObjectFree(ASN1_OBJECT* a); +PALEXPORT void CryptoNative_Asn1ObjectFree(ASN1_OBJECT* a); /* Shims the d2i_ASN1_BIT_STRING method and makes it easier to invoke from managed code. */ -DLLEXPORT ASN1_BIT_STRING* CryptoNative_DecodeAsn1BitString(const uint8_t* buf, int32_t len); +PALEXPORT ASN1_BIT_STRING* CryptoNative_DecodeAsn1BitString(const uint8_t* buf, int32_t len); /* Direct shim to ASN1_BIT_STRING_free. */ -DLLEXPORT void CryptoNative_Asn1BitStringFree(ASN1_STRING* a); +PALEXPORT void CryptoNative_Asn1BitStringFree(ASN1_STRING* a); /* Direct shim to ASN1_OCTET_STRING_new. */ -DLLEXPORT ASN1_OCTET_STRING* CryptoNative_Asn1OctetStringNew(void); +PALEXPORT ASN1_OCTET_STRING* CryptoNative_Asn1OctetStringNew(void); /* Direct shim to ASN1_OCTET_STRING_set. */ -DLLEXPORT int32_t CryptoNative_Asn1OctetStringSet(ASN1_OCTET_STRING* s, const uint8_t* data, int32_t len); +PALEXPORT int32_t CryptoNative_Asn1OctetStringSet(ASN1_OCTET_STRING* s, const uint8_t* data, int32_t len); /* Direct shim to ASN1_OCTET_STRING_free. */ -DLLEXPORT void CryptoNative_Asn1OctetStringFree(ASN1_STRING* a); +PALEXPORT void CryptoNative_Asn1OctetStringFree(ASN1_STRING* a); /* Direct shim to ASN1_STRING_free. */ -DLLEXPORT void CryptoNative_Asn1StringFree(ASN1_STRING* a); +PALEXPORT void CryptoNative_Asn1StringFree(ASN1_STRING* a); /* Returns the number of bytes it will take to convert the ASN1_INTEGER to a DER format. */ -DLLEXPORT int32_t CryptoNative_GetAsn1IntegerDerSize(ASN1_INTEGER* i); +PALEXPORT int32_t CryptoNative_GetAsn1IntegerDerSize(ASN1_INTEGER* i); /* Shims the i2d_ASN1_INTEGER method. Returns the number of bytes written to buf. */ -DLLEXPORT int32_t CryptoNative_EncodeAsn1Integer(ASN1_INTEGER* i, uint8_t* buf); +PALEXPORT int32_t CryptoNative_EncodeAsn1Integer(ASN1_INTEGER* i, uint8_t* buf); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_bignum.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_bignum.h index 79da9b8..de8ad3f 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_bignum.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_bignum.h @@ -16,19 +16,19 @@ No-op if a is null. The given BIGNUM pointer is invalid after this call. Always succeeds. */ -DLLEXPORT void CryptoNative_BigNumDestroy(BIGNUM* a); +PALEXPORT void CryptoNative_BigNumDestroy(BIGNUM* a); /* Shims the BN_bin2bn method. */ -DLLEXPORT BIGNUM* CryptoNative_BigNumFromBinary(const uint8_t* s, int32_t len); +PALEXPORT BIGNUM* CryptoNative_BigNumFromBinary(const uint8_t* s, int32_t len); /* Shims the BN_bn2bin method. */ -DLLEXPORT int32_t CryptoNative_BigNumToBinary(const BIGNUM* a, uint8_t* to); +PALEXPORT int32_t CryptoNative_BigNumToBinary(const BIGNUM* a, uint8_t* to); /* Returns the number of bytes needed to export a BIGNUM. */ -DLLEXPORT int32_t CryptoNative_GetBigNumBytes(const BIGNUM* a); +PALEXPORT int32_t CryptoNative_GetBigNumBytes(const BIGNUM* a); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_bio.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_bio.h index 21a1989..2f465a9 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_bio.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_bio.h @@ -9,12 +9,12 @@ /* Creates a new memory-backed BIO instance. */ -DLLEXPORT BIO* CryptoNative_CreateMemoryBio(void); +PALEXPORT BIO* CryptoNative_CreateMemoryBio(void); /* Direct shim to BIO_new_file. */ -DLLEXPORT BIO* CryptoNative_BioNewFile(const char* filename, const char* mode); +PALEXPORT BIO* CryptoNative_BioNewFile(const char* filename, const char* mode); /* Cleans up and deletes a BIO instance. @@ -25,33 +25,33 @@ Implemented by: No-op if a is null. The given BIO pointer is invalid after this call. */ -DLLEXPORT int32_t CryptoNative_BioDestroy(BIO* a); +PALEXPORT int32_t CryptoNative_BioDestroy(BIO* a); /* Direct shim to BIO_gets. */ -DLLEXPORT int32_t CryptoNative_BioGets(BIO* b, char* buf, int32_t size); +PALEXPORT int32_t CryptoNative_BioGets(BIO* b, char* buf, int32_t size); /* Direct shim to BIO_read. */ -DLLEXPORT int32_t CryptoNative_BioRead(BIO* b, void* buf, int32_t len); +PALEXPORT int32_t CryptoNative_BioRead(BIO* b, void* buf, int32_t len); /* Direct shim to BIO_write. */ -DLLEXPORT int32_t CryptoNative_BioWrite(BIO* b, const void* buf, int32_t len); +PALEXPORT int32_t CryptoNative_BioWrite(BIO* b, const void* buf, int32_t len); /* Gets the size of data available in the BIO. Shims the BIO_get_mem_data method. */ -DLLEXPORT int32_t CryptoNative_GetMemoryBioSize(BIO* bio); +PALEXPORT int32_t CryptoNative_GetMemoryBioSize(BIO* bio); /* Shims the BIO_ctrl_pending method. Returns the number of pending characters in the BIOs read and write buffers. */ -DLLEXPORT int32_t CryptoNative_BioCtrlPending(BIO* bio); +PALEXPORT int32_t CryptoNative_BioCtrlPending(BIO* bio); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_dsa.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_dsa.h index d220fd7..351c4d3 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_dsa.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_dsa.h @@ -11,7 +11,7 @@ Shims the DSA_up_ref method. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_DsaUpRef(DSA* dsa); +PALEXPORT int32_t CryptoNative_DsaUpRef(DSA* dsa); /* Cleans up and deletes a DSA instance. @@ -22,38 +22,38 @@ No-op if dsa is null. The given DSA pointer is invalid after this call. Always succeeds. */ -DLLEXPORT void CryptoNative_DsaDestroy(DSA* dsa); +PALEXPORT void CryptoNative_DsaDestroy(DSA* dsa); /* Shims the DSA_generate_key_ex method. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_DsaGenerateKey(DSA** dsa, int32_t bits); +PALEXPORT int32_t CryptoNative_DsaGenerateKey(DSA** dsa, int32_t bits); /* Shims the DSA_size method. Returns the size of the ASN.1 encoded signature. */ -DLLEXPORT int32_t CryptoNative_DsaSizeSignature(DSA* dsa); +PALEXPORT int32_t CryptoNative_DsaSizeSignature(DSA* dsa); /* Returns the size of the p parameter in bytes. */ -DLLEXPORT int32_t CryptoNative_DsaSizeP(DSA* dsa); +PALEXPORT int32_t CryptoNative_DsaSizeP(DSA* dsa); /* Returns the size of the q parameter in bytes. */ -DLLEXPORT int32_t CryptoNative_DsaSizeQ(DSA* dsa); +PALEXPORT int32_t CryptoNative_DsaSizeQ(DSA* dsa); /* Shims the DSA_sign method. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t +PALEXPORT int32_t CryptoNative_DsaSign( DSA* dsa, const uint8_t* hash, @@ -66,7 +66,7 @@ Shims the DSA_verify method. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t +PALEXPORT int32_t CryptoNative_DsaVerify( DSA* dsa, const uint8_t* hash, @@ -79,7 +79,7 @@ Gets all the parameters from the DSA instance. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_GetDsaParameters( +PALEXPORT int32_t CryptoNative_GetDsaParameters( const DSA* dsa, const BIGNUM** p, int32_t* pLength, const BIGNUM** q, int32_t* qLength, @@ -90,7 +90,7 @@ DLLEXPORT int32_t CryptoNative_GetDsaParameters( /* Sets all the parameters on the DSA instance. */ -DLLEXPORT int32_t CryptoNative_DsaKeyCreateByExplicitParameters( +PALEXPORT int32_t CryptoNative_DsaKeyCreateByExplicitParameters( DSA** dsa, uint8_t* p, int32_t pLength, diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ecc_import_export.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ecc_import_export.h index 61e6e39..594c98c 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ecc_import_export.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ecc_import_export.h @@ -19,7 +19,7 @@ typedef enum /* Returns the ECC key parameters. */ -DLLEXPORT int32_t CryptoNative_GetECKeyParameters( +PALEXPORT int32_t CryptoNative_GetECKeyParameters( const EC_KEY* key, int32_t includePrivate, const BIGNUM** qx, int32_t* cbQx, @@ -29,7 +29,7 @@ DLLEXPORT int32_t CryptoNative_GetECKeyParameters( /* Returns the ECC key and curve parameters. */ -DLLEXPORT int32_t CryptoNative_GetECCurveParameters( +PALEXPORT int32_t CryptoNative_GetECCurveParameters( const EC_KEY* key, int32_t includePrivate, ECCurveType* curveType, @@ -49,7 +49,7 @@ DLLEXPORT int32_t CryptoNative_GetECCurveParameters( Creates the new EC_KEY instance using the curve oid (friendly name or value) and public key parameters. Returns 1 upon success, -1 if oid was not found, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_EcKeyCreateByKeyParameters( +PALEXPORT int32_t CryptoNative_EcKeyCreateByKeyParameters( EC_KEY** key, const char* oid, uint8_t* qx, int32_t qxLength, @@ -59,7 +59,7 @@ DLLEXPORT int32_t CryptoNative_EcKeyCreateByKeyParameters( /* Returns the new EC_KEY instance using the explicit parameters. */ -DLLEXPORT EC_KEY* CryptoNative_EcKeyCreateByExplicitParameters( +PALEXPORT EC_KEY* CryptoNative_EcKeyCreateByExplicitParameters( ECCurveType curveType, uint8_t* qx, int32_t qxLength, uint8_t* qy, int32_t qyLength, diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ecdsa.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ecdsa.h index ccc47c9..055ef68 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ecdsa.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ecdsa.h @@ -11,7 +11,7 @@ Shims the ECDSA_sign method. Returns 1 on success, otherwise 0. */ -DLLEXPORT int32_t +PALEXPORT int32_t CryptoNative_EcDsaSign(const uint8_t* dgst, int32_t dgstlen, uint8_t* sig, int32_t* siglen, EC_KEY* key); /* @@ -19,7 +19,7 @@ Shims the ECDSA_verify method. Returns 1 for a correct signature, 0 for an incorrect signature, -1 on error. */ -DLLEXPORT int32_t +PALEXPORT int32_t CryptoNative_EcDsaVerify(const uint8_t* dgst, int32_t dgstlen, const uint8_t* sig, int32_t siglen, EC_KEY* key); /* @@ -27,4 +27,4 @@ Shims the ECDSA_size method. Returns the maximum length of a DER encoded ECDSA signature created with this key. */ -DLLEXPORT int32_t CryptoNative_EcDsaSize(const EC_KEY* key); +PALEXPORT int32_t CryptoNative_EcDsaSize(const EC_KEY* key); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_eckey.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_eckey.h index 3f03058..58934e4 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_eckey.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_eckey.h @@ -15,39 +15,39 @@ No-op if r is null. The given EC_KEY pointer is invalid after this call. Always succeeds. */ -DLLEXPORT void CryptoNative_EcKeyDestroy(EC_KEY* r); +PALEXPORT void CryptoNative_EcKeyDestroy(EC_KEY* r); /* Shims the EC_KEY_new_by_curve_name method. Returns the new EC_KEY instance. */ -DLLEXPORT EC_KEY* CryptoNative_EcKeyCreateByOid(const char* oid); +PALEXPORT EC_KEY* CryptoNative_EcKeyCreateByOid(const char* oid); /* Shims the EC_KEY_generate_key method. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_EcKeyGenerateKey(EC_KEY* eckey); +PALEXPORT int32_t CryptoNative_EcKeyGenerateKey(EC_KEY* eckey); /* Shims the EC_KEY_up_ref method. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_EcKeyUpRef(EC_KEY* r); +PALEXPORT int32_t CryptoNative_EcKeyUpRef(EC_KEY* r); /* Gets the key size in bits for the specified EC_KEY. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_EcKeyGetSize(const EC_KEY* key, int32_t* keySize); +PALEXPORT int32_t CryptoNative_EcKeyGetSize(const EC_KEY* key, int32_t* keySize); /* Gets the NID of the curve name as an oid value for the specified EC_KEY. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_EcKeyGetCurveName2(const EC_KEY* key, int32_t* nidName); +PALEXPORT int32_t CryptoNative_EcKeyGetCurveName2(const EC_KEY* key, int32_t* nidName); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_err.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_err.h index 98ac293..3610c26 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_err.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_err.h @@ -9,26 +9,26 @@ /* Shims the ERR_clear_error method. */ -DLLEXPORT void CryptoNative_ErrClearError(void); +PALEXPORT void CryptoNative_ErrClearError(void); /* Shim to ERR_get_error which also returns whether the error was caused by an allocation failure. */ -DLLEXPORT uint64_t CryptoNative_ErrGetErrorAlloc(int32_t* isAllocFailure); +PALEXPORT uint64_t CryptoNative_ErrGetErrorAlloc(int32_t* isAllocFailure); -DLLEXPORT uint64_t CryptoNative_ErrPeekError(void); +PALEXPORT uint64_t CryptoNative_ErrPeekError(void); -DLLEXPORT uint64_t CryptoNative_ErrPeekLastError(void); +PALEXPORT uint64_t CryptoNative_ErrPeekLastError(void); /* Shims the ERR_reason_error_string method. Returns the string for the specified error. */ -DLLEXPORT const char* CryptoNative_ErrReasonErrorString(uint64_t error); +PALEXPORT const char* CryptoNative_ErrReasonErrorString(uint64_t error); /* Direct shim to ERR_error_string_n. */ -DLLEXPORT void CryptoNative_ErrErrorStringN(uint64_t e, char* buf, int32_t len); +PALEXPORT void CryptoNative_ErrErrorStringN(uint64_t e, char* buf, int32_t len); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp.h index cb98118..8eb150b 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp.h @@ -15,7 +15,7 @@ Implemented by: Returns new EVP_MD_CTX on success, nullptr on failure. */ -DLLEXPORT EVP_MD_CTX* CryptoNative_EvpMdCtxCreate(const EVP_MD* type); +PALEXPORT EVP_MD_CTX* CryptoNative_EvpMdCtxCreate(const EVP_MD* type); /* Cleans up and deletes an EVP_MD_CTX instance created by EvpMdCtxCreate. @@ -27,12 +27,12 @@ No-op if ctx is null. The given EVP_MD_CTX pointer is invalid after this call. Always succeeds. */ -DLLEXPORT void CryptoNative_EvpMdCtxDestroy(EVP_MD_CTX* ctx); +PALEXPORT void CryptoNative_EvpMdCtxDestroy(EVP_MD_CTX* ctx); /* Resets an EVP_MD_CTX instance for a new computation. */ -DLLEXPORT int32_t CryptoNative_EvpDigestReset(EVP_MD_CTX* ctx, const EVP_MD* type); +PALEXPORT int32_t CryptoNative_EvpDigestReset(EVP_MD_CTX* ctx, const EVP_MD* type); /* Function: @@ -40,7 +40,7 @@ EvpDigestUpdate Direct shim to EVP_DigestUpdate. */ -DLLEXPORT int32_t CryptoNative_EvpDigestUpdate(EVP_MD_CTX* ctx, const void* d, int32_t cnt); +PALEXPORT int32_t CryptoNative_EvpDigestUpdate(EVP_MD_CTX* ctx, const void* d, int32_t cnt); /* Function: @@ -48,7 +48,7 @@ EvpDigestFinalEx Direct shim to EVP_DigestFinal_ex. */ -DLLEXPORT int32_t CryptoNative_EvpDigestFinalEx(EVP_MD_CTX* ctx, uint8_t* md, uint32_t* s); +PALEXPORT int32_t CryptoNative_EvpDigestFinalEx(EVP_MD_CTX* ctx, uint8_t* md, uint32_t* s); /* Function: @@ -56,7 +56,7 @@ EvpMdSize Direct shim to EVP_MD_size. */ -DLLEXPORT int32_t CryptoNative_EvpMdSize(const EVP_MD* md); +PALEXPORT int32_t CryptoNative_EvpMdSize(const EVP_MD* md); /* Function: @@ -64,7 +64,7 @@ EvpMd5 Direct shim to EVP_md5. */ -DLLEXPORT const EVP_MD* CryptoNative_EvpMd5(void); +PALEXPORT const EVP_MD* CryptoNative_EvpMd5(void); /* Function: @@ -72,7 +72,7 @@ EvpSha1 Direct shim to EVP_sha1. */ -DLLEXPORT const EVP_MD* CryptoNative_EvpSha1(void); +PALEXPORT const EVP_MD* CryptoNative_EvpSha1(void); /* Function: @@ -80,7 +80,7 @@ EvpSha256 Direct shim to EVP_sha256. */ -DLLEXPORT const EVP_MD* CryptoNative_EvpSha256(void); +PALEXPORT const EVP_MD* CryptoNative_EvpSha256(void); /* Function: @@ -88,7 +88,7 @@ EvpSha384 Direct shim to EVP_sha384. */ -DLLEXPORT const EVP_MD* CryptoNative_EvpSha384(void); +PALEXPORT const EVP_MD* CryptoNative_EvpSha384(void); /* Function: @@ -96,7 +96,7 @@ EvpSha512 Direct shim to EVP_sha512. */ -DLLEXPORT const EVP_MD* CryptoNative_EvpSha512(void); +PALEXPORT const EVP_MD* CryptoNative_EvpSha512(void); /* Function: @@ -104,4 +104,4 @@ GetMaxMdSize Returns the maxium bytes for a message digest. */ -DLLEXPORT int32_t CryptoNative_GetMaxMdSize(void); +PALEXPORT int32_t CryptoNative_GetMaxMdSize(void); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_cipher.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_cipher.h index a0ba12a..fbaa474 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_cipher.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_cipher.h @@ -6,16 +6,16 @@ #include "pal_compiler.h" #include "opensslshim.h" -DLLEXPORT EVP_CIPHER_CTX* +PALEXPORT EVP_CIPHER_CTX* CryptoNative_EvpCipherCreate2(const EVP_CIPHER* type, uint8_t* key, int32_t keyLength, int32_t effectiveKeyLength, unsigned char* iv, int32_t enc); -DLLEXPORT EVP_CIPHER_CTX* +PALEXPORT EVP_CIPHER_CTX* CryptoNative_EvpCipherCreatePartial(const EVP_CIPHER* type); -DLLEXPORT int32_t CryptoNative_EvpCipherSetKeyAndIV(EVP_CIPHER_CTX* ctx, uint8_t* key, unsigned char* iv, int32_t enc); +PALEXPORT int32_t CryptoNative_EvpCipherSetKeyAndIV(EVP_CIPHER_CTX* ctx, uint8_t* key, unsigned char* iv, int32_t enc); -DLLEXPORT int32_t CryptoNative_EvpCipherSetGcmNonceLength(EVP_CIPHER_CTX* ctx, int32_t ivLength); -DLLEXPORT int32_t CryptoNative_EvpCipherSetCcmNonceLength(EVP_CIPHER_CTX* ctx, int32_t ivLength); +PALEXPORT int32_t CryptoNative_EvpCipherSetGcmNonceLength(EVP_CIPHER_CTX* ctx, int32_t ivLength); +PALEXPORT int32_t CryptoNative_EvpCipherSetCcmNonceLength(EVP_CIPHER_CTX* ctx, int32_t ivLength); /* Cleans up and deletes an EVP_CIPHER_CTX instance created by EvpCipherCreate. @@ -28,7 +28,7 @@ No-op if ctx is null. The given EVP_CIPHER_CTX pointer is invalid after this call. Always succeeds. */ -DLLEXPORT void CryptoNative_EvpCipherDestroy(EVP_CIPHER_CTX* ctx); +PALEXPORT void CryptoNative_EvpCipherDestroy(EVP_CIPHER_CTX* ctx); /* Function: @@ -36,7 +36,7 @@ EvpCipherReset Resets an EVP_CIPHER_CTX instance for a new computation. */ -DLLEXPORT int32_t CryptoNative_EvpCipherReset(EVP_CIPHER_CTX* ctx); +PALEXPORT int32_t CryptoNative_EvpCipherReset(EVP_CIPHER_CTX* ctx); /* Function: @@ -44,7 +44,7 @@ EvpCipherCtxSetPadding Direct shim to EVP_CIPHER_CTX_set_padding. */ -DLLEXPORT int32_t CryptoNative_EvpCipherCtxSetPadding(EVP_CIPHER_CTX* x, int32_t padding); +PALEXPORT int32_t CryptoNative_EvpCipherCtxSetPadding(EVP_CIPHER_CTX* x, int32_t padding); /* Function: @@ -52,7 +52,7 @@ EvpCipherUpdate Direct shim to EVP_CipherUpdate. */ -DLLEXPORT int32_t +PALEXPORT int32_t CryptoNative_EvpCipherUpdate(EVP_CIPHER_CTX* ctx, uint8_t* out, int32_t* outl, unsigned char* in, int32_t inl); /* @@ -61,7 +61,7 @@ EvpCipherFinalEx Direct shim to EVP_CipherFinal_ex. */ -DLLEXPORT int32_t CryptoNative_EvpCipherFinalEx(EVP_CIPHER_CTX* ctx, uint8_t* outm, int32_t* outl); +PALEXPORT int32_t CryptoNative_EvpCipherFinalEx(EVP_CIPHER_CTX* ctx, uint8_t* outm, int32_t* outl); /* Function: @@ -69,7 +69,7 @@ EvpAesGcmGetTag Retrieves tag for authenticated encryption */ -DLLEXPORT int32_t CryptoNative_EvpCipherGetGcmTag(EVP_CIPHER_CTX* ctx, uint8_t* tag, int32_t tagLength); +PALEXPORT int32_t CryptoNative_EvpCipherGetGcmTag(EVP_CIPHER_CTX* ctx, uint8_t* tag, int32_t tagLength); /* Function: @@ -77,7 +77,7 @@ EvpAesGcmSetTag Sets tag for authenticated decryption */ -DLLEXPORT int32_t CryptoNative_EvpCipherSetGcmTag(EVP_CIPHER_CTX* ctx, uint8_t* tag, int32_t tagLength); +PALEXPORT int32_t CryptoNative_EvpCipherSetGcmTag(EVP_CIPHER_CTX* ctx, uint8_t* tag, int32_t tagLength); /* Function: @@ -85,7 +85,7 @@ EvpAesCcmGetTag Retrieves tag for authenticated encryption */ -DLLEXPORT int32_t CryptoNative_EvpCipherGetCcmTag(EVP_CIPHER_CTX* ctx, uint8_t* tag, int32_t tagLength); +PALEXPORT int32_t CryptoNative_EvpCipherGetCcmTag(EVP_CIPHER_CTX* ctx, uint8_t* tag, int32_t tagLength); /* Function: @@ -93,7 +93,7 @@ EvpAesCcmSetTag Sets tag for authenticated decryption */ -DLLEXPORT int32_t CryptoNative_EvpCipherSetCcmTag(EVP_CIPHER_CTX* ctx, uint8_t* tag, int32_t tagLength); +PALEXPORT int32_t CryptoNative_EvpCipherSetCcmTag(EVP_CIPHER_CTX* ctx, uint8_t* tag, int32_t tagLength); /* Function: @@ -101,7 +101,7 @@ EvpAes128Ecb Direct shim to EVP_aes_128_ecb. */ -DLLEXPORT const EVP_CIPHER* CryptoNative_EvpAes128Ecb(void); +PALEXPORT const EVP_CIPHER* CryptoNative_EvpAes128Ecb(void); /* Function: @@ -109,7 +109,7 @@ EvpAes128Cbc Direct shim to EVP_aes_128_cbc. */ -DLLEXPORT const EVP_CIPHER* CryptoNative_EvpAes128Cbc(void); +PALEXPORT const EVP_CIPHER* CryptoNative_EvpAes128Cbc(void); /* Function: @@ -117,7 +117,7 @@ EvpAes128Gcm Direct shim to EVP_aes_128_gcm. */ -DLLEXPORT const EVP_CIPHER* CryptoNative_EvpAes128Gcm(void); +PALEXPORT const EVP_CIPHER* CryptoNative_EvpAes128Gcm(void); /* Function: @@ -125,7 +125,7 @@ EvpAes128Ccm Direct shim to EVP_aes_128_ccm. */ -DLLEXPORT const EVP_CIPHER* CryptoNative_EvpAes128Ccm(void); +PALEXPORT const EVP_CIPHER* CryptoNative_EvpAes128Ccm(void); /* Function: @@ -133,7 +133,7 @@ EvpAes192Ecb Direct shim to EVP_aes_192_ecb. */ -DLLEXPORT const EVP_CIPHER* CryptoNative_EvpAes192Ecb(void); +PALEXPORT const EVP_CIPHER* CryptoNative_EvpAes192Ecb(void); /* Function: @@ -141,7 +141,7 @@ EvpAes192Cbc Direct shim to EVP_aes_192_cbc. */ -DLLEXPORT const EVP_CIPHER* CryptoNative_EvpAes192Cbc(void); +PALEXPORT const EVP_CIPHER* CryptoNative_EvpAes192Cbc(void); /* Function: @@ -149,7 +149,7 @@ EvpAes192Gcm Direct shim to EVP_aes_192_gcm. */ -DLLEXPORT const EVP_CIPHER* CryptoNative_EvpAes192Gcm(void); +PALEXPORT const EVP_CIPHER* CryptoNative_EvpAes192Gcm(void); /* Function: @@ -157,7 +157,7 @@ EvpAes192Ccm Direct shim to EVP_aes_192_ccm. */ -DLLEXPORT const EVP_CIPHER* CryptoNative_EvpAes192Ccm(void); +PALEXPORT const EVP_CIPHER* CryptoNative_EvpAes192Ccm(void); /* Function: @@ -165,7 +165,7 @@ EvpAes256Ecb Direct shim to EVP_aes_256_ecb. */ -DLLEXPORT const EVP_CIPHER* CryptoNative_EvpAes256Ecb(void); +PALEXPORT const EVP_CIPHER* CryptoNative_EvpAes256Ecb(void); /* Function: @@ -173,7 +173,7 @@ EvpAes256Cbc Direct shim to EVP_aes_256_cbc. */ -DLLEXPORT const EVP_CIPHER* CryptoNative_EvpAes256Cbc(void); +PALEXPORT const EVP_CIPHER* CryptoNative_EvpAes256Cbc(void); /* Function: @@ -181,7 +181,7 @@ EvpAes256Gcm Direct shim to EVP_aes_256_gcm. */ -DLLEXPORT const EVP_CIPHER* CryptoNative_EvpAes256Gcm(void); +PALEXPORT const EVP_CIPHER* CryptoNative_EvpAes256Gcm(void); /* Function: @@ -189,7 +189,7 @@ EvpAes256Ccm Direct shim to EVP_aes_256_ccm. */ -DLLEXPORT const EVP_CIPHER* CryptoNative_EvpAes256Ccm(void); +PALEXPORT const EVP_CIPHER* CryptoNative_EvpAes256Ccm(void); /* Function: @@ -197,7 +197,7 @@ EvpDes3Ecb Direct shim to EVP_des_ede3. */ -DLLEXPORT const EVP_CIPHER* CryptoNative_EvpDes3Ecb(void); +PALEXPORT const EVP_CIPHER* CryptoNative_EvpDes3Ecb(void); /* Function: @@ -205,7 +205,7 @@ EvpDes3Cbc Direct shim to EVP_des_ede3_cbc. */ -DLLEXPORT const EVP_CIPHER* CryptoNative_EvpDes3Cbc(void); +PALEXPORT const EVP_CIPHER* CryptoNative_EvpDes3Cbc(void); /* Function: @@ -213,7 +213,7 @@ EvpDesEcb Direct shim to EVP_des_ecb. */ -DLLEXPORT const EVP_CIPHER* CryptoNative_EvpDesEcb(void); +PALEXPORT const EVP_CIPHER* CryptoNative_EvpDesEcb(void); /* Function: @@ -221,7 +221,7 @@ EvpDesCbc Direct shim to EVP_des_ede_cbc. */ -DLLEXPORT const EVP_CIPHER* CryptoNative_EvpDesCbc(void); +PALEXPORT const EVP_CIPHER* CryptoNative_EvpDesCbc(void); /* Function: @@ -229,7 +229,7 @@ EvpRC2Ecb Direct shim to EVP_rc2_ecb. */ -DLLEXPORT const EVP_CIPHER* CryptoNative_EvpRC2Ecb(void); +PALEXPORT const EVP_CIPHER* CryptoNative_EvpRC2Ecb(void); /* Function: @@ -237,4 +237,4 @@ EvpRC2Cbc Direct shim to EVP_des_rc2_cbc. */ -DLLEXPORT const EVP_CIPHER* CryptoNative_EvpRC2Cbc(void); +PALEXPORT const EVP_CIPHER* CryptoNative_EvpRC2Cbc(void); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.h index 7baf997..f1e23da 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.h @@ -11,7 +11,7 @@ Shims the EVP_PKEY_new method. Returns the new EVP_PKEY instance. */ -DLLEXPORT EVP_PKEY* CryptoNative_EvpPkeyCreate(void); +PALEXPORT EVP_PKEY* CryptoNative_EvpPkeyCreate(void); /* Cleans up and deletes a EVP_PKEY instance. @@ -22,7 +22,7 @@ No-op if pkey is null. The given EVP_PKEY pointer is invalid after this call. Always succeeds. */ -DLLEXPORT void CryptoNative_EvpPkeyDestroy(EVP_PKEY* pkey); +PALEXPORT void CryptoNative_EvpPkeyDestroy(EVP_PKEY* pkey); /* Used by System.Security.Cryptography.X509Certificates' OpenSslX509CertificateReader when @@ -31,4 +31,4 @@ duplicating a private key context as part of duplicating the Pal object. Returns the number (as of this call) of references to the EVP_PKEY. Anything less than 2 is an error, because the key is already in the process of being freed. */ -DLLEXPORT int32_t CryptoNative_UpRefEvpPkey(EVP_PKEY* pkey); +PALEXPORT int32_t CryptoNative_UpRefEvpPkey(EVP_PKEY* pkey); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_dsa.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_dsa.h index 7ea1743..6779f82 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_dsa.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_dsa.h @@ -11,7 +11,7 @@ Shims the EVP_PKEY_get1_DSA method. Returns the DSA instance for the EVP_PKEY. */ -DLLEXPORT DSA* CryptoNative_EvpPkeyGetDsa(EVP_PKEY* pkey); +PALEXPORT DSA* CryptoNative_EvpPkeyGetDsa(EVP_PKEY* pkey); /* Shims the EVP_PKEY_set1_DSA method to set the DSA @@ -19,4 +19,4 @@ instance on the EVP_KEY. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_EvpPkeySetDsa(EVP_PKEY* pkey, DSA* dsa); +PALEXPORT int32_t CryptoNative_EvpPkeySetDsa(EVP_PKEY* pkey, DSA* dsa); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_ecdh.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_ecdh.h index e97f4e2..3a424b3 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_ecdh.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_ecdh.h @@ -6,8 +6,8 @@ #include "pal_compiler.h" #include "opensslshim.h" -DLLEXPORT EVP_PKEY_CTX* CryptoNative_EvpPKeyCtxCreate(EVP_PKEY* pkey, EVP_PKEY* peerkey, uint32_t* secretLength); +PALEXPORT EVP_PKEY_CTX* CryptoNative_EvpPKeyCtxCreate(EVP_PKEY* pkey, EVP_PKEY* peerkey, uint32_t* secretLength); -DLLEXPORT int32_t CryptoNative_EvpPKeyDeriveSecretAgreement(uint8_t* secret, uint32_t secretLength, EVP_PKEY_CTX* ctx); +PALEXPORT int32_t CryptoNative_EvpPKeyDeriveSecretAgreement(uint8_t* secret, uint32_t secretLength, EVP_PKEY_CTX* ctx); -DLLEXPORT void CryptoNative_EvpPKeyCtxDestroy(EVP_PKEY_CTX* ctx); +PALEXPORT void CryptoNative_EvpPKeyCtxDestroy(EVP_PKEY_CTX* ctx); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_eckey.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_eckey.h index fbeea59..c015f7f 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_eckey.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_eckey.h @@ -11,7 +11,7 @@ Shims the EVP_PKEY_get1_EC_KEY method. Returns the EC_KEY instance for the EVP_PKEY. */ -DLLEXPORT EC_KEY* CryptoNative_EvpPkeyGetEcKey(EVP_PKEY* pkey); +PALEXPORT EC_KEY* CryptoNative_EvpPkeyGetEcKey(EVP_PKEY* pkey); /* Shims the EVP_PKEY_set1_EC_KEY method to set the EC_KEY @@ -19,4 +19,4 @@ instance on the EVP_KEY. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_EvpPkeySetEcKey(EVP_PKEY* pkey, EC_KEY* key); +PALEXPORT int32_t CryptoNative_EvpPkeySetEcKey(EVP_PKEY* pkey, EC_KEY* key); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_rsa.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_rsa.h index d8ff369..7b00edc 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_rsa.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_rsa.h @@ -11,7 +11,7 @@ Shims the EVP_PKEY_get1_RSA method. Returns the RSA instance for the EVP_PKEY. */ -DLLEXPORT RSA* CryptoNative_EvpPkeyGetRsa(EVP_PKEY* pkey); +PALEXPORT RSA* CryptoNative_EvpPkeyGetRsa(EVP_PKEY* pkey); /* Shims the EVP_PKEY_set1_RSA method to set the RSA @@ -19,4 +19,4 @@ instance on the EVP_KEY. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_EvpPkeySetRsa(EVP_PKEY* pkey, RSA* rsa); +PALEXPORT int32_t CryptoNative_EvpPkeySetRsa(EVP_PKEY* pkey, RSA* rsa); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_hmac.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_hmac.h index 1f10b81..b1ca1c5 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_hmac.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_hmac.h @@ -24,7 +24,7 @@ typedef struct hmac_ctx_st HMAC_CTX; * * Returns new HMAC_CTX on success, nullptr on failure. */ -DLLEXPORT HMAC_CTX* CryptoNative_HmacCreate(const uint8_t* key, int32_t keyLen, const EVP_MD* md); +PALEXPORT HMAC_CTX* CryptoNative_HmacCreate(const uint8_t* key, int32_t keyLen, const EVP_MD* md); /** * Cleans up and deletes an HMAC_CTX instance created by HmacCreate. @@ -37,14 +37,14 @@ DLLEXPORT HMAC_CTX* CryptoNative_HmacCreate(const uint8_t* key, int32_t keyLen, * The given HMAC_CTX pointer is invalid after this call. * Always succeeds. */ -DLLEXPORT void CryptoNative_HmacDestroy(HMAC_CTX* ctx); +PALEXPORT void CryptoNative_HmacDestroy(HMAC_CTX* ctx); /** * Resets an HMAC_CTX instance for a new computation, preserving the key and EVP_MD. * * Implemented by passing all null/0 values but ctx to HMAC_Init_ex. */ -DLLEXPORT int32_t CryptoNative_HmacReset(HMAC_CTX* ctx); +PALEXPORT int32_t CryptoNative_HmacReset(HMAC_CTX* ctx); /** * Appends data to the computation. @@ -53,7 +53,7 @@ DLLEXPORT int32_t CryptoNative_HmacReset(HMAC_CTX* ctx); * * Returns 1 for success or 0 for failure. (Always succeeds on platforms where HMAC_Update returns void.) */ -DLLEXPORT int32_t CryptoNative_HmacUpdate(HMAC_CTX* ctx, const uint8_t* data, int32_t len); +PALEXPORT int32_t CryptoNative_HmacUpdate(HMAC_CTX* ctx, const uint8_t* data, int32_t len); /** * Finalizes the computation and obtains the result. @@ -62,4 +62,4 @@ DLLEXPORT int32_t CryptoNative_HmacUpdate(HMAC_CTX* ctx, const uint8_t* data, in * * Returns 1 for success or 0 for failure. (Always succeeds on platforms where HMAC_Update returns void.) */ -DLLEXPORT int32_t CryptoNative_HmacFinal(HMAC_CTX* ctx, uint8_t* md, int32_t* len); +PALEXPORT int32_t CryptoNative_HmacFinal(HMAC_CTX* ctx, uint8_t* md, int32_t* len); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ocsp.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ocsp.h index e720582..08430f2 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ocsp.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ocsp.h @@ -9,24 +9,24 @@ /* Direct shim to OCSP_REQUEST_free */ -DLLEXPORT void CryptoNative_OcspRequestDestroy(OCSP_REQUEST* request); +PALEXPORT void CryptoNative_OcspRequestDestroy(OCSP_REQUEST* request); /* Returns the number of bytes required to encode an OCSP_REQUEST */ -DLLEXPORT int32_t CryptoNative_GetOcspRequestDerSize(OCSP_REQUEST* req); +PALEXPORT int32_t CryptoNative_GetOcspRequestDerSize(OCSP_REQUEST* req); /* Encodes the OCSP_REQUEST req into the destination buffer, returning the number of bytes written. */ -DLLEXPORT int32_t CryptoNative_EncodeOcspRequest(OCSP_REQUEST* req, uint8_t* buf); +PALEXPORT int32_t CryptoNative_EncodeOcspRequest(OCSP_REQUEST* req, uint8_t* buf); /* Direct shim to d2i_OCSP_RESPONSE */ -DLLEXPORT OCSP_RESPONSE* CryptoNative_DecodeOcspResponse(const uint8_t* buf, int32_t len); +PALEXPORT OCSP_RESPONSE* CryptoNative_DecodeOcspResponse(const uint8_t* buf, int32_t len); /* Direct shim to OCSP_RESPONSE_free */ -DLLEXPORT void CryptoNative_OcspResponseDestroy(OCSP_RESPONSE* response); +PALEXPORT void CryptoNative_OcspResponseDestroy(OCSP_RESPONSE* response); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_pkcs12.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_pkcs12.h index b3eb1fc..8091b32 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_pkcs12.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_pkcs12.h @@ -9,14 +9,14 @@ /* Shims the d2i_PKCS12 method and makes it easier to invoke from managed code. */ -DLLEXPORT PKCS12* CryptoNative_DecodePkcs12(const uint8_t* buf, int32_t len); +PALEXPORT PKCS12* CryptoNative_DecodePkcs12(const uint8_t* buf, int32_t len); /* Shims the d2i_PKCS12_bio method. Returns the new PKCS12 instance. */ -DLLEXPORT PKCS12* CryptoNative_DecodePkcs12FromBio(BIO* bio); +PALEXPORT PKCS12* CryptoNative_DecodePkcs12FromBio(BIO* bio); /* Cleans up and deletes a PKCS12 instance. @@ -27,32 +27,32 @@ No-op if p12 is null. The given PKCS12 pointer is invalid after this call. Always succeeds. */ -DLLEXPORT void CryptoNative_Pkcs12Destroy(PKCS12* p12); +PALEXPORT void CryptoNative_Pkcs12Destroy(PKCS12* p12); /* Shims the PKCS12_create method. Returns the new PKCS12 instance. */ -DLLEXPORT PKCS12* CryptoNative_Pkcs12Create(char* pass, EVP_PKEY* pkey, X509* cert, X509Stack* ca); +PALEXPORT PKCS12* CryptoNative_Pkcs12Create(char* pass, EVP_PKEY* pkey, X509* cert, X509Stack* ca); /* Returns the number of bytes it will take to convert the PKCS12 to a DER format. */ -DLLEXPORT int32_t CryptoNative_GetPkcs12DerSize(PKCS12* p12); +PALEXPORT int32_t CryptoNative_GetPkcs12DerSize(PKCS12* p12); /* Shims the i2d_PKCS12 method. Returns the number of bytes written to buf. */ -DLLEXPORT int32_t CryptoNative_EncodePkcs12(PKCS12* p12, uint8_t* buf); +PALEXPORT int32_t CryptoNative_EncodePkcs12(PKCS12* p12, uint8_t* buf); /* Shims the PKCS12_parse method. Returns 1 on success, otherwise 0. */ -DLLEXPORT int32_t +PALEXPORT int32_t CryptoNative_Pkcs12Parse(PKCS12* p12, const char* pass, EVP_PKEY** pkey, X509** cert, X509Stack** ca); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_pkcs7.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_pkcs7.h index 643965e..28d95ce 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_pkcs7.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_pkcs7.h @@ -13,12 +13,12 @@ Direct shim to PEM_read_bio_PKCS7. Returns the new PKCS7 instance. */ -DLLEXPORT PKCS7* CryptoNative_PemReadBioPkcs7(BIO* bp); +PALEXPORT PKCS7* CryptoNative_PemReadBioPkcs7(BIO* bp); /* Shims the d2i_PKCS7 method and makes it easier to invoke from managed code. */ -DLLEXPORT PKCS7* CryptoNative_DecodePkcs7(const uint8_t* buf, int32_t len); +PALEXPORT PKCS7* CryptoNative_DecodePkcs7(const uint8_t* buf, int32_t len); /* Reads a PKCS7 instance in DER format from a BIO. @@ -27,7 +27,7 @@ Direct shim to d2i_PKCS7_bio. Returns the new PKCS7 instance. */ -DLLEXPORT PKCS7* CryptoNative_D2IPkcs7Bio(BIO* bp); +PALEXPORT PKCS7* CryptoNative_D2IPkcs7Bio(BIO* bp); /* Create a new PKCS7 instance and prepare it to be a signed PKCS7 object @@ -35,7 +35,7 @@ with certificates only. Returns the new PKCS7 instance. */ -DLLEXPORT PKCS7* CryptoNative_Pkcs7CreateCertificateCollection(X509Stack* certs); +PALEXPORT PKCS7* CryptoNative_Pkcs7CreateCertificateCollection(X509Stack* certs); /* Cleans up and deletes a PKCS7 instance. @@ -46,7 +46,7 @@ No-op if p7 is null. The given PKCS7 pointer is invalid after this call. Always succeeds. */ -DLLEXPORT void CryptoNative_Pkcs7Destroy(PKCS7* p7); +PALEXPORT void CryptoNative_Pkcs7Destroy(PKCS7* p7); /* Function: @@ -60,17 +60,17 @@ Return values: 1 when the file format is understood, and *certs is assigned to the certificate contents of the structure. */ -DLLEXPORT int32_t CryptoNative_GetPkcs7Certificates(PKCS7* p7, X509Stack** certs); +PALEXPORT int32_t CryptoNative_GetPkcs7Certificates(PKCS7* p7, X509Stack** certs); /* Returns the number of bytes it will take to convert the PKCS7 to a DER format. */ -DLLEXPORT int32_t CryptoNative_GetPkcs7DerSize(PKCS7* p7); +PALEXPORT int32_t CryptoNative_GetPkcs7DerSize(PKCS7* p7); /* Shims the i2d_PKCS7 method. Returns the number of bytes written to buf. */ -DLLEXPORT int32_t CryptoNative_EncodePkcs7(PKCS7* p7, uint8_t* buf); +PALEXPORT int32_t CryptoNative_EncodePkcs7(PKCS7* p7, uint8_t* buf); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_rsa.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_rsa.h index b85fed6..8d98280 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_rsa.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_rsa.h @@ -22,14 +22,14 @@ Shims the RSA_new method. Returns the new RSA instance. */ -DLLEXPORT RSA* CryptoNative_RsaCreate(void); +PALEXPORT RSA* CryptoNative_RsaCreate(void); /* Shims the RSA_up_ref method. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_RsaUpRef(RSA* rsa); +PALEXPORT int32_t CryptoNative_RsaUpRef(RSA* rsa); /* Cleans up and deletes a RSA instance. @@ -40,19 +40,19 @@ No-op if rsa is null. The given RSA pointer is invalid after this call. Always succeeds. */ -DLLEXPORT void CryptoNative_RsaDestroy(RSA* rsa); +PALEXPORT void CryptoNative_RsaDestroy(RSA* rsa); /* Shims the d2i_RSAPublicKey method and makes it easier to invoke from managed code. */ -DLLEXPORT RSA* CryptoNative_DecodeRsaPublicKey(const uint8_t* buf, int32_t len); +PALEXPORT RSA* CryptoNative_DecodeRsaPublicKey(const uint8_t* buf, int32_t len); /* Shims the RSA_public_encrypt method. Returns the size of the signature, or -1 on error. */ -DLLEXPORT int32_t +PALEXPORT int32_t CryptoNative_RsaPublicEncrypt(int32_t flen, const uint8_t* from, uint8_t* to, RSA* rsa, RsaPadding padding); /* @@ -60,7 +60,7 @@ Shims the RSA_private_decrypt method. Returns the size of the signature, or -1 on error. */ -DLLEXPORT int32_t +PALEXPORT int32_t CryptoNative_RsaPrivateDecrypt(int32_t flen, const uint8_t* from, uint8_t* to, RSA* rsa, RsaPadding padding); /* @@ -69,7 +69,7 @@ Shims RSA_private_encrypt with a fixed value of RSA_NO_PADDING. Requires that the input be the size of the key. Returns the number of bytes written (which should be flen), or -1 on error. */ -DLLEXPORT int32_t CryptoNative_RsaSignPrimitive(int32_t flen, const uint8_t* from, uint8_t* to, RSA* rsa); +PALEXPORT int32_t CryptoNative_RsaSignPrimitive(int32_t flen, const uint8_t* from, uint8_t* to, RSA* rsa); /* Shims RSA_public_decrypt with a fixed value of RSA_NO_PADDING. @@ -77,28 +77,28 @@ Shims RSA_public_decrypt with a fixed value of RSA_NO_PADDING. Requires that the input be the size of the key. Returns the number of bytes written (which should be flen), or -1 on error. */ -DLLEXPORT int32_t CryptoNative_RsaVerificationPrimitive(int32_t flen, const uint8_t* from, uint8_t* to, RSA* rsa); +PALEXPORT int32_t CryptoNative_RsaVerificationPrimitive(int32_t flen, const uint8_t* from, uint8_t* to, RSA* rsa); /* Shims the RSA_size method. Returns the RSA modulus size in bytes. */ -DLLEXPORT int32_t CryptoNative_RsaSize(RSA* rsa); +PALEXPORT int32_t CryptoNative_RsaSize(RSA* rsa); /* Shims the RSA_generate_key_ex method. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_RsaGenerateKeyEx(RSA* rsa, int32_t bits, BIGNUM* e); +PALEXPORT int32_t CryptoNative_RsaGenerateKeyEx(RSA* rsa, int32_t bits, BIGNUM* e); /* Shims the RSA_sign method. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t +PALEXPORT int32_t CryptoNative_RsaSign(int32_t type, const uint8_t* m, int32_t mlen, uint8_t* sigret, int32_t* siglen, RSA* rsa); /* @@ -106,7 +106,7 @@ Shims the RSA_verify method. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t +PALEXPORT int32_t CryptoNative_RsaVerify(int32_t type, const uint8_t* m, int32_t mlen, uint8_t* sigbuf, int32_t siglen, RSA* rsa); /* @@ -114,7 +114,7 @@ Gets all the parameters from the RSA instance. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_GetRsaParameters(const RSA* rsa, +PALEXPORT int32_t CryptoNative_GetRsaParameters(const RSA* rsa, const BIGNUM** n, const BIGNUM** e, const BIGNUM** d, @@ -127,7 +127,7 @@ DLLEXPORT int32_t CryptoNative_GetRsaParameters(const RSA* rsa, /* Sets all the parameters on the RSA instance. */ -DLLEXPORT int32_t CryptoNative_SetRsaParameters(RSA* rsa, +PALEXPORT int32_t CryptoNative_SetRsaParameters(RSA* rsa, uint8_t* n, int32_t nLength, uint8_t* e, diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ssl.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ssl.h index 2db6e76..9167e5c 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ssl.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ssl.h @@ -130,40 +130,40 @@ typedef int32_t (*SslCtxSetAlpnCallback)(SSL* ssl, /* Ensures that libssl is correctly initialized and ready to use. */ -DLLEXPORT void CryptoNative_EnsureLibSslInitialized(void); +PALEXPORT void CryptoNative_EnsureLibSslInitialized(void); /* Shims the SSLv23_method method. Returns the requested SSL_METHOD. */ -DLLEXPORT const SSL_METHOD* CryptoNative_SslV2_3Method(void); +PALEXPORT const SSL_METHOD* CryptoNative_SslV2_3Method(void); /* Shims the SSL_CTX_new method. Returns the new SSL_CTX instance. */ -DLLEXPORT SSL_CTX* CryptoNative_SslCtxCreate(SSL_METHOD* method); +PALEXPORT SSL_CTX* CryptoNative_SslCtxCreate(SSL_METHOD* method); /* Sets the specified protocols in the SSL_CTX options. */ -DLLEXPORT void CryptoNative_SetProtocolOptions(SSL_CTX* ctx, SslProtocols protocols); +PALEXPORT void CryptoNative_SetProtocolOptions(SSL_CTX* ctx, SslProtocols protocols); /* Shims the SSL_new method. Returns the new SSL instance. */ -DLLEXPORT SSL* CryptoNative_SslCreate(SSL_CTX* ctx); +PALEXPORT SSL* CryptoNative_SslCreate(SSL_CTX* ctx); /* Shims the SSL_get_error method. Returns the error code for the specified result. */ -DLLEXPORT int32_t CryptoNative_SslGetError(SSL* ssl, int32_t ret); +PALEXPORT int32_t CryptoNative_SslGetError(SSL* ssl, int32_t ret); /* Cleans up and deletes an SSL instance. @@ -174,7 +174,7 @@ No-op if ssl is null. The given X509 SSL is invalid after this call. Always succeeds. */ -DLLEXPORT void CryptoNative_SslDestroy(SSL* ssl); +PALEXPORT void CryptoNative_SslDestroy(SSL* ssl); /* Cleans up and deletes an SSL_CTX instance. @@ -185,24 +185,24 @@ No-op if ctx is null. The given X509 SSL_CTX is invalid after this call. Always succeeds. */ -DLLEXPORT void CryptoNative_SslCtxDestroy(SSL_CTX* ctx); +PALEXPORT void CryptoNative_SslCtxDestroy(SSL_CTX* ctx); /* Shims the SSL_set_connect_state method. */ -DLLEXPORT void CryptoNative_SslSetConnectState(SSL* ssl); +PALEXPORT void CryptoNative_SslSetConnectState(SSL* ssl); /* Shims the SSL_set_accept_state method. */ -DLLEXPORT void CryptoNative_SslSetAcceptState(SSL* ssl); +PALEXPORT void CryptoNative_SslSetAcceptState(SSL* ssl); /* Shims the SSL_get_version method. Returns the protocol version string for the SSL instance. */ -DLLEXPORT const char* CryptoNative_SslGetVersion(SSL* ssl); +PALEXPORT const char* CryptoNative_SslGetVersion(SSL* ssl); /* Shims the SSL_write method. @@ -210,7 +210,7 @@ Shims the SSL_write method. Returns the positive number of bytes written when successful, 0 or a negative number when an error is encountered. */ -DLLEXPORT int32_t CryptoNative_SslWrite(SSL* ssl, const void* buf, int32_t num); +PALEXPORT int32_t CryptoNative_SslWrite(SSL* ssl, const void* buf, int32_t num); /* Shims the SSL_read method. @@ -218,14 +218,14 @@ Shims the SSL_read method. Returns the positive number of bytes read when successful, 0 or a negative number when an error is encountered. */ -DLLEXPORT int32_t CryptoNative_SslRead(SSL* ssl, void* buf, int32_t num); +PALEXPORT int32_t CryptoNative_SslRead(SSL* ssl, void* buf, int32_t num); /* Shims the SSL_renegotiate_pending method. Returns 1 when negotiation is requested; 0 once a handshake has finished. */ -DLLEXPORT int32_t CryptoNative_IsSslRenegotiatePending(SSL* ssl); +PALEXPORT int32_t CryptoNative_IsSslRenegotiatePending(SSL* ssl); /* Shims the SSL_shutdown method. @@ -235,12 +235,12 @@ Returns: 0 if the shutdown is not yet finished; <0 if the shutdown was not successful because a fatal error. */ -DLLEXPORT int32_t CryptoNative_SslShutdown(SSL* ssl); +PALEXPORT int32_t CryptoNative_SslShutdown(SSL* ssl); /* Shims the SSL_set_bio method. */ -DLLEXPORT void CryptoNative_SslSetBio(SSL* ssl, BIO* rbio, BIO* wbio); +PALEXPORT void CryptoNative_SslSetBio(SSL* ssl, BIO* rbio, BIO* wbio); /* Shims the SSL_do_handshake method. @@ -251,113 +251,113 @@ Returns: and by the specifications of the TLS/SSL protocol; <0 if the handshake was not successful because of a fatal error. */ -DLLEXPORT int32_t CryptoNative_SslDoHandshake(SSL* ssl); +PALEXPORT int32_t CryptoNative_SslDoHandshake(SSL* ssl); /* Gets a value indicating whether the SSL_state is SSL_ST_OK. Returns 1 if the state is OK, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_IsSslStateOK(SSL* ssl); +PALEXPORT int32_t CryptoNative_IsSslStateOK(SSL* ssl); /* Shims the SSL_get_peer_certificate method. Returns the certificate presented by the peer. */ -DLLEXPORT X509* CryptoNative_SslGetPeerCertificate(SSL* ssl); +PALEXPORT X509* CryptoNative_SslGetPeerCertificate(SSL* ssl); /* Shims the SSL_get_peer_cert_chain method. Returns the certificate chain presented by the peer. */ -DLLEXPORT X509Stack* CryptoNative_SslGetPeerCertChain(SSL* ssl); +PALEXPORT X509Stack* CryptoNative_SslGetPeerCertChain(SSL* ssl); /* Shims the SSL_CTX_use_certificate method. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_SslCtxUseCertificate(SSL_CTX* ctx, X509* x); +PALEXPORT int32_t CryptoNative_SslCtxUseCertificate(SSL_CTX* ctx, X509* x); /* Shims the SSL_CTX_use_PrivateKey method. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_SslCtxUsePrivateKey(SSL_CTX* ctx, EVP_PKEY* pkey); +PALEXPORT int32_t CryptoNative_SslCtxUsePrivateKey(SSL_CTX* ctx, EVP_PKEY* pkey); /* Shims the SSL_CTX_check_private_key method. Returns 1 upon success, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_SslCtxCheckPrivateKey(SSL_CTX* ctx); +PALEXPORT int32_t CryptoNative_SslCtxCheckPrivateKey(SSL_CTX* ctx); /* Shims the SSL_CTX_set_quiet_shutdown method. */ -DLLEXPORT void CryptoNative_SslCtxSetQuietShutdown(SSL_CTX* ctx); +PALEXPORT void CryptoNative_SslCtxSetQuietShutdown(SSL_CTX* ctx); /* Shims the SSL_set_quiet_shutdown method. */ -DLLEXPORT void CryptoNative_SslSetQuietShutdown(SSL* ctx, int mode); +PALEXPORT void CryptoNative_SslSetQuietShutdown(SSL* ctx, int mode); /* Shims the SSL_get_client_CA_list method. Returns the list of CA names explicity set. */ -DLLEXPORT X509NameStack* CryptoNative_SslGetClientCAList(SSL* ssl); +PALEXPORT X509NameStack* CryptoNative_SslGetClientCAList(SSL* ssl); /* Shims the SSL_CTX_set_verify method. */ -DLLEXPORT void CryptoNative_SslCtxSetVerify(SSL_CTX* ctx, SslCtxSetVerifyCallback callback); +PALEXPORT void CryptoNative_SslCtxSetVerify(SSL_CTX* ctx, SslCtxSetVerifyCallback callback); /* Shims the SSL_CTX_set_cert_verify_callback method. */ -DLLEXPORT void +PALEXPORT void CryptoNative_SslCtxSetCertVerifyCallback(SSL_CTX* ctx, SslCtxSetCertVerifyCallbackCallback callback, void* arg); /* Sets the specified encryption policy on the SSL_CTX. */ -DLLEXPORT int32_t CryptoNative_SetEncryptionPolicy(SSL_CTX* ctx, EncryptionPolicy policy); +PALEXPORT int32_t CryptoNative_SetEncryptionPolicy(SSL_CTX* ctx, EncryptionPolicy policy); /* Sets ciphers (< TLS 1.3) and cipher suites (TLS 1.3) on the SSL_CTX */ -DLLEXPORT int32_t CryptoNative_SetCiphers(SSL_CTX* ctx, const char* cipherList, const char* cipherSuites); +PALEXPORT int32_t CryptoNative_SetCiphers(SSL_CTX* ctx, const char* cipherList, const char* cipherSuites); /* Determines if TLS 1.3 is supported by this OpenSSL implementation */ -DLLEXPORT int32_t CryptoNative_Tls13Supported(void); +PALEXPORT int32_t CryptoNative_Tls13Supported(void); /* Shims the SSL_CTX_set_client_cert_cb method */ -DLLEXPORT void CryptoNative_SslCtxSetClientCertCallback(SSL_CTX* ctx, SslClientCertCallback callback); +PALEXPORT void CryptoNative_SslCtxSetClientCertCallback(SSL_CTX* ctx, SslClientCertCallback callback); /* Shims the SSL_get_finished method. */ -DLLEXPORT int32_t CryptoNative_SslGetFinished(SSL* ssl, void* buf, int32_t count); +PALEXPORT int32_t CryptoNative_SslGetFinished(SSL* ssl, void* buf, int32_t count); /* Shims the SSL_get_peer_finished method. */ -DLLEXPORT int32_t CryptoNative_SslGetPeerFinished(SSL* ssl, void* buf, int32_t count); +PALEXPORT int32_t CryptoNative_SslGetPeerFinished(SSL* ssl, void* buf, int32_t count); /* Returns true/false based on if existing ssl session was re-used or not. Shims the SSL_session_reused macro. */ -DLLEXPORT int32_t CryptoNative_SslSessionReused(SSL* ssl); +PALEXPORT int32_t CryptoNative_SslSessionReused(SSL* ssl); /* adds the given certificate to the extra chain certificates associated with ctx that is associated with the ssl. @@ -365,36 +365,36 @@ adds the given certificate to the extra chain certificates associated with ctx t libssl frees the x509 object. Returns 1 if success and 0 in case of failure */ -DLLEXPORT int32_t CryptoNative_SslAddExtraChainCert(SSL* ssl, X509* x509); +PALEXPORT int32_t CryptoNative_SslAddExtraChainCert(SSL* ssl, X509* x509); /* Shims the ssl_ctx_set_alpn_select_cb method. */ -DLLEXPORT void CryptoNative_SslCtxSetAlpnSelectCb(SSL_CTX* ctx, SslCtxSetAlpnCallback cb, void *arg); +PALEXPORT void CryptoNative_SslCtxSetAlpnSelectCb(SSL_CTX* ctx, SslCtxSetAlpnCallback cb, void *arg); /* Shims the ssl_ctx_set_alpn_protos method. Returns 0 on success, non-zero on failure. */ -DLLEXPORT int32_t CryptoNative_SslCtxSetAlpnProtos(SSL_CTX* ctx, const uint8_t* protos, uint32_t protos_len); +PALEXPORT int32_t CryptoNative_SslCtxSetAlpnProtos(SSL_CTX* ctx, const uint8_t* protos, uint32_t protos_len); /* Shims the ssl_get0_alpn_selected method. */ -DLLEXPORT void CryptoNative_SslGet0AlpnSelected(SSL* ssl, const uint8_t** protocol, uint32_t* len); +PALEXPORT void CryptoNative_SslGet0AlpnSelected(SSL* ssl, const uint8_t** protocol, uint32_t* len); /* Shims the SSL_set_tlsext_host_name method. */ -DLLEXPORT int32_t CryptoNative_SslSetTlsExtHostName(SSL* ssl, uint8_t* name); +PALEXPORT int32_t CryptoNative_SslSetTlsExtHostName(SSL* ssl, uint8_t* name); /* Shims the SSL_get_current_cipher and SSL_CIPHER_get_id. */ -DLLEXPORT int32_t CryptoNative_SslGetCurrentCipherId(SSL* ssl, int32_t* cipherId); +PALEXPORT int32_t CryptoNative_SslGetCurrentCipherId(SSL* ssl, int32_t* cipherId); /* Looks up a cipher by the IANA identifier, returns a shared string for the OpenSSL name for the cipher, and emits a value indicating if the cipher belongs to the SSL2-TLS1.2 list, or the TLS1.3+ list. */ -DLLEXPORT const char* CryptoNative_GetOpenSslCipherSuiteName(SSL* ssl, int32_t cipherSuite, int32_t* isTls12OrLower); +PALEXPORT const char* CryptoNative_GetOpenSslCipherSuiteName(SSL* ssl, int32_t cipherSuite, int32_t* isTls12OrLower); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_x509.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_x509.h index 1e8dfd6..d856095 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_x509.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_x509.h @@ -68,30 +68,30 @@ GetX509EvpPublicKey Returns a EVP_PKEY* equivalent to the public key of the certificate. */ -DLLEXPORT EVP_PKEY* CryptoNative_GetX509EvpPublicKey(X509* x509); +PALEXPORT EVP_PKEY* CryptoNative_GetX509EvpPublicKey(X509* x509); /* Shims the d2i_X509_CRL method and makes it easier to invoke from managed code. */ -DLLEXPORT X509_CRL* CryptoNative_DecodeX509Crl(const uint8_t* buf, int32_t len); +PALEXPORT X509_CRL* CryptoNative_DecodeX509Crl(const uint8_t* buf, int32_t len); /* Shims the d2i_X509 method and makes it easier to invoke from managed code. */ -DLLEXPORT X509* CryptoNative_DecodeX509(const uint8_t* buf, int32_t len); +PALEXPORT X509* CryptoNative_DecodeX509(const uint8_t* buf, int32_t len); /* Returns the number of bytes it will take to convert the X509 to a DER format. */ -DLLEXPORT int32_t CryptoNative_GetX509DerSize(X509* x); +PALEXPORT int32_t CryptoNative_GetX509DerSize(X509* x); /* Shims the i2d_X509 method. Returns the number of bytes written to buf. */ -DLLEXPORT int32_t CryptoNative_EncodeX509(X509* x, uint8_t* buf); +PALEXPORT int32_t CryptoNative_EncodeX509(X509* x, uint8_t* buf); /* Cleans up and deletes an X509 instance. @@ -102,121 +102,121 @@ No-op if a is null. The given X509 pointer is invalid after this call. Always succeeds. */ -DLLEXPORT void CryptoNative_X509Destroy(X509* a); +PALEXPORT void CryptoNative_X509Destroy(X509* a); /* Shims the X509_dup method. Returns the duplicated X509 instance. */ -DLLEXPORT X509* CryptoNative_X509Duplicate(X509* x509); +PALEXPORT X509* CryptoNative_X509Duplicate(X509* x509); /* Shims the PEM_read_bio_X509 method. Returns the read X509 instance. */ -DLLEXPORT X509* CryptoNative_PemReadX509FromBio(BIO* bio); +PALEXPORT X509* CryptoNative_PemReadX509FromBio(BIO* bio); /* Shims the PEM_read_bio_X509_AUX method. Returns the read X509 instance. */ -DLLEXPORT X509* CryptoNative_PemReadX509FromBioAux(BIO* bio); +PALEXPORT X509* CryptoNative_PemReadX509FromBioAux(BIO* bio); /* Shims the X509_get_serialNumber method. Returns the ASN1_INTEGER for the serial number. */ -DLLEXPORT ASN1_INTEGER* CryptoNative_X509GetSerialNumber(X509* x509); +PALEXPORT ASN1_INTEGER* CryptoNative_X509GetSerialNumber(X509* x509); /* Shims the X509_get_issuer_name method. Returns the ASN1_INTEGER for the issuer name. */ -DLLEXPORT X509_NAME* CryptoNative_X509GetIssuerName(X509* x509); +PALEXPORT X509_NAME* CryptoNative_X509GetIssuerName(X509* x509); /* Shims the X509_get_subject_name method. Returns the X509_NAME for the subject name. */ -DLLEXPORT X509_NAME* CryptoNative_X509GetSubjectName(X509* x509); +PALEXPORT X509_NAME* CryptoNative_X509GetSubjectName(X509* x509); /* Shims the X509_check_purpose method. */ -DLLEXPORT int32_t CryptoNative_X509CheckPurpose(X509* x, int32_t id, int32_t ca); +PALEXPORT int32_t CryptoNative_X509CheckPurpose(X509* x, int32_t id, int32_t ca); /* Shims the X509_issuer_name_hash method. */ -DLLEXPORT uint64_t CryptoNative_X509IssuerNameHash(X509* x); +PALEXPORT uint64_t CryptoNative_X509IssuerNameHash(X509* x); /* Shims the X509_get_ext_count method. */ -DLLEXPORT int32_t CryptoNative_X509GetExtCount(X509* x); +PALEXPORT int32_t CryptoNative_X509GetExtCount(X509* x); /* Shims the X509_get_ext method. */ -DLLEXPORT X509_EXTENSION* CryptoNative_X509GetExt(X509* x, int32_t loc); +PALEXPORT X509_EXTENSION* CryptoNative_X509GetExt(X509* x, int32_t loc); /* Shims the X509_EXTENSION_get_object method. */ -DLLEXPORT ASN1_OBJECT* CryptoNative_X509ExtensionGetOid(X509_EXTENSION* x); +PALEXPORT ASN1_OBJECT* CryptoNative_X509ExtensionGetOid(X509_EXTENSION* x); /* Shims the X509_EXTENSION_get_data method. */ -DLLEXPORT ASN1_OCTET_STRING* CryptoNative_X509ExtensionGetData(X509_EXTENSION* x); +PALEXPORT ASN1_OCTET_STRING* CryptoNative_X509ExtensionGetData(X509_EXTENSION* x); /* Shims the X509_EXTENSION_get_critical method. */ -DLLEXPORT int32_t CryptoNative_X509ExtensionGetCritical(X509_EXTENSION* x); +PALEXPORT int32_t CryptoNative_X509ExtensionGetCritical(X509_EXTENSION* x); /* Returns the data portion of the first matched extension. */ -DLLEXPORT ASN1_OCTET_STRING* CryptoNative_X509FindExtensionData(X509* x, int32_t nid); +PALEXPORT ASN1_OCTET_STRING* CryptoNative_X509FindExtensionData(X509* x, int32_t nid); /* Shims the X509_STORE_free method. */ -DLLEXPORT void CryptoNative_X509StoreDestory(X509_STORE* v); +PALEXPORT void CryptoNative_X509StoreDestory(X509_STORE* v); /* Shims the X509_STORE_add_crl method. */ -DLLEXPORT int32_t CryptoNative_X509StoreAddCrl(X509_STORE* ctx, X509_CRL* x); +PALEXPORT int32_t CryptoNative_X509StoreAddCrl(X509_STORE* ctx, X509_CRL* x); /* Sets the correct flags on the X509_STORE for the specified X509RevocationFlag. Shims the X509_STORE_set_flags method. */ -DLLEXPORT int32_t CryptoNative_X509StoreSetRevocationFlag(X509_STORE* ctx, X509RevocationFlag revocationFlag); +PALEXPORT int32_t CryptoNative_X509StoreSetRevocationFlag(X509_STORE* ctx, X509RevocationFlag revocationFlag); /* Shims the X509_STORE_CTX_new method. */ -DLLEXPORT X509_STORE_CTX* CryptoNative_X509StoreCtxCreate(void); +PALEXPORT X509_STORE_CTX* CryptoNative_X509StoreCtxCreate(void); /* Shims the X509_STORE_CTX_free method. */ -DLLEXPORT void CryptoNative_X509StoreCtxDestroy(X509_STORE_CTX* v); +PALEXPORT void CryptoNative_X509StoreCtxDestroy(X509_STORE_CTX* v); /* Shims the X509_STORE_CTX_init method. */ -DLLEXPORT int32_t CryptoNative_X509StoreCtxInit(X509_STORE_CTX* ctx, +PALEXPORT int32_t CryptoNative_X509StoreCtxInit(X509_STORE_CTX* ctx, X509_STORE* store, X509* x509, X509Stack* extraStore); @@ -224,92 +224,92 @@ DLLEXPORT int32_t CryptoNative_X509StoreCtxInit(X509_STORE_CTX* ctx, /* Shims the X509_verify_cert method. */ -DLLEXPORT int32_t CryptoNative_X509VerifyCert(X509_STORE_CTX* ctx); +PALEXPORT int32_t CryptoNative_X509VerifyCert(X509_STORE_CTX* ctx); /* Shims the X509_STORE_CTX_get1_chain method. */ -DLLEXPORT X509Stack* CryptoNative_X509StoreCtxGetChain(X509_STORE_CTX* ctx); +PALEXPORT X509Stack* CryptoNative_X509StoreCtxGetChain(X509_STORE_CTX* ctx); /* Shims the X509_STORE_CTX_get_current_cert function. */ -DLLEXPORT X509* CryptoNative_X509StoreCtxGetCurrentCert(X509_STORE_CTX* ctx); +PALEXPORT X509* CryptoNative_X509StoreCtxGetCurrentCert(X509_STORE_CTX* ctx); /* Returns the interior pointer to the "untrusted" certificates collection for this X509_STORE_CTX */ -DLLEXPORT X509Stack* CryptoNative_X509StoreCtxGetSharedUntrusted(X509_STORE_CTX* ctx); +PALEXPORT X509Stack* CryptoNative_X509StoreCtxGetSharedUntrusted(X509_STORE_CTX* ctx); /* Returns the interior pointer to the target certificate for an X509 certificate chain */ -DLLEXPORT X509* CryptoNative_X509StoreCtxGetTargetCert(X509_STORE_CTX* ctx); +PALEXPORT X509* CryptoNative_X509StoreCtxGetTargetCert(X509_STORE_CTX* ctx); /* Shims the X509_STORE_CTX_get_error method. */ -DLLEXPORT X509VerifyStatusCode CryptoNative_X509StoreCtxGetError(X509_STORE_CTX* ctx); +PALEXPORT X509VerifyStatusCode CryptoNative_X509StoreCtxGetError(X509_STORE_CTX* ctx); /* Resets ctx to before the chain was built, preserving the target cert, trust store, extra cert context, and verify parameters. */ -DLLEXPORT int32_t CryptoNative_X509StoreCtxReset(X509_STORE_CTX* ctx); +PALEXPORT int32_t CryptoNative_X509StoreCtxReset(X509_STORE_CTX* ctx); /* Reset ctx and rebuild the chain. Returns -1 if CryptoNative_X509StoreCtxReset failed, otherwise returns the result of X509_verify_cert. */ -DLLEXPORT int32_t CryptoNative_X509StoreCtxRebuildChain(X509_STORE_CTX* ctx); +PALEXPORT int32_t CryptoNative_X509StoreCtxRebuildChain(X509_STORE_CTX* ctx); /* Shims the X509_STORE_CTX_get_error_depth method. */ -DLLEXPORT int32_t CryptoNative_X509StoreCtxGetErrorDepth(X509_STORE_CTX* ctx); +PALEXPORT int32_t CryptoNative_X509StoreCtxGetErrorDepth(X509_STORE_CTX* ctx); /* Shims the X509_STORE_CTX_set_verify_cb function. */ -DLLEXPORT void CryptoNative_X509StoreCtxSetVerifyCallback(X509_STORE_CTX* ctx, X509StoreVerifyCallback callback); +PALEXPORT void CryptoNative_X509StoreCtxSetVerifyCallback(X509_STORE_CTX* ctx, X509StoreVerifyCallback callback); /* Shims the X509_verify_cert_error_string method. */ -DLLEXPORT const char* CryptoNative_X509VerifyCertErrorString(X509VerifyStatusCode n); +PALEXPORT const char* CryptoNative_X509VerifyCertErrorString(X509VerifyStatusCode n); /* Shims the X509_CRL_free method. */ -DLLEXPORT void CryptoNative_X509CrlDestroy(X509_CRL* a); +PALEXPORT void CryptoNative_X509CrlDestroy(X509_CRL* a); /* Shims the PEM_write_bio_X509_CRL method. Returns the number of bytes written. */ -DLLEXPORT int32_t CryptoNative_PemWriteBioX509Crl(BIO* bio, X509_CRL* crl); +PALEXPORT int32_t CryptoNative_PemWriteBioX509Crl(BIO* bio, X509_CRL* crl); /* Shims the PEM_read_bio_X509_CRL method. The new X509_CRL instance. */ -DLLEXPORT X509_CRL* CryptoNative_PemReadBioX509Crl(BIO* bio); +PALEXPORT X509_CRL* CryptoNative_PemReadBioX509Crl(BIO* bio); /* Returns the number of bytes it will take to convert the SubjectPublicKeyInfo portion of the X509 to DER format. */ -DLLEXPORT int32_t CryptoNative_GetX509SubjectPublicKeyInfoDerSize(X509* x); +PALEXPORT int32_t CryptoNative_GetX509SubjectPublicKeyInfoDerSize(X509* x); /* Shims the i2d_X509_PUBKEY method, providing X509_get_X509_PUBKEY(x) as the input. Returns the number of bytes written to buf. */ -DLLEXPORT int32_t CryptoNative_EncodeX509SubjectPublicKeyInfo(X509* x, uint8_t* buf); +PALEXPORT int32_t CryptoNative_EncodeX509SubjectPublicKeyInfo(X509* x, uint8_t* buf); /* Increases the reference count of the X509*, thereby increasing the number of calls @@ -319,28 +319,28 @@ Unlike X509Duplicate, this modifies an existing object, so no new memory is allo Returns the input value. */ -DLLEXPORT X509* CryptoNative_X509UpRef(X509* x509); +PALEXPORT X509* CryptoNative_X509UpRef(X509* x509); /* Create a new X509_STORE, considering the certificates from systemTrust and userTrust */ -DLLEXPORT X509_STORE* CryptoNative_X509ChainNew(X509Stack* systemTrust, X509Stack* userTrust); +PALEXPORT X509_STORE* CryptoNative_X509ChainNew(X509Stack* systemTrust, X509Stack* userTrust); /* Adds all of the simple certificates from null-or-empty-password PFX files in storePath to stack. */ -DLLEXPORT int32_t CryptoNative_X509StackAddDirectoryStore(X509Stack* stack, char* storePath); +PALEXPORT int32_t CryptoNative_X509StackAddDirectoryStore(X509Stack* stack, char* storePath); /* Adds all of the certificates in src to dest and increases their reference count. */ -DLLEXPORT int32_t CryptoNative_X509StackAddMultiple(X509Stack* dest, X509Stack* src); +PALEXPORT int32_t CryptoNative_X509StackAddMultiple(X509Stack* dest, X509Stack* src); /* Removes any untrusted/extra certificates from the unstrusted collection that are not part of the current chain to make chain builds after Reset faster. */ -DLLEXPORT int32_t CryptoNative_X509StoreCtxCommitToChain(X509_STORE_CTX* storeCtx); +PALEXPORT int32_t CryptoNative_X509StoreCtxCommitToChain(X509_STORE_CTX* storeCtx); /* Duplicates any certificate at or below the level where the error marker is. @@ -348,25 +348,25 @@ Duplicates any certificate at or below the level where the error marker is. Outputs a new store with a clone of the root, if necessary. The new store does not have any properties set other than the trust. (Mainly, CRLs are lost) */ -DLLEXPORT int32_t CryptoNative_X509StoreCtxResetForSignatureError(X509_STORE_CTX* storeCtx, X509_STORE** newStore); +PALEXPORT int32_t CryptoNative_X509StoreCtxResetForSignatureError(X509_STORE_CTX* storeCtx, X509_STORE** newStore); /* Look for a cached OCSP response appropriate to the end-entity certificate using the issuer as determined by the chain in storeCtx. */ -DLLEXPORT X509VerifyStatusCode CryptoNative_X509ChainGetCachedOcspStatus(X509_STORE_CTX* storeCtx, char* cachePath, int chainDepth); +PALEXPORT X509VerifyStatusCode CryptoNative_X509ChainGetCachedOcspStatus(X509_STORE_CTX* storeCtx, char* cachePath, int chainDepth); /* Build an OCSP request appropriate for the end-entity certificate using the issuer (and trust) as determined by the chain in storeCtx. */ -DLLEXPORT OCSP_REQUEST* CryptoNative_X509ChainBuildOcspRequest(X509_STORE_CTX* storeCtx, int chainDepth); +PALEXPORT OCSP_REQUEST* CryptoNative_X509ChainBuildOcspRequest(X509_STORE_CTX* storeCtx, int chainDepth); /* Determine if the OCSP response is acceptable, and if acceptable report the status and cache the result (if appropriate) */ -DLLEXPORT X509VerifyStatusCode CryptoNative_X509ChainVerifyOcsp(X509_STORE_CTX* storeCtx, +PALEXPORT X509VerifyStatusCode CryptoNative_X509ChainVerifyOcsp(X509_STORE_CTX* storeCtx, OCSP_REQUEST* req, OCSP_RESPONSE* resp, char* cachePath, diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_x509_name.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_x509_name.h index a24fdef..cfd633e 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_x509_name.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_x509_name.h @@ -12,9 +12,9 @@ GetX509NameStackFieldCount Direct shim to sk_X509_NAME_num */ -DLLEXPORT int32_t CryptoNative_GetX509NameStackFieldCount(X509NameStack* sk); +PALEXPORT int32_t CryptoNative_GetX509NameStackFieldCount(X509NameStack* sk); /* Direct shim to sk_X509_NAME_value */ -DLLEXPORT X509_NAME* CryptoNative_GetX509NameStackField(X509NameStack* sk, int32_t loc); +PALEXPORT X509_NAME* CryptoNative_GetX509NameStackField(X509NameStack* sk, int32_t loc); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_x509_root.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_x509_root.h index f259a50..40a828e 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_x509_root.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_x509_root.h @@ -9,11 +9,11 @@ Look up the directory in which all certificate files therein are considered trusted (root or trusted intermediate). */ -DLLEXPORT const char* CryptoNative_GetX509RootStorePath(void); +PALEXPORT const char* CryptoNative_GetX509RootStorePath(void); /* Look up the file in which all certificates are considered trusted (root or trusted intermediate), in addition to those files in the root store path. */ -DLLEXPORT const char* CryptoNative_GetX509RootStoreFile(void); +PALEXPORT const char* CryptoNative_GetX509RootStoreFile(void); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_x509ext.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_x509ext.h index 166f84d..3b8b4f2 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_x509ext.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_x509ext.h @@ -13,7 +13,7 @@ Implemented by calling X509_EXTENSION_create_by_OBJ Returns new X509_EXTENSION on success, nullptr on failure. */ -DLLEXPORT X509_EXTENSION* +PALEXPORT X509_EXTENSION* CryptoNative_X509ExtensionCreateByObj(ASN1_OBJECT* obj, int32_t isCritical, ASN1_OCTET_STRING* data); /* @@ -25,14 +25,14 @@ No-op if a is null. The given X509_EXTENSION pointer is invalid after this call. Always succeeds. */ -DLLEXPORT void CryptoNative_X509ExtensionDestroy(X509_EXTENSION* a); +PALEXPORT void CryptoNative_X509ExtensionDestroy(X509_EXTENSION* a); /* Shims the X509V3_EXT_print method. Returns 1 on success, otherwise 0 if there was an error. */ -DLLEXPORT int32_t CryptoNative_X509V3ExtPrint(BIO* out, X509_EXTENSION* ext); +PALEXPORT int32_t CryptoNative_X509V3ExtPrint(BIO* out, X509_EXTENSION* ext); /* Decodes the X509 BASIC_CONSTRAINTS information and fills the out variables: @@ -43,7 +43,7 @@ Decodes the X509 BASIC_CONSTRAINTS information and fills the out variables: Returns 1 if the BASIC_CONSTRAINTS information was successfully decoded, otherwise 0. */ -DLLEXPORT int32_t CryptoNative_DecodeX509BasicConstraints2Extension(const uint8_t* encoded, +PALEXPORT int32_t CryptoNative_DecodeX509BasicConstraints2Extension(const uint8_t* encoded, int32_t encodedLength, int32_t* certificateAuthority, int32_t* hasPathLengthConstraint, @@ -52,7 +52,7 @@ DLLEXPORT int32_t CryptoNative_DecodeX509BasicConstraints2Extension(const uint8_ /* Shims the d2i_EXTENDED_KEY_USAGE method and makes it easier to invoke from managed code. */ -DLLEXPORT EXTENDED_KEY_USAGE* CryptoNative_DecodeExtendedKeyUsage(const uint8_t* buf, int32_t len); +PALEXPORT EXTENDED_KEY_USAGE* CryptoNative_DecodeExtendedKeyUsage(const uint8_t* buf, int32_t len); /* Cleans up and deletes an EXTENDED_KEY_USAGE instance. @@ -63,4 +63,4 @@ No-op if a is null. The given EXTENDED_KEY_USAGE pointer is invalid after this call. Always succeeds. */ -DLLEXPORT void CryptoNative_ExtendedKeyUsageDestory(EXTENDED_KEY_USAGE* a); +PALEXPORT void CryptoNative_ExtendedKeyUsageDestory(EXTENDED_KEY_USAGE* a); diff --git a/src/mono/netcore/System.Private.CoreLib/src/LinkerDescriptor/System.Private.CoreLib.xml b/src/mono/netcore/System.Private.CoreLib/src/LinkerDescriptor/System.Private.CoreLib.xml index bba737a..c5d0285 100644 --- a/src/mono/netcore/System.Private.CoreLib/src/LinkerDescriptor/System.Private.CoreLib.xml +++ b/src/mono/netcore/System.Private.CoreLib/src/LinkerDescriptor/System.Private.CoreLib.xml @@ -1,7 +1,6 @@ - @@ -808,5 +807,9 @@ + + + +