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

Test Linter #137

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 9 additions & 10 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,20 @@ jobs:
cpp-linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cpp-linter/cpp-linter-action@v2
- uses: actions/checkout@v4
- uses: cpp-linter/cpp-linter-action@main
id: linter
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
style: file
# The following value will only update a single comment
# in a pull request's thread. Set it to false to disable the comment.
# Set it to true to post a new comment (and delete the old comment).
# thread-comments: ${{ github.event_name == 'pull_request' && 'update' }}
thread-comments: ${{ github.event_name == 'push' && 'update' }}
style: ''
files-changed-only: false
ignore: crypto

- name: Fail fast?!
if: steps.linter.outputs.checks-failed > 0
run: echo "Some files failed the linting checks!"
if: steps.linter.outputs.checks-failed != 0
run: |
echo "some linter checks failed. ${{ steps.linter.outputs.checks-failed }}"
# for actual deployment
# run: exit 1
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Build](https://github.com/samsung/mtower/workflows/Build/badge.svg)](https://github.com/samsung/mtower/actions?query=workflow%3ABuild)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/6108/badge)](https://bestpractices.coreinfrastructure.org/projects/6108)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/Samsung/mTower/badge)](https://api.securityscorecards.dev/projects/github.com/Samsung/mTower)
[![cpp-linter](https://github.com/cpp-linter/cpp-linter-action/actions/workflows/cpp-linter.yml/badge.svg)](https://github.com/cpp-linter/cpp-linter-action/actions/workflows/cpp-linter.yml)
[![RepoSize](https://img.shields.io/github/repo-size/samsung/mtower.svg)](https://github.com/samsung/mtower)
[![Release](https://img.shields.io/github/v/release/samsung/mtower.svg)](https://github.com/samsung/mtower/releases)
[![LICENSE](https://img.shields.io/github/license/samsung/mtower.svg)](https://github.com/samsung/mtower/blob/master/LICENSE)
Expand Down
6 changes: 3 additions & 3 deletions tools/ecdsa_keygen.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
uint8_t d[32]; /* 256-bits */
}__attribute__((packed)) ECC_KEY_T;

typedef struct _AES_DATA {

Check warning on line 62 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:62:16 [bugprone-reserved-identifier]

declaration uses identifier '_AES_DATA', which is a reserved identifier

Check warning on line 62 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:62:16 [bugprone-reserved-identifier]

declaration uses identifier '_AES_DATA', which is a reserved identifier
unsigned char key[AES_KEY_SIZE];
unsigned char iv[AES_BLOCK_SIZE];
} AES_DATA;
Expand All @@ -75,29 +75,29 @@

/* Private Data. */
/* All static data definitions appear here. */
uint32_t key[] =
const uint32_t key[] =
{ 0x78563412, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0xefcdac00 };

uint32_t iv[] =
const uint32_t iv[] =
{ 0x78563412, 0x00000000, 0x00000000, 0xefcdac00 };

/* Public Data. */
/* All data definitions with global scope appear here. */

/* Public Function Prototypes */
Message *message_init(int);

Check warning on line 89 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:89:26 [readability-named-parameter]

all parameters should be named in a function

Check warning on line 89 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:89:26 [readability-named-parameter]

all parameters should be named in a function
int aes256_init(Message *);

Check warning on line 90 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:90:26 [readability-named-parameter]

all parameters should be named in a function

Check warning on line 90 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:90:26 [readability-named-parameter]

all parameters should be named in a function
Message *aes256_encrypt(Message *);

Check warning on line 91 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:91:34 [readability-named-parameter]

all parameters should be named in a function

Check warning on line 91 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:91:34 [readability-named-parameter]

all parameters should be named in a function
void aes_cleanup(AES_DATA *);

Check warning on line 92 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:92:28 [readability-named-parameter]

all parameters should be named in a function

Check warning on line 92 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:92:28 [readability-named-parameter]

all parameters should be named in a function
void message_cleanup(Message *);

Check warning on line 93 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:93:31 [readability-named-parameter]

all parameters should be named in a function

Check warning on line 93 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:93:31 [readability-named-parameter]

all parameters should be named in a function

void sha256(unsigned char *data, unsigned int data_len, unsigned char *hash)
{
SHA256_CTX sha256;
SHA256_Init(&sha256);

Check warning on line 98 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:98:3 [clang-diagnostic-deprecated-declarations]

'SHA256_Init' is deprecated

Check warning on line 98 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:98:3 [clang-diagnostic-deprecated-declarations]

'SHA256_Init' is deprecated
SHA256_Update(&sha256, data, data_len);

Check warning on line 99 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:99:3 [clang-diagnostic-deprecated-declarations]

'SHA256_Update' is deprecated

Check warning on line 99 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:99:3 [clang-diagnostic-deprecated-declarations]

'SHA256_Update' is deprecated
SHA256_Final(hash, &sha256);

Check warning on line 100 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:100:3 [clang-diagnostic-deprecated-declarations]

'SHA256_Final' is deprecated

Check warning on line 100 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:100:3 [clang-diagnostic-deprecated-declarations]

'SHA256_Final' is deprecated
}

Message *message_init(int length)
Expand All @@ -117,7 +117,7 @@
//point to new data
input->aes_settings = aes_info;
//get rand bytes
memcpy(input->aes_settings->key, key, AES_KEY_SIZE);

Check warning on line 120 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:120:3 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]

Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11

Check warning on line 120 in tools/ecdsa_keygen.c

View workflow job for this annotation

GitHub Actions / cpp-linter

tools/ecdsa_keygen.c:120:3 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]

Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy(input->aes_settings->iv, iv, AES_KEY_SIZE / 2);

return 0;
Expand Down Expand Up @@ -374,7 +374,7 @@
}
fclose(fd);

exit:
// exit:
BN_free(x);
BN_free(y);
EC_GROUP_free(ecgroup);
Expand Down
Loading