mirror of
https://github.com/apple/swift-crypto
synced 2026-11-22 04:30:39 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
176abc28e0 | ||
|
|
64a4de00fb |
No files matched your search
@@ -158,4 +158,49 @@ let benchmarks = {
|
||||
blackHole(try privateKey.evaluate(blindedElement))
|
||||
}
|
||||
}
|
||||
|
||||
Benchmark(
|
||||
"key-exchange-p256",
|
||||
configuration: Benchmark.Configuration(
|
||||
metrics: defaultMetrics,
|
||||
scalingFactor: .kilo,
|
||||
maxDuration: .seconds(10_000_000),
|
||||
maxIterations: 10
|
||||
)
|
||||
) { benchmark in
|
||||
for _ in benchmark.scaledIterations {
|
||||
let (key1, key2) = (P256.KeyAgreement.PrivateKey(), P256.KeyAgreement.PrivateKey())
|
||||
blackHole(try key1.sharedSecretFromKeyAgreement(with: key2.publicKey))
|
||||
}
|
||||
}
|
||||
|
||||
Benchmark(
|
||||
"key-exchange-p384",
|
||||
configuration: Benchmark.Configuration(
|
||||
metrics: defaultMetrics,
|
||||
scalingFactor: .kilo,
|
||||
maxDuration: .seconds(10_000_000),
|
||||
maxIterations: 10
|
||||
)
|
||||
) { benchmark in
|
||||
for _ in benchmark.scaledIterations {
|
||||
let (key1, key2) = (P384.KeyAgreement.PrivateKey(), P384.KeyAgreement.PrivateKey())
|
||||
blackHole(try key1.sharedSecretFromKeyAgreement(with: key2.publicKey))
|
||||
}
|
||||
}
|
||||
|
||||
Benchmark(
|
||||
"key-exchange-p521",
|
||||
configuration: Benchmark.Configuration(
|
||||
metrics: defaultMetrics,
|
||||
scalingFactor: .kilo,
|
||||
maxDuration: .seconds(10_000_000),
|
||||
maxIterations: 10
|
||||
)
|
||||
) { benchmark in
|
||||
for _ in benchmark.scaledIterations {
|
||||
let (key1, key2) = (P521.KeyAgreement.PrivateKey(), P521.KeyAgreement.PrivateKey())
|
||||
blackHole(try key1.sharedSecretFromKeyAgreement(with: key2.publicKey))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,26 +36,20 @@ extension OpenSSLSupportedNISTCurve {
|
||||
|
||||
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *)
|
||||
extension P256: OpenSSLSupportedNISTCurve {
|
||||
@inlinable
|
||||
static var group: BoringSSLEllipticCurveGroup {
|
||||
try! BoringSSLEllipticCurveGroup(.p256)
|
||||
}
|
||||
@usableFromInline
|
||||
static let group = try! BoringSSLEllipticCurveGroup(.p256)
|
||||
}
|
||||
|
||||
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *)
|
||||
extension P384: OpenSSLSupportedNISTCurve {
|
||||
@inlinable
|
||||
static var group: BoringSSLEllipticCurveGroup {
|
||||
try! BoringSSLEllipticCurveGroup(.p384)
|
||||
}
|
||||
@usableFromInline
|
||||
static let group = try! BoringSSLEllipticCurveGroup(.p384)
|
||||
}
|
||||
|
||||
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *)
|
||||
extension P521: OpenSSLSupportedNISTCurve {
|
||||
@inlinable
|
||||
static var group: BoringSSLEllipticCurveGroup {
|
||||
try! BoringSSLEllipticCurveGroup(.p521)
|
||||
}
|
||||
@usableFromInline
|
||||
static let group = try! BoringSSLEllipticCurveGroup(.p521)
|
||||
}
|
||||
|
||||
@usableFromInline
|
||||
|
||||
Reference in new issue
Block a user