/mbedtls-3.5.0/library/ |
D | asn1parse.c | 39 int mbedtls_asn1_get_len(unsigned char **p, in mbedtls_asn1_get_len() argument 43 if ((end - *p) < 1) { in mbedtls_asn1_get_len() 47 if ((**p & 0x80) == 0) { in mbedtls_asn1_get_len() 48 *len = *(*p)++; in mbedtls_asn1_get_len() 50 switch (**p & 0x7F) { in mbedtls_asn1_get_len() 52 if ((end - *p) < 2) { in mbedtls_asn1_get_len() 56 *len = (*p)[1]; in mbedtls_asn1_get_len() 57 (*p) += 2; in mbedtls_asn1_get_len() 61 if ((end - *p) < 3) { in mbedtls_asn1_get_len() 65 *len = ((size_t) (*p)[1] << 8) | (*p)[2]; in mbedtls_asn1_get_len() [all …]
|
D | asn1write.c | 31 int mbedtls_asn1_write_len(unsigned char **p, const unsigned char *start, size_t len) in mbedtls_asn1_write_len() argument 34 if (*p - start < 1) { in mbedtls_asn1_write_len() 38 *--(*p) = (unsigned char) len; in mbedtls_asn1_write_len() 43 if (*p - start < 2) { in mbedtls_asn1_write_len() 47 *--(*p) = (unsigned char) len; in mbedtls_asn1_write_len() 48 *--(*p) = 0x81; in mbedtls_asn1_write_len() 53 if (*p - start < 3) { in mbedtls_asn1_write_len() 57 *--(*p) = MBEDTLS_BYTE_0(len); in mbedtls_asn1_write_len() 58 *--(*p) = MBEDTLS_BYTE_1(len); in mbedtls_asn1_write_len() 59 *--(*p) = 0x82; in mbedtls_asn1_write_len() [all …]
|
D | x509.c | 71 int mbedtls_x509_get_serial(unsigned char **p, const unsigned char *end, in mbedtls_x509_get_serial() argument 76 if ((end - *p) < 1) { in mbedtls_x509_get_serial() 81 if (**p != (MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_PRIMITIVE | 2) && in mbedtls_x509_get_serial() 82 **p != MBEDTLS_ASN1_INTEGER) { in mbedtls_x509_get_serial() 87 serial->tag = *(*p)++; in mbedtls_x509_get_serial() 89 if ((ret = mbedtls_asn1_get_len(p, end, &serial->len)) != 0) { in mbedtls_x509_get_serial() 93 serial->p = *p; in mbedtls_x509_get_serial() 94 *p += serial->len; in mbedtls_x509_get_serial() 105 int mbedtls_x509_get_alg_null(unsigned char **p, const unsigned char *end, in mbedtls_x509_get_alg_null() argument 110 if ((ret = mbedtls_asn1_get_alg_null(p, end, alg)) != 0) { in mbedtls_x509_get_alg_null() [all …]
|
D | x509_csr.c | 54 static int x509_csr_get_version(unsigned char **p, in x509_csr_get_version() argument 60 if ((ret = mbedtls_asn1_get_int(p, end, ver)) != 0) { in x509_csr_get_version() 76 unsigned char **p, const unsigned char *end) in x509_csr_parse_extensions() argument 81 while (*p < end) { in x509_csr_parse_extensions() 86 if ((ret = mbedtls_asn1_get_tag(p, end, &len, in x509_csr_parse_extensions() 91 end_ext_data = *p + len; in x509_csr_parse_extensions() 94 if ((ret = mbedtls_asn1_get_tag(p, end_ext_data, &extn_oid.len, in x509_csr_parse_extensions() 100 extn_oid.p = *p; in x509_csr_parse_extensions() 101 *p += extn_oid.len; in x509_csr_parse_extensions() 104 if ((ret = mbedtls_asn1_get_tag(p, end_ext_data, &len, in x509_csr_parse_extensions() [all …]
|
D | x509_crl.c | 62 static int x509_crl_get_version(unsigned char **p, in x509_crl_get_version() argument 68 if ((ret = mbedtls_asn1_get_int(p, end, ver)) != 0) { in x509_crl_get_version() 87 static int x509_get_crl_ext(unsigned char **p, in x509_get_crl_ext() argument 93 if (*p == end) { in x509_get_crl_ext() 101 if ((ret = mbedtls_x509_get_ext(p, end, ext, 0)) != 0) { in x509_get_crl_ext() 105 end = ext->p + ext->len; in x509_get_crl_ext() 107 while (*p < end) { in x509_get_crl_ext() 119 if ((ret = mbedtls_asn1_get_tag(p, end, &len, in x509_get_crl_ext() 124 end_ext_data = *p + len; in x509_get_crl_ext() 127 if ((ret = mbedtls_asn1_get_tag(p, end_ext_data, &len, in x509_get_crl_ext() [all …]
|
D | pkcs7.c | 52 static int pkcs7_get_next_content_len(unsigned char **p, unsigned char *end, in pkcs7_get_next_content_len() argument 57 ret = mbedtls_asn1_get_tag(p, end, len, MBEDTLS_ASN1_CONSTRUCTED in pkcs7_get_next_content_len() 61 } else if ((size_t) (end - *p) != *len) { in pkcs7_get_next_content_len() 73 static int pkcs7_get_version(unsigned char **p, unsigned char *end, int *ver) in pkcs7_get_version() argument 77 ret = mbedtls_asn1_get_int(p, end, ver); in pkcs7_get_version() 96 static int pkcs7_get_content_info_type(unsigned char **p, unsigned char *end, in pkcs7_get_content_info_type() argument 102 unsigned char *start = *p; in pkcs7_get_content_info_type() 104 ret = mbedtls_asn1_get_tag(p, end, &len, MBEDTLS_ASN1_CONSTRUCTED in pkcs7_get_content_info_type() 107 *p = start; in pkcs7_get_content_info_type() 110 *seq_end = *p + len; in pkcs7_get_content_info_type() [all …]
|
D | ssl_tls13_client.c | 56 unsigned char *p = buf; in ssl_tls13_write_supported_versions_ext() local 70 MBEDTLS_SSL_CHK_BUF_PTR(p, end, 5 + versions_len); in ssl_tls13_write_supported_versions_ext() 72 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_SUPPORTED_VERSIONS, p, 0); in ssl_tls13_write_supported_versions_ext() 73 MBEDTLS_PUT_UINT16_BE(versions_len + 1, p, 2); in ssl_tls13_write_supported_versions_ext() 74 p += 4; in ssl_tls13_write_supported_versions_ext() 77 *p++ = versions_len; in ssl_tls13_write_supported_versions_ext() 83 mbedtls_ssl_write_version(p, MBEDTLS_SSL_TRANSPORT_STREAM, in ssl_tls13_write_supported_versions_ext() 89 mbedtls_ssl_write_version(p + 2, MBEDTLS_SSL_TRANSPORT_STREAM, in ssl_tls13_write_supported_versions_ext() 134 const unsigned char *p = buf; in ssl_tls13_parse_alpn_ext() local 154 MBEDTLS_SSL_CHK_BUF_READ_PTR(p, end, 2); in ssl_tls13_parse_alpn_ext() [all …]
|
D | ssl_client.c | 45 unsigned char *p = buf; in ssl_write_hostname_ext() local 60 MBEDTLS_SSL_CHK_BUF_PTR(p, end, hostname_len + 9); in ssl_write_hostname_ext() 88 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_SERVERNAME, p, 0); in ssl_write_hostname_ext() 89 p += 2; in ssl_write_hostname_ext() 91 MBEDTLS_PUT_UINT16_BE(hostname_len + 5, p, 0); in ssl_write_hostname_ext() 92 p += 2; in ssl_write_hostname_ext() 94 MBEDTLS_PUT_UINT16_BE(hostname_len + 3, p, 0); in ssl_write_hostname_ext() 95 p += 2; in ssl_write_hostname_ext() 97 *p++ = MBEDTLS_BYTE_0(MBEDTLS_TLS_EXT_SERVERNAME_HOSTNAME); in ssl_write_hostname_ext() 99 MBEDTLS_PUT_UINT16_BE(hostname_len, p, 0); in ssl_write_hostname_ext() [all …]
|
D | pkparse.c | 167 static int pk_get_ecparams(unsigned char **p, const unsigned char *end, in pk_get_ecparams() argument 172 if (end - *p < 1) { in pk_get_ecparams() 178 params->tag = **p; in pk_get_ecparams() 188 if ((ret = mbedtls_asn1_get_tag(p, end, ¶ms->len, params->tag)) != 0) { in pk_get_ecparams() 192 params->p = *p; in pk_get_ecparams() 193 *p += params->len; in pk_get_ecparams() 195 if (*p != end) { in pk_get_ecparams() 226 unsigned char *p = params->p; in pk_group_from_specified() local 227 const unsigned char * const end = params->p + params->len; in pk_group_from_specified() 233 if ((ret = mbedtls_asn1_get_int(&p, end, &ver)) != 0) { in pk_group_from_specified() [all …]
|
D | x509_crt.c | 289 if (name->len < 3 || name->p[0] != '*' || name->p[1] != '.') { in x509_check_wildcard() 305 x509_memcasecmp(name->p + 1, cn + cn_idx, name->len - 1) == 0) { in x509_check_wildcard() 322 memcmp(a->p, b->p, b->len) == 0) { in x509_string_cmp() 329 x509_memcasecmp(a->p, b->p, b->len) == 0) { in x509_string_cmp() 357 memcmp(a->oid.p, b->oid.p, b->oid.len) != 0) { in x509_name_cmp() 402 static int x509_get_version(unsigned char **p, in x509_get_version() argument 409 if ((ret = mbedtls_asn1_get_tag(p, end, &len, in x509_get_version() 420 end = *p + len; in x509_get_version() 422 if ((ret = mbedtls_asn1_get_int(p, end, ver)) != 0) { in x509_get_version() 426 if (*p != end) { in x509_get_version() [all …]
|
D | ssl_tls13_server.c | 65 const unsigned char *p = buf; in ssl_tls13_parse_key_exchange_modes_ext() local 70 MBEDTLS_SSL_CHK_BUF_READ_PTR(p, end, 1); in ssl_tls13_parse_key_exchange_modes_ext() 71 ke_modes_len = *p++; in ssl_tls13_parse_key_exchange_modes_ext() 80 MBEDTLS_SSL_CHK_BUF_READ_PTR(p, end, ke_modes_len); in ssl_tls13_parse_key_exchange_modes_ext() 83 switch (*p++) { in ssl_tls13_parse_key_exchange_modes_ext() 395 for (const unsigned char *p = cipher_suites; in ssl_tls13_select_ciphersuite_for_psk() local 396 p < cipher_suites_end; p += 2) { in ssl_tls13_select_ciphersuite_for_psk() 400 cipher_suite = MBEDTLS_GET_UINT16_BE(p, 0); in ssl_tls13_select_ciphersuite_for_psk() 433 for (const unsigned char *p = cipher_suites; p < cipher_suites_end; p += 2) { in ssl_tls13_select_ciphersuite_for_resumption() local 434 uint16_t cipher_suite = MBEDTLS_GET_UINT16_BE(p, 0); in ssl_tls13_select_ciphersuite_for_resumption() [all …]
|
D | bignum_mod.c | 39 mbedtls_mpi_uint *p, in mbedtls_mpi_mod_residue_setup() argument 42 if (p_limbs != N->limbs || !mbedtls_mpi_core_lt_ct(p, N->p, N->limbs)) { in mbedtls_mpi_mod_residue_setup() 47 r->p = p; in mbedtls_mpi_mod_residue_setup() 59 r->p = NULL; in mbedtls_mpi_mod_residue_release() 68 N->p = NULL; in mbedtls_mpi_mod_modulus_init() 97 N->p = NULL; in mbedtls_mpi_mod_modulus_free() 123 memcpy(N.p, A, sizeof(mbedtls_mpi_uint) * limbs); in set_mont_const_square() 128 *X = RR.p; in set_mont_const_square() 129 RR.p = NULL; in set_mont_const_square() 140 const mbedtls_mpi_uint *p, in mbedtls_mpi_mod_modulus_setup() argument [all …]
|
D | x509_create.c | 212 cur->val.p[0] = critical; in mbedtls_x509_set_extension() 213 memcpy(cur->val.p + 1, val, val_len); in mbedtls_x509_set_extension() 230 static int x509_write_name(unsigned char **p, in x509_write_name() argument 236 const char *oid = (const char *) cur_name->oid.p; in x509_write_name() 238 const unsigned char *name = cur_name->val.p; in x509_write_name() 242 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_tagged_string(p, start, in x509_write_name() 248 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_oid(p, start, oid, in x509_write_name() 251 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_len(p, start, len)); in x509_write_name() 252 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_tag(p, start, in x509_write_name() 256 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_len(p, start, len)); in x509_write_name() [all …]
|
D | bignum.c | 74 X->p = NULL; in mbedtls_mpi_init() 86 if (X->p != NULL) { in mbedtls_mpi_free() 87 mbedtls_mpi_zeroize(X->p, X->n); in mbedtls_mpi_free() 88 mbedtls_free(X->p); in mbedtls_mpi_free() 93 X->p = NULL; in mbedtls_mpi_free() 101 mbedtls_mpi_uint *p; in mbedtls_mpi_grow() local 109 if ((p = (mbedtls_mpi_uint *) mbedtls_calloc(nblimbs, ciL)) == NULL) { in mbedtls_mpi_grow() 113 if (X->p != NULL) { in mbedtls_mpi_grow() 114 memcpy(p, X->p, X->n * ciL); in mbedtls_mpi_grow() 115 mbedtls_mpi_zeroize(X->p, X->n); in mbedtls_mpi_grow() [all …]
|
D | ssl_tls12_server.c | 190 const unsigned char *p; in ssl_parse_supported_groups_ext() local 232 p = buf + 2; in ssl_parse_supported_groups_ext() 234 uint16_t curr_tls_id = MBEDTLS_GET_UINT16_BE(p, 0); in ssl_parse_supported_groups_ext() 243 p += 2; in ssl_parse_supported_groups_ext() 255 const unsigned char *p; in ssl_parse_supported_point_formats() local 265 p = buf + 1; in ssl_parse_supported_point_formats() 267 if (p[0] == MBEDTLS_ECP_PF_UNCOMPRESSED || in ssl_parse_supported_point_formats() 268 p[0] == MBEDTLS_ECP_PF_COMPRESSED) { in ssl_parse_supported_point_formats() 271 ssl->handshake->ecdh_ctx.point_format = p[0]; in ssl_parse_supported_point_formats() 277 p[0]); in ssl_parse_supported_point_formats() [all …]
|
D | ecjpake.c | 189 ctx->s.p == NULL) { in mbedtls_ecjpake_check() 199 static int ecjpake_write_len_point(unsigned char **p, in ecjpake_write_len_point() argument 209 if (end < *p || end - *p < 5) { in ecjpake_write_len_point() 214 &len, *p + 4, end - (*p + 4)); in ecjpake_write_len_point() 219 MBEDTLS_PUT_UINT32_BE(len, *p, 0); in ecjpake_write_len_point() 221 *p += 4 + len; in ecjpake_write_len_point() 246 unsigned char *p = buf; in ecjpake_hash() local 252 MBEDTLS_MPI_CHK(ecjpake_write_len_point(&p, end, grp, pf, G)); in ecjpake_hash() 253 MBEDTLS_MPI_CHK(ecjpake_write_len_point(&p, end, grp, pf, V)); in ecjpake_hash() 254 MBEDTLS_MPI_CHK(ecjpake_write_len_point(&p, end, grp, pf, X)); in ecjpake_hash() [all …]
|
D | ssl_tls12_client.c | 62 unsigned char *p = buf; in ssl_write_renegotiation_ext() local 76 MBEDTLS_SSL_CHK_BUF_PTR(p, end, 5 + ssl->verify_data_len); in ssl_write_renegotiation_ext() 81 MBEDTLS_PUT_UINT16_BE(MBEDTLS_TLS_EXT_RENEGOTIATION_INFO, p, 0); in ssl_write_renegotiation_ext() 82 p += 2; in ssl_write_renegotiation_ext() 84 *p++ = 0x00; in ssl_write_renegotiation_ext() 85 *p++ = MBEDTLS_BYTE_0(ssl->verify_data_len + 1); in ssl_write_renegotiation_ext() 86 *p++ = MBEDTLS_BYTE_0(ssl->verify_data_len); in ssl_write_renegotiation_ext() 88 memcpy(p, ssl->own_verify_data, ssl->verify_data_len); in ssl_write_renegotiation_ext() 105 unsigned char *p = buf; in ssl_write_supported_point_formats_ext() local 112 MBEDTLS_SSL_CHK_BUF_PTR(p, end, 6); in ssl_write_supported_point_formats_ext() [all …]
|
D | ssl_tls13_generic.c | 169 const unsigned char *p = buf; in ssl_tls13_parse_certificate_verify() local 189 MBEDTLS_SSL_CHK_BUF_READ_PTR(p, end, 2); in ssl_tls13_parse_certificate_verify() 190 algorithm = MBEDTLS_GET_UINT16_BE(p, 0); in ssl_tls13_parse_certificate_verify() 191 p += 2; in ssl_tls13_parse_certificate_verify() 236 MBEDTLS_SSL_CHK_BUF_READ_PTR(p, end, 2); in ssl_tls13_parse_certificate_verify() 237 signature_len = MBEDTLS_GET_UINT16_BE(p, 0); in ssl_tls13_parse_certificate_verify() 238 p += 2; in ssl_tls13_parse_certificate_verify() 239 MBEDTLS_SSL_CHK_BUF_READ_PTR(p, end, signature_len); in ssl_tls13_parse_certificate_verify() 265 p, signature_len)) == 0) { in ssl_tls13_parse_certificate_verify() 393 const unsigned char *p = buf; in mbedtls_ssl_tls13_parse_certificate() local [all …]
|
D | base64.c | 44 unsigned char *p; in mbedtls_base64_encode() local 67 for (i = 0, p = dst; i < n; i += 3) { in mbedtls_base64_encode() 72 *p++ = mbedtls_ct_base64_enc_char((C1 >> 2) & 0x3F); in mbedtls_base64_encode() 73 *p++ = mbedtls_ct_base64_enc_char((((C1 & 3) << 4) + (C2 >> 4)) in mbedtls_base64_encode() 75 *p++ = mbedtls_ct_base64_enc_char((((C2 & 15) << 2) + (C3 >> 6)) in mbedtls_base64_encode() 77 *p++ = mbedtls_ct_base64_enc_char(C3 & 0x3F); in mbedtls_base64_encode() 84 *p++ = mbedtls_ct_base64_enc_char((C1 >> 2) & 0x3F); in mbedtls_base64_encode() 85 *p++ = mbedtls_ct_base64_enc_char((((C1 & 3) << 4) + (C2 >> 4)) in mbedtls_base64_encode() 89 *p++ = mbedtls_ct_base64_enc_char(((C2 & 15) << 2) & 0x3F); in mbedtls_base64_encode() 91 *p++ = '='; in mbedtls_base64_encode() [all …]
|
/mbedtls-3.5.0/programs/test/ |
D | udp_proxy.c | 192 char *p, *q; in get_options() local 207 p = argv[i]; in get_options() 208 if ((q = strchr(p, '=')) == NULL) { in get_options() 209 exit_usage(p, NULL); in get_options() 213 if (strcmp(p, "server_addr") == 0) { in get_options() 215 } else if (strcmp(p, "server_port") == 0) { in get_options() 217 } else if (strcmp(p, "listen_addr") == 0) { in get_options() 219 } else if (strcmp(p, "listen_port") == 0) { in get_options() 221 } else if (strcmp(p, "duplicate") == 0) { in get_options() 224 exit_usage(p, q); in get_options() [all …]
|
/mbedtls-3.5.0/include/mbedtls/ |
D | asn1write.h | 63 int mbedtls_asn1_write_len(unsigned char **p, const unsigned char *start, 77 int mbedtls_asn1_write_tag(unsigned char **p, const unsigned char *start, 93 int mbedtls_asn1_write_raw_buffer(unsigned char **p, const unsigned char *start, 111 int mbedtls_asn1_write_mpi(unsigned char **p, const unsigned char *start, 127 int mbedtls_asn1_write_null(unsigned char **p, const unsigned char *start); 143 int mbedtls_asn1_write_oid(unsigned char **p, const unsigned char *start, 161 int mbedtls_asn1_write_algorithm_identifier(unsigned char **p, 179 int mbedtls_asn1_write_bool(unsigned char **p, const unsigned char *start, 196 int mbedtls_asn1_write_int(unsigned char **p, const unsigned char *start, int val); 211 int mbedtls_asn1_write_enum(unsigned char **p, const unsigned char *start, int val); [all …]
|
D | asn1.h | 136 memcmp((oid_str), (oid_buf)->p, (oid_buf)->len) != 0) 157 unsigned char *p; /**< ASN1 data, e.g. in ASCII. */ member 167 unsigned char *p; /**< Raw ASN1 data for the bit string */ member 231 int mbedtls_asn1_get_len(unsigned char **p, 256 int mbedtls_asn1_get_tag(unsigned char **p, 275 int mbedtls_asn1_get_bool(unsigned char **p, 296 int mbedtls_asn1_get_int(unsigned char **p, 317 int mbedtls_asn1_get_enum(unsigned char **p, 338 int mbedtls_asn1_get_bitstring(unsigned char **p, const unsigned char *end, 359 int mbedtls_asn1_get_bitstring_null(unsigned char **p, [all …]
|
/mbedtls-3.5.0/tests/suites/ |
D | test_suite_bignum_mod.function | 10 ASSERT_COMPARE((a).p, (a).limbs * sizeof(mbedtls_mpi_uint), \ 11 (b).p, (b).limbs * sizeof(mbedtls_mpi_uint)) 17 mbedtls_mpi_uint *p = NULL; 20 int ret = mbedtls_test_read_mpi_core(&p, &limbs, input); 25 return mbedtls_mpi_mod_modulus_setup(m, p, limbs, int_rep); 33 mbedtls_mpi_uint *p = NULL; 36 int ret = mbedtls_test_read_mpi_core(&p, &limbs, input); 42 r->p = p; 48 return mbedtls_mpi_mod_residue_setup(r, m, p, limbs); 83 TEST_ASSERT(m.p != mp); [all …]
|
D | test_suite_asn1parse.function | 19 static int nested_parse(unsigned char **const p, 25 unsigned char *const start = *p; 40 TEST_EQUAL(mbedtls_asn1_get_tag(p, end, &len2, tag ^ 1), 42 *p = start; 43 TEST_EQUAL(mbedtls_asn1_get_tag(p, end, &len2, tag), 0); 45 TEST_ASSERT(*p == content_start); 46 *p = content_start; 52 *p = start; 53 ret = mbedtls_asn1_get_bool(p, end, &val); 65 *p = start; [all …]
|
/mbedtls-3.5.0/programs/x509/ |
D | cert_write.c | 54 do { x.len = MBEDTLS_OID_SIZE(oid); x.p = (unsigned char *) oid; } while (0) 259 unsigned char *p = obuf; in parse_serial_decimal_format() local 281 *p = val; in parse_serial_decimal_format() 283 p++; in parse_serial_decimal_format() 303 char *p, *q, *r; in main() local 366 p = argv[i]; in main() 367 if ((q = strchr(p, '=')) == NULL) { in main() 372 if (strcmp(p, "request_file") == 0) { in main() 374 } else if (strcmp(p, "subject_key") == 0) { in main() 376 } else if (strcmp(p, "issuer_key") == 0) { in main() [all …]
|