You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ILAsm should generate assemblies that are valid for binskim #108627
Re: SHA-256 support, #85344 included some work to add it for non-Windows platforms, though the main blocker seemed to be finding an implementation(s) to take a dependency on so we don't have to roll our own.
The agreed upon plan was (quoting from the conversation with .NET Security Team):
Use the Windows API like I mentioned before.
OSX does have their own lib to do this, just will need to dig in to figure out exactly where/what it is. Will look at what we do for .NET Crypto.
For linux, we are going to use OpenSSL, but not take a hard dependency on it, meaning that if OpenSSL doesn't exist on the box, then they cannot use the deterministic flag. Warn if OpenSSL is not present.
For linux, we are going to use OpenSSL, but not take a hard dependency on it, meaning that if OpenSSL doesn't exist on the box, then they cannot use the deterministic flag. Warn if OpenSSL is not present.
Can we assume OpenSSL will be available on the build machine? Or would we want to make the SHA-256 implementation unavailable when building without OpenSSL installed? I'm hesitant about introducing a new dependency for building the repo.
but not take a hard dependency on it, meaning that if OpenSSL doesn't exist on the box, then they cannot use the deterministic flag. Warn if OpenSSL is not present.
There might be some narrow circumstances where is it possible to do something with a .NET application without OpenSSL present, but build machines will generally have it, as building .NET requires it.
ilasm dependency on OpenSSL should have the same characteristics as the .NET runtime (System.Security managed APIs) dependency on OpenSSL:
For Microsoft (aka portable) builds, it should load whatever OpenSSL is installed on the system, it should not be hardcoded to one specific OpenSSL version
For source build builds, it should be directly bound against OpenSSL provided by the system
For System.Security managed APIs, this logic is implemented by native shim https://github.com/dotnet/runtime/tree/main/src/native/libs/System.Security.Cryptography.Native . You may want to reuse the implementation for ilasm since it is not exactly trivial. For example, instead of calling OpenSSL from ilasm directly, call the CryptoNative_ shim method from ilasm to perform the crypto operations and statically link the System.Security.Cryptography.Native shim into ilasm to deal with OpenSSL loading.
With #109091 merged in, ILAsm now emits PDB checksums hashed with SHA256. @Newrad0603 do you still need BinSkim compliance in the .NET Framework version of ILAsm?
@amanasifkhalid I was able to make a combination of tools and settings work to unblock my scenario for NetFx, so for now I no longer need support backported to NetFx ILAsm. Thanks for checking!
Activity
dotnet-policy-service commentedon Oct 7, 2024
Tagging subscribers to this area: @JulieLeeMSFT
See info in area-owners.md if you want to be subscribed.
JulieLeeMSFT commentedon Oct 8, 2024
cc @amanasifkhalid, @AndyAyersMS.
amanasifkhalid commentedon Oct 8, 2024
Re: SHA-256 support, #85344 included some work to add it for non-Windows platforms, though the main blocker seemed to be finding an implementation(s) to take a dependency on so we don't have to roll our own.
JulieLeeMSFT commentedon Oct 8, 2024
JanK commented to contact the .NET Security Team.
jkotas commentedon Oct 8, 2024
The agreed upon plan was (quoting from the conversation with .NET Security Team):
vcsjones commentedon Oct 11, 2024
The implementation is here, but we have some abstraction on top of it. https://github.com/dotnet/runtime/blob/main/src/native/libs/System.Security.Cryptography.Native.Apple/pal_digest.c
Here is a more straightforward example of using Apple's APIs.
amanasifkhalid commentedon Oct 22, 2024
Can we assume OpenSSL will be available on the build machine? Or would we want to make the SHA-256 implementation unavailable when building without OpenSSL installed? I'm hesitant about introducing a new dependency for building the repo.
vcsjones commentedon Oct 22, 2024
Generally, OpenSSL is a hard dependency for .NET on Linux. We abort when we cannot find it.
runtime/src/native/libs/System.Security.Cryptography.Native/opensslshim.c
Lines 175 to 181 in 10ee2b1
It should be reasonable to expect OpenSSL to be present on any Linux system which .NET is expected to run on.
(libssl being one of the libraries part of OpenSSL, the other being libcrypto. We require both)
vcsjones commentedon Oct 22, 2024
@jkotas did say
There might be some narrow circumstances where is it possible to do something with a .NET application without OpenSSL present, but build machines will generally have it, as building .NET requires it.
jkotas commentedon Oct 22, 2024
ilasm dependency on OpenSSL should have the same characteristics as the .NET runtime (System.Security managed APIs) dependency on OpenSSL:
For System.Security managed APIs, this logic is implemented by native shim https://github.com/dotnet/runtime/tree/main/src/native/libs/System.Security.Cryptography.Native . You may want to reuse the implementation for ilasm since it is not exactly trivial. For example, instead of calling OpenSSL from ilasm directly, call the
CryptoNative_shim method from ilasm to perform the crypto operations and statically link the System.Security.Cryptography.Native shim into ilasm to deal with OpenSSL loading.amanasifkhalid commentedon Jan 23, 2025
With #109091 merged in, ILAsm now emits PDB checksums hashed with SHA256. @Newrad0603 do you still need BinSkim compliance in the .NET Framework version of ILAsm?
Newrad0603 commentedon Jan 23, 2025
@amanasifkhalid I was able to make a combination of tools and settings work to unblock my scenario for NetFx, so for now I no longer need support backported to NetFx ILAsm. Thanks for checking!
amanasifkhalid commentedon Jan 23, 2025
Glad to hear that! I don't think there's anything else needed here.