Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
335917b
Merge in 'release/8.0' changes
dotnet-bot May 2, 2024
0e1c3ef
Merge in 'release/8.0' changes
dotnet-bot May 3, 2024
fa5b0d8
Merged PR 39242: Add a fallback to filling buffers in DeserializeAsyn…
May 3, 2024
d82c60d
Merge in 'release/8.0' changes
dotnet-bot May 17, 2024
a55d665
Merge in 'release/8.0' changes
dotnet-bot May 17, 2024
cb4ec67
Merge in 'release/8.0' changes
dotnet-bot May 17, 2024
6d230cd
Merge in 'release/8.0' changes
dotnet-bot May 20, 2024
76b5cd8
Merge in 'release/8.0' changes
dotnet-bot May 20, 2024
63d8096
Merge in 'release/8.0' changes
dotnet-bot May 20, 2024
4a8d5a0
Limit the size of OID supported by AsnDecoder/AsnReader
bartonjs Jun 10, 2024
eae2d42
Merge in 'release/8.0' changes
dotnet-bot Jun 10, 2024
025271a
Use GetTempPath2 on Windows if available
hoyosjs Jun 10, 2024
25139d0
newlines in domain literals
carlossanlop Jun 10, 2024
166be6b
Merge in 'release/8.0' changes
dotnet-bot Jun 11, 2024
d246d8e
Merge in 'release/8.0' changes
dotnet-bot Jun 11, 2024
7ab2011
Bypassing Serialization Binders with BinaryFormatter Mutation
Jun 11, 2024
e0b6a81
Merge in 'release/8.0' changes
dotnet-bot Jun 11, 2024
cc6880c
Merge in 'release/8.0' changes
dotnet-bot Jun 13, 2024
2aade6b
Merge in 'release/8.0' changes
dotnet-bot Jun 13, 2024
1d8fcf1
Onboard new inter-branch merge flow [Workflow] (#103807)
f-alizada Jul 3, 2024
45636fe
Merge commit '2aade6beb02ea367fd97c4070a4198802fe61c03' into internal…
vseanreesermsft Jul 9, 2024
2b93b01
Merge pull request #104623 from vseanreesermsft/internal-merge-8.0-20…
carlossanlop Jul 9, 2024
4ee04ba
Merge branch 'release/8.0-staging' into merge/release/8.0-to-release/…
carlossanlop Jul 12, 2024
62cc752
Merge branch 'release/8.0-staging' into merge/release/8.0-to-release/…
carlossanlop Jul 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/inter-branch-merge-flow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Inter-branch merge workflow
on:
push:
branches:
- release/**

permissions:
contents: write
pull-requests: write

jobs:
Merge:
uses: dotnet/arcade/.github/workflows/inter-branch-merge-base.yml@main
2 changes: 2 additions & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@
<SystemSecurityCryptographyOpenSslVersion>5.0.0</SystemSecurityCryptographyOpenSslVersion>
<SystemSecurityPrincipalWindowsVersion>5.0.0</SystemSecurityPrincipalWindowsVersion>
<SystemSecurityPermissionsVersion>7.0.0</SystemSecurityPermissionsVersion>
<!-- The JSON version that's present in minimum MSBuild / VS version that this release is supported on -->
<SystemTextJsonToolsetVersion>7.0.3</SystemTextJsonToolsetVersion>
<SystemTextJsonVersion>8.0.0-rc.1.23406.6</SystemTextJsonVersion>
<SystemRuntimeCompilerServicesUnsafeVersion>6.0.0</SystemRuntimeCompilerServicesUnsafeVersion>
<SystemThreadingAccessControlVersion>7.0.0</SystemThreadingAccessControlVersion>
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/debug/createdump/createdump.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ extern MINIDUMP_TYPE GetMiniDumpType(DumpType dumpType);

#ifdef HOST_WINDOWS
extern std::string GetLastErrorString();
extern DWORD GetTempPathWrapper(IN DWORD nBufferLength, OUT LPSTR lpBuffer);
#else
#define GetTempPathWrapper GetTempPathA
#endif
extern void printf_status(const char* format, ...);
extern void printf_error(const char* format, ...);
2 changes: 1 addition & 1 deletion src/coreclr/debug/createdump/createdumpmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ int createdump_main(const int argc, const char* argv[])
ArrayHolder<char> tmpPath = new char[MAX_LONGPATH];
if (options.DumpPathTemplate == nullptr)
{
if (::GetTempPathA(MAX_LONGPATH, tmpPath) == 0)
if (GetTempPathWrapper(MAX_LONGPATH, tmpPath) == 0)
{
printf_error("GetTempPath failed\n");
return -1;
Expand Down
35 changes: 35 additions & 0 deletions src/coreclr/debug/createdump/createdumpwindows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,38 @@ GetLastErrorString()
return result;
}


typedef DWORD(WINAPI *pfnGetTempPathA)(DWORD nBufferLength, LPSTR lpBuffer);

static volatile pfnGetTempPathA
g_pfnGetTempPathA = nullptr;


DWORD
GetTempPathWrapper(
IN DWORD nBufferLength,
OUT LPSTR lpBuffer)
{
if (g_pfnGetTempPathA == nullptr)
{
HMODULE hKernel32 = LoadLibraryExW(L"kernel32.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);

pfnGetTempPathA pLocalGetTempPathA = NULL;
if (hKernel32 != NULL)
{
// store to thread local variable to prevent data race
pLocalGetTempPathA = (pfnGetTempPathA)::GetProcAddress(hKernel32, "GetTempPath2A");
}

if (pLocalGetTempPathA == NULL) // method is only available with Windows 10 Creators Update or later
{
g_pfnGetTempPathA = &GetTempPathA;
}
else
{
g_pfnGetTempPathA = pLocalGetTempPathA;
}
}

return g_pfnGetTempPathA(nBufferLength, lpBuffer);
}
4 changes: 0 additions & 4 deletions src/coreclr/inc/longfilepathwrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ SearchPathWrapper(
_Out_opt_ LPWSTR * lpFilePart
);

DWORD WINAPI GetTempPathWrapper(
SString& lpBuffer
);

DWORD
GetModuleFileNameWrapper(
_In_opt_ HMODULE hModule,
Expand Down
3 changes: 0 additions & 3 deletions src/coreclr/inc/winwrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,6 @@
//Can not use extended syntax
#define WszGetFullPathName GetFullPathNameW

//Long Files will not work on these till redstone
#define WszGetTempPath GetTempPathWrapper

//APIS which have a buffer as an out parameter
#define WszGetEnvironmentVariable GetEnvironmentVariableWrapper
#define WszSearchPath SearchPathWrapper
Expand Down
41 changes: 0 additions & 41 deletions src/coreclr/utilcode/longfilepathwrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,47 +184,6 @@ GetModuleFileNameWrapper(
return ret;
}

DWORD WINAPI GetTempPathWrapper(
SString& lpBuffer
)
{
CONTRACTL
{
NOTHROW;
}
CONTRACTL_END;

HRESULT hr = S_OK;
DWORD ret = 0;
DWORD lastError = 0;

EX_TRY
{
//Change the behaviour in Redstone to retry
COUNT_T size = MAX_LONGPATH;

ret = GetTempPathW(
size,
lpBuffer.OpenUnicodeBuffer(size - 1)
);

lastError = GetLastError();
lpBuffer.CloseBuffer(ret);
}
EX_CATCH_HRESULT(hr);

if (hr != S_OK)
{
SetLastError(hr);
}
else if (ret == 0)
{
SetLastError(lastError);
}

return ret;
}

DWORD WINAPI GetEnvironmentVariableWrapper(
_In_opt_ LPCTSTR lpName,
_Out_opt_ SString& lpBuffer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<ItemGroup>
<!-- we need to keep the version of System.Reflection.Metadata in sync with dotnet/msbuild and dotnet/sdk -->
<PackageReference Include="System.Reflection.Metadata" Version="6.0.0" />
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonVersion)" />
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonToolsetVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@ internal static void ReadDsaPrivateKey(
throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
}

DssParms parms = DssParms.Decode(algId.Parameters.Value, AsnEncodingRules.BER);

ret = new DSAParameters
{
P = parms.P.ToByteArray(isUnsigned: true, isBigEndian: true),
Q = parms.Q.ToByteArray(isUnsigned: true, isBigEndian: true),
};

ret.G = parms.G.ExportKeyParameter(ret.P.Length);

BigInteger x;

try
Expand All @@ -57,6 +47,34 @@ internal static void ReadDsaPrivateKey(
throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e);
}

DssParms parms = DssParms.Decode(algId.Parameters.Value, AsnEncodingRules.BER);

// Sanity checks from FIPS 186-4 4.1/4.2. Since FIPS 186-5 withdrew DSA/DSS
// these will never change again.
//
// This technically allows a non-standard combination of 1024-bit P and 256-bit Q,
// but that will get filtered out by the underlying provider.
// These checks just prevent obviously bad data from wasting work on reinterpretation.

if (parms.P.Sign < 0 ||
parms.Q.Sign < 0 ||
!IsValidPLength(parms.P.GetBitLength()) ||
!IsValidQLength(parms.Q.GetBitLength()) ||
parms.G <= 1 ||
parms.G >= parms.P ||
x <= 1 ||
x >= parms.Q)
{
throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
}

ret = new DSAParameters
{
P = parms.P.ToByteArray(isUnsigned: true, isBigEndian: true),
Q = parms.Q.ToByteArray(isUnsigned: true, isBigEndian: true),
};

ret.G = parms.G.ExportKeyParameter(ret.P.Length);
ret.X = x.ExportKeyParameter(ret.Q.Length);

// The public key is not contained within the format, calculate it.
Expand All @@ -69,6 +87,11 @@ internal static void ReadDsaPublicKey(
in AlgorithmIdentifierAsn algId,
out DSAParameters ret)
{
if (!algId.Parameters.HasValue)
{
throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
}

BigInteger y;

try
Expand All @@ -88,13 +111,27 @@ internal static void ReadDsaPublicKey(
throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e);
}

if (!algId.Parameters.HasValue)
DssParms parms = DssParms.Decode(algId.Parameters.Value, AsnEncodingRules.BER);

// Sanity checks from FIPS 186-4 4.1/4.2. Since FIPS 186-5 withdrew DSA/DSS
// these will never change again.
//
// This technically allows a non-standard combination of 1024-bit P and 256-bit Q,
// but that will get filtered out by the underlying provider.
// These checks just prevent obviously bad data from wasting work on reinterpretation.

if (parms.P.Sign < 0 ||
parms.Q.Sign < 0 ||
!IsValidPLength(parms.P.GetBitLength()) ||
!IsValidQLength(parms.Q.GetBitLength()) ||
parms.G <= 1 ||
parms.G >= parms.P ||
y <= 1 ||
y >= parms.P)
{
throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding);
}

DssParms parms = DssParms.Decode(algId.Parameters.Value, AsnEncodingRules.BER);

ret = new DSAParameters
{
P = parms.P.ToByteArray(isUnsigned: true, isBigEndian: true),
Expand All @@ -105,6 +142,25 @@ internal static void ReadDsaPublicKey(
ret.Y = y.ExportKeyParameter(ret.P.Length);
}

private static bool IsValidPLength(long pBitLength)
{
return pBitLength switch
{
// FIPS 186-3/186-4
1024 or 2048 or 3072 => true,
// FIPS 186-1/186-2
>= 512 and < 1024 => pBitLength % 64 == 0,
_ => false,
};
}

private static bool IsValidQLength(long qBitLength)
{
// FIPS 186-1/186-2 only allows 160
// FIPS 186-3/186-4 allow 160/224/256
return qBitLength is 160 or 224 or 256;
}

internal static void ReadSubjectPublicKeyInfo(
ReadOnlySpan<byte> source,
out int bytesRead,
Expand Down
Loading