Skip to content

Pass IV through cipher resets for OpenSSL and Android - #64641

Merged
bartonjs merged 2 commits into
dotnet:mainfrom
vcsjones:ossl-iv-reset
Feb 3, 2022
Merged

Pass IV through cipher resets for OpenSSL and Android#64641
bartonjs merged 2 commits into
dotnet:mainfrom
vcsjones:ossl-iv-reset

Conversation

@vcsjones

Copy link
Copy Markdown
Member

The Reset method accepted an IV, but for OpenSSL and Android, the IV was discarded. Instead, the IV that was originally used to create the cipher context was used.

This wasn't a problem because we've always considered the Key and IV a tuple that belong together. The Lite ciphers are meant to decouple the key from the IV, so the cipher instance can be re-used with different IVs.

In order to facilitate re-usable lite cipher instances with different IVs, all platforms need to support resetting with a different IV than when it was originally constructed.

This also simplifies the reset on OpenSSL since the managed side always supplies the IV, and removes a workaround from OpenSSL 3.

@ghostghost assigned vcsjonesFeb 1, 2022
@ghost

ghost commented Feb 1, 2022

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/area-system-security, @vcsjones
See info in area-owners.md if you want to be subscribed.

Issue Details

The Reset method accepted an IV, but for OpenSSL and Android, the IV was discarded. Instead, the IV that was originally used to create the cipher context was used.

This wasn't a problem because we've always considered the Key and IV a tuple that belong together. The Lite ciphers are meant to decouple the key from the IV, so the cipher instance can be re-used with different IVs.

In order to facilitate re-usable lite cipher instances with different IVs, all platforms need to support resetting with a different IV than when it was originally constructed.

This also simplifies the reset on OpenSSL since the managed side always supplies the IV, and removes a workaround from OpenSSL 3.

Author:vcsjones
Assignees:vcsjones
Labels:

area-System.Security

Milestone:-

@vcsjones

Copy link
Copy Markdown
MemberAuthor

I ran the Android tests locally and everything passed, I'm uncertain if CI is covering Android right now, but I suspect not.

@vcsjones

Copy link
Copy Markdown
MemberAuthor

/azp run runtime

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@vcsjones

Copy link
Copy Markdown
MemberAuthor

Guessing it didn't run because I merged / pushed when GitHub was unavailable yesterday.

@bartonjs

Copy link
Copy Markdown
Member

runtime (Libraries Test Run checked coreclr OSX x64 Debug) failure is that the test matrix still contain{s/ed} an entry for macOS 10.14, but we've shut down that machine configuration.

Since everything else passed, and this change doesn't affect OSX anyways, merging.

@bartonjs
bartonjs merged commit 50e6f07 into dotnet:mainFeb 3, 2022
@vcsjones
vcsjones deleted the ossl-iv-reset branch February 3, 2022 19:17
@ghostghost locked as resolved and limited conversation to collaborators Mar 6, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@vcsjones@bartonjs