Codebase list libcryptx-perl / 17d7898
Update upstream source from tag 'upstream/0.064' Update to upstream version '0.064' with Debian dir 37fbee5058e1bbc46d6d5ac05b8ca2fffb4bd405 gregor herrmann 4 years ago
267 changed file(s) with 3829 addition(s) and 1771 deletion(s). Raw diff Collapse all Expand all
00 Changes for CryptX
1
2 0.064 2019-06-14
3 - fix #50 libtommath patch - building on HP-UX 11.11 / PA-RISC
4 - necessary XS adaptation to the latest libtommath
5 - bundled libtomcrypt update branch:develop (commit:c600d81e 2019-06-09)
16
27 0.063 2018-11-28
38 - proper patch for #46 (related to Math::BigInt::LTM)
402402 mp_int mpi;
403403
404404 if (in == NULL) XSRETURN_UNDEF;
405 if (mp_init(&mpi) != CRYPT_OK) XSRETURN_UNDEF;
405 if (mp_init(&mpi) != MP_OKAY) XSRETURN_UNDEF;
406406 if (strlen(in) == 0) {
407407 RETVAL = newSVpvn("", 0);
408408 }
416416 SvPOK_only(RETVAL);
417417 SvCUR_set(RETVAL, len);
418418 out_data = (unsigned char *)SvPVX(RETVAL);
419 mp_to_unsigned_bin(&mpi, out_data);
419 if (mp_to_unsigned_bin(&mpi, out_data) != MP_OKAY) {
420 SvREFCNT_dec(RETVAL);
421 RETVAL = newSVpvn(NULL, 0); /* undef */
422 }
420423 }
421424 }
422425 else {
436439 char *out_data;
437440 mp_int mpi, tmp;
438441 mp_digit d;
442 mp_err merr;
439443 int digits = 0;
440444
441445 if (!SvPOK(in) || radix < 2 || radix > 64) XSRETURN_UNDEF;
442446 in_data = (unsigned char *) SvPVbyte(in, len);
443 mp_init_multi(&mpi, &tmp, NULL);
447 if (mp_init_multi(&mpi, &tmp, NULL) != MP_OKAY) XSRETURN_UNDEF;
444448 if (len == 0) {
445449 RETVAL = newSVpvn("", 0);
446450 }
447451 else {
448452 if (mp_read_unsigned_bin(&mpi, in_data, (unsigned long)len) == CRYPT_OK) {
449 mp_copy(&mpi, &tmp);
450 while (mp_iszero(&tmp) == MP_NO) {
451 mp_div_d(&tmp, (mp_digit)radix, &tmp, &d);
453 merr = mp_copy(&mpi, &tmp);
454 while (merr == MP_OKAY && mp_iszero(&tmp) == MP_NO) {
455 merr = mp_div_d(&tmp, (mp_digit)radix, &tmp, &d);
452456 digits++;
453457 }
454 if (digits == 0) {
458 if (merr != MP_OKAY) {
459 RETVAL = newSVpvn(NULL, 0); /* undef */
460 }
461 else if (digits == 0) {
455462 RETVAL = newSVpvn("", 0);
456463 }
457464 else {
458465 RETVAL = NEWSV(0, digits + 2); /* +2 for sign and NUL byte */
459466 SvPOK_only(RETVAL);
460467 out_data = SvPVX(RETVAL);
461 mp_toradix(&mpi, out_data, radix);
462 SvCUR_set(RETVAL, strlen(out_data));
468 if (mp_toradix(&mpi, out_data, radix) == MP_OKAY) {
469 SvCUR_set(RETVAL, strlen(out_data));
470 }
471 else {
472 SvREFCNT_dec(RETVAL);
473 RETVAL = newSVpvn(NULL, 0); /* undef */
474 }
463475 }
464476 }
465477 else {
456456 src/ltc/pk/asn1/oid/pk_oid_cmp.c
457457 src/ltc/pk/asn1/oid/pk_oid_str.c
458458 src/ltc/pk/asn1/pkcs8/pkcs8_decode_flexi.c
459 src/ltc/pk/asn1/x509/x509_decode_public_key_from_certificate.c
459460 src/ltc/pk/asn1/x509/x509_decode_subject_public_key_info.c
460461 src/ltc/pk/asn1/x509/x509_encode_subject_public_key_info.c
461462 src/ltc/pk/dh/dh.c
615616 src/ltm/bn_mp_fread.c
616617 src/ltm/bn_mp_fwrite.c
617618 src/ltm/bn_mp_gcd.c
619 src/ltm/bn_mp_get_bit.c
618620 src/ltm/bn_mp_get_int.c
619621 src/ltm/bn_mp_get_long.c
620622 src/ltm/bn_mp_grow.c
631633 src/ltm/bn_mp_jacobi.c
632634 src/ltm/bn_mp_karatsuba_mul.c
633635 src/ltm/bn_mp_karatsuba_sqr.c
636 src/ltm/bn_mp_kronecker.c
634637 src/ltm/bn_mp_lcm.c
635638 src/ltm/bn_mp_lshd.c
636639 src/ltm/bn_mp_mod.c
649652 src/ltm/bn_mp_neg.c
650653 src/ltm/bn_mp_or.c
651654 src/ltm/bn_mp_prime_fermat.c
655 src/ltm/bn_mp_prime_frobenius_underwood.c
652656 src/ltm/bn_mp_prime_is_divisible.c
653657 src/ltm/bn_mp_prime_is_prime.c
654658 src/ltm/bn_mp_prime_miller_rabin.c
655659 src/ltm/bn_mp_prime_next_prime.c
656660 src/ltm/bn_mp_prime_rabin_miller_trials.c
657661 src/ltm/bn_mp_prime_random_ex.c
662 src/ltm/bn_mp_prime_strong_lucas_selfridge.c
658663 src/ltm/bn_mp_radix_size.c
659664 src/ltm/bn_mp_radix_smap.c
660665 src/ltm/bn_mp_rand.c
4444 "url" : "https://github.com/DCIT/perl-CryptX"
4545 }
4646 },
47 "version" : "0.063",
47 "version" : "0.064",
4848 "x_serialization_backend" : "JSON::PP version 2.94"
4949 }
2121 resources:
2222 bugtracker: https://github.com/DCIT/perl-CryptX/issues
2323 repository: https://github.com/DCIT/perl-CryptX
24 version: '0.063'
24 version: '0.064'
2525 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
66
77 Math::BigInt::LTM
88 _new(Class, SV *x)
9 CODE:
10 Newz(0, RETVAL, 1, mp_int);
11 mp_init(RETVAL);
9 PREINIT:
10 mp_err merr;
11 CODE:
12 Newz(0, RETVAL, 1, mp_int);
13 merr = mp_init(RETVAL);
14 #ifdef BN_MP_SET_INT_C
1215 if ((SvUOK(x) || SvIOK(x)) && (sizeof(UV) <= sizeof(unsigned long) || SvUV(x) == (unsigned long)SvUV(x))) {
1316 mp_set_int(RETVAL, (unsigned long)SvUV(x));
1417 }
15 else {
16 mp_read_radix(RETVAL, SvPV_nolen(x), 10);
17 }
18 #elif IVSIZE == 8
19 if (SvUOK(x)) {
20 mp_set_u64(RETVAL, (unsigned long long)SvUV(x));
21 }
22 else if (SvIOK(x)) {
23 mp_set_i64(RETVAL, (long long)SvIV(x));
24 }
25 #else
26 if (SvUOK(x)) {
27 mp_set_u32(RETVAL, (unsigned int)SvUV(x));
28 }
29 else if (SvIOK(x)) {
30 mp_set_i32(RETVAL, (int)SvIV(x));
31 }
32 #endif
33 else {
34 /* fallback - read the decimal number from string */
35 merr = mp_read_radix(RETVAL, SvPV_nolen(x), 10);
36 }
37 PERL_UNUSED_VAR(merr);
1838 OUTPUT:
1939 RETVAL
2040
2444 Math::BigInt::LTM
2545 _from_bin(Class, SV *x)
2646 PREINIT:
47 mp_err merr;
2748 char *str, *start;
2849 CODE:
2950 Newz(0, RETVAL, 1, mp_int);
30 mp_init(RETVAL);
51 merr = mp_init(RETVAL);
3152 str = SvPV_nolen(x);
3253 start = (strlen(str)>2 && str[0] == '0' && str[1] == 'b') ? str+2 : str;
33 mp_read_radix(RETVAL, start, 2);
54 merr = mp_read_radix(RETVAL, start, 2);
55 PERL_UNUSED_VAR(merr);
3456 OUTPUT:
3557 RETVAL
3658
4062 Math::BigInt::LTM
4163 _from_hex(Class, SV *x)
4264 PREINIT:
65 mp_err merr;
4366 char *str, *start;
4467 CODE:
4568 Newz(0, RETVAL, 1, mp_int);
46 mp_init(RETVAL);
69 merr = mp_init(RETVAL);
4770 str = SvPV_nolen(x);
4871 start = (strlen(str)>2 && str[0] == '0' && str[1] == 'x') ? str+2 : str;
49 mp_read_radix(RETVAL, start, 16);
72 merr = mp_read_radix(RETVAL, start, 16);
73 PERL_UNUSED_VAR(merr);
5074 OUTPUT:
5175 RETVAL
5276
5579
5680 Math::BigInt::LTM
5781 _from_oct(Class, SV *x)
58 CODE:
59 Newz(0, RETVAL, 1, mp_int);
60 mp_init(RETVAL);
61 mp_read_radix(RETVAL, SvPV_nolen(x), 8);
82 PREINIT:
83 mp_err merr;
84 CODE:
85 Newz(0, RETVAL, 1, mp_int);
86 merr = mp_init(RETVAL);
87 merr = mp_read_radix(RETVAL, SvPV_nolen(x), 8);
88 PERL_UNUSED_VAR(merr);
6289 OUTPUT:
6390 RETVAL
6491
6794
6895 Math::BigInt::LTM
6996 _from_base(Class, SV *x, int base)
70 CODE:
71 Newz(0, RETVAL, 1, mp_int);
72 mp_init(RETVAL);
73 mp_read_radix(RETVAL, SvPV_nolen(x), base);
97 PREINIT:
98 mp_err merr;
99 CODE:
100 Newz(0, RETVAL, 1, mp_int);
101 merr = mp_init(RETVAL);
102 merr = mp_read_radix(RETVAL, SvPV_nolen(x), base);
103 PERL_UNUSED_VAR(merr);
74104 OUTPUT:
75105 RETVAL
76106
80110 Math::BigInt::LTM
81111 _from_bytes(Class, SV *x)
82112 PREINIT:
113 mp_err merr;
83114 STRLEN buf_len;
84115 unsigned char *buf_ptr;
85116 CODE:
86117 Newz(0, RETVAL, 1, mp_int);
87 mp_init(RETVAL);
118 merr = mp_init(RETVAL);
88119 buf_ptr = (unsigned char *)SvPVbyte(x, buf_len);
89 mp_read_unsigned_bin(RETVAL, buf_ptr, buf_len);
120 merr = mp_read_unsigned_bin(RETVAL, buf_ptr, buf_len);
121 PERL_UNUSED_VAR(merr);
90122 OUTPUT:
91123 RETVAL
92124
95127
96128 void
97129 _set(Class, Math::BigInt::LTM n, SV *x)
98 CODE:
99 mp_set_int(n, (unsigned long)SvIV(x));
130 PREINIT:
131 mp_err merr;
132 CODE:
133 #ifdef BN_MP_SET_INT_C
134 if ((SvUOK(x) || SvIOK(x)) && (sizeof(UV) <= sizeof(unsigned long) || SvUV(x) == (unsigned long)SvUV(x))) {
135 mp_set_int(n, (unsigned long)SvIV(x));
136 }
137 #elif IVSIZE == 8
138 if (SvUOK(x)) {
139 mp_set_u64(n, (unsigned long long)SvUV(x));
140 }
141 else if (SvIOK(x)) {
142 mp_set_i64(n, (long long)SvIV(x));
143 }
144 #else
145 if (SvUOK(x)) {
146 mp_set_u32(n, (unsigned int)SvUV(x));
147 }
148 else if (SvIOK(x)) {
149 mp_set_i32(n, (int)SvIV(x));
150 }
151 #endif
152 else {
153 /* fallback - read the decimal number from string */
154 merr = mp_read_radix(n, SvPV_nolen(x), 10);
155 PERL_UNUSED_VAR(merr);
156 }
100157
101158 ##############################################################################
102159 # _zero()
103160
104161 Math::BigInt::LTM
105162 _zero(Class)
106 CODE:
107 Newz(0, RETVAL, 1, mp_int);
108 mp_init(RETVAL);
109 mp_set_int(RETVAL, 0);
163 PREINIT:
164 mp_err merr;
165 CODE:
166 Newz(0, RETVAL, 1, mp_int);
167 merr = mp_init(RETVAL);
168 mp_zero(RETVAL);
169 PERL_UNUSED_VAR(merr);
110170 OUTPUT:
111171 RETVAL
112172
115175
116176 Math::BigInt::LTM
117177 _one(Class)
118 CODE:
119 Newz(0, RETVAL, 1, mp_int);
120 mp_init(RETVAL);
178 PREINIT:
179 mp_err merr;
180 CODE:
181 Newz(0, RETVAL, 1, mp_int);
182 merr = mp_init(RETVAL);
183 #ifdef BN_MP_SET_INT_C
121184 mp_set_int(RETVAL, 1);
185 #else
186 mp_set_u32(RETVAL, 1);
187 #endif
188 PERL_UNUSED_VAR(merr);
122189 OUTPUT:
123190 RETVAL
124191
127194
128195 Math::BigInt::LTM
129196 _two(Class)
130 CODE:
131 Newz(0, RETVAL, 1, mp_int);
132 mp_init(RETVAL);
197 PREINIT:
198 mp_err merr;
199 CODE:
200 Newz(0, RETVAL, 1, mp_int);
201 merr = mp_init(RETVAL);
202 #ifdef BN_MP_SET_INT_C
133203 mp_set_int(RETVAL, 2);
204 #else
205 mp_set_u32(RETVAL, 2);
206 #endif
207 PERL_UNUSED_VAR(merr);
134208 OUTPUT:
135209 RETVAL
136210
139213
140214 Math::BigInt::LTM
141215 _ten(Class)
142 CODE:
143 Newz(0, RETVAL, 1, mp_int);
144 mp_init(RETVAL);
216 PREINIT:
217 mp_err merr;
218 CODE:
219 Newz(0, RETVAL, 1, mp_int);
220 merr = mp_init(RETVAL);
221 #ifdef BN_MP_SET_INT_C
145222 mp_set_int(RETVAL, 10);
223 #else
224 mp_set_u32(RETVAL, 10);
225 #endif
226 PERL_UNUSED_VAR(merr);
146227 OUTPUT:
147228 RETVAL
148229
151232
152233 Math::BigInt::LTM
153234 _1ex(Class, int x)
154 CODE:
155 Newz(0, RETVAL, 1, mp_int);
156 mp_init(RETVAL);
235 PREINIT:
236 mp_err merr;
237 CODE:
238 Newz(0, RETVAL, 1, mp_int);
239 merr = mp_init(RETVAL);
240 #ifdef BN_MP_SET_INT_C
157241 mp_set_int(RETVAL, 10);
158 mp_expt_d(RETVAL, x, RETVAL);
242 #else
243 mp_set_u32(RETVAL, 10);
244 #endif
245 merr = mp_expt_d(RETVAL, x, RETVAL);
246 PERL_UNUSED_VAR(merr);
159247 OUTPUT:
160248 RETVAL
161249
176264 SV *
177265 _str(Class, Math::BigInt::LTM n)
178266 PREINIT:
267 mp_err merr;
179268 int len;
180269 char *buf;
181270 CODE:
185274 else {
186275 len = mp_count_bits(n) / 3 + 3; /* decimal_size ~ (binary_size/3 + 1) +1 for sign +1 for NUL-byte */
187276 Newz(0, buf, len, char);
188 mp_toradix_n(n, buf, 10, len);
277 merr = mp_toradix_n(n, buf, 10, len);
189278 RETVAL = newSVpv(buf, 0);
190279 Safefree(buf);
191280 }
281 PERL_UNUSED_VAR(merr);
192282 OUTPUT:
193283 RETVAL
194284
198288 int
199289 _len(Class, Math::BigInt::LTM n)
200290 PREINIT:
291 mp_err merr;
201292 int len;
202293 char *buf;
203294 CODE:
207298 else {
208299 len = mp_count_bits(n) / 3 + 3; /* decimal_size ~ (binary_size/3 + 1) +1 for sign +1 for NUL-byte */
209300 Newz(0, buf, len, char);
210 mp_toradix_n(n, buf, 10, len);
301 merr = mp_toradix_n(n, buf, 10, len);
211302 RETVAL = (int)strlen(buf);
212303 Safefree(buf);
213304 }
305 PERL_UNUSED_VAR(merr);
214306 OUTPUT:
215307 RETVAL
216308
239331 int
240332 _zeros(Class, Math::BigInt::LTM n)
241333 PREINIT:
334 mp_err merr;
242335 int len;
243336 char *buf;
244337 CODE:
248341 else {
249342 len = mp_count_bits(n) / 3 + 3; /* decimal_size ~ (binary_size/3 + 1) +1 for sign +1 for NUL-byte */
250343 Newz(0, buf, len, char);
251 mp_toradix_n(n, buf, 10, len);
344 merr = mp_toradix_n(n, buf, 10, len);
252345 len = (int)strlen(buf);
253346 RETVAL = 0;
254347 while (len > 0) {
258351 }
259352 Safefree(buf);
260353 }
354 PERL_UNUSED_VAR(merr);
261355 OUTPUT:
262356 RETVAL
263357
267361 SV *
268362 _to_hex(Class, Math::BigInt::LTM n)
269363 PREINIT:
364 mp_err merr;
270365 int i, len;
271366 char *buf;
272367 CODE:
274369 RETVAL = newSV(len);
275370 SvPOK_on(RETVAL);
276371 buf = SvPVX(RETVAL);
277 mp_tohex(n, buf);
372 merr = mp_toradix(n, buf, 16); /* to hex */
278373 for (i=0; i<len && buf[i]>0; i++) buf[i] = toLOWER(buf[i]);
279374 SvCUR_set(RETVAL, strlen(buf));
375 PERL_UNUSED_VAR(merr);
280376 OUTPUT:
281377 RETVAL
282378
286382 SV *
287383 _to_bin(Class, Math::BigInt::LTM n)
288384 PREINIT:
385 mp_err merr;
289386 int len;
290387 char *buf;
291388 CODE:
293390 RETVAL = newSV(len);
294391 SvPOK_on(RETVAL);
295392 buf = SvPVX(RETVAL);
296 mp_tobinary(n, buf);
393 merr = mp_toradix(n, buf, 2); /* to binary */
297394 SvCUR_set(RETVAL, strlen(buf));
395 PERL_UNUSED_VAR(merr);
298396 OUTPUT:
299397 RETVAL
300398
304402 SV *
305403 _to_oct(Class, Math::BigInt::LTM n)
306404 PREINIT:
405 mp_err merr;
307406 int len;
308407 char *buf;
309408 CODE:
311410 RETVAL = newSV(len);
312411 SvPOK_on(RETVAL);
313412 buf = SvPVX(RETVAL);
314 mp_tooctal(n, buf);
413 merr = mp_toradix(n, buf, 8); /* to octal */
315414 SvCUR_set(RETVAL, strlen(buf));
415 PERL_UNUSED_VAR(merr);
316416 OUTPUT:
317417 RETVAL
318418
322422 SV *
323423 _to_base(Class, Math::BigInt::LTM n, int base)
324424 PREINIT:
425 mp_err merr;
325426 int len;
326427 char *buf;
327428 CODE:
330431 SvPOK_on(RETVAL);
331432 buf = SvPVX(RETVAL);
332433 if (len > 0) {
333 mp_toradix_n(n, buf, base, len);
434 merr = mp_toradix_n(n, buf, base, len);
334435 SvCUR_set(RETVAL, strlen(buf));
335436 }
336437 else {
337438 buf[0] = '0';
338439 SvCUR_set(RETVAL, 1);
339440 }
441 PERL_UNUSED_VAR(merr);
340442 OUTPUT:
341443 RETVAL
342444
349451 ALIAS:
350452 _as_bytes = 1
351453 PREINIT:
454 mp_err merr;
352455 int len;
353456 unsigned char *buf;
354457 CODE:
358461 SvPOK_on(RETVAL);
359462 buf = (unsigned char*)SvPVX(RETVAL);
360463 if (len > 0) {
361 mp_to_unsigned_bin(n, buf);
464 merr = mp_to_unsigned_bin(n, buf);
362465 SvCUR_set(RETVAL, len);
363466 }
364467 else {
365468 buf[0] = 0;
366469 SvCUR_set(RETVAL, 1);
367470 }
471 PERL_UNUSED_VAR(merr);
368472 OUTPUT:
369473 RETVAL
370474
373477
374478 Math::BigInt::LTM
375479 _modpow(Class, Math::BigInt::LTM n, Math::BigInt::LTM exp, Math::BigInt::LTM mod)
376 CODE:
377 Newz(0, RETVAL, 1, mp_int);
378 mp_init(RETVAL);
480 PREINIT:
481 mp_err merr;
482 CODE:
483 Newz(0, RETVAL, 1, mp_int);
484 merr = mp_init(RETVAL);
379485 if (mp_cmp_d(mod, 1) == MP_EQ) {
380 mp_set_int(RETVAL, 0);
381 }
382 else {
383 mp_exptmod(n, exp, mod, RETVAL);
384 }
486 mp_zero(RETVAL);
487 }
488 else {
489 merr = mp_exptmod(n, exp, mod, RETVAL);
490 }
491 PERL_UNUSED_VAR(merr);
385492 OUTPUT:
386493 RETVAL
387494
391498 void
392499 _modinv(Class, Math::BigInt::LTM x, Math::BigInt::LTM y)
393500 PREINIT:
501 mp_err merr;
394502 int rc;
395503 SV* s;
396504 mp_int* RETVAL;
397505 PPCODE:
398506 Newz(0, RETVAL, 1, mp_int);
399 mp_init(RETVAL);
507 merr = mp_init(RETVAL);
400508 rc = mp_invmod(x, y, RETVAL);
401509 EXTEND(SP, 2); /* we return two values */
402510 if (rc != MP_OKAY) {
412520 sv_setpvn(s, "+", 1);
413521 PUSHs(s);
414522 }
523 PERL_UNUSED_VAR(merr);
415524
416525 ##############################################################################
417526 # _add() - add $y to $x in place
418527
419528 void
420529 _add(Class, Math::BigInt::LTM x, Math::BigInt::LTM y)
421 PPCODE:
422 mp_add(x, y, x);
530 PREINIT:
531 mp_err merr;
532 PPCODE:
533 merr = mp_add(x, y, x);
534 PERL_UNUSED_VAR(merr);
423535 XPUSHs(ST(1)); /* x */
424536
425537 ##############################################################################
427539
428540 void
429541 _inc(Class, Math::BigInt::LTM x)
430 PPCODE:
431 mp_add_d(x, 1, x);
542 PREINIT:
543 mp_err merr;
544 PPCODE:
545 merr = mp_add_d(x, 1, x);
546 PERL_UNUSED_VAR(merr);
432547 XPUSHs(ST(1)); /* x */
433548
434549 ##############################################################################
436551
437552 void
438553 _dec(Class, Math::BigInt::LTM x)
439 PPCODE:
440 mp_sub_d(x, 1, x);
554 PREINIT:
555 mp_err merr;
556 PPCODE:
557 merr = mp_sub_d(x, 1, x);
558 PERL_UNUSED_VAR(merr);
441559 XPUSHs(ST(1)); /* x */
442560
443561 ##############################################################################
446564
447565 void
448566 _sub(Class, Math::BigInt::LTM x, Math::BigInt::LTM y, ...)
567 PREINIT:
568 mp_err merr;
449569 PPCODE:
450570 if ( items == 4 && SvTRUE(ST(3)) ) {
451571 /* y -= x */
452 mp_sub(x, y, y);
572 merr = mp_sub(x, y, y);
453573 XPUSHs(ST(2)); /* y */
454574 }
455575 else {
456576 /* x -= y */
457 mp_sub(x, y, x);
577 merr = mp_sub(x, y, x);
458578 XPUSHs(ST(1)); /* x */
459579 }
580 PERL_UNUSED_VAR(merr);
460581
461582 ##############################################################################
462583 # _rsft()
464585 void
465586 _rsft(Class, Math::BigInt::LTM x, Math::BigInt::LTM y, unsigned long base_int)
466587 PREINIT:
588 mp_err merr;
467589 mp_int* BASE;
468590 PPCODE:
469591 Newz(0, BASE, 1, mp_int);
470 mp_init_set_int(BASE, base_int);
471 mp_expt_d(BASE, mp_get_long(y), BASE);
472 mp_div(x, BASE, x, NULL);
592 merr = mp_init(BASE);
593 #ifdef BN_MP_SET_INT_C
594 mp_set_int(BASE, base_int);
595 #else
596 mp_set_ul(BASE, base_int);
597 #endif
598 #ifdef BN_MP_GET_LONG_C
599 merr = mp_expt_d(BASE, mp_get_long(y), BASE);
600 #else
601 merr = mp_expt_d(BASE, mp_get_ul(y), BASE);
602 #endif
603 merr = mp_div(x, BASE, x, NULL);
604 PERL_UNUSED_VAR(merr);
473605 mp_clear(BASE);
474606 Safefree(BASE);
475607 XPUSHs(ST(1)); /* x */
480612 void
481613 _lsft(Class, Math::BigInt::LTM x, Math::BigInt::LTM y, unsigned long base_int)
482614 PREINIT:
615 mp_err merr;
483616 mp_int* BASE;
484617 PPCODE:
485618 Newz(0, BASE, 1, mp_int);
486 mp_init_set_int(BASE, base_int);
487 mp_expt_d(BASE, mp_get_long(y), BASE);
488 mp_mul(x, BASE, x);
619 merr = mp_init(BASE);
620 #ifdef BN_MP_SET_INT_C
621 mp_set_int(BASE, base_int);
622 #else
623 mp_set_ul(BASE, base_int);
624 #endif
625 #ifdef BN_MP_GET_LONG_C
626 merr = mp_expt_d(BASE, mp_get_long(y), BASE);
627 #else
628 merr = mp_expt_d(BASE, mp_get_ul(y), BASE);
629 #endif
630 merr = mp_mul(x, BASE, x);
631 PERL_UNUSED_VAR(merr);
489632 mp_clear(BASE);
490633 Safefree(BASE);
491634 XPUSHs(ST(1)); /* x */
495638
496639 void
497640 _mul(Class, Math::BigInt::LTM x, Math::BigInt::LTM y)
498 PPCODE:
499 mp_mul(x, y, x);
641 PREINIT:
642 mp_err merr;
643 PPCODE:
644 merr = mp_mul(x, y, x);
645 PERL_UNUSED_VAR(merr);
500646 XPUSHs(ST(1)); /* x */
501647
502648 ##############################################################################
505651 void
506652 _div(Class, Math::BigInt::LTM x, Math::BigInt::LTM y)
507653 PREINIT:
654 mp_err merr;
508655 mp_int * rem;
509656 PPCODE:
510657 if (GIMME_V == G_ARRAY) {
511658 Newz(0, rem, 1, mp_int);
512 mp_init(rem);
513 mp_div(x, y, x, rem);
659 merr = mp_init(rem);
660 merr = mp_div(x, y, x, rem);
514661 EXTEND(SP, 2);
515662 PUSHs(ST(1)); /* x */
516663 PUSHs(sv_2mortal(sv_from_mpi(rem)));
517664 }
518665 else {
519 mp_div(x, y, x, NULL);
666 merr = mp_div(x, y, x, NULL);
520667 XPUSHs(ST(1)); /* x */
521668 }
669 PERL_UNUSED_VAR(merr);
522670
523671 ##############################################################################
524672 # _mod() - x %= y
525673
526674 void
527675 _mod(Class, Math::BigInt::LTM x, Math::BigInt::LTM y)
528 PPCODE:
529 mp_mod(x, y, x);
676 PREINIT:
677 mp_err merr;
678 PPCODE:
679 merr = mp_mod(x, y, x);
680 PERL_UNUSED_VAR(merr);
530681 XPUSHs(ST(1)); /* x */
531682
532683 ##############################################################################
586737
587738 void
588739 _pow(Class, Math::BigInt::LTM x, Math::BigInt::LTM y)
589 PPCODE:
590 mp_expt_d(x, mp_get_long(y), x);
740 PREINIT:
741 mp_err merr;
742 PPCODE:
743 #ifdef BN_MP_GET_LONG_C
744 merr = mp_expt_d(x, mp_get_long(y), x);
745 #else
746 merr = mp_expt_d(x, mp_get_ul(y), x);
747 #endif
748 PERL_UNUSED_VAR(merr);
591749 XPUSHs(ST(1)); /* x */
592750
593751 ##############################################################################
595753
596754 Math::BigInt::LTM
597755 _gcd(Class, Math::BigInt::LTM x, Math::BigInt::LTM y)
598 CODE:
599 Newz(0, RETVAL, 1, mp_int);
600 mp_init(RETVAL);
601 mp_gcd(x, y, RETVAL);
756 PREINIT:
757 mp_err merr;
758 CODE:
759 Newz(0, RETVAL, 1, mp_int);
760 merr = mp_init(RETVAL);
761 merr = mp_gcd(x, y, RETVAL);
762 PERL_UNUSED_VAR(merr);
602763 OUTPUT:
603764 RETVAL
604765
607768
608769 void
609770 _and(Class, Math::BigInt::LTM x, Math::BigInt::LTM y)
610 PPCODE:
611 mp_and(x, y, x);
771 PREINIT:
772 mp_err merr;
773 PPCODE:
774 merr = mp_and(x, y, x);
775 PERL_UNUSED_VAR(merr);
612776 XPUSHs(ST(1)); /* x */
613777
614778 ##############################################################################
616780
617781 void
618782 _xor(Class, Math::BigInt::LTM x, Math::BigInt::LTM y)
619 PPCODE:
620 mp_xor(x, y, x);
783 PREINIT:
784 mp_err merr;
785 PPCODE:
786 merr = mp_xor(x, y, x);
787 PERL_UNUSED_VAR(merr);
621788 XPUSHs(ST(1)); /* x */
622789
623790 ##############################################################################
625792
626793 void
627794 _or(Class, Math::BigInt::LTM x, Math::BigInt::LTM y)
628 PPCODE:
629 mp_or(x, y, x);
795 PREINIT:
796 mp_err merr;
797 PPCODE:
798 merr = mp_or(x, y, x);
799 PERL_UNUSED_VAR(merr);
630800 XPUSHs(ST(1)); /* x */
631801
632802 ##############################################################################
634804
635805 Math::BigInt::LTM
636806 _copy(Class, Math::BigInt::LTM m)
637 CODE:
638 Newz(0, RETVAL, 1, mp_int);
639 mp_init(RETVAL);
640 mp_copy(m, RETVAL);
807 PREINIT:
808 mp_err merr;
809 CODE:
810 Newz(0, RETVAL, 1, mp_int);
811 merr = mp_init(RETVAL);
812 merr = mp_copy(m, RETVAL);
813 PERL_UNUSED_VAR(merr);
641814 OUTPUT:
642815 RETVAL
643816
666839
667840 void
668841 _sqrt(Class, Math::BigInt::LTM x)
669 PPCODE:
670 mp_sqrt(x, x);
842 PREINIT:
843 mp_err merr;
844 PPCODE:
845 merr = mp_sqrt(x, x);
846 PERL_UNUSED_VAR(merr);
671847 XPUSHs(ST(1)); /* x */
672848
673849 ##############################################################################
675851
676852 void
677853 _root(Class, Math::BigInt::LTM x, Math::BigInt::LTM y)
678 PPCODE:
679 mp_n_root(x, mp_get_long(y), x);
854 PREINIT:
855 mp_err merr;
856 PPCODE:
857 #ifdef BN_MP_GET_LONG_C
858 merr = mp_n_root(x, mp_get_long(y), x);
859 #else
860 merr = mp_n_root(x, mp_get_ul(y), x);
861 #endif
862 PERL_UNUSED_VAR(merr);
680863 XPUSHs(ST(1)); /* x */
681864
682865 ##############################################################################
683866 # _lcm() - least common multiple
684867 void
685868 _lcm(Class, Math::BigInt::LTM x, Math::BigInt::LTM y)
686 PPCODE:
687 mp_lcm(x, y, x) ;
869 PREINIT:
870 mp_err merr;
871 PPCODE:
872 merr = mp_lcm(x, y, x) ;
873 PERL_UNUSED_VAR(merr);
688874 XPUSHs(ST(1)); /* x */
689875
690876 ##############################################################################
696882 SV *cloning = NO_INIT
697883 SV *serialized
698884 PREINIT:
885 mp_err merr;
699886 SV *target;
700887 mp_int *mpi;
701888 PPCODE:
702889 PERL_UNUSED_VAR(cloning);
703890 if (SvROK(blank_obj) && sv_isa(blank_obj, "Math::BigInt::LTM")) {
704891 Newz(0, mpi, 1, mp_int);
705 mp_init(mpi);
706 mp_read_radix(mpi, SvPV_nolen(serialized), 10);
892 merr = mp_init(mpi);
893 merr = mp_read_radix(mpi, SvPV_nolen(serialized), 10);
894 PERL_UNUSED_VAR(merr);
707895 target = SvRV(blank_obj);
708896 SvIV_set(target, PTR2IV(mpi));
709897 SvIOK_on(target);
718906 Math::BigInt::LTM self
719907 SV *cloning = NO_INIT
720908 PREINIT:
909 mp_err merr;
721910 unsigned long len;
722911 char *buf;
723912 CODE:
728917 else {
729918 len = mp_count_bits(self) / 3 + 3; /* decimal_size ~ (binary_size/3 + 1) +1 for sign +1 for NUL-byte */
730919 Newz(0, buf, len, char);
731 mp_toradix_n(self, buf, 10, len);
920 merr = mp_toradix_n(self, buf, 10, len);
921 PERL_UNUSED_VAR(merr);
732922 RETVAL = newSVpv(buf, 0);
733923 Safefree(buf);
734924 }
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw( ccm_encrypt_authenticate ccm_decrypt_verify )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw( chacha20poly1305_encrypt_authenticate chacha20poly1305_decrypt_verify )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw( eax_encrypt_authenticate eax_decrypt_verify )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw( gcm_encrypt_authenticate gcm_decrypt_verify )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw( ocb_encrypt_authenticate ocb_decrypt_verify )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 ### not used
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 use base qw(Crypt::Checksum Exporter);
77 our %EXPORT_TAGS = ( all => [qw( adler32_data adler32_data_hex adler32_data_int adler32_file adler32_file_hex adler32_file_int )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 use base qw(Crypt::Checksum Exporter);
77 our %EXPORT_TAGS = ( all => [qw( crc32_data crc32_data_hex crc32_data_int crc32_file crc32_file_hex crc32_file_int )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw/ adler32_data adler32_data_hex adler32_data_int adler32_file adler32_file_hex adler32_file_int
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Cipher);
99
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 use Carp;
77 $Carp::Internal{(__PACKAGE__)}++;
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2b_160 blake2b_160_hex blake2b_160_b64 blake2b_160_b64u blake2b_160_file blake2b_160_file_hex blake2b_160_file_b64 blake2b_160_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2b_256 blake2b_256_hex blake2b_256_b64 blake2b_256_b64u blake2b_256_file blake2b_256_file_hex blake2b_256_file_b64 blake2b_256_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2b_384 blake2b_384_hex blake2b_384_b64 blake2b_384_b64u blake2b_384_file blake2b_384_file_hex blake2b_384_file_b64 blake2b_384_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2b_512 blake2b_512_hex blake2b_512_b64 blake2b_512_b64u blake2b_512_file blake2b_512_file_hex blake2b_512_file_b64 blake2b_512_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2s_128 blake2s_128_hex blake2s_128_b64 blake2s_128_b64u blake2s_128_file blake2s_128_file_hex blake2s_128_file_b64 blake2s_128_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2s_160 blake2s_160_hex blake2s_160_b64 blake2s_160_b64u blake2s_160_file blake2s_160_file_hex blake2s_160_file_b64 blake2s_160_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2s_224 blake2s_224_hex blake2s_224_b64 blake2s_224_b64u blake2s_224_file blake2s_224_file_hex blake2s_224_file_b64 blake2s_224_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2s_256 blake2s_256_hex blake2s_256_b64 blake2s_256_b64u blake2s_256_file blake2s_256_file_hex blake2s_256_file_b64 blake2s_256_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( chaes chaes_hex chaes_b64 chaes_b64u chaes_file chaes_file_hex chaes_file_b64 chaes_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( keccak224 keccak224_hex keccak224_b64 keccak224_b64u keccak224_file keccak224_file_hex keccak224_file_b64 keccak224_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( keccak256 keccak256_hex keccak256_b64 keccak256_b64u keccak256_file keccak256_file_hex keccak256_file_b64 keccak256_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( keccak384 keccak384_hex keccak384_b64 keccak384_b64u keccak384_file keccak384_file_hex keccak384_file_b64 keccak384_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( keccak512 keccak512_hex keccak512_b64 keccak512_b64u keccak512_file keccak512_file_hex keccak512_file_b64 keccak512_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( md2 md2_hex md2_b64 md2_b64u md2_file md2_file_hex md2_file_b64 md2_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( md4 md4_hex md4_b64 md4_b64u md4_file md4_file_hex md4_file_b64 md4_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( md5 md5_hex md5_b64 md5_b64u md5_file md5_file_hex md5_file_b64 md5_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( ripemd128 ripemd128_hex ripemd128_b64 ripemd128_b64u ripemd128_file ripemd128_file_hex ripemd128_file_b64 ripemd128_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( ripemd160 ripemd160_hex ripemd160_b64 ripemd160_b64u ripemd160_file ripemd160_file_hex ripemd160_file_b64 ripemd160_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( ripemd256 ripemd256_hex ripemd256_b64 ripemd256_b64u ripemd256_file ripemd256_file_hex ripemd256_file_b64 ripemd256_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( ripemd320 ripemd320_hex ripemd320_b64 ripemd320_b64u ripemd320_file ripemd320_file_hex ripemd320_file_b64 ripemd320_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha1 sha1_hex sha1_b64 sha1_b64u sha1_file sha1_file_hex sha1_file_b64 sha1_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha224 sha224_hex sha224_b64 sha224_b64u sha224_file sha224_file_hex sha224_file_b64 sha224_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha256 sha256_hex sha256_b64 sha256_b64u sha256_file sha256_file_hex sha256_file_b64 sha256_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha384 sha384_hex sha384_b64 sha384_b64u sha384_file sha384_file_hex sha384_file_b64 sha384_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha3_224 sha3_224_hex sha3_224_b64 sha3_224_b64u sha3_224_file sha3_224_file_hex sha3_224_file_b64 sha3_224_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha3_256 sha3_256_hex sha3_256_b64 sha3_256_b64u sha3_256_file sha3_256_file_hex sha3_256_file_b64 sha3_256_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha3_384 sha3_384_hex sha3_384_b64 sha3_384_b64u sha3_384_file sha3_384_file_hex sha3_384_file_b64 sha3_384_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha3_512 sha3_512_hex sha3_512_b64 sha3_512_b64u sha3_512_file sha3_512_file_hex sha3_512_file_b64 sha3_512_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha512 sha512_hex sha512_b64 sha512_b64u sha512_file sha512_file_hex sha512_file_b64 sha512_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha512_224 sha512_224_hex sha512_224_b64 sha512_224_b64u sha512_224_file sha512_224_file_hex sha512_224_file_b64 sha512_224_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha512_256 sha512_256_hex sha512_256_b64 sha512_256_b64u sha512_256_file sha512_256_file_hex sha512_256_file_b64 sha512_256_file_b64u )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 use Carp;
77 $Carp::Internal{(__PACKAGE__)}++;
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( tiger192 tiger192_hex tiger192_b64 tiger192_b64u tiger192_file tiger192_file_hex tiger192_file_b64 tiger192_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( whirlpool whirlpool_hex whirlpool_b64 whirlpool_b64u whirlpool_file whirlpool_file_hex whirlpool_file_b64 whirlpool_file_b64u )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw( digest_data digest_data_hex digest_data_b64 digest_data_b64u digest_file digest_file_hex digest_file_b64 digest_file_b64u )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw(pbkdf1 pbkdf2 hkdf hkdf_expand hkdf_extract)] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2b blake2b_hex blake2b_b64 blake2b_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2s blake2s_hex blake2s_b64 blake2s_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( f9 f9_hex f9_b64 f9_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( hmac hmac_hex hmac_b64 hmac_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( omac omac_hex omac_b64 omac_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( pmac pmac_hex pmac_b64 pmac_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( pelican pelican_hex pelican_b64 pelican_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( poly1305 poly1305_hex poly1305_b64 poly1305_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( xcbc xcbc_hex xcbc_b64 xcbc_b64u )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 use Carp;
77 $Carp::Internal{(__PACKAGE__)}++;
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import';
77 use Carp 'croak';
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use Crypt::Cipher;
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use Crypt::Cipher;
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use Crypt::Cipher;
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use Crypt::Cipher;
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.063';
6 our $VERSION = '0.064';
77
88 use Crypt::Cipher;
99
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 ### not used
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw( dh_shared_secret )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw( dsa_encrypt dsa_decrypt dsa_sign_message dsa_verify_message dsa_sign_hash dsa_verify_hash )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw( ecc_encrypt ecc_decrypt ecc_sign_message ecc_verify_message ecc_sign_hash ecc_verify_hash ecc_shared_secret )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw(rsa_encrypt rsa_decrypt rsa_sign_message rsa_verify_message rsa_sign_hash rsa_verify_hash)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 use Carp;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 use base qw(Crypt::PRNG Exporter);
77 our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 use base qw(Crypt::PRNG Exporter);
77 our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 use base qw(Crypt::PRNG Exporter);
77 our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 use base qw(Crypt::PRNG Exporter);
77 our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 use base qw(Crypt::PRNG Exporter);
77 our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings ;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 require XSLoader;
77 XSLoader::load('CryptX', $VERSION);
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.063';
4 our $VERSION = '0.064';
55
66 use CryptX;
77 use Carp;
+1686
-953
ppport.h less more
33 /*
44 ----------------------------------------------------------------------
55
6 ppport.h -- Perl/Pollution/Portability Version 3.36
7
8 Automatically created by Devel::PPPort running under perl 5.022003.
6 ppport.h -- Perl/Pollution/Portability Version 3.52
7
8 Automatically created by Devel::PPPort running under perl 5.026003.
99
1010 Do NOT edit this file directly! -- Edit PPPort_pm.PL and the
1111 includes in parts/inc/ instead.
2020
2121 =head1 NAME
2222
23 ppport.h - Perl/Pollution/Portability version 3.36
23 ppport.h - Perl/Pollution/Portability version 3.52
2424
2525 =head1 SYNOPSIS
2626
4545 --nochanges don't suggest changes
4646 --nofilter don't filter input files
4747
48 --strip strip all script and doc functionality from
49 ppport.h
48 --strip strip all script and doc functionality
49 from ppport.h
5050
5151 --list-provided list provided API
5252 --list-unsupported list unsupported API
5555 =head1 COMPATIBILITY
5656
5757 This version of F<ppport.h> is designed to support operation with Perl
58 installations back to 5.003, and has been tested up to 5.20.
58 installations back to 5.003, and has been tested up to 5.30.
5959
6060 =head1 OPTIONS
6161
220220 PL_signals NEED_PL_signals NEED_PL_signals_GLOBAL
221221 SvRX() NEED_SvRX NEED_SvRX_GLOBAL
222222 caller_cx() NEED_caller_cx NEED_caller_cx_GLOBAL
223 croak_xs_usage() NEED_croak_xs_usage NEED_croak_xs_usage_GLOBAL
224 die_sv() NEED_die_sv NEED_die_sv_GLOBAL
223225 eval_pv() NEED_eval_pv NEED_eval_pv_GLOBAL
224226 grok_bin() NEED_grok_bin NEED_grok_bin_GLOBAL
225227 grok_hex() NEED_grok_hex NEED_grok_hex_GLOBAL
228230 grok_oct() NEED_grok_oct NEED_grok_oct_GLOBAL
229231 gv_fetchpvn_flags() NEED_gv_fetchpvn_flags NEED_gv_fetchpvn_flags_GLOBAL
230232 load_module() NEED_load_module NEED_load_module_GLOBAL
233 mess() NEED_mess NEED_mess_GLOBAL
234 mess_nocontext() NEED_mess_nocontext NEED_mess_nocontext_GLOBAL
235 mess_sv() NEED_mess_sv NEED_mess_sv_GLOBAL
231236 mg_findext() NEED_mg_findext NEED_mg_findext_GLOBAL
232237 my_snprintf() NEED_my_snprintf NEED_my_snprintf_GLOBAL
233238 my_sprintf() NEED_my_sprintf NEED_my_sprintf_GLOBAL
234239 my_strlcat() NEED_my_strlcat NEED_my_strlcat_GLOBAL
235240 my_strlcpy() NEED_my_strlcpy NEED_my_strlcpy_GLOBAL
241 my_strnlen() NEED_my_strnlen NEED_my_strnlen_GLOBAL
236242 newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL
237243 newRV_noinc() NEED_newRV_noinc NEED_newRV_noinc_GLOBAL
238244 newSV_type() NEED_newSV_type NEED_newSV_type_GLOBAL
249255 sv_setpvf_mg() NEED_sv_setpvf_mg NEED_sv_setpvf_mg_GLOBAL
250256 sv_setpvf_mg_nocontext() NEED_sv_setpvf_mg_nocontext NEED_sv_setpvf_mg_nocontext_GLOBAL
251257 sv_unmagicext() NEED_sv_unmagicext NEED_sv_unmagicext_GLOBAL
258 utf8_to_uvchr_buf() NEED_utf8_to_uvchr_buf NEED_utf8_to_uvchr_buf_GLOBAL
252259 vload_module() NEED_vload_module NEED_vload_module_GLOBAL
260 vmess() NEED_vmess NEED_vmess_GLOBAL
253261 vnewSVpvf() NEED_vnewSVpvf NEED_vnewSVpvf_GLOBAL
254262 warner() NEED_warner NEED_warner_GLOBAL
255263
329337
330338 If F<ppport.h> was generated using the latest version of
331339 C<Devel::PPPort> and is causing failure of this module, please
332 file a bug report here: L<https://github.com/mhx/Devel-PPPort/issues/>
340 send a bug report to L<perlbug@perl.org|mailto:perlbug@perl.org>.
333341
334342 Please include the following information:
335343
380388 use strict;
381389
382390 # Disable broken TRIE-optimization
383 BEGIN { eval '${^RE_TRIE_MAXBUF} = -1' if $] >= 5.009004 && $] <= 5.009005 }
384
385 my $VERSION = 3.36;
391 BEGIN { eval '${^RE_TRIE_MAXBUF} = -1' if "$]" >= 5.009004 && "$]" <= 5.009005 }
392
393 my $VERSION = 3.52;
386394
387395 my %opt = (
388396 quiet => 0,
449457 (index($4, 'n') >= 0 ? ( nothxarg => 1 ) : ()),
450458 } )
451459 : die "invalid spec: $_" } qw(
452 ASCII_TO_NEED||5.007001|n
453460 AvFILLp|5.004050||p
454461 AvFILL|||
462 BOM_UTF8|||
455463 BhkDISABLE||5.024000|
456464 BhkENABLE||5.024000|
457465 BhkENTRY_set||5.024000|
540548 IVTYPE|5.006000||p
541549 IVdf|5.006000||p
542550 LEAVE|||
551 LIKELY|||p
543552 LINKLIST||5.013006|
544553 LVRET|||
545554 MARK|||
551560 MY_CXT|5.007003||p
552561 MoveD|5.009002|5.004050|p
553562 Move|||
554 NATIVE_TO_NEED||5.007001|n
555563 NOOP|5.005000||p
556564 NUM2PTR|5.006000||p
557565 NVTYPE|5.006000||p
596604 PERLIO_FUNCS_CAST|5.009003||p
597605 PERLIO_FUNCS_DECL|5.009003||p
598606 PERL_ABS|5.008001||p
607 PERL_ARGS_ASSERT_CROAK_XS_USAGE|||p
599608 PERL_BCDVERSION|5.024000||p
600609 PERL_GCC_BRACE_GROUPS_FORBIDDEN|5.008001||p
601610 PERL_HASH|5.003070||p
743752 PL_sv_no|5.004050||pn
744753 PL_sv_undef|5.004050||pn
745754 PL_sv_yes|5.004050||pn
755 PL_sv_zero|||n
746756 PL_tainted|5.004050||p
747757 PL_tainting|5.004050||p
748758 PL_tokenbuf|5.024000||p
819829 PerlIO_tell||5.007003|
820830 PerlIO_unread||5.007003|
821831 PerlIO_write||5.007003|
822 Perl_signbit||5.009005|n
832 PerlLIO_dup2_cloexec|||
833 PerlLIO_dup_cloexec|||
834 PerlLIO_open3_cloexec|||
835 PerlLIO_open_cloexec|||
836 PerlProc_pipe_cloexec|||
837 PerlSock_accept_cloexec|||
838 PerlSock_socket_cloexec|||
839 PerlSock_socketpair_cloexec|||
840 Perl_langinfo|||n
841 Perl_setlocale|||n
823842 PoisonFree|5.009004||p
824843 PoisonNew|5.009004||p
825844 PoisonWith|5.009004||p
826845 Poison|5.008000||p
827846 READ_XDIGIT||5.017006|
847 REPLACEMENT_CHARACTER_UTF8|||
828848 RESTORE_LC_NUMERIC||5.024000|
829849 RETVAL|||n
830850 Renewc|||
926946 SvPOK_on|||
927947 SvPOKp|||
928948 SvPOK|||
949 SvPVCLEAR|||
929950 SvPVX_const|5.009003||p
930951 SvPVX_mutable|5.009003||p
931952 SvPVX|||
963984 SvPVutf8||5.006000|
964985 SvPVx|||
965986 SvPV|||
987 SvREADONLY_off|||
988 SvREADONLY_on|||
989 SvREADONLY|||
966990 SvREFCNT_dec_NN||5.017007|
967991 SvREFCNT_dec|||
968992 SvREFCNT_inc_NN|5.009004||p
10141038 SvVSTRING_mg|5.009004||p
10151039 THIS|||n
10161040 UNDERBAR|5.009002||p
1041 UNICODE_REPLACEMENT|||p
1042 UNLIKELY|||p
10171043 UTF8SKIP||5.006000|
1044 UTF8_IS_INVARIANT|||
1045 UTF8_IS_NONCHAR|||
1046 UTF8_IS_SUPER|||
1047 UTF8_IS_SURROGATE|||
10181048 UTF8_MAXBYTES|5.009002||p
1049 UTF8_SAFE_SKIP|||p
1050 UVCHR_IS_INVARIANT|||
10191051 UVCHR_SKIP||5.022000|
10201052 UVSIZE|5.006000||p
10211053 UVTYPE|5.006000||p
11131145 XopFLAGS||5.013007|
11141146 ZeroD|5.009002||p
11151147 Zero|||
1148 __ASSERT_|||p
11161149 _aMY_CXT|5.007003||p
1117 _add_range_to_invlist|||
1118 _append_range_to_invlist|||
1119 _core_swash_init|||
1120 _get_encoding|||
1121 _get_regclass_nonbitmap_data|||
1122 _get_swash_invlist|||
1123 _invlistEQ|||
1124 _invlist_array_init|||n
1125 _invlist_contains_cp|||n
1126 _invlist_dump|||
1127 _invlist_intersection_maybe_complement_2nd|||
1128 _invlist_intersection|||
1129 _invlist_invert|||
1130 _invlist_len|||n
1131 _invlist_populate_swatch|||n
1132 _invlist_search|||n
1133 _invlist_subtract|||
1134 _invlist_union_maybe_complement_2nd|||
1135 _invlist_union|||
1136 _is_cur_LC_category_utf8|||
1137 _is_in_locale_category||5.021001|
1138 _is_uni_FOO||5.017008|
1139 _is_uni_perl_idcont||5.017008|
1140 _is_uni_perl_idstart||5.017007|
1141 _is_utf8_FOO||5.017008|
1142 _is_utf8_char_slow||5.021001|n
1143 _is_utf8_idcont||5.021001|
1144 _is_utf8_idstart||5.021001|
1145 _is_utf8_mark||5.017008|
1146 _is_utf8_perl_idcont||5.017008|
1147 _is_utf8_perl_idstart||5.017007|
1148 _is_utf8_xidcont||5.021001|
1149 _is_utf8_xidstart||5.021001|
1150 _load_PL_utf8_foldclosures|||
1151 _make_exactf_invlist|||
1150 _inverse_folds|||
1151 _is_grapheme|||
1152 _is_in_locale_category|||
11521153 _new_invlist_C_array|||
1153 _new_invlist|||
11541154 _pMY_CXT|5.007003||p
1155 _setlocale_debug_string|||n
1156 _setup_canned_invlist|||
1157 _swash_inversion_hash|||
1158 _swash_to_invlist|||
1159 _to_fold_latin1|||
1160 _to_uni_fold_flags||5.014000|
1155 _to_fold_latin1|||n
11611156 _to_upper_title_latin1|||
11621157 _to_utf8_case|||
1163 _to_utf8_fold_flags||5.019009|
1164 _to_utf8_lower_flags||5.019009|
1165 _to_utf8_title_flags||5.019009|
1166 _to_utf8_upper_flags||5.019009|
1158 _variant_byte_number|||n
11671159 _warn_problematic_locale|||n
11681160 aMY_CXT_|5.007003||p
11691161 aMY_CXT|5.007003||p
11711163 aTHXR|5.024000||p
11721164 aTHX_|5.006000||p
11731165 aTHX|5.006000||p
1166 abort_execution|||
11741167 add_above_Latin1_folds|||
1175 add_cp_to_invlist|||
11761168 add_data|||n
11771169 add_multi_match|||
11781170 add_utf16_textfilter|||
11801172 advance_one_LB|||
11811173 advance_one_SB|||
11821174 advance_one_WB|||
1183 alloc_maybe_populate_EXACT|||
1184 alloccopstash|||
11851175 allocmy|||
11861176 amagic_call|||
11871177 amagic_cmp_locale|||
11931183 anonymise_cv_maybe|||
11941184 any_dup|||
11951185 ao|||
1196 append_utf8_from_native_byte||5.019004|n
11971186 apply_attrs_my|||
1198 apply_attrs_string||5.006001|
11991187 apply_attrs|||
12001188 apply|||
1189 argvout_final|||
12011190 assert_uft8_cache_coherent|||
12021191 assignment_type|||
12031192 atfork_lock||5.007003|n
12041193 atfork_unlock||5.007003|n
12051194 av_arylen_p||5.009003|
12061195 av_clear|||
1207 av_create_and_push||5.009005|
1208 av_create_and_unshift_one||5.009005|
12091196 av_delete||5.006000|
12101197 av_exists||5.006000|
12111198 av_extend_guts|||
12151202 av_iter_p||5.011000|
12161203 av_len|||
12171204 av_make|||
1205 av_nonelem|||
12181206 av_pop|||
12191207 av_push|||
12201208 av_reify|||
12211209 av_shift|||
12221210 av_store|||
1223 av_tindex||5.017009|
1224 av_top_index||5.017009|
1211 av_tindex|5.017009|5.017009|p
1212 av_top_index|5.017009|5.017009|p
12251213 av_undef|||
12261214 av_unshift|||
12271215 ax|||n
1216 backup_one_GCB|||
12281217 backup_one_LB|||
12291218 backup_one_SB|||
12301219 backup_one_WB|||
12401229 boot_core_UNIVERSAL|||
12411230 boot_core_mro|||
12421231 bytes_cmp_utf8||5.013007|
1243 bytes_from_utf8||5.007001|
1244 bytes_to_utf8||5.006001|
12451232 cBOOL|5.013000||p
12461233 call_argv|5.006000||p
12471234 call_atexit||5.006000|
12561243 cast_iv||5.006000|n
12571244 cast_ulong||5.006000|n
12581245 cast_uv||5.006000|n
1259 check_locale_boundary_crossing|||
1246 category_name|||n
1247 change_engine_size|||
1248 check_and_deprecate|||
12601249 check_type_and_open|||
12611250 check_uni|||
1262 check_utf8_print|||
12631251 checkcomma|||
1252 ckWARN2_d|||
1253 ckWARN2|||
1254 ckWARN3_d|||
1255 ckWARN3|||
1256 ckWARN4_d|||
1257 ckWARN4|||
1258 ckWARN_d|||
12641259 ckWARN|5.006000||p
12651260 ck_entersub_args_core|||
12661261 ck_entersub_args_list||5.013006|
12721267 ckwarn_d||5.009003|
12731268 ckwarn||5.009003|
12741269 clear_defarray||5.023008|
1275 clear_placeholders|||
12761270 clear_special_blocks|||
12771271 clone_params_del|||n
12781272 clone_params_new|||n
12801274 cntrl_to_mnemonic|||n
12811275 compute_EXACTish|||n
12821276 construct_ahocorasick_from_trie|||
1283 cop_fetch_label||5.015001|
12841277 cop_free|||
12851278 cop_hints_2hv||5.013007|
12861279 cop_hints_fetch_pvn||5.013007|
12871280 cop_hints_fetch_pvs||5.013007|
12881281 cop_hints_fetch_pv||5.013007|
12891282 cop_hints_fetch_sv||5.013007|
1290 cop_store_label||5.015001|
12911283 cophh_2hv||5.013007|
12921284 cophh_copy||5.013007|
12931285 cophh_delete_pvn||5.013007|
13071299 core_prototype|||
13081300 coresub_op|||
13091301 cr_textfilter|||
1310 create_eval_scope|||
1311 croak_memory_wrap||5.019003|n
1302 croak_caller|||vn
1303 croak_memory_wrap|5.019003||pn
13121304 croak_no_mem|||n
1313 croak_no_modify||5.013003|n
1314 croak_nocontext|||vn
1305 croak_no_modify|5.013003||pn
1306 croak_nocontext|||pvn
13151307 croak_popstack|||n
1316 croak_sv||5.013001|
1317 croak_xs_usage||5.010001|n
1308 croak_sv|5.013001||p
1309 croak_xs_usage|5.010001||pn
13181310 croak|||v
13191311 csighandler||5.009003|n
13201312 current_re_engine|||
13241316 custom_op_name||5.007003|
13251317 custom_op_register||5.013007|
13261318 custom_op_xop||5.013007|
1327 cv_ckproto_len_flags|||
13281319 cv_clone_into|||
13291320 cv_clone|||
13301321 cv_const_sv_or_av|||n
13311322 cv_const_sv||5.003070|n
13321323 cv_dump|||
13331324 cv_forget_slab|||
1325 cv_get_call_checker_flags|||
13341326 cv_get_call_checker||5.013006|
13351327 cv_name||5.021005|
13361328 cv_set_call_checker_flags||5.021004|
13421334 cvstash_set|||
13431335 cx_dump||5.005000|
13441336 cx_dup|||
1345 cx_popblock||5.023008|
1346 cx_popeval||5.023008|
1347 cx_popformat||5.023008|
1348 cx_popgiven||5.023008|
1349 cx_poploop||5.023008|
1350 cx_popsub_args||5.023008|
1351 cx_popsub_common||5.023008|
1352 cx_popsub||5.023008|
1353 cx_popwhen||5.023008|
1354 cx_pushblock||5.023008|
1355 cx_pusheval||5.023008|
1356 cx_pushformat||5.023008|
1357 cx_pushgiven||5.023008|
1358 cx_pushloop_for||5.023008|
1359 cx_pushloop_plain||5.023008|
1360 cx_pushsub||5.023008|
1361 cx_pushwhen||5.023008|
1362 cx_topblock||5.023008|
13631337 cxinc|||
13641338 dAXMARK|5.009003||p
13651339 dAX|5.007002||p
13951369 deb||5.007003|v
13961370 defelem_target|||
13971371 del_sv|||
1398 delete_eval_scope|||
1372 delimcpy_no_escape|||n
13991373 delimcpy||5.004000|n
1400 deprecate_commaless_var_list|||
14011374 despatch_signals||5.007001|
14021375 destroy_matcher|||
14031376 die_nocontext|||vn
1404 die_sv||5.013001|
1377 die_sv|5.013001||p
14051378 die_unwind|||
14061379 die|||v
14071380 dirp_dup|||
14171390 do_dump_pad|||
14181391 do_eof|||
14191392 do_exec3|||
1420 do_execfree|||
14211393 do_exec|||
14221394 do_gv_dump||5.006000|
14231395 do_gvgv_dump||5.006000|
14311403 do_ncmp|||
14321404 do_oddball|||
14331405 do_op_dump||5.006000|
1434 do_open6|||
14351406 do_open9||5.006000|
1436 do_open_raw|||
14371407 do_openn||5.007001|
14381408 do_open||5.003070|
14391409 do_pmop_dump||5.006000|
14601430 do_vecset|||
14611431 do_vop|||
14621432 docatch|||
1433 does_utf8_overflow|||n
14631434 doeval_compile|||
14641435 dofile|||
14651436 dofindlabel|||
14931464 dump_mstats|||
14941465 dump_packsubs_perl|||
14951466 dump_packsubs||5.006000|
1467 dump_regex_sets_structures|||
14961468 dump_sub_perl|||
14971469 dump_sub||5.006000|
14981470 dump_sv_child|||
15021474 dump_vindent||5.006000|
15031475 dumpuntil|||
15041476 dup_attrlist|||
1477 dup_warnings|||
15051478 edit_distance|||n
1506 emulate_cop_io|||
1479 emulate_setlocale|||n
15071480 eval_pv|5.006000||p
15081481 eval_sv|5.006000||p
15091482 exec_failed|||
15251498 find_hash_subscript|||
15261499 find_in_my_stash|||
15271500 find_lexical_cv|||
1501 find_next_masked|||n
15281502 find_runcv_where|||
15291503 find_runcv||5.008001|
1530 find_rundefsvoffset||5.009002|
15311504 find_rundefsv||5.013002|
15321505 find_script|||
1533 find_uninit_var|||
1506 find_span_end_mask|||n
1507 find_span_end|||n
15341508 first_symbol|||n
15351509 fixup_errno_string|||
1510 foldEQ_latin1_s2_folded|||n
15361511 foldEQ_latin1||5.013008|n
15371512 foldEQ_locale||5.013002|n
1538 foldEQ_utf8_flags||5.013010|
15391513 foldEQ_utf8||5.013002|
15401514 foldEQ||5.013002|n
15411515 fold_constants|||
15491523 force_word|||
15501524 forget_pmop|||
15511525 form_nocontext|||vn
1552 form_short_octal_warning|||
15531526 form||5.004000|v
15541527 fp_dup|||
15551528 fprintf_nocontext|||vn
15581531 free_tied_hv_pool|||
15591532 free_tmps|||
15601533 gen_constant_list|||
1534 get_ANYOFM_contents|||
15611535 get_ANYOF_cp_list_for_ssc|||
1536 get_and_check_backslash_N_name_wrapper|||
15621537 get_and_check_backslash_N_name|||
15631538 get_aux_mg|||
15641539 get_av|5.006000||p
15721547 get_debug_opts|||
15731548 get_hash_seed|||
15741549 get_hv|5.006000||p
1575 get_invlist_iter_addr|||n
1576 get_invlist_offset_addr|||n
1577 get_invlist_previous_index_addr|||n
15781550 get_mstats|||
15791551 get_no_modify|||
15801552 get_num|||
15821554 get_op_names||5.005000|
15831555 get_opargs|||
15841556 get_ppaddr||5.006000|
1585 get_re_arg|||
15861557 get_sv|5.006000||p
15871558 get_vtbl||5.005030|
15881559 getcwd_sv||5.007002|
15951566 grok_atoUV|||n
15961567 grok_bin|5.007003||p
15971568 grok_bslash_N|||
1598 grok_bslash_c|||
1599 grok_bslash_o|||
1600 grok_bslash_x|||
16011569 grok_hex|5.007003||p
16021570 grok_infnan||5.021004|
16031571 grok_number_flags||5.021002|
16311599 gv_fetchmeth_sv_autoload||5.015004|
16321600 gv_fetchmeth_sv||5.015004|
16331601 gv_fetchmethod_autoload||5.004000|
1634 gv_fetchmethod_pv_flags||5.015004|
1635 gv_fetchmethod_pvn_flags||5.015004|
1636 gv_fetchmethod_sv_flags||5.015004|
16371602 gv_fetchmethod|||
16381603 gv_fetchmeth|||
16391604 gv_fetchpvn_flags|5.009002||p
16611626 gv_stashpv|||
16621627 gv_stashsvpvn_cached|||
16631628 gv_stashsv|||
1664 gv_try_downgrade|||
16651629 handle_named_backref|||
16661630 handle_possible_posix|||
16671631 handle_regex_sets|||
1632 handle_user_defined_property|||
16681633 he_dup|||
16691634 hek_dup|||
16701635 hfree_next_entry|||
1671 hfreeentries|||
16721636 hsplit|||
16731637 hv_assert|||
16741638 hv_auxinit_internal|||n
16751639 hv_auxinit|||
1676 hv_backreferences_p|||
16771640 hv_clear_placeholders||5.009001|
16781641 hv_clear|||
16791642 hv_common_key_len||5.010000|
16801643 hv_common||5.010000|
16811644 hv_copy_hints_hv||5.009004|
16821645 hv_delayfree_ent||5.004000|
1683 hv_delete_common|||
16841646 hv_delete_ent||5.003070|
16851647 hv_delete|||
16861648 hv_eiter_p||5.009003|
16941656 hv_fetch|||
16951657 hv_fill||5.013002|
16961658 hv_free_ent_ret|||
1659 hv_free_entries|||
16971660 hv_free_ent||5.004000|
16981661 hv_iterinit|||
16991662 hv_iterkeysv||5.003070|
17001663 hv_iterkey|||
1701 hv_iternext_flags||5.008000|
17021664 hv_iternextsv|||
17031665 hv_iternext|||
17041666 hv_iterval|||
1705 hv_kill_backrefs|||
17061667 hv_ksplit||5.003070|
17071668 hv_magic_check|||n
17081669 hv_magic|||
17111672 hv_placeholders_get||5.009003|
17121673 hv_placeholders_p|||
17131674 hv_placeholders_set||5.009003|
1675 hv_pushkv|||
17141676 hv_rand_set||5.018000|
17151677 hv_riter_p||5.009003|
17161678 hv_riter_set||5.009003|
17171679 hv_scalar||5.009001|
17181680 hv_store_ent||5.003070|
1719 hv_store_flags||5.008000|
17201681 hv_stores|5.009004||p
17211682 hv_store|||
17221683 hv_undef_flags|||
17341695 init_dbargs|||
17351696 init_debugger|||
17361697 init_global_struct|||
1737 init_i18nl10n||5.006000|
1738 init_i18nl14n||5.006000|
17391698 init_ids|||
17401699 init_interp|||
17411700 init_main_stash|||
1701 init_named_cv|||
17421702 init_perllib|||
17431703 init_postdump_symbols|||
17441704 init_predump_symbols|||
17451705 init_stacks||5.005000|
17461706 init_tm||5.007002|
1707 init_uniprops|||
17471708 inplace_aassign|||
17481709 instr|||n
17491710 intro_my||5.004000|
17501711 intuit_method|||
17511712 intuit_more|||
17521713 invert|||
1753 invlist_array|||n
1754 invlist_clear|||
1755 invlist_clone|||
1756 invlist_contents|||
1757 invlist_extend|||
1758 invlist_highest|||n
1759 invlist_is_iterating|||n
1760 invlist_iterfinish|||n
1761 invlist_iterinit|||n
1762 invlist_iternext|||n
1763 invlist_max|||n
1764 invlist_previous_index|||n
1765 invlist_replace_list_destroys_src|||
1766 invlist_set_len|||
1767 invlist_set_previous_index|||n
1768 invlist_trim|||n
17691714 invoke_exception_hook|||
17701715 io_close|||
1716 isALNUMC_A|||p
17711717 isALNUMC|5.006000||p
1772 isALNUM_lazy||5.021001|
1773 isALPHANUMERIC||5.017008|
1774 isALPHA|||
1718 isALNUM_A|||p
1719 isALNUM|||p
1720 isALPHANUMERIC_A|||p
1721 isALPHANUMERIC|5.017008|5.017008|p
1722 isALPHA_A|||p
1723 isALPHA|||p
1724 isASCII_A|||p
17751725 isASCII|5.006000||p
1726 isBLANK_A|||p
17761727 isBLANK|5.006001||p
1728 isC9_STRICT_UTF8_CHAR|||n
1729 isCNTRL_A|||p
17771730 isCNTRL|5.006000||p
1778 isDIGIT|||
1779 isFOO_lc|||
1731 isDIGIT_A|||p
1732 isDIGIT|||p
1733 isFF_OVERLONG|||n
17801734 isFOO_utf8_lc|||
1781 isGCB|||n
1735 isGCB|||
1736 isGRAPH_A|||p
17821737 isGRAPH|5.006000||p
1783 isIDCONT||5.017008|
1784 isIDFIRST_lazy||5.021001|
1785 isIDFIRST|||
1738 isIDCONT_A|||p
1739 isIDCONT|5.017008|5.017008|p
1740 isIDFIRST_A|||p
1741 isIDFIRST|||p
17861742 isLB|||
1787 isLOWER|||
1788 isOCTAL||5.013005|
1743 isLOWER_A|||p
1744 isLOWER|||p
1745 isOCTAL_A|||p
1746 isOCTAL|5.013005|5.013005|p
1747 isPRINT_A|||p
17891748 isPRINT|5.004000||p
1749 isPSXSPC_A|||p
17901750 isPSXSPC|5.006001||p
1751 isPUNCT_A|||p
17911752 isPUNCT|5.006000||p
17921753 isSB|||
1793 isSPACE|||
1794 isUPPER|||
1795 isUTF8_CHAR||5.021001|
1754 isSCRIPT_RUN|||
1755 isSPACE_A|||p
1756 isSPACE|||p
1757 isSTRICT_UTF8_CHAR|||n
1758 isUPPER_A|||p
1759 isUPPER|||p
1760 isUTF8_CHAR_flags|||
1761 isUTF8_CHAR||5.021001|n
17961762 isWB|||
1797 isWORDCHAR||5.013006|
1763 isWORDCHAR_A|||p
1764 isWORDCHAR|5.013006|5.013006|p
1765 isXDIGIT_A|||p
17981766 isXDIGIT|5.006000||p
17991767 is_an_int|||
1800 is_ascii_string||5.011000|
1768 is_ascii_string||5.011000|n
1769 is_c9strict_utf8_string_loclen|||n
1770 is_c9strict_utf8_string_loc|||n
1771 is_c9strict_utf8_string|||n
18011772 is_handle_constructor|||n
18021773 is_invariant_string||5.021007|n
18031774 is_lvalue_sub||5.007001|
18041775 is_safe_syscall||5.019004|
18051776 is_ssc_worth_it|||n
1806 is_uni_alnum_lc||5.006000|
1807 is_uni_alnumc_lc||5.017007|
1808 is_uni_alnumc||5.017007|
1809 is_uni_alnum||5.006000|
1810 is_uni_alpha_lc||5.006000|
1811 is_uni_alpha||5.006000|
1812 is_uni_ascii_lc||5.006000|
1813 is_uni_ascii||5.006000|
1814 is_uni_blank_lc||5.017002|
1815 is_uni_blank||5.017002|
1816 is_uni_cntrl_lc||5.006000|
1817 is_uni_cntrl||5.006000|
1818 is_uni_digit_lc||5.006000|
1819 is_uni_digit||5.006000|
1820 is_uni_graph_lc||5.006000|
1821 is_uni_graph||5.006000|
1822 is_uni_idfirst_lc||5.006000|
1823 is_uni_idfirst||5.006000|
1824 is_uni_lower_lc||5.006000|
1825 is_uni_lower||5.006000|
1826 is_uni_print_lc||5.006000|
1827 is_uni_print||5.006000|
1828 is_uni_punct_lc||5.006000|
1829 is_uni_punct||5.006000|
1830 is_uni_space_lc||5.006000|
1831 is_uni_space||5.006000|
1832 is_uni_upper_lc||5.006000|
1833 is_uni_upper||5.006000|
1834 is_uni_xdigit_lc||5.006000|
1835 is_uni_xdigit||5.006000|
1836 is_utf8_alnumc||5.017007|
1837 is_utf8_alnum||5.006000|
1838 is_utf8_alpha||5.006000|
1839 is_utf8_ascii||5.006000|
1840 is_utf8_blank||5.017002|
1777 is_strict_utf8_string_loclen|||n
1778 is_strict_utf8_string_loc|||n
1779 is_strict_utf8_string|||n
18411780 is_utf8_char_buf||5.015008|n
1842 is_utf8_char||5.006000|n
1843 is_utf8_cntrl||5.006000|
1781 is_utf8_common_with_len|||
18441782 is_utf8_common|||
1845 is_utf8_digit||5.006000|
1846 is_utf8_graph||5.006000|
1847 is_utf8_idcont||5.008000|
1848 is_utf8_idfirst||5.006000|
1849 is_utf8_lower||5.006000|
1850 is_utf8_mark||5.006000|
1851 is_utf8_perl_space||5.011001|
1852 is_utf8_perl_word||5.011001|
1853 is_utf8_posix_digit||5.011001|
1854 is_utf8_print||5.006000|
1855 is_utf8_punct||5.006000|
1856 is_utf8_space||5.006000|
1783 is_utf8_cp_above_31_bits|||n
1784 is_utf8_fixed_width_buf_flags|||n
1785 is_utf8_fixed_width_buf_loc_flags|||n
1786 is_utf8_fixed_width_buf_loclen_flags|||n
1787 is_utf8_invariant_string_loc|||n
1788 is_utf8_invariant_string|||n
1789 is_utf8_non_invariant_string|||n
1790 is_utf8_overlong_given_start_byte_ok|||n
1791 is_utf8_string_flags|||n
1792 is_utf8_string_loc_flags|||n
1793 is_utf8_string_loclen_flags|||n
18571794 is_utf8_string_loclen||5.009003|n
18581795 is_utf8_string_loc||5.008001|n
18591796 is_utf8_string||5.006001|n
1860 is_utf8_upper||5.006000|
1861 is_utf8_xdigit||5.006000|
1862 is_utf8_xidcont||5.013010|
1863 is_utf8_xidfirst||5.013010|
1797 is_utf8_valid_partial_char_flags|||n
1798 is_utf8_valid_partial_char|||n
18641799 isa_lookup|||
18651800 isinfnansv|||
18661801 isinfnan||5.021004|n
18701805 join_exact|||
18711806 keyword_plugin_standard|||
18721807 keyword|||
1873 leave_adjust_stacks||5.023008|
18741808 leave_scope|||
1875 lex_bufutf8||5.011002|
1876 lex_discard_to||5.011002|
1877 lex_grow_linestr||5.011002|
1878 lex_next_chunk||5.011002|
1879 lex_peek_unichar||5.011002|
1880 lex_read_space||5.011002|
1881 lex_read_to||5.011002|
1882 lex_read_unichar||5.011002|
1883 lex_start||5.009005|
1884 lex_stuff_pvn||5.011002|
18851809 lex_stuff_pvs||5.013005|
1886 lex_stuff_pv||5.013006|
1887 lex_stuff_sv||5.011002|
1888 lex_unstuff||5.011002|
18891810 listkids|||
18901811 list|||
18911812 load_module_nocontext|||vn
19501871 magic_setlvref|||
19511872 magic_setmglob|||
19521873 magic_setnkeys|||
1874 magic_setnonelem|||
19531875 magic_setpack|||
19541876 magic_setpos|||
19551877 magic_setregexp|||
19821904 mem_log_free|||n
19831905 mem_log_realloc|||n
19841906 mess_alloc|||
1985 mess_nocontext|||vn
1986 mess_sv||5.013001|
1987 mess||5.006000|v
1907 mess_nocontext|||pvn
1908 mess_sv|5.013001||p
1909 mess|5.006000||pv
19881910 mfree||5.007002|n
19891911 mg_clear|||
19901912 mg_copy|||
19931915 mg_findext|5.013008||pn
19941916 mg_find|||n
19951917 mg_free_type||5.013006|
1918 mg_freeext|||
19961919 mg_free|||
19971920 mg_get|||
1998 mg_length||5.005000|
19991921 mg_localize|||
20001922 mg_magical|||n
20011923 mg_set|||
20241946 mro_set_mro||5.010001|
20251947 mro_set_private_data||5.010001|
20261948 mul128|||
2027 mulexp10|||n
1949 multiconcat_stringify|||
20281950 multideref_stringify|||
20291951 my_atof2||5.007002|
1952 my_atof3|||
20301953 my_atof||5.006000|
20311954 my_attrs|||
2032 my_bcopy||5.004050|n
20331955 my_bytes_to_utf8|||n
2034 my_bzero|||n
20351956 my_chsize|||
20361957 my_clearenv|||
20371958 my_cxt_index|||
20451966 my_kid|||
20461967 my_lstat_flags|||
20471968 my_lstat||5.024000|
2048 my_memcmp|||n
2049 my_memset|||n
1969 my_memrchr|||n
1970 my_mkostemp|||n
1971 my_mkstemp_cloexec|||n
1972 my_mkstemp|||n
1973 my_nl_langinfo|||n
20501974 my_pclose||5.003070|
20511975 my_popen_list||5.007001|
20521976 my_popen||5.003070|
20531977 my_setenv|||
2054 my_setlocale|||
20551978 my_snprintf|5.009004||pvn
20561979 my_socketpair||5.007003|n
20571980 my_sprintf|5.009003||pvn
20581981 my_stat_flags|||
20591982 my_stat||5.024000|
2060 my_strerror||5.021001|
1983 my_strerror|||
20611984 my_strftime||5.007002|
20621985 my_strlcat|5.009004||pn
20631986 my_strlcpy|5.009004||pn
1987 my_strnlen|||pn
1988 my_strtod|||n
20641989 my_unexec|||
20651990 my_vsnprintf||5.009004|n
20661991 need_utf8|||n
20832008 newFOROP||5.013007|
20842009 newGIVENOP||5.009003|
20852010 newGIVWHENOP|||
2086 newGP|||
20872011 newGVOP|||
20882012 newGVREF|||
20892013 newGVgen_flags||5.015004|
21022026 newMYSUB||5.017004|
21032027 newNULLLIST|||
21042028 newOP|||
2105 newPADNAMELIST||5.021007|n
2106 newPADNAMEouter||5.021007|n
2107 newPADNAMEpvn||5.021007|n
21082029 newPADOP|||
21092030 newPMOP|||
21102031 newPROG|||
21372058 newSVpvs|5.009003||p
21382059 newSVpv|||
21392060 newSVrv|||
2061 newSVsv_flags|||
2062 newSVsv_nomg|||
21402063 newSVsv|||
21412064 newSVuv|5.006000||p
21422065 newSV|||
21452068 newWHENOP||5.009003|
21462069 newWHILEOP||5.013007|
21472070 newXS_deffile|||
2148 newXS_flags||5.009004|
21492071 newXS_len_flags|||
21502072 newXSproto||5.006000|
21512073 newXS||5.006000|
2152 new_collate||5.006000|
2074 new_collate|||
21532075 new_constant|||
2154 new_ctype||5.006000|
2076 new_ctype|||
21552077 new_he|||
21562078 new_logop|||
2157 new_numeric||5.006000|
2079 new_msg_hv|||
2080 new_numeric|||
2081 new_regcurly|||n
21582082 new_stackinfo||5.005000|
21592083 new_version||5.009000|
2160 new_warnings_bitfield|||
21612084 next_symbol|||
21622085 nextargv|||
21632086 nextchar|||
21692092 not_a_number|||
21702093 not_incrementable|||
21712094 nothreadhook||5.008000|
2095 notify_parser_that_changed_to_utf8|||
21722096 nuke_stacks|||
21732097 num_overflow|||n
21742098 oopsAV|||
21752099 oopsHV|||
21762100 op_append_elem||5.013006|
21772101 op_append_list||5.013006|
2102 op_class|||
21782103 op_clear|||
21792104 op_contextualize||5.013006|
21802105 op_convert_list||5.021006|
21832108 op_integerize|||
21842109 op_linklist||5.013006|
21852110 op_lvalue_flags|||
2186 op_lvalue||5.013007|
21872111 op_null||5.007002|
21882112 op_parent|||n
21892113 op_prepend_elem||5.013006|
2190 op_refcnt_dec|||
2191 op_refcnt_inc|||
21922114 op_refcnt_lock||5.009002|
21932115 op_refcnt_unlock||5.009002|
21942116 op_relocate_sv|||
2195 op_scope||5.013007|
21962117 op_sibling_splice||5.021002|n
21972118 op_std_init|||
2198 op_unscope|||
21992119 open_script|||
22002120 openn_cleanup|||
22012121 openn_setup|||
22032123 opslab_force_free|||
22042124 opslab_free_nopad|||
22052125 opslab_free|||
2206 output_or_return_posix_warnings|||
2126 optimize_optree|||
2127 optimize_op|||
2128 output_posix_warnings|||
22072129 pMY_CXT_|5.007003||p
22082130 pMY_CXT|5.007003||p
22092131 pTHX_|5.006000||p
22212143 pad_add_name_sv||5.015001|
22222144 pad_add_weakref|||
22232145 pad_alloc_name|||
2224 pad_alloc|||
22252146 pad_block_start|||
22262147 pad_check_dup|||
22272148 pad_compname_type||5.009003|
22392160 pad_setsv|||
22402161 pad_sv|||
22412162 pad_swipe|||
2242 pad_tidy||5.008001|
22432163 padlist_dup|||
22442164 padlist_store|||
22452165 padname_dup|||
22462166 padname_free|||
22472167 padnamelist_dup|||
2248 padnamelist_fetch||5.021007|n
22492168 padnamelist_free|||
2250 padnamelist_store||5.021007|
2251 parse_arithexpr||5.013008|
2252 parse_barestmt||5.013007|
2253 parse_block||5.013007|
22542169 parse_body|||
2255 parse_fullexpr||5.013008|
2256 parse_fullstmt||5.013005|
22572170 parse_gv_stash_name|||
22582171 parse_ident|||
2259 parse_label||5.013007|
2260 parse_listexpr||5.013008|
22612172 parse_lparen_question_flags|||
2262 parse_stmtseq||5.013006|
2263 parse_subsignature|||
2264 parse_termexpr||5.013008|
22652173 parse_unicode_opts|||
2174 parse_uniprop_string|||
22662175 parser_dup|||
22672176 parser_free_nexttoke_ops|||
22682177 parser_free|||
22912200 pregfree2||5.011000|
22922201 pregfree|||
22932202 prescan_version||5.011004|
2203 print_bytes_for_locale|||
2204 print_collxfrm_input_and_return|||
22942205 printbuf|||
22952206 printf_nocontext|||vn
22962207 process_special_blocks|||
22972208 ptr_hash|||n
2298 ptr_table_clear||5.009005|
22992209 ptr_table_fetch||5.009005|
23002210 ptr_table_find|||n
23012211 ptr_table_free||5.009005|
23132223 pv_pretty|5.009004||p
23142224 pv_uni_display||5.007003|
23152225 qerror|||
2316 qsortsvu|||
23172226 quadmath_format_needed|||n
23182227 quadmath_format_single|||n
23192228 re_compile||5.009005|
23612270 reg_numbered_buff_length|||
23622271 reg_numbered_buff_store|||
23632272 reg_qr_package|||
2364 reg_recode|||
23652273 reg_scan_name|||
23662274 reg_skipcomment|||n
23672275 reg_temp_copy|||
23682276 reganode|||
23692277 regatom|||
23702278 regbranch|||
2371 regclass_swash||5.009004|
23722279 regclass|||
2280 regcp_restore|||
23732281 regcppop|||
23742282 regcppush|||
23752283 regcurly|||n
24042312 require_pv||5.006000|
24052313 require_tie_mod|||
24062314 restore_magic|||
2315 restore_switched_locale|||
24072316 rninstr|||n
24082317 rpeep|||
24092318 rsignal_restore|||
24752384 save_sptr|||
24762385 save_strlen|||
24772386 save_svref|||
2387 save_to_buffer|||n
24782388 save_vptr||5.006000|
24792389 savepvn|||
24802390 savepvs||5.009003|
24862396 savestack_grow_cnt||5.008001|
24872397 savestack_grow|||
24882398 savesvpv||5.009002|
2489 savetmps||5.023008|
24902399 sawparens|||
24912400 scalar_mod_type|||n
24922401 scalarboolean|||
25052414 scan_num||5.007001|
25062415 scan_oct|||
25072416 scan_pat|||
2508 scan_str|||
25092417 scan_subst|||
25102418 scan_trans|||
25112419 scan_version||5.009001|
25122420 scan_vstring||5.009005|
2513 scan_word|||
25142421 search_const|||
25152422 seed||5.008001|
25162423 sequence_num|||
25172424 set_ANYOF_arg|||
25182425 set_caret_X|||
25192426 set_context||5.006000|n
2520 set_numeric_local||5.006000|
25212427 set_numeric_radix||5.006000|
25222428 set_numeric_standard||5.006000|
2429 set_numeric_underlying|||
25232430 set_padlist|||n
2431 set_regex_pv|||
25242432 setdefout|||
2433 setfd_cloexec_for_nonsysfd|||
2434 setfd_cloexec_or_inhexec_by_sysfdness|||
2435 setfd_cloexec|||n
2436 setfd_inhexec_for_sysfd|||
2437 setfd_inhexec|||n
2438 setlocale_debug_string|||n
25252439 share_hek_flags|||
25262440 share_hek||5.004000|
25272441 should_warn_nl|||n
25292443 sighandler|||n
25302444 simplify_sort|||
25312445 skip_to_be_ignored_text|||
2532 skipspace_flags|||
25332446 softref2xv|||
25342447 sortcv_stacked|||
25352448 sortcv_xsub|||
25512464 ssc_or|||
25522465 ssc_union|||
25532466 stack_grow|||
2554 start_glob|||
25552467 start_subparse||5.004000|
25562468 stdize_locale|||
25572469 strEQ|||
25782490 sv_2iv_flags||5.009001|
25792491 sv_2iv|||
25802492 sv_2mortal|||
2581 sv_2num|||
25822493 sv_2nv_flags||5.013001|
25832494 sv_2pv_flags|5.007002||p
25842495 sv_2pv_nolen|5.006000||p
26522563 sv_exp_grow|||
26532564 sv_force_normal_flags||5.007001|
26542565 sv_force_normal||5.006000|
2655 sv_free2|||
26562566 sv_free_arenas|||
26572567 sv_free|||
2658 sv_get_backrefs||5.021008|n
26592568 sv_gets||5.003070|
26602569 sv_grow|||
26612570 sv_i_ncmp|||
26662575 sv_isa|||
26672576 sv_isobject|||
26682577 sv_iv||5.005000|
2669 sv_kill_backrefs|||
26702578 sv_len_utf8_nomg|||
26712579 sv_len_utf8||5.006000|
26722580 sv_len|||
27122620 sv_report_used|||
27132621 sv_resetpvn|||
27142622 sv_reset|||
2623 sv_rvunweaken|||
27152624 sv_rvweaken||5.006000|
2625 sv_set_undef|||
27162626 sv_sethek|||
27172627 sv_setiv_mg|5.004050||p
27182628 sv_setiv|||
27192629 sv_setnv_mg|5.006000||p
27202630 sv_setnv|||
2631 sv_setpv_bufsize|||
27212632 sv_setpv_mg|5.004050||p
27222633 sv_setpvf_mg_nocontext|||pvn
27232634 sv_setpvf_mg|5.006000|5.004000|pv
27362647 sv_setref_pvs||5.024000|
27372648 sv_setref_pv|||
27382649 sv_setref_uv||5.007001|
2739 sv_setsv_cow|||
27402650 sv_setsv_flags||5.007002|
27412651 sv_setsv_mg|5.004050||p
27422652 sv_setsv_nomg|5.007002||p
27432653 sv_setsv|||
27442654 sv_setuv_mg|5.004050||p
27452655 sv_setuv|5.004000||p
2656 sv_string_from_errnum|||
27462657 sv_tainted||5.004000|
27472658 sv_taint||5.004000|
27482659 sv_true||5.005000|
27572668 sv_usepvn_flags||5.009004|
27582669 sv_usepvn_mg|5.004050||p
27592670 sv_usepvn|||
2760 sv_utf8_decode||5.006000|
2761 sv_utf8_downgrade||5.006000|
2671 sv_utf8_decode|||
2672 sv_utf8_downgrade|||
27622673 sv_utf8_encode||5.006000|
27632674 sv_utf8_upgrade_flags_grow||5.011000|
27642675 sv_utf8_upgrade_flags||5.007002|
27742685 sv_vsetpvf|5.006000|5.004000|p
27752686 svtype|||
27762687 swallow_bom|||
2777 swash_fetch||5.007002|
2778 swash_init||5.006000|
2779 swash_scan_list_line|||
27802688 swatch_get|||
2781 sync_locale||5.021004|
2689 switch_category_locale_to_template|||
2690 switch_to_global_locale|||n
2691 sync_locale||5.021004|n
27822692 sys_init3||5.010000|n
27832693 sys_init||5.010000|n
27842694 sys_intern_clear|||
27892699 taint_proper|||
27902700 tied_method|||v
27912701 tmps_grow_p|||
2702 toFOLD_utf8_safe|||
27922703 toFOLD_utf8||5.019001|
27932704 toFOLD_uvchr||5.023009|
27942705 toFOLD||5.019001|
27952706 toLOWER_L1||5.019001|
27962707 toLOWER_LC||5.004000|
2708 toLOWER_utf8_safe|||
27972709 toLOWER_utf8||5.015007|
27982710 toLOWER_uvchr||5.023009|
27992711 toLOWER|||
2712 toTITLE_utf8_safe|||
28002713 toTITLE_utf8||5.015007|
28012714 toTITLE_uvchr||5.023009|
28022715 toTITLE||5.019001|
2716 toUPPER_utf8_safe|||
28032717 toUPPER_utf8||5.015007|
28042718 toUPPER_uvchr||5.023009|
28052719 toUPPER|||
28062720 to_byte_substr|||
28072721 to_lower_latin1|||n
2808 to_uni_fold||5.007003|
2809 to_uni_lower_lc||5.006000|
2810 to_uni_lower||5.007003|
2811 to_uni_title_lc||5.006000|
2812 to_uni_title||5.007003|
2813 to_uni_upper_lc||5.006000|
2814 to_uni_upper||5.007003|
2815 to_utf8_case||5.007003|
2816 to_utf8_fold||5.015007|
2817 to_utf8_lower||5.015007|
28182722 to_utf8_substr|||
2819 to_utf8_title||5.015007|
2820 to_utf8_upper||5.015007|
28212723 tokenize_use|||
28222724 tokeq|||
28232725 tokereport|||
28242726 too_few_arguments_pv|||
28252727 too_many_arguments_pv|||
28262728 translate_substr_offsets|||n
2729 traverse_op_tree|||
28272730 try_amagic_bin|||
28282731 try_amagic_un|||
2732 turkic_fc|||
2733 turkic_lc|||
2734 turkic_uc|||
28292735 uiv_2buf|||n
28302736 unlnk|||
28312737 unpack_rec|||
28432749 utf16_to_utf8_reversed||5.006001|
28442750 utf16_to_utf8||5.006001|
28452751 utf8_distance||5.006000|
2752 utf8_hop_back|||n
2753 utf8_hop_forward|||n
2754 utf8_hop_safe|||n
28462755 utf8_hop||5.006000|n
28472756 utf8_length||5.007001|
28482757 utf8_mg_len_cache_update|||
28492758 utf8_mg_pos_cache_update|||
2850 utf8_to_bytes||5.006001|
2851 utf8_to_uvchr_buf||5.015009|
2852 utf8_to_uvchr||5.007001|
2853 utf8_to_uvuni_buf||5.015009|
2854 utf8_to_uvuni||5.007001|
2855 utf8n_to_uvchr||5.007001|
2759 utf8_to_uvchr_buf|5.015009|5.015009|p
2760 utf8_to_uvchr|||p
2761 utf8n_to_uvchr_error|||n
2762 utf8n_to_uvchr||5.007001|n
28562763 utf8n_to_uvuni||5.007001|
28572764 utilize|||
28582765 uvchr_to_utf8_flags||5.007003|
28602767 uvoffuni_to_utf8_flags||5.019004|
28612768 uvuni_to_utf8_flags||5.007003|
28622769 uvuni_to_utf8||5.007001|
2863 valid_utf8_to_uvchr||5.015009|
2864 valid_utf8_to_uvuni||5.015009|
2865 validate_proto|||
2770 valid_utf8_to_uvchr|||n
28662771 validate_suid|||
2772 variant_under_utf8_count|||n
28672773 varname|||
28682774 vcmp||5.009000|
28692775 vcroak||5.006000|
28732779 vivify_defelem|||
28742780 vivify_ref|||
28752781 vload_module|5.006000||p
2876 vmess||5.006000|
2782 vmess|5.006000|5.006000|p
28772783 vnewSVpvf|5.006000|5.004000|p
28782784 vnormal||5.009002|
28792785 vnumify||5.009000|
28822788 vwarner||5.006000|
28832789 vwarn||5.006000|
28842790 wait4pid|||
2885 warn_nocontext|||vn
2886 warn_sv||5.013001|
2791 warn_nocontext|||pvn
2792 warn_on_first_deprecated_use|||
2793 warn_sv|5.013001||p
28872794 warner_nocontext|||vn
28882795 warner|5.006000|5.004000|pv
28892796 warn|||v
28942801 whichsig_sv||5.015004|
28952802 whichsig|||
28962803 win32_croak_not_implemented|||n
2804 win32_setlocale|||
28972805 with_queued_errors|||
28982806 wrap_op_checker||5.015008|
28992807 write_to_stderr|||
29052813 yyerror|||
29062814 yylex|||
29072815 yyparse|||
2816 yyquit|||
29082817 yyunlex|||
29092818 yywarn|||
29102819 );
36723581 # endif
36733582 #endif
36743583
3675 #define _dpppDEC2BCD(dec) ((((dec)/100)<<8)|((((dec)%100)/10)<<4)|((dec)%10))
3676 #define PERL_BCDVERSION ((_dpppDEC2BCD(PERL_REVISION)<<24)|(_dpppDEC2BCD(PERL_VERSION)<<12)|_dpppDEC2BCD(PERL_SUBVERSION))
3584 #define D_PPP_DEC2BCD(dec) ((((dec)/100)<<8)|((((dec)%100)/10)<<4)|((dec)%10))
3585 #define PERL_BCDVERSION ((D_PPP_DEC2BCD(PERL_REVISION)<<24)|(D_PPP_DEC2BCD(PERL_VERSION)<<12)|D_PPP_DEC2BCD(PERL_SUBVERSION))
36773586
36783587 /* It is very unlikely that anyone will try to use this with Perl 6
36793588 (or greater), but who knows.
40703979 #ifndef UVSIZE
40713980 # define UVSIZE IVSIZE
40723981 #endif
4073 #ifndef sv_setuv
4074 # define sv_setuv(sv, uv) \
4075 STMT_START { \
4076 UV TeMpUv = uv; \
4077 if (TeMpUv <= IV_MAX) \
4078 sv_setiv(sv, TeMpUv); \
4079 else \
4080 sv_setnv(sv, (double)TeMpUv); \
4081 } STMT_END
4082 #endif
4083 #ifndef newSVuv
4084 # define newSVuv(uv) ((uv) <= IV_MAX ? newSViv((IV)uv) : newSVnv((NV)uv))
4085 #endif
4086 #ifndef sv_2uv
4087 # define sv_2uv(sv) ((PL_Sv = (sv)), (UV) (SvNOK(PL_Sv) ? SvNV(PL_Sv) : sv_2nv(PL_Sv)))
4088 #endif
4089
4090 #ifndef SvUVX
4091 # define SvUVX(sv) ((UV)SvIVX(sv))
4092 #endif
4093
4094 #ifndef SvUVXx
4095 # define SvUVXx(sv) SvUVX(sv)
4096 #endif
4097
4098 #ifndef SvUV
4099 # define SvUV(sv) (SvIOK(sv) ? SvUVX(sv) : sv_2uv(sv))
4100 #endif
4101
4102 #ifndef SvUVx
4103 # define SvUVx(sv) ((PL_Sv = (sv)), SvUV(PL_Sv))
4104 #endif
4105
4106 /* Hint: sv_uv
4107 * Always use the SvUVx() macro instead of sv_uv().
4108 */
4109 #ifndef sv_uv
4110 # define sv_uv(sv) SvUVx(sv)
4111 #endif
4112
4113 #if !defined(SvUOK) && defined(SvIOK_UV)
4114 # define SvUOK(sv) SvIOK_UV(sv)
4115 #endif
4116 #ifndef XST_mUV
4117 # define XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)) )
4118 #endif
4119
4120 #ifndef XSRETURN_UV
4121 # define XSRETURN_UV(v) STMT_START { XST_mUV(0,v); XSRETURN(1); } STMT_END
4122 #endif
4123 #ifndef PUSHu
4124 # define PUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG; } STMT_END
4125 #endif
4126
4127 #ifndef XPUSHu
4128 # define XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END
4129 #endif
4130
4131 #ifdef HAS_MEMCMP
4132 #ifndef memNE
4133 # define memNE(s1,s2,l) (memcmp(s1,s2,l))
4134 #endif
4135
4136 #ifndef memEQ
4137 # define memEQ(s1,s2,l) (!memcmp(s1,s2,l))
4138 #endif
4139
4140 #else
4141 #ifndef memNE
4142 # define memNE(s1,s2,l) (bcmp(s1,s2,l))
4143 #endif
4144
4145 #ifndef memEQ
4146 # define memEQ(s1,s2,l) (!bcmp(s1,s2,l))
4147 #endif
4148
4149 #endif
4150 #ifndef memEQs
4151 # define memEQs(s1, l, s2) \
4152 (sizeof(s2)-1 == l && memEQ(s1, (s2 ""), (sizeof(s2)-1)))
4153 #endif
4154
4155 #ifndef memNEs
4156 # define memNEs(s1, l, s2) !memEQs(s1, l, s2)
4157 #endif
4158 #ifndef MoveD
4159 # define MoveD(s,d,n,t) memmove((char*)(d),(char*)(s), (n) * sizeof(t))
4160 #endif
4161
4162 #ifndef CopyD
4163 # define CopyD(s,d,n,t) memcpy((char*)(d),(char*)(s), (n) * sizeof(t))
4164 #endif
4165
4166 #ifdef HAS_MEMSET
4167 #ifndef ZeroD
4168 # define ZeroD(d,n,t) memzero((char*)(d), (n) * sizeof(t))
4169 #endif
4170
4171 #else
4172 #ifndef ZeroD
4173 # define ZeroD(d,n,t) ((void)memzero((char*)(d), (n) * sizeof(t)), d)
4174 #endif
4175
4176 #endif
4177 #ifndef PoisonWith
4178 # define PoisonWith(d,n,t,b) (void)memset((char*)(d), (U8)(b), (n) * sizeof(t))
4179 #endif
4180
4181 #ifndef PoisonNew
4182 # define PoisonNew(d,n,t) PoisonWith(d,n,t,0xAB)
4183 #endif
4184
4185 #ifndef PoisonFree
4186 # define PoisonFree(d,n,t) PoisonWith(d,n,t,0xEF)
4187 #endif
4188
4189 #ifndef Poison
4190 # define Poison(d,n,t) PoisonFree(d,n,t)
4191 #endif
4192 #ifndef Newx
4193 # define Newx(v,n,t) New(0,v,n,t)
4194 #endif
4195
4196 #ifndef Newxc
4197 # define Newxc(v,n,t,c) Newc(0,v,n,t,c)
4198 #endif
4199
4200 #ifndef Newxz
4201 # define Newxz(v,n,t) Newz(0,v,n,t)
4202 #endif
4203 #ifndef PERL_MAGIC_qr
4204 # define PERL_MAGIC_qr 'r'
4205 #endif
42063982 #ifndef cBOOL
42073983 # define cBOOL(cbool) ((cbool) ? (bool)1 : (bool)0)
42083984 #endif
42254001
42264002 #ifndef OpMAYBESIB_set
42274003 # define OpMAYBESIB_set(o, sib, parent) ((o)->op_sibling = (sib))
4004 #endif
4005
4006 #ifndef HEf_SVKEY
4007 # define HEf_SVKEY -2
4008 #endif
4009
4010 #if defined(DEBUGGING) && !defined(__COVERITY__)
4011 #ifndef __ASSERT_
4012 # define __ASSERT_(statement) assert(statement),
4013 #endif
4014
4015 #else
4016 #ifndef __ASSERT_
4017 # define __ASSERT_(statement)
4018 #endif
4019
42284020 #endif
42294021
42304022 #ifndef SvRX
42354027 extern void * DPPP_(my_SvRX)(pTHX_ SV *rv);
42364028 #endif
42374029
4030 #if defined(NEED_SvRX) || defined(NEED_SvRX_GLOBAL)
4031
42384032 #ifdef SvRX
42394033 # undef SvRX
42404034 #endif
42414035 #define SvRX(a) DPPP_(my_SvRX)(aTHX_ a)
42424036
4243 #if defined(NEED_SvRX) || defined(NEED_SvRX_GLOBAL)
42444037
42454038 void *
42464039 DPPP_(my_SvRX)(pTHX_ SV *rv)
44204213 #ifndef AvFILLp
44214214 # define AvFILLp AvFILL
44224215 #endif
4216 #ifndef av_tindex
4217 # define av_tindex AvFILL
4218 #endif
4219
4220 #ifndef av_top_index
4221 # define av_top_index AvFILL
4222 #endif
44234223 #ifndef ERRSV
44244224 # define ERRSV get_sv("@",FALSE)
44254225 #endif
45414341 typedef OP* (CPERLscope(*Perl_check_t)) (pTHX_ OP*);
45424342
45434343 #endif
4544 #ifndef isPSXSPC
4545 # define isPSXSPC(c) (isSPACE(c) || (c) == '\v')
4546 #endif
4547
4548 #ifndef isBLANK
4549 # define isBLANK(c) ((c) == ' ' || (c) == '\t')
4344
4345 #ifndef WIDEST_UTYPE
4346 # ifdef QUADKIND
4347 # ifdef U64TYPE
4348 # define WIDEST_UTYPE U64TYPE
4349 # else
4350 # define WIDEST_UTYPE Quad_t
4351 # endif
4352 # else
4353 # define WIDEST_UTYPE U32
4354 # endif
45504355 #endif
45514356
45524357 #ifdef EBCDIC
4553 #ifndef isALNUMC
4554 # define isALNUMC(c) isalnum(c)
4555 #endif
4556
4358
4359 /* This is the first version where these macros are fully correct. Relying on
4360 * the C library functions, as earlier releases did, causes problems with
4361 * locales */
4362 # if (PERL_BCDVERSION < 0x5022000)
4363 # undef isALNUM
4364 # undef isALNUM_A
4365 # undef isALNUMC
4366 # undef isALNUMC_A
4367 # undef isALPHA
4368 # undef isALPHA_A
4369 # undef isALPHANUMERIC
4370 # undef isALPHANUMERIC_A
4371 # undef isASCII
4372 # undef isASCII_A
4373 # undef isBLANK
4374 # undef isBLANK_A
4375 # undef isCNTRL
4376 # undef isCNTRL_A
4377 # undef isDIGIT
4378 # undef isDIGIT_A
4379 # undef isGRAPH
4380 # undef isGRAPH_A
4381 # undef isIDCONT
4382 # undef isIDCONT_A
4383 # undef isIDFIRST
4384 # undef isIDFIRST_A
4385 # undef isLOWER
4386 # undef isLOWER_A
4387 # undef isOCTAL
4388 # undef isOCTAL_A
4389 # undef isPRINT
4390 # undef isPRINT_A
4391 # undef isPSXSPC
4392 # undef isPSXSPC_A
4393 # undef isPUNCT
4394 # undef isPUNCT_A
4395 # undef isSPACE
4396 # undef isSPACE_A
4397 # undef isUPPER
4398 # undef isUPPER_A
4399 # undef isWORDCHAR
4400 # undef isWORDCHAR_A
4401 # undef isXDIGIT
4402 # undef isXDIGIT_A
4403 # endif
45574404 #ifndef isASCII
4558 # define isASCII(c) isascii(c)
4559 #endif
4560
4405 # define isASCII(c) (isCNTRL(c) || isPRINT(c))
4406 #endif
4407
4408 /* The below is accurate for all EBCDIC code pages supported by
4409 * all the versions of Perl overridden by this */
45614410 #ifndef isCNTRL
4562 # define isCNTRL(c) iscntrl(c)
4563 #endif
4564
4565 #ifndef isGRAPH
4566 # define isGRAPH(c) isgraph(c)
4567 #endif
4568
4569 #ifndef isPRINT
4570 # define isPRINT(c) isprint(c)
4571 #endif
4572
4573 #ifndef isPUNCT
4574 # define isPUNCT(c) ispunct(c)
4575 #endif
4576
4577 #ifndef isXDIGIT
4578 # define isXDIGIT(c) isxdigit(c)
4579 #endif
4580
4581 #else
4411 # define isCNTRL(c) ( (c) == '\0' || (c) == '\a' || (c) == '\b' \
4412 || (c) == '\f' || (c) == '\n' || (c) == '\r' \
4413 || (c) == '\t' || (c) == '\v' \
4414 || ((c) <= 3 && (c) >= 1) /* SOH, STX, ETX */ \
4415 || (c) == 7 /* U+7F DEL */ \
4416 || ((c) <= 0x13 && (c) >= 0x0E) /* SO, SI */ \
4417 /* DLE, DC[1-3] */ \
4418 || (c) == 0x18 /* U+18 CAN */ \
4419 || (c) == 0x19 /* U+19 EOM */ \
4420 || ((c) <= 0x1F && (c) >= 0x1C) /* [FGRU]S */ \
4421 || (c) == 0x26 /* U+17 ETB */ \
4422 || (c) == 0x27 /* U+1B ESC */ \
4423 || (c) == 0x2D /* U+05 ENQ */ \
4424 || (c) == 0x2E /* U+06 ACK */ \
4425 || (c) == 0x32 /* U+16 SYN */ \
4426 || (c) == 0x37 /* U+04 EOT */ \
4427 || (c) == 0x3C /* U+14 DC4 */ \
4428 || (c) == 0x3D /* U+15 NAK */ \
4429 || (c) == 0x3F /* U+1A SUB */ \
4430 )
4431 #endif
4432
4433 /* The ordering of the tests in this and isUPPER are to exclude most characters
4434 * early */
4435 #ifndef isLOWER
4436 # define isLOWER(c) ( (c) >= 'a' && (c) <= 'z' \
4437 && ( (c) <= 'i' \
4438 || ((c) >= 'j' && (c) <= 'r') \
4439 || (c) >= 's'))
4440 #endif
4441
4442 #ifndef isUPPER
4443 # define isUPPER(c) ( (c) >= 'A' && (c) <= 'Z' \
4444 && ( (c) <= 'I' \
4445 || ((c) >= 'J' && (c) <= 'R') \
4446 || (c) >= 'S'))
4447 #endif
4448
4449 #else /* Above is EBCDIC; below is ASCII */
4450
4451 # if (PERL_BCDVERSION < 0x5004000)
4452 /* The implementation of these in older perl versions can give wrong results if
4453 * the C program locale is set to other than the C locale */
4454 # undef isALNUM
4455 # undef isALNUM_A
4456 # undef isALPHA
4457 # undef isALPHA_A
4458 # undef isDIGIT
4459 # undef isDIGIT_A
4460 # undef isIDFIRST
4461 # undef isIDFIRST_A
4462 # undef isLOWER
4463 # undef isLOWER_A
4464 # undef isUPPER
4465 # undef isUPPER_A
4466 # endif
4467
4468 # if (PERL_BCDVERSION < 0x5008000)
4469 /* Hint: isCNTRL
4470 * Earlier perls omitted DEL */
4471 # undef isCNTRL
4472 # endif
4473
45824474 # if (PERL_BCDVERSION < 0x5010000)
45834475 /* Hint: isPRINT
45844476 * The implementation in older perl versions includes all of the
45864478 * Devel::PPPort always overrides a present buggy version.
45874479 */
45884480 # undef isPRINT
4481 # undef isPRINT_A
45894482 # endif
45904483
4591 #ifdef HAS_QUAD
4592 # ifdef U64TYPE
4593 # define WIDEST_UTYPE U64TYPE
4594 # else
4595 # define WIDEST_UTYPE Quad_t
4484 # if (PERL_BCDVERSION < 0x5014000)
4485 /* Hint: isASCII
4486 * The implementation in older perl versions always returned true if the
4487 * parameter was a signed char
4488 */
4489 # undef isASCII
4490 # undef isASCII_A
45964491 # endif
4597 #else
4598 # define WIDEST_UTYPE U32
4599 #endif
4600 #ifndef isALNUMC
4601 # define isALNUMC(c) (isALPHA(c) || isDIGIT(c))
4602 #endif
4603
4492
4493 # if (PERL_BCDVERSION < 0x5020000)
4494 /* Hint: isSPACE
4495 * The implementation in older perl versions didn't include \v */
4496 # undef isSPACE
4497 # undef isSPACE_A
4498 # endif
46044499 #ifndef isASCII
46054500 # define isASCII(c) ((WIDEST_UTYPE) (c) <= 127)
46064501 #endif
46094504 # define isCNTRL(c) ((WIDEST_UTYPE) (c) < ' ' || (c) == 127)
46104505 #endif
46114506
4507 #ifndef isLOWER
4508 # define isLOWER(c) ((c) >= 'a' && (c) <= 'z')
4509 #endif
4510
4511 #ifndef isUPPER
4512 # define isUPPER(c) ((c) <= 'Z' && (c) >= 'A')
4513 #endif
4514
4515 #endif /* Below are definitions common to EBCDIC and ASCII */
4516 #ifndef isALNUM
4517 # define isALNUM(c) isWORDCHAR(c)
4518 #endif
4519
4520 #ifndef isALNUMC
4521 # define isALNUMC(c) isALPHANUMERIC(c)
4522 #endif
4523
4524 #ifndef isALPHA
4525 # define isALPHA(c) (isUPPER(c) || isLOWER(c))
4526 #endif
4527
4528 #ifndef isALPHANUMERIC
4529 # define isALPHANUMERIC(c) (isALPHA(c) || isDIGIT(c))
4530 #endif
4531
4532 #ifndef isBLANK
4533 # define isBLANK(c) ((c) == ' ' || (c) == '\t')
4534 #endif
4535
4536 #ifndef isDIGIT
4537 # define isDIGIT(c) ((c) <= '9' && (c) >= '0')
4538 #endif
4539
46124540 #ifndef isGRAPH
4613 # define isGRAPH(c) (isALNUM(c) || isPUNCT(c))
4541 # define isGRAPH(c) (isWORDCHAR(c) || isPUNCT(c))
4542 #endif
4543
4544 #ifndef isIDCONT
4545 # define isIDCONT(c) isWORDCHAR(c)
4546 #endif
4547
4548 #ifndef isIDFIRST
4549 # define isIDFIRST(c) (isALPHA(c) || (c) == '_')
4550 #endif
4551
4552 #ifndef isOCTAL
4553 # define isOCTAL(c) (((WIDEST_UTYPE)((c)) & ~7) == '0')
46144554 #endif
46154555
46164556 #ifndef isPRINT
4617 # define isPRINT(c) (((c) >= 32 && (c) < 127))
4557 # define isPRINT(c) (isGRAPH(c) || (c) == ' ')
4558 #endif
4559
4560 #ifndef isPSXSPC
4561 # define isPSXSPC(c) isSPACE(c)
46184562 #endif
46194563
46204564 #ifndef isPUNCT
4621 # define isPUNCT(c) (((c) >= 33 && (c) <= 47) || ((c) >= 58 && (c) <= 64) || ((c) >= 91 && (c) <= 96) || ((c) >= 123 && (c) <= 126))
4565 # define isPUNCT(c) ( (c) == '-' || (c) == '!' || (c) == '"' \
4566 || (c) == '#' || (c) == '$' || (c) == '%' \
4567 || (c) == '&' || (c) == '\'' || (c) == '(' \
4568 || (c) == ')' || (c) == '*' || (c) == '+' \
4569 || (c) == ',' || (c) == '.' || (c) == '/' \
4570 || (c) == ':' || (c) == ';' || (c) == '<' \
4571 || (c) == '=' || (c) == '>' || (c) == '?' \
4572 || (c) == '@' || (c) == '[' || (c) == '\\' \
4573 || (c) == ']' || (c) == '^' || (c) == '_' \
4574 || (c) == '`' || (c) == '{' || (c) == '|' \
4575 || (c) == '}' || (c) == '~')
4576 #endif
4577
4578 #ifndef isSPACE
4579 # define isSPACE(c) ( isBLANK(c) || (c) == '\n' || (c) == '\r' \
4580 || (c) == '\v' || (c) == '\f')
4581 #endif
4582
4583 #ifndef isWORDCHAR
4584 # define isWORDCHAR(c) (isALPHANUMERIC(c) || (c) == '_')
46224585 #endif
46234586
46244587 #ifndef isXDIGIT
4625 # define isXDIGIT(c) (isDIGIT(c) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
4626 #endif
4627
4588 # define isXDIGIT(c) ( isDIGIT(c) \
4589 || ((c) >= 'a' && (c) <= 'f') \
4590 || ((c) >= 'A' && (c) <= 'F'))
4591 #endif
4592 #ifndef isALNUM_A
4593 # define isALNUM_A isALNUM
4594 #endif
4595
4596 #ifndef isALNUMC_A
4597 # define isALNUMC_A isALNUMC
4598 #endif
4599
4600 #ifndef isALPHA_A
4601 # define isALPHA_A isALPHA
4602 #endif
4603
4604 #ifndef isALPHANUMERIC_A
4605 # define isALPHANUMERIC_A isALPHANUMERIC
4606 #endif
4607
4608 #ifndef isASCII_A
4609 # define isASCII_A isASCII
4610 #endif
4611
4612 #ifndef isBLANK_A
4613 # define isBLANK_A isBLANK
4614 #endif
4615
4616 #ifndef isCNTRL_A
4617 # define isCNTRL_A isCNTRL
4618 #endif
4619
4620 #ifndef isDIGIT_A
4621 # define isDIGIT_A isDIGIT
4622 #endif
4623
4624 #ifndef isGRAPH_A
4625 # define isGRAPH_A isGRAPH
4626 #endif
4627
4628 #ifndef isIDCONT_A
4629 # define isIDCONT_A isIDCONT
4630 #endif
4631
4632 #ifndef isIDFIRST_A
4633 # define isIDFIRST_A isIDFIRST
4634 #endif
4635
4636 #ifndef isLOWER_A
4637 # define isLOWER_A isLOWER
4638 #endif
4639
4640 #ifndef isOCTAL_A
4641 # define isOCTAL_A isOCTAL
4642 #endif
4643
4644 #ifndef isPRINT_A
4645 # define isPRINT_A isPRINT
4646 #endif
4647
4648 #ifndef isPSXSPC_A
4649 # define isPSXSPC_A isPSXSPC
4650 #endif
4651
4652 #ifndef isPUNCT_A
4653 # define isPUNCT_A isPUNCT
4654 #endif
4655
4656 #ifndef isSPACE_A
4657 # define isSPACE_A isSPACE
4658 #endif
4659
4660 #ifndef isUPPER_A
4661 # define isUPPER_A isUPPER
4662 #endif
4663
4664 #ifndef isWORDCHAR_A
4665 # define isWORDCHAR_A isWORDCHAR
4666 #endif
4667
4668 #ifndef isXDIGIT_A
4669 # define isXDIGIT_A isXDIGIT
46284670 #endif
46294671
46304672 /* Until we figure out how to support this in older perls... */
46424684
46434685 #ifndef C_ARRAY_END
46444686 # define C_ARRAY_END(a) ((a) + C_ARRAY_LENGTH(a))
4687 #endif
4688 #ifndef LIKELY
4689 # define LIKELY(x) (x)
4690 #endif
4691
4692 #ifndef UNLIKELY
4693 # define UNLIKELY(x) (x)
4694 #endif
4695 #ifndef UNICODE_REPLACEMENT
4696 # define UNICODE_REPLACEMENT 0xFFFD
4697 #endif
4698
4699 #ifndef MUTABLE_PTR
4700 #if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
4701 # define MUTABLE_PTR(p) ({ void *_p = (p); _p; })
4702 #else
4703 # define MUTABLE_PTR(p) ((void *) (p))
4704 #endif
4705 #endif
4706 #ifndef MUTABLE_SV
4707 # define MUTABLE_SV(p) ((SV *)MUTABLE_PTR(p))
4708 #endif
4709 #ifndef WARN_ALL
4710 # define WARN_ALL 0
4711 #endif
4712
4713 #ifndef WARN_CLOSURE
4714 # define WARN_CLOSURE 1
4715 #endif
4716
4717 #ifndef WARN_DEPRECATED
4718 # define WARN_DEPRECATED 2
4719 #endif
4720
4721 #ifndef WARN_EXITING
4722 # define WARN_EXITING 3
4723 #endif
4724
4725 #ifndef WARN_GLOB
4726 # define WARN_GLOB 4
4727 #endif
4728
4729 #ifndef WARN_IO
4730 # define WARN_IO 5
4731 #endif
4732
4733 #ifndef WARN_CLOSED
4734 # define WARN_CLOSED 6
4735 #endif
4736
4737 #ifndef WARN_EXEC
4738 # define WARN_EXEC 7
4739 #endif
4740
4741 #ifndef WARN_LAYER
4742 # define WARN_LAYER 8
4743 #endif
4744
4745 #ifndef WARN_NEWLINE
4746 # define WARN_NEWLINE 9
4747 #endif
4748
4749 #ifndef WARN_PIPE
4750 # define WARN_PIPE 10
4751 #endif
4752
4753 #ifndef WARN_UNOPENED
4754 # define WARN_UNOPENED 11
4755 #endif
4756
4757 #ifndef WARN_MISC
4758 # define WARN_MISC 12
4759 #endif
4760
4761 #ifndef WARN_NUMERIC
4762 # define WARN_NUMERIC 13
4763 #endif
4764
4765 #ifndef WARN_ONCE
4766 # define WARN_ONCE 14
4767 #endif
4768
4769 #ifndef WARN_OVERFLOW
4770 # define WARN_OVERFLOW 15
4771 #endif
4772
4773 #ifndef WARN_PACK
4774 # define WARN_PACK 16
4775 #endif
4776
4777 #ifndef WARN_PORTABLE
4778 # define WARN_PORTABLE 17
4779 #endif
4780
4781 #ifndef WARN_RECURSION
4782 # define WARN_RECURSION 18
4783 #endif
4784
4785 #ifndef WARN_REDEFINE
4786 # define WARN_REDEFINE 19
4787 #endif
4788
4789 #ifndef WARN_REGEXP
4790 # define WARN_REGEXP 20
4791 #endif
4792
4793 #ifndef WARN_SEVERE
4794 # define WARN_SEVERE 21
4795 #endif
4796
4797 #ifndef WARN_DEBUGGING
4798 # define WARN_DEBUGGING 22
4799 #endif
4800
4801 #ifndef WARN_INPLACE
4802 # define WARN_INPLACE 23
4803 #endif
4804
4805 #ifndef WARN_INTERNAL
4806 # define WARN_INTERNAL 24
4807 #endif
4808
4809 #ifndef WARN_MALLOC
4810 # define WARN_MALLOC 25
4811 #endif
4812
4813 #ifndef WARN_SIGNAL
4814 # define WARN_SIGNAL 26
4815 #endif
4816
4817 #ifndef WARN_SUBSTR
4818 # define WARN_SUBSTR 27
4819 #endif
4820
4821 #ifndef WARN_SYNTAX
4822 # define WARN_SYNTAX 28
4823 #endif
4824
4825 #ifndef WARN_AMBIGUOUS
4826 # define WARN_AMBIGUOUS 29
4827 #endif
4828
4829 #ifndef WARN_BAREWORD
4830 # define WARN_BAREWORD 30
4831 #endif
4832
4833 #ifndef WARN_DIGIT
4834 # define WARN_DIGIT 31
4835 #endif
4836
4837 #ifndef WARN_PARENTHESIS
4838 # define WARN_PARENTHESIS 32
4839 #endif
4840
4841 #ifndef WARN_PRECEDENCE
4842 # define WARN_PRECEDENCE 33
4843 #endif
4844
4845 #ifndef WARN_PRINTF
4846 # define WARN_PRINTF 34
4847 #endif
4848
4849 #ifndef WARN_PROTOTYPE
4850 # define WARN_PROTOTYPE 35
4851 #endif
4852
4853 #ifndef WARN_QW
4854 # define WARN_QW 36
4855 #endif
4856
4857 #ifndef WARN_RESERVED
4858 # define WARN_RESERVED 37
4859 #endif
4860
4861 #ifndef WARN_SEMICOLON
4862 # define WARN_SEMICOLON 38
4863 #endif
4864
4865 #ifndef WARN_TAINT
4866 # define WARN_TAINT 39
4867 #endif
4868
4869 #ifndef WARN_THREADS
4870 # define WARN_THREADS 40
4871 #endif
4872
4873 #ifndef WARN_UNINITIALIZED
4874 # define WARN_UNINITIALIZED 41
4875 #endif
4876
4877 #ifndef WARN_UNPACK
4878 # define WARN_UNPACK 42
4879 #endif
4880
4881 #ifndef WARN_UNTIE
4882 # define WARN_UNTIE 43
4883 #endif
4884
4885 #ifndef WARN_UTF8
4886 # define WARN_UTF8 44
4887 #endif
4888
4889 #ifndef WARN_VOID
4890 # define WARN_VOID 45
4891 #endif
4892
4893 #ifndef WARN_ASSERTIONS
4894 # define WARN_ASSERTIONS 46
4895 #endif
4896 #ifndef packWARN
4897 # define packWARN(a) (a)
4898 #endif
4899
4900 #ifndef ckWARN
4901 # ifdef G_WARN_ON
4902 # define ckWARN(a) (PL_dowarn & G_WARN_ON)
4903 # else
4904 # define ckWARN(a) PL_dowarn
4905 # endif
4906 #endif
4907
4908 #if (PERL_BCDVERSION >= 0x5004000) && !defined(warner)
4909 #if defined(NEED_warner)
4910 static void DPPP_(my_warner)(U32 err, const char *pat, ...);
4911 static
4912 #else
4913 extern void DPPP_(my_warner)(U32 err, const char *pat, ...);
4914 #endif
4915
4916 #if defined(NEED_warner) || defined(NEED_warner_GLOBAL)
4917
4918 #define Perl_warner DPPP_(my_warner)
4919
4920
4921 void
4922 DPPP_(my_warner)(U32 err, const char *pat, ...)
4923 {
4924 SV *sv;
4925 va_list args;
4926
4927 PERL_UNUSED_ARG(err);
4928
4929 va_start(args, pat);
4930 sv = vnewSVpvf(pat, &args);
4931 va_end(args);
4932 sv_2mortal(sv);
4933 warn("%s", SvPV_nolen(sv));
4934 }
4935
4936 #define warner Perl_warner
4937
4938 #define Perl_warner_nocontext Perl_warner
4939
4940 #endif
4941 #endif
4942
4943 #define _ppport_MIN(a,b) (((a) <= (b)) ? (a) : (b))
4944 #ifndef sv_setuv
4945 # define sv_setuv(sv, uv) \
4946 STMT_START { \
4947 UV TeMpUv = uv; \
4948 if (TeMpUv <= IV_MAX) \
4949 sv_setiv(sv, TeMpUv); \
4950 else \
4951 sv_setnv(sv, (double)TeMpUv); \
4952 } STMT_END
4953 #endif
4954 #ifndef newSVuv
4955 # define newSVuv(uv) ((uv) <= IV_MAX ? newSViv((IV)uv) : newSVnv((NV)uv))
4956 #endif
4957 #ifndef sv_2uv
4958 # define sv_2uv(sv) ((PL_Sv = (sv)), (UV) (SvNOK(PL_Sv) ? SvNV(PL_Sv) : sv_2nv(PL_Sv)))
4959 #endif
4960
4961 #ifndef SvUVX
4962 # define SvUVX(sv) ((UV)SvIVX(sv))
4963 #endif
4964
4965 #ifndef SvUVXx
4966 # define SvUVXx(sv) SvUVX(sv)
4967 #endif
4968
4969 #ifndef SvUV
4970 # define SvUV(sv) (SvIOK(sv) ? SvUVX(sv) : sv_2uv(sv))
4971 #endif
4972
4973 #ifndef SvUVx
4974 # define SvUVx(sv) ((PL_Sv = (sv)), SvUV(PL_Sv))
4975 #endif
4976
4977 /* Hint: sv_uv
4978 * Always use the SvUVx() macro instead of sv_uv().
4979 */
4980 #ifndef sv_uv
4981 # define sv_uv(sv) SvUVx(sv)
4982 #endif
4983
4984 #if !defined(SvUOK) && defined(SvIOK_UV)
4985 # define SvUOK(sv) SvIOK_UV(sv)
4986 #endif
4987 #ifndef XST_mUV
4988 # define XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)) )
4989 #endif
4990
4991 #ifndef XSRETURN_UV
4992 # define XSRETURN_UV(v) STMT_START { XST_mUV(0,v); XSRETURN(1); } STMT_END
4993 #endif
4994 #ifndef PUSHu
4995 # define PUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG; } STMT_END
4996 #endif
4997
4998 #ifndef XPUSHu
4999 # define XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END
5000 #endif
5001
5002 #if defined UTF8SKIP
5003
5004 /* Don't use official version because it uses MIN, which may not be available */
5005 #undef UTF8_SAFE_SKIP
5006 #ifndef UTF8_SAFE_SKIP
5007 # define UTF8_SAFE_SKIP(s, e) ( \
5008 ((((e) - (s)) <= 0) \
5009 ? 0 \
5010 : _ppport_MIN(((e) - (s)), UTF8SKIP(s))))
5011 #endif
5012
5013 #endif
5014
5015 #if !defined(my_strnlen)
5016 #if defined(NEED_my_strnlen)
5017 static STRLEN DPPP_(my_my_strnlen)(const char *str, Size_t maxlen);
5018 static
5019 #else
5020 extern STRLEN DPPP_(my_my_strnlen)(const char *str, Size_t maxlen);
5021 #endif
5022
5023 #if defined(NEED_my_strnlen) || defined(NEED_my_strnlen_GLOBAL)
5024
5025 #define my_strnlen DPPP_(my_my_strnlen)
5026 #define Perl_my_strnlen DPPP_(my_my_strnlen)
5027
5028
5029 STRLEN
5030 DPPP_(my_my_strnlen)(const char *str, Size_t maxlen)
5031 {
5032 const char *p = str;
5033
5034 while(maxlen-- && *p)
5035 p++;
5036
5037 return p - str;
5038 }
5039
5040 #endif
5041 #endif
5042
5043 #if (PERL_BCDVERSION < 0x5031002)
5044 /* Versions prior to this accepted things that are now considered
5045 * malformations, and didn't return -1 on error with warnings enabled
5046 * */
5047 # undef utf8_to_uvchr_buf
5048 #endif
5049
5050 /* This implementation brings modern, generally more restricted standards to
5051 * utf8_to_uvchr_buf. Some of these are security related, and clearly must
5052 * be done. But its arguable that the others need not, and hence should not.
5053 * The reason they're here is that a module that intends to play with the
5054 * latest perls shoud be able to work the same in all releases. An example is
5055 * that perl no longer accepts any UV for a code point, but limits them to
5056 * IV_MAX or below. This is for future internal use of the larger code points.
5057 * If it turns out that some of these changes are breaking code that isn't
5058 * intended to work with modern perls, the tighter restrictions could be
5059 * relaxed. khw thinks this is unlikely, but has been wrong in the past. */
5060
5061 #ifndef utf8_to_uvchr_buf
5062 /* Choose which underlying implementation to use. At least one must be
5063 * present or the perl is too early to handle this function */
5064 # if defined(utf8n_to_uvchr) || defined(utf8_to_uv)
5065 # if defined(utf8n_to_uvchr) /* This is the preferred implementation */
5066 # define _ppport_utf8_to_uvchr_buf_callee utf8n_to_uvchr
5067 # else
5068 # define _ppport_utf8_to_uvchr_buf_callee utf8_to_uv
5069 # endif
5070
5071 # endif
5072
5073 #ifdef _ppport_utf8_to_uvchr_buf_callee
5074 # if defined(NEED_utf8_to_uvchr_buf)
5075 static UV DPPP_(my_utf8_to_uvchr_buf)(pTHX_ const U8 * s, const U8 * send, STRLEN * retlen);
5076 static
5077 #else
5078 extern UV DPPP_(my_utf8_to_uvchr_buf)(pTHX_ const U8 * s, const U8 * send, STRLEN * retlen);
5079 #endif
5080
5081 #if defined(NEED_utf8_to_uvchr_buf) || defined(NEED_utf8_to_uvchr_buf_GLOBAL)
5082
5083 #ifdef utf8_to_uvchr_buf
5084 # undef utf8_to_uvchr_buf
5085 #endif
5086 #define utf8_to_uvchr_buf(a,b,c) DPPP_(my_utf8_to_uvchr_buf)(aTHX_ a,b,c)
5087 #define Perl_utf8_to_uvchr_buf DPPP_(my_utf8_to_uvchr_buf)
5088
5089
5090 UV
5091 DPPP_(my_utf8_to_uvchr_buf)(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen)
5092 {
5093 UV ret;
5094 STRLEN curlen;
5095 bool overflows = 0;
5096 const U8 *cur_s = s;
5097 const bool do_warnings = ckWARN_d(WARN_UTF8);
5098
5099 if (send > s) {
5100 curlen = send - s;
5101 }
5102 else {
5103 assert(0); /* Modern perls die under this circumstance */
5104 curlen = 0;
5105 if (! do_warnings) { /* Handle empty here if no warnings needed */
5106 if (retlen) *retlen = 0;
5107 return UNICODE_REPLACEMENT;
5108 }
5109 }
5110
5111 /* The modern version allows anything that evaluates to a legal UV, but not
5112 * overlongs nor an empty input */
5113 ret = _ppport_utf8_to_uvchr_buf_callee(
5114 s, curlen, retlen, (UTF8_ALLOW_ANYUV
5115 & ~(UTF8_ALLOW_LONG|UTF8_ALLOW_EMPTY)));
5116
5117 /* But actually, modern versions restrict the UV to being no more than what
5118 * an IV can hold */
5119 if (ret > PERL_INT_MAX) {
5120 overflows = 1;
5121 }
5122
5123 # if (PERL_BCDVERSION < 0x5026000)
5124 # ifndef EBCDIC
5125
5126 /* There are bugs in versions earlier than this on non-EBCDIC platforms
5127 * in which it did not detect all instances of overflow, which could be
5128 * a security hole. Also, earlier versions did not allow the overflow
5129 * malformation under any circumstances, and modern ones do. So we
5130 * need to check here. */
5131
5132 else if (curlen > 0 && *s >= 0xFE) {
5133
5134 /* If the main routine detected overflow, great; it returned 0. But if the
5135 * input's first byte indicates it could overflow, we need to verify.
5136 * First, on a 32-bit machine the first byte being at least \xFE
5137 * automatically is overflow */
5138 if (sizeof(ret) < 8) {
5139 overflows = 1;
5140 }
5141 else {
5142 const U8 highest[] = /* 2*63-1 */
5143 "\xFF\x80\x87\xBF\xBF\xBF\xBF\xBF\xBF\xBF\xBF\xBF\xBF";
5144 const U8 *cur_h = highest;
5145
5146 for (cur_s = s; cur_s < send; cur_s++, cur_h++) {
5147 if (UNLIKELY(*cur_s == *cur_h)) {
5148 continue;
5149 }
5150
5151 /* If this byte is larger than the corresponding highest UTF-8
5152 * byte, the sequence overflows; otherwise the byte is less than
5153 * (as we handled the equality case above), and so the sequence
5154 * doesn't overflow */
5155 overflows = *cur_s > *cur_h;
5156 break;
5157
5158 }
5159
5160 /* Here, either we set the bool and broke out of the loop, or got
5161 * to the end and all bytes are the same which indicates it doesn't
5162 * overflow. */
5163 }
5164 }
5165
5166 # endif
5167 # endif /* < 5.26 */
5168
5169 if (UNLIKELY(overflows)) {
5170 if (! do_warnings) {
5171 if (retlen) {
5172 *retlen = _ppport_MIN(*retlen, UTF8SKIP(s));
5173 *retlen = _ppport_MIN(*retlen, curlen);
5174 }
5175 return UNICODE_REPLACEMENT;
5176 }
5177 else {
5178
5179 /* On versions that correctly detect overflow, but forbid it
5180 * always, 0 will be returned, but also a warning will have been
5181 * raised. Don't repeat it */
5182 if (ret != 0) {
5183 /* We use the error message in use from 5.8-5.14 */
5184 Perl_warner(aTHX_ packWARN(WARN_UTF8),
5185 "Malformed UTF-8 character (overflow at 0x%" UVxf
5186 ", byte 0x%02x, after start byte 0x%02x)",
5187 ret, *cur_s, *s);
5188 }
5189 if (retlen) {
5190 *retlen = (STRLEN) -1;
5191 }
5192 return 0;
5193 }
5194 }
5195
5196 /* If failed and warnings are off, to emulate the behavior of the real
5197 * utf8_to_uvchr(), try again, allowing anything. (Note a return of 0 is
5198 * ok if the input was '\0') */
5199 if (UNLIKELY(ret == 0 && (curlen == 0 || *s != '\0'))) {
5200
5201 /* If curlen is 0, we already handled the case where warnings are
5202 * disabled, so this 'if' will be true, and we won't look at the
5203 * contents of 's' */
5204 if (do_warnings) {
5205 *retlen = (STRLEN) -1;
5206 }
5207 else {
5208 ret = _ppport_utf8_to_uvchr_buf_callee(
5209 s, curlen, retlen, UTF8_ALLOW_ANY);
5210 /* Override with the REPLACEMENT character, as that is what the
5211 * modern version of this function returns */
5212 ret = UNICODE_REPLACEMENT;
5213
5214 # if (PERL_BCDVERSION < 0x5016000)
5215
5216 /* Versions earlier than this don't necessarily return the proper
5217 * length. It should not extend past the end of string, nor past
5218 * what the first byte indicates the length is, nor past the
5219 * continuation characters */
5220 if (retlen && *retlen >= 0) {
5221 *retlen = _ppport_MIN(*retlen, curlen);
5222 *retlen = _ppport_MIN(*retlen, UTF8SKIP(s));
5223 unsigned int i = 1;
5224 do {
5225 if (s[i] < 0x80 || s[i] > 0xBF) {
5226 *retlen = i;
5227 break;
5228 }
5229 } while (++i < *retlen);
5230 }
5231
5232 # endif
5233
5234 }
5235 }
5236
5237 return ret;
5238 }
5239
5240 # endif
5241 #endif
5242 #endif
5243
5244 #if defined(UTF8SKIP) && defined(utf8_to_uvchr_buf)
5245 #undef utf8_to_uvchr /* Always redefine this unsafe function so that it refuses
5246 to read past a NUL, making it much less likely to read
5247 off the end of the buffer. A NUL indicates the start
5248 of the next character anyway. If the input isn't
5249 NUL-terminated, the function remains unsafe, as it
5250 always has been. */
5251 #ifndef utf8_to_uvchr
5252 # define utf8_to_uvchr(s, lp) \
5253 ((*(s) == '\0') \
5254 ? utf8_to_uvchr_buf(s,((s)+1), lp) /* Handle single NUL specially */ \
5255 : utf8_to_uvchr_buf(s, (s) + my_strnlen((char *) (s), UTF8SKIP(s)), (lp)))
5256 #endif
5257
5258 #endif
5259
5260 #ifdef HAS_MEMCMP
5261 #ifndef memNE
5262 # define memNE(s1,s2,l) (memcmp(s1,s2,l))
5263 #endif
5264
5265 #ifndef memEQ
5266 # define memEQ(s1,s2,l) (!memcmp(s1,s2,l))
5267 #endif
5268
5269 #else
5270 #ifndef memNE
5271 # define memNE(s1,s2,l) (bcmp(s1,s2,l))
5272 #endif
5273
5274 #ifndef memEQ
5275 # define memEQ(s1,s2,l) (!bcmp(s1,s2,l))
5276 #endif
5277
5278 #endif
5279 #ifndef memEQs
5280 # define memEQs(s1, l, s2) \
5281 (sizeof(s2)-1 == l && memEQ(s1, (s2 ""), (sizeof(s2)-1)))
5282 #endif
5283
5284 #ifndef memNEs
5285 # define memNEs(s1, l, s2) !memEQs(s1, l, s2)
5286 #endif
5287 #ifndef MoveD
5288 # define MoveD(s,d,n,t) memmove((char*)(d),(char*)(s), (n) * sizeof(t))
5289 #endif
5290
5291 #ifndef CopyD
5292 # define CopyD(s,d,n,t) memcpy((char*)(d),(char*)(s), (n) * sizeof(t))
5293 #endif
5294
5295 #ifdef HAS_MEMSET
5296 #ifndef ZeroD
5297 # define ZeroD(d,n,t) memzero((char*)(d), (n) * sizeof(t))
5298 #endif
5299
5300 #else
5301 #ifndef ZeroD
5302 # define ZeroD(d,n,t) ((void)memzero((char*)(d), (n) * sizeof(t)), d)
5303 #endif
5304
5305 #endif
5306 #ifndef PoisonWith
5307 # define PoisonWith(d,n,t,b) (void)memset((char*)(d), (U8)(b), (n) * sizeof(t))
5308 #endif
5309
5310 #ifndef PoisonNew
5311 # define PoisonNew(d,n,t) PoisonWith(d,n,t,0xAB)
5312 #endif
5313
5314 #ifndef PoisonFree
5315 # define PoisonFree(d,n,t) PoisonWith(d,n,t,0xEF)
5316 #endif
5317
5318 #ifndef Poison
5319 # define Poison(d,n,t) PoisonFree(d,n,t)
5320 #endif
5321 #ifndef Newx
5322 # define Newx(v,n,t) New(0,v,n,t)
5323 #endif
5324
5325 #ifndef Newxc
5326 # define Newxc(v,n,t,c) Newc(0,v,n,t,c)
5327 #endif
5328
5329 #ifndef Newxz
5330 # define Newxz(v,n,t) Newz(0,v,n,t)
5331 #endif
5332 #ifndef PERL_MAGIC_sv
5333 # define PERL_MAGIC_sv '\0'
5334 #endif
5335
5336 #ifndef PERL_MAGIC_overload
5337 # define PERL_MAGIC_overload 'A'
5338 #endif
5339
5340 #ifndef PERL_MAGIC_overload_elem
5341 # define PERL_MAGIC_overload_elem 'a'
5342 #endif
5343
5344 #ifndef PERL_MAGIC_overload_table
5345 # define PERL_MAGIC_overload_table 'c'
5346 #endif
5347
5348 #ifndef PERL_MAGIC_bm
5349 # define PERL_MAGIC_bm 'B'
5350 #endif
5351
5352 #ifndef PERL_MAGIC_regdata
5353 # define PERL_MAGIC_regdata 'D'
5354 #endif
5355
5356 #ifndef PERL_MAGIC_regdatum
5357 # define PERL_MAGIC_regdatum 'd'
5358 #endif
5359
5360 #ifndef PERL_MAGIC_env
5361 # define PERL_MAGIC_env 'E'
5362 #endif
5363
5364 #ifndef PERL_MAGIC_envelem
5365 # define PERL_MAGIC_envelem 'e'
5366 #endif
5367
5368 #ifndef PERL_MAGIC_fm
5369 # define PERL_MAGIC_fm 'f'
5370 #endif
5371
5372 #ifndef PERL_MAGIC_regex_global
5373 # define PERL_MAGIC_regex_global 'g'
5374 #endif
5375
5376 #ifndef PERL_MAGIC_isa
5377 # define PERL_MAGIC_isa 'I'
5378 #endif
5379
5380 #ifndef PERL_MAGIC_isaelem
5381 # define PERL_MAGIC_isaelem 'i'
5382 #endif
5383
5384 #ifndef PERL_MAGIC_nkeys
5385 # define PERL_MAGIC_nkeys 'k'
5386 #endif
5387
5388 #ifndef PERL_MAGIC_dbfile
5389 # define PERL_MAGIC_dbfile 'L'
5390 #endif
5391
5392 #ifndef PERL_MAGIC_dbline
5393 # define PERL_MAGIC_dbline 'l'
5394 #endif
5395
5396 #ifndef PERL_MAGIC_mutex
5397 # define PERL_MAGIC_mutex 'm'
5398 #endif
5399
5400 #ifndef PERL_MAGIC_shared
5401 # define PERL_MAGIC_shared 'N'
5402 #endif
5403
5404 #ifndef PERL_MAGIC_shared_scalar
5405 # define PERL_MAGIC_shared_scalar 'n'
5406 #endif
5407
5408 #ifndef PERL_MAGIC_collxfrm
5409 # define PERL_MAGIC_collxfrm 'o'
5410 #endif
5411
5412 #ifndef PERL_MAGIC_tied
5413 # define PERL_MAGIC_tied 'P'
5414 #endif
5415
5416 #ifndef PERL_MAGIC_tiedelem
5417 # define PERL_MAGIC_tiedelem 'p'
5418 #endif
5419
5420 #ifndef PERL_MAGIC_tiedscalar
5421 # define PERL_MAGIC_tiedscalar 'q'
5422 #endif
5423
5424 #ifndef PERL_MAGIC_qr
5425 # define PERL_MAGIC_qr 'r'
5426 #endif
5427
5428 #ifndef PERL_MAGIC_sig
5429 # define PERL_MAGIC_sig 'S'
5430 #endif
5431
5432 #ifndef PERL_MAGIC_sigelem
5433 # define PERL_MAGIC_sigelem 's'
5434 #endif
5435
5436 #ifndef PERL_MAGIC_taint
5437 # define PERL_MAGIC_taint 't'
5438 #endif
5439
5440 #ifndef PERL_MAGIC_uvar
5441 # define PERL_MAGIC_uvar 'U'
5442 #endif
5443
5444 #ifndef PERL_MAGIC_uvar_elem
5445 # define PERL_MAGIC_uvar_elem 'u'
5446 #endif
5447
5448 #ifndef PERL_MAGIC_vstring
5449 # define PERL_MAGIC_vstring 'V'
5450 #endif
5451
5452 #ifndef PERL_MAGIC_vec
5453 # define PERL_MAGIC_vec 'v'
5454 #endif
5455
5456 #ifndef PERL_MAGIC_utf8
5457 # define PERL_MAGIC_utf8 'w'
5458 #endif
5459
5460 #ifndef PERL_MAGIC_substr
5461 # define PERL_MAGIC_substr 'x'
5462 #endif
5463
5464 #ifndef PERL_MAGIC_defelem
5465 # define PERL_MAGIC_defelem 'y'
5466 #endif
5467
5468 #ifndef PERL_MAGIC_glob
5469 # define PERL_MAGIC_glob '*'
5470 #endif
5471
5472 #ifndef PERL_MAGIC_arylen
5473 # define PERL_MAGIC_arylen '#'
5474 #endif
5475
5476 #ifndef PERL_MAGIC_pos
5477 # define PERL_MAGIC_pos '.'
5478 #endif
5479
5480 #ifndef PERL_MAGIC_backref
5481 # define PERL_MAGIC_backref '<'
5482 #endif
5483
5484 #ifndef PERL_MAGIC_ext
5485 # define PERL_MAGIC_ext '~'
5486 #endif
5487
5488 #ifdef NEED_mess_sv
5489 #define NEED_mess
5490 #endif
5491
5492 #ifdef NEED_mess
5493 #define NEED_mess_nocontext
5494 #define NEED_vmess
5495 #endif
5496
5497 #ifndef croak_sv
5498 #if (PERL_BCDVERSION >= 0x5007003) || ( (PERL_BCDVERSION >= 0x5006001) && (PERL_BCDVERSION < 0x5007000) )
5499 # if ( (PERL_BCDVERSION >= 0x5008000) && (PERL_BCDVERSION < 0x5008009) ) || ( (PERL_BCDVERSION >= 0x5009000) && (PERL_BCDVERSION < 0x5010001) )
5500 # define D_PPP_FIX_UTF8_ERRSV(errsv, sv) \
5501 STMT_START { \
5502 if (sv != errsv) \
5503 SvFLAGS(errsv) = (SvFLAGS(errsv) & ~SVf_UTF8) | \
5504 (SvFLAGS(sv) & SVf_UTF8); \
5505 } STMT_END
5506 # else
5507 # define D_PPP_FIX_UTF8_ERRSV(errsv, sv) STMT_START {} STMT_END
5508 # endif
5509 # define croak_sv(sv) \
5510 STMT_START { \
5511 if (SvROK(sv)) { \
5512 sv_setsv(ERRSV, sv); \
5513 croak(NULL); \
5514 } else { \
5515 D_PPP_FIX_UTF8_ERRSV(ERRSV, sv); \
5516 croak("%" SVf, SVfARG(sv)); \
5517 } \
5518 } STMT_END
5519 #elif (PERL_BCDVERSION >= 0x5004000)
5520 # define croak_sv(sv) croak("%" SVf, SVfARG(sv))
5521 #else
5522 # define croak_sv(sv) croak("%s", SvPV_nolen(sv))
5523 #endif
5524 #endif
5525
5526 #ifndef die_sv
5527 #if defined(NEED_die_sv)
5528 static OP * DPPP_(my_die_sv)(pTHX_ SV *sv);
5529 static
5530 #else
5531 extern OP * DPPP_(my_die_sv)(pTHX_ SV *sv);
5532 #endif
5533
5534 #if defined(NEED_die_sv) || defined(NEED_die_sv_GLOBAL)
5535
5536 #ifdef die_sv
5537 # undef die_sv
5538 #endif
5539 #define die_sv(a) DPPP_(my_die_sv)(aTHX_ a)
5540 #define Perl_die_sv DPPP_(my_die_sv)
5541
5542 OP *
5543 DPPP_(my_die_sv)(pTHX_ SV *sv)
5544 {
5545 croak_sv(sv);
5546 return (OP *)NULL;
5547 }
5548 #endif
5549 #endif
5550
5551 #ifndef warn_sv
5552 #if (PERL_BCDVERSION >= 0x5004000)
5553 # define warn_sv(sv) warn("%" SVf, SVfARG(sv))
5554 #else
5555 # define warn_sv(sv) warn("%s", SvPV_nolen(sv))
5556 #endif
5557 #endif
5558
5559 #ifndef vmess
5560 #if defined(NEED_vmess)
5561 static SV * DPPP_(my_vmess)(pTHX_ const char * pat, va_list * args);
5562 static
5563 #else
5564 extern SV * DPPP_(my_vmess)(pTHX_ const char * pat, va_list * args);
5565 #endif
5566
5567 #if defined(NEED_vmess) || defined(NEED_vmess_GLOBAL)
5568
5569 #ifdef vmess
5570 # undef vmess
5571 #endif
5572 #define vmess(a,b) DPPP_(my_vmess)(aTHX_ a,b)
5573 #define Perl_vmess DPPP_(my_vmess)
5574
5575 SV*
5576 DPPP_(my_vmess)(pTHX_ const char* pat, va_list* args)
5577 {
5578 mess(pat, args);
5579 return PL_mess_sv;
5580 }
5581 #endif
5582 #endif
5583
5584 #if (PERL_BCDVERSION < 0x5006000)
5585 #undef mess
5586 #endif
5587
5588 #if !defined(mess_nocontext) && !defined(Perl_mess_nocontext)
5589 #if defined(NEED_mess_nocontext)
5590 static SV * DPPP_(my_mess_nocontext)(const char * pat, ...);
5591 static
5592 #else
5593 extern SV * DPPP_(my_mess_nocontext)(const char * pat, ...);
5594 #endif
5595
5596 #if defined(NEED_mess_nocontext) || defined(NEED_mess_nocontext_GLOBAL)
5597
5598 #define mess_nocontext DPPP_(my_mess_nocontext)
5599 #define Perl_mess_nocontext DPPP_(my_mess_nocontext)
5600
5601 SV*
5602 DPPP_(my_mess_nocontext)(const char* pat, ...)
5603 {
5604 dTHX;
5605 SV *sv;
5606 va_list args;
5607 va_start(args, pat);
5608 sv = vmess(pat, &args);
5609 va_end(args);
5610 return sv;
5611 }
5612 #endif
5613 #endif
5614
5615 #ifndef mess
5616 #if defined(NEED_mess)
5617 static SV * DPPP_(my_mess)(pTHX_ const char * pat, ...);
5618 static
5619 #else
5620 extern SV * DPPP_(my_mess)(pTHX_ const char * pat, ...);
5621 #endif
5622
5623 #if defined(NEED_mess) || defined(NEED_mess_GLOBAL)
5624
5625 #define Perl_mess DPPP_(my_mess)
5626
5627 SV*
5628 DPPP_(my_mess)(pTHX_ const char* pat, ...)
5629 {
5630 SV *sv;
5631 va_list args;
5632 va_start(args, pat);
5633 sv = vmess(pat, &args);
5634 va_end(args);
5635 return sv;
5636 }
5637 #ifdef mess_nocontext
5638 #define mess mess_nocontext
5639 #else
5640 #define mess Perl_mess_nocontext
5641 #endif
5642 #endif
5643 #endif
5644
5645 #ifndef mess_sv
5646 #if defined(NEED_mess_sv)
5647 static SV * DPPP_(my_mess_sv)(pTHX_ SV * basemsg, bool consume);
5648 static
5649 #else
5650 extern SV * DPPP_(my_mess_sv)(pTHX_ SV * basemsg, bool consume);
5651 #endif
5652
5653 #if defined(NEED_mess_sv) || defined(NEED_mess_sv_GLOBAL)
5654
5655 #ifdef mess_sv
5656 # undef mess_sv
5657 #endif
5658 #define mess_sv(a,b) DPPP_(my_mess_sv)(aTHX_ a,b)
5659 #define Perl_mess_sv DPPP_(my_mess_sv)
5660
5661 SV *
5662 DPPP_(my_mess_sv)(pTHX_ SV *basemsg, bool consume)
5663 {
5664 SV *tmp;
5665 SV *ret;
5666
5667 if (SvPOK(basemsg) && SvCUR(basemsg) && *(SvEND(basemsg)-1) == '\n') {
5668 if (consume)
5669 return basemsg;
5670 ret = mess("");
5671 SvSetSV_nosteal(ret, basemsg);
5672 return ret;
5673 }
5674
5675 if (consume) {
5676 sv_catsv(basemsg, mess(""));
5677 return basemsg;
5678 }
5679
5680 ret = mess("");
5681 tmp = newSVsv(ret);
5682 SvSetSV_nosteal(ret, basemsg);
5683 sv_catsv(ret, tmp);
5684 sv_dec(tmp);
5685 return ret;
5686 }
5687 #endif
5688 #endif
5689
5690 #ifndef warn_nocontext
5691 #define warn_nocontext warn
5692 #endif
5693
5694 #ifndef croak_nocontext
5695 #define croak_nocontext croak
5696 #endif
5697
5698 #ifndef croak_no_modify
5699 #define croak_no_modify() croak_nocontext("%s", PL_no_modify)
5700 #define Perl_croak_no_modify() croak_no_modify()
5701 #endif
5702
5703 #ifndef croak_memory_wrap
5704 #if (PERL_BCDVERSION >= 0x5009002) || ( (PERL_BCDVERSION >= 0x5008006) && (PERL_BCDVERSION < 0x5009000) )
5705 # define croak_memory_wrap() croak_nocontext("%s", PL_memory_wrap)
5706 #else
5707 # define croak_memory_wrap() croak_nocontext("panic: memory wrap")
5708 #endif
5709 #endif
5710
5711 #ifndef croak_xs_usage
5712 #if defined(NEED_croak_xs_usage)
5713 static void DPPP_(my_croak_xs_usage)(const CV * const cv, const char * const params);
5714 static
5715 #else
5716 extern void DPPP_(my_croak_xs_usage)(const CV * const cv, const char * const params);
5717 #endif
5718
5719 #if defined(NEED_croak_xs_usage) || defined(NEED_croak_xs_usage_GLOBAL)
5720
5721 #define croak_xs_usage DPPP_(my_croak_xs_usage)
5722 #define Perl_croak_xs_usage DPPP_(my_croak_xs_usage)
5723
5724
5725 #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
5726 #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
5727 #endif
5728
5729 void
5730 DPPP_(my_croak_xs_usage)(const CV *const cv, const char *const params)
5731 {
5732 dTHX;
5733 const GV *const gv = CvGV(cv);
5734
5735 PERL_ARGS_ASSERT_CROAK_XS_USAGE;
5736
5737 if (gv) {
5738 const char *const gvname = GvNAME(gv);
5739 const HV *const stash = GvSTASH(gv);
5740 const char *const hvname = stash ? HvNAME(stash) : NULL;
5741
5742 if (hvname)
5743 croak("Usage: %s::%s(%s)", hvname, gvname, params);
5744 else
5745 croak("Usage: %s(%s)", gvname, params);
5746 } else {
5747 /* Pants. I don't think that it should be possible to get here. */
5748 croak("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
5749 }
5750 }
5751 #endif
46455752 #endif
46465753
46475754 #ifndef PERL_SIGNALS_UNSAFE_FLAG
49006007 extern SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error);
49016008 #endif
49026009
6010 #if defined(NEED_eval_pv) || defined(NEED_eval_pv_GLOBAL)
6011
49036012 #ifdef eval_pv
49046013 # undef eval_pv
49056014 #endif
49066015 #define eval_pv(a,b) DPPP_(my_eval_pv)(aTHX_ a,b)
49076016 #define Perl_eval_pv DPPP_(my_eval_pv)
49086017
4909 #if defined(NEED_eval_pv) || defined(NEED_eval_pv_GLOBAL)
49106018
49116019 SV*
49126020 DPPP_(my_eval_pv)(char *p, I32 croak_on_error)
49226030 sv = POPs;
49236031 PUTBACK;
49246032
4925 if (croak_on_error && SvTRUE(GvSV(errgv)))
4926 croak(SvPVx(GvSV(errgv), na));
6033 if (croak_on_error && SvTRUEx(ERRSV))
6034 croak_sv(ERRSV);
49276035
49286036 return sv;
49296037 }
49396047 extern void DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args);
49406048 #endif
49416049
6050 #if defined(NEED_vload_module) || defined(NEED_vload_module_GLOBAL)
6051
49426052 #ifdef vload_module
49436053 # undef vload_module
49446054 #endif
49456055 #define vload_module(a,b,c,d) DPPP_(my_vload_module)(aTHX_ a,b,c,d)
49466056 #define Perl_vload_module DPPP_(my_vload_module)
49476057
4948 #if defined(NEED_vload_module) || defined(NEED_vload_module_GLOBAL)
49496058
49506059 void
49516060 DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args)
50146123 extern void DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...);
50156124 #endif
50166125
6126 #if defined(NEED_load_module) || defined(NEED_load_module_GLOBAL)
6127
50176128 #ifdef load_module
50186129 # undef load_module
50196130 #endif
50206131 #define load_module DPPP_(my_load_module)
50216132 #define Perl_load_module DPPP_(my_load_module)
50226133
5023 #if defined(NEED_load_module) || defined(NEED_load_module_GLOBAL)
50246134
50256135 void
50266136 DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...)
50456155 extern SV * DPPP_(my_newRV_noinc)(SV *sv);
50466156 #endif
50476157
6158 #if defined(NEED_newRV_noinc) || defined(NEED_newRV_noinc_GLOBAL)
6159
50486160 #ifdef newRV_noinc
50496161 # undef newRV_noinc
50506162 #endif
50516163 #define newRV_noinc(a) DPPP_(my_newRV_noinc)(aTHX_ a)
50526164 #define Perl_newRV_noinc DPPP_(my_newRV_noinc)
50536165
5054 #if defined(NEED_newRV_noinc) || defined(NEED_newRV_noinc_GLOBAL)
50556166 SV *
50566167 DPPP_(my_newRV_noinc)(SV *sv)
50576168 {
50766187 extern void DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv);
50776188 #endif
50786189
6190 #if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)
6191
50796192 #ifdef newCONSTSUB
50806193 # undef newCONSTSUB
50816194 #endif
50826195 #define newCONSTSUB(a,b,c) DPPP_(my_newCONSTSUB)(aTHX_ a,b,c)
50836196 #define Perl_newCONSTSUB DPPP_(my_newCONSTSUB)
50846197
5085 #if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)
50866198
50876199 /* This is just a trick to avoid a dependency of newCONSTSUB on PL_parser */
50886200 /* (There's no PL_parser in perl < 5.005, so this is completely safe) */
53416453 extern SV* DPPP_(my_newSV_type)(pTHX_ svtype const t);
53426454 #endif
53436455
6456 #if defined(NEED_newSV_type) || defined(NEED_newSV_type_GLOBAL)
6457
53446458 #ifdef newSV_type
53456459 # undef newSV_type
53466460 #endif
53476461 #define newSV_type(a) DPPP_(my_newSV_type)(aTHX_ a)
53486462 #define Perl_newSV_type DPPP_(my_newSV_type)
53496463
5350 #if defined(NEED_newSV_type) || defined(NEED_newSV_type_GLOBAL)
53516464
53526465 SV*
53536466 DPPP_(my_newSV_type)(pTHX_ svtype const t)
53876500 extern SV * DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags);
53886501 #endif
53896502
6503 #if defined(NEED_newSVpvn_flags) || defined(NEED_newSVpvn_flags_GLOBAL)
6504
53906505 #ifdef newSVpvn_flags
53916506 # undef newSVpvn_flags
53926507 #endif
53936508 #define newSVpvn_flags(a,b,c) DPPP_(my_newSVpvn_flags)(aTHX_ a,b,c)
53946509 #define Perl_newSVpvn_flags DPPP_(my_newSVpvn_flags)
53956510
5396 #if defined(NEED_newSVpvn_flags) || defined(NEED_newSVpvn_flags_GLOBAL)
53976511
53986512 SV *
53996513 DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags)
54386552 extern char * DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp);
54396553 #endif
54406554
6555 #if defined(NEED_sv_2pvbyte) || defined(NEED_sv_2pvbyte_GLOBAL)
6556
54416557 #ifdef sv_2pvbyte
54426558 # undef sv_2pvbyte
54436559 #endif
54446560 #define sv_2pvbyte(a,b) DPPP_(my_sv_2pvbyte)(aTHX_ a,b)
54456561 #define Perl_sv_2pvbyte DPPP_(my_sv_2pvbyte)
54466562
5447 #if defined(NEED_sv_2pvbyte) || defined(NEED_sv_2pvbyte_GLOBAL)
54486563
54496564 char *
54506565 DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp)
55356650 extern char * DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags);
55366651 #endif
55376652
6653 #if defined(NEED_sv_2pv_flags) || defined(NEED_sv_2pv_flags_GLOBAL)
6654
55386655 #ifdef sv_2pv_flags
55396656 # undef sv_2pv_flags
55406657 #endif
55416658 #define sv_2pv_flags(a,b,c) DPPP_(my_sv_2pv_flags)(aTHX_ a,b,c)
55426659 #define Perl_sv_2pv_flags DPPP_(my_sv_2pv_flags)
55436660
5544 #if defined(NEED_sv_2pv_flags) || defined(NEED_sv_2pv_flags_GLOBAL)
55456661
55466662 char *
55476663 DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags)
55596675 extern char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags);
55606676 #endif
55616677
6678 #if defined(NEED_sv_pvn_force_flags) || defined(NEED_sv_pvn_force_flags_GLOBAL)
6679
55626680 #ifdef sv_pvn_force_flags
55636681 # undef sv_pvn_force_flags
55646682 #endif
55656683 #define sv_pvn_force_flags(a,b,c) DPPP_(my_sv_pvn_force_flags)(aTHX_ a,b,c)
55666684 #define Perl_sv_pvn_force_flags DPPP_(my_sv_pvn_force_flags)
55676685
5568 #if defined(NEED_sv_pvn_force_flags) || defined(NEED_sv_pvn_force_flags_GLOBAL)
55696686
55706687 char *
55716688 DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags)
55796696 #endif
55806697
55816698 #if (PERL_BCDVERSION < 0x5008008) || ( (PERL_BCDVERSION >= 0x5009000) && (PERL_BCDVERSION < 0x5009003) )
5582 # define DPPP_SVPV_NOLEN_LP_ARG &PL_na
6699 # define D_PPP_SVPV_NOLEN_LP_ARG &PL_na
55836700 #else
5584 # define DPPP_SVPV_NOLEN_LP_ARG 0
6701 # define D_PPP_SVPV_NOLEN_LP_ARG 0
55856702 #endif
55866703 #ifndef SvPV_const
55876704 # define SvPV_const(sv, lp) SvPV_flags_const(sv, lp, SV_GMAGIC)
56056722 # define SvPV_flags_const_nolen(sv, flags) \
56066723 ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
56076724 ? SvPVX_const(sv) : \
5608 (const char*) sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, flags|SV_CONST_RETURN))
6725 (const char*) sv_2pv_flags(sv, D_PPP_SVPV_NOLEN_LP_ARG, flags|SV_CONST_RETURN))
56096726 #endif
56106727 #ifndef SvPV_flags_mutable
56116728 # define SvPV_flags_mutable(sv, lp, flags) \
56406757 #ifndef SvPV_force_flags_nolen
56416758 # define SvPV_force_flags_nolen(sv, flags) \
56426759 ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \
5643 ? SvPVX(sv) : sv_pvn_force_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, flags))
6760 ? SvPVX(sv) : sv_pvn_force_flags(sv, D_PPP_SVPV_NOLEN_LP_ARG, flags))
56446761 #endif
56456762 #ifndef SvPV_force_flags_mutable
56466763 # define SvPV_force_flags_mutable(sv, lp, flags) \
56516768 #ifndef SvPV_nolen
56526769 # define SvPV_nolen(sv) \
56536770 ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
5654 ? SvPVX(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC))
6771 ? SvPVX(sv) : sv_2pv_flags(sv, D_PPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC))
56556772 #endif
56566773 #ifndef SvPV_nolen_const
56576774 # define SvPV_nolen_const(sv) \
56586775 ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
5659 ? SvPVX_const(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC|SV_CONST_RETURN))
6776 ? SvPVX_const(sv) : sv_2pv_flags(sv, D_PPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC|SV_CONST_RETURN))
56606777 #endif
56616778 #ifndef SvPV_nomg
56626779 # define SvPV_nomg(sv, lp) SvPV_flags(sv, lp, 0)
56726789
56736790 #ifndef SvPV_nomg_nolen
56746791 # define SvPV_nomg_nolen(sv) ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
5675 ? SvPVX(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, 0))
6792 ? SvPVX(sv) : sv_2pv_flags(sv, D_PPP_SVPV_NOLEN_LP_ARG, 0))
56766793 #endif
56776794 #ifndef SvPV_renew
56786795 # define SvPV_renew(sv,n) STMT_START { SvLEN_set(sv, n); \
57456862 extern SV * DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args);
57466863 #endif
57476864
6865 #if defined(NEED_vnewSVpvf) || defined(NEED_vnewSVpvf_GLOBAL)
6866
57486867 #ifdef vnewSVpvf
57496868 # undef vnewSVpvf
57506869 #endif
57516870 #define vnewSVpvf(a,b) DPPP_(my_vnewSVpvf)(aTHX_ a,b)
57526871 #define Perl_vnewSVpvf DPPP_(my_vnewSVpvf)
57536872
5754 #if defined(NEED_vnewSVpvf) || defined(NEED_vnewSVpvf_GLOBAL)
57556873
57566874 SV *
57576875 DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args)
57806898 extern void DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...);
57816899 #endif
57826900
6901 #if defined(NEED_sv_catpvf_mg) || defined(NEED_sv_catpvf_mg_GLOBAL)
6902
57836903 #define Perl_sv_catpvf_mg DPPP_(my_sv_catpvf_mg)
57846904
5785 #if defined(NEED_sv_catpvf_mg) || defined(NEED_sv_catpvf_mg_GLOBAL)
57866905
57876906 void
57886907 DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...)
58066925 extern void DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...);
58076926 #endif
58086927
6928 #if defined(NEED_sv_catpvf_mg_nocontext) || defined(NEED_sv_catpvf_mg_nocontext_GLOBAL)
6929
58096930 #define sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext)
58106931 #define Perl_sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext)
58116932
5812 #if defined(NEED_sv_catpvf_mg_nocontext) || defined(NEED_sv_catpvf_mg_nocontext_GLOBAL)
58136933
58146934 void
58156935 DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...)
58516971 extern void DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...);
58526972 #endif
58536973
6974 #if defined(NEED_sv_setpvf_mg) || defined(NEED_sv_setpvf_mg_GLOBAL)
6975
58546976 #define Perl_sv_setpvf_mg DPPP_(my_sv_setpvf_mg)
58556977
5856 #if defined(NEED_sv_setpvf_mg) || defined(NEED_sv_setpvf_mg_GLOBAL)
58576978
58586979 void
58596980 DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...)
58776998 extern void DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...);
58786999 #endif
58797000
7001 #if defined(NEED_sv_setpvf_mg_nocontext) || defined(NEED_sv_setpvf_mg_nocontext_GLOBAL)
7002
58807003 #define sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext)
58817004 #define Perl_sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext)
58827005
5883 #if defined(NEED_sv_setpvf_mg_nocontext) || defined(NEED_sv_setpvf_mg_nocontext_GLOBAL)
58847006
58857007 void
58867008 DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...)
59297051 extern SV * DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash);
59307052 #endif
59317053
7054 #if defined(NEED_newSVpvn_share) || defined(NEED_newSVpvn_share_GLOBAL)
7055
59327056 #ifdef newSVpvn_share
59337057 # undef newSVpvn_share
59347058 #endif
59357059 #define newSVpvn_share(a,b,c) DPPP_(my_newSVpvn_share)(aTHX_ a,b,c)
59367060 #define Perl_newSVpvn_share DPPP_(my_newSVpvn_share)
59377061
5938 #if defined(NEED_newSVpvn_share) || defined(NEED_newSVpvn_share_GLOBAL)
59397062
59407063 SV *
59417064 DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash)
59747097 extern GV* DPPP_(my_gv_fetchpvn_flags)(pTHX_ const char* name, STRLEN len, int flags, int types);
59757098 #endif
59767099
7100 #if defined(NEED_gv_fetchpvn_flags) || defined(NEED_gv_fetchpvn_flags_GLOBAL)
7101
59777102 #ifdef gv_fetchpvn_flags
59787103 # undef gv_fetchpvn_flags
59797104 #endif
59807105 #define gv_fetchpvn_flags(a,b,c,d) DPPP_(my_gv_fetchpvn_flags)(aTHX_ a,b,c,d)
59817106 #define Perl_gv_fetchpvn_flags DPPP_(my_gv_fetchpvn_flags)
59827107
5983 #if defined(NEED_gv_fetchpvn_flags) || defined(NEED_gv_fetchpvn_flags_GLOBAL)
59847108
59857109 GV*
59867110 DPPP_(my_gv_fetchpvn_flags)(pTHX_ const char* name, STRLEN len, int flags, int types) {
60107134 #ifndef gv_init_pvn
60117135 # define gv_init_pvn(gv, stash, ptr, len, flags) gv_init(gv, stash, ptr, len, flags & GV_ADDMULTI ? TRUE : FALSE)
60127136 #endif
6013 #ifndef WARN_ALL
6014 # define WARN_ALL 0
6015 #endif
6016
6017 #ifndef WARN_CLOSURE
6018 # define WARN_CLOSURE 1
6019 #endif
6020
6021 #ifndef WARN_DEPRECATED
6022 # define WARN_DEPRECATED 2
6023 #endif
6024
6025 #ifndef WARN_EXITING
6026 # define WARN_EXITING 3
6027 #endif
6028
6029 #ifndef WARN_GLOB
6030 # define WARN_GLOB 4
6031 #endif
6032
6033 #ifndef WARN_IO
6034 # define WARN_IO 5
6035 #endif
6036
6037 #ifndef WARN_CLOSED
6038 # define WARN_CLOSED 6
6039 #endif
6040
6041 #ifndef WARN_EXEC
6042 # define WARN_EXEC 7
6043 #endif
6044
6045 #ifndef WARN_LAYER
6046 # define WARN_LAYER 8
6047 #endif
6048
6049 #ifndef WARN_NEWLINE
6050 # define WARN_NEWLINE 9
6051 #endif
6052
6053 #ifndef WARN_PIPE
6054 # define WARN_PIPE 10
6055 #endif
6056
6057 #ifndef WARN_UNOPENED
6058 # define WARN_UNOPENED 11
6059 #endif
6060
6061 #ifndef WARN_MISC
6062 # define WARN_MISC 12
6063 #endif
6064
6065 #ifndef WARN_NUMERIC
6066 # define WARN_NUMERIC 13
6067 #endif
6068
6069 #ifndef WARN_ONCE
6070 # define WARN_ONCE 14
6071 #endif
6072
6073 #ifndef WARN_OVERFLOW
6074 # define WARN_OVERFLOW 15
6075 #endif
6076
6077 #ifndef WARN_PACK
6078 # define WARN_PACK 16
6079 #endif
6080
6081 #ifndef WARN_PORTABLE
6082 # define WARN_PORTABLE 17
6083 #endif
6084
6085 #ifndef WARN_RECURSION
6086 # define WARN_RECURSION 18
6087 #endif
6088
6089 #ifndef WARN_REDEFINE
6090 # define WARN_REDEFINE 19
6091 #endif
6092
6093 #ifndef WARN_REGEXP
6094 # define WARN_REGEXP 20
6095 #endif
6096
6097 #ifndef WARN_SEVERE
6098 # define WARN_SEVERE 21
6099 #endif
6100
6101 #ifndef WARN_DEBUGGING
6102 # define WARN_DEBUGGING 22
6103 #endif
6104
6105 #ifndef WARN_INPLACE
6106 # define WARN_INPLACE 23
6107 #endif
6108
6109 #ifndef WARN_INTERNAL
6110 # define WARN_INTERNAL 24
6111 #endif
6112
6113 #ifndef WARN_MALLOC
6114 # define WARN_MALLOC 25
6115 #endif
6116
6117 #ifndef WARN_SIGNAL
6118 # define WARN_SIGNAL 26
6119 #endif
6120
6121 #ifndef WARN_SUBSTR
6122 # define WARN_SUBSTR 27
6123 #endif
6124
6125 #ifndef WARN_SYNTAX
6126 # define WARN_SYNTAX 28
6127 #endif
6128
6129 #ifndef WARN_AMBIGUOUS
6130 # define WARN_AMBIGUOUS 29
6131 #endif
6132
6133 #ifndef WARN_BAREWORD
6134 # define WARN_BAREWORD 30
6135 #endif
6136
6137 #ifndef WARN_DIGIT
6138 # define WARN_DIGIT 31
6139 #endif
6140
6141 #ifndef WARN_PARENTHESIS
6142 # define WARN_PARENTHESIS 32
6143 #endif
6144
6145 #ifndef WARN_PRECEDENCE
6146 # define WARN_PRECEDENCE 33
6147 #endif
6148
6149 #ifndef WARN_PRINTF
6150 # define WARN_PRINTF 34
6151 #endif
6152
6153 #ifndef WARN_PROTOTYPE
6154 # define WARN_PROTOTYPE 35
6155 #endif
6156
6157 #ifndef WARN_QW
6158 # define WARN_QW 36
6159 #endif
6160
6161 #ifndef WARN_RESERVED
6162 # define WARN_RESERVED 37
6163 #endif
6164
6165 #ifndef WARN_SEMICOLON
6166 # define WARN_SEMICOLON 38
6167 #endif
6168
6169 #ifndef WARN_TAINT
6170 # define WARN_TAINT 39
6171 #endif
6172
6173 #ifndef WARN_THREADS
6174 # define WARN_THREADS 40
6175 #endif
6176
6177 #ifndef WARN_UNINITIALIZED
6178 # define WARN_UNINITIALIZED 41
6179 #endif
6180
6181 #ifndef WARN_UNPACK
6182 # define WARN_UNPACK 42
6183 #endif
6184
6185 #ifndef WARN_UNTIE
6186 # define WARN_UNTIE 43
6187 #endif
6188
6189 #ifndef WARN_UTF8
6190 # define WARN_UTF8 44
6191 #endif
6192
6193 #ifndef WARN_VOID
6194 # define WARN_VOID 45
6195 #endif
6196
6197 #ifndef WARN_ASSERTIONS
6198 # define WARN_ASSERTIONS 46
6199 #endif
6200 #ifndef packWARN
6201 # define packWARN(a) (a)
6202 #endif
6203
6204 #ifndef ckWARN
6205 # ifdef G_WARN_ON
6206 # define ckWARN(a) (PL_dowarn & G_WARN_ON)
6207 # else
6208 # define ckWARN(a) PL_dowarn
6209 # endif
6210 #endif
6211
6212 #if (PERL_BCDVERSION >= 0x5004000) && !defined(warner)
6213 #if defined(NEED_warner)
6214 static void DPPP_(my_warner)(U32 err, const char *pat, ...);
6215 static
6216 #else
6217 extern void DPPP_(my_warner)(U32 err, const char *pat, ...);
6218 #endif
6219
6220 #define Perl_warner DPPP_(my_warner)
6221
6222 #if defined(NEED_warner) || defined(NEED_warner_GLOBAL)
6223
6224 void
6225 DPPP_(my_warner)(U32 err, const char *pat, ...)
6226 {
6227 SV *sv;
6228 va_list args;
6229
6230 PERL_UNUSED_ARG(err);
6231
6232 va_start(args, pat);
6233 sv = vnewSVpvf(pat, &args);
6234 va_end(args);
6235 sv_2mortal(sv);
6236 warn("%s", SvPV_nolen(sv));
6237 }
6238
6239 #define warner Perl_warner
6240
6241 #define Perl_warner_nocontext Perl_warner
6242
6243 #endif
6244 #endif
62457137
62467138 /* concatenating with "" ensures that only literal strings are accepted as argument
62477139 * note that STR_WITH_LEN() can't be used as argument to macros or functions that
62897181 #endif
62907182 #ifndef SvGETMAGIC
62917183 # define SvGETMAGIC(x) STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END
6292 #endif
6293
6294 /* Some random bits for sv_unmagicext. These should probably be pulled in for
6295 real and organized at some point */
6296 #ifndef HEf_SVKEY
6297 # define HEf_SVKEY -2
6298 #endif
6299
6300 #ifndef MUTABLE_PTR
6301 #if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
6302 # define MUTABLE_PTR(p) ({ void *_p = (p); _p; })
6303 #else
6304 # define MUTABLE_PTR(p) ((void *) (p))
6305 #endif
6306 #endif
6307 #ifndef MUTABLE_SV
6308 # define MUTABLE_SV(p) ((SV *)MUTABLE_PTR(p))
6309 #endif
6310
6311 /* end of random bits */
6312 #ifndef PERL_MAGIC_sv
6313 # define PERL_MAGIC_sv '\0'
6314 #endif
6315
6316 #ifndef PERL_MAGIC_overload
6317 # define PERL_MAGIC_overload 'A'
6318 #endif
6319
6320 #ifndef PERL_MAGIC_overload_elem
6321 # define PERL_MAGIC_overload_elem 'a'
6322 #endif
6323
6324 #ifndef PERL_MAGIC_overload_table
6325 # define PERL_MAGIC_overload_table 'c'
6326 #endif
6327
6328 #ifndef PERL_MAGIC_bm
6329 # define PERL_MAGIC_bm 'B'
6330 #endif
6331
6332 #ifndef PERL_MAGIC_regdata
6333 # define PERL_MAGIC_regdata 'D'
6334 #endif
6335
6336 #ifndef PERL_MAGIC_regdatum
6337 # define PERL_MAGIC_regdatum 'd'
6338 #endif
6339
6340 #ifndef PERL_MAGIC_env
6341 # define PERL_MAGIC_env 'E'
6342 #endif
6343
6344 #ifndef PERL_MAGIC_envelem
6345 # define PERL_MAGIC_envelem 'e'
6346 #endif
6347
6348 #ifndef PERL_MAGIC_fm
6349 # define PERL_MAGIC_fm 'f'
6350 #endif
6351
6352 #ifndef PERL_MAGIC_regex_global
6353 # define PERL_MAGIC_regex_global 'g'
6354 #endif
6355
6356 #ifndef PERL_MAGIC_isa
6357 # define PERL_MAGIC_isa 'I'
6358 #endif
6359
6360 #ifndef PERL_MAGIC_isaelem
6361 # define PERL_MAGIC_isaelem 'i'
6362 #endif
6363
6364 #ifndef PERL_MAGIC_nkeys
6365 # define PERL_MAGIC_nkeys 'k'
6366 #endif
6367
6368 #ifndef PERL_MAGIC_dbfile
6369 # define PERL_MAGIC_dbfile 'L'
6370 #endif
6371
6372 #ifndef PERL_MAGIC_dbline
6373 # define PERL_MAGIC_dbline 'l'
6374 #endif
6375
6376 #ifndef PERL_MAGIC_mutex
6377 # define PERL_MAGIC_mutex 'm'
6378 #endif
6379
6380 #ifndef PERL_MAGIC_shared
6381 # define PERL_MAGIC_shared 'N'
6382 #endif
6383
6384 #ifndef PERL_MAGIC_shared_scalar
6385 # define PERL_MAGIC_shared_scalar 'n'
6386 #endif
6387
6388 #ifndef PERL_MAGIC_collxfrm
6389 # define PERL_MAGIC_collxfrm 'o'
6390 #endif
6391
6392 #ifndef PERL_MAGIC_tied
6393 # define PERL_MAGIC_tied 'P'
6394 #endif
6395
6396 #ifndef PERL_MAGIC_tiedelem
6397 # define PERL_MAGIC_tiedelem 'p'
6398 #endif
6399
6400 #ifndef PERL_MAGIC_tiedscalar
6401 # define PERL_MAGIC_tiedscalar 'q'
6402 #endif
6403
6404 #ifndef PERL_MAGIC_qr
6405 # define PERL_MAGIC_qr 'r'
6406 #endif
6407
6408 #ifndef PERL_MAGIC_sig
6409 # define PERL_MAGIC_sig 'S'
6410 #endif
6411
6412 #ifndef PERL_MAGIC_sigelem
6413 # define PERL_MAGIC_sigelem 's'
6414 #endif
6415
6416 #ifndef PERL_MAGIC_taint
6417 # define PERL_MAGIC_taint 't'
6418 #endif
6419
6420 #ifndef PERL_MAGIC_uvar
6421 # define PERL_MAGIC_uvar 'U'
6422 #endif
6423
6424 #ifndef PERL_MAGIC_uvar_elem
6425 # define PERL_MAGIC_uvar_elem 'u'
6426 #endif
6427
6428 #ifndef PERL_MAGIC_vstring
6429 # define PERL_MAGIC_vstring 'V'
6430 #endif
6431
6432 #ifndef PERL_MAGIC_vec
6433 # define PERL_MAGIC_vec 'v'
6434 #endif
6435
6436 #ifndef PERL_MAGIC_utf8
6437 # define PERL_MAGIC_utf8 'w'
6438 #endif
6439
6440 #ifndef PERL_MAGIC_substr
6441 # define PERL_MAGIC_substr 'x'
6442 #endif
6443
6444 #ifndef PERL_MAGIC_defelem
6445 # define PERL_MAGIC_defelem 'y'
6446 #endif
6447
6448 #ifndef PERL_MAGIC_glob
6449 # define PERL_MAGIC_glob '*'
6450 #endif
6451
6452 #ifndef PERL_MAGIC_arylen
6453 # define PERL_MAGIC_arylen '#'
6454 #endif
6455
6456 #ifndef PERL_MAGIC_pos
6457 # define PERL_MAGIC_pos '.'
6458 #endif
6459
6460 #ifndef PERL_MAGIC_backref
6461 # define PERL_MAGIC_backref '<'
6462 #endif
6463
6464 #ifndef PERL_MAGIC_ext
6465 # define PERL_MAGIC_ext '~'
64667184 #endif
64677185
64687186 /* That's the best we can do... */
66327350 extern MAGIC * DPPP_(my_mg_findext)(SV * sv, int type, const MGVTBL *vtbl);
66337351 #endif
66347352
7353 #if defined(NEED_mg_findext) || defined(NEED_mg_findext_GLOBAL)
7354
66357355 #define mg_findext DPPP_(my_mg_findext)
66367356 #define Perl_mg_findext DPPP_(my_mg_findext)
66377357
6638 #if defined(NEED_mg_findext) || defined(NEED_mg_findext_GLOBAL)
66397358
66407359 MAGIC *
66417360 DPPP_(my_mg_findext)(SV * sv, int type, const MGVTBL *vtbl) {
66667385 extern int DPPP_(my_sv_unmagicext)(pTHX_ SV * const sv, const int type, MGVTBL * vtbl);
66677386 #endif
66687387
7388 #if defined(NEED_sv_unmagicext) || defined(NEED_sv_unmagicext_GLOBAL)
7389
66697390 #ifdef sv_unmagicext
66707391 # undef sv_unmagicext
66717392 #endif
66727393 #define sv_unmagicext(a,b,c) DPPP_(my_sv_unmagicext)(aTHX_ a,b,c)
66737394 #define Perl_sv_unmagicext DPPP_(my_sv_unmagicext)
66747395
6675 #if defined(NEED_sv_unmagicext) || defined(NEED_sv_unmagicext_GLOBAL)
66767396
66777397 int
66787398 DPPP_(my_sv_unmagicext)(pTHX_ SV *const sv, const int type, MGVTBL *vtbl)
68397559 extern const PERL_CONTEXT * DPPP_(my_caller_cx)(pTHX_ I32 count, const PERL_CONTEXT **dbcxp);
68407560 #endif
68417561
7562 #if defined(NEED_caller_cx) || defined(NEED_caller_cx_GLOBAL)
7563
68427564 #ifdef caller_cx
68437565 # undef caller_cx
68447566 #endif
68457567 #define caller_cx(a,b) DPPP_(my_caller_cx)(aTHX_ a,b)
68467568 #define Perl_caller_cx DPPP_(my_caller_cx)
68477569
6848 #if defined(NEED_caller_cx) || defined(NEED_caller_cx_GLOBAL)
68497570
68507571 const PERL_CONTEXT *
68517572 DPPP_(my_caller_cx)(pTHX_ I32 count, const PERL_CONTEXT **dbcxp)
69567677 extern bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send);
69577678 #endif
69587679
7680 #if defined(NEED_grok_numeric_radix) || defined(NEED_grok_numeric_radix_GLOBAL)
7681
69597682 #ifdef grok_numeric_radix
69607683 # undef grok_numeric_radix
69617684 #endif
69627685 #define grok_numeric_radix(a,b) DPPP_(my_grok_numeric_radix)(aTHX_ a,b)
69637686 #define Perl_grok_numeric_radix DPPP_(my_grok_numeric_radix)
69647687
6965 #if defined(NEED_grok_numeric_radix) || defined(NEED_grok_numeric_radix_GLOBAL)
69667688 bool
69677689 DPPP_(my_grok_numeric_radix)(pTHX_ const char **sp, const char *send)
69687690 {
70127734 extern int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep);
70137735 #endif
70147736
7737 #if defined(NEED_grok_number) || defined(NEED_grok_number_GLOBAL)
7738
70157739 #ifdef grok_number
70167740 # undef grok_number
70177741 #endif
70187742 #define grok_number(a,b,c) DPPP_(my_grok_number)(aTHX_ a,b,c)
70197743 #define Perl_grok_number DPPP_(my_grok_number)
70207744
7021 #if defined(NEED_grok_number) || defined(NEED_grok_number_GLOBAL)
70227745 int
70237746 DPPP_(my_grok_number)(pTHX_ const char *pv, STRLEN len, UV *valuep)
70247747 {
72267949 extern UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
72277950 #endif
72287951
7952 #if defined(NEED_grok_bin) || defined(NEED_grok_bin_GLOBAL)
7953
72297954 #ifdef grok_bin
72307955 # undef grok_bin
72317956 #endif
72327957 #define grok_bin(a,b,c,d) DPPP_(my_grok_bin)(aTHX_ a,b,c,d)
72337958 #define Perl_grok_bin DPPP_(my_grok_bin)
72347959
7235 #if defined(NEED_grok_bin) || defined(NEED_grok_bin_GLOBAL)
72367960 UV
72377961 DPPP_(my_grok_bin)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result)
72387962 {
73288052 extern UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
73298053 #endif
73308054
8055 #if defined(NEED_grok_hex) || defined(NEED_grok_hex_GLOBAL)
8056
73318057 #ifdef grok_hex
73328058 # undef grok_hex
73338059 #endif
73348060 #define grok_hex(a,b,c,d) DPPP_(my_grok_hex)(aTHX_ a,b,c,d)
73358061 #define Perl_grok_hex DPPP_(my_grok_hex)
73368062
7337 #if defined(NEED_grok_hex) || defined(NEED_grok_hex_GLOBAL)
73388063 UV
73398064 DPPP_(my_grok_hex)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result)
73408065 {
74308155 extern UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
74318156 #endif
74328157
8158 #if defined(NEED_grok_oct) || defined(NEED_grok_oct_GLOBAL)
8159
74338160 #ifdef grok_oct
74348161 # undef grok_oct
74358162 #endif
74368163 #define grok_oct(a,b,c,d) DPPP_(my_grok_oct)(aTHX_ a,b,c,d)
74378164 #define Perl_grok_oct DPPP_(my_grok_oct)
74388165
7439 #if defined(NEED_grok_oct) || defined(NEED_grok_oct_GLOBAL)
74408166 UV
74418167 DPPP_(my_grok_oct)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result)
74428168 {
75238249 extern int DPPP_(my_my_snprintf)(char * buffer, const Size_t len, const char * format, ...);
75248250 #endif
75258251
8252 #if defined(NEED_my_snprintf) || defined(NEED_my_snprintf_GLOBAL)
8253
75268254 #define my_snprintf DPPP_(my_my_snprintf)
75278255 #define Perl_my_snprintf DPPP_(my_my_snprintf)
75288256
7529 #if defined(NEED_my_snprintf) || defined(NEED_my_snprintf_GLOBAL)
75308257
75318258 int
75328259 DPPP_(my_my_snprintf)(char *buffer, const Size_t len, const char *format, ...)
75578284 extern int DPPP_(my_my_sprintf)(char * buffer, const char * pat, ...);
75588285 #endif
75598286
8287 #if defined(NEED_my_sprintf) || defined(NEED_my_sprintf_GLOBAL)
8288
75608289 #define my_sprintf DPPP_(my_my_sprintf)
75618290 #define Perl_my_sprintf DPPP_(my_my_sprintf)
75628291
7563 #if defined(NEED_my_sprintf) || defined(NEED_my_sprintf_GLOBAL)
75648292
75658293 int
75668294 DPPP_(my_my_sprintf)(char *buffer, const char* pat, ...)
75998327 extern Size_t DPPP_(my_my_strlcat)(char * dst, const char * src, Size_t size);
76008328 #endif
76018329
8330 #if defined(NEED_my_strlcat) || defined(NEED_my_strlcat_GLOBAL)
8331
76028332 #define my_strlcat DPPP_(my_my_strlcat)
76038333 #define Perl_my_strlcat DPPP_(my_my_strlcat)
76048334
7605 #if defined(NEED_my_strlcat) || defined(NEED_my_strlcat_GLOBAL)
76068335
76078336 Size_t
76088337 DPPP_(my_my_strlcat)(char *dst, const char *src, Size_t size)
76298358 extern Size_t DPPP_(my_my_strlcpy)(char * dst, const char * src, Size_t size);
76308359 #endif
76318360
8361 #if defined(NEED_my_strlcpy) || defined(NEED_my_strlcpy_GLOBAL)
8362
76328363 #define my_strlcpy DPPP_(my_my_strlcpy)
76338364 #define Perl_my_strlcpy DPPP_(my_my_strlcpy)
76348365
7635 #if defined(NEED_my_strlcpy) || defined(NEED_my_strlcpy_GLOBAL)
76368366
76378367 Size_t
76388368 DPPP_(my_my_strlcpy)(char *dst, const char *src, Size_t size)
77198449 extern char * DPPP_(my_pv_escape)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags);
77208450 #endif
77218451
8452 #if defined(NEED_pv_escape) || defined(NEED_pv_escape_GLOBAL)
8453
77228454 #ifdef pv_escape
77238455 # undef pv_escape
77248456 #endif
77258457 #define pv_escape(a,b,c,d,e,f) DPPP_(my_pv_escape)(aTHX_ a,b,c,d,e,f)
77268458 #define Perl_pv_escape DPPP_(my_pv_escape)
77278459
7728 #if defined(NEED_pv_escape) || defined(NEED_pv_escape_GLOBAL)
77298460
77308461 char *
77318462 DPPP_(my_pv_escape)(pTHX_ SV *dsv, char const * const str,
77388469 STRLEN wrote = 0;
77398470 STRLEN chsize = 0;
77408471 STRLEN readsize = 1;
7741 #if defined(is_utf8_string) && defined(utf8_to_uvchr)
8472 #if defined(is_utf8_string) && defined(utf8_to_uvchr_buf)
77428473 bool isuni = flags & PERL_PV_ESCAPE_UNI ? 1 : 0;
77438474 #endif
77448475 const char *pv = str;
77488479 if (!(flags & PERL_PV_ESCAPE_NOCLEAR))
77498480 sv_setpvs(dsv, "");
77508481
7751 #if defined(is_utf8_string) && defined(utf8_to_uvchr)
8482 #if defined(is_utf8_string) && defined(utf8_to_uvchr_buf)
77528483 if ((flags & PERL_PV_ESCAPE_UNI_DETECT) && is_utf8_string((U8*)pv, count))
77538484 isuni = 1;
77548485 #endif
77558486
77568487 for (; pv < end && (!max || wrote < max) ; pv += readsize) {
77578488 const UV u =
7758 #if defined(is_utf8_string) && defined(utf8_to_uvchr)
7759 isuni ? utf8_to_uvchr((U8*)pv, &readsize) :
8489 #if defined(is_utf8_string) && defined(utf8_to_uvchr_buf)
8490 isuni ? utf8_to_uvchr_buf((U8*)pv, end, &readsize) :
77608491 #endif
77618492 (U8)*pv;
77628493 const U8 c = (U8)u & 0xFF;
78288559 extern char * DPPP_(my_pv_pretty)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags);
78298560 #endif
78308561
8562 #if defined(NEED_pv_pretty) || defined(NEED_pv_pretty_GLOBAL)
8563
78318564 #ifdef pv_pretty
78328565 # undef pv_pretty
78338566 #endif
78348567 #define pv_pretty(a,b,c,d,e,f,g) DPPP_(my_pv_pretty)(aTHX_ a,b,c,d,e,f,g)
78358568 #define Perl_pv_pretty DPPP_(my_pv_pretty)
78368569
7837 #if defined(NEED_pv_pretty) || defined(NEED_pv_pretty_GLOBAL)
78388570
78398571 char *
78408572 DPPP_(my_pv_pretty)(pTHX_ SV *dsv, char const * const str, const STRLEN count,
78828614 extern char * DPPP_(my_pv_display)(pTHX_ SV * dsv, const char * pv, STRLEN cur, STRLEN len, STRLEN pvlim);
78838615 #endif
78848616
8617 #if defined(NEED_pv_display) || defined(NEED_pv_display_GLOBAL)
8618
78858619 #ifdef pv_display
78868620 # undef pv_display
78878621 #endif
78888622 #define pv_display(a,b,c,d,e) DPPP_(my_pv_display)(aTHX_ a,b,c,d,e)
78898623 #define Perl_pv_display DPPP_(my_pv_display)
78908624
7891 #if defined(NEED_pv_display) || defined(NEED_pv_display_GLOBAL)
78928625
78938626 char *
78948627 DPPP_(my_pv_display)(pTHX_ SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pvlim)
9595 ltc/pk/asn1/der/utctime/der_length_utctime.o ltc/pk/asn1/der/utf8/der_decode_utf8_string.o \
9696 ltc/pk/asn1/der/utf8/der_encode_utf8_string.o ltc/pk/asn1/der/utf8/der_length_utf8_string.o \
9797 ltc/pk/asn1/oid/pk_get_oid.o ltc/pk/asn1/oid/pk_oid_cmp.o ltc/pk/asn1/oid/pk_oid_str.o \
98 ltc/pk/asn1/pkcs8/pkcs8_decode_flexi.o ltc/pk/asn1/x509/x509_decode_subject_public_key_info.o \
99 ltc/pk/asn1/x509/x509_encode_subject_public_key_info.o ltc/pk/dh/dh.o ltc/pk/dh/dh_check_pubkey.o \
100 ltc/pk/dh/dh_export.o ltc/pk/dh/dh_export_key.o ltc/pk/dh/dh_free.o ltc/pk/dh/dh_generate_key.o \
101 ltc/pk/dh/dh_import.o ltc/pk/dh/dh_set.o ltc/pk/dh/dh_set_pg_dhparam.o ltc/pk/dh/dh_shared_secret.o \
102 ltc/pk/dsa/dsa_decrypt_key.o ltc/pk/dsa/dsa_encrypt_key.o ltc/pk/dsa/dsa_export.o \
103 ltc/pk/dsa/dsa_free.o ltc/pk/dsa/dsa_generate_key.o ltc/pk/dsa/dsa_generate_pqg.o \
104 ltc/pk/dsa/dsa_import.o ltc/pk/dsa/dsa_make_key.o ltc/pk/dsa/dsa_set.o ltc/pk/dsa/dsa_set_pqg_dsaparam.o \
105 ltc/pk/dsa/dsa_shared_secret.o ltc/pk/dsa/dsa_sign_hash.o ltc/pk/dsa/dsa_verify_hash.o \
106 ltc/pk/dsa/dsa_verify_key.o ltc/pk/ecc/ecc.o ltc/pk/ecc/ecc_ansi_x963_export.o ltc/pk/ecc/ecc_ansi_x963_import.o \
107 ltc/pk/ecc/ecc_decrypt_key.o ltc/pk/ecc/ecc_encrypt_key.o ltc/pk/ecc/ecc_export.o \
108 ltc/pk/ecc/ecc_export_openssl.o ltc/pk/ecc/ecc_find_curve.o ltc/pk/ecc/ecc_free.o \
109 ltc/pk/ecc/ecc_get_key.o ltc/pk/ecc/ecc_get_oid_str.o ltc/pk/ecc/ecc_get_size.o ltc/pk/ecc/ecc_import.o \
110 ltc/pk/ecc/ecc_import_openssl.o ltc/pk/ecc/ecc_import_pkcs8.o ltc/pk/ecc/ecc_import_x509.o \
111 ltc/pk/ecc/ecc_make_key.o ltc/pk/ecc/ecc_recover_key.o ltc/pk/ecc/ecc_set_curve.o \
112 ltc/pk/ecc/ecc_set_curve_internal.o ltc/pk/ecc/ecc_set_key.o ltc/pk/ecc/ecc_shared_secret.o \
113 ltc/pk/ecc/ecc_sign_hash.o ltc/pk/ecc/ecc_sizes.o ltc/pk/ecc/ecc_ssh_ecdsa_encode_name.o \
114 ltc/pk/ecc/ecc_verify_hash.o ltc/pk/ecc/ltc_ecc_export_point.o ltc/pk/ecc/ltc_ecc_import_point.o \
115 ltc/pk/ecc/ltc_ecc_is_point.o ltc/pk/ecc/ltc_ecc_is_point_at_infinity.o ltc/pk/ecc/ltc_ecc_map.o \
116 ltc/pk/ecc/ltc_ecc_mul2add.o ltc/pk/ecc/ltc_ecc_mulmod.o ltc/pk/ecc/ltc_ecc_mulmod_timing.o \
117 ltc/pk/ecc/ltc_ecc_points.o ltc/pk/ecc/ltc_ecc_projective_add_point.o ltc/pk/ecc/ltc_ecc_projective_dbl_point.o \
118 ltc/pk/ecc/ltc_ecc_verify_key.o ltc/pk/pkcs1/pkcs_1_i2osp.o ltc/pk/pkcs1/pkcs_1_mgf1.o \
119 ltc/pk/pkcs1/pkcs_1_oaep_decode.o ltc/pk/pkcs1/pkcs_1_oaep_encode.o ltc/pk/pkcs1/pkcs_1_os2ip.o \
120 ltc/pk/pkcs1/pkcs_1_pss_decode.o ltc/pk/pkcs1/pkcs_1_pss_encode.o ltc/pk/pkcs1/pkcs_1_v1_5_decode.o \
121 ltc/pk/pkcs1/pkcs_1_v1_5_encode.o ltc/pk/rsa/rsa_decrypt_key.o ltc/pk/rsa/rsa_encrypt_key.o \
122 ltc/pk/rsa/rsa_export.o ltc/pk/rsa/rsa_exptmod.o ltc/pk/rsa/rsa_free.o ltc/pk/rsa/rsa_get_size.o \
123 ltc/pk/rsa/rsa_import.o ltc/pk/rsa/rsa_import_pkcs8.o ltc/pk/rsa/rsa_import_x509.o \
98 ltc/pk/asn1/pkcs8/pkcs8_decode_flexi.o ltc/pk/asn1/x509/x509_decode_public_key_from_certificate.o \
99 ltc/pk/asn1/x509/x509_decode_subject_public_key_info.o ltc/pk/asn1/x509/x509_encode_subject_public_key_info.o \
100 ltc/pk/dh/dh.o ltc/pk/dh/dh_check_pubkey.o ltc/pk/dh/dh_export.o ltc/pk/dh/dh_export_key.o \
101 ltc/pk/dh/dh_free.o ltc/pk/dh/dh_generate_key.o ltc/pk/dh/dh_import.o ltc/pk/dh/dh_set.o \
102 ltc/pk/dh/dh_set_pg_dhparam.o ltc/pk/dh/dh_shared_secret.o ltc/pk/dsa/dsa_decrypt_key.o \
103 ltc/pk/dsa/dsa_encrypt_key.o ltc/pk/dsa/dsa_export.o ltc/pk/dsa/dsa_free.o ltc/pk/dsa/dsa_generate_key.o \
104 ltc/pk/dsa/dsa_generate_pqg.o ltc/pk/dsa/dsa_import.o ltc/pk/dsa/dsa_make_key.o ltc/pk/dsa/dsa_set.o \
105 ltc/pk/dsa/dsa_set_pqg_dsaparam.o ltc/pk/dsa/dsa_shared_secret.o ltc/pk/dsa/dsa_sign_hash.o \
106 ltc/pk/dsa/dsa_verify_hash.o ltc/pk/dsa/dsa_verify_key.o ltc/pk/ecc/ecc.o ltc/pk/ecc/ecc_ansi_x963_export.o \
107 ltc/pk/ecc/ecc_ansi_x963_import.o ltc/pk/ecc/ecc_decrypt_key.o ltc/pk/ecc/ecc_encrypt_key.o \
108 ltc/pk/ecc/ecc_export.o ltc/pk/ecc/ecc_export_openssl.o ltc/pk/ecc/ecc_find_curve.o \
109 ltc/pk/ecc/ecc_free.o ltc/pk/ecc/ecc_get_key.o ltc/pk/ecc/ecc_get_oid_str.o ltc/pk/ecc/ecc_get_size.o \
110 ltc/pk/ecc/ecc_import.o ltc/pk/ecc/ecc_import_openssl.o ltc/pk/ecc/ecc_import_pkcs8.o \
111 ltc/pk/ecc/ecc_import_x509.o ltc/pk/ecc/ecc_make_key.o ltc/pk/ecc/ecc_recover_key.o \
112 ltc/pk/ecc/ecc_set_curve.o ltc/pk/ecc/ecc_set_curve_internal.o ltc/pk/ecc/ecc_set_key.o \
113 ltc/pk/ecc/ecc_shared_secret.o ltc/pk/ecc/ecc_sign_hash.o ltc/pk/ecc/ecc_sizes.o \
114 ltc/pk/ecc/ecc_ssh_ecdsa_encode_name.o ltc/pk/ecc/ecc_verify_hash.o ltc/pk/ecc/ltc_ecc_export_point.o \
115 ltc/pk/ecc/ltc_ecc_import_point.o ltc/pk/ecc/ltc_ecc_is_point.o ltc/pk/ecc/ltc_ecc_is_point_at_infinity.o \
116 ltc/pk/ecc/ltc_ecc_map.o ltc/pk/ecc/ltc_ecc_mul2add.o ltc/pk/ecc/ltc_ecc_mulmod.o \
117 ltc/pk/ecc/ltc_ecc_mulmod_timing.o ltc/pk/ecc/ltc_ecc_points.o ltc/pk/ecc/ltc_ecc_projective_add_point.o \
118 ltc/pk/ecc/ltc_ecc_projective_dbl_point.o ltc/pk/ecc/ltc_ecc_verify_key.o ltc/pk/pkcs1/pkcs_1_i2osp.o \
119 ltc/pk/pkcs1/pkcs_1_mgf1.o ltc/pk/pkcs1/pkcs_1_oaep_decode.o ltc/pk/pkcs1/pkcs_1_oaep_encode.o \
120 ltc/pk/pkcs1/pkcs_1_os2ip.o ltc/pk/pkcs1/pkcs_1_pss_decode.o ltc/pk/pkcs1/pkcs_1_pss_encode.o \
121 ltc/pk/pkcs1/pkcs_1_v1_5_decode.o ltc/pk/pkcs1/pkcs_1_v1_5_encode.o ltc/pk/rsa/rsa_decrypt_key.o \
122 ltc/pk/rsa/rsa_encrypt_key.o ltc/pk/rsa/rsa_export.o ltc/pk/rsa/rsa_exptmod.o ltc/pk/rsa/rsa_free.o \
123 ltc/pk/rsa/rsa_get_size.o ltc/pk/rsa/rsa_import.o ltc/pk/rsa/rsa_import_pkcs8.o ltc/pk/rsa/rsa_import_x509.o \
124124 ltc/pk/rsa/rsa_make_key.o ltc/pk/rsa/rsa_set.o ltc/pk/rsa/rsa_sign_hash.o ltc/pk/rsa/rsa_sign_saltlen_get.o \
125125 ltc/pk/rsa/rsa_verify_hash.o ltc/prngs/chacha20.o ltc/prngs/fortuna.o ltc/prngs/rc4.o \
126126 ltc/prngs/rng_get_bytes.o ltc/prngs/rng_make_prng.o ltc/prngs/sober128.o ltc/prngs/sprng.o \
141141 ltm/bn_mp_div_3.o ltm/bn_mp_div_d.o ltm/bn_mp_dr_is_modulus.o ltm/bn_mp_dr_reduce.o \
142142 ltm/bn_mp_dr_setup.o ltm/bn_mp_exch.o ltm/bn_mp_export.o ltm/bn_mp_exptmod.o ltm/bn_mp_exptmod_fast.o \
143143 ltm/bn_mp_expt_d.o ltm/bn_mp_expt_d_ex.o ltm/bn_mp_exteuclid.o ltm/bn_mp_fread.o \
144 ltm/bn_mp_fwrite.o ltm/bn_mp_gcd.o ltm/bn_mp_get_int.o ltm/bn_mp_get_long.o ltm/bn_mp_grow.o \
145 ltm/bn_mp_import.o ltm/bn_mp_init.o ltm/bn_mp_init_copy.o ltm/bn_mp_init_multi.o \
144 ltm/bn_mp_fwrite.o ltm/bn_mp_gcd.o ltm/bn_mp_get_bit.o ltm/bn_mp_get_int.o ltm/bn_mp_get_long.o \
145 ltm/bn_mp_grow.o ltm/bn_mp_import.o ltm/bn_mp_init.o ltm/bn_mp_init_copy.o ltm/bn_mp_init_multi.o \
146146 ltm/bn_mp_init_set.o ltm/bn_mp_init_set_int.o ltm/bn_mp_init_size.o ltm/bn_mp_invmod.o \
147147 ltm/bn_mp_invmod_slow.o ltm/bn_mp_is_square.o ltm/bn_mp_jacobi.o ltm/bn_mp_karatsuba_mul.o \
148 ltm/bn_mp_karatsuba_sqr.o ltm/bn_mp_lcm.o ltm/bn_mp_lshd.o ltm/bn_mp_mod.o ltm/bn_mp_mod_2d.o \
149 ltm/bn_mp_mod_d.o ltm/bn_mp_montgomery_calc_normalization.o ltm/bn_mp_montgomery_reduce.o \
150 ltm/bn_mp_montgomery_setup.o ltm/bn_mp_mul.o ltm/bn_mp_mulmod.o ltm/bn_mp_mul_2.o \
151 ltm/bn_mp_mul_2d.o ltm/bn_mp_mul_d.o ltm/bn_mp_neg.o ltm/bn_mp_n_root.o ltm/bn_mp_n_root_ex.o \
152 ltm/bn_mp_or.o ltm/bn_mp_prime_fermat.o ltm/bn_mp_prime_is_divisible.o ltm/bn_mp_prime_is_prime.o \
153 ltm/bn_mp_prime_miller_rabin.o ltm/bn_mp_prime_next_prime.o ltm/bn_mp_prime_rabin_miller_trials.o \
154 ltm/bn_mp_prime_random_ex.o ltm/bn_mp_radix_size.o ltm/bn_mp_radix_smap.o ltm/bn_mp_rand.o \
155 ltm/bn_mp_read_radix.o ltm/bn_mp_read_signed_bin.o ltm/bn_mp_read_unsigned_bin.o \
148 ltm/bn_mp_karatsuba_sqr.o ltm/bn_mp_kronecker.o ltm/bn_mp_lcm.o ltm/bn_mp_lshd.o \
149 ltm/bn_mp_mod.o ltm/bn_mp_mod_2d.o ltm/bn_mp_mod_d.o ltm/bn_mp_montgomery_calc_normalization.o \
150 ltm/bn_mp_montgomery_reduce.o ltm/bn_mp_montgomery_setup.o ltm/bn_mp_mul.o ltm/bn_mp_mulmod.o \
151 ltm/bn_mp_mul_2.o ltm/bn_mp_mul_2d.o ltm/bn_mp_mul_d.o ltm/bn_mp_neg.o ltm/bn_mp_n_root.o \
152 ltm/bn_mp_n_root_ex.o ltm/bn_mp_or.o ltm/bn_mp_prime_fermat.o ltm/bn_mp_prime_frobenius_underwood.o \
153 ltm/bn_mp_prime_is_divisible.o ltm/bn_mp_prime_is_prime.o ltm/bn_mp_prime_miller_rabin.o \
154 ltm/bn_mp_prime_next_prime.o ltm/bn_mp_prime_rabin_miller_trials.o ltm/bn_mp_prime_random_ex.o \
155 ltm/bn_mp_prime_strong_lucas_selfridge.o ltm/bn_mp_radix_size.o ltm/bn_mp_radix_smap.o \
156 ltm/bn_mp_rand.o ltm/bn_mp_read_radix.o ltm/bn_mp_read_signed_bin.o ltm/bn_mp_read_unsigned_bin.o \
156157 ltm/bn_mp_reduce.o ltm/bn_mp_reduce_2k.o ltm/bn_mp_reduce_2k_l.o ltm/bn_mp_reduce_2k_setup.o \
157158 ltm/bn_mp_reduce_2k_setup_l.o ltm/bn_mp_reduce_is_2k.o ltm/bn_mp_reduce_is_2k_l.o \
158159 ltm/bn_mp_reduce_setup.o ltm/bn_mp_rshd.o ltm/bn_mp_set.o ltm/bn_mp_set_int.o ltm/bn_mp_set_long.o \
101101 ltc/pk/asn1/der/utctime/der_length_utctime.obj ltc/pk/asn1/der/utf8/der_decode_utf8_string.obj \
102102 ltc/pk/asn1/der/utf8/der_encode_utf8_string.obj ltc/pk/asn1/der/utf8/der_length_utf8_string.obj \
103103 ltc/pk/asn1/oid/pk_get_oid.obj ltc/pk/asn1/oid/pk_oid_cmp.obj ltc/pk/asn1/oid/pk_oid_str.obj \
104 ltc/pk/asn1/pkcs8/pkcs8_decode_flexi.obj ltc/pk/asn1/x509/x509_decode_subject_public_key_info.obj \
105 ltc/pk/asn1/x509/x509_encode_subject_public_key_info.obj ltc/pk/dh/dh.obj ltc/pk/dh/dh_check_pubkey.obj \
106 ltc/pk/dh/dh_export.obj ltc/pk/dh/dh_export_key.obj ltc/pk/dh/dh_free.obj ltc/pk/dh/dh_generate_key.obj \
107 ltc/pk/dh/dh_import.obj ltc/pk/dh/dh_set.obj ltc/pk/dh/dh_set_pg_dhparam.obj ltc/pk/dh/dh_shared_secret.obj \
108 ltc/pk/dsa/dsa_decrypt_key.obj ltc/pk/dsa/dsa_encrypt_key.obj ltc/pk/dsa/dsa_export.obj \
109 ltc/pk/dsa/dsa_free.obj ltc/pk/dsa/dsa_generate_key.obj ltc/pk/dsa/dsa_generate_pqg.obj \
110 ltc/pk/dsa/dsa_import.obj ltc/pk/dsa/dsa_make_key.obj ltc/pk/dsa/dsa_set.obj ltc/pk/dsa/dsa_set_pqg_dsaparam.obj \
104 ltc/pk/asn1/pkcs8/pkcs8_decode_flexi.obj ltc/pk/asn1/x509/x509_decode_public_key_from_certificate.obj \
105 ltc/pk/asn1/x509/x509_decode_subject_public_key_info.obj ltc/pk/asn1/x509/x509_encode_subject_public_key_info.obj \
106 ltc/pk/dh/dh.obj ltc/pk/dh/dh_check_pubkey.obj ltc/pk/dh/dh_export.obj ltc/pk/dh/dh_export_key.obj \
107 ltc/pk/dh/dh_free.obj ltc/pk/dh/dh_generate_key.obj ltc/pk/dh/dh_import.obj ltc/pk/dh/dh_set.obj \
108 ltc/pk/dh/dh_set_pg_dhparam.obj ltc/pk/dh/dh_shared_secret.obj ltc/pk/dsa/dsa_decrypt_key.obj \
109 ltc/pk/dsa/dsa_encrypt_key.obj ltc/pk/dsa/dsa_export.obj ltc/pk/dsa/dsa_free.obj \
110 ltc/pk/dsa/dsa_generate_key.obj ltc/pk/dsa/dsa_generate_pqg.obj ltc/pk/dsa/dsa_import.obj \
111 ltc/pk/dsa/dsa_make_key.obj ltc/pk/dsa/dsa_set.obj ltc/pk/dsa/dsa_set_pqg_dsaparam.obj \
111112 ltc/pk/dsa/dsa_shared_secret.obj ltc/pk/dsa/dsa_sign_hash.obj ltc/pk/dsa/dsa_verify_hash.obj \
112113 ltc/pk/dsa/dsa_verify_key.obj ltc/pk/ecc/ecc.obj ltc/pk/ecc/ecc_ansi_x963_export.obj \
113114 ltc/pk/ecc/ecc_ansi_x963_import.obj ltc/pk/ecc/ecc_decrypt_key.obj ltc/pk/ecc/ecc_encrypt_key.obj \
149150 ltm/bn_mp_dr_is_modulus.obj ltm/bn_mp_dr_reduce.obj ltm/bn_mp_dr_setup.obj ltm/bn_mp_exch.obj \
150151 ltm/bn_mp_export.obj ltm/bn_mp_exptmod.obj ltm/bn_mp_exptmod_fast.obj ltm/bn_mp_expt_d.obj \
151152 ltm/bn_mp_expt_d_ex.obj ltm/bn_mp_exteuclid.obj ltm/bn_mp_fread.obj ltm/bn_mp_fwrite.obj \
152 ltm/bn_mp_gcd.obj ltm/bn_mp_get_int.obj ltm/bn_mp_get_long.obj ltm/bn_mp_grow.obj \
153 ltm/bn_mp_import.obj ltm/bn_mp_init.obj ltm/bn_mp_init_copy.obj ltm/bn_mp_init_multi.obj \
154 ltm/bn_mp_init_set.obj ltm/bn_mp_init_set_int.obj ltm/bn_mp_init_size.obj ltm/bn_mp_invmod.obj \
155 ltm/bn_mp_invmod_slow.obj ltm/bn_mp_is_square.obj ltm/bn_mp_jacobi.obj ltm/bn_mp_karatsuba_mul.obj \
156 ltm/bn_mp_karatsuba_sqr.obj ltm/bn_mp_lcm.obj ltm/bn_mp_lshd.obj ltm/bn_mp_mod.obj \
157 ltm/bn_mp_mod_2d.obj ltm/bn_mp_mod_d.obj ltm/bn_mp_montgomery_calc_normalization.obj \
153 ltm/bn_mp_gcd.obj ltm/bn_mp_get_bit.obj ltm/bn_mp_get_int.obj ltm/bn_mp_get_long.obj \
154 ltm/bn_mp_grow.obj ltm/bn_mp_import.obj ltm/bn_mp_init.obj ltm/bn_mp_init_copy.obj \
155 ltm/bn_mp_init_multi.obj ltm/bn_mp_init_set.obj ltm/bn_mp_init_set_int.obj ltm/bn_mp_init_size.obj \
156 ltm/bn_mp_invmod.obj ltm/bn_mp_invmod_slow.obj ltm/bn_mp_is_square.obj ltm/bn_mp_jacobi.obj \
157 ltm/bn_mp_karatsuba_mul.obj ltm/bn_mp_karatsuba_sqr.obj ltm/bn_mp_kronecker.obj ltm/bn_mp_lcm.obj \
158 ltm/bn_mp_lshd.obj ltm/bn_mp_mod.obj ltm/bn_mp_mod_2d.obj ltm/bn_mp_mod_d.obj ltm/bn_mp_montgomery_calc_normalization.obj \
158159 ltm/bn_mp_montgomery_reduce.obj ltm/bn_mp_montgomery_setup.obj ltm/bn_mp_mul.obj \
159160 ltm/bn_mp_mulmod.obj ltm/bn_mp_mul_2.obj ltm/bn_mp_mul_2d.obj ltm/bn_mp_mul_d.obj \
160161 ltm/bn_mp_neg.obj ltm/bn_mp_n_root.obj ltm/bn_mp_n_root_ex.obj ltm/bn_mp_or.obj ltm/bn_mp_prime_fermat.obj \
161 ltm/bn_mp_prime_is_divisible.obj ltm/bn_mp_prime_is_prime.obj ltm/bn_mp_prime_miller_rabin.obj \
162 ltm/bn_mp_prime_next_prime.obj ltm/bn_mp_prime_rabin_miller_trials.obj ltm/bn_mp_prime_random_ex.obj \
163 ltm/bn_mp_radix_size.obj ltm/bn_mp_radix_smap.obj ltm/bn_mp_rand.obj ltm/bn_mp_read_radix.obj \
164 ltm/bn_mp_read_signed_bin.obj ltm/bn_mp_read_unsigned_bin.obj ltm/bn_mp_reduce.obj \
165 ltm/bn_mp_reduce_2k.obj ltm/bn_mp_reduce_2k_l.obj ltm/bn_mp_reduce_2k_setup.obj ltm/bn_mp_reduce_2k_setup_l.obj \
166 ltm/bn_mp_reduce_is_2k.obj ltm/bn_mp_reduce_is_2k_l.obj ltm/bn_mp_reduce_setup.obj \
167 ltm/bn_mp_rshd.obj ltm/bn_mp_set.obj ltm/bn_mp_set_int.obj ltm/bn_mp_set_long.obj \
168 ltm/bn_mp_shrink.obj ltm/bn_mp_signed_bin_size.obj ltm/bn_mp_sqr.obj ltm/bn_mp_sqrmod.obj \
169 ltm/bn_mp_sqrt.obj ltm/bn_mp_sqrtmod_prime.obj ltm/bn_mp_sub.obj ltm/bn_mp_submod.obj \
170 ltm/bn_mp_sub_d.obj ltm/bn_mp_tc_and.obj ltm/bn_mp_tc_div_2d.obj ltm/bn_mp_tc_or.obj \
171 ltm/bn_mp_tc_xor.obj ltm/bn_mp_toom_mul.obj ltm/bn_mp_toom_sqr.obj ltm/bn_mp_toradix.obj \
172 ltm/bn_mp_toradix_n.obj ltm/bn_mp_to_signed_bin.obj ltm/bn_mp_to_signed_bin_n.obj \
162 ltm/bn_mp_prime_frobenius_underwood.obj ltm/bn_mp_prime_is_divisible.obj ltm/bn_mp_prime_is_prime.obj \
163 ltm/bn_mp_prime_miller_rabin.obj ltm/bn_mp_prime_next_prime.obj ltm/bn_mp_prime_rabin_miller_trials.obj \
164 ltm/bn_mp_prime_random_ex.obj ltm/bn_mp_prime_strong_lucas_selfridge.obj ltm/bn_mp_radix_size.obj \
165 ltm/bn_mp_radix_smap.obj ltm/bn_mp_rand.obj ltm/bn_mp_read_radix.obj ltm/bn_mp_read_signed_bin.obj \
166 ltm/bn_mp_read_unsigned_bin.obj ltm/bn_mp_reduce.obj ltm/bn_mp_reduce_2k.obj ltm/bn_mp_reduce_2k_l.obj \
167 ltm/bn_mp_reduce_2k_setup.obj ltm/bn_mp_reduce_2k_setup_l.obj ltm/bn_mp_reduce_is_2k.obj \
168 ltm/bn_mp_reduce_is_2k_l.obj ltm/bn_mp_reduce_setup.obj ltm/bn_mp_rshd.obj ltm/bn_mp_set.obj \
169 ltm/bn_mp_set_int.obj ltm/bn_mp_set_long.obj ltm/bn_mp_shrink.obj ltm/bn_mp_signed_bin_size.obj \
170 ltm/bn_mp_sqr.obj ltm/bn_mp_sqrmod.obj ltm/bn_mp_sqrt.obj ltm/bn_mp_sqrtmod_prime.obj \
171 ltm/bn_mp_sub.obj ltm/bn_mp_submod.obj ltm/bn_mp_sub_d.obj ltm/bn_mp_tc_and.obj ltm/bn_mp_tc_div_2d.obj \
172 ltm/bn_mp_tc_or.obj ltm/bn_mp_tc_xor.obj ltm/bn_mp_toom_mul.obj ltm/bn_mp_toom_sqr.obj \
173 ltm/bn_mp_toradix.obj ltm/bn_mp_toradix_n.obj ltm/bn_mp_to_signed_bin.obj ltm/bn_mp_to_signed_bin_n.obj \
173174 ltm/bn_mp_to_unsigned_bin.obj ltm/bn_mp_to_unsigned_bin_n.obj ltm/bn_mp_unsigned_bin_size.obj \
174175 ltm/bn_mp_xor.obj ltm/bn_mp_zero.obj ltm/bn_prime_tab.obj ltm/bn_reverse.obj ltm/bn_s_mp_add.obj \
175176 ltm/bn_s_mp_exptmod.obj ltm/bn_s_mp_mul_digs.obj ltm/bn_s_mp_mul_high_digs.obj ltm/bn_s_mp_sqr.obj \
88
99 /* Defines the LTC_ARGCHK macro used within the library */
1010 /* ARGTYPE is defined in tomcrypt_cfg.h */
11
12 /* ARGTYPE is per default defined to 0 */
1113 #if ARGTYPE == 0
1214
1315 #include <signal.h>
1416
15 /* this is the default LibTomCrypt macro */
16 #if defined(__clang__) || defined(__GNUC_MINOR__)
17 #define NORETURN __attribute__ ((noreturn))
18 #else
19 #define NORETURN
20 #endif
21
22 void crypt_argchk(const char *v, const char *s, int d) NORETURN;
17 LTC_NORETURN void crypt_argchk(const char *v, const char *s, int d);
2318 #define LTC_ARGCHK(x) do { if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); } }while(0)
2419 #define LTC_ARGCHKVD(x) do { if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); } }while(0)
2520
3631
3732 #elif ARGTYPE == 3
3833
39 #define LTC_ARGCHK(x)
34 #define LTC_ARGCHK(x) LTC_UNUSED_PARAM(x)
4035 #define LTC_ARGCHKVD(x) LTC_ARGCHK(x)
4136
4237 #elif ARGTYPE == 4
5858 #define LTC_INLINE inline
5959 #else
6060 #define LTC_INLINE
61 #endif
62
63 #if defined(__clang__) || defined(__GNUC_MINOR__)
64 #define LTC_NORETURN __attribute__ ((noreturn))
65 #elif defined(_MSC_VER)
66 #define LTC_NORETURN __declspec(noreturn)
67 #else
68 #define LTC_NORETURN
6169 #endif
6270
6371 /* type of argument checking, 0=default, 1=fatal and 2=error+continue, 3=nothing */
553553 #endif
554554 #endif
555555
556 #if defined(LTC_MECC) || defined(LTC_MRSA) || defined(LTC_MDSA)
556 #if defined(LTC_MECC) || defined(LTC_MRSA) || defined(LTC_MDSA) || defined(LTC_SSH)
557557 /* Include the MPI functionality? (required by the PK algorithms) */
558558 #define LTC_MPI
559559
258258 /** the ECC params provided */
259259 extern const ltc_ecc_curve ltc_ecc_curves[];
260260
261 int ecc_test(void);
262261 void ecc_sizes(int *low, int *high);
263262 int ecc_get_size(const ecc_key *key);
264263
329329
330330 int der_utf8_valid_char(const wchar_t c);
331331
332 typedef int (*public_key_decode_cb)(const unsigned char *in, unsigned long inlen, void *ctx);
333
334 int x509_decode_public_key_from_certificate(const unsigned char *in, unsigned long inlen,
335 enum ltc_oid_id algorithm, ltc_asn1_type param_type,
336 ltc_asn1_list* parameters, unsigned long *parameters_len,
337 public_key_decode_cb callback, void *ctx);
338
332339 /* SUBJECT PUBLIC KEY INFO */
333340 int x509_encode_subject_public_key_info(unsigned char *out, unsigned long *outlen,
334341 unsigned int algorithm, const void* public_key, unsigned long public_key_len,
8888 static int set_int(void *a, ltc_mp_digit b)
8989 {
9090 LTC_ARGCHK(a != NULL);
91 #ifdef BN_MP_SET_INT_C
9192 return mpi_to_ltc_error(mp_set_int(a, b));
93 #else
94 mp_set_u32(a, b);
95 return CRYPT_OK;
96 #endif
9297 }
9398
9499 static unsigned long get_int(void *a)
95100 {
96101 LTC_ARGCHK(a != NULL);
102 #ifdef BN_MP_GET_INT_C
97103 return mp_get_int(a);
104 #else
105 return mp_get_ul(a);
106 #endif
98107 }
99108
100109 static ltc_mp_digit get_digit(void *a, int n)
411420 int err;
412421 LTC_ARGCHK(a != NULL);
413422 LTC_ARGCHK(c != NULL);
414 if (b == 0) {
415 b = LTC_MILLER_RABIN_REPS;
416 } /* if */
423 b = mp_prime_rabin_miller_trials(mp_count_bits(a));
417424 err = mpi_to_ltc_error(mp_prime_is_prime(a, b, c));
418425 *c = (*c == MP_YES) ? LTC_MP_YES : LTC_MP_NO;
419426 return err;
425432 return mpi_to_ltc_error(mp_rand(a, size));
426433 }
427434
435 #ifndef MP_DIGIT_BIT
436 #define MP_DIGIT_BIT DIGIT_BIT
437 #endif
438
428439 const ltc_math_descriptor ltm_desc = {
429440
430441 "LibTomMath",
431 (int)DIGIT_BIT,
442 (int)MP_DIGIT_BIT,
432443
433444 &init,
434445 &init_copy,
9898 type = mode & LTC_PAD_MASK;
9999
100100 if (*padded_length < l) {
101 #ifdef LTC_RNG_GET_BYTES
101102 if (type != LTC_PAD_ISO_10126) {
102103 *padded_length = l;
103104 } else {
104105 *padded_length = length + 256;
105106 }
107 #else
108 *padded_length = l;
109 #endif
106110 return CRYPT_BUFFER_OVERFLOW;
107111 }
108112
120120 size = strlen(sdata);
121121 STORE32H(size, out);
122122 out += 4;
123 XSTRNCPY((char *)out, sdata, size);
123 XMEMCPY(out, sdata, size);
124124 out += size;
125125 break;
126126 case LTC_SSHDATA_MPINT:
0 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
1 *
2 * LibTomCrypt is a library that provides various cryptographic
3 * algorithms in a highly modular and flexible manner.
4 *
5 * The library is free for all purposes without any express
6 * guarantee it works.
7 */
8 #include "tomcrypt_private.h"
9
10 /**
11 @file x509_decode_public_key_from_certificate.c
12 ASN.1 DER/X.509, decode a certificate
13 */
14
15 #ifdef LTC_DER
16
17 /* Check if it looks like a SubjectPublicKeyInfo */
18 #define LOOKS_LIKE_SPKI(l) ((l) != NULL) \
19 && ((l)->type == LTC_ASN1_SEQUENCE) \
20 && ((l)->child != NULL) \
21 && ((l)->child->type == LTC_ASN1_OBJECT_IDENTIFIER) \
22 && ((l)->next != NULL) \
23 && ((l)->next->type == LTC_ASN1_BIT_STRING)
24
25 /**
26 Try to decode the public key from a X.509 certificate
27 @param in The input buffer
28 @param inlen The length of the input buffer
29 @param algorithm One out of the enum #public_key_algorithms
30 @param param_type The parameters' type out of the enum ltc_asn1_type
31 @param parameters The parameters to include
32 @param parameters_len [in/out] The number of parameters to include
33 @param callback The callback
34 @param ctx The context passed to the callback
35 @return CRYPT_OK on success, CRYPT_NOP if no SubjectPublicKeyInfo was found
36 */
37 int x509_decode_public_key_from_certificate(const unsigned char *in, unsigned long inlen,
38 enum ltc_oid_id algorithm, ltc_asn1_type param_type,
39 ltc_asn1_list* parameters, unsigned long *parameters_len,
40 public_key_decode_cb callback, void *ctx)
41 {
42 int err;
43 unsigned char *tmpbuf;
44 unsigned long tmpbuf_len, tmp_inlen;
45 ltc_asn1_list *decoded_list = NULL, *l;
46
47 LTC_ARGCHK(in != NULL);
48 LTC_ARGCHK(inlen != 0);
49
50 tmpbuf_len = inlen;
51 tmpbuf = XCALLOC(1, tmpbuf_len);
52 if (tmpbuf == NULL) {
53 err = CRYPT_MEM;
54 goto LBL_OUT;
55 }
56
57 tmp_inlen = inlen;
58 if ((err = der_decode_sequence_flexi(in, &tmp_inlen, &decoded_list)) == CRYPT_OK) {
59 l = decoded_list;
60
61 err = CRYPT_NOP;
62
63 /* Move 2 levels up in the tree
64 SEQUENCE
65 SEQUENCE
66 ...
67 */
68 if ((l->type == LTC_ASN1_SEQUENCE) && (l->child != NULL)) {
69 l = l->child;
70 if ((l->type == LTC_ASN1_SEQUENCE) && (l->child != NULL)) {
71 l = l->child;
72
73 /* Move forward in the tree until we find this combination
74 ...
75 SEQUENCE
76 SEQUENCE
77 OBJECT IDENTIFIER <some PKA OID, e.g. 1.2.840.113549.1.1.1>
78 NULL
79 BIT STRING
80 */
81 do {
82 /* The additional check for l->data is there to make sure
83 * we won't try to decode a list that has been 'shrunk'
84 */
85 if ((l->type == LTC_ASN1_SEQUENCE)
86 && (l->data != NULL)
87 && LOOKS_LIKE_SPKI(l->child)) {
88 if (algorithm == PKA_EC) {
89 err = ecc_import_subject_public_key_info(l->data, l->size, ctx);
90 } else {
91 err = x509_decode_subject_public_key_info(l->data, l->size,
92 algorithm, tmpbuf, &tmpbuf_len,
93 param_type, parameters, parameters_len);
94 if (err == CRYPT_OK) {
95 err = callback(tmpbuf, tmpbuf_len, ctx);
96 goto LBL_OUT;
97 }
98 }
99 }
100 l = l->next;
101 } while(l);
102 }
103 }
104 }
105
106 LBL_OUT:
107 if (decoded_list) der_free_sequence_flexi(decoded_list);
108 if (tmpbuf != NULL) XFREE(tmpbuf);
109
110 return err;
111 }
112
113 #endif
114
115 /* ref: $Format:%D$ */
116 /* git commit: $Format:%H$ */
117 /* commit time: $Format:%ai$ */
3333 @param public_key_len [in/out] The length of the public key buffer and the written length
3434 @param parameters_type The parameters' type out of the enum ltc_asn1_type
3535 @param parameters The parameters to include
36 @param parameters_len [in/out]The number of parameters to include
36 @param parameters_len [in/out] The number of parameters to include
3737 @return CRYPT_OK on success
3838 */
3939 int x509_decode_subject_public_key_info(const unsigned char *in, unsigned long inlen,
4141 ltc_asn1_type parameters_type, ltc_asn1_list* parameters, unsigned long *parameters_len)
4242 {
4343 int err;
44 unsigned long len, alg_id_num;
44 unsigned long len, alg_id_num, tmplen;
4545 const char* oid;
4646 unsigned char *tmpbuf;
4747 unsigned long tmpoid[16];
48 unsigned long *_parameters_len;
4849 ltc_asn1_list alg_id[2];
4950 ltc_asn1_list subject_pubkey[2];
5051
5152 LTC_ARGCHK(in != NULL);
5253 LTC_ARGCHK(inlen != 0);
5354 LTC_ARGCHK(public_key_len != NULL);
55
5456 if (parameters_type != LTC_ASN1_EOL) {
55 LTC_ARGCHK(parameters_len != NULL);
57 if ((parameters == NULL) || (parameters_len == NULL)) {
58 tmplen = 0;
59 _parameters_len = &tmplen;
60 } else {
61 _parameters_len = parameters_len;
62 }
5663 }
5764
5865 err = pk_get_oid(algorithm, &oid);
7178 LTC_SET_ASN1(alg_id, 0, LTC_ASN1_OBJECT_IDENTIFIER, tmpoid, sizeof(tmpoid)/sizeof(tmpoid[0]));
7279 if (parameters_type == LTC_ASN1_EOL) {
7380 alg_id_num = 1;
74 }
75 else {
76 LTC_SET_ASN1(alg_id, 1, parameters_type, parameters, *parameters_len);
81 } else {
82 LTC_SET_ASN1(alg_id, 1, parameters_type, parameters, *_parameters_len);
7783 alg_id_num = 2;
7884 }
7985
8894 goto LBL_ERR;
8995 }
9096 if (parameters_type != LTC_ASN1_EOL) {
91 *parameters_len = alg_id[1].size;
97 *_parameters_len = alg_id[1].size;
9298 }
9399
94100 if ((err = pk_oid_cmp_with_asn1(oid, &alg_id[0])) != CRYPT_OK) {
111111 */
112112 int ecc_import_x509(const unsigned char *in, unsigned long inlen, ecc_key *key)
113113 {
114 int err;
115 unsigned long len;
116 ltc_asn1_list *decoded_list = NULL, *l;
117
118 LTC_ARGCHK(in != NULL);
119 LTC_ARGCHK(key != NULL);
120
121 len = inlen;
122 if ((err = der_decode_sequence_flexi(in, &len, &decoded_list)) == CRYPT_OK) {
123 err = CRYPT_ERROR;
124 l = decoded_list;
125 if (l->type == LTC_ASN1_SEQUENCE &&
126 l->child && l->child->type == LTC_ASN1_SEQUENCE) {
127 l = l->child->child;
128 while (l) {
129 if (l->type == LTC_ASN1_SEQUENCE && l->data &&
130 l->child && l->child->type == LTC_ASN1_SEQUENCE &&
131 l->child->child && l->child->child->type == LTC_ASN1_OBJECT_IDENTIFIER &&
132 l->child->next && l->child->next->type == LTC_ASN1_BIT_STRING) {
133 err = ecc_import_subject_public_key_info(l->data, l->size, key);
134 goto LBL_DONE;
135 }
136 l = l->next;
137 }
138 }
139 }
140
141 LBL_DONE:
142 if (decoded_list) der_free_sequence_flexi(decoded_list);
143 return err;
114 return x509_decode_public_key_from_certificate(in, inlen, PKA_EC, LTC_ASN1_EOL, NULL, NULL, NULL, key);
144115 }
145116
146117 #endif /* LTC_MECC */
1414
1515 #ifdef LTC_MRSA
1616
17 static int _rsa_decode(const unsigned char *in, unsigned long inlen, rsa_key *key)
18 {
19 /* now it should be SEQUENCE { INTEGER, INTEGER } */
20 return der_decode_sequence_multi(in, inlen,
21 LTC_ASN1_INTEGER, 1UL, key->N,
22 LTC_ASN1_INTEGER, 1UL, key->e,
23 LTC_ASN1_EOL, 0UL, NULL);
24 }
25
1726 /**
1827 Import an RSA key from a X.509 certificate
1928 @param in The packet to import from
2433 int rsa_import_x509(const unsigned char *in, unsigned long inlen, rsa_key *key)
2534 {
2635 int err;
27 unsigned char *tmpbuf;
28 unsigned long tmpbuf_len, tmp_inlen, len;
29 ltc_asn1_list *decoded_list = NULL, *l;
3036
3137 LTC_ARGCHK(in != NULL);
3238 LTC_ARGCHK(key != NULL);
3844 return err;
3945 }
4046
41 tmpbuf_len = inlen;
42 tmpbuf = XCALLOC(1, tmpbuf_len);
43 if (tmpbuf == NULL) {
44 err = CRYPT_MEM;
45 goto LBL_ERR;
47 if ((err = x509_decode_public_key_from_certificate(in, inlen,
48 PKA_RSA, LTC_ASN1_NULL,
49 NULL, NULL,
50 (public_key_decode_cb)_rsa_decode, key)) != CRYPT_OK) {
51 rsa_free(key);
52 } else {
53 key->type = PK_PUBLIC;
4654 }
47
48 tmp_inlen = inlen;
49 if ((err = der_decode_sequence_flexi(in, &tmp_inlen, &decoded_list)) == CRYPT_OK) {
50 l = decoded_list;
51 /* Move 2 levels up in the tree
52 SEQUENCE
53 SEQUENCE
54 ...
55 */
56 if (l->type == LTC_ASN1_SEQUENCE && l->child) {
57 l = l->child;
58 if (l->type == LTC_ASN1_SEQUENCE && l->child) {
59 l = l->child;
60
61 err = CRYPT_ERROR;
62
63 /* Move forward in the tree until we find this combination
64 ...
65 SEQUENCE
66 SEQUENCE
67 OBJECT IDENTIFIER 1.2.840.113549.1.1.1
68 NULL
69 BIT STRING
70 */
71 do {
72 /* The additional check for l->data is there to make sure
73 * we won't try to decode a list that has been 'shrunk'
74 */
75 if (l->type == LTC_ASN1_SEQUENCE && l->data && l->child &&
76 l->child->type == LTC_ASN1_SEQUENCE && l->child->child &&
77 l->child->child->type == LTC_ASN1_OBJECT_IDENTIFIER && l->child->next &&
78 l->child->next->type == LTC_ASN1_BIT_STRING) {
79 len = 0;
80 err = x509_decode_subject_public_key_info(l->data, l->size,
81 PKA_RSA, tmpbuf, &tmpbuf_len,
82 LTC_ASN1_NULL, NULL, &len);
83 if (err == CRYPT_OK) {
84 /* now it should be SEQUENCE { INTEGER, INTEGER } */
85 if ((err = der_decode_sequence_multi(tmpbuf, tmpbuf_len,
86 LTC_ASN1_INTEGER, 1UL, key->N,
87 LTC_ASN1_INTEGER, 1UL, key->e,
88 LTC_ASN1_EOL, 0UL, NULL)) != CRYPT_OK) {
89 goto LBL_ERR;
90 }
91 key->type = PK_PUBLIC;
92 err = CRYPT_OK;
93 goto LBL_FREE;
94 }
95 }
96 l = l->next;
97 } while(l);
98 }
99 }
100 }
101
102
103 LBL_ERR:
104 rsa_free(key);
105
106 LBL_FREE:
107 if (decoded_list) der_free_sequence_flexi(decoded_list);
108 if (tmpbuf != NULL) XFREE(tmpbuf);
10955
11056 return err;
11157 }
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 static const struct {
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* computes the modular inverse via binary extended euclidean algorithm,
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* computes xR**-1 == x (mod N) via Montgomery Reduction
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* Fast (comba) multiplier
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* this is a modified version of fast_s_mul_digs that only produces
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* the jist of squaring...
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* computes a = 2**b
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* b = |a|
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* high level addition (handles signs) */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* single digit addition */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* d = a + b (mod c) */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* AND two ints together */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* trim unused digits
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* clear one (frees) */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 #include <stdarg.h>
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* compare two ints (signed)*/
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* compare a digit */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* compare maginitude of two ints (unsigned) */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 static const int lnz[16] = {
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* b = ~a */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* copy, b = a */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* returns the number of bits in an int */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 #ifdef BN_MP_DIV_SMALL
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* b = a/2 */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* shift right by a certain bit count (store quotient in c, optional remainder in d) */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* divide by three (based on routine from MPI and the GMP manual) */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 static int s_is_power_of_two(mp_digit b, int *p)
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* determines if a number is a valid DR modulus */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* reduce "x" in place modulo "n" using the Diminished Radix algorithm.
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* determines the setup value */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* swap the elements of two integers, for cases where you can't simply swap the
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* based on gmp's mpz_export.
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* wrapper function for mp_expt_d_ex() */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* calculate c = a**b using a square-multiply algorithm */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* computes Y == G**X mod P, HAC pp.616, Algorithm 14.85
164163 }
165164
166165 /* compute the value at M[1<<(winsize-1)] by squaring M[1] (winsize-1) times */
167 if ((err = mp_copy(&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) {
166 if ((err = mp_copy(&M[1], &M[(size_t)1 << (winsize - 1)])) != MP_OKAY) {
168167 goto LBL_RES;
169168 }
170169
171170 for (x = 0; x < (winsize - 1); x++) {
172 if ((err = mp_sqr(&M[1 << (winsize - 1)], &M[1 << (winsize - 1)])) != MP_OKAY) {
173 goto LBL_RES;
174 }
175 if ((err = redux(&M[1 << (winsize - 1)], P, mp)) != MP_OKAY) {
171 if ((err = mp_sqr(&M[(size_t)1 << (winsize - 1)], &M[(size_t)1 << (winsize - 1)])) != MP_OKAY) {
172 goto LBL_RES;
173 }
174 if ((err = redux(&M[(size_t)1 << (winsize - 1)], P, mp)) != MP_OKAY) {
176175 goto LBL_RES;
177176 }
178177 }
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* Extended euclidean algorithm of (a, b) produces
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 #ifndef LTM_NO_FILE
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 #ifndef LTM_NO_FILE
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* Greatest Common Divisor using the binary method */
0 #include "tommath_private.h"
1 #ifdef BN_MP_GET_BIT_C
2
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis
4 *
5 * LibTomMath is a library that provides multiple-precision
6 * integer arithmetic as well as number theoretic functionality.
7 *
8 * The library was designed directly after the MPI library by
9 * Michael Fromberger but has been written from scratch with
10 * additional optimizations in place.
11 *
12 * SPDX-License-Identifier: Unlicense
13 */
14
15 /* Checks the bit at position b and returns MP_YES
16 if the bit is 1, MP_NO if it is 0 and MP_VAL
17 in case of error */
18 int mp_get_bit(const mp_int *a, int b)
19 {
20 int limb;
21 mp_digit bit, isset;
22
23 if (b < 0) {
24 return MP_VAL;
25 }
26
27 limb = b / DIGIT_BIT;
28
29 /*
30 * Zero is a special value with the member "used" set to zero.
31 * Needs to be tested before the check for the upper boundary
32 * otherwise (limb >= a->used) would be true for a = 0
33 */
34
35 if (mp_iszero(a) != MP_NO) {
36 return MP_NO;
37 }
38
39 if (limb >= a->used) {
40 return MP_VAL;
41 }
42
43 bit = (mp_digit)(1) << (b % DIGIT_BIT);
44
45 isset = a->dp[limb] & bit;
46 return (isset != 0u) ? MP_YES : MP_NO;
47 }
48
49 #endif
50
51 /* ref: $Format:%D$ */
52 /* git commit: $Format:%H$ */
53 /* commit time: $Format:%ai$ */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* get the lower 32-bits of an mp_int */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* get the lower unsigned long of an mp_int, platform dependent */
3635 return res;
3736 }
3837 #endif
38
39 /* ref: $Format:%D$ */
40 /* git commit: $Format:%H$ */
41 /* commit time: $Format:%ai$ */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* grow as required */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* based on gmp's mpz_import.
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* init a new mp_int */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* creates "a" then copies b into it */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 #include <stdarg.h>
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* initialize and set a digit */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* initialize and set a digit */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* init an mp_init for a given size */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* hac 14.61, pp608 */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* hac 14.61, pp608 */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* Check if remainders are possible squares - fast exclude non-squares */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* computes the jacobi c = (a | n) (or Legendre if n is prime)
16 * HAC pp. 73 Algorithm 2.149
17 * HAC is wrong here, as the special case of (0 | 1) is not
18 * handled correctly.
15 * Kept for legacy reasons, please use mp_kronecker() instead
1916 */
2017 int mp_jacobi(const mp_int *a, const mp_int *n, int *c)
2118 {
22 mp_int a1, p1;
23 int k, s, r, res;
24 mp_digit residue;
25
2619 /* if a < 0 return MP_VAL */
2720 if (mp_isneg(a) == MP_YES) {
2821 return MP_VAL;
3326 return MP_VAL;
3427 }
3528
36 /* step 1. handle case of a == 0 */
37 if (mp_iszero(a) == MP_YES) {
38 /* special case of a == 0 and n == 1 */
39 if (mp_cmp_d(n, 1uL) == MP_EQ) {
40 *c = 1;
41 } else {
42 *c = 0;
43 }
44 return MP_OKAY;
45 }
46
47 /* step 2. if a == 1, return 1 */
48 if (mp_cmp_d(a, 1uL) == MP_EQ) {
49 *c = 1;
50 return MP_OKAY;
51 }
52
53 /* default */
54 s = 0;
55
56 /* step 3. write a = a1 * 2**k */
57 if ((res = mp_init_copy(&a1, a)) != MP_OKAY) {
58 return res;
59 }
60
61 if ((res = mp_init(&p1)) != MP_OKAY) {
62 goto LBL_A1;
63 }
64
65 /* divide out larger power of two */
66 k = mp_cnt_lsb(&a1);
67 if ((res = mp_div_2d(&a1, k, &a1, NULL)) != MP_OKAY) {
68 goto LBL_P1;
69 }
70
71 /* step 4. if e is even set s=1 */
72 if (((unsigned)k & 1u) == 0u) {
73 s = 1;
74 } else {
75 /* else set s=1 if p = 1/7 (mod 8) or s=-1 if p = 3/5 (mod 8) */
76 residue = n->dp[0] & 7u;
77
78 if ((residue == 1u) || (residue == 7u)) {
79 s = 1;
80 } else if ((residue == 3u) || (residue == 5u)) {
81 s = -1;
82 }
83 }
84
85 /* step 5. if p == 3 (mod 4) *and* a1 == 3 (mod 4) then s = -s */
86 if (((n->dp[0] & 3u) == 3u) && ((a1.dp[0] & 3u) == 3u)) {
87 s = -s;
88 }
89
90 /* if a1 == 1 we're done */
91 if (mp_cmp_d(&a1, 1uL) == MP_EQ) {
92 *c = s;
93 } else {
94 /* n1 = n mod a1 */
95 if ((res = mp_mod(n, &a1, &p1)) != MP_OKAY) {
96 goto LBL_P1;
97 }
98 if ((res = mp_jacobi(&p1, &a1, &r)) != MP_OKAY) {
99 goto LBL_P1;
100 }
101 *c = s * r;
102 }
103
104 /* done */
105 res = MP_OKAY;
106 LBL_P1:
107 mp_clear(&p1);
108 LBL_A1:
109 mp_clear(&a1);
110 return res;
29 return mp_kronecker(a, n, c);
11130 }
11231 #endif
11332
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* c = |a| * |b| using Karatsuba Multiplication using
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* Karatsuba squaring, computes b = a*a using three
0 #include "tommath_private.h"
1 #ifdef BN_MP_KRONECKER_C
2
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis
4 *
5 * LibTomMath is a library that provides multiple-precision
6 * integer arithmetic as well as number theoretic functionality.
7 *
8 * The library was designed directly after the MPI library by
9 * Michael Fromberger but has been written from scratch with
10 * additional optimizations in place.
11 *
12 * SPDX-License-Identifier: Unlicense
13 */
14
15 /*
16 Kronecker symbol (a|p)
17 Straightforward implementation of algorithm 1.4.10 in
18 Henri Cohen: "A Course in Computational Algebraic Number Theory"
19
20 @book{cohen2013course,
21 title={A course in computational algebraic number theory},
22 author={Cohen, Henri},
23 volume={138},
24 year={2013},
25 publisher={Springer Science \& Business Media}
26 }
27 */
28 int mp_kronecker(const mp_int *a, const mp_int *p, int *c)
29 {
30 mp_int a1, p1, r;
31
32 int e = MP_OKAY;
33 int v, k;
34
35 static const int table[8] = {0, 1, 0, -1, 0, -1, 0, 1};
36
37 if (mp_iszero(p) != MP_NO) {
38 if ((a->used == 1) && (a->dp[0] == 1u)) {
39 *c = 1;
40 return e;
41 } else {
42 *c = 0;
43 return e;
44 }
45 }
46
47 if ((mp_iseven(a) != MP_NO) && (mp_iseven(p) != MP_NO)) {
48 *c = 0;
49 return e;
50 }
51
52 if ((e = mp_init_copy(&a1, a)) != MP_OKAY) {
53 return e;
54 }
55 if ((e = mp_init_copy(&p1, p)) != MP_OKAY) {
56 goto LBL_KRON_0;
57 }
58
59 v = mp_cnt_lsb(&p1);
60 if ((e = mp_div_2d(&p1, v, &p1, NULL)) != MP_OKAY) {
61 goto LBL_KRON_1;
62 }
63
64 if ((v & 0x1) == 0) {
65 k = 1;
66 } else {
67 k = table[a->dp[0] & 7u];
68 }
69
70 if (p1.sign == MP_NEG) {
71 p1.sign = MP_ZPOS;
72 if (a1.sign == MP_NEG) {
73 k = -k;
74 }
75 }
76
77 if ((e = mp_init(&r)) != MP_OKAY) {
78 goto LBL_KRON_1;
79 }
80
81 for (;;) {
82 if (mp_iszero(&a1) != MP_NO) {
83 if (mp_cmp_d(&p1, 1uL) == MP_EQ) {
84 *c = k;
85 goto LBL_KRON;
86 } else {
87 *c = 0;
88 goto LBL_KRON;
89 }
90 }
91
92 v = mp_cnt_lsb(&a1);
93 if ((e = mp_div_2d(&a1, v, &a1, NULL)) != MP_OKAY) {
94 goto LBL_KRON;
95 }
96
97 if ((v & 0x1) == 1) {
98 k = k * table[p1.dp[0] & 7u];
99 }
100
101 if (a1.sign == MP_NEG) {
102 /*
103 * Compute k = (-1)^((a1)*(p1-1)/4) * k
104 * a1.dp[0] + 1 cannot overflow because the MSB
105 * of the type mp_digit is not set by definition
106 */
107 if (((a1.dp[0] + 1u) & p1.dp[0] & 2u) != 0u) {
108 k = -k;
109 }
110 } else {
111 /* compute k = (-1)^((a1-1)*(p1-1)/4) * k */
112 if ((a1.dp[0] & p1.dp[0] & 2u) != 0u) {
113 k = -k;
114 }
115 }
116
117 if ((e = mp_copy(&a1, &r)) != MP_OKAY) {
118 goto LBL_KRON;
119 }
120 r.sign = MP_ZPOS;
121 if ((e = mp_mod(&p1, &r, &a1)) != MP_OKAY) {
122 goto LBL_KRON;
123 }
124 if ((e = mp_copy(&r, &p1)) != MP_OKAY) {
125 goto LBL_KRON;
126 }
127 }
128
129 LBL_KRON:
130 mp_clear(&r);
131 LBL_KRON_1:
132 mp_clear(&p1);
133 LBL_KRON_0:
134 mp_clear(&a1);
135
136 return e;
137 }
138
139 #endif
140
141 /* ref: $Format:%D$ */
142 /* git commit: $Format:%H$ */
143 /* commit time: $Format:%ai$ */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* computes least common multiple as |a*b|/(a, b) */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* shift left a certain amount of digits */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* c = a mod b, 0 <= c < b if b > 0, b < c <= 0 if b < 0 */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* calc a value mod 2**b */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c)
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /*
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* computes xR**-1 == x (mod N) via Montgomery Reduction */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* setups the montgomery reduction stuff */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* high level multiplication (handles sign) */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* b = a*2 */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* shift left by a certain bit count */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* multiply by a digit */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* d = a * b (mod c) */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* wrapper function for mp_n_root_ex()
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* find the n'th root of an integer
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* b = -a */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* OR two ints together */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* performs one Fermat test.
0 #include "tommath_private.h"
1 #ifdef BN_MP_PRIME_FROBENIUS_UNDERWOOD_C
2
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis
4 *
5 * LibTomMath is a library that provides multiple-precision
6 * integer arithmetic as well as number theoretic functionality.
7 *
8 * The library was designed directly after the MPI library by
9 * Michael Fromberger but has been written from scratch with
10 * additional optimizations in place.
11 *
12 * SPDX-License-Identifier: Unlicense
13 */
14
15 /*
16 * See file bn_mp_prime_is_prime.c or the documentation in doc/bn.tex for the details
17 */
18 #ifndef LTM_USE_FIPS_ONLY
19
20 #ifdef MP_8BIT
21 /*
22 * floor of positive solution of
23 * (2^16)-1 = (a+4)*(2*a+5)
24 * TODO: Both values are smaller than N^(1/4), would have to use a bigint
25 * for a instead but any a biger than about 120 are already so rare that
26 * it is possible to ignore them and still get enough pseudoprimes.
27 * But it is still a restriction of the set of available pseudoprimes
28 * which makes this implementation less secure if used stand-alone.
29 */
30 #define LTM_FROBENIUS_UNDERWOOD_A 177
31 #else
32 #define LTM_FROBENIUS_UNDERWOOD_A 32764
33 #endif
34 int mp_prime_frobenius_underwood(const mp_int *N, int *result)
35 {
36 mp_int T1z, T2z, Np1z, sz, tz;
37
38 int a, ap2, length, i, j, isset;
39 int e;
40
41 *result = MP_NO;
42
43 if ((e = mp_init_multi(&T1z, &T2z, &Np1z, &sz, &tz, NULL)) != MP_OKAY) {
44 return e;
45 }
46
47 for (a = 0; a < LTM_FROBENIUS_UNDERWOOD_A; a++) {
48 /* TODO: That's ugly! No, really, it is! */
49 if ((a==2) || (a==4) || (a==7) || (a==8) || (a==10) ||
50 (a==14) || (a==18) || (a==23) || (a==26) || (a==28)) {
51 continue;
52 }
53 /* (32764^2 - 4) < 2^31, no bigint for >MP_8BIT needed) */
54 if ((e = mp_set_long(&T1z, (unsigned long)a)) != MP_OKAY) {
55 goto LBL_FU_ERR;
56 }
57
58 if ((e = mp_sqr(&T1z, &T1z)) != MP_OKAY) {
59 goto LBL_FU_ERR;
60 }
61
62 if ((e = mp_sub_d(&T1z, 4uL, &T1z)) != MP_OKAY) {
63 goto LBL_FU_ERR;
64 }
65
66 if ((e = mp_kronecker(&T1z, N, &j)) != MP_OKAY) {
67 goto LBL_FU_ERR;
68 }
69
70 if (j == -1) {
71 break;
72 }
73
74 if (j == 0) {
75 /* composite */
76 goto LBL_FU_ERR;
77 }
78 }
79 /* Tell it a composite and set return value accordingly */
80 if (a >= LTM_FROBENIUS_UNDERWOOD_A) {
81 e = MP_ITER;
82 goto LBL_FU_ERR;
83 }
84 /* Composite if N and (a+4)*(2*a+5) are not coprime */
85 if ((e = mp_set_long(&T1z, (unsigned long)((a+4)*((2*a)+5)))) != MP_OKAY) {
86 goto LBL_FU_ERR;
87 }
88
89 if ((e = mp_gcd(N, &T1z, &T1z)) != MP_OKAY) {
90 goto LBL_FU_ERR;
91 }
92
93 if (!((T1z.used == 1) && (T1z.dp[0] == 1u))) {
94 goto LBL_FU_ERR;
95 }
96
97 ap2 = a + 2;
98 if ((e = mp_add_d(N, 1uL, &Np1z)) != MP_OKAY) {
99 goto LBL_FU_ERR;
100 }
101
102 mp_set(&sz, 1uL);
103 mp_set(&tz, 2uL);
104 length = mp_count_bits(&Np1z);
105
106 for (i = length - 2; i >= 0; i--) {
107 /*
108 * temp = (sz*(a*sz+2*tz))%N;
109 * tz = ((tz-sz)*(tz+sz))%N;
110 * sz = temp;
111 */
112 if ((e = mp_mul_2(&tz, &T2z)) != MP_OKAY) {
113 goto LBL_FU_ERR;
114 }
115
116 /* a = 0 at about 50% of the cases (non-square and odd input) */
117 if (a != 0) {
118 if ((e = mp_mul_d(&sz, (mp_digit)a, &T1z)) != MP_OKAY) {
119 goto LBL_FU_ERR;
120 }
121 if ((e = mp_add(&T1z, &T2z, &T2z)) != MP_OKAY) {
122 goto LBL_FU_ERR;
123 }
124 }
125
126 if ((e = mp_mul(&T2z, &sz, &T1z)) != MP_OKAY) {
127 goto LBL_FU_ERR;
128 }
129 if ((e = mp_sub(&tz, &sz, &T2z)) != MP_OKAY) {
130 goto LBL_FU_ERR;
131 }
132 if ((e = mp_add(&sz, &tz, &sz)) != MP_OKAY) {
133 goto LBL_FU_ERR;
134 }
135 if ((e = mp_mul(&sz, &T2z, &tz)) != MP_OKAY) {
136 goto LBL_FU_ERR;
137 }
138 if ((e = mp_mod(&tz, N, &tz)) != MP_OKAY) {
139 goto LBL_FU_ERR;
140 }
141 if ((e = mp_mod(&T1z, N, &sz)) != MP_OKAY) {
142 goto LBL_FU_ERR;
143 }
144 if ((isset = mp_get_bit(&Np1z, i)) == MP_VAL) {
145 e = isset;
146 goto LBL_FU_ERR;
147 }
148 if (isset == MP_YES) {
149 /*
150 * temp = (a+2) * sz + tz
151 * tz = 2 * tz - sz
152 * sz = temp
153 */
154 if (a == 0) {
155 if ((e = mp_mul_2(&sz, &T1z)) != MP_OKAY) {
156 goto LBL_FU_ERR;
157 }
158 } else {
159 if ((e = mp_mul_d(&sz, (mp_digit)ap2, &T1z)) != MP_OKAY) {
160 goto LBL_FU_ERR;
161 }
162 }
163 if ((e = mp_add(&T1z, &tz, &T1z)) != MP_OKAY) {
164 goto LBL_FU_ERR;
165 }
166 if ((e = mp_mul_2(&tz, &T2z)) != MP_OKAY) {
167 goto LBL_FU_ERR;
168 }
169 if ((e = mp_sub(&T2z, &sz, &tz)) != MP_OKAY) {
170 goto LBL_FU_ERR;
171 }
172 mp_exch(&sz, &T1z);
173 }
174 }
175
176 if ((e = mp_set_long(&T1z, (unsigned long)((2 * a) + 5))) != MP_OKAY) {
177 goto LBL_FU_ERR;
178 }
179 if ((e = mp_mod(&T1z, N, &T1z)) != MP_OKAY) {
180 goto LBL_FU_ERR;
181 }
182 if ((mp_iszero(&sz) != MP_NO) && (mp_cmp(&tz, &T1z) == MP_EQ)) {
183 *result = MP_YES;
184 goto LBL_FU_ERR;
185 }
186
187 LBL_FU_ERR:
188 mp_clear_multi(&tz, &sz, &Np1z, &T2z, &T1z, NULL);
189 return e;
190 }
191
192 #endif
193 #endif
194
195 /* ref: $Format:%D$ */
196 /* git commit: $Format:%H$ */
197 /* commit time: $Format:%ai$ */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* determines if an integers is divisible by one
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
15 /* performs a variable number of rounds of Miller-Rabin
16 *
17 * Probability of error after t rounds is no more than
18
19 *
20 * Sets result to 1 if probably prime, 0 otherwise
21 */
14 /* portable integer log of two with small footprint */
15 static unsigned int s_floor_ilog2(int value)
16 {
17 unsigned int r = 0;
18 while ((value >>= 1) != 0) {
19 r++;
20 }
21 return r;
22 }
23
24
2225 int mp_prime_is_prime(const mp_int *a, int t, int *result)
2326 {
2427 mp_int b;
25 int ix, err, res;
28 int ix, err, res, p_max = 0, size_a, len;
29 unsigned int fips_rand, mask;
2630
2731 /* default to no */
2832 *result = MP_NO;
2933
3034 /* valid value of t? */
31 if ((t <= 0) || (t > PRIME_SIZE)) {
35 if (t > PRIME_SIZE) {
3236 return MP_VAL;
37 }
38
39 /* Some shortcuts */
40 /* N > 3 */
41 if (a->used == 1) {
42 if ((a->dp[0] == 0u) || (a->dp[0] == 1u)) {
43 *result = 0;
44 return MP_OKAY;
45 }
46 if (a->dp[0] == 2u) {
47 *result = 1;
48 return MP_OKAY;
49 }
50 }
51
52 /* N must be odd */
53 if (mp_iseven(a) == MP_YES) {
54 return MP_OKAY;
55 }
56 /* N is not a perfect square: floor(sqrt(N))^2 != N */
57 if ((err = mp_is_square(a, &res)) != MP_OKAY) {
58 return err;
59 }
60 if (res != 0) {
61 return MP_OKAY;
3362 }
3463
3564 /* is the input equal to one of the primes in the table? */
3665 for (ix = 0; ix < PRIME_SIZE; ix++) {
3766 if (mp_cmp_d(a, ltm_prime_tab[ix]) == MP_EQ) {
38 *result = 1;
67 *result = MP_YES;
3968 return MP_OKAY;
4069 }
4170 }
71 #ifdef MP_8BIT
72 /* The search in the loop above was exhaustive in this case */
73 if (a->used == 1 && PRIME_SIZE >= 31) {
74 return MP_OKAY;
75 }
76 #endif
4277
4378 /* first perform trial division */
4479 if ((err = mp_prime_is_divisible(a, &res)) != MP_OKAY) {
5085 return MP_OKAY;
5186 }
5287
53 /* now perform the miller-rabin rounds */
54 if ((err = mp_init(&b)) != MP_OKAY) {
88 /*
89 Run the Miller-Rabin test with base 2 for the BPSW test.
90 */
91 if ((err = mp_init_set(&b, 2uL)) != MP_OKAY) {
5592 return err;
5693 }
5794
58 for (ix = 0; ix < t; ix++) {
59 /* set the prime */
60 mp_set(&b, ltm_prime_tab[ix]);
61
62 if ((err = mp_prime_miller_rabin(a, &b, &res)) != MP_OKAY) {
63 goto LBL_B;
64 }
65
95 if ((err = mp_prime_miller_rabin(a, &b, &res)) != MP_OKAY) {
96 goto LBL_B;
97 }
98 if (res == MP_NO) {
99 goto LBL_B;
100 }
101 /*
102 Rumours have it that Mathematica does a second M-R test with base 3.
103 Other rumours have it that their strong L-S test is slightly different.
104 It does not hurt, though, beside a bit of extra runtime.
105 */
106 b.dp[0]++;
107 if ((err = mp_prime_miller_rabin(a, &b, &res)) != MP_OKAY) {
108 goto LBL_B;
109 }
110 if (res == MP_NO) {
111 goto LBL_B;
112 }
113
114 /*
115 * Both, the Frobenius-Underwood test and the the Lucas-Selfridge test are quite
116 * slow so if speed is an issue, define LTM_USE_FIPS_ONLY to use M-R tests with
117 * bases 2, 3 and t random bases.
118 */
119 #ifndef LTM_USE_FIPS_ONLY
120 if (t >= 0) {
121 /*
122 * Use a Frobenius-Underwood test instead of the Lucas-Selfridge test for
123 * MP_8BIT (It is unknown if the Lucas-Selfridge test works with 16-bit
124 * integers but the necesssary analysis is on the todo-list).
125 */
126 #if defined (MP_8BIT) || defined (LTM_USE_FROBENIUS_TEST)
127 err = mp_prime_frobenius_underwood(a, &res);
128 if (err != MP_OKAY && err != MP_ITER) {
129 goto LBL_B;
130 }
66131 if (res == MP_NO) {
67132 goto LBL_B;
133 }
134 #else
135 if ((err = mp_prime_strong_lucas_selfridge(a, &res)) != MP_OKAY) {
136 goto LBL_B;
137 }
138 if (res == MP_NO) {
139 goto LBL_B;
140 }
141 #endif
142 }
143 #endif
144
145 /* run at least one Miller-Rabin test with a random base */
146 if (t == 0) {
147 t = 1;
148 }
149
150 /*
151 abs(t) extra rounds of M-R to extend the range of primes it can find if t < 0.
152 Only recommended if the input range is known to be < 3317044064679887385961981
153
154 It uses the bases for a deterministic M-R test if input < 3317044064679887385961981
155 The caller has to check the size.
156
157 Not for cryptographic use because with known bases strong M-R pseudoprimes can
158 be constructed. Use at least one M-R test with a random base (t >= 1).
159
160 The 1119 bit large number
161
162 80383745745363949125707961434194210813883768828755814583748891752229742737653\
163 33652186502336163960045457915042023603208766569966760987284043965408232928738\
164 79185086916685732826776177102938969773947016708230428687109997439976544144845\
165 34115587245063340927902227529622941498423068816854043264575340183297861112989\
166 60644845216191652872597534901
167
168 has been constructed by F. Arnault (F. Arnault, "Rabin-Miller primality test:
169 composite numbers which pass it.", Mathematics of Computation, 1995, 64. Jg.,
170 Nr. 209, S. 355-361), is a semiprime with the two factors
171
172 40095821663949960541830645208454685300518816604113250877450620473800321707011\
173 96242716223191597219733582163165085358166969145233813917169287527980445796800\
174 452592031836601
175
176 20047910831974980270915322604227342650259408302056625438725310236900160853505\
177 98121358111595798609866791081582542679083484572616906958584643763990222898400\
178 226296015918301
179
180 and it is a strong pseudoprime to all forty-six prime M-R bases up to 200
181
182 It does not fail the strong Bailley-PSP test as implemented here, it is just
183 given as an example, if not the reason to use the BPSW-test instead of M-R-tests
184 with a sequence of primes 2...n.
185
186 */
187 if (t < 0) {
188 t = -t;
189 /*
190 Sorenson, Jonathan; Webster, Jonathan (2015).
191 "Strong Pseudoprimes to Twelve Prime Bases".
192 */
193 /* 0x437ae92817f9fc85b7e5 = 318665857834031151167461 */
194 if ((err = mp_read_radix(&b, "437ae92817f9fc85b7e5", 16)) != MP_OKAY) {
195 goto LBL_B;
196 }
197
198 if (mp_cmp(a, &b) == MP_LT) {
199 p_max = 12;
200 } else {
201 /* 0x2be6951adc5b22410a5fd = 3317044064679887385961981 */
202 if ((err = mp_read_radix(&b, "2be6951adc5b22410a5fd", 16)) != MP_OKAY) {
203 goto LBL_B;
204 }
205
206 if (mp_cmp(a, &b) == MP_LT) {
207 p_max = 13;
208 } else {
209 err = MP_VAL;
210 goto LBL_B;
211 }
212 }
213
214 /* for compatibility with the current API (well, compatible within a sign's width) */
215 if (p_max < t) {
216 p_max = t;
217 }
218
219 if (p_max > PRIME_SIZE) {
220 err = MP_VAL;
221 goto LBL_B;
222 }
223 /* we did bases 2 and 3 already, skip them */
224 for (ix = 2; ix < p_max; ix++) {
225 mp_set(&b, ltm_prime_tab[ix]);
226 if ((err = mp_prime_miller_rabin(a, &b, &res)) != MP_OKAY) {
227 goto LBL_B;
228 }
229 if (res == MP_NO) {
230 goto LBL_B;
231 }
232 }
233 }
234 /*
235 Do "t" M-R tests with random bases between 3 and "a".
236 See Fips 186.4 p. 126ff
237 */
238 else if (t > 0) {
239 /*
240 * The mp_digit's have a defined bit-size but the size of the
241 * array a.dp is a simple 'int' and this library can not assume full
242 * compliance to the current C-standard (ISO/IEC 9899:2011) because
243 * it gets used for small embeded processors, too. Some of those MCUs
244 * have compilers that one cannot call standard compliant by any means.
245 * Hence the ugly type-fiddling in the following code.
246 */
247 size_a = mp_count_bits(a);
248 mask = (1u << s_floor_ilog2(size_a)) - 1u;
249 /*
250 Assuming the General Rieman hypothesis (never thought to write that in a
251 comment) the upper bound can be lowered to 2*(log a)^2.
252 E. Bach, "Explicit bounds for primality testing and related problems,"
253 Math. Comp. 55 (1990), 355-380.
254
255 size_a = (size_a/10) * 7;
256 len = 2 * (size_a * size_a);
257
258 E.g.: a number of size 2^2048 would be reduced to the upper limit
259
260 floor(2048/10)*7 = 1428
261 2 * 1428^2 = 4078368
262
263 (would have been ~4030331.9962 with floats and natural log instead)
264 That number is smaller than 2^28, the default bit-size of mp_digit.
265 */
266
267 /*
268 How many tests, you might ask? Dana Jacobsen of Math::Prime::Util fame
269 does exactly 1. In words: one. Look at the end of _GMP_is_prime() in
270 Math-Prime-Util-GMP-0.50/primality.c if you do not believe it.
271
272 The function mp_rand() goes to some length to use a cryptographically
273 good PRNG. That also means that the chance to always get the same base
274 in the loop is non-zero, although very low.
275 If the BPSW test and/or the addtional Frobenious test have been
276 performed instead of just the Miller-Rabin test with the bases 2 and 3,
277 a single extra test should suffice, so such a very unlikely event
278 will not do much harm.
279
280 To preemptivly answer the dangling question: no, a witness does not
281 need to be prime.
282 */
283 for (ix = 0; ix < t; ix++) {
284 /* mp_rand() guarantees the first digit to be non-zero */
285 if ((err = mp_rand(&b, 1)) != MP_OKAY) {
286 goto LBL_B;
287 }
288 /*
289 * Reduce digit before casting because mp_digit might be bigger than
290 * an unsigned int and "mask" on the other side is most probably not.
291 */
292 fips_rand = (unsigned int)(b.dp[0] & (mp_digit) mask);
293 #ifdef MP_8BIT
294 /*
295 * One 8-bit digit is too small, so concatenate two if the size of
296 * unsigned int allows for it.
297 */
298 if ((sizeof(unsigned int) * CHAR_BIT)/2 >= (sizeof(mp_digit) * CHAR_BIT)) {
299 if ((err = mp_rand(&b, 1)) != MP_OKAY) {
300 goto LBL_B;
301 }
302 fips_rand <<= sizeof(mp_digit) * CHAR_BIT;
303 fips_rand |= (unsigned int) b.dp[0];
304 fips_rand &= mask;
305 }
306 #endif
307 /* Ceil, because small numbers have a right to live, too, */
308 len = (((int)fips_rand + DIGIT_BIT) / DIGIT_BIT);
309 /* Unlikely. */
310 if (len < 0) {
311 ix--;
312 continue;
313 }
314 /*
315 * As mentioned above, one 8-bit digit is too small and
316 * although it can only happen in the unlikely case that
317 * an "unsigned int" is smaller than 16 bit a simple test
318 * is cheap and the correction even cheaper.
319 */
320 #ifdef MP_8BIT
321 /* All "a" < 2^8 have been caught before */
322 if (len == 1) {
323 len++;
324 }
325 #endif
326 if ((err = mp_rand(&b, len)) != MP_OKAY) {
327 goto LBL_B;
328 }
329 /*
330 * That number might got too big and the witness has to be
331 * smaller than or equal to "a"
332 */
333 len = mp_count_bits(&b);
334 if (len > size_a) {
335 len = len - size_a;
336 if ((err = mp_div_2d(&b, len, &b, NULL)) != MP_OKAY) {
337 goto LBL_B;
338 }
339 }
340
341 /* Although the chance for b <= 3 is miniscule, try again. */
342 if (mp_cmp_d(&b, 3uL) != MP_GT) {
343 ix--;
344 continue;
345 }
346 if ((err = mp_prime_miller_rabin(a, &b, &res)) != MP_OKAY) {
347 goto LBL_B;
348 }
349 if (res == MP_NO) {
350 goto LBL_B;
351 }
68352 }
69353 }
70354
74358 mp_clear(&b);
75359 return err;
76360 }
361
77362 #endif
78363
79364 /* ref: $Format:%D$ */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* Miller-Rabin test of "a" to the base of "b" as described in
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* finds the next prime after the number "a" using "t" trials
2221 int err, res = MP_NO, x, y;
2322 mp_digit res_tab[PRIME_SIZE], step, kstep;
2423 mp_int b;
25
26 /* ensure t is valid */
27 if ((t <= 0) || (t > PRIME_SIZE)) {
28 return MP_VAL;
29 }
3024
3125 /* force positive */
3226 a->sign = MP_ZPOS;
140134 continue;
141135 }
142136
143 /* is this prime? */
144 for (x = 0; x < t; x++) {
145 mp_set(&b, ltm_prime_tab[x]);
146 if ((err = mp_prime_miller_rabin(a, &b, &res)) != MP_OKAY) {
147 goto LBL_ERR;
148 }
149 if (res == MP_NO) {
150 break;
151 }
137 if ((err = mp_prime_is_prime(a, t, &res)) != MP_OKAY) {
138 goto LBL_ERR;
152139 }
153
154140 if (res == MP_YES) {
155141 break;
156142 }
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514
1615 static const struct {
1716 int k, t;
1817 } sizes[] = {
19 { 128, 28 },
18 { 80, -1 }, /* Use deterministic algorithm for size <= 80 bits */
19 { 81, 39 },
20 { 96, 37 },
21 { 128, 32 },
22 { 160, 27 },
23 { 192, 21 },
2024 { 256, 16 },
2125 { 384, 10 },
2226 { 512, 7 },
2327 { 640, 6 },
2428 { 768, 5 },
2529 { 896, 4 },
26 { 1024, 4 }
30 { 1024, 4 },
31 { 2048, 2 },
32 { 4096, 1 },
2733 };
2834
29 /* returns # of RM trials required for a given bit size */
35 /* returns # of RM trials required for a given bit size and max. error of 2^(-96)*/
3036 int mp_prime_rabin_miller_trials(int size)
3137 {
3238 int x;
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* makes a truly random prime of a given size (bits),
0 #include "tommath_private.h"
1 #ifdef BN_MP_PRIME_STRONG_LUCAS_SELFRIDGE_C
2
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis
4 *
5 * LibTomMath is a library that provides multiple-precision
6 * integer arithmetic as well as number theoretic functionality.
7 *
8 * The library was designed directly after the MPI library by
9 * Michael Fromberger but has been written from scratch with
10 * additional optimizations in place.
11 *
12 * SPDX-License-Identifier: Unlicense
13 */
14
15 /*
16 * See file bn_mp_prime_is_prime.c or the documentation in doc/bn.tex for the details
17 */
18 #ifndef LTM_USE_FIPS_ONLY
19
20 /*
21 * 8-bit is just too small. You can try the Frobenius test
22 * but that frobenius test can fail, too, for the same reason.
23 */
24 #ifndef MP_8BIT
25
26 /*
27 * multiply bigint a with int d and put the result in c
28 * Like mp_mul_d() but with a signed long as the small input
29 */
30 static int s_mp_mul_si(const mp_int *a, long d, mp_int *c)
31 {
32 mp_int t;
33 int err, neg = 0;
34
35 if ((err = mp_init(&t)) != MP_OKAY) {
36 return err;
37 }
38 if (d < 0) {
39 neg = 1;
40 d = -d;
41 }
42
43 /*
44 * mp_digit might be smaller than a long, which excludes
45 * the use of mp_mul_d() here.
46 */
47 if ((err = mp_set_long(&t, (unsigned long) d)) != MP_OKAY) {
48 goto LBL_MPMULSI_ERR;
49 }
50 if ((err = mp_mul(a, &t, c)) != MP_OKAY) {
51 goto LBL_MPMULSI_ERR;
52 }
53 if (neg == 1) {
54 c->sign = (a->sign == MP_NEG) ? MP_ZPOS: MP_NEG;
55 }
56 LBL_MPMULSI_ERR:
57 mp_clear(&t);
58 return err;
59 }
60
61
62
63 /*
64 Strong Lucas-Selfridge test.
65 returns MP_YES if it is a strong L-S prime, MP_NO if it is composite
66
67 Code ported from Thomas Ray Nicely's implementation of the BPSW test
68 at http://www.trnicely.net/misc/bpsw.html
69
70 Freeware copyright (C) 2016 Thomas R. Nicely <http://www.trnicely.net>.
71 Released into the public domain by the author, who disclaims any legal
72 liability arising from its use
73
74 The multi-line comments are made by Thomas R. Nicely and are copied verbatim.
75 Additional comments marked "CZ" (without the quotes) are by the code-portist.
76
77 (If that name sounds familiar, he is the guy who found the fdiv bug in the
78 Pentium (P5x, I think) Intel processor)
79 */
80 int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result)
81 {
82 /* CZ TODO: choose better variable names! */
83 mp_int Dz, gcd, Np1, Uz, Vz, U2mz, V2mz, Qmz, Q2mz, Qkdz, T1z, T2z, T3z, T4z, Q2kdz;
84 /* CZ TODO: Some of them need the full 32 bit, hence the (temporary) exclusion of MP_8BIT */
85 int D, Ds, J, sign, P, Q, r, s, u, Nbits;
86 int e;
87 int isset;
88
89 *result = MP_NO;
90
91 /*
92 Find the first element D in the sequence {5, -7, 9, -11, 13, ...}
93 such that Jacobi(D,N) = -1 (Selfridge's algorithm). Theory
94 indicates that, if N is not a perfect square, D will "nearly
95 always" be "small." Just in case, an overflow trap for D is
96 included.
97 */
98
99 if ((e = mp_init_multi(&Dz, &gcd, &Np1, &Uz, &Vz, &U2mz, &V2mz, &Qmz, &Q2mz, &Qkdz, &T1z, &T2z, &T3z, &T4z, &Q2kdz,
100 NULL)) != MP_OKAY) {
101 return e;
102 }
103
104 D = 5;
105 sign = 1;
106
107 for (;;) {
108 Ds = sign * D;
109 sign = -sign;
110 if ((e = mp_set_long(&Dz, (unsigned long)D)) != MP_OKAY) {
111 goto LBL_LS_ERR;
112 }
113 if ((e = mp_gcd(a, &Dz, &gcd)) != MP_OKAY) {
114 goto LBL_LS_ERR;
115 }
116 /* if 1 < GCD < N then N is composite with factor "D", and
117 Jacobi(D,N) is technically undefined (but often returned
118 as zero). */
119 if ((mp_cmp_d(&gcd, 1uL) == MP_GT) && (mp_cmp(&gcd, a) == MP_LT)) {
120 goto LBL_LS_ERR;
121 }
122 if (Ds < 0) {
123 Dz.sign = MP_NEG;
124 }
125 if ((e = mp_kronecker(&Dz, a, &J)) != MP_OKAY) {
126 goto LBL_LS_ERR;
127 }
128
129 if (J == -1) {
130 break;
131 }
132 D += 2;
133
134 if (D > (INT_MAX - 2)) {
135 e = MP_VAL;
136 goto LBL_LS_ERR;
137 }
138 }
139
140 P = 1; /* Selfridge's choice */
141 Q = (1 - Ds) / 4; /* Required so D = P*P - 4*Q */
142
143 /* NOTE: The conditions (a) N does not divide Q, and
144 (b) D is square-free or not a perfect square, are included by
145 some authors; e.g., "Prime numbers and computer methods for
146 factorization," Hans Riesel (2nd ed., 1994, Birkhauser, Boston),
147 p. 130. For this particular application of Lucas sequences,
148 these conditions were found to be immaterial. */
149
150 /* Now calculate N - Jacobi(D,N) = N + 1 (even), and calculate the
151 odd positive integer d and positive integer s for which
152 N + 1 = 2^s*d (similar to the step for N - 1 in Miller's test).
153 The strong Lucas-Selfridge test then returns N as a strong
154 Lucas probable prime (slprp) if any of the following
155 conditions is met: U_d=0, V_d=0, V_2d=0, V_4d=0, V_8d=0,
156 V_16d=0, ..., etc., ending with V_{2^(s-1)*d}=V_{(N+1)/2}=0
157 (all equalities mod N). Thus d is the highest index of U that
158 must be computed (since V_2m is independent of U), compared
159 to U_{N+1} for the standard Lucas-Selfridge test; and no
160 index of V beyond (N+1)/2 is required, just as in the
161 standard Lucas-Selfridge test. However, the quantity Q^d must
162 be computed for use (if necessary) in the latter stages of
163 the test. The result is that the strong Lucas-Selfridge test
164 has a running time only slightly greater (order of 10 %) than
165 that of the standard Lucas-Selfridge test, while producing
166 only (roughly) 30 % as many pseudoprimes (and every strong
167 Lucas pseudoprime is also a standard Lucas pseudoprime). Thus
168 the evidence indicates that the strong Lucas-Selfridge test is
169 more effective than the standard Lucas-Selfridge test, and a
170 Baillie-PSW test based on the strong Lucas-Selfridge test
171 should be more reliable. */
172
173 if ((e = mp_add_d(a, 1uL, &Np1)) != MP_OKAY) {
174 goto LBL_LS_ERR;
175 }
176 s = mp_cnt_lsb(&Np1);
177
178 /* CZ
179 * This should round towards zero because
180 * Thomas R. Nicely used GMP's mpz_tdiv_q_2exp()
181 * and mp_div_2d() is equivalent. Additionally:
182 * dividing an even number by two does not produce
183 * any leftovers.
184 */
185 if ((e = mp_div_2d(&Np1, s, &Dz, NULL)) != MP_OKAY) {
186 goto LBL_LS_ERR;
187 }
188 /* We must now compute U_d and V_d. Since d is odd, the accumulated
189 values U and V are initialized to U_1 and V_1 (if the target
190 index were even, U and V would be initialized instead to U_0=0
191 and V_0=2). The values of U_2m and V_2m are also initialized to
192 U_1 and V_1; the FOR loop calculates in succession U_2 and V_2,
193 U_4 and V_4, U_8 and V_8, etc. If the corresponding bits
194 (1, 2, 3, ...) of t are on (the zero bit having been accounted
195 for in the initialization of U and V), these values are then
196 combined with the previous totals for U and V, using the
197 composition formulas for addition of indices. */
198
199 mp_set(&Uz, 1uL); /* U=U_1 */
200 mp_set(&Vz, (mp_digit)P); /* V=V_1 */
201 mp_set(&U2mz, 1uL); /* U_1 */
202 mp_set(&V2mz, (mp_digit)P); /* V_1 */
203
204 if (Q < 0) {
205 Q = -Q;
206 if ((e = mp_set_long(&Qmz, (unsigned long)Q)) != MP_OKAY) {
207 goto LBL_LS_ERR;
208 }
209 if ((e = mp_mul_2(&Qmz, &Q2mz)) != MP_OKAY) {
210 goto LBL_LS_ERR;
211 }
212 /* Initializes calculation of Q^d */
213 if ((e = mp_set_long(&Qkdz, (unsigned long)Q)) != MP_OKAY) {
214 goto LBL_LS_ERR;
215 }
216 Qmz.sign = MP_NEG;
217 Q2mz.sign = MP_NEG;
218 Qkdz.sign = MP_NEG;
219 Q = -Q;
220 } else {
221 if ((e = mp_set_long(&Qmz, (unsigned long)Q)) != MP_OKAY) {
222 goto LBL_LS_ERR;
223 }
224 if ((e = mp_mul_2(&Qmz, &Q2mz)) != MP_OKAY) {
225 goto LBL_LS_ERR;
226 }
227 /* Initializes calculation of Q^d */
228 if ((e = mp_set_long(&Qkdz, (unsigned long)Q)) != MP_OKAY) {
229 goto LBL_LS_ERR;
230 }
231 }
232
233 Nbits = mp_count_bits(&Dz);
234 for (u = 1; u < Nbits; u++) { /* zero bit off, already accounted for */
235 /* Formulas for doubling of indices (carried out mod N). Note that
236 * the indices denoted as "2m" are actually powers of 2, specifically
237 * 2^(ul-1) beginning each loop and 2^ul ending each loop.
238 *
239 * U_2m = U_m*V_m
240 * V_2m = V_m*V_m - 2*Q^m
241 */
242
243 if ((e = mp_mul(&U2mz, &V2mz, &U2mz)) != MP_OKAY) {
244 goto LBL_LS_ERR;
245 }
246 if ((e = mp_mod(&U2mz, a, &U2mz)) != MP_OKAY) {
247 goto LBL_LS_ERR;
248 }
249 if ((e = mp_sqr(&V2mz, &V2mz)) != MP_OKAY) {
250 goto LBL_LS_ERR;
251 }
252 if ((e = mp_sub(&V2mz, &Q2mz, &V2mz)) != MP_OKAY) {
253 goto LBL_LS_ERR;
254 }
255 if ((e = mp_mod(&V2mz, a, &V2mz)) != MP_OKAY) {
256 goto LBL_LS_ERR;
257 }
258 /* Must calculate powers of Q for use in V_2m, also for Q^d later */
259 if ((e = mp_sqr(&Qmz, &Qmz)) != MP_OKAY) {
260 goto LBL_LS_ERR;
261 }
262 /* prevents overflow */ /* CZ still necessary without a fixed prealloc'd mem.? */
263 if ((e = mp_mod(&Qmz, a, &Qmz)) != MP_OKAY) {
264 goto LBL_LS_ERR;
265 }
266 if ((e = mp_mul_2(&Qmz, &Q2mz)) != MP_OKAY) {
267 goto LBL_LS_ERR;
268 }
269
270 if ((isset = mp_get_bit(&Dz, u)) == MP_VAL) {
271 e = isset;
272 goto LBL_LS_ERR;
273 }
274 if (isset == MP_YES) {
275 /* Formulas for addition of indices (carried out mod N);
276 *
277 * U_(m+n) = (U_m*V_n + U_n*V_m)/2
278 * V_(m+n) = (V_m*V_n + D*U_m*U_n)/2
279 *
280 * Be careful with division by 2 (mod N)!
281 */
282
283 if ((e = mp_mul(&U2mz, &Vz, &T1z)) != MP_OKAY) {
284 goto LBL_LS_ERR;
285 }
286 if ((e = mp_mul(&Uz, &V2mz, &T2z)) != MP_OKAY) {
287 goto LBL_LS_ERR;
288 }
289 if ((e = mp_mul(&V2mz, &Vz, &T3z)) != MP_OKAY) {
290 goto LBL_LS_ERR;
291 }
292 if ((e = mp_mul(&U2mz, &Uz, &T4z)) != MP_OKAY) {
293 goto LBL_LS_ERR;
294 }
295 if ((e = s_mp_mul_si(&T4z, (long)Ds, &T4z)) != MP_OKAY) {
296 goto LBL_LS_ERR;
297 }
298 if ((e = mp_add(&T1z, &T2z, &Uz)) != MP_OKAY) {
299 goto LBL_LS_ERR;
300 }
301 if (mp_isodd(&Uz) != MP_NO) {
302 if ((e = mp_add(&Uz, a, &Uz)) != MP_OKAY) {
303 goto LBL_LS_ERR;
304 }
305 }
306 /* CZ
307 * This should round towards negative infinity because
308 * Thomas R. Nicely used GMP's mpz_fdiv_q_2exp().
309 * But mp_div_2() does not do so, it is truncating instead.
310 */
311 if ((e = mp_div_2(&Uz, &Uz)) != MP_OKAY) {
312 goto LBL_LS_ERR;
313 }
314 if ((Uz.sign == MP_NEG) && (mp_isodd(&Uz) != MP_NO)) {
315 if ((e = mp_sub_d(&Uz, 1uL, &Uz)) != MP_OKAY) {
316 goto LBL_LS_ERR;
317 }
318 }
319 if ((e = mp_add(&T3z, &T4z, &Vz)) != MP_OKAY) {
320 goto LBL_LS_ERR;
321 }
322 if (mp_isodd(&Vz) != MP_NO) {
323 if ((e = mp_add(&Vz, a, &Vz)) != MP_OKAY) {
324 goto LBL_LS_ERR;
325 }
326 }
327 if ((e = mp_div_2(&Vz, &Vz)) != MP_OKAY) {
328 goto LBL_LS_ERR;
329 }
330 if ((Vz.sign == MP_NEG) && (mp_isodd(&Vz) != MP_NO)) {
331 if ((e = mp_sub_d(&Vz, 1uL, &Vz)) != MP_OKAY) {
332 goto LBL_LS_ERR;
333 }
334 }
335 if ((e = mp_mod(&Uz, a, &Uz)) != MP_OKAY) {
336 goto LBL_LS_ERR;
337 }
338 if ((e = mp_mod(&Vz, a, &Vz)) != MP_OKAY) {
339 goto LBL_LS_ERR;
340 }
341 /* Calculating Q^d for later use */
342 if ((e = mp_mul(&Qkdz, &Qmz, &Qkdz)) != MP_OKAY) {
343 goto LBL_LS_ERR;
344 }
345 if ((e = mp_mod(&Qkdz, a, &Qkdz)) != MP_OKAY) {
346 goto LBL_LS_ERR;
347 }
348 }
349 }
350
351 /* If U_d or V_d is congruent to 0 mod N, then N is a prime or a
352 strong Lucas pseudoprime. */
353 if ((mp_iszero(&Uz) != MP_NO) || (mp_iszero(&Vz) != MP_NO)) {
354 *result = MP_YES;
355 goto LBL_LS_ERR;
356 }
357
358 /* NOTE: Ribenboim ("The new book of prime number records," 3rd ed.,
359 1995/6) omits the condition V0 on p.142, but includes it on
360 p. 130. The condition is NECESSARY; otherwise the test will
361 return false negatives---e.g., the primes 29 and 2000029 will be
362 returned as composite. */
363
364 /* Otherwise, we must compute V_2d, V_4d, V_8d, ..., V_{2^(s-1)*d}
365 by repeated use of the formula V_2m = V_m*V_m - 2*Q^m. If any of
366 these are congruent to 0 mod N, then N is a prime or a strong
367 Lucas pseudoprime. */
368
369 /* Initialize 2*Q^(d*2^r) for V_2m */
370 if ((e = mp_mul_2(&Qkdz, &Q2kdz)) != MP_OKAY) {
371 goto LBL_LS_ERR;
372 }
373
374 for (r = 1; r < s; r++) {
375 if ((e = mp_sqr(&Vz, &Vz)) != MP_OKAY) {
376 goto LBL_LS_ERR;
377 }
378 if ((e = mp_sub(&Vz, &Q2kdz, &Vz)) != MP_OKAY) {
379 goto LBL_LS_ERR;
380 }
381 if ((e = mp_mod(&Vz, a, &Vz)) != MP_OKAY) {
382 goto LBL_LS_ERR;
383 }
384 if (mp_iszero(&Vz) != MP_NO) {
385 *result = MP_YES;
386 goto LBL_LS_ERR;
387 }
388 /* Calculate Q^{d*2^r} for next r (final iteration irrelevant). */
389 if (r < (s - 1)) {
390 if ((e = mp_sqr(&Qkdz, &Qkdz)) != MP_OKAY) {
391 goto LBL_LS_ERR;
392 }
393 if ((e = mp_mod(&Qkdz, a, &Qkdz)) != MP_OKAY) {
394 goto LBL_LS_ERR;
395 }
396 if ((e = mp_mul_2(&Qkdz, &Q2kdz)) != MP_OKAY) {
397 goto LBL_LS_ERR;
398 }
399 }
400 }
401 LBL_LS_ERR:
402 mp_clear_multi(&Q2kdz, &T4z, &T3z, &T2z, &T1z, &Qkdz, &Q2mz, &Qmz, &V2mz, &U2mz, &Vz, &Uz, &Np1, &gcd, &Dz, NULL);
403 return e;
404 }
405 #endif
406 #endif
407 #endif
408
409 /* ref: $Format:%D$ */
410 /* git commit: $Format:%H$ */
411 /* commit time: $Format:%ai$ */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* returns size of ASCII reprensentation */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* chars used in radix conversions */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* First the OS-specific special cases
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* read a string [ASCII] in a given radix */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* read signed bin, big endian, first byte is 0==positive or 1==negative */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* reads a unsigned char array, assumes the msb is stored first [big endian] */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* reduces x mod m, assumes 0 < x < m**2, mu is
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* reduces a modulo n where n is of the form 2**p - d */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* reduces a modulo n where n is of the form 2**p - d
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* determines the setup value */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* determines the setup value */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* determines if mp_reduce_2k can be used */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* determines if reduce_2k_l can be used */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* pre-calculate the value required for Barrett reduction
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* shift right a certain amount of digits */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* set to a digit */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* set a 32-bit const */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* set a platform dependent unsigned long int */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* shrink a bignum */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* get the size for an signed equivalent */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* computes b = a*a */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* c = a * a (mod b) */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* this function is less generic than mp_n_root, simpler and faster */
44 * LibTomMath is a library that provides multiple-precision
55 * integer arithmetic as well as number theoretic functionality.
66 *
7 * The library is free for all purposes without any express
8 * guarantee it works.
7 * The library was designed directly after the MPI library by
8 * Michael Fromberger but has been written from scratch with
9 * additional optimizations in place.
10 *
11 * SPDX-License-Identifier: Unlicense
912 */
1013
1114 /* Tonelli-Shanks algorithm
121124 }
122125
123126 #endif
127
128 /* ref: $Format:%D$ */
129 /* git commit: $Format:%H$ */
130 /* commit time: $Format:%ai$ */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* high level subtraction (handles signs) */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* single digit subtraction */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* d = a - b (mod c) */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* two complement and */
1615 int mp_tc_and(const mp_int *a, const mp_int *b, mp_int *c)
1716 {
18 int res = MP_OKAY, bits;
17 int res = MP_OKAY, bits, abits, bbits;
1918 int as = mp_isneg(a), bs = mp_isneg(b);
2019 mp_int *mx = NULL, _mx, acpy, bcpy;
2120
2221 if ((as != MP_NO) || (bs != MP_NO)) {
23 bits = MAX(mp_count_bits(a), mp_count_bits(b));
22 abits = mp_count_bits(a);
23 bbits = mp_count_bits(b);
24 bits = MAX(abits, bbits);
2425 res = mp_init_set_int(&_mx, 1uL);
2526 if (res != MP_OKAY) {
2627 goto end;
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* two complement right shift */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* two complement or */
1615 int mp_tc_or(const mp_int *a, const mp_int *b, mp_int *c)
1716 {
18 int res = MP_OKAY, bits;
17 int res = MP_OKAY, bits, abits, bbits;
1918 int as = mp_isneg(a), bs = mp_isneg(b);
2019 mp_int *mx = NULL, _mx, acpy, bcpy;
2120
2221 if ((as != MP_NO) || (bs != MP_NO)) {
23 bits = MAX(mp_count_bits(a), mp_count_bits(b));
22 abits = mp_count_bits(a);
23 bbits = mp_count_bits(b);
24 bits = MAX(abits, bbits);
2425 res = mp_init_set_int(&_mx, 1uL);
2526 if (res != MP_OKAY) {
2627 goto end;
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* two complement xor */
1615 int mp_tc_xor(const mp_int *a, const mp_int *b, mp_int *c)
1716 {
18 int res = MP_OKAY, bits;
17 int res = MP_OKAY, bits, abits, bbits;
1918 int as = mp_isneg(a), bs = mp_isneg(b);
2019 mp_int *mx = NULL, _mx, acpy, bcpy;
2120
2221 if ((as != MP_NO) || (bs != MP_NO)) {
23 bits = MAX(mp_count_bits(a), mp_count_bits(b));
22 abits = mp_count_bits(a);
23 bbits = mp_count_bits(b);
24 bits = MAX(abits, bbits);
2425 res = mp_init_set_int(&_mx, 1uL);
2526 if (res != MP_OKAY) {
2627 goto end;
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* store in signed [big endian] format */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* store in signed [big endian] format */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* store in unsigned [big endian] format */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* store in unsigned [big endian] format */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* multiplication using the Toom-Cook 3-way algorithm
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* squaring using Toom-Cook 3-way algorithm */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* stores a bignum as a ASCII string in a given radix (2..64) */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* stores a bignum as a ASCII string in a given radix (2..64)
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* get the size for an unsigned equivalent */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* XOR two ints together */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* set to zero */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 const mp_digit ltm_prime_tab[] = {
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* reverse an array, used for radix code */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* low level addition, based on HAC pp.594, Algorithm 14.7 */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 #ifdef MP_LOW_MEM
9897 /* compute the value at M[1<<(winsize-1)] by squaring
9998 * M[1] (winsize-1) times
10099 */
101 if ((err = mp_copy(&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) {
100 if ((err = mp_copy(&M[1], &M[(size_t)1 << (winsize - 1)])) != MP_OKAY) {
102101 goto LBL_MU;
103102 }
104103
105104 for (x = 0; x < (winsize - 1); x++) {
106105 /* square it */
107 if ((err = mp_sqr(&M[1 << (winsize - 1)],
108 &M[1 << (winsize - 1)])) != MP_OKAY) {
106 if ((err = mp_sqr(&M[(size_t)1 << (winsize - 1)],
107 &M[(size_t)1 << (winsize - 1)])) != MP_OKAY) {
109108 goto LBL_MU;
110109 }
111110
112111 /* reduce modulo P */
113 if ((err = redux(&M[1 << (winsize - 1)], P, &mu)) != MP_OKAY) {
112 if ((err = redux(&M[(size_t)1 << (winsize - 1)], P, &mu)) != MP_OKAY) {
114113 goto LBL_MU;
115114 }
116115 }
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* multiplies |a| * |b| and only computes upto digs digits of result
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* multiplies |a| * |b| and does not compute the lower digs digits
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* low level squaring, b = a*a, HAC pp.596-597, Algorithm 14.16 */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */
88 * Michael Fromberger but has been written from scratch with
99 * additional optimizations in place.
1010 *
11 * The library is free for all purposes without any express
12 * guarantee it works.
11 * SPDX-License-Identifier: Unlicense
1312 */
1413
1514 /* Known optimal configurations
66 * Michael Fromberger but has been written from scratch with
77 * additional optimizations in place.
88 *
9 * The library is free for all purposes without any express
10 * guarantee it works.
9 * SPDX-License-Identifier: Unlicense
1110 */
1211 #ifndef BN_H_
1312 #define BN_H_
1615 #include <stdlib.h>
1716 #include <limits.h>
1817
19 #include <tommath_class.h>
18 #include "tommath_class.h"
2019
2120 #ifdef __cplusplus
2221 extern "C" {
3534 defined(__ia64) || defined(__ia64__) || defined(__itanium__) || defined(_M_IA64) || \
3635 defined(__LP64__) || defined(_LP64) || defined(__64BIT__)
3736 # if !(defined(MP_32BIT) || defined(MP_16BIT) || defined(MP_8BIT))
38 # if defined(__GNUC__)
37 # if defined(__GNUC__) && !defined(__hppa)
3938 /* we support 128bit integers only via: __attribute__((mode(TI))) */
4039 # define MP_64BIT
4140 # else
117116 #define MP_MEM -2 /* out of mem */
118117 #define MP_VAL -3 /* invalid input */
119118 #define MP_RANGE MP_VAL
119 #define MP_ITER -4 /* Max. iterations reached */
120120
121121 #define MP_YES 1 /* yes response */
122122 #define MP_NO 0 /* no response */
203203 /* set to a digit */
204204 void mp_set(mp_int *a, mp_digit b);
205205
206 /* set a double */
207 int mp_set_double(mp_int *a, double b);
208
206209 /* set a 32-bit const */
207210 int mp_set_int(mp_int *a, unsigned long b);
208211
211214
212215 /* set a platform dependent unsigned long long value */
213216 /* int mp_set_long_long(mp_int *a, unsigned long long b); */
217
218 /* get a double */
219 double mp_get_double(const mp_int *a);
214220
215221 /* get a 32-bit value */
216222 unsigned long mp_get_int(const mp_int *a);
294300 /* c = a AND b */
295301 int mp_and(const mp_int *a, const mp_int *b, mp_int *c);
296302
303 /* Checks the bit at position b and returns MP_YES
304 if the bit is 1, MP_NO if it is 0 and MP_VAL
305 in case of error */
306 int mp_get_bit(const mp_int *a, int b);
307
297308 /* c = a XOR b (two complement) */
298309 int mp_tc_xor(const mp_int *a, const mp_int *b, mp_int *c);
299310
412423
413424 /* computes the jacobi c = (a | n) (or Legendre if b is prime) */
414425 int mp_jacobi(const mp_int *a, const mp_int *n, int *c);
426
427 /* computes the Kronecker symbol c = (a | p) (like jacobi() but with {a,p} in Z */
428 int mp_kronecker(const mp_int *a, const mp_int *p, int *c);
415429
416430 /* used to setup the Barrett reduction for a given modulus b */
417431 int mp_reduce_setup(mp_int *a, const mp_int *b);
494508 */
495509 int mp_prime_rabin_miller_trials(int size);
496510
497 /* performs t rounds of Miller-Rabin on "a" using the first
498 * t prime bases. Also performs an initial sieve of trial
511 /* performs one strong Lucas-Selfridge test of "a".
512 * Sets result to 0 if composite or 1 if probable prime
513 */
514 int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result);
515
516 /* performs one Frobenius test of "a" as described by Paul Underwood.
517 * Sets result to 0 if composite or 1 if probable prime
518 */
519 int mp_prime_frobenius_underwood(const mp_int *N, int *result);
520
521 /* performs t random rounds of Miller-Rabin on "a" additional to
522 * bases 2 and 3. Also performs an initial sieve of trial
499523 * division. Determines if "a" is prime with probability
500524 * of error no more than (1/4)**t.
525 * Both a strong Lucas-Selfridge to complete the BPSW test
526 * and a separate Frobenius test are available at compile time.
527 * With t<0 a deterministic test is run for primes up to
528 * 318665857834031151167461. With t<13 (abs(t)-13) additional
529 * tests with sequential small primes are run starting at 43.
530 * Is Fips 186.4 compliant if called with t as computed by
531 * mp_prime_rabin_miller_trials();
501532 *
502533 * Sets result to 1 if probably prime, 0 otherwise
503534 */
0 /* LibTomMath, multiple-precision integer library -- Tom St Denis
1 *
2 * LibTomMath is a library that provides multiple-precision
3 * integer arithmetic as well as number theoretic functionality.
4 *
5 * The library was designed directly after the MPI library by
6 * Michael Fromberger but has been written from scratch with
7 * additional optimizations in place.
8 *
9 * SPDX-License-Identifier: Unlicense
10 */
11
012 #if !(defined(LTM1) && defined(LTM2) && defined(LTM3))
113 #if defined(LTM2)
214 # define LTM3
4759 # define BN_MP_FREAD_C
4860 # define BN_MP_FWRITE_C
4961 # define BN_MP_GCD_C
62 # define BN_MP_GET_BIT_C
63 # define BN_MP_GET_DOUBLE_C
5064 # define BN_MP_GET_INT_C
5165 # define BN_MP_GET_LONG_C
5266 # define BN_MP_GET_LONG_LONG_C
6478 # define BN_MP_JACOBI_C
6579 # define BN_MP_KARATSUBA_MUL_C
6680 # define BN_MP_KARATSUBA_SQR_C
81 # define BN_MP_KRONECKER_C
6782 # define BN_MP_LCM_C
6883 # define BN_MP_LSHD_C
6984 # define BN_MP_MOD_C
8297 # define BN_MP_NEG_C
8398 # define BN_MP_OR_C
8499 # define BN_MP_PRIME_FERMAT_C
100 # define BN_MP_PRIME_FROBENIUS_UNDERWOOD_C
85101 # define BN_MP_PRIME_IS_DIVISIBLE_C
86102 # define BN_MP_PRIME_IS_PRIME_C
87103 # define BN_MP_PRIME_MILLER_RABIN_C
88104 # define BN_MP_PRIME_NEXT_PRIME_C
89105 # define BN_MP_PRIME_RABIN_MILLER_TRIALS_C
90106 # define BN_MP_PRIME_RANDOM_EX_C
107 # define BN_MP_PRIME_STRONG_LUCAS_SELFRIDGE_C
91108 # define BN_MP_RADIX_SIZE_C
92109 # define BN_MP_RADIX_SMAP_C
93110 # define BN_MP_RAND_C
104121 # define BN_MP_REDUCE_SETUP_C
105122 # define BN_MP_RSHD_C
106123 # define BN_MP_SET_C
124 # define BN_MP_SET_DOUBLE_C
107125 # define BN_MP_SET_INT_C
108126 # define BN_MP_SET_LONG_C
109127 # define BN_MP_SET_LONG_LONG_C
159177 # define BN_MP_CMP_C
160178 # define BN_MP_CMP_D_C
161179 # define BN_MP_ADD_C
180 # define BN_MP_CMP_MAG_C
162181 # define BN_MP_EXCH_C
163182 # define BN_MP_CLEAR_MULTI_C
164183 #endif
424443 # define BN_MP_CLEAR_C
425444 #endif
426445
446 #if defined(BN_MP_GET_BIT_C)
447 # define BN_MP_ISZERO_C
448 #endif
449
450 #if defined(BN_MP_GET_DOUBLE_C)
451 # define BN_MP_ISNEG_C
452 #endif
453
427454 #if defined(BN_MP_GET_INT_C)
428455 #endif
429456
508535 #endif
509536
510537 #if defined(BN_MP_JACOBI_C)
538 # define BN_MP_KRONECKER_C
511539 # define BN_MP_ISNEG_C
512540 # define BN_MP_CMP_D_C
513 # define BN_MP_ISZERO_C
514 # define BN_MP_INIT_COPY_C
515 # define BN_MP_CNT_LSB_C
516 # define BN_MP_DIV_2D_C
517 # define BN_MP_MOD_C
518 # define BN_MP_CLEAR_C
519541 #endif
520542
521543 #if defined(BN_MP_KARATSUBA_MUL_C)
537559 # define BN_S_MP_SUB_C
538560 # define BN_MP_LSHD_C
539561 # define BN_MP_ADD_C
562 # define BN_MP_CLEAR_C
563 #endif
564
565 #if defined(BN_MP_KRONECKER_C)
566 # define BN_MP_ISZERO_C
567 # define BN_MP_ISEVEN_C
568 # define BN_MP_INIT_COPY_C
569 # define BN_MP_CNT_LSB_C
570 # define BN_MP_DIV_2D_C
571 # define BN_MP_CMP_D_C
572 # define BN_MP_COPY_C
573 # define BN_MP_MOD_C
540574 # define BN_MP_CLEAR_C
541575 #endif
542576
665699 # define BN_MP_CLEAR_C
666700 #endif
667701
702 #if defined(BN_MP_PRIME_FROBENIUS_UNDERWOOD_C)
703 # define BN_MP_PRIME_IS_PRIME_C
704 # define BN_MP_INIT_MULTI_C
705 # define BN_MP_SET_LONG_C
706 # define BN_MP_SQR_C
707 # define BN_MP_SUB_D_C
708 # define BN_MP_KRONECKER_C
709 # define BN_MP_GCD_C
710 # define BN_MP_ADD_D_C
711 # define BN_MP_SET_C
712 # define BN_MP_COUNT_BITS_C
713 # define BN_MP_MUL_2_C
714 # define BN_MP_MUL_D_C
715 # define BN_MP_ADD_C
716 # define BN_MP_MUL_C
717 # define BN_MP_SUB_C
718 # define BN_MP_MOD_C
719 # define BN_MP_GET_BIT_C
720 # define BN_MP_EXCH_C
721 # define BN_MP_ISZERO_C
722 # define BN_MP_CMP_C
723 # define BN_MP_CLEAR_MULTI_C
724 #endif
725
668726 #if defined(BN_MP_PRIME_IS_DIVISIBLE_C)
669727 # define BN_MP_MOD_D_C
670728 #endif
671729
672730 #if defined(BN_MP_PRIME_IS_PRIME_C)
731 # define BN_MP_ISEVEN_C
732 # define BN_MP_IS_SQUARE_C
673733 # define BN_MP_CMP_D_C
674734 # define BN_MP_PRIME_IS_DIVISIBLE_C
675 # define BN_MP_INIT_C
676 # define BN_MP_SET_C
735 # define BN_MP_INIT_SET_C
677736 # define BN_MP_PRIME_MILLER_RABIN_C
737 # define BN_MP_PRIME_FROBENIUS_UNDERWOOD_C
738 # define BN_MP_PRIME_STRONG_LUCAS_SELFRIDGE_C
739 # define BN_MP_READ_RADIX_C
740 # define BN_MP_CMP_C
741 # define BN_MP_SET_C
742 # define BN_MP_COUNT_BITS_C
743 # define BN_MP_RAND_C
744 # define BN_MP_DIV_2D_C
678745 # define BN_MP_CLEAR_C
679746 #endif
680747
698765 # define BN_MP_MOD_D_C
699766 # define BN_MP_INIT_C
700767 # define BN_MP_ADD_D_C
701 # define BN_MP_PRIME_MILLER_RABIN_C
768 # define BN_MP_PRIME_IS_PRIME_C
702769 # define BN_MP_CLEAR_C
703770 #endif
704771
714781 # define BN_MP_ADD_D_C
715782 #endif
716783
784 #if defined(BN_MP_PRIME_STRONG_LUCAS_SELFRIDGE_C)
785 # define BN_MP_PRIME_IS_PRIME_C
786 # define BN_MP_MUL_D_C
787 # define BN_MP_MUL_SI_C
788 # define BN_MP_INIT_C
789 # define BN_MP_SET_LONG_C
790 # define BN_MP_MUL_C
791 # define BN_MP_CLEAR_C
792 # define BN_MP_INIT_MULTI_C
793 # define BN_MP_GCD_C
794 # define BN_MP_CMP_D_C
795 # define BN_MP_CMP_C
796 # define BN_MP_KRONECKER_C
797 # define BN_MP_ADD_D_C
798 # define BN_MP_CNT_LSB_C
799 # define BN_MP_DIV_2D_C
800 # define BN_MP_SET_C
801 # define BN_MP_MUL_2_C
802 # define BN_MP_COUNT_BITS_C
803 # define BN_MP_MOD_C
804 # define BN_MP_SQR_C
805 # define BN_MP_SUB_C
806 # define BN_MP_GET_BIT_C
807 # define BN_MP_ADD_C
808 # define BN_MP_ISODD_C
809 # define BN_MP_DIV_2_C
810 # define BN_MP_SUB_D_C
811 # define BN_MP_ISZERO_C
812 # define BN_MP_CLEAR_MULTI_C
813 #endif
814
717815 #if defined(BN_MP_RADIX_SIZE_C)
718816 # define BN_MP_ISZERO_C
719817 # define BN_MP_COUNT_BITS_C
830928
831929 #if defined(BN_MP_SET_C)
832930 # define BN_MP_ZERO_C
931 #endif
932
933 #if defined(BN_MP_SET_DOUBLE_C)
934 # define BN_MP_SET_LONG_LONG_C
935 # define BN_MP_DIV_2D_C
936 # define BN_MP_MUL_2D_C
937 # define BN_MP_ISZERO_C
833938 #endif
834939
835940 #if defined(BN_MP_SET_INT_C)
11121217 #else
11131218 # define LTM_LAST
11141219 #endif
1220
1221 /* ref: $Format:%D$ */
1222 /* git commit: $Format:%H$ */
1223 /* commit time: $Format:%ai$ */
66 * Michael Fromberger but has been written from scratch with
77 * additional optimizations in place.
88 *
9 * The library is free for all purposes without any express
10 * guarantee it works.
9 * SPDX-License-Identifier: Unlicense
1110 */
1211 #ifndef TOMMATH_PRIV_H_
1312 #define TOMMATH_PRIV_H_
0 /* LibTomMath, multiple-precision integer library -- Tom St Denis
1 *
2 * LibTomMath is a library that provides multiple-precision
3 * integer arithmetic as well as number theoretic functionality.
4 *
5 * The library was designed directly after the MPI library by
6 * Michael Fromberger but has been written from scratch with
7 * additional optimizations in place.
8 *
9 * SPDX-License-Identifier: Unlicense
10 */
11
012 /* super class file for PK algos */
113
214 /* default ... include all MPI */