Граф коммитов

4179 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 08266ac8c0 Refactor code to reduce duplication and number of parenthesis. 2020-10-02 10:36:18 +02:00
Rolf Bjarne Kvinge e2d8af37fa Extract common expresion into a variable to simplify code and reduce the number of parenthesis. 2020-10-02 10:36:18 +02:00
Rolf Bjarne Kvinge 102c92088f Rearrange parenthesis to fix an IndexOutOfRangeException that occured because the 'start > 0' condition didn't cover the entire expression. 2020-10-02 10:36:18 +02:00
Rolf Bjarne Kvinge 1b3c820405 Fix skipping null entries in the custom attribute table. Fixes #19.
The custom attribute table is sorted, but it may contain null entries, which
should be skipped. Teach the BinarySearch algorithm to skip those null entries.
2020-10-01 19:34:12 +02:00
Zoltan Varga 26d148421c
Merge pull request #18 from mono/unmanaged-cconv
Add support for the unmanaged (0x9) calling convention from .net core.
2020-07-15 05:27:08 -04:00
Zoltan Varga 18355d7d67 Add support for the unmanaged (0x9) calling convention from .net core. 2020-07-15 05:25:36 -04:00
Zoltan Varga 8362227c5b
Merge pull request #16 from vargaz/fix-type-init
Pass DeclaredOnly to GetConstructorImpl (). This fixes crashes when running ikdasm on modules which have global types/methods.
2020-03-28 15:14:18 -04:00
Zoltan Varga 26a033ed9d Pass DeclaredOnly to GetConstructorImpl (). This fixes crashes when running ikdasm on modules which have global types/methods. 2020-03-28 16:22:15 -04:00
Jonathan Peppers 9f805dcf8a [reflect] fix more usage of SHA1Managed for FIPS (#14)
In e9946684, I fixed the usage of `SHA1Managed` that I found from a stack trace while running `mkbundle.exe` on Windows.

I found 3 more usages that needed to be fixed.
2019-10-03 17:34:41 +02:00
Jonathan Peppers e9946684f0 [reflect] use SHA1.Create() to support FIPS (#13)
Context: https://github.com/xamarin/xamarin-android/pull/3728#issuecomment-537762227

On Windows 10 machines with the [Use FIPS compliant algorithms][0] group
policy enabled, `mkbundle` fails with:

    C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\mkbundle.exe --dos2unix=false --nomain --i18n none --bundled-header --mono-api-struct-path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\\mkbundle-api.h" --style linux -c -o obj\Release\bundles\x86_64\temp.c -oo obj\Release\bundles\x86_64\assemblies.o -z obj\Release\android\assets\UnnamedProject.dll obj\Release\android\assets\shrunk\Java.Interop.dll obj\Release\android\assets\shrunk\Mono.Android.dll obj\Release\android\assets\shrunk\mscorlib.dll obj\Release\android\assets\shrunk\System.Core.dll obj\Release\android\assets\shrunk\System.dll obj\Release\android\assets\shrunk\System.Runtime.Serialization.dll (TaskId:215)
    Unhandled Exception: System.InvalidOperationException: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms. (TaskId:215)
       at System.Security.Cryptography.SHA1Managed..ctor() (TaskId:215)
       at IKVM.Reflection.AssemblyName.ComputePublicKeyToken(Byte[] publicKey) (TaskId:215)
       at IKVM.Reflection.AssemblyName.get_FullName() (TaskId:215)
       at IKVM.Reflection.Universe.LoadAssembly(RawModule module) (TaskId:215)
       at IKVM.Reflection.Universe.LoadFile(String path) (TaskId:215)
       at MakeBundle.LoadAssemblyFile(String assembly) (TaskId:215)
       at MakeBundle.LoadAssemblies(List`1 sources) (TaskId:215)
       at MakeBundle.Main(String[] args) (TaskId:215)

On a FIPS-enabled machine, these code examples:

    var sha1 = new SHA1Managed();

Will throw:

    System.InvalidOperationException:
        This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.

But these three options work:

    var sha1 = SHA1.Create();
    var sha1 = new SHA1CryptoServiceProvider();
    var sha1 = new SHA1Cng();

We should use `SHA1.Create()` which will use the appropriate
implementation if FIPS is enabled or not.

Since the `PublicKeyToken` of a .NET assembly is a SHA1 value, there
is not really another option--we have to make this change for
`mkbundle.exe` to work.

[0]: https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/system-cryptography-use-fips-compliant-algorithms-for-encryption-hashing-and-signing
2019-10-03 17:21:46 +02:00
Zoltan Varga caa8e7f542 Allow cattrs on generic param constraints, recent roslyn versions seems to generate them. 2019-08-29 13:08:44 -04:00
Joao Matos f9c1e2fec0 Revert "Make MethodBase.ParameterCount public as we need to use it in Embeddinator."
This reverts commit c1d0dec3cf.
2017-08-18 13:34:57 +01:00
Joao Matos c1d0dec3cf Make MethodBase.ParameterCount public as we need to use it in Embeddinator. 2017-08-18 13:30:09 +01:00
Marek Safar 847e05fced TypeBuilder layout is not set when pack and size are not set 2017-05-23 00:32:53 +02:00
Joao Matos 9befae38e1 Make assembly default resolver public so we can fallback to it when using custom resolvers. 2017-03-22 20:55:31 +00:00
Marek Safar 7c1e61bec8 Handle types without a name (invalid, but created by some obfuscator). 2017-02-22 11:18:03 +01:00
Marek Safar 367864ef81 Update list of known FX assemblies 2016-10-12 14:34:40 +02:00
Marek Safar 03c3e32193 Merge pull request #11 from knocte/fix-build-with-mono4.2.1
Fix MSBuild build with xbuild 12.0 engine (mono 4.2.1)
2016-10-06 09:50:59 +02:00
Andres G. Aragoneses 22aec77297 Fix MSBuild build with xbuild 12.0 engine (mono 4.2.1)
If anyone tried to build IKVM.Reflection with the xbuild 12.0
engine that comes with mono 4.2.1 [1] (quite widespread given
that it's the version bundled with Ubuntu 16.04.x LTS), the
build would not work.

This change similar to this recent commit in MonoAddins:
a3efa4ca9f

[1] $ mono --version
Mono JIT compiler version 4.2.1 (Debian 4.2.1.102+dfsg2-7ubuntu4)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug
	LLVM:          supported, not enabled.
	GC:            sgen
2016-10-06 13:39:53 +08:00
Marek Safar 9f44f259bf Fixes FX assemblies unification with different build and revision versions.
This happens for PCL assemblies like System.Runtime which already exists in
versions 4.0.0.0, 4.0.10.0, 4.0.20.0
2016-06-09 10:22:22 +02:00
Marek Safar 163b37483c Fixes a warning 2016-06-01 13:41:09 +02:00
Marek Safar 946119c30a Add mcs required DisableDefaultAssembliesLookup option 2016-06-01 13:36:24 +02:00
Zoltan Varga 1f93971046 Add preliminary support for reading portable pdb files. 2016-04-05 17:34:28 -04:00
Miguel de Icaza 00252c18fc Remove the parts of IKVM that we do not use 2016-02-27 15:24:45 -05:00
jfrijters d6b00edf21 Use uint for file position to support >2GB files. Note that PE spec says that 2GB is the maximum valid size. 2015-08-27 12:15:44 +00:00
jfrijters 9d164ede04 Don't report IPv4 addresses on interfaces that aren't up. This matches JDK behavior. 2015-08-27 12:10:10 +00:00
jfrijters 532a385037 Use "wlan" prefix for wireless network interface names. 2015-08-27 12:08:24 +00:00
jfrijters 5178e7cb0b Implemented atomic file move (on Windows). 2015-08-26 10:19:11 +00:00
jfrijters b720ca0eaa Fix for #303. Don't crash when trying to get interfaces from type from missing assembly reference. 2015-08-26 10:08:40 +00:00
jfrijters bfc10b1cf3 Skip custom modifiers in MethodSpec. 2015-07-07 07:42:00 +00:00
jfrijters 2299e0e8f3 Improved -removeassertions ikvmc optimization to remove more code (esp. allow otherwise empty <clinit> methods to be optimized away). 2015-07-02 07:21:17 +00:00
jfrijters 5120f4f902 Unforked sun/awt/SunToolkit.java. 2015-06-30 11:51:02 +00:00
jfrijters c22de7172c Improved IsSideEffectFreeStaticInitializerOrNoop() to handle needless zero/null initialization of static fields. Removed bogus handling of incorrect return statements. 2015-06-30 10:18:05 +00:00
jfrijters df9cc5fb8d Reduced the number of differences between upstream and our version of java/lang/System.java. 2015-06-30 07:44:52 +00:00
jfrijters 8bfa5867bc Cleaned up static initializer optimization to use FieldWrapper.IsSerialVersionUID. 2015-06-29 10:15:15 +00:00
jfrijters 7aaec37765 Added FieldWrapper.IsSerialVersionUID property to properly (and consistently) detect serialVersionUID fields. 2015-06-29 10:12:11 +00:00
jfrijters 51969ec73b Emit warning if property getter/setter is missing. 2015-06-29 10:06:14 +00:00
jfrijters 174e87b1da Use new "native" method field binding support to avoid reflection. 2015-06-29 09:59:13 +00:00
jfrijters c3fea8fff4 Added MethodWrapper.IsClassInitializer and use it and IsConstructor instead of name comparisons. 2015-06-29 09:56:13 +00:00
jfrijters 31737736c5 RNGCryptoServiceProvider should be disposed on .NET 4. 2015-06-29 09:43:16 +00:00
jfrijters cde423eea0 Minor clean up of UAC detection. 2015-06-29 09:41:44 +00:00
jfrijters 8ec0c04c96 Use (cheaper) InterlockedCompareAndSet "native" method instead of AtomicReferenceFieldUpdater. 2015-06-26 14:58:40 +00:00
jfrijters b2ddeb8b16 Unforked java/net/SocketInputStream.java and java/net/SocketOutputStream.java. 2015-06-26 14:41:57 +00:00
jfrijters 7a84420150 Unforked java/io/FileInputStream.java, java/io/FileOutputStream.java and java/io/RandomAccessFile.java. 2015-06-26 11:37:04 +00:00
jfrijters 5e22345306 Added support for automatically passing in fields to "native" methods. 2015-06-26 11:26:44 +00:00
jfrijters c48633571a Moved unused field removal optimization to a later stage in the compilation. Also made the check more strict to only remove final fields and not remove fields that have annotations. 2015-06-26 11:22:19 +00:00
jfrijters 47041319ef Extract Windows version from kernel32.dll to avoid version lie. 2015-06-25 13:59:10 +00:00
jfrijters 196572bb11 Moved ClassSerializationProxy into its own source file. 2015-06-25 13:30:11 +00:00
jfrijters 439a2d3f99 No need to explicitly capture thread reference in Cleanup object, as it's an inner class. 2015-06-25 13:14:36 +00:00
jfrijters 4324ccfcad Updated reference to OpenJDK 8u45. 2015-06-25 13:13:39 +00:00