[macruby-changes] [5091] MacRuby/trunk/ext/openssl
source_changes at macosforge.org
source_changes at macosforge.org
Tue Dec 28 01:04:08 PST 2010
Revision: 5091
http://trac.macosforge.org/projects/ruby/changeset/5091
Author: watson1978 at gmail.com
Date: 2010-12-28 01:04:04 -0800 (Tue, 28 Dec 2010)
Log Message:
-----------
Fixed the typo. will use the API for BSTRING.
Modified Paths:
--------------
MacRuby/trunk/ext/openssl/ossl_cipher.c
MacRuby/trunk/ext/openssl/ossl_pkey.c
MacRuby/trunk/ext/openssl/ossl_pkey_ec.c
MacRuby/trunk/ext/openssl/ossl_pkey_rsa.c
MacRuby/trunk/ext/openssl/ossl_ssl.c
Modified: MacRuby/trunk/ext/openssl/ossl_cipher.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_cipher.c 2010-12-28 09:03:56 UTC (rev 5090)
+++ MacRuby/trunk/ext/openssl/ossl_cipher.c 2010-12-28 09:04:04 UTC (rev 5091)
@@ -324,17 +324,16 @@
if (NIL_P(str)) {
str = rb_bstr_new();
- rb_bstr_resize(str, out_len);
} else {
StringValue(str);
str = rb_str_bstr(str);
- rb_str_resize(str, out_len);
}
+ rb_bstr_resize(str, out_len);
- if (!EVP_CipherUpdate(ctx, (unsigned char *)RSTRING_PTR(str), &out_len, in, in_len))
+ if (!EVP_CipherUpdate(ctx, (unsigned char *)rb_bstr_bytes(str), &out_len, in, in_len))
ossl_raise(eCipherError, NULL);
assert(out_len < RSTRING_LEN(str));
- rb_str_set_len(str, out_len);
+ rb_bstr_resize(str, out_len);
return str;
}
@@ -360,7 +359,7 @@
if (!EVP_CipherFinal_ex(ctx, (unsigned char *)rb_bstr_bytes(str), &out_len))
ossl_raise(eCipherError, NULL);
assert(out_len <= RSTRING_LEN(str));
- rb_str_set_len(str, out_len);
+ rb_bstr_resize(str, out_len);
return str;
}
Modified: MacRuby/trunk/ext/openssl/ossl_pkey.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_pkey.c 2010-12-28 09:03:56 UTC (rev 5090)
+++ MacRuby/trunk/ext/openssl/ossl_pkey.c 2010-12-28 09:04:04 UTC (rev 5091)
@@ -179,7 +179,7 @@
if (!EVP_SignFinal(&ctx, (unsigned char *)rb_bstr_bytes(str), &buf_len, pkey))
ossl_raise(ePKeyError, NULL);
assert((long)buf_len <= RSTRING_LEN(str));
- rb_str_set_len(str, buf_len);
+ rb_bstr_resize(str, buf_len);
return str;
}
Modified: MacRuby/trunk/ext/openssl/ossl_pkey_ec.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_pkey_ec.c 2010-12-28 09:03:56 UTC (rev 5090)
+++ MacRuby/trunk/ext/openssl/ossl_pkey_ec.c 2010-12-28 09:04:04 UTC (rev 5091)
@@ -677,7 +677,7 @@
if (ECDSA_sign(0, (const unsigned char *) RSTRING_PTR(data), RSTRING_LEN(data), (unsigned char *) rb_bstr_bytes(str), &buf_len, ec) != 1)
ossl_raise(eECError, "ECDSA_sign");
- rb_str_resize(str, buf_len);
+ rb_bstr_resize(str, buf_len);
return str;
}
Modified: MacRuby/trunk/ext/openssl/ossl_pkey_rsa.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_pkey_rsa.c 2010-12-28 09:03:56 UTC (rev 5090)
+++ MacRuby/trunk/ext/openssl/ossl_pkey_rsa.c 2010-12-28 09:04:04 UTC (rev 5091)
@@ -318,10 +318,10 @@
str = rb_bstr_new();
rb_bstr_resize(str, ossl_rsa_buf_size(pkey));
buf_len = RSA_public_encrypt(RSTRING_LEN(buffer), (unsigned char *)RSTRING_PTR(buffer),
- (unsigned char *)RSTRING_PTR(str), pkey->pkey.rsa,
+ (unsigned char *)rb_bstr_bytes(str), pkey->pkey.rsa,
pad);
if (buf_len < 0) ossl_raise(eRSAError, NULL);
- rb_str_set_len(str, buf_len);
+ rb_bstr_resize(str, buf_len);
return str;
}
Modified: MacRuby/trunk/ext/openssl/ossl_ssl.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_ssl.c 2010-12-28 09:03:56 UTC (rev 5090)
+++ MacRuby/trunk/ext/openssl/ossl_ssl.c 2010-12-28 09:04:04 UTC (rev 5091)
@@ -1216,7 +1216,7 @@
}
end:
- rb_str_set_len(str, nread);
+ rb_bstr_resize(str, nread);
OBJ_TAINT(str);
return str;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101228/14b97a40/attachment-0001.html>
More information about the macruby-changes
mailing list