Lines Matching refs:p

80     volatile unsigned char *p = v; while( n-- ) *p++ = 0;  in mbedtls_zeroize()  local
209 static int x509_get_version( unsigned char **p, in x509_get_version() argument
216 if( ( ret = mbedtls_asn1_get_tag( p, end, &len, in x509_get_version()
228 end = *p + len; in x509_get_version()
230 if( ( ret = mbedtls_asn1_get_int( p, end, ver ) ) != 0 ) in x509_get_version()
233 if( *p != end ) in x509_get_version()
245 static int x509_get_dates( unsigned char **p, in x509_get_dates() argument
253 if( ( ret = mbedtls_asn1_get_tag( p, end, &len, in x509_get_dates()
257 end = *p + len; in x509_get_dates()
259 if( ( ret = mbedtls_x509_get_time( p, end, from ) ) != 0 ) in x509_get_dates()
262 if( ( ret = mbedtls_x509_get_time( p, end, to ) ) != 0 ) in x509_get_dates()
265 if( *p != end ) in x509_get_dates()
275 static int x509_get_uid( unsigned char **p, in x509_get_uid() argument
281 if( *p == end ) in x509_get_uid()
284 uid->tag = **p; in x509_get_uid()
286 if( ( ret = mbedtls_asn1_get_tag( p, end, &uid->len, in x509_get_uid()
295 uid->p = *p; in x509_get_uid()
296 *p += uid->len; in x509_get_uid()
301 static int x509_get_basic_constraints( unsigned char **p, in x509_get_basic_constraints() argument
317 if( ( ret = mbedtls_asn1_get_tag( p, end, &len, in x509_get_basic_constraints()
321 if( *p == end ) in x509_get_basic_constraints()
324 if( ( ret = mbedtls_asn1_get_bool( p, end, ca_istrue ) ) != 0 ) in x509_get_basic_constraints()
327 ret = mbedtls_asn1_get_int( p, end, ca_istrue ); in x509_get_basic_constraints()
336 if( *p == end ) in x509_get_basic_constraints()
339 if( ( ret = mbedtls_asn1_get_int( p, end, max_pathlen ) ) != 0 ) in x509_get_basic_constraints()
342 if( *p != end ) in x509_get_basic_constraints()
351 static int x509_get_ns_cert_type( unsigned char **p, in x509_get_ns_cert_type() argument
358 if( ( ret = mbedtls_asn1_get_bitstring( p, end, &bs ) ) != 0 ) in x509_get_ns_cert_type()
366 *ns_cert_type = *bs.p; in x509_get_ns_cert_type()
370 static int x509_get_key_usage( unsigned char **p, in x509_get_key_usage() argument
378 if( ( ret = mbedtls_asn1_get_bitstring( p, end, &bs ) ) != 0 ) in x509_get_key_usage()
389 *key_usage |= (unsigned int) bs.p[i] << (8*i); in x509_get_key_usage()
400 static int x509_get_ext_key_usage( unsigned char **p, in x509_get_ext_key_usage() argument
406 if( ( ret = mbedtls_asn1_get_sequence_of( p, end, ext_key_usage, MBEDTLS_ASN1_OID ) ) != 0 ) in x509_get_ext_key_usage()
410 if( ext_key_usage->buf.p == NULL ) in x509_get_ext_key_usage()
443 static int x509_get_subject_alt_name( unsigned char **p, in x509_get_subject_alt_name() argument
454 if( ( ret = mbedtls_asn1_get_tag( p, end, &len, in x509_get_subject_alt_name()
458 if( *p + len != end ) in x509_get_subject_alt_name()
462 while( *p < end ) in x509_get_subject_alt_name()
464 if( ( end - *p ) < 1 ) in x509_get_subject_alt_name()
468 tag = **p; in x509_get_subject_alt_name()
469 (*p)++; in x509_get_subject_alt_name()
470 if( ( ret = mbedtls_asn1_get_len( p, end, &tag_len ) ) != 0 ) in x509_get_subject_alt_name()
480 *p += tag_len; in x509_get_subject_alt_name()
485 if( cur->buf.p != NULL ) in x509_get_subject_alt_name()
501 buf->p = *p; in x509_get_subject_alt_name()
503 *p += buf->len; in x509_get_subject_alt_name()
509 if( *p != end ) in x509_get_subject_alt_name()
520 static int x509_get_crt_ext( unsigned char **p, in x509_get_crt_ext() argument
528 if( ( ret = mbedtls_x509_get_ext( p, end, &crt->v3_ext, 3 ) ) != 0 ) in x509_get_crt_ext()
536 while( *p < end ) in x509_get_crt_ext()
548 if( ( ret = mbedtls_asn1_get_tag( p, end, &len, in x509_get_crt_ext()
552 end_ext_data = *p + len; in x509_get_crt_ext()
555 extn_oid.tag = **p; in x509_get_crt_ext()
557 if( ( ret = mbedtls_asn1_get_tag( p, end, &extn_oid.len, MBEDTLS_ASN1_OID ) ) != 0 ) in x509_get_crt_ext()
560 extn_oid.p = *p; in x509_get_crt_ext()
561 *p += extn_oid.len; in x509_get_crt_ext()
563 if( ( end - *p ) < 1 ) in x509_get_crt_ext()
568 if( ( ret = mbedtls_asn1_get_bool( p, end_ext_data, &is_critical ) ) != 0 && in x509_get_crt_ext()
573 if( ( ret = mbedtls_asn1_get_tag( p, end_ext_data, &len, in x509_get_crt_ext()
577 end_ext_octet = *p + len; in x509_get_crt_ext()
591 *p = end_ext_octet; in x509_get_crt_ext()
614 if( ( ret = x509_get_basic_constraints( p, end_ext_octet, in x509_get_crt_ext()
621 if( ( ret = x509_get_key_usage( p, end_ext_octet, in x509_get_crt_ext()
628 if( ( ret = x509_get_ext_key_usage( p, end_ext_octet, in x509_get_crt_ext()
635 if( ( ret = x509_get_subject_alt_name( p, end_ext_octet, in x509_get_crt_ext()
642 if( ( ret = x509_get_ns_cert_type( p, end_ext_octet, in x509_get_crt_ext()
652 if( *p != end ) in x509_get_crt_ext()
667 unsigned char *p, *end, *crt_end; in x509_crt_parse_der_core() local
681 p = (unsigned char*) buf; in x509_crt_parse_der_core()
683 end = p + len; in x509_crt_parse_der_core()
691 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, in x509_crt_parse_der_core()
698 if( len > (size_t) ( end - p ) ) in x509_crt_parse_der_core()
704 crt_end = p + len; in x509_crt_parse_der_core()
708 crt->raw.p = p = mbedtls_calloc( 1, crt->raw.len ); in x509_crt_parse_der_core()
709 if( p == NULL ) in x509_crt_parse_der_core()
712 memcpy( p, buf, crt->raw.len ); in x509_crt_parse_der_core()
715 p += crt->raw.len - len; in x509_crt_parse_der_core()
716 end = crt_end = p + len; in x509_crt_parse_der_core()
721 crt->tbs.p = p; in x509_crt_parse_der_core()
723 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, in x509_crt_parse_der_core()
730 end = p + len; in x509_crt_parse_der_core()
731 crt->tbs.len = end - crt->tbs.p; in x509_crt_parse_der_core()
740 if( ( ret = x509_get_version( &p, end, &crt->version ) ) != 0 || in x509_crt_parse_der_core()
741 ( ret = mbedtls_x509_get_serial( &p, end, &crt->serial ) ) != 0 || in x509_crt_parse_der_core()
742 ( ret = mbedtls_x509_get_alg( &p, end, &crt->sig_oid, in x509_crt_parse_der_core()
768 crt->issuer_raw.p = p; in x509_crt_parse_der_core()
770 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, in x509_crt_parse_der_core()
777 if( ( ret = mbedtls_x509_get_name( &p, p + len, &crt->issuer ) ) != 0 ) in x509_crt_parse_der_core()
783 crt->issuer_raw.len = p - crt->issuer_raw.p; in x509_crt_parse_der_core()
791 if( ( ret = x509_get_dates( &p, end, &crt->valid_from, in x509_crt_parse_der_core()
801 crt->subject_raw.p = p; in x509_crt_parse_der_core()
803 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, in x509_crt_parse_der_core()
810 if( len && ( ret = mbedtls_x509_get_name( &p, p + len, &crt->subject ) ) != 0 ) in x509_crt_parse_der_core()
816 crt->subject_raw.len = p - crt->subject_raw.p; in x509_crt_parse_der_core()
821 if( ( ret = mbedtls_pk_parse_subpubkey( &p, end, &crt->pk ) ) != 0 ) in x509_crt_parse_der_core()
837 ret = x509_get_uid( &p, end, &crt->issuer_id, 1 ); in x509_crt_parse_der_core()
847 ret = x509_get_uid( &p, end, &crt->subject_id, 2 ); in x509_crt_parse_der_core()
859 ret = x509_get_crt_ext( &p, end, crt ); in x509_crt_parse_der_core()
867 if( p != end ) in x509_crt_parse_der_core()
883 if( ( ret = mbedtls_x509_get_alg( &p, end, &sig_oid2, &sig_params2 ) ) != 0 ) in x509_crt_parse_der_core()
890 memcmp( crt->sig_oid.p, sig_oid2.p, crt->sig_oid.len ) != 0 || in x509_crt_parse_der_core()
893 memcmp( sig_params1.p, sig_params2.p, sig_params1.len ) != 0 ) ) in x509_crt_parse_der_core()
899 if( ( ret = mbedtls_x509_get_sig( &p, end, &crt->sig ) ) != 0 ) in x509_crt_parse_der_core()
905 if( p != end ) in x509_crt_parse_der_core()
1109 char *p; in mbedtls_x509_crt_parse_path() local
1122 p = filename + len; in mbedtls_x509_crt_parse_path()
1137 memset( p, 0, len ); in mbedtls_x509_crt_parse_path()
1144 p, (int) len - 1, in mbedtls_x509_crt_parse_path()
1227 char *p = *buf; in x509_info_subject_alt_name() local
1236 *p = '\0'; in x509_info_subject_alt_name()
1242 *p++ = sep[i]; in x509_info_subject_alt_name()
1244 *p++ = cur->buf.p[i]; in x509_info_subject_alt_name()
1252 *p = '\0'; in x509_info_subject_alt_name()
1255 *buf = p; in x509_info_subject_alt_name()
1262 ret = mbedtls_snprintf( p, n, "%s" i, sep ); \
1276 char *p = *buf; in x509_info_cert_type() local
1289 *buf = p; in x509_info_cert_type()
1303 char *p = *buf; in x509_info_key_usage() local
1317 *buf = p; in x509_info_key_usage()
1328 char *p = *buf; in x509_info_ext_key_usage() local
1337 ret = mbedtls_snprintf( p, n, "%s%s", sep, desc ); in x509_info_ext_key_usage()
1346 *buf = p; in x509_info_ext_key_usage()
1361 char *p; in mbedtls_x509_crt_info() local
1364 p = buf; in mbedtls_x509_crt_info()
1369 ret = mbedtls_snprintf( p, n, "\nCertificate is uninitialised!\n" ); in mbedtls_x509_crt_info()
1375 ret = mbedtls_snprintf( p, n, "%scert. version : %d\n", in mbedtls_x509_crt_info()
1378 ret = mbedtls_snprintf( p, n, "%sserial number : ", in mbedtls_x509_crt_info()
1382 ret = mbedtls_x509_serial_gets( p, n, &crt->serial ); in mbedtls_x509_crt_info()
1385 ret = mbedtls_snprintf( p, n, "\n%sissuer name : ", prefix ); in mbedtls_x509_crt_info()
1387 ret = mbedtls_x509_dn_gets( p, n, &crt->issuer ); in mbedtls_x509_crt_info()
1390 ret = mbedtls_snprintf( p, n, "\n%ssubject name : ", prefix ); in mbedtls_x509_crt_info()
1392 ret = mbedtls_x509_dn_gets( p, n, &crt->subject ); in mbedtls_x509_crt_info()
1395 ret = mbedtls_snprintf( p, n, "\n%sissued on : " \ in mbedtls_x509_crt_info()
1402 ret = mbedtls_snprintf( p, n, "\n%sexpires on : " \ in mbedtls_x509_crt_info()
1409 ret = mbedtls_snprintf( p, n, "\n%ssigned using : ", prefix ); in mbedtls_x509_crt_info()
1412 ret = mbedtls_x509_sig_alg_gets( p, n, &crt->sig_oid, crt->sig_pk, in mbedtls_x509_crt_info()
1423 ret = mbedtls_snprintf( p, n, "\n%s%-" BC "s: %d bits", prefix, key_size_str, in mbedtls_x509_crt_info()
1433 ret = mbedtls_snprintf( p, n, "\n%sbasic constraints : CA=%s", prefix, in mbedtls_x509_crt_info()
1439 ret = mbedtls_snprintf( p, n, ", max_pathlen=%d", crt->max_pathlen - 1 ); in mbedtls_x509_crt_info()
1446 ret = mbedtls_snprintf( p, n, "\n%ssubject alt name : ", prefix ); in mbedtls_x509_crt_info()
1449 if( ( ret = x509_info_subject_alt_name( &p, &n, in mbedtls_x509_crt_info()
1456 ret = mbedtls_snprintf( p, n, "\n%scert. type : ", prefix ); in mbedtls_x509_crt_info()
1459 if( ( ret = x509_info_cert_type( &p, &n, crt->ns_cert_type ) ) != 0 ) in mbedtls_x509_crt_info()
1465 ret = mbedtls_snprintf( p, n, "\n%skey usage : ", prefix ); in mbedtls_x509_crt_info()
1468 if( ( ret = x509_info_key_usage( &p, &n, crt->key_usage ) ) != 0 ) in mbedtls_x509_crt_info()
1474 ret = mbedtls_snprintf( p, n, "\n%sext key usage : ", prefix ); in mbedtls_x509_crt_info()
1477 if( ( ret = x509_info_ext_key_usage( &p, &n, in mbedtls_x509_crt_info()
1482 ret = mbedtls_snprintf( p, n, "\n" ); in mbedtls_x509_crt_info()
1522 char *p = buf; in mbedtls_x509_crt_verify_info() local
1530 ret = mbedtls_snprintf( p, n, "%s%s\n", prefix, cur->string ); in mbedtls_x509_crt_verify_info()
1537 ret = mbedtls_snprintf( p, n, "%sUnknown reason " in mbedtls_x509_crt_verify_info()
1589 memcmp( cur_oid->p, usage_oid, usage_len ) == 0 ) in mbedtls_x509_crt_check_extended_key_usage()
1613 memcmp( crt->serial.p, cur->serial.p, crt->serial.len ) == 0 ) in mbedtls_x509_crt_is_revoked()
1644 memcmp( crl_list->issuer_raw.p, ca->subject_raw.p, in x509_crt_verifycrl()
1681 mbedtls_md( md_info, crl_list->tbs.p, crl_list->tbs.len, hash ); in x509_crt_verifycrl()
1688 crl_list->sig.p, crl_list->sig.len ) != 0 ) in x509_crt_verifycrl()
1756 if( name->len < 3 || name->p[0] != '*' || name->p[1] != '.' ) in x509_check_wildcard()
1772 x509_memcasecmp( name->p + 1, cn + cn_idx, name->len - 1 ) == 0 ) in x509_check_wildcard()
1790 memcmp( a->p, b->p, b->len ) == 0 ) in x509_string_cmp()
1798 x509_memcasecmp( a->p, b->p, b->len ) == 0 ) in x509_string_cmp()
1827 memcmp( a->oid.p, b->oid.p, b->oid.len ) != 0 ) in x509_name_cmp()
1875 memcmp( child->raw.p, parent->raw.p, child->raw.len ) == 0 ) in x509_crt_check_parent()
1934 mbedtls_md( md_info, child->tbs.p, child->tbs.len, hash ); in x509_crt_verify_top()
1948 memcmp( child->subject_raw.p, trust_ca->subject_raw.p, in x509_crt_verify_top()
1973 child->sig.p, child->sig.len ) != 0 ) in x509_crt_verify_top()
1996 memcmp( child->subject_raw.p, trust_ca->subject_raw.p, in x509_crt_verify_top()
2075 mbedtls_md( md_info, child->tbs.p, child->tbs.len, hash ); in x509_crt_verify_child()
2082 child->sig.p, child->sig.len ) != 0 ) in x509_crt_verify_child()
2211 x509_memcasecmp( cn, cur->buf.p, cn_len ) == 0 ) in mbedtls_x509_crt_verify_with_profile()
2215 memcmp( cur->buf.p, "*.", 2 ) == 0 && in mbedtls_x509_crt_verify_with_profile()
2234 x509_memcasecmp( name->val.p, cn, cn_len ) == 0 ) in mbedtls_x509_crt_verify_with_profile()
2238 memcmp( name->val.p, "*.", 2 ) == 0 && in mbedtls_x509_crt_verify_with_profile()
2371 if( cert_cur->raw.p != NULL ) in mbedtls_x509_crt_free()
2373 mbedtls_zeroize( cert_cur->raw.p, cert_cur->raw.len ); in mbedtls_x509_crt_free()
2374 mbedtls_free( cert_cur->raw.p ); in mbedtls_x509_crt_free()