summaryrefslogtreecommitdiff
path: root/ext/openssl
diff options
context:
space:
mode:
authorYusuke Nakamura <yusuke1994525@gmail.com>2022-11-23 21:05:49 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-12-13 18:07:41 +0900
commitd4dce27d894f4889f29d779c94ba2d30c231f9f8 (patch)
tree0c0b589b1b6119b1cb4b446bb7bf7527f96a784b /ext/openssl
parentd92f4fe4d74d929cec9ca36ec3dbec070b314902 (diff)
downloadruby-d4dce27d894f4889f29d779c94ba2d30c231f9f8.tar.gz
[ruby/openssl] Allow empty string to OpenSSL::Cipher#update
For some reasons, plaintext may be empty string. ref https://www.rfc-editor.org/rfc/rfc9001.html#section-5.8 https://github.com/ruby/openssl/commit/953592a29e
Diffstat (limited to 'ext/openssl')
-rw-r--r--ext/openssl/ossl_cipher.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/ext/openssl/ossl_cipher.c b/ext/openssl/ossl_cipher.c
index d9c7891433..cb8fbc3ca2 100644
--- a/ext/openssl/ossl_cipher.c
+++ b/ext/openssl/ossl_cipher.c
@@ -384,8 +384,7 @@ ossl_cipher_update(int argc, VALUE *argv, VALUE self)
StringValue(data);
in = (unsigned char *)RSTRING_PTR(data);
- if ((in_len = RSTRING_LEN(data)) == 0)
- ossl_raise(rb_eArgError, "data must not be empty");
+ in_len = RSTRING_LEN(data);
GetCipher(self, ctx);
out_len = in_len+EVP_CIPHER_CTX_block_size(ctx);
if (out_len <= 0) {