Skip to content

No usable version of libssl was found on Apple Silicon M1 Mac  #54597

Closed

Description

@younghoandrewchaa

Code in Azure function breaks locally on M1 Mac when AesGCM does Decrypt

Description

This is the part of the code that breaks

using var cipher = new AesGcm(key);
cipher.Decrypt(nonce, toDecrypt, tag, decryptedData, associatedData);

I have installed openssl and set DYLD_LIBRARY_PATH in ~/.zshrc
It worked on Intel-based Mac, but breaks still on arm-based M1 Mac.

Configuration

  • netcoreapp3.1
  • OS Version: Mac OS Big Sur Version 11.4, (Apple M1), 16 GB
  • Architecture: arm
  • openssl version: LibreSSL 2.8.3, [email protected]

Can anyone help please? This seems to be the only issue that stops me from developing in .NET on M1 Mac.

Activity

  1. ghost added
    untriaged
    on Jun 23, 2021
  2. vcsjones commented on Jun 23, 2021

    @vcsjones
    Member

    Can you make sure that the openssl you installed via homebrew is x86-64, not arm64? It can be confirmed with a command like:

    otool -vh /opt/path/to/openssl/from/homebrew/[email protected]/lib/libcrypto.1.1.dylib
    

    The mach header should indicate what architecture it was built for:

    Mach header
          magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
    MH_MAGIC_64  X86_64        ALL  0x00       DYLIB    14       1720   NOUNDEFS DYLDLINK TWOLEVEL NO_REEXPORTED_DYLIBS
    

    If it indicates an architecture other than X86_64, then you should re-install openssl with homebrew to make sure you get the right architecture.

  3. bartonjs commented on Jun 23, 2021

    @bartonjs
    Member

    @vcsjones I'm confused. They said they were running on an arm64 device, so wouldn't arm64 libcrypto/libssl be the right answer and x86_64 the wrong answer?

  4. vcsjones commented on Jun 23, 2021

    @vcsjones
    Member

    @bartonjs

    netcoreapp3.1

    They said they are running .NET Core 3.1, there is no macOS ARM64 build of the runtime for .NET Core 3.1, so I would assume they are running in Rosetta 2 (x64 compat mode). You can't load an ARM64 library in to an x86_64 process.

  5. bartonjs commented on Jun 23, 2021

    @bartonjs
    Member

    Ooooh, tricky, tricky.

  6. younghoandrewchaa commented on Jun 23, 2021

    @younghoandrewchaa
    Author

    @vcsjones Thanks a lot. I've checked and it's ARM64

    ./libcrypto.1.1.dylib:
    Mach header
          magic  cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
    MH_MAGIC_64    ARM64        ALL  0x00       DYLIB    15       1816   NOUNDEFS DYLDLINK TWOLEVEL NO_REEXPORTED_DYLIBS
    

    I'll try to install X86_64 openssl

    after an hour and lots of hair pulling, I managed to install X86_64 version of openssl and it worked. I had to use iTerm on Resetta 2 and X86_64 version of brew.

    Many thanks. Now I can use the new shiny M1 macbook for .NET coding!

  7. ghost locked as resolved and limited conversation to collaborators on Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Securityuntriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions