Skip to content

Fix full build including non-boolean with Asan: crypto part #144

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

Conversation

gilles-peskine-arm
Copy link
Collaborator

@gilles-peskine-arm gilles-peskine-arm commented Jun 7, 2019

This pull requests fixes some issues in test suites that we hadn't caught before because they aren't tested:

This PR does not add CI jobs that would detect those issues. This will come through PR in the mbedtls repository for which this PR is a prerequisite: Mbed-TLS/mbedtls#2684 (or in several PRs that 2684 may be split into).

Backports: Mbed-TLS/mbedtls#2754 Mbed-TLS/mbedtls#2755

@gilles-peskine-arm gilles-peskine-arm added bug Something isn't working needs: review The pull request is ready for review. This generally means that it has no known issues. labels Jun 7, 2019
Copy link
Contributor

@Patater Patater left a comment

Choose a reason for hiding this comment

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

The commit that adds TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );, replacing 0 with PSA_SUCCESS, has the same commit message as a commit that does something quite different. Please write a correct commit message for the commit that changes 0 to PSA_SUCCESS.

Otherwise, LGTM.

@gilles-peskine-arm gilles-peskine-arm force-pushed the oss-fuzz-fix-build-crypto branch from 3afcc53 to 88eefb8 Compare June 7, 2019 17:34
@gilles-peskine-arm
Copy link
Collaborator Author

Rebased to fix copypasta in the commit message.

Patater
Patater previously approved these changes Jun 10, 2019
@gilles-peskine-arm
Copy link
Collaborator Author

This PR is primarily a precursor to Mbed-TLS/mbedtls#2684 . I've split that TLS PR into pieces, the first of which Mbed-TLS/mbedtls#2697 is supported by a new crypto PR #148.

I'm not sure yet whether I'll split this PR further or just rebase it on top of the merge of #148 so I'm leaving it open for now.

@gilles-peskine-arm gilles-peskine-arm added needs: work The pull request needs rework before it can be merged. and removed needs: review The pull request is ready for review. This generally means that it has no known issues. labels Jul 15, 2019
psa_crypto_init() can fail. Do check its return code. Don't call it
before initializing local objects that are going to be cleaned up.
Writing 0 instead of PSA_SUCCESS is correct, but bad form.
memset has undefined behavior when either pointer can be NULL, which
is the case when it's the result of malloc/calloc with a size of 0.
The memset calls here are useless anyway since they come immediately
after calloc.
Call mbedtls_entropy_free on test failure.

Restore the previous NV seed functions which the call to
mbedtls_platform_set_nv_seed() changed. This didn't break anything,
but only because the NV seed functions used for these tests happened
to work for the tests that got executed later in the .data file.
This test case was only executed if the SHA-512 module was enabled and
MBEDTLS_ENTROPY_FORCE_SHA256 was not enabled, so "config.pl full"
didn't have a chance to reach it even if that enabled
MBEDTLS_PLATFORM_NV_SEED_ALT.

Now all it takes to enable this test is MBEDTLS_PLATFORM_NV_SEED_ALT
and its requirements, and the near-ubiquitous MD module.
@gilles-peskine-arm gilles-peskine-arm force-pushed the oss-fuzz-fix-build-crypto branch from 5b4cb75 to 66afcca Compare July 19, 2019 15:09
@gilles-peskine-arm gilles-peskine-arm added needs: review The pull request is ready for review. This generally means that it has no known issues. and removed needs: work The pull request needs rework before it can be merged. labels Jul 19, 2019
Copy link
Contributor

@k-stachowiak k-stachowiak left a comment

Choose a reason for hiding this comment

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

LGTM

@gilles-peskine-arm gilles-peskine-arm removed the needs: review The pull request is ready for review. This generally means that it has no known issues. label Aug 14, 2019
@gilles-peskine-arm gilles-peskine-arm merged commit 317f940 into ARMmbed:development Aug 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants