Skip to content

Commit e6ce8ba

Browse files
committed
A few more openssl differences and compiler issues
initialize variables that could be used unitialized ERR_remove_state deprecated in 1.0.0
1 parent cfd7e85 commit e6ce8ba

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Arguments:
103103

104104
Get the number of days that is currently set.
105105

106-
Returns a number
106+
Returns the number of days or -1 for a failure.
107107

108108
# EXPORT
109109

SignCSR.xs

+13-13
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ int set_cert_times(X509 *x, const char *startdate, const char *enddate,
8585
#endif
8686
return 0;
8787
} else {
88-
#if OPENSSL_API_COMPAT <= 10101
88+
#if OPENSSL_API_COMPAT <= 11000
8989
if (!ASN1_TIME_set_string(X509_get_notBefore(x), startdate))
9090
#else
9191
if (!ASN1_TIME_set_string_X509(X509_getm_notBefore(x), startdate))
@@ -100,7 +100,7 @@ int set_cert_times(X509 *x, const char *startdate, const char *enddate,
100100
#endif
101101
== NULL)
102102
return 0;
103-
#if OPENSSL_API_COMPAT < 10101
103+
#if OPENSSL_API_COMPAT <= 11000
104104
} else if (!ASN1_TIME_set_string(X509_get_notAfter(x), enddate)) {
105105
#else
106106
} else if (!ASN1_TIME_set_string_X509(X509_getm_notAfter(x), enddate)) {
@@ -437,18 +437,15 @@ char * get_digest(self)
437437
CODE:
438438
SV **svp;
439439

440+
RETVAL = SvPV_nolen(newSVpv("",0));
441+
440442
// Get the output format - default is pem format
441443
if (hv_exists(self, "digest", strlen("digest"))) {
442444
svp = hv_fetch(self, "digest", strlen("digest"), 0);
443445
if (SvROK(*svp)) {
444446
RETVAL = SvPV_nolen(SvRV(*svp));
445447
}
446448
}
447-
else {
448-
//FIXME this should probably get the default for openssl
449-
//but since nothing was set this is likely most accurate
450-
RETVAL = SvPV_nolen(newSVpv("",0));
451-
}
452449

453450
OUTPUT:
454451

@@ -493,16 +490,15 @@ char * get_format(self)
493490
CODE:
494491
SV **svp;
495492

493+
RETVAL = SvPV_nolen(newSVpv("",0));
494+
496495
// Get the output format - default is pem format
497496
if (hv_exists(self, "format", strlen("format"))) {
498497
svp = hv_fetch(self, "format", strlen("format"), 0);
499498
if (SvROK(*svp)) {
500499
RETVAL = SvPV_nolen(SvRV(*svp));
501500
}
502501
}
503-
else {
504-
RETVAL = SvPV_nolen(newSVpv("",0));
505-
}
506502

507503
OUTPUT:
508504

@@ -512,7 +508,7 @@ IV set_format(self, SV* format)
512508
HV * self;
513509

514510
CODE:
515-
IV ret = 0;
511+
RETVAL = 0;
516512

517513
if (sv_cmp(format, newSVpv("pem", 0)) == 0 ||
518514
sv_cmp(format, newSVpv("text", 0)) == 0 )
@@ -522,7 +518,7 @@ IV set_format(self, SV* format)
522518
else
523519
RETVAL = 1;
524520
} else {
525-
RETVAL = ret;
521+
RETVAL = 0;
526522
}
527523

528524
OUTPUT:
@@ -535,6 +531,7 @@ IV get_days(self)
535531
CODE:
536532
SV **svp;
537533

534+
RETVAL = -1;
538535
// Get the number of days for specified - default 365
539536
if (hv_exists(self, "days", strlen("days"))) {
540537
svp = hv_fetch(self, "days", strlen("days"), 0);
@@ -551,6 +548,7 @@ IV set_days(self, IV days)
551548
HV * self;
552549

553550
CODE:
551+
RETVAL = 0;
554552

555553
if((hv_store(self, "days", 4, newSViv(days), 0)) == NULL)
556554
RETVAL = 0;
@@ -582,7 +580,7 @@ SV * sign(self, request_SV)
582580
STRLEN digestname_length;
583581
IV days;
584582
SV * digest = NULL;
585-
SV * format;
583+
SV * format = NULL;
586584

587585
if (!hv_exists(self, "privkey", strlen("privkey")))
588586
croak("privkey not found in self!\n");
@@ -802,7 +800,9 @@ void signcsr_DESTROY(void)
802800

803801
CRYPTO_cleanup_all_ex_data();
804802
ERR_free_strings();
803+
#if OPENSSL_API_COMPAT < 10000
805804
ERR_remove_state(0);
805+
#endif
806806
EVP_cleanup();
807807

808808
#endif

lib/Crypt/OpenSSL/SignCSR.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Arguments:
122122
123123
Get the number of days that is currently set.
124124
125-
Returns a number
125+
Returns the number of days or -1 for a failure.
126126
127127
=head1 EXPORT
128128

0 commit comments

Comments
 (0)