Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Mbed-TLS/mbedtls
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 30e0623c7c9c8019f87e807f59e43259e45c1f11
Choose a base ref
...
head repository: Mbed-TLS/mbedtls
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e5ae132d8742de5fc9548f8c52155031dd4d5dc6
Choose a head ref

Commits on Sep 21, 2022

  1. Add bignum test generation framework

    Adds python script for generation of bignum test cases, with initial
    classes for mpi_cmp_mpi test cases. Build scripts are updated to
    generate test data.
    
    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    545911f View commit details
  2. Add test generation for bignum cmp variant

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    423f99b View commit details
  3. Add test case generation for bignum add

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    5c1173b View commit details
  4. Sort tests when generating cases

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    1c413bd View commit details
  5. Remove set() to preserve test case order

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    1bdee22 View commit details
  6. Fix type issues

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    d76c5ed View commit details
  7. Remove is None from if statement

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    f0910ae View commit details
  8. Fix incorrect indentation

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    92bb1cd View commit details
  9. Separate common test generation classes/functions

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    dcad1e9 View commit details
  10. Remove abbreviations and clarify attributes

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    70d3f3d View commit details
  11. Remove unneeded list concatenation

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    02998c4 View commit details
  12. Convert bools to int before arithmetic

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    1c2a732 View commit details
  13. Add details to docstrings

    Clarification is added to docstrings, mostly in abstract classes.
    
    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    008d90d View commit details
  14. Use ABCMeta for abstract classes

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    47e37b3 View commit details
  15. Split generate_tests to reduce code complexity

    Previous implementation mixed the test case generation and the
    recursive generation calls together. A separate method is added to
    generate test cases for the current class' test function. This reduces
    the need to override generate_tests().
    
    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    c34d037 View commit details
  16. Use __new__() for case counting

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    cace1aa View commit details
  17. Remove trailing whitespace in description

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    6d04142 View commit details
  18. Add missing typing

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    9509f44 View commit details
  19. Use typing casts for fixed-width tuples

    Enforces fixed-width tuple types where mypy does not recognize.
    
    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    478a4ce View commit details
  20. Disable pylint unused arg in __new__

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    486d258 View commit details
  21. Raise NotImplementedError in abstract methods

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    d77d33d View commit details
  22. Fix TARGET types and code style

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    412c497 View commit details
  23. Disable abstract check in pylint

    Version of pylint used in CI does not recognize abstract subclasses of
    BaseTarget, so disable warning in these abstract classes.
    
    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    b29f59f View commit details
  24. Clarify documentation

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    b03420f View commit details
  25. Use argparser default for targets

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    ac86390 View commit details
  26. Fix trailing whitespace

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    6f67bae View commit details
  27. Modify wording in docstrings

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    2b0f7d8 View commit details
  28. Use combinations_with_replacement for inputs

    When generating combinations of values, `itertools.combinations` will
    not allow inputs to be repeated. This is replaced so that cases where
    input values match are generated, i.e. ("0", "0").
    
    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    18f94d8 View commit details
  29. Add dependencies attribute to BaseTarget

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    486b341 View commit details
  30. Use Python 3.5 style typing for dependencies

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    6cc5e5f View commit details
  31. Rework TestGenerator to add file targets

    BaseTarget-derived targets are now added to TestGenerator.targets in
    initialization. This reduces repeated code in generate_xxx_tests.py
    scripts which use this framework.
    
    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    0d07e86 View commit details
  32. Remove unused imports

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    e53be35 View commit details
  33. Use simpler int to hex string conversion

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    3edcee7 View commit details
  34. Move symbol definition out of __init__

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    46c09a6 View commit details
  35. Replace L/R inputs with A/B

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    8b2d14b View commit details
  36. Update comments/docstrings in TestGenerator

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    f518276 View commit details
  37. Add toggle for test case count in descriptions

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    113ddd0 View commit details
  38. Use typing.cast instead of unqualified cast

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    1965d48 View commit details
  39. Add combination_pairs helper function

    Wrapper function for itertools.combinations_with_replacement, with
    explicit cast due to imprecise typing with older versions of mypy.
    
    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    38c2491 View commit details
  40. Update references to file targets in docstrings

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    64334d9 View commit details
  41. Use a script specific description in CLI help

    Previous changes used the docstring of the test_generation module,
    which does not inform a user about the script.
    
    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    4ed94a4 View commit details
  42. Add file generated by generate_bignum_tests.py

    Signed-off-by: Werner Lewis <werner.lewis@arm.com>
    wernerlewis committed Sep 21, 2022
    Copy the full SHA
    05998a0 View commit details

Commits on Oct 4, 2022

  1. Remove incorrect comment

    This comment (which used to be attached to the implementation, and should
    not have been moved to the header file) is incorrect: the library function
    mbedtls_mpi_read_string preserves leading zeros as desired, but does not
    create a zero-limb object for an empty string.
    
    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Oct 4, 2022
    Copy the full SHA
    9538c90 View commit details
  2. Allow test assertions on constant-flow scalar data

    When testing a function that is supposed to be constant-flow, we declare the
    inputs as constant-flow secrets with TEST_CF_SECRET. The result of such a
    function is itself a constant-flow secret, so it can't be tested with
    comparison operators.
    
    In TEST_EQUAL, TEST_LE_U and TEST_LE_S, declare the values to be compared as
    public. This way, test code doesn't need to explicitly declare results as
    public if they're only used by one of these macros.
    
    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Oct 4, 2022
    Copy the full SHA
    7db8e89 View commit details
  3. Move the definition of data_t to a header file

    This way it can be used in helper functions.
    
    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Oct 4, 2022
    Copy the full SHA
    34cb462 View commit details
  4. Replace the output file atomically

    When writing the new .data file, first write the new content, then replace
    the target. This way, there isn't a temporary state in which the file is
    partially written. This temporary state can be misleading if the build is
    interrupted. It's annoying if you're watching changes to the output and the
    changes appear as emptying the file following by the new version appearing.
    Now interrupted builds don't leave a file that appears to be up to date but
    isn't, and when watching the output, there's a single transition to the new
    version.
    
    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Oct 4, 2022
    Copy the full SHA
    eca29e4 View commit details

Commits on Oct 5, 2022

  1. Include platform.h unconditionally: automatic part

    We used to include platform.h only when MBEDTLS_PLATFORM_C was enabled, and
    to define ad hoc replacements for mbedtls_xxx functions on a case-by-case
    basis when MBEDTLS_PLATFORM_C was disabled. The only reason for this
    complication was to allow building individual source modules without copying
    platform.h. This is not something we support or recommend anymore, so get
    rid of the complication: include platform.h unconditionally.
    
    There should be no change in behavior since just including the header should
    not change the behavior of a program.
    
    This commit replaces most occurrences of conditional inclusion of
    platform.h, using the following code:
    
    ```
    perl -i -0777 -pe 's!#if.*\n#include "mbedtls/platform.h"\n(#else.*\n(#define (mbedtls|MBEDTLS)_.*\n|#include <(stdarg|stddef|stdio|stdlib|string|time)\.h>\n)*)?#endif.*!#include "mbedtls/platform.h"!mg' $(git grep -l '#include "mbedtls/platform.h"')
    ```
    
    Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
    gilles-peskine-arm committed Oct 5, 2022
    Copy the full SHA
    36f19b9 View commit details
  2. Add test components for tls 1.2 builds with single encryption type

    Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
    mprse committed Oct 5, 2022
    Copy the full SHA
    e535270 View commit details
  3. Fix guards for mbedtls_ct_size_mask() and mbedtls_ct_memcpy_if_eq()

    Both functions are used when MBEDTLS_SSL_SOME_SUITES_USE_MAC is defined not MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC.
    
    Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
    mprse committed Oct 5, 2022
    Copy the full SHA
    9450dc7 View commit details
  4. Fix configuration requirements(MBEDTLS_SSL_CONTEXT_SERIALIZATION, MBE…

    …DTLS_SSL_SESSION_TICKETS)
    
    Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
    mprse committed Oct 5, 2022
    Copy the full SHA
    864b43d View commit details
Showing with 1,242 additions and 1,102 deletions.
  1. +0 −5 3rdparty/everest/library/everest.c
  2. +3 −3 CONTRIBUTING.md
  3. +3 −0 ChangeLog.d/fix_aead_psa_driver_build.txt
  4. +4 −0 ChangeLog.d/fix_build_tls1_2_with_single_encryption_type.txt
  5. +3 −0 ChangeLog.d/platform-setbuf.txt
  6. +8 −6 README.md
  7. +3 −2 SUPPORT.md
  8. +1 −1 docs/architecture/testing/test-framework.md
  9. +23 −0 include/mbedtls/check_config.h
  10. +7 −4 include/mbedtls/config.h
  11. +7 −0 include/mbedtls/platform.h
  12. +1 −1 include/mbedtls/ssl.h
  13. +6 −0 include/psa/crypto_builtin_composites.h
  14. +0 −7 library/aes.c
  15. +0 −7 library/arc4.c
  16. +0 −7 library/aria.c
  17. +0 −6 library/asn1parse.c
  18. +0 −6 library/asn1write.c
  19. +0 −5 library/base64.c
  20. +0 −8 library/bignum.c
  21. +0 −7 library/camellia.c
  22. +0 −7 library/ccm.c
  23. +0 −7 library/chacha20.c
  24. +0 −7 library/chachapoly.c
  25. +0 −5 library/cipher.c
  26. +0 −6 library/cipher_wrap.c
  27. +4 −5 library/constant_time.c
  28. +2 −3 library/constant_time_internal.h
  29. +0 −7 library/ctr_drbg.c
  30. +0 −9 library/debug.c
  31. +0 −7 library/des.c
  32. +0 −8 library/dhm.c
  33. +0 −6 library/ecdsa.c
  34. +0 −5 library/ecjpake.c
  35. +0 −8 library/ecp.c
  36. +0 −9 library/entropy.c
  37. +0 −2 library/entropy_poll.c
  38. +0 −4 library/error.c
  39. +1 −9 library/gcm.c
  40. +0 −7 library/hmac_drbg.c
  41. +0 −6 library/md.c
  42. +0 −7 library/md2.c
  43. +0 −7 library/md4.c
  44. +0 −7 library/md5.c
  45. +0 −6 library/mps_trace.h
  46. +0 −4 library/net_sockets.c
  47. +0 −7 library/nist_kw.c
  48. +0 −4 library/oid.c
  49. +0 −6 library/pem.c
  50. +0 −6 library/pk_wrap.c
  51. +0 −6 library/pkcs11.c
  52. +0 −5 library/pkcs5.c
  53. +0 −6 library/pkparse.c
  54. +0 −6 library/pkwrite.c
  55. +0 −7 library/poly1305.c
  56. +0 −4 library/psa_crypto.c
  57. +0 −4 library/psa_crypto_client.c
  58. +0 −4 library/psa_crypto_ecp.c
  59. +0 −4 library/psa_crypto_rsa.c
  60. +0 −4 library/psa_crypto_se.c
  61. +0 −5 library/psa_crypto_slot_management.c
  62. +0 −6 library/psa_crypto_storage.c
  63. +0 −4 library/psa_its_file.c
  64. +0 −7 library/ripemd160.c
  65. +0 −7 library/rsa.c
  66. +0 −7 library/sha1.c
  67. +0 −10 library/sha256.c
  68. +0 −10 library/sha512.c
  69. +0 −6 library/ssl_cache.c
  70. +0 −4 library/ssl_ciphersuites.c
  71. +0 −6 library/ssl_cli.c
  72. +0 −5 library/ssl_cookie.c
  73. +0 −6 library/ssl_msg.c
  74. +0 −6 library/ssl_srv.c
  75. +0 −6 library/ssl_ticket.c
  76. +0 −6 library/ssl_tls.c
  77. +0 −5 library/timing.c
  78. +0 −9 library/x509.c
  79. +0 −8 library/x509_crl.c
  80. +0 −8 library/x509_crt.c
  81. +0 −8 library/x509_csr.c
  82. +0 −6 library/x509write_csr.c
  83. +0 −7 library/xtea.c
  84. +0 −10 programs/aes/crypt_and_hash.c
  85. +4 −4 programs/fuzz/fuzz_server.c
  86. +0 −10 programs/hash/generic_sum.c
  87. +0 −9 programs/hash/hello.c
  88. +0 −10 programs/pkey/dh_client.c
  89. +0 −10 programs/pkey/dh_genprime.c
  90. +0 −10 programs/pkey/dh_server.c
  91. +0 −9 programs/pkey/ecdh_curve25519.c
  92. +0 −9 programs/pkey/ecdsa.c
  93. +0 −9 programs/pkey/gen_key.c
  94. +0 −9 programs/pkey/key_app.c
  95. +0 −9 programs/pkey/key_app_writer.c
  96. +0 −9 programs/pkey/mpi_demo.c
  97. +0 −9 programs/pkey/pk_decrypt.c
  98. +0 −10 programs/pkey/pk_encrypt.c
  99. +0 −10 programs/pkey/pk_sign.c
  100. +0 −10 programs/pkey/pk_verify.c
  101. +0 −9 programs/pkey/rsa_decrypt.c
  102. +0 −10 programs/pkey/rsa_encrypt.c
  103. +0 −9 programs/pkey/rsa_genkey.c
  104. +0 −11 programs/pkey/rsa_sign.c
  105. +0 −10 programs/pkey/rsa_sign_pss.c
  106. +0 −10 programs/pkey/rsa_verify.c
  107. +0 −10 programs/pkey/rsa_verify_pss.c
  108. +0 −10 programs/random/gen_entropy.c
  109. +0 −10 programs/random/gen_random_ctr_drbg.c
  110. +0 −10 programs/random/gen_random_havege.c
  111. +0 −10 programs/ssl/dtls_client.c
  112. +0 −11 programs/ssl/dtls_server.c
  113. +0 −9 programs/ssl/mini_client.c
  114. +0 −12 programs/ssl/ssl_client1.c
  115. +0 −11 programs/ssl/ssl_fork_server.c
  116. +0 −12 programs/ssl/ssl_mail_client.c
  117. +0 −11 programs/ssl/ssl_pthread_server.c
  118. +0 −12 programs/ssl/ssl_server.c
  119. +6 −6 programs/ssl/ssl_server2.c
  120. +0 −15 programs/ssl/ssl_test_lib.h
  121. +0 −7 programs/test/benchmark.c
  122. +0 −10 programs/test/cmake_subproject/cmake_subproject.c
  123. +0 −10 programs/test/dlopen.c
  124. +0 −7 programs/test/query_compile_time_config.c
  125. +0 −5 programs/test/query_config.c
  126. +0 −12 programs/test/selftest.c
  127. +0 −8 programs/test/zeroize.c
  128. +0 −11 programs/util/pem2der.c
  129. +0 −7 programs/util/strerror.c
  130. +0 −12 programs/x509/cert_app.c
  131. +0 −9 programs/x509/cert_req.c
  132. +0 −9 programs/x509/cert_write.c
  133. +0 −9 programs/x509/crl_app.c
  134. +0 −12 programs/x509/load_roots.c
  135. +0 −9 programs/x509/req_app.c
  136. +3 −0 scripts/config.py
  137. +0 −4 scripts/data_files/error.fmt
  138. +0 −5 scripts/data_files/query_config.fmt
  139. +3 −1 scripts/mbedtls_dev/test_case.py
  140. +204 −0 scripts/mbedtls_dev/test_generation.py
  141. +1 −0 tests/include/test/drivers/config_test_driver.h
  142. +16 −2 tests/include/test/drivers/crypto_config_test_driver_extension.h
  143. +7 −14 tests/include/test/helpers.h
  144. +0 −13 tests/include/test/macros.h
  145. +194 −0 tests/scripts/all.sh
  146. +1 −0 tests/scripts/check-generated-files.sh
  147. +238 −0 tests/scripts/generate_bignum_tests.py
  148. +12 −61 tests/scripts/generate_psa_tests.py
  149. +9 −4 tests/scripts/run-test-suites.pl
  150. +60 −2 tests/src/drivers/test_driver_aead.c
  151. +13 −0 tests/src/helpers.c
  152. +1 −0 tests/ssl-opt.sh
  153. +0 −20 tests/suites/helpers.function
  154. +1 −1 tests/suites/test_suite_asn1parse.function
  155. +0 −3 tests/suites/test_suite_cipher.function
  156. +3 −3 tests/suites/test_suite_cmac.data
  157. +381 −0 tests/suites/test_suite_mpi.generated.data
  158. +9 −10 tests/suites/test_suite_pkcs12.function
5 changes: 0 additions & 5 deletions 3rdparty/everest/library/everest.c
Original file line number Diff line number Diff line change
@@ -28,12 +28,7 @@
#include "everest/x25519.h"
#include "everest/everest.h"

#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
#else
#define mbedtls_calloc calloc
#define mbedtls_free free
#endif

#if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED)

6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ We gratefully accept bug reports and contributions from the community. There are

Coding Standards
----------------
- We would ask that contributions conform to [our coding standards](https://tls.mbed.org/kb/development/mbedtls-coding-standards), and that contributions are fully tested before submission, as mentioned in the [Tests](#tests) and [Continuous Integration](#continuous-integration-tests) sections.
- We would ask that contributions conform to [our coding standards](https://mbed-tls.readthedocs.io/en/latest/kb/development/mbedtls-coding-standards/), and that contributions are fully tested before submission, as mentioned in the [Tests](#tests) and [Continuous Integration](#continuous-integration-tests) sections.
- The code should be written in a clean and readable style.
- The code should be written in a portable generic way, that will benefit the whole community, and not only your own needs.
- The code should be secure, and will be reviewed from a security point of view as well.
@@ -56,7 +56,7 @@ As mentioned, tests that show the correctness of the feature or bug fix should b

Mbed TLS includes a comprehensive set of test suites in the `tests/` directory that are dynamically generated to produce the actual test source files (e.g. `test_suite_mpi.c`). These files are generated from a `function file` (e.g. `suites/test_suite_mpi.function`) and a `data file` (e.g. `suites/test_suite_mpi.data`). The function file contains the test functions. The data file contains the test cases, specified as parameters that will be passed to the test function.

[A Knowledge Base article describing how to add additional tests is available on the Mbed TLS website](https://tls.mbed.org/kb/development/test_suites).
[A Knowledge Base article describing how to add additional tests is available on the Mbed TLS website](https://mbed-tls.readthedocs.io/en/latest/kb/development/test_suites/).

A test script `tests/scripts/basic-build-test.sh` is available to show test coverage of the library. New code contributions should provide a similar level of code coverage to that which already exists for the library.

@@ -75,7 +75,7 @@ Mbed TLS is well documented, but if you think documentation is needed, speak out
1. All interfaces should be documented through Doxygen. New APIs should introduce Doxygen documentation.
1. Complex parts in the code should include comments.
1. If needed, a Readme file is advised.
1. If a [Knowledge Base (KB)](https://tls.mbed.org/kb) article should be added, write this as a comment in the PR description.
1. If a [Knowledge Base (KB)](https://mbed-tls.readthedocs.io/en/latest/kb/) article should be added, write this as a comment in the PR description.
1. A [ChangeLog](https://github.com/Mbed-TLS/mbedtls/blob/development/ChangeLog.d/00README.md) entry should be added for this contribution.

License and Copyright
3 changes: 3 additions & 0 deletions ChangeLog.d/fix_aead_psa_driver_build.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Bugfix
* Fix compilation errors when trying to build with
PSA drivers for AEAD (GCM, CCM, Chacha20-Poly1305).
4 changes: 4 additions & 0 deletions ChangeLog.d/fix_build_tls1_2_with_single_encryption_type.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Bugfix
* Fix bugs and missing dependencies when
building and testing configurations with
only one encryption type enabled in TLS 1.2.
3 changes: 3 additions & 0 deletions ChangeLog.d/platform-setbuf.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Bugfix
* Provide the missing definition of mbedtls_setbuf() in some configurations
with MBEDTLS_PLATFORM_C disabled. Fixes #6118, #6196.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -17,7 +17,9 @@ We provide some non-standard configurations focused on specific use cases in the
Documentation
-------------

Documentation for the Mbed TLS interfaces in the default library configuration is available as part of the [Mbed TLS documentation](https://tls.mbed.org/api/).
The main Mbed TLS documentation is available via [ReadTheDocs](https://mbed-tls.readthedocs.io/).

Documentation for the PSA Cryptography API is available [on GitHub](https://armmbed.github.io/mbed-crypto/psa/#application-programming-interface).

To generate a local copy of the library documentation in HTML format, tailored to your compile-time configuration:

@@ -77,9 +79,9 @@ Setting the variable `SHARED` in your environment will build shared libraries in

Please note that setting `CFLAGS` overrides its default value of `-O2` and setting `WARNING_CFLAGS` overrides its default value (starting with `-Wall -Wextra`), so if you just want to add some warning options to the default ones, you can do so by setting `CFLAGS=-O2 -Werror` for example. Setting `WARNING_CFLAGS` is useful when you want to get rid of its default content (for example because your compiler doesn't accept `-Wall` as an option). Directory-specific options cannot be overridden from the command line.

Depending on your platform, you might run into some issues. Please check the Makefiles in `library/`, `programs/` and `tests/` for options to manually add or remove for specific platforms. You can also check [the Mbed TLS Knowledge Base](https://tls.mbed.org/kb) for articles on your platform or issue.
Depending on your platform, you might run into some issues. Please check the Makefiles in `library/`, `programs/` and `tests/` for options to manually add or remove for specific platforms. You can also check [the Mbed TLS Knowledge Base](https://mbed-tls.readthedocs.io/en/latest/kb/) for articles on your platform or issue.

In case you find that you need to do something else as well, please let us know what, so we can add it to the [Mbed TLS Knowledge Base](https://tls.mbed.org/kb).
In case you find that you need to do something else as well, please let us know what, so we can add it to the [Mbed TLS Knowledge Base](https://mbed-tls.readthedocs.io/en/latest/kb/).

### CMake

@@ -193,9 +195,9 @@ Porting Mbed TLS

Mbed TLS can be ported to many different architectures, OS's and platforms. Before starting a port, you may find the following Knowledge Base articles useful:

- [Porting Mbed TLS to a new environment or OS](https://tls.mbed.org/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS)
- [What external dependencies does Mbed TLS rely on?](https://tls.mbed.org/kb/development/what-external-dependencies-does-mbedtls-rely-on)
- [How do I configure Mbed TLS](https://tls.mbed.org/kb/compiling-and-building/how-do-i-configure-mbedtls)
- [Porting Mbed TLS to a new environment or OS](https://mbed-tls.readthedocs.io/en/latest/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS/)
- [What external dependencies does Mbed TLS rely on?](https://mbed-tls.readthedocs.io/en/latest/kb/development/what-external-dependencies-does-mbedtls-rely-on/)
- [How do I configure Mbed TLS](https://mbed-tls.readthedocs.io/en/latest/kb/compiling-and-building/how-do-i-configure-mbedtls/)

Mbed TLS is mostly written in portable C99; however, it has a few platform requirements that go beyond the standard, but are met by most modern architectures:

5 changes: 3 additions & 2 deletions SUPPORT.md
Original file line number Diff line number Diff line change
@@ -2,10 +2,11 @@

Here are some useful sources of information about using Mbed TLS:

- [ReadTheDocs](https://mbed-tls.readthedocs.io/);
- API documentation, see the [Documentation section of the
README](README.md#License);
README](README.md#documentation);
- the `docs` directory in the source tree;
- the [Mbed TLS knowledge Base](https://tls.mbed.org/kb);
- the [Mbed TLS Knowledge Base](https://mbed-tls.readthedocs.io/en/latest/kb/);
- the [Mbed TLS mailing-list
archives](https://lists.trustedfirmware.org/archives/list/mbed-tls@lists.trustedfirmware.org/).

2 changes: 1 addition & 1 deletion docs/architecture/testing/test-framework.md
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ This document is incomplete. You can help by expanding it.

## Unit tests

See <https://tls.mbed.org/kb/development/test_suites>
See <https://mbed-tls.readthedocs.io/en/latest/kb/development/test_suites>

### Unit test descriptions

23 changes: 23 additions & 0 deletions include/mbedtls/check_config.h
Original file line number Diff line number Diff line change
@@ -525,6 +525,20 @@
#error "MBEDTLS_PLATFORM_SNPRINTF_MACRO and MBEDTLS_PLATFORM_STD_SNPRINTF/MBEDTLS_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously"
#endif

#if defined(MBEDTLS_PLATFORM_VSNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
#error "MBEDTLS_PLATFORM_VSNPRINTF_ALT defined, but not all prerequisites"
#endif

#if defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
#error "MBEDTLS_PLATFORM_VSNPRINTF_MACRO defined, but not all prerequisites"
#endif

#if defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO) &&\
( defined(MBEDTLS_PLATFORM_STD_VSNPRINTF) ||\
defined(MBEDTLS_PLATFORM_VSNPRINTF_ALT) )
#error "MBEDTLS_PLATFORM_VSNPRINTF_MACRO and MBEDTLS_PLATFORM_STD_VSNPRINTF/MBEDTLS_PLATFORM_VSNPRINTF_ALT cannot be defined simultaneously"
#endif

#if defined(MBEDTLS_PLATFORM_STD_MEM_HDR) &&\
!defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
#error "MBEDTLS_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
@@ -812,6 +826,11 @@
#error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
#endif

#if defined(MBEDTLS_SSL_TICKET_C) && \
!( defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CCM_C) || defined(MBEDTLS_CHACHAPOLY_C) )
#error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
#endif

#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING) && \
!defined(MBEDTLS_SSL_PROTO_SSL3) && !defined(MBEDTLS_SSL_PROTO_TLS1)
#error "MBEDTLS_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
@@ -926,6 +945,10 @@
#error "MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH defined, but not all prerequisites"
#endif

#if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION) && !( defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CCM_C) || defined(MBEDTLS_CHACHAPOLY_C) )
#error "MBEDTLS_SSL_CONTEXT_SERIALIZATION defined, but not all prerequisites"
#endif

/*
* Avoid warning from -pedantic. This is a convenient place for this
* workaround since this is included by every single file before the
11 changes: 7 additions & 4 deletions include/mbedtls/config.h
Original file line number Diff line number Diff line change
@@ -1620,6 +1620,8 @@
* saved after the handshake to allow for more efficient serialization, so if
* you don't need this feature you'll save RAM by disabling it.
*
* Requires: MBEDTLS_GCM_C or MBEDTLS_CCM_C or MBEDTLS_CHACHAPOLY_C
*
* Comment to disable the context serialization APIs.
*/
#define MBEDTLS_SSL_CONTEXT_SERIALIZATION
@@ -3030,7 +3032,7 @@
*
* \note See also our Knowledge Base article about porting to a new
* environment:
* https://tls.mbed.org/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS
* https://mbed-tls.readthedocs.io/en/latest/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS
*
* Module: library/net_sockets.c
*
@@ -3400,7 +3402,8 @@
* Module: library/ssl_ticket.c
* Caller:
*
* Requires: MBEDTLS_CIPHER_C
* Requires: MBEDTLS_CIPHER_C &&
* ( MBEDTLS_GCM_C || MBEDTLS_CCM_C || MBEDTLS_CHACHAPOLY_C )
*/
#define MBEDTLS_SSL_TICKET_C

@@ -3456,7 +3459,7 @@
* contexts are not shared between threads. If you do intend to use contexts
* between threads, you will need to enable this layer to prevent race
* conditions. See also our Knowledge Base article about threading:
* https://tls.mbed.org/kb/development/thread-safety-and-multi-threading
* https://mbed-tls.readthedocs.io/en/latest/kb/development/thread-safety-and-multi-threading
*
* Module: library/threading.c
*
@@ -3488,7 +3491,7 @@
*
* \note See also our Knowledge Base article about porting to a new
* environment:
* https://tls.mbed.org/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS
* https://mbed-tls.readthedocs.io/en/latest/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS
*
* Module: library/timing.c
* Caller: library/havege.c
7 changes: 7 additions & 0 deletions include/mbedtls/platform.h
Original file line number Diff line number Diff line change
@@ -11,6 +11,13 @@
* implementations of these functions, or implementations specific to
* their platform, which can be statically linked to the library or
* dynamically configured at runtime.
*
* When all compilation options related to platform abstraction are
* disabled, this header just defines `mbedtls_xxx` function names
* as aliases to the standard `xxx` function.
*
* Most modules in the library and example programs are expected to
* include this header.
*/
/*
* Copyright The Mbed TLS Contributors
2 changes: 1 addition & 1 deletion include/mbedtls/ssl.h
Original file line number Diff line number Diff line change
@@ -2000,7 +2000,7 @@ int mbedtls_ssl_check_record( mbedtls_ssl_context const *ssl,
* here, except if using an event-driven style.
*
* \note See also the "DTLS tutorial" article in our knowledge base.
* https://tls.mbed.org/kb/how-to/dtls-tutorial
* https://mbed-tls.readthedocs.io/en/latest/kb/how-to/dtls-tutorial
*/
void mbedtls_ssl_set_timer_cb( mbedtls_ssl_context *ssl,
void *p_timer,
6 changes: 6 additions & 0 deletions include/psa/crypto_builtin_composites.h
Original file line number Diff line number Diff line change
@@ -43,6 +43,12 @@
#define MBEDTLS_PSA_BUILTIN_MAC
#endif

#if defined(MBEDTLS_PSA_BUILTIN_ALG_GCM) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_CCM) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_CHACHA20_POLY1305)
#define MBEDTLS_PSA_BUILTIN_AEAD 1
#endif

#if defined(MBEDTLS_PSA_BUILTIN_ALG_HMAC) || defined(PSA_CRYPTO_DRIVER_TEST)
typedef struct
{
7 changes: 0 additions & 7 deletions library/aes.c
Original file line number Diff line number Diff line change
@@ -40,14 +40,7 @@
#include "mbedtls/aesni.h"
#endif

#if defined(MBEDTLS_SELF_TEST)
#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
#else
#include <stdio.h>
#define mbedtls_printf printf
#endif /* MBEDTLS_PLATFORM_C */
#endif /* MBEDTLS_SELF_TEST */

#if !defined(MBEDTLS_AES_ALT)

7 changes: 0 additions & 7 deletions library/arc4.c
Original file line number Diff line number Diff line change
@@ -31,14 +31,7 @@

#include <string.h>

#if defined(MBEDTLS_SELF_TEST)
#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
#else
#include <stdio.h>
#define mbedtls_printf printf
#endif /* MBEDTLS_PLATFORM_C */
#endif /* MBEDTLS_SELF_TEST */

#if !defined(MBEDTLS_ARC4_ALT)

7 changes: 0 additions & 7 deletions library/aria.c
Original file line number Diff line number Diff line change
@@ -31,14 +31,7 @@

#include <string.h>

#if defined(MBEDTLS_SELF_TEST)
#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
#else
#include <stdio.h>
#define mbedtls_printf printf
#endif /* MBEDTLS_PLATFORM_C */
#endif /* MBEDTLS_SELF_TEST */

#if !defined(MBEDTLS_ARIA_ALT)

6 changes: 0 additions & 6 deletions library/asn1parse.c
Original file line number Diff line number Diff line change
@@ -31,13 +31,7 @@
#include "mbedtls/bignum.h"
#endif

#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
#else
#include <stdlib.h>
#define mbedtls_calloc calloc
#define mbedtls_free free
#endif

/*
* ASN.1 DER decoding routines
6 changes: 0 additions & 6 deletions library/asn1write.c
Original file line number Diff line number Diff line change
@@ -26,13 +26,7 @@

#include <string.h>

#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
#else
#include <stdlib.h>
#define mbedtls_calloc calloc
#define mbedtls_free free
#endif

int mbedtls_asn1_write_len( unsigned char **p, unsigned char *start, size_t len )
{
5 changes: 0 additions & 5 deletions library/base64.c
Original file line number Diff line number Diff line change
@@ -28,12 +28,7 @@

#if defined(MBEDTLS_SELF_TEST)
#include <string.h>
#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
#else
#include <stdio.h>
#define mbedtls_printf printf
#endif /* MBEDTLS_PLATFORM_C */
#endif /* MBEDTLS_SELF_TEST */

#define BASE64_SIZE_T_MAX ( (size_t) -1 ) /* SIZE_T_MAX is not standard */
8 changes: 0 additions & 8 deletions library/bignum.c
Original file line number Diff line number Diff line change
@@ -46,15 +46,7 @@
#include <limits.h>
#include <string.h>

#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
#else
#include <stdio.h>
#include <stdlib.h>
#define mbedtls_printf printf
#define mbedtls_calloc calloc
#define mbedtls_free free
#endif

#define MPI_VALIDATE_RET( cond ) \
MBEDTLS_INTERNAL_VALIDATE_RET( cond, MBEDTLS_ERR_MPI_BAD_INPUT_DATA )
7 changes: 0 additions & 7 deletions library/camellia.c
Original file line number Diff line number Diff line change
@@ -32,14 +32,7 @@

#include <string.h>

#if defined(MBEDTLS_SELF_TEST)
#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
#else
#include <stdio.h>
#define mbedtls_printf printf
#endif /* MBEDTLS_PLATFORM_C */
#endif /* MBEDTLS_SELF_TEST */

#if !defined(MBEDTLS_CAMELLIA_ALT)

7 changes: 0 additions & 7 deletions library/ccm.c
Original file line number Diff line number Diff line change
@@ -36,14 +36,7 @@

#include <string.h>

#if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_AES_C)
#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
#else
#include <stdio.h>
#define mbedtls_printf printf
#endif /* MBEDTLS_PLATFORM_C */
#endif /* MBEDTLS_SELF_TEST && MBEDTLS_AES_C */

#if !defined(MBEDTLS_CCM_ALT)

7 changes: 0 additions & 7 deletions library/chacha20.c
Original file line number Diff line number Diff line change
@@ -32,14 +32,7 @@
#include <stddef.h>
#include <string.h>

#if defined(MBEDTLS_SELF_TEST)
#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
#else
#include <stdio.h>
#define mbedtls_printf printf
#endif /* MBEDTLS_PLATFORM_C */
#endif /* MBEDTLS_SELF_TEST */

#if !defined(MBEDTLS_CHACHA20_ALT)

7 changes: 0 additions & 7 deletions library/chachapoly.c
Original file line number Diff line number Diff line change
@@ -28,14 +28,7 @@

#include <string.h>

#if defined(MBEDTLS_SELF_TEST)
#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
#else
#include <stdio.h>
#define mbedtls_printf printf
#endif /* MBEDTLS_PLATFORM_C */
#endif /* MBEDTLS_SELF_TEST */

#if !defined(MBEDTLS_CHACHAPOLY_ALT)

Loading