[macruby-changes] [2910] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 28 17:36:26 PDT 2009


Revision: 2910
          http://trac.macosforge.org/projects/ruby/changeset/2910
Author:   lsansonetti at apple.com
Date:     2009-10-28 17:36:24 -0700 (Wed, 28 Oct 2009)
Log Message:
-----------
experimental openssl support (work in progress)

Modified Paths:
--------------
    MacRuby/trunk/ext/openssl/ossl.c
    MacRuby/trunk/ext/openssl/ossl_asn1.c
    MacRuby/trunk/ext/openssl/ossl_bio.c
    MacRuby/trunk/ext/openssl/ossl_bn.c
    MacRuby/trunk/ext/openssl/ossl_cipher.c
    MacRuby/trunk/ext/openssl/ossl_config.c
    MacRuby/trunk/ext/openssl/ossl_digest.c
    MacRuby/trunk/ext/openssl/ossl_engine.c
    MacRuby/trunk/ext/openssl/ossl_hmac.c
    MacRuby/trunk/ext/openssl/ossl_ns_spki.c
    MacRuby/trunk/ext/openssl/ossl_ocsp.c
    MacRuby/trunk/ext/openssl/ossl_pkcs12.c
    MacRuby/trunk/ext/openssl/ossl_pkcs7.c
    MacRuby/trunk/ext/openssl/ossl_pkey.c
    MacRuby/trunk/ext/openssl/ossl_pkey_dh.c
    MacRuby/trunk/ext/openssl/ossl_pkey_dsa.c
    MacRuby/trunk/ext/openssl/ossl_pkey_ec.c
    MacRuby/trunk/ext/openssl/ossl_rand.c
    MacRuby/trunk/ext/openssl/ossl_ssl.c
    MacRuby/trunk/ext/openssl/ossl_ssl_session.c
    MacRuby/trunk/ext/openssl/ossl_x509ext.c
    MacRuby/trunk/ext/openssl/ossl_x509name.c
    MacRuby/trunk/ext/openssl/ossl_x509store.c
    MacRuby/trunk/rakelib/builder.rake

Modified: MacRuby/trunk/ext/openssl/ossl.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -118,24 +118,10 @@
 OSSL_IMPL_SK2ARY(x509, X509)
 OSSL_IMPL_SK2ARY(x509crl, X509_CRL)
 
-static VALUE
-ossl_str_new(int size)
-{
-    return rb_str_new(0, size);
-}
-
 VALUE
 ossl_buf2str(char *buf, int len)
 {
-    VALUE str;
-    int status = 0;
-
-    str = rb_protect((VALUE(*)_((VALUE)))ossl_str_new, len, &status);
-    if(!NIL_P(str)) memcpy(RSTRING_PTR(str), buf, len);
-    OPENSSL_free(buf);
-    if(status) rb_jump_tag(status);
-
-    return str;
+    return rb_bytestring_new_with_data((UInt8 *)buf, len);
 }
 
 /*

Modified: MacRuby/trunk/ext/openssl/ossl_asn1.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_asn1.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_asn1.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -647,7 +647,7 @@
 }
 
 static VALUE
-ossl_asn1data_initialize(VALUE self, VALUE value, VALUE tag, VALUE tag_class)
+ossl_asn1data_initialize(VALUE self, SEL sel, VALUE value, VALUE tag, VALUE tag_class)
 {
     if(!SYMBOL_P(tag_class))
 	ossl_raise(eASN1Error, "invalid tag class");
@@ -678,7 +678,7 @@
 }
 
 static VALUE
-ossl_asn1data_to_der(VALUE self)
+ossl_asn1data_to_der(VALUE self, SEL sel)
 {
     VALUE value, der;
     int tag, tag_class, is_cons = 0;
@@ -814,7 +814,7 @@
 }
 
 static VALUE
-ossl_asn1_traverse(VALUE self, VALUE obj)
+ossl_asn1_traverse(VALUE self, SEL sel, VALUE obj)
 {
     unsigned char *p;
     long offset = 0;
@@ -829,7 +829,7 @@
 }
 
 static VALUE
-ossl_asn1_decode(VALUE self, VALUE obj)
+ossl_asn1_decode(VALUE self, SEL sel, VALUE obj)
 {
     VALUE ret, ary;
     unsigned char *p;
@@ -846,7 +846,7 @@
 }
 
 static VALUE
-ossl_asn1_decode_all(VALUE self, VALUE obj)
+ossl_asn1_decode_all(VALUE self, SEL sel, VALUE obj)
 {
     VALUE ret;
     unsigned char *p;
@@ -862,7 +862,7 @@
 }
 
 static VALUE
-ossl_asn1_initialize(int argc, VALUE *argv, VALUE self)
+ossl_asn1_initialize(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     VALUE value, tag, tagging, tag_class;
 
@@ -919,7 +919,7 @@
 }
 
 static VALUE
-ossl_asn1prim_to_der(VALUE self)
+ossl_asn1prim_to_der(VALUE self, SEL sel)
 {
     ASN1_TYPE *asn1;
     int tn, tc, explicit;
@@ -956,7 +956,7 @@
 }
 
 static VALUE
-ossl_asn1cons_to_der(VALUE self)
+ossl_asn1cons_to_der(VALUE self, SEL sel)
 {
     int tag, tn, tc, explicit;
     long seq_len, length;
@@ -990,14 +990,14 @@
 }
 
 static VALUE
-ossl_asn1cons_each(VALUE self)
+ossl_asn1cons_each(VALUE self, SEL sel)
 {
     rb_ary_each(ossl_asn1_get_value(self));
     return self;
 }
 
 static VALUE
-ossl_asn1obj_s_register(VALUE self, VALUE oid, VALUE sn, VALUE ln)
+ossl_asn1obj_s_register(VALUE self, SEL sel, VALUE oid, VALUE sn, VALUE ln)
 {
     StringValue(oid);
     StringValue(sn);
@@ -1010,7 +1010,7 @@
 }
 
 static VALUE
-ossl_asn1obj_get_sn(VALUE self)
+ossl_asn1obj_get_sn(VALUE self, SEL sel)
 {
     VALUE val, ret = Qnil;
     int nid;
@@ -1023,7 +1023,7 @@
 }
 
 static VALUE
-ossl_asn1obj_get_ln(VALUE self)
+ossl_asn1obj_get_ln(VALUE self, SEL sel)
 {
     VALUE val, ret = Qnil;
     int nid;
@@ -1036,7 +1036,7 @@
 }
 
 static VALUE
-ossl_asn1obj_get_oid(VALUE self)
+ossl_asn1obj_get_oid(VALUE self, SEL sel)
 {
     VALUE val;
     ASN1_OBJECT *a1obj;
@@ -1051,7 +1051,7 @@
 }
 
 #define OSSL_ASN1_IMPL_FACTORY_METHOD(klass) \
-static VALUE ossl_asn1_##klass(int argc, VALUE *argv, VALUE self)\
+static VALUE ossl_asn1_##klass(VALUE self, SEL sel, int argc, VALUE *argv)\
 { return rb_funcall3(cASN1##klass, rb_intern("new"), argc, argv); }
 
 OSSL_ASN1_IMPL_FACTORY_METHOD(Boolean)
@@ -1096,9 +1096,9 @@
 
     mASN1 = rb_define_module_under(mOSSL, "ASN1");
     eASN1Error = rb_define_class_under(mASN1, "ASN1Error", eOSSLError);
-    rb_define_module_function(mASN1, "traverse", ossl_asn1_traverse, 1);
-    rb_define_module_function(mASN1, "decode", ossl_asn1_decode, 1);
-    rb_define_module_function(mASN1, "decode_all", ossl_asn1_decode_all, 1);
+    rb_objc_define_method(*(VALUE *)mASN1, "traverse", ossl_asn1_traverse, 1);
+    rb_objc_define_method(*(VALUE *)mASN1, "decode", ossl_asn1_decode, 1);
+    rb_objc_define_method(*(VALUE *)mASN1, "decode_all", ossl_asn1_decode_all, 1);
     ary = rb_ary_new();
     rb_define_const(mASN1, "UNIVERSAL_TAG_NAME", ary);
     for(i = 0; i < ossl_asn1_info_size; i++){
@@ -1111,25 +1111,25 @@
     rb_attr(cASN1Data, rb_intern("value"), 1, 1, 0);
     rb_attr(cASN1Data, rb_intern("tag"), 1, 1, 0);
     rb_attr(cASN1Data, rb_intern("tag_class"), 1, 1, 0);
-    rb_define_method(cASN1Data, "initialize", ossl_asn1data_initialize, 3);
-    rb_define_method(cASN1Data, "to_der", ossl_asn1data_to_der, 0);
+    rb_objc_define_method(cASN1Data, "initialize", ossl_asn1data_initialize, 3);
+    rb_objc_define_method(cASN1Data, "to_der", ossl_asn1data_to_der, 0);
 
     cASN1Primitive = rb_define_class_under(mASN1, "Primitive", cASN1Data);
     rb_attr(cASN1Primitive, rb_intern("tagging"), 1, 1, Qtrue);
-    rb_define_method(cASN1Primitive, "initialize", ossl_asn1_initialize, -1);
-    rb_define_method(cASN1Primitive, "to_der", ossl_asn1prim_to_der, 0);
+    rb_objc_define_method(cASN1Primitive, "initialize", ossl_asn1_initialize, -1);
+    rb_objc_define_method(cASN1Primitive, "to_der", ossl_asn1prim_to_der, 0);
 
     cASN1Constructive = rb_define_class_under(mASN1,"Constructive", cASN1Data);
     rb_include_module(cASN1Constructive, rb_mEnumerable);
     rb_attr(cASN1Constructive, rb_intern("tagging"), 1, 1, Qtrue);
-    rb_define_method(cASN1Constructive, "initialize", ossl_asn1_initialize, -1);
-    rb_define_method(cASN1Constructive, "to_der", ossl_asn1cons_to_der, 0);
-    rb_define_method(cASN1Constructive, "each", ossl_asn1cons_each, 0);
+    rb_objc_define_method(cASN1Constructive, "initialize", ossl_asn1_initialize, -1);
+    rb_objc_define_method(cASN1Constructive, "to_der", ossl_asn1cons_to_der, 0);
+    rb_objc_define_method(cASN1Constructive, "each", ossl_asn1cons_each, 0);
 
 #define OSSL_ASN1_DEFINE_CLASS(name, super) \
 do{\
     cASN1##name = rb_define_class_under(mASN1, #name, cASN1##super);\
-    rb_define_module_function(mASN1, #name, ossl_asn1_##name, -1);\
+    rb_objc_define_method(*(VALUE *)mASN1, #name, ossl_asn1_##name, -1);\
 }while(0)
 
     OSSL_ASN1_DEFINE_CLASS(Boolean, Primitive);
@@ -1156,10 +1156,10 @@
     OSSL_ASN1_DEFINE_CLASS(Sequence, Constructive);
     OSSL_ASN1_DEFINE_CLASS(Set, Constructive);
 
-    rb_define_singleton_method(cASN1ObjectId, "register", ossl_asn1obj_s_register, 3);
-    rb_define_method(cASN1ObjectId, "sn", ossl_asn1obj_get_sn, 0);
-    rb_define_method(cASN1ObjectId, "ln", ossl_asn1obj_get_ln, 0);
-    rb_define_method(cASN1ObjectId, "oid", ossl_asn1obj_get_oid, 0);
+    rb_objc_define_method(*(VALUE *)cASN1ObjectId, "register", ossl_asn1obj_s_register, 3);
+    rb_objc_define_method(cASN1ObjectId, "sn", ossl_asn1obj_get_sn, 0);
+    rb_objc_define_method(cASN1ObjectId, "ln", ossl_asn1obj_get_ln, 0);
+    rb_objc_define_method(cASN1ObjectId, "oid", ossl_asn1obj_get_oid, 0);
     rb_define_alias(cASN1ObjectId, "short_name", "sn");
     rb_define_alias(cASN1ObjectId, "long_name", "ln");
     rb_attr(cASN1BitString, rb_intern("unused_bits"), 1, 1, 0);

Modified: MacRuby/trunk/ext/openssl/ossl_bio.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_bio.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_bio.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -39,7 +39,11 @@
     }
     else {
 	StringValue(obj);
-	bio = BIO_new_mem_buf(RSTRING_PTR(obj), RSTRING_LEN(obj));
+	if (CLASS_OF(obj) != rb_cByteString) {
+	    rb_raise(rb_eArgError, "expected ByteString object");
+	}
+	bio = BIO_new_mem_buf(rb_bytestring_byte_pointer(obj),
+		rb_bytestring_length(obj));
 	if (!bio) ossl_raise(eOSSLError, NULL);
     }
 

Modified: MacRuby/trunk/ext/openssl/ossl_bn.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_bn.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_bn.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -87,7 +87,7 @@
 BN_CTX *ossl_bn_ctx;
 
 static VALUE
-ossl_bn_alloc(VALUE klass)
+ossl_bn_alloc(VALUE klass, SEL sel)
 {
     BIGNUM *bn;
     VALUE obj;
@@ -108,7 +108,7 @@
  *    BN.new(string, 0 | 2 | 10 | 16) => aBN
  */
 static VALUE
-ossl_bn_initialize(int argc, VALUE *argv, VALUE self)
+ossl_bn_initialize(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     BIGNUM *bn;
     VALUE str, bs;
@@ -263,7 +263,7 @@
      *							\
      */							\
     static VALUE					\
-    ossl_bn_##func(VALUE self)				\
+    ossl_bn_##func(VALUE self, SEL sel)			\
     {							\
 	BIGNUM *bn;					\
 	GetBN(self, bn);				\
@@ -283,7 +283,7 @@
      *							\
      */							\
     static VALUE					\
-    ossl_bn_##func(VALUE self)				\
+    ossl_bn_##func(VALUE self, SEL sel)			\
     {							\
 	BIGNUM *bn, *result;				\
 	VALUE obj;					\
@@ -307,7 +307,7 @@
      *							\
      */							\
     static VALUE					\
-    ossl_bn_##func(VALUE self, VALUE other)		\
+    ossl_bn_##func(VALUE self, SEL sel, VALUE other)	\
     {							\
 	BIGNUM *bn1, *bn2 = GetBNPtr(other), *result;	\
 	VALUE obj;					\
@@ -332,7 +332,7 @@
      *								\
      */								\
     static VALUE						\
-    ossl_bn_##func(VALUE self, VALUE other)			\
+    ossl_bn_##func(VALUE self, SEL sel, VALUE other)		\
     {								\
 	BIGNUM *bn1, *bn2 = GetBNPtr(other), *result;		\
 	VALUE obj;						\
@@ -359,7 +359,7 @@
  *    bn1 / bn2 => [result, remainder]
  */
 static VALUE
-ossl_bn_div(VALUE self, VALUE other)
+ossl_bn_div(VALUE self, SEL sel, VALUE other)
 {
     BIGNUM *bn1, *bn2 = GetBNPtr(other), *r1, *r2;
     VALUE obj1, obj2;
@@ -391,7 +391,7 @@
      *								\
      */								\
     static VALUE						\
-    ossl_bn_##func(VALUE self, VALUE other1, VALUE other2)	\
+    ossl_bn_##func(VALUE self, SEL sel, VALUE other1, VALUE other2)	\
     {								\
 	BIGNUM *bn1, *bn2 = GetBNPtr(other1);			\
 	BIGNUM *bn3 = GetBNPtr(other2), *result;		\
@@ -419,7 +419,7 @@
      *							\
      */							\
     static VALUE					\
-    ossl_bn_##func(VALUE self, VALUE bit)		\
+    ossl_bn_##func(VALUE self, SEL sel, VALUE bit)	\
     {							\
 	BIGNUM *bn;					\
 	GetBN(self, bn);				\
@@ -437,7 +437,7 @@
  *    bn.bit_set?(bit) => true | false
  */
 static VALUE
-ossl_bn_is_bit_set(VALUE self, VALUE bit)
+ossl_bn_is_bit_set(VALUE self, SEL sel, VALUE bit)
 {
     int b;
     BIGNUM *bn;
@@ -457,7 +457,7 @@
      *							\
      */							\
     static VALUE					\
-    ossl_bn_##func(VALUE self, VALUE bits)		\
+    ossl_bn_##func(VALUE self, SEL sel, VALUE bits)	\
     {							\
 	BIGNUM *bn, *result;				\
 	int b;						\
@@ -484,7 +484,7 @@
      *							\
      */							\
     static VALUE					\
-    ossl_bn_self_##func(VALUE self, VALUE bits)		\
+    ossl_bn_self_##func(VALUE self, SEL sel, VALUE bits) \
     {							\
 	BIGNUM *bn;					\
 	int b;						\
@@ -504,7 +504,7 @@
      *								\
      */								\
     static VALUE						\
-    ossl_bn_s_##func(int argc, VALUE *argv, VALUE klass)	\
+    ossl_bn_s_##func(VALUE klass, SEL sel, int argc, VALUE *argv)	\
     {								\
 	BIGNUM *result;						\
 	int bottom = 0, top = 0, b;				\
@@ -538,7 +538,7 @@
      *								\
      */								\
     static VALUE						\
-    ossl_bn_s_##func##_range(VALUE klass, VALUE range)		\
+    ossl_bn_s_##func##_range(VALUE klass, SEL sel, VALUE range)	\
     {								\
 	BIGNUM *bn = GetBNPtr(range), *result;			\
 	VALUE obj;						\
@@ -566,7 +566,7 @@
  * * +rem+ - BN
  */
 static VALUE
-ossl_bn_s_generate_prime(int argc, VALUE *argv, VALUE klass)
+ossl_bn_s_generate_prime(VALUE klass, SEL sel, int argc, VALUE *argv)
 {
     BIGNUM *add = NULL, *rem = NULL, *result;
     int safe = 1, num;
@@ -602,7 +602,7 @@
      *							\
      */							\
     static VALUE 				\
-    ossl_bn_##func(VALUE self)			\
+    ossl_bn_##func(VALUE self, SEL sel)		\
     {						\
 	BIGNUM *bn;				\
 	GetBN(self, bn);			\
@@ -612,7 +612,7 @@
 BIGNUM_NUM(num_bits)
 
 static VALUE
-ossl_bn_copy(VALUE self, VALUE other)
+ossl_bn_copy(VALUE self, SEL sel, VALUE other)
 {
     BIGNUM *bn1, *bn2;
     
@@ -636,7 +636,7 @@
      *							\
      */							\
     static VALUE					\
-    ossl_bn_##func(VALUE self, VALUE other)		\
+    ossl_bn_##func(VALUE self, SEL sel, VALUE other)	\
     {							\
 	BIGNUM *bn1, *bn2 = GetBNPtr(other);		\
 	GetBN(self, bn1);				\
@@ -646,9 +646,9 @@
 BIGNUM_CMP(ucmp)
 
 static VALUE
-ossl_bn_eql(VALUE self, VALUE other)
+ossl_bn_eql(VALUE self, SEL sel, VALUE other)
 {
-    if (ossl_bn_cmp(self, other) == INT2FIX(0)) {
+    if (ossl_bn_cmp(self, 0, other) == INT2FIX(0)) {
 	return Qtrue;
     }
     return Qfalse;
@@ -663,7 +663,7 @@
  * * +checks+ - integer
  */
 static VALUE
-ossl_bn_is_prime(int argc, VALUE *argv, VALUE self)
+ossl_bn_is_prime(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     BIGNUM *bn;
     VALUE vchecks;
@@ -696,7 +696,7 @@
  * * +trial_div+ - boolean
  */
 static VALUE
-ossl_bn_is_prime_fasttest(int argc, VALUE *argv, VALUE self)
+ossl_bn_is_prime_fasttest(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     BIGNUM *bn;
     VALUE vchecks, vtrivdiv;
@@ -743,33 +743,33 @@
 
     cBN = rb_define_class_under(mOSSL, "BN", rb_cObject);
 
-    rb_define_alloc_func(cBN, ossl_bn_alloc);
-    rb_define_method(cBN, "initialize", ossl_bn_initialize, -1);
+    rb_objc_define_method(*(VALUE *)cBN, "alloc", ossl_bn_alloc, 0);
+    rb_objc_define_method(cBN, "initialize", ossl_bn_initialize, -1);
 	
     rb_define_copy_func(cBN, ossl_bn_copy);
-    rb_define_method(cBN, "copy", ossl_bn_copy, 1);
+    rb_objc_define_method(cBN, "copy", ossl_bn_copy, 1);
 
     /* swap (=coerce?) */
 
-    rb_define_method(cBN, "num_bytes", ossl_bn_num_bytes, 0);
-    rb_define_method(cBN, "num_bits", ossl_bn_num_bits, 0);
+    rb_objc_define_method(cBN, "num_bytes", ossl_bn_num_bytes, 0);
+    rb_objc_define_method(cBN, "num_bits", ossl_bn_num_bits, 0);
     /* num_bits_word */
 
-    rb_define_method(cBN, "+", ossl_bn_add, 1);
-    rb_define_method(cBN, "-", ossl_bn_sub, 1);
-    rb_define_method(cBN, "*", ossl_bn_mul, 1);
-    rb_define_method(cBN, "sqr", ossl_bn_sqr, 0);
-    rb_define_method(cBN, "/", ossl_bn_div, 1);
-    rb_define_method(cBN, "%", ossl_bn_mod, 1);
+    rb_objc_define_method(cBN, "+", ossl_bn_add, 1);
+    rb_objc_define_method(cBN, "-", ossl_bn_sub, 1);
+    rb_objc_define_method(cBN, "*", ossl_bn_mul, 1);
+    rb_objc_define_method(cBN, "sqr", ossl_bn_sqr, 0);
+    rb_objc_define_method(cBN, "/", ossl_bn_div, 1);
+    rb_objc_define_method(cBN, "%", ossl_bn_mod, 1);
     /* nnmod */
 
-    rb_define_method(cBN, "mod_add", ossl_bn_mod_add, 2);
-    rb_define_method(cBN, "mod_sub", ossl_bn_mod_sub, 2);
-    rb_define_method(cBN, "mod_mul", ossl_bn_mod_mul, 2);
-    rb_define_method(cBN, "mod_sqr", ossl_bn_mod_sqr, 1);
-    rb_define_method(cBN, "**", ossl_bn_exp, 1);
-    rb_define_method(cBN, "mod_exp", ossl_bn_mod_exp, 2);
-    rb_define_method(cBN, "gcd", ossl_bn_gcd, 1);
+    rb_objc_define_method(cBN, "mod_add", ossl_bn_mod_add, 2);
+    rb_objc_define_method(cBN, "mod_sub", ossl_bn_mod_sub, 2);
+    rb_objc_define_method(cBN, "mod_mul", ossl_bn_mod_mul, 2);
+    rb_objc_define_method(cBN, "mod_sqr", ossl_bn_mod_sqr, 1);
+    rb_objc_define_method(cBN, "**", ossl_bn_exp, 1);
+    rb_objc_define_method(cBN, "mod_exp", ossl_bn_mod_exp, 2);
+    rb_objc_define_method(cBN, "gcd", ossl_bn_gcd, 1);
 
     /* add_word
      * sub_word
@@ -777,16 +777,16 @@
      * div_word
      * mod_word */
 
-    rb_define_method(cBN, "cmp", ossl_bn_cmp, 1);
+    rb_objc_define_method(cBN, "cmp", ossl_bn_cmp, 1);
     rb_define_alias(cBN, "<=>", "cmp");
-    rb_define_method(cBN, "ucmp", ossl_bn_ucmp, 1);
-    rb_define_method(cBN, "eql?", ossl_bn_eql, 1);
+    rb_objc_define_method(cBN, "ucmp", ossl_bn_ucmp, 1);
+    rb_objc_define_method(cBN, "eql?", ossl_bn_eql, 1);
     rb_define_alias(cBN, "==", "eql?");
     rb_define_alias(cBN, "===", "eql?");
-    rb_define_method(cBN, "zero?", ossl_bn_is_zero, 0);
-    rb_define_method(cBN, "one?", ossl_bn_is_one, 0);
+    rb_objc_define_method(cBN, "zero?", ossl_bn_is_zero, 0);
+    rb_objc_define_method(cBN, "one?", ossl_bn_is_one, 0);
     /* is_word */
-    rb_define_method(cBN, "odd?", ossl_bn_is_odd, 0);
+    rb_objc_define_method(cBN, "odd?", ossl_bn_is_odd, 0);
 
     /* zero
      * one
@@ -794,22 +794,22 @@
      * set_word
      * get_word */
     
-    rb_define_singleton_method(cBN, "rand", ossl_bn_s_rand, -1);
-    rb_define_singleton_method(cBN, "pseudo_rand", ossl_bn_s_pseudo_rand, -1);
-    rb_define_singleton_method(cBN, "rand_range", ossl_bn_s_rand_range, 1);
-    rb_define_singleton_method(cBN, "pseudo_rand_range", ossl_bn_s_pseudo_rand_range, 1);
+    rb_objc_define_method(*(VALUE *)cBN, "rand", ossl_bn_s_rand, -1);
+    rb_objc_define_method(*(VALUE *)cBN, "pseudo_rand", ossl_bn_s_pseudo_rand, -1);
+    rb_objc_define_method(*(VALUE *)cBN, "rand_range", ossl_bn_s_rand_range, 1);
+    rb_objc_define_method(*(VALUE *)cBN, "pseudo_rand_range", ossl_bn_s_pseudo_rand_range, 1);
 
-    rb_define_singleton_method(cBN, "generate_prime", ossl_bn_s_generate_prime, -1);
-    rb_define_method(cBN, "prime?", ossl_bn_is_prime, -1);
+    rb_objc_define_method(*(VALUE *)cBN, "generate_prime", ossl_bn_s_generate_prime, -1);
+    rb_objc_define_method(cBN, "prime?", ossl_bn_is_prime, -1);
 
-    rb_define_method(cBN, "set_bit!", ossl_bn_set_bit, 1);
-    rb_define_method(cBN, "clear_bit!", ossl_bn_clear_bit, 1);
-    rb_define_method(cBN, "bit_set?", ossl_bn_is_bit_set, 1);
-    rb_define_method(cBN, "mask_bits!", ossl_bn_mask_bits, 1);
-    rb_define_method(cBN, "<<", ossl_bn_lshift, 1);
-    rb_define_method(cBN, ">>", ossl_bn_rshift, 1);
-    rb_define_method(cBN, "lshift!", ossl_bn_self_lshift, 1);
-    rb_define_method(cBN, "rshift!", ossl_bn_self_rshift, 1);
+    rb_objc_define_method(cBN, "set_bit!", ossl_bn_set_bit, 1);
+    rb_objc_define_method(cBN, "clear_bit!", ossl_bn_clear_bit, 1);
+    rb_objc_define_method(cBN, "bit_set?", ossl_bn_is_bit_set, 1);
+    rb_objc_define_method(cBN, "mask_bits!", ossl_bn_mask_bits, 1);
+    rb_objc_define_method(cBN, "<<", ossl_bn_lshift, 1);
+    rb_objc_define_method(cBN, ">>", ossl_bn_rshift, 1);
+    rb_objc_define_method(cBN, "lshift!", ossl_bn_self_lshift, 1);
+    rb_objc_define_method(cBN, "rshift!", ossl_bn_self_rshift, 1);
     /* lshift1 - DON'T IMPL. */
     /* rshift1 - DON'T IMPL. */
 
@@ -825,11 +825,11 @@
      * bn2mpi
      * mpi2bn
      */
-    rb_define_method(cBN, "to_s", ossl_bn_to_s, -1);
-    rb_define_method(cBN, "to_i", ossl_bn_to_i, 0);
+    rb_objc_define_method(cBN, "to_s", ossl_bn_to_s, -1);
+    rb_objc_define_method(cBN, "to_i", ossl_bn_to_i, 0);
     rb_define_alias(cBN, "to_int", "to_i");
-    rb_define_method(cBN, "to_bn", ossl_bn_to_bn, 0);
-    rb_define_method(cBN, "coerce", ossl_bn_coerce, 1);
+    rb_objc_define_method(cBN, "to_bn", ossl_bn_to_bn, 0);
+    rb_objc_define_method(cBN, "coerce", ossl_bn_coerce, 1);
 	
     /*
      * TODO:
@@ -838,7 +838,7 @@
      * to_mpi
      */
 
-    rb_define_method(cBN, "mod_inverse", ossl_bn_mod_inverse, 1);
+    rb_objc_define_method(cBN, "mod_inverse", ossl_bn_mod_inverse, 1);
 
     /* RECiProcal
      * MONTgomery */
@@ -847,6 +847,6 @@
      * TODO:
      * Where to belong these?
      */
-    rb_define_method(cBN, "prime_fasttest?", ossl_bn_is_prime_fasttest, -1);
+    rb_objc_define_method(cBN, "prime_fasttest?", ossl_bn_is_prime_fasttest, -1);
 }
 

Modified: MacRuby/trunk/ext/openssl/ossl_cipher.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_cipher.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_cipher.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -29,7 +29,7 @@
 VALUE cCipher;
 VALUE eCipherError;
 
-static VALUE ossl_cipher_alloc(VALUE klass);
+static VALUE ossl_cipher_alloc(VALUE klass, SEL sel);
 
 /*
  * PUBLIC
@@ -50,7 +50,7 @@
     VALUE ret;
     EVP_CIPHER_CTX *ctx;
 
-    ret = ossl_cipher_alloc(cCipher);
+    ret = ossl_cipher_alloc(cCipher, 0);
     GetCipher(ret, ctx);
     EVP_CIPHER_CTX_init(ctx);
     if (EVP_CipherInit_ex(ctx, cipher, NULL, NULL, NULL, -1) != 1)
@@ -72,7 +72,7 @@
 }
 
 static VALUE
-ossl_cipher_alloc(VALUE klass)
+ossl_cipher_alloc(VALUE klass, SEL sel)
 {
     EVP_CIPHER_CTX *ctx;
     VALUE obj;
@@ -92,7 +92,7 @@
  *  A list of cipher names is available by calling OpenSSL::Cipher.ciphers.
  */
 static VALUE
-ossl_cipher_initialize(VALUE self, VALUE str)
+ossl_cipher_initialize(VALUE self, SEL sel, VALUE str)
 {
     EVP_CIPHER_CTX *ctx;
     const EVP_CIPHER *cipher;
@@ -141,7 +141,7 @@
  *  Returns the names of all available ciphers in an array.
  */
 static VALUE
-ossl_s_ciphers(VALUE self)
+ossl_s_ciphers(VALUE self, SEL sel)
 {
     VALUE ary;
 
@@ -163,7 +163,7 @@
  *  Internally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, -1).
  */
 static VALUE
-ossl_cipher_reset(VALUE self)
+ossl_cipher_reset(VALUE self, SEL sel)
 {
     EVP_CIPHER_CTX *ctx;
 
@@ -228,7 +228,7 @@
  *  Internally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, 1).
  */
 static VALUE
-ossl_cipher_encrypt(int argc, VALUE *argv, VALUE self)
+ossl_cipher_encrypt(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     return ossl_cipher_init(argc, argv, self, 1);
 }
@@ -243,7 +243,7 @@
  *  Internally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, 0).
  */
 static VALUE
-ossl_cipher_decrypt(int argc, VALUE *argv, VALUE self)
+ossl_cipher_decrypt(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     return ossl_cipher_init(argc, argv, self, 0);
 }
@@ -267,7 +267,7 @@
  *
  */
 static VALUE
-ossl_cipher_pkcs5_keyivgen(int argc, VALUE *argv, VALUE self)
+ossl_cipher_pkcs5_keyivgen(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     EVP_CIPHER_CTX *ctx;
     const EVP_MD *digest;
@@ -306,7 +306,7 @@
  *  +buffer+ is an optional string to store the result.
  */
 static VALUE 
-ossl_cipher_update(int argc, VALUE *argv, VALUE self)
+ossl_cipher_update(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     EVP_CIPHER_CTX *ctx;
     unsigned char *in;
@@ -346,7 +346,7 @@
  *  See EVP_CipherFinal_ex for further information.
  */
 static VALUE 
-ossl_cipher_final(VALUE self)
+ossl_cipher_final(VALUE self, SEL sel)
 {
     EVP_CIPHER_CTX *ctx;
     int out_len;
@@ -369,7 +369,7 @@
  *  Returns the name of the cipher which may differ slightly from the original name provided.
  */
 static VALUE
-ossl_cipher_name(VALUE self)
+ossl_cipher_name(VALUE self, SEL sel)
 {
     EVP_CIPHER_CTX *ctx;
 
@@ -387,7 +387,7 @@
  *  Only call this method after calling cipher.encrypt or cipher.decrypt.
  */
 static VALUE
-ossl_cipher_set_key(VALUE self, VALUE key)
+ossl_cipher_set_key(VALUE self, SEL sel, VALUE key)
 {
     EVP_CIPHER_CTX *ctx;
 
@@ -412,7 +412,7 @@
  *  Only call this method after calling cipher.encrypt or cipher.decrypt.
  */
 static VALUE
-ossl_cipher_set_iv(VALUE self, VALUE iv)
+ossl_cipher_set_iv(VALUE self, SEL sel, VALUE iv)
 {
     EVP_CIPHER_CTX *ctx;
 
@@ -441,7 +441,7 @@
  *  See EVP_CIPHER_CTX_set_key_length for further information.
  */
 static VALUE
-ossl_cipher_set_key_length(VALUE self, VALUE key_length)
+ossl_cipher_set_key_length(VALUE self, SEL sel, VALUE key_length)
 {
     int len = NUM2INT(key_length);
     EVP_CIPHER_CTX *ctx;
@@ -465,7 +465,7 @@
  *  See EVP_CIPHER_CTX_set_padding for further information.
  */
 static VALUE
-ossl_cipher_set_padding(VALUE self, VALUE padding)
+ossl_cipher_set_padding(VALUE self, SEL sel, VALUE padding)
 {
     EVP_CIPHER_CTX *ctx;
     int pad = NUM2INT(padding);
@@ -481,7 +481,7 @@
 
 #define CIPHER_0ARG_INT(func)					\
     static VALUE						\
-    ossl_cipher_##func(VALUE self)				\
+    ossl_cipher_##func(VALUE self, SEL sel)				\
     {								\
 	EVP_CIPHER_CTX *ctx;					\
 	GetCipher(self, ctx);					\
@@ -524,23 +524,23 @@
     cCipher = rb_define_class_under(mOSSL, "Cipher", rb_cObject);
     eCipherError = rb_define_class_under(cCipher, "CipherError", eOSSLError);
 
-    rb_define_alloc_func(cCipher, ossl_cipher_alloc);
+    rb_objc_define_method(*(VALUE *)cCipher, "alloc", ossl_cipher_alloc, 0);
     rb_define_copy_func(cCipher, ossl_cipher_copy);
-    rb_define_module_function(cCipher, "ciphers", ossl_s_ciphers, 0);
-    rb_define_method(cCipher, "initialize", ossl_cipher_initialize, 1);
-    rb_define_method(cCipher, "reset", ossl_cipher_reset, 0);
-    rb_define_method(cCipher, "encrypt", ossl_cipher_encrypt, -1);
-    rb_define_method(cCipher, "decrypt", ossl_cipher_decrypt, -1);
-    rb_define_method(cCipher, "pkcs5_keyivgen", ossl_cipher_pkcs5_keyivgen, -1);
-    rb_define_method(cCipher, "update", ossl_cipher_update, -1);
-    rb_define_method(cCipher, "final", ossl_cipher_final, 0);
-    rb_define_method(cCipher, "name", ossl_cipher_name, 0);
-    rb_define_method(cCipher, "key=", ossl_cipher_set_key, 1);
-    rb_define_method(cCipher, "key_len=", ossl_cipher_set_key_length, 1);
-    rb_define_method(cCipher, "key_len", ossl_cipher_key_length, 0);
-    rb_define_method(cCipher, "iv=", ossl_cipher_set_iv, 1);
-    rb_define_method(cCipher, "iv_len", ossl_cipher_iv_length, 0);
-    rb_define_method(cCipher, "block_size", ossl_cipher_block_size, 0);
-    rb_define_method(cCipher, "padding=", ossl_cipher_set_padding, 1);
+    rb_objc_define_method(*(VALUE *)cCipher, "ciphers", ossl_s_ciphers, 0);
+    rb_objc_define_method(cCipher, "initialize", ossl_cipher_initialize, 1);
+    rb_objc_define_method(cCipher, "reset", ossl_cipher_reset, 0);
+    rb_objc_define_method(cCipher, "encrypt", ossl_cipher_encrypt, -1);
+    rb_objc_define_method(cCipher, "decrypt", ossl_cipher_decrypt, -1);
+    rb_objc_define_method(cCipher, "pkcs5_keyivgen", ossl_cipher_pkcs5_keyivgen, -1);
+    rb_objc_define_method(cCipher, "update", ossl_cipher_update, -1);
+    rb_objc_define_method(cCipher, "final", ossl_cipher_final, 0);
+    rb_objc_define_method(cCipher, "name", ossl_cipher_name, 0);
+    rb_objc_define_method(cCipher, "key=", ossl_cipher_set_key, 1);
+    rb_objc_define_method(cCipher, "key_len=", ossl_cipher_set_key_length, 1);
+    rb_objc_define_method(cCipher, "key_len", ossl_cipher_key_length, 0);
+    rb_objc_define_method(cCipher, "iv=", ossl_cipher_set_iv, 1);
+    rb_objc_define_method(cCipher, "iv_len", ossl_cipher_iv_length, 0);
+    rb_objc_define_method(cCipher, "block_size", ossl_cipher_block_size, 0);
+    rb_objc_define_method(cCipher, "padding=", ossl_cipher_set_padding, 1);
 }
 

Modified: MacRuby/trunk/ext/openssl/ossl_config.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_config.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_config.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -89,7 +89,7 @@
 }
 
 static VALUE
-ossl_config_s_parse(VALUE klass, VALUE str)
+ossl_config_s_parse(VALUE klass, SEL sel, VALUE str)
 {
     CONF *conf;
     VALUE obj;
@@ -101,7 +101,7 @@
 }
 
 static VALUE
-ossl_config_s_alloc(VALUE klass)
+ossl_config_s_alloc(VALUE klass, SEL sel)
 {
     CONF *conf;
     VALUE obj;
@@ -127,7 +127,7 @@
 }
 
 static VALUE
-ossl_config_initialize(int argc, VALUE *argv, VALUE self)
+ossl_config_initialize(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     CONF *conf;
     long eline = -1;
@@ -202,7 +202,7 @@
 
 #if !defined(OSSL_NO_CONF_API)
 static VALUE
-ossl_config_add_value_m(VALUE self, VALUE section, VALUE name, VALUE value)
+ossl_config_add_value_m(VALUE self, SEL sel, VALUE section, VALUE name, VALUE value)
 {
     rb_ossl_config_modify_check(self);
     return ossl_config_add_value(self, section, name, value);
@@ -212,7 +212,7 @@
 #endif
 
 static VALUE
-ossl_config_get_value(VALUE self, VALUE section, VALUE name)
+ossl_config_get_value(VALUE self, SEL sel, VALUE section, VALUE name)
 {
     CONF *conf;
     char *str;
@@ -230,7 +230,7 @@
 }
 
 static VALUE
-ossl_config_get_value_old(int argc, VALUE *argv, VALUE self)
+ossl_config_get_value_old(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     VALUE section, name;
     
@@ -245,7 +245,7 @@
     }
     /* NOTE: Don't care about conf.get_value(nil, nil) */
     rb_warn("Config#value is deprecated; use Config#get_value");
-    return ossl_config_get_value(self, section, name);
+    return ossl_config_get_value(self, 0, section, name);
 }
 
 static VALUE
@@ -262,7 +262,7 @@
 }
 
 static VALUE
-ossl_config_set_section(VALUE self, VALUE section, VALUE hash)
+ossl_config_set_section(VALUE self, SEL sel, VALUE section, VALUE hash)
 {
     VALUE arg[2];
 
@@ -278,7 +278,7 @@
  * long number = CONF_get_number(confp->config, sect, StringValuePtr(item));
  */
 static VALUE
-ossl_config_get_section(VALUE self, VALUE section)
+ossl_config_get_section(VALUE self, SEL sel, VALUE section)
 {
     CONF *conf;
     STACK_OF(CONF_VALUE) *sk;
@@ -306,10 +306,10 @@
 }
 
 static VALUE
-ossl_config_get_section_old(VALUE self, VALUE section)
+ossl_config_get_section_old(VALUE self, SEL sel, VALUE section)
 {
     rb_warn("Config#section is deprecated; use Config#[]");
-    return ossl_config_get_section(self, section);
+    return ossl_config_get_section(self, 0, section);
 }
 
 #ifdef IMPLEMENT_LHASH_DOALL_ARG_FN
@@ -323,7 +323,7 @@
 static IMPLEMENT_LHASH_DOALL_ARG_FN(get_conf_section, CONF_VALUE*, VALUE)
 
 static VALUE
-ossl_config_get_sections(VALUE self)
+ossl_config_get_sections(VALUE self, SEL sel)
 {
     CONF *conf;
     VALUE ary;
@@ -372,7 +372,7 @@
 }
 
 static VALUE
-ossl_config_to_s(VALUE self)
+ossl_config_to_s(VALUE self, SEL sel)
 {
     CONF *conf;
 
@@ -405,7 +405,7 @@
 static IMPLEMENT_LHASH_DOALL_ARG_FN(each_conf_value, CONF_VALUE*, void*)
 
 static VALUE
-ossl_config_each(VALUE self)
+ossl_config_each(VALUE self, SEL sel)
 {
     CONF *conf;
 
@@ -418,21 +418,21 @@
 }
 #else
 static VALUE
-ossl_config_get_sections(VALUE self)
+ossl_config_get_sections(VALUE self, SEL sel)
 {
     rb_warn("#sections don't work with %s", OPENSSL_VERSION_TEXT);
     return rb_ary_new();
 }
 
 static VALUE
-ossl_config_to_s(VALUE self)
+ossl_config_to_s(VALUE self, SEL sel)
 {
     rb_warn("#to_s don't work with %s", OPENSSL_VERSION_TEXT);
     return rb_str_new(0, 0);
 }
 
 static VALUE
-ossl_config_each(VALUE self)
+ossl_config_each(VALUE self, SEL sel)
 {
     rb_warn("#each don't work with %s", OPENSSL_VERSION_TEXT);
     return self;
@@ -440,9 +440,9 @@
 #endif
 
 static VALUE
-ossl_config_inspect(VALUE self)
+ossl_config_inspect(VALUE self, SEL sel)
 {
-    VALUE str, ary = ossl_config_get_sections(self);
+    VALUE str, ary = ossl_config_get_sections(self, 0);
     const char *cname = rb_class2name(rb_obj_class(self));
 
     str = rb_str_new2("#<");
@@ -469,19 +469,19 @@
 		    rb_str_new2(default_config_file));
     OPENSSL_free(default_config_file);
     rb_include_module(cConfig, rb_mEnumerable);
-    rb_define_singleton_method(cConfig, "parse", ossl_config_s_parse, 1);
+    rb_objc_define_method(*(VALUE *)cConfig, "parse", ossl_config_s_parse, 1);
     rb_define_alias(CLASS_OF(cConfig), "load", "new");
-    rb_define_alloc_func(cConfig, ossl_config_s_alloc);
+    rb_objc_define_method(*(VALUE *)cConfig, "alloc", ossl_config_s_alloc, 0);
     rb_define_copy_func(cConfig, ossl_config_copy);
-    rb_define_method(cConfig, "initialize", ossl_config_initialize, -1);
-    rb_define_method(cConfig, "get_value", ossl_config_get_value, 2);
-    rb_define_method(cConfig, "value", ossl_config_get_value_old, -1);
-    rb_define_method(cConfig, "add_value", ossl_config_add_value_m, 3);
-    rb_define_method(cConfig, "[]", ossl_config_get_section, 1);
-    rb_define_method(cConfig, "section", ossl_config_get_section_old, 1);
-    rb_define_method(cConfig, "[]=", ossl_config_set_section, 2);
-    rb_define_method(cConfig, "sections", ossl_config_get_sections, 0);
-    rb_define_method(cConfig, "to_s", ossl_config_to_s, 0);
-    rb_define_method(cConfig, "each", ossl_config_each, 0);
-    rb_define_method(cConfig, "inspect", ossl_config_inspect, 0);
+    rb_objc_define_method(cConfig, "initialize", ossl_config_initialize, -1);
+    rb_objc_define_method(cConfig, "get_value", ossl_config_get_value, 2);
+    rb_objc_define_method(cConfig, "value", ossl_config_get_value_old, -1);
+    rb_objc_define_method(cConfig, "add_value", ossl_config_add_value_m, 3);
+    rb_objc_define_method(cConfig, "[]", ossl_config_get_section, 1);
+    rb_objc_define_method(cConfig, "section", ossl_config_get_section_old, 1);
+    rb_objc_define_method(cConfig, "[]=", ossl_config_set_section, 2);
+    rb_objc_define_method(cConfig, "sections", ossl_config_get_sections, 0);
+    rb_objc_define_method(cConfig, "to_s", ossl_config_to_s, 0);
+    rb_objc_define_method(cConfig, "each", ossl_config_each, 0);
+    rb_objc_define_method(cConfig, "inspect", ossl_config_inspect, 0);
 }

Modified: MacRuby/trunk/ext/openssl/ossl_digest.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_digest.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_digest.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -27,7 +27,7 @@
 VALUE cDigest;
 VALUE eDigestError;
 
-static VALUE ossl_digest_alloc(VALUE klass);
+static VALUE ossl_digest_alloc(VALUE klass, SEL sel);
 
 /*
  * Public
@@ -60,7 +60,7 @@
     VALUE ret;
     EVP_MD_CTX *ctx;
 
-    ret = ossl_digest_alloc(cDigest);
+    ret = ossl_digest_alloc(cDigest, 0);
     GetDigest(ret, ctx);
     EVP_DigestInit_ex(ctx, md, NULL);
    
@@ -71,7 +71,7 @@
  * Private
  */
 static VALUE
-ossl_digest_alloc(VALUE klass)
+ossl_digest_alloc(VALUE klass, SEL sel)
 {
     EVP_MD_CTX *ctx;
     VALUE obj;
@@ -84,7 +84,7 @@
     return obj;
 }
 
-VALUE ossl_digest_update(VALUE, VALUE);
+VALUE ossl_digest_update(VALUE, SEL, VALUE);
 
 /*
  *  call-seq:
@@ -92,7 +92,7 @@
  *
  */
 static VALUE
-ossl_digest_initialize(int argc, VALUE *argv, VALUE self)
+ossl_digest_initialize(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     EVP_MD_CTX *ctx;
     const EVP_MD *md;
@@ -105,7 +105,7 @@
     GetDigest(self, ctx);
     EVP_DigestInit_ex(ctx, md, NULL);
     
-    if (!NIL_P(data)) return ossl_digest_update(self, data);
+    if (!NIL_P(data)) return ossl_digest_update(self, 0, data);
     return self;
 }
 
@@ -132,7 +132,7 @@
  *
  */
 static VALUE
-ossl_digest_reset(VALUE self)
+ossl_digest_reset(VALUE self, SEL sel)
 {
     EVP_MD_CTX *ctx;
 
@@ -148,7 +148,7 @@
  *
  */
 VALUE
-ossl_digest_update(VALUE self, VALUE data)
+ossl_digest_update(VALUE self, SEL sel, VALUE data)
 {
     EVP_MD_CTX *ctx;
 
@@ -165,7 +165,7 @@
  *
  */
 static VALUE
-ossl_digest_finish(int argc, VALUE *argv, VALUE self)
+ossl_digest_finish(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     EVP_MD_CTX *ctx;
     VALUE str;
@@ -192,7 +192,7 @@
  *
  */
 static VALUE
-ossl_digest_name(VALUE self)
+ossl_digest_name(VALUE self, SEL sel)
 {
     EVP_MD_CTX *ctx;
 
@@ -208,7 +208,7 @@
  *  Returns the output size of the digest.
  */
 static VALUE
-ossl_digest_size(VALUE self)
+ossl_digest_size(VALUE self, SEL sel)
 {
     EVP_MD_CTX *ctx;
 
@@ -218,7 +218,7 @@
 }
 
 static VALUE
-ossl_digest_block_length(VALUE self)
+ossl_digest_block_length(VALUE self, SEL sel)
 {
     EVP_MD_CTX *ctx;
 
@@ -242,16 +242,16 @@
     cDigest = rb_define_class_under(mOSSL, "Digest", rb_path2class("Digest::Class"));
     eDigestError = rb_define_class_under(cDigest, "DigestError", eOSSLError);
 	
-    rb_define_alloc_func(cDigest, ossl_digest_alloc);
+    rb_objc_define_method(*(VALUE *)cDigest, "alloc", ossl_digest_alloc, 0);
 
-    rb_define_method(cDigest, "initialize", ossl_digest_initialize, -1);
+    rb_objc_define_method(cDigest, "initialize", ossl_digest_initialize, -1);
     rb_define_copy_func(cDigest, ossl_digest_copy);
-    rb_define_method(cDigest, "reset", ossl_digest_reset, 0);
-    rb_define_method(cDigest, "update", ossl_digest_update, 1);
+    rb_objc_define_method(cDigest, "reset", ossl_digest_reset, 0);
+    rb_objc_define_method(cDigest, "update", ossl_digest_update, 1);
     rb_define_alias(cDigest, "<<", "update");
-    rb_define_private_method(cDigest, "finish", ossl_digest_finish, -1);
-    rb_define_method(cDigest, "digest_length", ossl_digest_size, 0);
-    rb_define_method(cDigest, "block_length", ossl_digest_block_length, 0);
+    rb_objc_define_private_method(cDigest, "finish", ossl_digest_finish, -1);
+    rb_objc_define_method(cDigest, "digest_length", ossl_digest_size, 0);
+    rb_objc_define_method(cDigest, "block_length", ossl_digest_block_length, 0);
 
-    rb_define_method(cDigest, "name", ossl_digest_name, 0);
+    rb_objc_define_method(cDigest, "name", ossl_digest_name, 0);
 }

Modified: MacRuby/trunk/ext/openssl/ossl_engine.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_engine.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_engine.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -47,7 +47,7 @@
 }while(0)
 
 static VALUE
-ossl_engine_s_load(int argc, VALUE *argv, VALUE klass)
+ossl_engine_s_load(VALUE klass, SEL sel, int argc, VALUE *argv)
 {
 #if !defined(HAVE_ENGINE_LOAD_BUILTIN_ENGINES)
     return Qnil;
@@ -81,7 +81,7 @@
 }
 
 static VALUE
-ossl_engine_s_cleanup(VALUE self)
+ossl_engine_s_cleanup(VALUE self, SEL sel)
 {
 #if defined(HAVE_ENGINE_CLEANUP)
     ENGINE_cleanup();
@@ -90,7 +90,7 @@
 }
 
 static VALUE
-ossl_engine_s_engines(VALUE klass)
+ossl_engine_s_engines(VALUE klass, SEL sel)
 {
     ENGINE *e;
     VALUE ary, obj;
@@ -105,13 +105,13 @@
 }
 
 static VALUE
-ossl_engine_s_by_id(VALUE klass, VALUE id)
+ossl_engine_s_by_id(VALUE klass, SEL sel, VALUE id)
 {
     ENGINE *e;
     VALUE obj;
 
     StringValue(id);
-    ossl_engine_s_load(1, &id, klass);
+    ossl_engine_s_load(klass, 0, 1, &id);
     if(!(e = ENGINE_by_id(RSTRING_PTR(id))))
 	ossl_raise(eEngineError, NULL);
     WrapEngine(klass, obj, e);
@@ -126,7 +126,7 @@
 }
 
 static VALUE
-ossl_engine_s_alloc(VALUE klass)
+ossl_engine_s_alloc(VALUE klass, SEL sel)
 {
     ENGINE *e;
     VALUE obj;
@@ -140,7 +140,7 @@
 }
 
 static VALUE
-ossl_engine_get_id(VALUE self)
+ossl_engine_get_id(VALUE self, SEL sel)
 {
     ENGINE *e;
     GetEngine(self, e);
@@ -148,7 +148,7 @@
 }
 
 static VALUE
-ossl_engine_get_name(VALUE self)
+ossl_engine_get_name(VALUE self, SEL sel)
 {
     ENGINE *e;
     GetEngine(self, e);
@@ -156,7 +156,7 @@
 }
 
 static VALUE
-ossl_engine_finish(VALUE self)
+ossl_engine_finish(VALUE self, SEL sel)
 {
     ENGINE *e;
 
@@ -168,7 +168,7 @@
 
 #if defined(HAVE_ENGINE_GET_CIPHER)
 static VALUE
-ossl_engine_get_cipher(VALUE self, VALUE name)
+ossl_engine_get_cipher(VALUE self, SEL sel, VALUE name)
 {
     ENGINE *e;
     const EVP_CIPHER *ciph, *tmp;
@@ -191,7 +191,7 @@
 
 #if defined(HAVE_ENGINE_GET_DIGEST)
 static VALUE
-ossl_engine_get_digest(VALUE self, VALUE name)
+ossl_engine_get_digest(VALUE self, SEL sel, VALUE name)
 {
     ENGINE *e;
     const EVP_MD *md, *tmp;
@@ -213,7 +213,7 @@
 #endif
 
 static VALUE
-ossl_engine_load_privkey(int argc, VALUE *argv, VALUE self)
+ossl_engine_load_privkey(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     ENGINE *e;
     EVP_PKEY *pkey;
@@ -237,7 +237,7 @@
 }
 
 static VALUE
-ossl_engine_load_pubkey(int argc, VALUE *argv, VALUE self)
+ossl_engine_load_pubkey(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     ENGINE *e;
     EVP_PKEY *pkey;
@@ -259,7 +259,7 @@
 }
 
 static VALUE
-ossl_engine_set_default(VALUE self, VALUE flag)
+ossl_engine_set_default(VALUE self, SEL sel, VALUE flag)
 {
     ENGINE *e;
     int f = NUM2INT(flag);
@@ -271,7 +271,7 @@
 }
 
 static VALUE
-ossl_engine_ctrl_cmd(int argc, VALUE *argv, VALUE self)
+ossl_engine_ctrl_cmd(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     ENGINE *e;
     VALUE cmd, val;
@@ -301,7 +301,7 @@
 }
 
 static VALUE
-ossl_engine_get_cmds(VALUE self)
+ossl_engine_get_cmds(VALUE self, SEL sel)
 {
     ENGINE *e;
     const ENGINE_CMD_DEFN *defn, *p;
@@ -323,7 +323,7 @@
 }
 
 static VALUE
-ossl_engine_inspect(VALUE self)
+ossl_engine_inspect(VALUE self, SEL sel)
 {
     VALUE str;
     const char *cname = rb_class2name(rb_obj_class(self));
@@ -331,9 +331,9 @@
     str = rb_str_new2("#<");
     rb_str_cat2(str, cname);
     rb_str_cat2(str, " id=\"");
-    rb_str_append(str, ossl_engine_get_id(self));
+    rb_str_append(str, ossl_engine_get_id(self, 0));
     rb_str_cat2(str, "\" name=\"");
-    rb_str_append(str, ossl_engine_get_name(self));
+    rb_str_append(str, ossl_engine_get_name(self, 0));
     rb_str_cat2(str, "\">");
 
     return str;
@@ -347,24 +347,24 @@
     cEngine = rb_define_class_under(mOSSL, "Engine", rb_cObject);
     eEngineError = rb_define_class_under(cEngine, "EngineError", eOSSLError);
 
-    rb_define_alloc_func(cEngine, ossl_engine_s_alloc);
-    rb_define_singleton_method(cEngine, "load", ossl_engine_s_load, -1);
-    rb_define_singleton_method(cEngine, "cleanup", ossl_engine_s_cleanup, 0);
-    rb_define_singleton_method(cEngine, "engines", ossl_engine_s_engines, 0);
-    rb_define_singleton_method(cEngine, "by_id", ossl_engine_s_by_id, 1);
+    rb_objc_define_method(*(VALUE *)cEngine, "alloc", ossl_engine_s_alloc, 0);
+    rb_objc_define_method(*(VALUE *)cEngine, "load", ossl_engine_s_load, -1);
+    rb_objc_define_method(*(VALUE *)cEngine, "cleanup", ossl_engine_s_cleanup, 0);
+    rb_objc_define_method(*(VALUE *)cEngine, "engines", ossl_engine_s_engines, 0);
+    rb_objc_define_method(*(VALUE *)cEngine, "by_id", ossl_engine_s_by_id, 1);
     rb_undef_method(CLASS_OF(cEngine), "new");
 
-    rb_define_method(cEngine, "id", ossl_engine_get_id, 0);
-    rb_define_method(cEngine, "name", ossl_engine_get_name, 0);
-    rb_define_method(cEngine, "finish", ossl_engine_finish, 0);
-    rb_define_method(cEngine, "cipher", ossl_engine_get_cipher, 1);
-    rb_define_method(cEngine, "digest",  ossl_engine_get_digest, 1);
-    rb_define_method(cEngine, "load_private_key", ossl_engine_load_privkey, -1);
-    rb_define_method(cEngine, "load_public_key", ossl_engine_load_pubkey, -1);
-    rb_define_method(cEngine, "set_default", ossl_engine_set_default, 1);
-    rb_define_method(cEngine, "ctrl_cmd", ossl_engine_ctrl_cmd, -1);
-    rb_define_method(cEngine, "cmds", ossl_engine_get_cmds, 0);
-    rb_define_method(cEngine, "inspect", ossl_engine_inspect, 0);
+    rb_objc_define_method(cEngine, "id", ossl_engine_get_id, 0);
+    rb_objc_define_method(cEngine, "name", ossl_engine_get_name, 0);
+    rb_objc_define_method(cEngine, "finish", ossl_engine_finish, 0);
+    rb_objc_define_method(cEngine, "cipher", ossl_engine_get_cipher, 1);
+    rb_objc_define_method(cEngine, "digest",  ossl_engine_get_digest, 1);
+    rb_objc_define_method(cEngine, "load_private_key", ossl_engine_load_privkey, -1);
+    rb_objc_define_method(cEngine, "load_public_key", ossl_engine_load_pubkey, -1);
+    rb_objc_define_method(cEngine, "set_default", ossl_engine_set_default, 1);
+    rb_objc_define_method(cEngine, "ctrl_cmd", ossl_engine_ctrl_cmd, -1);
+    rb_objc_define_method(cEngine, "cmds", ossl_engine_get_cmds, 0);
+    rb_objc_define_method(cEngine, "inspect", ossl_engine_inspect, 0);
 
     DefEngineConst(METHOD_RSA);
     DefEngineConst(METHOD_DSA);

Modified: MacRuby/trunk/ext/openssl/ossl_hmac.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_hmac.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_hmac.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -46,7 +46,7 @@
 }
 
 static VALUE
-ossl_hmac_alloc(VALUE klass)
+ossl_hmac_alloc(VALUE klass, SEL sel)
 {
     HMAC_CTX *ctx;
     VALUE obj;
@@ -64,7 +64,7 @@
  *
  */
 static VALUE
-ossl_hmac_initialize(VALUE self, VALUE key, VALUE digest)
+ossl_hmac_initialize(VALUE self, SEL sel, VALUE key, VALUE digest)
 {
     HMAC_CTX *ctx;
 
@@ -97,7 +97,7 @@
  *
  */
 static VALUE
-ossl_hmac_update(VALUE self, VALUE data)
+ossl_hmac_update(VALUE self, SEL sel, VALUE data)
 {
     HMAC_CTX *ctx;
 
@@ -129,7 +129,7 @@
  *
  */
 static VALUE
-ossl_hmac_digest(VALUE self)
+ossl_hmac_digest(VALUE self, SEL sel)
 {
     HMAC_CTX *ctx;
     unsigned char *buf;
@@ -149,7 +149,7 @@
  *
  */
 static VALUE
-ossl_hmac_hexdigest(VALUE self)
+ossl_hmac_hexdigest(VALUE self, SEL sel)
 {
     HMAC_CTX *ctx;
     unsigned char *buf;
@@ -175,7 +175,7 @@
  *
  */
 static VALUE
-ossl_hmac_reset(VALUE self)
+ossl_hmac_reset(VALUE self, SEL sel)
 {
     HMAC_CTX *ctx;
 
@@ -191,7 +191,7 @@
  *
  */
 static VALUE
-ossl_hmac_s_digest(VALUE klass, VALUE digest, VALUE key, VALUE data)
+ossl_hmac_s_digest(VALUE klass, SEL sel, VALUE digest, VALUE key, VALUE data)
 {
     unsigned char *buf;
     unsigned int buf_len;
@@ -210,7 +210,7 @@
  *
  */
 static VALUE
-ossl_hmac_s_hexdigest(VALUE klass, VALUE digest, VALUE key, VALUE data)
+ossl_hmac_s_hexdigest(VALUE klass, SEL sel, VALUE digest, VALUE key, VALUE data)
 {
     unsigned char *buf;
     char *hexbuf;
@@ -244,18 +244,18 @@
 	
     cHMAC = rb_define_class_under(mOSSL, "HMAC", rb_cObject);
 
-    rb_define_alloc_func(cHMAC, ossl_hmac_alloc);
-    rb_define_singleton_method(cHMAC, "digest", ossl_hmac_s_digest, 3);
-    rb_define_singleton_method(cHMAC, "hexdigest", ossl_hmac_s_hexdigest, 3);
+    rb_objc_define_method(*(VALUE *)cHMAC, "alloc", ossl_hmac_alloc, 0);
+    rb_objc_define_method(*(VALUE *)cHMAC, "digest", ossl_hmac_s_digest, 3);
+    rb_objc_define_method(*(VALUE *)cHMAC, "hexdigest", ossl_hmac_s_hexdigest, 3);
     
-    rb_define_method(cHMAC, "initialize", ossl_hmac_initialize, 2);
+    rb_objc_define_method(cHMAC, "initialize", ossl_hmac_initialize, 2);
     rb_define_copy_func(cHMAC, ossl_hmac_copy);
 
-    rb_define_method(cHMAC, "reset", ossl_hmac_reset, 0);
-    rb_define_method(cHMAC, "update", ossl_hmac_update, 1);
+    rb_objc_define_method(cHMAC, "reset", ossl_hmac_reset, 0);
+    rb_objc_define_method(cHMAC, "update", ossl_hmac_update, 1);
     rb_define_alias(cHMAC, "<<", "update");
-    rb_define_method(cHMAC, "digest", ossl_hmac_digest, 0);
-    rb_define_method(cHMAC, "hexdigest", ossl_hmac_hexdigest, 0);
+    rb_objc_define_method(cHMAC, "digest", ossl_hmac_digest, 0);
+    rb_objc_define_method(cHMAC, "hexdigest", ossl_hmac_hexdigest, 0);
     rb_define_alias(cHMAC, "inspect", "hexdigest");
     rb_define_alias(cHMAC, "to_s", "hexdigest");
 }

Modified: MacRuby/trunk/ext/openssl/ossl_ns_spki.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_ns_spki.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_ns_spki.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -38,7 +38,7 @@
  * Private functions
  */
 static VALUE
-ossl_spki_alloc(VALUE klass)
+ossl_spki_alloc(VALUE klass, SEL sel)
 {
     NETSCAPE_SPKI *spki;
     VALUE obj;
@@ -52,7 +52,7 @@
 }
 
 static VALUE
-ossl_spki_initialize(int argc, VALUE *argv, VALUE self)
+ossl_spki_initialize(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     NETSCAPE_SPKI *spki;
     VALUE buffer;
@@ -76,7 +76,7 @@
 }
 
 static VALUE
-ossl_spki_to_der(VALUE self)
+ossl_spki_to_der(VALUE self, SEL sel)
 {
     NETSCAPE_SPKI *spki;
     VALUE str;
@@ -96,7 +96,7 @@
 }
 
 static VALUE
-ossl_spki_to_pem(VALUE self)
+ossl_spki_to_pem(VALUE self, SEL sel)
 {
     NETSCAPE_SPKI *spki;
     char *data;
@@ -112,7 +112,7 @@
 }
 
 static VALUE
-ossl_spki_print(VALUE self)
+ossl_spki_print(VALUE self, SEL sel)
 {
     NETSCAPE_SPKI *spki;
     BIO *out;
@@ -135,7 +135,7 @@
 }
 
 static VALUE
-ossl_spki_get_public_key(VALUE self)
+ossl_spki_get_public_key(VALUE self, SEL sel)
 {
     NETSCAPE_SPKI *spki;
     EVP_PKEY *pkey;
@@ -149,7 +149,7 @@
 }
 
 static VALUE
-ossl_spki_set_public_key(VALUE self, VALUE key)
+ossl_spki_set_public_key(VALUE self, SEL sel, VALUE key)
 {
     NETSCAPE_SPKI *spki;
 
@@ -162,7 +162,7 @@
 }
 
 static VALUE
-ossl_spki_get_challenge(VALUE self)
+ossl_spki_get_challenge(VALUE self, SEL sel)
 {
     NETSCAPE_SPKI *spki;
 
@@ -177,7 +177,7 @@
 }
 
 static VALUE
-ossl_spki_set_challenge(VALUE self, VALUE str)
+ossl_spki_set_challenge(VALUE self, SEL sel, VALUE str)
 {
     NETSCAPE_SPKI *spki;
 
@@ -192,7 +192,7 @@
 }
 
 static VALUE
-ossl_spki_sign(VALUE self, VALUE key, VALUE digest)
+ossl_spki_sign(VALUE self, SEL sel, VALUE key, VALUE digest)
 {
     NETSCAPE_SPKI *spki;
     EVP_PKEY *pkey;
@@ -212,7 +212,7 @@
  * Checks that cert signature is made with PRIVversion of this PUBLIC 'key'
  */
 static VALUE
-ossl_spki_verify(VALUE self, VALUE key)
+ossl_spki_verify(VALUE self, SEL sel, VALUE key)
 {
     NETSCAPE_SPKI *spki;
 
@@ -240,18 +240,18 @@
 	
     cSPKI = rb_define_class_under(mNetscape, "SPKI", rb_cObject);
 	
-    rb_define_alloc_func(cSPKI, ossl_spki_alloc);
-    rb_define_method(cSPKI, "initialize", ossl_spki_initialize, -1);
+    rb_objc_define_method(*(VALUE *)cSPKI, "alloc", ossl_spki_alloc, 0);
+    rb_objc_define_method(cSPKI, "initialize", ossl_spki_initialize, -1);
 	
-    rb_define_method(cSPKI, "to_der", ossl_spki_to_der, 0);
-    rb_define_method(cSPKI, "to_pem", ossl_spki_to_pem, 0);
+    rb_objc_define_method(cSPKI, "to_der", ossl_spki_to_der, 0);
+    rb_objc_define_method(cSPKI, "to_pem", ossl_spki_to_pem, 0);
     rb_define_alias(cSPKI, "to_s", "to_pem");
-    rb_define_method(cSPKI, "to_text", ossl_spki_print, 0);
-    rb_define_method(cSPKI, "public_key", ossl_spki_get_public_key, 0);
-    rb_define_method(cSPKI, "public_key=", ossl_spki_set_public_key, 1);
-    rb_define_method(cSPKI, "sign", ossl_spki_sign, 2);
-    rb_define_method(cSPKI, "verify", ossl_spki_verify, 1);
-    rb_define_method(cSPKI, "challenge", ossl_spki_get_challenge, 0);
-    rb_define_method(cSPKI, "challenge=", ossl_spki_set_challenge, 1);
+    rb_objc_define_method(cSPKI, "to_text", ossl_spki_print, 0);
+    rb_objc_define_method(cSPKI, "public_key", ossl_spki_get_public_key, 0);
+    rb_objc_define_method(cSPKI, "public_key=", ossl_spki_set_public_key, 1);
+    rb_objc_define_method(cSPKI, "sign", ossl_spki_sign, 2);
+    rb_objc_define_method(cSPKI, "verify", ossl_spki_verify, 1);
+    rb_objc_define_method(cSPKI, "challenge", ossl_spki_get_challenge, 0);
+    rb_objc_define_method(cSPKI, "challenge=", ossl_spki_set_challenge, 1);
 }
 

Modified: MacRuby/trunk/ext/openssl/ossl_ocsp.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_ocsp.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_ocsp.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -87,7 +87,7 @@
  * OCSP::Resquest
  */
 static VALUE
-ossl_ocspreq_alloc(VALUE klass)
+ossl_ocspreq_alloc(VALUE klass, SEL sel)
 {
     OCSP_REQUEST *req;
     VALUE obj;
@@ -100,7 +100,7 @@
 }
 
 static VALUE
-ossl_ocspreq_initialize(int argc, VALUE *argv, VALUE self)
+ossl_ocspreq_initialize(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     VALUE arg;
     const unsigned char *p;
@@ -122,7 +122,7 @@
 }
 
 static VALUE
-ossl_ocspreq_add_nonce(int argc, VALUE *argv, VALUE self)
+ossl_ocspreq_add_nonce(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     OCSP_REQUEST *req;
     VALUE val;
@@ -156,7 +156,7 @@
  *  necessary. return == 0 is always an error.
  */
 static VALUE
-ossl_ocspreq_check_nonce(VALUE self, VALUE basic_resp)
+ossl_ocspreq_check_nonce(VALUE self, SEL sel, VALUE basic_resp)
 {
     OCSP_REQUEST *req;
     OCSP_BASICRESP *bs;
@@ -170,7 +170,7 @@
 }
 
 static VALUE
-ossl_ocspreq_add_certid(VALUE self, VALUE certid)
+ossl_ocspreq_add_certid(VALUE self, SEL sel, VALUE certid)
 {
     OCSP_REQUEST *req;
     OCSP_CERTID *id;
@@ -184,7 +184,7 @@
 }
 
 static VALUE
-ossl_ocspreq_get_certid(VALUE self)
+ossl_ocspreq_get_certid(VALUE self, SEL sel)
 {
     OCSP_REQUEST *req;
     OCSP_ONEREQ *one;
@@ -207,7 +207,7 @@
 }
 
 static VALUE
-ossl_ocspreq_sign(int argc, VALUE *argv, VALUE self)
+ossl_ocspreq_sign(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     VALUE signer_cert, signer_key, certs, flags;
     OCSP_REQUEST *req;
@@ -235,7 +235,7 @@
 }
 
 static VALUE
-ossl_ocspreq_verify(int argc, VALUE *argv, VALUE self)
+ossl_ocspreq_verify(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     VALUE certs, store, flags;
     OCSP_REQUEST *req;
@@ -256,7 +256,7 @@
 }
 
 static VALUE
-ossl_ocspreq_to_der(VALUE self)
+ossl_ocspreq_to_der(VALUE self, SEL sel)
 {
     OCSP_REQUEST *req;
     VALUE str;
@@ -279,7 +279,7 @@
  * OCSP::Response
  */
 static VALUE
-ossl_ocspres_s_create(VALUE klass, VALUE status, VALUE basic_resp)
+ossl_ocspres_s_create(VALUE klass, SEL sel, VALUE status, VALUE basic_resp)
 {
     OCSP_BASICRESP *bs;
     OCSP_RESPONSE *res;
@@ -296,7 +296,7 @@
 }
 
 static VALUE
-ossl_ocspres_alloc(VALUE klass)
+ossl_ocspres_alloc(VALUE klass, SEL sel)
 {
     OCSP_RESPONSE *res;
     VALUE obj;
@@ -309,7 +309,7 @@
 }
 
 static VALUE
-ossl_ocspres_initialize(int argc, VALUE *argv, VALUE self)
+ossl_ocspres_initialize(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     VALUE arg;
     const unsigned char *p;
@@ -331,7 +331,7 @@
 }
 
 static VALUE
-ossl_ocspres_status(VALUE self)
+ossl_ocspres_status(VALUE self, SEL sel)
 {
     OCSP_RESPONSE *res;
     int st;
@@ -343,7 +343,7 @@
 }
 
 static VALUE
-ossl_ocspres_status_string(VALUE self)
+ossl_ocspres_status_string(VALUE self, SEL sel)
 {
     OCSP_RESPONSE *res;
     int st;
@@ -355,7 +355,7 @@
 }
 
 static VALUE
-ossl_ocspres_get_basic(VALUE self)
+ossl_ocspres_get_basic(VALUE self, SEL sel)
 {
     OCSP_RESPONSE *res;
     OCSP_BASICRESP *bs;
@@ -370,7 +370,7 @@
 }
 
 static VALUE
-ossl_ocspres_to_der(VALUE self)
+ossl_ocspres_to_der(VALUE self, SEL sel)
 {
     OCSP_RESPONSE *res;
     VALUE str;
@@ -393,7 +393,7 @@
  * OCSP::BasicResponse
  */
 static VALUE
-ossl_ocspbres_alloc(VALUE klass)
+ossl_ocspbres_alloc(VALUE klass, SEL sel)
 {
     OCSP_BASICRESP *bs;
     VALUE obj;
@@ -406,13 +406,13 @@
 }
 
 static VALUE
-ossl_ocspbres_initialize(int argc, VALUE *argv, VALUE self)
+ossl_ocspbres_initialize(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     return self;
 }
 
 static VALUE
-ossl_ocspbres_copy_nonce(VALUE self, VALUE request)
+ossl_ocspbres_copy_nonce(VALUE self, SEL sel, VALUE request)
 {
     OCSP_BASICRESP *bs;
     OCSP_REQUEST *req;
@@ -426,7 +426,7 @@
 }
 
 static VALUE
-ossl_ocspbres_add_nonce(int argc, VALUE *argv, VALUE self)
+ossl_ocspbres_add_nonce(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     OCSP_BASICRESP *bs;
     VALUE val;
@@ -448,7 +448,7 @@
 }
 
 static VALUE
-ossl_ocspbres_add_status(VALUE self, VALUE cid, VALUE status,
+ossl_ocspbres_add_status(VALUE self, SEL sel, VALUE cid, VALUE status,
 			 VALUE reason, VALUE revtime,
 			 VALUE thisupd, VALUE nextupd, VALUE ext)
 {
@@ -516,7 +516,7 @@
 }
 
 static VALUE
-ossl_ocspbres_get_status(VALUE self)
+ossl_ocspbres_get_status(VALUE self, SEL sel)
 {
     OCSP_BASICRESP *bs;
     OCSP_SINGLERESP *single;
@@ -561,7 +561,7 @@
 } 
 
 static VALUE
-ossl_ocspbres_sign(int argc, VALUE *argv, VALUE self)
+ossl_ocspbres_sign(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     VALUE signer_cert, signer_key, certs, flags;
     OCSP_BASICRESP *bs;
@@ -591,7 +591,7 @@
 }
 
 static VALUE
-ossl_ocspbres_verify(int argc, VALUE *argv, VALUE self)
+ossl_ocspbres_verify(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     VALUE certs, store, flags, result;
     OCSP_BASICRESP *bs;
@@ -615,7 +615,7 @@
  * OCSP::CertificateId
  */
 static VALUE
-ossl_ocspcid_alloc(VALUE klass)
+ossl_ocspcid_alloc(VALUE klass, SEL sel)
 {
     OCSP_CERTID *id;
     VALUE obj;
@@ -628,7 +628,7 @@
 }
 
 static VALUE
-ossl_ocspcid_initialize(VALUE self, VALUE subject, VALUE issuer)
+ossl_ocspcid_initialize(VALUE self, SEL sel, VALUE subject, VALUE issuer)
 {
     OCSP_CERTID *id, *newid;
     X509 *x509s, *x509i;
@@ -645,7 +645,7 @@
 }
 
 static VALUE
-ossl_ocspcid_cmp(VALUE self, VALUE other)
+ossl_ocspcid_cmp(VALUE self, SEL sel, VALUE other)
 {
     OCSP_CERTID *id, *id2;
     int result;
@@ -658,7 +658,7 @@
 }
 
 static VALUE
-ossl_ocspcid_cmp_issuer(VALUE self, VALUE other)
+ossl_ocspcid_cmp_issuer(VALUE self, SEL sel, VALUE other)
 {
     OCSP_CERTID *id, *id2;
     int result;
@@ -671,7 +671,7 @@
 }
 
 static VALUE
-ossl_ocspcid_get_serial(VALUE self)
+ossl_ocspcid_get_serial(VALUE self, SEL sel)
 {
     OCSP_CERTID *id;
 
@@ -688,41 +688,41 @@
     eOCSPError = rb_define_class_under(mOCSP, "OCSPError", eOSSLError);
 
     cOCSPReq = rb_define_class_under(mOCSP, "Request", rb_cObject);
-    rb_define_alloc_func(cOCSPReq, ossl_ocspreq_alloc);
-    rb_define_method(cOCSPReq, "initialize", ossl_ocspreq_initialize, -1);
-    rb_define_method(cOCSPReq, "add_nonce", ossl_ocspreq_add_nonce, -1);
-    rb_define_method(cOCSPReq, "check_nonce", ossl_ocspreq_check_nonce, 1);
-    rb_define_method(cOCSPReq, "add_certid", ossl_ocspreq_add_certid, 1);
-    rb_define_method(cOCSPReq, "certid", ossl_ocspreq_get_certid, 0);
-    rb_define_method(cOCSPReq, "sign", ossl_ocspreq_sign, -1);
-    rb_define_method(cOCSPReq, "verify", ossl_ocspreq_verify, -1);
-    rb_define_method(cOCSPReq, "to_der", ossl_ocspreq_to_der, 0);
+    rb_objc_define_method(*(VALUE *)cOCSPReq, "alloc", ossl_ocspreq_alloc, 0);
+    rb_objc_define_method(cOCSPReq, "initialize", ossl_ocspreq_initialize, -1);
+    rb_objc_define_method(cOCSPReq, "add_nonce", ossl_ocspreq_add_nonce, -1);
+    rb_objc_define_method(cOCSPReq, "check_nonce", ossl_ocspreq_check_nonce, 1);
+    rb_objc_define_method(cOCSPReq, "add_certid", ossl_ocspreq_add_certid, 1);
+    rb_objc_define_method(cOCSPReq, "certid", ossl_ocspreq_get_certid, 0);
+    rb_objc_define_method(cOCSPReq, "sign", ossl_ocspreq_sign, -1);
+    rb_objc_define_method(cOCSPReq, "verify", ossl_ocspreq_verify, -1);
+    rb_objc_define_method(cOCSPReq, "to_der", ossl_ocspreq_to_der, 0);
 
     cOCSPRes = rb_define_class_under(mOCSP, "Response", rb_cObject);
-    rb_define_singleton_method(cOCSPRes, "create", ossl_ocspres_s_create, 2);
-    rb_define_alloc_func(cOCSPRes, ossl_ocspres_alloc);
-    rb_define_method(cOCSPRes, "initialize", ossl_ocspres_initialize, -1);
-    rb_define_method(cOCSPRes, "status", ossl_ocspres_status, 0);
-    rb_define_method(cOCSPRes, "status_string", ossl_ocspres_status_string, 0);
-    rb_define_method(cOCSPRes, "basic", ossl_ocspres_get_basic, 0);
-    rb_define_method(cOCSPRes, "to_der", ossl_ocspres_to_der, 0);
+    rb_objc_define_method(*(VALUE *)cOCSPRes, "create", ossl_ocspres_s_create, 2);
+    rb_objc_define_method(*(VALUE *)cOCSPRes, "alloc", ossl_ocspres_alloc, 0);
+    rb_objc_define_method(cOCSPRes, "initialize", ossl_ocspres_initialize, -1);
+    rb_objc_define_method(cOCSPRes, "status", ossl_ocspres_status, 0);
+    rb_objc_define_method(cOCSPRes, "status_string", ossl_ocspres_status_string, 0);
+    rb_objc_define_method(cOCSPRes, "basic", ossl_ocspres_get_basic, 0);
+    rb_objc_define_method(cOCSPRes, "to_der", ossl_ocspres_to_der, 0);
 
     cOCSPBasicRes = rb_define_class_under(mOCSP, "BasicResponse", rb_cObject);
-    rb_define_alloc_func(cOCSPBasicRes, ossl_ocspbres_alloc);
-    rb_define_method(cOCSPBasicRes, "initialize", ossl_ocspbres_initialize, -1);
-    rb_define_method(cOCSPBasicRes, "copy_nonce", ossl_ocspbres_copy_nonce, 1);
-    rb_define_method(cOCSPBasicRes, "add_nonce", ossl_ocspbres_add_nonce, -1);
-    rb_define_method(cOCSPBasicRes, "add_status", ossl_ocspbres_add_status, 7);
-    rb_define_method(cOCSPBasicRes, "status", ossl_ocspbres_get_status, 0);
-    rb_define_method(cOCSPBasicRes, "sign", ossl_ocspbres_sign, -1);
-    rb_define_method(cOCSPBasicRes, "verify", ossl_ocspbres_verify, -1);
+    rb_objc_define_method(*(VALUE *)cOCSPBasicRes, "alloc", ossl_ocspbres_alloc, 0);
+    rb_objc_define_method(cOCSPBasicRes, "initialize", ossl_ocspbres_initialize, -1);
+    rb_objc_define_method(cOCSPBasicRes, "copy_nonce", ossl_ocspbres_copy_nonce, 1);
+    rb_objc_define_method(cOCSPBasicRes, "add_nonce", ossl_ocspbres_add_nonce, -1);
+    rb_objc_define_method(cOCSPBasicRes, "add_status", ossl_ocspbres_add_status, 7);
+    rb_objc_define_method(cOCSPBasicRes, "status", ossl_ocspbres_get_status, 0);
+    rb_objc_define_method(cOCSPBasicRes, "sign", ossl_ocspbres_sign, -1);
+    rb_objc_define_method(cOCSPBasicRes, "verify", ossl_ocspbres_verify, -1);
 
     cOCSPCertId = rb_define_class_under(mOCSP, "CertificateId", rb_cObject);
-    rb_define_alloc_func(cOCSPCertId, ossl_ocspcid_alloc);
-    rb_define_method(cOCSPCertId, "initialize", ossl_ocspcid_initialize, 2);
-    rb_define_method(cOCSPCertId, "cmp", ossl_ocspcid_cmp, 1);
-    rb_define_method(cOCSPCertId, "cmp_issuer", ossl_ocspcid_cmp_issuer, 1);
-    rb_define_method(cOCSPCertId, "serial", ossl_ocspcid_get_serial, 0);
+    rb_objc_define_method(*(VALUE *)cOCSPCertId, "alloc", ossl_ocspcid_alloc, 0);
+    rb_objc_define_method(cOCSPCertId, "initialize", ossl_ocspcid_initialize, 2);
+    rb_objc_define_method(cOCSPCertId, "cmp", ossl_ocspcid_cmp, 1);
+    rb_objc_define_method(cOCSPCertId, "cmp_issuer", ossl_ocspcid_cmp_issuer, 1);
+    rb_objc_define_method(cOCSPCertId, "serial", ossl_ocspcid_get_serial, 0);
 
 #define DefOCSPConst(x) rb_define_const(mOCSP, #x, INT2NUM(OCSP_##x))
 

Modified: MacRuby/trunk/ext/openssl/ossl_pkcs12.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_pkcs12.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_pkcs12.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -37,7 +37,7 @@
  * Private
  */
 static VALUE
-ossl_pkcs12_s_allocate(VALUE klass)
+ossl_pkcs12_s_allocate(VALUE klass, SEL sel)
 {
     PKCS12 *p12;
     VALUE obj;
@@ -71,7 +71,7 @@
  * See the OpenSSL documentation for PKCS12_create().
  */
 static VALUE
-ossl_pkcs12_s_create(int argc, VALUE *argv, VALUE self)
+ossl_pkcs12_s_create(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     VALUE pass, name, pkey, cert, ca, key_nid, cert_nid, key_iter, mac_iter, keytype;
     VALUE obj;
@@ -128,7 +128,7 @@
  * * +pass+ - string
  */
 static VALUE
-ossl_pkcs12_initialize(int argc, VALUE *argv, VALUE self)
+ossl_pkcs12_initialize(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     BIO *in;
     VALUE arg, pass, pkey, cert, ca;
@@ -172,7 +172,7 @@
 }
 
 static VALUE
-ossl_pkcs12_to_der(VALUE self)
+ossl_pkcs12_to_der(VALUE self, SEL sel)
 {
     PKCS12 *p12;
     VALUE str;
@@ -201,12 +201,12 @@
      */
     cPKCS12 = rb_define_class_under(mOSSL, "PKCS12", rb_cObject);
     ePKCS12Error = rb_define_class_under(cPKCS12, "PKCS12Error", eOSSLError);
-    rb_define_singleton_method(cPKCS12, "create", ossl_pkcs12_s_create, -1);
+    rb_objc_define_method(*(VALUE *)cPKCS12, "create", ossl_pkcs12_s_create, -1);
 
-    rb_define_alloc_func(cPKCS12, ossl_pkcs12_s_allocate);
+    rb_objc_define_method(*(VALUE *)cPKCS12, "alloc", ossl_pkcs12_s_allocate, 0);
     rb_attr(cPKCS12, rb_intern("key"), 1, 0, Qfalse);
     rb_attr(cPKCS12, rb_intern("certificate"), 1, 0, Qfalse);
     rb_attr(cPKCS12, rb_intern("ca_certs"), 1, 0, Qfalse);
-    rb_define_method(cPKCS12, "initialize", ossl_pkcs12_initialize, -1);
-    rb_define_method(cPKCS12, "to_der", ossl_pkcs12_to_der, 0);
+    rb_objc_define_method(cPKCS12, "initialize", ossl_pkcs12_initialize, -1);
+    rb_objc_define_method(cPKCS12, "to_der", ossl_pkcs12_to_der, 0);
 }

Modified: MacRuby/trunk/ext/openssl/ossl_pkcs7.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_pkcs7.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_pkcs7.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -137,7 +137,7 @@
  *    PKCS7.read_smime(string) => pkcs7
  */
 static VALUE
-ossl_pkcs7_s_read_smime(VALUE klass, VALUE arg)
+ossl_pkcs7_s_read_smime(VALUE klass, SEL sel, VALUE arg)
 {
     BIO *in, *out;
     PKCS7 *pkcs7;
@@ -161,7 +161,7 @@
  *    PKCS7.write_smime(pkcs7 [, data [, flags]]) => string
  */
 static VALUE
-ossl_pkcs7_s_write_smime(int argc, VALUE *argv, VALUE klass)
+ossl_pkcs7_s_write_smime(VALUE klass, SEL sel, int argc, VALUE *argv)
 {
     VALUE pkcs7, data, flags;
     BIO *out, *in;
@@ -196,7 +196,7 @@
  *    PKCS7.sign(cert, key, data, [, certs [, flags]]) => pkcs7
  */
 static VALUE
-ossl_pkcs7_s_sign(int argc, VALUE *argv, VALUE klass)
+ossl_pkcs7_s_sign(VALUE klass, SEL sel, int argc, VALUE *argv)
 {
     VALUE cert, key, data, certs, flags;
     X509 *x509;
@@ -239,7 +239,7 @@
  *    PKCS7.encrypt(certs, data, [, cipher [, flags]]) => pkcs7
  */
 static VALUE
-ossl_pkcs7_s_encrypt(int argc, VALUE *argv, VALUE klass)
+ossl_pkcs7_s_encrypt(VALUE klass, SEL sel, int argc, VALUE *argv)
 {
     VALUE certs, data, cipher, flags;
     STACK_OF(X509) *x509s;
@@ -307,7 +307,7 @@
  * Many methods in this class aren't documented.
  */
 static VALUE
-ossl_pkcs7_initialize(int argc, VALUE *argv, VALUE self)
+ossl_pkcs7_initialize(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     PKCS7 *p7, *pkcs = DATA_PTR(self);
     BIO *in;
@@ -390,7 +390,7 @@
  *    pkcs7.type = type => type
  */
 static VALUE
-ossl_pkcs7_set_type(VALUE self, VALUE type)
+ossl_pkcs7_set_type(VALUE self, SEL sel, VALUE type)
 {
     PKCS7 *p7;
 
@@ -406,7 +406,7 @@
  *    pkcs7.type => string or nil
  */
 static VALUE
-ossl_pkcs7_get_type(VALUE self)
+ossl_pkcs7_get_type(VALUE self, SEL sel)
 {
     PKCS7 *p7;
 
@@ -425,7 +425,7 @@
 }
 
 static VALUE
-ossl_pkcs7_set_detached(VALUE self, VALUE flag)
+ossl_pkcs7_set_detached(VALUE self, SEL sel, VALUE flag)
 {
     PKCS7 *p7;
 
@@ -439,7 +439,7 @@
 }
 
 static VALUE
-ossl_pkcs7_get_detached(VALUE self)
+ossl_pkcs7_get_detached(VALUE self, SEL sel)
 {
     PKCS7 *p7;
     GetPKCS7(self, p7);
@@ -447,7 +447,7 @@
 }
 
 static VALUE
-ossl_pkcs7_detached_p(VALUE self)
+ossl_pkcs7_detached_p(VALUE self, SEL sel)
 {
     PKCS7 *p7;
     GetPKCS7(self, p7);
@@ -455,7 +455,7 @@
 }
 
 static VALUE
-ossl_pkcs7_set_cipher(VALUE self, VALUE cipher)
+ossl_pkcs7_set_cipher(VALUE self, SEL sel, VALUE cipher)
 {
     PKCS7 *pkcs7;
 
@@ -468,7 +468,7 @@
 }
 
 static VALUE
-ossl_pkcs7_add_signer(VALUE self, VALUE signer)
+ossl_pkcs7_add_signer(VALUE self, SEL sel, VALUE signer)
 {
     PKCS7 *pkcs7;
     PKCS7_SIGNER_INFO *p7si;
@@ -488,7 +488,7 @@
 }
 
 static VALUE
-ossl_pkcs7_get_signer(VALUE self)
+ossl_pkcs7_get_signer(VALUE self, SEL sel)
 {
     PKCS7 *pkcs7;
     STACK_OF(PKCS7_SIGNER_INFO) *sk;
@@ -514,7 +514,7 @@
 }
 
 static VALUE
-ossl_pkcs7_add_recipient(VALUE self, VALUE recip)
+ossl_pkcs7_add_recipient(VALUE self, SEL sel, VALUE recip)
 {
     PKCS7 *pkcs7;
     PKCS7_RECIP_INFO *ri;
@@ -530,7 +530,7 @@
 }
 
 static VALUE
-ossl_pkcs7_get_recipient(VALUE self)
+ossl_pkcs7_get_recipient(VALUE self, SEL sel)
 {
     PKCS7 *pkcs7;
     STACK_OF(PKCS7_RECIP_INFO) *sk;
@@ -558,7 +558,7 @@
 }
 
 static VALUE
-ossl_pkcs7_add_certificate(VALUE self, VALUE cert)
+ossl_pkcs7_add_certificate(VALUE self, SEL sel, VALUE cert)
 {
     PKCS7 *pkcs7;
     X509 *x509;
@@ -601,11 +601,11 @@
 static VALUE
 ossl_pkcs7_set_certs_i(VALUE i, VALUE arg)
 {
-    return ossl_pkcs7_add_certificate(arg, i);
+    return ossl_pkcs7_add_certificate(arg, 0, i);
 }
 
 static VALUE
-ossl_pkcs7_set_certificates(VALUE self, VALUE ary)
+ossl_pkcs7_set_certificates(VALUE self, SEL sel, VALUE ary)
 {
     STACK_OF(X509) *certs;
     X509 *cert;
@@ -618,13 +618,13 @@
 }
 
 static VALUE
-ossl_pkcs7_get_certificates(VALUE self)
+ossl_pkcs7_get_certificates(VALUE self, SEL sel)
 {
     return ossl_x509_sk2ary(pkcs7_get_certs_or_crls(self, 1));
 }
 
 static VALUE
-ossl_pkcs7_add_crl(VALUE self, VALUE crl)
+ossl_pkcs7_add_crl(VALUE self, SEL sel, VALUE crl)
 {
     PKCS7 *pkcs7;
     X509_CRL *x509crl;
@@ -641,11 +641,11 @@
 static VALUE
 ossl_pkcs7_set_crls_i(VALUE i, VALUE arg)
 {
-    return ossl_pkcs7_add_crl(arg, i);
+    return ossl_pkcs7_add_crl(arg, 0, i);
 }
 
 static VALUE
-ossl_pkcs7_set_crls(VALUE self, VALUE ary)
+ossl_pkcs7_set_crls(VALUE self, SEL sel, VALUE ary)
 {
     STACK_OF(X509_CRL) *crls;
     X509_CRL *crl;
@@ -658,13 +658,13 @@
 }
 
 static VALUE
-ossl_pkcs7_get_crls(VALUE self)
+ossl_pkcs7_get_crls(VALUE self, SEL sel)
 {
     return ossl_x509crl_sk2ary(pkcs7_get_certs_or_crls(self, 0));
 }
 
 static VALUE
-ossl_pkcs7_verify(int argc, VALUE *argv, VALUE self)
+ossl_pkcs7_verify(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     VALUE certs, store, indata, flags;
     STACK_OF(X509) *x509s;
@@ -708,7 +708,7 @@
 }
 
 static VALUE
-ossl_pkcs7_decrypt(int argc, VALUE *argv, VALUE self)
+ossl_pkcs7_decrypt(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     VALUE pkey, cert, flags;
     EVP_PKEY *key;
@@ -735,7 +735,7 @@
 }
 
 static VALUE
-ossl_pkcs7_add_data(VALUE self, VALUE data)
+ossl_pkcs7_add_data(VALUE self, SEL sel, VALUE data)
 {
     PKCS7 *pkcs7;
     BIO *out, *in;
@@ -769,7 +769,7 @@
 }
 
 static VALUE
-ossl_pkcs7_to_der(VALUE self)
+ossl_pkcs7_to_der(VALUE self, SEL sel)
 {
     PKCS7 *pkcs7;
     VALUE str;
@@ -789,7 +789,7 @@
 }
 
 static VALUE
-ossl_pkcs7_to_pem(VALUE self)
+ossl_pkcs7_to_pem(VALUE self, SEL sel)
 {
     PKCS7 *pkcs7;
     BIO *out;
@@ -812,7 +812,7 @@
  * SIGNER INFO
  */
 static VALUE
-ossl_pkcs7si_alloc(VALUE klass)
+ossl_pkcs7si_alloc(VALUE klass, SEL sel)
 {
     PKCS7_SIGNER_INFO *p7si;
     VALUE obj;
@@ -826,7 +826,7 @@
 }
 
 static VALUE
-ossl_pkcs7si_initialize(VALUE self, VALUE cert, VALUE key, VALUE digest)
+ossl_pkcs7si_initialize(VALUE self, SEL sel, VALUE cert, VALUE key, VALUE digest)
 {
     PKCS7_SIGNER_INFO *p7si;
     EVP_PKEY *pkey;
@@ -845,7 +845,7 @@
 }
 
 static VALUE
-ossl_pkcs7si_get_issuer(VALUE self)
+ossl_pkcs7si_get_issuer(VALUE self, SEL sel)
 {
     PKCS7_SIGNER_INFO *p7si;
 
@@ -855,7 +855,7 @@
 }
 
 static VALUE
-ossl_pkcs7si_get_serial(VALUE self)
+ossl_pkcs7si_get_serial(VALUE self, SEL sel)
 {
     PKCS7_SIGNER_INFO *p7si;
 
@@ -865,7 +865,7 @@
 }
 
 static VALUE
-ossl_pkcs7si_get_signed_time(VALUE self)
+ossl_pkcs7si_get_signed_time(VALUE self, SEL sel)
 {
     PKCS7_SIGNER_INFO *p7si;
     ASN1_TYPE *asn1obj;
@@ -891,7 +891,7 @@
  * RECIPIENT INFO
  */
 static VALUE
-ossl_pkcs7ri_alloc(VALUE klass)
+ossl_pkcs7ri_alloc(VALUE klass, SEL sel)
 {
     PKCS7_RECIP_INFO *p7ri;
     VALUE obj;
@@ -905,7 +905,7 @@
 }
 
 static VALUE
-ossl_pkcs7ri_initialize(VALUE self, VALUE cert)
+ossl_pkcs7ri_initialize(VALUE self, SEL sel, VALUE cert)
 {
     PKCS7_RECIP_INFO *p7ri;
     X509 *x509;
@@ -920,7 +920,7 @@
 }
 
 static VALUE
-ossl_pkcs7ri_get_issuer(VALUE self)
+ossl_pkcs7ri_get_issuer(VALUE self, SEL sel)
 {
     PKCS7_RECIP_INFO *p7ri;
 
@@ -930,7 +930,7 @@
 }
 
 static VALUE
-ossl_pkcs7ri_get_serial(VALUE self)
+ossl_pkcs7ri_get_serial(VALUE self, SEL sel)
 {
     PKCS7_RECIP_INFO *p7ri;
 
@@ -940,7 +940,7 @@
 }
 
 static VALUE
-ossl_pkcs7ri_get_enc_key(VALUE self)
+ossl_pkcs7ri_get_enc_key(VALUE self, SEL sel)
 {
     PKCS7_RECIP_INFO *p7ri;
 
@@ -957,54 +957,54 @@
 {
     cPKCS7 = rb_define_class_under(mOSSL, "PKCS7", rb_cObject);
     ePKCS7Error = rb_define_class_under(cPKCS7, "PKCS7Error", eOSSLError);
-    rb_define_singleton_method(cPKCS7, "read_smime", ossl_pkcs7_s_read_smime, 1);
-    rb_define_singleton_method(cPKCS7, "write_smime", ossl_pkcs7_s_write_smime, -1);
-    rb_define_singleton_method(cPKCS7, "sign",  ossl_pkcs7_s_sign, -1);
-    rb_define_singleton_method(cPKCS7, "encrypt", ossl_pkcs7_s_encrypt, -1);
+    rb_objc_define_method(*(VALUE *)cPKCS7, "read_smime", ossl_pkcs7_s_read_smime, 1);
+    rb_objc_define_method(*(VALUE *)cPKCS7, "write_smime", ossl_pkcs7_s_write_smime, -1);
+    rb_objc_define_method(*(VALUE *)cPKCS7, "sign",  ossl_pkcs7_s_sign, -1);
+    rb_objc_define_method(*(VALUE *)cPKCS7, "encrypt", ossl_pkcs7_s_encrypt, -1);
     rb_attr(cPKCS7, rb_intern("data"), 1, 0, Qfalse);
     rb_attr(cPKCS7, rb_intern("error_string"), 1, 1, Qfalse);
-    rb_define_alloc_func(cPKCS7, ossl_pkcs7_alloc);
+    rb_objc_define_method(*(VALUE *)cPKCS7, "alloc", ossl_pkcs7_alloc, 0);
     rb_define_copy_func(cPKCS7, ossl_pkcs7_copy);
-    rb_define_method(cPKCS7, "initialize", ossl_pkcs7_initialize, -1);
-    rb_define_method(cPKCS7, "type=", ossl_pkcs7_set_type, 1);
-    rb_define_method(cPKCS7, "type", ossl_pkcs7_get_type, 0);
-    rb_define_method(cPKCS7, "detached=", ossl_pkcs7_set_detached, 1);
-    rb_define_method(cPKCS7, "detached", ossl_pkcs7_get_detached, 0);
-    rb_define_method(cPKCS7, "detached?", ossl_pkcs7_detached_p, 0);
-    rb_define_method(cPKCS7, "cipher=", ossl_pkcs7_set_cipher, 1);
-    rb_define_method(cPKCS7, "add_signer", ossl_pkcs7_add_signer, 1);
-    rb_define_method(cPKCS7, "signers", ossl_pkcs7_get_signer, 0);
-    rb_define_method(cPKCS7, "add_recipient", ossl_pkcs7_add_recipient, 1);
-    rb_define_method(cPKCS7, "recipients", ossl_pkcs7_get_recipient, 0);
-    rb_define_method(cPKCS7, "add_certificate", ossl_pkcs7_add_certificate, 1);
-    rb_define_method(cPKCS7, "certificates=", ossl_pkcs7_set_certificates, 1);
-    rb_define_method(cPKCS7, "certificates", ossl_pkcs7_get_certificates, 0);
-    rb_define_method(cPKCS7, "add_crl", ossl_pkcs7_add_crl, 1);
-    rb_define_method(cPKCS7, "crls=", ossl_pkcs7_set_crls, 1);
-    rb_define_method(cPKCS7, "crls", ossl_pkcs7_get_crls, 0);
-    rb_define_method(cPKCS7, "add_data", ossl_pkcs7_add_data, 1);
+    rb_objc_define_method(cPKCS7, "initialize", ossl_pkcs7_initialize, -1);
+    rb_objc_define_method(cPKCS7, "type=", ossl_pkcs7_set_type, 1);
+    rb_objc_define_method(cPKCS7, "type", ossl_pkcs7_get_type, 0);
+    rb_objc_define_method(cPKCS7, "detached=", ossl_pkcs7_set_detached, 1);
+    rb_objc_define_method(cPKCS7, "detached", ossl_pkcs7_get_detached, 0);
+    rb_objc_define_method(cPKCS7, "detached?", ossl_pkcs7_detached_p, 0);
+    rb_objc_define_method(cPKCS7, "cipher=", ossl_pkcs7_set_cipher, 1);
+    rb_objc_define_method(cPKCS7, "add_signer", ossl_pkcs7_add_signer, 1);
+    rb_objc_define_method(cPKCS7, "signers", ossl_pkcs7_get_signer, 0);
+    rb_objc_define_method(cPKCS7, "add_recipient", ossl_pkcs7_add_recipient, 1);
+    rb_objc_define_method(cPKCS7, "recipients", ossl_pkcs7_get_recipient, 0);
+    rb_objc_define_method(cPKCS7, "add_certificate", ossl_pkcs7_add_certificate, 1);
+    rb_objc_define_method(cPKCS7, "certificates=", ossl_pkcs7_set_certificates, 1);
+    rb_objc_define_method(cPKCS7, "certificates", ossl_pkcs7_get_certificates, 0);
+    rb_objc_define_method(cPKCS7, "add_crl", ossl_pkcs7_add_crl, 1);
+    rb_objc_define_method(cPKCS7, "crls=", ossl_pkcs7_set_crls, 1);
+    rb_objc_define_method(cPKCS7, "crls", ossl_pkcs7_get_crls, 0);
+    rb_objc_define_method(cPKCS7, "add_data", ossl_pkcs7_add_data, 1);
     rb_define_alias(cPKCS7,  "data=", "add_data");
-    rb_define_method(cPKCS7, "verify", ossl_pkcs7_verify, -1);
-    rb_define_method(cPKCS7, "decrypt", ossl_pkcs7_decrypt, -1);
-    rb_define_method(cPKCS7, "to_pem", ossl_pkcs7_to_pem, 0);
+    rb_objc_define_method(cPKCS7, "verify", ossl_pkcs7_verify, -1);
+    rb_objc_define_method(cPKCS7, "decrypt", ossl_pkcs7_decrypt, -1);
+    rb_objc_define_method(cPKCS7, "to_pem", ossl_pkcs7_to_pem, 0);
     rb_define_alias(cPKCS7,  "to_s", "to_pem");
-    rb_define_method(cPKCS7, "to_der", ossl_pkcs7_to_der, 0);
+    rb_objc_define_method(cPKCS7, "to_der", ossl_pkcs7_to_der, 0);
 
     cPKCS7Signer = rb_define_class_under(cPKCS7, "SignerInfo", rb_cObject);
     rb_define_const(cPKCS7, "Signer", cPKCS7Signer);
-    rb_define_alloc_func(cPKCS7Signer, ossl_pkcs7si_alloc);
-    rb_define_method(cPKCS7Signer, "initialize", ossl_pkcs7si_initialize,3);
-    rb_define_method(cPKCS7Signer, "issuer", ossl_pkcs7si_get_issuer, 0);
+    rb_objc_define_method(*(VALUE *)cPKCS7Signer, "alloc", ossl_pkcs7si_alloc, 0);
+    rb_objc_define_method(cPKCS7Signer, "initialize", ossl_pkcs7si_initialize,3);
+    rb_objc_define_method(cPKCS7Signer, "issuer", ossl_pkcs7si_get_issuer, 0);
     rb_define_alias(cPKCS7Signer, "name", "issuer");
-    rb_define_method(cPKCS7Signer, "serial", ossl_pkcs7si_get_serial,0);
-    rb_define_method(cPKCS7Signer,"signed_time",ossl_pkcs7si_get_signed_time,0);
+    rb_objc_define_method(cPKCS7Signer, "serial", ossl_pkcs7si_get_serial,0);
+    rb_objc_define_method(cPKCS7Signer,"signed_time",ossl_pkcs7si_get_signed_time,0);
 
     cPKCS7Recipient = rb_define_class_under(cPKCS7,"RecipientInfo",rb_cObject);
-    rb_define_alloc_func(cPKCS7Recipient, ossl_pkcs7ri_alloc);
-    rb_define_method(cPKCS7Recipient, "initialize", ossl_pkcs7ri_initialize,1); 
-    rb_define_method(cPKCS7Recipient, "issuer", ossl_pkcs7ri_get_issuer,0);
-    rb_define_method(cPKCS7Recipient, "serial", ossl_pkcs7ri_get_serial,0);
-    rb_define_method(cPKCS7Recipient, "enc_key", ossl_pkcs7ri_get_enc_key,0); 
+    rb_objc_define_method(*(VALUE *)cPKCS7Recipient, "alloc", ossl_pkcs7ri_alloc, 0);
+    rb_objc_define_method(cPKCS7Recipient, "initialize", ossl_pkcs7ri_initialize,1); 
+    rb_objc_define_method(cPKCS7Recipient, "issuer", ossl_pkcs7ri_get_issuer,0);
+    rb_objc_define_method(cPKCS7Recipient, "serial", ossl_pkcs7ri_get_serial,0);
+    rb_objc_define_method(cPKCS7Recipient, "enc_key", ossl_pkcs7ri_get_enc_key,0); 
 
 #define DefPKCS7Const(x) rb_define_const(cPKCS7, #x, INT2NUM(PKCS7_##x))
 

Modified: MacRuby/trunk/ext/openssl/ossl_pkey.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_pkey.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_pkey.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -137,7 +137,7 @@
  * Private
  */
 static VALUE
-ossl_pkey_alloc(VALUE klass)
+ossl_pkey_alloc(VALUE klass, SEL sel)
 {
     EVP_PKEY *pkey;
     VALUE obj;
@@ -151,7 +151,7 @@
 }
 
 static VALUE
-ossl_pkey_initialize(VALUE self)
+ossl_pkey_initialize(VALUE self, SEL sel)
 {
     if (rb_obj_is_instance_of(self, cPKey)) {
 	ossl_raise(rb_eNotImpError, "OpenSSL::PKey::PKey is an abstract class.");
@@ -160,7 +160,7 @@
 }
 
 static VALUE
-ossl_pkey_sign(VALUE self, VALUE digest, VALUE data)
+ossl_pkey_sign(VALUE self, SEL sel, VALUE digest, VALUE data)
 {
     EVP_PKEY *pkey;
     EVP_MD_CTX ctx;
@@ -184,7 +184,7 @@
 }
 
 static VALUE
-ossl_pkey_verify(VALUE self, VALUE digest, VALUE sig, VALUE data)
+ossl_pkey_verify(VALUE self, SEL sel, VALUE digest, VALUE sig, VALUE data)
 {
     EVP_PKEY *pkey;
     EVP_MD_CTX ctx;
@@ -221,11 +221,11 @@
 
     cPKey = rb_define_class_under(mPKey, "PKey", rb_cObject);
 	
-    rb_define_alloc_func(cPKey, ossl_pkey_alloc);
-    rb_define_method(cPKey, "initialize", ossl_pkey_initialize, 0);
+    rb_objc_define_method(*(VALUE *)cPKey, "alloc", ossl_pkey_alloc, 0);
+    rb_objc_define_method(cPKey, "initialize", ossl_pkey_initialize, 0);
 
-    rb_define_method(cPKey, "sign", ossl_pkey_sign, 2);
-    rb_define_method(cPKey, "verify", ossl_pkey_verify, 3);
+    rb_objc_define_method(cPKey, "sign", ossl_pkey_sign, 2);
+    rb_objc_define_method(cPKey, "verify", ossl_pkey_verify, 3);
 	
     id_private_q = rb_intern("private?");
 	

Modified: MacRuby/trunk/ext/openssl/ossl_pkey_dh.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_pkey_dh.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_pkey_dh.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -109,7 +109,7 @@
  *
  */
 static VALUE
-ossl_dh_s_generate(int argc, VALUE *argv, VALUE klass)
+ossl_dh_s_generate(VALUE klass, SEL sel, int argc, VALUE *argv)
 {
     DH *dh ;
     int g = 2;
@@ -144,7 +144,7 @@
  *  * DH.new(File.read('key.pem')) -> dh
  */
 static VALUE
-ossl_dh_initialize(int argc, VALUE *argv, VALUE self)
+ossl_dh_initialize(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     EVP_PKEY *pkey;
     DH *dh;
@@ -394,7 +394,7 @@
  *
  */
 static VALUE
-ossl_dh_compute_key(VALUE self, VALUE pub)
+ossl_dh_compute_key(VALUE self, SEL sel, VALUE pub)
 {
     DH *dh;
     EVP_PKEY *pkey;
@@ -496,24 +496,24 @@
 
     eDHError = rb_define_class_under(mPKey, "DHError", ePKeyError);
     cDH = rb_define_class_under(mPKey, "DH", cPKey);
-    rb_define_singleton_method(cDH, "generate", ossl_dh_s_generate, -1);
-    rb_define_method(cDH, "initialize", ossl_dh_initialize, -1);
-    rb_define_method(cDH, "public?", ossl_dh_is_public, 0);
-    rb_define_method(cDH, "private?", ossl_dh_is_private, 0);
-    rb_define_method(cDH, "to_text", ossl_dh_to_text, 0);
-    rb_define_method(cDH, "export", ossl_dh_export, 0);
+    rb_objc_define_method(*(VALUE *)cDH, "generate", ossl_dh_s_generate, -1);
+    rb_objc_define_method(cDH, "initialize", ossl_dh_initialize, -1);
+    rb_objc_define_method(cDH, "public?", ossl_dh_is_public, 0);
+    rb_objc_define_method(cDH, "private?", ossl_dh_is_private, 0);
+    rb_objc_define_method(cDH, "to_text", ossl_dh_to_text, 0);
+    rb_objc_define_method(cDH, "export", ossl_dh_export, 0);
     rb_define_alias(cDH, "to_pem", "export");
     rb_define_alias(cDH, "to_s", "export");
-    rb_define_method(cDH, "to_der", ossl_dh_to_der, 0);
-    rb_define_method(cDH, "public_key", ossl_dh_to_public_key, 0);
-    rb_define_method(cDH, "params_ok?", ossl_dh_check_params, 0);
-    rb_define_method(cDH, "generate_key!", ossl_dh_generate_key, 0);
-    rb_define_method(cDH, "compute_key", ossl_dh_compute_key, 1);
+    rb_objc_define_method(cDH, "to_der", ossl_dh_to_der, 0);
+    rb_objc_define_method(cDH, "public_key", ossl_dh_to_public_key, 0);
+    rb_objc_define_method(cDH, "params_ok?", ossl_dh_check_params, 0);
+    rb_objc_define_method(cDH, "generate_key!", ossl_dh_generate_key, 0);
+    rb_objc_define_method(cDH, "compute_key", ossl_dh_compute_key, 1);
     DEF_OSSL_PKEY_BN(cDH, dh, p);
     DEF_OSSL_PKEY_BN(cDH, dh, g);
     DEF_OSSL_PKEY_BN(cDH, dh, pub_key);
     DEF_OSSL_PKEY_BN(cDH, dh, priv_key);
-    rb_define_method(cDH, "params", ossl_dh_get_params, 0);
+    rb_objc_define_method(cDH, "params", ossl_dh_get_params, 0);
 
     OSSL_DEFAULT_DH_512 = ossl_create_dh(
 	DEFAULT_DH_512_PRIM, sizeof(DEFAULT_DH_512_PRIM),

Modified: MacRuby/trunk/ext/openssl/ossl_pkey_dsa.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_pkey_dsa.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_pkey_dsa.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -108,7 +108,7 @@
  *
  */
 static VALUE
-ossl_dsa_s_generate(VALUE klass, VALUE size)
+ossl_dsa_s_generate(VALUE klass, SEL sel, VALUE size)
 {
     DSA *dsa = dsa_generate(NUM2INT(size)); /* err handled by dsa_instance */
     VALUE obj = dsa_instance(klass, dsa);
@@ -138,7 +138,7 @@
  *
  */
 static VALUE
-ossl_dsa_initialize(int argc, VALUE *argv, VALUE self)
+ossl_dsa_initialize(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     EVP_PKEY *pkey;
     DSA *dsa;
@@ -231,7 +231,7 @@
  *
  */
 static VALUE
-ossl_dsa_export(int argc, VALUE *argv, VALUE self)
+ossl_dsa_export(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     EVP_PKEY *pkey;
     BIO *out;
@@ -384,7 +384,7 @@
  *
  */
 static VALUE
-ossl_dsa_sign(VALUE self, VALUE data)
+ossl_dsa_sign(VALUE self, SEL sel, VALUE data)
 {
     EVP_PKEY *pkey;
     unsigned int buf_len;
@@ -412,7 +412,7 @@
  *
  */
 static VALUE
-ossl_dsa_verify(VALUE self, VALUE digest, VALUE sig)
+ossl_dsa_verify(VALUE self, SEL sel, VALUE digest, VALUE sig)
 {
     EVP_PKEY *pkey;
     int ret;
@@ -454,19 +454,19 @@
 
     cDSA = rb_define_class_under(mPKey, "DSA", cPKey);
 	
-    rb_define_singleton_method(cDSA, "generate", ossl_dsa_s_generate, 1);
-    rb_define_method(cDSA, "initialize", ossl_dsa_initialize, -1);
+    rb_objc_define_method(*(VALUE *)cDSA, "generate", ossl_dsa_s_generate, 1);
+    rb_objc_define_method(cDSA, "initialize", ossl_dsa_initialize, -1);
 
-    rb_define_method(cDSA, "public?", ossl_dsa_is_public, 0);
-    rb_define_method(cDSA, "private?", ossl_dsa_is_private, 0);
-    rb_define_method(cDSA, "to_text", ossl_dsa_to_text, 0);
-    rb_define_method(cDSA, "export", ossl_dsa_export, -1);
+    rb_objc_define_method(cDSA, "public?", ossl_dsa_is_public, 0);
+    rb_objc_define_method(cDSA, "private?", ossl_dsa_is_private, 0);
+    rb_objc_define_method(cDSA, "to_text", ossl_dsa_to_text, 0);
+    rb_objc_define_method(cDSA, "export", ossl_dsa_export, -1);
     rb_define_alias(cDSA, "to_pem", "export");
     rb_define_alias(cDSA, "to_s", "export");
-    rb_define_method(cDSA, "to_der", ossl_dsa_to_der, 0);
-    rb_define_method(cDSA, "public_key", ossl_dsa_to_public_key, 0);
-    rb_define_method(cDSA, "syssign", ossl_dsa_sign, 1);
-    rb_define_method(cDSA, "sysverify", ossl_dsa_verify, 2);
+    rb_objc_define_method(cDSA, "to_der", ossl_dsa_to_der, 0);
+    rb_objc_define_method(cDSA, "public_key", ossl_dsa_to_public_key, 0);
+    rb_objc_define_method(cDSA, "syssign", ossl_dsa_sign, 1);
+    rb_objc_define_method(cDSA, "sysverify", ossl_dsa_verify, 2);
 
     DEF_OSSL_PKEY_BN(cDSA, dsa, p);
     DEF_OSSL_PKEY_BN(cDSA, dsa, q);
@@ -474,7 +474,7 @@
     DEF_OSSL_PKEY_BN(cDSA, dsa, pub_key);
     DEF_OSSL_PKEY_BN(cDSA, dsa, priv_key);
 
-    rb_define_method(cDSA, "params", ossl_dsa_get_params, 0);
+    rb_objc_define_method(cDSA, "params", ossl_dsa_get_params, 0);
 }
 
 #else /* defined NO_DSA */

Modified: MacRuby/trunk/ext/openssl/ossl_pkey_ec.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_pkey_ec.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_pkey_ec.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -639,13 +639,15 @@
 
 /* BUG: need a way to figure out the maximum string size */
     buf_len = 1024;
-    str = rb_str_new(0, buf_len);
+    str = rb_bytestring_new();
+    rb_bytestring_resize(str, buf_len);
 /* BUG: take KDF as a block */
-    buf_len = ECDH_compute_key(RSTRING_PTR(str), buf_len, point, ec, NULL);
+    buf_len = ECDH_compute_key(rb_bytestring_byte_pointer(str), buf_len,
+	    point, ec, NULL);
     if (buf_len < 0)
          ossl_raise(eECError, "ECDH_compute_key");
 
-    rb_str_resize(str, buf_len);
+    rb_bytestring_resize(str, buf_len);
 
     return str;
 }

Modified: MacRuby/trunk/ext/openssl/ossl_rand.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_rand.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_rand.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -34,7 +34,7 @@
  *
  */
 static VALUE
-ossl_rand_seed(VALUE self, VALUE str)
+ossl_rand_seed(VALUE self, SEL sel, VALUE str)
 {
     StringValue(str);
     RAND_seed(RSTRING_PTR(str), RSTRING_LEN(str));
@@ -48,7 +48,7 @@
  *
  */
 static VALUE
-ossl_rand_add(VALUE self, VALUE str, VALUE entropy)
+ossl_rand_add(VALUE self, SEL sel, VALUE str, VALUE entropy)
 {
     StringValue(str);
     RAND_add(RSTRING_PTR(str), RSTRING_LEN(str), NUM2DBL(entropy));
@@ -62,7 +62,7 @@
  *
  */
 static VALUE
-ossl_rand_load_file(VALUE self, VALUE filename)
+ossl_rand_load_file(VALUE self, SEL sel, VALUE filename)
 {
     SafeStringValue(filename);
 	
@@ -78,7 +78,7 @@
  *
  */
 static VALUE
-ossl_rand_write_file(VALUE self, VALUE filename)
+ossl_rand_write_file(VALUE self, SEL sel, VALUE filename)
 {
     SafeStringValue(filename);
     if (RAND_write_file(RSTRING_PTR(filename)) == -1) {
@@ -93,7 +93,7 @@
  *
  */
 static VALUE
-ossl_rand_bytes(VALUE self, VALUE len)
+ossl_rand_bytes(VALUE self, SEL sel, VALUE len)
 {
     VALUE str;
     int n = NUM2INT(len);
@@ -112,7 +112,7 @@
  *
  */
 static VALUE
-ossl_rand_pseudo_bytes(VALUE self, VALUE len)
+ossl_rand_pseudo_bytes(VALUE self, SEL sel, VALUE len)
 {
     VALUE str;
     int n = NUM2INT(len);
@@ -131,7 +131,7 @@
  *
  */
 static VALUE
-ossl_rand_egd(VALUE self, VALUE filename)
+ossl_rand_egd(VALUE self, SEL sel, VALUE filename)
 {
     SafeStringValue(filename);
 	
@@ -147,7 +147,7 @@
  *
  */
 static VALUE
-ossl_rand_egd_bytes(VALUE self, VALUE filename, VALUE len)
+ossl_rand_egd_bytes(VALUE self, SEL sel, VALUE filename, VALUE len)
 {
     long n = NUM2INT(len);
 
@@ -166,14 +166,14 @@
  * Return true if the PRNG has been seeded with enough data, false otherwise.
  */
 static VALUE
-ossl_rand_status(VALUE self)
+ossl_rand_status(VALUE self, SEL sel)
 {
     return RAND_status() ? Qtrue : Qfalse;
 }
 
 #define DEFMETH(class, name, func, argc) \
-	rb_define_method(class, name, func, argc); \
-	rb_define_singleton_method(class, name, func, argc);
+	rb_objc_define_method(class, name, func, argc); \
+	rb_objc_define_method(*(VALUE *)class, name, func, argc);
 
 /*
  * INIT

Modified: MacRuby/trunk/ext/openssl/ossl_ssl.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_ssl.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_ssl.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -148,7 +148,7 @@
 }
 
 static VALUE
-ossl_sslctx_set_ssl_version(VALUE self, VALUE ssl_method)
+ossl_sslctx_set_ssl_version(VALUE self, SEL sel, VALUE ssl_method)
 {
     SSL_METHOD *method = NULL;
     const char *s;
@@ -185,7 +185,7 @@
  * You can get a list of valid methods with OpenSSL::SSL::SSLContext::METHODS
  */
 static VALUE
-ossl_sslctx_initialize(int argc, VALUE *argv, VALUE self)
+ossl_sslctx_initialize(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     VALUE ssl_method;
     int i;
@@ -198,7 +198,7 @@
     if (rb_scan_args(argc, argv, "01", &ssl_method) == 0){
         return self;
     }
-    ossl_sslctx_set_ssl_version(self, ssl_method);
+    ossl_sslctx_set_ssl_version(self, 0, ssl_method);
 
     return self;
 }
@@ -682,7 +682,7 @@
  *    ctx.ciphers => [[name, version, bits, alg_bits], ...]
  */
 static VALUE
-ossl_sslctx_get_ciphers(VALUE self)
+ossl_sslctx_get_ciphers(VALUE self, SEL sel)
 {
     SSL_CTX *ctx;
     STACK_OF(SSL_CIPHER) *ciphers;
@@ -716,7 +716,7 @@
  *    ctx.ciphers = [[name, version, bits, alg_bits], ...]
  */
 static VALUE
-ossl_sslctx_set_ciphers(VALUE self, VALUE v)
+ossl_sslctx_set_ciphers(VALUE self, SEL sel, VALUE v)
 {
     SSL_CTX *ctx;
     VALUE str, elem;
@@ -758,7 +758,7 @@
  *
  */
 static VALUE
-ossl_sslctx_session_add(VALUE self, VALUE arg)
+ossl_sslctx_session_add(VALUE self, SEL sel, VALUE arg)
 {
     SSL_CTX *ctx;
     SSL_SESSION *sess;
@@ -775,7 +775,7 @@
  *
  */
 static VALUE
-ossl_sslctx_session_remove(VALUE self, VALUE arg)
+ossl_sslctx_session_remove(VALUE self, SEL sel, VALUE arg)
 {
     SSL_CTX *ctx;
     SSL_SESSION *sess;
@@ -807,7 +807,7 @@
  *
  */
 static VALUE
-ossl_sslctx_set_session_cache_mode(VALUE self, VALUE arg)
+ossl_sslctx_set_session_cache_mode(VALUE self, SEL sel, VALUE arg)
 {
     SSL_CTX *ctx;
 
@@ -839,7 +839,7 @@
  *
  */
 static VALUE
-ossl_sslctx_set_session_cache_size(VALUE self, VALUE arg)
+ossl_sslctx_set_session_cache_size(VALUE self, SEL sel, VALUE arg)
 {
     SSL_CTX *ctx;
 
@@ -887,7 +887,7 @@
  *
  */
 static VALUE
-ossl_sslctx_flush_sessions(int argc, VALUE *argv, VALUE self)
+ossl_sslctx_flush_sessions(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     VALUE arg1;
     SSL_CTX *ctx;
@@ -950,7 +950,7 @@
  * however, session management is still allowed in the frozen SSLContext.
  */
 static VALUE
-ossl_ssl_initialize(int argc, VALUE *argv, VALUE self)
+ossl_ssl_initialize(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     VALUE io, ctx;
 
@@ -1025,7 +1025,7 @@
 {
     if (nonblock) {
         VALUE exc = ossl_exc_new(eSSLError, "write would block");
-        rb_extend_object(exc, rb_mWaitWritable);
+        //rb_extend_object(exc, rb_mWaitWritable);
         rb_exc_raise(exc);
     }
 }
@@ -1035,7 +1035,7 @@
 {
     if (nonblock) {
         VALUE exc = ossl_exc_new(eSSLError, "read would block");
-        rb_extend_object(exc, rb_mWaitReadable);
+        //rb_extend_object(exc, rb_mWaitReadable);
         rb_exc_raise(exc);
     }
 }
@@ -1164,12 +1164,17 @@
 
     rb_scan_args(argc, argv, "11", &len, &str);
     ilen = NUM2INT(len);
-    if(NIL_P(str)) str = rb_str_new(0, ilen);
+    if(NIL_P(str)) {
+	str = rb_bytestring_new();
+    }
     else{
         StringValue(str);
         rb_str_modify(str);
-        rb_str_resize(str, ilen);
+	if (CLASS_OF(str) != rb_cByteString) {
+	    rb_raise(rb_eArgError, "expected ByteString object");
+	}
     }
+    rb_bytestring_resize(str, ilen);
     if(ilen == 0) return str;
 
     Data_Get_Struct(self, SSL, ssl);
@@ -1178,7 +1183,8 @@
 	if(!nonblock && SSL_pending(ssl) <= 0)
 	    rb_thread_wait_fd(FPTR_TO_FD(fptr));
 	for (;;){
-	    nread = SSL_read(ssl, RSTRING_PTR(str), RSTRING_LEN(str));
+	    nread = SSL_read(ssl, rb_bytestring_byte_pointer(str),
+		    rb_bytestring_length(str));
 	    switch(ssl_get_error(ssl, nread)){
 	    case SSL_ERROR_NONE:
 		goto end;
@@ -1224,7 +1230,7 @@
  * * +buffer+ is a string used to store the result.
  */
 static VALUE
-ossl_ssl_read(int argc, VALUE *argv, VALUE self)
+ossl_ssl_read(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     return ossl_ssl_read_internal(argc, argv, self, 0);
 }
@@ -1239,7 +1245,7 @@
  * * +buffer+ is a string used to store the result.
  */
 static VALUE
-ossl_ssl_read_nonblock(int argc, VALUE *argv, VALUE self)
+ossl_ssl_read_nonblock(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     return ossl_ssl_read_internal(argc, argv, self, 1);
 }
@@ -1291,7 +1297,7 @@
  *    ssl.syswrite(string) => integer
  */
 static VALUE
-ossl_ssl_write(VALUE self, VALUE str)
+ossl_ssl_write(VALUE self, SEL sel, VALUE str)
 {
     return ossl_ssl_write_internal(self, str, 0);
 }
@@ -1301,7 +1307,7 @@
  *    ssl.syswrite_nonblock(string) => integer
  */
 static VALUE
-ossl_ssl_write_nonblock(VALUE self, VALUE str)
+ossl_ssl_write_nonblock(VALUE self, SEL sel, VALUE str)
 {
     return ossl_ssl_write_internal(self, str, 1);
 }
@@ -1500,7 +1506,7 @@
  *
  */
 static VALUE
-ossl_ssl_set_session(VALUE self, VALUE arg1)
+ossl_ssl_set_session(VALUE self, SEL sel, VALUE arg1)
 {
     SSL *ssl;
     SSL_SESSION *sess;
@@ -1570,16 +1576,16 @@
      * * session_id_context, session_add_cb, session_new_cb, session_remove_cb
      */
     cSSLContext = rb_define_class_under(mSSL, "SSLContext", rb_cObject);
-    rb_define_alloc_func(cSSLContext, ossl_sslctx_s_alloc);
+    rb_objc_define_method(*(VALUE *)cSSLContext, "alloc", ossl_sslctx_s_alloc, 0);
     for(i = 0; i < numberof(ossl_sslctx_attrs); i++)
         rb_attr(cSSLContext, rb_intern(ossl_sslctx_attrs[i]), 1, 1, Qfalse);
     rb_define_alias(cSSLContext, "ssl_timeout", "timeout");
-    rb_define_method(cSSLContext, "initialize",  ossl_sslctx_initialize, -1);
-    rb_define_method(cSSLContext, "ssl_version=", ossl_sslctx_set_ssl_version, 1);
-    rb_define_method(cSSLContext, "ciphers",     ossl_sslctx_get_ciphers, 0);
-    rb_define_method(cSSLContext, "ciphers=",    ossl_sslctx_set_ciphers, 1);
+    rb_objc_define_method(cSSLContext, "initialize",  ossl_sslctx_initialize, -1);
+    rb_objc_define_method(cSSLContext, "ssl_version=", ossl_sslctx_set_ssl_version, 1);
+    rb_objc_define_method(cSSLContext, "ciphers",     ossl_sslctx_get_ciphers, 0);
+    rb_objc_define_method(cSSLContext, "ciphers=",    ossl_sslctx_set_ciphers, 1);
 
-    rb_define_method(cSSLContext, "setup", ossl_sslctx_setup, 0);
+    rb_objc_define_method(cSSLContext, "setup", ossl_sslctx_setup, 0);
 
     
     rb_define_const(cSSLContext, "SESSION_CACHE_OFF", LONG2FIX(SSL_SESS_CACHE_OFF));
@@ -1590,14 +1596,14 @@
     rb_define_const(cSSLContext, "SESSION_CACHE_NO_INTERNAL_LOOKUP", LONG2FIX(SSL_SESS_CACHE_NO_INTERNAL_LOOKUP));
     rb_define_const(cSSLContext, "SESSION_CACHE_NO_INTERNAL_STORE", LONG2FIX(SSL_SESS_CACHE_NO_INTERNAL_STORE));
     rb_define_const(cSSLContext, "SESSION_CACHE_NO_INTERNAL", LONG2FIX(SSL_SESS_CACHE_NO_INTERNAL));
-    rb_define_method(cSSLContext, "session_add",     ossl_sslctx_session_add, 1);
-    rb_define_method(cSSLContext, "session_remove",     ossl_sslctx_session_remove, 1);
-    rb_define_method(cSSLContext, "session_cache_mode",     ossl_sslctx_get_session_cache_mode, 0);
-    rb_define_method(cSSLContext, "session_cache_mode=",     ossl_sslctx_set_session_cache_mode, 1);
-    rb_define_method(cSSLContext, "session_cache_size",     ossl_sslctx_get_session_cache_size, 0);
-    rb_define_method(cSSLContext, "session_cache_size=",     ossl_sslctx_set_session_cache_size, 1);
-    rb_define_method(cSSLContext, "session_cache_stats",     ossl_sslctx_get_session_cache_stats, 0);
-    rb_define_method(cSSLContext, "flush_sessions",     ossl_sslctx_flush_sessions, -1);
+    rb_objc_define_method(cSSLContext, "session_add",     ossl_sslctx_session_add, 1);
+    rb_objc_define_method(cSSLContext, "session_remove",     ossl_sslctx_session_remove, 1);
+    rb_objc_define_method(cSSLContext, "session_cache_mode",     ossl_sslctx_get_session_cache_mode, 0);
+    rb_objc_define_method(cSSLContext, "session_cache_mode=",     ossl_sslctx_set_session_cache_mode, 1);
+    rb_objc_define_method(cSSLContext, "session_cache_size",     ossl_sslctx_get_session_cache_size, 0);
+    rb_objc_define_method(cSSLContext, "session_cache_size=",     ossl_sslctx_set_session_cache_size, 1);
+    rb_objc_define_method(cSSLContext, "session_cache_stats",     ossl_sslctx_get_session_cache_stats, 0);
+    rb_objc_define_method(cSSLContext, "flush_sessions",     ossl_sslctx_flush_sessions, -1);
 
     ary = rb_ary_new2(numberof(ossl_ssl_method_tab));
     for (i = 0; i < numberof(ossl_ssl_method_tab); i++) {
@@ -1620,25 +1626,25 @@
     for(i = 0; i < numberof(ossl_ssl_attrs); i++)
         rb_attr(cSSLSocket, rb_intern(ossl_ssl_attrs[i]), 1, 1, Qfalse);
     rb_define_alias(cSSLSocket, "to_io", "io");
-    rb_define_method(cSSLSocket, "initialize", ossl_ssl_initialize, -1);
-    rb_define_method(cSSLSocket, "connect",    ossl_ssl_connect, 0);
-    rb_define_method(cSSLSocket, "connect_nonblock",    ossl_ssl_connect_nonblock, 0);
-    rb_define_method(cSSLSocket, "accept",     ossl_ssl_accept, 0);
-    rb_define_method(cSSLSocket, "accept_nonblock",     ossl_ssl_accept_nonblock, 0);
-    rb_define_method(cSSLSocket, "sysread",    ossl_ssl_read, -1);
-    rb_define_private_method(cSSLSocket, "sysread_nonblock",    ossl_ssl_read_nonblock, -1);
-    rb_define_method(cSSLSocket, "syswrite",   ossl_ssl_write, 1);
-    rb_define_private_method(cSSLSocket, "syswrite_nonblock",    ossl_ssl_write_nonblock, 1);
-    rb_define_method(cSSLSocket, "sysclose",   ossl_ssl_close, 0);
-    rb_define_method(cSSLSocket, "cert",       ossl_ssl_get_cert, 0);
-    rb_define_method(cSSLSocket, "peer_cert",  ossl_ssl_get_peer_cert, 0);
-    rb_define_method(cSSLSocket, "peer_cert_chain", ossl_ssl_get_peer_cert_chain, 0);
-    rb_define_method(cSSLSocket, "cipher",     ossl_ssl_get_cipher, 0);
-    rb_define_method(cSSLSocket, "state",      ossl_ssl_get_state, 0);
-    rb_define_method(cSSLSocket, "pending",    ossl_ssl_pending, 0);
-    rb_define_method(cSSLSocket, "session_reused?",    ossl_ssl_session_reused, 0);
-    rb_define_method(cSSLSocket, "session=",    ossl_ssl_set_session, 1);
-    rb_define_method(cSSLSocket, "verify_result", ossl_ssl_get_verify_result, 0);
+    rb_objc_define_method(cSSLSocket, "initialize", ossl_ssl_initialize, -1);
+    rb_objc_define_method(cSSLSocket, "connect",    ossl_ssl_connect, 0);
+    rb_objc_define_method(cSSLSocket, "connect_nonblock",    ossl_ssl_connect_nonblock, 0);
+    rb_objc_define_method(cSSLSocket, "accept",     ossl_ssl_accept, 0);
+    rb_objc_define_method(cSSLSocket, "accept_nonblock",     ossl_ssl_accept_nonblock, 0);
+    rb_objc_define_method(cSSLSocket, "sysread",    ossl_ssl_read, -1);
+    rb_objc_define_private_method(cSSLSocket, "sysread_nonblock",    ossl_ssl_read_nonblock, -1);
+    rb_objc_define_method(cSSLSocket, "syswrite",   ossl_ssl_write, 1);
+    rb_objc_define_private_method(cSSLSocket, "syswrite_nonblock",    ossl_ssl_write_nonblock, 1);
+    rb_objc_define_method(cSSLSocket, "sysclose",   ossl_ssl_close, 0);
+    rb_objc_define_method(cSSLSocket, "cert",       ossl_ssl_get_cert, 0);
+    rb_objc_define_method(cSSLSocket, "peer_cert",  ossl_ssl_get_peer_cert, 0);
+    rb_objc_define_method(cSSLSocket, "peer_cert_chain", ossl_ssl_get_peer_cert_chain, 0);
+    rb_objc_define_method(cSSLSocket, "cipher",     ossl_ssl_get_cipher, 0);
+    rb_objc_define_method(cSSLSocket, "state",      ossl_ssl_get_state, 0);
+    rb_objc_define_method(cSSLSocket, "pending",    ossl_ssl_pending, 0);
+    rb_objc_define_method(cSSLSocket, "session_reused?",    ossl_ssl_session_reused, 0);
+    rb_objc_define_method(cSSLSocket, "session=",    ossl_ssl_set_session, 1);
+    rb_objc_define_method(cSSLSocket, "verify_result", ossl_ssl_get_verify_result, 0);
 
 #define ossl_ssl_def_const(x) rb_define_const(mSSL, #x, INT2NUM(SSL_##x))
 

Modified: MacRuby/trunk/ext/openssl/ossl_ssl_session.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_ssl_session.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_ssl_session.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -33,7 +33,7 @@
  * +SSLSocket+ is an OpenSSL::SSL::SSLSocket
  * +string+ must be a DER or PEM encoded Session.
 */
-static VALUE ossl_ssl_session_initialize(VALUE self, VALUE arg1)
+static VALUE ossl_ssl_session_initialize(VALUE self, SEL sel, VALUE arg1)
 {
 	SSL_SESSION *ctx = NULL;
 
@@ -77,7 +77,7 @@
  *    session1 == session2 -> boolean
  *
 */
-static VALUE ossl_ssl_session_eq(VALUE val1, VALUE val2)
+static VALUE ossl_ssl_session_eq(VALUE val1, SEL sel, VALUE val2)
 {
 	SSL_SESSION *ctx1, *ctx2;
 
@@ -130,7 +130,7 @@
 }
 
 #define SSLSESSION_SET_TIME(func)						\
-	static VALUE ossl_ssl_session_set_##func(VALUE self, VALUE time_v)	\
+	static VALUE ossl_ssl_session_set_##func(VALUE self, SEL sel, VALUE time_v)	\
 	{									\
 		SSL_SESSION *ctx;						\
 		unsigned long t;						\
@@ -275,22 +275,22 @@
 	cSSLSession = rb_define_class_under(mSSL, "Session", rb_cObject);
 	eSSLSession = rb_define_class_under(cSSLSession, "SessionError", eOSSLError);
 
-	rb_define_alloc_func(cSSLSession, ossl_ssl_session_alloc);
-	rb_define_method(cSSLSession, "initialize", ossl_ssl_session_initialize, 1);
+	rb_objc_define_method(*(VALUE *)cSSLSession, "alloc", ossl_ssl_session_alloc, 0);
+	rb_objc_define_method(cSSLSession, "initialize", ossl_ssl_session_initialize, 1);
 
-	rb_define_method(cSSLSession, "==", ossl_ssl_session_eq, 1);
+	rb_objc_define_method(cSSLSession, "==", ossl_ssl_session_eq, 1);
 
-	rb_define_method(cSSLSession, "time", ossl_ssl_session_get_time, 0);
-	rb_define_method(cSSLSession, "time=", ossl_ssl_session_set_time, 1);
-	rb_define_method(cSSLSession, "timeout", ossl_ssl_session_get_timeout, 0);
-	rb_define_method(cSSLSession, "timeout=", ossl_ssl_session_set_timeout, 1);
+	rb_objc_define_method(cSSLSession, "time", ossl_ssl_session_get_time, 0);
+	rb_objc_define_method(cSSLSession, "time=", ossl_ssl_session_set_time, 1);
+	rb_objc_define_method(cSSLSession, "timeout", ossl_ssl_session_get_timeout, 0);
+	rb_objc_define_method(cSSLSession, "timeout=", ossl_ssl_session_set_timeout, 1);
 
 #ifdef HAVE_SSL_SESSION_GET_ID
-	rb_define_method(cSSLSession, "id", ossl_ssl_session_get_id, 0);
+	rb_objc_define_method(cSSLSession, "id", ossl_ssl_session_get_id, 0);
 #else
 	rb_undef_method(cSSLSession, "id");
 #endif
-	rb_define_method(cSSLSession, "to_der", ossl_ssl_session_to_der, 0);
-	rb_define_method(cSSLSession, "to_pem", ossl_ssl_session_to_pem, 0);
-	rb_define_method(cSSLSession, "to_text", ossl_ssl_session_to_text, 0);
+	rb_objc_define_method(cSSLSession, "to_der", ossl_ssl_session_to_der, 0);
+	rb_objc_define_method(cSSLSession, "to_pem", ossl_ssl_session_to_pem, 0);
+	rb_objc_define_method(cSSLSession, "to_text", ossl_ssl_session_to_text, 0);
 }

Modified: MacRuby/trunk/ext/openssl/ossl_x509ext.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_x509ext.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_x509ext.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -239,10 +239,10 @@
 #ifdef HAVE_X509V3_EXT_NCONF_NID
     rconf = rb_iv_get(self, "@config");
     conf = NIL_P(rconf) ? NULL : GetConfigPtr(rconf);
-    ext = X509V3_EXT_nconf_nid(conf, ctx, nid, RSTRING_PTR(valstr));
+    ext = X509V3_EXT_nconf_nid(conf, ctx, nid, (char *)RSTRING_PTR(valstr));
 #else
     if (!empty_lhash) empty_lhash = lh_new(NULL, NULL);
-    ext = X509V3_EXT_conf_nid(empty_lhash, ctx, nid, RSTRING_PTR(valstr));
+    ext = X509V3_EXT_conf_nid(empty_lhash, ctx, nid, (char *)RSTRING_PTR(valstr));
 #endif
     if (!ext){
 	ossl_raise(eX509ExtError, "%s = %s",

Modified: MacRuby/trunk/ext/openssl/ossl_x509name.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_x509name.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_x509name.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -358,7 +358,7 @@
     ia5str = INT2NUM(V_ASN1_IA5STRING);
     rb_define_const(cX509Name, "DEFAULT_OBJECT_TYPE", utf8str);
     hash = rb_hash_new();
-    RHASH(hash)->ifnone = utf8str;
+    rb_hash_set_ifnone(hash, utf8str);
     rb_hash_aset(hash, rb_str_new2("C"), ptrstr);
     rb_hash_aset(hash, rb_str_new2("countryName"), ptrstr);
     rb_hash_aset(hash, rb_str_new2("serialNumber"), ptrstr);

Modified: MacRuby/trunk/ext/openssl/ossl_x509store.c
===================================================================
--- MacRuby/trunk/ext/openssl/ossl_x509store.c	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/ext/openssl/ossl_x509store.c	2009-10-29 00:36:24 UTC (rev 2910)
@@ -208,7 +208,7 @@
 {
     X509_STORE *store;
     X509_LOOKUP *lookup;
-    char *path = NULL;
+    const char *path = NULL;
 
     if(file != Qnil){
         SafeStringValue(file);
@@ -229,7 +229,7 @@
 {
     X509_STORE *store;
     X509_LOOKUP *lookup;
-    char *path = NULL;
+    const char *path = NULL;
 
     if(dir != Qnil){
         SafeStringValue(dir);

Modified: MacRuby/trunk/rakelib/builder.rake
===================================================================
--- MacRuby/trunk/rakelib/builder.rake	2009-10-28 21:04:22 UTC (rev 2909)
+++ MacRuby/trunk/rakelib/builder.rake	2009-10-29 00:36:24 UTC (rev 2910)
@@ -326,7 +326,7 @@
 EXTMK_ARGS = "#{SCRIPT_ARGS} --extension --extstatic"
 INSTRUBY_ARGS = "#{SCRIPT_ARGS} --data-mode=0644 --prog-mode=0755 --installed-list #{INSTALLED_LIST} --mantype=\"doc\" --sym-dest-dir=\"#{SYM_INSTDIR}\" --rdoc-output=\"doc\""
 
-EXTENSIONS = ['ripper', 'digest', 'etc', 'readline', 'libyaml', 'fcntl', 'socket', 'zlib', 'bigdecimal'].sort
+EXTENSIONS = ['ripper', 'digest', 'etc', 'readline', 'libyaml', 'fcntl', 'socket', 'zlib', 'bigdecimal', 'openssl'].sort
 def perform_extensions_target(target)
   EXTENSIONS.map { |x| File.join('ext', x) }.each do |ext_dir|
     Dir.glob(File.join(ext_dir, '**/extconf.rb')) do |p|
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091028/5a3c38e1/attachment-0001.html>


More information about the macruby-changes mailing list