Skip to content

Audit findings#3

Merged
relatko merged 5 commits into
merging-with-onflow-latest-development-branchfrom
audit_findings
Jun 12, 2024
Merged

Audit findings#3
relatko merged 5 commits into
merging-with-onflow-latest-development-branchfrom
audit_findings

Conversation

@relatko

@relatko relatko commented Jun 4, 2024

Copy link
Copy Markdown

No description provided.

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@relatko
relatko changed the base branch from develop to merging-with-onflow-latest-development-branch June 5, 2024 06:40
Comment thread src/crypto.c Outdated
&messageDigestSize));

if (messageDigestSize != 32) {
if (messageDigestSize != CX_SHA256_SIZE) {

@tarakby tarakby Jun 5, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I think the audit report pointed to replacing the 32 on this line. However, I don't agree with the report suggestion. There should be a new defined constant CX_SHA3_256_SIZE (also equal to 32). SHA256 refers to SHA-2, while here we are working with SHA-3

  • The line modified in this PR should actually remain 32, or should be replaced by another new constant (the elliptic curve order size), otherwise the check doesn't make sense from a cryptographic perspective. In this specific case, all constants happen to be 32 and the code passes, but if we evolve the code to support more curves/hashing, the code would become incorrect (EDIT: after thinking more on this, it can be fine to check against the expected hash output only, if the later signing function checks for curve/hash compatibility)

@tarakby tarakby Jun 5, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can make a minor suggestion PR in a few hours to clean up the magic numbers from a cryptographic point of a view. It would only improve the code readability, but wouldn't have any functional change on the current code.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is my suggestion PR: #4

@relatko
relatko force-pushed the audit_findings branch 2 times, most recently from efffc6d to 4dff0a0 Compare June 6, 2024 17:03
@relatko
relatko merged commit 0c12067 into merging-with-onflow-latest-development-branch Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants