@@ -88,7 +88,7 @@ int set_cert_times(X509 *x, const char *startdate, const char *enddate,
8888 if (X509_time_adj_ex (X509_getm_notAfter (x ), days , 0 , NULL )
8989 == NULL )
9090 return 0 ;
91- #if OPENSSL_API_COMPAT >= 10100
91+ #if OPENSSL_API_COMPAT >= 10101
9292 } else if (!ASN1_TIME_set_string_X509 (X509_getm_notAfter (x ), enddate )) {
9393#else
9494 } else if (!ASN1_TIME_set_string (X509_getm_notAfter (x ), enddate )) {
@@ -195,7 +195,7 @@ void croakSsl(char* p_file, int p_line)
195195 croak ("%s:%d: OpenSSL error: %s" , p_file , p_line , errorReason );
196196}
197197
198- SV * extractBioString (BIO * p_stringBio )
198+ SV * extractBioString (pTHX_ BIO * p_stringBio )
199199{
200200 SV * sv ;
201201 BUF_MEM * bptr ;
@@ -437,9 +437,8 @@ IV set_digest(self, SV* digest)
437437 HV * self ;
438438
439439 CODE :
440- IV ret = 0 ;
441- char * digestname = NULL ;
442- IV digestname_length ;
440+ const char * digestname = NULL ;
441+ STRLEN digestname_length ;
443442
444443 RETVAL = 0 ;
445444 // Get digestname parameter - verify that it is valid
@@ -449,16 +448,17 @@ IV set_digest(self, SV* digest)
449448 EVP_MD * md = NULL ;
450449#endif
451450 if (digest != NULL ) {
452- digestname = (char * ) SvPV (digest , digestname_length );
451+ digestname = (const char * ) SvPV (digest , digestname_length );
453452 //printf("Digest Name: %s\n", digestname);
454453 md = (EVP_MD * )EVP_get_digestbyname (digestname );
455454 }
456455
457- if (md != NULL )
456+ if (md != NULL ) {
458457 if ((hv_store (self , "digest" , 6 , newRV_inc (digest ), 0 )) == NULL )
459458 RETVAL = 0 ;
460459 else
461460 RETVAL = 1 ;
461+ }
462462
463463 OUTPUT :
464464
@@ -528,7 +528,6 @@ IV set_days(self, IV days)
528528 HV * self ;
529529
530530 CODE :
531- IV ret = 0 ;
532531
533532 if ((hv_store (self , "days" , 4 , newSViv (days ), 0 )) == NULL )
534533 RETVAL = 0 ;
@@ -557,7 +556,7 @@ SV * sign(self, request_SV, sigopts)
557556 STRLEN request_length ;
558557 unsigned char * request ;
559558 BIO * csrbio ;
560- char * digestname ;
559+ const char * digestname ;
561560 STRLEN digestname_length ;
562561 IV days ;
563562 SV * digest = NULL ;
@@ -578,6 +577,9 @@ SV * sign(self, request_SV, sigopts)
578577 if (SvIOKp (* svp )) {
579578 days = SvIV (* svp );
580579 }
580+ else {
581+ days = 365 ;
582+ }
581583
582584 if (hv_exists (self , "digest" , strlen ("digest" ))) {
583585 svp = hv_fetch (self , "digest" , strlen ("digest" ), 0 );
@@ -705,12 +707,11 @@ SV * sign(self, request_SV, sigopts)
705707 EVP_MD * md = NULL ;
706708#endif
707709 if (digest != NULL ) {
708- digestname = (unsigned char * ) SvPV (digest , digestname_length );
709- //printf("Digest Name: %s\n", digestname);
710+ digestname = (const char * ) SvPV (digest , digestname_length );
710711 md = (EVP_MD * )EVP_get_digestbyname (digestname );
711712 }
712713 if (md != NULL )
713- digestname = (char * ) digestname ;
714+ digestname = (const char * ) digestname ;
714715 else
715716 digestname = NULL ;
716717
@@ -743,7 +744,7 @@ SV * sign(self, request_SV, sigopts)
743744 if (!i )
744745 croak ("unable to output certificate data\n" );
745746
746- RETVAL = extractBioString (out );
747+ RETVAL = extractBioString (aTHX_ out );
747748
748749 OUTPUT :
749750
0 commit comments