Skip to content

Commit e502936

Browse files
committed
mbed-cloud-client 1.3.3
1 parent d37a136 commit e502936

File tree

43 files changed

+1289
-419
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1289
-419
lines changed

CHANGELOG.md

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
11
## Changelog for Mbed Cloud Client
22

3-
### Release R1.3.2 (22.05.2018)
3+
### Release 1.3.3 (11.06.2018)
4+
5+
#### Mbed Cloud Client
6+
7+
* Fixed issue: Wrong CoAP ping message. CoAP ping must be sent as an empty confirmable message.
8+
* In the previous versions, the client in queue mode went to sleep while in reconnection mode. Now, it completes the connection before going to sleep.
9+
* This version of Cloud Client supports Mbed OS 5.8.5 and onwards patch releases.
10+
11+
#### Factory configurator client
12+
13+
* Full support for the `device generated keys` mode. You can activate the mode using the factory configurator utility (FCU) or the KCM APIs.
14+
15+
<span class="notes">**Note:** Cloud Client and Mbed Cloud do not yet support this mode.</span>
16+
* A certificate signed request (CSR) that is generated on the device, can be created with the `Extended key usage` extension.
17+
* A new KCM API introduced:
18+
* `kcm_certificate_verify_with_private_key` - a self-generated certificate can be checked against a stored private key.
19+
* Fixed the `FtcdCommBase::wait_for_message` function to receive multiple messages.
20+
21+
#### Platform Adaptation Layer (PAL)
22+
23+
* The u-blox ODIN-W2 board now requires support for RSA crypto from Mbed TLS. RSA crypto has been enabled by default for the target `MODULE_UBLOX_ODIN_W2`. Enabling RSA crypto increases the flash size by 20KB. More details in Mbed OS PR [#6963](https://github.com/ARMmbed/mbed-os/pull/6963).
24+
25+
### Release 1.3.2 (22.05.2018)
426

527
#### Mbed Cloud Client
628

@@ -35,28 +57,27 @@
3557

3658
* Linux: Converted all timers to use signal-based timer (SIGEV_SIGNAL) instead of (SIGEV_THREAD).
3759
* This fixes the Valgrind warnings for possible memory leaks caused by LIBC's internal timer helper thread.
38-
60+
3961
<span class="notes">**Note**: If the client application is creating a pthread before instantiating MbedCloudClient,
4062
it needs to block the PAL_TIMER_SIGNAL from it. Otherwise the thread may get an exception caused
4163
by the default signal handler with a message such as "Process terminating with default action
42-
of signal 34 (SIGRT2)". For a suggested way to handle this please see `mcc_platform_init()` in
43-
https://github.com/ARMmbed/mbed-cloud-client-example/blob/master/source/platform/Linux/common_setup.c.</span>
44-
* Linux: Linux specific version of pal_accept()'s addressLen parameter was requiring a platform specific socket address structure size, not a platform independent one.
64+
of signal 34 (SIGRT2)". For a suggested way to handle this please see `mcc_platform_init()` in [here](https://github.com/ARMmbed/mbed-cloud-client-example/blob/master/source/platform/Linux/common_setup.c).</span>
65+
* Linux: Fixed the Linux-specific version of `pal_accept()'s` `addressLen` parameter which previously required a platform-specific socket address structure size, not a platform independent one.
4566
* Fixed a hard fault issue that occurred when calling `pal_ECKeyGenerateKey`.
4667
* Return PAL_ERR_BUFFER_TOO_SMALL if the output buffer is too small for write in `pal_writePrivateKeyToDer`, `pal_writePublicKeyToDer` and `pal_x509CSRWriteDER APIs`.
4768
* Fixed the missing handling for initialization failure of SOTP.
4869
* New API `pal_x509CertGetHTBS`: Calculate the hash of the _To Be Signed_ part of an X509 certificate.
4970

50-
#### Mbed cloud update
71+
#### Mbed Cloud Update
5172

5273
* Improvements to the scheduler to ensure that events are not lost. The scheduler now uses a pool allocation mechanism and queue element locks.
53-
* Implement API to get the active firmware details.
54-
* Rollback protection error will now be reported as "Firmware update failed" (8) when MCCP=1.
55-
* Issue an error when the firmware payload exceeds the maximum storage-size limit.
56-
* Use constant time binary compare function.
57-
* Fix build error for Cortex-A9 target.
74+
* Implemented an API to get the active firmware details.
75+
* A rollback protection error will now be reported as "Firmware update failed" (8) when MCCP=1.
76+
* An error is issued when the firmware payload exceeds the maximum storage-size limit.
77+
* Mbed Cloud Update now uses a constant time binary compare function.
78+
* Fixed a build error for Cortex-A9 target when retrieving the current interrupt enabled state.
5879

59-
### Release R1.3.1.1 (27.04.2018)
80+
### Release 1.3.1.1 (27.04.2018)
6081

6182
#### Mbed Cloud Client
6283

@@ -73,7 +94,7 @@
7394

7495
* Linux: Replaced `fflush(NULL)` with `sync()` in `pal_osReboot` which was causing deadlock in Raspberry Pi3.
7596

76-
### Release R1.3.1 (19.04.2018)
97+
### Release 1.3.1 (19.04.2018)
7798

7899
#### Mbed Cloud Client
79100

@@ -102,5 +123,5 @@ Using PAL for asyncronous handling of DNS enables firmware update with mesh.
102123
* Removed the thread-priority requirement.
103124
* Fixed the compatibility issues with Mbed OS 5.8/5.9.
104125

105-
### Release R1.3.0 (27.3.2018)
126+
### Release 1.3.0 (27.3.2018)
106127
* Initial public release.

factory-configurator-client/crypto-service/source/cs_der_keys_and_csrs.c

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,16 @@ static kcm_status_e cs_csr_generate_int(palECKeyHandle_t key_handle, const kcm_c
257257
palx509CSRHandle_t x509CSR_handle = NULLPTR;
258258
palMDType_t pal_md_type;
259259
uint32_t pal_key_usage = 0;
260+
uint32_t pal_ext_key_usage = 0;
261+
uint32_t eku_all_bits = KCM_CSR_EXT_KU_ANY | KCM_CSR_EXT_KU_SERVER_AUTH | KCM_CSR_EXT_KU_CLIENT_AUTH |
262+
KCM_CSR_EXT_KU_CODE_SIGNING | KCM_CSR_EXT_KU_EMAIL_PROTECTION | KCM_CSR_EXT_KU_TIME_STAMPING | KCM_CSR_EXT_KU_OCSP_SIGNING;
260263

261264
SA_PV_ERR_RECOVERABLE_RETURN_IF((csr_params == NULL), KCM_STATUS_INVALID_PARAMETER, "Invalid csr_params pointer");
262265
SA_PV_ERR_RECOVERABLE_RETURN_IF((csr_params->subject == NULL), KCM_STATUS_INVALID_PARAMETER, "Invalid subject pointer in csr_params");
263266
SA_PV_ERR_RECOVERABLE_RETURN_IF((csr_buff_out == NULL), KCM_STATUS_INVALID_PARAMETER, "Invalid out csr buffer");
264267
SA_PV_ERR_RECOVERABLE_RETURN_IF((csr_buff_max_size == 0), KCM_STATUS_INVALID_PARAMETER, "Invalid max csr buffer size");
265268
SA_PV_ERR_RECOVERABLE_RETURN_IF((csr_buff_act_size_out == NULL), KCM_STATUS_INVALID_PARAMETER, "Invalid out csr buffer size");
269+
SA_PV_ERR_RECOVERABLE_RETURN_IF((csr_params->ext_key_usage & (~eku_all_bits)), KCM_STATUS_INVALID_PARAMETER, "Invalid extended key usage options");
266270

267271
// Initialize x509 CSR handle
268272
pal_status = pal_x509CSRInit(&x509CSR_handle);
@@ -301,6 +305,34 @@ static kcm_status_e cs_csr_generate_int(palECKeyHandle_t key_handle, const kcm_c
301305
pal_status = pal_x509CSRSetKeyUsage(x509CSR_handle, pal_key_usage);
302306
SA_PV_ERR_RECOVERABLE_GOTO_IF((PAL_SUCCESS != pal_status), kcm_status = cs_error_handler(pal_status), exit, "Failed to set CSR key usage");
303307
}
308+
309+
// Set CSR extended key usage
310+
if (csr_params->ext_key_usage != KCM_CSR_EXT_KU_NONE) {
311+
if (csr_params->ext_key_usage & KCM_CSR_EXT_KU_ANY) {
312+
pal_ext_key_usage |= PAL_X509_EXT_KU_ANY;
313+
}
314+
if (csr_params->ext_key_usage & KCM_CSR_EXT_KU_SERVER_AUTH) {
315+
pal_ext_key_usage |= PAL_X509_EXT_KU_SERVER_AUTH;
316+
}
317+
if (csr_params->ext_key_usage & KCM_CSR_EXT_KU_CLIENT_AUTH) {
318+
pal_ext_key_usage |= PAL_X509_EXT_KU_CLIENT_AUTH;
319+
}
320+
if (csr_params->ext_key_usage & KCM_CSR_EXT_KU_CODE_SIGNING) {
321+
pal_ext_key_usage |= PAL_X509_EXT_KU_CODE_SIGNING;
322+
}
323+
if (csr_params->ext_key_usage & KCM_CSR_EXT_KU_EMAIL_PROTECTION) {
324+
pal_ext_key_usage |= PAL_X509_EXT_KU_EMAIL_PROTECTION;
325+
}
326+
if (csr_params->ext_key_usage & KCM_CSR_EXT_KU_TIME_STAMPING) {
327+
pal_ext_key_usage |= PAL_X509_EXT_KU_TIME_STAMPING;
328+
}
329+
if (csr_params->ext_key_usage & KCM_CSR_EXT_KU_OCSP_SIGNING) {
330+
pal_ext_key_usage |= PAL_X509_EXT_KU_OCSP_SIGNING;
331+
}
332+
pal_status = pal_x509CSRSetExtendedKeyUsage(x509CSR_handle, pal_ext_key_usage);
333+
SA_PV_ERR_RECOVERABLE_GOTO_IF((PAL_SUCCESS != pal_status), kcm_status = cs_error_handler(pal_status), exit, "Failed to set CSR extended key usage");
334+
}
335+
304336
// Write the CSR to out buffer in DER format
305337
pal_status = pal_x509CSRWriteDER(x509CSR_handle, csr_buff_out, csr_buff_max_size, csr_buff_act_size_out);
306338
SA_PV_ERR_RECOVERABLE_GOTO_IF((PAL_SUCCESS != pal_status), kcm_status = cs_error_handler(pal_status), exit, "Failed to write the CSR to out buffer");
@@ -345,7 +377,6 @@ kcm_status_e cs_csr_generate(const uint8_t *priv_key, size_t priv_key_size, cons
345377
}
346378
return kcm_status;
347379
}
348-
349380
kcm_status_e cs_generate_keys_and_csr(kcm_crypto_key_scheme_e curve_name, const kcm_csr_params_s *csr_params, uint8_t *priv_key_out,
350381
size_t priv_key_max_size, size_t *priv_key_act_size_out, uint8_t *pub_key_out,
351382
size_t pub_key_max_size, size_t *pub_key_act_size_out, uint8_t *csr_buff_out,
@@ -374,4 +405,4 @@ kcm_status_e cs_generate_keys_and_csr(kcm_crypto_key_scheme_e curve_name, const
374405
SA_PV_ERR_RECOVERABLE_RETURN_IF((key_handle != NULLPTR && kcm_status == KCM_STATUS_SUCCESS), KCM_STATUS_ERROR, "Free key handle failed ");
375406
}
376407
return kcm_status;
377-
}
408+
}

factory-configurator-client/crypto-service/source/cs_utils.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ kcm_status_e cs_error_handler(palStatus_t pal_status)
100100
}
101101
}
102102

103-
104103
/* The function checks private and certificate's public key correlation
105104
*/
106105
kcm_status_e cs_check_certifcate_public_key(palX509Handle_t x509_cert, const uint8_t *private_key_data, size_t size_of_private_key_data)

factory-configurator-client/factory-configurator-client/factory-configurator-client/fcc_status.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ extern "C" {
6363
FCC_STATUS_CERTIFICATE_PUBLIC_KEY_CORRELATION_ERROR, //!< Certificate's public key failed do not matches to corresponding private key
6464
FCC_STATUS_CERTIFICATE_CHAIN_VERIFICATION_FAILED, //!< One of the certificates in the chain does not match its predecessor
6565
FCC_STATUS_BUNDLE_INVALID_KEEP_ALIVE_SESSION_STATUS,//!< The message status is invalid.
66-
FCC_MAX_STATUS = 0xffffffff
66+
FCC_STATUS_TOO_MANY_CSR_REQUESTS, //!< The message contained more than CSR_MAX_NUMBER_OF_CSRS CSR requests
67+
FCC_MAX_STATUS = 0x7fffffff
6768
} fcc_status_e;
6869

6970
#ifdef __cplusplus

factory-configurator-client/factory-configurator-client/source/fcc_utils.c

Lines changed: 56 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -73,53 +73,74 @@ fcc_status_e fcc_convert_kcm_to_fcc_status(kcm_status_e kcm_result)
7373
fcc_status_e fcc_status = FCC_STATUS_SUCCESS;
7474

7575
switch (kcm_result) {
76-
case (KCM_STATUS_SUCCESS):
76+
case KCM_STATUS_SUCCESS:
7777
fcc_status = FCC_STATUS_SUCCESS;
7878
break;
79-
case (KCM_STATUS_ERROR):
80-
case (KCM_STATUS_INVALID_PARAMETER):
81-
case (KCM_STATUS_OUT_OF_MEMORY):
82-
case (KCM_STATUS_INSUFFICIENT_BUFFER):
79+
case KCM_STATUS_ERROR:
80+
case KCM_STATUS_INVALID_PARAMETER:
81+
case KCM_STATUS_OUT_OF_MEMORY:
82+
case KCM_STATUS_INSUFFICIENT_BUFFER:
8383
fcc_status = FCC_STATUS_KCM_ERROR;
8484
break;
85-
case (KCM_STATUS_ITEM_NOT_FOUND):
85+
case KCM_STATUS_ITEM_NOT_FOUND:
8686
fcc_status = FCC_STATUS_ITEM_NOT_EXIST;
8787
break;
88-
case (KCM_STATUS_STORAGE_ERROR):
88+
case KCM_STATUS_STORAGE_ERROR:
89+
case KCM_STATUS_META_DATA_NOT_FOUND:
90+
case KCM_STATUS_META_DATA_SIZE_ERROR:
91+
case KCM_STATUS_NOT_PERMITTED:
92+
case KCM_STATUS_ITEM_IS_EMPTY:
93+
case KCM_STATUS_INVALID_FILE_VERSION:
94+
case KCM_STATUS_UNKNOWN_STORAGE_ERROR:
95+
case KCM_STATUS_NOT_INITIALIZED:
96+
case KCM_STATUS_CLOSE_INCOMPLETE_CHAIN:
97+
case KCM_STATUS_INVALID_NUM_OF_CERT_IN_CHAIN:
98+
case KCM_STATUS_FILE_CORRUPTED:
99+
case KCM_STATUS_FILE_NAME_CORRUPTED:
100+
case KCM_STATUS_INVALID_FILE_ACCESS_MODE:
101+
case KCM_STATUS_CORRUPTED_CHAIN_FILE:
102+
case KCM_STATUS_FILE_NAME_TOO_LONG:
89103
fcc_status = FCC_STATUS_KCM_STORAGE_ERROR;
90104
break;
91-
case (KCM_STATUS_FILE_EXIST):
105+
case KCM_STATUS_SELF_GENERATED_CERTIFICATE_VERIFICATION_ERROR:
106+
fcc_status = FCC_STATUS_CERTIFICATE_PUBLIC_KEY_CORRELATION_ERROR;
107+
case KCM_STATUS_FILE_EXIST:
108+
case (KCM_STATUS_KEY_EXIST):
92109
fcc_status = FCC_STATUS_KCM_FILE_EXIST_ERROR;
93110
break;
94-
case (KCM_CRYPTO_STATUS_UNSUPPORTED_HASH_MODE):
95-
case (KCM_CRYPTO_STATUS_PARSING_DER_PRIVATE_KEY):
96-
case (KCM_CRYPTO_STATUS_PARSING_DER_PUBLIC_KEY):
97-
case (KCM_CRYPTO_STATUS_PK_KEY_INVALID_FORMAT):
98-
case (KCM_CRYPTO_STATUS_INVALID_PK_PUBKEY):
99-
case (KCM_CRYPTO_STATUS_ECP_INVALID_KEY):
100-
case (KCM_CRYPTO_STATUS_PK_KEY_INVALID_VERSION):
101-
case (KCM_CRYPTO_STATUS_PK_PASSWORD_REQUIRED):
102-
case (KCM_CRYPTO_STATUS_PRIVATE_KEY_VERIFICATION_FAILED):
103-
case (KCM_CRYPTO_STATUS_PUBLIC_KEY_VERIFICATION_FAILED):
104-
case (KCM_CRYPTO_STATUS_PK_UNKNOWN_PK_ALG):
105-
case (KCM_CRYPTO_STATUS_UNSUPPORTED_CURVE):
106-
case (KCM_CRYPTO_STATUS_PARSING_DER_CERT):
107-
case (KCM_CRYPTO_STATUS_CERT_EXPIRED):
108-
case (KCM_CRYPTO_STATUS_CERT_FUTURE):
109-
case (KCM_CRYPTO_STATUS_CERT_MD_ALG):
110-
case (KCM_CRYPTO_STATUS_CERT_PUB_KEY_TYPE):
111-
case (KCM_CRYPTO_STATUS_CERT_PUB_KEY):
112-
case (KCM_CRYPTO_STATUS_CERT_NOT_TRUSTED):
113-
case (KCM_CRYPTO_STATUS_INVALID_X509_ATTR):
114-
case (KCM_CRYPTO_STATUS_VERIFY_SIGNATURE_FAILED):
115-
case (KCM_CRYPTO_STATUS_INVALID_MD_TYPE):
116-
case (KCM_CRYPTO_STATUS_FAILED_TO_WRITE_SIGNATURE):
111+
case KCM_CRYPTO_STATUS_UNSUPPORTED_HASH_MODE:
112+
case KCM_CRYPTO_STATUS_PARSING_DER_PRIVATE_KEY:
113+
case KCM_CRYPTO_STATUS_PARSING_DER_PUBLIC_KEY:
114+
case KCM_CRYPTO_STATUS_PK_KEY_INVALID_FORMAT:
115+
case KCM_CRYPTO_STATUS_INVALID_PK_PUBKEY:
116+
case KCM_CRYPTO_STATUS_ECP_INVALID_KEY:
117+
case KCM_CRYPTO_STATUS_PK_KEY_INVALID_VERSION:
118+
case KCM_CRYPTO_STATUS_PK_PASSWORD_REQUIRED:
119+
case KCM_CRYPTO_STATUS_PRIVATE_KEY_VERIFICATION_FAILED:
120+
case KCM_CRYPTO_STATUS_PUBLIC_KEY_VERIFICATION_FAILED:
121+
case KCM_CRYPTO_STATUS_PK_UNKNOWN_PK_ALG:
122+
case KCM_CRYPTO_STATUS_UNSUPPORTED_CURVE:
123+
case KCM_CRYPTO_STATUS_PARSING_DER_CERT:
124+
case KCM_CRYPTO_STATUS_CERT_EXPIRED:
125+
case KCM_CRYPTO_STATUS_CERT_FUTURE:
126+
case KCM_CRYPTO_STATUS_CERT_MD_ALG:
127+
case KCM_CRYPTO_STATUS_CERT_PUB_KEY_TYPE:
128+
case KCM_CRYPTO_STATUS_CERT_PUB_KEY:
129+
case KCM_CRYPTO_STATUS_CERT_NOT_TRUSTED:
130+
case KCM_CRYPTO_STATUS_INVALID_X509_ATTR:
131+
case KCM_CRYPTO_STATUS_VERIFY_SIGNATURE_FAILED:
132+
case KCM_CRYPTO_STATUS_INVALID_MD_TYPE:
133+
case KCM_CRYPTO_STATUS_FAILED_TO_WRITE_SIGNATURE:
134+
case KCM_STATUS_CERTIFICATE_CHAIN_VERIFICATION_FAILED:
135+
case KCM_CRYPTO_STATUS_FAILED_TO_WRITE_PRIVATE_KEY:
136+
case KCM_CRYPTO_STATUS_FAILED_TO_WRITE_PUBLIC_KEY:
137+
case KCM_CRYPTO_STATUS_INVALID_OID:
138+
case KCM_CRYPTO_STATUS_INVALID_NAME_FORMAT:
139+
case KCM_CRYPTO_STATUS_FAILED_TO_WRITE_CSR:
140+
case KCM_MAX_STATUS:
117141
fcc_status = FCC_STATUS_KCM_CRYPTO_ERROR;
118142
break;
119-
default:
120-
SA_PV_LOG_INFO("Invalid kcm_result result (%u)!", kcm_result);
121-
fcc_status = FCC_STATUS_ERROR;
122-
break;
143+
123144
}
124145
return fcc_status;
125146
}

0 commit comments

Comments
 (0)