mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
Add Make file and fix identation
This commit is contained in:
72
IDE/iotsafe-raspberrypi/Makefile
Normal file
72
IDE/iotsafe-raspberrypi/Makefile
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
CFLAGS := -g -ggdb -Wall -Wextra -std=c11
|
||||||
|
CINCS := -I. -I/usr/local/wolfssl
|
||||||
|
CLIBS := -L/usr/local/lib
|
||||||
|
CDEPS := -lc -lg -lm -lwolfssl
|
||||||
|
|
||||||
|
ENABLE_DEBUG_UART_IO := off
|
||||||
|
ENABLE_DEBUG_UART_IO_EXTRA := off
|
||||||
|
ENABLE_SECRET_CALLBACK := off
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_DEBUG_UART_IO), on)
|
||||||
|
CFLAGS+=-DDEBUG_UART_IO
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_DEBUG_UART_IO_EXTRA), on)
|
||||||
|
CFLAGS+=-DDEBUG_UART_IO -DDEBUG_UART_IO_EXTRA_VERBOSE
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_SECRET_CALLBACK), on)
|
||||||
|
CFLAGS+=-DUSE_SECRET_CALLBACK
|
||||||
|
endif
|
||||||
|
|
||||||
|
OBJS:=main.o client-tls13.o
|
||||||
|
|
||||||
|
.PHONY: all clean help
|
||||||
|
|
||||||
|
define run-help =
|
||||||
|
echo "Run 'make TARGET* OPTION*'"
|
||||||
|
echo ""
|
||||||
|
echo "TARGET (specify 0 or more):"
|
||||||
|
echo " all (default target)"
|
||||||
|
echo " Build main.bin executable"
|
||||||
|
echo " main.bin"
|
||||||
|
echo " Build main.bin executable"
|
||||||
|
echo " main.o"
|
||||||
|
echo " Build main.o"
|
||||||
|
echo " client-tls13.o"
|
||||||
|
echo " Build client-tls13.o"
|
||||||
|
echo " clean"
|
||||||
|
echo " Clean *.o and *.bin"
|
||||||
|
echo " help"
|
||||||
|
echo " This help"
|
||||||
|
echo ""
|
||||||
|
echo "OPTION (specify 0 or more):"
|
||||||
|
echo " ENABLE_DEBUG_UART_IO=on|off (default off)"
|
||||||
|
echo " Enable printing ASCII characters sent and received by the UART"
|
||||||
|
echo " ENABLE_DEBUG_UART_IO_EXTRA=on|off (default off)"
|
||||||
|
echo " Enable more printing hex characters sent and received by the UART"
|
||||||
|
echo " Setting this on implicitly sets ENABLE_DEBUG_UART_IO=on"
|
||||||
|
echo " ENABLE_SECRET_CALLBACK=on|off (default off)"
|
||||||
|
echo " Enable secret callback for TLS 1.3 handshaking, which can be useful for wireshark sniffing"
|
||||||
|
echo ""
|
||||||
|
echo "Example:"
|
||||||
|
echo " make all ENABLE_DEBUG_UART_IO_EXTRA=on"
|
||||||
|
echo ""
|
||||||
|
endef
|
||||||
|
|
||||||
|
help:
|
||||||
|
@$(run-help)
|
||||||
|
|
||||||
|
all: main.bin
|
||||||
|
|
||||||
|
main.bin: $(OBJS)
|
||||||
|
$(CC) $(CFLAGS) $(CINCS) $(CLIBS) -o $@ $^ $(CDEPS)
|
||||||
|
|
||||||
|
main.o: main.c
|
||||||
|
$(CC) $(CFLAGS) $(CINCS) $(CLIBS) -c -o $@ $^ $(CDEPS)
|
||||||
|
|
||||||
|
client-tls13.o: client-tls13.c
|
||||||
|
$(CC) $(CFLAGS) $(CINCS) $(CLIBS) -c -o $@ $^ $(CDEPS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o *.bin
|
@ -727,31 +727,32 @@ static int iotsafe_hkdf_extract(byte* prk, const byte* salt, word32 saltLen,
|
|||||||
char *resp;
|
char *resp;
|
||||||
uint16_t hash_algo = 0;
|
uint16_t hash_algo = 0;
|
||||||
int len;
|
int len;
|
||||||
|
uint16_t hash_algo_be = 0;
|
||||||
|
|
||||||
WOLFSSL_MSG("Enter iotsafe_hkdf_extract");
|
WOLFSSL_MSG("Enter iotsafe_hkdf_extract");
|
||||||
switch (digest) {
|
switch (digest) {
|
||||||
#ifndef NO_SHA256
|
#ifndef NO_SHA256
|
||||||
case WC_SHA256:
|
case WC_SHA256:
|
||||||
hash_algo = (uint16_t)1;
|
hash_algo = (uint16_t)1;
|
||||||
if (ikmLen == 0) {
|
if (ikmLen == 0) {
|
||||||
len = WC_SHA256_DIGEST_SIZE;
|
len = WC_SHA256_DIGEST_SIZE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef WOLFSSL_SHA384
|
#ifdef WOLFSSL_SHA384
|
||||||
case WC_SHA384:
|
case WC_SHA384:
|
||||||
hash_algo = (uint16_t)2;
|
hash_algo = (uint16_t)2;
|
||||||
if (ikmLen == 0) {
|
if (ikmLen == 0) {
|
||||||
len = WC_SHA384_DIGEST_SIZE;
|
len = WC_SHA384_DIGEST_SIZE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef WOLFSSL_TLS13_SHA512
|
#ifdef WOLFSSL_TLS13_SHA512
|
||||||
case WC_SHA512:
|
case WC_SHA512:
|
||||||
hash_algo = (uint16_t)4;
|
hash_algo = (uint16_t)4;
|
||||||
if (ikmLen == 0) {
|
if (ikmLen == 0) {
|
||||||
len = WC_SHA512_DIGEST_SIZE;
|
len = WC_SHA512_DIGEST_SIZE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
@ -777,7 +778,7 @@ static int iotsafe_hkdf_extract(byte* prk, const byte* salt, word32 saltLen,
|
|||||||
printf("\nhash: %d\n", digest);
|
printf("\nhash: %d\n", digest);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint16_t hash_algo_be = XHTONS(hash_algo);
|
hash_algo_be = XHTONS(hash_algo);
|
||||||
|
|
||||||
iotsafe_cmd_start(csim_cmd, IOTSAFE_CLASS, IOTSAFE_INS_HKDF_EXTRACT, 0, 0);
|
iotsafe_cmd_start(csim_cmd, IOTSAFE_CLASS, IOTSAFE_INS_HKDF_EXTRACT, 0, 0);
|
||||||
iotsafe_cmd_add_tlv(csim_cmd, IOTSAFE_TAG_SECRET, ikmLen, ikm);
|
iotsafe_cmd_add_tlv(csim_cmd, IOTSAFE_TAG_SECRET, ikmLen, ikm);
|
||||||
|
Reference in New Issue
Block a user