Skip to content

Commit ea9c961

Browse files
committed
Fixed V1.1.4
Support SHA384 and SHA256
1 parent 06a72d9 commit ea9c961

File tree

5 files changed

+31
-17
lines changed

5 files changed

+31
-17
lines changed

CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ add_definitions(-DPICO_FLASH_SPI_CLKDIV=4)
109109
add_definitions(-DPICO_DEFAULT_UART_BAUD_RATE=921600)
110110

111111
# Set compile options
112-
add_compile_options(
113-
-Wall
114-
-Wno-format # int != int32_t as far as the compiler is concerned because gcc has int32_t as long int
115-
-Wno-unused-function # we have some for the docs that aren't called
116-
-Wno-maybe-uninitialized
117-
-O3
118-
)
112+
#add_compile_options(
113+
# -Wall
114+
# -Wno-format # int != int32_t as far as the compiler is concerned because gcc has int32_t as long int
115+
# -Wno-unused-function # we have some for the docs that aren't called
116+
# -Wno-maybe-uninitialized
117+
# -O3
118+
# )
119119

120120
add_subdirectory(main)
121121
# Add libraries in subdirectories

port/app/configuration/inc/common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/* Application Firmware Version */
1010
#define MAJOR_VER 1
1111
#define MINOR_VER 1
12-
#define MAINTENANCE_VER 3
12+
#define MAINTENANCE_VER 4
1313

1414
#define DEV_CONFIG_VER 103
1515

port/app/mbedtls/inc/SSLConfig.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
#define _CRT_SECURE_NO_DEPRECATE 1
3737
#endif
3838

39+
//#define MBEDTLS_DEBUG_C
40+
//#define MBEDTLS_DEBUG_LEVEL 4
41+
//#define MBEDTLS_ERROR_C
42+
3943
#define MBEDTLS_HAVE_ASM
4044
#define MBEDTLS_CIPHER_MODE_CBC
4145
#define MBEDTLS_REMOVE_ARC4_CIPHERSUITES
@@ -79,6 +83,8 @@
7983
#define MBEDTLS_ECP_C
8084
#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
8185
#define MBEDTLS_SHA256_C
86+
#define MBEDTLS_SHA384_C
87+
#define MBEDTLS_SHA512_C
8288

8389
#define MBEDTLS_SSL_CLI_C
8490
#define MBEDTLS_SSL_TLS_C

port/app/mbedtls/src/SSLInterface.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,13 @@ int wiz_tls_init(wiz_tls_context* tlsContext, int* socket_fd)
121121
mbedtls_x509_crt_init(tlsContext->cacert);
122122
mbedtls_x509_crt_init(tlsContext->clicert);
123123
mbedtls_pk_init(tlsContext->pkey);
124-
124+
const int *ciphersuite_list = mbedtls_ssl_list_ciphersuites();
125+
while (*ciphersuite_list != 0) {
126+
const char *name = mbedtls_ssl_get_ciphersuite_name(*ciphersuite_list);
127+
if (name != NULL)
128+
PRT_SSL("%s\r\n", name);
129+
ciphersuite_list++;
130+
}
125131
/*
126132
Initialize certificates
127133
*/
@@ -316,6 +322,9 @@ int wiz_tls_socket_connect(wiz_tls_context* tlsContext, char * addr, unsigned in
316322
int ret;
317323
uint8_t sock = (uint8_t)(tlsContext->socket_fd);
318324

325+
#if defined(MBEDTLS_ERROR_C)
326+
char error_buf[1024];
327+
#endif
319328
/*socket open*/
320329
ret = socket(sock, Sn_MR_TCP, 0, 0x00);
321330
if(ret != sock)
@@ -335,9 +344,9 @@ int wiz_tls_socket_connect(wiz_tls_context* tlsContext, char * addr, unsigned in
335344
if( ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE )
336345
{
337346
#if defined(MBEDTLS_ERROR_C)
338-
memset(tempBuf, 0, 1024);
339-
mbedtls_strerror(ret, (char *) tempBuf, DEBUG_BUFFER_SIZE );
340-
printf( " failed\n\r ! mbedtls_ssl_handshake returned %d: %s\n\r", ret, tempBuf );
347+
memset(error_buf, 0, 1024);
348+
mbedtls_strerror(ret, (char *) error_buf, DEBUG_BUFFER_SIZE );
349+
printf( " failed\n\r ! mbedtls_ssl_handshake returned %d: %s\n\r", ret, error_buf );
341350
#endif
342351
return( -1 );
343352
}

port/app/serial_to_ethernet/src/seg.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,10 +458,11 @@ void proc_SEG_tcp_client_over_tls(uint8_t sock)
458458
(char *)network_connection->remote_ip,
459459
(unsigned int)network_connection->remote_port);
460460

461-
reg_val = (SIK_CONNECTED | SIK_DISCONNECTED | SIK_RECEIVED | SIK_TIMEOUT) & 0x00FF;
462-
ctlsocket(sock, CS_CLR_INTERRUPT, (void *)&reg_val);
463461
#if 1
464-
reg_val = (SIK_CONNECTED | SIK_DISCONNECTED | SIK_RECEIVED | SIK_TIMEOUT) & 0x00FF; // except SIK_SENT(send OK) interrupt
462+
reg_val = SIK_RECEIVED & 0x00FF;
463+
ctlsocket(sock, CS_CLR_INTERRUPT, (void *)&reg_val);
464+
465+
reg_val = SIK_RECEIVED & 0x00FF; // except SIK_SENT(send OK) interrupt
465466
ctlsocket(sock, CS_SET_INTMASK, (void *)&reg_val);
466467

467468
ctlwizchip(CW_GET_INTRMASK, (void *)&reg_val);
@@ -724,7 +725,6 @@ void proc_SEG_mqtt_client(uint8_t sock)
724725
first_established = 0;
725726
}
726727
mqtt_transport_yield(&g_mqtt_config);
727-
vTaskDelay(1);
728728
break;
729729

730730
case SOCK_CLOSE_WAIT:
@@ -927,7 +927,6 @@ void proc_SEG_mqtts_client(uint8_t sock)
927927
first_established = 0;
928928
}
929929
mqtt_transport_yield(&g_mqtt_config);
930-
vTaskDelay(1);
931930
break;
932931

933932
case SOCK_CLOSE_WAIT:

0 commit comments

Comments
 (0)