Skip to content

[illink] Try to avoid System.Security.Cryptography.Primitives in linked apk #5451

Closed

Description

@radekdoulik

Part of System.Security.Cryptography.Primitives.dll is preserved in linked simple XA apps.

Linker analyzer output:

--- Module:System.Security.Cryptography.Primitives.dll dependencies ----
Dependency #1
        Module:System.Security.Cryptography.Primitives.dll
        | TypeDef:System.Security.Cryptography.HashAlgorithm [12 deps]
        | TypeDef:Java.Interop.Tools.JavaCallableWrappers.Crc64 [9 deps]
        | Method:System.String Java.Interop.Tools.TypeNameMappings.JavaNativeTypeManager::GetPackageName(System.Type) [1 deps]
        | Method:System.String Java.Interop.Tools.TypeNameMappings.JavaNativeTypeManager::ToJniName(System.Type,Java.Interop.ExportParameterKind) [2 deps]
        | Method:System.String Java.Interop.Tools.TypeNameMappings.JavaNativeTypeManager::ToJniName(System.Type) [3 deps]
        | Method:System.String Android.Runtime.JNIEnv::GetJniName(System.Type) [2 deps]
        | Method:System.Void Java.Interop.TypeManager::RegisterType(System.String,System.Type) [2 deps]
        | Method:System.Void Android.Runtime.JNIEnv::RegisterJniNatives(System.IntPtr,System.Int32,System.IntPtr,System.IntPtr,System.Int32) [1 deps]
        | Other:C:\Users\rodo\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.win-x64\11.0.100-ci.master.316\targets\..\PreserveLists\Mono.Android.xml

So it looks like it is only preserved through JavaNativeTypeManager::GetPackageName.

The Java.Interop.Tools.JavaCallableWrappers.Crc64 type is based on System.Security.Cryptography.HashAlgorithm.

That was useful, when we provided choice between md5 and crc64 for JCW names. We don't provide md5 anymore, so we don't really need to base it on System.Security.Cryptography.HashAlgorithm for JavaNativeTypeManager::GetPackageName.

Activity

  1. self-assigned this
    on Dec 29, 2020
  2. added this to the One .NET milestone on Dec 29, 2020
  3. added a commit that references this issue on Jan 4, 2021
  4. added a commit that references this issue on Jan 5, 2021
  5. modified the milestones: .NET 6, .NET 7 on Jun 14, 2021
  6. modified the milestones: .NET 7, .NET 8 on Jul 27, 2022
  7. jonathanpeppers commented on Mar 27, 2023

    @jonathanpeppers
    Member

    System.Security.Cryptography.Primitives.dll is not present in .NET 8 apps:

      [1/8] System.Runtime.dll -> System.Runtime.dll.so
      [2/8] test1.dll -> test1.dll.so
      [3/8] System.Console.dll -> System.Console.dll.so
      [4/8] System.Runtime.InteropServices.dll -> System.Runtime.InteropServices.dll.so
      [5/8] System.Linq.dll -> System.Linq.dll.so
      [6/8] Mono.Android.dll -> Mono.Android.dll.so
      [7/8] Java.Interop.dll -> Java.Interop.dll.so
      [8/8] System.Private.CoreLib.dll -> System.Private.CoreLib.dll.so
    

    I think we can just close.

  8. ghost locked as resolved and limited conversation to collaborators on Apr 26, 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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions