@@ -55,7 +55,7 @@ static const rb_data_type_t ossl_x509ext_type = {
55
55
{
56
56
0 , ossl_x509ext_free ,
57
57
},
58
- 0 , 0 , RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED ,
58
+ 0 , 0 , RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_FROZEN_SHAREABLE ,
59
59
};
60
60
61
61
/*
@@ -108,7 +108,7 @@ static const rb_data_type_t ossl_x509extfactory_type = {
108
108
{
109
109
0 , ossl_x509extfactory_free ,
110
110
},
111
- 0 , 0 , RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED ,
111
+ 0 , 0 , RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_FROZEN_SHAREABLE ,
112
112
};
113
113
114
114
static VALUE
@@ -181,6 +181,7 @@ ossl_x509extfactory_initialize(int argc, VALUE *argv, VALUE self)
181
181
182
182
rb_scan_args (argc , argv , "04" ,
183
183
& issuer_cert , & subject_cert , & subject_req , & crl );
184
+ rb_check_frozen (self );
184
185
if (!NIL_P (issuer_cert ))
185
186
ossl_x509extfactory_set_issuer_cert (self , issuer_cert );
186
187
if (!NIL_P (subject_cert ))
@@ -281,6 +282,7 @@ ossl_x509ext_initialize(int argc, VALUE *argv, VALUE self)
281
282
const unsigned char * p ;
282
283
X509_EXTENSION * ext , * x ;
283
284
285
+ rb_check_frozen (self );
284
286
GetX509Ext (self , ext );
285
287
if (rb_scan_args (argc , argv , "12" , & oid , & value , & critical ) == 1 ){
286
288
oid = ossl_to_der_if_possible (oid );
@@ -318,12 +320,17 @@ ossl_x509ext_initialize_copy(VALUE self, VALUE other)
318
320
return self ;
319
321
}
320
322
323
+ /*
324
+ * call-seq:
325
+ * extension.oid = string => string
326
+ */
321
327
static VALUE
322
328
ossl_x509ext_set_oid (VALUE self , VALUE oid )
323
329
{
324
330
X509_EXTENSION * ext ;
325
331
ASN1_OBJECT * obj ;
326
332
333
+ rb_check_frozen (self );
327
334
GetX509Ext (self , ext );
328
335
obj = OBJ_txt2obj (StringValueCStr (oid ), 0 );
329
336
if (!obj )
@@ -337,12 +344,17 @@ ossl_x509ext_set_oid(VALUE self, VALUE oid)
337
344
return oid ;
338
345
}
339
346
347
+ /*
348
+ * call-seq:
349
+ * extension.value = string => string
350
+ */
340
351
static VALUE
341
352
ossl_x509ext_set_value (VALUE self , VALUE data )
342
353
{
343
354
X509_EXTENSION * ext ;
344
355
ASN1_OCTET_STRING * asn1s ;
345
356
357
+ rb_check_frozen (self );
346
358
GetX509Ext (self , ext );
347
359
data = ossl_to_der_if_possible (data );
348
360
StringValue (data );
@@ -356,17 +368,26 @@ ossl_x509ext_set_value(VALUE self, VALUE data)
356
368
return data ;
357
369
}
358
370
371
+ /*
372
+ * call-seq:
373
+ * extension.critical = bool => bool
374
+ */
359
375
static VALUE
360
376
ossl_x509ext_set_critical (VALUE self , VALUE flag )
361
377
{
362
378
X509_EXTENSION * ext ;
363
379
380
+ rb_check_frozen (self );
364
381
GetX509Ext (self , ext );
365
382
X509_EXTENSION_set_critical (ext , RTEST (flag ) ? 1 : 0 );
366
383
367
384
return flag ;
368
385
}
369
386
387
+ /*
388
+ * call-seq:
389
+ * extension.oid => string
390
+ */
370
391
static VALUE
371
392
ossl_x509ext_get_oid (VALUE obj )
372
393
{
@@ -390,6 +411,10 @@ ossl_x509ext_get_oid(VALUE obj)
390
411
return ret ;
391
412
}
392
413
414
+ /*
415
+ * call-seq:
416
+ * extension.value => string
417
+ */
393
418
static VALUE
394
419
ossl_x509ext_get_value (VALUE obj )
395
420
{
@@ -420,6 +445,10 @@ ossl_x509ext_get_value_der(VALUE obj)
420
445
return rb_str_new ((const char * )value -> data , value -> length );
421
446
}
422
447
448
+ /*
449
+ * call-seq:
450
+ * extension.critical = bool
451
+ */
423
452
static VALUE
424
453
ossl_x509ext_get_critical (VALUE obj )
425
454
{
@@ -429,6 +458,10 @@ ossl_x509ext_get_critical(VALUE obj)
429
458
return X509_EXTENSION_get_critical (ext ) ? Qtrue : Qfalse ;
430
459
}
431
460
461
+ /*
462
+ * call-seq:
463
+ * extension.to_der => string
464
+ */
432
465
static VALUE
433
466
ossl_x509ext_to_der (VALUE obj )
434
467
{
0 commit comments