[macruby-changes] [5084] MacRuby/trunk/ext/openssl/ossl_pkey_dh.c
source_changes at macosforge.org
source_changes at macosforge.org
Mon Dec 27 11:40:03 PST 2010
Revision: 5084
http://trac.macosforge.org/projects/ruby/changeset/5084
Author: watson1978 at gmail.com
Date: 2010-12-27 11:39:58 -0800 (Mon, 27 Dec 2010)
Log Message:
-----------
Fixed the Bus Error within OpenSSL::PKey::DH#compute_key.
Test Script:
{{{
require 'openssl'
dh = OpenSSL::PKey::DH.generate(128, 5)
raise "bad DH parameter" unless dh.params_ok?
dh1 = dh
dh2 = OpenSSL::PKey::DH.new(dh)
dh1.generate_key!
dh2.generate_key!
key1 = dh1.compute_key(dh2.pub_key)
key2 = dh1.compute_key(dh1.pub_key)
}}}
Modified Paths:
--------------
MacRuby/trunk/ext/openssl/ossl_pkey_dh.c
Modified: MacRuby/trunk/ext/openssl/ossl_pkey_dh.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_pkey_dh.c 2010-12-27 19:39:52 UTC (rev 5083)
+++ MacRuby/trunk/ext/openssl/ossl_pkey_dh.c 2010-12-27 19:39:58 UTC (rev 5084)
@@ -407,8 +407,9 @@
dh = pkey->pkey.dh;
pub_key = GetBNPtr(pub);
len = DH_size(dh);
- str = rb_str_new(0, len);
- if ((len = DH_compute_key((unsigned char *)RSTRING_PTR(str), pub_key, dh)) < 0) {
+ str = rb_bstr_new();
+ rb_bstr_resize(str, len);
+ if ((len = DH_compute_key((unsigned char *)rb_bstr_bytes(str), pub_key, dh)) < 0) {
ossl_raise(eDHError, NULL);
}
rb_str_set_len(str, len);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101227/62896073/attachment.html>
More information about the macruby-changes
mailing list