/mbedtls-3.7.0/tests/suites/ |
D | test_suite_common.function | 4 void fill_arrays(unsigned char *a, unsigned char *b, unsigned char *r1, unsigned char *r2, size_t n) 6 for (size_t i = 0; i < n; i++) { 18 size_t n = (size_t) len; 20 TEST_CALLOC(a, n + 1); 21 TEST_CALLOC(b, n + 1); 22 TEST_CALLOC(r1, n + 1); 23 TEST_CALLOC(r2, n + 1); 26 fill_arrays(a, b, r1, r2, n); 27 for (size_t i = 0; i < n; i++) { 30 mbedtls_xor(r2, a, b, n); [all …]
|
D | test_suite_pem.data | 2 …n":"-----END TEST-----\n":"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F":"----… 5 …_pem_write_buffer:"-----START TEST-----\n":"-----END TEST-----\n":"":"-----START TEST-----\n-----E… 8 …_write_buffer:"-----START TEST-----\n":"-----END TEST-----\n":"00":"-----START TEST-----\nAA==\n--… 11 …n":"-----END TEST-----\n":"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F0001020… 14 …n":"-----END TEST-----\n":"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F0001020… 17 …n":"-----END TEST-----\n":"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F0001020… 23 mbedtls_pem_read_buffer:"^":"$":"^\nTWJlZCBUTFM=\n$":"":0:"4d62656420544c53" 26 …E KEY-----":"-----END EC PRIVATE KEY-----":"-----BEGIN EC PRIVATE KEY-----\n\n-----END EC PRIVATE … 46 … KEY-----\nProc-Type\: 4,ENCRYPTED\nDEK-Info\: DES-CBC,AA94892A169FA426\n\nMAAA\n-----END EC PRIVA… 50 …----\nProc-Type\: 4,ENCRYPTED\nDEK-Info\: DES-EDE3-CBC,AA94892A169FA426\n\nMAAA\n-----END EC PRIVA… [all …]
|
D | test_suite_platform_printf.function | 18 #define NEWLINE_CHAR '\n' 24 #define LOWERCASE_N_CHAR 'n' 32 const size_t n = strlen(result); 35 TEST_CALLOC(output, n + 1); 36 TEST_EQUAL(n, mbedtls_snprintf(output, n + 1, format, x)); 37 TEST_MEMORY_COMPARE(result, n + 1, output, n + 1); 53 const size_t n = sizeof(value) * 2; 56 TEST_CALLOC(expected, n + 1); 60 TEST_CALLOC(output, n + 1); 61 TEST_EQUAL(n, mbedtls_snprintf(output, n + 1, format, value)); [all …]
|
D | host_test.function | 16 "Expected string (with \"\") for parameter and got: %s\n", *str); 44 "Expected integer for parameter and got: %s\n", str); 48 mbedtls_fprintf(stderr, "Integer out of range: %s\n", str); 61 "Usage: %s [OPTIONS] files...\n\n" \ 62 " Command line arguments:\n" \ 63 " files... One or more test data files. If no file is\n" \ 64 " specified the following default test case\n" \ 65 " file is used:\n" \ 66 " %s\n\n" \ 67 " Options:\n" \ [all …]
|
D | test_suite_psa_crypto_metadata.function | 301 size_t n; 311 for (n = 1; n <= length; n++) { 312 psa_algorithm_t truncated_alg = PSA_ALG_TRUNCATED_MAC(alg, n); 314 key_type, key_bits, n); 331 PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(truncated_alg, n), 1), 334 PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(truncated_alg, n), length - 1), 337 PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(truncated_alg, n), length), 342 for (n = 1; n <= length; n++) { 343 psa_algorithm_t policy_alg = PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(alg, n); 345 key_type, key_bits, n); [all …]
|
D | test_suite_debug.data | 2 debug_print_msg_threshold:1:0:"MyFile":999:"MyFile(0999)\: Text message, 2 == 2\n" 5 debug_print_msg_threshold:1:1:"MyFile":999:"MyFile(0999)\: Text message, 2 == 2\n" 17 …_ret:"MyFile":999:"Test return value":0:"MyFile(0999)\: Test return value() returned 0 (-0x0000)\n" 20 …le":999:"Test return value":-0x1000:"MyFile(0999)\: Test return value() returned -4096 (-0x1000)\n" 23 …e":999:"Test return value":-0xFFFF:"MyFile(0999)\: Test return value() returned -65535 (-0xffff)\n" 26 …nt_buf:"MyFile":999:"Test return value":"":"MyFile(0999)\: dumping 'Test return value' (0 bytes)\n" 29 …turn value' (1 bytes)\nMyFile(0999)\: 0000\: 00 .\n" 32 …bytes)\nMyFile(0999)\: 0000\: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ................\n" 35 … 0f ................\nMyFile(0999)\: 0010\: 00 .\n" 38 … 2f !"#$%&'()*+,-./\nMyFile(0999)\: 0030\: 30 0\n" [all …]
|
/mbedtls-3.7.0/library/ |
D | bignum.c | 62 if (X->n != Y->n) { in mbedtls_mpi_lt_mpi_ct() 90 mbedtls_ct_condition_t lt = mbedtls_mpi_core_lt_ct(p[i], p[i ^ 1], X->n); in mbedtls_mpi_lt_mpi_ct() 123 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(X, Y->n)); in mbedtls_mpi_safe_cond_assign() 130 mbedtls_mpi_core_cond_assign(X->p, Y->p, Y->n, do_assign); in mbedtls_mpi_safe_cond_assign() 133 for (size_t i = Y->n; i < X->n; i++) { in mbedtls_mpi_safe_cond_assign() 161 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(X, Y->n)); in mbedtls_mpi_safe_cond_swap() 162 MBEDTLS_MPI_CHK(mbedtls_mpi_grow(Y, X->n)); in mbedtls_mpi_safe_cond_swap() 168 mbedtls_mpi_core_cond_swap(X->p, Y->p, X->n, do_swap); in mbedtls_mpi_safe_cond_swap() 175 #define mbedtls_mpi_zeroize_and_free(v, n) mbedtls_zeroize_and_free(v, ciL * (n)) argument 183 X->n = 0; in mbedtls_mpi_init() [all …]
|
D | platform.c | 25 static void *platform_calloc_uninit(size_t n, size_t size) in platform_calloc_uninit() argument 27 ((void) n); in platform_calloc_uninit() 70 int mbedtls_platform_win32_snprintf(char *s, size_t n, const char *fmt, ...) in mbedtls_platform_win32_snprintf() argument 76 ret = mbedtls_vsnprintf(s, n, fmt, argp); in mbedtls_platform_win32_snprintf() 88 static int platform_snprintf_uninit(char *s, size_t n, in platform_snprintf_uninit() argument 92 ((void) n); in platform_snprintf_uninit() 100 int (*mbedtls_snprintf)(char *s, size_t n, 104 int mbedtls_platform_set_snprintf(int (*snprintf_func)(char *s, size_t n, in mbedtls_platform_set_snprintf() argument 115 int mbedtls_platform_win32_vsnprintf(char *s, size_t n, const char *fmt, va_list arg) in mbedtls_platform_win32_vsnprintf() argument 120 if (s == NULL || n == 0 || fmt == NULL) { in mbedtls_platform_win32_vsnprintf() [all …]
|
D | camellia.c | 59 #define SBOX1(n) FSb[(n)] argument 60 #define SBOX2(n) (unsigned char) ((FSb[(n)] >> 7 ^ FSb[(n)] << 1) & 0xff) argument 61 #define SBOX3(n) (unsigned char) ((FSb[(n)] >> 1 ^ FSb[(n)] << 7) & 0xff) argument 62 #define SBOX4(n) FSb[((n) << 1 ^ (n) >> 7) &0xff] argument 146 #define SBOX1(n) FSb[(n)] argument 147 #define SBOX2(n) FSb2[(n)] argument 148 #define SBOX3(n) FSb3[(n)] argument 149 #define SBOX4(n) FSb4[(n)] argument 578 size_t n; in mbedtls_camellia_crypt_cfb128() local 583 n = *iv_off; in mbedtls_camellia_crypt_cfb128() [all …]
|
D | alignment.h | 427 #define MBEDTLS_PUT_UINT32_BE(n, data, offset) \ argument 431 mbedtls_put_unaligned_uint32((data) + (offset), (uint32_t) (n)); \ 435 mbedtls_put_unaligned_uint32((data) + (offset), MBEDTLS_BSWAP32((uint32_t) (n))); \ 464 #define MBEDTLS_PUT_UINT32_LE(n, data, offset) \ argument 468 mbedtls_put_unaligned_uint32((data) + (offset), MBEDTLS_BSWAP32((uint32_t) (n))); \ 472 mbedtls_put_unaligned_uint32((data) + (offset), ((uint32_t) (n))); \ 500 #define MBEDTLS_PUT_UINT16_LE(n, data, offset) \ argument 504 mbedtls_put_unaligned_uint16((data) + (offset), MBEDTLS_BSWAP16((uint16_t) (n))); \ 508 mbedtls_put_unaligned_uint16((data) + (offset), (uint16_t) (n)); \ 536 #define MBEDTLS_PUT_UINT16_BE(n, data, offset) \ argument [all …]
|
D | base64.c | 64 size_t i, n; in mbedtls_base64_encode() local 73 n = slen / 3 + (slen % 3 != 0); in mbedtls_base64_encode() 75 if (n > (SIZE_MAX - 1) / 4) { in mbedtls_base64_encode() 80 n *= 4; in mbedtls_base64_encode() 82 if ((dlen < n + 1) || (NULL == dst)) { in mbedtls_base64_encode() 83 *olen = n + 1; in mbedtls_base64_encode() 87 n = (slen / 3) * 3; in mbedtls_base64_encode() 89 for (i = 0, p = dst; i < n; i += 3) { in mbedtls_base64_encode() 132 size_t n; /* number of digits or trailing = in source */ in mbedtls_base64_decode() local 140 for (i = n = 0; i < slen; i++) { in mbedtls_base64_decode() [all …]
|
D | common.h | 139 unsigned char *p, size_t n) in mbedtls_buffer_offset() argument 141 return p == NULL ? NULL : p + n; in mbedtls_buffer_offset() 156 const unsigned char *p, size_t n) in mbedtls_buffer_offset_const() argument 158 return p == NULL ? NULL : p + n; in mbedtls_buffer_offset_const() 189 size_t n) in mbedtls_xor() argument 196 for (; (i + 16) <= n; i += 16) { in mbedtls_xor() 207 if (n % 16 == 0) { in mbedtls_xor() 213 for (; (i + 8) <= n; i += 8) { in mbedtls_xor() 218 if (n % 8 == 0) { in mbedtls_xor() 223 for (; (i + 4) <= n; i += 4) { in mbedtls_xor() [all …]
|
D | x509.c | 815 size_t i, j, n, asn1_len_size, asn1_tag_size, asn1_tag_len_buf_start; in mbedtls_x509_dn_gets() local 830 n = size; in mbedtls_x509_dn_gets() 839 ret = mbedtls_snprintf(p, n, merge ? " + " : ", "); in mbedtls_x509_dn_gets() 848 ret = mbedtls_snprintf(p, n, "%s=", short_name); in mbedtls_x509_dn_gets() 850 if ((ret = mbedtls_oid_get_numeric_string(p, n, &name->oid)) > 0) { in mbedtls_x509_dn_gets() 851 n -= ret; in mbedtls_x509_dn_gets() 853 ret = mbedtls_snprintf(p, n, "="); in mbedtls_x509_dn_gets() 858 ret = mbedtls_snprintf(p, n, "\?\?="); in mbedtls_x509_dn_gets() 931 ret = mbedtls_snprintf(p, n, "%s", s); in mbedtls_x509_dn_gets() 938 return (int) (size - n); in mbedtls_x509_dn_gets() [all …]
|
D | dhm.c | 45 int ret, n; in dhm_read_bignum() local 51 n = MBEDTLS_GET_UINT16_BE(*p, 0); in dhm_read_bignum() 54 if ((size_t) (end - *p) < (size_t) n) { in dhm_read_bignum() 58 if ((ret = mbedtls_mpi_read_binary(X, *p, n)) != 0) { in dhm_read_bignum() 62 (*p) += n; in dhm_read_bignum() 241 #define DHM_MPI_EXPORT(X, n) \ in mbedtls_dhm_make_params() argument 245 (n))); \ in mbedtls_dhm_make_params() 246 *p++ = MBEDTLS_BYTE_1(n); \ in mbedtls_dhm_make_params() 247 *p++ = MBEDTLS_BYTE_0(n); \ in mbedtls_dhm_make_params() 248 p += (n); \ in mbedtls_dhm_make_params() [all …]
|
D | x509_csr.c | 507 size_t n; in mbedtls_x509_csr_parse_file() local 510 if ((ret = mbedtls_pk_load_file(path, &buf, &n)) != 0) { in mbedtls_x509_csr_parse_file() 514 ret = mbedtls_x509_csr_parse(csr, buf, n); in mbedtls_x509_csr_parse_file() 516 mbedtls_zeroize_and_free(buf, n); in mbedtls_x509_csr_parse_file() 532 size_t n; in mbedtls_x509_csr_info() local 537 n = size; in mbedtls_x509_csr_info() 539 ret = mbedtls_snprintf(p, n, "%sCSR version : %d", in mbedtls_x509_csr_info() 543 ret = mbedtls_snprintf(p, n, "\n%ssubject name : ", prefix); in mbedtls_x509_csr_info() 545 ret = mbedtls_x509_dn_gets(p, n, &csr->subject); in mbedtls_x509_csr_info() 548 ret = mbedtls_snprintf(p, n, "\n%ssigned using : ", prefix); in mbedtls_x509_csr_info() [all …]
|
D | constant_time.c | 70 size_t n) in mbedtls_ct_memcmp() argument 84 for (; (i + 4) <= n; i += 4) { in mbedtls_ct_memcmp() 91 for (; i < n; i++) { in mbedtls_ct_memcmp() 123 size_t n, in mbedtls_ct_memcmp_partial() argument 132 size_t valid_end = n - skip_tail; in mbedtls_ct_memcmp_partial() 134 for (size_t i = 0; i < n; i++) { in mbedtls_ct_memcmp_partial() 159 for (size_t n = 0; n < total - 1; n++) { in mbedtls_ct_memmove_left() local 160 unsigned char current = buf[n]; in mbedtls_ct_memmove_left() 161 unsigned char next = buf[n+1]; in mbedtls_ct_memmove_left() 162 buf[n] = mbedtls_ct_uint_if(no_op, current, next); in mbedtls_ct_memmove_left()
|
D | psa_its_file.c | 80 size_t n; in psa_its_read_file() local 92 n = fread(&header, 1, sizeof(header), *p_stream); in psa_its_read_file() 93 if (n != sizeof(header)) { in psa_its_read_file() 127 size_t n; in psa_its_get() local 159 n = fread(p_data, 1, data_length, stream); in psa_its_get() 160 if (n != data_length) { in psa_its_get() 165 *p_data_length = n; in psa_its_get() 188 size_t n; in psa_its_set() local 205 n = fwrite(&header, 1, sizeof(header), stream); in psa_its_set() 206 if (n != sizeof(header)) { in psa_its_set() [all …]
|
D | aria.c | 323 const uint32_t b[4], uint8_t n) in aria_rot128() argument 328 const uint8_t n1 = n % 32; // bit offset in aria_rot128() 331 j = (n / 32) % 4; // initial word offset in aria_rot128() 572 size_t n; in mbedtls_aria_crypt_cfb128() local 578 n = *iv_off; in mbedtls_aria_crypt_cfb128() 582 if (n >= MBEDTLS_ARIA_BLOCKSIZE) { in mbedtls_aria_crypt_cfb128() 588 if (n == 0) { in mbedtls_aria_crypt_cfb128() 593 *output++ = c ^ iv[n]; in mbedtls_aria_crypt_cfb128() 594 iv[n] = c; in mbedtls_aria_crypt_cfb128() 596 n = (n + 1) & 0x0F; in mbedtls_aria_crypt_cfb128() [all …]
|
D | x509_crl.c | 570 size_t n; in mbedtls_x509_crl_parse_file() local 573 if ((ret = mbedtls_pk_load_file(path, &buf, &n)) != 0) { in mbedtls_x509_crl_parse_file() 577 ret = mbedtls_x509_crl_parse(chain, buf, n); in mbedtls_x509_crl_parse_file() 579 mbedtls_zeroize_and_free(buf, n); in mbedtls_x509_crl_parse_file() 598 size_t n; in mbedtls_x509_crl_info() local 603 n = size; in mbedtls_x509_crl_info() 605 ret = mbedtls_snprintf(p, n, "%sCRL version : %d", in mbedtls_x509_crl_info() 609 ret = mbedtls_snprintf(p, n, "\n%sissuer name : ", prefix); in mbedtls_x509_crl_info() 611 ret = mbedtls_x509_dn_gets(p, n, &crl->issuer); in mbedtls_x509_crl_info() 614 ret = mbedtls_snprintf(p, n, "\n%sthis update : " \ in mbedtls_x509_crl_info() [all …]
|
/mbedtls-3.7.0/programs/pkey/ |
D | dh_client.c | 62 size_t n, buflen; in main() local 146 n = buflen = (buf[0] << 8) | buf[1]; in main() 157 if ((ret = mbedtls_net_recv(&server_fd, buf, n)) != (int) n) { in main() 169 n = mbedtls_dhm_get_len(&dhm); in main() 170 if (n < 64 || n > 512) { in main() 184 if ((n = (size_t) (end - p)) != mbedtls_rsa_get_len(&rsa)) { in main() 212 n = mbedtls_dhm_get_len(&dhm); in main() 213 if ((ret = mbedtls_dhm_make_public(&dhm, (int) n, buf, n, in main() 219 if ((ret = mbedtls_net_send(&server_fd, buf, n)) != (int) n) { in main() 230 if ((ret = mbedtls_dhm_calc_secret(&dhm, buf, sizeof(buf), &n, in main() [all …]
|
D | dh_server.c | 55 size_t n, buflen; in main() local 180 mbedtls_dhm_make_params(&dhm, (int) mbedtls_dhm_get_len(&dhm), buf, &n, in main() 196 if ((ret = mbedtls_sha256(buf, n, hash, 0)) != 0) { in main() 202 buf[n] = (unsigned char) (rsa_key_len >> 8); in main() 203 buf[n + 1] = (unsigned char) (rsa_key_len); in main() 207 hash, buf + n + 2)) != 0) { in main() 212 buflen = n + 2 + rsa_key_len; in main() 230 n = mbedtls_dhm_get_len(&dhm); in main() 231 if ((ret = mbedtls_net_recv(&client_fd, buf, n)) != (int) n) { in main() 236 if ((ret = mbedtls_dhm_read_public(&dhm, buf, n)) != 0) { in main() [all …]
|
/mbedtls-3.7.0/programs/hash/ |
D | generic_sum.c | 63 size_t n; in generic_check() local 86 n = sizeof(line); in generic_check() 88 while (fgets(line, (int) n - 1, f) != NULL) { in generic_check() 89 n = strlen(line); in generic_check() 91 if (n < (size_t) 2 * mbedtls_md_get_size(md_info) + 4) { in generic_check() 102 if (line[n - 1] == '\n') { in generic_check() 103 n--; line[n] = '\0'; in generic_check() 105 if (line[n - 1] == '\r') { in generic_check() 106 n--; line[n] = '\0'; in generic_check() 133 n = sizeof(line); in generic_check()
|
/mbedtls-3.7.0/programs/test/ |
D | dlopen.c | 44 unsigned n; in main() local 54 for (n = 0; ciphersuites[n] != 0; n++) {/* nothing to do, we're just counting */ in main() 58 TLS_SO_FILENAME, n); in main() 82 for (n = 0; mds[n] != 0; n++) {/* nothing to do, we're just counting */ in main() 86 CRYPTO_SO_FILENAME, n); in main()
|
/mbedtls-3.7.0/programs/util/ |
D | pem2der.c | 105 static int load_file(const char *path, unsigned char **buf, size_t *n) in load_file() argument 121 *n = (size_t) size; in load_file() 123 if (*n + 1 == 0 || in load_file() 124 (*buf = mbedtls_calloc(1, *n + 1)) == NULL) { in load_file() 129 if (fread(*buf, 1, *n, f) != *n) { in load_file() 138 (*buf)[*n] = '\0'; in load_file() 146 static int write_file(const char *path, unsigned char *buf, size_t n) in write_file() argument 154 if (fwrite(buf, 1, n, f) != n) { in write_file()
|
/mbedtls-3.7.0/scripts/mbedtls_dev/ |
D | bignum_common.py | 19 def invmod(a: int, n: int) -> int: 26 while n: 27 q, r = divmod(a, n) 28 a, b, c, n = n, c, b - q*c, r 34 def invmod_positive(a: int, n: int) -> int: 36 inv = invmod(a, n) 37 return inv if inv >= 0 else inv + n 83 n = ((1 << (len(val) * 4)) - 1) 84 l = limbs_mpi(n, bits_in_limb) 377 yield from ((n, a, "0") for a, n in cls.input_cases) [all …]
|