diff --git a/ChangeLog b/ChangeLog index 5e0493a..342be8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2017-10-03 NIIBE Yutaka + * polarssl/library/rsa.c: Don't include stdlib.h. + * src/gnuk-malloc.h: Rename from stdlib.h. + * polarssl/library/bignum.c: Include gnuk-malloc.h. + * src/Makefile (build/flash.data): Generate. * src/main.c (flash_addr_key_storage_start) diff --git a/polarssl/library/bignum.c b/polarssl/library/bignum.c index 108090d..4a9a9d8 100644 --- a/polarssl/library/bignum.c +++ b/polarssl/library/bignum.c @@ -37,7 +37,7 @@ #include "polarssl/bignum.h" #include "polarssl/bn_mul.h" -#include +#include #define ciL (sizeof(t_uint)) /* chars in limb */ #define biL (ciL << 3) /* bits in limb */ diff --git a/polarssl/library/rsa.c b/polarssl/library/rsa.c index 4885e9e..3e9b829 100644 --- a/polarssl/library/rsa.c +++ b/polarssl/library/rsa.c @@ -39,7 +39,6 @@ #include "polarssl/md.h" #endif -#include #include /* diff --git a/src/gnuk-malloc.h b/src/gnuk-malloc.h new file mode 100644 index 0000000..e9c55d2 --- /dev/null +++ b/src/gnuk-malloc.h @@ -0,0 +1,16 @@ +/* + * Gnuk uses its own malloc functions. + * + * The intention is no-dependency to C library. But, we provide + * malloc and free here, since RSA routines uses malloc/free + * internally. + * + */ + +#include /* NULL and size_t */ + +#define malloc(size) gnuk_malloc (size) +#define free(p) gnuk_free (p) + +void *gnuk_malloc (size_t); +void gnuk_free (void *); diff --git a/src/stdlib.h b/src/stdlib.h deleted file mode 100644 index bc2d05b..0000000 --- a/src/stdlib.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * stdlib.h replacement to replace malloc functions - * - * The intention is that no dependency to C library. But since RSA - * routines uses malloc/free, we provide malloc and free. - * - * For GNU/Linux emulation, we can use C library. - */ - -#include /* NULL and size_t */ - -#define malloc(size) gnuk_malloc (size) -#define free(p) gnuk_free (p) - -void *gnuk_malloc (size_t); -void gnuk_free (void *); - -#ifdef GNU_LINUX_EMULATION -long int random(void); -void srandom(unsigned int seed); -void exit(int status); -#endif