Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aes: remove Copy from public types of "soft" impls #215

Merged
merged 1 commit into from
Dec 2, 2020

Conversation

tarcieri
Copy link
Member

@tarcieri tarcieri commented Dec 2, 2020

When using the autodetect module, we store the possible backing AES implementations in a union, which presently requires all fields be Copy until ManuallyDrop stabilizes in Rust 1.49.

However, the "soft" types are directly exposed on non-x86 architectures or when the force-soft feature is enabled. Having these types be Copy when the autodetect wrappers aren't is inconsistent, and it's better to require an explicit clone for these to make users think when they make copies of key material.

As a workaround until ManuallyDrop lands, this gates the Copy impl on the "soft" types to only cases where it is hidden behind the autodetect facade (i.e. when they presently need to be Copy).

When using the `autodetect` module, we store the possible backing AES
implementations in a `union`, which presently requires all fields be
`Copy` until `ManuallyDrop` stabilizes in Rust 1.49.

However, the "soft" types are directly exposed on non-x86 architectures
or when the `force-soft` feature is enabled. Having these types be
`Copy` when the autodetect wrappers aren't is inconsistent, and it's
better to require an explicit clone for these to make users think when
they make copies of material.

As a workaround until `ManuallyDrop` lands, this gates the `Copy` impl
on the "soft" types to only cases where it is hidden behind the
autodetect facade (i.e. when they presently *need* to be `Copy`).
@tarcieri tarcieri merged commit c2bdea1 into master Dec 2, 2020
@tarcieri tarcieri deleted the aes/soft-copy-workaround branch December 2, 2020 18:47
@tarcieri tarcieri mentioned this pull request Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant