Minor cleanups for the GCC ARM example. Fixed build with DH enabled. Changed random.h to always make sure CUSTOM_RAND_TYPE is defined. Added TLS13 option to reference user_settings.h.

This commit is contained in:
David Garske
2017-08-25 12:27:07 -07:00
parent 69b25ee508
commit 2d67f46247
5 changed files with 22 additions and 5 deletions

View File

@ -326,6 +326,11 @@ extern unsigned int custom_rand_generate(void);
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* Enable Features */ /* Enable Features */
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
#if 0
#undef WOLFSSL_TLS13
#define WOLFSSL_TLS13
#endif
#undef KEEP_PEER_CERT #undef KEEP_PEER_CERT
//#define KEEP_PEER_CERT //#define KEEP_PEER_CERT

View File

@ -31,6 +31,9 @@ LDFLAGS = $(ARCHFLAGS) -Wl,--gc-sections --specs=nano.specs --specs=nosys.specs
LDFLAGS += -Wl,-Map=$(BUILD_DIR)/$(BIN).map $(DBGFLAGS) LDFLAGS += -Wl,-Map=$(BUILD_DIR)/$(BIN).map $(DBGFLAGS)
LDFLAGS += -Wl,-ereset_handler LDFLAGS += -Wl,-ereset_handler
# Math lib for DH
LIBS = -lm
SRC_C += ./Source/armtarget.c SRC_C += ./Source/armtarget.c
SRC_C += $(wildcard ../../src/*.c ../../wolfcrypt/src/*.c ../../wolfcrypt/benchmark/*.c ../../wolfcrypt/test/*.c) SRC_C += $(wildcard ../../src/*.c ../../wolfcrypt/src/*.c ../../wolfcrypt/benchmark/*.c ../../wolfcrypt/test/*.c)
FILENAMES_C = $(notdir $(SRC_C)) FILENAMES_C = $(notdir $(SRC_C))
@ -69,7 +72,7 @@ $(BUILD_DIR)/%.o: %.c
$(BUILD_DIR)/$(BIN).elf: $(OBJS_ASM) $(OBJS_C) $(BUILD_DIR)/$(BIN).elf: $(OBJS_ASM) $(OBJS_C)
@echo "Linking ELF binary: $(notdir $@)" @echo "Linking ELF binary: $(notdir $@)"
$(CMD_ECHO) $(LD) $(LDFLAGS) -T$(SRC_LD) -o $@ $^ $(CMD_ECHO) $(LD) $(LDFLAGS) -T$(SRC_LD) -o $@ $^ $(LIBS)
@echo "Generating name list: $(BIN).sym" @echo "Generating name list: $(BIN).sym"
$(CMD_ECHO) $(NM) -n $@ > $(BUILD_DIR)/$(BIN).sym $(CMD_ECHO) $(NM) -n $@ > $(BUILD_DIR)/$(BIN).sym

View File

@ -4,8 +4,8 @@
* All library options are defined in `Header/user_settings.h`. * All library options are defined in `Header/user_settings.h`.
* The memory map is located in the linker file in `linker.ld`. * The memory map is located in the linker file in `linker.ld`.
* Entry point function is `reset_handler` in `retarget.c`. * Entry point function is `reset_handler` in `armtarget.c`.
* The RTC and RNG hardware interface needs implemented for real production applications in `retarget.c` * The RTC and RNG hardware interface needs implemented for real production applications in `armtarget.c`
## Building ## Building
@ -21,19 +21,26 @@ Example:
text data bss dec hex filename text data bss dec hex filename
39155 2508 60 41723 a2fb ./Build/WolfCryptBench.elf 39155 2508 60 41723 a2fb ./Build/WolfCryptBench.elf
text data bss dec hex filename
70368 464 36 70868 114d4 ./Build/WolfSSLClient.elf
``` ```
## Performace Tuning Options ## Performace Tuning Options
* `DEBUG_WOLFSSL`: Undefine this to disable debug logging. * `DEBUG_WOLFSSL`: Undefine this to disable debug logging.
* `NO_ERROR_STRINGS`: Disables error strings to save code space.
* `NO_INLINE`: Disabling inline function saves about 1KB, but is slower. * `NO_INLINE`: Disabling inline function saves about 1KB, but is slower.
* `WOLFSSL_SMALL_STACK`: Enables stack reduction techniques to allocate stack sections over 100 bytes from heap. * `WOLFSSL_SMALL_STACK`: Enables stack reduction techniques to allocate stack sections over 100 bytes from heap.
* `USE_FAST_MATH`: Uses stack based math, which is faster than the heap based math. * `USE_FAST_MATH`: Uses stack based math, which is faster than the heap based math.
* `ALT_ECC_SIZE`: If using fast math and RSA/DH you can define this to reduce your ECC memory consumption.
* `FP_MAX_BITS`: Is the maximum math size (key size * 2). Used only with `USE_FAST_MATH`.
* `ECC_TIMING_RESISTANT`: Enables timing resistance for ECC and uses slightly less memory.
* `ECC_SHAMIR`: Doubles heap usage, but slightly faster * `ECC_SHAMIR`: Doubles heap usage, but slightly faster
* `RSA_LOW_MEM`: Half as much memory but twice as slow. Uses Non-CRT method for private key. * `RSA_LOW_MEM`: Half as much memory but twice as slow. Uses Non-CRT method for private key.
AES GCM: `GCM_SMALL`, `GCM_WORD32` or `GCM_TABLE`: Tunes performance and flash/memory usage. AES GCM: `GCM_SMALL`, `GCM_WORD32` or `GCM_TABLE`: Tunes performance and flash/memory usage.
* `CURVED25519_SMALL`: Enables small versions of Ed/Curve (FE/GE math). * `CURVED25519_SMALL`: Enables small versions of Ed/Curve (FE/GE math).
* `USE_SLOW_SHA`: Enables smaller/slower version of SHA. * `USE_SLOW_SHA`: Enables smaller/slower version of SHA.
* `USE_SLOW_SHA2`: Over twice as small, but 50% slower * `USE_SLOW_SHA2`: Over twice as small, but 50% slower
* `FP_MAX_BITS`: Is the maximum math size (key size * 2). Used only with `USE_FAST_MATH`.
* `USE_CERT_BUFFERS_1024` or `USE_CERT_BUFFERS_2048`: Size of RSA certs / keys to test with. * `USE_CERT_BUFFERS_1024` or `USE_CERT_BUFFERS_2048`: Size of RSA certs / keys to test with.
* `BENCH_EMBEDDED`: Define this if using the wolfCrypt test/benchmark and using a low memory target.

View File

@ -20,6 +20,8 @@
*/ */
#include "user_settings.h" #include "user_settings.h"
#include <wolfssl/ssl.h>
#include <wolfssl/wolfcrypt/random.h> /* for CUSTOM_RAND_TYPE */
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>

View File

@ -50,7 +50,7 @@
#endif #endif
#if defined(CUSTOM_RAND_GENERATE) && !defined(CUSTOM_RAND_TYPE) #if !defined(CUSTOM_RAND_TYPE)
/* To maintain compatibility the default is byte */ /* To maintain compatibility the default is byte */
#define CUSTOM_RAND_TYPE byte #define CUSTOM_RAND_TYPE byte
#endif #endif