Don't provide stdlib.h, but provide gnuk-malloc.h.
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
2017-10-03 NIIBE Yutaka <gniibe@fsij.org>
|
2017-10-03 NIIBE Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
|
* 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/Makefile (build/flash.data): Generate.
|
||||||
|
|
||||||
* src/main.c (flash_addr_key_storage_start)
|
* src/main.c (flash_addr_key_storage_start)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#include "polarssl/bignum.h"
|
#include "polarssl/bignum.h"
|
||||||
#include "polarssl/bn_mul.h"
|
#include "polarssl/bn_mul.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <gnuk-malloc.h>
|
||||||
|
|
||||||
#define ciL (sizeof(t_uint)) /* chars in limb */
|
#define ciL (sizeof(t_uint)) /* chars in limb */
|
||||||
#define biL (ciL << 3) /* bits in limb */
|
#define biL (ciL << 3) /* bits in limb */
|
||||||
|
|||||||
@@ -39,7 +39,6 @@
|
|||||||
#include "polarssl/md.h"
|
#include "polarssl/md.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
16
src/gnuk-malloc.h
Normal file
16
src/gnuk-malloc.h
Normal file
@@ -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 <stddef.h> /* 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 *);
|
||||||
22
src/stdlib.h
22
src/stdlib.h
@@ -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 <stddef.h> /* 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
|
|
||||||
Reference in New Issue
Block a user