apple / swift-crypto

Open-source implementation of a substantial portion of the API of Apple CryptoKit suitable for use on Linux platforms.
https://apple.github.io/swift-crypto
Apache License 2.0
1.47k stars 166 forks source link

wrapper: Move EC types and random bytes into CryptoBoringWrapper #277

Closed simonjbeaumont closed 1 month ago

simonjbeaumont commented 1 month ago

Motivation

The Crypto module contains some EC types used to implement the CryptoKit API on non-Darwin platforms, which we'd like to make available to functionality in _CryptoExtras on all platforms.

Modifications

In a similar manner to how we handled ArbitraryPrecisionInteger, this PR moves the EC types, which were internal to the Crypto module, to the CryptoBoringWrapper module, and makes them package visible.

This patch only exposes the functionality that's actually used by the Crypto module as package-visible, and leaves everything else internal (now internal to the CryptoBoringWrapper module).

As part of the move, the _boring suffix has been removed, since that is implied by their presence in this module. This PR also retroactively removes that suffix from the other files that migrated over recently but erroneously retained their suffix.

Finally, we remove some redundant compilation guards on the tests for files that were previously moved into CryptoBoringWrapper since they are intended to run on all platforms now.

Result

This should have no external impact and is purely a refactor.

simonjbeaumont commented 1 month ago

@Lukasa PTAL 🙏