Commit Graph
226 Commits
Author SHA1 Message Date
David Nadoba 12aabc3ed4 Move to single target 2023-09-11 19:23:50 +01:00
David Nadoba e14741a393 update baselines 2023-09-04 11:41:23 +01:00
David Nadoba 43a7152206 Merge branch 'main' into dn-package-benchmark
# Conflicts:
#	IntegrationTests/tests_01_allocation_counters/test_01_resources/run-swift-certificates-alloc-counter-tests.sh
#	docker/docker-compose.2204.57.yaml
#	docker/docker-compose.2204.58.yaml
#	docker/docker-compose.2204.59.yaml
#	docker/docker-compose.2204.main.yaml
2023-09-04 11:26:08 +01:00
David Nadoba 9629570389 swift-format 2023-09-04 11:24:02 +01:00
David Nadoba 5f62f025fd crash in debug configuration 2023-09-04 11:20:47 +01:00
David Nadoba d95888c91d revork folder structure
and add BlackHole module
2023-09-04 11:17:39 +01:00
Alexander Cyon 216a8a1166 Fix typos in Sources and Tests (#133)
* Fix typos in Sources and Tests

* Address PR review comments

* Second attempt to rectify tab instead of spaces.
2023-09-04 10:34:25 +01:00
David Nadoba ef10b819c7 Add Certificate.PrivateKey description (#132)
* Add `Certificate.PrivateKey` description

and update `Certificate.PublicKey` description to disambiguate from private keys.

* secure enclave is only a thing on darwin

* update tests
1.0.0-beta.1
2023-08-25 08:32:40 +01:00
David Nadoba 708eb05b1f Use beta release of swift-asn1 (#131)
* Use beta release of `swift-asn1`

* update swift-asn1 in integeration tests as well

* allocation have improved 🥳
2023-08-24 17:27:47 +01:00
Stefana-Ioana DrancaandDavid Nadoba 44a0c84fce Make PublicKey DERImplicitlyTaggable (#129)
Motivation:

PublicKey doesn't conform to DERImplicitlyTaggable which was an oversight during development.

Modifications:

Add conformance to DERImplicitlyTaggable, PEMSerializable, and PEMParsable.

Result:

PublicKey is DERImplicitlyTaggable.

Co-authored-by: David Nadoba <d_nadoba@apple.com>
2023-08-24 15:09:43 +01:00
David NadobaandCory Benfield 0a44251615 Fix preference of root certificates (#127)
Motivation

We prefer issuers that have a subject key identifier that matches the authority key identifier of the certificate for which were are searching for an issuer. However, currently we have flipped this sort order.

Modifications

Flip preference order
update test
add test which would previously fail

Result

We actually prefer certificates in the order described above.
Note that this is just a performance improvement.

Co-authored-by: Cory Benfield <lukasa@apple.com>
2023-08-24 06:32:50 -07:00
David Nadoba 26832755b5 Refactor ASN1UTF8StringView to ASN1TaggedStringView and use it for printable strings (#128)
* Refactor `ASN1UTF8StringView` to `ASN1TaggedStringView` and use it for `printable` strings

* run swift-format

* fix comments
2023-08-24 14:13:58 +01:00
David Nadoba 80bac7f810 use released version 2023-08-24 13:22:29 +01:00
David Nadoba b4e5ab60a5 delete old integration tests 2023-08-24 11:05:13 +01:00
David Nadoba fda5b548fd use latest threshold file format 2023-08-23 17:21:09 +01:00
David Nadoba 7b97179f3f add license headers 2023-08-23 15:55:13 +01:00
David Nadoba d432a4fd2d adopt swift-format for benchmarks 2023-08-23 15:48:18 +01:00
David Nadoba bd3926313c merge main and update allocation counters 2023-08-23 15:44:46 +01:00
David Nadoba ab5462e294 Merge branch 'main' into dn-package-benchmark
# Conflicts:
#	docker/docker-compose.2204.59.yaml
2023-08-23 15:25:01 +01:00
David Nadoba 5a038c7a4a use automated threshold import 2023-08-23 15:23:27 +01:00
David Nadoba 9d029e018c update metrics 2023-08-23 14:28:56 +01:00
David Nadoba 311dcaa45b use new metricP90AbsoluteThresholds export format 2023-08-23 13:16:43 +01:00
David Nadoba 8005d751f1 install jemalloc 2023-08-22 15:29:13 +01:00
David Nadoba 88c84f920a don’t require the parent folder to be named swift-certificates 2023-08-22 11:06:30 +01:00
David Nadoba 9810290914 use scaledIterations 2023-08-22 09:37:26 +01:00
David Nadoba e6905bfcef Apply review feedback 2023-08-22 08:55:21 +01:00
David Nadoba 92ffb4827b Add PolicyFailureReason to support lazy failure reason string interpolation (#126)
* Add `PolicyFailureReason` to support lazy failure reason string interpolation

* fix allocation test compilation

* update allocation counters
2023-08-21 20:01:19 +01:00
David Nadoba 6b7c04f2ad Merge branch 'main' into dn-package-benchmark 2023-08-21 16:54:20 +01:00
David Nadoba b69a931b43 remove deprecated API (#123) 2023-08-21 06:32:51 -07:00
David Nadoba 7f4c7b5362 Fix review comment 2023-08-18 21:23:43 +01:00
David Nadoba 58523351be self review 2023-08-18 11:27:09 +01:00
David Nadoba 285343fc17 refactor file structure 2023-08-18 11:25:55 +01:00
David Nadoba 477055672d fix benchmark plugin 2023-08-18 10:51:06 +01:00
David Nadoba 2e9b1c10d8 split into multiple targets 2023-08-18 10:51:06 +01:00
David Nadoba c16c7bf6b4 use local dependencies 2023-08-18 10:51:06 +01:00
David Nadoba f512cbef0f Add package-benchmark 2023-08-18 10:51:06 +01:00
David Nadoba 088a22943d Use valid ASN1ObjectIdentifier in tests (#124)
### Motivation
We have used `ASN1ObjectIdentifier` with just one component in tests but they need at least two components. `swift-asn1` has recently changed the initialiser to enforce this during initialisation time if initialised from a literal. Therefore our tests currently crash.

### Modifications
This PR changes all of our test `ASN1ObjectIdentifier`s to have at least two components.

### Results
Tests no longer crash
2023-08-18 02:23:30 -07:00
David Nadoba 1442890101 Allow RelativeDistinguishedNameConvertible to fail gracefully (#122) 2023-08-16 13:01:49 +01:00
David Nadoba 45ad9935c7 Adopt apple/swift-format (#121)
* Adopt `apple/swift-format`

* install swift-format

* set `UseSynthesizedInitializer` to `false` until bug is fixed https://github.com/apple/swift-format/issues/591

* fix license header

* Fix license header
2023-08-16 11:17:34 +01:00
David NadobaandCory Benfield 98e0f85457 Do not count self-issued certificates against maxPathLength (#119)
Only non-self-issued certificates count against the maxPathLength limit.

RFC Section 4.2.1.9.  Basic Constraints:

> [...]
> The pathLenConstraint field is meaningful only if the cA boolean is
> asserted and the key usage extension, if present, asserts the
> keyCertSign bit (Section 4.2.1.3).  In this case, it gives the
> maximum number of non-self-issued intermediate certificates that may
> follow this certificate in a valid certification path.  (Note: The
> last certificate in the certification path is not an intermediate
> certificate, and is not included in this limit.  Usually, the last
> certificate is an end entity certificate, but it can be a CA
> certificate.)  A pathLenConstraint of zero indicates that no non-
> self-issued intermediate CA certificates may follow in a valid
> certification path.  Where it appears, the pathLenConstraint field
> MUST be greater than or equal to zero.  Where pathLenConstraint does
> not appear, no limit is imposed.
> [...]
> https://www.rfc-editor.org/rfc/rfc5280#section-4.2.1.9

Co-authored-by: Cory Benfield <lukasa@apple.com>
2023-08-10 03:58:44 -07:00
David Nadoba 21a8721886 Reject v1 Certificates with extensions (#118)
v1 certificates do not support extensions and any v1 certificate we encounter with extensions can’t be used to verify a chain.
2023-08-10 11:43:21 +01:00
David Nadoba 3c30a4a095 Use Certificate.description instead of dump for debugging flaky tests (#117) 2023-08-09 11:19:27 +01:00
David Nadoba 619756c18f Add custom String representation to Certificate and related types (#116)
* `Custom[String|DebugString]Convertible` conformance

* save progress

* Apply new learned rules

debugDescription should be usable in structural display

* remove unused init

* remove unused properties

* Some fixups before review

* change description a bit around and respect RFC 2253

* add addition test

* fix license header and tests

* update allocation counters
2023-08-09 08:30:09 +01:00
David Nadoba 583414dad1 Make debugDescription work well as part of a structural display (#115)
### Motivation

`debugDescription` name and documentation is confusing and should be changed but it is today expected to be suitable to be used as part of a structured display e.g. to be printed as part of `struct` or `enum` with associated values. Therefore it should have no unpaired parentheses, no unescaped quotes and no top-level commas.

### Modifications
- let `debugDescription` simply contain the same contents as `description` but suitable for structural display as described above.
- add a new `multilineDescription` which contains the same contents as the `description` but breaded down on multiple lines for better readability.
2023-08-07 11:48:43 +01:00
David Nadoba 8debe3f20d Add optional diagnostic information to Verifier (#113)
* work in progress

* remove generic

* save progress

* Add description

* Apply review feedback

* run `./scripts/update_cmakelists.sh`

* Conform to `CustomDebugStringConvertible` instead of `CustomStringConvertible`

* implement `CustomStringConvertible` for `VerificationDiagnostic`

* Apply review feedback

* Add more diagnostics

* Update tests

* Remove prototype code

* add `IssuerIsAlreadyInTheChain` diagnostics
2023-07-27 09:46:07 +01:00
David Nadoba 5f82c70d24 Make hashing a RDN.Attribute.Value.utf8String not allocate (#112)
* Make hashing a `RDN.Attribute.Value.utf8String` not allocate

* Precompute as much as possible

and fix bounds checking

* Update allocation counter
2023-07-20 09:59:29 +01:00
David Nadoba c13badf75a Add verifier allocation tests (#111)
* Add verifier allocation test

* update allocations
2023-07-17 17:04:40 +01:00
David Nadoba 1db96874fa Remove unused import (#110) 2023-07-10 05:13:21 -07:00
David Nadoba af42ab0d26 Remove unused test key (#109) 2023-07-10 13:04:36 +01:00
David NadobaandFranz Busch fb7b79f346 Allow OCSPRequester to fail OCSPVerifierPolicy (#108)
* Support hard failures from OCSPRequester

* rename error result methods to nonTerminalError and terminalError from softFailure and harFailure

* rename query result in tests as well

* Update Sources/X509/OCSP/OCSPPolicy.swift

Co-authored-by: Franz Busch <privat@franz-busch.de>

* Add warning

---------

Co-authored-by: Franz Busch <privat@franz-busch.de>
2023-07-06 14:50:21 +01:00