/mbedtls-3.6.0/library/ |
D | x509write_crt.c | 164 unsigned char buf[9]; in mbedtls_x509write_crt_set_basic_constraints() local 165 unsigned char *c = buf + sizeof(buf); in mbedtls_x509write_crt_set_basic_constraints() 168 memset(buf, 0, sizeof(buf)); in mbedtls_x509write_crt_set_basic_constraints() 176 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_int(&c, buf, in mbedtls_x509write_crt_set_basic_constraints() 179 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_bool(&c, buf, 1)); in mbedtls_x509write_crt_set_basic_constraints() 182 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_len(&c, buf, len)); in mbedtls_x509write_crt_set_basic_constraints() 183 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_tag(&c, buf, in mbedtls_x509write_crt_set_basic_constraints() 190 is_ca, buf + sizeof(buf) - len, len); in mbedtls_x509write_crt_set_basic_constraints() 199 unsigned char buf[MBEDTLS_MPI_MAX_SIZE * 2 + 20]; /* tag, length + 2xMPI */ in mbedtls_x509write_crt_set_key_identifier() local 200 unsigned char *c = buf + sizeof(buf); in mbedtls_x509write_crt_set_key_identifier() [all …]
|
D | x509write_csr.c | 85 unsigned char buf[4] = { 0 }; in mbedtls_x509write_csr_set_key_usage() local 89 c = buf + 4; in mbedtls_x509write_csr_set_key_usage() 91 ret = mbedtls_asn1_write_named_bitstring(&c, buf, &key_usage, 8); in mbedtls_x509write_csr_set_key_usage() 109 unsigned char buf[4] = { 0 }; in mbedtls_x509write_csr_set_ns_cert_type() local 113 c = buf + 4; in mbedtls_x509write_csr_set_ns_cert_type() 115 ret = mbedtls_asn1_write_named_bitstring(&c, buf, &ns_cert_type, 8); in mbedtls_x509write_csr_set_ns_cert_type() 131 unsigned char *buf, in x509write_csr_der_internal() argument 151 c = buf + size; in x509write_csr_der_internal() 153 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_x509_write_extensions(&c, buf, in x509write_csr_der_internal() 157 MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_len(&c, buf, len)); in x509write_csr_der_internal() [all …]
|
D | pkwrite.c | 156 uint8_t buf[PSA_EXPORT_PUBLIC_KEY_MAX_SIZE]; in pk_write_ec_pubkey() local 159 if (psa_export_public_key(pk->priv_id, buf, sizeof(buf), &len) != PSA_SUCCESS) { in pk_write_ec_pubkey() 164 memcpy(buf, pk->pub_raw, len); in pk_write_ec_pubkey() 172 memcpy(*p, buf, len); in pk_write_ec_pubkey() 182 uint8_t buf[PSA_EXPORT_PUBLIC_KEY_MAX_SIZE]; in pk_write_ec_pubkey() local 184 unsigned char buf[MBEDTLS_ECP_MAX_PT_LEN]; in pk_write_ec_pubkey() local 191 if (psa_export_public_key(pk->priv_id, buf, sizeof(buf), &len) != PSA_SUCCESS) { in pk_write_ec_pubkey() 195 memcpy(*p, buf, len); in pk_write_ec_pubkey() 202 &len, buf, sizeof(buf))) != 0) { in pk_write_ec_pubkey() 212 memcpy(*p, buf, len); in pk_write_ec_pubkey() [all …]
|
D | entropy.c | 199 unsigned char buf[MBEDTLS_ENTROPY_MAX_GATHER]; in entropy_gather_internal() local 216 buf, MBEDTLS_ENTROPY_MAX_GATHER, &olen)) != 0) { in entropy_gather_internal() 225 buf, olen)) != 0) { in entropy_gather_internal() 237 mbedtls_platform_zeroize(buf, sizeof(buf)); in entropy_gather_internal() 271 unsigned char buf[MBEDTLS_ENTROPY_BLOCK_SIZE]; in mbedtls_entropy_func() local 320 memset(buf, 0, MBEDTLS_ENTROPY_BLOCK_SIZE); in mbedtls_entropy_func() 327 if ((ret = mbedtls_md_finish(&ctx->accumulator, buf)) != 0) { in mbedtls_entropy_func() 345 if ((ret = mbedtls_md_update(&ctx->accumulator, buf, in mbedtls_entropy_func() 354 buf, MBEDTLS_ENTROPY_BLOCK_SIZE, buf)) != 0) { in mbedtls_entropy_func() 362 memcpy(output, buf, len); in mbedtls_entropy_func() [all …]
|
D | ssl_tls13_client.c | 47 unsigned char *buf, in ssl_tls13_write_supported_versions_ext() argument 51 unsigned char *p = buf; in ssl_tls13_write_supported_versions_ext() 99 const unsigned char *buf, in ssl_tls13_parse_supported_versions_ext() argument 104 MBEDTLS_SSL_CHK_BUF_READ_PTR(buf, end, 2); in ssl_tls13_parse_supported_versions_ext() 105 if (mbedtls_ssl_read_version(buf, ssl->conf->transport) != in ssl_tls13_parse_supported_versions_ext() 114 if (&buf[2] != end) { in ssl_tls13_parse_supported_versions_ext() 128 const unsigned char *buf, size_t len) in ssl_tls13_parse_alpn_ext() argument 130 const unsigned char *p = buf; in ssl_tls13_parse_alpn_ext() 131 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 | pem.c | 154 unsigned char *buf, size_t buflen, in pem_des_decrypt() argument 171 des_iv, buf, buf); in pem_des_decrypt() 184 unsigned char *buf, size_t buflen, in pem_des3_decrypt() argument 201 des3_iv, buf, buf); in pem_des3_decrypt() 216 unsigned char *buf, size_t buflen, in pem_aes_decrypt() argument 233 aes_iv, buf, buf); in pem_aes_decrypt() 251 unsigned char *buf; in mbedtls_pem_read_buffer() local 392 if ((buf = mbedtls_calloc(1, len)) == NULL) { in mbedtls_pem_read_buffer() 396 if ((ret = mbedtls_base64_decode(buf, len, &len, s1, s2 - s1)) != 0) { in mbedtls_pem_read_buffer() 397 mbedtls_zeroize_and_free(buf, len); in mbedtls_pem_read_buffer() [all …]
|
D | gcm.c | 265 memset(ctx->buf, 0x00, sizeof(ctx->buf)); in mbedtls_gcm_starts() 341 mbedtls_xor(ctx->buf + offset, ctx->buf + offset, p, use_len); in mbedtls_gcm_update_ad() 344 gcm_mult(ctx, ctx->buf, ctx->buf); in mbedtls_gcm_update_ad() 355 mbedtls_xor(ctx->buf, ctx->buf, p, 16); in mbedtls_gcm_update_ad() 357 gcm_mult(ctx, ctx->buf, ctx->buf); in mbedtls_gcm_update_ad() 364 mbedtls_xor(ctx->buf, ctx->buf, p, add_len); in mbedtls_gcm_update_ad() 399 mbedtls_xor(ctx->buf + offset, ctx->buf + offset, input, use_len); in gcm_mask() 403 mbedtls_xor(ctx->buf + offset, ctx->buf + offset, output, use_len); in gcm_mask() 445 gcm_mult(ctx, ctx->buf, ctx->buf); in mbedtls_gcm_update() 460 gcm_mult(ctx, ctx->buf, ctx->buf); in mbedtls_gcm_update() [all …]
|
D | ssl_tls13_generic.c | 51 unsigned char **buf, in mbedtls_ssl_tls13_fetch_handshake_msg() argument 77 *buf = ssl->in_msg + 4; in mbedtls_ssl_tls13_fetch_handshake_msg() 87 const unsigned char *buf, const unsigned char *end, in mbedtls_ssl_tls13_is_supported_versions_ext_present_in_exts() argument 91 const unsigned char *p = buf; in mbedtls_ssl_tls13_is_supported_versions_ext_present_in_exts() 213 const unsigned char *buf, in ssl_tls13_parse_certificate_verify() argument 220 const unsigned char *p = buf; in ssl_tls13_parse_certificate_verify() 345 unsigned char *buf; in mbedtls_ssl_tls13_process_certificate_verify() local 352 ssl, MBEDTLS_SSL_HS_CERTIFICATE_VERIFY, &buf, &buf_len)); in mbedtls_ssl_tls13_process_certificate_verify() 383 ssl, buf, buf + buf_len, in mbedtls_ssl_tls13_process_certificate_verify() 388 buf, buf_len)); in mbedtls_ssl_tls13_process_certificate_verify() [all …]
|
D | ecdh.c | 266 unsigned char *buf, size_t blen, in ecdh_make_params_internal() argument 304 if ((ret = mbedtls_ecp_tls_write_group(&ctx->grp, &grp_len, buf, in ecdh_make_params_internal() 309 buf += grp_len; in ecdh_make_params_internal() 313 &pt_len, buf, blen)) != 0) { in ecdh_make_params_internal() 329 unsigned char *buf, size_t blen, in mbedtls_ecdh_make_params() argument 341 return ecdh_make_params_internal(ctx, olen, ctx->point_format, buf, blen, in mbedtls_ecdh_make_params() 348 buf, blen, f_rng, p_rng); in mbedtls_ecdh_make_params() 352 ctx->point_format, buf, blen, in mbedtls_ecdh_make_params() 362 const unsigned char **buf, in ecdh_read_params_internal() argument 365 return mbedtls_ecp_tls_read_point(&ctx->grp, &ctx->Qp, buf, in ecdh_read_params_internal() [all …]
|
D | ecjpake.c | 202 unsigned char buf[ECJPAKE_HASH_BUF_LEN]; in ecjpake_hash() local 203 unsigned char *p = buf; in ecjpake_hash() 204 const unsigned char *end = buf + sizeof(buf); in ecjpake_hash() 229 buf, p - buf, hash)); in ecjpake_hash() 456 const unsigned char *buf, in ecjpake_kkpp_read() argument 460 const unsigned char *p = buf; in ecjpake_kkpp_read() 461 const unsigned char *end = buf + len; in ecjpake_kkpp_read() 492 unsigned char *buf, in ecjpake_kkpp_write() argument 499 unsigned char *p = buf; in ecjpake_kkpp_write() 500 const unsigned char *end = buf + len; in ecjpake_kkpp_write() [all …]
|
D | x509write.c | 46 unsigned char *buf; in mbedtls_x509_write_set_san_common() local 91 buf = mbedtls_calloc(1, buflen); in mbedtls_x509_write_set_san_common() 92 if (buf == NULL) { in mbedtls_x509_write_set_san_common() 95 p = buf + buflen; in mbedtls_x509_write_set_san_common() 114 &p, buf, in mbedtls_x509_write_set_san_common() 117 &p, buf, unstructured_name_len)); in mbedtls_x509_write_set_san_common() 120 &p, buf, in mbedtls_x509_write_set_san_common() 126 mbedtls_x509_write_names(&p, buf, in mbedtls_x509_write_set_san_common() 131 mbedtls_asn1_write_len(&p, buf, single_san_len)); in mbedtls_x509_write_set_san_common() 133 mbedtls_asn1_write_tag(&p, buf, in mbedtls_x509_write_set_san_common() [all …]
|
D | platform.c | 222 static void platform_setbuf_uninit(FILE *stream, char *buf) in platform_setbuf_uninit() argument 225 ((void) buf); in platform_setbuf_uninit() 230 void (*mbedtls_setbuf)(FILE *stream, char *buf) = MBEDTLS_PLATFORM_STD_SETBUF; 232 int mbedtls_platform_set_setbuf(void (*setbuf_func)(FILE *stream, char *buf)) in mbedtls_platform_set_setbuf() argument 293 int mbedtls_platform_std_nv_seed_read(unsigned char *buf, size_t buf_len) in mbedtls_platform_std_nv_seed_read() argument 305 if ((n = fread(buf, 1, buf_len, file)) != buf_len) { in mbedtls_platform_std_nv_seed_read() 307 mbedtls_platform_zeroize(buf, buf_len); in mbedtls_platform_std_nv_seed_read() 315 int mbedtls_platform_std_nv_seed_write(unsigned char *buf, size_t buf_len) in mbedtls_platform_std_nv_seed_write() argument 327 if ((n = fwrite(buf, 1, buf_len, file)) != buf_len) { in mbedtls_platform_std_nv_seed_write() 342 static int platform_nv_seed_read_uninit(unsigned char *buf, size_t buf_len) in platform_nv_seed_read_uninit() argument [all …]
|
D | ssl_tls12_server.c | 108 const unsigned char *buf, in ssl_parse_renegotiation_info() argument 115 buf[0] != ssl->verify_data_len || in ssl_parse_renegotiation_info() 116 mbedtls_ct_memcmp(buf + 1, ssl->peer_verify_data, in ssl_parse_renegotiation_info() 126 if (len != 1 || buf[0] != 0x0) { in ssl_parse_renegotiation_info() 182 const unsigned char *buf, in ssl_parse_supported_groups_ext() argument 195 list_size = ((buf[0] << 8) | (buf[1])); in ssl_parse_supported_groups_ext() 228 p = buf + 2; in ssl_parse_supported_groups_ext() 247 const unsigned char *buf, in ssl_parse_supported_point_formats() argument 253 if (len == 0 || (size_t) (buf[0] + 1) != len) { in ssl_parse_supported_point_formats() 259 list_size = buf[0]; in ssl_parse_supported_point_formats() [all …]
|
D | ssl_tls13_server.c | 52 const unsigned char *buf, in ssl_tls13_parse_key_exchange_modes_ext() argument 55 const unsigned char *p = buf; in ssl_tls13_parse_key_exchange_modes_ext() 676 unsigned char *buf, in ssl_tls13_write_server_pre_shared_key_ext() argument 680 unsigned char *p = (unsigned char *) buf; in ssl_tls13_write_server_pre_shared_key_ext() 723 const unsigned char *buf, in ssl_tls13_parse_supported_versions_ext() argument 726 const unsigned char *p = buf; in ssl_tls13_parse_supported_versions_ext() 782 const unsigned char *buf, in ssl_tls13_parse_supported_groups_ext() argument 785 const unsigned char *p = buf; in ssl_tls13_parse_supported_groups_ext() 789 MBEDTLS_SSL_DEBUG_BUF(3, "supported_groups extension", p, end - buf); in ssl_tls13_parse_supported_groups_ext() 844 const unsigned char *buf, in ssl_tls13_parse_key_shares_ext() argument [all …]
|
/mbedtls-3.6.0/programs/test/ |
D | benchmark.c | 495 unsigned char buf[BUFSIZE]; variable 611 memset(buf, 0xAA, sizeof(buf)); in main() 620 TIME_AND_TSC("MD5", mbedtls_md5(buf, BUFSIZE, tmp)); in main() 626 TIME_AND_TSC("RIPEMD160", mbedtls_ripemd160(buf, BUFSIZE, tmp)); in main() 632 TIME_AND_TSC("SHA-1", mbedtls_sha1(buf, BUFSIZE, tmp)); in main() 638 TIME_AND_TSC("SHA-256", mbedtls_sha256(buf, BUFSIZE, tmp, 0)); in main() 644 TIME_AND_TSC("SHA-512", mbedtls_sha512(buf, BUFSIZE, tmp, 0)); in main() 649 TIME_AND_TSC("SHA3-224", mbedtls_sha3(MBEDTLS_SHA3_224, buf, BUFSIZE, tmp, 28)); in main() 652 TIME_AND_TSC("SHA3-256", mbedtls_sha3(MBEDTLS_SHA3_256, buf, BUFSIZE, tmp, 32)); in main() 655 TIME_AND_TSC("SHA3-384", mbedtls_sha3(MBEDTLS_SHA3_384, buf, BUFSIZE, tmp, 48)); in main() [all …]
|
D | udp_proxy.c | 229 char *buf; in get_options() local 246 buf = mbedtls_calloc(1, len + 1); in get_options() 247 if (buf == NULL) { in get_options() 251 memcpy(buf, q, len + 1); in get_options() 253 delay_list[(*delay_cnt)++] = buf; in get_options() 383 static int ctx_buffer_flush(ctx_buffer *buf) in ctx_buffer_flush() argument 388 elapsed_time(), buf->description, in ctx_buffer_flush() 389 (unsigned) buf->len, buf->num_datagrams, in ctx_buffer_flush() 390 elapsed_time() - buf->packet_lifetime); in ctx_buffer_flush() 392 ret = mbedtls_net_send(buf->ctx, buf->data, buf->len); in ctx_buffer_flush() [all …]
|
/mbedtls-3.6.0/programs/pkey/ |
D | dh_client.c | 60 unsigned char buf[2048]; in main() local 133 memset(buf, 0, sizeof(buf)); in main() 135 if ((ret = mbedtls_net_recv(&server_fd, buf, 2)) != 2) { in main() 140 n = buflen = (buf[0] << 8) | buf[1]; in main() 141 if (buflen < 1 || buflen > sizeof(buf)) { in main() 149 memset(buf, 0, sizeof(buf)); in main() 151 if ((ret = mbedtls_net_recv(&server_fd, buf, n)) != (int) n) { in main() 156 p = buf, end = buf + buflen; in main() 183 if ((ret = mbedtls_sha1(buf, (int) (p - 2 - buf), hash)) != 0) { in main() 201 if ((ret = mbedtls_dhm_make_public(&dhm, (int) n, buf, n, in main() [all …]
|
D | dh_server.c | 59 unsigned char buf[2048]; in main() local 177 memset(buf, 0, sizeof(buf)); in main() 180 mbedtls_dhm_make_params(&dhm, (int) mbedtls_mpi_size(&dhm.MBEDTLS_PRIVATE(P)), buf, &n, in main() 189 if ((ret = mbedtls_sha1(buf, n, hash)) != 0) { in main() 194 buf[n] = (unsigned char) (rsa.MBEDTLS_PRIVATE(len) >> 8); in main() 195 buf[n + 1] = (unsigned char) (rsa.MBEDTLS_PRIVATE(len)); in main() 198 32, hash, buf + n + 2)) != 0) { in main() 208 (ret = mbedtls_net_send(&client_fd, buf, buflen)) != (int) buflen) { in main() 219 memset(buf, 0, sizeof(buf)); in main() 222 if ((ret = mbedtls_net_recv(&client_fd, buf, n)) != (int) n) { in main() [all …]
|
/mbedtls-3.6.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.6.0/programs/x509/ |
D | cert_write.c | 298 char buf[1024]; in main() local 329 memset(buf, 0, sizeof(buf)); in main() 508 ext_key_usage->buf.tag = MBEDTLS_ASN1_OID; in main() 510 SET_OID(ext_key_usage->buf, MBEDTLS_OID_SERVER_AUTH); in main() 512 SET_OID(ext_key_usage->buf, MBEDTLS_OID_CLIENT_AUTH); in main() 514 SET_OID(ext_key_usage->buf, MBEDTLS_OID_CODE_SIGNING); in main() 516 SET_OID(ext_key_usage->buf, MBEDTLS_OID_EMAIL_PROTECTION); in main() 518 SET_OID(ext_key_usage->buf, MBEDTLS_OID_TIME_STAMPING); in main() 520 SET_OID(ext_key_usage->buf, MBEDTLS_OID_OCSP_SIGNING); in main() 522 SET_OID(ext_key_usage->buf, MBEDTLS_OID_ANY_EXTENDED_KEY_USAGE); in main() [all …]
|
/mbedtls-3.6.0/programs/ssl/ |
D | ssl_mail_client.c | 153 unsigned char buf[1024]; in do_handshake() local 154 memset(buf, 0, 1024); in do_handshake() 165 mbedtls_strerror(ret, (char *) buf, 1024); in do_handshake() 167 mbedtls_printf(" failed\n ! mbedtls_ssl_handshake returned %d: %s\n\n", ret, buf); in do_handshake() 199 mbedtls_x509_crt_info((char *) buf, sizeof(buf) - 1, " ", in do_handshake() 201 mbedtls_printf("%s\n", buf); in do_handshake() 207 static int write_ssl_data(mbedtls_ssl_context *ssl, unsigned char *buf, size_t len) in write_ssl_data() argument 211 mbedtls_printf("\n%s", buf); in write_ssl_data() 212 while (len && (ret = mbedtls_ssl_write(ssl, buf, len)) <= 0) { in write_ssl_data() 222 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.6.0/tests/suites/ |
D | test_suite_ssl_decrypt.function | 28 .buf = NULL, 43 uint8_t *buf = NULL; 55 TEST_CALLOC(rec_good.buf, rec_good.buf_len); 56 memcpy(rec_good.buf, sample_plaintext, plaintext_length); 65 TEST_CALLOC(buf, rec.buf_len); 69 rec.buf = buf; 70 memcpy(buf, rec_good.buf, rec.buf_len); 71 buf[i] ^= 1; 75 mbedtls_free(buf); 76 buf = NULL; [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_pem.function | 9 void mbedtls_pem_write_buffer(char *start, char *end, data_t *buf, 17 ret = mbedtls_pem_write_buffer(start, end, buf->x, buf->len, NULL, 0, &olen); 23 ret = mbedtls_pem_write_buffer(start, end, buf->x, buf->len, check_buf, olen, &olen2); 39 unsigned char buf[1024]; 47 ret = mbedtls_pem_write_buffer("\n", "\n", data, l, buf, sizeof(buf), &olen); 52 memset(buf, 1, sizeof(buf)); 53 ret = mbedtls_pem_write_buffer("\n", "\n", data, l, buf, olen_needed, &olen); 57 for (size_t i = olen_needed; i < sizeof(buf); i++) { 58 TEST_EQUAL(buf[i], 1); 72 const unsigned char *buf; [all …]
|
/mbedtls-3.6.0/programs/util/ |
D | pem2der.c | 105 static int load_file(const char *path, unsigned char **buf, size_t *n) in load_file() argument 124 (*buf = mbedtls_calloc(1, *n + 1)) == NULL) { in load_file() 129 if (fread(*buf, 1, *n, f) != *n) { in load_file() 131 free(*buf); in load_file() 132 *buf = NULL; 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() 169 char buf[1024]; in main() local 177 memset(buf, 0, sizeof(buf)); in main() [all …]
|