aboutsummaryrefslogtreecommitdiff
path: root/programs/fuzz
AgeCommit message (Collapse)AuthorFilesLines
7 daysFix missing-prototype error in programs/fuzz by moving ↵Michael Schuster7-2/+9
LLVMFuzzerTestOneInput prototype to common.h Signed-off-by: Michael Schuster <michael@schuster.ms>
2024-07-19programs: fuzz: Fix commentRonald Cron1-3/+1
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-07-11Replace MBEDTLS_MD_CAN_SHA256 with PSA_WANT_ALG_SHA_256Elena Uziunaite1-2/+2
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-07-03Replace MBEDTLS_MD_CAN_SHA384 with PSA_WANT_ALG_SHA_384Elena Uziunaite1-2/+2
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-02-22Remove cruftGilles Peskine6-6/+0
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-22Don't authorize private access to fields where not actually neededGilles Peskine6-6/+0
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-22fuzz_dtlsserver: explicitly note the one access to a private fieldGilles Peskine1-3/+1
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-22fuzz_pubkey, fuzz_privkey: no real need to access private fieldsGilles Peskine2-7/+9
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-01-24Refactor common PThreads CMake codePaul Elliott1-4/+0
Move the flags and find of Threads to root CMakeLists.txt, rather than duplicate these everywhere. Make explicit linking of library with PThreads use the same mechanism. Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-01-19Remove unneeded lines from fuzz/MakefilePaul Elliott1-3/+0
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-01-19Set preferences before finding Threads in CMakePaul Elliott1-0/+2
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-01-05Allow programs/fuzz to be linked against pthreadPaul Elliott1-30/+4
Use the same mechanisms used to link other programs against pthread with make, i.e. include common.make, and remove common code from programs/ fuzz/Makefile Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-01-05Link programs with pthread via cmakePaul Elliott2-0/+7
All programs are now linked directly with all test code, thus adding a pthread abstraction into the test code means having to link the programs with pthread (if the library is found under cmake). Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-09-25fuzzer Makefile: Added -lbcrypt linkageMinos Galanakis1-0/+4
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-07-26Fix warnings from clang-16Gowtham Suresh Kumar2-2/+2
Running clang-16 on mbedtls reports warnings of type "-Wstrict-prototypes". This patch fixes these warnings by adding void to functions with no arguments. The generate_test_code.py is modified to insert void into test functions with no arguments in *.function files. Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
2023-05-12Fuzz programs: print an error if loading the reproducer failsGilles Peskine1-0/+14
The fuzz programs were returning a nonzero status if they failed to load the reproducer, but that's discreet and not informative. Make them also print an error message. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-24Fix code-stylePrzemek Stekiel2-2/+2
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-24Add guards for mbedtls_psa_crypto_free()Przemek Stekiel8-4/+23
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-24Init PSA in fuzz programsPrzemek Stekiel9-15/+103
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-03-21Remove legacy_or_psa.hManuel Pégourié-Gonnard1-1/+0
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-03-21SSL: use MD_CAN macrosManuel Pégourié-Gonnard1-4/+4
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-01-11Switch to the new code styleGilles Peskine13-298/+340
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-11-29programs/fuzz: set sensible default CFLAGSGilles Peskine1-1/+3
Running make from programs/fuzz didn't set any optimization flags (running make from programs or from the root inherited the parent's optimization flags). Default to -O2. There were no -W flags. Default to -Wall -Wextra, but not -Werror in line with the other makefiles. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-11-10Merge remote-tracking branch 'origin/development' into pr3431Dave Rodgman2-7/+11
2022-10-19Fix SHA512 vs SHA384 dependenciesAndrzej Kurek1-3/+7
When building SHA512 without SHA384, there are some code paths that resulted in unused variables or usage of undefined code. This commit fixes that. Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-10-10Fix session tickets related build flags in fuzz_server and ssl_server2Przemek Stekiel1-4/+4
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-09-01pkcs7: provide fuzz harnessNayna Jain4-0/+23
This allows for pkcs7 fuzz testing with OSS-Fuzz. Signed-off-by: Daniel Axtens <dja@axtens.net> Signed-off-by: Nayna Jain <nayna@linux.ibm.com>
2022-08-08Fix fuzz_privkey build without MBEDTLS_ENTROPY_C definedNeil Armstrong1-4/+4
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-05-11Redo of PR#5345. Fixed spelling and typographical errors found by CodeSpell.Shaun Case2-4/+4
Signed-off-by: Shaun Case <warmsocks@gmail.com> Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-03-04Fix requirement mismatch in fuzz/common.cAndrzej Kurek1-1/+1
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-03-04programs/fuzz: Remove superfluous MBEDTLS_HAVE_TIMEDavid Horstmann1-1/+1
MBEDTLS_HAVE_TIME_ALT implies MBEDTLS_HAVE_TIME, so an extra check for MBEDTLS_HAVE_TIME is not needed. Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-03-04programs/fuzz: Use build_info.h in common.hDavid Horstmann1-5/+1
Remove direct inclusion of mbedtls_config.h and replace with build_info.h, as is the convention in Mbed TLS 3.0. Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-03-04Do not include time.h without MBEDTLS_HAVE_TIMEDaniel Axtens2-1/+14
MBEDTLS_HAVE_TIME is documented as: "System has time.h and time()." If that is not defined, do not attempt to include time.h. A particular problem is platform-time.h, which should only be included if MBEDTLS_HAVE_TIME is defined, which makes everything messier. Maybe it should be refactored to have the check inside the header. Signed-off-by: Daniel Axtens <dja@axtens.net>
2022-02-16Merge pull request #5533 from paul-elliott-arm/fix_fuzz_privkey_null_ctxManuel Pégourié-Gonnard3-13/+34
Fix null context when using dummy_rand with mbedtls_pk_parse_key()
2022-02-15Fix uninitialised return value.Paul Elliott1-0/+3
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2022-02-14Add safety to dummy_random in case of NULL contextPaul Elliott1-2/+5
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2022-02-14Ensure valid context is used in fuzz_dtlsserverPaul Elliott1-8/+8
A valid ctr_drbg context is now a prerequisite for using dummy_random() Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2022-02-11Ensure context is passed in to dummy_randPaul Elliott1-3/+18
In fuzz_privkey, we switched over to using dummy_rand(), which uses ctr_drbg internally, and thus requires an initialised ctr_drbg_context to be passed in via p_rng when calling mbedtls_pk_parse_key(). Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2022-02-10Ensure ctr_drbg is initialised every timePaul Elliott1-6/+7
ctr_drbg is a local variable and thus needs initialisation every time LLVMFuzzerTestOneInput() is called, the rest of the variables inside the if(initialised) block are all static. Add extra validation to attempt to catch this issue in future. Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2021-12-06Fix builds when config.h only defines MBEDTLS_BIGNUM_CDave Rodgman1-0/+1
Fixes #4929 Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2021-06-28Rename config.h to mbedtls_config.hBence Szépkúti1-1/+1
This commit was generated using the following script: # ======================== #!/bin/sh git ls-files | grep -v '^ChangeLog' | xargs sed -b -E -i ' s/((check|crypto|full|mbedtls|query)_config)\.h/\1\nh/g s/config\.h/mbedtls_config.h/g y/\n/./ ' mv include/mbedtls/config.h include/mbedtls/mbedtls_config.h # ======================== Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2021-06-28Replace all inclusions of config.hBence Szépkúti1-5/+1
Also remove preprocessor logic for MBEDTLS_CONFIG_FILE, since build_info.h alreadyy handles it. This commit was generated using the following script: # ======================== #!/bin/sh git ls-files | grep -v '^include/mbedtls/build_info\.h$' | xargs sed -b -E -i ' /^#if !?defined\(MBEDTLS_CONFIG_FILE\)/i#include "mbedtls/build_info.h" //,/^#endif/d ' # ======================== Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2021-06-22Merge pull request #4664 from tom-daubney-arm/rm_truncated_HMAC_extManuel Pégourié-Gonnard2-6/+0
Remove truncated HMAC extension
2021-06-17Fix cmake build of fuzz_privkeyManuel Pégourié-Gonnard1-1/+1
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-06-17Use the dedicated dummy_random in fuzzing programsManuel Pégourié-Gonnard3-12/+11
Also make sure to initialize the DRBG before using it in fuzz_server (dummy_random uses ctr_drbg internally). Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-06-17Add RNG params to private key parsingManuel Pégourié-Gonnard3-3/+8
This is necessary for the case where the public part of an EC keypair needs to be computed from the private part - either because it was not included (it's an optional component) or because it was compressed (a format we can't parse). This changes the API of two public functions: mbedtls_pk_parse_key() and mbedtls_pk_parse_keyfile(). Tests and programs have been adapted. Some programs use a non-secure RNG (from the test library) just to get things to compile and run; in a future commit this should be improved in order to demonstrate best practice. Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-06-16Removes MBEDTLS_SSL_TRUNCATED_HMAC code from fuzz programsThomas Daubney2-6/+0
Commit removes conditional compilation code blocks dependent on MBEDTLS_SSL_TRUNCATED_HMAC config option. Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2021-05-27Merge branch 'development' into mbedtls_private_with_pythonMateusz Starzyk1-3/+0
Conflicts: include/mbedtls/ssl.h Conflicts resolved by using code from development branch and manually re-applying MBEDTLS_PRIVATE wrapping.
2021-05-24Removal of constants and functions and a new ChangeLog fileTRodziewicz1-3/+0
Signed-off-by: TRodziewicz <tomasz.rodziewicz@mobica.com>
2021-05-21Add MBEDTLS_ALLOW_PRIVATE_ACCESS to test programsMateusz Starzyk9-0/+18
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>