/mbedtls-3.5.0/library/ |
D | x509write_crt.c | 169 unsigned char buf[9]; in mbedtls_x509write_crt_set_basic_constraints() local 170 unsigned char *c = buf + sizeof(buf); in mbedtls_x509write_crt_set_basic_constraints() 173 memset(buf, 0, sizeof(buf)); in mbedtls_x509write_crt_set_basic_constraints() 181 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_int(&c, buf, in mbedtls_x509write_crt_set_basic_constraints() 184 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_bool(&c, buf, 1)); in mbedtls_x509write_crt_set_basic_constraints() 187 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_len(&c, buf, len)); in mbedtls_x509write_crt_set_basic_constraints() 188 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_tag(&c, buf, in mbedtls_x509write_crt_set_basic_constraints() 195 is_ca, buf + sizeof(buf) - len, len); in mbedtls_x509write_crt_set_basic_constraints() 204 unsigned char buf[MBEDTLS_MPI_MAX_SIZE * 2 + 20]; /* tag, length + 2xMPI */ in mbedtls_x509write_crt_set_key_identifier() local 205 unsigned char *c = buf + sizeof(buf); in mbedtls_x509write_crt_set_key_identifier() [all …]
|
D | x509write_csr.c | 94 unsigned char *buf; in mbedtls_x509write_csr_set_subject_alternative_name() local 123 buf = mbedtls_calloc(1, buflen); in mbedtls_x509write_csr_set_subject_alternative_name() 124 if (buf == NULL) { in mbedtls_x509write_csr_set_subject_alternative_name() 128 mbedtls_platform_zeroize(buf, buflen); in mbedtls_x509write_csr_set_subject_alternative_name() 129 p = buf + buflen; in mbedtls_x509write_csr_set_subject_alternative_name() 146 &p, buf, in mbedtls_x509write_csr_set_subject_alternative_name() 149 &p, buf, unstructured_name_len)); in mbedtls_x509write_csr_set_subject_alternative_name() 152 &p, buf, in mbedtls_x509write_csr_set_subject_alternative_name() 163 MBEDTLS_ASN1_CHK_CLEANUP_ADD(len, mbedtls_asn1_write_len(&p, buf, len)); in mbedtls_x509write_csr_set_subject_alternative_name() 165 mbedtls_asn1_write_tag(&p, buf, in mbedtls_x509write_csr_set_subject_alternative_name() [all …]
|
D | pkwrite.c | 110 unsigned char buf[MBEDTLS_ECP_MAX_PT_LEN]; in pk_write_ec_pubkey() local 114 &len, buf, sizeof(buf))) != 0) { in pk_write_ec_pubkey() 123 memcpy(*p, buf, len); in pk_write_ec_pubkey() 212 int mbedtls_pk_write_pubkey_der(const mbedtls_pk_context *key, unsigned char *buf, size_t size) in mbedtls_pk_write_pubkey_der() argument 224 c = buf + size; in mbedtls_pk_write_pubkey_der() 226 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_pk_write_pubkey(&c, buf, key)); in mbedtls_pk_write_pubkey_der() 228 if (c - buf < 1) { in mbedtls_pk_write_pubkey_der() 240 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_len(&c, buf, len)); in mbedtls_pk_write_pubkey_der() 241 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_tag(&c, buf, MBEDTLS_ASN1_BIT_STRING)); in mbedtls_pk_write_pubkey_der() 246 MBEDTLS_ASN1_CHK_ADD(par_len, pk_write_ec_param(&c, buf, mbedtls_pk_ec(*key))); in mbedtls_pk_write_pubkey_der() [all …]
|
D | entropy.c | 234 unsigned char buf[MBEDTLS_ENTROPY_MAX_GATHER]; in entropy_gather_internal() local 251 buf, MBEDTLS_ENTROPY_MAX_GATHER, &olen)) != 0) { in entropy_gather_internal() 260 buf, olen)) != 0) { in entropy_gather_internal() 272 mbedtls_platform_zeroize(buf, sizeof(buf)); in entropy_gather_internal() 306 unsigned char buf[MBEDTLS_ENTROPY_BLOCK_SIZE]; in mbedtls_entropy_func() local 355 memset(buf, 0, MBEDTLS_ENTROPY_BLOCK_SIZE); in mbedtls_entropy_func() 363 if ((ret = mbedtls_sha512_finish(&ctx->accumulator, buf)) != 0) { in mbedtls_entropy_func() 375 if ((ret = mbedtls_sha512_update(&ctx->accumulator, buf, in mbedtls_entropy_func() 383 if ((ret = mbedtls_sha512(buf, MBEDTLS_ENTROPY_BLOCK_SIZE, in mbedtls_entropy_func() 384 buf, 0)) != 0) { in mbedtls_entropy_func() [all …]
|
D | pem.c | 262 unsigned char *buf, size_t buflen, in pem_des_decrypt() argument 279 des_iv, buf, buf); in pem_des_decrypt() 292 unsigned char *buf, size_t buflen, in pem_des3_decrypt() argument 309 des3_iv, buf, buf); in pem_des3_decrypt() 324 unsigned char *buf, size_t buflen, in pem_aes_decrypt() argument 341 aes_iv, buf, buf); in pem_aes_decrypt() 359 unsigned char *buf; in mbedtls_pem_read_buffer() local 500 if ((buf = mbedtls_calloc(1, len)) == NULL) { in mbedtls_pem_read_buffer() 504 if ((ret = mbedtls_base64_decode(buf, len, &len, s1, s2 - s1)) != 0) { in mbedtls_pem_read_buffer() 505 mbedtls_platform_zeroize(buf, len); in mbedtls_pem_read_buffer() [all …]
|
D | ssl_tls13_client.c | 52 unsigned char *buf, in ssl_tls13_write_supported_versions_ext() argument 56 unsigned char *p = buf; in ssl_tls13_write_supported_versions_ext() 104 const unsigned char *buf, in ssl_tls13_parse_supported_versions_ext() argument 109 MBEDTLS_SSL_CHK_BUF_READ_PTR(buf, end, 2); in ssl_tls13_parse_supported_versions_ext() 110 if (mbedtls_ssl_read_version(buf, ssl->conf->transport) != in ssl_tls13_parse_supported_versions_ext() 119 if (&buf[2] != end) { in ssl_tls13_parse_supported_versions_ext() 132 const unsigned char *buf, size_t len) in ssl_tls13_parse_alpn_ext() argument 134 const unsigned char *p = buf; in ssl_tls13_parse_alpn_ext() 135 const unsigned char *end = buf + len; in ssl_tls13_parse_alpn_ext() 265 unsigned char *buf, in ssl_tls13_write_key_share_ext() argument [all …]
|
D | ssl_tls13_generic.c | 55 unsigned char **buf, in mbedtls_ssl_tls13_fetch_handshake_msg() argument 81 *buf = ssl->in_msg + 4; in mbedtls_ssl_tls13_fetch_handshake_msg() 162 const unsigned char *buf, in ssl_tls13_parse_certificate_verify() argument 169 const unsigned char *p = buf; in ssl_tls13_parse_certificate_verify() 292 unsigned char *buf; in mbedtls_ssl_tls13_process_certificate_verify() local 299 MBEDTLS_SSL_HS_CERTIFICATE_VERIFY, &buf, &buf_len)); in mbedtls_ssl_tls13_process_certificate_verify() 328 MBEDTLS_SSL_PROC_CHK(ssl_tls13_parse_certificate_verify(ssl, buf, in mbedtls_ssl_tls13_process_certificate_verify() 329 buf + buf_len, verify_buffer, in mbedtls_ssl_tls13_process_certificate_verify() 334 buf, buf_len)); in mbedtls_ssl_tls13_process_certificate_verify() 387 const unsigned char *buf, in mbedtls_ssl_tls13_parse_certificate() argument [all …]
|
D | gcm.c | 276 memset(ctx->buf, 0x00, sizeof(ctx->buf)); in mbedtls_gcm_starts() 352 mbedtls_xor(ctx->buf + offset, ctx->buf + offset, p, use_len); in mbedtls_gcm_update_ad() 355 gcm_mult(ctx, ctx->buf, ctx->buf); in mbedtls_gcm_update_ad() 366 mbedtls_xor(ctx->buf, ctx->buf, p, 16); in mbedtls_gcm_update_ad() 368 gcm_mult(ctx, ctx->buf, ctx->buf); in mbedtls_gcm_update_ad() 375 mbedtls_xor(ctx->buf, ctx->buf, p, add_len); in mbedtls_gcm_update_ad() 410 mbedtls_xor(ctx->buf + offset, ctx->buf + offset, input, use_len); in gcm_mask() 414 mbedtls_xor(ctx->buf + offset, ctx->buf + offset, output, use_len); in gcm_mask() 456 gcm_mult(ctx, ctx->buf, ctx->buf); in mbedtls_gcm_update() 471 gcm_mult(ctx, ctx->buf, ctx->buf); in mbedtls_gcm_update() [all …]
|
D | ecdh.c | 278 unsigned char *buf, size_t blen, in ecdh_make_params_internal() argument 316 if ((ret = mbedtls_ecp_tls_write_group(&ctx->grp, &grp_len, buf, in ecdh_make_params_internal() 321 buf += grp_len; in ecdh_make_params_internal() 325 &pt_len, buf, blen)) != 0) { in ecdh_make_params_internal() 341 unsigned char *buf, size_t blen, in mbedtls_ecdh_make_params() argument 353 return ecdh_make_params_internal(ctx, olen, ctx->point_format, buf, blen, in mbedtls_ecdh_make_params() 360 buf, blen, f_rng, p_rng); in mbedtls_ecdh_make_params() 364 ctx->point_format, buf, blen, in mbedtls_ecdh_make_params() 374 const unsigned char **buf, in ecdh_read_params_internal() argument 377 return mbedtls_ecp_tls_read_point(&ctx->grp, &ctx->Qp, buf, in ecdh_read_params_internal() [all …]
|
D | ecjpake.c | 245 unsigned char buf[ECJPAKE_HASH_BUF_LEN]; in ecjpake_hash() local 246 unsigned char *p = buf; in ecjpake_hash() 247 const unsigned char *end = buf + sizeof(buf); in ecjpake_hash() 272 buf, p - buf, hash)); in ecjpake_hash() 499 const unsigned char *buf, in ecjpake_kkpp_read() argument 503 const unsigned char *p = buf; in ecjpake_kkpp_read() 504 const unsigned char *end = buf + len; in ecjpake_kkpp_read() 535 unsigned char *buf, in ecjpake_kkpp_write() argument 542 unsigned char *p = buf; in ecjpake_kkpp_write() 543 const unsigned char *end = buf + len; in ecjpake_kkpp_write() [all …]
|
D | platform.c | 234 static void platform_setbuf_uninit(FILE *stream, char *buf) in platform_setbuf_uninit() argument 237 ((void) buf); in platform_setbuf_uninit() 242 void (*mbedtls_setbuf)(FILE *stream, char *buf) = MBEDTLS_PLATFORM_STD_SETBUF; 244 int mbedtls_platform_set_setbuf(void (*setbuf_func)(FILE *stream, char *buf)) in mbedtls_platform_set_setbuf() argument 305 int mbedtls_platform_std_nv_seed_read(unsigned char *buf, size_t buf_len) in mbedtls_platform_std_nv_seed_read() argument 317 if ((n = fread(buf, 1, buf_len, file)) != buf_len) { in mbedtls_platform_std_nv_seed_read() 319 mbedtls_platform_zeroize(buf, buf_len); in mbedtls_platform_std_nv_seed_read() 327 int mbedtls_platform_std_nv_seed_write(unsigned char *buf, size_t buf_len) in mbedtls_platform_std_nv_seed_write() argument 339 if ((n = fwrite(buf, 1, buf_len, file)) != buf_len) { in mbedtls_platform_std_nv_seed_write() 354 static int platform_nv_seed_read_uninit(unsigned char *buf, size_t buf_len) in platform_nv_seed_read_uninit() argument [all …]
|
D | ssl_tls13_server.c | 62 const unsigned char *buf, in ssl_tls13_parse_key_exchange_modes_ext() argument 65 const unsigned char *p = buf; in ssl_tls13_parse_key_exchange_modes_ext() 687 unsigned char *buf, in ssl_tls13_write_server_pre_shared_key_ext() argument 691 unsigned char *p = (unsigned char *) buf; in ssl_tls13_write_server_pre_shared_key_ext() 734 const unsigned char *buf, in ssl_tls13_parse_supported_versions_ext() argument 737 const unsigned char *p = buf; in ssl_tls13_parse_supported_versions_ext() 788 const unsigned char *buf, in ssl_tls13_parse_supported_groups_ext() argument 791 const unsigned char *p = buf; in ssl_tls13_parse_supported_groups_ext() 795 MBEDTLS_SSL_DEBUG_BUF(3, "supported_groups extension", p, end - buf); in ssl_tls13_parse_supported_groups_ext() 849 const unsigned char *buf, in ssl_tls13_parse_key_shares_ext() argument [all …]
|
/mbedtls-3.5.0/programs/x509/ |
D | cert_write.c | 300 char buf[1024]; in main() local 329 memset(buf, 0, sizeof(buf)); in main() 498 ext_key_usage->buf.tag = MBEDTLS_ASN1_OID; in main() 500 SET_OID(ext_key_usage->buf, MBEDTLS_OID_SERVER_AUTH); in main() 502 SET_OID(ext_key_usage->buf, MBEDTLS_OID_CLIENT_AUTH); in main() 504 SET_OID(ext_key_usage->buf, MBEDTLS_OID_CODE_SIGNING); in main() 506 SET_OID(ext_key_usage->buf, MBEDTLS_OID_EMAIL_PROTECTION); in main() 508 SET_OID(ext_key_usage->buf, MBEDTLS_OID_TIME_STAMPING); in main() 510 SET_OID(ext_key_usage->buf, MBEDTLS_OID_OCSP_SIGNING); in main() 573 mbedtls_strerror(ret, buf, sizeof(buf)); in main() [all …]
|
/mbedtls-3.5.0/programs/pkey/ |
D | dh_client.c | 70 unsigned char buf[2048]; in main() local 143 memset(buf, 0, sizeof(buf)); in main() 145 if ((ret = mbedtls_net_recv(&server_fd, buf, 2)) != 2) { in main() 150 n = buflen = (buf[0] << 8) | buf[1]; in main() 151 if (buflen < 1 || buflen > sizeof(buf)) { in main() 159 memset(buf, 0, sizeof(buf)); in main() 161 if ((ret = mbedtls_net_recv(&server_fd, buf, n)) != (int) n) { in main() 166 p = buf, end = buf + buflen; in main() 193 if ((ret = mbedtls_sha1(buf, (int) (p - 2 - buf), hash)) != 0) { in main() 211 if ((ret = mbedtls_dhm_make_public(&dhm, (int) n, buf, n, in main() [all …]
|
D | dh_server.c | 69 unsigned char buf[2048]; in main() local 187 memset(buf, 0, sizeof(buf)); in main() 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() 218 (ret = mbedtls_net_send(&client_fd, buf, buflen)) != (int) buflen) { in main() 229 memset(buf, 0, sizeof(buf)); in main() 232 if ((ret = mbedtls_net_recv(&client_fd, buf, n)) != (int) n) { in main() [all …]
|
/mbedtls-3.5.0/programs/test/ |
D | benchmark.c | 505 unsigned char buf[BUFSIZE]; variable 612 memset(buf, 0xAA, sizeof(buf)); in main() 621 TIME_AND_TSC("MD5", mbedtls_md5(buf, BUFSIZE, tmp)); in main() 627 TIME_AND_TSC("RIPEMD160", mbedtls_ripemd160(buf, BUFSIZE, tmp)); in main() 633 TIME_AND_TSC("SHA-1", mbedtls_sha1(buf, BUFSIZE, tmp)); in main() 639 TIME_AND_TSC("SHA-256", mbedtls_sha256(buf, BUFSIZE, tmp, 0)); in main() 645 TIME_AND_TSC("SHA-512", mbedtls_sha512(buf, BUFSIZE, tmp, 0)); in main() 658 mbedtls_des3_crypt_cbc(&des3, MBEDTLS_DES_ENCRYPT, BUFSIZE, tmp, buf, buf)); in main() 669 mbedtls_des_crypt_cbc(&des, MBEDTLS_DES_ENCRYPT, BUFSIZE, tmp, buf, buf)); in main() 679 memset(buf, 0, sizeof(buf)); in main() [all …]
|
D | udp_proxy.c | 241 char *buf; in get_options() local 258 buf = mbedtls_calloc(1, len + 1); in get_options() 259 if (buf == NULL) { in get_options() 263 memcpy(buf, q, len + 1); in get_options() 265 delay_list[(*delay_cnt)++] = buf; in get_options() 395 static int ctx_buffer_flush(ctx_buffer *buf) in ctx_buffer_flush() argument 400 elapsed_time(), buf->description, in ctx_buffer_flush() 401 (unsigned) buf->len, buf->num_datagrams, in ctx_buffer_flush() 402 elapsed_time() - buf->packet_lifetime); in ctx_buffer_flush() 404 ret = mbedtls_net_send(buf->ctx, buf->data, buf->len); in ctx_buffer_flush() [all …]
|
/mbedtls-3.5.0/3rdparty/everest/library/ |
D | x25519.c | 60 unsigned char *buf, size_t blen, in mbedtls_x25519_make_params() argument 75 *buf++ = MBEDTLS_ECP_TLS_NAMED_CURVE; in mbedtls_x25519_make_params() 76 *buf++ = MBEDTLS_ECP_TLS_CURVE25519 >> 8; in mbedtls_x25519_make_params() 77 *buf++ = MBEDTLS_ECP_TLS_CURVE25519 & 0xFF; in mbedtls_x25519_make_params() 78 *buf++ = MBEDTLS_X25519_KEY_SIZE_BYTES; in mbedtls_x25519_make_params() 81 Hacl_Curve25519_crypto_scalarmult( buf, ctx->our_secret, base ); in mbedtls_x25519_make_params() 84 if( memcmp( buf, base, MBEDTLS_X25519_KEY_SIZE_BYTES) == 0 ) in mbedtls_x25519_make_params() 91 const unsigned char **buf, const unsigned char *end ) in mbedtls_x25519_read_params() argument 93 if( end - *buf < MBEDTLS_X25519_KEY_SIZE_BYTES + 1 ) in mbedtls_x25519_read_params() 96 if( ( *(*buf)++ != MBEDTLS_X25519_KEY_SIZE_BYTES ) ) in mbedtls_x25519_read_params() [all …]
|
/mbedtls-3.5.0/tests/suites/ |
D | test_suite_pkwrite.function | 16 unsigned char buf[5000]; 22 memset(buf, 0, sizeof(buf)); 28 ret = mbedtls_pk_write_pubkey_pem(&key, buf, sizeof(buf)); 31 pem_len = strlen((char *) buf); 34 for (buf_index = pem_len; buf_index < sizeof(buf); ++buf_index) { 35 TEST_ASSERT(buf[buf_index] == 0); 44 TEST_ASSERT(memcmp((char *) buf, (char *) check_buf, ilen) == 0); 55 unsigned char buf[5000]; 61 memset(buf, 0, sizeof(buf)); 68 ret = mbedtls_pk_write_key_pem(&key, buf, sizeof(buf)); [all …]
|
D | test_suite_ecdh.function | 123 rnd_info_A.buf = rnd_buf_A->x; 141 rnd_info_B.buf = rnd_buf_B->x; 199 unsigned char buf[1000]; 212 memset(buf, 0x00, sizeof(buf)); vbuf = buf; 213 TEST_ASSERT(mbedtls_ecdh_make_params(&srv, &len, buf, 1000, 216 TEST_ASSERT(mbedtls_ecdh_read_params(&cli, &vbuf, buf + len) == 0); 218 memset(buf, 0x00, sizeof(buf)); 219 TEST_ASSERT(mbedtls_ecdh_make_public(&cli, &len, buf, 1000, 222 TEST_ASSERT(mbedtls_ecdh_read_public(&srv, buf, len) == 0); 224 TEST_ASSERT(mbedtls_ecdh_calc_secret(&srv, &len, buf, 1000, [all …]
|
D | test_suite_x509write.function | 38 static int x509_crt_verifycsr(const unsigned char *buf, size_t buflen) 46 if (mbedtls_x509_csr_parse(&csr, buf, buflen) != 0) { 101 unsigned char buf[EXT_KEY_USAGE_TMP_BUF_MAX_LENGTH] = { 0 }; 102 unsigned char *p = buf + sizeof(buf); 114 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_oid(&p, buf, oid, oid_len)); 115 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_len(&p, buf, ret)); 116 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_tag(&p, buf, 144 unsigned char buf[4096]; 203 ret = mbedtls_x509write_csr_pem(&req, buf, sizeof(buf), 207 pem_len = strlen((char *) buf); [all …]
|
D | test_suite_entropy.function | 68 int buffer_nv_seed_read(unsigned char *buf, size_t buf_len) 74 memcpy(buf, buffer_seed, MBEDTLS_ENTROPY_BLOCK_SIZE); 78 int buffer_nv_seed_write(unsigned char *buf, size_t buf_len) 84 memcpy(buffer_seed, buf, MBEDTLS_ENTROPY_BLOCK_SIZE); 91 static int write_nv_seed(unsigned char *buf, size_t buf_len) 103 if (fwrite(buf, 1, MBEDTLS_ENTROPY_BLOCK_SIZE, f) != 113 int read_nv_seed(unsigned char *buf, size_t buf_len) 125 if (fread(buf, 1, MBEDTLS_ENTROPY_BLOCK_SIZE, f) != 199 unsigned char buf[MBEDTLS_ENTROPY_BLOCK_SIZE]; 203 TEST_EQUAL(mbedtls_entropy_func(&ctx, buf, sizeof(buf)), [all …]
|
D | test_suite_platform_util.function | 8 char buf[130]; 14 buf[0] = 2; 15 buf[len + 1] = 2; 19 p = &buf[1]; 26 TEST_EQUAL(buf[0], 2); 30 TEST_EQUAL(buf[len + 1], 2); 35 TEST_EQUAL(buf[0], 2); 39 TEST_EQUAL(buf[len + 1], 2); 56 char buf[128]; 57 mbedtls_platform_zeroize(buf, len); [all …]
|
/mbedtls-3.5.0/programs/ssl/ |
D | ssl_mail_client.c | 165 unsigned char buf[1024]; in do_handshake() local 166 memset(buf, 0, 1024); in do_handshake() 177 mbedtls_strerror(ret, (char *) buf, 1024); in do_handshake() 179 mbedtls_printf(" failed\n ! mbedtls_ssl_handshake returned %d: %s\n\n", ret, buf); in do_handshake() 211 mbedtls_x509_crt_info((char *) buf, sizeof(buf) - 1, " ", in do_handshake() 213 mbedtls_printf("%s\n", buf); in do_handshake() 219 static int write_ssl_data(mbedtls_ssl_context *ssl, unsigned char *buf, size_t len) in write_ssl_data() argument 223 mbedtls_printf("\n%s", buf); in write_ssl_data() 224 while (len && (ret = mbedtls_ssl_write(ssl, buf, len)) <= 0) { in write_ssl_data() 234 static int write_ssl_and_get_response(mbedtls_ssl_context *ssl, unsigned char *buf, size_t len) in write_ssl_and_get_response() argument [all …]
|
/mbedtls-3.5.0/programs/util/ |
D | pem2der.c | 117 static int load_file(const char *path, unsigned char **buf, size_t *n) in load_file() argument 136 (*buf = mbedtls_calloc(1, *n + 1)) == NULL) { in load_file() 141 if (fread(*buf, 1, *n, f) != *n) { in load_file() 143 free(*buf); in load_file() 144 *buf = NULL; 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() 181 char buf[1024]; in main() local 189 memset(buf, 0, sizeof(buf)); in main() [all …]
|