Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Merged PR 89706: Merge github/release/1.1.0 to release/1.1.0-MSRC
Browse files Browse the repository at this point in the history
Again merge conflicts in this branch due to msrc changes for the non-stabilized build.
  • Loading branch information
safern committed Oct 14, 2017
1 parent 4f8d79b commit 0ceb8c2
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Packaging.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<XmlDocFileRoot>$(PackagesDir)Microsoft.Private.Intellisense/1.0.0-rc4-24206-00/xmldocs</XmlDocFileRoot>
<!-- We're currently not building a "live" baseline, instead we're using .NETCore 1.0 RTM stable versions as the baseline -->
<SkipBaseLineCheck>true</SkipBaseLineCheck>
<LineupPackageVersion Condition="'$(LineupPackageVersion)' == ''">1.1.1</LineupPackageVersion>
<LineupPackageVersion Condition="'$(LineupPackageVersion)' == ''">1.1.2</LineupPackageVersion>
<PlatformPackageVersion Condition="'$(PlatformPackageVersion)' == ''">1.1.0</PlatformPackageVersion>

<!-- by default all packages will use the same version which revs with respect to product version -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />

<PropertyGroup>
<PackageVersion>1.1.1</PackageVersion>
<PackageVersion>1.1.2</PackageVersion>
<IsLineupPackage>true</IsLineupPackage>
<RuntimeFileSource>runtime.json</RuntimeFileSource>
<SkipValidatePackage>true</SkipValidatePackage>
Expand Down
45 changes: 30 additions & 15 deletions pkg/Microsoft.Private.PackageBaseline/packageIndex.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"1.0.1",
"1.0.2",
"1.1.0",
"1.1.1"
"1.1.1",
"1.1.2"
],
"BaselineVersion": "1.1.0"
},
Expand Down Expand Up @@ -357,7 +358,8 @@
"1.0.1",
"4.3.0",
"4.3.1",
"4.3.2"
"4.3.2",
"4.3.3"
],
"BaselineVersion": "4.3.2"
},
Expand Down Expand Up @@ -395,7 +397,8 @@
"1.0.1",
"4.3.0",
"4.3.1",
"4.3.2"
"4.3.2",
"4.3.3"
],
"BaselineVersion": "4.3.2"
},
Expand Down Expand Up @@ -440,7 +443,8 @@
"4.0.0",
"4.3.0",
"4.3.1",
"4.3.2"
"4.3.2",
"4.3.3"
],
"BaselineVersion": "4.3.2"
},
Expand Down Expand Up @@ -478,7 +482,8 @@
"1.0.1",
"4.3.0",
"4.3.1",
"4.3.2"
"4.3.2",
"4.3.3"
],
"BaselineVersion": "4.3.2"
},
Expand Down Expand Up @@ -516,7 +521,8 @@
"1.0.1",
"4.3.0",
"4.3.1",
"4.3.2"
"4.3.2",
"4.3.3"
],
"BaselineVersion": "4.3.2"
},
Expand Down Expand Up @@ -554,7 +560,8 @@
"1.0.1",
"4.3.0",
"4.3.1",
"4.3.2"
"4.3.2",
"4.3.3"
],
"BaselineVersion": "4.3.2"
},
Expand Down Expand Up @@ -592,7 +599,8 @@
"1.0.1",
"4.3.0",
"4.3.1",
"4.3.2"
"4.3.2",
"4.3.3"
],
"BaselineVersion": "4.3.2"
},
Expand Down Expand Up @@ -630,7 +638,8 @@
"1.0.1",
"4.3.0",
"4.3.1",
"4.3.2"
"4.3.2",
"4.3.3"
],
"BaselineVersion": "4.3.2"
},
Expand Down Expand Up @@ -2028,7 +2037,8 @@
"System.Security.Cryptography.Algorithms": {
"StableVersions": [
"4.2.0",
"4.3.0"
"4.3.0",
"4.3.1"
],
"BaselineVersion": "4.3.0",
"AssemblyVersionInPackageVersion": {
Expand Down Expand Up @@ -2076,7 +2086,8 @@
"System.Security.Cryptography.OpenSsl": {
"StableVersions": [
"4.0.0",
"4.3.0"
"4.3.0",
"4.3.1"
],
"BaselineVersion": "4.3.0",
"AssemblyVersionInPackageVersion": {
Expand Down Expand Up @@ -2120,7 +2131,8 @@
"StableVersions": [
"4.1.0",
"4.3.0",
"4.3.1"
"4.3.1",
"4.3.2"
],
"BaselineVersion": "4.3.0",
"AssemblyVersionInPackageVersion": {
Expand Down Expand Up @@ -2617,7 +2629,8 @@
"StableVersions": [
"4.3.0",
"4.3.1",
"4.3.2"
"4.3.2",
"4.3.3"
],
"BaselineVersion": "4.3.2"
},
Expand Down Expand Up @@ -2666,7 +2679,8 @@
"StableVersions": [
"4.3.0",
"4.3.1",
"4.3.2"
"4.3.2",
"4.3.3"
],
"BaselineVersion": "4.3.2"
},
Expand Down Expand Up @@ -2746,7 +2760,8 @@
"StableVersions": [
"4.3.0",
"4.3.1",
"4.3.2"
"4.3.2",
"4.3.3"
],
"BaselineVersion": "4.3.2"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ internal static SafeEcKeyHandle EcKeyCreateByExplicitCurve(ECCurve curve)


[DllImport(Libraries.CryptoNative)]
private static extern bool CryptoNative_GetECKeyParameters(
private static extern int CryptoNative_GetECKeyParameters(
SafeEcKeyHandle key,
bool includePrivate,
out SafeBignumHandle qx_bn, out int x_cb,
Expand All @@ -117,12 +117,18 @@ internal static ECParameters GetECKeyParameters(
try
{
key.DangerousAddRef(ref refAdded); // Protect access to d_bn_not_owned
if (!CryptoNative_GetECKeyParameters(
int rc = CryptoNative_GetECKeyParameters(
key,
includePrivate,
out qx_bn, out qx_cb,
out qy_bn, out qy_cb,
out d_bn_not_owned, out d_cb))
out d_bn_not_owned, out d_cb);

if (rc == -1)
{
throw new CryptographicException(SR.Cryptography_CSP_NoPrivateKey);
}
else if (rc != 1)
{
throw Interop.Crypto.CreateOpenSslCryptographicException();
}
Expand Down Expand Up @@ -152,7 +158,7 @@ internal static ECParameters GetECKeyParameters(
}

[DllImport(Libraries.CryptoNative)]
private static extern bool CryptoNative_GetECCurveParameters(
private static extern int CryptoNative_GetECCurveParameters(
SafeEcKeyHandle key,
bool includePrivate,
out ECCurve.ECCurveType curveType,
Expand Down Expand Up @@ -181,7 +187,7 @@ internal static ECParameters GetECCurveParameters(
try
{
key.DangerousAddRef(ref refAdded); // Protect access to d_bn_not_owned
if (!CryptoNative_GetECCurveParameters(
int rc = CryptoNative_GetECCurveParameters(
key,
includePrivate,
out curveType,
Expand All @@ -195,7 +201,13 @@ internal static ECParameters GetECCurveParameters(
out gy_bn, out gy_cb,
out order_bn, out order_cb,
out cofactor_bn, out cofactor_cb,
out seed_bn, out seed_cb))
out seed_bn, out seed_cb);

if (rc == -1)
{
throw new CryptographicException(SR.Cryptography_CSP_NoPrivateKey);
}
else if (rc != 1)
{
throw Interop.Crypto.CreateOpenSslCryptographicException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.

using Xunit;
using Test.Cryptography;

namespace System.Security.Cryptography.EcDsa.Tests
{
Expand Down Expand Up @@ -237,6 +238,32 @@ public static void TestNamedCurveWithExplicitKey()
}
}

[ConditionalFact(nameof(ECExplicitCurvesSupported))]
public static void ExportIncludingPrivateOnPublicOnlyKey()
{
ECParameters iutParameters = new ECParameters
{
Curve = ECCurve.NamedCurves.nistP521,
Q =
{
X = "00d45615ed5d37fde699610a62cd43ba76bedd8f85ed31005fe00d6450fbbd101291abd96d4945a8b57bc73b3fe9f4671105309ec9b6879d0551d930dac8ba45d255".HexToByteArray(),
Y = "01425332844e592b440c0027972ad1526431c06732df19cd46a242172d4dd67c2c8c99dfc22e49949a56cf90c6473635ce82f25b33682fb19bc33bd910ed8ce3a7fa".HexToByteArray(),
},
D = "00816f19c1fb10ef94d4a1d81c156ec3d1de08b66761f03f06ee4bb9dcebbbfe1eaa1ed49a6a990838d8ed318c14d74cc872f95d05d07ad50f621ceb620cd905cfb8".HexToByteArray(),
};

using (ECDsa iut = ECDsaFactory.Create())
using (ECDsa cavs = ECDsaFactory.Create())
{
iut.ImportParameters(iutParameters);
cavs.ImportParameters(iut.ExportParameters(false));

// Linux throws an Interop.Crypto.OpenSslCryptographicException : CryptographicException
Assert.ThrowsAny<CryptographicException>(() => cavs.ExportExplicitParameters(true));
Assert.ThrowsAny<CryptographicException>(() => cavs.ExportParameters(true));
}
}

private static void VerifyNamedCurve(ECParameters parameters, ECDsa ec, int keySize, bool includePrivate)
{
parameters.Validate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,17 @@ extern "C" int32_t CryptoNative_GetECKeyParameters(

if (includePrivate)
{
*d = const_cast<BIGNUM*>(EC_KEY_get0_private_key(key));
*cbD = BN_num_bytes(*d);
const BIGNUM* const_bignum_privateKey = EC_KEY_get0_private_key(key);
if (const_bignum_privateKey != nullptr)
{
*d = const_cast<BIGNUM*>(const_bignum_privateKey);
*cbD = BN_num_bytes(*d);
}
else
{
rc = -1;
goto error;
}
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)\.., dir.props))\dir.props" />

<PropertyGroup>
<PackageVersion>4.3.2</PackageVersion>
<PackageVersion>4.3.3</PackageVersion>
</PropertyGroup>
</Project>
3 changes: 2 additions & 1 deletion src/System.Security.Cryptography.Algorithms/dir.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.1.1</AssemblyVersion>
<PackageVersion>4.3.1</PackageVersion>
</PropertyGroup>
</Project>

Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<SkipGenerationCheck>true</SkipGenerationCheck>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ref\4.0\System.Security.Cryptography.Algorithms.depproj">
<SupportedFramework>net46</SupportedFramework>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<AssemblyName>System.Security.Cryptography.Algorithms</AssemblyName>
<AssemblyVersion Condition="'$(TargetGroup)'=='net46'">4.0.0.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)'=='net461' or '$(TargetGroup)' == 'netcore50'">4.1.0.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)'=='net463'">4.2.1.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>INTERNAL_ASYMMETRIC_IMPLEMENTATIONS</DefineConstants>
<ContractProject Condition="'$(AssemblyVersion)' == '4.0.0.0'">..\ref\4.0\System.Security.Cryptography.Algorithms.depproj</ContractProject>
Expand Down
3 changes: 2 additions & 1 deletion src/System.Security.Cryptography.OpenSsl/dir.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.0.1.1</AssemblyVersion>
<PackageVersion>4.3.1</PackageVersion>
</PropertyGroup>
</Project>

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />

<ItemGroup>
<ProjectReference Include="..\ref\System.Security.Cryptography.OpenSsl.csproj">
<SupportedFramework>net463;netcoreapp1.0;$(AllXamarinFrameworks)</SupportedFramework>
Expand Down
13 changes: 13 additions & 0 deletions src/packages.builds
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,26 @@
<AdditionalProperties>$(AdditionalProperties)</AdditionalProperties>
</Project>
<!-- add specific builds / pkgproj's here to include in servicing builds -->
<Project Include="..\pkg\Microsoft.NETCore.Targets\Microsoft.NETCore.Targets.builds">
<AdditionalProperties>$(AdditionalProperties)</AdditionalProperties>
</Project>
<Project Include="System.Security.Cryptography.Algorithms\pkg\System.Security.Cryptography.Algorithms.builds">
<AdditionalProperties>$(AdditionalProperties)</AdditionalProperties>
</Project>
<Project Include="System.Security.Cryptography.OpenSsl\pkg\System.Security.Cryptography.OpenSsl.builds">
<AdditionalProperties>$(AdditionalProperties)</AdditionalProperties>
</Project>
<Project Include="System.Security.Cryptography.X509Certificates\pkg\System.Security.Cryptography.X509Certificates.builds">
<AdditionalProperties>$(AdditionalProperties)</AdditionalProperties>
</Project>
</ItemGroup>

<ItemGroup Condition="'$(BuildAllPackages)' == 'false' AND '$(SkipNativePackageBuild)' != 'true'" >
<!-- add specific native builds / pkgproj's here to include in servicing builds -->
<Project Include="Native\pkg\runtime.native.System.Security.Cryptography\runtime.native.System.Security.Cryptography.builds">
<AdditionalProperties>$(AdditionalProperties);SkipCreatePackageOnMissingFiles=true</AdditionalProperties>
<BuildAllOSGroups>$(BuildAllOSGroups)</BuildAllOSGroups>
</Project>
</ItemGroup>

<UsingTask TaskName="GenerateNetStandardSupportTable" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll" />
Expand Down

0 comments on commit 0ceb8c2

Please sign in to comment.