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

iv length is constant so set only once #649

Merged
merged 1 commit into from
May 3, 2023

Conversation

pabuhler
Copy link
Member

@pabuhler pabuhler commented Apr 3, 2023

The iv length is preserved inside the EVP_CIPHER_CTX so no need to set more than once.
This is especially important with OpenSSL 3 where setting the iv len is a expensive operation due to param lookup code inside of OpenSSL.

This should help performance issue with OpenSSL 3 and libsrtp with #645 in the case of GCM but does not fix all of the performance issues.

The iv length is preserved inside the EVP_CIPHER_CTX
so no need to set more than once.
This is especially important with OpenSSL 3 where setting the iv len is a expensive
operation due to param lookup code inside of OpenSSL.

This should help Performance issue with OpennSSL 3 and libsrtp with cisco#645 in the case of GCM
but does not fix all of the performance issues.
@murillo128
Copy link

I have been testing this PR and it marginally helps performance, so good to have it in anyway.

@pabuhler pabuhler marked this pull request as ready for review April 22, 2023 07:47
@pabuhler
Copy link
Member Author

@murillo128 I agree that it should just go in. @bifurcation could you review ?

Copy link
Contributor

@bifurcation bifurcation left a comment

Choose a reason for hiding this comment

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

Looks like the change here is to call SET_IVLEN on initiation, as opposed to every time an IV is set? That seems fine, assuming EVP_CIPHER_CTX holds on to this setting. Which seems like it's confirmed if this passes tests.

@bifurcation bifurcation merged commit 00a7f9b into cisco:main May 3, 2023
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.

3 participants