Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public abstract partial class ECKeyFileTests<T> where T : ECAlgorithm

// This would need to be virtualized if there was ever a platform that
// allowed explicit in ECDH or ECDSA but not the other.
public static bool SupportsExplicitCurves { get; } = EcDiffieHellman.Tests.ECDiffieHellmanFactory.ExplicitCurvesSupported;
public static bool SupportsExplicitCurves { get; } =
EcDiffieHellman.Tests.ECDiffieHellmanFactory.ExplicitCurvesSupported ||
EcDiffieHellman.Tests.ECDiffieHellmanFactory.ExplicitCurvesSupportFailOnUseOnly;

public static bool CanDeriveNewPublicKey { get; } = EcDiffieHellman.Tests.ECDiffieHellmanFactory.CanDeriveNewPublicKey;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public interface IECDiffieHellmanProvider
#endif
bool IsCurveValid(Oid oid);
bool ExplicitCurvesSupported { get; }
bool ExplicitCurvesSupportFailOnUseOnly => PlatformDetection.IsAzureLinux;
bool CanDeriveNewPublicKey { get; }
bool SupportsRawDerivation { get; }
bool SupportsSha3 { get; }
Expand Down Expand Up @@ -48,5 +49,7 @@ public static bool IsCurveValid(Oid oid)
public static bool SupportsRawDerivation => s_provider.SupportsRawDerivation;

public static bool SupportsSha3 => s_provider.SupportsSha3;

public static bool ExplicitCurvesSupportFailOnUseOnly => s_provider.ExplicitCurvesSupportFailOnUseOnly;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ public static void TestGeneralExportWithExplicitParameters()
[Fact]
public static void TestExplicitCurveImportOnUnsupportedPlatform()
{
if (ECDiffieHellmanFactory.ExplicitCurvesSupported)
if (ECDiffieHellmanFactory.ExplicitCurvesSupported || ECDiffieHellmanFactory.ExplicitCurvesSupportFailOnUseOnly)
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public interface IECDsaProvider
#endif
bool IsCurveValid(Oid oid);
bool ExplicitCurvesSupported { get; }
bool ExplicitCurvesSupportFailOnUseOnly => PlatformDetection.IsAzureLinux;
}

public static partial class ECDsaFactory
Expand Down Expand Up @@ -39,5 +40,6 @@ public static bool IsCurveValid(Oid oid)
}

public static bool ExplicitCurvesSupported => s_provider.ExplicitCurvesSupported;
public static bool ExplicitCurvesSupportFailOnUseOnly => s_provider.ExplicitCurvesSupportFailOnUseOnly;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ namespace System.Security.Cryptography.Rsa.Tests
[SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")]
public class KeyGeneration
{
[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotAzureLinux))]
Comment thread
vcsjones marked this conversation as resolved.
public static void GenerateMinKey()
{
GenerateKey(rsa => GetMin(rsa.LegalKeySizes));
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotAzureLinux))]
public static void GenerateSecondMinKey()
{
GenerateKey(rsa => GetSecondMin(rsa.LegalKeySizes));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public static partial class PlatformDetection
public static bool IsNotMonoLinuxArm64 => !IsMonoLinuxArm64;
public static bool IsQemuLinux => IsLinux && Environment.GetEnvironmentVariable("DOTNET_RUNNING_UNDER_QEMU") != null;
public static bool IsNotQemuLinux => !IsQemuLinux;
public static bool IsNotAzureLinux => !IsAzureLinux;

// OSX family
public static bool IsApplePlatform => IsOSX || IsiOS || IstvOS || IsMacCatalyst;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public bool ExplicitCurvesSupported
{
get
{
return true;
return !PlatformDetection.IsAzureLinux;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,11 @@ public static void CheckIsSupported()
// CryptoKit is supported on macOS 10.15+, which is our minimum target. On iOS/tvOS, it was added in 13.0 but we can expect that version in our testing environments.
expectedIsSupported = true;
}
else if (PlatformDetection.IsAzureLinux)
{
// Though Azure Linux uses OpenSSL, they build OpenSSL without ChaCha20-Poly1305.
expectedIsSupported = false;
}
else if (PlatformDetection.OpenSslPresentOnSystem && PlatformDetection.IsOpenSslSupported)
{
const int OpenSslChaChaMinimumVersion = 0x1_01_00_00_F; //major_minor_fix_patch_status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public bool ExplicitCurvesSupported
{
get
{
if (PlatformDetection.IsApplePlatform)
if (PlatformDetection.IsApplePlatform || PlatformDetection.IsAzureLinux)
{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public bool ExplicitCurvesSupported
{
get
{
if (PlatformDetection.IsApplePlatform)
if (PlatformDetection.IsApplePlatform || PlatformDetection.IsAzureLinux)
{
return false;
}
Expand Down