Skip to content

Commit d00ea7d

Browse files
author
Jamie Smith
authored
Merge pull request #29 from mbed-ce/upstream-fixes
Merge latest fixes in from upstream (Apr through June)
2 parents ee41930 + 2a7efd8 commit d00ea7d

File tree

29 files changed

+484
-195
lines changed

29 files changed

+484
-195
lines changed

.github/workflows/basic_checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
This workflow performs the checks like license check,
1+
# This workflow performs the checks like license check,
22
# doxygen, unit tests etc.
33
name: Basic Checks
44

connectivity/FEATURE_BLE/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,19 @@ This is the Github repository for the `BLE_API`. Please see the [Mbed OS Example
88
* [Mbed OS example BLE GitHub repo](https://github.com/ARMmbed/mbed-os-example-ble) for all Mbed OS BLE examples.
99
* [Mbed OS BLE introduction](https://os.mbed.com/docs/latest/apis/ble.html) for an introduction to Mbed BLE.
1010
* [Mbed OS BLE API page](https://os.mbed.com/docs/latest/apis/bluetooth.html) for the Mbed BLE API documentation.
11+
12+
## Privacy notice
13+
14+
The Cordio Bluetooth stack only stores one single signing key. This key is then
15+
shared across all bonded devices. If a malicious device bonds with the Mbed OS
16+
application it then gains knowledge of the shared signing key of the Mbed OS device.
17+
The malicious device can then track the Mbed OS device whenever a signing write
18+
is issued from it.
19+
20+
To overcome this privacy issue do not issue signed writes from the Mbed OS device.
21+
A signed write occurs when the member function `write` of `GattClient` is called
22+
with its `cmd` argument set to `GATT_OP_SIGNED_WRITE_CMD`.
23+
24+
Instead of using signed writes, enable encryption on the connection. This is achieved
25+
by calling the function `setLinkEncryption` of the `SecurityManager`. Set the encryption
26+
to at least `ENCRYPTED`.

connectivity/cellular/include/cellular/framework/AT/AT_CellularDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class AT_CellularDevice : public CellularDevice {
6767
};
6868

6969
public:
70-
AT_CellularDevice(FileHandle *fh);
70+
AT_CellularDevice(FileHandle *fh, char *delim = "\r");
7171
virtual ~AT_CellularDevice();
7272

7373
virtual nsapi_error_t clear();

connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ using namespace std::chrono_literals;
3939
#define DEFAULT_AT_TIMEOUT 1s // at default timeout
4040
const int MAX_SIM_RESPONSE_LENGTH = 16;
4141

42-
AT_CellularDevice::AT_CellularDevice(FileHandle *fh) :
42+
AT_CellularDevice::AT_CellularDevice(FileHandle *fh, char *delim):
4343
CellularDevice(),
44-
_at(fh, _queue, DEFAULT_AT_TIMEOUT, "\r"),
44+
_at(fh, _queue, DEFAULT_AT_TIMEOUT, delim),
4545
#if MBED_CONF_CELLULAR_USE_SMS
4646
_sms(0),
4747
#endif // MBED_CONF_CELLULAR_USE_SMS

connectivity/cellular/tests/UNITTESTS/doubles/AT_CellularDevice_stub.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ bool AT_CellularDevice_stub::pin_needed = false;
3333
bool AT_CellularDevice_stub::supported_bool = false;
3434
int AT_CellularDevice_stub::max_sock_value = 1;
3535

36-
AT_CellularDevice::AT_CellularDevice(FileHandle *fh) :
36+
AT_CellularDevice::AT_CellularDevice(FileHandle *fh, char *delim) :
3737
CellularDevice(),
38-
_at(fh, _queue, get_property(AT_CellularDevice::PROPERTY_AT_SEND_DELAY), "\r"),
38+
_at(fh, _queue, get_property(AT_CellularDevice::PROPERTY_AT_SEND_DELAY), delim),
3939
#if MBED_CONF_CELLULAR_USE_SMS
4040
_sms(0),
4141
#endif // MBED_CONF_CELLULAR_USE_SMS

connectivity/drivers/emac/TARGET_ARM_SSG/COMPONENT_SMSC9220/smsc9220_emac.cpp

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,13 @@ emac_mem_buf_t *SMSC9220_EMAC::low_level_input()
8989
message_length -= CRC_LENGTH_BYTES;
9090
}
9191
92-
p = _memory_manager->alloc_heap(SMSC9220_ETH_MAX_FRAME_SIZE,
92+
p = _memory_manager->alloc_heap(message_length,
9393
SMSC9220_BUFF_ALIGNMENT);
9494
9595
if (p != NULL) {
9696
_RXLockMutex.lock();
97-
received_bytes = smsc9220_receive_by_chunks(dev,
98-
(char*)_memory_manager->get_ptr(p),
99-
_memory_manager->get_len(p));
97+
received_bytes = smsc9220_receive_packet(dev,
98+
_memory_manager->get_ptr(p));
10099
if(received_bytes == 0){
101100
_memory_manager->free(p);
102101
p = nullptr;
@@ -148,7 +147,6 @@ bool SMSC9220_EMAC::link_out(emac_mem_buf_t *buf)
148147
if(buf == NULL) {
149148
return false;
150149
} else {
151-
uint32_t buffer_chain_length = 0;
152150
enum smsc9220_error_t error = SMSC9220_ERROR_NONE;
153151
/* If buffer is chained or not aligned then
154152
* make a contiguous aligned copy of it */
@@ -170,16 +168,12 @@ bool SMSC9220_EMAC::link_out(emac_mem_buf_t *buf)
170168
buf = copy_buf;
171169
}
172170
173-
buffer_chain_length = _memory_manager->get_total_len(buf);
174-
175171
_TXLockMutex.lock();
176-
error = smsc9220_send_by_chunks(dev,
177-
buffer_chain_length,
178-
true,
179-
(const char*)_memory_manager->get_ptr(buf),
172+
error = smsc9220_send_packet(dev,
173+
_memory_manager->get_ptr(buf),
180174
_memory_manager->get_len(buf));
181175
_memory_manager->free(buf);
182-
_TXLockMutex.unlock();
176+
_TXLockMutex.unlock();
183177
return (error == SMSC9220_ERROR_NONE);
184178
}
185179
}
@@ -211,7 +205,7 @@ bool SMSC9220_EMAC::power_up()
211205
this));
212206
213207
/* Initialize the hardware */
214-
enum smsc9220_error_t init_successful = smsc9220_init(dev, &ThisThread::sleep_for);
208+
enum smsc9220_error_t init_successful = smsc9220_init(dev, &thread_sleep_for);
215209
if (init_successful != SMSC9220_ERROR_NONE) {
216210
return false;
217211
}
@@ -237,7 +231,7 @@ bool SMSC9220_EMAC::power_up()
237231
&SMSC9220_EMAC::link_status_task));
238232
239233
/* Allow the Link Status task to detect the initial link state */
240-
ThisThread::sleep_for(10);
234+
ThisThread::sleep_for(10ms);
241235
_link_status_task_handle = mbed::mbed_event_queue()->call_every(
242236
LINK_STATUS_TASK_PERIOD_MS,
243237
mbed::callback(this,

connectivity/drivers/emac/TARGET_ARM_SSG/COMPONENT_SMSC9220/smsc9220_emac_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#define FLAG_RX 1U
3737
#define LINK_STATUS_THREAD_PRIORITY (osPriorityNormal)
3838
#define LINK_STATUS_THREAD_STACKSIZE 512U
39-
#define LINK_STATUS_TASK_PERIOD_MS 200U
39+
#define LINK_STATUS_TASK_PERIOD_MS 200ms
4040
#define PHY_STATE_LINK_DOWN false
4141
#define PHY_STATE_LINK_UP true
4242
#define CRC_LENGTH_BYTES 4U

connectivity/drivers/mbedtls/TARGET_NUVOTON/TARGET_M480/des/des_alt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ static int mbedtls_des_docrypt(uint16_t keyopt, uint8_t key[3][MBEDTLS_DES_KEY_S
375375
* 1. BE for byte sequence in word
376376
* 2. BE for word sequence in double-word
377377
*/
378-
TDES_Open(CRPT
378+
TDES_Open(CRPT,
379379
0, // Channel number (0~4)
380380
enc, // 0: decode, 1: encode
381381
(tdes_opmode & CRPT_TDES_CTL_TMODE_Msk) ? 1 : 0, // 0: DES, 1: TDES

connectivity/drivers/mbedtls/TARGET_NUVOTON/TARGET_M480/ecp/ecp_internal_alt.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,11 @@ NU_STATIC int internal_run_eccop(const mbedtls_ecp_group *grp,
502502
return MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED;
503503
}
504504

505+
/* NOTE: Engine doesn't support P + Q when P and Q are the same. Workaround by 2*P */
506+
if (mbedtls_ecp_point_cmp(P, Q) == 0) {
507+
return internal_run_eccop(grp, R, NULL, P, NULL, NULL, ECCOP_POINT_DOUBLE);
508+
}
509+
505510
int ret;
506511
bool ecc_done;
507512

connectivity/lwipstack/lwip/src/apps/lwiperf/lwip_lwiperf.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ lwiperf_tcp_close(lwiperf_state_tcp_t *conn, enum lwiperf_report_type report_typ
263263
/* don't want to wait for free memory here... */
264264
tcp_abort(conn->conn_pcb);
265265
}
266-
} else {
266+
} else if (conn->server_pcb != NULL) {
267267
/* no conn pcb, this is the listener pcb */
268268
err = tcp_close(conn->server_pcb);
269269
LWIP_ASSERT("error", err == ERR_OK);
@@ -565,6 +565,11 @@ lwiperf_tcp_err(void *arg, err_t err)
565565
{
566566
lwiperf_state_tcp_t *conn = (lwiperf_state_tcp_t *)arg;
567567
LWIP_UNUSED_ARG(err);
568+
569+
/* pcb is already deallocated, prevent double-free */
570+
conn->conn_pcb = NULL;
571+
conn->server_pcb = NULL;
572+
568573
lwiperf_tcp_close(conn, LWIPERF_TCP_ABORTED_REMOTE);
569574
}
570575

0 commit comments

Comments
 (0)