Skip to content

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

Merged
rhenium merged 1 commit intoruby:masterfrom
unasuke:empty_string_to_cipher_update
Nov 23, 2022
Merged

Allow empty string to OpenSSL::Cipher#update#568
rhenium merged 1 commit intoruby:masterfrom
unasuke:empty_string_to_cipher_update

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants