mirror of
https://github.com/apple/swift-crypto
synced 2026-11-24 04:37:48 +00:00
3.13.2
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
93a2ebfad7 |
Add API for ARC(P-256) and deprecate ARC(P-384) (#374)
## Motivation The ARC IETF draft has been updated to now support P256 and drop support for P384. ## Modifications - Update the internal ARC implementation to accommodate multiple curves - Add API surface for P256 - Deprecate API for P384 - Add tests for P256 with test vectors from the draft - Move over the end-to-end API tests to P256 - Add benchmarks for P256 ## Result - New API `P256._ARCV1`, which provides an implementation of ARC(P-256). - Deprecate `P384._ARCV1`, which provides an implementation of ARC(P-256). [^1]: https://chris-wood.github.io/draft-arc/draft-yun-cfrg-arc.html#name-arcv1-p256 --------- Co-authored-by: Cory Benfield <lukasa@apple.com> |
||
|
|
5bd06ee1d2 |
Drop Swift 5.9 (#353)
Motivation: Swift 5.9 is no longer supported, we should bump the tools version and remove it from our CI. Modifications: * Bump the Swift tools version to Swift 5.10 * Remove Swift 5.9 jobs where appropriate in main.yml, pull_request.yml Result: Code reflects our support window. |
||
|
|
6db5a75258 |
perf: Add benchmarks and reduce allocations by ~50% for ARC and VOPRF (#346)
### Motivation We've recently added some EC operations internally to support some schemes, including ARC and VOPRF. Some of this code is quite allocation-heavy, which could be avoided with some minimally invasive changes. ### Modifications - Add package benchmarks for ARC and VOPRF. - Make use of the `consuming` keyword in some targeted places to reduce allocations in arithmetic- and append-chains. - Use a Thread-/Task-local FiniteFieldArithmeticContext for EC operations, and thread this through as a `BN_CTX` to BoringSSL functions when available. - Replace EC static computed properties with stored properties for things that are statically knowable about the EC group. ### Result This has resulted in a 50% reduction in allocations for ARC issuance and VOPRF evaluation, and a 34% reduction in ARC verification. ```none SwiftCryptoBenchmarks ============================================================================================================================ ---------------------------------------------------------------------------------------------------------------------------- arc-issue-p384 metrics ---------------------------------------------------------------------------------------------------------------------------- ╒══════════════════════════════════════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╕ │ Malloc (total) * │ p0 │ p25 │ p50 │ p75 │ p90 │ p99 │ p100 │ Samples │ ╞══════════════════════════════════════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡ │ alpha │ 945 │ 945 │ 945 │ 945 │ 945 │ 945 │ 945 │ 3 │ ├──────────────────────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤ │ beta │ 464 │ 464 │ 464 │ 464 │ 464 │ 464 │ 464 │ 3 │ ├──────────────────────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤ │ Δ │ -481 │ -481 │ -481 │ -481 │ -481 │ -481 │ -481 │ 0 │ ├──────────────────────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤ │ Improvement % │ 51 │ 51 │ 51 │ 51 │ 51 │ 51 │ 51 │ 0 │ ╘══════════════════════════════════════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╛ ---------------------------------------------------------------------------------------------------------------------------- arc-verify-p384 metrics ---------------------------------------------------------------------------------------------------------------------------- ╒══════════════════════════════════════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╕ │ Malloc (total) * │ p0 │ p25 │ p50 │ p75 │ p90 │ p99 │ p100 │ Samples │ ╞══════════════════════════════════════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡ │ alpha │ 410 │ 410 │ 410 │ 415 │ 415 │ 415 │ 415 │ 10 │ ├──────────────────────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤ │ beta │ 271 │ 271 │ 271 │ 275 │ 275 │ 275 │ 275 │ 10 │ ├──────────────────────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤ │ Δ │ -139 │ -139 │ -139 │ -140 │ -140 │ -140 │ -140 │ 0 │ ├──────────────────────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤ │ Improvement % │ 34 │ 34 │ 34 │ 34 │ 34 │ 34 │ 34 │ 0 │ ╘══════════════════════════════════════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╛ ---------------------------------------------------------------------------------------------------------------------------- voprf-evaluate-p384 metrics ---------------------------------------------------------------------------------------------------------------------------- ╒══════════════════════════════════════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╕ │ Malloc (total) * │ p0 │ p25 │ p50 │ p75 │ p90 │ p99 │ p100 │ Samples │ ╞══════════════════════════════════════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡ │ alpha │ 331 │ 331 │ 331 │ 331 │ 331 │ 331 │ 331 │ 3 │ ├──────────────────────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤ │ beta │ 168 │ 168 │ 168 │ 168 │ 168 │ 168 │ 168 │ 3 │ ├──────────────────────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤ │ Δ │ -163 │ -163 │ -163 │ -163 │ -163 │ -163 │ -163 │ 0 │ ├──────────────────────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤ │ Improvement % │ 49 │ 49 │ 49 │ 49 │ 49 │ 49 │ 49 │ 0 │ ╘══════════════════════════════════════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╛ ``` --------- Co-authored-by: Cory Benfield <lukasa@apple.com> |