Rename the generic read functions to ssl_read_file_text
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
This commit is contained in:
parent
6c678d7543
commit
b1db72923e
1 changed files with 6 additions and 5 deletions
|
@ -720,21 +720,22 @@ exit:
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_EARLY_DATA)
|
#if defined(MBEDTLS_SSL_EARLY_DATA)
|
||||||
|
|
||||||
#define MBEDTLS_ERR_EARLY_FILE_IO_ERROR -2
|
#define MBEDTLS_ERR_FILE_IO_ERROR -2
|
||||||
|
|
||||||
int ssl_early_data_read_file(const char *path, unsigned char **buffer, size_t *length)
|
static int ssl_read_file_text(const char *path,
|
||||||
|
unsigned char **buffer, size_t *length)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
long size;
|
long size;
|
||||||
|
|
||||||
if ((f = fopen(path, "rb")) == NULL) {
|
if ((f = fopen(path, "rb")) == NULL) {
|
||||||
return MBEDTLS_ERR_EARLY_FILE_IO_ERROR;
|
return MBEDTLS_ERR_FILE_IO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
fseek(f, 0, SEEK_END);
|
fseek(f, 0, SEEK_END);
|
||||||
if ((size = ftell(f)) == -1) {
|
if ((size = ftell(f)) == -1) {
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return MBEDTLS_ERR_EARLY_FILE_IO_ERROR;
|
return MBEDTLS_ERR_FILE_IO_ERROR;
|
||||||
}
|
}
|
||||||
fseek(f, 0, SEEK_SET);
|
fseek(f, 0, SEEK_SET);
|
||||||
|
|
||||||
|
@ -747,7 +748,7 @@ int ssl_early_data_read_file(const char *path, unsigned char **buffer, size_t *l
|
||||||
|
|
||||||
if (fread(*buffer, 1, *length, f) != *length) {
|
if (fread(*buffer, 1, *length, f) != *length) {
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return MBEDTLS_ERR_EARLY_FILE_IO_ERROR;
|
return MBEDTLS_ERR_FILE_IO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue