Branch Coverage

SSLeay.xs
Criterion Covered Total %
branch 622 1808 34.4


line true false branch
236 1 0 if (trace && SvIOK(trace) && SvIV(trace)>=level) {
1 0 if (trace && SvIOK(trace) && SvIV(trace)>=level) {
1 0 if (trace && SvIOK(trace) && SvIV(trace)>=level) {
0 1 if (trace && SvIOK(trace) && SvIV(trace)>=level) {
424 50 39 if (!m) return; /* Skip aliases */
426 18 21 if (strcmp(from, mname)) return; /* Skip shortnames */
428 5 16 if (EVP_MD_flags(m) & EVP_MD_FLAG_PKEY_DIGEST) return; /* Skip clones */
430 0 16 if (strchr(mname, ' ')) mname= EVP_MD_name(m);
486 10 0 if (cb) {
490 1 9 cb->data = (data == &PL_sv_undef) ? NULL : data;
497 9 0 if (cb) {
498 9 0 if (cb->func) {
502 1 8 if (cb->data) {
518 0 353 len = my_snprintf(key_name, sizeof(key_name), "ptr_%p", ptr);
519 0 353 if (len == sizeof(key_name)) return 0; /* error - key_name too short*/
523 178 175 if (svtmp == NULL) {
528 0 175 if (!SvOK(*svtmp) || !SvROK(*svtmp)) return 0;
0 0 if (!SvOK(*svtmp) || !SvROK(*svtmp)) return 0;
0 0 if (!SvOK(*svtmp) || !SvROK(*svtmp)) return 0;
0 175 if (!SvOK(*svtmp) || !SvROK(*svtmp)) return 0;
538 344 9 if (data!=NULL) {
539 150 194 if (SvOK(data))
150 0 if (SvOK(data))
0 150 if (SvOK(data))
557 0 1113 len = my_snprintf(key_name, sizeof(key_name), "ptr_%p", ptr);
558 0 1113 if (len == sizeof(key_name)) return &PL_sv_undef; /* return undef on error - key_name too short*/
562 3 1110 if (svtmp == NULL) return &PL_sv_undef;
563 0 1110 if (!SvOK(*svtmp)) return &PL_sv_undef;
0 0 if (!SvOK(*svtmp)) return &PL_sv_undef;
0 0 if (!SvOK(*svtmp)) return &PL_sv_undef;
564 0 1110 if (!SvROK(*svtmp)) return &PL_sv_undef;
573 480 630 if (svtmp == NULL) return &PL_sv_undef;
574 0 630 if (!SvOK(*svtmp)) return &PL_sv_undef;
0 0 if (!SvOK(*svtmp)) return &PL_sv_undef;
0 0 if (!SvOK(*svtmp)) return &PL_sv_undef;
585 0 350 len = my_snprintf(key_name, sizeof(key_name), "ptr_%p", ptr);
586 0 350 if (len == sizeof(key_name)) return 0; /* error - key_name too short*/
605 3 18 if (!SvOK(cb_func)) {
3 0 if (!SvOK(cb_func)) {
3 0 if (!SvOK(cb_func)) {
610 0 21 if (!SvOK(cb_func))
0 0 if (!SvOK(cb_func))
0 0 if (!SvOK(cb_func))
618 0 21 PUSHMARK(sp);
619 0 21 EXTEND( sp, 2 );
630 0 21 if (count != 1)
633 21 0 res = POPi;
636 21 0 FREETMPS;
653 0 5 if(!SvOK(cb_func))
0 0 if(!SvOK(cb_func))
0 0 if(!SvOK(cb_func))
659 0 5 PUSHMARK(sp);
660 0 5 XPUSHs(sv_2mortal(newSViv(rwflag)));
661 0 5 XPUSHs(sv_2mortal(newSVsv(cb_data)));
668 0 5 if (count != 1)
671 5 0 res = POPp;
673 0 5 if (res == NULL) {
681 5 0 FREETMPS;
759 0 1 if(!SvOK(cb_func))
0 0 if(!SvOK(cb_func))
0 0 if(!SvOK(cb_func))
765 0 1 PUSHMARK(SP);
766 0 1 XPUSHs(sv_2mortal(newSViv(PTR2IV(x509_store_ctx))));
767 0 1 XPUSHs(sv_2mortal(newSVsv(cb_data)));
774 0 1 if (count != 1)
777 1 0 res = POPi;
780 1 0 FREETMPS;
800 0 0 if(!SvOK(cb_func))
0 0 if(!SvOK(cb_func))
0 0 if(!SvOK(cb_func))
806 0 0 PUSHMARK(SP);
807 0 0 XPUSHs(sv_2mortal(newSViv(PTR2IV(ssl))));
808 0 0 XPUSHs(sv_2mortal(newSVsv(cb_data)));
815 0 0 if (count != 1)
818 0 0 res = POPi;
821 0 0 FREETMPS;
843 0 0 if ( ! SvROK(cb_func) || (SvTYPE(SvRV(cb_func)) != SVt_PVCV))
0 0 if ( ! SvROK(cb_func) || (SvTYPE(SvRV(cb_func)) != SVt_PVCV))
847 0 0 if (p) ocsp_response = d2i_OCSP_RESPONSE(NULL, &p, len);
852 0 0 PUSHMARK(SP);
853 0 0 XPUSHs(sv_2mortal(newSViv(PTR2IV(ssl))));
855 0 0 XPUSHs(sv_2mortal(newSVsv(cb_data)));
859 0 0 if (ocsp_response) OCSP_RESPONSE_free(ocsp_response);
863 0 0 if (nres != 1)
866 0 0 res = POPi;
869 0 0 FREETMPS;
884 1 0 if ( ! SvROK(cb_func) || (SvTYPE(SvRV(cb_func)) != SVt_PVCV))
0 1 if ( ! SvROK(cb_func) || (SvTYPE(SvRV(cb_func)) != SVt_PVCV))
890 0 1 PUSHMARK(SP);
891 0 1 XPUSHs(sv_2mortal(newSViv(PTR2IV(ssl))));
892 0 1 XPUSHs(sv_2mortal(newSVpvn((const char *)data, len)));
893 0 1 XPUSHs(sv_2mortal(newSVsv(cb_data)));
900 0 1 if (nres != 1)
903 1 0 res = POPi;
906 1 0 FREETMPS;
931 0 0 if(!SvOK(cb_func))
0 0 if(!SvOK(cb_func))
0 0 if(!SvOK(cb_func))
937 0 0 PUSHMARK(SP);
939 0 0 XPUSHs(secretsv);
940 0 0 for (i=0; i
944 0 0 XPUSHs(sv_2mortal(newRV_inc((SV*)ciphers)));
945 0 0 XPUSHs(sv_2mortal(newRV_inc(pref_cipher)));
946 0 0 XPUSHs(sv_2mortal(newSVsv(cb_data)));
954 0 0 if (count != 1)
957 0 0 res = POPi;
958 0 0 if (res) {
960 0 0 if (SvIOK(pref_cipher))
961 0 0 *cipher = sk_SSL_CIPHER_value(peer_ciphers, SvIV(pref_cipher));
974 0 0 FREETMPS;
1002 0 0 if(!SvOK(cb_func))
0 0 if(!SvOK(cb_func))
0 0 if(!SvOK(cb_func))
1008 0 0 PUSHMARK(SP);
1009 0 0 if (hint != NULL) {
1011 0 0 XPUSHs(hintsv);
1020 0 0 if (count != 2)
1023 0 0 psk_val = POPpx;
1024 0 0 identity_val = POPpx;
1026 0 0 my_snprintf(identity, max_identity_len, "%s", identity_val);
0 0 my_snprintf(identity, max_identity_len, "%s", identity_val);
1028 0 0 if (BN_hex2bn(&psk_bn, psk_val) > 0) {
1029 0 0 if (BN_num_bytes(psk_bn) <= max_psk_len) {
1036 0 0 FREETMPS;
1062 0 0 if(!SvOK(cb_func))
0 0 if(!SvOK(cb_func))
0 0 if(!SvOK(cb_func))
1068 0 0 PUSHMARK(SP);
1069 0 0 if (hint != NULL) {
1071 0 0 XPUSHs(hintsv);
1080 0 0 if (count != 2)
1083 0 0 psk_val = POPpx;
1084 0 0 identity_val = POPpx;
1086 0 0 my_snprintf(identity, max_identity_len, "%s", identity_val);
0 0 my_snprintf(identity, max_identity_len, "%s", identity_val);
1088 0 0 if (BN_hex2bn(&psk_bn, psk_val) > 0) {
1089 0 0 if (BN_num_bytes(psk_bn) <= max_psk_len) {
1096 0 0 FREETMPS;
1110 0 8 if (last_index<0) return 0;
1111 16 8 for(i=0; i<=last_index; i++) {
1112 16 0 char *p = SvPV_nolen(*av_fetch(list, i, 0));
1114 0 16 if (len>255) return 0;
1115 8 8 if (out) {
1129 0 0 if (!list || inlen<2) return 0;
0 0 if (!list || inlen<2) return 0;
1130 0 0 while (i
1132 0 0 if (i+il > inlen) return 0;
1161 0 1 if (SvROK(cb_func) && (SvTYPE(SvRV(cb_func)) == SVt_PVCV)) {
0 0 if (SvROK(cb_func) && (SvTYPE(SvRV(cb_func)) == SVt_PVCV)) {
1167 0 0 if (!next_proto_helper_protodata2AV(list, in, inlen)) return SSL_TLSEXT_ERR_ALERT_FATAL;
1171 0 0 PUSHMARK(SP);
1172 0 0 XPUSHs(sv_2mortal(newSViv(PTR2IV(ssl))));
1173 0 0 XPUSHs(sv_2mortal(newRV_inc((SV*)list)));
1174 0 0 XPUSHs(sv_2mortal(newSVsv(cb_data)));
1178 0 0 if (count != 2)
1180 0 0 next_proto_data = (unsigned char*)POPpx;
1181 0 0 next_proto_status = POPi;
1184 0 0 if (next_proto_len<=255) {
1194 0 0 FREETMPS;
1197 0 0 return next_proto_len>255 ? SSL_TLSEXT_ERR_ALERT_FATAL : SSL_TLSEXT_ERR_OK;
1199 1 0 else if (SvROK(cb_data) && (SvTYPE(SvRV(cb_data)) == SVt_PVAV)) {
1 0 else if (SvROK(cb_data) && (SvTYPE(SvRV(cb_data)) == SVt_PVAV)) {
1202 0 1 if (!next_proto_data) return SSL_TLSEXT_ERR_ALERT_FATAL;
1207 0 1 if (next_proto_status != OPENSSL_NPN_NEGOTIATED) {
1233 0 1 if (SvROK(cb_func) && (SvTYPE(SvRV(cb_func)) == SVt_PVCV)) {
0 0 if (SvROK(cb_func) && (SvTYPE(SvRV(cb_func)) == SVt_PVCV)) {
1238 0 0 PUSHMARK(SP);
1239 0 0 XPUSHs(sv_2mortal(newSViv(PTR2IV(ssl))));
1240 0 0 XPUSHs(sv_2mortal(newSVsv(cb_data)));
1244 0 0 if (count != 1)
1247 0 0 if (SvOK(tmpsv) && SvROK(tmpsv) && (SvTYPE(SvRV(tmpsv)) == SVt_PVAV)) {
0 0 if (SvOK(tmpsv) && SvROK(tmpsv) && (SvTYPE(SvRV(tmpsv)) == SVt_PVAV)) {
0 0 if (SvOK(tmpsv) && SvROK(tmpsv) && (SvTYPE(SvRV(tmpsv)) == SVt_PVAV)) {
0 0 if (SvOK(tmpsv) && SvROK(tmpsv) && (SvTYPE(SvRV(tmpsv)) == SVt_PVAV)) {
0 0 if (SvOK(tmpsv) && SvROK(tmpsv) && (SvTYPE(SvRV(tmpsv)) == SVt_PVAV)) {
1251 0 0 if (protodata) next_proto_helper_AV2protodata(tmpav, protodata);
1254 0 0 FREETMPS;
1257 1 0 else if (SvROK(cb_data) && (SvTYPE(SvRV(cb_data)) == SVt_PVAV)) {
1 0 else if (SvROK(cb_data) && (SvTYPE(SvRV(cb_data)) == SVt_PVAV)) {
1261 1 0 if (protodata) next_proto_helper_AV2protodata(tmpav, protodata);
1263 1 0 if (protodata) {
1290 0 1 if (SvROK(cb_func) && (SvTYPE(SvRV(cb_func)) == SVt_PVCV)) {
0 0 if (SvROK(cb_func) && (SvTYPE(SvRV(cb_func)) == SVt_PVCV)) {
1297 0 0 if (!next_proto_helper_protodata2AV(list, in, inlen)) return SSL_TLSEXT_ERR_ALERT_FATAL;
1301 0 0 PUSHMARK(SP);
1302 0 0 XPUSHs(sv_2mortal(newSViv(PTR2IV(ssl))));
1303 0 0 XPUSHs(sv_2mortal(newRV_inc((SV*)list)));
1304 0 0 XPUSHs(sv_2mortal(newSVsv(cb_data)));
1308 0 0 if (count != 1)
1311 0 0 if (SvOK(alpn_data_sv)) {
0 0 if (SvOK(alpn_data_sv)) {
0 0 if (SvOK(alpn_data_sv)) {
1312 0 0 alpn_data = (unsigned char*)SvPV_nolen(alpn_data_sv);
1314 0 0 if (alpn_len <= 255) {
1324 0 0 FREETMPS;
1327 0 0 if (alpn_len>255) return SSL_TLSEXT_ERR_ALERT_FATAL;
1328 0 0 return alpn_data ? SSL_TLSEXT_ERR_OK : SSL_TLSEXT_ERR_NOACK;
1330 1 0 else if (SvROK(cb_data) && (SvTYPE(SvRV(cb_data)) == SVt_PVAV)) {
1 0 else if (SvROK(cb_data) && (SvTYPE(SvRV(cb_data)) == SVt_PVAV)) {
1335 0 1 if (!alpn_data) return SSL_TLSEXT_ERR_ALERT_FATAL;
1341 0 1 if (status != OPENSSL_NPN_NEGOTIATED) {
1345 1 0 return status == OPENSSL_NPN_NEGOTIATED ? SSL_TLSEXT_ERR_OK : SSL_TLSEXT_ERR_NOACK;
1362 2 0 if (cb->func && SvOK(cb->func)) {
0 2 if (cb->func && SvOK(cb->func)) {
0 0 if (cb->func && SvOK(cb->func)) {
0 0 if (cb->func && SvOK(cb->func)) {
1366 0 2 PUSHMARK(sp);
1368 0 2 XPUSHs(sv_2mortal( newSViv(bufsize-1) ));
1369 0 2 XPUSHs(sv_2mortal( newSViv(rwflag) ));
1370 0 2 if (cb->data) XPUSHs( cb->data );
0 0 if (cb->data) XPUSHs( cb->data );
1379 0 2 if (count != 1) {
1383 2 0 str = POPpx;
1385 2 0 if (str_len+1 < bufsize) {
1395 2 0 FREETMPS;
1408 845 0 if (cb->func && SvOK(cb->func)) {
505 340 if (cb->func && SvOK(cb->func)) {
505 0 if (cb->func && SvOK(cb->func)) {
0 505 if (cb->func && SvOK(cb->func)) {
1412 0 340 PUSHMARK(sp);
1414 0 340 XPUSHs(sv_2mortal( newSViv(i) ));
1415 0 340 XPUSHs(sv_2mortal( newSViv(n) ));
1416 221 119 if (cb->data) XPUSHs( cb->data );
0 221 if (cb->data) XPUSHs( cb->data );
1422 0 339 if (count != 0)
1427 339 0 FREETMPS;
1440 16 0 if ( ! SvROK(cb_func) || (SvTYPE(SvRV(cb_func)) != SVt_PVCV))
0 16 if ( ! SvROK(cb_func) || (SvTYPE(SvRV(cb_func)) != SVt_PVCV))
1446 0 16 PUSHMARK(SP);
1447 0 16 XPUSHs(sv_2mortal(newSViv(PTR2IV(ssl))));
1448 0 16 XPUSHs(sv_2mortal(newSViv(where)) );
1449 0 16 XPUSHs(sv_2mortal(newSViv(ret)) );
1450 0 16 XPUSHs(sv_2mortal(newSVsv(cb_data)));
1457 16 0 FREETMPS;
1470 457 0 if ( ! SvROK(cb_func) || (SvTYPE(SvRV(cb_func)) != SVt_PVCV))
0 457 if ( ! SvROK(cb_func) || (SvTYPE(SvRV(cb_func)) != SVt_PVCV))
1476 0 457 PUSHMARK(SP);
1477 0 457 XPUSHs(sv_2mortal(newSViv(PTR2IV(ssl))));
1478 0 457 XPUSHs(sv_2mortal(newSViv(where)) );
1479 0 457 XPUSHs(sv_2mortal(newSViv(ret)) );
1480 0 457 XPUSHs(sv_2mortal(newSVsv(cb_data)));
1487 457 0 FREETMPS;
1499 24 0 if ( ! SvROK(cb_func) || (SvTYPE(SvRV(cb_func)) != SVt_PVCV))
0 24 if ( ! SvROK(cb_func) || (SvTYPE(SvRV(cb_func)) != SVt_PVCV))
1505 0 24 PUSHMARK(SP);
1506 0 24 XPUSHs(sv_2mortal(newSViv(write_p)));
1507 0 24 XPUSHs(sv_2mortal(newSViv(version)));
1508 0 24 XPUSHs(sv_2mortal(newSViv(content_type)));
1509 0 24 XPUSHs(sv_2mortal(newSVpv((const char*)buf, len)));
1510 0 24 XPUSHs(sv_2mortal(newSViv(len)));
1511 0 24 XPUSHs(sv_2mortal(newSViv(PTR2IV(ssl))));
1512 0 24 XPUSHs(sv_2mortal(newSVsv(cb_data)));
1519 24 0 FREETMPS;
1532 24 0 if ( ! SvROK(cb_func) || (SvTYPE(SvRV(cb_func)) != SVt_PVCV))
0 24 if ( ! SvROK(cb_func) || (SvTYPE(SvRV(cb_func)) != SVt_PVCV))
1538 0 24 PUSHMARK(SP);
1539 0 24 XPUSHs(sv_2mortal(newSViv(write_p)));
1540 0 24 XPUSHs(sv_2mortal(newSViv(version)));
1541 0 24 XPUSHs(sv_2mortal(newSViv(content_type)));
1542 0 24 XPUSHs(sv_2mortal(newSVpv((const char*)buf, len)));
1543 0 24 XPUSHs(sv_2mortal(newSViv(len)));
1544 0 24 XPUSHs(sv_2mortal(newSViv(PTR2IV(ssl))));
1545 0 24 XPUSHs(sv_2mortal(newSVsv(cb_data)));
1552 24 0 FREETMPS;
1585 7 0 if (!SvROK(cb_func) || (SvTYPE(SvRV(cb_func)) != SVt_PVCV))
0 7 if (!SvROK(cb_func) || (SvTYPE(SvRV(cb_func)) != SVt_PVCV))
1590 0 7 PUSHMARK(SP);
1592 0 7 XPUSHs(sv_2mortal(newSVsv(cb_data)));
1594 4 3 if (!enc) {
1596 0 4 XPUSHs(sv_2mortal(newSVpv((const char *)key_name,16)));
1607 0 7 if (count>2)
1611 6 1 if (count>0) {
1613 0 6 if (SvOK(sname)) {
0 0 if (SvOK(sname)) {
0 0 if (SvOK(sname)) {
1614 6 0 unsigned char *pname = (unsigned char *)SvPV(sname,svlen);
1615 0 6 if (svlen > 16)
1617 0 6 if (svlen == 0)
1624 6 1 if (count>1) {
1626 0 6 if (SvOK(skey)) {
0 0 if (SvOK(skey)) {
0 0 if (SvOK(skey)) {
1627 6 0 unsigned char *pkey = (unsigned char *)SvPV(skey,svlen);
1628 0 6 if (svlen != 32 && svlen != 48)
0 0 if (svlen != 32 && svlen != 48)
1637 7 0 FREETMPS;
1640 4 3 if (!enc && usable_rv_count == 0) {
1 3 if (!enc && usable_rv_count == 0) {
1644 0 6 if (usable_rv_count != 2)
1647 3 3 if (enc) {
1659 2 1 if (memcmp(name,key_name,16) == 0)
1679 0 6 if(!SvOK(cb_func))
0 0 if(!SvOK(cb_func))
0 0 if(!SvOK(cb_func))
1685 0 6 PUSHMARK(sp);
1686 0 6 XPUSHs(sv_2mortal(newSViv(PTR2IV(ssl))));
1687 0 6 XPUSHs(sv_2mortal(newSViv(PTR2IV(sess))));
1694 0 6 if (count != 1)
1697 6 0 remove = POPi;
1700 6 0 FREETMPS;
1714 0 6 if(!SvOK(cb_func))
0 0 if(!SvOK(cb_func))
0 0 if(!SvOK(cb_func))
1720 0 6 PUSHMARK(sp);
1721 0 6 XPUSHs(sv_2mortal(newSViv(PTR2IV(ctx))));
1722 0 6 XPUSHs(sv_2mortal(newSViv(PTR2IV(sess))));
1730 6 0 FREETMPS;
1812 0 0 if (asn1t->type == V_ASN1_UTCTIME) {
1813 0 0 if (asn1t->length<12 || asn1t->length>17) return 0;
0 0 if (asn1t->length<12 || asn1t->length>17) return 0;
1814 0 0 if (asn1t->length>12) tz = 12;
1816 0 0 if (asn1t->length<14) return 0;
1817 0 0 if (asn1t->length>14) {
1818 0 0 if (p[14] == '.') {
1820 0 0 for(i=msec+1;ilength && p[i]>='0' && p[i]<='9';i++) ;
0 0 for(i=msec+1;ilength && p[i]>='0' && p[i]<='9';i++) ;
0 0 for(i=msec+1;ilength && p[i]>='0' && p[i]<='9';i++) ;
1821 0 0 if (ilength) tz = i;
1828 0 0 l = msec ? msec : tz ? tz : asn1t->length;
0 0 l = msec ? msec : tz ? tz : asn1t->length;
1829 0 0 for(i=0;i
1830 0 0 if (p[i]<'0' || p[i]>'9') return 0;
0 0 if (p[i]<'0' || p[i]>'9') return 0;
1835 0 0 if (asn1t->type == V_ASN1_UTCTIME) { /* YY - two digit year */
1837 0 0 if (t.tm_year < 70) t.tm_year += 100;
1852 0 0 if (tz) {
1854 0 0 if (p[tz] == 'Z') {
1855 0 0 if (asn1t->length>tz+1 ) return 0;
1856 0 0 } else if (asn1t->length
0 0 } else if (asn1t->length
0 0 } else if (asn1t->length
1859 0 0 if (asn1t->length>tz+5 ) return 0;
1860 0 0 for(i=tz+1;i
1861 0 0 if (p[i]<'0' || p[i]>'9') return 0;
0 0 if (p[i]<'0' || p[i]>'9') return 0;
1865 0 0 if (p[tz]=='+') adj*= -1; /* +0500: subtract 5 hours to get UTC */
1870 0 0 if (result == -1) return 0; /* broken time */
1872 0 0 if (gmtoff && *gmtoff == -1) {
0 0 if (gmtoff && *gmtoff == -1) {
1886 0 0 if (chain) {
1887 0 0 for(i=0;i
1888 0 0 if ( X509_check_issued(sk_X509_value(chain,i),cert) == X509_V_OK ) {
1895 0 0 if ( !issuer && store ) {
0 0 if ( !issuer && store ) {
1897 0 0 if (stx && X509_STORE_CTX_init(stx,store,cert,NULL)) {
0 0 if (stx && X509_STORE_CTX_init(stx,store,cert,NULL)) {
1899 0 0 if (ok<0) {
1901 0 0 if(err) {
1906 0 0 } else if (ok == 0 ) {
1912 0 0 if (stx) X509_STORE_CTX_free(stx);
1921 8 0 : &PL_sv_undef;
2158 7 0 RETVAL = SSL_CTX_load_verify_locations (ctx,
7 0 RETVAL = SSL_CTX_load_verify_locations (ctx,
2159 7 0 CAfile?(*CAfile?CAfile:NULL):NULL,
2160 0 7 CApath?(*CApath?CApath:NULL):NULL
2179 1 0 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 1 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 0 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 0 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
1 0 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 1 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 0 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 1 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 0 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 0 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 1 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 0 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 0 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 0 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 0 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 0 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 1 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 0 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 0 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 0 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 0 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 0 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
0 1 if (callback==NULL || !SvOK(callback) || !SvTRUE(callback)) {
2226 6 0 if (callback==NULL || !SvOK(callback)) {
0 6 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
2240 6 0 if (callback==NULL || !SvOK(callback)) {
0 6 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
2351 18 288 if (got <= 0 && SSL_ERROR_ZERO_RETURN != SSL_get_error(s, got))
6 12 if (got <= 0 && SSL_ERROR_ZERO_RETURN != SSL_get_error(s, got))
2358 306 0 if (GIMME_V==G_ARRAY) {
286 20 if (GIMME_V==G_ARRAY) {
2359 0 286 EXTEND(SP, 2);
2360 281 5 PUSHs(sv_2mortal(succeeded ? newSVpvn(buf, got) : newSV(0)));
2365 0 20 EXTEND(SP, 1);
2366 19 1 PUSHs(sv_2mortal(succeeded ? newSVpvn(buf, got) : newSV(0)));
2383 2 3 if (got <= 0 && SSL_ERROR_ZERO_RETURN != SSL_get_error(s, got))
2 0 if (got <= 0 && SSL_ERROR_ZERO_RETURN != SSL_get_error(s, got))
2390 5 0 if (GIMME_V==G_ARRAY) {
2 3 if (GIMME_V==G_ARRAY) {
2391 0 2 EXTEND(SP, 2);
2392 1 1 PUSHs(sv_2mortal(succeeded ? newSVpvn(buf, got) : newSV(0)));
2397 0 3 EXTEND(SP, 1);
2398 2 1 PUSHs(sv_2mortal(succeeded ? newSVpvn(buf, got) : newSV(0)));
2507 0 22 if (len < 0) {
2660 2 2 if( sk == NULL ) {
2663 194 2 for (i=0; i
2665 0 194 XPUSHs(sv_2mortal(newSViv(PTR2IV(c))));
2691 7 0 if(SSL_get_shared_ciphers(s, buf, sizeof(buf)))
2707 0 0 if( chain == NULL ) {
2710 0 0 for (i=0; i
2712 0 0 XPUSHs(sv_2mortal(newSViv(PTR2IV(x))));
2721 7 0 if (callback==NULL || !SvOK(callback)) {
0 7 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
2784 0 3 if (!(len = i2d_SSL_SESSION(sess,NULL))) croak("invalid SSL_SESSION");
2786 0 3 if (!pc) croak("out of memory");
2789 0 3 XPUSHs(sv_2mortal(newSVpv((char*)pc,len)));
2798 7 0 if (SvPOK(pv)) {
2801 7 0 p = (unsigned char*)SvPV(pv,len);
3073 0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
3223 43 1 if (!LIB_initialized) {
3321 0 0 RAND_add((const void *)SvPV(buf, len), num, entropy);
3336 0 3 if (!RAND_file_name(buf, num)) {
3375 0 0 RETVAL = X509_check_host(cert, name, 0, flags, (items == 4) ? &c_peername : NULL);
3376 0 0 if (items == 4)
3381 0 0 if (c_peername)
3397 0 0 c_address = (unsigned char *)SvPV(address, addresslen);
3504 17 0 if ((buf = X509_NAME_oneline(name, NULL, 0))) {
3521 13 0 if (bp) {
3522 13 0 if (X509_NAME_print_ex(bp, name, ident, flags)) {
3525 13 0 if (buf) {
3527 13 0 if (i>=0 && i<=n) {
13 0 if (i>=0 && i<=n) {
3529 0 13 if (utf8_decode) sv_utf8_decode(ST(0));
3548 1 0 if (length>=0) {
3550 1 0 if (X509_NAME_get_text_by_NID(name, nid, buf, length + 1)>=0)
3710 1 0 if (crl && crl_number)
1 0 if (crl && crl_number)
3711 1 0 if (X509_CRL_add1_ext_i2d(crl, NID_crl_number, crl_number, 0, 0)) RETVAL = 1;
3722 1 0 if (!RETVAL || i==-1) XSRETURN_UNDEF;
0 1 if (!RETVAL || i==-1) XSRETURN_UNDEF;
3742 2 0 if (rev) {
3743 2 0 if (BN_hex2bn(&bn, serial_hex)) {
3745 2 0 if (sn) {
3753 0 2 if (!rv) XSRETURN_IV(0);
3755 0 2 if (!rev_time) XSRETURN_IV(0);
3756 0 2 if (!X509_REVOKED_set_revocationDate(rev, rev_time)) XSRETURN_IV(0);
3758 2 0 if(reason_code) {
3761 2 0 if (rsn) {
3762 2 0 if (ASN1_ENUMERATED_set(rsn, reason_code))
3763 2 0 if (X509_REVOKED_add1_ext_i2d(rev, NID_crl_reason, rsn, 0, 0))
3767 0 2 if (!rv) XSRETURN_IV(0);
3770 2 0 if(comp_time) {
3774 0 2 if(!X509_CRL_add0_revoked(crl, rev)) XSRETURN_IV(0);
3847 1 1 for (i=0; i
3850 0 1 XPUSHs(sv_2mortal(newSViv(PTR2IV(s))));
3865 1 0 if (items>1) {
3868 6 1 while(i+1
3869 6 0 nid = SvIV(ST(i));
3870 6 0 data = SvPV_nolen(ST(i+1));
3873 6 0 if (ex)
3897 1 0 if (items>1) {
3899 6 1 while(i+1
3900 6 0 nid = SvIV(ST(i));
3901 6 0 data = SvPV_nolen(ST(i+1));
3905 6 0 if (ex) {
3932 1 0 if (items>1) {
3934 1 1 while(i+1
3935 1 0 nid = SvIV(ST(i));
3936 1 0 data = SvPV_nolen(ST(i+1));
3940 1 0 if (ex) {
3967 1 0 if (!x509 || !x509_req) XSRETURN_IV(0);
0 1 if (!x509 || !x509_req) XSRETURN_IV(0);
3969 6 1 for(i = 0; i < sk_X509_EXTENSION_num(exts); i++) {
3974 0 6 if (idx != -1) {
3975 0 0 if (override) continue; /* don't override existing extension */
3982 0 0 } while (idx != -1);
3984 0 6 if (!X509_add_ext(x509, ext, -1)) ret = 0;
4038 9 0 if (!k && !strcmp(type,"md5")) {
4 5 if (!k && !strcmp(type,"md5")) {
4042 5 4 if (!k && !strcmp(type,"sha1")) {
4 1 if (!k && !strcmp(type,"sha1")) {
4047 1 8 if (!k && !strcmp(type,"sha256")) {
0 1 if (!k && !strcmp(type,"sha256")) {
4052 1 8 if (!k && !strcmp(type,"ripemd160")) {
0 1 if (!k && !strcmp(type,"ripemd160")) {
4055 1 8 if (!k) /* Default digest */
4057 0 9 if ( digest_tp == NULL ) {
4061 0 9 if (!X509_digest(cert, digest_tp, digest, &dsz)) {
4066 164 9 for(k=0; k
4082 3 2 if ( (i = X509_get_ext_by_NID(cert, NID_subject_alt_name, -1)) >= 0
4083 3 0 && (subjAltNameExt = X509_get_ext(cert, i))
4084 3 0 && (subjAltNameDNs = X509V3_EXT_d2i(subjAltNameExt)))
4088 16 3 for (j = 0; j < num_gnames; j++)
4095 0 2 EXTEND(SP, 2);
4108 0 8 EXTEND(SP, 2);
4121 0 0 EXTEND(SP, 2);
4132 2 0 if (len < 0 || len > (int)((sizeof(buf) - 1)))
2 0 if (len < 0 || len > (int)((sizeof(buf) - 1)))
4134 0 2 EXTEND(SP, 2);
4142 0 4 EXTEND(SP, 2);
4167 1 3 if (points)
4168 2 1 for (i = 0; i < sk_DIST_POINT_num(points); i++) {
4170 0 2 if (!p->distpoint)
4172 2 0 if (p->distpoint->type == 0) {
4175 2 2 for (j = 0; j < sk_GENERAL_NAME_num(gnames); j++) {
4178 2 0 if (gn->type == GEN_URI) {
4182 0 2 XPUSHs(sv_2mortal(newSVpv((char*)ASN1_STRING_data(gn->d.ia5),ASN1_STRING_length(gn->d.ia5))));
4218 0 0 if (!info) XSRETURN_UNDEF;
4220 0 0 for (i = 0; i < sk_ACCESS_DESCRIPTION_num(info); i++) {
4222 0 0 if (OBJ_obj2nid(ad->method) == NID_ad_OCSP
4223 0 0 && ad->location->type == GEN_URI) {
4224 0 0 XPUSHs(sv_2mortal(newSVpv(
4232 0 0 if (GIMME == G_SCALAR) break; /* get only first */
0 0 if (GIMME == G_SCALAR) break; /* get only first */
4248 76 16 for(i = 0; i < sk_ASN1_OBJECT_num(extusage); i++) {
4252 19 57 if(format==0)
4253 0 19 XPUSHs(sv_2mortal(newSVpv(buffer,0))); /* format 0: oid */
4254 19 38 else if(format==1 && nid>0)
16 3 else if(format==1 && nid>0)
4255 0 16 XPUSHs(sv_2mortal(newSViv(nid))); /* format 1: nid */
4256 19 22 else if(format==2 && nid>0)
16 3 else if(format==2 && nid>0)
4257 0 16 XPUSHs(sv_2mortal(newSVpv(OBJ_nid2sn(nid),0))); /* format 2: shortname */
4258 19 6 else if(format==3 && nid>0)
16 3 else if(format==3 && nid>0)
4259 0 16 XPUSHs(sv_2mortal(newSVpv(OBJ_nid2ln(nid),0))); /* format 3: longname */
4271 4 0 if (u) {
4272 4 0 if (ASN1_BIT_STRING_get_bit(u,0)) XPUSHs(sv_2mortal(newSVpv("digitalSignature",0)));
0 4 if (ASN1_BIT_STRING_get_bit(u,0)) XPUSHs(sv_2mortal(newSVpv("digitalSignature",0)));
4273 1 3 if (ASN1_BIT_STRING_get_bit(u,1)) XPUSHs(sv_2mortal(newSVpv("nonRepudiation",0)));
0 1 if (ASN1_BIT_STRING_get_bit(u,1)) XPUSHs(sv_2mortal(newSVpv("nonRepudiation",0)));
4274 4 0 if (ASN1_BIT_STRING_get_bit(u,2)) XPUSHs(sv_2mortal(newSVpv("keyEncipherment",0)));
0 4 if (ASN1_BIT_STRING_get_bit(u,2)) XPUSHs(sv_2mortal(newSVpv("keyEncipherment",0)));
4275 1 3 if (ASN1_BIT_STRING_get_bit(u,3)) XPUSHs(sv_2mortal(newSVpv("dataEncipherment",0)));
0 1 if (ASN1_BIT_STRING_get_bit(u,3)) XPUSHs(sv_2mortal(newSVpv("dataEncipherment",0)));
4276 1 3 if (ASN1_BIT_STRING_get_bit(u,4)) XPUSHs(sv_2mortal(newSVpv("keyAgreement",0)));
0 1 if (ASN1_BIT_STRING_get_bit(u,4)) XPUSHs(sv_2mortal(newSVpv("keyAgreement",0)));
4277 1 3 if (ASN1_BIT_STRING_get_bit(u,5)) XPUSHs(sv_2mortal(newSVpv("keyCertSign",0)));
0 1 if (ASN1_BIT_STRING_get_bit(u,5)) XPUSHs(sv_2mortal(newSVpv("keyCertSign",0)));
4278 1 3 if (ASN1_BIT_STRING_get_bit(u,6)) XPUSHs(sv_2mortal(newSVpv("cRLSign",0)));
0 1 if (ASN1_BIT_STRING_get_bit(u,6)) XPUSHs(sv_2mortal(newSVpv("cRLSign",0)));
4279 0 4 if (ASN1_BIT_STRING_get_bit(u,7)) XPUSHs(sv_2mortal(newSVpv("encipherOnly",0)));
0 0 if (ASN1_BIT_STRING_get_bit(u,7)) XPUSHs(sv_2mortal(newSVpv("encipherOnly",0)));
4280 1 3 if (ASN1_BIT_STRING_get_bit(u,8)) XPUSHs(sv_2mortal(newSVpv("decipherOnly",0)));
0 1 if (ASN1_BIT_STRING_get_bit(u,8)) XPUSHs(sv_2mortal(newSVpv("decipherOnly",0)));
4290 0 4 if (u) {
4291 0 0 if (ASN1_BIT_STRING_get_bit(u,0)) XPUSHs(sv_2mortal(newSVpv("client",0)));
0 0 if (ASN1_BIT_STRING_get_bit(u,0)) XPUSHs(sv_2mortal(newSVpv("client",0)));
4292 0 0 if (ASN1_BIT_STRING_get_bit(u,1)) XPUSHs(sv_2mortal(newSVpv("server",0)));
0 0 if (ASN1_BIT_STRING_get_bit(u,1)) XPUSHs(sv_2mortal(newSVpv("server",0)));
4293 0 0 if (ASN1_BIT_STRING_get_bit(u,2)) XPUSHs(sv_2mortal(newSVpv("email",0)));
0 0 if (ASN1_BIT_STRING_get_bit(u,2)) XPUSHs(sv_2mortal(newSVpv("email",0)));
4294 0 0 if (ASN1_BIT_STRING_get_bit(u,3)) XPUSHs(sv_2mortal(newSVpv("objsign",0)));
0 0 if (ASN1_BIT_STRING_get_bit(u,3)) XPUSHs(sv_2mortal(newSVpv("objsign",0)));
4295 0 0 if (ASN1_BIT_STRING_get_bit(u,4)) XPUSHs(sv_2mortal(newSVpv("reserved",0)));
0 0 if (ASN1_BIT_STRING_get_bit(u,4)) XPUSHs(sv_2mortal(newSVpv("reserved",0)));
4296 0 0 if (ASN1_BIT_STRING_get_bit(u,5)) XPUSHs(sv_2mortal(newSVpv("sslCA",0)));
0 0 if (ASN1_BIT_STRING_get_bit(u,5)) XPUSHs(sv_2mortal(newSVpv("sslCA",0)));
4297 0 0 if (ASN1_BIT_STRING_get_bit(u,6)) XPUSHs(sv_2mortal(newSVpv("emailCA",0)));
0 0 if (ASN1_BIT_STRING_get_bit(u,6)) XPUSHs(sv_2mortal(newSVpv("emailCA",0)));
4298 0 0 if (ASN1_BIT_STRING_get_bit(u,7)) XPUSHs(sv_2mortal(newSVpv("objCA",0)));
0 0 if (ASN1_BIT_STRING_get_bit(u,7)) XPUSHs(sv_2mortal(newSVpv("objCA",0)));
4351 21 0 if (bp) {
4352 21 0 if(X509V3_EXT_print(bp,ext,flags,indent)) {
4355 21 0 if (buf) {
4357 21 0 if (i>=0 && i<=n) {
21 0 if (i>=0 && i<=n) {
4359 0 21 if (utf8_decode) sv_utf8_decode(ST(0));
4520 0 3 if (!BN_hex2bn(&bn, str)) XSRETURN_IV(0);
4521 0 3 if (!BN_to_ASN1_INTEGER(bn, i)) rv = 0;
4534 0 1 if (!BN_dec2bn(&bn, str)) XSRETURN_IV(0);
4535 0 1 if (!BN_to_ASN1_INTEGER(bn, i)) rv = 0;
4547 0 6 if (!bn) XSRETURN_UNDEF;
4551 0 6 if (!result) XSRETURN_UNDEF;
4552 0 6 XPUSHs(sv_2mortal(newSVpv((const char*)result, strlen(result))));
4563 0 5 if (!bn) XSRETURN_UNDEF;
4567 0 5 if (!result) XSRETURN_UNDEF;
4568 0 5 XPUSHs(sv_2mortal(newSVpv((const char*)result, strlen(result))));
4583 43 44 if (utf8_decode) sv_utf8_decode(u8);
4584 0 87 XPUSHs(sv_2mortal(u8));
4656 4 0 if (tm) {
4658 4 0 if (bp) {
4662 4 0 if (i>0)
4681 34 0 if (tmp) {
4682 34 0 if (ASN1_GENERALIZEDTIME_check(tmp)) {
4683 34 0 if (strlen((char*)tmp->data)>=14 && strlen((char*)tmp->data)<200) {
34 0 if (strlen((char*)tmp->data)>=14 && strlen((char*)tmp->data)<200) {
4691 34 0 if (strlen((char*)tmp->data)>14) strcat(buf+19,(char*)tmp->data+14);
4708 0 13 if (!tm) XSRETURN_UNDEF;
4710 0 13 if (strlen(str) < 19) XSRETURN_UNDEF;
4711 52 0 for (i=0; i<4; i++) if ((str[i] > '9') || (str[i] < '0')) XSRETURN_UNDEF;
0 52 for (i=0; i<4; i++) if ((str[i] > '9') || (str[i] < '0')) XSRETURN_UNDEF;
52 13 for (i=0; i<4; i++) if ((str[i] > '9') || (str[i] < '0')) XSRETURN_UNDEF;
4712 26 0 for (i=5; i<7; i++) if ((str[i] > '9') || (str[i] < '0')) XSRETURN_UNDEF;
0 26 for (i=5; i<7; i++) if ((str[i] > '9') || (str[i] < '0')) XSRETURN_UNDEF;
26 13 for (i=5; i<7; i++) if ((str[i] > '9') || (str[i] < '0')) XSRETURN_UNDEF;
4713 26 0 for (i=8; i<10; i++) if ((str[i] > '9') || (str[i] < '0')) XSRETURN_UNDEF;
0 26 for (i=8; i<10; i++) if ((str[i] > '9') || (str[i] < '0')) XSRETURN_UNDEF;
26 13 for (i=8; i<10; i++) if ((str[i] > '9') || (str[i] < '0')) XSRETURN_UNDEF;
4714 26 0 for (i=11; i<13; i++) if ((str[i] > '9') || (str[i] < '0')) XSRETURN_UNDEF;
0 26 for (i=11; i<13; i++) if ((str[i] > '9') || (str[i] < '0')) XSRETURN_UNDEF;
26 13 for (i=11; i<13; i++) if ((str[i] > '9') || (str[i] < '0')) XSRETURN_UNDEF;
4715 26 0 for (i=14; i<16; i++) if ((str[i] > '9') || (str[i] < '0')) XSRETURN_UNDEF;
0 26 for (i=14; i<16; i++) if ((str[i] > '9') || (str[i] < '0')) XSRETURN_UNDEF;
26 13 for (i=14; i<16; i++) if ((str[i] > '9') || (str[i] < '0')) XSRETURN_UNDEF;
4716 26 0 for (i=17; i<19; i++) if ((str[i] > '9') || (str[i] < '0')) XSRETURN_UNDEF;
0 26 for (i=17; i<19; i++) if ((str[i] > '9') || (str[i] < '0')) XSRETURN_UNDEF;
26 13 for (i=17; i<19; i++) if ((str[i] > '9') || (str[i] < '0')) XSRETURN_UNDEF;
4724 13 0 if (strlen(str)>19 && strlen(str)<200) strcat(buf,str+19);
13 0 if (strlen(str)>19 && strlen(str)<200) strcat(buf,str+19);
4732 13 0 if (!ASN1_TIME_check(&t)) {
4734 0 13 if (!ASN1_TIME_check(&t)) XSRETURN_UNDEF;
4738 0 13 if (!ASN1_STRING_set(tm,t.data,t.length)) XSRETURN_UNDEF;
4785 3 0 if (bp && x509) {
3 0 if (bp && x509) {
4789 3 0 if (buf) {
4791 3 0 if (i>=0 && i<=n) sv_setpvn(ST(0), buf, i);
3 0 if (i>=0 && i<=n) sv_setpvn(ST(0), buf, i);
4807 1 0 if (bp && x509_req) {
1 0 if (bp && x509_req) {
4811 1 0 if (buf) {
4813 1 0 if (i>=0 && i<=n) sv_setpvn(ST(0), buf, i);
1 0 if (i>=0 && i<=n) sv_setpvn(ST(0), buf, i);
4829 1 0 if (bp && x509_crl) {
1 0 if (bp && x509_crl) {
4833 1 0 if (buf) {
4835 1 0 if (i>=0 && i<=n) sv_setpvn(ST(0), buf, i);
1 0 if (i>=0 && i<=n) sv_setpvn(ST(0), buf, i);
4856 6 0 if (bp && pk) {
6 0 if (bp && pk) {
4857 2 4 if (passwd) passwd_len = strlen(passwd);
4858 2 4 if (passwd_len>0) {
4860 1 1 if (!enc_alg)
4871 6 0 if (buf) {
4873 6 0 if (i>=0 && i<=n) sv_setpvn(ST(0), buf, i);
6 0 if (i>=0 && i<=n) sv_setpvn(ST(0), buf, i);
4891 0 0 if ((fp = fopen (file, "rb"))) {
4897 0 0 if ((p12 = d2i_PKCS12_fp(fp, NULL))) {
4898 0 0 if (PKCS12_parse(p12, password, &private_key, &certificate, NULL)) {
4899 0 0 if (private_key) {
4900 0 0 if (SSL_CTX_use_PrivateKey(ctx, private_key)) RETVAL = 1;
4903 0 0 if (certificate) {
4904 0 0 if (SSL_CTX_use_certificate(ctx, certificate)) RETVAL = 1;
4910 0 0 if (!RETVAL) ERR_print_errors_fp(stderr);
4930 4 0 if ((fp = fopen (file, "rb"))) {
4936 4 0 if ((p12 = d2i_PKCS12_fp(fp, NULL))) {
4937 3 1 if(load_chain)
4941 4 0 if (result) {
4942 4 0 if (private_key)
4943 0 4 XPUSHs(sv_2mortal(newSViv(PTR2IV(private_key))));
4945 0 0 XPUSHs(sv_2mortal(newSVpv(NULL,0))); /* undef */
4946 4 0 if (certificate)
4947 0 4 XPUSHs(sv_2mortal(newSViv(PTR2IV(certificate))));
4949 0 0 XPUSHs(sv_2mortal(newSVpv(NULL,0))); /* undef */
4950 1 3 if (cachain) {
4951 2 1 for (i=0; i
4953 0 2 XPUSHs(sv_2mortal(newSViv(PTR2IV(x))));
4993 9 0 if (MD4(data,len,md)) {
5011 9 0 if (MD5(data,len,md)) {
5029 9 0 if (RIPEMD160(data,len,md)) {
5047 8 0 if (SHA1(data,len,md)) {
5064 8 0 if (SHA256(data,len,md)) {
5081 8 0 if (SHA512(data,len,md)) {
5272 55 83 if ((got = BIO_read(s, buf, max)) >= 0)
5349 0 194 if(description == NULL) {
5352 0 194 XPUSHs(sv_2mortal(newSVpv(description, 0)));
5363 0 390 if (items > 2) croak("SSL_CIPHER_get_bits: Need to call with one or two parameters");
5364 194 196 if (items > 1) sv_setsv(ST(1), sv_2mortal(newSViv(alg_bits)));
5431 1 0 if (callback==NULL || !SvOK(callback)) {
0 1 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
5460 4 0 if (callback==NULL || !SvOK(callback)) {
0 4 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
5477 2 0 if (data==NULL || !SvOK(data)) {
0 2 if (data==NULL || !SvOK(data)) {
0 0 if (data==NULL || !SvOK(data)) {
0 0 if (data==NULL || !SvOK(data)) {
5593 3 1 if (count > finished_len)
5612 3 1 if (count > finished_len)
5730 1 0 if (callback==NULL || !SvOK(callback)) {
0 1 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
5746 148 0 if (callback==NULL || !SvOK(callback)) {
0 148 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
5762 2 0 if (callback==NULL || !SvOK(callback)) {
1 1 if (callback==NULL || !SvOK(callback)) {
1 0 if (callback==NULL || !SvOK(callback)) {
1 0 if (callback==NULL || !SvOK(callback)) {
5778 2 0 if (callback==NULL || !SvOK(callback)) {
1 1 if (callback==NULL || !SvOK(callback)) {
1 0 if (callback==NULL || !SvOK(callback)) {
1 0 if (callback==NULL || !SvOK(callback)) {
6093 0 1 if (SvIOK(curve)) {
6094 0 0 nid = SvIV(curve);
6096 1 0 nid = OBJ_sn2nid(SvPV_nolen(curve));
6098 0 1 if (!nid) nid = EC_curve_nist2nid(SvPV_nolen(curve));
0 0 if (!nid) nid = EC_curve_nist2nid(SvPV_nolen(curve));
6100 0 1 if (!nid) croak("unknown curve %s",SvPV_nolen(curve));
0 0 if (!nid) croak("unknown curve %s",SvPV_nolen(curve));
6104 0 1 if (!group) croak("unknown curve nid=%d",nid);
6108 1 0 if ( eckey
6109 1 0 && EC_KEY_set_group(eckey, group)
6110 1 0 && EC_KEY_generate_key(eckey)) {
6113 0 0 if (eckey) EC_KEY_free(eckey);
6115 1 0 if (group) EC_GROUP_free(group);
6323 0 8 if(!e)
6329 0 8 if(!ret) {
6353 7 0 if (rc == -1 || ret == NULL) {
0 7 if (rc == -1 || ret == NULL) {
6354 0 0 if (ret) RSA_free(ret);
6407 0 1 XPUSHs(bn2sv(rsa->n));
6408 0 1 XPUSHs(bn2sv(rsa->e));
6409 0 1 XPUSHs(bn2sv(rsa->d));
6410 0 1 XPUSHs(bn2sv(rsa->p));
6411 0 1 XPUSHs(bn2sv(rsa->q));
6412 0 1 XPUSHs(bn2sv(rsa->dmp1));
6413 0 1 XPUSHs(bn2sv(rsa->dmq1));
6414 0 1 XPUSHs(bn2sv(rsa->iqmp));
6540 6 2 if (SvOK(perl_cb)) {
6 0 if (SvOK(perl_cb)) {
0 6 if (SvOK(perl_cb)) {
6546 6 0 else if (!SvOK(perl_cb) && SvOK(perl_data) && SvPOK(perl_data)) {
6 0 else if (!SvOK(perl_cb) && SvOK(perl_data) && SvPOK(perl_data)) {
6 0 else if (!SvOK(perl_cb) && SvOK(perl_data) && SvPOK(perl_data)) {
4 2 else if (!SvOK(perl_cb) && SvOK(perl_data) && SvPOK(perl_data)) {
4 0 else if (!SvOK(perl_cb) && SvOK(perl_data) && SvPOK(perl_data)) {
0 4 else if (!SvOK(perl_cb) && SvOK(perl_data) && SvPOK(perl_data)) {
2 0 else if (!SvOK(perl_cb) && SvOK(perl_data) && SvPOK(perl_data)) {
6550 4 0 else if (!SvOK(perl_cb) && !SvOK(perl_data)) {
4 0 else if (!SvOK(perl_cb) && !SvOK(perl_data)) {
4 0 else if (!SvOK(perl_cb) && !SvOK(perl_data)) {
4 0 else if (!SvOK(perl_cb) && !SvOK(perl_data)) {
4 0 else if (!SvOK(perl_cb) && !SvOK(perl_data)) {
4 0 else if (!SvOK(perl_cb) && !SvOK(perl_data)) {
6691 1 0 if (s == NULL ||
1 0 if (s == NULL ||
6692 1 0 s->enc_read_ctx == NULL ||
6693 0 1 s->enc_read_ctx->cipher == NULL ||
6706 1 0 if (s->s3)
6719 1 0 : -1;
6752 0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
6772 0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
6786 0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
6805 3 0 if (callback==NULL || !SvOK(callback)) {
0 3 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
6899 57 0 if (EVP_DigestFinal(ctx,md,&md_size))
6911 9 0 if (EVP_DigestFinal_ex(ctx,md,&md_size))
6927 48 0 if (EVP_Digest(data,len,md,&md_size,type,impl))
7249 4 0 if (X509_pubkey_digest(data,type,md,&md_size))
7264 4 0 if (X509_digest(data,type,md,&md_size))
7276 1 0 if (X509_CRL_digest(data,type,md,&md_size))
7288 1 0 if (X509_REQ_digest(data,type,md,&md_size))
7300 0 0 if (X509_NAME_digest(data,type,md,&md_size))
7349 0 1 if (!(pkey = X509_get_X509_PUBKEY(x))) croak("invalid certificate");
7350 0 1 if (!(len = i2d_X509_PUBKEY(pkey, NULL))) croak("invalid certificate public key");
7352 0 1 if (!pc) croak("out of memory");
7355 0 1 if (pi-pc != len) croak("invalid encoded length");
7356 0 1 XPUSHs(sv_2mortal(newSVpv((char*)pc,len)));
7368 1 0 if (callback==NULL || !SvOK(callback)) {
0 1 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
7374 1 0 else if (SvROK(callback) && (SvTYPE(SvRV(callback)) == SVt_PVAV)) {
1 0 else if (SvROK(callback) && (SvTYPE(SvRV(callback)) == SVt_PVAV)) {
7381 0 0 else if (SvROK(callback) && (SvTYPE(SvRV(callback)) == SVt_PVCV)) {
0 0 else if (SvROK(callback) && (SvTYPE(SvRV(callback)) == SVt_PVCV)) {
7400 1 0 if (callback==NULL || !SvOK(callback)) {
0 1 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
7406 1 0 else if (SvROK(callback) && (SvTYPE(SvRV(callback)) == SVt_PVAV)) {
1 0 else if (SvROK(callback) && (SvTYPE(SvRV(callback)) == SVt_PVAV)) {
7413 0 0 else if (SvROK(callback) && (SvTYPE(SvRV(callback)) == SVt_PVCV)) {
0 0 else if (SvROK(callback) && (SvTYPE(SvRV(callback)) == SVt_PVCV)) {
7433 0 2 XPUSHs(sv_2mortal(newSVpv((char *)data, len)));
7439 0 1 XPUSHs(sv_2mortal(newSVsv(cb_data_advanced_get((void*)s, "next_proto_select_cb!!last_status"))));
7473 0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
7477 0 0 } else if (SvROK(callback) && (SvTYPE(SvRV(callback)) == SVt_PVCV)) {
0 0 } else if (SvROK(callback) && (SvTYPE(SvRV(callback)) == SVt_PVCV)) {
7494 1 0 if (callback==NULL || !SvOK(callback)) {
0 1 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
7498 1 0 } else if (SvROK(callback) && (SvTYPE(SvRV(callback)) == SVt_PVCV)) {
1 0 } else if (SvROK(callback) && (SvTYPE(SvRV(callback)) == SVt_PVCV)) {
7518 1 0 if (ticketlen > 0) {
7520 0 1 if (!p)
7536 0 0 if (SvPOK(pv)) {
7539 0 0 p = (unsigned char*)SvPV(pv,len);
7551 0 0 if (!(len = i2d_OCSP_RESPONSE(r,NULL))) croak("invalid OCSP response");
7553 0 0 if (!pc) croak("out of memory");
7556 0 0 XPUSHs(sv_2mortal(newSVpv((char*)pc,len)));
7569 0 0 if (SvPOK(pv)) {
7572 0 0 p = (unsigned char*)SvPV(pv,len);
7584 0 0 if (!(len = i2d_OCSP_REQUEST(r,NULL))) croak("invalid OCSP request");
7586 0 0 if (!pc) croak("out of memory");
7589 0 0 XPUSHs(sv_2mortal(newSVpv((char*)pc,len)));
7617 0 0 if (!ssl) croak("not a SSL object");
7619 0 0 if (!ctx) croak("invalid SSL object - no context");
7623 0 0 for(i=0;i
7624 0 0 cert = INT2PTR(X509*,SvIV(ST(i+1)));
7625 0 0 if (X509_check_issued(cert,cert) == X509_V_OK)
7627 0 0 if (!(issuer = find_issuer(cert,store,chain)))
7631 0 0 if (!id)
7635 0 0 if (!(len = i2d_OCSP_CERTID(id,&pi)))
7637 0 0 XPUSHs(sv_2mortal(newSVpvn((char *)pi, len)));
7652 0 0 if (!req) croak("out of memory");
7655 0 0 for(i=0;i
7657 0 0 const unsigned char *p = (unsigned char*)SvPV(ST(i),len);
7659 0 0 if (!id) {
7684 0 0 if (!ssl) croak("not a SSL object");
7686 0 0 if (!ctx) croak("invalid SSL object - no context");
7689 0 0 if (!bsr) croak("invalid OCSP response");
7693 0 0 if (svreq && SvOK(svreq) &&
0 0 if (svreq && SvOK(svreq) &&
0 0 if (svreq && SvOK(svreq) &&
0 0 if (svreq && SvOK(svreq) &&
0 0 if (svreq && SvOK(svreq) &&
7694 0 0 (req = INT2PTR(OCSP_REQUEST*,SvIV(svreq)))) {
7696 0 0 if ( i <= 0 ) {
7697 0 0 if (i == -1) {
7707 0 0 if ((store = SSL_CTX_get_cert_store(ctx))) {
7712 0 0 for(i=0;i
7717 0 0 if (chain && !RETVAL) {
0 0 if (chain && !RETVAL) {
7725 0 0 if (last && (issuer = find_issuer(last,store,chain))) {
0 0 if (last && (issuer = find_issuer(last,store,chain))) {
7749 0 0 if (!bsr) croak("invalid OCSP response");
7751 0 0 want_array = (GIMME == G_ARRAY);
7755 0 0 for(i=0; i < (getall ? sksn : items-1); i++) {
0 0 for(i=0; i < (getall ? sksn : items-1); i++) {
7763 0 0 if(getall) {
7770 0 0 if (!SvOK(idsv)) croak("undefined certid in arguments");
0 0 if (!SvOK(idsv)) croak("undefined certid in arguments");
0 0 if (!SvOK(idsv)) croak("undefined certid in arguments");
7771 0 0 p = (unsigned char*)SvPV(idsv,len);
7772 0 0 if (!(certid = d2i_OCSP_CERTID(NULL,&p,len))) {
7777 0 0 if (first >= 0)
7781 0 0 if (sir)
7787 0 0 if (status == V_OCSP_CERTSTATUS_REVOKED)
7792 0 0 if (status == V_OCSP_CERTSTATUS_REVOKED) {
7794 0 0 } else if (status != V_OCSP_CERTSTATUS_GOOD) {
7797 0 0 else if (!OCSP_check_validity(thisupdate, nextupdate, 0, -1)) {
7805 0 0 if (want_array) {
7807 0 0 if (!idsv) {
7815 0 0 if(!len) continue;
7817 0 0 if (!pc) croak("out of memory");
7831 0 0 av_push(idav, error ? newSVpv(error,0) : newSV(0));
7832 0 0 if (sir) {
7837 0 0 if (nextupdate) hv_store(details,"nextUpdate",10,
7839 0 0 if (thisupdate) hv_store(details,"thisUpdate",10,
7841 0 0 if (status == V_OCSP_CERTSTATUS_REVOKED) {
7852 0 0 XPUSHs(sv_2mortal(newRV_noinc((SV*)idav)));
7853 0 0 } else if (!error) {
7856 0 0 if (!nextupd || nextupd>nu) nextupd = nu;
0 0 if (!nextupd || nextupd>nu) nextupd = nu;
7859 0 0 if (certid) OCSP_CERTID_free(certid);
7860 0 0 if (error && !want_array) {
0 0 if (error && !want_array) {
7866 0 0 if (!want_array)
7867 0 0 XPUSHs(sv_2mortal(newSViv(nextupd)));
7882 1 0 if (callback==NULL || !SvOK(callback)) {
0 1 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
0 0 if (callback==NULL || !SvOK(callback)) {
7888 1 0 else if (SvROK(callback) && (SvTYPE(SvRV(callback)) == SVt_PVAV)) {
1 0 else if (SvROK(callback) && (SvTYPE(SvRV(callback)) == SVt_PVAV)) {
7895 0 0 else if (SvROK(callback) && (SvTYPE(SvRV(callback)) == SVt_PVCV)) {
0 0 else if (SvROK(callback) && (SvTYPE(SvRV(callback)) == SVt_PVCV)) {
7918 1 0 if (!SvROK(data) || (SvTYPE(SvRV(data)) != SVt_PVAV))
0 1 if (!SvROK(data) || (SvTYPE(SvRV(data)) != SVt_PVAV))
7922 0 1 if (!alpn_data)
7942 0 0 if (!SvROK(data) || (SvTYPE(SvRV(data)) != SVt_PVAV))
0 0 if (!SvROK(data) || (SvTYPE(SvRV(data)) != SVt_PVAV))
7946 0 0 if (!alpn_data)
7963 0 2 XPUSHs(sv_2mortal(newSVpv((char *)data, len)));
7986 9 6 if (context != &PL_sv_undef) {
7988 9 0 context_arg = SvPV( ST(3), contextlen);
7991 15 0 PUSHs(sv_2mortal(ret>0 ? newSVpvn((const char *)out, outlen) : newSV(0)));
7992 0 15 EXTEND(SP, 1);