From 5f0704ce372a1dcd575538351a0ce0c0b229f57e Mon Sep 17 00:00:00 2001 From: monojenkins Date: Mon, 30 Dec 2019 15:54:37 +0100 Subject: [PATCH 01/10] [eglib] Don't define _FORTIFY_SOURCE on Cygwin builds (#18312) See https://github.com/msys2/MINGW-packages/issues/5803 Without -lssp (or -fstack-protector), -D_FORTIFY_SOURCE=2 leads to linker errors. --- mono/eglib/Makefile.am | 6 +++++- mono/eglib/test/Makefile.am | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mono/eglib/Makefile.am b/mono/eglib/Makefile.am index 0c5132c6338f..1cfc667ce086 100644 --- a/mono/eglib/Makefile.am +++ b/mono/eglib/Makefile.am @@ -63,7 +63,11 @@ if !ENABLE_MSVC_ONLY eglibdir=$(datadir)/mono-$(API_VER)/mono/eglib eglib_DATA = eglib-config.h -libeglib_la_CFLAGS = -g -Wall -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE +libeglib_la_CFLAGS = -g -Wall -D_GNU_SOURCE + +if !HOST_WIN32 +libeglib_la_CFLAGS += -D_FORTIFY_SOURCE=2 +endif AM_CPPFLAGS = -I$(srcdir) diff --git a/mono/eglib/test/Makefile.am b/mono/eglib/test/Makefile.am index 68b68d66a42f..9e4efb351851 100644 --- a/mono/eglib/test/Makefile.am +++ b/mono/eglib/test/Makefile.am @@ -34,7 +34,10 @@ SOURCES = \ test_eglib_SOURCES = $(SOURCES) -GLIB_TEST_FLAGS_COMMON = -Wall -DEGLIB_TESTS=1 -D_FORTIFY_SOURCE=2 -I$(srcdir)/.. -I.. -DDRIVER_NAME=\"EGlib\" +GLIB_TEST_FLAGS_COMMON = -Wall -DEGLIB_TESTS=1 -I$(srcdir)/.. -I.. -DDRIVER_NAME=\"EGlib\" +if !HOST_WIN32 +GLIB_TEST_FLAGS_COMMON += -D_FORTIFY_SOURCE=2 +endif CFLAGS += $(GLIB_TEST_FLAGS_COMMON) CXXFLAGS += $(GLIB_TEST_FLAGS_COMMON) @CXXFLAGS_COMMON@ From 99e3aed6ec366383372f75af07994162f247d9ff Mon Sep 17 00:00:00 2001 From: monojenkins Date: Wed, 1 Jan 2020 23:32:16 +0100 Subject: [PATCH 02/10] Socket.BeginMConnect() should not attempt connections on unsupported address families. (#18321) Fixes #16513. Co-authored-by: Martin Baulig --- mcs/class/System/System.Net.Sockets/Socket.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mcs/class/System/System.Net.Sockets/Socket.cs b/mcs/class/System/System.Net.Sockets/Socket.cs index 985075412fc2..b52f42dc9650 100644 --- a/mcs/class/System/System.Net.Sockets/Socket.cs +++ b/mcs/class/System/System.Net.Sockets/Socket.cs @@ -1083,6 +1083,9 @@ static bool BeginMConnect (SocketAsyncResult sockares) sockares.CurrentAddress++; sockares.EndPoint = new IPEndPoint (sockares.Addresses [i], sockares.Port); + if (!sockares.socket.CanTryAddressFamily(sockares.EndPoint.AddressFamily)) + continue; + return BeginSConnect (sockares); } catch (Exception e) { exc = e; From 2faea92a92469322e29edc8f0fdeac24bd316fd0 Mon Sep 17 00:00:00 2001 From: monojenkins Date: Mon, 6 Jan 2020 22:03:08 +0100 Subject: [PATCH 03/10] [2019-10] [metadata] Size 0 Blob heap is ok when resolving assembly refs (#18338) * [metadata] Size 0 Blob heap is ok when resolving assembly refs Sometimes ILasm can produce images with a Blob heap of size 0. In cases where we're loading assembly references from such an image, the hash (which is optional) can be at index = 0 and the Blob heap size is also 0. Also: add the hash value to the output of `monodis --assemblyref` * [metadata] Add a separate assertion for the index == size == 0 case And a comment explaining how it is likely to be triggered. If the assembly is reasonable the caller of mono_metadata_blob_heap should be updated to use mono_metadata_blob_heap_null_ok instead * [bcl] Allow Mono's ILASM to produce a size 0 Blob heap ECMA 335 II.24.2.4 says that the user string and blob heaps should have an entry at index 0 consisting of the single byte 0. However .NET Framework (and .NET Core) ilasm will entirely omit the Blob heap (that is, create a blob heap entry of size 0) if it is not needed. This PR changes Mono's ILASM to emit the initial byte on demand only if one of the MetaDataStream.Add() methods is called. Otherwise we will also emit a stream of size 0. This is needed to compile some test cases. * [tests] Add regression test for loading assemblies with size 0 Blob heap Depends on ILASM that can emit a size 0 Blob heap --- mcs/class/PEAPI/Metadata.cs | 27 +++++++++++++-- mono/dis/dump.c | 19 +++++++++-- mono/metadata/assembly.c | 46 +++++++++++++++++++++----- mono/metadata/metadata-internals.h | 2 ++ mono/metadata/metadata.c | 25 +++++++++++++- mono/tests/Makefile.am | 11 ++++++ mono/tests/null-blob-main.cs | 19 +++++++++++ mono/tests/null-blob-null-blob-assm.il | 11 ++++++ mono/tests/null-blob-ref.il | 46 ++++++++++++++++++++++++++ mono/tests/null-blob-tgt.cs | 3 ++ 10 files changed, 195 insertions(+), 14 deletions(-) create mode 100644 mono/tests/null-blob-main.cs create mode 100644 mono/tests/null-blob-null-blob-assm.il create mode 100644 mono/tests/null-blob-ref.il create mode 100644 mono/tests/null-blob-tgt.cs diff --git a/mcs/class/PEAPI/Metadata.cs b/mcs/class/PEAPI/Metadata.cs index 222ece4633ae..98e81a42aeda 100644 --- a/mcs/class/PEAPI/Metadata.cs +++ b/mcs/class/PEAPI/Metadata.cs @@ -5658,21 +5658,30 @@ internal class MetaDataStream : BinaryWriter { char[] name; Hashtable htable = new Hashtable(); Hashtable btable = new Hashtable (new ByteArrayHashCodeProvider (), new ByteArrayComparer ()); + bool addInitByte = false; + bool initByteAdded = false; internal MetaDataStream(char[] name, bool addInitByte) : base(new MemoryStream()) { - if (addInitByte) { Write((byte)0); size = 1; } + this.addInitByte = addInitByte; this.name = name; sizeOfHeader = StreamHeaderSize + (uint)name.Length; } internal MetaDataStream(char[] name, System.Text.Encoding enc, bool addInitByte) : base(new MemoryStream(),enc) { - if (addInitByte) { Write((byte)0); size = 1; } + this.addInitByte = addInitByte; this.name = name; sizeOfHeader = StreamHeaderSize + (uint)name.Length; } + void AddInitByte () { + if (addInitByte && !initByteAdded) { + Write((byte)0); + size += 1; + initByteAdded = true; + } + } public uint Start { get { return start; } set { start = value; } @@ -5706,6 +5715,7 @@ internal void WriteDetails() internal uint Add(string str, bool prependSize) { + AddInitByte (); Object val = htable[str]; uint index = 0; if (val == null) { @@ -5723,6 +5733,7 @@ internal uint Add(string str, bool prependSize) } internal uint Add (byte[] str, bool prependSize) { + AddInitByte (); Object val = btable [str]; uint index = 0; if (val == null) { @@ -5740,6 +5751,7 @@ internal uint Add (byte[] str, bool prependSize) internal uint Add(Guid guid, bool prependSize) { + AddInitByte (); byte [] b = guid.ToByteArray (); if (prependSize) CompressNum ((uint) b.Length); Write(guid.ToByteArray()); @@ -5749,6 +5761,7 @@ internal uint Add(Guid guid, bool prependSize) internal uint Add(byte[] blob) { + AddInitByte (); uint ix = size; CompressNum((uint)blob.Length); Write(blob); @@ -5758,6 +5771,7 @@ internal uint Add(byte[] blob) internal uint Add(byte val, bool prependSize) { + AddInitByte (); uint ix = size; if (prependSize) CompressNum (1); Write(val); @@ -5767,6 +5781,7 @@ internal uint Add(byte val, bool prependSize) internal uint Add(sbyte val, bool prependSize) { + AddInitByte (); uint ix = size; if (prependSize) CompressNum (1); Write(val); @@ -5776,6 +5791,7 @@ internal uint Add(sbyte val, bool prependSize) internal uint Add(ushort val, bool prependSize) { + AddInitByte (); uint ix = size; if (prependSize) CompressNum (2); Write(val); @@ -5785,6 +5801,7 @@ internal uint Add(ushort val, bool prependSize) internal uint Add(short val, bool prependSize) { + AddInitByte (); uint ix = size; if (prependSize) CompressNum (2); Write(val); @@ -5794,6 +5811,7 @@ internal uint Add(short val, bool prependSize) internal uint Add(uint val, bool prependSize) { + AddInitByte (); uint ix = size; if (prependSize) CompressNum (4); Write(val); @@ -5803,6 +5821,7 @@ internal uint Add(uint val, bool prependSize) internal uint Add(int val, bool prependSize) { + AddInitByte (); uint ix = size; if (prependSize) CompressNum (4); Write (val); @@ -5812,6 +5831,7 @@ internal uint Add(int val, bool prependSize) internal uint Add(ulong val, bool prependSize) { + AddInitByte (); uint ix = size; if (prependSize) CompressNum (8); Write(val); @@ -5821,6 +5841,7 @@ internal uint Add(ulong val, bool prependSize) internal uint Add(long val, bool prependSize) { + AddInitByte (); uint ix = size; if (prependSize) CompressNum (8); Write(val); @@ -5830,6 +5851,7 @@ internal uint Add(long val, bool prependSize) internal uint Add(float val, bool prependSize) { + AddInitByte (); uint ix = size; if (prependSize) CompressNum (4); Write(val); @@ -5839,6 +5861,7 @@ internal uint Add(float val, bool prependSize) internal uint Add(double val, bool prependSize) { + AddInitByte (); uint ix = size; if (prependSize) CompressNum (8); Write(val); diff --git a/mono/dis/dump.c b/mono/dis/dump.c index 5d652d07e269..4160e7733d4c 100755 --- a/mono/dis/dump.c +++ b/mono/dis/dump.c @@ -137,15 +137,28 @@ dump_table_assemblyref (MonoImage *m) cols [MONO_ASSEMBLYREF_REV_NUMBER], mono_metadata_string_heap (m, cols [MONO_ASSEMBLYREF_NAME])); fprintf (output, "\tFlags=0x%08x\n", cols [MONO_ASSEMBLYREF_FLAGS]); - ptr = mono_metadata_blob_heap (m, cols [MONO_ASSEMBLYREF_PUBLIC_KEY]); - len = mono_metadata_decode_value (ptr, &ptr); + ptr = mono_metadata_blob_heap_null_ok (m, cols [MONO_ASSEMBLYREF_PUBLIC_KEY]); + if (ptr) + len = mono_metadata_decode_value (ptr, &ptr); + else + len = 0; if (len > 0){ fprintf (output, "\tPublic Key:"); hex_dump (ptr, 0, len); fprintf (output, "\n"); } else fprintf (output, "\tZero sized public key\n"); - + ptr = mono_metadata_blob_heap_null_ok (m, cols [MONO_ASSEMBLYREF_HASH_VALUE]); + if (ptr) + len = mono_metadata_decode_value (ptr, &ptr); + else + len = 0; + if (len > 0) { + fprintf (output, "\tHash:"); + hex_dump (ptr, 0, len); + fprintf (output, "\n"); + } else + fprintf (output, "\tZero sized hash value\n"); } fprintf (output, "\n"); } diff --git a/mono/metadata/assembly.c b/mono/metadata/assembly.c index fc7656937a99..febd22b26a95 100644 --- a/mono/metadata/assembly.c +++ b/mono/metadata/assembly.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -1269,6 +1270,10 @@ assemblyref_public_tok_checked (MonoImage *image, guint32 key_index, guint32 fla public_tok = mono_metadata_blob_heap_checked (image, key_index, error); return_val_if_nok (error, NULL); + if (!public_tok) { + mono_error_set_bad_image (error, image, "expected public key token (index = %d) in assembly reference, but the Blob heap is NULL", key_index); + return NULL; + } len = mono_metadata_decode_blob_size (public_tok, &public_tok); if (flags & ASSEMBLYREF_FULL_PUBLIC_KEY_FLAG) { @@ -1478,10 +1483,18 @@ mono_assembly_get_assemblyref (MonoImage *image, int index, MonoAssemblyName *an t = &image->tables [MONO_TABLE_ASSEMBLYREF]; mono_metadata_decode_row (t, index, cols, MONO_ASSEMBLYREF_SIZE); - - hash = mono_metadata_blob_heap (image, cols [MONO_ASSEMBLYREF_HASH_VALUE]); - aname->hash_len = mono_metadata_decode_blob_size (hash, &hash); - aname->hash_value = hash; + + // ECMA-335: II.22.5 - AssemblyRef + // HashValue can be null or non-null. If non-null it's an index into the blob heap + // Sometimes ILasm can create an image without a Blob heap. + hash = mono_metadata_blob_heap_null_ok (image, cols [MONO_ASSEMBLYREF_HASH_VALUE]); + if (hash) { + aname->hash_len = mono_metadata_decode_blob_size (hash, &hash); + aname->hash_value = hash; + } else { + aname->hash_len = 0; + aname->hash_value = NULL; + } aname->name = mono_metadata_string_heap (image, cols [MONO_ASSEMBLYREF_NAME]); aname->culture = mono_metadata_string_heap (image, cols [MONO_ASSEMBLYREF_CULTURE]); aname->flags = cols [MONO_ASSEMBLYREF_FLAGS]; @@ -1697,7 +1710,7 @@ netcore_load_reference (MonoAssemblyName *aname, MonoAssemblyLoadContext *alc, M #endif /* ENABLE_NETCORE */ /** - * mono_assembly_get_assemblyref: + * mono_assembly_get_assemblyref_checked: * \param image pointer to the \c MonoImage to extract the information from. * \param index index to the assembly reference in the image. * \param aname pointer to a \c MonoAssemblyName that will hold the returned value. @@ -1719,10 +1732,18 @@ mono_assembly_get_assemblyref_checked (MonoImage *image, int index, MonoAssembly if (!mono_metadata_decode_row_checked (image, t, index, cols, MONO_ASSEMBLYREF_SIZE, error)) return FALSE; + // ECMA-335: II.22.5 - AssemblyRef + // HashValue can be null or non-null. If non-null it's an index into the blob heap + // Sometimes ILasm can create an image without a Blob heap. hash = mono_metadata_blob_heap_checked (image, cols [MONO_ASSEMBLYREF_HASH_VALUE], error); return_val_if_nok (error, FALSE); - aname->hash_len = mono_metadata_decode_blob_size (hash, &hash); - aname->hash_value = hash; + if (hash) { + aname->hash_len = mono_metadata_decode_blob_size (hash, &hash); + aname->hash_value = hash; + } else { + aname->hash_len = 0; + aname->hash_value = NULL; + } aname->name = mono_metadata_string_heap_checked (image, cols [MONO_ASSEMBLYREF_NAME], error); return_val_if_nok (error, FALSE); aname->culture = mono_metadata_string_heap_checked (image, cols [MONO_ASSEMBLYREF_CULTURE], error); @@ -1769,7 +1790,15 @@ mono_assembly_load_reference (MonoImage *image, int index) if (reference) return; - mono_assembly_get_assemblyref (image, index, &aname); + mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Requesting loading reference %d (of %d) of %s", index, image->nreferences, image->name); + + ERROR_DECL (local_error); + mono_assembly_get_assemblyref_checked (image, index, &aname, local_error); + if (!is_ok (local_error)) { + mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_ASSEMBLY, "Decoding assembly reference %d (of %d) of %s failed due to: %s", index, image->nreferences, image->name, mono_error_get_message (local_error)); + mono_error_cleanup (local_error); + goto commit_reference; + } if (image->assembly) { if (mono_trace_is_traced (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY)) { @@ -1839,6 +1868,7 @@ mono_assembly_load_reference (MonoImage *image, int index) } +commit_reference: mono_assemblies_lock (); if (reference == NULL) { /* Flag as not found */ diff --git a/mono/metadata/metadata-internals.h b/mono/metadata/metadata-internals.h index b033439c436f..02a8027c4256 100644 --- a/mono/metadata/metadata-internals.h +++ b/mono/metadata/metadata-internals.h @@ -908,6 +908,8 @@ mono_image_load_metadata (MonoImage *image, MonoCLIImageInfo *iinfo); const char* mono_metadata_string_heap_checked (MonoImage *meta, uint32_t table_index, MonoError *error); +const char * +mono_metadata_blob_heap_null_ok (MonoImage *meta, guint32 index); const char* mono_metadata_blob_heap_checked (MonoImage *meta, uint32_t table_index, MonoError *error); gboolean diff --git a/mono/metadata/metadata.c b/mono/metadata/metadata.c index ecc4414cc92d..a596e6a97295 100644 --- a/mono/metadata/metadata.c +++ b/mono/metadata/metadata.c @@ -1078,22 +1078,45 @@ mono_metadata_user_string (MonoImage *meta, guint32 index) const char * mono_metadata_blob_heap (MonoImage *meta, guint32 index) { + /* Some tools can produce assemblies with a size 0 Blob stream. If a + * blob value is optional, if the index == 0 and heap_blob.size == 0 + * assertion is hit, consider updating caller to use + * mono_metadata_blob_heap_null_ok and handling a null return value. */ + g_assert (!(index == 0 && meta->heap_blob.size == 0)); g_assert (index < meta->heap_blob.size); - g_return_val_if_fail (index < meta->heap_blob.size, "");/*FIXME shouldn't we return NULL and check for index == 0?*/ return meta->heap_blob.data + index; } +/** + * mono_metadata_blob_heap_null_ok: + * \param meta metadata context + * \param index index into the blob. + * \return an in-memory pointer to the \p index in the Blob heap. + * If the Blob heap is empty or missing and index is 0 returns NULL, instead of asserting. + */ +const char * +mono_metadata_blob_heap_null_ok (MonoImage *meta, guint32 index) +{ + if (G_UNLIKELY (index == 0 && meta->heap_blob.size == 0)) + return NULL; + else + return mono_metadata_blob_heap (meta, index); +} + /** * mono_metadata_blob_heap_checked: * \param meta metadata context * \param index index into the blob. * \param error set on error * \returns an in-memory pointer to the \p index in the Blob heap. On failure sets \p error and returns NULL; + * If the Blob heap is empty or missing and \p index is 0 returns NULL, without setting error. * */ const char * mono_metadata_blob_heap_checked (MonoImage *meta, guint32 index, MonoError *error) { + if (G_UNLIKELY (index == 0 && meta->heap_blob.size == 0)) + return NULL; if (G_UNLIKELY (!(index < meta->heap_blob.size))) { mono_error_set_bad_image_by_name (error, meta->name ? meta->name : "unknown image", "blob heap index %u out of bounds %u", index, meta->heap_blob.size); return NULL; diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am index 046ae211c02e..d88fbff36179 100755 --- a/mono/tests/Makefile.am +++ b/mono/tests/Makefile.am @@ -722,6 +722,7 @@ TESTS_CS_SRC= \ bug-10837.cs \ bug-gh-9507.cs \ async-generic-enum.cs \ + null-blob-main.cs \ last-error.cs # some tests fail to compile on mcs @@ -3247,6 +3248,16 @@ EXTRA_DIST += internalsvisibleto-runtimetest.cs internalsvisibleto-compilertest. EXTRA_DIST += weakattribute.cs +EXTRA_DIST += null-blob-null-blob-assm.il null-blob-ref.il null-blob-tgt.cs + +null-blob-tgt.dll: null-blob-tgt.cs + $(MCS) -target:library -out:$@ $< + +null-blob-main.exe: null-blob-main.cs null-blob-tgt.dll null-blob-ref.dll null-blob-null-blob-assm.dll + $(MCS) -target:exe -out:$@ $< + +null-blob-main.exe$(PLATFORM_AOT_SUFFIX): null-blob-tgt.dll$(PLATFORM_AOT_SUFFIX) null-blob-ref.dll$(PLATFORM_AOT_SUFFIX) null-blob-null-blob-assm.dll$(PLATFORM_AOT_SUFFIX) + # Contains copies of types which don't exist in the desktop profile so tests can use them Mono.Runtime.Testing.dll: weakattribute.cs $(MCS) -target:library -out:$@ $< diff --git a/mono/tests/null-blob-main.cs b/mono/tests/null-blob-main.cs new file mode 100644 index 000000000000..202656a6bc9f --- /dev/null +++ b/mono/tests/null-blob-main.cs @@ -0,0 +1,19 @@ +using System; +using System.Reflection; + +public class M { + public static int Main () + { + var an = new AssemblyName ("null-blob-ref"); + var assm = Assembly.Load (an); + var t = assm.GetType ("C2"); + var o = Activator.CreateInstance (t); + var mi = t.GetMethod ("M1"); + // This method call to C2.M1 causes a load of null-blob-ref.dll + // which will forward to null-blob-null-blob-assm.dll which is + // an assembly with a size zero Blob stream. Loading + // null-blob-null-blob-assm.dll should not trigger a crash + mi.Invoke (o, new object[] { null } ); + return 0; + } +} diff --git a/mono/tests/null-blob-null-blob-assm.il b/mono/tests/null-blob-null-blob-assm.il new file mode 100644 index 000000000000..04cf6611749e --- /dev/null +++ b/mono/tests/null-blob-null-blob-assm.il @@ -0,0 +1,11 @@ +// This assembly compiles to a CIL image with a zero sized Blob stream +.assembly 'null-blob-null-blob-assm' +{ + .ver 0:0:0:0 +} +.assembly extern 'null-blob-tgt' { } +.class extern forwarder C1 +{ + .assembly extern 'null-blob-tgt' +} + diff --git a/mono/tests/null-blob-ref.il b/mono/tests/null-blob-ref.il new file mode 100644 index 000000000000..dff68b5d64e6 --- /dev/null +++ b/mono/tests/null-blob-ref.il @@ -0,0 +1,46 @@ +.assembly extern mscorlib +{ + .ver 4:0:0:0 + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. +} +.assembly extern 'null-blob-null-blob-assm' +{ + .ver 0:0:0:0 +} +.assembly 'null-blob-ref' +{ + .ver 0:0:0:0 +} +.module 'null-blob-ref.dll' + + + .class public auto ansi beforefieldinit C2 + extends [mscorlib]System.Object + { + + // method line 1 + .method public hidebysig + instance default void M1 (class ['null-blob-null-blob-assm']C1 c1) cil managed + { + // Method begins at RVA 0x2050 + // Code size 2 (0x2) + .maxstack 8 + IL_0000: nop + IL_0001: ret + } // end of method C2::M1 + + // method line 2 + .method public hidebysig specialname rtspecialname + instance default void '.ctor' () cil managed + { + // Method begins at RVA 0x2053 + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void object::'.ctor'() + IL_0006: nop + IL_0007: ret + } // end of method C2::.ctor + + } // end of class C2 + diff --git a/mono/tests/null-blob-tgt.cs b/mono/tests/null-blob-tgt.cs new file mode 100644 index 000000000000..d7a76edfddc7 --- /dev/null +++ b/mono/tests/null-blob-tgt.cs @@ -0,0 +1,3 @@ + +public class C1 { +} From df42020fe6f7a0a1b5fa59b481fb603d88d72348 Mon Sep 17 00:00:00 2001 From: Alexis Christoforides Date: Mon, 6 Jan 2020 14:05:42 -0700 Subject: [PATCH 04/10] [FileSystemWatcher] Fix wrong behaviour when move multiple files out of watched folder on mac (#41963) (#18224) Backport of https://github.com/dotnet/corefx/pull/41963 Fixes https://github.com/mono/mono/issues/16778 corefx PR: mono/corefx#385 --- external/corefx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/corefx b/external/corefx index 69b0cd9750ba..c7e51ee08356 160000 --- a/external/corefx +++ b/external/corefx @@ -1 +1 @@ -Subproject commit 69b0cd9750bab86053cce41a332d81e55374de15 +Subproject commit c7e51ee0835695ea93b26180d522febfb5b468da From 2bb369f036a6ead5531f5f2c189f1e02c1a9c4fe Mon Sep 17 00:00:00 2001 From: monojenkins Date: Tue, 7 Jan 2020 18:08:10 +0100 Subject: [PATCH 05/10] [2019-10] Add SignedCms to the TypeForwards in the System.Security.Cryptography.Pkcs facade (#18363) * Add SignedCms to the typeforwards in the System.Security.Cryptography.Pkcs facade * Added additional missing types from System.Security.Cryptography.Pkcs. * It would be nice if the files I added had namespaces ;-) * [csproj] Update project files * Bump API snapshot submodule --- external/api-snapshot | 2 +- .../TypeForwarders.cs | 23 ++- .../Pkcs12Builder.NotSupported.cs | 115 ++++++++++++ .../Pkcs12CertBag.NotSupported.cs | 50 +++++ .../Pkcs12ConfidentialityMode.NotSupported.cs | 13 ++ .../Pkcs12Info.NotSupported.cs | 59 ++++++ .../Pkcs12IntegrityMode.NotSupported.cs | 13 ++ .../Pkcs12KeyBag.NotSupported.cs | 25 +++ .../Pkcs12SafeBag.NotSupported.cs | 57 ++++++ .../Pkcs12SafeContents.NotSupported.cs | 171 ++++++++++++++++++ .../Pkcs12SafeContentsBag.NotSupported.cs | 20 ++ .../Pkcs12SecretBag.NotSupported.cs | 27 +++ .../Pkcs12ShroudedKeyBag.NotSupported.cs | 25 +++ .../Pkcs8PrivateKeyInfo.NotSupported.cs | 149 +++++++++++++++ .../Pkcs9LocalKeyId.NotSupported.cs | 32 ++++ .../Rfc3161TimestampRequest.NotSupported.cs | 120 ++++++++++++ .../Rfc3161TimestampToken.NotSupported.cs | 61 +++++++ .../Rfc3161TimestampTokenInfo.NotSupported.cs | 101 +++++++++++ .../System.Security/System.Security.csproj | 16 ++ .../common_System.Security.dll.sources | 20 ++ 20 files changed, 1096 insertions(+), 3 deletions(-) create mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12Builder.NotSupported.cs create mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12CertBag.NotSupported.cs create mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12ConfidentialityMode.NotSupported.cs create mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12Info.NotSupported.cs create mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12IntegrityMode.NotSupported.cs create mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12KeyBag.NotSupported.cs create mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12SafeBag.NotSupported.cs create mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12SafeContents.NotSupported.cs create mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12SafeContentsBag.NotSupported.cs create mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12SecretBag.NotSupported.cs create mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12ShroudedKeyBag.NotSupported.cs create mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs8PrivateKeyInfo.NotSupported.cs create mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9LocalKeyId.NotSupported.cs create mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Rfc3161TimestampRequest.NotSupported.cs create mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Rfc3161TimestampToken.NotSupported.cs create mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Rfc3161TimestampTokenInfo.NotSupported.cs diff --git a/external/api-snapshot b/external/api-snapshot index 45a61d93eca7..d89d8d3d9cfe 160000 --- a/external/api-snapshot +++ b/external/api-snapshot @@ -1 +1 @@ -Subproject commit 45a61d93eca72aa7ad04fa47db3d00f360832d69 +Subproject commit d89d8d3d9cfedab4a8aad048a522b39e0933812e diff --git a/mcs/class/Facades/System.Security.Cryptography.Pkcs/TypeForwarders.cs b/mcs/class/Facades/System.Security.Cryptography.Pkcs/TypeForwarders.cs index db96723509e4..0054d951a894 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Pkcs/TypeForwarders.cs +++ b/mcs/class/Facades/System.Security.Cryptography.Pkcs/TypeForwarders.cs @@ -27,14 +27,28 @@ [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.CmsRecipient))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.CmsRecipientCollection))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.CmsRecipientEnumerator))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.CmsSigner))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.ContentInfo))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.EnvelopedCms))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.KeyAgreeRecipientInfo))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.KeyTransRecipientInfo))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12Builder))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12CertBag))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12ConfidentialityMode))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12Info))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12IntegrityMode))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12KeyBag))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12SafeBag))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12SafeContents))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12SafeContentsBag))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12SecretBag))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs12ShroudedKeyBag))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs8PrivateKeyInfo))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9AttributeObject))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9ContentType))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9DocumentDescription))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9DocumentName))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9LocalKeyId))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9MessageDigest))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Pkcs9SigningTime))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.PublicKeyInfo))] @@ -42,10 +56,15 @@ [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.RecipientInfoCollection))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.RecipientInfoEnumerator))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.RecipientInfoType))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Rfc3161TimestampRequest))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Rfc3161TimestampToken))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.Rfc3161TimestampTokenInfo))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SignedCms))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SignerInfo))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SignerInfoCollection))] +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SignerInfoEnumerator))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SubjectIdentifier))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SubjectIdentifierOrKey))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SubjectIdentifierOrKeyType))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Pkcs.SubjectIdentifierType))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Xml.X509IssuerSerial))] - - diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12Builder.NotSupported.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12Builder.NotSupported.cs new file mode 100644 index 000000000000..95ce4ff018b2 --- /dev/null +++ b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12Builder.NotSupported.cs @@ -0,0 +1,115 @@ +using System; +using System.Security.Cryptography; +using System.Security.Cryptography.Pkcs; + +namespace System.Security.Cryptography.Pkcs { + /// Enables the creation of PKCS#12 PFX data values. This class cannot be inherited. + public sealed class Pkcs12Builder { + /// Gets a value that indicates whether the PFX data has been sealed. + /// A value that indicates whether the PFX data has been sealed. + public bool IsSealed { + get { + throw new PlatformNotSupportedException (); + } + } + + /// Add contents to the PFX in an bundle encrypted with a byte-based password from a byte array. + /// The contents to add to the PFX. + /// The byte array to use as a password when encrypting the contents. + /// The password-based encryption (PBE) parameters to use when encrypting the contents. + /// The or parameter is . + /// The parameter value is already encrypted. + /// The PFX is already sealed ( is ). + /// + /// indicates that should be used, which requires -based passwords. + public void AddSafeContentsEncrypted (Pkcs12SafeContents safeContents, byte[] passwordBytes, PbeParameters pbeParameters) { + throw new PlatformNotSupportedException (); + } + + /// Add contents to the PFX in an bundle encrypted with a byte-based password from a span. + /// The contents to add to the PFX. + /// The byte span to use as a password when encrypting the contents. + /// The password-based encryption (PBE) parameters to use when encrypting the contents. + /// The or parameter is . + /// The parameter value is already encrypted. + /// The PFX is already sealed ( is ). + /// + /// indicates that should be used, which requires -based passwords. + public void AddSafeContentsEncrypted (Pkcs12SafeContents safeContents, ReadOnlySpan passwordBytes, PbeParameters pbeParameters) { + throw new PlatformNotSupportedException (); + } + + /// Add contents to the PFX in an bundle encrypted with a char-based password from a span. + /// The contents to add to the PFX. + /// The span to use as a password when encrypting the contents. + /// The password-based encryption (PBE) parameters to use when encrypting the contents. + /// The or parameter is . + /// The parameter value is already encrypted. + /// The PFX is already sealed ( is ). + public void AddSafeContentsEncrypted (Pkcs12SafeContents safeContents, ReadOnlySpan password, PbeParameters pbeParameters) { + throw new PlatformNotSupportedException (); + } + + /// Add contents to the PFX in an bundle encrypted with a char-based password from a string. + /// The contents to add to the PFX. + /// The string to use as a password when encrypting the contents. + /// The password-based encryption (PBE) parameters to use when encrypting the contents. + /// The or parameter is . + /// The parameter value is already encrypted. + /// The PFX is already sealed ( is ). + public void AddSafeContentsEncrypted (Pkcs12SafeContents safeContents, string password, PbeParameters pbeParameters) { + throw new PlatformNotSupportedException (); + } + + /// Add contents to the PFX without encrypting them. + /// The contents to add to the PFX. + /// The parameter is . + /// The PFX is already sealed ( is ). + public void AddSafeContentsUnencrypted (Pkcs12SafeContents safeContents) { + throw new PlatformNotSupportedException (); + } + + /// Encodes the contents of a sealed PFX and returns it as a byte array. + /// A byte array representing the encoded form of the PFX. + /// The PFX is not sealed ( is ). + public byte[] Encode () { + throw new PlatformNotSupportedException (); + } + + /// Seals the PFX against further changes by applying a password-based Message Authentication Code (MAC) over the contents with a password from a span. + /// The password to use as a key for computing the MAC. + /// The hash algorithm to use when computing the MAC. + /// The iteration count for the Key Derivation Function (KDF) used in computing the MAC. + /// The parameter is less than or equal to 0. + /// The PFX is already sealed ( is ). + public void SealWithMac (ReadOnlySpan password, HashAlgorithmName hashAlgorithm, int iterationCount) { + throw new PlatformNotSupportedException (); + } + + /// Seals the PFX against further changes by applying a password-based Message Authentication Code (MAC) over the contents with a password from a string. + /// The password to use as a key for computing the MAC. + /// The hash algorithm to use when computing the MAC. + /// The iteration count for the Key Derivation Function (KDF) used in computing the MAC. + /// The parameter is less than or equal to 0. + /// The PFX is already sealed ( is ). + public void SealWithMac (string password, HashAlgorithmName hashAlgorithm, int iterationCount) { + throw new PlatformNotSupportedException (); + } + + /// Seals the PFX from further changes without applying tamper-protection. + /// The PFX is already sealed ( is ). + public void SealWithoutIntegrity () { + throw new PlatformNotSupportedException (); + } + + /// Attempts to encode the contents of a sealed PFX into a provided buffer. + /// The byte span to receive the PKCS#12 PFX data. + /// When this method returns, contains a value that indicates the number of bytes written to . This parameter is treated as uninitialized. + /// + /// if is big enough to receive the output; otherwise, . + /// The PFX is not sealed ( is ). + public bool TryEncode (Span destination, out int bytesWritten) { + throw new PlatformNotSupportedException (); + } + } +} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12CertBag.NotSupported.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12CertBag.NotSupported.cs new file mode 100644 index 000000000000..8e074f7386fe --- /dev/null +++ b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12CertBag.NotSupported.cs @@ -0,0 +1,50 @@ +using System; +using System.Security.Cryptography; +using System.Security.Cryptography.Pkcs; +using System.Security.Cryptography.X509Certificates; + +namespace System.Security.Cryptography.Pkcs { + /// Represents the PKCS#12 CertBag. This class cannot be inherited. + public sealed class Pkcs12CertBag : Pkcs12SafeBag { + /// Gets the uninterpreted certificate contents of the CertSafeBag. + /// The uninterpreted certificate contents of the CertSafeBag. + public ReadOnlyMemory EncodedCertificate { + get { + throw new PlatformNotSupportedException (); + } + } + + /// Gets a value indicating whether the content type of the encoded certificate value is the X.509 public key certificate content type. + /// + /// if the content type is the X.509 public key certificate content type (1.2.840.113549.1.9.22.1); otherwise, . + public bool IsX509Certificate { + get { + throw new PlatformNotSupportedException (); + } + } + + /// Initializes a new instance of the class using the specified certificate type and encoding. + /// The Object Identifier (OID) for the certificate type. + /// The encoded certificate value. + /// The parameter is . + /// The parameter does not represent a single ASN.1 BER-encoded value. + public Pkcs12CertBag (Oid certificateType, ReadOnlyMemory encodedCertificate) + : base (null, default(ReadOnlyMemory)) { + throw new PlatformNotSupportedException (); + } + + /// Gets the contents of the CertBag interpreted as an X.509 public key certificate. + /// A certificate decoded from the contents of the CertBag. + /// The content type is not the X.509 public key certificate content type. + /// The contents were not valid for the X.509 certificate content type. + public X509Certificate2 GetCertificate () { + throw new PlatformNotSupportedException (); + } + + /// Gets the Object Identifier (OID) which identifies the content type of the encoded certificte value. + /// The Object Identifier (OID) which identifies the content type of the encoded certificate value. + public Oid GetCertificateType () { + throw new PlatformNotSupportedException (); + } + } +} \ No newline at end of file diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12ConfidentialityMode.NotSupported.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12ConfidentialityMode.NotSupported.cs new file mode 100644 index 000000000000..5cf164d44442 --- /dev/null +++ b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12ConfidentialityMode.NotSupported.cs @@ -0,0 +1,13 @@ +namespace System.Security.Cryptography.Pkcs { + /// Represents the kind of encryption associated with a PKCS#12 SafeContents value. + public enum Pkcs12ConfidentialityMode { + /// The SafeContents value is not encrypted. + None = 1, + /// The SafeContents value is encrypted with a password. + Password = 2, + /// The SafeContents value is encrypted using public key cryptography. + PublicKey = 3, + /// The kind of encryption applied to the SafeContents is unknown or could not be determined. + Unknown = 0 + } +} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12Info.NotSupported.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12Info.NotSupported.cs new file mode 100644 index 000000000000..69c7a2b43479 --- /dev/null +++ b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12Info.NotSupported.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.ObjectModel; +using System.Security.Cryptography.Pkcs; + +namespace System.Security.Cryptography.Pkcs { + /// Represents the data from PKCS#12 PFX contents. This class cannot be inherited. + public sealed class Pkcs12Info { + /// Gets a read-only collection of the SafeContents values present in the PFX AuthenticatedSafe. + /// A read-only collection of the SafeContents values present in the PFX AuthenticatedSafe. + public ReadOnlyCollection AuthenticatedSafe { + get { + throw new PlatformNotSupportedException (); + } + } + + /// Gets a value that indicates the type of tamper protection provided for the contents. + /// One of the enumeration members that indicates the type of tamper protection provided for the contents. + public Pkcs12IntegrityMode IntegrityMode { + get { + throw new PlatformNotSupportedException (); + } + } + + internal Pkcs12Info () { + throw new PlatformNotSupportedException (); + } + + /// Reads the provided data as a PKCS#12 PFX and returns an object view of the contents. + /// The data to interpret as a PKCS#12 PFX. + /// When this method returns, contains a value that indicates the number of bytes from which were read by this method. This parameter is treated as uninitialized. + /// + /// to store without making a defensive copy; otherwise, . The default is . + /// An object view of the PKCS#12 PFX decoded from the input. + /// The contents of the parameter were not successfully decoded as a PKCS#12 PFX. + public static Pkcs12Info Decode (ReadOnlyMemory encodedBytes, out int bytesConsumed, bool skipCopy = false) { + throw new PlatformNotSupportedException (); + } + + /// Attempts to verify the integrity of the contents with a password represented by a . + /// The password to use to attempt to verify integrity. + /// + /// if the password successfully verifies the integrity of the contents; if the password is not correct or the contents have been altered. + /// The value is not . + /// The hash algorithm option specified by the PKCS#12 PFX contents could not be identified or is not supported by this platform. + public bool VerifyMac (ReadOnlySpan password) { + throw new PlatformNotSupportedException (); + } + + /// Attempts to verify the integrity of the contents with a password represented by a . + /// The password to use to attempt to verify integrity. + /// + /// if the password successfully verifies the integrity of the contents; if the password is not correct or the contents have been altered. + /// The value is not . + /// The hash algorithm option specified by the PKCS#12 PFX contents could not be identified or is not supported by this platform. + public bool VerifyMac (string password) { + throw new PlatformNotSupportedException (); + } + } +} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12IntegrityMode.NotSupported.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12IntegrityMode.NotSupported.cs new file mode 100644 index 000000000000..dc6ffb67403e --- /dev/null +++ b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12IntegrityMode.NotSupported.cs @@ -0,0 +1,13 @@ +namespace System.Security.Cryptography.Pkcs { + /// Represents the type of anti-tampering applied to a PKCS#12 PFX value. + public enum Pkcs12IntegrityMode { + /// The PKCS#12 PFX value is not protected from tampering. + None = 1, + /// The PKCS#12 PFX value is protected from tampering with a Message Authentication Code (MAC) keyed with a password. + Password = 2, + /// The PKCS#12 PFX value is protected from tampering with a digital signature using public key cryptography. + PublicKey = 3, + /// The type of anti-tampering applied to the PKCS#12 PFX is unknown or could not be determined. + Unknown = 0 + } +} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12KeyBag.NotSupported.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12KeyBag.NotSupported.cs new file mode 100644 index 000000000000..5c9e6bf55a0a --- /dev/null +++ b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12KeyBag.NotSupported.cs @@ -0,0 +1,25 @@ +using System; +using System.Security.Cryptography.Pkcs; + +namespace System.Security.Cryptography.Pkcs { + /// Represents the KeyBag from PKCS#12, a container whose contents are a PKCS#8 PrivateKeyInfo. This class cannot be inherited. + public sealed class Pkcs12KeyBag : Pkcs12SafeBag { + /// Gets a memory value containing the PKCS#8 PrivateKeyInfo value transported by this bag. + /// A memory value containing the PKCS#8 PrivateKeyInfo value transported by this bag. + public ReadOnlyMemory Pkcs8PrivateKey { + get { + throw new PlatformNotSupportedException (); + } + } + + /// Initializes a new instance of the from an existing encoded PKCS#8 PrivateKeyInfo value. + /// A BER-encoded PKCS#8 PrivateKeyInfo value. + /// + /// to store without making a defensive copy; otherwise, . The default is . + /// The parameter does not represent a single ASN.1 BER-encoded value. + public Pkcs12KeyBag (ReadOnlyMemory pkcs8PrivateKey, bool skipCopy = false) + : base (null, default(ReadOnlyMemory)) { + throw new PlatformNotSupportedException (); + } + } +} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12SafeBag.NotSupported.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12SafeBag.NotSupported.cs new file mode 100644 index 000000000000..1f32260e3c7f --- /dev/null +++ b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12SafeBag.NotSupported.cs @@ -0,0 +1,57 @@ +using System; +using System.Security.Cryptography; + +namespace System.Security.Cryptography.Pkcs { + /// Defines the core behavior of a SafeBag value from the PKCS#12 specification and provides a base for derived classes. + public abstract class Pkcs12SafeBag { + /// Gets the modifiable collection of attributes to encode with the SafeBag value. + /// The modifiable collection of attributes to encode with the SafeBag value. + public CryptographicAttributeObjectCollection Attributes { + get { + throw new PlatformNotSupportedException (); + } + } + + /// Gets the ASN.1 BER encoding of the contents of this SafeBag. + /// The ASN.1 BER encoding of the contents of this SafeBag. + public ReadOnlyMemory EncodedBagValue { + get { + throw new PlatformNotSupportedException (); + } + } + + /// Called from constructors in derived classes to initialize the class. + /// The Object Identifier (OID), in dotted decimal form, indicating the data type of this SafeBag. + /// The ASN.1 BER encoded value of the SafeBag contents. + /// + /// to store without making a defensive copy; otherwise, . The default is . + /// The parameter is or the empty string. + /// The parameter does not represent a single ASN.1 BER-encoded value. + protected Pkcs12SafeBag (string bagIdValue, ReadOnlyMemory encodedBagValue, bool skipCopy = false) { + throw new PlatformNotSupportedException (); + } + + /// Encodes the SafeBag value and returns it as a byte array. + /// A byte array representing the encoded form of the SafeBag. + /// The object identifier value passed to the constructor was invalid. + public byte[] Encode () { + throw new PlatformNotSupportedException (); + } + + /// Gets the Object Identifier (OID) identifying the content type of this SafeBag. + /// The Object Identifier (OID) identifying the content type of this SafeBag. + public Oid GetBagId () { + throw new PlatformNotSupportedException (); + } + + /// Attempts to encode the SafeBag value into a provided buffer. + /// The byte span to receive the encoded SafeBag value. + /// When this method returns, contains a value that indicates the number of bytes written to . This parameter is treated as uninitialized. + /// + /// if is big enough to receive the output; otherwise, . + /// The object identifier value passed to the constructor was invalid. + public bool TryEncode (Span destination, out int bytesWritten) { + throw new PlatformNotSupportedException (); + } + } +} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12SafeContents.NotSupported.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12SafeContents.NotSupported.cs new file mode 100644 index 000000000000..3a02a792cbbf --- /dev/null +++ b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12SafeContents.NotSupported.cs @@ -0,0 +1,171 @@ +using System; +using System.Collections.Generic; +using System.Security.Cryptography; +using System.Security.Cryptography.Pkcs; +using System.Security.Cryptography.X509Certificates; + +namespace System.Security.Cryptography.Pkcs { + /// Represents a PKCS#12 SafeContents value. This class cannot be inherited. + public sealed class Pkcs12SafeContents { + /// Gets a value that indicates the type of encryption applied to the contents. + /// One of the enumeration values that indicates the type of encryption applied to the contents. The default value is . + public Pkcs12ConfidentialityMode ConfidentialityMode { + get { + throw new PlatformNotSupportedException (); + } + } + + /// Gets a value that indicates whether this instance in a read-only state. + /// + /// if this value is in a read-only state; otherwise, . The default value is . + public bool IsReadOnly { + get { + throw new PlatformNotSupportedException (); + } + } + + /// Adds a certificate to the SafeContents via a new and returns the newly created bag instance. + /// The certificate to add. + /// The bag instance which was added to the SafeContents. + /// The parameter is . + /// This instance is read-only. + /// The parameter is in an invalid state. + public Pkcs12CertBag AddCertificate (X509Certificate2 certificate) { + throw new PlatformNotSupportedException (); + } + + /// Adds an asymmetric private key to the SafeContents via a new and returns the newly created bag instance. + /// The asymmetric private key to add. + /// The bag instance which was added to the SafeContents. + /// The parameter is . + /// This instance is read-only. + /// The key export failed. + public Pkcs12KeyBag AddKeyUnencrypted (AsymmetricAlgorithm key) { + throw new PlatformNotSupportedException (); + } + + /// Adds a nested SafeContents to the SafeContents via a new and returns the newly created bag instance. + /// The nested contents to add to the SafeContents. + /// The bag instance which was added to the SafeContents. + /// The parameter is . + /// The parameter is encrypted. + /// This instance is read-only. + public Pkcs12SafeContentsBag AddNestedContents (Pkcs12SafeContents safeContents) { + throw new PlatformNotSupportedException (); + } + + /// Adds a SafeBag to the SafeContents. + /// The SafeBag value to add. + /// The parameter is . + /// This instance is read-only. + public void AddSafeBag (Pkcs12SafeBag safeBag) { + throw new PlatformNotSupportedException (); + } + + /// Adds an ASN.1 BER-encoded value with a specified type identifier to the SafeContents via a new and returns the newly created bag instance. + /// The Object Identifier (OID) which identifies the data type of the secret value. + /// The BER-encoded value representing the secret to add. + /// The bag instance which was added to the SafeContents. + /// The parameter is . + /// This instance is read-only. + /// The parameter does not represent a single ASN.1 BER-encoded value. + public Pkcs12SecretBag AddSecret (Oid secretType, ReadOnlyMemory secretValue) { + throw new PlatformNotSupportedException (); + } + + /// Adds an encrypted asymmetric private key to the SafeContents via a new from a byte-based password in an array and returns the newly created bag instance. + /// The asymmetric private key to add. + /// The bytes to use as a password when encrypting the key material. + /// The password-based encryption (PBE) parameters to use when encrypting the key material. + /// The bag instance which was added to the SafeContents. + /// The parameter is . + /// This instance is read-only. + /// The key export failed. + public Pkcs12ShroudedKeyBag AddShroudedKey (AsymmetricAlgorithm key, byte[] passwordBytes, PbeParameters pbeParameters) { + throw new PlatformNotSupportedException (); + } + + /// Adds an encrypted asymmetric private key to the SafeContents via a new from a byte-based password in a span and returns the newly created bag instance. + /// The asymmetric private key to add. + /// The bytes to use as a password when encrypting the key material. + /// The password-based encryption (PBE) parameters to use when encrypting the key material. + /// The bag instance which was added to the SafeContents. + /// The parameter is . + /// This instance is read-only. + /// The key export failed. + public Pkcs12ShroudedKeyBag AddShroudedKey (AsymmetricAlgorithm key, ReadOnlySpan passwordBytes, PbeParameters pbeParameters) { + throw new PlatformNotSupportedException (); + } + + /// Adds an encrypted asymmetric private key to the SafeContents via a new from a character-based password in a span and returns the newly created bag instance. + /// The asymmetric private key to add. + /// The password to use when encrypting the key material. + /// The password-based encryption (PBE) parameters to use when encrypting the key material. + /// The bag instance which was added to the SafeContents. + /// The parameter is . + /// This instance is read-only. + /// The key export failed. + public Pkcs12ShroudedKeyBag AddShroudedKey (AsymmetricAlgorithm key, ReadOnlySpan password, PbeParameters pbeParameters) { + throw new PlatformNotSupportedException (); + } + + /// Adds an encrypted asymmetric private key to the SafeContents via a new from a character-based password in a string and returns the newly created bag instance. + /// The asymmetric private key to add. + /// The password to use when encrypting the key material. + /// The password-based encryption (PBE) parameters to use when encrypting the key material. + /// The bag instance which was added to the SafeContents. + /// The parameter is . + /// This instance is read-only. + /// The key export failed. + public Pkcs12ShroudedKeyBag AddShroudedKey (AsymmetricAlgorithm key, string password, PbeParameters pbeParameters) { + throw new PlatformNotSupportedException (); + } + + /// Decrypts the contents of this SafeContents value using a byte-based password from an array. + /// The bytes to use as a password for decrypting the encrypted contents. + /// The property is not . + /// The password is incorrect. + /// -or- + /// The contents were not successfully decrypted. + public void Decrypt (byte[] passwordBytes) { + throw new PlatformNotSupportedException (); + } + + /// Decrypts the contents of this SafeContents value using a byte-based password from a span. + /// The bytes to use as a password for decrypting the encrypted contents. + /// The property is not . + /// The password is incorrect. + /// -or- + /// The contents were not successfully decrypted. + public void Decrypt (ReadOnlySpan passwordBytes) { + throw new PlatformNotSupportedException (); + } + + /// Decrypts the contents of this SafeContents value using a character-based password from a span. + /// The password to use for decrypting the encrypted contents. + /// The property is not . + /// The password is incorrect. + /// -or- + /// The contents were not successfully decrypted. + public void Decrypt (ReadOnlySpan password) { + throw new PlatformNotSupportedException (); + } + + /// Decrypts the contents of this SafeContents value using a character-based password from a string. + /// The password to use for decrypting the encrypted contents. + /// The property is not . + /// The password is incorrect. + /// -or- + /// The contents were not successfully decrypted. + public void Decrypt (string password) { + throw new PlatformNotSupportedException (); + } + + /// Gets an enumerable representation of the SafeBag values contained within the SafeContents. + /// An enumerable representation of the SafeBag values contained within the SafeContents. + /// The contents are encrypted. + public IEnumerable GetBags () { + throw new PlatformNotSupportedException (); + } + } +} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12SafeContentsBag.NotSupported.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12SafeContentsBag.NotSupported.cs new file mode 100644 index 000000000000..15f10f14d633 --- /dev/null +++ b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12SafeContentsBag.NotSupported.cs @@ -0,0 +1,20 @@ +using System; +using System.Security.Cryptography.Pkcs; + +namespace System.Security.Cryptography.Pkcs { + /// Represents the SafeContentsBag from PKCS#12, a container whose contents are a PKCS#12 SafeContents value. This class cannot be inherited. + public sealed class Pkcs12SafeContentsBag : Pkcs12SafeBag { + /// Gets the SafeContents value contained within this bag. + /// The SafeContents value contained within this bag. + public Pkcs12SafeContents SafeContents { + get { + throw new PlatformNotSupportedException (); + } + } + + internal Pkcs12SafeContentsBag () + : base (null, default(ReadOnlyMemory)) { + throw new PlatformNotSupportedException (); + } + } +} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12SecretBag.NotSupported.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12SecretBag.NotSupported.cs new file mode 100644 index 000000000000..65552677408a --- /dev/null +++ b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12SecretBag.NotSupported.cs @@ -0,0 +1,27 @@ +using System; +using System.Security.Cryptography; +using System.Security.Cryptography.Pkcs; + +namespace System.Security.Cryptography.Pkcs { + /// Represents the SecretBag from PKCS#12, a container whose contents are arbitrary data with a type identifier. This class cannot be inherited. + public sealed class Pkcs12SecretBag : Pkcs12SafeBag { + /// Gets a memory value containing the BER-encoded contents of the bag. + /// A memory value containing the BER-encoded contents of the bag. + public ReadOnlyMemory SecretValue { + get { + throw new PlatformNotSupportedException (); + } + } + + internal Pkcs12SecretBag () + : base (null, default(ReadOnlyMemory)) { + throw new PlatformNotSupportedException (); + } + + /// Gets the Object Identifier (OID) which identifies the data type of the secret value. + /// The Object Identifier (OID) which identifies the data type of the secret value. + public Oid GetSecretType () { + throw new PlatformNotSupportedException (); + } + } +} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12ShroudedKeyBag.NotSupported.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12ShroudedKeyBag.NotSupported.cs new file mode 100644 index 000000000000..14bc04c105c6 --- /dev/null +++ b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs12ShroudedKeyBag.NotSupported.cs @@ -0,0 +1,25 @@ +using System; +using System.Security.Cryptography.Pkcs; + +namespace System.Security.Cryptography.Pkcs { + /// Represents the ShroudedKeyBag from PKCS#12, a container whose contents are a PKCS#8 EncryptedPrivateKeyInfo. This class cannot be inherited. + public sealed class Pkcs12ShroudedKeyBag : Pkcs12SafeBag { + /// Gets a memory value containing the PKCS#8 EncryptedPrivateKeyInfo value transported by this bag. + /// A memory value containing the PKCS#8 EncryptedPrivateKeyInfo value transported by this bag. + public ReadOnlyMemory EncryptedPkcs8PrivateKey { + get { + throw new PlatformNotSupportedException (); + } + } + + /// Initializes a new instance of the from an existing encoded PKCS#8 EncryptedPrivateKeyInfo value. + /// A BER-encoded PKCS#8 EncryptedPrivateKeyInfo value. + /// + /// to store without making a defensive copy; otherwise, . The default is . + /// The parameter does not represent a single ASN.1 BER-encoded value. + public Pkcs12ShroudedKeyBag (ReadOnlyMemory encryptedPkcs8PrivateKey, bool skipCopy = false) + : base (null, default(ReadOnlyMemory)) { + throw new PlatformNotSupportedException (); + } + } +} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs8PrivateKeyInfo.NotSupported.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs8PrivateKeyInfo.NotSupported.cs new file mode 100644 index 000000000000..719c890da99a --- /dev/null +++ b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs8PrivateKeyInfo.NotSupported.cs @@ -0,0 +1,149 @@ +using System; +using System.Security.Cryptography; +using System.Security.Cryptography.Pkcs; + +namespace System.Security.Cryptography.Pkcs { + /// Enables the inspection of and creation of PKCS#8 PrivateKeyInfo and EncryptedPrivateKeyInfo values. This class cannot be inherited. + public sealed class Pkcs8PrivateKeyInfo { + /// Gets the Object Identifier (OID) value identifying the algorithm this key is for. + /// The Object Identifier (OID) value identifying the algorithm this key is for. + public Oid AlgorithmId { + get { + throw new PlatformNotSupportedException (); + } + } + + /// Gets a memory value containing the BER-encoded algorithm parameters associated with this key. + /// A memory value containing the BER-encoded algorithm parameters associated with this key, or if no parameters were present. + public ReadOnlyMemory? AlgorithmParameters { + get { + throw new PlatformNotSupportedException (); + } + } + + /// Gets the modifiable collection of attributes for this private key. + /// The modifiable collection of attributes to encode with the private key. + public CryptographicAttributeObjectCollection Attributes { + get { + throw new PlatformNotSupportedException (); + } + } + + /// Gets a memory value that represents the algorithm-specific encoded private key. + /// A memory value that represents the algorithm-specific encoded private key. + public ReadOnlyMemory PrivateKeyBytes { + get { + throw new PlatformNotSupportedException (); + } + } + + /// Initializes a new instance of the class. + /// The Object Identifier (OID) identifying the asymmetric algorithm this key is for. + /// The BER-encoded algorithm parameters associated with this key, or to omit algorithm parameters when encoding. + /// The algorithm-specific encoded private key. + /// + /// to store and without making a defensive copy; otherwise, . The default is . + /// The parameter is . + /// The parameter is not , empty, or a single BER-encoded value. + public Pkcs8PrivateKeyInfo (Oid algorithmId, ReadOnlyMemory? algorithmParameters, ReadOnlyMemory privateKey, bool skipCopies = false) { + throw new PlatformNotSupportedException (); + } + + /// Exports a specified key as a PKCS#8 PrivateKeyInfo and returns its decoded interpretation. + /// The private key to represent in a PKCS#8 PrivateKeyInfo. + /// The decoded interpretation of the exported PKCS#8 PrivateKeyInfo. + /// The parameter is . + public static Pkcs8PrivateKeyInfo Create (AsymmetricAlgorithm privateKey) { + throw new PlatformNotSupportedException (); + } + + /// Reads the provided data as a PKCS#8 PrivateKeyInfo and returns an object view of the contents. + /// The data to interpret as a PKCS#8 PrivateKeyInfo value. + /// When this method returns, contains a value that indicates the number of bytes read from . This parameter is treated as uninitialized. + /// + /// to store without making a defensive copy; otherwise, . The default is . + /// An object view of the contents decoded as a PKCS#8 PrivateKeyInfo. + /// The contents of the parameter were not successfully decoded as a PKCS#8 PrivateKeyInfo. + public static Pkcs8PrivateKeyInfo Decode (ReadOnlyMemory source, out int bytesRead, bool skipCopy = false) { + throw new PlatformNotSupportedException (); + } + + /// Decrypts the provided data using the provided byte-based password and decodes the output into an object view of the PKCS#8 PrivateKeyInfo. + /// The bytes to use as a password when decrypting the key material. + /// The data to read as a PKCS#8 EncryptedPrivateKeyInfo structure in the ASN.1-BER encoding. + /// When this method returns, contains a value that indicates the number of bytes read from . This parameter is treated as uninitialized. + /// An object view of the contents decrypted decoded as a PKCS#8 PrivateKeyInfo. + /// The password is incorrect. + /// -or- + /// The contents of indicate the Key Derivation Function (KDF) to apply is the legacy PKCS#12 KDF, which requires -based passwords. + /// -or- + /// The contents of do not represent an ASN.1-BER-encoded PKCS#8 EncryptedPrivateKeyInfo structure. + public static Pkcs8PrivateKeyInfo DecryptAndDecode (ReadOnlySpan passwordBytes, ReadOnlyMemory source, out int bytesRead) { + throw new PlatformNotSupportedException (); + } + + /// Decrypts the provided data using the provided character-based password and decodes the output into an object view of the PKCS#8 PrivateKeyInfo. + /// The password to use when decrypting the key material. + /// The bytes of a PKCS#8 EncryptedPrivateKeyInfo structure in the ASN.1-BER encoding. + /// When this method returns, contains a value that indicates the number of bytes read from . This parameter is treated as uninitialized. + /// An object view of the contents decrypted decoded as a PKCS#8 PrivateKeyInfo. + public static Pkcs8PrivateKeyInfo DecryptAndDecode (ReadOnlySpan password, ReadOnlyMemory source, out int bytesRead) { + throw new PlatformNotSupportedException (); + } + + /// Encodes the property data of this instance as a PKCS#8 PrivateKeyInfo and returns the encoding as a byte array. + /// A byte array representing the encoded form of the PKCS#8 PrivateKeyInfo. + public byte[] Encode () { + throw new PlatformNotSupportedException(); + } + + /// Produces a PKCS#8 EncryptedPrivateKeyInfo from the property contents of this object after encrypting with the specified byte-based password and encryption parameters. + /// The bytes to use as a password when encrypting the key material. + /// The password-based encryption (PBE) parameters to use when encrypting the key material. + /// A byte array containing the encoded form of the PKCS#8 EncryptedPrivateKeyInfo. + /// + /// indicates that should be used, which requires -based passwords. + public byte[] Encrypt (ReadOnlySpan passwordBytes, PbeParameters pbeParameters) { + throw new PlatformNotSupportedException (); + } + + /// Produces a PKCS#8 EncryptedPrivateKeyInfo from the property contents of this object after encrypting with the specified character-based password and encryption parameters. + /// The password to use when encrypting the key material. + /// The password-based encryption (PBE) parameters to use when encrypting the key material. + /// A byte array containing the encoded form of the PKCS#8 EncryptedPrivateKeyInfo. + public byte[] Encrypt (ReadOnlySpan password, PbeParameters pbeParameters) { + throw new PlatformNotSupportedException (); + } + + /// Attempts to encode the property data of this instance as a PKCS#8 PrivateKeyInfo, writing the results into a provided buffer. + /// The byte span to receive the PKCS#8 PrivateKeyInfo data. + /// When this method returns, contains a value that indicates the number of bytes written to . This parameter is treated as uninitialized. + /// + /// if is big enough to receive the output; otherwise, . + public bool TryEncode (Span destination, out int bytesWritten) { + throw new PlatformNotSupportedException (); + } + + /// Attempts to produce a PKCS#8 EncryptedPrivateKeyInfo from the property contents of this object after encrypting with the specified byte-based password and encryption parameters, writing the results into a provided buffer. + /// The bytes to use as a password when encrypting the key material. + /// The password-based encryption (PBE) parameters to use when encrypting the key material. + /// The byte span to receive the PKCS#8 EncryptedPrivateKeyInfo data. + /// When this method returns, contains a value that indicates the number of bytes written to . This parameter is treated as uninitialized. + /// + /// if is big enough to receive the output; otherwise, . + public bool TryEncrypt (ReadOnlySpan passwordBytes, PbeParameters pbeParameters, Span destination, out int bytesWritten) { + throw new PlatformNotSupportedException (); + } + + /// Attempts to produce a PKCS#8 EncryptedPrivateKeyInfo from the property contents of this object after encrypting with the specified character-based password and encryption parameters, writing the result into a provided buffer. + /// The password to use when encrypting the key material. + /// The password-based encryption (PBE) parameters to use when encrypting the key material. + /// The byte span to receive the PKCS#8 EncryptedPrivateKeyInfo data. + /// When this method returns, contains a value that indicates the number of bytes written to . This parameter is treated as uninitialized. + /// + /// if is big enough to receive the output; otherwise, . + public bool TryEncrypt (ReadOnlySpan password, PbeParameters pbeParameters, Span destination, out int bytesWritten) { + throw new PlatformNotSupportedException (); + } + } +} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9LocalKeyId.NotSupported.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9LocalKeyId.NotSupported.cs new file mode 100644 index 000000000000..20aa61ea4921 --- /dev/null +++ b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9LocalKeyId.NotSupported.cs @@ -0,0 +1,32 @@ +using System; +using System.Security.Cryptography.Pkcs; + +namespace System.Security.Cryptography.Pkcs { + /// Represents the LocalKeyId attribute from PKCS#9. + public sealed class Pkcs9LocalKeyId : Pkcs9AttributeObject { + /// Gets a memory value containing the key identifier from this attribute. + /// A memory value containing the key identifier from this attribute. + public ReadOnlyMemory KeyId { + get { + throw new PlatformNotSupportedException (); + } + } + + /// Initializes a new instance of the class with an empty key identifier value. + public Pkcs9LocalKeyId () { + throw new PlatformNotSupportedException (); + } + + /// Initializes a new instance of the class with a key identifier specified by a byte array. + /// A byte array containing the key identifier. + public Pkcs9LocalKeyId (byte[] keyId) { + throw new PlatformNotSupportedException (); + } + + /// Initializes a new instance of the class with a key identifier specified by a byte span. + /// A byte array containing the key identifier. + public Pkcs9LocalKeyId (ReadOnlySpan keyId) { + throw new PlatformNotSupportedException (); + } + } +} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Rfc3161TimestampRequest.NotSupported.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Rfc3161TimestampRequest.NotSupported.cs new file mode 100644 index 000000000000..46175aa8c76f --- /dev/null +++ b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Rfc3161TimestampRequest.NotSupported.cs @@ -0,0 +1,120 @@ +using System; +using System.Security.Cryptography; +using System.Security.Cryptography.Pkcs; +using System.Security.Cryptography.X509Certificates; + +namespace System.Security.Cryptography.Pkcs { + public sealed class Rfc3161TimestampRequest { + public bool HasExtensions { + get { + throw new PlatformNotSupportedException (); + } + } + + public Oid HashAlgorithmId { + get { + throw new PlatformNotSupportedException (); + } + } + + public Oid RequestedPolicyId { + get { + throw new PlatformNotSupportedException (); + } + } + + public bool RequestSignerCertificate { + get { + throw new PlatformNotSupportedException (); + } + } + + public int Version { + get { + throw new PlatformNotSupportedException (); + } + } + + internal Rfc3161TimestampRequest () { + throw new PlatformNotSupportedException (); + } + + /// + /// + /// + /// + /// + /// + public static Rfc3161TimestampRequest CreateFromData (ReadOnlySpan data, HashAlgorithmName hashAlgorithm, Oid requestedPolicyId = null, ReadOnlyMemory? nonce = default(ReadOnlyMemory?), bool requestSignerCertificates = false, X509ExtensionCollection extensions = null) { + throw new PlatformNotSupportedException (); + } + + /// + /// + /// + /// + /// + /// + public static Rfc3161TimestampRequest CreateFromHash (ReadOnlyMemory hash, HashAlgorithmName hashAlgorithm, Oid requestedPolicyId = null, ReadOnlyMemory? nonce = default(ReadOnlyMemory?), bool requestSignerCertificates = false, X509ExtensionCollection extensions = null) { + throw new PlatformNotSupportedException (); + } + + /// Create a timestamp request using a pre-computed hash value. + /// The pre-computed hash value to be timestamped. + /// The Object Identifier (OID) for the hash algorithm that produced . + /// The Object Identifier (OID) for a timestamp policy the Timestamp Authority (TSA) should use, or to express no preference. + /// An optional nonce (number used once) to uniquely identify this request to pair it with the response. The value is interpreted as an unsigned big-endian integer and may be normalized to the encoding format. + /// + /// to indicate the Timestamp Authority (TSA) must include the signing certificate in the issued timestamp token; otherwise, . + /// RFC3161 extensions to present with the request. + /// An representing the chosen values. + public static Rfc3161TimestampRequest CreateFromHash (ReadOnlyMemory hash, Oid hashAlgorithmId, Oid requestedPolicyId = null, ReadOnlyMemory? nonce = default(ReadOnlyMemory?), bool requestSignerCertificates = false, X509ExtensionCollection extensions = null) { + throw new PlatformNotSupportedException (); + } + + /// + /// + /// + /// + /// + /// + public static Rfc3161TimestampRequest CreateFromSignerInfo (SignerInfo signerInfo, HashAlgorithmName hashAlgorithm, Oid requestedPolicyId = null, ReadOnlyMemory? nonce = default(ReadOnlyMemory?), bool requestSignerCertificates = false, X509ExtensionCollection extensions = null) { + throw new PlatformNotSupportedException (); + } + + public byte[] Encode () { + throw new PlatformNotSupportedException (); + } + + public X509ExtensionCollection GetExtensions () { + throw new PlatformNotSupportedException (); + } + + public ReadOnlyMemory GetMessageHash () { + throw new PlatformNotSupportedException (); + } + + public ReadOnlyMemory? GetNonce () { + throw new PlatformNotSupportedException (); + } + + /// + /// + public Rfc3161TimestampToken ProcessResponse (ReadOnlyMemory responseBytes, out int bytesConsumed) { + throw new PlatformNotSupportedException (); + } + + /// + /// + /// + public static bool TryDecode (ReadOnlyMemory encodedBytes, out Rfc3161TimestampRequest request, out int bytesConsumed) { + throw new PlatformNotSupportedException (); + } + + /// + /// + public bool TryEncode (Span destination, out int bytesWritten) { + throw new PlatformNotSupportedException (); + } + } +} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Rfc3161TimestampToken.NotSupported.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Rfc3161TimestampToken.NotSupported.cs new file mode 100644 index 000000000000..3e10b1f82fc7 --- /dev/null +++ b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Rfc3161TimestampToken.NotSupported.cs @@ -0,0 +1,61 @@ +using System; +using System.Security.Cryptography; +using System.Security.Cryptography.Pkcs; +using System.Security.Cryptography.X509Certificates; + +namespace System.Security.Cryptography.Pkcs { + public sealed class Rfc3161TimestampToken { + public Rfc3161TimestampTokenInfo TokenInfo { + get { + throw new PlatformNotSupportedException (); + } + } + + internal Rfc3161TimestampToken () { + throw new PlatformNotSupportedException (); + } + + /// Gets a Signed Cryptographic Message Syntax (CMS) representation of the RFC3161 timestamp token. + /// The representation of the . + public SignedCms AsSignedCms () { + throw new PlatformNotSupportedException (); + } + + /// + /// + /// + public static bool TryDecode (ReadOnlyMemory encodedBytes, out Rfc3161TimestampToken token, out int bytesConsumed) { + throw new PlatformNotSupportedException (); + } + + /// + /// + /// + public bool VerifySignatureForData (ReadOnlySpan data, out X509Certificate2 signerCertificate, X509Certificate2Collection extraCandidates = null) { + throw new PlatformNotSupportedException (); + } + + /// + /// + /// + /// + public bool VerifySignatureForHash (ReadOnlySpan hash, HashAlgorithmName hashAlgorithm, out X509Certificate2 signerCertificate, X509Certificate2Collection extraCandidates = null) { + throw new PlatformNotSupportedException (); + } + + /// + /// + /// + /// + public bool VerifySignatureForHash (ReadOnlySpan hash, Oid hashAlgorithmId, out X509Certificate2 signerCertificate, X509Certificate2Collection extraCandidates = null) { + throw new PlatformNotSupportedException (); + } + + /// + /// + /// + public bool VerifySignatureForSignerInfo (SignerInfo signerInfo, out X509Certificate2 signerCertificate, X509Certificate2Collection extraCandidates = null) { + throw new PlatformNotSupportedException (); + } + } +} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Rfc3161TimestampTokenInfo.NotSupported.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Rfc3161TimestampTokenInfo.NotSupported.cs new file mode 100644 index 000000000000..094114c7fbfd --- /dev/null +++ b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Rfc3161TimestampTokenInfo.NotSupported.cs @@ -0,0 +1,101 @@ +using System; +using System.Security.Cryptography; +using System.Security.Cryptography.Pkcs; +using System.Security.Cryptography.X509Certificates; + +namespace System.Security.Cryptography.Pkcs { + public sealed class Rfc3161TimestampTokenInfo { + public long? AccuracyInMicroseconds { + get { + throw new PlatformNotSupportedException (); + } + } + + public bool HasExtensions { + get { + throw new PlatformNotSupportedException (); + } + } + + public Oid HashAlgorithmId { + get { + throw new PlatformNotSupportedException (); + } + } + + public bool IsOrdering { + get { + throw new PlatformNotSupportedException (); + } + } + + public Oid PolicyId { + get { + throw new PlatformNotSupportedException (); + } + } + + public DateTimeOffset Timestamp { + get { + throw new PlatformNotSupportedException (); + } + } + + public int Version { + get { + throw new PlatformNotSupportedException (); + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public Rfc3161TimestampTokenInfo (Oid policyId, Oid hashAlgorithmId, ReadOnlyMemory messageHash, ReadOnlyMemory serialNumber, DateTimeOffset timestamp, long? accuracyInMicroseconds = default(long?), bool isOrdering = false, ReadOnlyMemory? nonce = default(ReadOnlyMemory?), ReadOnlyMemory? timestampAuthorityName = default(ReadOnlyMemory?), X509ExtensionCollection extensions = null) { + throw new PlatformNotSupportedException (); + } + + public byte[] Encode () { + throw new PlatformNotSupportedException (); + } + + public X509ExtensionCollection GetExtensions () { + throw new PlatformNotSupportedException (); + } + + public ReadOnlyMemory GetMessageHash () { + throw new PlatformNotSupportedException (); + } + + public ReadOnlyMemory? GetNonce () { + throw new PlatformNotSupportedException (); + } + + public ReadOnlyMemory GetSerialNumber () { + throw new PlatformNotSupportedException (); + } + + public ReadOnlyMemory? GetTimestampAuthorityName () { + throw new PlatformNotSupportedException (); + } + + /// + /// + /// + public static bool TryDecode (ReadOnlyMemory encodedBytes, out Rfc3161TimestampTokenInfo timestampTokenInfo, out int bytesConsumed) { + throw new PlatformNotSupportedException (); + } + + /// + /// + public bool TryEncode (Span destination, out int bytesWritten) { + throw new PlatformNotSupportedException (); + } + } +} diff --git a/mcs/class/System.Security/System.Security.csproj b/mcs/class/System.Security/System.Security.csproj index 0c68242c1a8b..1cd79c8485dc 100644 --- a/mcs/class/System.Security/System.Security.csproj +++ b/mcs/class/System.Security/System.Security.csproj @@ -211,6 +211,22 @@ + + + + + + + + + + + + + + + + diff --git a/mcs/class/System.Security/common_System.Security.dll.sources b/mcs/class/System.Security/common_System.Security.dll.sources index bc12f3f9315f..edd3535fd3bb 100644 --- a/mcs/class/System.Security/common_System.Security.dll.sources +++ b/mcs/class/System.Security/common_System.Security.dll.sources @@ -99,5 +99,25 @@ System.Security.Cryptography.Pkcs/EnvelopedCms.cs ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignerInfoCollection.cs ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignerInfoEnumerator.cs + +# System.Security.Cryptography.Pkcs NotSupported +System.Security.Cryptography.Pkcs/Pkcs12Builder.NotSupported.cs +System.Security.Cryptography.Pkcs/Pkcs12CertBag.NotSupported.cs +System.Security.Cryptography.Pkcs/Pkcs12ConfidentialityMode.NotSupported.cs +System.Security.Cryptography.Pkcs/Pkcs12Info.NotSupported.cs +System.Security.Cryptography.Pkcs/Pkcs12IntegrityMode.NotSupported.cs +System.Security.Cryptography.Pkcs/Pkcs12KeyBag.NotSupported.cs +System.Security.Cryptography.Pkcs/Pkcs12SafeBag.NotSupported.cs +System.Security.Cryptography.Pkcs/Pkcs12SafeContents.NotSupported.cs +System.Security.Cryptography.Pkcs/Pkcs12SafeContentsBag.NotSupported.cs +System.Security.Cryptography.Pkcs/Pkcs12SecretBag.NotSupported.cs +System.Security.Cryptography.Pkcs/Pkcs12ShroudedKeyBag.NotSupported.cs +System.Security.Cryptography.Pkcs/Pkcs8PrivateKeyInfo.NotSupported.cs +System.Security.Cryptography.Pkcs/Pkcs9LocalKeyId.NotSupported.cs +System.Security.Cryptography.Pkcs/Rfc3161TimestampRequest.NotSupported.cs +System.Security.Cryptography.Pkcs/Rfc3161TimestampToken.NotSupported.cs +System.Security.Cryptography.Pkcs/Rfc3161TimestampTokenInfo.NotSupported.cs + + # System.Security.Cryptography.Xml ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Xml/X509IssuerSerial.cs From b38f2038ec2bf4e1268ccd94aced53cc46fe4a02 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Tue, 7 Jan 2020 12:13:28 -0500 Subject: [PATCH 06/10] [2019-10] Bump msbuild to track mono-2019-10 (#18259) * Bump msbuild to track mono-2019-10 - update nuget.exe to 5.5.0-preview1 to match --- packaging/MacSDK/msbuild.py | 2 +- packaging/MacSDK/nuget.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/MacSDK/msbuild.py b/packaging/MacSDK/msbuild.py index 1704d86882da..842f62749317 100644 --- a/packaging/MacSDK/msbuild.py +++ b/packaging/MacSDK/msbuild.py @@ -3,7 +3,7 @@ class MSBuild (GitHubPackage): def __init__ (self): GitHubPackage.__init__ (self, 'mono', 'msbuild', '15', # note: fix scripts/ci/run-test-mac-sdk.sh when bumping the version number - revision = '82d95d045ec6bb36345f55b558cae0aba33a1487') + revision = 'ebc1ebc6c51b3240b2eb1d59f1adbb05e2b2538e') def build (self): try: diff --git a/packaging/MacSDK/nuget.py b/packaging/MacSDK/nuget.py index fa766cf5415e..4b2bcc748bcc 100644 --- a/packaging/MacSDK/nuget.py +++ b/packaging/MacSDK/nuget.py @@ -4,7 +4,7 @@ class NuGetBinary (Package): def __init__(self): - Package.__init__(self, name='NuGet', version='5.4.0', sources=[ + Package.__init__(self, name='NuGet', version='5.5.0-preview1', sources=[ 'https://dist.nuget.org/win-x86-commandline/v%{version}/nuget.exe']) def build(self): From 398bb16a403b959c44580817f6fce37b494dd350 Mon Sep 17 00:00:00 2001 From: imhameed Date: Tue, 7 Jan 2020 14:09:19 -0800 Subject: [PATCH 07/10] [2019-10] Use byte-aligned LLVM loads and stores for unaligned mini IR loads and stores. (#18369) Should fix https://github.com/mono/mono/issues/18221. Backport of #18296. --- mono/mini/mini-llvm.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/mono/mini/mini-llvm.c b/mono/mini/mini-llvm.c index 9d251a99b293..e034f5213f33 100644 --- a/mono/mini/mini-llvm.c +++ b/mono/mini/mini-llvm.c @@ -5739,6 +5739,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) LLVMTypeRef t; gboolean sext = FALSE, zext = FALSE; gboolean is_volatile = (ins->flags & (MONO_INST_FAULT | MONO_INST_VOLATILE)) != 0; + gboolean is_unaligned = (ins->flags & MONO_INST_UNALIGNED) != 0; t = load_store_to_llvm_type (ins->opcode, &size, &sext, &zext); @@ -5766,7 +5767,10 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) addr = convert (ctx, addr, LLVMPointerType (t, 0)); - values [ins->dreg] = emit_load (ctx, bb, &builder, size, addr, base, dname, is_volatile, LLVM_BARRIER_NONE); + if (is_unaligned) + values [ins->dreg] = mono_llvm_build_aligned_load (builder, addr, dname, is_volatile, 1); + else + values [ins->dreg] = emit_load (ctx, bb, &builder, size, addr, base, dname, is_volatile, LLVM_BARRIER_NONE); if (!is_volatile && (ins->flags & MONO_INST_INVARIANT_LOAD)) { /* @@ -5784,7 +5788,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) values [ins->dreg] = LLVMBuildFPExt (builder, values [ins->dreg], LLVMDoubleType (), dname); break; } - + case OP_STOREI1_MEMBASE_REG: case OP_STOREI2_MEMBASE_REG: case OP_STOREI4_MEMBASE_REG: @@ -5797,6 +5801,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) LLVMTypeRef t; gboolean sext = FALSE, zext = FALSE; gboolean is_volatile = (ins->flags & (MONO_INST_FAULT | MONO_INST_VOLATILE)) != 0; + gboolean is_unaligned = (ins->flags & MONO_INST_UNALIGNED) != 0; if (!values [ins->inst_destbasereg]) { set_failure (ctx, "inst_destbasereg"); @@ -5811,13 +5816,19 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) index = LLVMConstInt (LLVMInt32Type (), ins->inst_offset, FALSE); addr = LLVMBuildGEP (builder, convert (ctx, base, LLVMPointerType (LLVMInt8Type (), 0)), &index, 1, ""); } else { - index = LLVMConstInt (LLVMInt32Type (), ins->inst_offset / size, FALSE); + index = LLVMConstInt (LLVMInt32Type (), ins->inst_offset / size, FALSE); addr = LLVMBuildGEP (builder, convert (ctx, base, LLVMPointerType (t, 0)), &index, 1, ""); } if (is_volatile && LLVMGetInstructionOpcode (base) == LLVMAlloca && !(ins->flags & MONO_INST_VOLATILE)) /* Storing to an alloca cannot fail */ is_volatile = FALSE; - emit_store (ctx, bb, &builder, size, convert (ctx, values [ins->sreg1], t), convert (ctx, addr, LLVMPointerType (t, 0)), base, is_volatile); + LLVMValueRef srcval = convert (ctx, values [ins->sreg1], t); + LLVMValueRef ptrdst = convert (ctx, addr, LLVMPointerType (t, 0)); + + if (is_unaligned) + mono_llvm_build_aligned_store (builder, srcval, ptrdst, is_volatile, 1); + else + emit_store (ctx, bb, &builder, size, srcval, ptrdst, base, is_volatile); break; } @@ -5831,6 +5842,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) LLVMTypeRef t; gboolean sext = FALSE, zext = FALSE; gboolean is_volatile = (ins->flags & (MONO_INST_FAULT | MONO_INST_VOLATILE)) != 0; + gboolean is_unaligned = (ins->flags & MONO_INST_UNALIGNED) != 0; t = load_store_to_llvm_type (ins->opcode, &size, &sext, &zext); @@ -5840,10 +5852,15 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) index = LLVMConstInt (LLVMInt32Type (), ins->inst_offset, FALSE); addr = LLVMBuildGEP (builder, convert (ctx, base, LLVMPointerType (LLVMInt8Type (), 0)), &index, 1, ""); } else { - index = LLVMConstInt (LLVMInt32Type (), ins->inst_offset / size, FALSE); + index = LLVMConstInt (LLVMInt32Type (), ins->inst_offset / size, FALSE); addr = LLVMBuildGEP (builder, convert (ctx, base, LLVMPointerType (t, 0)), &index, 1, ""); } - emit_store (ctx, bb, &builder, size, convert (ctx, LLVMConstInt (IntPtrType (), ins->inst_imm, FALSE), t), convert (ctx, addr, LLVMPointerType (t, 0)), base, is_volatile); + LLVMValueRef srcval = convert (ctx, LLVMConstInt (IntPtrType (), ins->inst_imm, FALSE), t); + LLVMValueRef ptrdst = convert (ctx, addr, LLVMPointerType (t, 0)); + if (is_unaligned) + mono_llvm_build_aligned_store (builder, srcval, ptrdst, is_volatile, 1); + else + emit_store (ctx, bb, &builder, size, srcval, ptrdst, base, is_volatile); break; } @@ -10730,4 +10747,4 @@ MonoCPUFeatures mono_llvm_get_cpu_features (void) cpu_features |= MONO_CPU_INITED; } return cpu_features; -} \ No newline at end of file +} From 6a246d09405a8b2a0c2498f2708f057869ca5c48 Mon Sep 17 00:00:00 2001 From: monojenkins Date: Tue, 7 Jan 2020 23:29:14 +0100 Subject: [PATCH 08/10] [2019-10] [jit] Avoid passing a vtable argument to DIM methods when making calls out of gsharedvt methods. (#18366) * [jit] Avoid passing a vtable argument to DIM methods when making calls out of gsharedvt methods. Fixes https://github.com/mono/mono/issues/18276. --- mono/mini/Makefile.am.in | 2 +- mono/mini/gshared.cs | 31 +++++++++++++++++++++++++++++++ mono/mini/method-to-ir.c | 5 ++--- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/mono/mini/Makefile.am.in b/mono/mini/Makefile.am.in index 5f530661df95..ef744067c87e 100755 --- a/mono/mini/Makefile.am.in +++ b/mono/mini/Makefile.am.in @@ -74,7 +74,7 @@ TOOLS_RUNTIME = MONO_PATH=$(mcs_topdir)/class/lib/build $(top_builddir)/runtime/ INTERP_RUNTIME = $(MINI_RUNTIME) --interpreter RUNTIME_AOTCHECK = MONO_PATH="$(CLASS)$(PLATFORM_PATH_SEPARATOR)." $(RUNTIME_EXECUTABLE) -MCS = CSC_SDK_PATH_DISABLED= $(TOOLS_RUNTIME) $(CSC) -langversion:7.2 -nostdlib -unsafe -nowarn:0162 -nologo -noconfig -r:$(CLASS)/mscorlib.dll -r:$(CLASS)/System.dll -r:$(CLASS)/System.Core.dll +MCS = CSC_SDK_PATH_DISABLED= $(TOOLS_RUNTIME) $(CSC) -langversion:8.0 -nostdlib -unsafe -nowarn:0162 -nologo -noconfig -r:$(CLASS)/mscorlib.dll -r:$(CLASS)/System.dll -r:$(CLASS)/System.Core.dll ILASM = $(TOOLS_RUNTIME) $(mcs_topdir)/class/lib/build/ilasm.exe if !ENABLE_MSVC_ONLY diff --git a/mono/mini/gshared.cs b/mono/mini/gshared.cs index 93a7f5b0f76d..f458de293d55 100644 --- a/mono/mini/gshared.cs +++ b/mono/mini/gshared.cs @@ -2216,6 +2216,14 @@ public static int test_0_open_delegate () { var res = (Nullable)iface.AMethod> (); return res == 42 ? 0 : 1; } + +#if !__MonoCS__ + public static int test_0_gsharedvt_out_dim () { + var c = new Outer(); + c.prop = new H (); + return (c.Foo () == "abcd") ? 0 : 1; + } +#endif } // #13191 @@ -2262,6 +2270,29 @@ public SparseArrayBuilder(bool initialize) : this () { public ArrayBuilder Markers => _markers; } +// #18276 +#if !__MonoCS__ +public class Outer { + public interface ID { + string Foo () { + return null; + } + } + + public ID prop; + + public string Foo () { + return prop?.Foo(); + } +} + +public class H : Outer.ID { + string Outer.ID.Foo () { + return "abcd"; + } +} +#endif + #if !__MOBILE__ public class GSharedTests : Tests { } diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c index 4005bf0c358a..ab4c722f347d 100644 --- a/mono/mini/method-to-ir.c +++ b/mono/mini/method-to-ir.c @@ -7628,16 +7628,15 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b imt_arg = emit_get_rgctx_method (cfg, context_used, cmethod, MONO_RGCTX_INFO_METHOD); g_assert (imt_arg); - /* This is not needed, as the trampoline code will pass one, and it might be passed in the same reg as the imt arg */ - vtable_arg = NULL; } else if (mono_class_is_interface (cmethod->klass) && !imt_arg) { /* This can happen when we call a fully instantiated iface method */ g_assert (will_have_imt_arg); imt_arg = emit_get_rgctx_method (cfg, context_used, cmethod, MONO_RGCTX_INFO_METHOD); g_assert (imt_arg); - vtable_arg = NULL; } + /* This is not needed, as the trampoline code will pass one, and it might be passed in the same reg as the imt arg */ + vtable_arg = NULL; } if ((m_class_get_parent (cmethod->klass) == mono_defaults.multicastdelegate_class) && (!strcmp (cmethod->name, "Invoke"))) From ca47edd56dc110533a9ef8fb60649a521f72c96a Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 8 Jan 2020 08:58:27 -0500 Subject: [PATCH 09/10] [2019-10] Bump msbuild to track mono-2019-10 (#18374) --- packaging/MacSDK/msbuild.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/MacSDK/msbuild.py b/packaging/MacSDK/msbuild.py index 842f62749317..52b8936d1a1b 100644 --- a/packaging/MacSDK/msbuild.py +++ b/packaging/MacSDK/msbuild.py @@ -3,7 +3,7 @@ class MSBuild (GitHubPackage): def __init__ (self): GitHubPackage.__init__ (self, 'mono', 'msbuild', '15', # note: fix scripts/ci/run-test-mac-sdk.sh when bumping the version number - revision = 'ebc1ebc6c51b3240b2eb1d59f1adbb05e2b2538e') + revision = '906089d570bcb33fda0242589decea0313e1f4d9') def build (self): try: From 7b5e2bab9b7b7fc053d641540c94eab2e30b3c29 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 8 Jan 2020 21:00:16 -0500 Subject: [PATCH 10/10] [2019-10] Bump msbuild to track mono-2019-10 --- packaging/MacSDK/msbuild.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/MacSDK/msbuild.py b/packaging/MacSDK/msbuild.py index 52b8936d1a1b..5905eb2b5ab0 100644 --- a/packaging/MacSDK/msbuild.py +++ b/packaging/MacSDK/msbuild.py @@ -3,7 +3,7 @@ class MSBuild (GitHubPackage): def __init__ (self): GitHubPackage.__init__ (self, 'mono', 'msbuild', '15', # note: fix scripts/ci/run-test-mac-sdk.sh when bumping the version number - revision = '906089d570bcb33fda0242589decea0313e1f4d9') + revision = '7a1caeff672da46137139777af78dc8ceeb8633d') def build (self): try: