diff --git a/IDE/iotsafe-raspberrypi/Makefile b/IDE/iotsafe-raspberrypi/Makefile index d26af05ae..12faf7317 100644 --- a/IDE/iotsafe-raspberrypi/Makefile +++ b/IDE/iotsafe-raspberrypi/Makefile @@ -24,7 +24,8 @@ endif OBJS:=$(WOLFSSL_BUILD)/main.o $(WOLFSSL_BUILD)/client-tls13.o -.PHONY: all clean help +default: all + .PHONY: all clean help define run-help = echo "Run 'make TARGET* OPTION*'" diff --git a/IDE/iotsafe-raspberrypi/client-tls13.c b/IDE/iotsafe-raspberrypi/client-tls13.c index 83a0ec419..3b1f7b874 100644 --- a/IDE/iotsafe-raspberrypi/client-tls13.c +++ b/IDE/iotsafe-raspberrypi/client-tls13.c @@ -1,6 +1,6 @@ /* client-tls13.c * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. (formerly known as CyaSSL) * @@ -20,33 +20,24 @@ */ /* C Standard Library */ - #include #include #include #include - - /* POSIX Library */ - #include #include #include #include - - /* wolfSSL Library */ - #include #include #include #include #include - - /* IoTSAFE Certificate slots */ /* File Slot '02' is pre-provisioned with @@ -84,21 +75,16 @@ #define PEER_CERT_ID 0x05 - /* Function Declarations */ - -extern int client_loop(const char *peer_ip, const char *peer_name, const char *peer_port, const char *temperature); - +extern int client_loop(const char *peer_ip, const char *peer_name, + const char *peer_port, const char *temperature); #if defined(USE_SECRET_CALLBACK) - -static int Tls13SecretCallback(WOLFSSL* ssl, int id, const unsigned char* secret, int secretSz, void* ctx); - +static int Tls13SecretCallback(WOLFSSL* ssl, int id, const unsigned char* secret, + int secretSz, void* ctx); #endif - /* Function Definitions */ - #if defined(USE_SECRET_CALLBACK) #ifndef WOLFSSL_SSLKEYLOGFILE_OUTPUT @@ -157,12 +143,10 @@ static int Tls13SecretCallback(WOLFSSL* ssl, int id, const unsigned char* secret return 0; } - #endif /* USE_SECRET_CALLBACK */ - - -int client_loop(const char *peer_ip, const char *peer_name, const char *peer_port, const char *temperature) +int client_loop(const char *peer_ip, const char *peer_name, + const char *peer_port, const char *temperature) { int ret = 0; diff --git a/IDE/iotsafe-raspberrypi/main.c b/IDE/iotsafe-raspberrypi/main.c index b0a6b73a4..6c2e308dd 100644 --- a/IDE/iotsafe-raspberrypi/main.c +++ b/IDE/iotsafe-raspberrypi/main.c @@ -1,6 +1,6 @@ /* main.c * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. (formerly known as CyaSSL) * @@ -24,15 +24,11 @@ */ /* C Standard Library */ - #include #include #include - - /* POSIX Library */ - #include #include #include @@ -40,40 +36,32 @@ #include #include - - /* wolfSSL Library */ - #include #include #include #include #include - - /* Variable Declarations */ - static int serial_fd = -1; /* Function Declarations */ - -extern int client_loop(const char *peer_ip, const char *peer_name, const char *peer_port, const char *temperature); - +extern int client_loop(const char *peer_ip, const char *peer_name, + const char *peer_port, const char *temperature); +#ifdef DEBUG_UART_IO static void print_buffer_hex(const char *buf, int len); static void print_buffer_char(const char *buf, int len); - +#endif static int usart_init(const char *dev_name, int *fd); static int usart_clean(int fd); static int usart_read(char *buf, int len); static int usart_write(const char *buf, int len); - static void show_usage(const char *program); - /* Function Definitions */ - +#ifdef DEBUG_UART_IO static void print_buffer_hex(const char *buf, int len) { for (int i = 0; i < len; i++) @@ -85,6 +73,7 @@ static void print_buffer_char(const char *buf, int len) for (int i = 0; i < len; i++) printf("%c", *(buf++)); } +#endif static int usart_init(const char *dev_name, int *fd) { @@ -131,23 +120,20 @@ static int usart_read(char *buf, int len) int ret = 0; int i = 0; - char c; + char c; memset(buf, 0, len); - - /* Read 1 byte at one time until *buf is full or a POSIX read error like timeout occurs. */ + /* Read 1 byte at one time until *buf is full or a POSIX read error like + * timeout occurs. */ do { ret = read(serial_fd, &c, 1U); - if (ret > 0) - { + if (ret > 0) { buf[i++] = c; if (c == '\n') break; } } while (i < len && ret > 0); - - #ifdef DEBUG_UART_IO printf("UART Read Actual : %d bytes\n", i); @@ -196,7 +182,8 @@ static int usart_write(const char *buf, int len) static void show_usage(const char *program) { printf("\nUsage:\n"); - printf("\t%s -ip SERVER_IP_ADDRESS -h SERVER_HOST_NAME -p PORT_NUMBER -t TEMPERATURE -d DEVICE_FILE_PATH\n", program); + printf("\t%s -ip SERVER_IP_ADDRESS -h SERVER_HOST_NAME -p PORT_NUMBER " + "-t TEMPERATURE -d DEVICE_FILE_PATH\n", program); printf("\n"); printf("\t-ip \n"); printf("\t-h \n"); diff --git a/wolfcrypt/src/port/iotsafe/iotsafe.c b/wolfcrypt/src/port/iotsafe/iotsafe.c index 3b1147a06..d778ae164 100644 --- a/wolfcrypt/src/port/iotsafe/iotsafe.c +++ b/wolfcrypt/src/port/iotsafe/iotsafe.c @@ -1,6 +1,6 @@ /* iotsafe.c * - * Copyright (C) 2006-2021 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. * @@ -241,7 +241,7 @@ static int iotsafe_cmd_add_tlv_ex(char *cmd, byte tag, uint16_t len, char *len_csim_str = (cmd + AT_CSIM_CMD_SIZE - 5); word32 cmdlen; - cmdlen = XSTRLEN(cmd); + cmdlen = (word32)XSTRLEN(cmd); if (cmdlen < AT_CSIM_CMD_SIZE) { return BAD_FUNC_ARG; }