concrete icon indicating copy to clipboard operation
concrete copied to clipboard

feat(csprng): Native AES for Apple Silicon

Open tmontaigu opened this issue 3 years ago • 0 comments

Please check if the PR fulfills these requirements

(please use '[x]' to check the checkboxes, or submit the PR and then click the checkboxes)

  • [ ] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been added / updated (for bug fixes / features)
  • [x] The PR description links to the related issue (to link an issue, use '#XXX'.)
  • [ ] The tests on AWS have been launched and are successful (apply the aws_label to the PR to launch the tests on AWS)
  • [ ] The draft release description has been updated

Resolves: zama-ai/concrete-core-internal#117

Description

The goal is to support AppleSilicon chip natively in concrete-csprng.

This implements AES encryption using aarch64 native instructions from the aes and neon features which are part of the ARMv8.0-A spec.

However, the x86_64 rdseed feature only has an equivalent in ARMv8.5-A, and M1 chip are ARMv8.4-A and Rust does not seem to expose this feature in the core::arch::aarch64.

So we use the Apple specific API to generate cryptographically secure random numbers instead.

There is one drawback however: This change requires nightly to be compiled (but only on Apple Silicon macs)

tmontaigu avatar Nov 12 '21 09:11 tmontaigu