File tree Expand file tree Collapse file tree 1 file changed +5
-18
lines changed Expand file tree Collapse file tree 1 file changed +5
-18
lines changed Original file line number Diff line number Diff line change @@ -574,26 +574,13 @@ static VALUE
574
574
ossl_x509stctx_get_chain (VALUE self )
575
575
{
576
576
X509_STORE_CTX * ctx ;
577
- STACK_OF (X509 ) * chain ;
578
- X509 * x509 ;
579
- int i , num ;
580
- VALUE ary ;
577
+ const STACK_OF (X509 ) * chain ;
581
578
582
579
GetX509StCtx (self , ctx );
583
- if ((chain = X509_STORE_CTX_get0_chain (ctx )) == NULL ){
584
- return Qnil ;
585
- }
586
- if ((num = sk_X509_num (chain )) < 0 ){
587
- OSSL_Debug ("certs in chain < 0???" );
588
- return rb_ary_new ();
589
- }
590
- ary = rb_ary_new2 (num );
591
- for (i = 0 ; i < num ; i ++ ) {
592
- x509 = sk_X509_value (chain , i );
593
- rb_ary_push (ary , ossl_x509_new (x509 ));
594
- }
595
-
596
- return ary ;
580
+ chain = X509_STORE_CTX_get0_chain (ctx );
581
+ if (!chain )
582
+ return Qnil ; /* Could be an empty array instead? */
583
+ return ossl_x509_sk2ary (chain );
597
584
}
598
585
599
586
/*
You can’t perform that action at this time.
0 commit comments