Skip to content

Conversation

@wnagrodzki
Copy link
Contributor

Add Sequence conformance to AES._CBC.IV where Element is UInt8.

Checklist

  • I've run tests to see all new and existing tests pass

PKCS8DERRepresentationTests do not compile on master branch with Error 'pkcs8DERRepresentation' is only available in iOS 14.0 or newer. All the other tests pass after my changes.

  • I've followed the code style of the rest of the project
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary

If you've made changes to gyb files

  • I've run .script/generate_boilerplate_files_with_gyb and included updated generated files in a commit of this pull request

Motivation:

No convenient API for converting AES._CBC.IV into Data.

Modifications:

Added Sequence conformance to AES._CBC.IV similarly how it is done for AES.GCM._SIV.Nonce.

Result:

It will be possible to create Data instance with AES._CBC.IV passed as init argument.

@Lukasa Lukasa added the 🆕 semver/minor Adds new public API. label Jul 30, 2025
Copy link
Contributor

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! Can you also add a test-case that uses this API so we can make sure it works as expected?

}
}

public func makeIterator() -> Array<UInt8>.Iterator {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's erase this to some IteratorProtocol, and make the method @inlinable. That should give us the same performance characteristics as the existing code, but allow us to change the iterator in a future release if we feel like it.

Copy link
Contributor

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thanks!

@Lukasa Lukasa merged commit c68a7a7 into apple:main Jul 31, 2025
43 checks passed
@wnagrodzki wnagrodzki deleted the aes-cbc-iv-sequence-conformance branch July 31, 2025 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants