Skip to content

[NativeAOT] Link runtime crypto archive directly - #12372

Merged
jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers-stop-copying-nativeaot-crypto
Aug 13, 2026
Merged

jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers-stop-copying-nativeaot-crypto

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Summary

  • link libSystem.Security.Cryptography.Native.Android.a directly from the SDK-resolved NativeAOT runtime pack
  • stop downloading and copying the archive into Microsoft.Android.Runtime.NativeAOT packs
  • add an on-device AES encrypt/decrypt round-trip test to the existing NativeAOT lane

Testing

  • built and installed Mono.Android.NET-Tests with PublishAot=true and the trimmable typemap
  • passed AesEncryptDecryptRoundTrip on a connected Android device
  • confirmed AndroidCryptoNative_CipherCreate, AndroidCryptoNative_CipherUpdate, and AndroidCryptoNative_CipherFinalEx are linked into the arm64 application shared library

Use the System.Security.Cryptography.Native.Android archive supplied by the SDK-resolved NativeAOT runtime pack instead of downloading and copying it into the Android runtime pack. Add an on-device AES round-trip test that runs in the NativeAOT lane.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: d4663df0-3e70-40ba-94f8-ffe73104f480

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the NativeAOT build/link pipeline to rely on the SDK-resolved NativeAOT runtime pack for libSystem.Security.Cryptography.Native.Android.a (instead of downloading/copying it into Microsoft.Android.Runtime.NativeAOT packs), and adds a device-level AES encrypt/decrypt round-trip test to validate the crypto archive is correctly linked in NativeAOT apps.

Changes:

  • Add an on-device AesEncryptDecryptRoundTrip test in the Mono.Android test app, categorized for NativeAOT crypto validation.
  • Remove the special-case MSBuild logic and pack-production steps that downloaded/copied libSystem.Security.Cryptography.Native.Android.a into Microsoft.Android.Runtime.NativeAOT packs.
  • Simplify workload provisioning by dropping explicit PackageDownload entries for the NativeAOT Android runtime packs.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/Mono.Android-Tests/Mono.Android-Tests/System.Security.Cryptography/CryptographyTest.cs Adds AES encrypt/decrypt round-trip smoke test intended to validate NativeAOT crypto linking on-device.
tests/Mono.Android-Tests/Mono.Android-Tests/Mono.Android.NET-Tests.csproj Includes the new cryptography test source file in the test app build.
src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.NativeAOT.targets Removes the explicit swap-in of the crypto archive from the Android runtime pack directory, relying on @(NativeLibrary) instead.
src/workloads/workloads.csproj Stops pre-downloading the NativeAOT Android runtime packs as part of workload provisioning.
src/native/native.targets Removes copying the crypto archive from the NativeAOT runtime pack into the Microsoft.Android.Runtime.NativeAOT pack output.
build-tools/create-packs/Microsoft.Android.Runtime.proj Stops packaging the crypto archive into Microsoft.Android.Runtime.NativeAOT packs during pack creation.

@jonathanpeppers
jonathanpeppers merged commit 4a2e2fa into main Aug 13, 2026
45 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-stop-copying-nativeaot-crypto branch August 13, 2026 22:19
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants