Further user_settings.h cleanup / additions. Additional README.md comments.

This commit is contained in:
David Garske
2019-06-07 13:58:17 -07:00
parent fdd01c8c8c
commit d7ab3a6dec
3 changed files with 59 additions and 37 deletions

View File

@ -22,13 +22,15 @@ OPT_CFLAGS = -specs=nano.specs
#OPT_CFLAGS += -O3 -DTIME -DNOENUM -Wno-implicit -mexplicit-relocs -save-temps
#OPT_CFLAGS += -fno-inline -fno-builtin-printf -fno-common -falign-functions=4
# ovewrite the __stack_size default value of 0x400 with 0x1000(4 Kbytes).
# override the __stack_size and __heap_size default values of 0x400
# SiFive HiFive1 has 16KB of data SRAM
# The __stack_size and __heap_size symbols are defined in the linker metal.default.ld
# script in the freedom-e-sdk.
override CFLAGS += $(OPT_CFLAGS) $(WOLFSSL_CFLAGS) \
-Xlinker --defsym=__stack_size=0x1200 \
-Xlinker --defsym=__heap_size=0x800
$(PROGRAM): $(SRC)
$(CC) $(CFLAGS) $(SRC) $(LDFLAGS) $(LDLIBS) -o $@

View File

@ -130,7 +130,7 @@ int my_rng_gen_block(unsigned char* output, unsigned int sz)
int main(void)
{
int ret;
long clkHz = 16000000; /* default */
long clk_Hz = 16000000; /* default */
#if WOLFSSL_SIFIVE_RISC_V_DEBUG
printf("check stack and heap addresses\n");
@ -144,11 +144,11 @@ int main(void)
/* Speed up clock */
printf("SiFive HiFive1 Demo\n");
printf("Setting clock to %dMHz\n", USE_CLOCK_HZ/1000000);
clkHz = metal_clock_set_rate_hz(
clk_Hz = metal_clock_set_rate_hz(
&__METAL_DT_SIFIVE_FE310_G000_PLL_HANDLE->clock, USE_CLOCK_HZ
);
#endif
printf("Actual Clock %dMHz\n", clkHz/1000000);
printf("Actual Clock %dMHz\n", clk_Hz/1000000);
#ifdef DEBUG_WOLFSSL
wolfSSL_Debugging_ON();

View File

@ -70,22 +70,9 @@ extern "C" {
//#define TFM_ARM
#endif
/* Wolf Single Precision Math */
/* Optional ECC SECP256R1 acceleration using optimized C code */
#undef WOLFSSL_SP
#if 1
#define WOLFSSL_SP
#define WOLFSSL_SP_SMALL /* use smaller version of code (requires heap) */
#define SP_WORD_SIZE 32 /* force 32-bit type */
#define WOLFSSL_SP_MATH /* only SP math - eliminates fast math code */
//#define WOLFSSL_SP_DIV_32 /* do not use 64-bit divides */
#define WOLFSSL_HAVE_SP_ECC
//#define WOLFSSL_HAVE_SP_RSA
#endif
/* ------------------------------------------------------------------------- */
/* Crypto */
/* Asymmetric */
/* ------------------------------------------------------------------------- */
/* RSA */
/* Not enabled due to memory constraints on HiFive1 */
@ -205,6 +192,43 @@ extern "C" {
#endif
/* Wolf Single Precision Math */
/* Optional ECC SECP256R1 acceleration using optimized C code */
#undef WOLFSSL_SP
#if 1
#define WOLFSSL_SP
#define WOLFSSL_SP_SMALL /* use smaller version of code (requires heap) */
#define SP_WORD_SIZE 32 /* force 32-bit type */
#define WOLFSSL_SP_MATH /* only SP math - eliminates fast math code */
//#define WOLFSSL_SP_DIV_32 /* do not use 64-bit divides */
#ifdef HAVE_ECC
#define WOLFSSL_HAVE_SP_ECC
#endif
#ifndef NO_RSA
#define WOLFSSL_HAVE_SP_RSA
#endif
#endif
/* Ed25519 / Curve25519 */
#undef HAVE_CURVE25519
#undef HAVE_ED25519
#if 1
#define HAVE_CURVE25519
#define HAVE_ED25519 /* ED25519 Requires SHA512 */
/* Optionally use small math (less flash usage, but much slower) */
#if 1
/* Curve and Ed 25519 small */
#define CURVED25519_SMALL
#endif
#endif
/* ------------------------------------------------------------------------- */
/* Symmetric Ciphers */
/* ------------------------------------------------------------------------- */
/* AES */
#undef NO_AES
#if 1
@ -230,7 +254,6 @@ extern "C" {
//#define HAVE_AESCCM
#endif
/* DES3 */
#undef NO_DES3
#if 0
@ -250,23 +273,9 @@ extern "C" {
#define HAVE_ONE_TIME_AUTH
#endif
/* Ed25519 / Curve25519 */
#undef HAVE_CURVE25519
#undef HAVE_ED25519
#if 1
#define HAVE_CURVE25519
#define HAVE_ED25519 /* ED25519 Requires SHA512 */
/* Optionally use small math (less flash usage, but much slower) */
#if 1
/* Curve and Ed 25519 small */
#define CURVED25519_SMALL
#endif
#endif
/* ------------------------------------------------------------------------- */
/* Hashing */
/* Symmetric Hashing */
/* ------------------------------------------------------------------------- */
/* Sha */
#undef NO_SHA
@ -320,6 +329,18 @@ extern "C" {
#define NO_MD5
#endif
/* Blake2B */
#undef HAVE_BLAKE2
#if 0
#define HAVE_BLAKE2
#endif
/* Blake2S */
#undef HAVE_BLAKE2S
#if 0
#define HAVE_BLAKE2S
#endif
/* HKDF */
#undef HAVE_HKDF
#if 0
@ -386,6 +407,7 @@ extern "C" {
#define XREALLOC(p, n, h, t) myRealloc(p, n, h, t)
#endif
/* Static memory */
#if 0
/* Static memory requires fast math */
#define WOLFSSL_STATIC_MEMORY
@ -423,9 +445,8 @@ extern "C" {
/* ------------------------------------------------------------------------- */
/* Override Current Time */
/* Allows custom "custom_time()" function to be used for benchmark */
#if defined(WOLFSSL_SIFIVE_RISC_V)
#define WOLFSSL_USER_CURRTIME
#define WOLFSSL_USER_CURRTIME /* for benchmarks, uses "custom_time()" function */
#define WOLFSSL_GMTIME
#define USER_TICKS
#else
@ -569,4 +590,3 @@ extern "C" {
#endif
#endif /* WOLFSSL_USER_SETTINGS_H */