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.43k stars 151 forks source link

Move ArbitraryPrecisionInteger type to CryptoBoringWrapper module #236

Closed simonjbeaumont closed 2 weeks ago

simonjbeaumont commented 1 month ago

Motivation

Before this PR, the Crypto module had an internal ArbitraryPrecisionInteger type that manages the lifetime of a BoringSSL BIGNUM and exposes several BIGNUM operations. We'd like to make use of this from the _CryptoExtras module and also for code that will run on Darwin platforms.

Modifications

There are a number of other ways this could have been achieved but none of them seemed great given the requirements, specifically:

Result

ArbitraryPrecisionInteger is now in a shared place that can be used from the _CryptoExtras module.

simonjbeaumont commented 1 month ago
  • We require that any import of the CCryptoBoringSSL module is imported using @_implementationOnly.

@Lukasa based on our discussion, we believe that this is not a requirement and that we can actually drop the @_implementationOnly on our imports, which we can front-run in its own, targeted PR?

simonjbeaumont commented 2 weeks ago

@swift-server-bot test this please

Lukasa commented 2 weeks ago

Thanks for this Si, much appreciated.