Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AfrOtaJobDocumentFields_t definition. #89

Merged
merged 39 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
518285c
MISRA Violation Fixes
bradleysmith23 Oct 24, 2023
7d27862
MISRA fixes
bradleysmith23 Oct 24, 2023
e1e175d
Add line at EOF for jobs.c and jobs.h
bradleysmith23 Oct 24, 2023
3807451
Uncrustify: triggered by comment.
actions-user Oct 25, 2023
5ec87a6
Run Github Actions
bradleysmith23 Oct 25, 2023
b6b1f76
Merge branch 'aws:main' into main
bradleysmith23 Oct 27, 2023
054779e
Add OTA Parser, OTA Parser MISRA fixes.
bradleysmith23 Oct 27, 2023
71cac6d
Fix MISRA directive 4.8 Violation
bradleysmith23 Oct 27, 2023
8a6cfda
Update OtaJobParser cbmc proofs
bradleysmith23 Oct 27, 2023
290df7d
Update ota_job_handler_utest.c
bradleysmith23 Oct 30, 2023
1fd189e
Merge branch 'main' of https://github.com/bradleysmith23/Jobs-for-AWS…
bradleysmith23 Oct 30, 2023
77a4a7d
Update Job Parser Unit Tests
bradleysmith23 Oct 30, 2023
6037c4c
Update unwindset for strncpy
bradleysmith23 Oct 30, 2023
0d7f1cf
Formatting Fixes
bradleysmith23 Nov 1, 2023
12d93a5
Github Actions Fixes
bradleysmith23 Nov 1, 2023
ae929cb
Remove unity folder, fix spelling.
bradleysmith23 Nov 1, 2023
cae1064
Fix spelling, broken link
bradleysmith23 Nov 1, 2023
855feb0
Update memory statistics config
bradleysmith23 Nov 1, 2023
464689e
Update ci.yml to ignore unity folder
bradleysmith23 Nov 1, 2023
9582e98
Add link from unit test to exclude-urls for ci.yml
bradleysmith23 Nov 1, 2023
c322600
Fix ci.yml error
bradleysmith23 Nov 1, 2023
2481ddf
change exclude-urls to allow-list for link verifier
bradleysmith23 Nov 1, 2023
c196dc5
Add line to EOF for size_table.md
bradleysmith23 Nov 1, 2023
d57706f
Move linkAllowList to .github folder
bradleysmith23 Nov 1, 2023
40b317e
Add copies of otaParser C files to build dir for coverage checking
bradleysmith23 Nov 1, 2023
c66d490
Update file path for cp commands from ./ to ./build
bradleysmith23 Nov 1, 2023
f97f4d8
Update ci.yml
bradleysmith23 Nov 1, 2023
2ffcdcf
Update ci.yml
bradleysmith23 Nov 1, 2023
224239f
Make copy of otaJobParser sources for testing/coverage
bradleysmith23 Nov 1, 2023
fd7e979
Update jobs_handler_test_sources path
bradleysmith23 Nov 1, 2023
791b540
Uncrustify: triggered by comment.
actions-user Nov 1, 2023
cc71940
Run Github Actions
bradleysmith23 Nov 1, 2023
d3aaa84
Update cmake, github actions
bradleysmith23 Nov 2, 2023
bd91511
Update size_table.md order
bradleysmith23 Nov 2, 2023
b39ac2e
Merge branch 'aws:main' into main
bradleysmith23 Nov 7, 2023
1383c44
Revert MISRA directive 4.8 changes, suppress violation.
bradleysmith23 Nov 7, 2023
7692ecf
Update proofs.c to reflect change in struct definition
bradleysmith23 Nov 7, 2023
2d97cee
Uncrustify: triggered by comment.
actions-user Nov 8, 2023
41ab0e4
Update linkAllowList.txt
bradleysmith23 Nov 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/linkAllowList.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
https://s3.region.amazonaws.com/joe-ota/
https://www.misra.org.uk
19 changes: 17 additions & 2 deletions source/otaJobParser/include/job_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,22 @@
#include <stdlib.h>
#include <stdint.h>

typedef struct AfrOtaJobDocumentFields_t * AfrOtaJobDocumentFields;
typedef struct
{
const char * signature;
size_t signatureLen;
const char * filepath;
size_t filepathLen;
const char * certfile;
size_t certfileLen;
const char * authScheme;
size_t authSchemeLen;
const char * imageRef;
size_t imageRefLen;
uint32_t fileId;
uint32_t fileSize;
uint32_t fileType;
} AfrOtaJobDocumentFields_t;

/**
* @brief Populate the fields of 'result', returning
Expand All @@ -30,6 +45,6 @@ typedef struct AfrOtaJobDocumentFields_t * AfrOtaJobDocumentFields;
bool populateJobDocFields( const char * jobDoc,
const size_t jobDocLength,
int32_t fileIndex,
AfrOtaJobDocumentFields result );
AfrOtaJobDocumentFields_t * result );

#endif /* JOB_PARSER_H */
2 changes: 1 addition & 1 deletion source/otaJobParser/include/ota_job_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
int8_t otaParser_parseJobDocFile( const char * jobDoc,
const size_t jobDocLength,
const uint8_t fileIndex,
AfrOtaJobDocumentFields fields );
AfrOtaJobDocumentFields_t * fields );

#endif /*OTA_JOB_PROCESSOR_H*/
31 changes: 7 additions & 24 deletions source/otaJobParser/job_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,6 @@
#include "core_json.h"
#include "job_parser.h"

struct AfrOtaJobDocumentFields_t
{
const char * signature;
size_t signatureLen;
const char * filepath;
size_t filepathLen;
const char * certfile;
size_t certfileLen;
const char * authScheme;
size_t authSchemeLen;
const char * imageRef;
size_t imageRefLen;
uint32_t fileId;
uint32_t fileSize;
uint32_t fileType;
};

/**
* @brief Populates common job document fields in result
*
Expand All @@ -44,7 +27,7 @@ struct AfrOtaJobDocumentFields_t
static JSONStatus_t populateCommonFields( const char * jobDoc,
const size_t jobDocLength,
int32_t fileIndex,
AfrOtaJobDocumentFields result );
AfrOtaJobDocumentFields_t * result );

/**
* @brief Populates MQTT job document fields in result
Expand All @@ -56,7 +39,7 @@ static JSONStatus_t populateCommonFields( const char * jobDoc,
*/
static JSONStatus_t populateMqttStreamingFields( const char * jobDoc,
const size_t jobDocLength,
AfrOtaJobDocumentFields result );
AfrOtaJobDocumentFields_t * result );

/**
* @brief Populates HTTP job document fields in result
Expand All @@ -70,7 +53,7 @@ static JSONStatus_t populateMqttStreamingFields( const char * jobDoc,
static JSONStatus_t populateHttpStreamingFields( const char * jobDoc,
const size_t jobDocLength,
int32_t fileIndex,
AfrOtaJobDocumentFields result );
AfrOtaJobDocumentFields_t * result );

/**
* @brief Assembles an indexed OTA file query
Expand Down Expand Up @@ -151,7 +134,7 @@ static bool addOverflowUint32( const uint32_t a,
bool populateJobDocFields( const char * jobDoc,
const size_t jobDocLength,
int32_t fileIndex,
AfrOtaJobDocumentFields result )
AfrOtaJobDocumentFields_t * result )
{
bool populatedJobDocFields = false;
JSONStatus_t jsonResult = JSONNotFound;
Expand Down Expand Up @@ -200,7 +183,7 @@ bool populateJobDocFields( const char * jobDoc,
static JSONStatus_t populateCommonFields( const char * jobDoc,
const size_t jobDocLength,
int32_t fileIndex,
AfrOtaJobDocumentFields result )
AfrOtaJobDocumentFields_t * result )
{
JSONStatus_t jsonResult = JSONNotFound;
const char * jsonValue = NULL;
Expand Down Expand Up @@ -299,7 +282,7 @@ static JSONStatus_t populateCommonFields( const char * jobDoc,

static JSONStatus_t populateMqttStreamingFields( const char * jobDoc,
const size_t jobDocLength,
AfrOtaJobDocumentFields result )
AfrOtaJobDocumentFields_t * result )
{
JSONStatus_t jsonResult = JSONNotFound;
const char * jsonValue = NULL;
Expand Down Expand Up @@ -327,7 +310,7 @@ static JSONStatus_t populateMqttStreamingFields( const char * jobDoc,
static JSONStatus_t populateHttpStreamingFields( const char * jobDoc,
const size_t jobDocLength,
int32_t fileIndex,
AfrOtaJobDocumentFields result )
AfrOtaJobDocumentFields_t * result )
{
JSONStatus_t jsonResult = JSONNotFound;
const char * jsonValue = NULL;
Expand Down
2 changes: 1 addition & 1 deletion source/otaJobParser/ota_job_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static bool isJobFileIndexValid( const char * jobDoc,
int8_t otaParser_parseJobDocFile( const char * jobDoc,
const size_t jobDocLength,
const uint8_t fileIndex,
AfrOtaJobDocumentFields fields )
AfrOtaJobDocumentFields_t * fields )
{
bool fieldsPopulated = false;
int8_t nextFileIndex = -1;
Expand Down
4 changes: 2 additions & 2 deletions test/cbmc/proofs.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ void proof_populateJobDocFields( void )
const char * jobDoc;
const size_t jobDocLength;
int fileIndex;
AfrOtaJobDocumentFields result = { 0 };
AfrOtaJobDocumentFields_t result = { 0 };
bool ret;

__CPROVER_assume( jobDocLength <= CBMC_JOBDOC_MAX_LEN );
Expand All @@ -462,7 +462,7 @@ void proof_otaParser_parseJobDocFile( void )
const char * jobDoc;
const size_t jobDocLength;
const uint8_t fileIndex;
AfrOtaJobDocumentFields fields = { 0 };
AfrOtaJobDocumentFields_t fields = { 0 };
int8_t ret;

__CPROVER_assume( jobDocLength <= CBMC_JOBDOC_MAX_LEN );
Expand Down
Loading