* Prepare repo for new GHA checks
Motivation:
Migrate to GitHub Actions reusable workflows (2)
Modifications:
* Add GHA PR label checks
* Add GHA benchmarks checks
* Satisfy soundness checks
Result:
New soundness checks should be green and ready for adoption
* review comments
Motivation:
Completing annotations helps with coverage for consuming projects.
Modifications:
Mark more things and Sendable or not.
Result:
Consuming libraries more likely to get correct usage.
Co-authored-by: Cory Benfield <lukasa@apple.com>
* Add support for CRLF line endings to `PEMDocument`
* Remove `lineEnding` as an argument and instead detect line ending automatically.
* Fix description
* Refactor
Motivation:
We should feel confident that we compile clean when built in an environment
that has enabled upcoming Swift features.
When compiling swift-asn1 specifying `.enableUpcomingFeature("ExistentialAny")`
there are some minor warnings emitted by ASN1.swift.
Modifications:
Minor code changes to address surfaced warnings
Result:
Better confidence that we don't break downstreams that compile this code with
these upcoming features enabled.
Co-authored-by: Paul Seligman <pseligman@apple.com>
Motivation:
There is a possible overflow when computing a `Double` value for `fractionalSeconds` from an `ArraySlice` of bytes. Hence, access to this original `ArraySlice` is necessary.
Modifications:
- Add `rawFractionalSeconds` property to `GeneralizedTime`.
- Add a new `internal init` to `GeneralizedTime` that accepts `rawFractionalSeconds` instead of `fractionalSeconds` and generates the later from the former.
- Adjust the algorithm for computing `fractionalSeconds`, from a mathematical to a `String` computation. This is due to the precision mismatch between the mathematical computation and the native `Double` computation. This issue, which previously did not surface, now does, due to the newly included round-trip conversion from `fractionalSeconds` to `rawFractionalSeconds`.
Result:
- The `rawFractionalSeconds` property now provides the original `ArraySlice` from which `fractionalSeconds` was computed.
- `GeneralizedTime` can now compute `fractionalSeconds` from the provided `rawFractionalSeconds`.
* Support macOS 10.14.x/iOS 12.x and older again
* Revert "Support macOS 10.14.x/iOS 12.x and older again"
This reverts commit 6eeba0327f.
* Erase concrete type manually
### Motiviation
We want reduce allocations in swift-certificates and need a way to parse without allocating an intermediate `Array`.
### Modifications
add `DER.lazySet(of:identifier:rootNode)` which returns its result without allocating.
### Result
We can eliminate allocations during parsing
While this is a nice clear construction, it also has to allocate a temporary
Array, as the StrideTo type is not a BidirectionalCollection but a Sequence.
In rare cases it's necessary for users to be able to do an end-run
around the serializer. This is most common in cases where some bytes
have had a signature calculated over them, and they are being
re-encoded. Even though DER is unambiguous, the ASN.1 objects themselves
may not be, and may permit multiple valid encodings. Allowing the bytes
to be re-serialized as they were preserves the integrity of the
signature.
When building against a build tree artifact for Foundation, we need to add the build tree artifacts of dispatch as that is an exposed dependency for Foundation.