mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* ext/openssl/ossl_cipher.c (ossl_cipher_update): input data must
not be empty. [ruby-talk:161220]
* test/openssl/test_cipher.rb: add test for Cipher#update("").
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
			
			
This commit is contained in:
		
							parent
							
								
									aa57e68b06
								
							
						
					
					
						commit
						ab509c0edb
					
				
					 3 changed files with 14 additions and 1 deletions
				
			
		| 
						 | 
					@ -1,3 +1,10 @@
 | 
				
			||||||
 | 
					Mon Oct 31 05:46:08 2005  GOTOU Yuuzou  <gotoyuzo@notwork.org>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* ext/openssl/ossl_cipher.c (ossl_cipher_update): input data must
 | 
				
			||||||
 | 
						  not be empty. [ruby-talk:161220]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* test/openssl/test_cipher.rb: add test for Cipher#update("").
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Mon Oct 31 05:38:26 2005  GOTOU Yuuzou  <gotoyuzo@notwork.org>
 | 
					Mon Oct 31 05:38:26 2005  GOTOU Yuuzou  <gotoyuzo@notwork.org>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	* lib/webrick/httpservlet/cgihandler.rb
 | 
						* lib/webrick/httpservlet/cgihandler.rb
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -224,7 +224,8 @@ ossl_cipher_update(VALUE self, VALUE data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    StringValue(data);
 | 
					    StringValue(data);
 | 
				
			||||||
    in = RSTRING(data)->ptr;
 | 
					    in = RSTRING(data)->ptr;
 | 
				
			||||||
    in_len = RSTRING(data)->len;
 | 
					    if ((in_len = RSTRING(data)->len) == 0)
 | 
				
			||||||
 | 
					        rb_raise(rb_eArgError, "data must not be empty");
 | 
				
			||||||
    GetCipher(self, ctx);
 | 
					    GetCipher(self, ctx);
 | 
				
			||||||
    str = rb_str_new(0, in_len+EVP_CIPHER_CTX_block_size(ctx));
 | 
					    str = rb_str_new(0, in_len+EVP_CIPHER_CTX_block_size(ctx));
 | 
				
			||||||
    if (!EVP_CipherUpdate(ctx, RSTRING(str)->ptr, &out_len, in, in_len))
 | 
					    if (!EVP_CipherUpdate(ctx, RSTRING(str)->ptr, &out_len, in, in_len))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -57,6 +57,11 @@ class OpenSSL::TestCipher < Test::Unit::TestCase
 | 
				
			||||||
    s2 = @c1.update(@data) + @c1.final
 | 
					    s2 = @c1.update(@data) + @c1.final
 | 
				
			||||||
    assert_equal(s1, s2, "encrypt reset")
 | 
					    assert_equal(s1, s2, "encrypt reset")
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def test_empty_data
 | 
				
			||||||
 | 
					    @c1.encrypt
 | 
				
			||||||
 | 
					    assert_raises(ArgumentError){ @c1.update("") }
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue