Skip to content

crossgen2 fails on FIPS enabled systems (due to MD5 hashing) #94786

Closed

Description

@tmds

crossgen2 fails on FIPS enabled systems due to it using an MD5 hash.

  Emitting R2R PE file: /home/tester/runtime/artifacts/bin/coreclr/linux.x64.Release/System.Private.CoreLib.dll
Error : error : 060800C8:digital envelope routines:EVP_DigestInit_ex:disabled for FIPS [/home/tester/runtime/src/coreclr/crossgen-corelib.proj]
Interop+Crypto+OpenSslCryptographicException : error : 060800C8:digital envelope routines:EVP_DigestInit_ex:disabled for FIPS [/home/tester/runtime/src/coreclr/crossgen-corelib.proj]
     at System.Security.Cryptography.HashProviderDispenser.OneShotHashProvider.HashData(String hashAlgorithmId, ReadOnlySpan`1 source, Span`1 destination)
     at System.Security.Cryptography.MD5.TryHashData(ReadOnlySpan`1 source, Span`1 destination, Int32& bytesWritten)
     at System.Security.Cryptography.MD5.HashData(ReadOnlySpan`1 source, Span`1 destination)
     at System.Security.Cryptography.MD5.HashData(ReadOnlySpan`1 source)
     at System.Security.Cryptography.MD5.HashData(Byte[] source)
     at ILCompiler.Diagnostics.PerfMapWriter.PerfMapV1SignatureHelper(IEnumerable`1 inputAssemblies, TargetDetails details) in /home/tester/runtime/src/coreclr/tools/aot/ILCompiler.Diagnostics/PerfMapWriter.cs:line 104
     at ILCompiler.DependencyAnalysis.ReadyToRunObjectWriter.EmitPortableExecutable() in /home/tester/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs:line 373
     at ILCompiler.ReadyToRunCodegenCompilation.Compile(String outputFile) in /home/tester/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilation.cs:line 400
     at ILCompiler.Program.RunSingleCompilation(Dictionary`2 inFilePaths, InstructionSetSupport instructionSetSupport, String compositeRootPath, Dictionary`2 unrootedInputFilePaths, HashSet`1 versionBubbleModulesHash, ReadyToRunCompilerContext typeSystemContext, Logger logger) in /home/tester/runtime/src/coreclr/tools/aot/crossgen2/Program.cs:line 637
     at ILCompiler.Program.Run() in /home/tester/runtime/src/coreclr/tools/aot/crossgen2/Program.cs:line 302
     at ILCompiler.Crossgen2RootCommand.<>c__DisplayClass205_0.<.ctor>b__0(ParseResult result) in /home/tester/runtime/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs:line 261
/home/tester/runtime/src/coreclr/crossgen-corelib.proj(145,5): error MSB3073: The command "/home/tester/runtime/dotnet.sh /home/tester/runtime/artifacts/bin/coreclr/linux.x64.Release/x64/crossgen2/tools/crossgen2.dll -o:/home/tester/runtime/artifacts/bin/coreclr/linux.x64.Release/System.Private.CoreLib.dll -r:/home/tester/runtime/artifacts/bin/coreclr/linux.x64.Release/IL/*.dll --targetarch:x64 --targetos:linux -O /home/tester/runtime/artifacts/bin/coreclr/linux.x64.Release/IL/System.Private.CoreLib.dll --perfmap-format-version:1 --perfmap --perfmap-path:/home/tester/runtime/artifacts/bin/coreclr/linux.x64.Release/" exited with code 1.

Can another hash algorithm be used? Or is it possible to not add the signature hash when MD5 is not allowed?

cc @hoyosjs @jkotas @bartonjs @omajid

Activity

  1. ghost added
    untriaged
    on Nov 15, 2023
  2. jkotas commented on Nov 15, 2023

    @jkotas
    Member

    Can another hash algorithm be used?

    I think so. I do not see any dependencies on this particular hash algorithm in the tools that consume perfmap files. @hoyosjs @tommcdon Do you agree?

  3. tmds commented on Nov 20, 2023

    @tmds
    MemberAuthor

    @vcsjones Since this issue reproduces with #94934 included (which is about being more permissive about MD5 on FIPS), I don't think that PR is meant to affect this usage. Is that right?

  4. jkotas commented on Nov 20, 2023

    @jkotas
    Member

    this issue reproduces with #94934 included

    Make sure that you are testing it with live build of the runtime. crossgen2 does not always use live build of the runtime.

  5. vcsjones commented on Nov 20, 2023

    @vcsjones
    Member

    Since this issue reproduces with #94934 included

    That is surprising. It should not, unless crossgen2 is not using the "live" built runtime from the repository.

    The intention of that PR is that .NET should be able to use MD5 freely, regardless of the FIPS configuration.

  6. tmds commented on Nov 21, 2023

    @tmds
    MemberAuthor

    Yes, as you suspected, crossgen wasn't using the live built runtime.

    When using a runtime that includes #94934, crossgen2 is now working under FIPS.

    Thanks!

  7. ghost removed
    untriaged
    on Nov 21, 2023
  8. locked and limited conversation to collaborators on Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions