line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!perl -w |
2
|
|
|
|
|
|
|
# -*- coding: utf-8; -*- |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
304
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Crypt::OpenSSL::CA::Inline::C; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Crypt::OpenSSL::CA::Inline::C - A bag of XS and L tricks |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=for My::Tests::Below "synopsis" begin |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
package Crypt::OpenSSL::CA::Foo; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use Crypt::OpenSSL::CA::Inline::C <<"C_CODE_SAMPLE"; |
20
|
|
|
|
|
|
|
#include |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
static |
23
|
|
|
|
|
|
|
SV* mysub() { |
24
|
|
|
|
|
|
|
// Your C code here |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
C_CODE_SAMPLE |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Then maybe some Perl... |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use Crypt::OpenSSL::CA::Inline::C <<"MORE_C_CODE"; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
static |
34
|
|
|
|
|
|
|
void another() { |
35
|
|
|
|
|
|
|
// ... |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
MORE_C_CODE |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
use Crypt::OpenSSL::CA::Inline::C "__END__"; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=for My::Tests::Below "synopsis" end |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 DESCRIPTION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
B
|
47
|
|
|
|
|
|
|
I. It is of no interest for people who just want |
48
|
|
|
|
|
|
|
to use the module.> |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This package provides L goodness to L |
51
|
|
|
|
|
|
|
during development, plus a few tricks of our own. The idiom in |
52
|
|
|
|
|
|
|
L, used throughout the source code of |
53
|
|
|
|
|
|
|
L, recaps them all; noteworthy points are: |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=over |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=item the C-newline trick |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Because the C language doesn't have namespaces, we don't want symbols |
60
|
|
|
|
|
|
|
named e.g. C appearing in the .so's symbol tables: they could |
61
|
|
|
|
|
|
|
clash with other symbols defined by Perl, or with each other. |
62
|
|
|
|
|
|
|
Therefore we have to declare them C, but doing this in the |
63
|
|
|
|
|
|
|
naïve way would cause L to purposefully B bind them |
64
|
|
|
|
|
|
|
with Perl... The winning trick is to put the C word alone on |
65
|
|
|
|
|
|
|
its line, as demonstrated. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item the "__END__" pragma |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
The code in L must use the following pragma to |
70
|
|
|
|
|
|
|
signal that it won't attempt to add any L code after this |
71
|
|
|
|
|
|
|
point: |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
use Crypt::OpenSSL::CA::Inline::C "__END__"; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=back |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 Standard Library |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
In addition to the standard library available to XS C code described |
80
|
|
|
|
|
|
|
in L, L, L and L, C code that |
81
|
|
|
|
|
|
|
compiles itself through I has access to |
82
|
|
|
|
|
|
|
the following C functions: |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head3 char0_value |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
static inline char* char0_value(SV* string); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Returns the string value of a Perl SV, making sure that it exists and is |
89
|
|
|
|
|
|
|
zero-terminated beforehand. If C is undef, returns the empty string |
90
|
|
|
|
|
|
|
(B NULL; see L). If C is tainted, that makes |
91
|
|
|
|
|
|
|
no difference; return it, or the empty string, just the same. See |
92
|
|
|
|
|
|
|
L, look for the word "Nevertheless" - I assume |
93
|
|
|
|
|
|
|
there is a macro in Perl's convenience stuff that does exactly that already, but |
94
|
|
|
|
|
|
|
I don't know it... |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head3 char0_value_or_null |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
static inline char* char0_value_or_null(SV* string); |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Like L, except that NULL is returned if C is |
101
|
|
|
|
|
|
|
undef. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head3 perl_wrap |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
static inline SV* perl_wrap(class, pointer); |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Creates read-only SV containing the integral value of C, |
108
|
|
|
|
|
|
|
blesses it into class C and returns it as a SV*. The return |
109
|
|
|
|
|
|
|
value is an adequate Perl wrapper to stand for C, as |
110
|
|
|
|
|
|
|
demonstrated in L. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head3 perl_unwrap (class, typename, SV*) |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
The reverse of L. Given a Lped SV*, asserts |
115
|
|
|
|
|
|
|
that it actually contains an object blessed in class C (lest it |
116
|
|
|
|
|
|
|
Cs), extracts the pointer within same, casts it into |
117
|
|
|
|
|
|
|
C and returns it. This is a macro instead of a static |
118
|
|
|
|
|
|
|
inline, so as to be able to perform the polymorphic cast. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head3 openssl_string_to_SV |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
static inline SV* openssl_string_to_SV(char* string); |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Copies over C to a newly-allocated C Perl scalar, and |
125
|
|
|
|
|
|
|
then frees C using C. Used to transfer |
126
|
|
|
|
|
|
|
ownership of strings from OpenSSL to Perl, and thereby ensure proper |
127
|
|
|
|
|
|
|
memory management. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Note to I hackers: if C is on an OpenSSL |
130
|
|
|
|
|
|
|
static buffer instead of having been allocated by OpenSSL, this will |
131
|
|
|
|
|
|
|
SEGV in trying to free() C that was not malloc()'d; in this |
132
|
|
|
|
|
|
|
case you want to use L instead or some such. |
133
|
|
|
|
|
|
|
Check the OpenSSL documentation carefully, and make use of |
134
|
|
|
|
|
|
|
L to ascertain experimentally |
135
|
|
|
|
|
|
|
that your code doesn't leak memory. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head3 openssl_buf_to_SV |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
static inline SV* openssl_buf_to_SV(char* string, int length); |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Like L except that the length is specified, |
142
|
|
|
|
|
|
|
which allows for C to not contain null characters or not be |
143
|
|
|
|
|
|
|
zero-terminated. Use this form e.g. for ASN.1 buffers returned by |
144
|
|
|
|
|
|
|
C OpenSSL functions. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head3 BIO_mem_to_SV |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
static inline SV* BIO_mem_to_SV(BIO *bio); |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
This inline function is intended to be used to return scalar values |
151
|
|
|
|
|
|
|
(e.g. PEM strings and RSA moduli) constructed by OpenSSL. Should be |
152
|
|
|
|
|
|
|
invoked thusly, after having freed all temporary resources except |
153
|
|
|
|
|
|
|
*bio: |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
return BIO_mem_to_SV(bio); |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
I turns bio into a Perl scalar and returns it, or |
158
|
|
|
|
|
|
|
Cs trying (hence the requirement not to have any outstanding |
159
|
|
|
|
|
|
|
memory resources allocated in the caller). Regardless of the outcome, |
160
|
|
|
|
|
|
|
C will be C()d. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 sslcroak |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
static void sslcroak(char *format, ...); |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Like L, except that a blessed exception of class |
167
|
|
|
|
|
|
|
I is generated. The OpenSSL error |
168
|
|
|
|
|
|
|
stack, if any, gets recorded as an array reference inside the |
169
|
|
|
|
|
|
|
exception structure. |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Note to I hackers: please select the appropriate |
172
|
|
|
|
|
|
|
routine between I and I, depending on whether the |
173
|
|
|
|
|
|
|
current error condition is being caused by OpenSSL or not; in this way |
174
|
|
|
|
|
|
|
callers are able to discriminate errors. Also, don't be fooled into |
175
|
|
|
|
|
|
|
thinking that C-style error management acts in the same way in |
176
|
|
|
|
|
|
|
C and Perl! Because calling C (or, for that matter, |
177
|
|
|
|
|
|
|
L) will return control directly to Perl without running |
178
|
|
|
|
|
|
|
any C code, any and all temporary variables that have been allocated |
179
|
|
|
|
|
|
|
from C will fail to be de-allocated, thereby causing a memory leak. |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Internally, I works by invoking |
182
|
|
|
|
|
|
|
L several times, using a rough |
183
|
|
|
|
|
|
|
equivalent of the following pseudo-code: |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
_sslcroak_callback("-message", $formattedstring); |
186
|
|
|
|
|
|
|
_sslcroak_callback("-openssl", $openssl_errorstring_1); |
187
|
|
|
|
|
|
|
_sslcroak_callback("-openssl", $openssl_errorstring_2); |
188
|
|
|
|
|
|
|
... |
189
|
|
|
|
|
|
|
_sslcroak_callback("DONE"); |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
where $formattedstring is the C-formatted version of the |
192
|
|
|
|
|
|
|
arguments passed to I, and the OpenSSL error strings are |
193
|
|
|
|
|
|
|
retrieved using B and B. |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=head3 parse_RFC3280_time |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
static ASN1_TIME* parse_RFC3280_time(char* datetime, |
198
|
|
|
|
|
|
|
char** errmsg, char* sslerrmsg); |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Parses C, a date in "Zulu" format (that is, yyyymmddhhmmssZ, |
201
|
|
|
|
|
|
|
with a literal Z at the end), and returns a newly-allocated ASN1_TIME* |
202
|
|
|
|
|
|
|
structure utilizing a C encoding for dates in the year 2049 |
203
|
|
|
|
|
|
|
or before and C for dates in 2050 and after. RFC3280 |
204
|
|
|
|
|
|
|
dictates that this convention should apply to most date-related fields |
205
|
|
|
|
|
|
|
in X509 certificates and CRLs (as per sections 4.1.2.5 for certificate |
206
|
|
|
|
|
|
|
validity periods, and 5.1.2.4 through 5.1.2.6 for CRL validity periods |
207
|
|
|
|
|
|
|
and certificate revocation times). By contrast, the C |
208
|
|
|
|
|
|
|
CRL revocation reason extension is always in C and |
209
|
|
|
|
|
|
|
this function should not be used there. |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
If there is an error, NULL is returned, and one (and only |
212
|
|
|
|
|
|
|
one) of *errmsg and *sslerrmsg is set to an error string, provided |
213
|
|
|
|
|
|
|
that they are not NULL. Caller should thereafter call I or |
214
|
|
|
|
|
|
|
L respectively. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=head3 parse_RFC3280_time_or_croak |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
static ASN1_TIME* parse_RFC3280_time_or_croak(char* datetime); |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Like L except that it handles its errors itself and |
221
|
|
|
|
|
|
|
will therefore never return NULL. The caller should not have an |
222
|
|
|
|
|
|
|
outstanding temporary variable that must be freed before it returns, |
223
|
|
|
|
|
|
|
or a memory leak will be created; if this is the case, use the more |
224
|
|
|
|
|
|
|
clunky L form instead. |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=head3 parse_serial |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
static ASN1_INTEGER* parse_serial |
229
|
|
|
|
|
|
|
(char* hexserial, char** errmsg, char** sslerrmsg); |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
Parses hexserial, a lowercase, hexadecimal string that starts with |
232
|
|
|
|
|
|
|
"0x", and returns it as a newly-allocated C structure |
233
|
|
|
|
|
|
|
that must be freed by caller (with C) when done |
234
|
|
|
|
|
|
|
with it. If there is an error, NULL is returned, and one (and only |
235
|
|
|
|
|
|
|
one) of *errmsg and *sslerrmsg is set to an error string, provided |
236
|
|
|
|
|
|
|
that they are not NULL. Caller should thereafter call I or |
237
|
|
|
|
|
|
|
L respectively. |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=head3 parse_serial_or_croak |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
static ASN1_INTEGER* parse_serial_or_croak(char* hexserial); |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
Like L except that it handles its errors itself and |
244
|
|
|
|
|
|
|
will therefore never return NULL. The caller should not have an |
245
|
|
|
|
|
|
|
outstanding temporary variable that must be freed before it returns, |
246
|
|
|
|
|
|
|
or a memory leak will be created; if this is the case, use the more |
247
|
|
|
|
|
|
|
clunky L form instead. |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=cut |
250
|
|
|
|
|
|
|
|
251
|
0
|
|
|
0
|
|
|
sub _c_boilerplate { <<'C_BOILERPLATE'; } |
252
|
|
|
|
|
|
|
#include /* For varargs stuff in sslcroak() */ |
253
|
|
|
|
|
|
|
#include /* For OPENSSL_free() in openssl_buf_to_SV */ |
254
|
|
|
|
|
|
|
#include /* For ERR_stuff in sslcroak() */ |
255
|
|
|
|
|
|
|
#include /* For BUF_MEM->data dereference in |
256
|
|
|
|
|
|
|
BIO_mem_to_SV(). WTF is this declaration |
257
|
|
|
|
|
|
|
doing in there?! */ |
258
|
|
|
|
|
|
|
#include /* Also for BIO_mem_to_SV() */ |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
#include |
261
|
|
|
|
|
|
|
#if OPENSSL_VERSION_NUMBER < 0x00907000 |
262
|
|
|
|
|
|
|
#error OpenSSL version 0.9.7 or later is required. See comments in CA.pm |
263
|
|
|
|
|
|
|
#endif |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
static inline char* char0_value_or_null(SV* perlscalar) { |
266
|
|
|
|
|
|
|
if (! SvOK(perlscalar)) { return NULL; } |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
STRLEN length; |
269
|
|
|
|
|
|
|
SvPV(perlscalar, length); |
270
|
|
|
|
|
|
|
SvGROW(perlscalar, length + 1); |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
char* retval = SvPV_nolen(perlscalar); |
273
|
|
|
|
|
|
|
retval[length] = '\0'; |
274
|
|
|
|
|
|
|
return retval; |
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
static inline char* char0_value(SV* perlscalar) { |
278
|
|
|
|
|
|
|
char* retval = char0_value_or_null(perlscalar); |
279
|
|
|
|
|
|
|
return ( retval ? retval : "" ); |
280
|
|
|
|
|
|
|
} |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
static inline SV* perl_wrap(const char* class, void* pointer) { |
283
|
|
|
|
|
|
|
SV* obj = sv_setref_pv(newSV(0), class, pointer); |
284
|
|
|
|
|
|
|
if (! obj) { croak("not enough memory"); } |
285
|
|
|
|
|
|
|
SvREADONLY_on(SvRV(obj)); |
286
|
|
|
|
|
|
|
return obj; |
287
|
|
|
|
|
|
|
} |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
#define perl_unwrap(class, typename, obj) \ |
290
|
|
|
|
|
|
|
((typename) __perl_unwrap(__FILE__, __LINE__, (class), (obj))) |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
static inline void* __perl_unwrap(const char* file, int line, |
293
|
|
|
|
|
|
|
const char* class, SV* obj) { |
294
|
|
|
|
|
|
|
if (!(sv_isobject(obj) && sv_isa(obj, class))) { |
295
|
|
|
|
|
|
|
croak("%s:%d:perl_unwrap: got an invalid " |
296
|
|
|
|
|
|
|
"Perl argument (expected an object blessed " |
297
|
|
|
|
|
|
|
"in class ``%s'')", file, line, (class)); |
298
|
|
|
|
|
|
|
} |
299
|
|
|
|
|
|
|
return (void *)(intptr_t)SvIV(SvRV(obj)); |
300
|
|
|
|
|
|
|
} |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
static inline SV* openssl_buf_to_SV(char* string, int length) { |
303
|
|
|
|
|
|
|
/* Note that a newmortal is not wanted here, even though |
304
|
|
|
|
|
|
|
* caller will typically return the SV* to Perl. This is because XS |
305
|
|
|
|
|
|
|
* performs some magic of its own for functions that return an SV (as |
306
|
|
|
|
|
|
|
* documented in L) |
307
|
|
|
|
|
|
|
* and Inline::C leverages that. */ |
308
|
|
|
|
|
|
|
SV* retval = newSVpv(string, length); |
309
|
|
|
|
|
|
|
OPENSSL_free(string); |
310
|
|
|
|
|
|
|
return retval; |
311
|
|
|
|
|
|
|
} |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
static inline SV* openssl_string_to_SV(char* string) { |
314
|
|
|
|
|
|
|
return openssl_buf_to_SV(string, 0); |
315
|
|
|
|
|
|
|
} |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
static inline SV* BIO_mem_to_SV(BIO *mem) { |
318
|
|
|
|
|
|
|
SV* retval; |
319
|
|
|
|
|
|
|
BUF_MEM* buf; |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
BIO_get_mem_ptr(mem, &buf); |
322
|
|
|
|
|
|
|
if (! buf) { |
323
|
|
|
|
|
|
|
BIO_free(mem); |
324
|
|
|
|
|
|
|
croak("BIO_get_mem_ptr failed"); |
325
|
|
|
|
|
|
|
} |
326
|
|
|
|
|
|
|
retval = newSVpv(buf->data, 0); |
327
|
|
|
|
|
|
|
if (! retval) { |
328
|
|
|
|
|
|
|
BIO_free(mem); |
329
|
|
|
|
|
|
|
croak("newSVpv failed"); |
330
|
|
|
|
|
|
|
} |
331
|
|
|
|
|
|
|
BIO_free(mem); |
332
|
|
|
|
|
|
|
return retval; |
333
|
|
|
|
|
|
|
} |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
#define ERRBUFSZ 512 |
336
|
|
|
|
|
|
|
#define THISPACKAGE "Crypt::OpenSSL::CA" |
337
|
|
|
|
|
|
|
static void sslcroak(char *fmt, ...) { |
338
|
|
|
|
|
|
|
va_list ap; /* The argument list hiding behind the |
339
|
|
|
|
|
|
|
hyphens in the protype above */ |
340
|
|
|
|
|
|
|
dSP; /* Required to be able to perform Perl |
341
|
|
|
|
|
|
|
callbacks */ |
342
|
|
|
|
|
|
|
char* argv[3]; /* The list of arguments to pass to the |
343
|
|
|
|
|
|
|
callback */ |
344
|
|
|
|
|
|
|
char croakbuf[ERRBUFSZ]; /* The buffer to typeset the main error |
345
|
|
|
|
|
|
|
message into */ |
346
|
|
|
|
|
|
|
char errbuf[ERRBUFSZ]; /* The buffer to typeset the auxillary error |
347
|
|
|
|
|
|
|
messages from OpenSSL into */ |
348
|
|
|
|
|
|
|
SV* dollar_at; /* Used to probe $@ to see if everything |
349
|
|
|
|
|
|
|
went well with the callback */ |
350
|
|
|
|
|
|
|
unsigned long sslerr; /* Will iterate through the OpenSSL |
351
|
|
|
|
|
|
|
error stack */ |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
va_start(ap, fmt); |
354
|
|
|
|
|
|
|
vsnprintf(croakbuf, ERRBUFSZ, fmt, ap); |
355
|
|
|
|
|
|
|
croakbuf[ERRBUFSZ - 1] = '\0'; |
356
|
|
|
|
|
|
|
va_end(ap); |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
argv[0] = "-message"; |
359
|
|
|
|
|
|
|
argv[1] = croakbuf; |
360
|
|
|
|
|
|
|
argv[2] = NULL; |
361
|
|
|
|
|
|
|
call_argv(THISPACKAGE "::_sslcroak_callback", G_DISCARD, argv); |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
argv[0] = "-openssl"; |
364
|
|
|
|
|
|
|
argv[1] = errbuf; |
365
|
|
|
|
|
|
|
while( (sslerr = ERR_get_error()) ) { |
366
|
|
|
|
|
|
|
ERR_error_string_n(sslerr, errbuf, ERRBUFSZ); |
367
|
|
|
|
|
|
|
errbuf[ERRBUFSZ - 1] = '\0'; |
368
|
|
|
|
|
|
|
call_argv(THISPACKAGE "::_sslcroak_callback", G_DISCARD, argv); |
369
|
|
|
|
|
|
|
} |
370
|
|
|
|
|
|
|
argv[0] = "DONE"; |
371
|
|
|
|
|
|
|
argv[1] = NULL; |
372
|
|
|
|
|
|
|
call_argv(THISPACKAGE "::_sslcroak_callback", G_DISCARD, argv); |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
dollar_at = get_sv("@", FALSE); |
375
|
|
|
|
|
|
|
if (dollar_at && sv_isobject(dollar_at)) { |
376
|
|
|
|
|
|
|
// Success! |
377
|
|
|
|
|
|
|
croak(Nullch); |
378
|
|
|
|
|
|
|
} else { |
379
|
|
|
|
|
|
|
// Something went bang, revert to the croakbuf. |
380
|
|
|
|
|
|
|
croak("%s", croakbuf); |
381
|
|
|
|
|
|
|
} |
382
|
|
|
|
|
|
|
} |
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
/* RFC3280, section 4.1.2.5 */ |
385
|
|
|
|
|
|
|
#define RFC3280_cutoff_date "20500000" "000000" |
386
|
|
|
|
|
|
|
static ASN1_TIME* parse_RFC3280_time(char* date, |
387
|
|
|
|
|
|
|
char** errmsg, char** sslerrmsg) { |
388
|
|
|
|
|
|
|
int status; |
389
|
|
|
|
|
|
|
int is_generalizedtime; |
390
|
|
|
|
|
|
|
ASN1_TIME* retval; |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
if (strlen(date) != strlen(RFC3280_cutoff_date) + 1) { |
393
|
|
|
|
|
|
|
if (errmsg) { *errmsg = "Wrong date length"; } |
394
|
|
|
|
|
|
|
return NULL; |
395
|
|
|
|
|
|
|
} |
396
|
|
|
|
|
|
|
if (date[strlen(RFC3280_cutoff_date)] != 'Z') { |
397
|
|
|
|
|
|
|
if (errmsg) { *errmsg = "Wrong date format"; } |
398
|
|
|
|
|
|
|
return NULL; |
399
|
|
|
|
|
|
|
} |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
if (! (retval = ASN1_TIME_new())) { |
402
|
|
|
|
|
|
|
if (errmsg) { *errmsg = "ASN1_TIME_new failed"; } |
403
|
|
|
|
|
|
|
return NULL; |
404
|
|
|
|
|
|
|
} |
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
is_generalizedtime = (strcmp(date, RFC3280_cutoff_date) > 0); |
407
|
|
|
|
|
|
|
if (! (is_generalizedtime ? |
408
|
|
|
|
|
|
|
ASN1_GENERALIZEDTIME_set_string(retval, date) : |
409
|
|
|
|
|
|
|
ASN1_UTCTIME_set_string(retval, date + 2)) ) { |
410
|
|
|
|
|
|
|
ASN1_TIME_free(retval); |
411
|
|
|
|
|
|
|
if (errmsg) { |
412
|
|
|
|
|
|
|
*errmsg = (is_generalizedtime ? |
413
|
|
|
|
|
|
|
"ASN1_GENERALIZEDTIME_set_string failed (bad date format?)" : |
414
|
|
|
|
|
|
|
"ASN1_UTCTIME_set_string failed (bad date format?)"); |
415
|
|
|
|
|
|
|
} |
416
|
|
|
|
|
|
|
return NULL; |
417
|
|
|
|
|
|
|
} |
418
|
|
|
|
|
|
|
return retval; |
419
|
|
|
|
|
|
|
} |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
static ASN1_TIME* parse_RFC3280_time_or_croak(char* date) { |
422
|
|
|
|
|
|
|
char* plainerr = NULL; char* sslerr = NULL; |
423
|
|
|
|
|
|
|
ASN1_INTEGER* retval = NULL; |
424
|
|
|
|
|
|
|
if ((retval = parse_RFC3280_time(date, &plainerr, &sslerr))) { |
425
|
|
|
|
|
|
|
return retval; |
426
|
|
|
|
|
|
|
} |
427
|
|
|
|
|
|
|
if (plainerr) { croak("%s", plainerr); } |
428
|
|
|
|
|
|
|
if (sslerr) { sslcroak("%s", sslerr); } |
429
|
|
|
|
|
|
|
croak("Unknown error in parse_RFC3280_time"); |
430
|
|
|
|
|
|
|
return NULL; /* Not reached */ |
431
|
|
|
|
|
|
|
} |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
static ASN1_INTEGER* parse_serial(char* hexserial, |
434
|
|
|
|
|
|
|
char** errmsg, char** sslerrmsg) { |
435
|
|
|
|
|
|
|
BIGNUM* serial = NULL; |
436
|
|
|
|
|
|
|
ASN1_INTEGER* retval; |
437
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
if (! (hexserial[0] == '0' && hexserial[1] == 'x')) { |
439
|
|
|
|
|
|
|
if (errmsg) { |
440
|
|
|
|
|
|
|
*errmsg = "Bad serial string, should start with 0x"; |
441
|
|
|
|
|
|
|
} |
442
|
|
|
|
|
|
|
return NULL; |
443
|
|
|
|
|
|
|
} |
444
|
|
|
|
|
|
|
if (! BN_hex2bn(&serial, hexserial + 2)) { |
445
|
|
|
|
|
|
|
if (sslerrmsg) { *sslerrmsg = "BN_hex2bn failed"; } |
446
|
|
|
|
|
|
|
return NULL; |
447
|
|
|
|
|
|
|
} |
448
|
|
|
|
|
|
|
retval = BN_to_ASN1_INTEGER(serial, NULL); |
449
|
|
|
|
|
|
|
BN_free(serial); |
450
|
|
|
|
|
|
|
if (! retval) { |
451
|
|
|
|
|
|
|
if (sslerrmsg) { *sslerrmsg = "BN_to_ASN1_INTEGER failed"; } |
452
|
|
|
|
|
|
|
return NULL; |
453
|
|
|
|
|
|
|
} |
454
|
|
|
|
|
|
|
return retval; |
455
|
|
|
|
|
|
|
} |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
static ASN1_INTEGER* parse_serial_or_croak(char* hexserial) { |
458
|
|
|
|
|
|
|
char* plainerr = NULL; char* sslerr = NULL; |
459
|
|
|
|
|
|
|
ASN1_INTEGER* retval = NULL; |
460
|
|
|
|
|
|
|
if ((retval = parse_serial(hexserial, &plainerr, &sslerr))) { |
461
|
|
|
|
|
|
|
return retval; |
462
|
|
|
|
|
|
|
} |
463
|
|
|
|
|
|
|
if (plainerr) { croak("%s", plainerr); } |
464
|
|
|
|
|
|
|
if (sslerr) { sslcroak("%s", sslerr); } |
465
|
|
|
|
|
|
|
croak("Unknown error in parse_serial"); |
466
|
|
|
|
|
|
|
return NULL; /* Not reached */ |
467
|
|
|
|
|
|
|
} |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
C_BOILERPLATE |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
=head2 BOOT-time effect |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
Each C<.so> XS module will be fitted with a C section (see |
474
|
|
|
|
|
|
|
L which automatically gets executed upon loading it |
475
|
|
|
|
|
|
|
with L or L. The C section is the same for |
476
|
|
|
|
|
|
|
all subpackages in L; it ensures that various |
477
|
|
|
|
|
|
|
stuff is loaded inside OpenSSL, such as C, |
478
|
|
|
|
|
|
|
C and all that jazz. After the boot |
479
|
|
|
|
|
|
|
code completes, C<$Crypt::OpenSSL::CA::openssl_stuff_loaded> will be |
480
|
|
|
|
|
|
|
1, so that the following XS modules can skip that when they in turn |
481
|
|
|
|
|
|
|
get loaded. |
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
=cut |
484
|
|
|
|
|
|
|
|
485
|
0
|
|
|
0
|
|
|
sub _c_boot_section { <<"ENSURE_OPENSSL_STUFF_LOADED" } |
486
|
|
|
|
|
|
|
SV* already_loaded = get_sv |
487
|
|
|
|
|
|
|
("Crypt::OpenSSL::CA::openssl_stuff_loaded", 1); |
488
|
|
|
|
|
|
|
if (SvOK(already_loaded)) { return; } |
489
|
|
|
|
|
|
|
sv_setiv(already_loaded, 1); |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
ERR_load_crypto_strings(); |
492
|
|
|
|
|
|
|
OpenSSL_add_all_algorithms(); |
493
|
|
|
|
|
|
|
ENSURE_OPENSSL_STUFF_LOADED |
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
=head1 INTERNALS |
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
The C<< use Crypt::OpenSSL::CA::Inline::C >> idiom described in |
498
|
|
|
|
|
|
|
L is implemented in terms of L. |
499
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
=head3 %c_code |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
A lexical variable that L uses to accumulate all the C code |
503
|
|
|
|
|
|
|
submitted by L. Keys are package names, and |
504
|
|
|
|
|
|
|
values are snippets of C. |
505
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
=cut |
507
|
|
|
|
|
|
|
|
508
|
1
|
|
|
|
|
21
|
my %c_code; |
509
|
|
|
|
|
|
|
|
510
|
1
|
|
|
1
|
|
1827
|
use Inline::C (); |
|
1
|
|
|
|
|
75359
|
|
|
1
|
|
|
|
|
2295
|
|
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
=head3 import () |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
Called whenever one of the C<< use Crypt::OpenSSL::CA::Inline::C "foo" |
515
|
|
|
|
|
|
|
>> pragmas (listed in L) is seen by Perl; performs the |
516
|
|
|
|
|
|
|
actual magic of the module. Stashes everything into L%c_code>, and |
517
|
|
|
|
|
|
|
invokes L at the end. |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
=cut |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
sub import { |
522
|
0
|
|
|
0
|
|
|
my ($class, $c_code) = @_; |
523
|
|
|
|
|
|
|
|
524
|
0
|
0
|
|
|
|
|
return if ! defined $c_code; # A simple "use" |
525
|
|
|
|
|
|
|
|
526
|
0
|
0
|
|
|
|
|
return $class->compile_everything if ($c_code eq "__END__"); |
527
|
|
|
|
|
|
|
|
528
|
0
|
|
|
|
|
|
my ($package, $file, $line) = caller; |
529
|
0
|
|
|
|
|
|
$c_code{$package} .= sprintf(qq'#line %d "%s"\n', $line + 1, $file) |
530
|
|
|
|
|
|
|
. $c_code; |
531
|
0
|
|
|
|
|
|
return; |
532
|
|
|
|
|
|
|
} |
533
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
=head3 compile_everything () |
535
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
Called when L is seen. Invokes |
537
|
|
|
|
|
|
|
L once for every package (that is, every key in |
538
|
|
|
|
|
|
|
L%c_code>), prepending L<_c_boilerplate> each time. |
539
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
=cut |
541
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
sub compile_everything { |
543
|
0
|
|
|
0
|
0
|
|
my ($class) = @_; |
544
|
0
|
|
|
|
|
|
foreach my $package (keys %c_code) { |
545
|
0
|
|
|
|
|
|
$class->compile_into($package, _c_boilerplate . $c_code{$package}, |
546
|
|
|
|
|
|
|
-boot_section => _c_boot_section()); |
547
|
|
|
|
|
|
|
} |
548
|
|
|
|
|
|
|
} |
549
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
=head3 compile_into ($package, $c_code, %named_options) |
551
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
Compile $c_code and make its functions available as part of $package's |
553
|
|
|
|
|
|
|
namespace, courtesy to L magic. Works by invoking |
554
|
|
|
|
|
|
|
L in a tweaked fashion, so as to compile with all |
555
|
|
|
|
|
|
|
warnings turned into errors (i.e. C<-Wall -Werror>) and to link with |
556
|
|
|
|
|
|
|
the OpenSSL libraries. The environment variables are taken into |
557
|
|
|
|
|
|
|
account (see L). |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
Available named options are: |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
=over |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
=item B<< -boot_section => $c_code >> |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
Adds $c_code to the BOOT section of the generated .so module. |
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
=back |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
=cut |
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
sub compile_into { |
572
|
0
|
|
|
0
|
0
|
|
my ($class, $package, $c_code, %opts) = @_; |
573
|
0
|
0
|
|
|
|
|
my $compile_params = ($class->full_debugging ? |
574
|
|
|
|
|
|
|
<<'COMPILE_PARAMS_DEBUG' : |
575
|
|
|
|
|
|
|
CCFLAGS => "-Wall -Wno-unused -Werror -save-temps", |
576
|
|
|
|
|
|
|
OPTIMIZE => "-g", |
577
|
|
|
|
|
|
|
CLEAN_AFTER_BUILD => 0, |
578
|
|
|
|
|
|
|
COMPILE_PARAMS_DEBUG |
579
|
|
|
|
|
|
|
<<'COMPILE_PARAMS_OPTIMIZED'); |
580
|
|
|
|
|
|
|
OPTIMIZE => "-g -O2", |
581
|
|
|
|
|
|
|
COMPILE_PARAMS_OPTIMIZED |
582
|
|
|
|
|
|
|
|
583
|
0
|
|
0
|
|
|
|
my $openssl_params = sprintf('LIBS => "%s -lcrypto -lssl",', |
584
|
|
|
|
|
|
|
($ENV{BUILD_OPENSSL_LDFLAGS} or "")); |
585
|
0
|
0
|
|
|
|
|
if ($ENV{BUILD_OPENSSL_CFLAGS}) { |
586
|
0
|
|
|
|
|
|
$openssl_params .= qq' INC => "$ENV{BUILD_OPENSSL_CFLAGS}",'; |
587
|
|
|
|
|
|
|
} |
588
|
|
|
|
|
|
|
|
589
|
0
|
0
|
|
|
|
|
my $version_params = |
590
|
|
|
|
|
|
|
( $Crypt::OpenSSL::CA::VERSION ? |
591
|
|
|
|
|
|
|
qq'VERSION => "$Crypt::OpenSSL::CA::VERSION",' : "" ); |
592
|
|
|
|
|
|
|
|
593
|
0
|
0
|
|
|
|
|
my $boot_params = ($opts{-boot_section} ? <<"BOOT_CONFIG" : ""); |
594
|
|
|
|
|
|
|
BOOT => <<'BOOT_SECTION', |
595
|
|
|
|
|
|
|
$opts{-boot_section} |
596
|
|
|
|
|
|
|
BOOT_SECTION |
597
|
|
|
|
|
|
|
BOOT_CONFIG |
598
|
|
|
|
|
|
|
|
599
|
0
|
0
|
|
|
|
|
eval <<"FAKE_Inline_C_INVOCATION"; die $@ if $@; |
|
0
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
package $package; |
601
|
|
|
|
|
|
|
use Inline C => Config => |
602
|
|
|
|
|
|
|
NAME => '$package', |
603
|
|
|
|
|
|
|
$compile_params |
604
|
|
|
|
|
|
|
$version_params |
605
|
|
|
|
|
|
|
$openssl_params |
606
|
|
|
|
|
|
|
$boot_params |
607
|
|
|
|
|
|
|
; |
608
|
|
|
|
|
|
|
use Inline C => <<'C_CODE'; |
609
|
|
|
|
|
|
|
$c_code |
610
|
|
|
|
|
|
|
C_CODE |
611
|
|
|
|
|
|
|
FAKE_Inline_C_INVOCATION |
612
|
|
|
|
|
|
|
|
613
|
0
|
|
|
|
|
|
return 1; |
614
|
|
|
|
|
|
|
} |
615
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
=head3 full_debugging |
617
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
Returns true iff the environment variable L is set. |
619
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
=cut |
621
|
|
|
|
|
|
|
|
622
|
0
|
|
|
0
|
0
|
|
sub full_debugging { ! ! $ENV{FULL_DEBUGGING} } |
623
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
=head3 installed_version |
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
Returns what the source code of this module will look like (with POD |
627
|
|
|
|
|
|
|
and everything) after it is installed. The installed version is a dud |
628
|
|
|
|
|
|
|
stub; its L method only loads the XS DLL, and it is no longer |
629
|
|
|
|
|
|
|
possible to alter the C code once the module has been installed. The |
630
|
|
|
|
|
|
|
upside is that in thanks to that, L is a dependency only at |
631
|
|
|
|
|
|
|
compile time. |
632
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
=begin this_pod_is_not_ours |
634
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
=cut |
636
|
|
|
|
|
|
|
|
637
|
0
|
|
|
0
|
0
|
|
sub installed_version { <<'INSTALLED_VERSION' } |
638
|
|
|
|
|
|
|
#!perl -w |
639
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
package Crypt::OpenSSL::CA::Inline::C; |
641
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
use strict; |
643
|
|
|
|
|
|
|
use XSLoader; |
644
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
sub import { |
646
|
|
|
|
|
|
|
my ($class, $stuff) = @_; |
647
|
|
|
|
|
|
|
return if ! defined $stuff; |
648
|
|
|
|
|
|
|
return if $stuff eq "__END__"; |
649
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
my ($package) = caller; |
651
|
|
|
|
|
|
|
no strict "refs"; |
652
|
|
|
|
|
|
|
push @{$package."::ISA"}, qw(XSLoader); |
653
|
|
|
|
|
|
|
{ no warnings "redefine"; XSLoader::load($package); } |
654
|
|
|
|
|
|
|
} |
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
=head1 NAME |
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
Crypt::OpenSSL::CA::Inline::C - The Inline magic (or lack thereof) for |
659
|
|
|
|
|
|
|
Crypt::OpenSSL::CA |
660
|
|
|
|
|
|
|
|
661
|
|
|
|
|
|
|
=head1 SYNOPSIS |
662
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
use Crypt::OpenSSL::CA::Inline::C $and_the_rest_is_ignored; |
664
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
# ... |
666
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
use Crypt::OpenSSL::CA::Inline::C "__END__"; |
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
=head1 DESCRIPTION |
670
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
This package simply loads the DLLs that contain the parts of |
672
|
|
|
|
|
|
|
L that are made of XS code. It is a stubbed-down |
673
|
|
|
|
|
|
|
version of the full-fledged I that |
674
|
|
|
|
|
|
|
replaces the real thing at module install time. |
675
|
|
|
|
|
|
|
|
676
|
|
|
|
|
|
|
There is more to I, such as the ability |
677
|
|
|
|
|
|
|
to dynamically modify and recompile the C code snippets in |
678
|
|
|
|
|
|
|
I's code source. But in order to grasp hold of its |
679
|
|
|
|
|
|
|
power, you have to use the full source code tarball and not just the |
680
|
|
|
|
|
|
|
installed version. |
681
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
=cut |
683
|
|
|
|
|
|
|
|
684
|
|
|
|
|
|
|
1; |
685
|
|
|
|
|
|
|
|
686
|
|
|
|
|
|
|
INSTALLED_VERSION |
687
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
=end this_pod_is_not_ours |
689
|
|
|
|
|
|
|
|
690
|
|
|
|
|
|
|
=head1 ENVIRONMENT VARIABLES |
691
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
=head2 FULL_DEBUGGING |
693
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
Setting this variable to 1 causes the C code to be compiled without |
695
|
|
|
|
|
|
|
optimization, allowing gdb to dump symbols of static functions with |
696
|
|
|
|
|
|
|
only one call site (which comprises most of the C code in |
697
|
|
|
|
|
|
|
L). Also, the temporary build files are left |
698
|
|
|
|
|
|
|
intact if C is set. |
699
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
Developpers, please note that in the absence of C, the |
701
|
|
|
|
|
|
|
default compiler flags are C<-g -O2>, still allowing for a range of |
702
|
|
|
|
|
|
|
debugging strategies. C should therefore only be set |
703
|
|
|
|
|
|
|
on a one-shot basis by developpers who have a specific need for it. |
704
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
=head2 BUILD_OPENSSL_CFLAGS |
706
|
|
|
|
|
|
|
|
707
|
|
|
|
|
|
|
Contains the CFLAGS to pass so as to compile C code that links against |
708
|
|
|
|
|
|
|
OpenSSL; eg C<< -I/usr/lib/openssl/include >> or something. Passed on |
709
|
|
|
|
|
|
|
to L by L. |
710
|
|
|
|
|
|
|
|
711
|
|
|
|
|
|
|
=head2 BUILD_OPENSSL_LDFLAGS |
712
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
Contains the LDFLAGS to pass so as to link with the OpenSSL libraries; |
714
|
|
|
|
|
|
|
eg C<< -L/usr/lib/openssl/lib >> or something. Passed on to |
715
|
|
|
|
|
|
|
L by L. |
716
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
=head1 SEE ALSO |
718
|
|
|
|
|
|
|
|
719
|
|
|
|
|
|
|
L, L, L, L. |
720
|
|
|
|
|
|
|
|
721
|
|
|
|
|
|
|
=cut |
722
|
|
|
|
|
|
|
|
723
|
1
|
50
|
|
|
|
1193
|
require My::Tests::Below unless caller(); |
724
|
|
|
|
|
|
|
|
725
|
0
|
|
|
|
|
0
|
1; |
726
|
|
|
|
|
|
|
|
727
|
|
|
|
|
|
|
__END__ |