Skip to content

Commit

Permalink
apply 6.0.2 patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Larson committed Aug 14, 2020
1 parent 37046f8 commit fbd7df3
Show file tree
Hide file tree
Showing 104 changed files with 9,697 additions and 796 deletions.
7 changes: 7 additions & 0 deletions addons/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ set(SOURCES
# {{END_TARGET_SOURCES}}
)

# Append BSD file if the user wants it
if(NXD_ENABLE_FILE_BSD)
list(APPEND SOURCES
${CMAKE_CURRENT_LIST_DIR}/BSD/nxd_bsd.c
)
endif()

# Remove the file server files if the user doesn't want them
if(NOT NXD_ENABLE_FILE_SERVERS)
list(REMOVE_ITEM SOURCES
Expand Down
8 changes: 7 additions & 1 deletion addons/ftp/nxd_ftp_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -4832,7 +4832,7 @@ UINT status;
/* FUNCTION RELEASE */
/* */
/* _nx_ftp_client_active_transfer_setup PORTABLE C */
/* 6.0 */
/* 6.0.2 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
Expand Down Expand Up @@ -4877,6 +4877,9 @@ UINT status;
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 08-14-2020 Yuxin Zhou Modified comment(s), and */
/* fixed packet leak, */
/* resulting in version 6.0.2 */
/* */
/**************************************************************************/
UINT _nx_ftp_client_active_transfer_setup(NX_FTP_CLIENT *ftp_client_ptr, ULONG wait_option)
Expand Down Expand Up @@ -5132,6 +5135,9 @@ UINT ipduo_size;
return(NX_FTP_EXPECTED_2XX_CODE);
}

/* Release the packet. */
nx_packet_release(packet_ptr);

return(NX_SUCCESS);
}

Expand Down
2 changes: 1 addition & 1 deletion addons/pppoe/nx_pppoe_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,4 +349,4 @@ VOID _nx_pppoe_client_packet_deferred_receive(NX_PACKET *packet_ptr);
}
#endif

#endif /* NX_PPP_CLIENT_H */
#endif /* NX_PPPOE_CLIENT_H */
2 changes: 1 addition & 1 deletion addons/pppoe/nx_pppoe_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,4 +373,4 @@ VOID _nx_pppoe_server_packet_deferred_receive(NX_PACKET *packet_ptr);
}
#endif

#endif /* NX_PPP_SERVER_H */
#endif /* NX_PPPOE_SERVER_H */
7 changes: 5 additions & 2 deletions common/inc/nx_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/* APPLICATION INTERFACE DEFINITION RELEASE */
/* */
/* nx_api.h PORTABLE C */
/* 6.0.1 */
/* 6.0.2 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
Expand All @@ -49,6 +49,9 @@
/* ThreadX version check, */
/* updated product constants, */
/* resulting in version 6.0.1 */
/* 08-14-2020 Yuxin Zhou Modified comment(s), and */
/* updated product constants, */
/* resulting in version 6.0.2 */
/* */
/**************************************************************************/

Expand Down Expand Up @@ -456,7 +459,7 @@ VOID _nx_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, ULONG
#define AZURE_RTOS_NETXDUO
#define NETXDUO_MAJOR_VERSION 6
#define NETXDUO_MINOR_VERSION 0
#define NETXDUO_PATCH_VERSION 1
#define NETXDUO_PATCH_VERSION 2

/* Define the following symbols for backward compatibility */
#define EL_PRODUCT_NETXDUO
Expand Down
18 changes: 17 additions & 1 deletion common/src/nx_icmpv6_process_ra.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
/* FUNCTION RELEASE */
/* */
/* _nx_icmpv6_process_ra PORTABLE C */
/* 6.0 */
/* 6.0.2 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
Expand Down Expand Up @@ -76,6 +76,9 @@
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 08-14-2020 Yuxin Zhou Modified comment(s), improved */
/* option length verification, */
/* resulting in version 6.0.2 */
/* */
/**************************************************************************/
VOID _nx_icmpv6_process_ra(NX_IP *ip_ptr, NX_PACKET *packet_ptr)
Expand Down Expand Up @@ -237,6 +240,19 @@ UINT interface_index;
if (option_ptr -> nx_icmpv6_option_type == ICMPV6_OPTION_TYPE_PREFIX_INFO)
{

/* Validate packet length before cast to avoid OOB access. */
if (packet_length < (INT)sizeof(NX_ICMPV6_OPTION_PREFIX))
{
#ifndef NX_DISABLE_ICMP_INFO

/* Increment the ICMP invalid packet error. */
ip_ptr -> nx_ip_icmp_invalid_packets++;
#endif /* NX_DISABLE_ICMP_INFO */

_nx_packet_release(packet_ptr);
return;
}

/* Yes, set a local pointer to the option. */
/*lint -e{929} -e{826} -e{740} suppress cast of pointer to pointer, since it is necessary */
prefix_ptr = (NX_ICMPV6_OPTION_PREFIX *)option_ptr;
Expand Down
11 changes: 10 additions & 1 deletion common/src/nx_ipv6_process_fragment_option.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
/* FUNCTION RELEASE */
/* */
/* _nx_ipv6_process_fragment_option PORTABLE C */
/* 6.0 */
/* 6.0.2 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
Expand Down Expand Up @@ -77,6 +77,9 @@
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 08-14-2020 Yuxin Zhou Modified comment(s), improved */
/* packet length verification, */
/* resulting in version 6.0.2 */
/* */
/**************************************************************************/
UINT _nx_ipv6_process_fragment_option(NX_IP *ip_ptr, NX_PACKET *packet_ptr)
Expand All @@ -103,6 +106,12 @@ NX_IPV6_HEADER_FRAGMENT_OPTION *fragment_option;
return(NX_OPTION_HEADER_ERROR);
}

/* Check packet length is at least sizeof(NX_IPV6_HEADER_FRAGMENT_OPTION). */
if (packet_ptr -> nx_packet_length < sizeof(NX_IPV6_HEADER_FRAGMENT_OPTION))
{
return(NX_OPTION_HEADER_ERROR);
}

/* Set a pointer to the starting of the fragment option. */
/*lint -e{927} -e{826} suppress cast of pointer to pointer, since it is necessary */
fragment_option = (NX_IPV6_HEADER_FRAGMENT_OPTION *)packet_ptr -> nx_packet_prepend_ptr;
Expand Down
11 changes: 10 additions & 1 deletion common/src/nx_ipv6_process_routing_option.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
/* FUNCTION RELEASE */
/* */
/* _nx_ipv6_process_routing_option PORTABLE C */
/* 6.0 */
/* 6.0.2 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
Expand Down Expand Up @@ -70,6 +70,9 @@
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
/* 08-14-2020 Yuxin Zhou Modified comment(s), improved */
/* packet length verification, */
/* resulting in version 6.0.2 */
/* */
/**************************************************************************/
UINT _nx_ipv6_process_routing_option(NX_IP *ip_ptr, NX_PACKET *packet_ptr)
Expand All @@ -84,6 +87,12 @@ UINT base_offset;
/* Add debug information. */
NX_PACKET_DEBUG(__FILE__, __LINE__, packet_ptr);

/* Check packet length is at least sizeof(NX_IPV6_HEADER_ROUTING_OPTION). */
if (packet_ptr -> nx_packet_length < sizeof(NX_IPV6_HEADER_ROUTING_OPTION))
{
return(NX_OPTION_HEADER_ERROR);
}

/* Set a pointer to the routing header. */
/*lint -e{927} -e{826} suppress cast of pointer to pointer, since it is necessary */
option = (NX_IPV6_HEADER_ROUTING_OPTION *)(packet_ptr -> nx_packet_prepend_ptr);
Expand Down
7 changes: 5 additions & 2 deletions crypto_libraries/inc/nx_crypto_huge_number.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/* APPLICATION INTERFACE DEFINITION RELEASE */
/* */
/* nx_crypto_huge_number.h PORTABLE C */
/* 6.0 */
/* 6.0.2 */
/* AUTHOR */
/* */
/* Timothy Stapko, Microsoft Corporation */
Expand All @@ -41,6 +41,9 @@
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Timothy Stapko Initial Version 6.0 */
/* 08-14-2020 Timothy Stapko Modified comment(s), and */
/* fixed number initialization,*/
/* resulting in version 6.0.2 */
/* */
/**************************************************************************/

Expand Down Expand Up @@ -146,7 +149,7 @@ typedef struct NX_CRYPTO_HUGE_NUMBER_STRUCT
/* Initialize the buffer of huge number to variable between 0 and (HN_RADIX - 1). */
#define NX_CRYPTO_HUGE_NUMBER_INITIALIZE_DIGIT(hn, buff, val) \
(hn) -> nx_crypto_huge_number_data = (HN_UBASE *)(buff); \
(hn) -> nx_crypto_huge_buffer_size = sizeof(buff); \
(hn) -> nx_crypto_huge_buffer_size = sizeof(HN_UBASE); \
NX_CRYPTO_HUGE_NUMBER_SET_DIGIT(hn, val)

/* Copy huge number from src to dst. */
Expand Down
45 changes: 35 additions & 10 deletions crypto_libraries/src/nx_crypto_generic_ciphersuites.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
/* FUNCTION RELEASE */
/* */
/* nx_crypto_generic_ciphersuites PORTABLE C */
/* 6.0 */
/* 6.0.2 */
/* AUTHOR */
/* */
/* Timothy Stapko, Microsoft Corporation */
Expand Down Expand Up @@ -61,6 +61,10 @@
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Timothy Stapko Initial Version 6.0 */
/* 08-14-2020 Timothy Stapko Modified comment(s), added */
/* curves in the crypto array, */
/* added TLS ciphersuite entry,*/
/* resulting in version 6.0.2 */
/* */
/**************************************************************************/

Expand Down Expand Up @@ -336,6 +340,24 @@ const NX_CRYPTO_CIPHERSUITE nx_crypto_tls_rsa_with_aes_128_cbc_sha256 =
(NX_SECURE_TLS_BITFIELD_VERSIONS_PRE_1_3 | NX_SECURE_DTLS_BITFIELD_VERSIONS_PRE_1_3)
};

const NX_CRYPTO_CIPHERSUITE nx_crypto_tls_ecdhe_rsa_with_aes_128_cbc_sha256 =
/* TLS ciphersuite entry. */
{ TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, /* Ciphersuite ID. */
NX_SECURE_APPLICATION_TLS, /* Internal application label. */
16, /* Symmetric key size. */
{ /* Cipher role array. */
{NX_CRYPTO_KEY_EXCHANGE_ECDHE, NX_CRYPTO_ROLE_KEY_EXCHANGE},
{NX_CRYPTO_KEY_EXCHANGE_RSA, NX_CRYPTO_ROLE_SIGNATURE_CRYPTO},
{NX_CRYPTO_ENCRYPTION_AES_CBC, NX_CRYPTO_ROLE_SYMMETRIC},
{NX_CRYPTO_AUTHENTICATION_HMAC_SHA2_256, NX_CRYPTO_ROLE_MAC_HASH},
{NX_CRYPTO_HASH_SHA256, NX_CRYPTO_ROLE_RAW_HASH},
{NX_CRYPTO_HASH_HMAC, NX_CRYPTO_ROLE_HMAC},
{NX_CRYPTO_PRF_HMAC_SHA2_256, NX_CRYPTO_ROLE_PRF},
{NX_CRYPTO_NONE, NX_CRYPTO_ROLE_NONE}
},
/* TLS/DTLS Versions supported. */
(NX_SECURE_TLS_BITFIELD_VERSIONS_PRE_1_3 | NX_SECURE_DTLS_BITFIELD_VERSIONS_PRE_1_3)
};

const NX_CRYPTO_CIPHERSUITE nx_crypto_tls_ecdhe_rsa_with_aes_128_gcm_sha256 =
/* TLS ciphersuite entry. */
Expand Down Expand Up @@ -554,17 +576,17 @@ const NX_CRYPTO_METHOD *supported_crypto[] =
&crypto_method_none,
&crypto_method_rsa,
&crypto_method_pkcs1,
&crypto_method_ecdhe,
&crypto_method_ecdhe,
&crypto_method_ecdsa,
&crypto_method_aes_ccm_8,
&crypto_method_aes_cbc_128,
&crypto_method_aes_cbc_256,
&crypto_method_aes_128_gcm_16,
&crypto_method_aes_256_gcm_16,
&crypto_method_aes_ccm_8,
&crypto_method_aes_cbc_128,
&crypto_method_aes_cbc_256,
&crypto_method_aes_128_gcm_16,
&crypto_method_aes_256_gcm_16,
&crypto_method_hmac,
&crypto_method_hmac_md5,
&crypto_method_hmac_sha1,
&crypto_method_hmac_sha256,
&crypto_method_hmac_md5,
&crypto_method_hmac_sha1,
&crypto_method_hmac_sha256,
&crypto_method_md5,
&crypto_method_sha1,
&crypto_method_sha224,
Expand All @@ -574,6 +596,9 @@ const NX_CRYPTO_METHOD *supported_crypto[] =
&crypto_method_tls_prf_1,
&crypto_method_tls_prf_sha256,
&crypto_method_hkdf,
&crypto_method_ec_secp256,
&crypto_method_ec_secp384,
&crypto_method_ec_secp521,
};

const UINT supported_crypto_size = sizeof(supported_crypto) / sizeof(NX_CRYPTO_METHOD*);
Expand Down
7 changes: 5 additions & 2 deletions crypto_libraries/src/nx_crypto_huge_number.c
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ UINT i, j;
/* FUNCTION RELEASE */
/* */
/* _nx_crypto_huge_number_modulus PORTABLE C */
/* 6.0 */
/* 6.0.2 */
/* AUTHOR */
/* */
/* Timothy Stapko, Microsoft Corporation */
Expand Down Expand Up @@ -1377,6 +1377,9 @@ UINT i, j;
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Timothy Stapko Initial Version 6.0 */
/* 08-14-2020 Timothy Stapko Modified comment(s), and */
/* fixed variable type issue, */
/* resulting in version 6.0.2 */
/* */
/**************************************************************************/
NX_CRYPTO_KEEP VOID _nx_crypto_huge_number_modulus(NX_CRYPTO_HUGE_NUMBER *dividend, NX_CRYPTO_HUGE_NUMBER *divisor)
Expand Down Expand Up @@ -1476,7 +1479,7 @@ NX_CRYPTO_HUGE_NUMBER *result;
}
else
{
scale = (dividend_msb / divisor_msb) << (HN_SHIFT >> 1);
scale = ((HN_UBASE2)(dividend_msb / divisor_msb)) << (HN_SHIFT >> 1);
}
}
else if (shift)
Expand Down
1 change: 1 addition & 0 deletions nx_secure/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ target_sources(${PROJECT_NAME}
${CMAKE_CURRENT_LIST_DIR}/src/nx_secure_tls_metadata_size_calculate.c
${CMAKE_CURRENT_LIST_DIR}/src/nx_secure_tls_newest_supported_version.c
${CMAKE_CURRENT_LIST_DIR}/src/nx_secure_tls_packet_allocate.c
${CMAKE_CURRENT_LIST_DIR}/src/nx_secure_tls_packet_release.c
${CMAKE_CURRENT_LIST_DIR}/src/nx_secure_tls_process_certificate_request.c
${CMAKE_CURRENT_LIST_DIR}/src/nx_secure_tls_process_certificate_verify.c
${CMAKE_CURRENT_LIST_DIR}/src/nx_secure_tls_process_changecipherspec.c
Expand Down
Loading

0 comments on commit fbd7df3

Please sign in to comment.