Skip to content

Commit 719da5f

Browse files
committed
Make changes to integrate with MbedTLSv3.5.1 and remove OTA cmake targets
1 parent 86cf6e0 commit 719da5f

File tree

26 files changed

+55
-951
lines changed

26 files changed

+55
-951
lines changed

.github/workflows/update-submodules.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
required: true
99
default: main
1010
allowed:
11-
description: 'Optional regex pattern passed to `grep` to update only the specified library submodules, e.g. "ota\|jobs" updates only libraries with "ota" or "jobs" in the name.'
11+
description: 'Optional regex pattern passed to `grep` to update only the specified library submodules, e.g. "jobs" updates only libraries with "jobs" in the name.'
1212
required: false
1313
default: .*
1414

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
### Major Changes
66

7-
- [#1929](https://github.com/aws/aws-iot-device-sdk-embedded-C/pull/1929) This release includes 202406.01-LTS versions of coreMQTT, corePKCS11, coreHTTP, coreJSON, backoffAlgorithm, AWS IoT Device Shadow, AWS IoT Jobs, AWS IoT Device Defender, AWS IoT Fleet Provisioning and SigV4 libraries. These libraries have gone through code quality checks including verification that no function has a [GNU Complexity](https://www.gnu.org/software/complexity/manual/complexity.html) score greater than 8, checks against deviations from the mandatory rules in the [MISRA coding standard](https://www.misra.org.uk/), static code analysis from [Coverity static analysis](https://scan.coverity.com/) and validation of memory safety through the [CBMC automated reasoning tool](http://www.cs.cmu.edu/~modelcheck/cbmc/).
8-
- [#1929](https://github.com/aws/aws-iot-device-sdk-embedded-C/pull/1929) Removes the OTA library and OTA demo . They are planned to be replaced by [aws-iot-core-mqtt-file-streams-embedded-c](https://github.com/aws/aws-iot-core-mqtt-file-streams-embedded-c) in future releases.
7+
- [#1929](https://github.com/aws/aws-iot-device-sdk-embedded-C/pull/1929) This release brings the following changes:
8+
- Includes [202406.01-LTS](https://github.com/FreeRTOS/FreeRTOS-LTS/releases/tag/202406.01-LTS) versions of coreMQTT, corePKCS11, coreHTTP, coreJSON, backoffAlgorithm, AWS IoT Device Shadow, AWS IoT Jobs, AWS IoT Device Defender, AWS IoT Fleet Provisioning and SigV4 libraries.
9+
- Removes the OTA library and OTA demo . They are planned to be replaced by [aws-iot-core-mqtt-file-streams-embedded-c](https://github.com/aws/aws-iot-core-mqtt-file-streams-embedded-c) in future releases following [this announcement](https://aws.amazon.com/about-aws/whats-new/2023/12/freertos-modular-composable-ota-libraries/). To learn more about FreeRTOS OTA libraries, visit the [FreeRTOS OTA page](https://freertos.org/freertos-core/over-the-air-updates/index.html). To get started, see the new OTA [reference demo](https://freertos.org/freertos-core/over-the-air-updates/mqtt-ota-agent-orchestrator.html).
10+
- Update readme instructions for demos for better user experience.
911

1012
### Minor Changes
1113

@@ -16,7 +18,6 @@
1618
- [#1875](https://github.com/aws/aws-iot-device-sdk-embedded-C/pull/1875) Add a Fleet provisioning demo to get certificate and private key via CreateKeysAndCertificate API.
1719
- [#1899](https://github.com/aws/aws-iot-device-sdk-embedded-C/pull/1899) Add Tunnelmole as an open source tunneling option in addition to ngrok.
1820
- [#1901](https://github.com/aws/aws-iot-device-sdk-embedded-C/pull/1901) Add a HTTP demo to generate a pre-signed URL to an S3 object file.
19-
- Update readme instructions for demos for better user experience.
2021

2122
## 202211.00 (November 2022)
2223

MISRA.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ Deviations from the MISRA standard are listed below:
3636
| Rule 11.8 | Required | An OpenSSL API `SSL_set_tlsext_host_name`, which is used in the TLS transport implementation, internally casts a string literal to a `void *` pointer. |
3737
| Rule 13.4 | Required | A POSIX-specific macro utility `FD_SET` is flagged for this violation. This macro utility, whose implementation is supplied by the system, is used in the transport implementation. |
3838
| Rule 14.4 | Required | A POSIX-specific macro utility `FD_ZERO` is flagged for this violation. This macro utility, whose implementation is supplied by the system, is used in the transport implementation. |
39-
| Rule 21.6 | Required | The Standard Library input/output functions for opening and closing files are used by the OpenSSL transport implementation, since the OpenSSL API `PEM_read_X509` to read PEM files takes `FILE *` as an argument. The standard C library file handling functions are also used in POSIX platform implementation of OTA. |
39+
| Rule 21.6 | Required | The Standard Library input/output functions for opening and closing files are used by the OpenSSL transport implementation, since the OpenSSL API `PEM_read_X509` to read PEM files takes `FILE *` as an argument. |

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -488,13 +488,7 @@ The following creates a job that specifies a Linux Kernel link for downloading.
488488
--targets arn:aws:iot:us-west-2:<account-id>:thing/<thing-name> \
489489
--document '{"url":"https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.8.5.tar.xz"}'
490490
```
491-
3. Execute the following command:
492-
```
493-
/build/bin/jobs_demo_mosquitto
494-
```
495-
This command will provide detailed instructions for running the demo.
496-
497-
4. When prompted, run the demo using this command:
491+
3. Run the demo using this command:
498492
```
499493
./build/bin/jobs_demo_mosquitto \
500494
-n <thing-name> \

demos/CMakeLists.txt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ check_symbol_exists(fork "unistd.h" HAVE_FORK)
2626
if(${LIB_RT} STREQUAL "LIB_RT-NOTFOUND")
2727
set(librt_demos
2828
"http_demo_s3_download_multithreaded"
29-
"ota_demo_core_http"
30-
"ota_demo_core_mqtt"
3129
)
3230
message( WARNING "rt library could not be found. Demos that use it will be excluded from the default target." )
3331
foreach(demo_name ${librt_demos})
@@ -46,8 +44,6 @@ if(NOT ${OpenSSL_FOUND})
4644
"mqtt_demo_basic_tls"
4745
"mqtt_demo_mutual_auth"
4846
"mqtt_demo_subscription_manager"
49-
"ota_demo_core_http"
50-
"ota_demo_core_mqtt"
5147
"shadow_demo_main"
5248
"greengrass_demo_local_auth"
5349
)
@@ -56,16 +52,6 @@ if(NOT ${OpenSSL_FOUND})
5652
set_target_properties(${demo_name} PROPERTIES EXCLUDE_FROM_ALL true)
5753
endforeach()
5854
endif()
59-
if(NOT ${Threads_FOUND})
60-
set(thread_demos
61-
"ota_demo_core_http"
62-
"ota_demo_core_mqtt"
63-
)
64-
message( WARNING "Threads library could not be found. Demos that use it will be excluded from the default target." )
65-
foreach(demo_name ${thread_demos})
66-
set_target_properties(${demo_name} PROPERTIES EXCLUDE_FROM_ALL true)
67-
endforeach()
68-
endif()
6955
if(NOT HAVE_FORK)
7056
set(fork_demos
7157
"http_demo_s3_download_multithreaded"

demos/fleet_provisioning/fleet_provisioning_keys_cert/pkcs11_operations.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@
4444
/* MbedTLS include. */
4545
#include "mbedtls/ctr_drbg.h"
4646
#include "mbedtls/entropy.h"
47-
#include "mbedtls/entropy_poll.h"
47+
#include "entropy_poll.h"
4848
#include "mbedtls/error.h"
4949
#include "mbedtls/oid.h"
5050
#include "mbedtls/pk.h"
51-
#include "mbedtls/pk_internal.h"
51+
#include "pk_wrap.h"
5252
#include "mbedtls/sha256.h"
5353
#include "mbedtls/x509_crt.h"
5454
#include "mbedtls/x509_csr.h"
@@ -537,10 +537,15 @@ static CK_RV provisionPrivateKey( CK_SESSION_HANDLE session,
537537
mbedtls_pk_type_t mbedKeyType = MBEDTLS_PK_NONE;
538538
int mbedResult = 0;
539539
mbedtls_pk_context mbedPkContext = { 0 };
540+
mbedtls_ctr_drbg_context ctr_drbg;
541+
mbedtls_entropy_context entropy;
540542

541543
mbedtls_pk_init( &mbedPkContext );
544+
mbedtls_entropy_init(&entropy);
545+
mbedtls_ctr_drbg_init(&ctr_drbg);
546+
mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, NULL, 0);
542547
mbedResult = mbedtls_pk_parse_key( &mbedPkContext, ( const uint8_t * ) privateKey,
543-
privateKeyLength, NULL, 0 );
548+
privateKeyLength, NULL, 0, mbedtls_ctr_drbg_random, &ctr_drbg );
544549

545550
if( mbedResult != 0 )
546551
{

demos/fleet_provisioning/fleet_provisioning_keys_cert/pkcs11_operations.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
#include <stdlib.h>
2828
#include <stdbool.h>
2929

30+
/**
31+
* @brief To access the private members of the MbedTLS structs
32+
*/
33+
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
34+
3035
/* corePKCS11 include. */
3136
#include "core_pkcs11.h"
3237

demos/fleet_provisioning/fleet_provisioning_with_csr/pkcs11_operations.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@
4444
/* MbedTLS include. */
4545
#include "mbedtls/ctr_drbg.h"
4646
#include "mbedtls/entropy.h"
47-
#include "mbedtls/entropy_poll.h"
47+
#include "entropy_poll.h"
4848
#include "mbedtls/error.h"
4949
#include "mbedtls/oid.h"
5050
#include "mbedtls/pk.h"
51-
#include "mbedtls/pk_internal.h"
51+
#include "pk_wrap.h"
5252
#include "mbedtls/sha256.h"
5353
#include "mbedtls/x509_crt.h"
5454
#include "mbedtls/x509_csr.h"
@@ -243,11 +243,12 @@ static int extractEcPublicKey( CK_SESSION_HANDLE p11Session,
243243
* @param[in] pRng Unused.
244244
* @param[in] pRngContext Unused.
245245
*/
246-
static int32_t privateKeySigningCallback( void * pContext,
246+
static int32_t privateKeySigningCallback( mbedtls_pk_context * pContext,
247247
mbedtls_md_type_t mdAlg,
248248
const unsigned char * pHash,
249249
size_t hashLen,
250250
unsigned char * pSig,
251+
size_t sig_size,
251252
size_t * pSigLen,
252253
int ( * pRng )( void *, unsigned char *, size_t ),
253254
void * pRngContext );
@@ -636,10 +637,15 @@ static CK_RV provisionPrivateKey( CK_SESSION_HANDLE session,
636637
mbedtls_pk_type_t mbedKeyType = MBEDTLS_PK_NONE;
637638
int mbedResult = 0;
638639
mbedtls_pk_context mbedPkContext = { 0 };
640+
mbedtls_ctr_drbg_context ctr_drbg;
641+
mbedtls_entropy_context entropy;
639642

640643
mbedtls_pk_init( &mbedPkContext );
644+
mbedtls_entropy_init(&entropy);
645+
mbedtls_ctr_drbg_init(&ctr_drbg);
646+
mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, NULL, 0);
641647
mbedResult = mbedtls_pk_parse_key( &mbedPkContext, ( const uint8_t * ) privateKey,
642-
privateKeyLength, NULL, 0 );
648+
privateKeyLength, NULL, 0, mbedtls_ctr_drbg_random, &ctr_drbg );
643649

644650
if( mbedResult != 0 )
645651
{
@@ -900,11 +906,12 @@ static int extractEcPublicKey( CK_SESSION_HANDLE p11Session,
900906

901907
/*-----------------------------------------------------------*/
902908

903-
static int32_t privateKeySigningCallback( void * pContext,
909+
static int32_t privateKeySigningCallback( mbedtls_pk_context * pContext,
904910
mbedtls_md_type_t mdAlg,
905911
const unsigned char * pHash,
906912
size_t hashLen,
907913
unsigned char * pSig,
914+
size_t sig_size,
908915
size_t * pSigLen,
909916
int ( * pRng )( void *, unsigned char *, size_t ),
910917
void * pRngContext )

demos/fleet_provisioning/fleet_provisioning_with_csr/pkcs11_operations.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
#include <stdlib.h>
2828
#include <stdbool.h>
2929

30+
/**
31+
* @brief To access the private members of the MbedTLS structs
32+
*/
33+
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
34+
3035
/* corePKCS11 include. */
3136
#include "core_pkcs11.h"
3237

demos/http/common/src/http_demo_s3_utils.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
/* MBEDTLS API header. */
3838
#include "mbedtls/sha256.h"
39+
#include "mbedtls/compat-2.x.h"
3940

4041
/* OpenSSL transport header. */
4142
#include "openssl_posix.h"

0 commit comments

Comments
 (0)