Skip to content
This repository
Browse code

dup was broken for several classes

openssl methods were not defined for branch

git-svn-id: http://svn.codehaus.org/jruby/branches/enebo_block@2845 961051c9-f516-0410-bf72-c9f7e237a7b7
  • Loading branch information...
commit 76488695f09273bd23608315b7372e70cd1ec82c 1 parent 667e851
Thomas E Enebo enebo authored

Showing 28 changed files with 344 additions and 328 deletions. Show diff stats Hide diff stats

  1. +1 1  jruby/src/org/jruby/RubyDigest.java
  2. +1 1  jruby/src/org/jruby/RubyKernel.java
  3. +1 1  jruby/src/org/jruby/RubyObject.java
  4. +4 4 jruby/src/org/jruby/RubyString.java
  5. +34 34 jruby/src/org/jruby/ext/openssl/ASN1.java
  6. +7 6 jruby/src/org/jruby/ext/openssl/Attribute.java
  7. +20 19 jruby/src/org/jruby/ext/openssl/Cipher.java
  8. +1 1  jruby/src/org/jruby/ext/openssl/Config.java
  9. +14 14 jruby/src/org/jruby/ext/openssl/Digest.java
  10. +12 11 jruby/src/org/jruby/ext/openssl/HMAC.java
  11. +12 11 jruby/src/org/jruby/ext/openssl/NetscapeSPKI.java
  12. +42 41 jruby/src/org/jruby/ext/openssl/PKCS7.java
  13. +4 3 jruby/src/org/jruby/ext/openssl/PKey.java
  14. +12 11 jruby/src/org/jruby/ext/openssl/PKeyDSA.java
  15. +13 12 jruby/src/org/jruby/ext/openssl/PKeyRSA.java
  16. +7 7 jruby/src/org/jruby/ext/openssl/Random.java
  17. +20 19 jruby/src/org/jruby/ext/openssl/Request.java
  18. +4 3 jruby/src/org/jruby/ext/openssl/SSLContext.java
  19. +13 12 jruby/src/org/jruby/ext/openssl/SSLSocket.java
  20. +28 27 jruby/src/org/jruby/ext/openssl/X509CRL.java
  21. +30 29 jruby/src/org/jruby/ext/openssl/X509Cert.java
  22. +16 15 jruby/src/org/jruby/ext/openssl/X509Extensions.java
  23. +10 9 jruby/src/org/jruby/ext/openssl/X509Name.java
  24. +9 8 jruby/src/org/jruby/ext/openssl/X509Revoked.java
  25. +11 12 jruby/src/org/jruby/ext/openssl/X509Store.java
  26. +15 14 jruby/src/org/jruby/ext/openssl/X509StoreCtx.java
  27. +2 2 jruby/src/org/jruby/runtime/builtin/meta/StringMetaClass.java
  28. +1 1  jruby/src/org/jruby/runtime/builtin/meta/TimeMetaClass.java
2  jruby/src/org/jruby/RubyDigest.java
@@ -50,7 +50,7 @@ public static void createDigest(IRuby runtime) {
50 50 cDigestBase.defineFastSingletonMethod("hexdigest",basecb.getFastSingletonMethod("s_hexdigest",IRubyObject.class));
51 51
52 52 cDigestBase.defineMethod("initialize",basecb.getOptMethod("initialize"));
53   - cDigestBase.defineMethod("initialize_copy",basecb.getMethod("initialize_copy",IRubyObject.class));
  53 + cDigestBase.defineFastMethod("initialize_copy",basecb.getFastMethod("initialize_copy",IRubyObject.class));
54 54 cDigestBase.defineFastMethod("clone",basecb.getFastMethod("rbClone"));
55 55 cDigestBase.defineFastMethod("update",basecb.getFastMethod("update",IRubyObject.class));
56 56 cDigestBase.defineFastMethod("<<",basecb.getFastMethod("update",IRubyObject.class));
2  jruby/src/org/jruby/RubyKernel.java
@@ -176,7 +176,7 @@ public static RubyModule createKernelModule(IRuby runtime) {
176 176 module.defineFastPublicModuleFunction("extend", objectCallbackFactory.getFastOptMethod("extend"));
177 177 module.defineFastPublicModuleFunction("freeze", objectCallbackFactory.getFastMethod("freeze"));
178 178 module.defineFastPublicModuleFunction("frozen?", objectCallbackFactory.getFastMethod("frozen"));
179   - module.defineModuleFunction("initialize_copy", objectCallbackFactory.getMethod("initialize_copy", IRubyObject.class));
  179 + module.defineFastModuleFunction("initialize_copy", objectCallbackFactory.getFastMethod("initialize_copy", IRubyObject.class));
180 180 module.definePublicModuleFunction("instance_eval", objectCallbackFactory.getOptMethod("instance_eval"));
181 181 module.defineFastPublicModuleFunction("instance_of?", objectCallbackFactory.getFastMethod("instance_of", IRubyObject.class));
182 182 module.defineFastPublicModuleFunction("instance_variables", objectCallbackFactory.getFastMethod("instance_variables"));
2  jruby/src/org/jruby/RubyObject.java
@@ -806,7 +806,7 @@ public IRubyObject same(IRubyObject other) {
806 806 return this == other ? getRuntime().getTrue() : getRuntime().getFalse();
807 807 }
808 808
809   - public IRubyObject initialize_copy(IRubyObject original, Block block) {
  809 + public IRubyObject initialize_copy(IRubyObject original) {
810 810 if (this != original) {
811 811 checkFrozen();
812 812 if (!getClass().equals(original.getClass())) {
8 jruby/src/org/jruby/RubyString.java
@@ -396,7 +396,7 @@ public IRubyObject to_str() {
396 396 /** rb_str_replace_m
397 397 *
398 398 */
399   - public RubyString replace(IRubyObject other, Block block) {
  399 + public RubyString replace(IRubyObject other) {
400 400 RubyString newValue = stringValue(other);
401 401 if (this == other || sameAs(newValue)) {
402 402 return this;
@@ -425,9 +425,9 @@ public static RubyString newInstance(IRubyObject recv, IRubyObject[] args, Block
425 425 return newString;
426 426 }
427 427
428   - public IRubyObject initialize(IRubyObject[] args, Block block) {
  428 + public IRubyObject initialize(IRubyObject[] args, Block unusedBlock) {
429 429 if (checkArgumentCount(args, 0, 1) == 1) {
430   - replace(args[0], null);
  430 + replace(args[0]);
431 431 }
432 432 return this;
433 433 }
@@ -1399,7 +1399,7 @@ private IRubyObject sub(IRubyObject[] args, boolean bang, Block block) {
1399 1399 }
1400 1400 }
1401 1401 if (bang) {
1402   - replace(newStr, block);
  1402 + replace(newStr);
1403 1403 return this;
1404 1404 }
1405 1405
68 jruby/src/org/jruby/ext/openssl/ASN1.java
@@ -249,9 +249,9 @@ public static void createASN1(IRuby runtime, RubyModule ossl) {
249 249 mASN1.defineClassUnder("ASN1Error",openSSLError, openSSLError.getAllocator());
250 250
251 251 CallbackFactory asncb = runtime.callbackFactory(ASN1.class);
252   - mASN1.defineSingletonMethod("traverse",asncb.getSingletonMethod("traverse",IRubyObject.class));
253   - mASN1.defineSingletonMethod("decode",asncb.getSingletonMethod("decode",IRubyObject.class));
254   - mASN1.defineSingletonMethod("decode_all",asncb.getSingletonMethod("decode_all",IRubyObject.class));
  252 + mASN1.defineFastSingletonMethod("traverse",asncb.getFastSingletonMethod("traverse",IRubyObject.class));
  253 + mASN1.defineFastSingletonMethod("decode",asncb.getFastSingletonMethod("decode",IRubyObject.class));
  254 + mASN1.defineFastSingletonMethod("decode_all",asncb.getFastSingletonMethod("decode_all",IRubyObject.class));
255 255
256 256 List ary = new ArrayList();
257 257 mASN1.setConstant("UNIVERSAL_TAG_NAME",runtime.newArray(ary));
@@ -268,44 +268,44 @@ public static void createASN1(IRuby runtime, RubyModule ossl) {
268 268 cASN1Data.attr_accessor(new IRubyObject[]{runtime.newString("value"),runtime.newString("tag"),runtime.newString("tag_class")});
269 269 CallbackFactory asn1datacb = runtime.callbackFactory(ASN1Data.class);
270 270 cASN1Data.defineMethod("initialize",asn1datacb.getOptMethod("initialize"));
271   - cASN1Data.defineMethod("to_der",asn1datacb.getMethod("to_der"));
  271 + cASN1Data.defineFastMethod("to_der",asn1datacb.getFastMethod("to_der"));
272 272
273 273 RubyClass cASN1Primitive = mASN1.defineClassUnder("Primitive",cASN1Data, cASN1Data.getAllocator());
274 274 cASN1Primitive.attr_accessor(new IRubyObject[]{runtime.newString("tagging")});
275 275 CallbackFactory primcb = runtime.callbackFactory(ASN1Primitive.class);
276 276 cASN1Primitive.defineMethod("initialize",primcb.getOptMethod("initialize"));
277   - cASN1Primitive.defineMethod("to_der",primcb.getMethod("to_der"));
  277 + cASN1Primitive.defineFastMethod("to_der",primcb.getFastMethod("to_der"));
278 278
279 279 RubyClass cASN1Constructive = mASN1.defineClassUnder("Constructive",cASN1Data,cASN1Data.getAllocator());
280 280 cASN1Constructive.includeModule(runtime.getModule("Enumerable"));
281 281 cASN1Constructive.attr_accessor(new IRubyObject[]{runtime.newString("tagging")});
282 282 CallbackFactory concb = runtime.callbackFactory(ASN1Constructive.class);
283 283 cASN1Constructive.defineMethod("initialize",concb.getOptMethod("initialize"));
284   - cASN1Constructive.defineMethod("to_der",concb.getMethod("to_der"));
  284 + cASN1Constructive.defineFastMethod("to_der",concb.getFastMethod("to_der"));
285 285 cASN1Constructive.defineMethod("each",concb.getMethod("each"));
286 286
287   - mASN1.defineSingletonMethod("Boolean",asncb.getOptSingletonMethod("fact_Boolean"));
288   - mASN1.defineSingletonMethod("Integer",asncb.getOptSingletonMethod("fact_Integer"));
289   - mASN1.defineSingletonMethod("Enumerated",asncb.getOptSingletonMethod("fact_Enumerated"));
290   - mASN1.defineSingletonMethod("BitString",asncb.getOptSingletonMethod("fact_BitString"));
291   - mASN1.defineSingletonMethod("OctetString",asncb.getOptSingletonMethod("fact_OctetString"));
292   - mASN1.defineSingletonMethod("UTF8String",asncb.getOptSingletonMethod("fact_UTF8String"));
293   - mASN1.defineSingletonMethod("NumericString",asncb.getOptSingletonMethod("fact_NumericString"));
294   - mASN1.defineSingletonMethod("PrintableString",asncb.getOptSingletonMethod("fact_PrintableString"));
295   - mASN1.defineSingletonMethod("T61String",asncb.getOptSingletonMethod("fact_T61String"));
296   - mASN1.defineSingletonMethod("VideotexString",asncb.getOptSingletonMethod("fact_VideotexString"));
297   - mASN1.defineSingletonMethod("IA5String",asncb.getOptSingletonMethod("fact_IA5String"));
298   - mASN1.defineSingletonMethod("GraphicString",asncb.getOptSingletonMethod("fact_GraphicString"));
299   - mASN1.defineSingletonMethod("ISO64String",asncb.getOptSingletonMethod("fact_ISO64String"));
300   - mASN1.defineSingletonMethod("GeneralString",asncb.getOptSingletonMethod("fact_GeneralString"));
301   - mASN1.defineSingletonMethod("UniversalString",asncb.getOptSingletonMethod("fact_UniversalString"));
302   - mASN1.defineSingletonMethod("BMPString",asncb.getOptSingletonMethod("fact_BMPString"));
303   - mASN1.defineSingletonMethod("Null",asncb.getOptSingletonMethod("fact_Null"));
304   - mASN1.defineSingletonMethod("ObjectId",asncb.getOptSingletonMethod("fact_ObjectId"));
305   - mASN1.defineSingletonMethod("UTCTime",asncb.getOptSingletonMethod("fact_UTCTime"));
306   - mASN1.defineSingletonMethod("GeneralizedTime",asncb.getOptSingletonMethod("fact_GeneralizedTime"));
307   - mASN1.defineSingletonMethod("Sequence",asncb.getOptSingletonMethod("fact_Sequence"));
308   - mASN1.defineSingletonMethod("Set",asncb.getOptSingletonMethod("fact_Set"));
  287 + mASN1.defineFastSingletonMethod("Boolean",asncb.getFastOptSingletonMethod("fact_Boolean"));
  288 + mASN1.defineFastSingletonMethod("Integer",asncb.getFastOptSingletonMethod("fact_Integer"));
  289 + mASN1.defineFastSingletonMethod("Enumerated",asncb.getFastOptSingletonMethod("fact_Enumerated"));
  290 + mASN1.defineFastSingletonMethod("BitString",asncb.getFastOptSingletonMethod("fact_BitString"));
  291 + mASN1.defineFastSingletonMethod("OctetString",asncb.getFastOptSingletonMethod("fact_OctetString"));
  292 + mASN1.defineFastSingletonMethod("UTF8String",asncb.getFastOptSingletonMethod("fact_UTF8String"));
  293 + mASN1.defineFastSingletonMethod("NumericString",asncb.getFastOptSingletonMethod("fact_NumericString"));
  294 + mASN1.defineFastSingletonMethod("PrintableString",asncb.getFastOptSingletonMethod("fact_PrintableString"));
  295 + mASN1.defineFastSingletonMethod("T61String",asncb.getFastOptSingletonMethod("fact_T61String"));
  296 + mASN1.defineFastSingletonMethod("VideotexString",asncb.getFastOptSingletonMethod("fact_VideotexString"));
  297 + mASN1.defineFastSingletonMethod("IA5String",asncb.getFastOptSingletonMethod("fact_IA5String"));
  298 + mASN1.defineFastSingletonMethod("GraphicString",asncb.getFastOptSingletonMethod("fact_GraphicString"));
  299 + mASN1.defineFastSingletonMethod("ISO64String",asncb.getFastOptSingletonMethod("fact_ISO64String"));
  300 + mASN1.defineFastSingletonMethod("GeneralString",asncb.getFastOptSingletonMethod("fact_GeneralString"));
  301 + mASN1.defineFastSingletonMethod("UniversalString",asncb.getFastOptSingletonMethod("fact_UniversalString"));
  302 + mASN1.defineFastSingletonMethod("BMPString",asncb.getFastOptSingletonMethod("fact_BMPString"));
  303 + mASN1.defineFastSingletonMethod("Null",asncb.getFastOptSingletonMethod("fact_Null"));
  304 + mASN1.defineFastSingletonMethod("ObjectId",asncb.getFastOptSingletonMethod("fact_ObjectId"));
  305 + mASN1.defineFastSingletonMethod("UTCTime",asncb.getFastOptSingletonMethod("fact_UTCTime"));
  306 + mASN1.defineFastSingletonMethod("GeneralizedTime",asncb.getFastOptSingletonMethod("fact_GeneralizedTime"));
  307 + mASN1.defineFastSingletonMethod("Sequence",asncb.getFastOptSingletonMethod("fact_Sequence"));
  308 + mASN1.defineFastSingletonMethod("Set",asncb.getFastOptSingletonMethod("fact_Set"));
309 309
310 310 mASN1.defineClassUnder("Boolean",cASN1Primitive,cASN1Primitive.getAllocator());
311 311 mASN1.defineClassUnder("Integer",cASN1Primitive,cASN1Primitive.getAllocator());
@@ -330,12 +330,12 @@ public static void createASN1(IRuby runtime, RubyModule ossl) {
330 330 mASN1.defineClassUnder("Sequence",cASN1Constructive,cASN1Constructive.getAllocator());
331 331 mASN1.defineClassUnder("Set",cASN1Constructive,cASN1Constructive.getAllocator());
332 332
333   - cASN1ObjectId.defineSingletonMethod("register",asncb.getOptSingletonMethod("objectid_register"));
334   - cASN1ObjectId.defineMethod("sn",asncb.getSingletonMethod("objectid_sn"));
335   - cASN1ObjectId.defineMethod("ln",asncb.getSingletonMethod("objectid_ln"));
336   - cASN1ObjectId.defineMethod("short_name",asncb.getSingletonMethod("objectid_sn"));
337   - cASN1ObjectId.defineMethod("long_name",asncb.getSingletonMethod("objectid_ln"));
338   - cASN1ObjectId.defineMethod("oid",asncb.getSingletonMethod("objectid_oid"));
  333 + cASN1ObjectId.defineFastSingletonMethod("register",asncb.getFastOptSingletonMethod("objectid_register"));
  334 + cASN1ObjectId.defineFastMethod("sn",asncb.getFastSingletonMethod("objectid_sn"));
  335 + cASN1ObjectId.defineFastMethod("ln",asncb.getFastSingletonMethod("objectid_ln"));
  336 + cASN1ObjectId.defineFastMethod("short_name",asncb.getFastSingletonMethod("objectid_sn"));
  337 + cASN1ObjectId.defineFastMethod("long_name",asncb.getFastSingletonMethod("objectid_ln"));
  338 + cASN1ObjectId.defineFastMethod("oid",asncb.getFastSingletonMethod("objectid_oid"));
339 339
340 340 cASN1BitString.attr_accessor(new IRubyObject[]{runtime.newSymbol("unused_bits")});
341 341 }
13 jruby/src/org/jruby/ext/openssl/Attribute.java
@@ -36,6 +36,7 @@
36 36 import org.jruby.RubyClass;
37 37 import org.jruby.RubyModule;
38 38 import org.jruby.RubyObject;
  39 +import org.jruby.runtime.Block;
39 40 import org.jruby.runtime.CallbackFactory;
40 41 import org.jruby.runtime.ObjectAllocator;
41 42 import org.jruby.runtime.builtin.IRubyObject;
@@ -59,11 +60,11 @@ public static void createAttribute(IRuby runtime, RubyModule mX509) {
59 60 CallbackFactory attrcb = runtime.callbackFactory(Attribute.class);
60 61
61 62 cAttribute.defineMethod("initialize",attrcb.getOptMethod("_initialize"));
62   - cAttribute.defineMethod("to_der",attrcb.getMethod("to_der"));
63   - cAttribute.defineMethod("oid",attrcb.getMethod("oid"));
64   - cAttribute.defineMethod("oid=",attrcb.getMethod("set_oid",IRubyObject.class));
65   - cAttribute.defineMethod("value",attrcb.getMethod("value"));
66   - cAttribute.defineMethod("value=",attrcb.getMethod("set_value",IRubyObject.class));
  63 + cAttribute.defineFastMethod("to_der",attrcb.getFastMethod("to_der"));
  64 + cAttribute.defineFastMethod("oid",attrcb.getFastMethod("oid"));
  65 + cAttribute.defineFastMethod("oid=",attrcb.getFastMethod("set_oid",IRubyObject.class));
  66 + cAttribute.defineFastMethod("value",attrcb.getFastMethod("value"));
  67 + cAttribute.defineFastMethod("value=",attrcb.getFastMethod("set_value",IRubyObject.class));
67 68 }
68 69
69 70 public Attribute(IRuby runtime, RubyClass type) {
@@ -95,7 +96,7 @@ DERObject toASN1() throws Exception {
95 96 return new DERSequence(v1);
96 97 }
97 98
98   - public IRubyObject _initialize(IRubyObject[] str) throws Exception {
  99 + public IRubyObject _initialize(IRubyObject[] str, Block unusedBlock) throws Exception {
99 100 if(checkArgumentCount(str,1,2) == 1) {
100 101 IRubyObject _oid = OpenSSLImpl.to_der_if_possible(str[0]);
101 102 set_oid(_oid);
39 jruby/src/org/jruby/ext/openssl/Cipher.java
@@ -43,6 +43,7 @@
43 43 import org.jruby.RubyNumeric;
44 44 import org.jruby.RubyObject;
45 45 import org.jruby.exceptions.RaiseException;
  46 +import org.jruby.runtime.Block;
46 47 import org.jruby.runtime.CallbackFactory;
47 48 import org.jruby.runtime.ObjectAllocator;
48 49 import org.jruby.runtime.builtin.IRubyObject;
@@ -66,25 +67,25 @@ public static void createCipher(IRuby runtime, RubyModule ossl) {
66 67
67 68 CallbackFactory ciphercb = runtime.callbackFactory(Cipher.class);
68 69
69   - mCipher.defineSingletonMethod("ciphers",ciphercb.getSingletonMethod("ciphers"));
  70 + mCipher.defineFastSingletonMethod("ciphers",ciphercb.getFastSingletonMethod("ciphers"));
70 71 cCipher.defineMethod("initialize",ciphercb.getMethod("initialize",IRubyObject.class));
71   - cCipher.defineMethod("initialize_copy",ciphercb.getMethod("initialize_copy",IRubyObject.class));
72   - cCipher.defineMethod("clone",ciphercb.getMethod("rbClone"));
73   - cCipher.defineMethod("name",ciphercb.getMethod("name"));
74   - cCipher.defineMethod("key_len",ciphercb.getMethod("key_len"));
75   - cCipher.defineMethod("key_len=",ciphercb.getMethod("set_key_len",IRubyObject.class));
76   - cCipher.defineMethod("iv_len",ciphercb.getMethod("iv_len"));
77   - cCipher.defineMethod("block_size",ciphercb.getMethod("block_size"));
78   - cCipher.defineMethod("encrypt",ciphercb.getOptMethod("encrypt"));
79   - cCipher.defineMethod("decrypt",ciphercb.getOptMethod("decrypt"));
80   - cCipher.defineMethod("key=",ciphercb.getMethod("set_key",IRubyObject.class));
81   - cCipher.defineMethod("iv=",ciphercb.getMethod("set_iv",IRubyObject.class));
82   - cCipher.defineMethod("reset",ciphercb.getMethod("reset"));
83   - cCipher.defineMethod("pkcs5_keyivgen",ciphercb.getOptMethod("pkcs5_keyivgen"));
84   - cCipher.defineMethod("update",ciphercb.getMethod("update",IRubyObject.class));
85   - cCipher.defineMethod("<<",ciphercb.getMethod("update_deprecated",IRubyObject.class));
86   - cCipher.defineMethod("final",ciphercb.getMethod("_final"));
87   - cCipher.defineMethod("padding=",ciphercb.getMethod("set_padding",IRubyObject.class));
  72 + cCipher.defineFastMethod("initialize_copy",ciphercb.getFastMethod("initialize_copy",IRubyObject.class));
  73 + cCipher.defineFastMethod("clone",ciphercb.getFastMethod("rbClone"));
  74 + cCipher.defineFastMethod("name",ciphercb.getFastMethod("name"));
  75 + cCipher.defineFastMethod("key_len",ciphercb.getFastMethod("key_len"));
  76 + cCipher.defineFastMethod("key_len=",ciphercb.getFastMethod("set_key_len",IRubyObject.class));
  77 + cCipher.defineFastMethod("iv_len",ciphercb.getFastMethod("iv_len"));
  78 + cCipher.defineFastMethod("block_size",ciphercb.getFastMethod("block_size"));
  79 + cCipher.defineFastMethod("encrypt",ciphercb.getFastOptMethod("encrypt"));
  80 + cCipher.defineFastMethod("decrypt",ciphercb.getFastOptMethod("decrypt"));
  81 + cCipher.defineFastMethod("key=",ciphercb.getFastMethod("set_key",IRubyObject.class));
  82 + cCipher.defineFastMethod("iv=",ciphercb.getFastMethod("set_iv",IRubyObject.class));
  83 + cCipher.defineFastMethod("reset",ciphercb.getFastMethod("reset"));
  84 + cCipher.defineFastMethod("pkcs5_keyivgen",ciphercb.getFastOptMethod("pkcs5_keyivgen"));
  85 + cCipher.defineFastMethod("update",ciphercb.getFastMethod("update",IRubyObject.class));
  86 + cCipher.defineFastMethod("<<",ciphercb.getFastMethod("update_deprecated",IRubyObject.class));
  87 + cCipher.defineFastMethod("final",ciphercb.getFastMethod("_final"));
  88 + cCipher.defineFastMethod("padding=",ciphercb.getFastMethod("set_padding",IRubyObject.class));
88 89 }
89 90
90 91 private static final Set BLOCK_MODES = new HashSet();
@@ -190,7 +191,7 @@ public Cipher(IRuby runtime, RubyClass type) {
190 191 private byte[] iv;
191 192 private String padding;
192 193
193   - public IRubyObject initialize(IRubyObject str) {
  194 + public IRubyObject initialize(IRubyObject str, Block unusedBlock) {
194 195 name = str.toString();
195 196 String[] values = rubyToJavaCipher(name);
196 197 cryptoBase = values[0];
2  jruby/src/org/jruby/ext/openssl/Config.java
@@ -40,7 +40,7 @@
40 40 public static void createConfig(IRuby runtime, RubyModule ossl) {
41 41 RubyClass cConfig = ossl.defineClassUnder("Config", runtime.getObject(), runtime.getObject().getAllocator());
42 42 CallbackFactory confcb = runtime.callbackFactory(Config.class);
43   - cConfig.defineSingletonMethod("parse",confcb.getOptSingletonMethod("parse"));
  43 + cConfig.defineFastSingletonMethod("parse",confcb.getFastOptSingletonMethod("parse"));
44 44 }
45 45
46 46 public static IRubyObject parse(IRubyObject recv, IRubyObject[] args) {
28 jruby/src/org/jruby/ext/openssl/Digest.java
@@ -58,21 +58,21 @@ public static void createDigest(IRuby runtime, RubyModule ossl) {
58 58 CallbackFactory digestcb = runtime.callbackFactory(Digest.class);
59 59
60 60 cDigest.defineSingletonMethod("new",digestcb.getOptSingletonMethod("newInstance"));
61   - cDigest.defineSingletonMethod("digest",digestcb.getSingletonMethod("s_digest",IRubyObject.class,IRubyObject.class));
62   - cDigest.defineSingletonMethod("hexdigest",digestcb.getSingletonMethod("s_hexdigest",IRubyObject.class,IRubyObject.class));
  61 + cDigest.defineFastSingletonMethod("digest",digestcb.getFastSingletonMethod("s_digest",IRubyObject.class,IRubyObject.class));
  62 + cDigest.defineFastSingletonMethod("hexdigest",digestcb.getFastSingletonMethod("s_hexdigest",IRubyObject.class,IRubyObject.class));
63 63 cDigest.defineMethod("initialize",digestcb.getOptMethod("initialize"));
64   - cDigest.defineMethod("initialize_copy",digestcb.getMethod("initialize_copy",IRubyObject.class));
65   - cDigest.defineMethod("clone",digestcb.getMethod("rbClone"));
66   - cDigest.defineMethod("update",digestcb.getMethod("update",IRubyObject.class));
67   - cDigest.defineMethod("<<",digestcb.getMethod("update",IRubyObject.class));
68   - cDigest.defineMethod("digest",digestcb.getMethod("digest"));
69   - cDigest.defineMethod("hexdigest",digestcb.getMethod("hexdigest"));
70   - cDigest.defineMethod("inspect",digestcb.getMethod("hexdigest"));
71   - cDigest.defineMethod("to_s",digestcb.getMethod("hexdigest"));
72   - cDigest.defineMethod("==",digestcb.getMethod("eq",IRubyObject.class));
73   - cDigest.defineMethod("reset",digestcb.getMethod("reset"));
74   - cDigest.defineMethod("name",digestcb.getMethod("name"));
75   - cDigest.defineMethod("size",digestcb.getMethod("size"));
  64 + cDigest.defineFastMethod("initialize_copy",digestcb.getFastMethod("initialize_copy",IRubyObject.class));
  65 + cDigest.defineFastMethod("clone",digestcb.getFastMethod("rbClone"));
  66 + cDigest.defineFastMethod("update",digestcb.getFastMethod("update",IRubyObject.class));
  67 + cDigest.defineFastMethod("<<",digestcb.getFastMethod("update",IRubyObject.class));
  68 + cDigest.defineFastMethod("digest",digestcb.getFastMethod("digest"));
  69 + cDigest.defineFastMethod("hexdigest",digestcb.getFastMethod("hexdigest"));
  70 + cDigest.defineFastMethod("inspect",digestcb.getFastMethod("hexdigest"));
  71 + cDigest.defineFastMethod("to_s",digestcb.getFastMethod("hexdigest"));
  72 + cDigest.defineFastMethod("==",digestcb.getFastMethod("eq",IRubyObject.class));
  73 + cDigest.defineFastMethod("reset",digestcb.getFastMethod("reset"));
  74 + cDigest.defineFastMethod("name",digestcb.getFastMethod("name"));
  75 + cDigest.defineFastMethod("size",digestcb.getFastMethod("size"));
76 76 }
77 77
78 78 private static String transformDigest(String inp) {
23 jruby/src/org/jruby/ext/openssl/HMAC.java
@@ -35,6 +35,7 @@
35 35 import org.jruby.RubyClass;
36 36 import org.jruby.RubyModule;
37 37 import org.jruby.RubyObject;
  38 +import org.jruby.runtime.Block;
38 39 import org.jruby.runtime.CallbackFactory;
39 40 import org.jruby.runtime.ObjectAllocator;
40 41 import org.jruby.runtime.builtin.IRubyObject;
@@ -56,17 +57,17 @@ public static void createHMAC(IRuby runtime, RubyModule ossl) {
56 57
57 58 CallbackFactory hmaccb = runtime.callbackFactory(HMAC.class);
58 59
59   - cHMAC.defineSingletonMethod("digest",hmaccb.getSingletonMethod("s_digest",IRubyObject.class,IRubyObject.class,IRubyObject.class));
60   - cHMAC.defineSingletonMethod("hexdigest",hmaccb.getSingletonMethod("s_hexdigest",IRubyObject.class,IRubyObject.class,IRubyObject.class));
  60 + cHMAC.defineFastSingletonMethod("digest",hmaccb.getFastSingletonMethod("s_digest",IRubyObject.class,IRubyObject.class,IRubyObject.class));
  61 + cHMAC.defineFastSingletonMethod("hexdigest",hmaccb.getFastSingletonMethod("s_hexdigest",IRubyObject.class,IRubyObject.class,IRubyObject.class));
61 62 cHMAC.defineMethod("initialize",hmaccb.getMethod("initialize",IRubyObject.class,IRubyObject.class));
62   - cHMAC.defineMethod("initialize_copy",hmaccb.getMethod("initialize_copy",IRubyObject.class));
63   - cHMAC.defineMethod("clone",hmaccb.getMethod("rbClone"));
64   - cHMAC.defineMethod("update",hmaccb.getMethod("update",IRubyObject.class));
65   - cHMAC.defineMethod("<<",hmaccb.getMethod("update",IRubyObject.class));
66   - cHMAC.defineMethod("digest",hmaccb.getMethod("digest"));
67   - cHMAC.defineMethod("hexdigest",hmaccb.getMethod("hexdigest"));
68   - cHMAC.defineMethod("inspect",hmaccb.getMethod("hexdigest"));
69   - cHMAC.defineMethod("to_s",hmaccb.getMethod("hexdigest"));
  63 + cHMAC.defineFastMethod("initialize_copy",hmaccb.getFastMethod("initialize_copy",IRubyObject.class));
  64 + cHMAC.defineFastMethod("clone",hmaccb.getFastMethod("rbClone"));
  65 + cHMAC.defineFastMethod("update",hmaccb.getFastMethod("update",IRubyObject.class));
  66 + cHMAC.defineFastMethod("<<",hmaccb.getFastMethod("update",IRubyObject.class));
  67 + cHMAC.defineFastMethod("digest",hmaccb.getFastMethod("digest"));
  68 + cHMAC.defineFastMethod("hexdigest",hmaccb.getFastMethod("hexdigest"));
  69 + cHMAC.defineFastMethod("inspect",hmaccb.getFastMethod("hexdigest"));
  70 + cHMAC.defineFastMethod("to_s",hmaccb.getFastMethod("hexdigest"));
70 71 }
71 72
72 73 public static IRubyObject s_digest(IRubyObject recv, IRubyObject digest, IRubyObject kay, IRubyObject data) {
@@ -103,7 +104,7 @@ public HMAC(IRuby runtime, RubyClass type) {
103 104 private byte[] key;
104 105 private StringBuffer data = new StringBuffer();
105 106
106   - public IRubyObject initialize(IRubyObject kay, IRubyObject digest) {
  107 + public IRubyObject initialize(IRubyObject kay, IRubyObject digest, Block unusedBlock) {
107 108 String name = "HMAC" + ((Digest)digest).getAlgorithm();
108 109 try {
109 110 mac = Mac.getInstance(name);
23 jruby/src/org/jruby/ext/openssl/NetscapeSPKI.java
@@ -39,6 +39,7 @@
39 39 import org.jruby.RubyClass;
40 40 import org.jruby.RubyModule;
41 41 import org.jruby.RubyObject;
  42 +import org.jruby.runtime.Block;
42 43 import org.jruby.runtime.CallbackFactory;
43 44 import org.jruby.runtime.ObjectAllocator;
44 45 import org.jruby.runtime.builtin.IRubyObject;
@@ -62,16 +63,16 @@ public static void createNetscapeSPKI(IRuby runtime, RubyModule ossl) {
62 63
63 64 CallbackFactory spkicb = runtime.callbackFactory(NetscapeSPKI.class);
64 65 cSPKI.defineMethod("initialize",spkicb.getOptMethod("_initialize"));
65   - cSPKI.defineMethod("to_der",spkicb.getMethod("to_der"));
66   - cSPKI.defineMethod("to_pem",spkicb.getMethod("to_pem"));
67   - cSPKI.defineMethod("to_s",spkicb.getMethod("to_pem"));
68   - cSPKI.defineMethod("to_text",spkicb.getMethod("to_text"));
69   - cSPKI.defineMethod("public_key",spkicb.getMethod("public_key"));
70   - cSPKI.defineMethod("public_key=",spkicb.getMethod("set_public_key",IRubyObject.class));
71   - cSPKI.defineMethod("sign",spkicb.getMethod("sign",IRubyObject.class,IRubyObject.class));
72   - cSPKI.defineMethod("verify",spkicb.getMethod("verify",IRubyObject.class));
73   - cSPKI.defineMethod("challenge",spkicb.getMethod("challenge"));
74   - cSPKI.defineMethod("challenge=",spkicb.getMethod("set_challenge",IRubyObject.class));
  66 + cSPKI.defineFastMethod("to_der",spkicb.getFastMethod("to_der"));
  67 + cSPKI.defineFastMethod("to_pem",spkicb.getFastMethod("to_pem"));
  68 + cSPKI.defineFastMethod("to_s",spkicb.getFastMethod("to_pem"));
  69 + cSPKI.defineFastMethod("to_text",spkicb.getFastMethod("to_text"));
  70 + cSPKI.defineFastMethod("public_key",spkicb.getFastMethod("public_key"));
  71 + cSPKI.defineFastMethod("public_key=",spkicb.getFastMethod("set_public_key",IRubyObject.class));
  72 + cSPKI.defineFastMethod("sign",spkicb.getFastMethod("sign",IRubyObject.class,IRubyObject.class));
  73 + cSPKI.defineFastMethod("verify",spkicb.getFastMethod("verify",IRubyObject.class));
  74 + cSPKI.defineFastMethod("challenge",spkicb.getFastMethod("challenge"));
  75 + cSPKI.defineFastMethod("challenge=",spkicb.getFastMethod("set_challenge",IRubyObject.class));
75 76 }
76 77
77 78 public NetscapeSPKI(IRuby runtime, RubyClass type) {
@@ -83,7 +84,7 @@ public NetscapeSPKI(IRuby runtime, RubyClass type) {
83 84
84 85 private NetscapeCertRequest cert;
85 86
86   - public IRubyObject _initialize(IRubyObject[] args) throws Exception {
  87 + public IRubyObject _initialize(IRubyObject[] args, Block unusedBlock) throws Exception {
87 88 if(args.length > 0) {
88 89 byte[] b = args[0].toString().getBytes("PLAIN");
89 90 try {
83 jruby/src/org/jruby/ext/openssl/PKCS7.java
@@ -50,11 +50,11 @@
50 50 import org.jruby.RubyArray;
51 51 import org.jruby.RubyClass;
52 52 import org.jruby.RubyModule;
53   -import org.jruby.RubyNumeric;
54 53 import org.jruby.RubyObject;
55 54 import org.jruby.ext.openssl.x509store.PEM;
56 55 import org.jruby.ext.openssl.x509store.X509AuxCertificate;
57 56 import org.jruby.ext.openssl.x509store.X509_STORE_CTX;
  57 +import org.jruby.runtime.Block;
58 58 import org.jruby.runtime.CallbackFactory;
59 59 import org.jruby.runtime.ObjectAllocator;
60 60 import org.jruby.runtime.builtin.IRubyObject;
@@ -72,37 +72,38 @@ public static void createPKCS7(IRuby runtime, RubyModule mOSSL) {
72 72 cPKCS7.attr_accessor(new IRubyObject[]{runtime.newSymbol("data"),runtime.newSymbol("error_string")});
73 73
74 74 CallbackFactory p7cb = runtime.callbackFactory(PKCS7.class);
75   - mPKCS7.defineSingletonMethod("read_smime",p7cb.getSingletonMethod("read_smime",IRubyObject.class));
76   - mPKCS7.defineSingletonMethod("write_smime",p7cb.getOptSingletonMethod("write_smime"));
77   - mPKCS7.defineSingletonMethod("sign",p7cb.getOptSingletonMethod("sign"));
78   - mPKCS7.defineSingletonMethod("encrypt",p7cb.getOptSingletonMethod("encrypt"));
79   - cPKCS7.defineSingletonMethod("new",p7cb.getOptSingletonMethod("newInstance"));
  75 + mPKCS7.defineFastSingletonMethod("read_smime",p7cb.getFastSingletonMethod("read_smime",IRubyObject.class));
  76 + mPKCS7.defineFastSingletonMethod("write_smime",p7cb.getFastOptSingletonMethod("write_smime"));
  77 + mPKCS7.defineFastSingletonMethod("sign",p7cb.getFastOptSingletonMethod("sign"));
  78 + mPKCS7.defineFastSingletonMethod("encrypt",p7cb.getFastOptSingletonMethod("encrypt"));
  79 + // FIXME: This was defined, but does not exist? Should it?
  80 + //cPKCS7.defineFastSingletonMethod("new",p7cb.getFastOptSingletonMethod("newInstance"));
80 81 cPKCS7.defineMethod("initialize",p7cb.getOptMethod("_initialize"));
81   - cPKCS7.defineMethod("initialize_copy",p7cb.getMethod("initialize_copy",IRubyObject.class));
82   - cPKCS7.defineMethod("clone",p7cb.getMethod("rbClone"));
83   - cPKCS7.defineMethod("type=",p7cb.getMethod("set_type",IRubyObject.class));
84   - cPKCS7.defineMethod("type",p7cb.getMethod("get_type"));
85   - cPKCS7.defineMethod("detached=",p7cb.getMethod("set_detached",IRubyObject.class));
86   - cPKCS7.defineMethod("detached",p7cb.getMethod("detached"));
87   - cPKCS7.defineMethod("detached?",p7cb.getMethod("detached_p"));
88   - cPKCS7.defineMethod("cipher=",p7cb.getMethod("set_cipher",IRubyObject.class));
89   - cPKCS7.defineMethod("add_signer",p7cb.getMethod("add_signer",IRubyObject.class));
90   - cPKCS7.defineMethod("signers",p7cb.getMethod("signers"));
91   - cPKCS7.defineMethod("add_recipient",p7cb.getMethod("add_recipient",IRubyObject.class));
92   - cPKCS7.defineMethod("recipients",p7cb.getMethod("recipients"));
93   - cPKCS7.defineMethod("add_certificate",p7cb.getMethod("add_certificate",IRubyObject.class));
94   - cPKCS7.defineMethod("certificates=",p7cb.getMethod("set_certificates",IRubyObject.class));
95   - cPKCS7.defineMethod("certificates",p7cb.getMethod("certificates"));
96   - cPKCS7.defineMethod("add_crl",p7cb.getMethod("add_crl",IRubyObject.class));
97   - cPKCS7.defineMethod("crls=",p7cb.getMethod("set_crls",IRubyObject.class));
98   - cPKCS7.defineMethod("crls",p7cb.getMethod("crls"));
99   - cPKCS7.defineMethod("add_data",p7cb.getMethod("add_data",IRubyObject.class));
100   - cPKCS7.defineMethod("data=",p7cb.getMethod("add_data",IRubyObject.class));
101   - cPKCS7.defineMethod("verify",p7cb.getOptMethod("verify"));
102   - cPKCS7.defineMethod("decrypt",p7cb.getOptMethod("decrypt"));
103   - cPKCS7.defineMethod("to_pem",p7cb.getMethod("to_pem"));
104   - cPKCS7.defineMethod("to_s",p7cb.getMethod("to_pem"));
105   - cPKCS7.defineMethod("to_der",p7cb.getMethod("to_der"));
  82 + cPKCS7.defineFastMethod("initialize_copy",p7cb.getFastMethod("initialize_copy",IRubyObject.class));
  83 + cPKCS7.defineFastMethod("clone",p7cb.getFastMethod("rbClone"));
  84 + cPKCS7.defineFastMethod("type=",p7cb.getFastMethod("set_type",IRubyObject.class));
  85 + cPKCS7.defineFastMethod("type",p7cb.getFastMethod("get_type"));
  86 + cPKCS7.defineFastMethod("detached=",p7cb.getFastMethod("set_detached",IRubyObject.class));
  87 + cPKCS7.defineFastMethod("detached",p7cb.getFastMethod("detached"));
  88 + cPKCS7.defineFastMethod("detached?",p7cb.getFastMethod("detached_p"));
  89 + cPKCS7.defineFastMethod("cipher=",p7cb.getFastMethod("set_cipher",IRubyObject.class));
  90 + cPKCS7.defineFastMethod("add_signer",p7cb.getFastMethod("add_signer",IRubyObject.class));
  91 + cPKCS7.defineFastMethod("signers",p7cb.getFastMethod("signers"));
  92 + cPKCS7.defineFastMethod("add_recipient",p7cb.getFastMethod("add_recipient",IRubyObject.class));
  93 + cPKCS7.defineFastMethod("recipients",p7cb.getFastMethod("recipients"));
  94 + cPKCS7.defineFastMethod("add_certificate",p7cb.getFastMethod("add_certificate",IRubyObject.class));
  95 + cPKCS7.defineFastMethod("certificates=",p7cb.getFastMethod("set_certificates",IRubyObject.class));
  96 + cPKCS7.defineFastMethod("certificates",p7cb.getFastMethod("certificates"));
  97 + cPKCS7.defineFastMethod("add_crl",p7cb.getFastMethod("add_crl",IRubyObject.class));
  98 + cPKCS7.defineFastMethod("crls=",p7cb.getFastMethod("set_crls",IRubyObject.class));
  99 + cPKCS7.defineFastMethod("crls",p7cb.getFastMethod("crls"));
  100 + cPKCS7.defineFastMethod("add_data",p7cb.getFastMethod("add_data",IRubyObject.class));
  101 + cPKCS7.defineFastMethod("data=",p7cb.getFastMethod("add_data",IRubyObject.class));
  102 + cPKCS7.defineFastMethod("verify",p7cb.getFastOptMethod("verify"));
  103 + cPKCS7.defineFastMethod("decrypt",p7cb.getFastOptMethod("decrypt"));
  104 + cPKCS7.defineFastMethod("to_pem",p7cb.getFastMethod("to_pem"));
  105 + cPKCS7.defineFastMethod("to_s",p7cb.getFastMethod("to_pem"));
  106 + cPKCS7.defineFastMethod("to_der",p7cb.getFastMethod("to_der"));
106 107
107 108 SignerInfo.createSignerInfo(runtime,mPKCS7);
108 109 RecipientInfo.createRecipientInfo(runtime,mPKCS7);
@@ -187,7 +188,7 @@ public PKCS7(IRuby runtime, RubyClass type) {
187 188
188 189 private CMSSignedData signedData;
189 190
190   - public IRubyObject _initialize(IRubyObject[] args) throws Exception {
  191 + public IRubyObject _initialize(IRubyObject[] args, Block unusedBlock) throws Exception {
191 192 if(checkArgumentCount(args,0,1) == 0) {
192 193 return this;
193 194 }
@@ -394,11 +395,11 @@ public static void createSignerInfo(IRuby runtime, RubyModule mPKCS7) {
394 395 mPKCS7.defineConstant("Signer",cPKCS7Signer);
395 396
396 397 CallbackFactory p7scb = runtime.callbackFactory(SignerInfo.class);
397   - cPKCS7Signer.defineMethod("initialize",p7scb.getMethod("initialize",IRubyObject.class,IRubyObject.class,IRubyObject.class));
398   - cPKCS7Signer.defineMethod("issuer",p7scb.getMethod("issuer"));
399   - cPKCS7Signer.defineMethod("name",p7scb.getMethod("issuer"));
400   - cPKCS7Signer.defineMethod("serial",p7scb.getMethod("serial"));
401   - cPKCS7Signer.defineMethod("signed_time",p7scb.getMethod("signed_time"));
  398 + cPKCS7Signer.defineFastMethod("initialize",p7scb.getFastMethod("initialize",IRubyObject.class,IRubyObject.class,IRubyObject.class));
  399 + cPKCS7Signer.defineFastMethod("issuer",p7scb.getFastMethod("issuer"));
  400 + cPKCS7Signer.defineFastMethod("name",p7scb.getFastMethod("issuer"));
  401 + cPKCS7Signer.defineFastMethod("serial",p7scb.getFastMethod("serial"));
  402 + cPKCS7Signer.defineFastMethod("signed_time",p7scb.getFastMethod("signed_time"));
402 403 }
403 404
404 405 public SignerInfo(IRuby runtime, RubyClass type) {
@@ -437,10 +438,10 @@ public static void createRecipientInfo(IRuby runtime, RubyModule mPKCS7) {
437 438 RubyClass cPKCS7Recipient = mPKCS7.defineClassUnder("RecipientInfo",runtime.getObject(),RECIPIENTINFO_ALLOCATOR);
438 439
439 440 CallbackFactory p7rcb = runtime.callbackFactory(RecipientInfo.class);
440   - cPKCS7Recipient.defineMethod("initialize",p7rcb.getMethod("initialize",IRubyObject.class));
441   - cPKCS7Recipient.defineMethod("issuer",p7rcb.getMethod("issuer"));
442   - cPKCS7Recipient.defineMethod("serial",p7rcb.getMethod("serial"));
443   - cPKCS7Recipient.defineMethod("enc_key",p7rcb.getMethod("enc_key"));
  441 + cPKCS7Recipient.defineFastMethod("initialize",p7rcb.getFastMethod("initialize",IRubyObject.class));
  442 + cPKCS7Recipient.defineFastMethod("issuer",p7rcb.getFastMethod("issuer"));
  443 + cPKCS7Recipient.defineFastMethod("serial",p7rcb.getFastMethod("serial"));
  444 + cPKCS7Recipient.defineFastMethod("enc_key",p7rcb.getFastMethod("enc_key"));
444 445 }
445 446
446 447 public RecipientInfo(IRuby runtime, RubyClass type) {
7 jruby/src/org/jruby/ext/openssl/PKey.java
@@ -35,6 +35,7 @@
35 35 import org.jruby.RubyClass;
36 36 import org.jruby.RubyModule;
37 37 import org.jruby.RubyObject;
  38 +import org.jruby.runtime.Block;
38 39 import org.jruby.runtime.CallbackFactory;
39 40 import org.jruby.runtime.ObjectAllocator;
40 41 import org.jruby.runtime.builtin.IRubyObject;
@@ -53,8 +54,8 @@ public static void createPKey(IRuby runtime, RubyModule ossl) {
53 54 CallbackFactory pkeycb = runtime.callbackFactory(PKey.class);
54 55
55 56 cPKey.defineMethod("initialize",pkeycb.getMethod("initialize"));
56   - cPKey.defineMethod("sign",pkeycb.getMethod("sign",IRubyObject.class,IRubyObject.class));
57   - cPKey.defineMethod("verify",pkeycb.getMethod("verify",IRubyObject.class,IRubyObject.class,IRubyObject.class));
  57 + cPKey.defineFastMethod("sign",pkeycb.getFastMethod("sign",IRubyObject.class,IRubyObject.class));
  58 + cPKey.defineFastMethod("verify",pkeycb.getFastMethod("verify",IRubyObject.class,IRubyObject.class,IRubyObject.class));
58 59
59 60 PKeyRSA.createPKeyRSA(runtime,mPKey);
60 61 PKeyDSA.createPKeyDSA(runtime,mPKey);
@@ -65,7 +66,7 @@ public PKey(IRuby runtime, RubyClass type) {
65 66 super(runtime,type);
66 67 }
67 68
68   - public IRubyObject initialize() {
  69 + public IRubyObject initialize(Block unusedBlock) {
69 70 return this;
70 71 }
71 72
23 jruby/src/org/jruby/ext/openssl/PKeyDSA.java
@@ -48,6 +48,7 @@
48 48 import org.jruby.RubyModule;
49 49 import org.jruby.exceptions.RaiseException;
50 50 import org.jruby.ext.openssl.x509store.PEM;
  51 +import org.jruby.runtime.Block;
51 52 import org.jruby.runtime.CallbackFactory;
52 53 import org.jruby.runtime.ObjectAllocator;
53 54 import org.jruby.runtime.builtin.IRubyObject;
@@ -71,16 +72,16 @@ public static void createPKeyDSA(IRuby runtime, RubyModule mPKey) {
71 72
72 73 cDSA.defineMethod("initialize",dsacb.getOptMethod("initialize"));
73 74
74   - cDSA.defineMethod("public?",dsacb.getMethod("public_p"));
75   - cDSA.defineMethod("private?",dsacb.getMethod("private_p"));
76   - cDSA.defineMethod("to_der",dsacb.getMethod("to_der"));
77   - cDSA.defineMethod("to_text",dsacb.getMethod("to_text"));
78   - cDSA.defineMethod("public_key",dsacb.getMethod("public_key"));
79   - cDSA.defineMethod("export",dsacb.getOptMethod("export"));
80   - cDSA.defineMethod("to_pem",dsacb.getOptMethod("export"));
81   - cDSA.defineMethod("to_s",dsacb.getOptMethod("export"));
82   - cDSA.defineMethod("syssign",dsacb.getMethod("syssign",IRubyObject.class));
83   - cDSA.defineMethod("sysverify",dsacb.getMethod("sysverify",IRubyObject.class,IRubyObject.class));
  75 + cDSA.defineFastMethod("public?",dsacb.getFastMethod("public_p"));
  76 + cDSA.defineFastMethod("private?",dsacb.getFastMethod("private_p"));
  77 + cDSA.defineFastMethod("to_der",dsacb.getFastMethod("to_der"));
  78 + cDSA.defineFastMethod("to_text",dsacb.getFastMethod("to_text"));
  79 + cDSA.defineFastMethod("public_key",dsacb.getFastMethod("public_key"));
  80 + cDSA.defineFastMethod("export",dsacb.getFastOptMethod("export"));
  81 + cDSA.defineFastMethod("to_pem",dsacb.getFastOptMethod("export"));
  82 + cDSA.defineFastMethod("to_s",dsacb.getFastOptMethod("export"));
  83 + cDSA.defineFastMethod("syssign",dsacb.getFastMethod("syssign",IRubyObject.class));
  84 + cDSA.defineFastMethod("sysverify",dsacb.getFastMethod("sysverify",IRubyObject.class,IRubyObject.class));
84 85 }
85 86
86 87 public PKeyDSA(IRuby runtime, RubyClass type) {
@@ -102,7 +103,7 @@ String getAlgorithm() {
102 103 return "DSA";
103 104 }
104 105
105   - public IRubyObject initialize(IRubyObject[] args) {
  106 + public IRubyObject initialize(IRubyObject[] args, Block unusedBlock) {
106 107 Object rsa;
107 108 IRubyObject arg;
108 109 IRubyObject pass = null;
25 jruby/src/org/jruby/ext/openssl/PKeyRSA.java
@@ -56,6 +56,7 @@
56 56 import org.jruby.RubyNumeric;
57 57 import org.jruby.exceptions.RaiseException;
58 58 import org.jruby.ext.openssl.x509store.PEM;
  59 +import org.jruby.runtime.Block;
59 60 import org.jruby.runtime.CallbackFactory;
60 61 import org.jruby.runtime.ObjectAllocator;
61 62 import org.jruby.runtime.builtin.IRubyObject;
@@ -78,17 +79,17 @@ public static void createPKeyRSA(IRuby runtime, RubyModule mPKey) {
78 79 CallbackFactory rsacb = runtime.callbackFactory(PKeyRSA.class);
79 80
80 81 cRSA.defineMethod("initialize",rsacb.getOptMethod("initialize"));
81   - cRSA.defineMethod("public?",rsacb.getMethod("public_p"));
82   - cRSA.defineMethod("private?",rsacb.getMethod("private_p"));
83   - cRSA.defineMethod("to_der",rsacb.getMethod("to_der"));
84   - cRSA.defineMethod("public_key",rsacb.getMethod("public_key"));
85   - cRSA.defineMethod("export",rsacb.getOptMethod("export"));
86   - cRSA.defineMethod("to_pem",rsacb.getOptMethod("export"));
87   - cRSA.defineMethod("to_s",rsacb.getOptMethod("export"));
88   - cRSA.defineMethod("private_encrypt",rsacb.getOptMethod("private_encrypt"));
89   - cRSA.defineMethod("private_decrypt",rsacb.getOptMethod("private_decrypt"));
90   - cRSA.defineMethod("public_encrypt",rsacb.getOptMethod("public_encrypt"));
91   - cRSA.defineMethod("public_decrypt",rsacb.getOptMethod("public_decrypt"));
  82 + cRSA.defineFastMethod("public?",rsacb.getFastMethod("public_p"));
  83 + cRSA.defineFastMethod("private?",rsacb.getFastMethod("private_p"));
  84 + cRSA.defineFastMethod("to_der",rsacb.getFastMethod("to_der"));
  85 + cRSA.defineFastMethod("public_key",rsacb.getFastMethod("public_key"));
  86 + cRSA.defineFastMethod("export",rsacb.getFastOptMethod("export"));
  87 + cRSA.defineFastMethod("to_pem",rsacb.getFastOptMethod("export"));
  88 + cRSA.defineFastMethod("to_s",rsacb.getFastOptMethod("export"));
  89 + cRSA.defineFastMethod("private_encrypt",rsacb.getFastOptMethod("private_encrypt"));
  90 + cRSA.defineFastMethod("private_decrypt",rsacb.getFastOptMethod("private_decrypt"));
  91 + cRSA.defineFastMethod("public_encrypt",rsacb.getFastOptMethod("public_encrypt"));
  92 + cRSA.defineMethod("public_decrypt",rsacb.getFastOptMethod("public_decrypt"));
92 93
93 94 cRSA.setConstant("PKCS1_PADDING",runtime.newFixnum(1));
94 95 cRSA.setConstant("SSLV23_PADDING",runtime.newFixnum(2));
@@ -115,7 +116,7 @@ String getAlgorithm() {
115 116 return "RSA";
116 117 }
117 118
118   - public IRubyObject initialize(IRubyObject[] args) {
  119 + public IRubyObject initialize(IRubyObject[] args, Block block) {
119 120 Object rsa;
120 121 IRubyObject arg;
121 122 IRubyObject pass = null;
14 jruby/src/org/jruby/ext/openssl/Random.java
@@ -40,13 +40,13 @@ public static void createRandom(IRuby runtime, RubyModule ossl) {
40 40 RubyModule rand = ossl.defineModuleUnder("Random");
41 41
42 42 CallbackFactory randcb = runtime.callbackFactory(Random.class);
43   - rand.defineSingletonMethod("seed",randcb.getOptSingletonMethod("seed"));
44   - rand.defineSingletonMethod("load_random_file",randcb.getOptSingletonMethod("load_random_file"));
45   - rand.defineSingletonMethod("write_random_file",randcb.getOptSingletonMethod("write_random_file"));
46   - rand.defineSingletonMethod("random_bytes",randcb.getOptSingletonMethod("random_bytes"));
47   - rand.defineSingletonMethod("pseudo_bytes",randcb.getOptSingletonMethod("pseudo_bytes"));
48   - rand.defineSingletonMethod("egd",randcb.getOptSingletonMethod("egd"));
49   - rand.defineSingletonMethod("egd_bytes",randcb.getOptSingletonMethod("egd_bytes"));
  43 + rand.defineFastSingletonMethod("seed",randcb.getFastOptSingletonMethod("seed"));
  44 + rand.defineFastSingletonMethod("load_random_file",randcb.getFastOptSingletonMethod("load_random_file"));
  45 + rand.defineFastSingletonMethod("write_random_file",randcb.getFastOptSingletonMethod("write_random_file"));
  46 + rand.defineFastSingletonMethod("random_bytes",randcb.getFastOptSingletonMethod("random_bytes"));
  47 + rand.defineFastSingletonMethod("pseudo_bytes",randcb.getFastOptSingletonMethod("pseudo_bytes"));
  48 + rand.defineFastSingletonMethod("egd",randcb.getFastOptSingletonMethod("egd"));
  49 + rand.defineFastSingletonMethod("egd_bytes",randcb.getFastOptSingletonMethod("egd_bytes"));
50 50 }
51 51
52 52 public static IRubyObject seed(IRubyObject recv, IRubyObject[] args) {
39 jruby/src/org/jruby/ext/openssl/Request.java
@@ -46,6 +46,7 @@
46 46 import org.jruby.RubyNumeric;
47 47 import org.jruby.RubyObject;
48 48 import org.jruby.exceptions.RaiseException;
  49 +import org.jruby.runtime.Block;
49 50 import org.jruby.runtime.CallbackFactory;
50 51 import org.jruby.runtime.ObjectAllocator;
51 52 import org.jruby.runtime.ThreadContext;
@@ -69,24 +70,24 @@ public static void createRequest(IRuby runtime, RubyModule mX509) {
69 70 CallbackFactory reqcb = runtime.callbackFactory(Request.class);
70 71
71 72 cRequest.defineMethod("initialize",reqcb.getOptMethod("_initialize"));
72   - cRequest.defineMethod("initialize_copy",reqcb.getMethod("initialize_copy",IRubyObject.class));
73   - cRequest.defineMethod("clone",reqcb.getMethod("rbClone"));
74   - cRequest.defineMethod("to_pem",reqcb.getMethod("to_pem"));
75   - cRequest.defineMethod("to_der",reqcb.getMethod("to_der"));
76   - cRequest.defineMethod("to_s",reqcb.getMethod("to_pem"));
77   - cRequest.defineMethod("to_text",reqcb.getMethod("to_text"));
78   - cRequest.defineMethod("version",reqcb.getMethod("version"));
79   - cRequest.defineMethod("version=",reqcb.getMethod("set_version",IRubyObject.class));
80   - cRequest.defineMethod("subject",reqcb.getMethod("subject"));
81   - cRequest.defineMethod("subject=",reqcb.getMethod("set_subject",IRubyObject.class));
82   - cRequest.defineMethod("signature_algorithm",reqcb.getMethod("signature_algorithm"));
83   - cRequest.defineMethod("public_key",reqcb.getMethod("public_key"));
84   - cRequest.defineMethod("public_key=",reqcb.getMethod("set_public_key",IRubyObject.class));
85   - cRequest.defineMethod("sign",reqcb.getMethod("sign",IRubyObject.class,IRubyObject.class));
86   - cRequest.defineMethod("verify",reqcb.getMethod("verify",IRubyObject.class));
87   - cRequest.defineMethod("attributes",reqcb.getMethod("attributes"));
88   - cRequest.defineMethod("attributes=",reqcb.getMethod("set_attributes",IRubyObject.class));
89   - cRequest.defineMethod("add_attribute",reqcb.getMethod("add_attribute",IRubyObject.class));
  73 + cRequest.defineFastMethod("initialize_copy",reqcb.getFastMethod("initialize_copy",IRubyObject.class));
  74 + cRequest.defineFastMethod("clone",reqcb.getFastMethod("rbClone"));
  75 + cRequest.defineFastMethod("to_pem",reqcb.getFastMethod("to_pem"));
  76 + cRequest.defineFastMethod("to_der",reqcb.getFastMethod("to_der"));
  77 + cRequest.defineFastMethod("to_s",reqcb.getFastMethod("to_pem"));
  78 + cRequest.defineFastMethod("to_text",reqcb.getFastMethod("to_text"));
  79 + cRequest.defineFastMethod("version",reqcb.getFastMethod("version"));
  80 + cRequest.defineFastMethod("version=",reqcb.getFastMethod("set_version",IRubyObject.class));
  81 + cRequest.defineFastMethod("subject",reqcb.getFastMethod("subject"));
  82 + cRequest.defineFastMethod("subject=",reqcb.getFastMethod("set_subject",IRubyObject.class));
  83 + cRequest.defineFastMethod("signature_algorithm",reqcb.getFastMethod("signature_algorithm"));
  84 + cRequest.defineFastMethod("public_key",reqcb.getFastMethod("public_key"));
  85 + cRequest.defineFastMethod("public_key=",reqcb.getFastMethod("set_public_key",IRubyObject.class));
  86 + cRequest.defineFastMethod("sign",reqcb.getFastMethod("sign",IRubyObject.class,IRubyObject.class));
  87 + cRequest.defineFastMethod("verify",reqcb.getFastMethod("verify",IRubyObject.class));
  88 + cRequest.defineFastMethod("attributes",reqcb.getFastMethod("attributes"));
  89 + cRequest.defineFastMethod("attributes=",reqcb.getFastMethod("set_attributes",IRubyObject.class));
  90 + cRequest.defineFastMethod("add_attribute",reqcb.getFastMethod("add_attribute",IRubyObject.class));
90 91 }
91 92
92 93 private IRubyObject version;
@@ -103,7 +104,7 @@ public Request(IRuby runtime, RubyClass type) {
103 104 attrs = new ArrayList();
104 105 }
105 106
106   - public IRubyObject _initialize(IRubyObject[] args) throws Exception {
  107 + public IRubyObject _initialize(IRubyObject[] args, Block block) throws Exception {
107 108 if(checkArgumentCount(args,0,1) == 0) {
108 109 return this;
109 110 }
7 jruby/src/org/jruby/ext/openssl/SSLContext.java
@@ -43,6 +43,7 @@
43 43 import org.jruby.ext.openssl.x509store.X509AuxCertificate;
44 44 import org.jruby.ext.openssl.x509store.X509_STORE;
45 45 import org.jruby.ext.openssl.x509store.X509_STORE_CTX;
  46 +import org.jruby.runtime.Block;
46 47 import org.jruby.runtime.CallbackFactory;
47 48 import org.jruby.runtime.ObjectAllocator;
48 49 import org.jruby.runtime.builtin.IRubyObject;
@@ -71,8 +72,8 @@ public static void createSSLContext(IRuby runtime, RubyModule mSSL) {
71 72
72 73 CallbackFactory ctxcb = runtime.callbackFactory(SSLContext.class);
73 74 cSSLContext.defineMethod("initialize",ctxcb.getOptMethod("initialize"));
74   - cSSLContext.defineMethod("ciphers",ctxcb.getMethod("ciphers"));
75   - cSSLContext.defineMethod("ciphers=",ctxcb.getMethod("set_ciphers",IRubyObject.class));
  75 + cSSLContext.defineFastMethod("ciphers",ctxcb.getFastMethod("ciphers"));
  76 + cSSLContext.defineFastMethod("ciphers=",ctxcb.getFastMethod("set_ciphers",IRubyObject.class));
76 77 }
77 78
78 79 public SSLContext(IRuby runtime, RubyClass type) {
@@ -115,7 +116,7 @@ public X509Cert getCallbackCert() {
115 116 return t_cert;
116 117 }
117 118
118   - public IRubyObject initialize(IRubyObject[] args) {
  119 + public IRubyObject initialize(IRubyObject[] args, Block unusedBlock) {
119 120 ciphers = getRuntime().getNil();
120 121 return this;
121 122 }
25 jruby/src/org/jruby/ext/openssl/SSLSocket.java
@@ -46,6 +46,7 @@
46 46 import org.jruby.RubyNumeric;
47 47 import org.jruby.RubyObject;
48 48 import org.jruby.exceptions.RaiseException;
  49 +import org.jruby.runtime.Block;
49 50 import org.jruby.runtime.CallType;
50 51 import org.jruby.runtime.CallbackFactory;
51 52 import org.jruby.runtime.ObjectAllocator;
@@ -72,17 +73,17 @@ public static void createSSLSocket(IRuby runtime, RubyModule mSSL) {
72 73 CallbackFactory sockcb = runtime.callbackFactory(SSLSocket.class);
73 74 cSSLSocket.defineAlias("to_io","io");
74 75 cSSLSocket.defineMethod("initialize",sockcb.getOptMethod("_initialize"));
75   - cSSLSocket.defineMethod("connect",sockcb.getMethod("connect"));
76   - cSSLSocket.defineMethod("accept",sockcb.getMethod("accept"));
77   - cSSLSocket.defineMethod("sysread",sockcb.getOptMethod("sysread"));
78   - cSSLSocket.defineMethod("syswrite",sockcb.getMethod("syswrite",IRubyObject.class));
79   - cSSLSocket.defineMethod("sysclose",sockcb.getMethod("sysclose"));
80   - cSSLSocket.defineMethod("cert",sockcb.getMethod("cert"));
81   - cSSLSocket.defineMethod("peer_cert",sockcb.getMethod("peer_cert"));
82   - cSSLSocket.defineMethod("peer_cert_chain",sockcb.getMethod("peer_cert_chain"));
83   - cSSLSocket.defineMethod("cipher",sockcb.getMethod("cipher"));
84   - cSSLSocket.defineMethod("state",sockcb.getMethod("state"));
85   - cSSLSocket.defineMethod("pending",sockcb.getMethod("pending"));
  76 + cSSLSocket.defineFastMethod("connect",sockcb.getFastMethod("connect"));
  77 + cSSLSocket.defineFastMethod("accept",sockcb.getFastMethod("accept"));
  78 + cSSLSocket.defineFastMethod("sysread",sockcb.getFastOptMethod("sysread"));
  79 + cSSLSocket.defineFastMethod("syswrite",sockcb.getFastMethod("syswrite",IRubyObject.class));
  80 + cSSLSocket.defineFastMethod("sysclose",sockcb.getFastMethod("sysclose"));
  81 + cSSLSocket.defineFastMethod("cert",sockcb.getFastMethod("cert"));
  82 + cSSLSocket.defineFastMethod("peer_cert",sockcb.getFastMethod("peer_cert"));
  83 + cSSLSocket.defineFastMethod("peer_cert_chain",sockcb.getFastMethod("peer_cert_chain"));
  84 + cSSLSocket.defineFastMethod("cipher",sockcb.getFastMethod("cipher"));
  85 + cSSLSocket.defineFastMethod("state",sockcb.getFastMethod("state"));
  86 + cSSLSocket.defineFastMethod("pending",sockcb.getFastMethod("pending"));
86 87 }
87 88
88 89 private RubyClass sslError;
@@ -111,7 +112,7 @@ public SSLSocket(IRuby runtime, RubyClass type) {
111 112 private Selector wsel;
112 113 private Selector asel;
113 114
114   - public IRubyObject _initialize(IRubyObject[] args) throws Exception {
  115 + public IRubyObject _initialize(IRubyObject[] args, Block unusedBlock) throws Exception {
115 116 IRubyObject io, ctx;
116 117 ThreadContext tc = getRuntime().getCurrentContext();
117 118 if(checkArgumentCount(args,1,2) == 1) {
55 jruby/src/org/jruby/ext/openssl/X509CRL.java
@@ -57,6 +57,7 @@
57 57 import org.jruby.RubyTime;
58 58 import org.jruby.exceptions.RaiseException;
59 59 import org.jruby.ext.openssl.x509store.PEM;
  60 +import org.jruby.runtime.Block;
60 61 import org.jruby.runtime.CallbackFactory;
61 62 import org.jruby.runtime.ObjectAllocator;
62 63 import org.jruby.runtime.ThreadContext;
@@ -80,32 +81,32 @@ public static void createX509CRL(IRuby runtime, RubyModule mX509) {
80 81 CallbackFactory crlcb = runtime.callbackFactory(X509CRL.class);
81 82
82 83 cX509CRL.defineMethod("initialize",crlcb.getOptMethod("_initialize"));
83   - cX509CRL.defineMethod("initialize_copy",crlcb.getMethod("initialize_copy",IRubyObject.class));
84   - cX509CRL.defineMethod("clone",crlcb.getMethod("rbClone"));
85   -
86   - cX509CRL.defineMethod("version",crlcb.getMethod("version"));
87   - cX509CRL.defineMethod("version=",crlcb.getMethod("set_version",IRubyObject.class));
88   - cX509CRL.defineMethod("signature_algorithm",crlcb.getMethod("signature_algorithm"));
89   - cX509CRL.defineMethod("issuer",crlcb.getMethod("issuer"));
90   - cX509CRL.defineMethod("issuer=",crlcb.getMethod("set_issuer",IRubyObject.class));
91   - cX509CRL.defineMethod("last_update",crlcb.getMethod("last_update"));
92   - cX509CRL.defineMethod("last_update=",crlcb.getMethod("set_last_update",IRubyObject.class));
93   - cX509CRL.defineMethod("next_update",crlcb.getMethod("next_update"));
94   - cX509CRL.defineMethod("next_update=",crlcb.getMethod("set_next_update",IRubyObject.class));
95   - cX509CRL.defineMethod("revoked",crlcb.getMethod("revoked"));
96   - cX509CRL.defineMethod("revoked=",crlcb.getMethod("set_revoked",IRubyObject.class));
97   - cX509CRL.defineMethod("add_revoked",crlcb.getMethod("add_revoked",IRubyObject.class));
98   -
99   - cX509CRL.defineMethod("sign",crlcb.getMethod("sign",IRubyObject.class,IRubyObject.class));
100   - cX509CRL.defineMethod("verify",crlcb.getMethod("verify",IRubyObject.class));
101   -
102   - cX509CRL.defineMethod("to_der",crlcb.getMethod("to_der"));
103   - cX509CRL.defineMethod("to_pem",crlcb.getMethod("to_pem"));
104   - cX509CRL.defineMethod("to_s",crlcb.getMethod("to_pem"));
105   - cX509CRL.defineMethod("to_text",crlcb.getMethod("to_text"));
106   - cX509CRL.defineMethod("extensions",crlcb.getMethod("extensions"));
107   - cX509CRL.defineMethod("extensions=",crlcb.getMethod("set_extensions",IRubyObject.class));
108   - cX509CRL.defineMethod("add_extension",crlcb.getMethod("add_extension",IRubyObject.class));
  84 + cX509CRL.defineFastMethod("initialize_copy",crlcb.getFastMethod("initialize_copy",IRubyObject.class));
  85 + cX509CRL.defineFastMethod("clone",crlcb.getFastMethod("rbClone"));
  86 +
  87 + cX509CRL.defineFastMethod("version",crlcb.getFastMethod("version"));
  88 + cX509CRL.defineFastMethod("version=",crlcb.getFastMethod("set_version",IRubyObject.class));
  89 + cX509CRL.defineFastMethod("signature_algorithm",crlcb.getFastMethod("signature_algorithm"));
  90 + cX509CRL.defineFastMethod("issuer",crlcb.getFastMethod("issuer"));
  91 + cX509CRL.defineFastMethod("issuer=",crlcb.getFastMethod("set_issuer",IRubyObject.class));
  92 + cX509CRL.defineFastMethod("last_update",crlcb.getFastMethod("last_update"));
  93 + cX509CRL.defineFastMethod("last_update=",crlcb.getFastMethod("set_last_update",IRubyObject.class));
  94 + cX509CRL.defineFastMethod("next_update",crlcb.getFastMethod("next_update"));
  95 + cX509CRL.defineFastMethod("next_update=",crlcb.getFastMethod("set_next_update",IRubyObject.class));
  96 + cX509CRL.defineFastMethod("revoked",crlcb.getFastMethod("revoked"));
  97 + cX509CRL.defineFastMethod("revoked=",crlcb.getFastMethod("set_revoked",IRubyObject.class));
  98 + cX509CRL.defineFastMethod("add_revoked",crlcb.getFastMethod("add_revoked",IRubyObject.class));
  99 +
  100 + cX509CRL.defineFastMethod("sign",crlcb.getFastMethod("sign",IRubyObject.class,IRubyObject.class));
  101 + cX509CRL.defineFastMethod("verify",crlcb.getFastMethod("verify",IRubyObject.class));
  102 +
  103 + cX509CRL.defineFastMethod("to_der",crlcb.getFastMethod("to_der"));
  104 + cX509CRL.defineFastMethod("to_pem",crlcb.getFastMethod("to_pem"));
  105 + cX509CRL.defineFastMethod("to_s",crlcb.getFastMethod("to_pem"));
  106 + cX509CRL.defineFastMethod("to_text",crlcb.getFastMethod("to_text"));
  107 + cX509CRL.defineFastMethod("extensions",crlcb.getFastMethod("extensions"));
  108 + cX509CRL.defineFastMethod("extensions=",crlcb.getFastMethod("set_extensions",IRubyObject.class));
  109 + cX509CRL.defineFastMethod("add_extension",crlcb.getFastMethod("add_extension",IRubyObject.class));
109 110 }
110 111
111 112 private IRubyObject version;
@@ -132,7 +133,7 @@ public X509CRL(IRuby runtime, RubyClass type) {
132 133 super(runtime,type);
133 134 }
134 135
135   - public IRubyObject _initialize(IRubyObject[] args) throws Exception {
  136 + public IRubyObject _initialize(IRubyObject[] args, Block block) throws Exception {
136 137 // System.err.println("WARNING: unimplemented method called: CRL#initialize");
137 138 extensions = new ArrayList();
138 139 if(checkArgumentCount(args,0,1) == 0) {
59 jruby/src/org/jruby/ext/openssl/X509Cert.java
@@ -56,6 +56,7 @@
56 56 import org.jruby.exceptions.RaiseException;
57 57 import org.jruby.ext.openssl.x509store.PEM;
58 58 import org.jruby.ext.openssl.x509store.X509AuxCertificate;
  59 +import org.jruby.runtime.Block;
59 60 import org.jruby.runtime.CallbackFactory;
60 61 import org.jruby.runtime.ObjectAllocator;
61 62 import org.jruby.runtime.ThreadContext;
@@ -78,34 +79,34 @@ public static void createX509Cert(IRuby runtime, RubyModule mX509) {
78 79
79 80 CallbackFactory certcb = runtime.callbackFactory(X509Cert.class);
80 81 cX509Cert.defineMethod("initialize",certcb.getOptMethod("_initialize"));
81   - cX509Cert.defineMethod("initialize_copy",certcb.getMethod("initialize_copy",IRubyObject.class));
82   - cX509Cert.defineMethod("clone",certcb.getMethod("rbClone"));
83   - cX509Cert.defineMethod("to_der",certcb.getMethod("to_der"));
84   - cX509Cert.defineMethod("to_pem",certcb.getMethod("to_pem"));
85   - cX509Cert.defineMethod("to_s",certcb.getMethod("to_pem"));
86   - cX509Cert.defineMethod("to_text",certcb.getMethod("to_text"));
87   - cX509Cert.defineMethod("version",certcb.getMethod("version"));
88   - cX509Cert.defineMethod("version=",certcb.getMethod("set_version",IRubyObject.class));
89   - cX509Cert.defineMethod("signature_algorithm",certcb.getMethod("signature_algorithm"));
90   - cX509Cert.defineMethod("serial",certcb.getMethod("serial"));
91   - cX509Cert.defineMethod("serial=",certcb.getMethod("set_serial",IRubyObject.class));
92   - cX509Cert.defineMethod("subject",certcb.getMethod("subject"));
93   - cX509Cert.defineMethod("subject=",certcb.getMethod("set_subject",IRubyObject.class));
94   - cX509Cert.defineMethod("issuer",certcb.getMethod("issuer"));
95   - cX509Cert.defineMethod("issuer=",certcb.getMethod("set_issuer",IRubyObject.class));
96   - cX509Cert.defineMethod("not_before",certcb.getMethod("not_before"));
97   - cX509Cert.defineMethod("not_before=",certcb.getMethod("set_not_before",IRubyObject.class));
98   - cX509Cert.defineMethod("not_after",certcb.getMethod("not_after"));
99   - cX509Cert.defineMethod("not_after=",certcb.getMethod("set_not_after",IRubyObject.class));
100   - cX509Cert.defineMethod("public_key",certcb.getMethod("public_key"));
101   - cX509Cert.defineMethod("public_key=",certcb.getMethod("set_public_key",IRubyObject.class));
102   - cX509Cert.defineMethod("sign",certcb.getMethod("sign",IRubyObject.class,IRubyObject.class));
103   - cX509Cert.defineMethod("verify",certcb.getMethod("verify",IRubyObject.class));
104   - cX509Cert.defineMethod("check_private_key",certcb.getMethod("check_private_key",IRubyObject.class));
105   - cX509Cert.defineMethod("extensions",certcb.getMethod("extensions"));
106   - cX509Cert.defineMethod("extensions=",certcb.getMethod("set_extensions",IRubyObject.class));
107   - cX509Cert.defineMethod("add_extension",certcb.getMethod("add_extension",IRubyObject.class));
108   - cX509Cert.defineMethod("inspect",certcb.getMethod("inspect"));
  82 + cX509Cert.defineFastMethod("initialize_copy",certcb.getFastMethod("initialize_copy",IRubyObject.class));
  83 + cX509Cert.defineFastMethod("clone",certcb.getFastMethod("rbClone"));
  84 + cX509Cert.defineFastMethod("to_der",certcb.getFastMethod("to_der"));
  85 + cX509Cert.defineFastMethod("to_pem",certcb.getFastMethod("to_pem"));
  86 + cX509Cert.defineFastMethod("to_s",certcb.getFastMethod("to_pem"));
  87 + cX509Cert.defineFastMethod("to_text",certcb.getFastMethod("to_text"));
  88 + cX509Cert.defineFastMethod("version",certcb.getFastMethod("version"));
  89 + cX509Cert.defineFastMethod("version=",certcb.getFastMethod("set_version",IRubyObject.class));
  90 + cX509Cert.defineFastMethod("signature_algorithm",certcb.getFastMethod("signature_algorithm"));
  91 + cX509Cert.defineFastMethod("serial",certcb.getFastMethod("serial"));
  92 + cX509Cert.defineFastMethod("serial=",certcb.getFastMethod("set_serial",IRubyObject.class));
  93 + cX509Cert.defineFastMethod("subject",certcb.getFastMethod("subject"));
  94 + cX509Cert.defineFastMethod("subject=",certcb.getFastMethod("set_subject",IRubyObject.class));
  95 + cX509Cert.defineFastMethod("issuer",certcb.getFastMethod("issuer"));
  96 + cX509Cert.defineFastMethod("issuer=",certcb.getFastMethod("set_issuer",IRubyObject.class));
  97 + cX509Cert.defineFastMethod("not_before",certcb.getFastMethod("not_before"));
  98 + cX509Cert.defineFastMethod("not_before=",certcb.getFastMethod("set_not_before",IRubyObject.class));
  99 + cX509Cert.defineFastMethod("not_after",certcb.getFastMethod("not_after"));
  100 + cX509Cert.defineFastMethod("not_after=",certcb.getFastMethod("set_not_after",IRubyObject.class));
  101 + cX509Cert.defineFastMethod("public_key",certcb.getFastMethod("public_key"));
  102 + cX509Cert.defineFastMethod("public_key=",certcb.getFastMethod("set_public_key",IRubyObject.class));
  103 + cX509Cert.defineFastMethod("sign",certcb.getFastMethod("sign",IRubyObject.class,IRubyObject.class));
  104 + cX509Cert.defineFastMethod("verify",certcb.getFastMethod("verify",IRubyObject.class));
  105 + cX509Cert.defineFastMethod("check_private_key",certcb.getFastMethod("check_private_key",IRubyObject.class));
  106 + cX509Cert.defineFastMethod("extensions",certcb.getFastMethod("extensions"));
  107 + cX509Cert.defineFastMethod("extensions=",certcb.getFastMethod("set_extensions",IRubyObject.class));
  108 + cX509Cert.defineFastMethod("add_extension",certcb.getFastMethod("add_extension",IRubyObject.class));
  109 + cX509Cert.defineFastMethod("inspect",certcb.getFastMethod("inspect"));
109 110 }
110 111
111 112 public X509Cert(IRuby runtime, RubyClass type) {
@@ -144,7 +145,7 @@ public static IRubyObject wrap(IRuby runtime, Certificate c) throws Exception {
144 145 return cr.callMethod(runtime.getCurrentContext(),"new",runtime.newString(new String(c.getEncoded(),"ISO8859_1")));
145 146 }
146 147
147   - public IRubyObject _initialize(IRubyObject[] args) throws Exception {
  148 + public IRubyObject _initialize(IRubyObject[] args, Block unusedBlock) throws Exception {
148 149 extensions = new ArrayList();
149 150 if(checkArgumentCount(args,0,1) == 0) {
150 151 return this;
31 jruby/src/org/jruby/ext/openssl/X509Extensions.java
@@ -54,6 +54,7 @@
54 54 import org.jruby.RubyObject;
55 55 import org.jruby.RubyString;
56 56 import org.jruby.exceptions.RaiseException;
  57 +import org.jruby.runtime.Block;
57 58 import org.jruby.runtime.CallbackFactory;
58 59 import org.jruby.runtime.ThreadContext;
59 60 import org.jruby.runtime.builtin.IRubyObject;
@@ -73,23 +74,23 @@ public static void createX509Ext(IRuby runtime, RubyModule mX509) {
73 74 cX509ExtFactory.attr_reader(new IRubyObject[]{runtime.newString("issuer_certificate"),runtime.newString("subject_certificate"),
74 75 runtime.newString("subject_request"),runtime.newString("crl"),
75 76 runtime.newString("config")});
76   - cX509ExtFactory.defineMethod("issuer_certificate=",extfcb.getMethod("set_issuer_cert",IRubyObject.class));
77   - cX509ExtFactory.defineMethod("subject_certificate=",extfcb.getMethod("set_subject_cert",IRubyObject.class));
78   - cX509ExtFactory.defineMethod("subject_request=",extfcb.getMethod("set_subject_req",IRubyObject.class));
79   - cX509ExtFactory.defineMethod("crl=",extfcb.getMethod("set_crl",IRubyObject.class));
80   - cX509ExtFactory.defineMethod("config=",extfcb.getMethod("set_config",IRubyObject.class));
81   - cX509ExtFactory.defineMethod("create_ext",extfcb.getOptMethod("create_ext"));
  77 + cX509ExtFactory.defineFastMethod("issuer_certificate=",extfcb.getFastMethod("set_issuer_cert",IRubyObject.class));
  78 + cX509ExtFactory.defineFastMethod("subject_certificate=",extfcb.getFastMethod("set_subject_cert",IRubyObject.class));
  79 + cX509ExtFactory.defineFastMethod("subject_request=",extfcb.getFastMethod("set_subject_req",IRubyObject.class));
  80 + cX509ExtFactory.defineFastMethod("crl=",extfcb.getFastMethod("set_crl",IRubyObject.class));
  81 + cX509ExtFactory.defineFastMethod("config=",extfcb.getFastMethod("set_config",IRubyObject.class));
  82 + cX509ExtFactory.defineFastMethod("create_ext",extfcb.getFastOptMethod("create_ext"));
82 83
83 84 RubyClass cX509Ext = mX509.defineClassUnder("Extension",runtime.getObject(),runtime.getObject().getAllocator());
84 85 CallbackFactory extcb = runtime.callbackFactory(Extension.class);
85   - cX509Ext.defineMethod("initialize",extcb.getOptMethod("_initialize"));
86   - cX509Ext.defineMethod("oid=",extcb.getMethod("set_oid",IRubyObject.class));
87   - cX509Ext.defineMethod("value=",extcb.getMethod("set_value",IRubyObject.class));
88   - cX509Ext.defineMethod("critical=",extcb.getMethod("set_critical",IRubyObject.class));
89   - cX509Ext.defineMethod("oid",extcb.getMethod("oid"));
90   - cX509Ext.defineMethod("value",extcb.getMethod("value"));
91   - cX509Ext.defineMethod("critical?",extcb.getMethod("critical_p"));
92   - cX509Ext.defineMethod("to_der",extcb.getMethod("to_der"));
  86 + cX509Ext.defineFastMethod("initialize",extcb.getFastOptMethod("_initialize"));
  87 + cX509Ext.defineFastMethod("oid=",extcb.getFastMethod("set_oid",IRubyObject.class));
  88 + cX509Ext.defineFastMethod("value=",extcb.getFastMethod("set_value",IRubyObject.class));
  89 + cX509Ext.defineFastMethod("critical=",extcb.getFastMethod("set_critical",IRubyObject.class));
  90 + cX509Ext.defineFastMethod("oid",extcb.getFastMethod("oid"));
  91 + cX509Ext.defineFastMethod("value",extcb.getFastMethod("value"));
  92 + cX509Ext.defineFastMethod("critical?",extcb.getFastMethod("critical_p"));
  93 + cX509Ext.defineFastMethod("to_der",extcb.getFastMethod("to_der"));
93 94 }
94 95
95 96 public static class ExtensionFactory extends RubyObject {
@@ -97,7 +98,7 @@ public ExtensionFactory(IRuby runtime, RubyClass type) {
97 98 super(runtime,type);
98 99 }
99 100
100   - public IRubyObject initialize(IRubyObject[] args) {
  101 + public IRubyObject initialize(IRubyObject[] args, Block unusedBlock) {
101 102 checkArgumentCount(args,0,4);
102 103 if(args.length > 0 && !args[0].isNil()) {
103 104 set_issuer_cert(args[0]);
19 jruby/src/org/jruby/ext/openssl/X509Name.java
@@ -55,6 +55,7 @@
55 55 import org.jruby.RubyNumeric;
56 56 import org.jruby.RubyObject;
57 57 import org.jruby.exceptions.RaiseException;
  58 +import org.jruby.runtime.Block;
58 59 import org.jruby.runtime.CallbackFactory;
59 60 import org.jruby.runtime.ObjectAllocator;
60 61 import org.jruby.runtime.builtin.IRubyObject;
@@ -77,14 +78,14 @@ public static void createX509Name(IRuby runtime, RubyModule mX509) {
77 78 CallbackFactory namecb = runtime.callbackFactory(X509Name.class);
78 79
79 80 cX509Name.defineMethod("initialize",namecb.getOptMethod("initialize"));
80   - cX509Name.defineMethod("add_entry",namecb.getOptMethod("add_entry"));
81   - cX509Name.defineMethod("to_s",namecb.getOptMethod("_to_s"));
82   - cX509Name.defineMethod("to_a",namecb.getMethod("to_a"));
83   - cX509Name.defineMethod("cmp",namecb.getMethod("cmp",IRubyObject.class));
84   - cX509Name.defineMethod("<=>",namecb.getMethod("cmp",IRubyObject.class));
85   - cX509Name.defineMethod("eql?",namecb.getMethod("eql_p",IRubyObject.class));
86   - cX509Name.defineMethod("hash",namecb.getMethod("hash"));
87   - cX509Name.defineMethod("to_der",namecb.getMethod("to_der"));
  81 + cX509Name.defineFastMethod("add_entry",namecb.getFastOptMethod("add_entry"));
  82 + cX509Name.defineFastMethod("to_s",namecb.getFastOptMethod("_to_s"));
  83 + cX509Name.defineFastMethod("to_a",namecb.getFastMethod("to_a"));