malloc changes to core_malloc
This commit is contained in:
parent
1691a69bae
commit
053adfacf6
|
@ -1,5 +1,6 @@
|
|||
#include "core_aes.h"
|
||||
#include "core_aes_cmac.h"
|
||||
#include "core_pkbuf.h"
|
||||
#include "testutil.h"
|
||||
|
||||
typedef struct {
|
||||
|
@ -43,9 +44,9 @@ static void aes_test2(abts_case *tc, void *data)
|
|||
|
||||
test_vector[0].key_bits = 128;
|
||||
test_vector[0].key =
|
||||
malloc(sizeof(char)*KEYLENGTH(test_vector[0].key_bits));
|
||||
core_malloc(sizeof(char)*KEYLENGTH(test_vector[0].key_bits));
|
||||
test_vector[0].rk =
|
||||
malloc(sizeof(unsigned int)*RKLENGTH(test_vector[0].key_bits));
|
||||
core_malloc(sizeof(unsigned int)*RKLENGTH(test_vector[0].key_bits));
|
||||
memcpy(test_vector[0].key,
|
||||
"\x95\xA8\xEE\x8E\x89\x97\x9B\x9E"
|
||||
"\xFD\xCB\xC6\xEB\x97\x97\x52\x8D",
|
||||
|
@ -65,9 +66,9 @@ static void aes_test2(abts_case *tc, void *data)
|
|||
|
||||
test_vector[1].key_bits = 192;
|
||||
test_vector[1].key =
|
||||
malloc(sizeof(char)*KEYLENGTH(test_vector[1].key_bits));
|
||||
core_malloc(sizeof(char)*KEYLENGTH(test_vector[1].key_bits));
|
||||
test_vector[1].rk =
|
||||
malloc(sizeof(unsigned int)*RKLENGTH(test_vector[1].key_bits));
|
||||
core_malloc(sizeof(unsigned int)*RKLENGTH(test_vector[1].key_bits));
|
||||
memcpy(test_vector[1].key,
|
||||
"\x95\xA8\xEE\x8E\x89\x97\x9B\x9E"
|
||||
"\xFD\xCB\xC6\xEB\x97\x97\x52\x8D"
|
||||
|
@ -88,9 +89,9 @@ static void aes_test2(abts_case *tc, void *data)
|
|||
|
||||
test_vector[2].key_bits = 256;
|
||||
test_vector[2].key =
|
||||
malloc(sizeof(char)*KEYLENGTH(test_vector[2].key_bits));
|
||||
core_malloc(sizeof(char)*KEYLENGTH(test_vector[2].key_bits));
|
||||
test_vector[2].rk =
|
||||
malloc(sizeof(unsigned int)*RKLENGTH(test_vector[2].key_bits));
|
||||
core_malloc(sizeof(unsigned int)*RKLENGTH(test_vector[2].key_bits));
|
||||
memcpy(test_vector[2].key,
|
||||
"\x95\xA8\xEE\x8E\x89\x97\x9B\x9E"
|
||||
"\xFD\xCB\xC6\xEB\x97\x97\x52\x8D"
|
||||
|
@ -125,8 +126,8 @@ static void aes_test2(abts_case *tc, void *data)
|
|||
rc = memcmp(tmp, test_vector[i].decipher_output, 16);
|
||||
ABTS_INT_EQUAL(tc, 0, rc);
|
||||
|
||||
free(test_vector[i].key);
|
||||
free(test_vector[i].rk);
|
||||
core_free(test_vector[i].key);
|
||||
core_free(test_vector[i].rk);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "core_file.h"
|
||||
#include "core_pkbuf.h"
|
||||
#include "testutil.h"
|
||||
|
||||
#define DIRNAME "data"
|
||||
|
@ -95,7 +96,7 @@ static void test_read(abts_case *tc, void *data)
|
|||
{
|
||||
status_t rv;
|
||||
size_t nbytes = 256;
|
||||
char *str = malloc(nbytes + 1);
|
||||
char *str = core_malloc(nbytes + 1);
|
||||
file_t *filetest = NULL;
|
||||
|
||||
rv = file_open(&filetest, FILENAME,
|
||||
|
@ -108,7 +109,7 @@ static void test_read(abts_case *tc, void *data)
|
|||
ABTS_SIZE_EQUAL(tc, strlen(TESTSTR), nbytes);
|
||||
ABTS_STR_EQUAL(tc, TESTSTR, str);
|
||||
|
||||
free(str);
|
||||
core_free(str);
|
||||
|
||||
file_close(filetest);
|
||||
}
|
||||
|
@ -244,7 +245,7 @@ static void test_seek(abts_case *tc, void *data)
|
|||
status_t rv;
|
||||
off_t offset = 5;
|
||||
size_t nbytes = 256;
|
||||
char *str = malloc(nbytes + 1);
|
||||
char *str = core_malloc(nbytes + 1);
|
||||
file_t *filetest = NULL;
|
||||
|
||||
rv = file_open(&filetest, FILENAME,
|
||||
|
@ -288,7 +289,7 @@ static void test_seek(abts_case *tc, void *data)
|
|||
ABTS_SIZE_EQUAL(tc, 5, nbytes);
|
||||
ABTS_STR_EQUAL(tc, TESTSTR + strlen(TESTSTR) - 5, str);
|
||||
|
||||
free(str);
|
||||
core_free(str);
|
||||
|
||||
file_close(filetest);
|
||||
}
|
||||
|
@ -312,7 +313,7 @@ static void test_gets(abts_case *tc, void *data)
|
|||
{
|
||||
file_t *f = NULL;
|
||||
status_t rv;
|
||||
char *str = malloc(256);
|
||||
char *str = core_malloc(256);
|
||||
|
||||
rv = file_open(&f, FILENAME, FILE_READ, 0);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
|
@ -328,7 +329,7 @@ static void test_gets(abts_case *tc, void *data)
|
|||
ABTS_INT_EQUAL(tc, CORE_EOF, rv);
|
||||
ABTS_STR_EQUAL(tc, "", str);
|
||||
|
||||
free(str);
|
||||
core_free(str);
|
||||
file_close(f);
|
||||
}
|
||||
|
||||
|
@ -461,7 +462,7 @@ static void file_contents_equal(abts_case *tc,
|
|||
const void *expect,
|
||||
size_t expectlen)
|
||||
{
|
||||
void *actual = malloc(expectlen);
|
||||
void *actual = core_malloc(expectlen);
|
||||
file_t *f;
|
||||
|
||||
CORE_ASSERT_OK(tc, "open file",
|
||||
|
@ -475,7 +476,7 @@ static void file_contents_equal(abts_case *tc,
|
|||
|
||||
CORE_ASSERT_OK(tc, "close file", file_close(f));
|
||||
|
||||
free(actual);
|
||||
core_free(actual);
|
||||
}
|
||||
|
||||
#define LINE1 "this is a line of text\n"
|
||||
|
|
|
@ -39,10 +39,14 @@ static void pkbuf_test4(abts_case *tc, void *data)
|
|||
ABTS_PTR_NOTNULL(tc, p);
|
||||
memset(p, 1, 10);
|
||||
|
||||
q = core_realloc(p, 248);
|
||||
q = core_realloc(p,
|
||||
CORE_ALIGN(128+MAX_SIZEOF_HEADROOM, SIZEOF_VOIDP) -
|
||||
SIZEOF_VOIDP);
|
||||
ABTS_TRUE(tc, p == q);
|
||||
|
||||
p = core_realloc(q, 249);
|
||||
p = core_realloc(q,
|
||||
CORE_ALIGN(128+MAX_SIZEOF_HEADROOM, SIZEOF_VOIDP) -
|
||||
SIZEOF_VOIDP + 1);
|
||||
ABTS_TRUE(tc, p != q);
|
||||
ABTS_TRUE(tc, memcmp(p, q, 10) == 0);
|
||||
core_free(p);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "core_debug.h"
|
||||
#include "core_sha1.h"
|
||||
#include "core_sha2.h"
|
||||
#include "core_pkbuf.h"
|
||||
#include "testutil.h"
|
||||
|
||||
static void sha1_test1(abts_case *tc, void *data)
|
||||
|
|
Loading…
Reference in New Issue