Skip to content

Commit

Permalink
Merge pull request dotnet#1 from pgavlin/sn2
Browse files Browse the repository at this point in the history
Merge corefx/master into sn2.
  • Loading branch information
CIPop committed Aug 3, 2015
2 parents f81e410 + bc80ece commit 18ef2b4
Show file tree
Hide file tree
Showing 427 changed files with 57,900 additions and 36,039 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ More libraries are coming soon (the overall list of items we currently plan to m
|<sub>**System.Linq.Queryable**<br/>[![MyGet Package](https://img.shields.io/myget/dotnet-core/v/System.Linq.Queryable.svg)](https://www.myget.org/gallery/dotnet-core)</sub>|<sub>Provides LINQ standard query operators that operate on objects that implement ```IQueryable<T>```.</sub>|
|<sub>**System.Net.Http**<br/>[![MyGet Package](https://img.shields.io/myget/dotnet-core/v/System.Net.Http.svg)](https://www.myget.org/gallery/dotnet-core)</sub>|<sub>Provides a programming interface for modern HTTP applications, including HTTP client components that allow applications to consume web services over HTTP and HTTP components that can be used by both clients and servers for parsing HTTP headers.</sub>|
|<sub>**System.Net.Http.WinHttpHandler**<br/>[![MyGet Package](https://img.shields.io/myget/dotnet-core/v/System.Net.Http.WinHttpHandler.svg)](https://www.myget.org/gallery/dotnet-core)</sub>|<sub>Provides a message handler for HttpClient based on the WinHTTP interface of Windows. While similar to HttpClientHandler, it provides developers more granular control over the application's HTTP communication than the HttpClientHandler.</sub>|
|<sub>**System.Net.Primitives**<br/>[![MyGet Package](https://img.shields.io/myget/dotnet-core/v/System.Net.Primitives.svg)](https://www.myget.org/gallery/dotnet-core)</sub>|<sub>Provides common types for network-based libraries, including System.Net.IPAddress, System.Net.IPEndPoint, and System.Net.CookieContainer.</sub>|
|<sub>**System.Net.Requests**<br/>[![MyGet Package](https://img.shields.io/myget/dotnet-core/v/System.Net.Requests.svg)](https://www.myget.org/gallery/dotnet-core)</sub>|<sub>Provides older classes (such as HttpWebRequest and HttpWebResponse) for sending HTTP requests and receiving HTTP responses from a resource identified by a URI. _This library is available primarily for compatibility; developers should prefer the classes in the System.Net.Http package._</sub>|
|<sub>**System.Net.WebHeaderCollection**<br/>[![MyGet Package](https://img.shields.io/myget/dotnet-core/v/System.Net.WebHeaderCollection.svg)](https://www.myget.org/gallery/dotnet-core)</sub>|<sub>Contains types that represent HTTP request and response headers. This library is used with classes such as System.Net.HttpWebRequest and System.Net.HttpWebResponse and allows developers to query/edit header names/values.</sub>|
|<sub>**System.Net.WebSockets**<br/>[![MyGet Package](https://img.shields.io/myget/dotnet-core/v/System.Net.WebSockets.svg)](https://www.myget.org/gallery/dotnet-core)</sub>|<sub>Provides the System.Net.WebSockets.WebSocket abstract class and related types to allow developers to implement the WebSocket protocol (RFC 6455). WebSockets provide full-duplex communication over a single TCP connection.</sub>|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,21 @@ internal static partial class NativeCrypto
{
private delegate int NegativeSizeReadMethod<in THandle>(THandle handle, byte[] buf, int cBuf);

[DllImport(Libraries.CryptoInterop)]
internal static extern int BioTell(SafeBioHandle bio);

[DllImport(Libraries.CryptoInterop)]
internal static extern int BioSeek(SafeBioHandle bio, int pos);

[DllImport(Libraries.CryptoInterop)]
private static extern int GetX509Thumbprint(SafeX509Handle x509, byte[] buf, int cBuf);

[DllImport(Libraries.CryptoInterop)]
private static extern int GetX509NameRawBytes(IntPtr x509Name, byte[] buf, int cBuf);

[DllImport(Libraries.CryptoInterop)]
internal static extern SafeX509Handle ReadX509AsDerFromBio(SafeBioHandle bio);

[DllImport(Libraries.CryptoInterop)]
internal static extern IntPtr GetX509NotBefore(SafeX509Handle x509);

Expand Down
3 changes: 3 additions & 0 deletions src/Common/src/Interop/Unix/libcrypto/Interop.BIO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ internal static partial class libcrypto
[DllImport(Libraries.LibCrypto)]
internal static extern SafeBioHandle BIO_new(IntPtr type);

[DllImport(Libraries.LibCrypto)]
internal static extern SafeBioHandle BIO_new_file(string filename, string mode);

[DllImport(Libraries.LibCrypto)]
internal static extern IntPtr BIO_s_mem();

Expand Down
15 changes: 15 additions & 0 deletions src/Common/src/Interop/Unix/libcrypto/Interop.EvpPkey.Rsa.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Runtime.InteropServices;

using Microsoft.Win32.SafeHandles;

internal static partial class Interop
{
internal static partial class libcrypto
{
[DllImport(Libraries.LibCrypto)]
internal static extern SafeRsaHandle EVP_PKEY_get1_RSA(SafeEvpPkeyHandle pkey);
}
}
14 changes: 14 additions & 0 deletions src/Common/src/Interop/Unix/libcrypto/Interop.EvpPkey.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Runtime.InteropServices;

internal static partial class Interop
{
internal static partial class libcrypto
{
[DllImport(Libraries.LibCrypto)]
internal static extern void EVP_PKEY_free(IntPtr pkey);
}
}
26 changes: 26 additions & 0 deletions src/Common/src/Interop/Unix/libcrypto/Interop.Pkcs12.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Runtime.InteropServices;

using Microsoft.Win32.SafeHandles;

internal static partial class Interop
{
internal static partial class libcrypto
{
[DllImport(Libraries.LibCrypto)]
internal static unsafe extern SafePkcs12Handle d2i_PKCS12(IntPtr zero, byte** ppin, int len);

[DllImport(Libraries.LibCrypto)]
internal static extern SafePkcs12Handle d2i_PKCS12_bio(SafeBioHandle bio, IntPtr zero);

[DllImport(Libraries.LibCrypto)]
internal static extern void PKCS12_free(IntPtr p12);

[DllImport(Libraries.CryptoInterop, CharSet = CharSet.Ansi)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool PKCS12_parse(SafePkcs12Handle p12, string pass, out SafeEvpPkeyHandle pkey, out SafeX509Handle cert, out SafeX509StackHandle ca);
}
}
4 changes: 4 additions & 0 deletions src/Common/src/Interop/Unix/libcrypto/Interop.Rsa.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ internal static partial class libcrypto
[DllImport(Libraries.LibCrypto)]
internal static unsafe extern SafeRsaHandle d2i_RSAPublicKey(IntPtr zero, byte** ppin, int len);

[DllImport(Libraries.LibCrypto)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool RSA_up_ref(IntPtr rsa);

[DllImport(Libraries.LibCrypto)]
internal static extern void RSA_free(IntPtr rsa);

Expand Down
7 changes: 5 additions & 2 deletions src/Common/src/Interop/Unix/libcrypto/Interop.d2i.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal static partial class libcrypto

internal unsafe delegate int I2DFunc<in THandle>(THandle handle, byte** @out);

internal static unsafe THandle OpenSslD2I<THandle>(D2IFunc<THandle> d2i, byte[] data)
internal static unsafe THandle OpenSslD2I<THandle>(D2IFunc<THandle> d2i, byte[] data, bool checkHandle=true)
where THandle : SafeHandle
{
// The OpenSSL d2i_* functions are set up for cascaded calls, so they increment *ppData while reading.
Expand All @@ -27,7 +27,10 @@ internal static unsafe THandle OpenSslD2I<THandle>(D2IFunc<THandle> d2i, byte[]

THandle handle = d2i(IntPtr.Zero, ppData, data.Length);

CheckValidOpenSslHandle(handle);
if (checkHandle)
{
CheckValidOpenSslHandle(handle);
}

return handle;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Runtime.InteropServices;

namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeEvpPkeyHandle : SafeHandle
{
private SafeEvpPkeyHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}

protected override bool ReleaseHandle()
{
Interop.libcrypto.EVP_PKEY_free(handle);
SetHandle(IntPtr.Zero);
return true;
}

public override bool IsInvalid
{
get { return handle == IntPtr.Zero; }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Runtime.InteropServices;

namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafePkcs12Handle : SafeHandle
{
private SafePkcs12Handle() :
base(IntPtr.Zero, ownsHandle: true)
{
}

protected override bool ReleaseHandle()
{
Interop.libcrypto.PKCS12_free(handle);
SetHandle(IntPtr.Zero);
return true;
}

public override bool IsInvalid
{
get { return handle == IntPtr.Zero; }
}
}
}
18 changes: 18 additions & 0 deletions src/Common/src/Microsoft/Win32/SafeHandles/SafeRsaHandle.Unix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Diagnostics;
using System.Security;
using System.Runtime.InteropServices;

Expand All @@ -26,5 +27,22 @@ public override bool IsInvalid
{
get { return handle == IntPtr.Zero; }
}

internal static SafeRsaHandle DuplicateHandle(IntPtr handle)
{
Debug.Assert(handle != IntPtr.Zero);

// Reliability: Allocate the SafeHandle before calling RSA_up_ref so
// that we don't lose a tracked reference in low-memory situations.
SafeRsaHandle safeHandle = new SafeRsaHandle();

if (!Interop.libcrypto.RSA_up_ref(handle))
{
throw Interop.libcrypto.CreateOpenSslCryptographicException();
}

safeHandle.SetHandle(handle);
return safeHandle;
}
}
}
4 changes: 2 additions & 2 deletions src/Common/tests/SystemXml/BaseLibManaged/project.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"dependencies": {
"System.Runtime": "4.0.20-beta-*",
"System.Runtime.Extensions": "4.0.10-beta-*"
"System.Runtime": "4.0.20",
"System.Runtime.Extensions": "4.0.10"
},
"frameworks": {
"dnxcore50": {}
Expand Down
54 changes: 35 additions & 19 deletions src/Common/tests/SystemXml/BaseLibManaged/project.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"version": -9996,
"targets": {
"DNXCore,Version=v5.0": {
"System.Private.Uri/4.0.0-beta-23024": {
"System.Private.Uri/4.0.0": {
"runtime": {
"lib/DNXCore50/System.Private.Uri.dll": {}
}
},
"System.Runtime/4.0.20-beta-23024": {
"System.Runtime/4.0.20": {
"dependencies": {
"System.Private.Uri": "4.0.0-beta-23024"
"System.Private.Uri": "4.0.0"
},
"compile": {
"ref/dotnet/System.Runtime.dll": {}
Expand All @@ -19,9 +19,9 @@
"lib/DNXCore50/System.Runtime.dll": {}
}
},
"System.Runtime.Extensions/4.0.10-beta-23024": {
"System.Runtime.Extensions/4.0.10": {
"dependencies": {
"System.Runtime": "4.0.20-beta-23024"
"System.Runtime": "4.0.20"
},
"compile": {
"ref/dotnet/System.Runtime.Extensions.dll": {}
Expand All @@ -33,12 +33,12 @@
}
},
"libraries": {
"System.Private.Uri/4.0.0-beta-23024": {
"System.Private.Uri/4.0.0": {
"serviceable": true,
"sha512": "SJbplxSAYqzECE4GzsXfkES5vug34KI34ERs2ySNAfuVcEbtto0YieQQqLQERzYINfbFVbOPbV4yN3VTzjW0DQ==",
"sha512": "CtuxaCKcRIvPcsqquVl3mPp79EDZPMr2UogfiFCxCs+t2z1VjbpQsKNs1GHZ8VQetqbk1mr0V1yAfMe6y8CHDA==",
"files": [
"System.Private.Uri.4.0.0-beta-23024.nupkg",
"System.Private.Uri.4.0.0-beta-23024.nupkg.sha512",
"System.Private.Uri.4.0.0.nupkg",
"System.Private.Uri.4.0.0.nupkg.sha512",
"System.Private.Uri.nuspec",
"lib/DNXCore50/System.Private.Uri.dll",
"lib/netcore50/System.Private.Uri.dll",
Expand All @@ -47,16 +47,20 @@
"runtimes/win8-aot/lib/netcore50/System.Private.Uri.dll"
]
},
"System.Runtime/4.0.20-beta-23024": {
"System.Runtime/4.0.20": {
"serviceable": true,
"sha512": "vacwPrf5OZcHwSL58Vdoq/vqqMrz1xbHXdZiSA5cHBCIVmo5bD9Gw+Qu4NgGekCxV3fgKs9Qq97oibezsZZ+8w==",
"sha512": "X7N/9Bz7jVPorqdVFO86ns1sX6MlQM+WTxELtx+Z4VG45x9+LKmWH0GRqjgKprUnVuwmfB9EJ9DQng14Z7/zwg==",
"files": [
"System.Runtime.4.0.20-beta-23024.nupkg",
"System.Runtime.4.0.20-beta-23024.nupkg.sha512",
"System.Runtime.4.0.20.nupkg",
"System.Runtime.4.0.20.nupkg.sha512",
"System.Runtime.nuspec",
"lib/DNXCore50/System.Runtime.dll",
"lib/MonoAndroid10/_._",
"lib/MonoTouch10/_._",
"lib/net46/_._",
"lib/netcore50/System.Runtime.dll",
"lib/xamarinios10/_._",
"lib/xamarinmac20/_._",
"ref/dotnet/System.Runtime.dll",
"ref/dotnet/System.Runtime.xml",
"ref/dotnet/de/System.Runtime.xml",
Expand All @@ -68,20 +72,28 @@
"ref/dotnet/ru/System.Runtime.xml",
"ref/dotnet/zh-hans/System.Runtime.xml",
"ref/dotnet/zh-hant/System.Runtime.xml",
"ref/MonoAndroid10/_._",
"ref/MonoTouch10/_._",
"ref/net46/_._",
"ref/xamarinios10/_._",
"ref/xamarinmac20/_._",
"runtimes/win8-aot/lib/netcore50/System.Runtime.dll"
]
},
"System.Runtime.Extensions/4.0.10-beta-23024": {
"System.Runtime.Extensions/4.0.10": {
"serviceable": true,
"sha512": "Cj6RMtpMINFjTBHeClYAWk3SvDTdmo6c3rHIGwzn0R0P5B7wt0YclQibiZnjRzN/00XQ44067E6ZvRU/Z6AWgA==",
"sha512": "5dsEwf3Iml7d5OZeT20iyOjT+r+okWpN7xI2v+R4cgd3WSj4DeRPTvPFjDpacbVW4skCAZ8B9hxXJYgkCFKJ1A==",
"files": [
"System.Runtime.Extensions.4.0.10-beta-23024.nupkg",
"System.Runtime.Extensions.4.0.10-beta-23024.nupkg.sha512",
"System.Runtime.Extensions.4.0.10.nupkg",
"System.Runtime.Extensions.4.0.10.nupkg.sha512",
"System.Runtime.Extensions.nuspec",
"lib/DNXCore50/System.Runtime.Extensions.dll",
"lib/MonoAndroid10/_._",
"lib/MonoTouch10/_._",
"lib/net46/_._",
"lib/netcore50/System.Runtime.Extensions.dll",
"lib/xamarinios10/_._",
"lib/xamarinmac20/_._",
"ref/dotnet/System.Runtime.Extensions.dll",
"ref/dotnet/System.Runtime.Extensions.xml",
"ref/dotnet/de/System.Runtime.Extensions.xml",
Expand All @@ -93,15 +105,19 @@
"ref/dotnet/ru/System.Runtime.Extensions.xml",
"ref/dotnet/zh-hans/System.Runtime.Extensions.xml",
"ref/dotnet/zh-hant/System.Runtime.Extensions.xml",
"ref/MonoAndroid10/_._",
"ref/MonoTouch10/_._",
"ref/net46/_._",
"ref/xamarinios10/_._",
"ref/xamarinmac20/_._",
"runtimes/win8-aot/lib/netcore50/System.Runtime.Extensions.dll"
]
}
},
"projectFileDependencyGroups": {
"": [
"System.Runtime >= 4.0.20-beta-*",
"System.Runtime.Extensions >= 4.0.10-beta-*"
"System.Runtime >= 4.0.20",
"System.Runtime.Extensions >= 4.0.10"
],
"DNXCore,Version=v5.0": []
}
Expand Down
14 changes: 7 additions & 7 deletions src/Common/tests/SystemXml/ModuleCore/project.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"dependencies": {
"System.Runtime": "4.0.20-beta-*",
"System.Runtime.Extensions": "4.0.10-beta-*",
"System.Collections": "4.0.10-beta-*",
"System.Xml.ReaderWriter": "4.0.10-beta-*",
"System.Text.Encoding": "4.0.10-beta-*",
"System.IO": "4.0.10-beta-*",
"System.Runtime": "4.0.20",
"System.Runtime.Extensions": "4.0.10",
"System.Collections": "4.0.10",
"System.Xml.ReaderWriter": "4.0.10",
"System.Text.Encoding": "4.0.10",
"System.IO": "4.0.10",
"System.Console": "4.0.0-beta-*",
"System.Diagnostics.Debug": "4.0.10-beta-*"
"System.Diagnostics.Debug": "4.0.10"
},
"frameworks": {
"dnxcore50": {}
Expand Down
Loading

0 comments on commit 18ef2b4

Please sign in to comment.