Skip to content

Commit 7269ada

Browse files
authored
Merge pull request #6 from timlegge/openssl-fixes
Openssl fixes
2 parents c8be7a0 + 150a974 commit 7269ada

File tree

4 files changed

+38
-11
lines changed

4 files changed

+38
-11
lines changed

Makefile.PL

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ if ($Config{gccversion} =~ /llvm/i) {
4141
$cc_option_flags .= ' -Wno-compound-token-split-by-macro';
4242
}
4343

44-
if ($Config{perl_version} <= 20) {
44+
if ($Config{PERL_VERSION} <= 20) {
4545
$cc_option_flags .= ' -Wno-error=pointer-bool-conversion';
4646
}
4747
}
@@ -70,7 +70,7 @@ my %WriteMakefileArgs = (
7070
"File::Slurper" => "0.012",
7171
"File::Which" => 0
7272
},
73-
"VERSION" => "0.11",
73+
"VERSION" => "0.12",
7474
"test" => {
7575
"TESTS" => "t/*.t"
7676
}

SignCSR.xs

+34-7
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,16 @@ static int key_destroy(pTHX_ SV* var, MAGIC* magic) {
322322
static const MGVTBL key_magic = { NULL, NULL, NULL, NULL, key_destroy };
323323

324324

325-
MODULE = Crypt::OpenSSL::SignCSR PACKAGE = Crypt::OpenSSL::SignCSR
325+
MODULE = Crypt::OpenSSL::SignCSR PACKAGE = Crypt::OpenSSL::SignCSR PREFIX = signcsr_
326+
327+
BOOT:
328+
ERR_load_crypto_strings();
329+
#if OPENSSL_API_COMPAT <= 10100
330+
ERR_load_ERR_strings();
331+
OpenSSL_add_all_algorithms();
332+
OpenSSL_add_all_ciphers();
333+
OpenSSL_add_all_digests();
334+
#endif
326335

327336
PROTOTYPES: DISABLE
328337

@@ -471,8 +480,8 @@ IV set_digest(self, SV* digest)
471480
else
472481
RETVAL = 1;
473482
} else {
474-
//printf("Can't change digets to %s\n", digestname);
475-
}
483+
//printf("Can't change digets to %s\n", digestname);
484+
}
476485

477486
OUTPUT:
478487

@@ -641,7 +650,7 @@ SV * sign(self, request_SV)
641650
int ret = do_X509_REQ_verify(csr, pkey, NULL);
642651
if (ret == 0)
643652
croak ("Verification of CSR failed\n");
644-
if ( ret < 0)
653+
if ( ret < 0)
645654
croak ("Warning: error while verifying CSR self-signature\n");
646655
}
647656
else
@@ -738,9 +747,9 @@ SV * sign(self, request_SV)
738747
if (md != NULL)
739748
digestname = (const char *) digestname;
740749
else {
741-
digestname = NULL;
742-
printf("Failed to set the digest md = Null\n");
743-
}
750+
digestname = NULL;
751+
printf("Failed to set the digest md = Null\n");
752+
}
744753
//printf ("DIGEST NAME = %s\n", digestname);
745754
// Allocate and a new digest context for certificate signing
746755
#if OPENSSL_API_COMPAT <= 10100
@@ -780,3 +789,21 @@ SV * sign(self, request_SV)
780789

781790
RETVAL
782791

792+
#if OPENSSL_API_COMPAT > 10200
793+
void signcsr_DESTROY(void)
794+
795+
CODE:
796+
/* deinitialisation is done automatically */
797+
798+
#else
799+
void signcsr_DESTROY(void)
800+
801+
CODE:
802+
803+
CRYPTO_cleanup_all_ex_data();
804+
ERR_free_strings();
805+
ERR_remove_state(0);
806+
EVP_cleanup();
807+
808+
#endif
809+

lib/Crypt/OpenSSL/SignCSR.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use warnings;
77

88
require Exporter;
99

10-
our $VERSION = "0.11";
10+
our $VERSION = "0.12";
1111

1212
our @ISA = qw(Exporter);
1313

maint/Makefile_header.PL

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if ($Config{gccversion} =~ /llvm/i) {
3131
$cc_option_flags .= ' -Wno-compound-token-split-by-macro';
3232
}
3333

34-
if ($Config{perl_version} <= 20) {
34+
if ($Config{PERL_VERSION} <= 20) {
3535
$cc_option_flags .= ' -Wno-error=pointer-bool-conversion';
3636
}
3737
}

0 commit comments

Comments
 (0)