Home
last modified time | relevance | path

Searched refs:n (Results 1 – 25 of 133) sorted by relevance

123456

/mbedtls-3.5.0/tests/suites/
Dtest_suite_common.function4 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 ASSERT_ALLOC(a, n + 1);
21 ASSERT_ALLOC(b, n + 1);
22 ASSERT_ALLOC(r1, n + 1);
23 ASSERT_ALLOC(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 …]
Dtest_suite_pem.data2n":"-----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--…
11n":"-----END TEST-----\n":"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F0001020…
14n":"-----END TEST-----\n":"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F0001020…
17n":"-----END TEST-----\n":"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F0001020…
20 mbedtls_pem_read_buffer:"^":"$":"^\nTWJlZCBUTFM=\n$":"":0:"4d62656420544c53"
36 … KEY-----\nProc-Type\: 4,ENCRYPTED\nDEK-Info\: DES-CBC,AA94892A169FA426\n\nMAAA\n-----END EC PRIVA…
40 …----\nProc-Type\: 4,ENCRYPTED\nDEK-Info\: DES-EDE3-CBC,AA94892A169FA426\n\nMAAA\n-----END EC PRIVA…
44 …\: 4,ENCRYPTED\nDEK-Info\: AES-128-CBC,AA94892A169FA426AA94892A169FA426\n\nMAAA\n-----END EC PRIVA…
Dhost_test.function16 "Expected string (with \"\") for parameter and got: %s\n", *str);
73 "Expected integer for parameter and got: %s\n", str);
83 "Usage: %s [OPTIONS] files...\n\n" \
84 " Command line arguments:\n" \
85 " files... One or more test data files. If no file is\n" \
86 " specified the following default test case\n" \
87 " file is used:\n" \
88 " %s\n\n" \
89 " Options:\n" \
90 " -v | --verbose Display full information about each test\n" \
[all …]
Dtest_suite_debug.data2 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 …]
Dtest_suite_psa_crypto_metadata.function301 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 …]
/mbedtls-3.5.0/library/
Dalignment.h263 #define MBEDTLS_PUT_UINT32_BE(n, data, offset) \ argument
267 mbedtls_put_unaligned_uint32((data) + (offset), (uint32_t) (n)); \
271 mbedtls_put_unaligned_uint32((data) + (offset), MBEDTLS_BSWAP32((uint32_t) (n))); \
300 #define MBEDTLS_PUT_UINT32_LE(n, data, offset) \ argument
304 mbedtls_put_unaligned_uint32((data) + (offset), MBEDTLS_BSWAP32((uint32_t) (n))); \
308 mbedtls_put_unaligned_uint32((data) + (offset), ((uint32_t) (n))); \
336 #define MBEDTLS_PUT_UINT16_LE(n, data, offset) \ argument
340 mbedtls_put_unaligned_uint16((data) + (offset), MBEDTLS_BSWAP16((uint16_t) (n))); \
344 mbedtls_put_unaligned_uint16((data) + (offset), (uint16_t) (n)); \
372 #define MBEDTLS_PUT_UINT16_BE(n, data, offset) \ argument
[all …]
Dplatform.c37 static void *platform_calloc_uninit(size_t n, size_t size) in platform_calloc_uninit() argument
39 ((void) n); in platform_calloc_uninit()
82 int mbedtls_platform_win32_snprintf(char *s, size_t n, const char *fmt, ...) in mbedtls_platform_win32_snprintf() argument
88 ret = mbedtls_vsnprintf(s, n, fmt, argp); in mbedtls_platform_win32_snprintf()
100 static int platform_snprintf_uninit(char *s, size_t n, in platform_snprintf_uninit() argument
104 ((void) n); in platform_snprintf_uninit()
112 int (*mbedtls_snprintf)(char *s, size_t n,
116 int mbedtls_platform_set_snprintf(int (*snprintf_func)(char *s, size_t n, in mbedtls_platform_set_snprintf() argument
127 int mbedtls_platform_win32_vsnprintf(char *s, size_t n, const char *fmt, va_list arg) in mbedtls_platform_win32_vsnprintf() argument
132 if (s == NULL || n == 0 || fmt == NULL) { in mbedtls_platform_win32_vsnprintf()
[all …]
Dbase64.c42 size_t i, n; in mbedtls_base64_encode() local
51 n = slen / 3 + (slen % 3 != 0); in mbedtls_base64_encode()
53 if (n > (BASE64_SIZE_T_MAX - 1) / 4) { in mbedtls_base64_encode()
58 n *= 4; in mbedtls_base64_encode()
60 if ((dlen < n + 1) || (NULL == dst)) { in mbedtls_base64_encode()
61 *olen = n + 1; in mbedtls_base64_encode()
65 n = (slen / 3) * 3; in mbedtls_base64_encode()
67 for (i = 0, p = dst; i < n; i += 3) { in mbedtls_base64_encode()
110 size_t n; /* number of digits or trailing = in source */ in mbedtls_base64_decode() local
118 for (i = n = 0; i < slen; i++) { in mbedtls_base64_decode()
[all …]
Dbignum.c60 static void mbedtls_mpi_zeroize(mbedtls_mpi_uint *v, size_t n) in mbedtls_mpi_zeroize() argument
62 mbedtls_platform_zeroize(v, ciL * n); in mbedtls_mpi_zeroize()
73 X->n = 0; in mbedtls_mpi_init()
87 mbedtls_mpi_zeroize(X->p, X->n); in mbedtls_mpi_free()
92 X->n = 0; in mbedtls_mpi_free()
108 if (X->n < nblimbs) { 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()
119 X->n = nblimbs; in mbedtls_mpi_grow()
141 if (X->n <= nblimbs) { in mbedtls_mpi_shrink()
[all …]
Dcamellia.c71 #define SBOX1(n) FSb[(n)] argument
72 #define SBOX2(n) (unsigned char) ((FSb[(n)] >> 7 ^ FSb[(n)] << 1) & 0xff) argument
73 #define SBOX3(n) (unsigned char) ((FSb[(n)] >> 1 ^ FSb[(n)] << 7) & 0xff) argument
74 #define SBOX4(n) FSb[((n) << 1 ^ (n) >> 7) &0xff] argument
158 #define SBOX1(n) FSb[(n)] argument
159 #define SBOX2(n) FSb2[(n)] argument
160 #define SBOX3(n) FSb3[(n)] argument
161 #define SBOX4(n) FSb4[(n)] argument
588 size_t n; in mbedtls_camellia_crypt_cfb128() local
593 n = *iv_off; in mbedtls_camellia_crypt_cfb128()
[all …]
Dx509_csr.c454 size_t n; in mbedtls_x509_csr_parse_file() local
457 if ((ret = mbedtls_pk_load_file(path, &buf, &n)) != 0) { in mbedtls_x509_csr_parse_file()
461 ret = mbedtls_x509_csr_parse(csr, buf, n); in mbedtls_x509_csr_parse_file()
463 mbedtls_platform_zeroize(buf, n); in mbedtls_x509_csr_parse_file()
480 size_t n; in mbedtls_x509_csr_info() local
485 n = size; in mbedtls_x509_csr_info()
487 ret = mbedtls_snprintf(p, n, "%sCSR version : %d", in mbedtls_x509_csr_info()
491 ret = mbedtls_snprintf(p, n, "\n%ssubject name : ", prefix); in mbedtls_x509_csr_info()
493 ret = mbedtls_x509_dn_gets(p, n, &csr->subject); in mbedtls_x509_csr_info()
496 ret = mbedtls_snprintf(p, n, "\n%ssigned using : ", prefix); in mbedtls_x509_csr_info()
[all …]
Ddhm.c57 int ret, n; in dhm_read_bignum() local
63 n = ((*p)[0] << 8) | (*p)[1]; in dhm_read_bignum()
66 if ((int) (end - *p) < n) { in dhm_read_bignum()
70 if ((ret = mbedtls_mpi_read_binary(X, *p, n)) != 0) { in dhm_read_bignum()
74 (*p) += n; in dhm_read_bignum()
253 #define DHM_MPI_EXPORT(X, n) \ in mbedtls_dhm_make_params() argument
257 (n))); \ in mbedtls_dhm_make_params()
258 *p++ = MBEDTLS_BYTE_1(n); \ in mbedtls_dhm_make_params()
259 *p++ = MBEDTLS_BYTE_0(n); \ in mbedtls_dhm_make_params()
260 p += (n); \ in mbedtls_dhm_make_params()
[all …]
Dpsa_its_file.c92 size_t n; in psa_its_read_file() local
104 n = fread(&header, 1, sizeof(header), *p_stream); in psa_its_read_file()
105 if (n != sizeof(header)) { in psa_its_read_file()
144 size_t n; in psa_its_get() local
176 n = fread(p_data, 1, data_length, stream); in psa_its_get()
177 if (n != data_length) { in psa_its_get()
182 *p_data_length = n; in psa_its_get()
205 size_t n; in psa_its_set() local
222 n = fwrite(&header, 1, sizeof(header), stream); in psa_its_set()
223 if (n != sizeof(header)) { in psa_its_set()
[all …]
Dx509.c570 static int x509_parse_int(unsigned char **p, size_t n, int *res) in x509_parse_int() argument
574 for (; n > 0; --n) { in x509_parse_int()
842 size_t i, j, n; in mbedtls_x509_dn_gets() local
852 n = size; in mbedtls_x509_dn_gets()
861 ret = mbedtls_snprintf(p, n, merge ? " + " : ", "); in mbedtls_x509_dn_gets()
868 ret = mbedtls_snprintf(p, n, "%s=", short_name); in mbedtls_x509_dn_gets()
870 ret = mbedtls_snprintf(p, n, "\?\?="); in mbedtls_x509_dn_gets()
894 ret = mbedtls_snprintf(p, n, "%s", s); in mbedtls_x509_dn_gets()
901 return (int) (size - n); in mbedtls_x509_dn_gets()
911 size_t i, n, nr; in mbedtls_x509_serial_gets() local
[all …]
Dcommon.h91 unsigned char *p, size_t n) in mbedtls_buffer_offset() argument
93 return p == NULL ? NULL : p + n; in mbedtls_buffer_offset()
108 const unsigned char *p, size_t n) in mbedtls_buffer_offset_const() argument
110 return p == NULL ? NULL : p + n; in mbedtls_buffer_offset_const()
124 inline void mbedtls_xor(unsigned char *r, const unsigned char *a, const unsigned char *b, size_t n) in mbedtls_xor() argument
128 for (; (i + 4) <= n; i += 4) { in mbedtls_xor()
133 for (; i < n; i++) { in mbedtls_xor()
Daria.c341 const uint32_t b[4], uint8_t n) in aria_rot128() argument
346 const uint8_t n1 = n % 32; // bit offset in aria_rot128()
349 j = (n / 32) % 4; // initial word offset in aria_rot128()
599 size_t n; in mbedtls_aria_crypt_cfb128() local
609 n = *iv_off; in mbedtls_aria_crypt_cfb128()
614 if (n >= MBEDTLS_ARIA_BLOCKSIZE) { in mbedtls_aria_crypt_cfb128()
620 if (n == 0) { in mbedtls_aria_crypt_cfb128()
625 *output++ = c ^ iv[n]; in mbedtls_aria_crypt_cfb128()
626 iv[n] = c; in mbedtls_aria_crypt_cfb128()
628 n = (n + 1) & 0x0F; in mbedtls_aria_crypt_cfb128()
[all …]
Dx509_crl.c581 size_t n; in mbedtls_x509_crl_parse_file() local
584 if ((ret = mbedtls_pk_load_file(path, &buf, &n)) != 0) { in mbedtls_x509_crl_parse_file()
588 ret = mbedtls_x509_crl_parse(chain, buf, n); in mbedtls_x509_crl_parse_file()
590 mbedtls_platform_zeroize(buf, n); in mbedtls_x509_crl_parse_file()
610 size_t n; in mbedtls_x509_crl_info() local
615 n = size; in mbedtls_x509_crl_info()
617 ret = mbedtls_snprintf(p, n, "%sCRL version : %d", in mbedtls_x509_crl_info()
621 ret = mbedtls_snprintf(p, n, "\n%sissuer name : ", prefix); in mbedtls_x509_crl_info()
623 ret = mbedtls_x509_dn_gets(p, n, &crl->issuer); in mbedtls_x509_crl_info()
626 ret = mbedtls_snprintf(p, n, "\n%sthis update : " \ in mbedtls_x509_crl_info()
[all …]
Dconstant_time.c90 size_t n) in mbedtls_ct_memcmp() argument
104 for (; (i + 4) <= n; i += 4) { in mbedtls_ct_memcmp()
111 for (; i < n; i++) { in mbedtls_ct_memcmp()
353 void mbedtls_ct_mpi_uint_cond_assign(size_t n, in mbedtls_ct_mpi_uint_cond_assign() argument
374 for (i = 0; i < n; i++) { in mbedtls_ct_mpi_uint_cond_assign()
439 size_t i, n; in mbedtls_ct_mem_move_to_left() local
448 for (n = 0; n < total - 1; n++) { in mbedtls_ct_mem_move_to_left()
449 unsigned char current = buf[n]; in mbedtls_ct_mem_move_to_left()
450 unsigned char next = buf[n+1]; in mbedtls_ct_mem_move_to_left()
451 buf[n] = mbedtls_ct_uint_if(no_op, current, next); in mbedtls_ct_mem_move_to_left()
[all …]
Dnet_sockets.c223 int n, ret; in mbedtls_net_bind() local
253 n = 1; in mbedtls_net_bind()
255 (const char *) &n, sizeof(n)) != 0) { in mbedtls_net_bind()
345 socklen_t n = (socklen_t) sizeof(client_addr); in mbedtls_net_accept() local
348 int n = (int) sizeof(client_addr); in mbedtls_net_accept() local
362 (struct sockaddr *) &client_addr, &n); in mbedtls_net_accept()
368 (struct sockaddr *) &client_addr, &n); in mbedtls_net_accept()
393 if (connect(bind_ctx->fd, (struct sockaddr *) &client_addr, n) != 0) { in mbedtls_net_accept()
400 n = sizeof(struct sockaddr_storage); in mbedtls_net_accept()
402 (struct sockaddr *) &local_addr, &n) != 0 || in mbedtls_net_accept()
[all …]
/mbedtls-3.5.0/programs/pkey/
Ddh_client.c66 size_t n, buflen; in main() local
150 n = buflen = (buf[0] << 8) | buf[1]; in main()
161 if ((ret = mbedtls_net_recv(&server_fd, buf, n)) != (int) n) { in main()
173 n = mbedtls_dhm_get_len(&dhm); in main()
174 if (n < 64 || n > 512) { in main()
188 if ((n = (size_t) (end - p)) != rsa.MBEDTLS_PRIVATE(len)) { in main()
210 n = mbedtls_dhm_get_len(&dhm); in main()
211 if ((ret = mbedtls_dhm_make_public(&dhm, (int) n, buf, n, in main()
217 if ((ret = mbedtls_net_send(&server_fd, buf, n)) != (int) n) { in main()
228 if ((ret = mbedtls_dhm_calc_secret(&dhm, buf, sizeof(buf), &n, in main()
[all …]
Ddh_server.c66 size_t n, buflen; in main() local
190 mbedtls_dhm_make_params(&dhm, (int) mbedtls_mpi_size(&dhm.MBEDTLS_PRIVATE(P)), buf, &n, in main()
199 if ((ret = mbedtls_sha1(buf, n, hash)) != 0) { in main()
204 buf[n] = (unsigned char) (rsa.MBEDTLS_PRIVATE(len) >> 8); in main()
205 buf[n + 1] = (unsigned char) (rsa.MBEDTLS_PRIVATE(len)); in main()
208 32, hash, buf + n + 2)) != 0) { in main()
213 buflen = n + 2 + rsa.MBEDTLS_PRIVATE(len); in main()
231 n = mbedtls_dhm_get_len(&dhm); in main()
232 if ((ret = mbedtls_net_recv(&client_fd, buf, n)) != (int) n) { in main()
237 if ((ret = mbedtls_dhm_read_public(&dhm, buf, n)) != 0) { in main()
[all …]
/mbedtls-3.5.0/programs/test/
Ddlopen.c56 unsigned n; in main() local
66 for (n = 0; ciphersuites[n] != 0; n++) {/* nothing to do, we're just counting */ in main()
70 TLS_SO_FILENAME, n); in main()
94 for (n = 0; mds[n] != 0; n++) {/* nothing to do, we're just counting */ in main()
98 CRYPTO_SO_FILENAME, n); in main()
/mbedtls-3.5.0/programs/hash/
Dgeneric_sum.c75 size_t n; in generic_check() local
98 n = sizeof(line); in generic_check()
100 while (fgets(line, (int) n - 1, f) != NULL) { in generic_check()
101 n = strlen(line); in generic_check()
103 if (n < (size_t) 2 * mbedtls_md_get_size(md_info) + 4) { in generic_check()
114 if (line[n - 1] == '\n') { in generic_check()
115 n--; line[n] = '\0'; in generic_check()
117 if (line[n - 1] == '\r') { in generic_check()
118 n--; line[n] = '\0'; in generic_check()
145 n = sizeof(line); in generic_check()
/mbedtls-3.5.0/programs/util/
Dpem2der.c117 static int load_file(const char *path, unsigned char **buf, size_t *n) in load_file() argument
133 *n = (size_t) size; in load_file()
135 if (*n + 1 == 0 || in load_file()
136 (*buf = mbedtls_calloc(1, *n + 1)) == NULL) { in load_file()
141 if (fread(*buf, 1, *n, f) != *n) { in load_file()
150 (*buf)[*n] = '\0'; in load_file()
158 static int write_file(const char *path, unsigned char *buf, size_t n) in write_file() argument
166 if (fwrite(buf, 1, n, f) != n) { in write_file()
/mbedtls-3.5.0/scripts/mbedtls_dev/
Dbignum_common.py28 def invmod(a: int, n: int) -> int:
35 while n:
36 q, r = divmod(a, n)
37 a, b, c, n = n, c, b - q*c, r
43 def invmod_positive(a: int, n: int) -> int:
45 inv = invmod(a, n)
46 return inv if inv >= 0 else inv + n
361 yield from ((n, a, "0") for a, n in cls.input_cases)
363 yield from ((n, a, b) for a, b, n in cls.input_cases)
374 test_objects = (cls(n, a, b, bits_in_limb=bil)
[all …]

123456