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

Allow empty string to OpenSSL::Cipher#update #568

Merged
merged 1 commit into from Nov 23, 2022

Conversation

unasuke
Copy link
Contributor

@unasuke unasuke commented Nov 23, 2022

For some reasons, plaintext may be empty string.

ref https://www.rfc-editor.org/rfc/rfc9001.html#section-5.8

@rhenium
Copy link
Member

rhenium commented Nov 23, 2022

This effectively reverts ruby trunk r9485 (2c1d99d) committed back in 2005. I couldn't find the referenced message [ruby-talk:161220] with a Google search, which may have described the reason for this.

@rhenium
Copy link
Member

rhenium commented Nov 23, 2022

That explains! From https://web.archive.org/web/20160517163055/http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/161220

encrypt('') # -> gives error "evp_enc.c(332): OpenSSL internal error,
assertion failed: inl > 0 \n Abort trap"

This appears to be the assertion removed in this OpenSSL commit: openssl/openssl@2e41577

@rhenium rhenium merged commit c1639f1 into ruby:master Nov 23, 2022
@rhenium
Copy link
Member

rhenium commented Nov 23, 2022

Merged, thanks!

@unasuke unasuke deleted the empty_string_to_cipher_update branch November 23, 2022 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants